Skip to content

Commit

Permalink
fix after rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
winsvega committed Jan 8, 2025
1 parent de486ba commit 2a614f7
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
10 changes: 5 additions & 5 deletions src/ethereum_test_base_types/conversions.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)
Expand Down
2 changes: 1 addition & 1 deletion tests/cancun/eip1153_tstore/test_tstorage_selfdestruct.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 2a614f7

Please sign in to comment.