diff --git a/libevmasm/CommonSubexpressionEliminator.h b/libevmasm/CommonSubexpressionEliminator.h index a09b1913f..cddc928aa 100644 --- a/libevmasm/CommonSubexpressionEliminator.h +++ b/libevmasm/CommonSubexpressionEliminator.h @@ -161,7 +161,7 @@ private: /// Current positions of equivalence classes, equal to the empty set if already deleted. std::map> m_classPositions; - /// The actual eqivalence class items and how to compute them. + /// The actual equivalence class items and how to compute them. ExpressionClasses& m_expressionClasses; /// Keeps information about which storage or memory slots were written to by which operations. /// The operations are sorted ascendingly by sequence number. diff --git a/test/tools/CMakeLists.txt b/test/tools/CMakeLists.txt index 9e44357bc..2cc31170f 100644 --- a/test/tools/CMakeLists.txt +++ b/test/tools/CMakeLists.txt @@ -33,4 +33,3 @@ add_executable(isoltest ../libyul/YulInterpreterTest.cpp ) target_link_libraries(isoltest PRIVATE libsolc solidity yulInterpreter evmasm ${Boost_PROGRAM_OPTIONS_LIBRARIES} ${Boost_UNIT_TEST_FRAMEWORK_LIBRARIES}) - diff --git a/test/tools/yulInterpreter/EVMInstructionInterpreter.cpp b/test/tools/yulInterpreter/EVMInstructionInterpreter.cpp index d9e916d4a..4b92edc18 100644 --- a/test/tools/yulInterpreter/EVMInstructionInterpreter.cpp +++ b/test/tools/yulInterpreter/EVMInstructionInterpreter.cpp @@ -132,7 +132,7 @@ u256 EVMInstructionInterpreter::eval( case Instruction::SLT: return u2s(arg[0]) < u2s(arg[1]) ? 1 : 0; case Instruction::SGT: - return u2s(arg[0]) < u2s(arg[1]) ? 1 : 0; + return u2s(arg[0]) > u2s(arg[1]) ? 1 : 0; case Instruction::EQ: return arg[0] == arg[1] ? 1 : 0; case Instruction::ISZERO: diff --git a/test/tools/yulInterpreter/EVMInstructionInterpreter.h b/test/tools/yulInterpreter/EVMInstructionInterpreter.h index 70033976f..1ce6dbd9a 100644 --- a/test/tools/yulInterpreter/EVMInstructionInterpreter.h +++ b/test/tools/yulInterpreter/EVMInstructionInterpreter.h @@ -58,7 +58,7 @@ struct InterpreterState; * - And many other things * * The main focus is that the generated execution trace is the same for equivalent executions - * and likely to be different for non-eqivalent executions. + * and likely to be different for non-equivalent executions. */ class EVMInstructionInterpreter { @@ -69,10 +69,10 @@ public: dev::u256 eval(dev::solidity::Instruction _instruction, std::vector const& _arguments); private: - /// Record a memory read in the trace. Also updaes m_state.msize + /// Record a memory read in the trace. Also updates m_state.msize /// @returns true if m_state.memory can be used at that offset. bool logMemoryRead(dev::u256 const& _offset, dev::u256 const& _size = 32); - /// Record a memory write in the trace. Also updaes m_state.msize + /// Record a memory write in the trace. Also updates m_state.msize /// @returns true if m_state.memory can be used at that offset. bool logMemoryWrite(dev::u256 const& _offset, dev::u256 const& _size = 32, dev::bytes const& _data = {}); diff --git a/test/tools/yulInterpreter/Interpreter.h b/test/tools/yulInterpreter/Interpreter.h index 572892867..267fe0a4d 100644 --- a/test/tools/yulInterpreter/Interpreter.h +++ b/test/tools/yulInterpreter/Interpreter.h @@ -30,11 +30,6 @@ #include -namespace dev -{ -using u120 = boost::multiprecision::number>; -} - namespace yul { namespace test @@ -53,15 +48,15 @@ struct InterpreterState /// This is different than memory.size() because we ignore gas. dev::u256 msize; std::map storage; - dev::u120 address = 0x11111111; + dev::u160 address = 0x11111111; dev::u256 balance = 0x22222222; - dev::u120 origin = 0x33333333; - dev::u120 caller = 0x44444444; + dev::u160 origin = 0x33333333; + dev::u160 caller = 0x44444444; dev::u256 callvalue = 0x55555555; /// Deployed code dev::bytes code = dev::asBytes("codecodecodecodecode"); dev::u256 gasprice = 0x66666666; - dev::u120 coinbase = 0x77777777; + dev::u160 coinbase = 0x77777777; dev::u256 timestamp = 0x88888888; dev::u256 blockNumber = 1024; dev::u256 difficulty = 0x9999999; @@ -88,14 +83,14 @@ public: m_functions(std::move(_functions)) {} - virtual void operator()(ExpressionStatement const& _statement) override; - virtual void operator()(Assignment const& _assignment) override; - virtual void operator()(VariableDeclaration const& _varDecl) override; - virtual void operator()(If const& _if) override; - virtual void operator()(Switch const& _switch) override; - virtual void operator()(FunctionDefinition const&) override; - virtual void operator()(ForLoop const&) override; - virtual void operator()(Block const& _block) override; + void operator()(ExpressionStatement const& _statement) override; + void operator()(Assignment const& _assignment) override; + void operator()(VariableDeclaration const& _varDecl) override; + void operator()(If const& _if) override; + void operator()(Switch const& _switch) override; + void operator()(FunctionDefinition const&) override; + void operator()(ForLoop const&) override; + void operator()(Block const& _block) override; std::vector const& trace() const { return m_state.trace; } @@ -136,10 +131,10 @@ public: m_functions(_functions) {} - virtual void operator()(Literal const&) override; - virtual void operator()(Identifier const&) override; - virtual void operator()(FunctionalInstruction const& _instr) override; - virtual void operator()(FunctionCall const& _funCall) override; + void operator()(Literal const&) override; + void operator()(Identifier const&) override; + void operator()(FunctionalInstruction const& _instr) override; + void operator()(FunctionCall const& _funCall) override; /// Asserts that the expression has exactly one value and returns it. dev::u256 value() const;