test_gas_limit_below_minimum()
Documentation for tests/frontier/validation/test_header.py::test_gas_limit_below_minimum@b314d18e.
Generate fixtures for these test cases for Amsterdam with:
fill -v tests/frontier/validation/test_header.py::test_gas_limit_below_minimum --fork Amsterdam
Tests that a block with a gas limit below the minimum throws an error.
Source code in tests/frontier/validation/test_header.py
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53 | @pytest.mark.parametrize(
"gas_limit",
[
pytest.param(0, marks=pytest.mark.exception_test),
pytest.param(1, marks=pytest.mark.exception_test),
pytest.param(4999, marks=pytest.mark.exception_test),
pytest.param(5000, marks=pytest.mark.valid_before("EIP7928")),
pytest.param(
5000,
marks=[
pytest.mark.valid_from("EIP7928"),
pytest.mark.exception_test,
],
),
],
)
def test_gas_limit_below_minimum(
blockchain_test: BlockchainTestFiller,
pre: Alloc,
gas_limit: int,
env: Environment,
fork: Fork,
) -> None:
"""
Tests that a block with a gas limit below the minimum throws an error.
"""
modified_fields = {"gas_limit": gas_limit}
env.gas_limit = ZeroPaddedHexNumber(5000)
block = Block(txs=[])
if gas_limit < 5000:
block.rlp_modifier = Header(**modified_fields)
block.exception = BlockException.INVALID_GASLIMIT
elif fork.is_eip_enabled(7928):
block.exception = BlockException.BLOCK_ACCESS_LIST_GAS_LIMIT_EXCEEDED
blockchain_test(pre=pre, post={}, blocks=[block], genesis_environment=env)
|
Parametrized Test Cases
This test generates 4 parametrized test cases across 16 forks.