From b8febaa15acf50e17fc2da416c22637d71bd6efa Mon Sep 17 00:00:00 2001 From: Hugo De La Cruz Date: Tue, 27 Feb 2024 20:51:11 -0700 Subject: [PATCH 1/2] Add new evmone errors --- retesteth/configs/Options.h | 2 +- retesteth/configs/clientconfigs/evmone.cpp | 72 +++++++++++++------- retesteth/configs/genesis/default/Prague.cpp | 30 ++++++++ 3 files changed, 80 insertions(+), 24 deletions(-) create mode 100644 retesteth/configs/genesis/default/Prague.cpp diff --git a/retesteth/configs/Options.h b/retesteth/configs/Options.h index 3e69c3040..c38dc6750 100644 --- a/retesteth/configs/Options.h +++ b/retesteth/configs/Options.h @@ -16,7 +16,7 @@ extern std::string const t8ntool_start; #define DECLARE_T8NTOOL(X) \ FOR_EACH(X, t8ntoolcfg, RewardsCfg, FrontierCfg, HomesteadCfg, EIP150Cfg, EIP158Cfg, ByzantiumCfg, \ ConstantinopleCfg, ConstantinopleFixCfg, IstanbulCfg, BerlinCfg, LondonCfg, ParisCfg, MergeCfg, \ - ShanghaiCfg, CancunCfg, \ + ShanghaiCfg, CancunCfg, PragueCfg, \ ArrowGlacierCfg, GrayGlacierCfg, ArrowGlacierToParisAtDiffC0000Cfg, ParisToShanghaiAtTime15kCfg, \ ShanghaiToCancunAtTime15kCfg, \ FrontierToHomesteadCfg, HomesteadToDaoCfg, HomesteadToEIP150Cfg, EIP158ToByzantiumCfg, \ diff --git a/retesteth/configs/clientconfigs/evmone.cpp b/retesteth/configs/clientconfigs/evmone.cpp index 29f77a82f..352fb1b70 100644 --- a/retesteth/configs/clientconfigs/evmone.cpp +++ b/retesteth/configs/clientconfigs/evmone.cpp @@ -39,7 +39,8 @@ string const evmone_config = R"({ "London", "Paris", "Shanghai", - "Cancun" + "Cancun", + "Prague" ], "additionalForks" : [ "FrontierToHomesteadAt5", @@ -278,25 +279,41 @@ string const evmone_config = R"({ "INPUT_UNMARSHAL_ERROR" : "cannot unmarshal hex", "INPUT_UNMARSHAL_SIZE_ERROR" : "failed unmarshaling", "RLP_BODY_UNMARSHAL_ERROR" : "Rlp structure is wrong", - "EOF_ConflictingStackHeight": "err: stack_height_mismatch", - "EOF_StackUnderflow" : "err: stack_underflow", - "EOF_InvalidCodeTermination" : "err: no_terminating_instruction", - "EOF_MaxStackHeightExceeded" : "err: max_stack_height_above_limit", - "EOF_UnreachableCode": "err: unreachable_instructions", - "EOF_InvalidCode": "err: invalid_code", - "EOF_TruncatedImmediate": "err: truncated_instruction", - "EOF_InvalidJumpDestination": "err: invalid_rjump_destination", - "EOF_InvalidJumpTableCount": "err: invalid_rjumpv_count", + "EOF_InvalidPrefix" : "err: invalid_prefix", + "EOF_UnknownVersion" : "err: eof_version_unknown", + "EOF_IncompleteSectionSize" : "err: incomplete_section_size", + "EOF_IncompleteSectionNumber": "err: incomplete_section_number", + "EOF_HeaderTerminatorMissing": "err: header_terminator_missing", "EOF_TypeSectionMissing": "err: type_section_missing", "EOF_CodeSectionMissing": "err: code_section_missing", + "EOF_DataSectionMissing": "err: data_section_missing", + "EOF_ZeroSectionSize": "err: zero_section_size", + "EOF_SectionHeadersNotTerminated": "err: section_headers_not_terminated", + "EOF_InvalidSectionBodiesSize": "err: invalid_section_bodies_size", + "EOF_UnreachableCodeSections" : "err: unreachable_code_sections", + "EOF_UndefinedInstruction": "err: undefined_instruction", + "EOF_TruncatedImmediate": "err: truncated_instruction", + "EOF_InvalidJumpDestination": "err: invalid_rjump_destination", + "EOF_TooManyCodeSections": "err: too_many_code_sections", "EOF_InvalidTypeSectionSize": "err: invalid_type_section_size", "EOF_InvalidFirstSectionType": "err: invalid_first_section_type", - "EOF_TooManyCodeSections": "err: too_many_code_sections", + "EOF_InvalidMaxStackHeight": "err: invalid_max_stack_height", + "EOF_InvalidCodeTermination": "err: no_terminating_instruction", + "EOF_ConflictingStackHeight": "err: stack_height_mismatch", + "EOF_InvalidNumberOfOutputs": "err: stack_higher_than_outputs_required", + "EOF_MaxStackHeightExceeded": "err: max_stack_height_above_limit", + "EOF_UnreachableCode": "err: unreachable_instructions", + "EOF_InputsOutputsNumAboveLimit": "err: inputs_outputs_num_above_limit", + "EOF_StackUnderflow": "err: stack_underflow", + "EOF_StackOverflow": "err: stack_overflow", "EOF_InvalidCodeSectionIndex": "err: invalid_code_section_index", - "EOF_UndefinedInstruction": "err: undefined_instruction", - "EOF_ZeroSectionSize": "err: zero_section_size", - "EOF_NonEmptyStackOnTerminatingInstruction": "err: non_empty_stack_on_terminating_instruction", - "EOF_InvalidSectionBodiesSize": "err: invalid_section_bodies_size", + "EOF_InvalidDataloadnIndex": "err: invalid_dataloadn_index", + "EOF_JumpfDestinationIncompatibleOutputs": "err: jumpf_destination_incompatible_outputs", + "EOF_CallfToNonReturningFunction": "err: callf_to_non_returning_function", + "EOF_TooManyContainerSections": "err: too_many_container_sections", + "EOF_InvalidContainerSectionIndex": "err: invalid_container_section_index", + "EOF_EofCreateWithTruncatedContainer": "err: eof_create_with_truncated_container", + "EOF_InvalidNonReturningFlag" : "err: invalid_non_returning_flag", "PostParisUncleHashIsNotEmpty" : "block.uncleHash != empty", "PostParisDifficultyIsNot0" : "block.difficulty must be 0" } @@ -304,16 +321,24 @@ string const evmone_config = R"({ string const evmone_start = R"(#!/bin/sh -wevm=$(which evmone) +wevm=$(which evmone-t8n) if [ -z $wevm ]; then - >&2 echo "Can't find EvmOne's 'evmone' executable alias in the system path!" + >&2 echo "Can't find EvmOne's 'evmone-t8n' executable alias in the system path!" exit 1 fi -if [ $1 = "eof" ] || [ $1 = "t8n" ] || [ $1 = "b11r" ]; then - evmone $1 $2 $3 $4 $5 $6 $7 $8 $9 $10 $11 $12 $13 $14 $15 $16 $17 $18 $19 $20 $21 $22 $23 $24 $25 $26 +if [ $1 = "t8n" ] || [ $1 = "b11r" ]; then + evmone-t8n $2 $3 $4 $5 $6 $7 $8 $9 $10 $11 $12 $13 $14 $15 $16 $17 $18 $19 $20 $21 $22 $23 $24 $25 $26 elif [ $1 = "-v" ]; then - evmone -v + evmone-t8n -v +elif [ $1 = "eof" ]; then + result=$(echo $5 | evmone-eofparse) + echo $result | grep "OK" > /dev/null + if [ $? -eq 0 ]; then + echo "ok." + else + echo "$result" + fi else stateProvided=0 readErrorLog=0 @@ -336,12 +361,13 @@ else done if [ $stateProvided -eq 1 ]; then if [ -z $errorLogFile ]; then - evmone $cmdArgs --verbosity 2 + evmone-t8n $cmdArgs --verbosity 2 else - evmone $cmdArgs --verbosity 2 2> $errorLogFile + evmone-t8n $cmdArgs --verbosity 2 2> $errorLogFile fi else - evmone t9n $cmdArgs 2> $errorLogFile + echo "Error: evmone-t9n not supported" + exit 2 fi fi )"; diff --git a/retesteth/configs/genesis/default/Prague.cpp b/retesteth/configs/genesis/default/Prague.cpp new file mode 100644 index 000000000..f08e71694 --- /dev/null +++ b/retesteth/configs/genesis/default/Prague.cpp @@ -0,0 +1,30 @@ +#include +using namespace std; +using namespace dataobject; + +namespace retesteth::options +{ +genPragueCfg::genPragueCfg() +{ + +const string t8ntool_Prague_config = R"({ + "params" : { + "fork" : "Prague", + "terminalTotalDifficulty" : "0x00", + "constantinopleForkBlock" : "0x00", + "byzantiumForkBlock" : "0x00", + "homesteadForkBlock" : "0x00", + "chainID" : "0x01" + }, + "accounts" : { + } +})"; + + { + spDataObject obj; + (*obj)["path"] = "default/genesis/Prague.json"; + (*obj)["content"] = t8ntool_Prague_config; + map_configs.addArrayObject(obj); + } +} +} // namespace retesteth::options From a7cdb58650b63b0e4f6bd7732f097c3ffe51795b Mon Sep 17 00:00:00 2001 From: Dimitry Kh Date: Thu, 21 Mar 2024 10:00:20 +0100 Subject: [PATCH 2/2] evmone-eofparse fix --- retesteth/configs/clientconfigs/evmone.cpp | 12 ++++++------ retesteth/testSuites/Common.cpp | 3 ++- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/retesteth/configs/clientconfigs/evmone.cpp b/retesteth/configs/clientconfigs/evmone.cpp index 352fb1b70..6477acd2a 100644 --- a/retesteth/configs/clientconfigs/evmone.cpp +++ b/retesteth/configs/clientconfigs/evmone.cpp @@ -332,13 +332,13 @@ if [ $1 = "t8n" ] || [ $1 = "b11r" ]; then elif [ $1 = "-v" ]; then evmone-t8n -v elif [ $1 = "eof" ]; then - result=$(echo $5 | evmone-eofparse) - echo $result | grep "OK" > /dev/null - if [ $? -eq 0 ]; then - echo "ok." - else - echo "$result" + wevm=$(which evmone-eofparse) + if [ -z $wevm ]; then + >&2 echo "Can't find EvmOne's 'evmone-eofparse' executable alias in the system path!" + exit 1 fi + result=$(echo $5 | evmone-eofparse) + echo "$result" else stateProvided=0 readErrorLog=0 diff --git a/retesteth/testSuites/Common.cpp b/retesteth/testSuites/Common.cpp index 0f41d9ca7..bd3e8b407 100644 --- a/retesteth/testSuites/Common.cpp +++ b/retesteth/testSuites/Common.cpp @@ -125,7 +125,8 @@ void compareTransactionException(spTransaction const& _tr, MineBlocksResult cons void compareEOFException(BYTES const& _code, std::string const& _mRes, std::string const& _testException) { - string const remoteException = _mRes == "ok." ? "" : _mRes; + bool const hasOk = (_mRes.find("ok.") != string::npos || _mRes.find("OK") != string::npos); + string const remoteException = hasOk ? "" : _mRes; if (!_testException.empty() && remoteException.empty()) ETH_ERROR_MESSAGE("Client didn't reject EOF code: (" + _code.asString() + ")" + "\nTest Expected: " + _testException);