feat!(avm-server): Per-call current_peer_id (#381)

The current peer ID is passed as a new field of `TestRunParameters` named
`current_peer_id: String`, instead of creating an AVM with peer ID.

This is a breaking API change of `avm-interface` and `avm-server`.
This commit is contained in:
Ivan Boldyrev 2022-11-25 10:59:09 +03:00 committed by GitHub
parent 4e86da7eda
commit becdedc364
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
22 changed files with 206 additions and 85 deletions

7
Cargo.lock generated
View File

@ -176,13 +176,14 @@ dependencies = [
[[package]]
name = "air-test-utils"
version = "0.3.0"
version = "0.4.0"
dependencies = [
"air",
"air-interpreter-interface",
"avm-interface",
"avm-server",
"fstrings",
"maplit",
"marine-rs-sdk",
"object-pool",
"once_cell",
@ -319,7 +320,7 @@ dependencies = [
[[package]]
name = "avm-interface"
version = "0.26.1"
version = "0.27.0"
dependencies = [
"air-interpreter-interface",
"air-utils",
@ -335,7 +336,7 @@ dependencies = [
[[package]]
name = "avm-server"
version = "0.26.1"
version = "0.27.0"
dependencies = [
"air-interpreter-interface",
"air-utils",

View File

@ -45,7 +45,7 @@ fn issue_177() {
// client 1: demand result for (call %init_peer_id% ("getDataSrv" "-relay-") [] -relay-)
let client_result_1 = client
.runner
.call(script, "", "", client_peer_id, 0, 0, HashMap::new())
.call(script, "", "", client_peer_id, 0, 0, None, HashMap::new())
.expect("call should be success");
let expected_call_requests = maplit::hashmap! {
1 => CallRequestParams::new("getDataSrv", "-relay-", vec![], vec![]),
@ -59,7 +59,16 @@ fn issue_177() {
// client 2: send result to the specified relay
let client_result_2 = client
.runner
.call(script, client_result_1.data, "", client_peer_id, 0, 0, call_results)
.call(
script,
client_result_1.data,
"",
client_peer_id,
0,
0,
None,
call_results,
)
.expect("call should be success");
assert!(client_result_2.call_requests.is_empty());
assert_eq!(client_result_2.next_peer_pks, vec![relay_peer_id.to_string()]);
@ -74,6 +83,7 @@ fn issue_177() {
client_peer_id,
0,
0,
None,
HashMap::new(),
)
.expect("call should be success");
@ -96,6 +106,7 @@ fn issue_177() {
client_peer_id,
0,
0,
None,
call_results,
)
.expect("call should be success");
@ -114,6 +125,7 @@ fn issue_177() {
client_peer_id,
0,
0,
None,
call_results,
)
.expect("call should be success");
@ -132,6 +144,7 @@ fn issue_177() {
client_peer_id,
0,
0,
None,
call_results,
)
.expect("call should be success");
@ -147,6 +160,7 @@ fn issue_177() {
client_peer_id,
0,
0,
None,
HashMap::new(),
)
.expect("call should be success");
@ -163,7 +177,16 @@ fn issue_177() {
// demand a result for (call %init_peer_id% ("peer" "timeout") [1000 "timeout"])
let client_result_4 = client
.runner
.call(script, client_result_3.data, "", client_peer_id, 0, 0, call_results)
.call(
script,
client_result_3.data,
"",
client_peer_id,
0,
0,
None,
call_results,
)
.expect("call should be success");
let expected_call_requests = maplit::hashmap! {
3 => CallRequestParams::new("peer", "timeout", vec![json!(1000u64), json!("timeout")], vec![
@ -178,9 +201,16 @@ fn issue_177() {
};
// timeout requests provided
let client_result_5 = client
.runner
.call(script, client_result_4.data, "", client_peer_id, 0, 0, call_results);
let client_result_5 = client.runner.call(
script,
client_result_4.data,
"",
client_peer_id,
0,
0,
None,
call_results,
);
// before patch the interpreter crashed here
assert!(client_result_5.is_ok());
}

View File

@ -6,6 +6,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
## [0.27.0] - 2022-11-22
### Added
- Add `current_peer_id` field to the `ParticleParameters`
### Changed
- `ParticleParameters` now has only single lifetime parameter
## [0.26.1] - 2022-09-13
### Fixed

View File

@ -1,7 +1,7 @@
[package]
name = "avm-interface"
description = "Fluence AIR VM interfacing"
version = "0.26.1"
version = "0.27.0"
authors = ["Fluence Labs"]
edition = "2018"
license = "Apache-2.0"

View File

@ -20,25 +20,28 @@ use std::borrow::Cow;
/// Represents parameters obtained from a particle.
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct ParticleParameters<'init_peer_id, 'particle_id> {
pub init_peer_id: Cow<'init_peer_id, str>,
pub particle_id: Cow<'particle_id, str>,
pub struct ParticleParameters<'ctx> {
pub init_peer_id: Cow<'ctx, str>,
pub particle_id: Cow<'ctx, str>,
pub timestamp: u64,
pub ttl: u32,
pub current_peer_id: Cow<'ctx, str>,
}
impl<'init_peer_id, 'particle_id> ParticleParameters<'init_peer_id, 'particle_id> {
impl<'ctx> ParticleParameters<'ctx> {
pub fn new(
init_peer_id: Cow<'init_peer_id, str>,
particle_id: Cow<'particle_id, str>,
init_peer_id: Cow<'ctx, str>,
particle_id: Cow<'ctx, str>,
timestamp: u64,
ttl: u32,
current_peer_id: Cow<'ctx, str>,
) -> Self {
Self {
init_peer_id,
particle_id,
timestamp,
ttl,
current_peer_id,
}
}
}

View File

@ -6,6 +6,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
## [0.27.0] - 2022-11-22
### Changed
- Move `current_peer_id` field/argument to the `ParticleParameters`.
It is removed from both `AVMConfig` and `AVMRunner::new`, but added to `AVMRunner::call`/`AVMRunner::call_tracing`.
- `ParticleParameters` now has only single lifetime parameter
- Update `avm-interface` version
## [0.26.1] - 2022-09-13
### Other

View File

@ -1,7 +1,7 @@
[package]
name = "avm-server"
description = "Fluence AIR VM"
version = "0.26.1"
version = "0.27.0"
authors = ["Fluence Labs"]
edition = "2018"
license = "Apache-2.0"
@ -20,7 +20,7 @@ air-utils = { version = "0.1.0", path = "../../crates/air-lib/utils" }
avm-data-store = { version = "0.4.1", path = "../../crates/data-store" }
marine-runtime = "0.23.1"
polyplets = { version = "0.3.2", path = "../../crates/air-lib/polyplets" }
avm-interface = { version = "0.26.1", path = "../../avm/interface" }
avm-interface = { version = "0.27.0", path = "../../avm/interface" }
eyre = "0.6.8"
thiserror = "1.0.37"

View File

@ -62,7 +62,6 @@ impl<E> AVM<E> {
pub fn new(config: AVMConfig<E>) -> AVMResult<Self, E> {
let AVMConfig {
air_wasm_path,
current_peer_id,
max_heap_size,
logging_mask,
mut data_store,
@ -70,7 +69,7 @@ impl<E> AVM<E> {
data_store.initialize()?;
let runner = AVMRunner::new(air_wasm_path, current_peer_id, max_heap_size, logging_mask)
let runner = AVMRunner::new(air_wasm_path, max_heap_size, logging_mask)
.map_err(AVMError::RunnerError)?;
let runner = SendSafeRunner(runner);
let avm = Self { runner, data_store };
@ -83,7 +82,7 @@ impl<E> AVM<E> {
&mut self,
air: impl Into<String>,
data: impl Into<Vec<u8>>,
particle_parameters: ParticleParameters<'_, '_>,
particle_parameters: ParticleParameters<'_>,
call_results: CallResults,
) -> AVMResult<AVMOutcome, E> {
let air = air.into();
@ -102,6 +101,7 @@ impl<E> AVM<E> {
particle_parameters.init_peer_id.clone().into_owned(),
particle_parameters.timestamp,
particle_parameters.ttl,
particle_parameters.current_peer_id.clone(),
call_results,
)
.map_err(AVMError::RunnerError)?;
@ -144,7 +144,7 @@ impl<E> AVM<E> {
&mut self,
air_script: &str,
current_data: &[u8],
particle_parameters: &ParticleParameters<'_, '_>,
particle_parameters: &ParticleParameters<'_>,
avm_outcome: &RawAVMOutcome,
execution_time: Duration,
memory_delta: usize,

View File

@ -22,9 +22,6 @@ pub struct AVMConfig<E> {
/// Path to a AIR interpreter Wasm file.
pub air_wasm_path: PathBuf,
/// Current peer id.
pub current_peer_id: String,
/// Maximum heap size in bytes available for the interpreter.
pub max_heap_size: Option<u64>,

View File

@ -30,7 +30,6 @@ use std::path::PathBuf;
pub struct AVMRunner {
marine: Marine,
current_peer_id: String,
/// file name of the AIR interpreter .wasm
wasm_filename: String,
}
@ -48,7 +47,6 @@ impl AVMRunner {
/// Create AVM with the provided config.
pub fn new(
air_wasm_path: PathBuf,
current_peer_id: impl Into<String>,
max_heap_size: Option<u64>,
logging_mask: i32,
) -> RunnerResult<Self> {
@ -57,11 +55,9 @@ impl AVMRunner {
let marine_config =
make_marine_config(wasm_dir, &wasm_filename, max_heap_size, logging_mask);
let marine = Marine::with_raw_config(marine_config)?;
let current_peer_id = current_peer_id.into();
let avm = Self {
marine,
current_peer_id,
wasm_filename,
};
@ -78,13 +74,14 @@ impl AVMRunner {
init_peer_id: impl Into<String>,
timestamp: u64,
ttl: u32,
current_peer_id: impl Into<String>,
call_results: CallResults,
) -> RunnerResult<RawAVMOutcome> {
let args = prepare_args(
air,
prev_data,
data,
self.current_peer_id.clone(),
current_peer_id.into(),
init_peer_id.into(),
timestamp,
ttl,
@ -117,6 +114,7 @@ impl AVMRunner {
init_peer_id: impl Into<String>,
timestamp: u64,
ttl: u32,
current_peer_id: impl Into<String>,
call_results: CallResults,
tracing_params: String,
tracing_output_mode: u8,
@ -125,7 +123,7 @@ impl AVMRunner {
air,
prev_data,
data,
self.current_peer_id.clone(),
current_peer_id.into(),
init_peer_id.into(),
timestamp,
ttl,
@ -165,11 +163,6 @@ impl AVMRunner {
max_memory_size: stats[0].max_memory_size,
}
}
#[inline]
pub fn set_peer_id(&mut self, current_peer_id: impl Into<String>) {
self.current_peer_id = current_peer_id.into();
}
}
#[allow(clippy::too_many_arguments)]

View File

@ -1,6 +1,6 @@
[package]
name = "air-test-utils"
version = "0.3.0"
version = "0.4.0"
description = "Test utils for the AIR interpreter"
authors = ["Fluence Labs"]
edition = "2018"
@ -26,5 +26,8 @@ once_cell = "1.16.0"
semver = "1.0.14"
serde_json = "1.0.89"
[dev-dependencies]
maplit = "1.0.2"
[features]
test_with_native_code = []

View File

@ -38,19 +38,23 @@ impl AirRunner for NativeAirRunner {
init_peer_id: impl Into<String>,
timestamp: u64,
ttl: u32,
override_current_peer_id: Option<String>,
call_results: avm_server::CallResults,
) -> Result<RawAVMOutcome, Box<dyn std::error::Error>> {
// some inner parts transformations
let raw_call_results = into_raw_result(call_results);
let raw_call_results = serde_json::to_vec(&raw_call_results).unwrap();
let current_peer_id =
override_current_peer_id.unwrap_or_else(|| self.current_peer_id.clone());
let outcome = air::execute_air(
air.into(),
prev_data.into(),
data.into(),
RunParameters {
init_peer_id: init_peer_id.into(),
current_peer_id: self.current_peer_id.clone(),
current_peer_id,
timestamp,
ttl,
},

View File

@ -37,6 +37,7 @@ pub trait AirRunner {
init_peer_id: impl Into<String>,
timestamp: u64,
ttl: u32,
override_current_peer_id: Option<String>,
call_results: avm_server::CallResults,
) -> Result<RawAVMOutcome, Box<dyn std::error::Error>>;
}
@ -51,6 +52,7 @@ pub struct TestRunParameters {
pub init_peer_id: String,
pub timestamp: u64,
pub ttl: u32,
pub override_current_peer_id: Option<String>,
}
impl<R: AirRunner> TestRunner<R> {
@ -69,6 +71,7 @@ impl<R: AirRunner> TestRunner<R> {
init_peer_id,
timestamp,
ttl,
override_current_peer_id,
} = test_run_params;
let mut call_results = HashMap::new();
@ -84,6 +87,7 @@ impl<R: AirRunner> TestRunner<R> {
init_peer_id.clone(),
timestamp,
ttl,
override_current_peer_id.clone(),
call_results,
)
.map_err(|e| e.to_string())?;
@ -128,6 +132,7 @@ impl TestRunParameters {
init_peer_id: init_peer_id.into(),
timestamp,
ttl,
override_current_peer_id: None,
}
}
@ -136,6 +141,7 @@ impl TestRunParameters {
init_peer_id: init_peer_id.into(),
timestamp: 0,
ttl: 0,
override_current_peer_id: None,
}
}
@ -144,6 +150,7 @@ impl TestRunParameters {
init_peer_id: String::new(),
timestamp,
ttl: 0,
override_current_peer_id: None,
}
}
@ -152,6 +159,73 @@ impl TestRunParameters {
init_peer_id: String::new(),
timestamp: 0,
ttl,
override_current_peer_id: None,
}
}
}
#[cfg(test)]
mod tests {
use super::*;
use crate::call_services::{set_variables_call_service, VariableOptionSource};
use avm_interface::CallRequestParams;
use fstrings::f;
use fstrings::format_args_f;
use serde_json::json;
#[test]
fn test_override_current_peer_id() {
let spell_id = "spell_id";
let host_peer_id = "host_peer_id";
let script = f!(r#"(call "{}" ("service" "func") [])"#, spell_id);
let variables = maplit::hashmap! {
"func".to_owned() => json!("success"),
};
let mut client = create_avm(
set_variables_call_service(variables, VariableOptionSource::FunctionName),
host_peer_id,
);
let current_result_1 = client
.runner
.call(&script, "", "", spell_id, 0, 0, None, HashMap::new())
.expect("call should be success");
let expected_current_call_requests = HashMap::new();
let expected_current_next_peers_pks = vec![spell_id.to_owned()];
assert_eq!(
current_result_1.call_requests,
expected_current_call_requests
);
assert_eq!(
current_result_1.next_peer_pks,
expected_current_next_peers_pks
);
let spell_result_1 = client
.runner
.call(
script,
"",
"",
spell_id,
0,
0,
Some(spell_id.to_owned()),
HashMap::new(),
)
.expect("call should be success");
let expected_spell_call_requests = maplit::hashmap! {
1 => CallRequestParams::new("service", "func", vec![], vec![]),
};
let expected_spell_next_peers_pks = Vec::<String>::new();
assert_eq!(spell_result_1.call_requests, expected_spell_call_requests);
assert_eq!(spell_result_1.next_peer_pks, expected_spell_next_peers_pks);
}
}

View File

@ -24,15 +24,16 @@ use std::path::PathBuf;
const AVM_MAX_HEAP_SIZE: u64 = 10 * 1024 * 1024;
const AIR_WASM_PATH: &str = "../target/wasm32-wasi/debug/air_interpreter_server.wasm";
pub struct WasmAirRunner(object_pool::Reusable<'static, AVMRunner>);
pub struct WasmAirRunner {
current_peer_id: String,
runner: object_pool::Reusable<'static, AVMRunner>,
}
fn make_pooled_avm_runner() -> AVMRunner {
let fake_current_peer_id = "";
let logging_mask = i32::MAX;
AVMRunner::new(
PathBuf::from(AIR_WASM_PATH),
fake_current_peer_id,
Some(AVM_MAX_HEAP_SIZE),
logging_mask,
)
@ -51,10 +52,12 @@ impl AirRunner for WasmAirRunner {
)
});
let mut runner = pool.pull(make_pooled_avm_runner);
runner.set_peer_id(current_peer_id);
let runner = pool.pull(make_pooled_avm_runner);
Self(runner)
Self {
current_peer_id: current_peer_id.into(),
runner,
}
}
fn call(
@ -65,15 +68,20 @@ impl AirRunner for WasmAirRunner {
init_peer_id: impl Into<String>,
timestamp: u64,
ttl: u32,
override_current_peer_id: Option<String>,
call_results: avm_server::CallResults,
) -> Result<RawAVMOutcome, Box<dyn std::error::Error>> {
Ok(self.0.call(
let current_peer_id =
override_current_peer_id.unwrap_or_else(|| self.current_peer_id.clone());
Ok(self.runner.call(
air,
prev_data,
data,
init_peer_id,
timestamp,
ttl,
current_peer_id,
call_results,
)?)
}

View File

@ -10,7 +10,6 @@ Executes an AIR script with data in WASM AquaVM. It has two modes of parameter
All common parameters are optional. Their position is before the mode selector (`--plain` or `--anomaly`).
+ `--call-results PATH` parameter allows you to provide call results for current execution.
+ `--current-peer-id STR` by default is "some_id".
+ `--max-heap-size N` defines maximum heap size for WASM runtime.
+ `--interpreter PATH` option defines the AquaVM WASM binary to be executed. By default, it is "target/wasm32-wasi/release/air_interpreter_server.wasm", but you can define a global value with the `AIR_INTERPRETER_WASM_PATH` environment variable. The default presumes that the tool is run from the root of this repository. Feel free to use option or environment variable to run from any location.
+ with the `--json` option, tracing info is output (to stderr) in machine-readable JSON format. The output can be later processed with `air-trace stats` subcommand.

View File

@ -31,9 +31,6 @@ use std::path::{Path, PathBuf};
#[derive(Parser, Debug)]
#[clap(about = "Run AIR script with AquaVM")]
pub(crate) struct Args {
#[clap(long)]
current_peer_id: Option<String>,
#[clap(long = "call-results")]
call_results_path: Option<PathBuf>,
@ -82,13 +79,7 @@ pub(crate) fn run(args: Args) -> anyhow::Result<()> {
let global_tracing_params = args.tracing_params.clone();
init_tracing(global_tracing_params, tracing_json);
let current_peer_id = args.current_peer_id.as_deref().unwrap_or("some_id");
let mut runner = get_runner(
args.native,
current_peer_id,
&args.air_interpreter_path,
args.max_heap_size,
)?;
let mut runner = get_runner(args.native, &args.air_interpreter_path, args.max_heap_size)?;
let execution_data = match &args.source {
Source::Anomaly(anomaly) => data::anomaly::load(anomaly)?,
@ -108,6 +99,7 @@ pub(crate) fn run(args: Args) -> anyhow::Result<()> {
particle.init_peer_id.clone().into_owned(),
particle.timestamp,
particle.ttl,
particle.current_peer_id.clone().into(),
call_results.clone(),
args.tracing_params.clone(),
tracing_json,
@ -124,19 +116,13 @@ pub(crate) fn run(args: Args) -> anyhow::Result<()> {
#[cfg(feature = "wasm")]
fn get_runner(
native: bool,
current_peer_id: impl Into<String>,
air_interpreter_wasm_path: &Path,
max_heap_size: Option<u64>,
) -> anyhow::Result<Box<dyn AirRunner>> {
if native {
self::native::create_native_avm_runner(current_peer_id)
.context("Failed to instantiate a native AVM")
self::native::create_native_avm_runner().context("Failed to instantiate a native AVM")
} else {
self::wasm::create_wasm_avm_runner(
current_peer_id,
air_interpreter_wasm_path,
max_heap_size,
)
self::wasm::create_wasm_avm_runner(air_interpreter_wasm_path, max_heap_size)
.context("Failed to instantiate WASM AVM")
}
}

View File

@ -39,7 +39,7 @@ pub(crate) fn load(args: &AnomalyDataArgs) -> anyhow::Result<super::ExecutionDat
.context("Anomaly current_data is not a valid string")?;
let current_data = String::from_utf8(anomaly_data.current_data.to_vec())
.context("Anomaly current_data is not a valid string")?;
let particle: ParticleParameters<'static, 'static> =
let particle: ParticleParameters<'static> =
serde_json::from_reader(&*anomaly_data.particle.to_vec())
.context("Anomaly particle is not a valid JSON")?;

View File

@ -23,5 +23,5 @@ pub(crate) struct ExecutionData<'ctx> {
pub(crate) air_script: String,
pub(crate) current_data: String,
pub(crate) prev_data: String,
pub(crate) particle: ParticleParameters<'ctx, 'ctx>,
pub(crate) particle: ParticleParameters<'ctx>,
}

View File

@ -26,12 +26,14 @@ const DEFAULT_DATA: &str = "";
#[derive(clap::Args, Debug)]
pub(crate) struct PlainDataArgs {
#[clap(long)]
init_peer_id: Option<String>,
#[clap(long, default_value = "some_id")]
init_peer_id: String,
#[clap(long, help = "default: current time")]
timestamp: Option<u64>,
#[clap(long, help = "default: max possible ttl")]
ttl: Option<u32>,
#[clap(long, default_value = "some_id")]
current_peer_id: String,
#[clap(long = "script", help = "read from stdin by default")]
air_script_path: Option<PathBuf>,
@ -54,9 +56,17 @@ pub(crate) fn load(args: &PlainDataArgs) -> anyhow::Result<ExecutionData<'_>> {
let timestamp = args.timestamp.unwrap_or_else(unix_timestamp_now);
let ttl = args.ttl.unwrap_or(u32::MAX);
let init_peer_id = args.init_peer_id.as_deref().unwrap_or("some_id");
let init_peer_id = &args.init_peer_id;
let current_peer_id = &args.current_peer_id;
let particle = ParticleParameters::new(
init_peer_id.into(),
"".into(),
timestamp,
ttl,
current_peer_id.into(),
);
let particle = ParticleParameters::new(init_peer_id.into(), "".into(), timestamp, ttl);
Ok(ExecutionData {
air_script,
prev_data,

View File

@ -18,9 +18,7 @@ use super::runner::AirRunner;
use air_interpreter_interface::RunParameters;
use avm_interface::raw_outcome::RawAVMOutcome;
struct NativeAvmRunner {
current_peer_id: String,
}
struct NativeAvmRunner {}
impl AirRunner for NativeAvmRunner {
fn call_tracing(
@ -31,6 +29,7 @@ impl AirRunner for NativeAvmRunner {
init_peer_id: String,
timestamp: u64,
ttl: u32,
current_peer_id: String,
call_results: avm_interface::CallResults,
// We use externally configured logger.
_tracing_params: String,
@ -48,7 +47,7 @@ impl AirRunner for NativeAvmRunner {
data,
RunParameters {
init_peer_id,
current_peer_id: self.current_peer_id.clone(),
current_peer_id,
timestamp,
ttl,
},
@ -60,10 +59,6 @@ impl AirRunner for NativeAvmRunner {
}
}
pub(crate) fn create_native_avm_runner(
current_peer_id: impl Into<String>,
) -> anyhow::Result<Box<dyn AirRunner>> {
Ok(Box::new(NativeAvmRunner {
current_peer_id: current_peer_id.into(),
}))
pub(crate) fn create_native_avm_runner() -> anyhow::Result<Box<dyn AirRunner>> {
Ok(Box::new(NativeAvmRunner {}))
}

View File

@ -27,6 +27,7 @@ pub(crate) trait AirRunner {
init_peer_id: String,
timestamp: u64,
ttl: u32,
current_peer_id: String,
call_results: CallResults,
tracing_params: String,
tracing_output_mode: u8,

View File

@ -28,6 +28,7 @@ impl AirRunner for WasmAvmRunner {
init_peer_id: String,
timestamp: u64,
ttl: u32,
current_peer_id: String,
call_results: avm_interface::CallResults,
tracing_params: String,
tracing_output_mode: u8,
@ -39,6 +40,7 @@ impl AirRunner for WasmAvmRunner {
init_peer_id,
timestamp,
ttl,
current_peer_id,
call_results,
tracing_params,
tracing_output_mode,
@ -47,15 +49,11 @@ impl AirRunner for WasmAvmRunner {
}
pub(crate) fn create_wasm_avm_runner(
current_peer_id: impl Into<String>,
air_interpreter_wasm_path: &Path,
max_heap_size: Option<u64>,
) -> anyhow::Result<Box<dyn AirRunner>> {
let current_peer_id = current_peer_id.into();
Ok(Box::new(WasmAvmRunner(AVMRunner::new(
air_interpreter_wasm_path.to_owned(),
current_peer_id,
max_heap_size,
0,
)?)))