Skip to content

Invalid gas limit on Blockchain tests when a custom genesis gas limit is used #234

Open
@marioevz

Description

@marioevz

When using a custom genesis environment to set a custom gas limit, it results in an invalid gas limit value being set for blocks 1 and after, since no gas limit is specified for these later blocks, the default is used, which would be outside of the allowed increase/decrease of gas limit in a 1 block period.

E.g. if gas_limit is set to 10_000_000_000 in genesis_environment, and no gas_limit is set for any of the blocks in the test, the environment gas limit for block 1 reverts to the default value (100_000_000_000_000_000) in this line:

env = Environment.from_parent_header(genesis)

The default gas_limit is much higher than the allowed increase per block, therefore the block is invalid, and the block processing will fail:

block #1 insertion into chain failed: invalid gas limi
t: have 100000000000000000, want 10000000000 +-= 9765624

We need to either:

  1. take into account the parent gas used before setting a default value in the block 1
  2. check the gas limit delta from block to block and warn the tester when the value is invalid

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requestedscope:toolsScope: Changes ethereum_test_tools packagetype:bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions