From 0014c5e892faa3bcf5738a8a87b804d643f64d8b Mon Sep 17 00:00:00 2001 From: Dimitry Kh Date: Mon, 9 Dec 2024 22:02:02 +0100 Subject: [PATCH] unit tests --- src/ethereum_test_base_types/conversions.py | 25 +++- .../tests/test_base_types.py | 139 ++++++++++++++---- .../tests/test_state.py | 16 +- .../tests/test_fixtures.py | 2 +- src/ethereum_test_specs/tests/test_types.py | 36 ++++- src/ethereum_test_types/tests/test_helpers.py | 10 +- .../tests/test_post_alloc.py | 28 ++-- .../tests/test_transactions.py | 21 ++- src/ethereum_test_types/tests/test_types.py | 25 +++- .../test_tstorage_execution_contexts.py | 5 +- .../test_tstorage_selfdestruct.py | 7 +- .../eip4895_withdrawals/test_withdrawals.py | 8 +- 12 files changed, 242 insertions(+), 80 deletions(-) diff --git a/src/ethereum_test_base_types/conversions.py b/src/ethereum_test_base_types/conversions.py index 43ec7ffd93..fa668b368e 100644 --- a/src/ethereum_test_base_types/conversions.py +++ b/src/ethereum_test_base_types/conversions.py @@ -63,12 +63,33 @@ def to_fixed_size_bytes(input: FixedSizeBytesConvertible, size: int) -> bytes: return int.to_bytes(input, length=size, byteorder="big", signed=input < 0) input = to_bytes(input) if len(input) > size: - raise Exception(f"input is too large for fixed size bytes: {len(input)} > {size}") + raise Exception( + f"input is too large for fixed size bytes: {len(input)} > {size}" + f", input: {to_hex(input)}" + ) if len(input) < size: - raise Exception(f"input is too small for fixed size bytes: {len(input)} < {size}") + raise Exception( + f"input is too small for fixed size bytes: {len(input)} < {size}" + f", input: {to_hex(input)}" + ) return bytes(input).rjust(size, b"\x00") +def left_pad_zeros_up_to_size(input: bytes, size: int) -> bytes: + """ + Pads the given data to fit into a size-byte bytes. If the data is longer than + size bytes, it raises a ValueError. If it is shorter, it left pads with zero bytes. + + :param data: The input data to pad. + :return: A Hash object of exactly size bytes. + """ + input = to_bytes(input) + if len(input) > size: + raise ValueError(f"Data cannot be longer than {size} bytes.") + padded_data = bytes(input).rjust(size, b"\x00") + return bytes(padded_data) + + def to_hex(input: BytesConvertible) -> str: """ Converts multiple types into a bytes hex string. diff --git a/src/ethereum_test_base_types/tests/test_base_types.py b/src/ethereum_test_base_types/tests/test_base_types.py index e4a8fa5ebb..7a0b793b4f 100644 --- a/src/ethereum_test_base_types/tests/test_base_types.py +++ b/src/ethereum_test_base_types/tests/test_base_types.py @@ -14,34 +14,117 @@ @pytest.mark.parametrize( "a, b, equal", [ - (Address("0x0"), Address("0x0"), True), - (Address("0x0"), Address("0x1"), False), - (Address("0x1"), Address("0x0"), False), - (Address("0x1"), "0x1", True), - (Address("0x1"), "0x2", False), - (Address("0x1"), 1, True), - (Address("0x1"), 2, False), - (Address("0x1"), b"\x01", True), - (Address("0x1"), b"\x02", False), - ("0x1", Address("0x1"), True), - ("0x2", Address("0x1"), False), - (1, Address("0x1"), True), - (2, Address("0x1"), False), - (b"\x01", Address("0x1"), True), - (b"\x02", Address("0x1"), False), - (Hash("0x0"), Hash("0x0"), True), - (Hash("0x0"), Hash("0x1"), False), - (Hash("0x1"), Hash("0x0"), False), - (Hash("0x1"), "0x1", True), - (Hash("0x1"), "0x2", False), - (Hash("0x1"), 1, True), - (Hash("0x1"), 2, False), - (Hash("0x1"), b"\x01", True), - (Hash("0x1"), b"\x02", False), - ("0x1", Hash("0x1"), True), - ("0x2", Hash("0x1"), False), - (1, Hash("0x1"), True), - (2, Hash("0x1"), False), + (Address(0), Address(0), True), + ( + Address("0x0000000000000000000000000000000000000000"), + Address("0x0000000000000000000000000000000000000000"), + True, + ), + ( + Address("0x0000000000000000000000000000000000000000"), + Address("0x0000000000000000000000000000000000000001"), + False, + ), + ( + Address("0x0000000000000000000000000000000000000001"), + Address("0x0000000000000000000000000000000000000000"), + False, + ), + ( + Address("0x0000000000000000000000000000000000000001"), + "0x0000000000000000000000000000000000000001", + True, + ), + ( + Address("0x0000000000000000000000000000000000000001"), + "0x0000000000000000000000000000000000000002", + False, + ), + (Address("0x0000000000000000000000000000000000000001"), 1, True), + (Address("0x0000000000000000000000000000000000000001"), 2, False), + ( + Address("0x0000000000000000000000000000000000000001"), + b"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01", + True, + ), + ( + Address("0x0000000000000000000000000000000000000001"), + b"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02", + False, + ), + ( + "0x0000000000000000000000000000000000000001", + Address("0x0000000000000000000000000000000000000001"), + True, + ), + ( + "0x0000000000000000000000000000000000000002", + Address("0x0000000000000000000000000000000000000001"), + False, + ), + (1, Address("0x0000000000000000000000000000000000000001"), True), + (2, Address("0x0000000000000000000000000000000000000001"), False), + ( + b"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01", + Address("0x0000000000000000000000000000000000000001"), + True, + ), + ( + b"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02", + Address("0x0000000000000000000000000000000000000001"), + False, + ), + ( + Hash("0x0000000000000000000000000000000000000000000000000000000000000000"), + Hash("0x0000000000000000000000000000000000000000000000000000000000000000"), + True, + ), + ( + Hash("0x0000000000000000000000000000000000000000000000000000000000000000"), + Hash("0x0000000000000000000000000000000000000000000000000000000000000001"), + False, + ), + ( + Hash("0x0000000000000000000000000000000000000000000000000000000000000001"), + Hash("0x0000000000000000000000000000000000000000000000000000000000000000"), + False, + ), + ( + Hash("0x0000000000000000000000000000000000000000000000000000000000000001"), + "0x0000000000000000000000000000000000000000000000000000000000000001", + True, + ), + ( + Hash("0x0000000000000000000000000000000000000000000000000000000000000001"), + "0x0000000000000000000000000000000000000000000000000000000000000002", + False, + ), + (Hash("0x0000000000000000000000000000000000000000000000000000000000000001"), 1, True), + (Hash("0x0000000000000000000000000000000000000000000000000000000000000001"), 2, False), + ( + Hash("0x0000000000000000000000000000000000000000000000000000000000000001"), + b"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + b"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01", + True, + ), + ( + Hash("0x0000000000000000000000000000000000000000000000000000000000000001"), + b"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + b"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02", + False, + ), + ( + "0x0000000000000000000000000000000000000000000000000000000000000001", + Hash("0x0000000000000000000000000000000000000000000000000000000000000001"), + True, + ), + ( + "0x0000000000000000000000000000000000000000000000000000000000000002", + Hash("0x0000000000000000000000000000000000000000000000000000000000000001"), + False, + ), + (1, Hash("0x0000000000000000000000000000000000000000000000000000000000000001"), True), + (2, Hash("0x0000000000000000000000000000000000000000000000000000000000000001"), False), ], ) def test_comparisons(a: Any, b: Any, equal: bool): diff --git a/src/ethereum_test_fixtures/tests/test_state.py b/src/ethereum_test_fixtures/tests/test_state.py index c7b4cb584f..30f4863cf5 100644 --- a/src/ethereum_test_fixtures/tests/test_state.py +++ b/src/ethereum_test_fixtures/tests/test_state.py @@ -18,8 +18,8 @@ pytest.param( True, FixtureForkPost( - state_root="0x00", - logs_hash="0x01", + state_root=0, + logs_hash=1, tx_bytes="0x02", ), { @@ -33,8 +33,8 @@ pytest.param( True, FixtureForkPost( - state_root="0x00", - logs_hash="0x01", + state_root=0, + logs_hash=1, tx_bytes="0x02", expect_exception=TransactionException.INITCODE_SIZE_EXCEEDED, ), @@ -51,8 +51,8 @@ False, # Can not be deserialized: A single expect_exception str will not be # deserialized as a list and therefore will not match the model_instance definition. FixtureForkPost( - state_root="0x00", - logs_hash="0x01", + state_root=0, + logs_hash=1, tx_bytes="0x02", expect_exception=[TransactionException.INITCODE_SIZE_EXCEEDED], ), @@ -68,8 +68,8 @@ pytest.param( True, FixtureForkPost( - state_root="0x00", - logs_hash="0x01", + state_root=0, + logs_hash=1, tx_bytes="0x02", expect_exception=[ TransactionException.INITCODE_SIZE_EXCEEDED, diff --git a/src/ethereum_test_specs/tests/test_fixtures.py b/src/ethereum_test_specs/tests/test_fixtures.py index 9c92e51496..6c23eb6807 100644 --- a/src/ethereum_test_specs/tests/test_fixtures.py +++ b/src/ethereum_test_specs/tests/test_fixtures.py @@ -542,7 +542,7 @@ def test_fixture_header_join(self, blockchain_test_fixture: BlockchainFixture): new_state_root = Hash(12345) # See description of https://github.com/ethereum/execution-spec-tests/pull/398 - new_transactions_root = "0x100" + new_transactions_root = 0x100 header_new_fields = Header( difficulty=new_difficulty, state_root=new_state_root, diff --git a/src/ethereum_test_specs/tests/test_types.py b/src/ethereum_test_specs/tests/test_types.py index 72aff9eeaa..2497377f3b 100644 --- a/src/ethereum_test_specs/tests/test_types.py +++ b/src/ethereum_test_specs/tests/test_types.py @@ -44,8 +44,12 @@ ), pytest.param( fixture_header_ones, - Header(state_root="0x100"), - fixture_header_ones.copy(state_root="0x100"), + Header( + state_root="0x0000000000000000000000000000000000000000000000000000000000000100" + ), + fixture_header_ones.copy( + state_root="0x0000000000000000000000000000000000000000000000000000000000000100" + ), id="state_root_as_str", ), pytest.param( @@ -74,8 +78,24 @@ ), pytest.param( fixture_header_ones, - Header(logs_bloom="0x100"), - fixture_header_ones.copy(logs_bloom="0x100"), + Header( + logs_bloom="0x00000000000000000000000000000000000000000000000000000000000000000000" + "000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "000000000000000000000000000000000000100" + ), + fixture_header_ones.copy( + logs_bloom="0x00000000000000000000000000000000000000000000000000000000000000000000" + "000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "000000000000000000000000000000000000100" + ), id="bloom_as_str", ), pytest.param( @@ -86,13 +106,17 @@ ), pytest.param( fixture_header_ones, - Header(logs_bloom=Hash(100)), + Header(logs_bloom=Bloom(100)), fixture_header_ones.copy(logs_bloom=100), id="bloom_as_hash", ), pytest.param( fixture_header_ones, - Header(state_root="0x100", logs_bloom=Hash(200), difficulty=300), + Header( + state_root="0x0000000000000000000000000000000000000000000000000000000000000100", + logs_bloom=Bloom(200), + difficulty=300, + ), fixture_header_ones.copy( state_root=0x100, logs_bloom=200, diff --git a/src/ethereum_test_types/tests/test_helpers.py b/src/ethereum_test_types/tests/test_helpers.py index d7fdaa1f58..15d47306fb 100644 --- a/src/ethereum_test_types/tests/test_helpers.py +++ b/src/ethereum_test_types/tests/test_helpers.py @@ -13,11 +13,17 @@ def test_address(): """ Test `ethereum_test.base_types.Address`. """ - assert Address("0x0") == "0x0000000000000000000000000000000000000000" + assert ( + Address("0x0000000000000000000000000000000000000000") + == "0x0000000000000000000000000000000000000000" + ) assert Address(0) == "0x0000000000000000000000000000000000000000" assert Address(1) == "0x0000000000000000000000000000000000000001" assert Address(10) == "0x000000000000000000000000000000000000000a" - assert Address("0x10") == "0x0000000000000000000000000000000000000010" + assert ( + Address("0x0000000000000000000000000000000000000010") + == "0x0000000000000000000000000000000000000010" + ) assert Address(2 ** (20 * 8) - 1) == "0xffffffffffffffffffffffffffffffffffffffff" assert Address(0) == Address(0) assert Address(0) != Address(1) diff --git a/src/ethereum_test_types/tests/test_post_alloc.py b/src/ethereum_test_types/tests/test_post_alloc.py index 2145c67ff7..24763d71cf 100644 --- a/src/ethereum_test_types/tests/test_post_alloc.py +++ b/src/ethereum_test_types/tests/test_post_alloc.py @@ -31,9 +31,9 @@ def alloc(request: pytest.FixtureRequest) -> Alloc: [ # Account should not exist but contained in alloc ( - {"0x0": Account.NONEXISTENT}, + {"0x0000000000000000000000000000000000000000": Account.NONEXISTENT}, { - "0x00": { + "0x0000000000000000000000000000000000000000": { "nonce": "1", "code": "0x123", "balance": "1", @@ -44,27 +44,27 @@ def alloc(request: pytest.FixtureRequest) -> Alloc: ), # Account should not exist but contained in alloc ( - {"0x00": Account.NONEXISTENT}, - {"0x0": {"nonce": "1"}}, + {"0x0000000000000000000000000000000000000000": Account.NONEXISTENT}, + {"0x0000000000000000000000000000000000000000": {"nonce": "1"}}, Alloc.UnexpectedAccount, ), # Account should not exist but contained in alloc ( - {"0x1": Account.NONEXISTENT}, - {"0x01": {"balance": "1"}}, + {"0x0000000000000000000000000000000000000001": Account.NONEXISTENT}, + {"0x0000000000000000000000000000000000000001": {"balance": "1"}}, Alloc.UnexpectedAccount, ), # Account should not exist but contained in alloc ( - {"0x0a": Account.NONEXISTENT}, - {"0x0A": {"code": "0x00"}}, + {"0x000000000000000000000000000000000000000a": Account.NONEXISTENT}, + {"0x000000000000000000000000000000000000000A": {"code": "0x00"}}, Alloc.UnexpectedAccount, ), # Account should exist but not in alloc ( - {"0x0A": Account()}, + {"0x000000000000000000000000000000000000000A": Account()}, { - "0x0B": { + "0x000000000000000000000000000000000000000B": { "nonce": "1", "code": "0x123", "balance": "1", @@ -76,9 +76,9 @@ def alloc(request: pytest.FixtureRequest) -> Alloc: # Account should exist and contained in alloc, but don't care about # values ( - {"0x1": Account()}, + {"0x0000000000000000000000000000000000000001": Account()}, { - "0x1": { + "0x0000000000000000000000000000000000000001": { "nonce": "1", "code": "0x123", "balance": "1", @@ -89,9 +89,9 @@ def alloc(request: pytest.FixtureRequest) -> Alloc: ), # Account should exist and contained in alloc, single incorrect value ( - {"0x1": Account(nonce=0)}, + {"0x0000000000000000000000000000000000000001": Account(nonce=0)}, { - "0x1": { + "0x0000000000000000000000000000000000000001": { "nonce": "1", "code": "0x123", "balance": "1", diff --git a/src/ethereum_test_types/tests/test_transactions.py b/src/ethereum_test_types/tests/test_transactions.py index bbe61b476c..b18295d358 100644 --- a/src/ethereum_test_types/tests/test_transactions.py +++ b/src/ethereum_test_types/tests/test_transactions.py @@ -6,7 +6,7 @@ import pytest -from ..types import AccessList, Transaction +from ..types import AccessList, Hash, Transaction @pytest.mark.parametrize( @@ -107,7 +107,12 @@ ty=1, nonce=0, gas_price=1000000000, - access_list=[AccessList(address="0x123", storage_keys=["0x456", "0x789"])], + access_list=[ + AccessList( + address="0x0000000000000000000000000000000000000123", + storage_keys=[0x456, 0x789], + ) + ], ), ( 0, @@ -127,7 +132,7 @@ nonce=0, gas_price=1000000000, to=None, - access_list=[AccessList(address="0x123", storage_keys=["0x456", "0x789"])], + access_list=[AccessList(address=0x123, storage_keys=[0x456, 0x789])], ), ( 0, @@ -145,7 +150,7 @@ Transaction( ty=2, nonce=0, - access_list=[AccessList(address="0x123", storage_keys=["0x456", "0x789"])], + access_list=[AccessList(address=0x123, storage_keys=[0x456, 0x789])], max_fee_per_gas=10, max_priority_fee_per_gas=5, ), @@ -166,7 +171,7 @@ ty=2, nonce=0, to=None, - access_list=[AccessList(address="0x123", storage_keys=["0x456", "0x789"])], + access_list=[AccessList(address=0x123, storage_keys=[0x456, 0x789])], max_fee_per_gas=10, max_priority_fee_per_gas=5, ), @@ -186,7 +191,7 @@ Transaction( ty=3, nonce=0, - access_list=[AccessList(address="0x123", storage_keys=["0x456", "0x789"])], + access_list=[AccessList(address=0x123, storage_keys=[0x456, 0x789])], max_fee_per_gas=10, max_priority_fee_per_gas=5, max_fee_per_blob_gas=100, @@ -208,11 +213,11 @@ Transaction( ty=3, nonce=0, - access_list=[AccessList(address="0x123", storage_keys=["0x456", "0x789"])], + access_list=[AccessList(address=0x123, storage_keys=[0x456, 0x789])], max_fee_per_gas=10, max_priority_fee_per_gas=5, max_fee_per_blob_gas=100, - blob_versioned_hashes=[bytes(), bytes([0x01])], + blob_versioned_hashes=[Hash(0), Hash(0x01)], ), ( 1, diff --git a/src/ethereum_test_types/tests/test_types.py b/src/ethereum_test_types/tests/test_types.py index 770ee6c42c..1e91492535 100644 --- a/src/ethereum_test_types/tests/test_types.py +++ b/src/ethereum_test_types/tests/test_types.py @@ -335,13 +335,13 @@ def test_account_check_alloc(account: Account, alloc_dict: Dict[Any, Any], shoul ), pytest.param( Alloc({0x2: {"nonce": 1}}), # type: ignore - Alloc({"0x02": {"nonce": 2}}), # type: ignore + Alloc({"0x0000000000000000000000000000000000000002": {"nonce": 2}}), # type: ignore Alloc({0x2: Account(nonce=2)}), # type: ignore id="overwrite_account", ), pytest.param( Alloc({0x2: {"balance": 1}}), # type: ignore - Alloc({"0x02": {"nonce": 1}}), # type: ignore + Alloc({"0x0000000000000000000000000000000000000002": {"nonce": 1}}), # type: ignore Alloc({0x2: Account(balance=1, nonce=1)}), # type: ignore id="mix_account", ), @@ -562,6 +562,27 @@ def test_account_merge( }, id="transaction_t8n_to_none", ), + pytest.param( + True, + Transaction( + to="", + ).with_signature_and_sender(), + { + "type": "0x0", + "chainId": "0x1", + "nonce": "0x0", + "to": None, + "value": "0x0", + "input": "0x", + "gas": "0x5208", + "gasPrice": "0xa", + "v": "0x25", + "r": "0x1cfe2cbb0c3577f74d9ae192a7f1ee2d670fe806a040f427af9cb768be3d07ce", + "s": "0xcbe2d029f52dbf93ade486625bed0603945d2c7358b31de99fe8786c00f13da", + "sender": "0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b", + }, + id="transaction_t8n_to_empty_str", + ), pytest.param( True, Transaction( diff --git a/tests/cancun/eip1153_tstore/test_tstorage_execution_contexts.py b/tests/cancun/eip1153_tstore/test_tstorage_execution_contexts.py index b01dcdc705..d0b603b8c9 100644 --- a/tests/cancun/eip1153_tstore/test_tstorage_execution_contexts.py +++ b/tests/cancun/eip1153_tstore/test_tstorage_execution_contexts.py @@ -8,7 +8,8 @@ import pytest -from ethereum_test_tools import Account, Address, Alloc, Bytecode, Environment, Hash +from ethereum_test_base_types.conversions import left_pad_zeros_up_to_size +from ethereum_test_tools import Account, Address, Alloc, Bytecode, Environment from ethereum_test_tools import Opcodes as Op from ethereum_test_tools import StateTestFiller, Transaction @@ -301,7 +302,7 @@ def tx(pre: Alloc, caller_address: Address, callee_address: Address) -> Transact return Transaction( sender=pre.fund_eoa(), to=caller_address, - data=Hash(callee_address), + data=left_pad_zeros_up_to_size(callee_address, 32), gas_limit=1_000_000, ) diff --git a/tests/cancun/eip1153_tstore/test_tstorage_selfdestruct.py b/tests/cancun/eip1153_tstore/test_tstorage_selfdestruct.py index f1cef0eeac..55c3049b8c 100644 --- a/tests/cancun/eip1153_tstore/test_tstorage_selfdestruct.py +++ b/tests/cancun/eip1153_tstore/test_tstorage_selfdestruct.py @@ -9,7 +9,8 @@ import pytest -from ethereum_test_tools import Account, Alloc, Bytecode, CalldataCase, Environment, Hash, Initcode +from ethereum_test_base_types.conversions import left_pad_zeros_up_to_size +from ethereum_test_tools import Account, Alloc, Bytecode, CalldataCase, Environment, Initcode from ethereum_test_tools import Opcodes as Op from ethereum_test_tools import StateTestFiller, Switch, Transaction, compute_create_address @@ -223,10 +224,10 @@ def test_reentrant_selfdestructing_call( caller_address = pre.deploy_contract(code=caller_bytecode) - data: Hash | Bytecode + data: bytes | Bytecode if pre_existing_contract: callee_address = pre.deploy_contract(code=callee_bytecode) - data = Hash(callee_address) + data = left_pad_zeros_up_to_size(callee_address, 32) else: callee_address = compute_create_address(address=caller_address, nonce=1) data = Initcode(deploy_code=callee_bytecode) diff --git a/tests/shanghai/eip4895_withdrawals/test_withdrawals.py b/tests/shanghai/eip4895_withdrawals/test_withdrawals.py index 23bd823765..a1597e77c8 100644 --- a/tests/shanghai/eip4895_withdrawals/test_withdrawals.py +++ b/tests/shanghai/eip4895_withdrawals/test_withdrawals.py @@ -10,6 +10,7 @@ import pytest from ethereum_clis import TransitionTool +from ethereum_test_base_types.conversions import left_pad_zeros_up_to_size from ethereum_test_forks import Cancun, Fork from ethereum_test_tools import ( EOA, @@ -18,7 +19,6 @@ Alloc, Block, BlockchainTestFiller, - Hash, Transaction, TransactionException, Withdrawal, @@ -209,7 +209,7 @@ def test_balance_within_block(blockchain_test: BlockchainTestFiller, pre: Alloc) sender=sender, gas_limit=100000, to=contract_address, - data=Hash(recipient), + data=left_pad_zeros_up_to_size(recipient, 32), ) ], withdrawals=[ @@ -227,7 +227,7 @@ def test_balance_within_block(blockchain_test: BlockchainTestFiller, pre: Alloc) sender=sender, gas_limit=100000, to=contract_address, - data=Hash(recipient), + data=left_pad_zeros_up_to_size(recipient, 32), ) ] ), @@ -381,7 +381,7 @@ def test_self_destructing_account( sender=sender, gas_limit=100000, to=self_destruct_contract_address, - data=Hash(recipient), + data=left_pad_zeros_up_to_size(recipient, 32), ) withdrawal = Withdrawal(