diff --git a/lib/evmone/eof.cpp b/lib/evmone/eof.cpp index 530f83bf05..1725696f4f 100644 --- a/lib/evmone/eof.cpp +++ b/lib/evmone/eof.cpp @@ -6,6 +6,7 @@ #include "baseline_instruction_table.hpp" #include "instructions_traits.hpp" +#include #include #include #include @@ -48,8 +49,19 @@ size_t eof_header_size(const EOFSectionHeaders& headers) noexcept EOFValidationError get_section_missing_error(uint8_t section_id) noexcept { - return static_cast( - static_cast(EOFValidationError::header_terminator_missing) + section_id); + switch (section_id) + { + case TERMINATOR: + return EOFValidationError::header_terminator_missing; + case TYPE_SECTION: + return EOFValidationError::type_section_missing; + case CODE_SECTION: + return EOFValidationError::code_section_missing; + case DATA_SECTION: + return EOFValidationError::data_section_missing; + default: + intx::unreachable(); + } } std::variant validate_eof_headers(bytes_view container) @@ -565,8 +577,6 @@ std::string_view get_error_message(EOFValidationError err) noexcept return "type_section_missing"; case EOFValidationError::code_section_missing: return "code_section_missing"; - case EOFValidationError::unknown_section_id: - return "unknown_section_id"; case EOFValidationError::data_section_missing: return "data_section_missing"; case EOFValidationError::zero_section_size: diff --git a/lib/evmone/eof.hpp b/lib/evmone/eof.hpp index d77f96fe71..dea647c163 100644 --- a/lib/evmone/eof.hpp +++ b/lib/evmone/eof.hpp @@ -69,7 +69,6 @@ enum class EOFValidationError header_terminator_missing, type_section_missing, code_section_missing, - unknown_section_id, data_section_missing, zero_section_size, section_headers_not_terminated,