-
Notifications
You must be signed in to change notification settings - Fork 2.3k
refactor(anvil): use alloy's effective_gas_price in Backend::mined_transaction_receipt
#12639
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
refactor(anvil): use alloy's effective_gas_price in Backend::mined_transaction_receipt
#12639
Conversation
…_transaction_receipt`
|
I think we need to update the failing transaction_receipt test |
| .saturating_add(t.tx().max_priority_fee_per_gas), | ||
| TypedTransaction::Deposit(_) => 0_u128, | ||
| }; | ||
| let effective_gas_price = transaction.effective_gas_price(block.header.base_fee_per_gas); |
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.
Imo using block.header.base_fee_per_gas as base fee arg is okay and non-breaking, despite self.base_fee() not being used anymore
Indeed after careful review of the blocks init/mining logic, I've not found any scenario where block.header.base_fee_per_gas could be None at this point. Which would mean that in the previous implementation we never had a fallback to the default value self.base_fee() (giving always base_fee_per_gas + max_priority_fee_per_gas for TXs >= eip1559).
So Alloy's impl would "more correct", I guess.
Let me know, if you think i'm wrong.
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.
If my observation is correct, we could improve robustness by making base_fee non-optional in block header ?
Motivation
#12406 follow-up
Clean up the Anvil codebase by removing custom implementations that are no longer needed.
Solution
effective_gas_priceimpl w/ alloy'sTransactiontrait fnPR Checklist
effective_gas_priceinBackend::mined_transaction_receipt#12639 (comment))