chore: refactor validate_against_state_and_deduct_caller#2991
chore: refactor validate_against_state_and_deduct_caller#2991
Conversation
CodSpeed Performance ReportMerging #2991 will degrade performances by 3.18%Comparing Summary
Benchmarks breakdown
|
|
|
||
| // journal the change | ||
| journal.caller_accounting_journal_entry(tx.caller(), old_balance, tx.kind().is_call()); | ||
|
|
|
|
||
| // Touch account so we know it is changed. | ||
| caller_account.mark_touch(); | ||
| let new_balance = deduct_caller_balance_with_components(account_balance, tx, block, cfg)?; |
There was a problem hiding this comment.
All max and effective balance deduction and checks are wrapped inside this function
|
|
||
| if tx.kind().is_call() { | ||
| caller_account.info.nonce = caller_account.info.nonce.saturating_add(1); | ||
| } |
There was a problem hiding this comment.
Touching of account and nonce bumps are now inside caller_touch_and_change
| let is_nonce_check_disabled = context.cfg().is_nonce_check_disabled(); | ||
| let caller = context.tx().caller(); | ||
| let value = context.tx().value(); | ||
| let (tx, block, cfg, journal) = evm.ctx_mut().tx_block_cfg_journal_mut(); |
There was a problem hiding this comment.
No need for temp fields, and we can use tx_block_cfg_journal_mut to get all needed context objects.
mattsse
left a comment
There was a problem hiding this comment.
perhaps we can do this in smaller chunks, e.g. especially the balance functions can be introduced as standalone prs
this includes a lot of op changes as well
| // If the transaction is not a deposit transaction, subtract the L1 data fee from the | ||
| // caller's balance directly after minting the requested amount of ETH. | ||
| // Additionally deduct the operator fee from the caller's account. | ||
| // | ||
| // In case of deposit additional cost will be zero. |
There was a problem hiding this comment.
I feel like this is useful context, that we now no longer have?
There was a problem hiding this comment.
This comment became obsolete, as flows for deposit and ordinary transactions are now split for clarity.
And it is not fully correct, mint is only available for deposit transactions. And a deposit transaction does not have additional fee (l1 cost and operator fee)
Would assume the intention for this is to mint first, then to deduct the effective gas.
|
last PR to chunk all changes is here #3069 All of rest are merged |
closes #2983