test_tx_gas_limit()
Documentation for tests/frontier/validation/test_transaction.py::test_tx_gas_limit@8db70f93.
Generate fixtures for these test cases for Amsterdam with:
fill -v tests/frontier/validation/test_transaction.py::test_tx_gas_limit --fork Amsterdam
Tests that if a tx gas limit is higher than the block gas limit,
an exception is raised.
Source code in tests/frontier/validation/test_transaction.py
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 | @pytest.mark.exception_test
@pytest.mark.eels_base_coverage
def test_tx_gas_limit(
blockchain_test: BlockchainTestFiller,
pre: Alloc,
env: Environment,
) -> None:
"""
Tests that if a tx gas limit is higher than the block gas limit,
an exception is raised.
"""
sender = pre.fund_eoa()
to = pre.fund_eoa()
tx = Transaction(
gas_limit=21001,
to=to,
gas_price=0x10, # Must be >= base fee to isolate gas limit validation
sender=sender,
protected=False,
error=TransactionException.GAS_ALLOWANCE_EXCEEDED,
)
modified_fields = {"gas_limit": ZeroPaddedHexNumber(21000)}
env.gas_limit = ZeroPaddedHexNumber(21000)
block = Block(
txs=[tx],
rlp_modifier=Header(**modified_fields),
exception=TransactionException.GAS_ALLOWANCE_EXCEEDED,
)
blockchain_test(pre=pre, post={}, blocks=[block], genesis_environment=env)
|
Parametrized Test Cases
This test generates 1 parametrized test case across 14 forks.