-
Notifications
You must be signed in to change notification settings - Fork 809
chore: refactor validate_against_state_and_deduct_caller #2991
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
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()); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
||
// 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need for temp fields, and we can use tx_block_cfg_journal_mut
to get all needed context objects.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel like this is useful context, that we now no longer have?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
closes #2983