From aa1a57137084e4865651f6f780627c4a4e13a429 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Bylica?= Date: Wed, 15 May 2024 17:27:06 +0200 Subject: [PATCH] fix(fw): EOF - add EOFException.INVALID_DATALOADN_INDEX (#560) --- src/ethereum_test_tools/exceptions/evmone_exceptions.py | 1 + src/ethereum_test_tools/exceptions/exceptions.py | 4 ++++ .../eip7480_data_section/test_code_validation.py | 6 +++--- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/ethereum_test_tools/exceptions/evmone_exceptions.py b/src/ethereum_test_tools/exceptions/evmone_exceptions.py index 754af7681d..2b1b8f8f47 100644 --- a/src/ethereum_test_tools/exceptions/evmone_exceptions.py +++ b/src/ethereum_test_tools/exceptions/evmone_exceptions.py @@ -49,6 +49,7 @@ class EvmoneExceptionMapper: ExceptionMessage(EOFException.UNREACHABLE_INSTRUCTIONS, "err: unreachable_instructions"), ExceptionMessage(EOFException.INVALID_RJUMP_DESTINATION, "err: invalid_rjump_destination"), ExceptionMessage(EOFException.UNREACHABLE_CODE_SECTIONS, "err: unreachable_code_sections"), + ExceptionMessage(EOFException.INVALID_DATALOADN_INDEX, "err: invalid_dataloadn_index"), ) def __init__(self) -> None: diff --git a/src/ethereum_test_tools/exceptions/exceptions.py b/src/ethereum_test_tools/exceptions/exceptions.py index 5e3c516fa6..e32cbed23e 100644 --- a/src/ethereum_test_tools/exceptions/exceptions.py +++ b/src/ethereum_test_tools/exceptions/exceptions.py @@ -303,6 +303,10 @@ class EOFException(ExceptionBase): """ EOF container's body have code sections that are unreachable """ + INVALID_DATALOADN_INDEX = auto() + """ + A DATALOADN instruction has out-of-bounds index for the data section + """ """ diff --git a/tests/prague/eip7692_eof_v1/eip7480_data_section/test_code_validation.py b/tests/prague/eip7692_eof_v1/eip7480_data_section/test_code_validation.py index 650e383cee..3cf3658423 100644 --- a/tests/prague/eip7692_eof_v1/eip7480_data_section/test_code_validation.py +++ b/tests/prague/eip7692_eof_v1/eip7480_data_section/test_code_validation.py @@ -128,7 +128,7 @@ max_stack_height=1, ), ], - validity_error=EOFException.DEFAULT_EXCEPTION, + validity_error=EOFException.INVALID_DATALOADN_INDEX, ), Container( name="DATALOADN_max_small_data", @@ -141,7 +141,7 @@ ), Section.Data(data="1122334455667788" * 16), ], - validity_error=EOFException.DEFAULT_EXCEPTION, + validity_error=EOFException.INVALID_DATALOADN_INDEX, ), Container( name="DATALOADN_max_half_data", @@ -154,7 +154,7 @@ ), Section.Data(data=("1122334455667788" * 4 * 1024)[2:]), ], - validity_error=EOFException.DEFAULT_EXCEPTION, + validity_error=EOFException.INVALID_DATALOADN_INDEX, ), ]