Skip to content

Commit d216517

Browse files
committed
fix(specs,tests): Fix withdrawal tests for BALs issue with idx==0
- `self.txs.successfully_parsed` is a list of transaction indexes, not transactions. The "if tx" check here would then check `if 0` which parses as a boolean ``False``. This means we would skip counting the tx if index=0 was successful. - Fixes some test expectations where `post_code` was being checked instead of ``new_code``.
1 parent 3e60ec1 commit d216517

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

src/ethereum_spec_tools/evm_tools/t8n/__init__.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,11 @@ def _run_blockchain_test(self, block_env: Any, block_output: Any) -> None:
294294
if self.fork.is_after_fork("amsterdam"):
295295
assert block_env.state.change_tracker is not None
296296
num_transactions = ulen(
297-
[tx for tx in self.txs.successfully_parsed if tx]
297+
[
298+
tx_idx
299+
for tx_idx in self.txs.successfully_parsed
300+
if tx_idx is not None
301+
]
298302
)
299303

300304
# post-execution use n + 1

tests/amsterdam/eip7928_block_level_access_lists/test_block_access_lists_eip4895.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import pytest
44
from execution_testing import (
5+
EOA,
56
Account,
67
Address,
78
Alloc,
@@ -94,7 +95,8 @@ def test_bal_withdrawal_and_transaction(
9495
sender=alice,
9596
to=bob,
9697
value=5,
97-
gas_price=0xA,
98+
max_fee_per_gas=50,
99+
max_priority_fee_per_gas=5,
98100
)
99101

100102
block = Block(
@@ -481,7 +483,7 @@ def test_bal_withdrawal_and_new_contract(
481483

482484
code = Op.STOP
483485
initcode = Initcode(deploy_code=code)
484-
oracle = compute_create_address(alice, 0)
486+
oracle = compute_create_address(address=alice)
485487

486488
tx = Transaction(
487489
sender=alice,
@@ -508,7 +510,7 @@ def test_bal_withdrawal_and_new_contract(
508510
nonce_changes=[BalNonceChange(tx_index=1, post_nonce=1)],
509511
),
510512
oracle: BalAccountExpectation(
511-
code_changes=[BalCodeChange(tx_index=1, post_code=code)],
513+
code_changes=[BalCodeChange(tx_index=1, new_code=code)],
512514
balance_changes=[
513515
BalBalanceChange(tx_index=1, post_balance=5 * GWEI),
514516
BalBalanceChange(tx_index=2, post_balance=15 * GWEI),
@@ -550,7 +552,7 @@ def test_bal_zero_withdrawal(
550552
if initial_balance > 0:
551553
charlie = pre.fund_eoa(amount=initial_balance)
552554
else:
553-
charlie = Address(0xCC)
555+
charlie = EOA(0xCC)
554556

555557
block = Block(
556558
txs=[],

0 commit comments

Comments
 (0)