1

I've been trying to find out more about where and when exactly fees are deducted. ie) it seems that here in the process of sanitizing txs (post sigverify, dedup) that there is an initial fee deduction happening in check_fee_payer_unlocked specifically in a call to validate_fee_payer here:

    payer_account
        .lamports()
        .checked_sub(min_balance)
        .and_then(|v| v.checked_sub(fee))
        .ok_or_else(|| {
            error_metrics.insufficient_funds += 1;
            TransactionError::InsufficientFundsForFee
        })?;

But in filter_program_errors_and_collect_fee in the bank it seems that fees are deducted in commit_transactions with the execution output?

But does that mean if a transaction uses LESS CUs than expected (calculated internally by the validator themselves), that the excess is NOT returned to users (unlike in ETH say for example where a failed tx's remaining gas limit is returned)

Also when CREATING the block, is CU requested used (ie. for the 12m / writable account limit) or would it be the CU used?

1 Answer 1

2

The first call is only checking that the account has enough lamports to pay for the fee, but not actually propagating the change to subtract the fee from the account.

Changes aren't actually propagated until commit_transactions in the bank.

Separately, if a transaction uses LESS CUs than paid for, the fee payer is still charged the full amount. This helps the validator prioritize transactions since they know exactly how much they'll earn in priority fees.

However, while packing the block, the validator will count the ACTUAL CUs used, and not the requested amount. This allows the validator to maximize the number of transactions in the block.

2
  • Does the scheduler use the fee requested to order the prio-graph? Commented Aug 25 at 5:06
  • Yes, that's the idea. Note that the ordering is not enforced by consensus, however. So if I'm the leader and I create a block that reverses priority, it won't be rejected by the network.
    – Jon C
    Commented Aug 26 at 11:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.