mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #12586 from ethereum/disable-gas-comparison
Code transform fuzzer: Filter log statements and remove gas comparison.
This commit is contained in:
commit
597426bd1c
@ -71,11 +71,6 @@ DEFINE_PROTO_FUZZER(Program const& _input)
|
|||||||
of.write(yul_source.data(), static_cast<streamsize>(yul_source.size()));
|
of.write(yul_source.data(), static_cast<streamsize>(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();
|
YulStringRepository::reset();
|
||||||
|
|
||||||
solidity::frontend::OptimiserSettings settings = solidity::frontend::OptimiserSettings::full();
|
solidity::frontend::OptimiserSettings settings = solidity::frontend::OptimiserSettings::full();
|
||||||
@ -162,18 +157,6 @@ DEFINE_PROTO_FUZZER(Program const& _input)
|
|||||||
ostringstream optimizedState;
|
ostringstream optimizedState;
|
||||||
optimizedState << EVMHostPrinter{hostContext, deployResultOpt.create_address}.state();
|
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(
|
solAssert(
|
||||||
unoptimizedState.str() == optimizedState.str(),
|
unoptimizedState.str() == optimizedState.str(),
|
||||||
"State of unoptimised and optimised stack reused code do not match."
|
"State of unoptimised and optimised stack reused code do not match."
|
||||||
|
@ -1348,7 +1348,9 @@ void ProtoConverter::visit(Statement const& _x)
|
|||||||
m_output << "continue\n";
|
m_output << "continue\n";
|
||||||
break;
|
break;
|
||||||
case Statement::kLogFunc:
|
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;
|
break;
|
||||||
case Statement::kCopyFunc:
|
case Statement::kCopyFunc:
|
||||||
visit(_x.copy_func());
|
visit(_x.copy_func());
|
||||||
|
Loading…
Reference in New Issue
Block a user