Skip to content

Commit 8234e90

Browse files
fix: apply tx gas limit cap to template (#2046)
1 parent 429079c commit 8234e90

File tree

2 files changed

+16
-5
lines changed

2 files changed

+16
-5
lines changed

src/cli/eest/make/templates/blockchain_test.py.j2

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,25 @@ abstract: Tests [EIP-{{eip_number}} {{eip_name}}](https://eips.ethereum.org/EIPS
55

66
import pytest
77

8-
from ethereum_test_tools import Account, Alloc, Block, BlockchainTestFiller, Transaction
8+
from ethereum_test_forks import Fork
9+
from ethereum_test_tools import (
10+
Account,
11+
Alloc,
12+
Block,
13+
BlockchainTestFiller,
14+
Environment,
15+
Transaction,
16+
)
917
from ethereum_test_tools.vm.opcode import Opcodes as Op
1018

1119
REFERENCE_SPEC_GIT_PATH = "DUMMY/eip-DUMMY.md"
1220
REFERENCE_SPEC_VERSION = "DUMMY_VERSION"
1321

1422

1523
@pytest.mark.valid_from("{{fork}}")
16-
def {{module_name}}(blockchain_test: BlockchainTestFiller, pre: Alloc):
24+
def {{module_name}}(
25+
blockchain_test: BlockchainTestFiller, pre: Alloc, fork: Fork, env: Environment
26+
):
1727
"""
1828
TODO: Enter a one-line test summary here.
1929

@@ -40,7 +50,7 @@ def {{module_name}}(blockchain_test: BlockchainTestFiller, pre: Alloc):
4050

4151
tx = Transaction(
4252
to=contract_address,
43-
gas_limit=100000000,
53+
gas_limit=fork.transaction_gas_limit_cap() or env.gas_limit,
4454
data=b"",
4555
value=0,
4656
sender=sender,

src/cli/eest/make/templates/state_test.py.j2

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ abstract: Tests [EIP-{{eip_number}} {{eip_name}}](https://eips.ethereum.org/EIPS
55

66
import pytest
77

8+
from ethereum_test_forks import Fork
89
from ethereum_test_tools import Account, Alloc, Environment, StateTestFiller, Transaction
910
from ethereum_test_tools.vm.opcode import Opcodes as Op
1011

@@ -13,7 +14,7 @@ REFERENCE_SPEC_VERSION = "DUMMY_VERSION"
1314

1415

1516
@pytest.mark.valid_from("{{fork}}")
16-
def {{module_name}}(state_test: StateTestFiller, pre: Alloc):
17+
def {{module_name}}(state_test: StateTestFiller, pre: Alloc, fork: Fork, env: Environment):
1718
"""
1819
TODO: Enter a one-line test summary here.
1920

@@ -42,7 +43,7 @@ def {{module_name}}(state_test: StateTestFiller, pre: Alloc):
4243

4344
tx = Transaction(
4445
to=contract_address,
45-
gas_limit=100000000,
46+
gas_limit=fork.transaction_gas_limit_cap() or env.gas_limit,
4647
data=b"",
4748
value=0,
4849
sender=sender,

0 commit comments

Comments
 (0)