Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
bb::nodejs::AvmSimulateNapi Class Reference

NAPI wrapper for the C++ AVM simulation. More...

#include <avm_simulate_napi.hpp>

Static Public Member Functions

static Napi::Value simulate (const Napi::CallbackInfo &info)
 NAPI function to simulate AVM execution.
 
static Napi::Value simulateWithHintedDbs (const Napi::CallbackInfo &info)
 NAPI function to simulate AVM execution with pre-collected hints.
 

Detailed Description

NAPI wrapper for the C++ AVM simulation.

This class provides the bridge between TypeScript and the C++ avm_simulate*() functions. It handles deserialization of inputs, execution on a worker thread, and serialization of results.

The simulate variation uses real world state and uses callbacks to TS for contract DB.

The simulateWithHintedDbs variation uses pre-collected hints for world state and contracts DB. There are no callbacks to TS or direct calls to world state.

Definition at line 18 of file avm_simulate_napi.hpp.

Member Function Documentation

◆ simulate()

Napi::Value bb::nodejs::AvmSimulateNapi::simulate ( const Napi::CallbackInfo &  info)
static

NAPI function to simulate AVM execution.

Expected arguments:

  • info[0]: Buffer containing serialized AvmFastSimulationInputs (msgpack)
  • info[1]: Object with contract provider callbacks:
    • getContractInstance(address: string): Promise<Buffer | undefined>
    • getContractClass(classId: string): Promise<Buffer | undefined>
  • info[2]: External WorldState handle (pointer to world_state::WorldState)

Returns: Promise<Buffer> containing serialized simulation results

Parameters
infoNAPI callback info containing arguments
Returns
Napi::Value Promise that resolves with simulation results

Definition at line 115 of file avm_simulate_napi.cpp.

◆ simulateWithHintedDbs()

Napi::Value bb::nodejs::AvmSimulateNapi::simulateWithHintedDbs ( const Napi::CallbackInfo &  info)
static

NAPI function to simulate AVM execution with pre-collected hints.

Expected arguments:

  • info[0]: Buffer containing serialized AvmProvingInputs (msgpack)
Parameters
infoNAPI callback info containing arguments
Returns
Napi::Value Promise that resolves with simulation results

Definition at line 235 of file avm_simulate_napi.cpp.


The documentation for this class was generated from the following files: