foundry-rs / forge-std

Forge Standard Library is a collection of helpful contracts for use with forge and foundry. It leverages forge's cheatcodes to make writing tests easier and faster, while improving the UX of cheatcodes. For more in-depth usage examples checkout the tests.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Feature request: block gas limits for most popular chains

PaulRBerg opened this issue · comments

Block gas limits can influence the configuration of smart contracts. For example, the MAX_SEGMENT_COUNT in Sablier is influenced by them.

Thus, it would be handy if Forge Std offered the block gas limits of the most popular chains (Ethereum, Arbitrum, Optmism, etc.) as fields in the Chain struct.

For L1 chains, block gas limits are soft consensus parameters with no easy visibility, so I'm hesitant to add them since they're likely become out of date.

For OP Stack chains, you can read this value for a given chain by calling the gasLimit getter on the L1 SystemConfig contract. For example with OP Mainnet, the L1 SystemConfig contract address can be found here, and you can call

$ cast call 0x229047fed2591dbec1eF1118d64F7aF3dB9EB290 "gasLimit()(uint256)"
30000000

Arbitrum stack chains may expose this value similarly but I'm unsure offhand

Ok, in this case it makes sense to close this issue.

Thanks for your guidance on reading the gas limit on OP Stack chains. Didn't know about the gasLimit getter.