From cfda0e41ce8099646c847ab519b67866c7b0ab38 Mon Sep 17 00:00:00 2001 From: Bhargava Shastry Date: Wed, 26 Jan 2022 15:58:12 +0100 Subject: [PATCH] Filter log statements and remove gas comparison. --- test/tools/ossfuzz/StackReuseCodegenFuzzer.cpp | 17 ----------------- test/tools/ossfuzz/protoToYul.cpp | 4 +++- 2 files changed, 3 insertions(+), 18 deletions(-) diff --git a/test/tools/ossfuzz/StackReuseCodegenFuzzer.cpp b/test/tools/ossfuzz/StackReuseCodegenFuzzer.cpp index 89acd2c09..7c045b47a 100644 --- a/test/tools/ossfuzz/StackReuseCodegenFuzzer.cpp +++ b/test/tools/ossfuzz/StackReuseCodegenFuzzer.cpp @@ -71,11 +71,6 @@ DEFINE_PROTO_FUZZER(Program const& _input) of.write(yul_source.data(), static_cast(yul_source.size())); } - // Do not proceed with tests that are too large. 1200 is an arbitrary - // threshold. - if (yul_source.size() > 1200) - return; - YulStringRepository::reset(); solidity::frontend::OptimiserSettings settings = solidity::frontend::OptimiserSettings::full(); @@ -162,18 +157,6 @@ DEFINE_PROTO_FUZZER(Program const& _input) ostringstream optimizedState; optimizedState << EVMHostPrinter{hostContext, deployResultOpt.create_address}.state(); - int64_t constexpr tolerance = 1000; - if (callResult.gas_left > callResultOpt.gas_left) - if (callResult.gas_left - callResultOpt.gas_left > tolerance) - { - cout << "Gas differential " << callResult.gas_left - callResultOpt.gas_left << endl; - cout << "Unoptimised bytecode" << endl; - cout << util::toHex(unoptimisedByteCode) << endl; - cout << "Optimised bytecode" << endl; - cout << util::toHex(optimisedByteCode) << endl; - solAssert(false, "Optimised code consumed more than +1000 gas."); - } - solAssert( unoptimizedState.str() == optimizedState.str(), "State of unoptimised and optimised stack reused code do not match." diff --git a/test/tools/ossfuzz/protoToYul.cpp b/test/tools/ossfuzz/protoToYul.cpp index 599e6153e..f6759dddb 100644 --- a/test/tools/ossfuzz/protoToYul.cpp +++ b/test/tools/ossfuzz/protoToYul.cpp @@ -1348,7 +1348,9 @@ void ProtoConverter::visit(Statement const& _x) m_output << "continue\n"; break; case Statement::kLogFunc: - visit(_x.log_func()); + // Log is a stateful statement since it writes to storage. + if (!m_filterStatefulInstructions) + visit(_x.log_func()); break; case Statement::kCopyFunc: visit(_x.copy_func());