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

Add EOF Errors to evmone configuration #225

Merged
merged 2 commits into from
Mar 27, 2024
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion retesteth/configs/Options.h
Original file line number Diff line number Diff line change
Expand Up @@ -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, \
Expand Down
72 changes: 49 additions & 23 deletions retesteth/configs/clientconfigs/evmone.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ string const evmone_config = R"({
"London",
"Paris",
"Shanghai",
"Cancun"
"Cancun",
"Prague"
],
"additionalForks" : [
"FrontierToHomesteadAt5",
Expand Down Expand Up @@ -278,42 +279,66 @@ 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"
}
})";

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
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to check if it still works with .py tests.

elif [ $1 = "-v" ]; then
evmone -v
evmone-t8n -v
elif [ $1 = "eof" ]; then
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
Expand All @@ -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
)";
Expand Down
30 changes: 30 additions & 0 deletions retesteth/configs/genesis/default/Prague.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#include <retesteth/configs/Options.h>
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
3 changes: 2 additions & 1 deletion retesteth/testSuites/Common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down