19 bool logging_enabled =
std::getenv(
"AVM_FUZZER_LOGGING") !=
nullptr;
24 if (logging_enabled) {
25 info(
"Fuzzer data: ", fuzzer_data);
28 if (logging_enabled) {
41 cpp_result = cpp_simulator.simulate(*ws_mgr,
bytecode, fuzzer_data.
calldata);
43 }
catch (
const std::exception& e) {
44 info(
"CppSimulator failed with error: ", e.what());
45 throw std::runtime_error(
"Error simulating with CppSimulator");
53 info(
"CppSimulator result: ");
55 info(
"JsSimulator result: ");
57 throw std::runtime_error(
"Simulator results are different");
59 if (logging_enabled) {
60 info(
"Simulator results match successfully");
const FF CONTRACT_ADDRESS
std::shared_ptr< Napi::ThreadSafeFunction > bytecode
uses barretenberg/vm2 to simulate the bytecode
uses the yarn-project/simulator to simulate the bytecode Singleton, because initializing the simulato...
static JsSimulator * getInstance()
SimulatorResult simulate(fuzzer::FuzzerWorldStateManager &ws_mgr, const std::vector< uint8_t > &bytecode, const std::vector< FF > &calldata) override
static FuzzerWorldStateManager * getInstance()
void register_contract_address(const AztecAddress &contract_address)
void log_result(const SimulatorResult &result)
SimulatorResult fuzz(FuzzerData &fuzzer_data)
fuzz CPP vs JS simulator with the given fuzzer data
constexpr decltype(auto) get(::tuplet::tuple< T... > &&t) noexcept
bool compare_simulator_results(const SimulatorResult &result1, const SimulatorResult &result2)
describes the data which will be used for fuzzing Should contain instructions, calldata,...
ReturnOptions return_options
std::vector< bb::avm2::FF > calldata
std::vector< CFGInstruction > cfg_instructions
std::vector< std::vector< FuzzInstruction > > instruction_blocks
std::string revert_reason