From 2a614f7973f38feb3bcd6d2eec63b59467d73a43 Mon Sep 17 00:00:00 2001 From: Dimitry Kh Date: Wed, 8 Jan 2025 13:36:49 +0100 Subject: [PATCH] fix after rebase --- src/ethereum_test_base_types/conversions.py | 10 +++++----- .../eip1153_tstore/test_tstorage_execution_contexts.py | 2 +- .../eip1153_tstore/test_tstorage_selfdestruct.py | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/ethereum_test_base_types/conversions.py b/src/ethereum_test_base_types/conversions.py index 98d31d2bd2..242d96e908 100644 --- a/src/ethereum_test_base_types/conversions.py +++ b/src/ethereum_test_base_types/conversions.py @@ -60,18 +60,18 @@ def to_fixed_size_bytes(input_bytes: FixedSizeBytesConvertible, size: int) -> by return bytes(input_bytes).rjust(size, b"\x00") -def left_pad_zeros_up_to_size(input: bytes, size: int) -> bytes: +def left_pad_zeros_up_to_size(input_bytes: bytes, size: int) -> bytes: """ - Pads the given data to fit into a size-byte bytes. If the data is longer than + Pad 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: + input_bytes = to_bytes(input_bytes) + if len(input_bytes) > size: raise ValueError(f"Data cannot be longer than {size} bytes.") - padded_data = bytes(input).rjust(size, b"\x00") + padded_data = bytes(input_bytes).rjust(size, b"\x00") return bytes(padded_data) diff --git a/tests/cancun/eip1153_tstore/test_tstorage_execution_contexts.py b/tests/cancun/eip1153_tstore/test_tstorage_execution_contexts.py index d4edb44c36..0d89022d5c 100644 --- a/tests/cancun/eip1153_tstore/test_tstorage_execution_contexts.py +++ b/tests/cancun/eip1153_tstore/test_tstorage_execution_contexts.py @@ -8,13 +8,13 @@ import pytest +from ethereum_test_base_types.conversions import left_pad_zeros_up_to_size from ethereum_test_tools import ( Account, Address, Alloc, Bytecode, Environment, - Hash, StateTestFiller, Transaction, ) diff --git a/tests/cancun/eip1153_tstore/test_tstorage_selfdestruct.py b/tests/cancun/eip1153_tstore/test_tstorage_selfdestruct.py index fd450f0286..001532f689 100644 --- a/tests/cancun/eip1153_tstore/test_tstorage_selfdestruct.py +++ b/tests/cancun/eip1153_tstore/test_tstorage_selfdestruct.py @@ -9,13 +9,13 @@ import pytest +from ethereum_test_base_types.conversions import left_pad_zeros_up_to_size from ethereum_test_tools import ( Account, Alloc, Bytecode, CalldataCase, Environment, - Hash, Initcode, StateTestFiller, Switch,