Skip to content

Commit 8726766

Browse files
committed
tests/eip4788: Add tx_to_address.
1 parent 6fdf312 commit 8726766

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

tests/cancun/eip4788_beacon_root/conftest.py

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ def call_gas() -> int: # noqa: D103
5353

5454

5555
@pytest.fixture
56-
def call_address() -> str: # noqa: D103
56+
def caller_address() -> str: # noqa: D103
5757
return to_address(0x100)
5858

5959

@@ -98,7 +98,7 @@ def precompile_call_account(call_type: Op, call_gas: int) -> Account:
9898
return Account(
9999
nonce=0,
100100
code=precompile_call_code,
101-
balance=10**10,
101+
balance=0x10**10,
102102
)
103103

104104

@@ -121,7 +121,7 @@ def valid_input() -> bool:
121121
@pytest.fixture
122122
def pre(
123123
precompile_call_account: Account,
124-
call_address: str,
124+
caller_address: str,
125125
) -> Dict:
126126
"""
127127
Prepares the pre state of all test cases, by setting the balance of the
@@ -133,13 +133,18 @@ def pre(
133133
nonce=0,
134134
balance=0x10**10,
135135
),
136-
call_address: precompile_call_account,
136+
caller_address: precompile_call_account,
137137
}
138138

139139

140+
@pytest.fixture
141+
def tx_to_address(request, caller_address: Account) -> bytes: # noqa: D103
142+
return request.param if hasattr(request, "param") else caller_address
143+
144+
140145
@pytest.fixture
141146
def tx(
142-
call_address: str,
147+
tx_to_address: str,
143148
timestamp: int,
144149
) -> Transaction:
145150
"""
@@ -149,7 +154,7 @@ def tx(
149154
ty=2,
150155
nonce=0,
151156
data=to_hash_bytes(timestamp),
152-
to=call_address,
157+
to=tx_to_address,
153158
value=0,
154159
gas_limit=1000000,
155160
max_fee_per_gas=7,
@@ -159,7 +164,7 @@ def tx(
159164

160165
@pytest.fixture
161166
def post(
162-
call_address: str,
167+
caller_address: str,
163168
beacon_root: bytes,
164169
timestamp: int,
165170
valid_call: bool,
@@ -170,7 +175,7 @@ def post(
170175
failure of the call, and the validity of the timestamp input.
171176
"""
172177
return {
173-
call_address: Account(
178+
caller_address: Account(
174179
storage=expected_storage(
175180
beacon_root,
176181
timestamp,

0 commit comments

Comments
 (0)