Skip to content

Commit 597426b

Browse files
authored
Merge pull request #12586 from ethereum/disable-gas-comparison
Code transform fuzzer: Filter log statements and remove gas comparison.
2 parents 6f59e22 + cfda0e4 commit 597426b

File tree

2 files changed

+3
-18
lines changed

2 files changed

+3
-18
lines changed

test/tools/ossfuzz/StackReuseCodegenFuzzer.cpp

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -71,11 +71,6 @@ DEFINE_PROTO_FUZZER(Program const& _input)
7171
of.write(yul_source.data(), static_cast<streamsize>(yul_source.size()));
7272
}
7373

74-
// Do not proceed with tests that are too large. 1200 is an arbitrary
75-
// threshold.
76-
if (yul_source.size() > 1200)
77-
return;
78-
7974
YulStringRepository::reset();
8075

8176
solidity::frontend::OptimiserSettings settings = solidity::frontend::OptimiserSettings::full();
@@ -162,18 +157,6 @@ DEFINE_PROTO_FUZZER(Program const& _input)
162157
ostringstream optimizedState;
163158
optimizedState << EVMHostPrinter{hostContext, deployResultOpt.create_address}.state();
164159

165-
int64_t constexpr tolerance = 1000;
166-
if (callResult.gas_left > callResultOpt.gas_left)
167-
if (callResult.gas_left - callResultOpt.gas_left > tolerance)
168-
{
169-
cout << "Gas differential " << callResult.gas_left - callResultOpt.gas_left << endl;
170-
cout << "Unoptimised bytecode" << endl;
171-
cout << util::toHex(unoptimisedByteCode) << endl;
172-
cout << "Optimised bytecode" << endl;
173-
cout << util::toHex(optimisedByteCode) << endl;
174-
solAssert(false, "Optimised code consumed more than +1000 gas.");
175-
}
176-
177160
solAssert(
178161
unoptimizedState.str() == optimizedState.str(),
179162
"State of unoptimised and optimised stack reused code do not match."

test/tools/ossfuzz/protoToYul.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1348,7 +1348,9 @@ void ProtoConverter::visit(Statement const& _x)
13481348
m_output << "continue\n";
13491349
break;
13501350
case Statement::kLogFunc:
1351-
visit(_x.log_func());
1351+
// Log is a stateful statement since it writes to storage.
1352+
if (!m_filterStatefulInstructions)
1353+
visit(_x.log_func());
13521354
break;
13531355
case Statement::kCopyFunc:
13541356
visit(_x.copy_func());

0 commit comments

Comments
 (0)