anvil-zksync icon indicating copy to clipboard operation
anvil-zksync copied to clipboard

feat: implement `anvil_setBlockGasLimit` API endpoint

Open itegulov opened this issue 1 year ago • 3 comments

A method that allows a user to manually set block gas limit to a value of their choice:

#[rpc(name = "anvil_setBlockGasLimit")]
fn set_block_gas_limit(&self, limit: U256) -> RpcResult<bool>;

Not sure if this even makes sense in our case as even for core block gas limit is fixed to the the VM's batch gas limit.

itegulov avatar Nov 25 '24 08:11 itegulov

@popzxc what do you think regarding that last question? Implementing this would be easy on a surface level but honestly I am not sure in the general usefulness of this as you can never exceed VM's gas limit regardless.

itegulov avatar Nov 25 '24 08:11 itegulov

You cannot exceed VM's gas limit, but you can exceed a single transaction gas limit (e.g. we have an API check for that). I think it might be useful for indirect usages: e.g. if people want to make sure that given certain parameters they don't exceed certain gas limit for their transaction (so: instead of increasing limit, we will decrease it).

popzxc avatar Nov 25 '24 08:11 popzxc

Right, I guess in a non-single tx mode this is dependent on us following proper block sealing criteria from core that, among other things, will take this "fake" gas limit into account.

itegulov avatar Nov 25 '24 08:11 itegulov