-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
fix: #8759, default (low) gas limit set even when disabled, use custom gas_limit on forks #8933
Conversation
@@ -1171,9 +1186,10 @@ latest block number: {latest_block}" | |||
// the next block | |||
let next_block_base_fee = fees.get_next_block_base_fee_per_gas( | |||
block.header.gas_used, | |||
block.header.gas_limit, | |||
gas_limit, |
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.
not sure about this
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 should be okay, but in case u128 the basefee would be more or less locked to the lowest possible value 7.
I assume this is okay if you disable the gas limit
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 think this makes sense.
could we two more test cases, one fork test for base and one where the gaslimit is disabled via config?
@@ -1171,9 +1186,10 @@ latest block number: {latest_block}" | |||
// the next block | |||
let next_block_base_fee = fees.get_next_block_base_fee_per_gas( | |||
block.header.gas_used, | |||
block.header.gas_limit, | |||
gas_limit, |
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 should be okay, but in case u128 the basefee would be more or less locked to the lowest possible value 7.
I assume this is okay if you disable the gas limit
7e7d172
to
c2c4da6
Compare
@mattsse thanks, I added a test for base, and some potential tests for setting/disabling the gas limits on both forks and local |
1f209f9
to
a27652c
Compare
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.
last nits
…use custom gas price in forks
5daa35c
to
7662cbf
Compare
… use custom gas_limit on forks (foundry-rs#8933) * fix: foundry-rs#8759, do not set low gas price on block if disabled, use custom gas price in forks * test(fix): default block gas limit for large mine test * fix fmt * fix: optional gas_limit in as_json * fix: use option not serde_json::Value::Null * tests: base tests + config tests * fix: nits * fix: comment
Motivation
#8759 and others I believe were mostly afflicted by the fact that most eth_call requests do not typically fill out the
gas
field on call requests (including alloy bindings), and if you weren't in forking mode, withdisable_block_gas_limit
, any incoming call without this field would be limited to 30M gas,as you can see on line 1209 we try to get the requests gas field to setup the tx env, but its likely not there
foundry/crates/anvil/src/eth/backend/mem/mod.rs
Lines 1205 to 1231 in a592f7a
so on line 1230 we set the tx.env.gas_limit to the block gas limit, however even when we set the
disable_block_gas_limit
flag, this block gas limit defaults to30_000_000
as seen here and here, which can make it seem like the flag is not working if the call youre testing is over 30M gasLastly, the fork mode appeared to work (as mentioned in #8759) because we branch if we have a fork, and in that branch we explicitly set the env block gas limit high if the flag is set , which would transitively apply to incoming calls.
foundry/crates/anvil/src/config.rs
Lines 1145 to 1160 in a592f7a
Solution
In this PR there is breaking change (gas_limit is now an option on
NodeConfig
) to allow for using custom gas limits in forks, if we dont care about that then it doesnt need to breaking.If the
disable_block_gas_limit
flag is set, make sure the block gas limit is high to ensure we dont limit incoming calls (without explicit gas_limit) to the default (low) limit