Skip to content

fix(anvil): remove override for block.basefee when building transaction env #8517

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

Merged
merged 6 commits into from
Jul 25, 2024

Conversation

jakim929
Copy link
Contributor

@jakim929 jakim929 commented Jul 24, 2024

Motivation

closes #8516

when calling eth_estimateGas, the max_fee_per_gas parameter included in the tx ends up overwriting the block.basefee. This makes it harder to estimate gas for contracts that rely on the value of block.basefee.

Solution

remove the override for block.basefee from fee_details.max_fee_per_gas. If an override is necessary, maybe we can directly override the blockEnv.block before passing to build_call_env.

explicitly disables basefee check when setting up the env for calls (used for eth_estimateGas, eth_createAccessList, eth_call, and tracing)

@jakim929
Copy link
Contributor Author

seeing some tests fail - will update!

Copy link
Member

@mattsse mattsse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think what's missing here is disabling the basefee check like

https://github.com/paradigmxyz/reth/blob/d395df29fcffbc742cd3e819772cc32271ec2d21/crates/rpc/rpc-eth-api/src/helpers/call.rs#L901-L904

here:

// we want to disable this in eth_call, since this is common practice used by other node
// impls and providers <https://github.com/foundry-rs/foundry/issues/4388>
env.cfg.disable_block_gas_limit = true;

@mattsse mattsse merged commit 4845380 into foundry-rs:master Jul 25, 2024
20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

bug(anvil): eth_estimateGas max_fee_per_gas overrides the block.basefee when simulating a transaction
2 participants