Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: KeyError #38

Merged
merged 5 commits into from
Dec 16, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions evmspec/data/_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ def _decode_hook(typ: Type, obj: object):
ONE_EMPTY_BYTE = bytes(HexBytes("0x00"))


_MISSING_BYTES = {i: (32 - i) * ONE_EMPTY_BYTE for i in range(0, 32)}
_MISSING_BYTES = {i: (32 - i) * ONE_EMPTY_BYTE for i in range(0, 33)}
"""Calculate the number of missing bytes and return them.

Args:
Expand Down Expand Up @@ -340,7 +340,7 @@ def __new__(cls, v):
try:
missing_bytes = _MISSING_BYTES[len(input_bytes)]
except KeyError as e:
raise ValueError(f"{v} is too long") from e.__cause__
raise ValueError(f"{v} is too long: {len(input_bytes)}") from e.__cause__

return __hb_new__(cls, missing_bytes + input_bytes)

Expand Down
Loading