Some extrinsics allow fees to not be paid if they execute properly (Ex: council.vote
if it is the first vote of that account on the given proposal).
What happens when those extrinsics are included inside a utility.batch
or utility.batchAll
?
Substrate and Polkadot Stack Exchange is a question and answer site for developers building blockchains with the Substrate SDK. It only takes a minute to sign up.
Sign up to join this communitySaying that "fees are not paid" is not a fully accurate statement of what is happening for things like council.vote
.
What is actually happening is that at the beginning of the transaction, you are charged a fee assuming the worst case scenario. If we detect you are a first time voter, we refund all of the fee back to the user at the end of the call.
Unfortunately, the batch
and batch_all
calls are not clever enough to support knowing to refund just part of the fees of the call. Either all the fees are paid, or none of them are.
Additional abstractions and code in the runtime could support this, but, the increased complexity probably won't be worth it at the moment.
Yes you will also need to pay for these transactions inside utility.batch
or utility.batchAll
. However, you also don't pay for each transaction separately, you pay for all of them directly together. The only thing that happens is that if a transaction returns a post weight, that will be taken into account to reduce the overall fee that will be deducted from the sender.