From 771d42dec43d3081621897edda3735768fd9ff71 Mon Sep 17 00:00:00 2001 From: Ivan Boldyrev Date: Fri, 15 Dec 2023 18:23:09 +0400 Subject: [PATCH] feat(data)!: flexible serialization formats (#757) New crate air_interpreter_sede introduces a flexible serialization and deserialization infrastructure. Low level API: the Format trait and related. It includes simple and universal mechanisms for serializing any possible (e.g. implementing the Serde traits) value. High level API: Representation trait and related. It allows declaring representation types that can serialize and deserialize only certain types (for example, InterpreterDataRepr can serialize only the InterpreterData, but deserialize InterpreterData and Versions` types), producing newtype values as serialization results. The serialized representation of CallResults now contains byte arrays, not strings, because the new infrastructure serializes to byte arrays only. Also, the basic support for multicodecs is added. --- Cargo.lock | 44 + Cargo.toml | 1 + air-interpreter/src/marine.rs | 6 +- air-interpreter/src/wasm_bindgen.rs | 2 +- air/Cargo.toml | 3 +- .../errors/uncatchable_errors.rs | 9 + .../instructions/call/resolved_call.rs | 19 +- air/src/farewell_step/outcome.rs | 24 +- air/src/preparation_step/errors.rs | 25 +- air/src/preparation_step/preparation.rs | 24 +- air/src/runner.rs | 5 +- .../features/misc/version_check.rs | 6 +- .../features/signatures/algorithms.rs | 5 +- .../features/signatures/attacks.rs | 18 +- .../features/signatures/corruption.rs | 12 +- .../features/signatures/runtime.rs | 10 +- .../negative_tests/farewell_step.rs | 2 +- .../negative_tests/preparation_step.rs | 36 +- .../uncatchable_trace_related.rs | 5 +- avm/client/src/avmHelpers.ts | 10 +- avm/interface/Cargo.toml | 1 + avm/interface/src/call_request_parameters.rs | 26 +- avm/interface/src/call_service_result.rs | 1 + avm/interface/src/lib.rs | 17 +- avm/interface/src/raw_outcome.rs | 2 +- avm/server/Cargo.toml | 1 + avm/server/src/runner.rs | 10 +- benches/PERFORMANCE.json | 1650 +++++++++++------ benches/PERFORMANCE.txt | 1180 ++++++------ crates/air-lib/interpreter-data/Cargo.toml | 1 + .../interpreter-data/src/interpreter_data.rs | 26 +- .../src/interpreter_data/repr.rs | 75 + .../air-lib/interpreter-interface/Cargo.toml | 5 +- .../src/call_request_parameters.rs | 64 +- .../src/call_service_result.rs | 18 + .../src/interpreter_outcome.rs | 13 +- crates/air-lib/interpreter-sede/Cargo.toml | 28 + crates/air-lib/interpreter-sede/src/format.rs | 49 + crates/air-lib/interpreter-sede/src/lib.rs | 52 + .../interpreter-sede/src/multiformat.rs | 94 + .../interpreter-sede/src/representation.rs | 111 ++ .../air-lib/interpreter-sede/src/rmp_serde.rs | 95 + .../interpreter-sede/src/serde_json.rs | 84 + .../interpreter-sede/src/serialized_type.rs | 101 + crates/air-lib/test-utils/Cargo.toml | 1 + crates/air-lib/test-utils/src/lib.rs | 12 +- .../test-utils/src/native_test_runner.rs | 4 +- crates/air-lib/test-utils/src/test_runner.rs | 6 + junk/gen-bench-data/Cargo.toml | 1 + .../src/cid_benchmarking/mod.rs | 5 +- junk/gen-bench-data/src/main.rs | 77 +- tools/cli/air/Cargo.toml | 1 + tools/cli/air/src/trace/run.rs | 14 +- tools/cli/air/src/trace/run/data/anomaly.rs | 13 +- tools/cli/air/src/trace/run/data/mod.rs | 4 +- tools/cli/air/src/trace/run/data/plain.rs | 2 +- tools/cli/air/src/trace/run/native.rs | 4 +- .../performance_metering/bench.py | 14 +- 58 files changed, 2881 insertions(+), 1247 deletions(-) create mode 100644 crates/air-lib/interpreter-data/src/interpreter_data/repr.rs create mode 100644 crates/air-lib/interpreter-sede/Cargo.toml create mode 100644 crates/air-lib/interpreter-sede/src/format.rs create mode 100644 crates/air-lib/interpreter-sede/src/lib.rs create mode 100644 crates/air-lib/interpreter-sede/src/multiformat.rs create mode 100644 crates/air-lib/interpreter-sede/src/representation.rs create mode 100644 crates/air-lib/interpreter-sede/src/rmp_serde.rs create mode 100644 crates/air-lib/interpreter-sede/src/serde_json.rs create mode 100644 crates/air-lib/interpreter-sede/src/serialized_type.rs diff --git a/Cargo.lock b/Cargo.lock index be6ba1e3..21a8d20e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -112,6 +112,7 @@ name = "air-interpreter-data" version = "0.15.0" dependencies = [ "air-interpreter-cid", + "air-interpreter-sede", "air-interpreter-signatures", "air-utils", "aquavm-air-parser", @@ -131,12 +132,28 @@ dependencies = [ name = "air-interpreter-interface" version = "0.15.2" dependencies = [ + "air-interpreter-sede", "fluence-it-types", + "marine-call-parameters", "marine-rs-sdk", "serde", + "serde_bytes", "serde_json", ] +[[package]] +name = "air-interpreter-sede" +version = "0.1.0" +dependencies = [ + "marine-rs-sdk", + "rmp-serde", + "serde", + "serde_bytes", + "serde_json", + "thiserror", + "unsigned-varint 0.8.0", +] + [[package]] name = "air-interpreter-signatures" version = "0.1.5" @@ -183,6 +200,7 @@ dependencies = [ "air-interpreter-cid", "air-interpreter-data", "air-interpreter-interface", + "air-interpreter-sede", "air-interpreter-signatures", "aquavm-air", "avm-interface", @@ -337,6 +355,7 @@ dependencies = [ "air-interpreter-cid", "air-interpreter-data", "air-interpreter-interface", + "air-interpreter-sede", "air-interpreter-signatures", "air-lambda-ast", "air-lambda-parser", @@ -378,6 +397,7 @@ version = "0.5.4" dependencies = [ "air-beautifier", "air-interpreter-interface", + "air-interpreter-sede", "air-test-utils", "anyhow", "aquavm-air", @@ -585,6 +605,7 @@ name = "avm-interface" version = "0.29.3" dependencies = [ "air-interpreter-interface", + "air-interpreter-sede", "air-utils", "log", "maplit", @@ -600,6 +621,7 @@ name = "avm-server" version = "0.33.4" dependencies = [ "air-interpreter-interface", + "air-interpreter-sede", "air-utils", "avm-data-store", "avm-interface", @@ -4671,6 +4693,28 @@ dependencies = [ "digest 0.10.7", ] +[[package]] +name = "rmp" +version = "0.8.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f9860a6cc38ed1da53456442089b4dfa35e7cedaa326df63017af88385e6b20" +dependencies = [ + "byteorder", + "num-traits", + "paste", +] + +[[package]] +name = "rmp-serde" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bffea85eea980d8a74453e5d02a8d93028f3c34725de143085a844ebe953258a" +dependencies = [ + "byteorder", + "rmp", + "serde", +] + [[package]] name = "rust-argon2" version = "0.8.3" diff --git a/Cargo.toml b/Cargo.toml index 79def04b..04d9ff1c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,6 +9,7 @@ members = [ "crates/air-lib/interpreter-cid", "crates/air-lib/interpreter-data", "crates/air-lib/interpreter-interface", + "crates/air-lib/interpreter-sede", "crates/air-lib/interpreter-signatures", "crates/air-lib/lambda/ast", "crates/air-lib/lambda/parser", diff --git a/air-interpreter/src/marine.rs b/air-interpreter/src/marine.rs index f11b110b..497ada60 100644 --- a/air-interpreter/src/marine.rs +++ b/air-interpreter/src/marine.rs @@ -49,7 +49,7 @@ pub fn invoke( params: RunParameters, call_results: Vec, ) -> InterpreterOutcome { - execute_air(air, prev_data, data, params, call_results) + execute_air(air, prev_data, data, params, call_results.into()) } #[allow(clippy::too_many_arguments)] @@ -79,7 +79,9 @@ pub fn invoke_tracing( let subscriber = builder.finish(); Dispatch::new(subscriber) }; - tracing::dispatcher::with_default(&dispatch, || execute_air(air, prev_data, data, params, call_results)) + tracing::dispatcher::with_default(&dispatch, || { + execute_air(air, prev_data, data, params, call_results.into()) + }) } #[marine] diff --git a/air-interpreter/src/wasm_bindgen.rs b/air-interpreter/src/wasm_bindgen.rs index 412da9b3..433fb804 100644 --- a/air-interpreter/src/wasm_bindgen.rs +++ b/air-interpreter/src/wasm_bindgen.rs @@ -67,7 +67,7 @@ pub fn invoke( let params: RunParameters = serde_json::from_slice(¶ms).expect("cannot parse RunParameters"); - let outcome = execute_air(air, prev_data, data, params, call_results); + let outcome = execute_air(air, prev_data, data, params, call_results.into()); serde_json::to_string(&outcome).expect("Cannot parse InterpreterOutcome") } diff --git a/air/Cargo.toml b/air/Cargo.toml index 9a27448f..8466136b 100644 --- a/air/Cargo.toml +++ b/air/Cargo.toml @@ -20,6 +20,7 @@ aquavm-air-parser = { version = "0.11.0", path = "../crates/air-lib/air-parser" air-execution-info-collector = { version = "0.7.11", path = "../crates/air-lib/execution-info-collector" } air-interpreter-cid = { version = "0.7.0", path = "../crates/air-lib/interpreter-cid" } air-interpreter-data = { version = "0.15.0", path = "../crates/air-lib/interpreter-data" } +air-interpreter-sede = { version = "0.1.0", path = "../crates/air-lib/interpreter-sede" } air-interpreter-signatures = { version = "0.1.5", path = "../crates/air-lib/interpreter-signatures" } air-interpreter-interface = { version = "0.15.2", path = "../crates/air-lib/interpreter-interface", default-features = false } air-log-targets = { version = "0.1.0", path = "../crates/air-lib/log-targets" } @@ -88,4 +89,4 @@ harness = false [[bench]] name = "nox_tc2_benchmark" -harness = false \ No newline at end of file +harness = false diff --git a/air/src/execution_step/errors/uncatchable_errors.rs b/air/src/execution_step/errors/uncatchable_errors.rs index 2c0d35bb..afdf9518 100644 --- a/air/src/execution_step/errors/uncatchable_errors.rs +++ b/air/src/execution_step/errors/uncatchable_errors.rs @@ -25,6 +25,9 @@ use crate::ToErrorCode; use air_interpreter_cid::CidCalculationError; use air_interpreter_cid::CidRef; use air_interpreter_data::ValueRef; +use air_interpreter_interface::CallArgumentsRepr; +use air_interpreter_interface::TetrapletsRepr; +use air_interpreter_sede::Representation; use air_trace_handler::GenerationCompactificationError; use air_trace_handler::IntConversionError; use air_trace_handler::TraceHandlerError; @@ -131,6 +134,12 @@ pub enum UncatchableError { #[error("failed to sign data: {0}")] SigningError(#[from] fluence_keypair::error::SigningError), + + #[error("failed to serialize tetraplets {0}")] + TetrapletSerializationFailed(::SerializeError), + + #[error("failed to serialize call arguments {0}")] + CallArgumentsSerializationFailed(::SerializeError), } impl ToErrorCode for UncatchableError { diff --git a/air/src/execution_step/instructions/call/resolved_call.rs b/air/src/execution_step/instructions/call/resolved_call.rs index bebf55fa..60152739 100644 --- a/air/src/execution_step/instructions/call/resolved_call.rs +++ b/air/src/execution_step/instructions/call/resolved_call.rs @@ -25,13 +25,15 @@ use crate::execution_step::RcSecurityTetraplet; use crate::execution_step::RcSecurityTetraplets; use crate::execution_step::UncatchableError; use crate::trace_to_exec_err; -use crate::JValue; use crate::SecurityTetraplet; use air_interpreter_cid::value_to_json_cid; use air_interpreter_cid::CidRef; use air_interpreter_data::CallResult; +use air_interpreter_interface::CallArgumentsRepr; use air_interpreter_interface::CallRequestParams; +use air_interpreter_interface::SerializedCallArguments; +use air_interpreter_interface::TetrapletsRepr; use air_parser::ast; use air_trace_handler::merger::MergerCallResult; use air_trace_handler::TraceHandler; @@ -48,7 +50,7 @@ pub(super) struct ResolvedCall<'i> { #[derive(Debug, Clone, PartialEq)] struct ResolvedArguments { - call_arguments: String, + call_arguments: SerializedCallArguments, tetraplets: Vec, } @@ -156,12 +158,16 @@ impl<'i> ResolvedCall<'i> { exec_ctx: &ExecutionCtx<'_>, tetraplet: &SecurityTetraplet, ) -> ExecutionResult { + use air_interpreter_sede::ToSerialized; + let ResolvedArguments { call_arguments, tetraplets, } = self.resolve_args(exec_ctx)?; - let serialized_tetraplets = serde_json::to_string(&tetraplets).expect("default serializer shouldn't fail"); + let serialized_tetraplets = TetrapletsRepr + .serialize(&tetraplets) + .map_err(UncatchableError::TetrapletSerializationFailed)?; let request_params = CallRequestParams::new( tetraplet.service_id.to_string(), @@ -197,10 +203,13 @@ impl<'i> ResolvedCall<'i> { /// Prepare arguments of this call instruction by resolving and preparing their security tetraplets. fn resolve_args(&self, exec_ctx: &ExecutionCtx<'i>) -> ExecutionResult { + use air_interpreter_sede::ToSerialized; + let (call_arguments, tetraplets) = self.collect_args(exec_ctx)?; - let call_arguments = JValue::Array(call_arguments); - let call_arguments = call_arguments.to_string(); + let call_arguments = CallArgumentsRepr + .serialize(&call_arguments) + .map_err(UncatchableError::CallArgumentsSerializationFailed)?; let resolved_arguments = ResolvedArguments { call_arguments, diff --git a/air/src/farewell_step/outcome.rs b/air/src/farewell_step/outcome.rs index 49fae0df..36cbdcd3 100644 --- a/air/src/farewell_step/outcome.rs +++ b/air/src/farewell_step/outcome.rs @@ -24,6 +24,8 @@ use crate::INTERPRETER_SUCCESS; use air_interpreter_data::InterpreterData; use air_interpreter_interface::CallRequests; +use air_interpreter_interface::CallRequestsRepr; +use air_interpreter_sede::ToSerialized; use air_interpreter_signatures::KeyPair; use air_utils::measure; use fluence_keypair::error::SigningError; @@ -60,7 +62,9 @@ pub(crate) fn from_uncatchable_error( ) -> InterpreterOutcome { let ret_code = error.to_error_code(); let data = data.into(); - let call_requests = serde_json::to_vec(&CallRequests::new()).expect("default serializer shouldn't fail"); + let call_requests = CallRequestsRepr + .serialize(&CallRequests::new()) + .expect("default serializer shouldn't fail"); InterpreterOutcome::new(ret_code, error.to_string(), data, vec![], call_requests) } @@ -109,16 +113,18 @@ fn populate_outcome_from_contexts( semver::Version::parse(env!("CARGO_PKG_VERSION")).expect("cargo version is valid"), ); let data = measure!( - serde_json::to_vec(&data).expect("default serializer shouldn't fail"), - tracing::Level::TRACE, - "serde_json::to_vec(data)" + data.serialize().expect("default serializer shouldn't fail"), + tracing::Level::INFO, + "InterpreterData::serialize" ); let next_peer_pks = dedup(exec_ctx.next_peer_pks); let call_requests = measure!( - serde_json::to_vec(&exec_ctx.call_requests).expect("default serializer shouldn't fail"), - tracing::Level::TRACE, - "serde_json::to_vec(call_results)", + CallRequestsRepr + .serialize(&exec_ctx.call_requests) + .expect("default serializer shouldn't fail"), + tracing::Level::INFO, + "CallRequestsRepr.serialize", ); InterpreterOutcome::new(ret_code, error_message, data, next_peer_pks, call_requests) } @@ -146,11 +152,11 @@ fn sign_result(exec_ctx: &mut ExecutionCtx<'_>, keypair: &KeyPair) -> Result<(), // these methods are called only if there is an internal error in the interpreter and // new execution trace was corrupted fn execution_error_into_outcome(error: ExecutionError) -> InterpreterOutcome { - InterpreterOutcome::new(error.to_error_code(), error.to_string(), vec![], vec![], vec![]) + InterpreterOutcome::new(error.to_error_code(), error.to_string(), vec![], vec![], <_>::default()) } fn signing_error_into_outcome(error: SigningError) -> InterpreterOutcome { - InterpreterOutcome::new(error.to_error_code(), error.to_string(), vec![], vec![], vec![]) + InterpreterOutcome::new(error.to_error_code(), error.to_string(), vec![], vec![], <_>::default()) } /// Deduplicate values in a supplied vector. diff --git a/air/src/preparation_step/errors.rs b/air/src/preparation_step/errors.rs index 2c780482..05495fe7 100644 --- a/air/src/preparation_step/errors.rs +++ b/air/src/preparation_step/errors.rs @@ -18,14 +18,18 @@ use crate::ToErrorCode; use air_interpreter_data::data_version; use air_interpreter_data::verification::DataVerifierError; use air_interpreter_data::CidStoreVerificationError; +use air_interpreter_data::InterpreterDataRepr; use air_interpreter_data::Versions; - -use serde_json::Error as SerdeJsonError; +use air_interpreter_interface::CallResultsDeserializeError; +use air_interpreter_interface::SerializedCallResults; +use air_interpreter_sede::Representation; use strum::IntoEnumIterator; use strum_macros::EnumDiscriminants; use strum_macros::EnumIter; use thiserror::Error as ThisError; +type SerdeDeserializeError = ::DeserializeError; + /// Errors happened during the interpreter preparation step. #[derive(Debug, EnumDiscriminants, ThisError)] #[strum_discriminants(derive(EnumIter))] @@ -43,7 +47,10 @@ pub enum PreparationError { super::interpreter_version(), data_version() )] - DataDeFailed { data: Vec, error: SerdeJsonError }, + DataDeFailed { + data: Vec, + error: SerdeDeserializeError, + }, /// Errors occurred on executed trace deserialization /// when it was possible to recover versions. @@ -59,7 +66,7 @@ pub enum PreparationError { )] DataDeFailedWithVersions { data: Vec, - error: SerdeJsonError, + error: SerdeDeserializeError, versions: Versions, }, @@ -69,8 +76,8 @@ pub enum PreparationError { Call results: {call_results:?}" )] CallResultsDeFailed { - call_results: Vec, - error: SerdeJsonError, + call_results: SerializedCallResults, + error: CallResultsDeserializeError, }, /// Error occurred when a version of interpreter produced supplied data is less then minimal. @@ -101,15 +108,15 @@ impl ToErrorCode for PreparationError { } impl PreparationError { - pub fn data_de_failed(data: Vec, error: SerdeJsonError) -> Self { + pub fn data_de_failed(data: Vec, error: SerdeDeserializeError) -> Self { Self::DataDeFailed { data, error } } - pub fn data_de_failed_with_versions(data: Vec, error: SerdeJsonError, versions: Versions) -> Self { + pub fn data_de_failed_with_versions(data: Vec, error: SerdeDeserializeError, versions: Versions) -> Self { Self::DataDeFailedWithVersions { data, error, versions } } - pub fn call_results_de_failed(call_results: Vec, error: SerdeJsonError) -> Self { + pub fn call_results_de_failed(call_results: SerializedCallResults, error: CallResultsDeserializeError) -> Self { Self::CallResultsDeFailed { call_results, error } } diff --git a/air/src/preparation_step/preparation.rs b/air/src/preparation_step/preparation.rs index 3e26a57b..7eb28f87 100644 --- a/air/src/preparation_step/preparation.rs +++ b/air/src/preparation_step/preparation.rs @@ -20,11 +20,17 @@ use crate::execution_step::ExecutionCtx; use crate::execution_step::TraceHandler; use air_interpreter_data::InterpreterData; +use air_interpreter_data::InterpreterDataRepr; +use air_interpreter_interface::CallResultsRepr; use air_interpreter_interface::RunParameters; +use air_interpreter_interface::SerializedCallResults; +use air_interpreter_sede::FromSerialized; +use air_interpreter_sede::Representation; use air_interpreter_signatures::KeyError; use air_interpreter_signatures::KeyPair; use air_interpreter_signatures::SignatureStore; use air_parser::ast::Instruction; +use air_utils::measure; use fluence_keypair::KeyFormat; use std::convert::TryFrom; @@ -64,7 +70,7 @@ pub(crate) fn prepare<'i>( prev_data: InterpreterData, current_data: InterpreterData, raw_air: &'i str, - call_results: &[u8], + call_results: &SerializedCallResults, run_parameters: RunParameters, signature_store: SignatureStore, ) -> PreparationResult> { @@ -112,7 +118,10 @@ pub(crate) fn try_to_data(raw_data: &[u8]) -> PreparationResult InterpreterData::try_from_slice(raw_data).map_err(|de_error| to_date_de_error(raw_data.to_vec(), de_error)) } -fn to_date_de_error(raw_data: Vec, de_error: serde_json::Error) -> PreparationError { +fn to_date_de_error( + raw_data: Vec, + de_error: ::DeserializeError, +) -> PreparationError { match InterpreterData::try_get_versions(&raw_data) { Ok(versions) => PreparationError::data_de_failed_with_versions(raw_data, de_error, versions), Err(_) => PreparationError::data_de_failed(raw_data, de_error), @@ -123,12 +132,17 @@ fn to_date_de_error(raw_data: Vec, de_error: serde_json::Error) -> Preparati fn make_exec_ctx( prev_ingredients: ExecCtxIngredients, current_ingredients: ExecCtxIngredients, - call_results: &[u8], + call_results: &SerializedCallResults, signature_store: SignatureStore, run_parameters: &RunParameters, ) -> PreparationResult> { - let call_results = serde_json::from_slice(call_results) - .map_err(|e| PreparationError::call_results_de_failed(call_results.to_vec(), e))?; + let call_results = measure!( + CallResultsRepr + .deserialize(call_results) + .map_err(|e| PreparationError::call_results_de_failed(call_results.clone(), e))?, + tracing::Level::INFO, + "CallResultsRepr.deserialize", + ); let ctx = ExecutionCtx::new( prev_ingredients, diff --git a/air/src/runner.rs b/air/src/runner.rs index 37b8163c..f279ecfa 100644 --- a/air/src/runner.rs +++ b/air/src/runner.rs @@ -25,6 +25,7 @@ use crate::verification_step::verify; use air_interpreter_interface::InterpreterOutcome; use air_interpreter_interface::RunParameters; +use air_interpreter_interface::SerializedCallResults; use air_log_targets::RUN_PARAMS; use air_utils::farewell_if_fail; use air_utils::measure; @@ -35,7 +36,7 @@ pub fn execute_air( prev_data: Vec, data: Vec, params: RunParameters, - call_results: Vec, + call_results: SerializedCallResults, ) -> InterpreterOutcome { use std::convert::identity; @@ -58,7 +59,7 @@ fn execute_air_impl( raw_prev_data: Vec, raw_current_data: Vec, params: RunParameters, - call_results: Vec, + call_results: SerializedCallResults, ) -> Result { let ParsedDataPair { prev_data, diff --git a/air/tests/test_module/features/misc/version_check.rs b/air/tests/test_module/features/misc/version_check.rs index 40cbcd1c..a5487e48 100644 --- a/air/tests/test_module/features/misc/version_check.rs +++ b/air/tests/test_module/features/misc/version_check.rs @@ -26,7 +26,7 @@ fn minimal_version_check() { let actual_version = semver::Version::new(0, 31, 1); let current_data = InterpreterData::new(actual_version.clone()); - let current_data = serde_json::to_vec(¤t_data).expect("default serializer shouldn't fail"); + let current_data = current_data.serialize().expect("default serializer shouldn't fail"); let result = call_vm!(vm, <_>::default(), script, "", current_data); let expected_error = PreparationError::UnsupportedInterpreterVersion { @@ -45,7 +45,7 @@ fn publish_version_check() { let actual_version = semver::Version::parse("1.0.1-feat-VM-173-add-interpreter-version-in-data-a2d575b-205-1.0").unwrap(); let current_data = InterpreterData::new(actual_version); - let current_data = serde_json::to_vec(¤t_data).expect("default serializer shouldn't fail"); + let current_data = current_data.serialize().expect("default serializer shouldn't fail"); let result = call_vm!(vm, <_>::default(), script, "", current_data); assert_eq!(result.ret_code, INTERPRETER_SUCCESS, "{:?}", result.error_message); @@ -58,7 +58,7 @@ fn publish_unsupported_version_check() { let actual_version = semver::Version::parse("0.31.1-feat-VM-173-add-interpreter-version-in-data-a2d575b-205-1.0").unwrap(); let current_data = InterpreterData::new(actual_version.clone()); - let current_data = serde_json::to_vec(¤t_data).expect("default serializer shouldn't fail"); + let current_data = current_data.serialize().expect("default serializer shouldn't fail"); let result = call_vm!(vm, <_>::default(), "", "", current_data); let expected_error = PreparationError::UnsupportedInterpreterVersion { diff --git a/air/tests/test_module/features/signatures/algorithms.rs b/air/tests/test_module/features/signatures/algorithms.rs index 32286cef..5925c5a0 100644 --- a/air/tests/test_module/features/signatures/algorithms.rs +++ b/air/tests/test_module/features/signatures/algorithms.rs @@ -15,7 +15,8 @@ */ use air::{min_supported_version, PreparationError}; -use air_interpreter_data::{verification::DataVerifierError, InterpreterData}; +use air_interpreter_data::{verification::DataVerifierError, InterpreterData, InterpreterDataRepr}; +use air_interpreter_sede::{Format, Representation}; use air_interpreter_signatures::KeyError; use air_test_utils::{ assert_error_eq, @@ -56,7 +57,7 @@ fn test_banned_signature() { data["signatures"] = bad_signature_store; - let current_data = data.to_string(); + let current_data = InterpreterDataRepr.get_format().to_vec(&data).unwrap(); let mut avm = create_avm(unit_call_service(), "other_peer_id"); let res = avm diff --git a/air/tests/test_module/features/signatures/attacks.rs b/air/tests/test_module/features/signatures/attacks.rs index d3e1c32c..4de0d188 100644 --- a/air/tests/test_module/features/signatures/attacks.rs +++ b/air/tests/test_module/features/signatures/attacks.rs @@ -82,8 +82,8 @@ fn test_attack_injection_current_peer_scalar() { let mut alice_avm = create_avm_with_key::(alice_keypair, unit_call_service()); let test_run_params = TestRunParameters::from_init_peer_id(alice_peer_id); - let prev_data = serde_json::to_vec(&alice_data).unwrap(); - let cur_data = serde_json::to_vec(&mallory_data).unwrap(); + let prev_data = alice_data.serialize().unwrap(); + let cur_data = mallory_data.serialize().unwrap(); let res = alice_avm .call(&air_script, prev_data, cur_data, test_run_params) .unwrap(); @@ -153,8 +153,8 @@ fn test_attack_injection_current_peer_stream() { let mut alice_avm = create_avm_with_key::(alice_keypair, unit_call_service()); let test_run_params = TestRunParameters::from_init_peer_id(alice_peer_id); - let prev_data = serde_json::to_vec(&alice_data).unwrap(); - let cur_data = serde_json::to_vec(&mallory_data).unwrap(); + let prev_data = alice_data.serialize().unwrap(); + let cur_data = mallory_data.serialize().unwrap(); let res = alice_avm .call(&air_script, prev_data, cur_data, test_run_params) .unwrap(); @@ -222,8 +222,8 @@ fn test_attack_injection_current_injection_unused() { let mut alice_avm = create_avm_with_key::(alice_keypair, unit_call_service()); let test_run_params = TestRunParameters::from_init_peer_id(alice_peer_id); - let prev_data = serde_json::to_vec(&alice_data).unwrap(); - let cur_data = serde_json::to_vec(&mallory_data).unwrap(); + let prev_data = alice_data.serialize().unwrap(); + let cur_data = mallory_data.serialize().unwrap(); let res = alice_avm .call(&air_script, prev_data, cur_data, test_run_params) .unwrap(); @@ -284,7 +284,7 @@ fn test_attack_injection_other_peer_scalar() { let mut bob_avm = create_avm_with_key::(bob_keypair, unit_call_service()); let test_run_params = TestRunParameters::from_init_peer_id(alice_peer_id); let prev_data = ""; - let cur_data = serde_json::to_vec(&mallory_data).unwrap(); + let cur_data = mallory_data.serialize().unwrap(); let res = bob_avm.call(&air_script, prev_data, cur_data, test_run_params).unwrap(); assert_ne!(res.ret_code, 0); } @@ -342,7 +342,7 @@ fn test_attack_injection_other_peer_stream() { let mut bob_avm = create_avm_with_key::(bob_keypair, unit_call_service()); let test_run_params = TestRunParameters::from_init_peer_id(alice_peer_id); let prev_data = ""; - let cur_data = serde_json::to_vec(&mallory_data).unwrap(); + let cur_data = mallory_data.serialize().unwrap(); let res = bob_avm.call(&air_script, prev_data, cur_data, test_run_params).unwrap(); assert_ne!(res.ret_code, 0, "{}", res.error_message); } @@ -400,7 +400,7 @@ fn test_attack_injection_other_peer_unused() { let mut bob_avm = create_avm_with_key::(bob_keypair, unit_call_service()); let test_run_params = TestRunParameters::from_init_peer_id(alice_peer_id); let prev_data = ""; - let cur_data = serde_json::to_vec(&mallory_data).unwrap(); + let cur_data = mallory_data.serialize().unwrap(); let res = bob_avm.call(&air_script, prev_data, cur_data, test_run_params).unwrap(); // please not that such injection is not caught diff --git a/air/tests/test_module/features/signatures/corruption.rs b/air/tests/test_module/features/signatures/corruption.rs index 63a0108f..85ac80c8 100644 --- a/air/tests/test_module/features/signatures/corruption.rs +++ b/air/tests/test_module/features/signatures/corruption.rs @@ -88,7 +88,7 @@ fn test_attack_replace_value() { let mut bob_avm = create_avm(unit_call_service(), bob_peer_id); let test_run_params = TestRunParameters::from_init_peer_id(alice_peer_id); let prev_data = ""; - let cur_data = serde_json::to_vec(&mallory_data).unwrap(); + let cur_data = mallory_data.serialize().unwrap(); let res = bob_avm.call(&air_script, prev_data, cur_data, test_run_params).unwrap(); assert_error_eq!( @@ -164,7 +164,7 @@ fn test_attack_replace_tetraplet() { let mut bob_avm = create_avm(unit_call_service(), bob_peer_id); let test_run_params = TestRunParameters::from_init_peer_id(alice_peer_id); let prev_data = ""; - let cur_data = serde_json::to_vec(&mallory_data).unwrap(); + let cur_data = mallory_data.serialize().unwrap(); let res = bob_avm.call(&air_script, prev_data, cur_data, test_run_params).unwrap(); assert_error_eq!( @@ -247,7 +247,7 @@ fn test_attack_replace_call_result() { let mut bob_avm = create_avm(unit_call_service(), bob_peer_id); let test_run_params = TestRunParameters::from_init_peer_id(alice_peer_id); let prev_data = ""; - let cur_data = serde_json::to_vec(&mallory_data).unwrap(); + let cur_data = mallory_data.serialize().unwrap(); let res = bob_avm.call(&air_script, prev_data, cur_data, test_run_params).unwrap(); assert_error_eq!( @@ -337,7 +337,7 @@ fn test_attack_replace_canon_value() { let mut bob_avm = create_avm(unit_call_service(), bob_peer_id); let test_run_params = TestRunParameters::from_init_peer_id(alice_peer_id); let prev_data = ""; - let cur_data = serde_json::to_vec(&mallory_data).unwrap(); + let cur_data = mallory_data.serialize().unwrap(); let res = bob_avm.call(&air_script, prev_data, cur_data, test_run_params).unwrap(); assert_error_eq!( @@ -436,7 +436,7 @@ fn test_attack_replace_canon_result_values() { let mut bob_avm = create_avm(unit_call_service(), bob_peer_id); let test_run_params = TestRunParameters::from_init_peer_id(alice_peer_id); let prev_data = ""; - let cur_data = serde_json::to_vec(&mallory_data).unwrap(); + let cur_data = mallory_data.serialize().unwrap(); let res = bob_avm.call(&air_script, prev_data, cur_data, test_run_params).unwrap(); assert_error_eq!( @@ -539,7 +539,7 @@ fn test_attack_replace_canon_result_tetraplet() { let mut bob_avm = create_avm(unit_call_service(), bob_peer_id); let test_run_params = TestRunParameters::from_init_peer_id(alice_peer_id); let prev_data = ""; - let cur_data = serde_json::to_vec(&mallory_data).unwrap(); + let cur_data = mallory_data.serialize().unwrap(); let res = bob_avm.call(&air_script, prev_data, cur_data, test_run_params).unwrap(); assert_error_eq!( diff --git a/air/tests/test_module/features/signatures/runtime.rs b/air/tests/test_module/features/signatures/runtime.rs index d6025f85..c556de1b 100644 --- a/air/tests/test_module/features/signatures/runtime.rs +++ b/air/tests/test_module/features/signatures/runtime.rs @@ -60,7 +60,7 @@ fn test_runtime_executed_call_argument_hash() { mallory_raw_trace.swap(0, 1); mallory_data.trace = ExecutionTrace::from(mallory_raw_trace); - let mallory_data = serde_json::to_vec(&mallory_data).unwrap(); + let mallory_data = mallory_data.serialize().unwrap(); let bob_res = bob_avm.call(air_script, "", mallory_data, test_run_params).unwrap(); assert_error_eq!( @@ -112,7 +112,7 @@ fn test_runtime_executed_call_tetraplet() { mallory_raw_trace.swap(0, 1); mallory_data.trace = ExecutionTrace::from(mallory_raw_trace); - let mallory_data = serde_json::to_vec(&mallory_data).unwrap(); + let mallory_data = mallory_data.serialize().unwrap(); let bob_res = bob_avm.call(air_script, "", mallory_data, test_run_params).unwrap(); let expected_value = format!( @@ -182,7 +182,7 @@ fn test_runtime_executed_failed_argument_hash() { mallory_raw_trace.swap(0, 1); mallory_data.trace = ExecutionTrace::from(mallory_raw_trace); - let mallory_data = serde_json::to_vec(&mallory_data).unwrap(); + let mallory_data = mallory_data.serialize().unwrap(); let bob_res = bob_avm.call(air_script, "", mallory_data, test_run_params).unwrap(); assert_error_eq!( @@ -238,7 +238,7 @@ fn test_runtime_failed_call_tetraplet() { mallory_raw_trace.swap(0, 1); mallory_data.trace = ExecutionTrace::from(mallory_raw_trace); - let mallory_data = serde_json::to_vec(&mallory_data).unwrap(); + let mallory_data = mallory_data.serialize().unwrap(); let bob_res = bob_avm.call(air_script, "", mallory_data, test_run_params).unwrap(); let expected_value = format!( @@ -306,7 +306,7 @@ fn test_runtime_canon_tetraplet() { mallory_raw_trace.swap(2, 3); mallory_data.trace = ExecutionTrace::from(mallory_raw_trace); - let mallory_data = serde_json::to_vec(&mallory_data).unwrap(); + let mallory_data = mallory_data.serialize().unwrap(); let bob_res = bob_avm.call(air_script, "", mallory_data, test_run_params).unwrap(); let expected_value = format!( diff --git a/air/tests/test_module/negative_tests/farewell_step.rs b/air/tests/test_module/negative_tests/farewell_step.rs index 8eb6ef07..c9106e38 100644 --- a/air/tests/test_module/negative_tests/farewell_step.rs +++ b/air/tests/test_module/negative_tests/farewell_step.rs @@ -23,7 +23,7 @@ fn unprocessed_call_result() { let client_peer_id = "some_peer_id"; let mut client_vm = create_avm(unit_call_service(), client_peer_id); let prev_data = InterpreterData::new(semver::Version::new(1, 1, 1)); - let prev_data: Vec = serde_json::to_vec(&prev_data).unwrap(); + let prev_data: Vec = prev_data.serialize().unwrap(); let call_service_result = air_test_utils::CallServiceResult::ok(json!("null")); let call_results_4_call = maplit::hashmap!( 70 => call_service_result, diff --git a/air/tests/test_module/negative_tests/preparation_step.rs b/air/tests/test_module/negative_tests/preparation_step.rs index 2c3f348b..db6d5b5e 100644 --- a/air/tests/test_module/negative_tests/preparation_step.rs +++ b/air/tests/test_module/negative_tests/preparation_step.rs @@ -15,7 +15,10 @@ */ use air::PreparationError; -use air_interpreter_interface::{CallResults, RunParameters}; +use air_interpreter_interface::CallResultsFormat; +use air_interpreter_interface::CallResultsRepr; +use air_interpreter_interface::RunParameters; +use air_interpreter_sede::FromSerialized; use air_test_utils::prelude::*; use serde::Deserialize; @@ -23,6 +26,9 @@ use serde::Serialize; #[test] fn invalid_data_without_versions() { + use air_interpreter_sede::Format; + use air_interpreter_sede::Representation; + #[derive(Serialize, Deserialize)] struct InvalidDataStruct { pub trace: Vec, @@ -33,11 +39,12 @@ fn invalid_data_without_versions() { let script = r#"(null)"#; let invalid_data = InvalidDataStruct { trace: vec![1, 2, 3] }; - let invalid_data = serde_json::to_vec(&invalid_data).unwrap(); + + let invalid_data = InterpreterDataRepr.get_format().to_vec(&invalid_data).unwrap(); let result = call_vm!(vm, <_>::default(), script, "", invalid_data.clone()); - let expected_serde_error = serde_json::from_slice::(&invalid_data).err().unwrap(); + let expected_serde_error = InterpreterData::try_from_slice(&invalid_data).unwrap_err(); let expected_error = PreparationError::DataDeFailed { data: invalid_data, error: expected_serde_error, @@ -47,6 +54,9 @@ fn invalid_data_without_versions() { #[test] fn invalid_data_with_versions() { + use air_interpreter_sede::Format; + use air_interpreter_sede::Representation; + #[derive(Serialize, Deserialize)] struct InvalidDataStruct { pub trace: Vec, @@ -63,11 +73,11 @@ fn invalid_data_with_versions() { trace: vec![1, 2, 3], versions: versions.clone(), }; - let invalid_data = serde_json::to_vec(&invalid_data).unwrap(); + let invalid_data = InterpreterDataRepr.get_format().to_vec(&invalid_data).unwrap(); let result = call_vm!(vm, <_>::default(), script, "", invalid_data.clone()); - let expected_serde_error = serde_json::from_slice::(&invalid_data).err().unwrap(); + let expected_serde_error = InterpreterData::try_from_slice(&invalid_data).unwrap_err(); let expected_error = PreparationError::DataDeFailedWithVersions { data: invalid_data, error: expected_serde_error, @@ -78,13 +88,15 @@ fn invalid_data_with_versions() { #[test] fn invalid_callresults() { + use air_interpreter_sede::Format; + let air = r#"(null)"#.to_string(); let client_peer_id = "some_peer_id".to_string(); let prev_data = InterpreterData::new(semver::Version::new(1, 1, 1)); - let prev_data: Vec = serde_json::to_vec(&prev_data).unwrap(); + let prev_data: Vec = prev_data.serialize().unwrap(); let data = Vec::::new(); - let wrong_call_results = Vec::::new(); - let wrong_call_results = serde_json::to_vec(&wrong_call_results).unwrap(); + let vec = Vec::::new(); + let wrong_call_results = CallResultsFormat::default().to_vec(&vec).unwrap(); let keypair = fluence_keypair::KeyPair::generate_ed25519(); let run_parameters = RunParameters::new( client_peer_id.clone(), @@ -96,15 +108,13 @@ fn invalid_callresults() { "".to_owned(), ); - let result = air::execute_air(air, prev_data, data, run_parameters, wrong_call_results.clone()); + let result = air::execute_air(air, prev_data, data, run_parameters, wrong_call_results.clone().into()); let result = RawAVMOutcome::from_interpreter_outcome(result).unwrap(); - let expected_serde_error = serde_json::from_slice::(&wrong_call_results) - .err() - .unwrap(); + let expected_serde_error = CallResultsRepr.deserialize(&wrong_call_results).unwrap_err(); let expected_error = PreparationError::CallResultsDeFailed { error: expected_serde_error, - call_results: wrong_call_results, + call_results: wrong_call_results.into(), }; assert!(check_error(&result, expected_error)); diff --git a/air/tests/test_module/negative_tests/uncatchable_trace_related.rs b/air/tests/test_module/negative_tests/uncatchable_trace_related.rs index 48aa9d41..3a93757b 100644 --- a/air/tests/test_module/negative_tests/uncatchable_trace_related.rs +++ b/air/tests/test_module/negative_tests/uncatchable_trace_related.rs @@ -303,6 +303,9 @@ fn different_executed_state_expected() { #[test] fn invalid_dst_generations() { + use air_interpreter_sede::Format; + use air_interpreter_sede::Representation; + let vm_peer_id_1 = "vm_peer_id_1"; let mut peer_vm_1 = create_avm(unit_call_service(), vm_peer_id_1); let script = format!( @@ -321,7 +324,7 @@ fn invalid_dst_generations() { let mut data_value = serde_json::to_value(&empty_data).unwrap(); data_value["trace"] = json!([{"ap": {"gens": [42, 42]}}]); - let data: Vec = serde_json::to_vec(&data_value).unwrap(); + let data = InterpreterDataRepr.get_format().to_vec(&data_value).unwrap(); // let result = peer_vm_1.call(script, "", data, <_>::default()).unwrap(); let result = call_vm!(peer_vm_1, <_>::default(), &script, "", data); let expected_error = UncatchableError::TraceError { diff --git a/avm/client/src/avmHelpers.ts b/avm/client/src/avmHelpers.ts index cf670f72..ca931a70 100644 --- a/avm/client/src/avmHelpers.ts +++ b/avm/client/src/avmHelpers.ts @@ -83,15 +83,17 @@ export function deserializeAvmResult(result: any): InterpreterResult { let arguments_; let tetraplets; try { - arguments_ = JSON.parse(callRequest.arguments); + const argumentsStr = decoder.decode(new Uint8Array(callRequest.arguments)); + arguments_ = JSON.parse(argumentsStr); } catch (e) { - throw "Couldn't parse arguments: " + e + '. Original string is: ' + arguments_; + throw "Couldn't parse arguments: " + e + '. Original data is: ' + callRequest.arguments; } try { - tetraplets = JSON.parse(callRequest.tetraplets); + const tetrapletsStr = decoder.decode(new Uint8Array(callRequest.tetraplets)); + tetraplets = JSON.parse(tetrapletsStr); } catch (e) { - throw "Couldn't parse tetraplets: " + e + '. Original string is: ' + tetraplets; + throw "Couldn't parse tetraplets: " + e + '. Original data is: ' + callRequest.tetraplets; } resultCallRequests.push([ diff --git a/avm/interface/Cargo.toml b/avm/interface/Cargo.toml index f093453a..ff665c40 100644 --- a/avm/interface/Cargo.toml +++ b/avm/interface/Cargo.toml @@ -16,6 +16,7 @@ path = "src/lib.rs" [dependencies] air-interpreter-interface = { version = "0.15.2", path = "../../crates/air-lib/interpreter-interface", default-features = false } +air-interpreter-sede = { version = "0.1.0", path = "../../crates/air-lib/interpreter-sede", default-features = false } air-utils = { version = "0.2.0", path = "../../crates/air-lib/utils" } polyplets = { version = "0.5.1", path = "../../crates/air-lib/polyplets" } diff --git a/avm/interface/src/call_request_parameters.rs b/avm/interface/src/call_request_parameters.rs index 1add26fd..a68ce8ec 100644 --- a/avm/interface/src/call_request_parameters.rs +++ b/avm/interface/src/call_request_parameters.rs @@ -17,6 +17,7 @@ use super::JValue; use crate::CallSeDeErrors; +use air_interpreter_interface::SerializedCallRequests; use polyplets::SecurityTetraplet; use serde::Deserialize; use serde::Serialize; @@ -60,15 +61,19 @@ impl CallRequestParams { pub(crate) fn from_raw( call_params: air_interpreter_interface::CallRequestParams, ) -> Result { - let arguments: Vec = - serde_json::from_str(&call_params.arguments).map_err(|de_error| { - CallSeDeErrors::CallParamsArgsDeFailed { - call_params: call_params.clone(), - de_error, - } + use air_interpreter_interface::CallArgumentsRepr; + use air_interpreter_interface::TetrapletsRepr; + use air_interpreter_sede::FromSerialized; + + let arguments: Vec = CallArgumentsRepr + .deserialize(&call_params.arguments) + .map_err(|de_error| CallSeDeErrors::CallParamsArgsDeFailed { + call_params: call_params.clone(), + de_error, })?; - let tetraplets: Vec> = serde_json::from_str(&call_params.tetraplets) + let tetraplets: Vec> = TetrapletsRepr + .deserialize(&call_params.tetraplets) .map_err(|de_error| CallSeDeErrors::CallParamsTetrapletsDeFailed { call_params: call_params.clone(), de_error, @@ -86,10 +91,13 @@ impl CallRequestParams { } pub(crate) fn from_raw_call_requests( - raw_call_params: Vec, + raw_call_params: SerializedCallRequests, ) -> Result { + use air_interpreter_interface::CallRequestsRepr; + use air_interpreter_sede::FromSerialized; + let call_requests: air_interpreter_interface::CallRequests = - match serde_json::from_slice(&raw_call_params) { + match CallRequestsRepr.deserialize(&raw_call_params) { Ok(requests) => requests, Err(error) => { return Err(CallSeDeErrors::CallRequestsDeError { diff --git a/avm/interface/src/call_service_result.rs b/avm/interface/src/call_service_result.rs index c2827f9d..e994df47 100644 --- a/avm/interface/src/call_service_result.rs +++ b/avm/interface/src/call_service_result.rs @@ -53,6 +53,7 @@ impl CallServiceResult { air_interpreter_interface::CallServiceResult { ret_code, + // TODO serializer result: result.to_string(), } } diff --git a/avm/interface/src/lib.rs b/avm/interface/src/lib.rs index 488b237a..8d19fefa 100644 --- a/avm/interface/src/lib.rs +++ b/avm/interface/src/lib.rs @@ -32,7 +32,11 @@ mod outcome; mod particle_parameters; pub mod raw_outcome; -use serde_json::Error as SerdeError; +use air_interpreter_interface::CallArgumentsDeserializeError; +use air_interpreter_interface::CallRequestsDeserializeError; +use air_interpreter_interface::CallResultsSerializeError; +use air_interpreter_interface::SerializedCallRequests; +use air_interpreter_interface::TetrapletDeserializeError; use thiserror::Error as ThisError; #[derive(Debug, ThisError)] @@ -42,14 +46,14 @@ pub enum CallSeDeErrors { #[error("error occurred while call results `{call_results:?}` deserialization: {se_error}")] CallResultsSeFailed { call_results: air_interpreter_interface::CallResults, - se_error: SerdeError, + se_error: CallResultsSerializeError, }, /// This error is encountered when deserialization pof call requests failed for some reason. #[error("'{raw_call_request:?}' can't been serialized with error '{error}'")] CallRequestsDeError { - raw_call_request: Vec, - error: SerdeError, + raw_call_request: SerializedCallRequests, + error: CallRequestsDeserializeError, }, /// Errors encountered while trying to deserialize arguments from call parameters returned @@ -58,7 +62,7 @@ pub enum CallSeDeErrors { #[error("error occurred while deserialization of arguments from call params `{call_params:?}`: {de_error}")] CallParamsArgsDeFailed { call_params: air_interpreter_interface::CallRequestParams, - de_error: SerdeError, + de_error: CallArgumentsDeserializeError, }, /// Errors encountered while trying to deserialize tetraplets from call parameters returned @@ -67,9 +71,10 @@ pub enum CallSeDeErrors { #[error("error occurred while deserialization of tetraplets from call params `{call_params:?}`: {de_error}")] CallParamsTetrapletsDeFailed { call_params: air_interpreter_interface::CallRequestParams, - de_error: SerdeError, + de_error: TetrapletDeserializeError, }, } + type JValue = serde_json::Value; pub use call_request_parameters::*; diff --git a/avm/interface/src/raw_outcome.rs b/avm/interface/src/raw_outcome.rs index 2377dfc1..0be933dd 100644 --- a/avm/interface/src/raw_outcome.rs +++ b/avm/interface/src/raw_outcome.rs @@ -43,7 +43,7 @@ impl RawAVMOutcome { next_peer_pks, } = outcome; - let call_requests = crate::from_raw_call_requests(call_requests)?; + let call_requests = crate::from_raw_call_requests(call_requests.into())?; let raw_avm_outcome = Self { ret_code, diff --git a/avm/server/Cargo.toml b/avm/server/Cargo.toml index a56e3c7d..c0f45834 100644 --- a/avm/server/Cargo.toml +++ b/avm/server/Cargo.toml @@ -16,6 +16,7 @@ path = "src/lib.rs" [dependencies] air-interpreter-interface = { version = "0.15.2", path = "../../crates/air-lib/interpreter-interface" } +air-interpreter-sede = { version = "0.1.0", path = "../../crates/air-lib/interpreter-sede" } air-utils = { version = "0.2.0", path = "../../crates/air-lib/utils" } avm-data-store = { version = "0.7.3", path = "../../crates/data-store" } marine-runtime = "0.30.0" diff --git a/avm/server/src/runner.rs b/avm/server/src/runner.rs index a6e6e60b..1f1f28e3 100644 --- a/avm/server/src/runner.rs +++ b/avm/server/src/runner.rs @@ -17,7 +17,9 @@ use crate::RunnerError; use crate::RunnerResult; +use air_interpreter_interface::CallResultsRepr; use air_interpreter_interface::InterpreterOutcome; +use air_interpreter_sede::ToSerialized; use air_utils::measure; use avm_interface::raw_outcome::RawAVMOutcome; use avm_interface::CallResults; @@ -210,9 +212,11 @@ fn prepare_args( let call_results = avm_interface::into_raw_result(call_results); let call_results = measure!( - serde_json::to_vec(&call_results).expect("the default serializer shouldn't fail"), + CallResultsRepr + .serialize(&call_results) + .expect("the default serializer shouldn't fail"), tracing::Level::INFO, - "serde_json::to_vec call_results" + "CallResultsRepr.serialize" ); vec![ @@ -220,7 +224,7 @@ fn prepare_args( IValue::ByteArray(prev_data.into()), IValue::ByteArray(data.into()), run_parameters, - IValue::ByteArray(call_results), + IValue::ByteArray(call_results.to_vec()), ] } diff --git a/benches/PERFORMANCE.json b/benches/PERFORMANCE.json index 19e6ac95..fd3f0b24 100644 --- a/benches/PERFORMANCE.json +++ b/benches/PERFORMANCE.json @@ -2379,33 +2379,46 @@ "stats": { "air::runner::execute_air": { "common_prefix": "air", - "duration": "13.10ms", + "duration": "13.18ms", "nested": { "preparation_step::preparation::parse_data": { - "common_prefix": "air_interpreter_data::interpreter_data::serde_json", - "duration": "5.36ms", + "common_prefix": "air_interpreter_data::interpreter_data::InterpreterData", + "duration": "5.28ms", "nested": { - "from_slice": "5.30ms" + "try_from_slice": "5.24ms" } }, "preparation_step::preparation::prepare": { "common_prefix": "", - "duration": "170.00µs", + "duration": "190.00µs", "nested": { - "air::preparation_step::preparation::make_exec_ctx": "22.00µs", - "air_parser::parser::air_parser::parse": "32.00µs" + "air::preparation_step::preparation::make_exec_ctx": { + "common_prefix": "air::preparation_step::preparation", + "duration": "40.00µs", + "nested": { + "CallResultsRepr.deserialize": "10.00µs" + } + }, + "air_parser::parser::air_parser::parse": "28.00µs" } }, "runner::execute": "8.00µs", "runner::farewell": { "common_prefix": "air::farewell_step::outcome", - "duration": "3.29ms", + "duration": "3.41ms", "nested": { "from_success_result": { "common_prefix": "air::farewell_step::outcome", - "duration": "3.27ms", + "duration": "3.39ms", "nested": { - "populate_outcome_from_contexts": "3.23ms" + "populate_outcome_from_contexts": { + "common_prefix": "air::farewell_step::outcome", + "duration": "3.35ms", + "nested": { + "CallRequestsRepr.serialize": "16.00µs", + "InterpreterData::serialize": "2.36ms" + } + } } } } @@ -2413,68 +2426,81 @@ "signing_step::sign_produced_cids": "100.00µs", "verification_step::verify": { "common_prefix": "air_interpreter_data::cid_info", - "duration": "3.99ms", + "duration": "4.00ms", "nested": { - "verify": "3.63ms" + "verify": "3.64ms" } } } } }, - "total_time": "13.10ms" + "total_time": "13.18ms" }, "call-requests500": { "comment": "multiple call requests", "memory_sizes": [ - "58.562 MiB", - "58.562 MiB" + "55.500 MiB", + "55.500 MiB" ], "stats": { "air::runner::execute_air": { "common_prefix": "air", - "duration": "26.11ms", + "duration": "18.37ms", "nested": { "preparation_step::preparation::parse_data": { - "common_prefix": "air_interpreter_data::interpreter_data::serde_json", - "duration": "134.00µs", + "common_prefix": "air_interpreter_data::interpreter_data::InterpreterData", + "duration": "145.00µs", "nested": { - "from_slice": "97.00µs" + "try_from_slice": "99.00µs" } }, "preparation_step::preparation::prepare": { "common_prefix": "", - "duration": "238.00µs", + "duration": "243.00µs", "nested": { - "air::preparation_step::preparation::make_exec_ctx": "48.00µs", - "air_parser::parser::air_parser::parse": "68.00µs" + "air::preparation_step::preparation::make_exec_ctx": { + "common_prefix": "air::preparation_step::preparation", + "duration": "44.00µs", + "nested": { + "CallResultsRepr.deserialize": "18.00µs" + } + }, + "air_parser::parser::air_parser::parse": "71.00µs" } }, - "runner::execute": "20.23ms", + "runner::execute": "16.83ms", "runner::farewell": { "common_prefix": "air::farewell_step::outcome", - "duration": "5.16ms", + "duration": "780.00µs", "nested": { "from_success_result": { "common_prefix": "air::farewell_step::outcome", - "duration": "5.14ms", + "duration": "759.00µs", "nested": { - "populate_outcome_from_contexts": "5.04ms" + "populate_outcome_from_contexts": { + "common_prefix": "air::farewell_step::outcome", + "duration": "652.00µs", + "nested": { + "CallRequestsRepr.serialize": "276.00µs", + "InterpreterData::serialize": "217.00µs" + } + } } } } }, - "signing_step::sign_produced_cids": "107.00µs", + "signing_step::sign_produced_cids": "105.00µs", "verification_step::verify": { "common_prefix": "air_interpreter_data::cid_info", - "duration": "75.00µs", + "duration": "81.00µs", "nested": { - "verify": "9.00µs" + "verify": "10.00µs" } } } } }, - "total_time": "26.11ms" + "total_time": "18.37ms" }, "call-results500": { "comment": "multiple call results", @@ -2485,41 +2511,54 @@ "stats": { "air::runner::execute_air": { "common_prefix": "air", - "duration": "15.96ms", + "duration": "14.90ms", "nested": { "preparation_step::preparation::parse_data": { - "common_prefix": "air_interpreter_data::interpreter_data::serde_json", - "duration": "624.00µs", + "common_prefix": "air_interpreter_data::interpreter_data::InterpreterData", + "duration": "611.00µs", "nested": { - "from_slice": "581.00µs" + "try_from_slice": "568.00µs" } }, "preparation_step::preparation::prepare": { "common_prefix": "", - "duration": "1.00ms", + "duration": "330.00µs", "nested": { - "air::preparation_step::preparation::make_exec_ctx": "810.00µs", - "air_parser::parser::air_parser::parse": "67.00µs" + "air::preparation_step::preparation::make_exec_ctx": { + "common_prefix": "air::preparation_step::preparation", + "duration": "136.00µs", + "nested": { + "CallResultsRepr.deserialize": "107.00µs" + } + }, + "air_parser::parser::air_parser::parse": "66.00µs" } }, - "runner::execute": "11.94ms", + "runner::execute": "11.51ms", "runner::farewell": { "common_prefix": "air::farewell_step::outcome", - "duration": "1.82ms", + "duration": "1.88ms", "nested": { "from_success_result": { "common_prefix": "air::farewell_step::outcome", - "duration": "1.79ms", + "duration": "1.86ms", "nested": { - "populate_outcome_from_contexts": "1.35ms" + "populate_outcome_from_contexts": { + "common_prefix": "air::farewell_step::outcome", + "duration": "1.40ms", + "nested": { + "CallRequestsRepr.serialize": "16.00µs", + "InterpreterData::serialize": "949.00µs" + } + } } } } }, - "signing_step::sign_produced_cids": "292.00µs", + "signing_step::sign_produced_cids": "288.00µs", "verification_step::verify": { "common_prefix": "air_interpreter_data::cid_info", - "duration": "92.00µs", + "duration": "96.00µs", "nested": { "verify": "9.00µs" } @@ -2527,7 +2566,7 @@ } } }, - "total_time": "15.96ms" + "total_time": "14.90ms" }, "canon-map-key-by-lens": { "comment": "benchmarking a map insert operation", @@ -2538,49 +2577,62 @@ "stats": { "air::runner::execute_air": { "common_prefix": "air", - "duration": "10.80ms", + "duration": "10.90ms", "nested": { "preparation_step::preparation::parse_data": { - "common_prefix": "air_interpreter_data::interpreter_data::serde_json", - "duration": "3.18ms", + "common_prefix": "air_interpreter_data::interpreter_data::InterpreterData", + "duration": "3.17ms", "nested": { - "from_slice": "3.13ms" + "try_from_slice": "3.12ms" } }, "preparation_step::preparation::prepare": { "common_prefix": "", - "duration": "378.00µs", + "duration": "401.00µs", "nested": { - "air::preparation_step::preparation::make_exec_ctx": "189.00µs", - "air_parser::parser::air_parser::parse": "73.00µs" + "air::preparation_step::preparation::make_exec_ctx": { + "common_prefix": "air::preparation_step::preparation", + "duration": "210.00µs", + "nested": { + "CallResultsRepr.deserialize": "11.00µs" + } + }, + "air_parser::parser::air_parser::parse": "69.00µs" } }, - "runner::execute": "1.94ms", + "runner::execute": "1.93ms", "runner::farewell": { "common_prefix": "air::farewell_step::outcome", - "duration": "1.87ms", + "duration": "1.94ms", "nested": { "from_success_result": { "common_prefix": "air::farewell_step::outcome", - "duration": "1.85ms", + "duration": "1.92ms", "nested": { - "populate_outcome_from_contexts": "1.49ms" + "populate_outcome_from_contexts": { + "common_prefix": "air::farewell_step::outcome", + "duration": "1.56ms", + "nested": { + "CallRequestsRepr.serialize": "15.00µs", + "InterpreterData::serialize": "1.26ms" + } + } } } } }, - "signing_step::sign_produced_cids": "99.00µs", + "signing_step::sign_produced_cids": "100.00µs", "verification_step::verify": { "common_prefix": "air_interpreter_data::cid_info", - "duration": "3.15ms", + "duration": "3.16ms", "nested": { - "verify": "2.79ms" + "verify": "2.80ms" } } } } }, - "total_time": "10.80ms" + "total_time": "10.90ms" }, "canon-map-key-element-by-lens": { "comment": "benchmarking a map insert operation", @@ -2594,40 +2646,53 @@ "duration": "10.80ms", "nested": { "preparation_step::preparation::parse_data": { - "common_prefix": "air_interpreter_data::interpreter_data::serde_json", - "duration": "3.18ms", + "common_prefix": "air_interpreter_data::interpreter_data::InterpreterData", + "duration": "3.15ms", "nested": { - "from_slice": "3.13ms" + "try_from_slice": "3.10ms" } }, "preparation_step::preparation::prepare": { "common_prefix": "", - "duration": "387.00µs", + "duration": "399.00µs", "nested": { - "air::preparation_step::preparation::make_exec_ctx": "194.00µs", - "air_parser::parser::air_parser::parse": "75.00µs" + "air::preparation_step::preparation::make_exec_ctx": { + "common_prefix": "air::preparation_step::preparation", + "duration": "209.00µs", + "nested": { + "CallResultsRepr.deserialize": "10.00µs" + } + }, + "air_parser::parser::air_parser::parse": "70.00µs" } }, - "runner::execute": "1.93ms", + "runner::execute": "1.92ms", "runner::farewell": { "common_prefix": "air::farewell_step::outcome", - "duration": "1.86ms", + "duration": "1.91ms", "nested": { "from_success_result": { "common_prefix": "air::farewell_step::outcome", - "duration": "1.84ms", + "duration": "1.89ms", "nested": { - "populate_outcome_from_contexts": "1.50ms" + "populate_outcome_from_contexts": { + "common_prefix": "air::farewell_step::outcome", + "duration": "1.55ms", + "nested": { + "CallRequestsRepr.serialize": "16.00µs", + "InterpreterData::serialize": "1.25ms" + } + } } } } }, - "signing_step::sign_produced_cids": "99.00µs", + "signing_step::sign_produced_cids": "100.00µs", "verification_step::verify": { "common_prefix": "air_interpreter_data::cid_info", - "duration": "3.15ms", + "duration": "3.17ms", "nested": { - "verify": "2.79ms" + "verify": "2.80ms" } } } @@ -2644,49 +2709,62 @@ "stats": { "air::runner::execute_air": { "common_prefix": "air", - "duration": "8.97ms", + "duration": "8.88ms", "nested": { "preparation_step::preparation::parse_data": { - "common_prefix": "air_interpreter_data::interpreter_data::serde_json", - "duration": "410.00µs", + "common_prefix": "air_interpreter_data::interpreter_data::InterpreterData", + "duration": "416.00µs", "nested": { - "from_slice": "363.00µs" + "try_from_slice": "372.00µs" } }, "preparation_step::preparation::prepare": { "common_prefix": "", - "duration": "196.00µs", + "duration": "218.00µs", "nested": { - "air::preparation_step::preparation::make_exec_ctx": "20.00µs", - "air_parser::parser::air_parser::parse": "59.00µs" + "air::preparation_step::preparation::make_exec_ctx": { + "common_prefix": "air::preparation_step::preparation", + "duration": "38.00µs", + "nested": { + "CallResultsRepr.deserialize": "10.00µs" + } + }, + "air_parser::parser::air_parser::parse": "58.00µs" } }, - "runner::execute": "6.05ms", + "runner::execute": "5.87ms", "runner::farewell": { "common_prefix": "air::farewell_step::outcome", - "duration": "1.63ms", + "duration": "1.69ms", "nested": { "from_success_result": { "common_prefix": "air::farewell_step::outcome", - "duration": "1.60ms", + "duration": "1.67ms", "nested": { - "populate_outcome_from_contexts": "1.32ms" + "populate_outcome_from_contexts": { + "common_prefix": "air::farewell_step::outcome", + "duration": "1.37ms", + "nested": { + "CallRequestsRepr.serialize": "14.00µs", + "InterpreterData::serialize": "1.08ms" + } + } } } } }, - "signing_step::sign_produced_cids": "100.00µs", + "signing_step::sign_produced_cids": "99.00µs", "verification_step::verify": { "common_prefix": "air_interpreter_data::cid_info", - "duration": "406.00µs", + "duration": "413.00µs", "nested": { - "verify": "39.00µs" + "verify": "40.00µs" } } } } }, - "total_time": "8.97ms" + "total_time": "8.88ms" }, "canon-map-scalar-multiple-keys": { "comment": "benchmarking a map insert operation", @@ -2697,49 +2775,62 @@ "stats": { "air::runner::execute_air": { "common_prefix": "air", - "duration": "4.10ms", + "duration": "4.17ms", "nested": { "preparation_step::preparation::parse_data": { - "common_prefix": "air_interpreter_data::interpreter_data::serde_json", - "duration": "420.00µs", + "common_prefix": "air_interpreter_data::interpreter_data::InterpreterData", + "duration": "414.00µs", "nested": { - "from_slice": "369.00µs" + "try_from_slice": "366.00µs" } }, "preparation_step::preparation::prepare": { "common_prefix": "", - "duration": "195.00µs", + "duration": "214.00µs", "nested": { - "air::preparation_step::preparation::make_exec_ctx": "20.00µs", - "air_parser::parser::air_parser::parse": "59.00µs" + "air::preparation_step::preparation::make_exec_ctx": { + "common_prefix": "air::preparation_step::preparation", + "duration": "38.00µs", + "nested": { + "CallResultsRepr.deserialize": "10.00µs" + } + }, + "air_parser::parser::air_parser::parse": "58.00µs" } }, - "runner::execute": "2.45ms", + "runner::execute": "2.42ms", "runner::farewell": { "common_prefix": "air::farewell_step::outcome", - "duration": "349.00µs", + "duration": "415.00µs", "nested": { "from_success_result": { "common_prefix": "air::farewell_step::outcome", - "duration": "329.00µs", + "duration": "393.00µs", "nested": { - "populate_outcome_from_contexts": "292.00µs" + "populate_outcome_from_contexts": { + "common_prefix": "air::farewell_step::outcome", + "duration": "354.00µs", + "nested": { + "CallRequestsRepr.serialize": "15.00µs", + "InterpreterData::serialize": "110.00µs" + } + } } } } }, - "signing_step::sign_produced_cids": "99.00µs", + "signing_step::sign_produced_cids": "101.00µs", "verification_step::verify": { "common_prefix": "air_interpreter_data::cid_info", - "duration": "406.00µs", + "duration": "416.00µs", "nested": { - "verify": "40.00µs" + "verify": "42.00µs" } } } } }, - "total_time": "4.10ms" + "total_time": "4.17ms" }, "canon-map-scalar-single-key": { "comment": "benchmarking a map insert operation", @@ -2750,49 +2841,62 @@ "stats": { "air::runner::execute_air": { "common_prefix": "air", - "duration": "3.26ms", + "duration": "3.35ms", "nested": { "preparation_step::preparation::parse_data": { - "common_prefix": "air_interpreter_data::interpreter_data::serde_json", - "duration": "423.00µs", + "common_prefix": "air_interpreter_data::interpreter_data::InterpreterData", + "duration": "410.00µs", "nested": { - "from_slice": "375.00µs" + "try_from_slice": "368.00µs" } }, "preparation_step::preparation::prepare": { "common_prefix": "", - "duration": "192.00µs", + "duration": "214.00µs", "nested": { - "air::preparation_step::preparation::make_exec_ctx": "19.00µs", - "air_parser::parser::air_parser::parse": "56.00µs" + "air::preparation_step::preparation::make_exec_ctx": { + "common_prefix": "air::preparation_step::preparation", + "duration": "38.00µs", + "nested": { + "CallResultsRepr.deserialize": "10.00µs" + } + }, + "air_parser::parser::air_parser::parse": "54.00µs" } }, "runner::execute": "1.57ms", "runner::farewell": { "common_prefix": "air::farewell_step::outcome", - "duration": "359.00µs", + "duration": "417.00µs", "nested": { "from_success_result": { "common_prefix": "air::farewell_step::outcome", - "duration": "339.00µs", + "duration": "398.00µs", "nested": { - "populate_outcome_from_contexts": "284.00µs" + "populate_outcome_from_contexts": { + "common_prefix": "air::farewell_step::outcome", + "duration": "341.00µs", + "nested": { + "CallRequestsRepr.serialize": "14.00µs", + "InterpreterData::serialize": "121.00µs" + } + } } } } }, - "signing_step::sign_produced_cids": "99.00µs", + "signing_step::sign_produced_cids": "100.00µs", "verification_step::verify": { "common_prefix": "air_interpreter_data::cid_info", - "duration": "435.00µs", + "duration": "448.00µs", "nested": { - "verify": "73.00µs" + "verify": "76.00µs" } } } } }, - "total_time": "3.26ms" + "total_time": "3.35ms" }, "canon-map-single-key": { "comment": "benchmarking a map insert operation", @@ -2803,49 +2907,62 @@ "stats": { "air::runner::execute_air": { "common_prefix": "air", - "duration": "7.48ms", + "duration": "7.45ms", "nested": { "preparation_step::preparation::parse_data": { - "common_prefix": "air_interpreter_data::interpreter_data::serde_json", + "common_prefix": "air_interpreter_data::interpreter_data::InterpreterData", "duration": "421.00µs", "nested": { - "from_slice": "373.00µs" + "try_from_slice": "376.00µs" } }, "preparation_step::preparation::prepare": { "common_prefix": "", - "duration": "192.00µs", + "duration": "208.00µs", "nested": { - "air::preparation_step::preparation::make_exec_ctx": "20.00µs", - "air_parser::parser::air_parser::parse": "56.00µs" + "air::preparation_step::preparation::make_exec_ctx": { + "common_prefix": "air::preparation_step::preparation", + "duration": "37.00µs", + "nested": { + "CallResultsRepr.deserialize": "10.00µs" + } + }, + "air_parser::parser::air_parser::parse": "54.00µs" } }, - "runner::execute": "4.44ms", + "runner::execute": "4.32ms", "runner::farewell": { "common_prefix": "air::farewell_step::outcome", - "duration": "1.72ms", + "duration": "1.78ms", "nested": { "from_success_result": { "common_prefix": "air::farewell_step::outcome", - "duration": "1.70ms", + "duration": "1.76ms", "nested": { - "populate_outcome_from_contexts": "1.46ms" + "populate_outcome_from_contexts": { + "common_prefix": "air::farewell_step::outcome", + "duration": "1.52ms", + "nested": { + "CallRequestsRepr.serialize": "14.00µs", + "InterpreterData::serialize": "1.25ms" + } + } } } } }, - "signing_step::sign_produced_cids": "99.00µs", + "signing_step::sign_produced_cids": "98.00µs", "verification_step::verify": { "common_prefix": "air_interpreter_data::cid_info", - "duration": "434.00µs", + "duration": "444.00µs", "nested": { - "verify": "72.00µs" + "verify": "74.00µs" } } } } }, - "total_time": "7.48ms" + "total_time": "7.45ms" }, "dashboard": { "comment": "big dashboard test", @@ -2856,33 +2973,46 @@ "stats": { "air::runner::execute_air": { "common_prefix": "air", - "duration": "5.69ms", + "duration": "5.75ms", "nested": { "preparation_step::preparation::parse_data": { - "common_prefix": "air_interpreter_data::interpreter_data::serde_json", - "duration": "1.01ms", + "common_prefix": "air_interpreter_data::interpreter_data::InterpreterData", + "duration": "999.00µs", "nested": { - "from_slice": "955.00µs" + "try_from_slice": "944.00µs" } }, "preparation_step::preparation::prepare": { "common_prefix": "", - "duration": "313.00µs", + "duration": "335.00µs", "nested": { - "air::preparation_step::preparation::make_exec_ctx": "36.00µs", - "air_parser::parser::air_parser::parse": "160.00µs" + "air::preparation_step::preparation::make_exec_ctx": { + "common_prefix": "air::preparation_step::preparation", + "duration": "54.00µs", + "nested": { + "CallResultsRepr.deserialize": "10.00µs" + } + }, + "air_parser::parser::air_parser::parse": "161.00µs" } }, - "runner::execute": "759.00µs", + "runner::execute": "754.00µs", "runner::farewell": { "common_prefix": "air::farewell_step::outcome", - "duration": "461.00µs", + "duration": "519.00µs", "nested": { "from_success_result": { "common_prefix": "air::farewell_step::outcome", - "duration": "441.00µs", + "duration": "499.00µs", "nested": { - "populate_outcome_from_contexts": "398.00µs" + "populate_outcome_from_contexts": { + "common_prefix": "air::farewell_step::outcome", + "duration": "454.00µs", + "nested": { + "CallRequestsRepr.serialize": "20.00µs", + "InterpreterData::serialize": "232.00µs" + } + } } } } @@ -2890,15 +3020,15 @@ "signing_step::sign_produced_cids": "101.00µs", "verification_step::verify": { "common_prefix": "air_interpreter_data::cid_info", - "duration": "2.87ms", + "duration": "2.86ms", "nested": { - "verify": "157.00µs" + "verify": "156.00µs" } } } } }, - "total_time": "5.69ms" + "total_time": "5.75ms" }, "long-data": { "comment": "Long data trace", @@ -2909,41 +3039,54 @@ "stats": { "air::runner::execute_air": { "common_prefix": "air", - "duration": "5.01ms", + "duration": "5.04ms", "nested": { "preparation_step::preparation::parse_data": { - "common_prefix": "air_interpreter_data::interpreter_data::serde_json", - "duration": "1.95ms", + "common_prefix": "air_interpreter_data::interpreter_data::InterpreterData", + "duration": "1.89ms", "nested": { - "from_slice": "1.89ms" + "try_from_slice": "1.84ms" } }, "preparation_step::preparation::prepare": { "common_prefix": "", - "duration": "182.00µs", + "duration": "202.00µs", "nested": { - "air::preparation_step::preparation::make_exec_ctx": "34.00µs", - "air_parser::parser::air_parser::parse": "31.00µs" + "air::preparation_step::preparation::make_exec_ctx": { + "common_prefix": "air::preparation_step::preparation", + "duration": "53.00µs", + "nested": { + "CallResultsRepr.deserialize": "10.00µs" + } + }, + "air_parser::parser::air_parser::parse": "27.00µs" } }, "runner::execute": "8.00µs", "runner::farewell": { "common_prefix": "air::farewell_step::outcome", - "duration": "895.00µs", + "duration": "963.00µs", "nested": { "from_success_result": { "common_prefix": "air::farewell_step::outcome", - "duration": "876.00µs", + "duration": "944.00µs", "nested": { - "populate_outcome_from_contexts": "838.00µs" + "populate_outcome_from_contexts": { + "common_prefix": "air::farewell_step::outcome", + "duration": "908.00µs", + "nested": { + "CallRequestsRepr.serialize": "16.00µs", + "InterpreterData::serialize": "414.00µs" + } + } } } } }, - "signing_step::sign_produced_cids": "98.00µs", + "signing_step::sign_produced_cids": "99.00µs", "verification_step::verify": { "common_prefix": "air_interpreter_data::cid_info", - "duration": "1.71ms", + "duration": "1.72ms", "nested": { "verify": "662.00µs" } @@ -2951,7 +3094,7 @@ } } }, - "total_time": "5.01ms" + "total_time": "5.04ms" }, "multiple-cids10": { "comment": "verifying multiple CIDs for single peer", @@ -2962,102 +3105,128 @@ "stats": { "air::runner::execute_air": { "common_prefix": "air", - "duration": "2.53ms", + "duration": "2.63ms", "nested": { "preparation_step::preparation::parse_data": { - "common_prefix": "air_interpreter_data::interpreter_data::serde_json", - "duration": "425.00µs", + "common_prefix": "air_interpreter_data::interpreter_data::InterpreterData", + "duration": "429.00µs", "nested": { - "from_slice": "371.00µs" + "try_from_slice": "374.00µs" } }, "preparation_step::preparation::prepare": { "common_prefix": "", - "duration": "206.00µs", + "duration": "223.00µs", "nested": { - "air::preparation_step::preparation::make_exec_ctx": "30.00µs", - "air_parser::parser::air_parser::parse": "60.00µs" + "air::preparation_step::preparation::make_exec_ctx": { + "common_prefix": "air::preparation_step::preparation", + "duration": "47.00µs", + "nested": { + "CallResultsRepr.deserialize": "10.00µs" + } + }, + "air_parser::parser::air_parser::parse": "56.00µs" } }, - "runner::execute": "418.00µs", + "runner::execute": "415.00µs", "runner::farewell": { "common_prefix": "air::farewell_step::outcome", - "duration": "320.00µs", + "duration": "383.00µs", "nested": { "from_success_result": { "common_prefix": "air::farewell_step::outcome", - "duration": "299.00µs", + "duration": "363.00µs", "nested": { - "populate_outcome_from_contexts": "249.00µs" + "populate_outcome_from_contexts": { + "common_prefix": "air::farewell_step::outcome", + "duration": "311.00µs", + "nested": { + "CallRequestsRepr.serialize": "13.00µs", + "InterpreterData::serialize": "134.00µs" + } + } } } } }, - "signing_step::sign_produced_cids": "99.00µs", + "signing_step::sign_produced_cids": "101.00µs", "verification_step::verify": { "common_prefix": "air_interpreter_data::cid_info", - "duration": "890.00µs", + "duration": "901.00µs", "nested": { - "verify": "180.00µs" + "verify": "182.00µs" } } } } }, - "total_time": "2.53ms" + "total_time": "2.63ms" }, "multiple-peers8": { "comment": "verifying many CIDs for many peers", "memory_sizes": [ - "53.375 MiB", - "53.375 MiB" + "53.438 MiB", + "53.438 MiB" ], "stats": { "air::runner::execute_air": { "common_prefix": "air", - "duration": "9.43ms", + "duration": "9.56ms", "nested": { "preparation_step::preparation::parse_data": { - "common_prefix": "air_interpreter_data::interpreter_data::serde_json", - "duration": "1.38ms", + "common_prefix": "air_interpreter_data::interpreter_data::InterpreterData", + "duration": "1.39ms", "nested": { - "from_slice": "1.33ms" + "try_from_slice": "1.33ms" } }, "preparation_step::preparation::prepare": { "common_prefix": "", - "duration": "258.00µs", + "duration": "277.00µs", "nested": { - "air::preparation_step::preparation::make_exec_ctx": "78.00µs", - "air_parser::parser::air_parser::parse": "64.00µs" + "air::preparation_step::preparation::make_exec_ctx": { + "common_prefix": "air::preparation_step::preparation", + "duration": "94.00µs", + "nested": { + "CallResultsRepr.deserialize": "10.00µs" + } + }, + "air_parser::parser::air_parser::parse": "62.00µs" } }, - "runner::execute": "2.68ms", + "runner::execute": "2.65ms", "runner::farewell": { "common_prefix": "air::farewell_step::outcome", - "duration": "896.00µs", + "duration": "978.00µs", "nested": { "from_success_result": { "common_prefix": "air::farewell_step::outcome", - "duration": "875.00µs", + "duration": "959.00µs", "nested": { - "populate_outcome_from_contexts": "774.00µs" + "populate_outcome_from_contexts": { + "common_prefix": "air::farewell_step::outcome", + "duration": "856.00µs", + "nested": { + "CallRequestsRepr.serialize": "13.00µs", + "InterpreterData::serialize": "582.00µs" + } + } } } } }, - "signing_step::sign_produced_cids": "99.00µs", + "signing_step::sign_produced_cids": "106.00µs", "verification_step::verify": { "common_prefix": "air_interpreter_data::cid_info", - "duration": "3.93ms", + "duration": "3.98ms", "nested": { - "verify": "733.00µs" + "verify": "743.00µs" } } } } }, - "total_time": "9.43ms" + "total_time": "9.56ms" }, "multiple-sigs30": { "comment": "signing multiple CIDs", @@ -3068,49 +3237,62 @@ "stats": { "air::runner::execute_air": { "common_prefix": "air", - "duration": "17.47ms", + "duration": "17.48ms", "nested": { "preparation_step::preparation::parse_data": { - "common_prefix": "air_interpreter_data::interpreter_data::serde_json", - "duration": "3.96ms", + "common_prefix": "air_interpreter_data::interpreter_data::InterpreterData", + "duration": "3.95ms", "nested": { - "from_slice": "3.90ms" + "try_from_slice": "3.90ms" } }, "preparation_step::preparation::prepare": { "common_prefix": "", - "duration": "330.00µs", + "duration": "350.00µs", "nested": { - "air::preparation_step::preparation::make_exec_ctx": "151.00µs", - "air_parser::parser::air_parser::parse": "63.00µs" + "air::preparation_step::preparation::make_exec_ctx": { + "common_prefix": "air::preparation_step::preparation", + "duration": "172.00µs", + "nested": { + "CallResultsRepr.deserialize": "10.00µs" + } + }, + "air_parser::parser::air_parser::parse": "59.00µs" } }, - "runner::execute": "7.04ms", + "runner::execute": "6.93ms", "runner::farewell": { "common_prefix": "air::farewell_step::outcome", - "duration": "2.55ms", + "duration": "2.63ms", "nested": { "from_success_result": { "common_prefix": "air::farewell_step::outcome", - "duration": "2.53ms", + "duration": "2.61ms", "nested": { - "populate_outcome_from_contexts": "2.35ms" + "populate_outcome_from_contexts": { + "common_prefix": "air::farewell_step::outcome", + "duration": "2.43ms", + "nested": { + "CallRequestsRepr.serialize": "12.00µs", + "InterpreterData::serialize": "1.57ms" + } + } } } } }, - "signing_step::sign_produced_cids": "443.00µs", + "signing_step::sign_produced_cids": "444.00µs", "verification_step::verify": { "common_prefix": "air_interpreter_data::cid_info", - "duration": "2.96ms", + "duration": "2.98ms", "nested": { - "verify": "1.26ms" + "verify": "1.28ms" } } } } }, - "total_time": "17.47ms" + "total_time": "17.48ms" }, "network-explore": { "comment": "5 peers of network are discovered", @@ -3121,49 +3303,62 @@ "stats": { "air::runner::execute_air": { "common_prefix": "air", - "duration": "3.07ms", + "duration": "3.15ms", "nested": { "preparation_step::preparation::parse_data": { - "common_prefix": "air_interpreter_data::interpreter_data::serde_json", - "duration": "490.00µs", + "common_prefix": "air_interpreter_data::interpreter_data::InterpreterData", + "duration": "484.00µs", "nested": { - "from_slice": "434.00µs" + "try_from_slice": "430.00µs" } }, "preparation_step::preparation::prepare": { "common_prefix": "", - "duration": "219.00µs", + "duration": "236.00µs", "nested": { - "air::preparation_step::preparation::make_exec_ctx": "25.00µs", - "air_parser::parser::air_parser::parse": "78.00µs" + "air::preparation_step::preparation::make_exec_ctx": { + "common_prefix": "air::preparation_step::preparation", + "duration": "41.00µs", + "nested": { + "CallResultsRepr.deserialize": "10.00µs" + } + }, + "air_parser::parser::air_parser::parse": "77.00µs" } }, - "runner::execute": "144.00µs", + "runner::execute": "138.00µs", "runner::farewell": { "common_prefix": "air::farewell_step::outcome", - "duration": "251.00µs", + "duration": "315.00µs", "nested": { "from_success_result": { "common_prefix": "air::farewell_step::outcome", - "duration": "231.00µs", + "duration": "294.00µs", "nested": { - "populate_outcome_from_contexts": "193.00µs" + "populate_outcome_from_contexts": { + "common_prefix": "air::farewell_step::outcome", + "duration": "253.00µs", + "nested": { + "CallRequestsRepr.serialize": "13.00µs", + "InterpreterData::serialize": "92.00µs" + } + } } } } }, - "signing_step::sign_produced_cids": "100.00µs", + "signing_step::sign_produced_cids": "101.00µs", "verification_step::verify": { "common_prefix": "air_interpreter_data::cid_info", "duration": "1.69ms", "nested": { - "verify": "65.00µs" + "verify": "64.00µs" } } } } }, - "total_time": "3.07ms" + "total_time": "3.15ms" }, "null": { "comment": "Empty data and null script", @@ -3174,35 +3369,48 @@ "stats": { "air::runner::execute_air": { "common_prefix": "air", - "duration": "737.00µs", + "duration": "829.00µs", "nested": { - "preparation_step::preparation::parse_data": "23.00µs", + "preparation_step::preparation::parse_data": "24.00µs", "preparation_step::preparation::prepare": { "common_prefix": "", - "duration": "190.00µs", + "duration": "206.00µs", "nested": { - "air::preparation_step::preparation::make_exec_ctx": "23.00µs", - "air_parser::parser::air_parser::parse": "34.00µs" + "air::preparation_step::preparation::make_exec_ctx": { + "common_prefix": "air::preparation_step::preparation", + "duration": "40.00µs", + "nested": { + "CallResultsRepr.deserialize": "11.00µs" + } + }, + "air_parser::parser::air_parser::parse": "35.00µs" } }, - "runner::execute": "8.00µs", + "runner::execute": "9.00µs", "runner::farewell": { "common_prefix": "air::farewell_step::outcome", - "duration": "184.00µs", + "duration": "242.00µs", "nested": { "from_success_result": { "common_prefix": "air::farewell_step::outcome", - "duration": "165.00µs", + "duration": "223.00µs", "nested": { - "populate_outcome_from_contexts": "125.00µs" + "populate_outcome_from_contexts": { + "common_prefix": "air::farewell_step::outcome", + "duration": "186.00µs", + "nested": { + "CallRequestsRepr.serialize": "16.00µs", + "InterpreterData::serialize": "31.00µs" + } + } } } } }, - "signing_step::sign_produced_cids": "106.00µs", + "signing_step::sign_produced_cids": "109.00µs", "verification_step::verify": { "common_prefix": "air_interpreter_data::cid_info", - "duration": "44.00µs", + "duration": "47.00µs", "nested": { "verify": "10.00µs" } @@ -3210,7 +3418,7 @@ } } }, - "total_time": "737.00µs" + "total_time": "829.00µs" }, "parser-10000-100": { "comment": "long air script with lot of variable assignments", @@ -3221,43 +3429,56 @@ "stats": { "air::runner::execute_air": { "common_prefix": "air", - "duration": "22.89ms", + "duration": "23.30ms", "nested": { "preparation_step::preparation::parse_data": "25.00µs", "preparation_step::preparation::prepare": { "common_prefix": "", - "duration": "21.40ms", + "duration": "21.75ms", "nested": { - "air::preparation_step::preparation::make_exec_ctx": "23.00µs", - "air_parser::parser::air_parser::parse": "21.25ms" + "air::preparation_step::preparation::make_exec_ctx": { + "common_prefix": "air::preparation_step::preparation", + "duration": "37.00µs", + "nested": { + "CallResultsRepr.deserialize": "11.00µs" + } + }, + "air_parser::parser::air_parser::parse": "21.58ms" } }, - "runner::execute": "39.00µs", + "runner::execute": "36.00µs", "runner::farewell": { "common_prefix": "air::farewell_step::outcome", - "duration": "187.00µs", + "duration": "247.00µs", "nested": { "from_success_result": { "common_prefix": "air::farewell_step::outcome", - "duration": "168.00µs", + "duration": "227.00µs", "nested": { - "populate_outcome_from_contexts": "131.00µs" + "populate_outcome_from_contexts": { + "common_prefix": "air::farewell_step::outcome", + "duration": "190.00µs", + "nested": { + "CallRequestsRepr.serialize": "16.00µs", + "InterpreterData::serialize": "35.00µs" + } + } } } } }, - "signing_step::sign_produced_cids": "107.00µs", + "signing_step::sign_produced_cids": "108.00µs", "verification_step::verify": { "common_prefix": "air_interpreter_data::cid_info", - "duration": "45.00µs", + "duration": "49.00µs", "nested": { - "verify": "11.00µs" + "verify": "10.00µs" } } } } }, - "total_time": "22.89ms" + "total_time": "23.30ms" }, "parser-calls-10000-100": { "comment": "multiple calls parser benchmark", @@ -3268,35 +3489,48 @@ "stats": { "air::runner::execute_air": { "common_prefix": "air", - "duration": "22.65ms", + "duration": "22.94ms", "nested": { "preparation_step::preparation::parse_data": "25.00µs", "preparation_step::preparation::prepare": { "common_prefix": "", - "duration": "21.00ms", + "duration": "21.20ms", "nested": { - "air::preparation_step::preparation::make_exec_ctx": "25.00µs", - "air_parser::parser::air_parser::parse": "20.84ms" + "air::preparation_step::preparation::make_exec_ctx": { + "common_prefix": "air::preparation_step::preparation", + "duration": "40.00µs", + "nested": { + "CallResultsRepr.deserialize": "10.00µs" + } + }, + "air_parser::parser::air_parser::parse": "21.00ms" } }, - "runner::execute": "39.00µs", + "runner::execute": "35.00µs", "runner::farewell": { "common_prefix": "air::farewell_step::outcome", - "duration": "187.00µs", + "duration": "251.00µs", "nested": { "from_success_result": { "common_prefix": "air::farewell_step::outcome", - "duration": "168.00µs", + "duration": "231.00µs", "nested": { - "populate_outcome_from_contexts": "130.00µs" + "populate_outcome_from_contexts": { + "common_prefix": "air::farewell_step::outcome", + "duration": "191.00µs", + "nested": { + "CallRequestsRepr.serialize": "16.00µs", + "InterpreterData::serialize": "35.00µs" + } + } } } } }, - "signing_step::sign_produced_cids": "107.00µs", + "signing_step::sign_produced_cids": "109.00µs", "verification_step::verify": { "common_prefix": "air_interpreter_data::cid_info", - "duration": "42.00µs", + "duration": "46.00µs", "nested": { "verify": "10.00µs" } @@ -3304,7 +3538,7 @@ } } }, - "total_time": "22.65ms" + "total_time": "22.94ms" }, "populate-map-multiple-keys": { "comment": "benchmarking a map insert operation", @@ -3315,49 +3549,62 @@ "stats": { "air::runner::execute_air": { "common_prefix": "air", - "duration": "3.45ms", + "duration": "3.61ms", "nested": { "preparation_step::preparation::parse_data": { - "common_prefix": "air_interpreter_data::interpreter_data::serde_json", - "duration": "162.00µs", + "common_prefix": "air_interpreter_data::interpreter_data::InterpreterData", + "duration": "158.00µs", "nested": { - "from_slice": "113.00µs" + "try_from_slice": "113.00µs" } }, "preparation_step::preparation::prepare": { "common_prefix": "", - "duration": "196.00µs", + "duration": "225.00µs", "nested": { - "air::preparation_step::preparation::make_exec_ctx": "19.00µs", - "air_parser::parser::air_parser::parse": "60.00µs" + "air::preparation_step::preparation::make_exec_ctx": { + "common_prefix": "air::preparation_step::preparation", + "duration": "39.00µs", + "nested": { + "CallResultsRepr.deserialize": "10.00µs" + } + }, + "air_parser::parser::air_parser::parse": "61.00µs" } }, - "runner::execute": "2.14ms", + "runner::execute": "2.18ms", "runner::farewell": { "common_prefix": "air::farewell_step::outcome", - "duration": "285.00µs", + "duration": "357.00µs", "nested": { "from_success_result": { "common_prefix": "air::farewell_step::outcome", - "duration": "266.00µs", + "duration": "336.00µs", "nested": { - "populate_outcome_from_contexts": "231.00µs" + "populate_outcome_from_contexts": { + "common_prefix": "air::farewell_step::outcome", + "duration": "297.00µs", + "nested": { + "CallRequestsRepr.serialize": "16.00µs", + "InterpreterData::serialize": "108.00µs" + } + } } } } }, - "signing_step::sign_produced_cids": "100.00µs", + "signing_step::sign_produced_cids": "103.00µs", "verification_step::verify": { "common_prefix": "air_interpreter_data::cid_info", - "duration": "392.00µs", + "duration": "409.00µs", "nested": { - "verify": "39.00µs" + "verify": "40.00µs" } } } } }, - "total_time": "3.45ms" + "total_time": "3.61ms" }, "populate-map-single-key": { "comment": "benchmarking a map insert operation", @@ -3368,55 +3615,68 @@ "stats": { "air::runner::execute_air": { "common_prefix": "air", - "duration": "2.73ms", + "duration": "2.87ms", "nested": { "preparation_step::preparation::parse_data": { - "common_prefix": "air_interpreter_data::interpreter_data::serde_json", - "duration": "215.00µs", + "common_prefix": "air_interpreter_data::interpreter_data::InterpreterData", + "duration": "216.00µs", "nested": { - "from_slice": "168.00µs" + "try_from_slice": "172.00µs" } }, "preparation_step::preparation::prepare": { "common_prefix": "", - "duration": "195.00µs", + "duration": "220.00µs", "nested": { - "air::preparation_step::preparation::make_exec_ctx": "20.00µs", - "air_parser::parser::air_parser::parse": "60.00µs" + "air::preparation_step::preparation::make_exec_ctx": { + "common_prefix": "air::preparation_step::preparation", + "duration": "40.00µs", + "nested": { + "CallResultsRepr.deserialize": "10.00µs" + } + }, + "air_parser::parser::air_parser::parse": "57.00µs" } }, - "runner::execute": "1.30ms", + "runner::execute": "1.33ms", "runner::farewell": { "common_prefix": "air::farewell_step::outcome", - "duration": "308.00µs", + "duration": "379.00µs", "nested": { "from_success_result": { "common_prefix": "air::farewell_step::outcome", - "duration": "289.00µs", + "duration": "359.00µs", "nested": { - "populate_outcome_from_contexts": "235.00µs" + "populate_outcome_from_contexts": { + "common_prefix": "air::farewell_step::outcome", + "duration": "302.00µs", + "nested": { + "CallRequestsRepr.serialize": "16.00µs", + "InterpreterData::serialize": "121.00µs" + } + } } } } }, - "signing_step::sign_produced_cids": "99.00µs", + "signing_step::sign_produced_cids": "102.00µs", "verification_step::verify": { "common_prefix": "air_interpreter_data::cid_info", - "duration": "425.00µs", + "duration": "442.00µs", "nested": { - "verify": "74.00µs" + "verify": "76.00µs" } } } } }, - "total_time": "2.73ms" + "total_time": "2.87ms" } }, - "datetime": "2023-12-12 10:20:35.572977+00:00", + "datetime": "2023-12-13 12:33:17.230462+00:00", "features": "check_signatures,gen_signatures", - "platform": "macOS-14.1.2-arm64-arm-64bit", - "version": "0.54.0" + "platform": "macOS-14.2-arm64-arm-64bit", + "version": "0.55.0" }, "e536f8eaae8c978493a773ba566ae3393e2e6240d6ea8e05b5ca1b8f77e9c441": { "benches": { @@ -3429,102 +3689,128 @@ "stats": { "air::runner::execute_air": { "common_prefix": "air", - "duration": "17.84ms", + "duration": "17.75ms", "nested": { "preparation_step::preparation::parse_data": { - "common_prefix": "air_interpreter_data::interpreter_data::serde_json", - "duration": "7.24ms", + "common_prefix": "air_interpreter_data::interpreter_data::InterpreterData", + "duration": "7.14ms", "nested": { - "from_slice": "7.19ms" + "try_from_slice": "7.09ms" } }, "preparation_step::preparation::prepare": { "common_prefix": "", - "duration": "222.00µs", + "duration": "240.00µs", "nested": { - "air::preparation_step::preparation::make_exec_ctx": "21.00µs", + "air::preparation_step::preparation::make_exec_ctx": { + "common_prefix": "air::preparation_step::preparation", + "duration": "44.00µs", + "nested": { + "CallResultsRepr.deserialize": "11.00µs" + } + }, "air_parser::parser::air_parser::parse": "19.00µs" } }, - "runner::execute": "10.00µs", + "runner::execute": "9.00µs", "runner::farewell": { "common_prefix": "air::farewell_step::outcome", - "duration": "4.70ms", + "duration": "4.82ms", "nested": { "from_success_result": { "common_prefix": "air::farewell_step::outcome", - "duration": "4.67ms", + "duration": "4.80ms", "nested": { - "populate_outcome_from_contexts": "4.61ms" + "populate_outcome_from_contexts": { + "common_prefix": "air::farewell_step::outcome", + "duration": "4.76ms", + "nested": { + "CallRequestsRepr.serialize": "15.00µs", + "InterpreterData::serialize": "3.62ms" + } + } } } } }, - "signing_step::sign_produced_cids": "158.00µs", + "signing_step::sign_produced_cids": "156.00µs", "verification_step::verify": { "common_prefix": "air_interpreter_data::cid_info", - "duration": "5.35ms", + "duration": "5.26ms", "nested": { - "verify": "4.81ms" + "verify": "4.72ms" } } } } }, - "total_time": "17.84ms" + "total_time": "17.75ms" }, "call-requests500": { "comment": "multiple call requests", "memory_sizes": [ - "58.562 MiB", - "58.562 MiB" + "55.500 MiB", + "55.500 MiB" ], "stats": { "air::runner::execute_air": { "common_prefix": "air", - "duration": "35.41ms", + "duration": "21.87ms", "nested": { "preparation_step::preparation::parse_data": { - "common_prefix": "air_interpreter_data::interpreter_data::serde_json", - "duration": "112.00µs", + "common_prefix": "air_interpreter_data::interpreter_data::InterpreterData", + "duration": "117.00µs", "nested": { - "from_slice": "76.00µs" + "try_from_slice": "80.00µs" } }, "preparation_step::preparation::prepare": { "common_prefix": "", - "duration": "270.00µs", + "duration": "272.00µs", "nested": { - "air::preparation_step::preparation::make_exec_ctx": "40.00µs", - "air_parser::parser::air_parser::parse": "48.00µs" + "air::preparation_step::preparation::make_exec_ctx": { + "common_prefix": "air::preparation_step::preparation", + "duration": "41.00µs", + "nested": { + "CallResultsRepr.deserialize": "14.00µs" + } + }, + "air_parser::parser::air_parser::parse": "49.00µs" } }, - "runner::execute": "25.35ms", + "runner::execute": "19.81ms", "runner::farewell": { "common_prefix": "air::farewell_step::outcome", - "duration": "9.31ms", + "duration": "1.30ms", "nested": { "from_success_result": { "common_prefix": "air::farewell_step::outcome", - "duration": "9.29ms", + "duration": "1.28ms", "nested": { - "populate_outcome_from_contexts": "9.14ms" + "populate_outcome_from_contexts": { + "common_prefix": "air::farewell_step::outcome", + "duration": "1.16ms", + "nested": { + "CallRequestsRepr.serialize": "621.00µs", + "InterpreterData::serialize": "332.00µs" + } + } } } } }, - "signing_step::sign_produced_cids": "165.00µs", + "signing_step::sign_produced_cids": "160.00µs", "verification_step::verify": { "common_prefix": "air_interpreter_data::cid_info", - "duration": "77.00µs", + "duration": "81.00µs", "nested": { - "verify": "10.00µs" + "verify": "12.00µs" } } } } }, - "total_time": "35.41ms" + "total_time": "21.87ms" }, "call-results500": { "comment": "multiple call results", @@ -3535,41 +3821,54 @@ "stats": { "air::runner::execute_air": { "common_prefix": "air", - "duration": "19.57ms", + "duration": "18.92ms", "nested": { "preparation_step::preparation::parse_data": { - "common_prefix": "air_interpreter_data::interpreter_data::serde_json", - "duration": "667.00µs", + "common_prefix": "air_interpreter_data::interpreter_data::InterpreterData", + "duration": "664.00µs", "nested": { - "from_slice": "627.00µs" + "try_from_slice": "624.00µs" } }, "preparation_step::preparation::prepare": { "common_prefix": "", - "duration": "931.00µs", + "duration": "394.00µs", "nested": { - "air::preparation_step::preparation::make_exec_ctx": "694.00µs", + "air::preparation_step::preparation::make_exec_ctx": { + "common_prefix": "air::preparation_step::preparation", + "duration": "162.00µs", + "nested": { + "CallResultsRepr.deserialize": "132.00µs" + } + }, "air_parser::parser::air_parser::parse": "50.00µs" } }, - "runner::execute": "15.12ms", + "runner::execute": "14.93ms", "runner::farewell": { "common_prefix": "air::farewell_step::outcome", - "duration": "2.20ms", + "duration": "2.27ms", "nested": { "from_success_result": { "common_prefix": "air::farewell_step::outcome", - "duration": "2.17ms", + "duration": "2.25ms", "nested": { - "populate_outcome_from_contexts": "1.75ms" + "populate_outcome_from_contexts": { + "common_prefix": "air::farewell_step::outcome", + "duration": "1.87ms", + "nested": { + "CallRequestsRepr.serialize": "15.00µs", + "InterpreterData::serialize": "1.30ms" + } + } } } } }, - "signing_step::sign_produced_cids": "432.00µs", + "signing_step::sign_produced_cids": "434.00µs", "verification_step::verify": { "common_prefix": "air_interpreter_data::cid_info", - "duration": "82.00µs", + "duration": "84.00µs", "nested": { "verify": "10.00µs" } @@ -3577,7 +3876,7 @@ } } }, - "total_time": "19.57ms" + "total_time": "18.92ms" }, "canon-map-key-by-lens": { "comment": "benchmarking a map insert operation", @@ -3588,49 +3887,62 @@ "stats": { "air::runner::execute_air": { "common_prefix": "air", - "duration": "14.97ms", + "duration": "14.93ms", "nested": { "preparation_step::preparation::parse_data": { - "common_prefix": "air_interpreter_data::interpreter_data::serde_json", - "duration": "4.08ms", + "common_prefix": "air_interpreter_data::interpreter_data::InterpreterData", + "duration": "4.07ms", "nested": { - "from_slice": "4.03ms" + "try_from_slice": "4.03ms" } }, "preparation_step::preparation::prepare": { "common_prefix": "", - "duration": "530.00µs", + "duration": "552.00µs", "nested": { - "air::preparation_step::preparation::make_exec_ctx": "289.00µs", - "air_parser::parser::air_parser::parse": "57.00µs" + "air::preparation_step::preparation::make_exec_ctx": { + "common_prefix": "air::preparation_step::preparation", + "duration": "318.00µs", + "nested": { + "CallResultsRepr.deserialize": "11.00µs" + } + }, + "air_parser::parser::air_parser::parse": "56.00µs" } }, - "runner::execute": "2.75ms", + "runner::execute": "2.76ms", "runner::farewell": { "common_prefix": "air::farewell_step::outcome", - "duration": "2.78ms", + "duration": "2.81ms", "nested": { "from_success_result": { "common_prefix": "air::farewell_step::outcome", - "duration": "2.76ms", + "duration": "2.79ms", "nested": { - "populate_outcome_from_contexts": "2.39ms" + "populate_outcome_from_contexts": { + "common_prefix": "air::farewell_step::outcome", + "duration": "2.44ms", + "nested": { + "CallRequestsRepr.serialize": "14.00µs", + "InterpreterData::serialize": "2.05ms" + } + } } } } }, - "signing_step::sign_produced_cids": "160.00µs", + "signing_step::sign_produced_cids": "157.00µs", "verification_step::verify": { "common_prefix": "air_interpreter_data::cid_info", - "duration": "4.52ms", + "duration": "4.43ms", "nested": { - "verify": "3.98ms" + "verify": "3.90ms" } } } } }, - "total_time": "14.97ms" + "total_time": "14.93ms" }, "canon-map-key-element-by-lens": { "comment": "benchmarking a map insert operation", @@ -3641,49 +3953,62 @@ "stats": { "air::runner::execute_air": { "common_prefix": "air", - "duration": "14.92ms", + "duration": "15.00ms", "nested": { "preparation_step::preparation::parse_data": { - "common_prefix": "air_interpreter_data::interpreter_data::serde_json", - "duration": "4.09ms", + "common_prefix": "air_interpreter_data::interpreter_data::InterpreterData", + "duration": "4.08ms", "nested": { - "from_slice": "4.04ms" + "try_from_slice": "4.03ms" } }, "preparation_step::preparation::prepare": { "common_prefix": "", - "duration": "526.00µs", + "duration": "557.00µs", "nested": { - "air::preparation_step::preparation::make_exec_ctx": "285.00µs", - "air_parser::parser::air_parser::parse": "58.00µs" + "air::preparation_step::preparation::make_exec_ctx": { + "common_prefix": "air::preparation_step::preparation", + "duration": "316.00µs", + "nested": { + "CallResultsRepr.deserialize": "11.00µs" + } + }, + "air_parser::parser::air_parser::parse": "57.00µs" } }, - "runner::execute": "2.73ms", + "runner::execute": "2.77ms", "runner::farewell": { "common_prefix": "air::farewell_step::outcome", - "duration": "2.78ms", + "duration": "2.83ms", "nested": { "from_success_result": { "common_prefix": "air::farewell_step::outcome", - "duration": "2.75ms", + "duration": "2.81ms", "nested": { - "populate_outcome_from_contexts": "2.40ms" + "populate_outcome_from_contexts": { + "common_prefix": "air::farewell_step::outcome", + "duration": "2.47ms", + "nested": { + "CallRequestsRepr.serialize": "15.00µs", + "InterpreterData::serialize": "2.08ms" + } + } } } } }, - "signing_step::sign_produced_cids": "161.00µs", + "signing_step::sign_produced_cids": "158.00µs", "verification_step::verify": { "common_prefix": "air_interpreter_data::cid_info", - "duration": "4.51ms", + "duration": "4.44ms", "nested": { - "verify": "3.97ms" + "verify": "3.91ms" } } } } }, - "total_time": "14.92ms" + "total_time": "15.00ms" }, "canon-map-multiple-keys": { "comment": "benchmarking a map insert operation", @@ -3694,41 +4019,54 @@ "stats": { "air::runner::execute_air": { "common_prefix": "air", - "duration": "12.43ms", + "duration": "12.45ms", "nested": { "preparation_step::preparation::parse_data": { - "common_prefix": "air_interpreter_data::interpreter_data::serde_json", - "duration": "355.00µs", + "common_prefix": "air_interpreter_data::interpreter_data::InterpreterData", + "duration": "350.00µs", "nested": { - "from_slice": "313.00µs" + "try_from_slice": "309.00µs" } }, "preparation_step::preparation::prepare": { "common_prefix": "", - "duration": "247.00µs", + "duration": "273.00µs", "nested": { - "air::preparation_step::preparation::make_exec_ctx": "18.00µs", - "air_parser::parser::air_parser::parse": "46.00µs" + "air::preparation_step::preparation::make_exec_ctx": { + "common_prefix": "air::preparation_step::preparation", + "duration": "43.00µs", + "nested": { + "CallResultsRepr.deserialize": "12.00µs" + } + }, + "air_parser::parser::air_parser::parse": "47.00µs" } }, - "runner::execute": "8.64ms", + "runner::execute": "8.62ms", "runner::farewell": { "common_prefix": "air::farewell_step::outcome", - "duration": "2.31ms", + "duration": "2.35ms", "nested": { "from_success_result": { "common_prefix": "air::farewell_step::outcome", - "duration": "2.28ms", + "duration": "2.33ms", "nested": { - "populate_outcome_from_contexts": "1.99ms" + "populate_outcome_from_contexts": { + "common_prefix": "air::farewell_step::outcome", + "duration": "2.04ms", + "nested": { + "CallRequestsRepr.serialize": "14.00µs", + "InterpreterData::serialize": "1.69ms" + } + } } } } }, - "signing_step::sign_produced_cids": "164.00µs", + "signing_step::sign_produced_cids": "160.00µs", "verification_step::verify": { "common_prefix": "air_interpreter_data::cid_info", - "duration": "566.00µs", + "duration": "557.00µs", "nested": { "verify": "28.00µs" } @@ -3736,7 +4074,7 @@ } } }, - "total_time": "12.43ms" + "total_time": "12.45ms" }, "canon-map-scalar-multiple-keys": { "comment": "benchmarking a map insert operation", @@ -3747,49 +4085,62 @@ "stats": { "air::runner::execute_air": { "common_prefix": "air", - "duration": "5.33ms", + "duration": "5.23ms", "nested": { "preparation_step::preparation::parse_data": { - "common_prefix": "air_interpreter_data::interpreter_data::serde_json", - "duration": "358.00µs", + "common_prefix": "air_interpreter_data::interpreter_data::InterpreterData", + "duration": "348.00µs", "nested": { - "from_slice": "316.00µs" + "try_from_slice": "309.00µs" } }, "preparation_step::preparation::prepare": { "common_prefix": "", - "duration": "244.00µs", + "duration": "264.00µs", "nested": { - "air::preparation_step::preparation::make_exec_ctx": "18.00µs", - "air_parser::parser::air_parser::parse": "45.00µs" + "air::preparation_step::preparation::make_exec_ctx": { + "common_prefix": "air::preparation_step::preparation", + "duration": "41.00µs", + "nested": { + "CallResultsRepr.deserialize": "10.00µs" + } + }, + "air_parser::parser::air_parser::parse": "46.00µs" } }, - "runner::execute": "3.40ms", + "runner::execute": "3.29ms", "runner::farewell": { "common_prefix": "air::farewell_step::outcome", - "duration": "460.00µs", + "duration": "485.00µs", "nested": { "from_success_result": { "common_prefix": "air::farewell_step::outcome", - "duration": "438.00µs", + "duration": "463.00µs", "nested": { - "populate_outcome_from_contexts": "394.00µs" + "populate_outcome_from_contexts": { + "common_prefix": "air::farewell_step::outcome", + "duration": "425.00µs", + "nested": { + "CallRequestsRepr.serialize": "14.00µs", + "InterpreterData::serialize": "131.00µs" + } + } } } } }, - "signing_step::sign_produced_cids": "161.00µs", + "signing_step::sign_produced_cids": "156.00µs", "verification_step::verify": { "common_prefix": "air_interpreter_data::cid_info", - "duration": "576.00µs", + "duration": "555.00µs", "nested": { - "verify": "27.00µs" + "verify": "28.00µs" } } } } }, - "total_time": "5.33ms" + "total_time": "5.23ms" }, "canon-map-scalar-single-key": { "comment": "benchmarking a map insert operation", @@ -3800,49 +4151,62 @@ "stats": { "air::runner::execute_air": { "common_prefix": "air", - "duration": "4.35ms", + "duration": "4.28ms", "nested": { "preparation_step::preparation::parse_data": { - "common_prefix": "air_interpreter_data::interpreter_data::serde_json", - "duration": "387.00µs", + "common_prefix": "air_interpreter_data::interpreter_data::InterpreterData", + "duration": "379.00µs", "nested": { - "from_slice": "342.00µs" + "try_from_slice": "341.00µs" } }, "preparation_step::preparation::prepare": { "common_prefix": "", - "duration": "244.00µs", + "duration": "259.00µs", "nested": { - "air::preparation_step::preparation::make_exec_ctx": "18.00µs", + "air::preparation_step::preparation::make_exec_ctx": { + "common_prefix": "air::preparation_step::preparation", + "duration": "40.00µs", + "nested": { + "CallResultsRepr.deserialize": "10.00µs" + } + }, "air_parser::parser::air_parser::parse": "43.00µs" } }, - "runner::execute": "2.35ms", + "runner::execute": "2.29ms", "runner::farewell": { "common_prefix": "air::farewell_step::outcome", - "duration": "462.00µs", + "duration": "486.00µs", "nested": { "from_success_result": { "common_prefix": "air::farewell_step::outcome", - "duration": "438.00µs", + "duration": "464.00µs", "nested": { - "populate_outcome_from_contexts": "380.00µs" + "populate_outcome_from_contexts": { + "common_prefix": "air::farewell_step::outcome", + "duration": "414.00µs", + "nested": { + "CallRequestsRepr.serialize": "13.00µs", + "InterpreterData::serialize": "140.00µs" + } + } } } } }, - "signing_step::sign_produced_cids": "165.00µs", + "signing_step::sign_produced_cids": "156.00µs", "verification_step::verify": { "common_prefix": "air_interpreter_data::cid_info", - "duration": "599.00µs", + "duration": "587.00µs", "nested": { - "verify": "62.00µs" + "verify": "60.00µs" } } } } }, - "total_time": "4.35ms" + "total_time": "4.28ms" }, "canon-map-single-key": { "comment": "benchmarking a map insert operation", @@ -3853,41 +4217,54 @@ "stats": { "air::runner::execute_air": { "common_prefix": "air", - "duration": "10.81ms", + "duration": "10.71ms", "nested": { "preparation_step::preparation::parse_data": { - "common_prefix": "air_interpreter_data::interpreter_data::serde_json", - "duration": "381.00µs", + "common_prefix": "air_interpreter_data::interpreter_data::InterpreterData", + "duration": "372.00µs", "nested": { - "from_slice": "340.00µs" + "try_from_slice": "335.00µs" } }, "preparation_step::preparation::prepare": { "common_prefix": "", - "duration": "239.00µs", + "duration": "258.00µs", "nested": { - "air::preparation_step::preparation::make_exec_ctx": "18.00µs", - "air_parser::parser::air_parser::parse": "43.00µs" + "air::preparation_step::preparation::make_exec_ctx": { + "common_prefix": "air::preparation_step::preparation", + "duration": "40.00µs", + "nested": { + "CallResultsRepr.deserialize": "10.00µs" + } + }, + "air_parser::parser::air_parser::parse": "42.00µs" } }, - "runner::execute": "6.62ms", + "runner::execute": "6.56ms", "runner::farewell": { "common_prefix": "air::farewell_step::outcome", - "duration": "2.68ms", + "duration": "2.64ms", "nested": { "from_success_result": { "common_prefix": "air::farewell_step::outcome", - "duration": "2.66ms", + "duration": "2.61ms", "nested": { - "populate_outcome_from_contexts": "2.40ms" + "populate_outcome_from_contexts": { + "common_prefix": "air::farewell_step::outcome", + "duration": "2.38ms", + "nested": { + "CallRequestsRepr.serialize": "13.00µs", + "InterpreterData::serialize": "2.06ms" + } + } } } } }, - "signing_step::sign_produced_cids": "160.00µs", + "signing_step::sign_produced_cids": "155.00µs", "verification_step::verify": { "common_prefix": "air_interpreter_data::cid_info", - "duration": "590.00µs", + "duration": "593.00µs", "nested": { "verify": "61.00µs" } @@ -3895,7 +4272,7 @@ } } }, - "total_time": "10.81ms" + "total_time": "10.71ms" }, "dashboard": { "comment": "big dashboard test", @@ -3906,49 +4283,62 @@ "stats": { "air::runner::execute_air": { "common_prefix": "air", - "duration": "8.65ms", + "duration": "8.33ms", "nested": { "preparation_step::preparation::parse_data": { - "common_prefix": "air_interpreter_data::interpreter_data::serde_json", - "duration": "1.32ms", + "common_prefix": "air_interpreter_data::interpreter_data::InterpreterData", + "duration": "1.31ms", "nested": { - "from_slice": "1.26ms" + "try_from_slice": "1.26ms" } }, "preparation_step::preparation::prepare": { "common_prefix": "", - "duration": "360.00µs", + "duration": "366.00µs", "nested": { - "air::preparation_step::preparation::make_exec_ctx": "41.00µs", - "air_parser::parser::air_parser::parse": "132.00µs" + "air::preparation_step::preparation::make_exec_ctx": { + "common_prefix": "air::preparation_step::preparation", + "duration": "63.00µs", + "nested": { + "CallResultsRepr.deserialize": "10.00µs" + } + }, + "air_parser::parser::air_parser::parse": "128.00µs" } }, - "runner::execute": "1.08ms", + "runner::execute": "1.07ms", "runner::farewell": { "common_prefix": "air::farewell_step::outcome", - "duration": "674.00µs", + "duration": "699.00µs", "nested": { "from_success_result": { "common_prefix": "air::farewell_step::outcome", - "duration": "650.00µs", + "duration": "678.00µs", "nested": { - "populate_outcome_from_contexts": "596.00µs" + "populate_outcome_from_contexts": { + "common_prefix": "air::farewell_step::outcome", + "duration": "634.00µs", + "nested": { + "CallRequestsRepr.serialize": "18.00µs", + "InterpreterData::serialize": "364.00µs" + } + } } } } }, - "signing_step::sign_produced_cids": "172.00µs", + "signing_step::sign_produced_cids": "158.00µs", "verification_step::verify": { "common_prefix": "air_interpreter_data::cid_info", - "duration": "4.89ms", + "duration": "4.58ms", "nested": { - "verify": "198.00µs" + "verify": "192.00µs" } } } } }, - "total_time": "8.65ms" + "total_time": "8.33ms" }, "long-data": { "comment": "Long data trace", @@ -3959,49 +4349,62 @@ "stats": { "air::runner::execute_air": { "common_prefix": "air", - "duration": "6.29ms", + "duration": "6.46ms", "nested": { "preparation_step::preparation::parse_data": { - "common_prefix": "air_interpreter_data::interpreter_data::serde_json", - "duration": "2.44ms", + "common_prefix": "air_interpreter_data::interpreter_data::InterpreterData", + "duration": "2.43ms", "nested": { - "from_slice": "2.40ms" + "try_from_slice": "2.39ms" } }, "preparation_step::preparation::prepare": { "common_prefix": "", - "duration": "239.00µs", + "duration": "260.00µs", "nested": { - "air::preparation_step::preparation::make_exec_ctx": "41.00µs", - "air_parser::parser::air_parser::parse": "18.00µs" + "air::preparation_step::preparation::make_exec_ctx": { + "common_prefix": "air::preparation_step::preparation", + "duration": "65.00µs", + "nested": { + "CallResultsRepr.deserialize": "11.00µs" + } + }, + "air_parser::parser::air_parser::parse": "19.00µs" } }, "runner::execute": "9.00µs", "runner::farewell": { "common_prefix": "air::farewell_step::outcome", - "duration": "1.09ms", + "duration": "1.17ms", "nested": { "from_success_result": { "common_prefix": "air::farewell_step::outcome", - "duration": "1.07ms", + "duration": "1.15ms", "nested": { - "populate_outcome_from_contexts": "1.03ms" + "populate_outcome_from_contexts": { + "common_prefix": "air::farewell_step::outcome", + "duration": "1.11ms", + "nested": { + "CallRequestsRepr.serialize": "14.00µs", + "InterpreterData::serialize": "547.00µs" + } + } } } } }, - "signing_step::sign_produced_cids": "160.00µs", + "signing_step::sign_produced_cids": "156.00µs", "verification_step::verify": { "common_prefix": "air_interpreter_data::cid_info", - "duration": "2.23ms", + "duration": "2.30ms", "nested": { - "verify": "838.00µs" + "verify": "827.00µs" } } } } }, - "total_time": "6.29ms" + "total_time": "6.46ms" }, "multiple-cids10": { "comment": "verifying multiple CIDs for single peer", @@ -4015,40 +4418,53 @@ "duration": "3.43ms", "nested": { "preparation_step::preparation::parse_data": { - "common_prefix": "air_interpreter_data::interpreter_data::serde_json", - "duration": "478.00µs", + "common_prefix": "air_interpreter_data::interpreter_data::InterpreterData", + "duration": "466.00µs", "nested": { - "from_slice": "423.00µs" + "try_from_slice": "416.00µs" } }, "preparation_step::preparation::prepare": { "common_prefix": "", - "duration": "260.00µs", + "duration": "270.00µs", "nested": { - "air::preparation_step::preparation::make_exec_ctx": "32.00µs", - "air_parser::parser::air_parser::parse": "45.00µs" + "air::preparation_step::preparation::make_exec_ctx": { + "common_prefix": "air::preparation_step::preparation", + "duration": "53.00µs", + "nested": { + "CallResultsRepr.deserialize": "10.00µs" + } + }, + "air_parser::parser::air_parser::parse": "44.00µs" } }, - "runner::execute": "572.00µs", + "runner::execute": "564.00µs", "runner::farewell": { "common_prefix": "air::farewell_step::outcome", - "duration": "464.00µs", + "duration": "504.00µs", "nested": { "from_success_result": { "common_prefix": "air::farewell_step::outcome", - "duration": "441.00µs", + "duration": "483.00µs", "nested": { - "populate_outcome_from_contexts": "383.00µs" + "populate_outcome_from_contexts": { + "common_prefix": "air::farewell_step::outcome", + "duration": "433.00µs", + "nested": { + "CallRequestsRepr.serialize": "14.00µs", + "InterpreterData::serialize": "200.00µs" + } + } } } } }, - "signing_step::sign_produced_cids": "162.00µs", + "signing_step::sign_produced_cids": "155.00µs", "verification_step::verify": { "common_prefix": "air_interpreter_data::cid_info", - "duration": "1.36ms", + "duration": "1.34ms", "nested": { - "verify": "233.00µs" + "verify": "228.00µs" } } } @@ -4065,49 +4481,62 @@ "stats": { "air::runner::execute_air": { "common_prefix": "air", - "duration": "13.67ms", + "duration": "13.62ms", "nested": { "preparation_step::preparation::parse_data": { - "common_prefix": "air_interpreter_data::interpreter_data::serde_json", - "duration": "1.77ms", + "common_prefix": "air_interpreter_data::interpreter_data::InterpreterData", + "duration": "1.76ms", "nested": { - "from_slice": "1.71ms" + "try_from_slice": "1.70ms" } }, "preparation_step::preparation::prepare": { "common_prefix": "", - "duration": "338.00µs", + "duration": "353.00µs", "nested": { - "air::preparation_step::preparation::make_exec_ctx": "104.00µs", - "air_parser::parser::air_parser::parse": "51.00µs" + "air::preparation_step::preparation::make_exec_ctx": { + "common_prefix": "air::preparation_step::preparation", + "duration": "124.00µs", + "nested": { + "CallResultsRepr.deserialize": "10.00µs" + } + }, + "air_parser::parser::air_parser::parse": "50.00µs" } }, - "runner::execute": "3.68ms", + "runner::execute": "3.67ms", "runner::farewell": { "common_prefix": "air::farewell_step::outcome", - "duration": "1.30ms", + "duration": "1.36ms", "nested": { "from_success_result": { "common_prefix": "air::farewell_step::outcome", - "duration": "1.28ms", + "duration": "1.33ms", "nested": { - "populate_outcome_from_contexts": "1.17ms" + "populate_outcome_from_contexts": { + "common_prefix": "air::farewell_step::outcome", + "duration": "1.23ms", + "nested": { + "CallRequestsRepr.serialize": "15.00µs", + "InterpreterData::serialize": "928.00µs" + } + } } } } }, - "signing_step::sign_produced_cids": "162.00µs", + "signing_step::sign_produced_cids": "157.00µs", "verification_step::verify": { "common_prefix": "air_interpreter_data::cid_info", - "duration": "6.26ms", + "duration": "6.20ms", "nested": { - "verify": "1.04ms" + "verify": "1.03ms" } } } } }, - "total_time": "13.67ms" + "total_time": "13.62ms" }, "multiple-sigs30": { "comment": "signing multiple CIDs", @@ -4118,49 +4547,62 @@ "stats": { "air::runner::execute_air": { "common_prefix": "air", - "duration": "24.71ms", + "duration": "24.67ms", "nested": { "preparation_step::preparation::parse_data": { - "common_prefix": "air_interpreter_data::interpreter_data::serde_json", - "duration": "5.05ms", + "common_prefix": "air_interpreter_data::interpreter_data::InterpreterData", + "duration": "4.96ms", "nested": { - "from_slice": "4.98ms" + "try_from_slice": "4.89ms" } }, "preparation_step::preparation::prepare": { "common_prefix": "", - "duration": "444.00µs", + "duration": "469.00µs", "nested": { - "air::preparation_step::preparation::make_exec_ctx": "208.00µs", - "air_parser::parser::air_parser::parse": "49.00µs" + "air::preparation_step::preparation::make_exec_ctx": { + "common_prefix": "air::preparation_step::preparation", + "duration": "240.00µs", + "nested": { + "CallResultsRepr.deserialize": "11.00µs" + } + }, + "air_parser::parser::air_parser::parse": "50.00µs" } }, - "runner::execute": "10.47ms", + "runner::execute": "10.37ms", "runner::farewell": { "common_prefix": "air::farewell_step::outcome", - "duration": "3.69ms", + "duration": "3.79ms", "nested": { "from_success_result": { "common_prefix": "air::farewell_step::outcome", - "duration": "3.66ms", + "duration": "3.77ms", "nested": { - "populate_outcome_from_contexts": "3.48ms" + "populate_outcome_from_contexts": { + "common_prefix": "air::farewell_step::outcome", + "duration": "3.60ms", + "nested": { + "CallRequestsRepr.serialize": "14.00µs", + "InterpreterData::serialize": "2.62ms" + } + } } } } }, - "signing_step::sign_produced_cids": "654.00µs", + "signing_step::sign_produced_cids": "665.00µs", "verification_step::verify": { "common_prefix": "air_interpreter_data::cid_info", "duration": "4.27ms", "nested": { - "verify": "1.80ms" + "verify": "1.76ms" } } } } }, - "total_time": "24.71ms" + "total_time": "24.67ms" }, "network-explore": { "comment": "5 peers of network are discovered", @@ -4171,49 +4613,62 @@ "stats": { "air::runner::execute_air": { "common_prefix": "air", - "duration": "4.40ms", + "duration": "4.44ms", "nested": { "preparation_step::preparation::parse_data": { - "common_prefix": "air_interpreter_data::interpreter_data::serde_json", - "duration": "587.00µs", + "common_prefix": "air_interpreter_data::interpreter_data::InterpreterData", + "duration": "588.00µs", "nested": { - "from_slice": "531.00µs" + "try_from_slice": "536.00µs" } }, "preparation_step::preparation::prepare": { "common_prefix": "", - "duration": "273.00µs", + "duration": "283.00µs", "nested": { - "air::preparation_step::preparation::make_exec_ctx": "23.00µs", - "air_parser::parser::air_parser::parse": "68.00µs" + "air::preparation_step::preparation::make_exec_ctx": { + "common_prefix": "air::preparation_step::preparation", + "duration": "44.00µs", + "nested": { + "CallResultsRepr.deserialize": "10.00µs" + } + }, + "air_parser::parser::air_parser::parse": "67.00µs" } }, - "runner::execute": "159.00µs", + "runner::execute": "163.00µs", "runner::farewell": { "common_prefix": "air::farewell_step::outcome", - "duration": "369.00µs", + "duration": "416.00µs", "nested": { "from_success_result": { "common_prefix": "air::farewell_step::outcome", - "duration": "346.00µs", + "duration": "395.00µs", "nested": { - "populate_outcome_from_contexts": "301.00µs" + "populate_outcome_from_contexts": { + "common_prefix": "air::farewell_step::outcome", + "duration": "356.00µs", + "nested": { + "CallRequestsRepr.serialize": "14.00µs", + "InterpreterData::serialize": "134.00µs" + } + } } } } }, - "signing_step::sign_produced_cids": "162.00µs", + "signing_step::sign_produced_cids": "157.00µs", "verification_step::verify": { "common_prefix": "air_interpreter_data::cid_info", - "duration": "2.72ms", + "duration": "2.70ms", "nested": { - "verify": "64.00µs" + "verify": "62.00µs" } } } } }, - "total_time": "4.40ms" + "total_time": "4.44ms" }, "null": { "comment": "Empty data and null script", @@ -4224,35 +4679,48 @@ "stats": { "air::runner::execute_air": { "common_prefix": "air", - "duration": "834.00µs", + "duration": "950.00µs", "nested": { - "preparation_step::preparation::parse_data": "19.00µs", + "preparation_step::preparation::parse_data": "17.00µs", "preparation_step::preparation::prepare": { "common_prefix": "", - "duration": "224.00µs", + "duration": "261.00µs", "nested": { - "air::preparation_step::preparation::make_exec_ctx": "15.00µs", - "air_parser::parser::air_parser::parse": "19.00µs" + "air::preparation_step::preparation::make_exec_ctx": { + "common_prefix": "air::preparation_step::preparation", + "duration": "39.00µs", + "nested": { + "CallResultsRepr.deserialize": "10.00µs" + } + }, + "air_parser::parser::air_parser::parse": "18.00µs" } }, "runner::execute": "9.00µs", "runner::farewell": { "common_prefix": "air::farewell_step::outcome", - "duration": "256.00µs", + "duration": "326.00µs", "nested": { "from_success_result": { "common_prefix": "air::farewell_step::outcome", - "duration": "235.00µs", + "duration": "306.00µs", "nested": { - "populate_outcome_from_contexts": "195.00µs" + "populate_outcome_from_contexts": { + "common_prefix": "air::farewell_step::outcome", + "duration": "272.00µs", + "nested": { + "CallRequestsRepr.serialize": "13.00µs", + "InterpreterData::serialize": "42.00µs" + } + } } } } }, - "signing_step::sign_produced_cids": "161.00µs", + "signing_step::sign_produced_cids": "175.00µs", "verification_step::verify": { "common_prefix": "air_interpreter_data::cid_info", - "duration": "35.00µs", + "duration": "34.00µs", "nested": { "verify": "10.00µs" } @@ -4260,7 +4728,7 @@ } } }, - "total_time": "834.00µs" + "total_time": "950.00µs" }, "parser-10000-100": { "comment": "long air script with lot of variable assignments", @@ -4271,35 +4739,48 @@ "stats": { "air::runner::execute_air": { "common_prefix": "air", - "duration": "28.73ms", + "duration": "28.86ms", "nested": { - "preparation_step::preparation::parse_data": "20.00µs", + "preparation_step::preparation::parse_data": "16.00µs", "preparation_step::preparation::prepare": { "common_prefix": "", - "duration": "27.47ms", + "duration": "27.56ms", "nested": { - "air::preparation_step::preparation::make_exec_ctx": "17.00µs", - "air_parser::parser::air_parser::parse": "27.23ms" + "air::preparation_step::preparation::make_exec_ctx": { + "common_prefix": "air::preparation_step::preparation", + "duration": "41.00µs", + "nested": { + "CallResultsRepr.deserialize": "11.00µs" + } + }, + "air_parser::parser::air_parser::parse": "27.34ms" } }, "runner::execute": "27.00µs", "runner::farewell": { "common_prefix": "air::farewell_step::outcome", - "duration": "263.00µs", + "duration": "312.00µs", "nested": { "from_success_result": { "common_prefix": "air::farewell_step::outcome", - "duration": "240.00µs", + "duration": "290.00µs", "nested": { - "populate_outcome_from_contexts": "201.00µs" + "populate_outcome_from_contexts": { + "common_prefix": "air::farewell_step::outcome", + "duration": "256.00µs", + "nested": { + "CallRequestsRepr.serialize": "13.00µs", + "InterpreterData::serialize": "44.00µs" + } + } } } } }, - "signing_step::sign_produced_cids": "162.00µs", + "signing_step::sign_produced_cids": "158.00µs", "verification_step::verify": { "common_prefix": "air_interpreter_data::cid_info", - "duration": "36.00µs", + "duration": "35.00µs", "nested": { "verify": "10.00µs" } @@ -4307,7 +4788,7 @@ } } }, - "total_time": "28.73ms" + "total_time": "28.86ms" }, "parser-calls-10000-100": { "comment": "multiple calls parser benchmark", @@ -4318,35 +4799,48 @@ "stats": { "air::runner::execute_air": { "common_prefix": "air", - "duration": "25.94ms", + "duration": "25.49ms", "nested": { - "preparation_step::preparation::parse_data": "18.00µs", + "preparation_step::preparation::parse_data": "17.00µs", "preparation_step::preparation::prepare": { "common_prefix": "", - "duration": "24.66ms", + "duration": "24.18ms", "nested": { - "air::preparation_step::preparation::make_exec_ctx": "15.00µs", - "air_parser::parser::air_parser::parse": "24.46ms" + "air::preparation_step::preparation::make_exec_ctx": { + "common_prefix": "air::preparation_step::preparation", + "duration": "38.00µs", + "nested": { + "CallResultsRepr.deserialize": "10.00µs" + } + }, + "air_parser::parser::air_parser::parse": "23.94ms" } }, "runner::execute": "28.00µs", "runner::farewell": { "common_prefix": "air::farewell_step::outcome", - "duration": "255.00µs", + "duration": "311.00µs", "nested": { "from_success_result": { "common_prefix": "air::farewell_step::outcome", - "duration": "233.00µs", + "duration": "290.00µs", "nested": { - "populate_outcome_from_contexts": "195.00µs" + "populate_outcome_from_contexts": { + "common_prefix": "air::farewell_step::outcome", + "duration": "256.00µs", + "nested": { + "CallRequestsRepr.serialize": "14.00µs", + "InterpreterData::serialize": "44.00µs" + } + } } } } }, - "signing_step::sign_produced_cids": "160.00µs", + "signing_step::sign_produced_cids": "158.00µs", "verification_step::verify": { "common_prefix": "air_interpreter_data::cid_info", - "duration": "36.00µs", + "duration": "35.00µs", "nested": { "verify": "10.00µs" } @@ -4354,7 +4848,7 @@ } } }, - "total_time": "25.94ms" + "total_time": "25.49ms" }, "populate-map-multiple-keys": { "comment": "benchmarking a map insert operation", @@ -4365,49 +4859,62 @@ "stats": { "air::runner::execute_air": { "common_prefix": "air", - "duration": "4.40ms", + "duration": "4.51ms", "nested": { "preparation_step::preparation::parse_data": { - "common_prefix": "air_interpreter_data::interpreter_data::serde_json", - "duration": "131.00µs", + "common_prefix": "air_interpreter_data::interpreter_data::InterpreterData", + "duration": "133.00µs", "nested": { - "from_slice": "91.00µs" + "try_from_slice": "95.00µs" } }, "preparation_step::preparation::prepare": { "common_prefix": "", - "duration": "243.00µs", + "duration": "273.00µs", "nested": { - "air::preparation_step::preparation::make_exec_ctx": "17.00µs", - "air_parser::parser::air_parser::parse": "48.00µs" + "air::preparation_step::preparation::make_exec_ctx": { + "common_prefix": "air::preparation_step::preparation", + "duration": "42.00µs", + "nested": { + "CallResultsRepr.deserialize": "11.00µs" + } + }, + "air_parser::parser::air_parser::parse": "49.00µs" } }, - "runner::execute": "2.80ms", + "runner::execute": "2.83ms", "runner::farewell": { "common_prefix": "air::farewell_step::outcome", - "duration": "383.00µs", + "duration": "425.00µs", "nested": { "from_success_result": { "common_prefix": "air::farewell_step::outcome", - "duration": "361.00µs", + "duration": "402.00µs", "nested": { - "populate_outcome_from_contexts": "321.00µs" + "populate_outcome_from_contexts": { + "common_prefix": "air::farewell_step::outcome", + "duration": "366.00µs", + "nested": { + "CallRequestsRepr.serialize": "14.00µs", + "InterpreterData::serialize": "129.00µs" + } + } } } } }, - "signing_step::sign_produced_cids": "158.00µs", + "signing_step::sign_produced_cids": "157.00µs", "verification_step::verify": { "common_prefix": "air_interpreter_data::cid_info", - "duration": "557.00µs", + "duration": "554.00µs", "nested": { - "verify": "27.00µs" + "verify": "30.00µs" } } } } }, - "total_time": "4.40ms" + "total_time": "4.51ms" }, "populate-map-single-key": { "comment": "benchmarking a map insert operation", @@ -4418,41 +4925,54 @@ "stats": { "air::runner::execute_air": { "common_prefix": "air", - "duration": "3.62ms", + "duration": "3.67ms", "nested": { "preparation_step::preparation::parse_data": { - "common_prefix": "air_interpreter_data::interpreter_data::serde_json", - "duration": "200.00µs", + "common_prefix": "air_interpreter_data::interpreter_data::InterpreterData", + "duration": "198.00µs", "nested": { - "from_slice": "159.00µs" + "try_from_slice": "161.00µs" } }, "preparation_step::preparation::prepare": { "common_prefix": "", - "duration": "244.00µs", + "duration": "261.00µs", "nested": { - "air::preparation_step::preparation::make_exec_ctx": "17.00µs", + "air::preparation_step::preparation::make_exec_ctx": { + "common_prefix": "air::preparation_step::preparation", + "duration": "40.00µs", + "nested": { + "CallResultsRepr.deserialize": "10.00µs" + } + }, "air_parser::parser::air_parser::parse": "45.00µs" } }, "runner::execute": "1.89ms", "runner::farewell": { "common_prefix": "air::farewell_step::outcome", - "duration": "403.00µs", + "duration": "442.00µs", "nested": { "from_success_result": { "common_prefix": "air::farewell_step::outcome", - "duration": "381.00µs", + "duration": "420.00µs", "nested": { - "populate_outcome_from_contexts": "325.00µs" + "populate_outcome_from_contexts": { + "common_prefix": "air::farewell_step::outcome", + "duration": "371.00µs", + "nested": { + "CallRequestsRepr.serialize": "14.00µs", + "InterpreterData::serialize": "140.00µs" + } + } } } } }, - "signing_step::sign_produced_cids": "160.00µs", + "signing_step::sign_produced_cids": "154.00µs", "verification_step::verify": { "common_prefix": "air_interpreter_data::cid_info", - "duration": "586.00µs", + "duration": "582.00µs", "nested": { "verify": "60.00µs" } @@ -4460,12 +4980,12 @@ } } }, - "total_time": "3.62ms" + "total_time": "3.67ms" } }, - "datetime": "2023-12-12 12:01:06.070549+00:00", + "datetime": "2023-12-13 13:12:19.425891+00:00", "features": "check_signatures,gen_signatures", "platform": "Linux-5.15.0-76-generic-x86_64-with-glibc2.29", - "version": "0.54.0" + "version": "0.55.0" } } diff --git a/benches/PERFORMANCE.txt b/benches/PERFORMANCE.txt index b091023c..e26cd82b 100644 --- a/benches/PERFORMANCE.txt +++ b/benches/PERFORMANCE.txt @@ -642,568 +642,688 @@ Machine c1f3ea5950db0a10b44da931c25774d64ab25084f47d504f72f311e694550ff1: execute: 29.00µs new: 38.00µs Machine d77ebe8481884bc3b2778c8083f1bf459e548e929edd87041beb14f6b868d35f: - Platform: macOS-14.1.2-arm64-arm-64bit - Timestamp: 2023-12-12 10:20:35.572977+00:00 - AquaVM version: 0.54.0 + Platform: macOS-14.2-arm64-arm-64bit + Timestamp: 2023-12-13 12:33:17.230462+00:00 + AquaVM version: 0.55.0 Benches: Features: check_signatures,gen_signatures - big-values-data (13.10ms; 59.000 MiB, 59.000 MiB): Loading a trace with huge values - air::runner::execute_air: 13.10ms - preparation_step::preparation::parse_data: 5.36ms - from_slice: 5.30ms - preparation_step::preparation::prepare: 170.00µs - air::preparation_step::preparation::make_exec_ctx: 22.00µs - air_parser::parser::air_parser::parse: 32.00µs + big-values-data (13.18ms; 59.000 MiB, 59.000 MiB): Loading a trace with huge values + air::runner::execute_air: 13.18ms + preparation_step::preparation::parse_data: 5.28ms + try_from_slice: 5.24ms + preparation_step::preparation::prepare: 190.00µs + air::preparation_step::preparation::make_exec_ctx: 40.00µs + CallResultsRepr.deserialize: 10.00µs + air_parser::parser::air_parser::parse: 28.00µs runner::execute: 8.00µs - runner::farewell: 3.29ms - from_success_result: 3.27ms - populate_outcome_from_contexts: 3.23ms + runner::farewell: 3.41ms + from_success_result: 3.39ms + populate_outcome_from_contexts: 3.35ms + CallRequestsRepr.serialize: 16.00µs + InterpreterData::serialize: 2.36ms signing_step::sign_produced_cids: 100.00µs - verification_step::verify: 3.99ms - verify: 3.63ms - call-requests500 (26.11ms; 58.562 MiB, 58.562 MiB): multiple call requests - air::runner::execute_air: 26.11ms - preparation_step::preparation::parse_data: 134.00µs - from_slice: 97.00µs - preparation_step::preparation::prepare: 238.00µs - air::preparation_step::preparation::make_exec_ctx: 48.00µs - air_parser::parser::air_parser::parse: 68.00µs - runner::execute: 20.23ms - runner::farewell: 5.16ms - from_success_result: 5.14ms - populate_outcome_from_contexts: 5.04ms - signing_step::sign_produced_cids: 107.00µs - verification_step::verify: 75.00µs + verification_step::verify: 4.00ms + verify: 3.64ms + call-requests500 (18.37ms; 55.500 MiB, 55.500 MiB): multiple call requests + air::runner::execute_air: 18.37ms + preparation_step::preparation::parse_data: 145.00µs + try_from_slice: 99.00µs + preparation_step::preparation::prepare: 243.00µs + air::preparation_step::preparation::make_exec_ctx: 44.00µs + CallResultsRepr.deserialize: 18.00µs + air_parser::parser::air_parser::parse: 71.00µs + runner::execute: 16.83ms + runner::farewell: 780.00µs + from_success_result: 759.00µs + populate_outcome_from_contexts: 652.00µs + CallRequestsRepr.serialize: 276.00µs + InterpreterData::serialize: 217.00µs + signing_step::sign_produced_cids: 105.00µs + verification_step::verify: 81.00µs + verify: 10.00µs + call-results500 (14.90ms; 54.438 MiB, 54.438 MiB): multiple call results + air::runner::execute_air: 14.90ms + preparation_step::preparation::parse_data: 611.00µs + try_from_slice: 568.00µs + preparation_step::preparation::prepare: 330.00µs + air::preparation_step::preparation::make_exec_ctx: 136.00µs + CallResultsRepr.deserialize: 107.00µs + air_parser::parser::air_parser::parse: 66.00µs + runner::execute: 11.51ms + runner::farewell: 1.88ms + from_success_result: 1.86ms + populate_outcome_from_contexts: 1.40ms + CallRequestsRepr.serialize: 16.00µs + InterpreterData::serialize: 949.00µs + signing_step::sign_produced_cids: 288.00µs + verification_step::verify: 96.00µs verify: 9.00µs - call-results500 (15.96ms; 54.438 MiB, 54.438 MiB): multiple call results - air::runner::execute_air: 15.96ms - preparation_step::preparation::parse_data: 624.00µs - from_slice: 581.00µs - preparation_step::preparation::prepare: 1.00ms - air::preparation_step::preparation::make_exec_ctx: 810.00µs - air_parser::parser::air_parser::parse: 67.00µs - runner::execute: 11.94ms - runner::farewell: 1.82ms - from_success_result: 1.79ms - populate_outcome_from_contexts: 1.35ms - signing_step::sign_produced_cids: 292.00µs - verification_step::verify: 92.00µs - verify: 9.00µs - canon-map-key-by-lens (10.80ms; 56.625 MiB, 56.625 MiB): benchmarking a map insert operation - air::runner::execute_air: 10.80ms - preparation_step::preparation::parse_data: 3.18ms - from_slice: 3.13ms - preparation_step::preparation::prepare: 378.00µs - air::preparation_step::preparation::make_exec_ctx: 189.00µs - air_parser::parser::air_parser::parse: 73.00µs - runner::execute: 1.94ms - runner::farewell: 1.87ms - from_success_result: 1.85ms - populate_outcome_from_contexts: 1.49ms - signing_step::sign_produced_cids: 99.00µs - verification_step::verify: 3.15ms - verify: 2.79ms + canon-map-key-by-lens (10.90ms; 56.625 MiB, 56.625 MiB): benchmarking a map insert operation + air::runner::execute_air: 10.90ms + preparation_step::preparation::parse_data: 3.17ms + try_from_slice: 3.12ms + preparation_step::preparation::prepare: 401.00µs + air::preparation_step::preparation::make_exec_ctx: 210.00µs + CallResultsRepr.deserialize: 11.00µs + air_parser::parser::air_parser::parse: 69.00µs + runner::execute: 1.93ms + runner::farewell: 1.94ms + from_success_result: 1.92ms + populate_outcome_from_contexts: 1.56ms + CallRequestsRepr.serialize: 15.00µs + InterpreterData::serialize: 1.26ms + signing_step::sign_produced_cids: 100.00µs + verification_step::verify: 3.16ms + verify: 2.80ms canon-map-key-element-by-lens (10.80ms; 56.625 MiB, 56.625 MiB): benchmarking a map insert operation air::runner::execute_air: 10.80ms - preparation_step::preparation::parse_data: 3.18ms - from_slice: 3.13ms - preparation_step::preparation::prepare: 387.00µs - air::preparation_step::preparation::make_exec_ctx: 194.00µs - air_parser::parser::air_parser::parse: 75.00µs - runner::execute: 1.93ms - runner::farewell: 1.86ms - from_success_result: 1.84ms - populate_outcome_from_contexts: 1.50ms - signing_step::sign_produced_cids: 99.00µs - verification_step::verify: 3.15ms - verify: 2.79ms - canon-map-multiple-keys (8.97ms; 54.500 MiB, 54.500 MiB): benchmarking a map insert operation - air::runner::execute_air: 8.97ms - preparation_step::preparation::parse_data: 410.00µs - from_slice: 363.00µs - preparation_step::preparation::prepare: 196.00µs - air::preparation_step::preparation::make_exec_ctx: 20.00µs - air_parser::parser::air_parser::parse: 59.00µs - runner::execute: 6.05ms - runner::farewell: 1.63ms - from_success_result: 1.60ms - populate_outcome_from_contexts: 1.32ms + preparation_step::preparation::parse_data: 3.15ms + try_from_slice: 3.10ms + preparation_step::preparation::prepare: 399.00µs + air::preparation_step::preparation::make_exec_ctx: 209.00µs + CallResultsRepr.deserialize: 10.00µs + air_parser::parser::air_parser::parse: 70.00µs + runner::execute: 1.92ms + runner::farewell: 1.91ms + from_success_result: 1.89ms + populate_outcome_from_contexts: 1.55ms + CallRequestsRepr.serialize: 16.00µs + InterpreterData::serialize: 1.25ms signing_step::sign_produced_cids: 100.00µs - verification_step::verify: 406.00µs - verify: 39.00µs - canon-map-scalar-multiple-keys (4.10ms; 53.125 MiB, 53.125 MiB): benchmarking a map insert operation - air::runner::execute_air: 4.10ms - preparation_step::preparation::parse_data: 420.00µs - from_slice: 369.00µs - preparation_step::preparation::prepare: 195.00µs - air::preparation_step::preparation::make_exec_ctx: 20.00µs - air_parser::parser::air_parser::parse: 59.00µs - runner::execute: 2.45ms - runner::farewell: 349.00µs - from_success_result: 329.00µs - populate_outcome_from_contexts: 292.00µs + verification_step::verify: 3.17ms + verify: 2.80ms + canon-map-multiple-keys (8.88ms; 54.500 MiB, 54.500 MiB): benchmarking a map insert operation + air::runner::execute_air: 8.88ms + preparation_step::preparation::parse_data: 416.00µs + try_from_slice: 372.00µs + preparation_step::preparation::prepare: 218.00µs + air::preparation_step::preparation::make_exec_ctx: 38.00µs + CallResultsRepr.deserialize: 10.00µs + air_parser::parser::air_parser::parse: 58.00µs + runner::execute: 5.87ms + runner::farewell: 1.69ms + from_success_result: 1.67ms + populate_outcome_from_contexts: 1.37ms + CallRequestsRepr.serialize: 14.00µs + InterpreterData::serialize: 1.08ms signing_step::sign_produced_cids: 99.00µs - verification_step::verify: 406.00µs + verification_step::verify: 413.00µs verify: 40.00µs - canon-map-scalar-single-key (3.26ms; 53.000 MiB, 53.000 MiB): benchmarking a map insert operation - air::runner::execute_air: 3.26ms - preparation_step::preparation::parse_data: 423.00µs - from_slice: 375.00µs - preparation_step::preparation::prepare: 192.00µs - air::preparation_step::preparation::make_exec_ctx: 19.00µs - air_parser::parser::air_parser::parse: 56.00µs - runner::execute: 1.57ms - runner::farewell: 359.00µs - from_success_result: 339.00µs - populate_outcome_from_contexts: 284.00µs - signing_step::sign_produced_cids: 99.00µs - verification_step::verify: 435.00µs - verify: 73.00µs - canon-map-single-key (7.48ms; 55.312 MiB, 55.312 MiB): benchmarking a map insert operation - air::runner::execute_air: 7.48ms - preparation_step::preparation::parse_data: 421.00µs - from_slice: 373.00µs - preparation_step::preparation::prepare: 192.00µs - air::preparation_step::preparation::make_exec_ctx: 20.00µs - air_parser::parser::air_parser::parse: 56.00µs - runner::execute: 4.44ms - runner::farewell: 1.72ms - from_success_result: 1.70ms - populate_outcome_from_contexts: 1.46ms - signing_step::sign_produced_cids: 99.00µs - verification_step::verify: 434.00µs - verify: 72.00µs - dashboard (5.69ms; 52.625 MiB, 52.625 MiB): big dashboard test - air::runner::execute_air: 5.69ms - preparation_step::preparation::parse_data: 1.01ms - from_slice: 955.00µs - preparation_step::preparation::prepare: 313.00µs - air::preparation_step::preparation::make_exec_ctx: 36.00µs - air_parser::parser::air_parser::parse: 160.00µs - runner::execute: 759.00µs - runner::farewell: 461.00µs - from_success_result: 441.00µs - populate_outcome_from_contexts: 398.00µs + canon-map-scalar-multiple-keys (4.17ms; 53.125 MiB, 53.125 MiB): benchmarking a map insert operation + air::runner::execute_air: 4.17ms + preparation_step::preparation::parse_data: 414.00µs + try_from_slice: 366.00µs + preparation_step::preparation::prepare: 214.00µs + air::preparation_step::preparation::make_exec_ctx: 38.00µs + CallResultsRepr.deserialize: 10.00µs + air_parser::parser::air_parser::parse: 58.00µs + runner::execute: 2.42ms + runner::farewell: 415.00µs + from_success_result: 393.00µs + populate_outcome_from_contexts: 354.00µs + CallRequestsRepr.serialize: 15.00µs + InterpreterData::serialize: 110.00µs signing_step::sign_produced_cids: 101.00µs - verification_step::verify: 2.87ms - verify: 157.00µs - long-data (5.01ms; 53.812 MiB, 53.812 MiB): Long data trace - air::runner::execute_air: 5.01ms - preparation_step::preparation::parse_data: 1.95ms - from_slice: 1.89ms - preparation_step::preparation::prepare: 182.00µs - air::preparation_step::preparation::make_exec_ctx: 34.00µs - air_parser::parser::air_parser::parse: 31.00µs - runner::execute: 8.00µs - runner::farewell: 895.00µs - from_success_result: 876.00µs - populate_outcome_from_contexts: 838.00µs + verification_step::verify: 416.00µs + verify: 42.00µs + canon-map-scalar-single-key (3.35ms; 53.000 MiB, 53.000 MiB): benchmarking a map insert operation + air::runner::execute_air: 3.35ms + preparation_step::preparation::parse_data: 410.00µs + try_from_slice: 368.00µs + preparation_step::preparation::prepare: 214.00µs + air::preparation_step::preparation::make_exec_ctx: 38.00µs + CallResultsRepr.deserialize: 10.00µs + air_parser::parser::air_parser::parse: 54.00µs + runner::execute: 1.57ms + runner::farewell: 417.00µs + from_success_result: 398.00µs + populate_outcome_from_contexts: 341.00µs + CallRequestsRepr.serialize: 14.00µs + InterpreterData::serialize: 121.00µs + signing_step::sign_produced_cids: 100.00µs + verification_step::verify: 448.00µs + verify: 76.00µs + canon-map-single-key (7.45ms; 55.312 MiB, 55.312 MiB): benchmarking a map insert operation + air::runner::execute_air: 7.45ms + preparation_step::preparation::parse_data: 421.00µs + try_from_slice: 376.00µs + preparation_step::preparation::prepare: 208.00µs + air::preparation_step::preparation::make_exec_ctx: 37.00µs + CallResultsRepr.deserialize: 10.00µs + air_parser::parser::air_parser::parse: 54.00µs + runner::execute: 4.32ms + runner::farewell: 1.78ms + from_success_result: 1.76ms + populate_outcome_from_contexts: 1.52ms + CallRequestsRepr.serialize: 14.00µs + InterpreterData::serialize: 1.25ms signing_step::sign_produced_cids: 98.00µs - verification_step::verify: 1.71ms + verification_step::verify: 444.00µs + verify: 74.00µs + dashboard (5.75ms; 52.625 MiB, 52.625 MiB): big dashboard test + air::runner::execute_air: 5.75ms + preparation_step::preparation::parse_data: 999.00µs + try_from_slice: 944.00µs + preparation_step::preparation::prepare: 335.00µs + air::preparation_step::preparation::make_exec_ctx: 54.00µs + CallResultsRepr.deserialize: 10.00µs + air_parser::parser::air_parser::parse: 161.00µs + runner::execute: 754.00µs + runner::farewell: 519.00µs + from_success_result: 499.00µs + populate_outcome_from_contexts: 454.00µs + CallRequestsRepr.serialize: 20.00µs + InterpreterData::serialize: 232.00µs + signing_step::sign_produced_cids: 101.00µs + verification_step::verify: 2.86ms + verify: 156.00µs + long-data (5.04ms; 53.812 MiB, 53.812 MiB): Long data trace + air::runner::execute_air: 5.04ms + preparation_step::preparation::parse_data: 1.89ms + try_from_slice: 1.84ms + preparation_step::preparation::prepare: 202.00µs + air::preparation_step::preparation::make_exec_ctx: 53.00µs + CallResultsRepr.deserialize: 10.00µs + air_parser::parser::air_parser::parse: 27.00µs + runner::execute: 8.00µs + runner::farewell: 963.00µs + from_success_result: 944.00µs + populate_outcome_from_contexts: 908.00µs + CallRequestsRepr.serialize: 16.00µs + InterpreterData::serialize: 414.00µs + signing_step::sign_produced_cids: 99.00µs + verification_step::verify: 1.72ms verify: 662.00µs - multiple-cids10 (2.53ms; 52.438 MiB, 52.438 MiB): verifying multiple CIDs for single peer - air::runner::execute_air: 2.53ms - preparation_step::preparation::parse_data: 425.00µs - from_slice: 371.00µs + multiple-cids10 (2.63ms; 52.438 MiB, 52.438 MiB): verifying multiple CIDs for single peer + air::runner::execute_air: 2.63ms + preparation_step::preparation::parse_data: 429.00µs + try_from_slice: 374.00µs + preparation_step::preparation::prepare: 223.00µs + air::preparation_step::preparation::make_exec_ctx: 47.00µs + CallResultsRepr.deserialize: 10.00µs + air_parser::parser::air_parser::parse: 56.00µs + runner::execute: 415.00µs + runner::farewell: 383.00µs + from_success_result: 363.00µs + populate_outcome_from_contexts: 311.00µs + CallRequestsRepr.serialize: 13.00µs + InterpreterData::serialize: 134.00µs + signing_step::sign_produced_cids: 101.00µs + verification_step::verify: 901.00µs + verify: 182.00µs + multiple-peers8 (9.56ms; 53.438 MiB, 53.438 MiB): verifying many CIDs for many peers + air::runner::execute_air: 9.56ms + preparation_step::preparation::parse_data: 1.39ms + try_from_slice: 1.33ms + preparation_step::preparation::prepare: 277.00µs + air::preparation_step::preparation::make_exec_ctx: 94.00µs + CallResultsRepr.deserialize: 10.00µs + air_parser::parser::air_parser::parse: 62.00µs + runner::execute: 2.65ms + runner::farewell: 978.00µs + from_success_result: 959.00µs + populate_outcome_from_contexts: 856.00µs + CallRequestsRepr.serialize: 13.00µs + InterpreterData::serialize: 582.00µs + signing_step::sign_produced_cids: 106.00µs + verification_step::verify: 3.98ms + verify: 743.00µs + multiple-sigs30 (17.48ms; 56.188 MiB, 56.188 MiB): signing multiple CIDs + air::runner::execute_air: 17.48ms + preparation_step::preparation::parse_data: 3.95ms + try_from_slice: 3.90ms + preparation_step::preparation::prepare: 350.00µs + air::preparation_step::preparation::make_exec_ctx: 172.00µs + CallResultsRepr.deserialize: 10.00µs + air_parser::parser::air_parser::parse: 59.00µs + runner::execute: 6.93ms + runner::farewell: 2.63ms + from_success_result: 2.61ms + populate_outcome_from_contexts: 2.43ms + CallRequestsRepr.serialize: 12.00µs + InterpreterData::serialize: 1.57ms + signing_step::sign_produced_cids: 444.00µs + verification_step::verify: 2.98ms + verify: 1.28ms + network-explore (3.15ms; 52.375 MiB, 52.375 MiB): 5 peers of network are discovered + air::runner::execute_air: 3.15ms + preparation_step::preparation::parse_data: 484.00µs + try_from_slice: 430.00µs + preparation_step::preparation::prepare: 236.00µs + air::preparation_step::preparation::make_exec_ctx: 41.00µs + CallResultsRepr.deserialize: 10.00µs + air_parser::parser::air_parser::parse: 77.00µs + runner::execute: 138.00µs + runner::farewell: 315.00µs + from_success_result: 294.00µs + populate_outcome_from_contexts: 253.00µs + CallRequestsRepr.serialize: 13.00µs + InterpreterData::serialize: 92.00µs + signing_step::sign_produced_cids: 101.00µs + verification_step::verify: 1.69ms + verify: 64.00µs + null (829.00µs; 52.375 MiB, 52.375 MiB): Empty data and null script + air::runner::execute_air: 829.00µs + preparation_step::preparation::parse_data: 24.00µs preparation_step::preparation::prepare: 206.00µs - air::preparation_step::preparation::make_exec_ctx: 30.00µs - air_parser::parser::air_parser::parse: 60.00µs - runner::execute: 418.00µs - runner::farewell: 320.00µs - from_success_result: 299.00µs - populate_outcome_from_contexts: 249.00µs - signing_step::sign_produced_cids: 99.00µs - verification_step::verify: 890.00µs - verify: 180.00µs - multiple-peers8 (9.43ms; 53.375 MiB, 53.375 MiB): verifying many CIDs for many peers - air::runner::execute_air: 9.43ms - preparation_step::preparation::parse_data: 1.38ms - from_slice: 1.33ms - preparation_step::preparation::prepare: 258.00µs - air::preparation_step::preparation::make_exec_ctx: 78.00µs - air_parser::parser::air_parser::parse: 64.00µs - runner::execute: 2.68ms - runner::farewell: 896.00µs - from_success_result: 875.00µs - populate_outcome_from_contexts: 774.00µs - signing_step::sign_produced_cids: 99.00µs - verification_step::verify: 3.93ms - verify: 733.00µs - multiple-sigs30 (17.47ms; 56.188 MiB, 56.188 MiB): signing multiple CIDs - air::runner::execute_air: 17.47ms - preparation_step::preparation::parse_data: 3.96ms - from_slice: 3.90ms - preparation_step::preparation::prepare: 330.00µs - air::preparation_step::preparation::make_exec_ctx: 151.00µs - air_parser::parser::air_parser::parse: 63.00µs - runner::execute: 7.04ms - runner::farewell: 2.55ms - from_success_result: 2.53ms - populate_outcome_from_contexts: 2.35ms - signing_step::sign_produced_cids: 443.00µs - verification_step::verify: 2.96ms - verify: 1.26ms - network-explore (3.07ms; 52.375 MiB, 52.375 MiB): 5 peers of network are discovered - air::runner::execute_air: 3.07ms - preparation_step::preparation::parse_data: 490.00µs - from_slice: 434.00µs - preparation_step::preparation::prepare: 219.00µs - air::preparation_step::preparation::make_exec_ctx: 25.00µs - air_parser::parser::air_parser::parse: 78.00µs - runner::execute: 144.00µs + air::preparation_step::preparation::make_exec_ctx: 40.00µs + CallResultsRepr.deserialize: 11.00µs + air_parser::parser::air_parser::parse: 35.00µs + runner::execute: 9.00µs + runner::farewell: 242.00µs + from_success_result: 223.00µs + populate_outcome_from_contexts: 186.00µs + CallRequestsRepr.serialize: 16.00µs + InterpreterData::serialize: 31.00µs + signing_step::sign_produced_cids: 109.00µs + verification_step::verify: 47.00µs + verify: 10.00µs + parser-10000-100 (23.30ms; 54.625 MiB, 54.625 MiB): long air script with lot of variable assignments + air::runner::execute_air: 23.30ms + preparation_step::preparation::parse_data: 25.00µs + preparation_step::preparation::prepare: 21.75ms + air::preparation_step::preparation::make_exec_ctx: 37.00µs + CallResultsRepr.deserialize: 11.00µs + air_parser::parser::air_parser::parse: 21.58ms + runner::execute: 36.00µs + runner::farewell: 247.00µs + from_success_result: 227.00µs + populate_outcome_from_contexts: 190.00µs + CallRequestsRepr.serialize: 16.00µs + InterpreterData::serialize: 35.00µs + signing_step::sign_produced_cids: 108.00µs + verification_step::verify: 49.00µs + verify: 10.00µs + parser-calls-10000-100 (22.94ms; 54.375 MiB, 54.375 MiB): multiple calls parser benchmark + air::runner::execute_air: 22.94ms + preparation_step::preparation::parse_data: 25.00µs + preparation_step::preparation::prepare: 21.20ms + air::preparation_step::preparation::make_exec_ctx: 40.00µs + CallResultsRepr.deserialize: 10.00µs + air_parser::parser::air_parser::parse: 21.00ms + runner::execute: 35.00µs runner::farewell: 251.00µs from_success_result: 231.00µs - populate_outcome_from_contexts: 193.00µs - signing_step::sign_produced_cids: 100.00µs - verification_step::verify: 1.69ms - verify: 65.00µs - null (737.00µs; 52.375 MiB, 52.375 MiB): Empty data and null script - air::runner::execute_air: 737.00µs - preparation_step::preparation::parse_data: 23.00µs - preparation_step::preparation::prepare: 190.00µs - air::preparation_step::preparation::make_exec_ctx: 23.00µs - air_parser::parser::air_parser::parse: 34.00µs - runner::execute: 8.00µs - runner::farewell: 184.00µs - from_success_result: 165.00µs - populate_outcome_from_contexts: 125.00µs - signing_step::sign_produced_cids: 106.00µs - verification_step::verify: 44.00µs + populate_outcome_from_contexts: 191.00µs + CallRequestsRepr.serialize: 16.00µs + InterpreterData::serialize: 35.00µs + signing_step::sign_produced_cids: 109.00µs + verification_step::verify: 46.00µs verify: 10.00µs - parser-10000-100 (22.89ms; 54.625 MiB, 54.625 MiB): long air script with lot of variable assignments - air::runner::execute_air: 22.89ms - preparation_step::preparation::parse_data: 25.00µs - preparation_step::preparation::prepare: 21.40ms - air::preparation_step::preparation::make_exec_ctx: 23.00µs - air_parser::parser::air_parser::parse: 21.25ms - runner::execute: 39.00µs - runner::farewell: 187.00µs - from_success_result: 168.00µs - populate_outcome_from_contexts: 131.00µs - signing_step::sign_produced_cids: 107.00µs - verification_step::verify: 45.00µs - verify: 11.00µs - parser-calls-10000-100 (22.65ms; 54.375 MiB, 54.375 MiB): multiple calls parser benchmark - air::runner::execute_air: 22.65ms - preparation_step::preparation::parse_data: 25.00µs - preparation_step::preparation::prepare: 21.00ms - air::preparation_step::preparation::make_exec_ctx: 25.00µs - air_parser::parser::air_parser::parse: 20.84ms - runner::execute: 39.00µs - runner::farewell: 187.00µs - from_success_result: 168.00µs - populate_outcome_from_contexts: 130.00µs - signing_step::sign_produced_cids: 107.00µs - verification_step::verify: 42.00µs - verify: 10.00µs - populate-map-multiple-keys (3.45ms; 53.000 MiB, 53.000 MiB): benchmarking a map insert operation - air::runner::execute_air: 3.45ms - preparation_step::preparation::parse_data: 162.00µs - from_slice: 113.00µs - preparation_step::preparation::prepare: 196.00µs - air::preparation_step::preparation::make_exec_ctx: 19.00µs - air_parser::parser::air_parser::parse: 60.00µs - runner::execute: 2.14ms - runner::farewell: 285.00µs - from_success_result: 266.00µs - populate_outcome_from_contexts: 231.00µs - signing_step::sign_produced_cids: 100.00µs - verification_step::verify: 392.00µs - verify: 39.00µs - populate-map-single-key (2.73ms; 52.938 MiB, 52.938 MiB): benchmarking a map insert operation - air::runner::execute_air: 2.73ms - preparation_step::preparation::parse_data: 215.00µs - from_slice: 168.00µs - preparation_step::preparation::prepare: 195.00µs - air::preparation_step::preparation::make_exec_ctx: 20.00µs - air_parser::parser::air_parser::parse: 60.00µs - runner::execute: 1.30ms - runner::farewell: 308.00µs - from_success_result: 289.00µs - populate_outcome_from_contexts: 235.00µs - signing_step::sign_produced_cids: 99.00µs - verification_step::verify: 425.00µs - verify: 74.00µs + populate-map-multiple-keys (3.61ms; 53.000 MiB, 53.000 MiB): benchmarking a map insert operation + air::runner::execute_air: 3.61ms + preparation_step::preparation::parse_data: 158.00µs + try_from_slice: 113.00µs + preparation_step::preparation::prepare: 225.00µs + air::preparation_step::preparation::make_exec_ctx: 39.00µs + CallResultsRepr.deserialize: 10.00µs + air_parser::parser::air_parser::parse: 61.00µs + runner::execute: 2.18ms + runner::farewell: 357.00µs + from_success_result: 336.00µs + populate_outcome_from_contexts: 297.00µs + CallRequestsRepr.serialize: 16.00µs + InterpreterData::serialize: 108.00µs + signing_step::sign_produced_cids: 103.00µs + verification_step::verify: 409.00µs + verify: 40.00µs + populate-map-single-key (2.87ms; 52.938 MiB, 52.938 MiB): benchmarking a map insert operation + air::runner::execute_air: 2.87ms + preparation_step::preparation::parse_data: 216.00µs + try_from_slice: 172.00µs + preparation_step::preparation::prepare: 220.00µs + air::preparation_step::preparation::make_exec_ctx: 40.00µs + CallResultsRepr.deserialize: 10.00µs + air_parser::parser::air_parser::parse: 57.00µs + runner::execute: 1.33ms + runner::farewell: 379.00µs + from_success_result: 359.00µs + populate_outcome_from_contexts: 302.00µs + CallRequestsRepr.serialize: 16.00µs + InterpreterData::serialize: 121.00µs + signing_step::sign_produced_cids: 102.00µs + verification_step::verify: 442.00µs + verify: 76.00µs Machine e536f8eaae8c978493a773ba566ae3393e2e6240d6ea8e05b5ca1b8f77e9c441: Platform: Linux-5.15.0-76-generic-x86_64-with-glibc2.29 - Timestamp: 2023-12-12 12:01:06.070549+00:00 - AquaVM version: 0.54.0 + Timestamp: 2023-12-13 13:12:19.425891+00:00 + AquaVM version: 0.55.0 Benches: Features: check_signatures,gen_signatures - big-values-data (17.84ms; 59.000 MiB, 59.000 MiB): Loading a trace with huge values - air::runner::execute_air: 17.84ms - preparation_step::preparation::parse_data: 7.24ms - from_slice: 7.19ms - preparation_step::preparation::prepare: 222.00µs - air::preparation_step::preparation::make_exec_ctx: 21.00µs + big-values-data (17.75ms; 59.000 MiB, 59.000 MiB): Loading a trace with huge values + air::runner::execute_air: 17.75ms + preparation_step::preparation::parse_data: 7.14ms + try_from_slice: 7.09ms + preparation_step::preparation::prepare: 240.00µs + air::preparation_step::preparation::make_exec_ctx: 44.00µs + CallResultsRepr.deserialize: 11.00µs air_parser::parser::air_parser::parse: 19.00µs - runner::execute: 10.00µs - runner::farewell: 4.70ms - from_success_result: 4.67ms - populate_outcome_from_contexts: 4.61ms - signing_step::sign_produced_cids: 158.00µs - verification_step::verify: 5.35ms - verify: 4.81ms - call-requests500 (35.41ms; 58.562 MiB, 58.562 MiB): multiple call requests - air::runner::execute_air: 35.41ms - preparation_step::preparation::parse_data: 112.00µs - from_slice: 76.00µs - preparation_step::preparation::prepare: 270.00µs - air::preparation_step::preparation::make_exec_ctx: 40.00µs - air_parser::parser::air_parser::parse: 48.00µs - runner::execute: 25.35ms - runner::farewell: 9.31ms - from_success_result: 9.29ms - populate_outcome_from_contexts: 9.14ms - signing_step::sign_produced_cids: 165.00µs - verification_step::verify: 77.00µs - verify: 10.00µs - call-results500 (19.57ms; 54.438 MiB, 54.438 MiB): multiple call results - air::runner::execute_air: 19.57ms - preparation_step::preparation::parse_data: 667.00µs - from_slice: 627.00µs - preparation_step::preparation::prepare: 931.00µs - air::preparation_step::preparation::make_exec_ctx: 694.00µs - air_parser::parser::air_parser::parse: 50.00µs - runner::execute: 15.12ms - runner::farewell: 2.20ms - from_success_result: 2.17ms - populate_outcome_from_contexts: 1.75ms - signing_step::sign_produced_cids: 432.00µs - verification_step::verify: 82.00µs - verify: 10.00µs - canon-map-key-by-lens (14.97ms; 56.625 MiB, 56.625 MiB): benchmarking a map insert operation - air::runner::execute_air: 14.97ms - preparation_step::preparation::parse_data: 4.08ms - from_slice: 4.03ms - preparation_step::preparation::prepare: 530.00µs - air::preparation_step::preparation::make_exec_ctx: 289.00µs - air_parser::parser::air_parser::parse: 57.00µs - runner::execute: 2.75ms - runner::farewell: 2.78ms - from_success_result: 2.76ms - populate_outcome_from_contexts: 2.39ms - signing_step::sign_produced_cids: 160.00µs - verification_step::verify: 4.52ms - verify: 3.98ms - canon-map-key-element-by-lens (14.92ms; 56.625 MiB, 56.625 MiB): benchmarking a map insert operation - air::runner::execute_air: 14.92ms - preparation_step::preparation::parse_data: 4.09ms - from_slice: 4.04ms - preparation_step::preparation::prepare: 526.00µs - air::preparation_step::preparation::make_exec_ctx: 285.00µs - air_parser::parser::air_parser::parse: 58.00µs - runner::execute: 2.73ms - runner::farewell: 2.78ms - from_success_result: 2.75ms - populate_outcome_from_contexts: 2.40ms - signing_step::sign_produced_cids: 161.00µs - verification_step::verify: 4.51ms - verify: 3.97ms - canon-map-multiple-keys (12.43ms; 54.500 MiB, 54.500 MiB): benchmarking a map insert operation - air::runner::execute_air: 12.43ms - preparation_step::preparation::parse_data: 355.00µs - from_slice: 313.00µs - preparation_step::preparation::prepare: 247.00µs - air::preparation_step::preparation::make_exec_ctx: 18.00µs - air_parser::parser::air_parser::parse: 46.00µs - runner::execute: 8.64ms - runner::farewell: 2.31ms - from_success_result: 2.28ms - populate_outcome_from_contexts: 1.99ms - signing_step::sign_produced_cids: 164.00µs - verification_step::verify: 566.00µs - verify: 28.00µs - canon-map-scalar-multiple-keys (5.33ms; 53.125 MiB, 53.125 MiB): benchmarking a map insert operation - air::runner::execute_air: 5.33ms - preparation_step::preparation::parse_data: 358.00µs - from_slice: 316.00µs - preparation_step::preparation::prepare: 244.00µs - air::preparation_step::preparation::make_exec_ctx: 18.00µs - air_parser::parser::air_parser::parse: 45.00µs - runner::execute: 3.40ms - runner::farewell: 460.00µs - from_success_result: 438.00µs - populate_outcome_from_contexts: 394.00µs - signing_step::sign_produced_cids: 161.00µs - verification_step::verify: 576.00µs - verify: 27.00µs - canon-map-scalar-single-key (4.35ms; 53.000 MiB, 53.000 MiB): benchmarking a map insert operation - air::runner::execute_air: 4.35ms - preparation_step::preparation::parse_data: 387.00µs - from_slice: 342.00µs - preparation_step::preparation::prepare: 244.00µs - air::preparation_step::preparation::make_exec_ctx: 18.00µs - air_parser::parser::air_parser::parse: 43.00µs - runner::execute: 2.35ms - runner::farewell: 462.00µs - from_success_result: 438.00µs - populate_outcome_from_contexts: 380.00µs - signing_step::sign_produced_cids: 165.00µs - verification_step::verify: 599.00µs - verify: 62.00µs - canon-map-single-key (10.81ms; 55.312 MiB, 55.312 MiB): benchmarking a map insert operation - air::runner::execute_air: 10.81ms - preparation_step::preparation::parse_data: 381.00µs - from_slice: 340.00µs - preparation_step::preparation::prepare: 239.00µs - air::preparation_step::preparation::make_exec_ctx: 18.00µs - air_parser::parser::air_parser::parse: 43.00µs - runner::execute: 6.62ms - runner::farewell: 2.68ms - from_success_result: 2.66ms - populate_outcome_from_contexts: 2.40ms - signing_step::sign_produced_cids: 160.00µs - verification_step::verify: 590.00µs - verify: 61.00µs - dashboard (8.65ms; 52.625 MiB, 52.625 MiB): big dashboard test - air::runner::execute_air: 8.65ms - preparation_step::preparation::parse_data: 1.32ms - from_slice: 1.26ms - preparation_step::preparation::prepare: 360.00µs - air::preparation_step::preparation::make_exec_ctx: 41.00µs - air_parser::parser::air_parser::parse: 132.00µs - runner::execute: 1.08ms - runner::farewell: 674.00µs - from_success_result: 650.00µs - populate_outcome_from_contexts: 596.00µs - signing_step::sign_produced_cids: 172.00µs - verification_step::verify: 4.89ms - verify: 198.00µs - long-data (6.29ms; 53.812 MiB, 53.812 MiB): Long data trace - air::runner::execute_air: 6.29ms - preparation_step::preparation::parse_data: 2.44ms - from_slice: 2.40ms - preparation_step::preparation::prepare: 239.00µs - air::preparation_step::preparation::make_exec_ctx: 41.00µs - air_parser::parser::air_parser::parse: 18.00µs runner::execute: 9.00µs - runner::farewell: 1.09ms - from_success_result: 1.07ms - populate_outcome_from_contexts: 1.03ms - signing_step::sign_produced_cids: 160.00µs - verification_step::verify: 2.23ms - verify: 838.00µs - multiple-cids10 (3.43ms; 52.438 MiB, 52.438 MiB): verifying multiple CIDs for single peer - air::runner::execute_air: 3.43ms - preparation_step::preparation::parse_data: 478.00µs - from_slice: 423.00µs - preparation_step::preparation::prepare: 260.00µs - air::preparation_step::preparation::make_exec_ctx: 32.00µs - air_parser::parser::air_parser::parse: 45.00µs - runner::execute: 572.00µs - runner::farewell: 464.00µs - from_success_result: 441.00µs - populate_outcome_from_contexts: 383.00µs - signing_step::sign_produced_cids: 162.00µs - verification_step::verify: 1.36ms - verify: 233.00µs - multiple-peers8 (13.67ms; 53.375 MiB, 53.375 MiB): verifying many CIDs for many peers - air::runner::execute_air: 13.67ms - preparation_step::preparation::parse_data: 1.77ms - from_slice: 1.71ms - preparation_step::preparation::prepare: 338.00µs - air::preparation_step::preparation::make_exec_ctx: 104.00µs - air_parser::parser::air_parser::parse: 51.00µs - runner::execute: 3.68ms + runner::farewell: 4.82ms + from_success_result: 4.80ms + populate_outcome_from_contexts: 4.76ms + CallRequestsRepr.serialize: 15.00µs + InterpreterData::serialize: 3.62ms + signing_step::sign_produced_cids: 156.00µs + verification_step::verify: 5.26ms + verify: 4.72ms + call-requests500 (21.87ms; 55.500 MiB, 55.500 MiB): multiple call requests + air::runner::execute_air: 21.87ms + preparation_step::preparation::parse_data: 117.00µs + try_from_slice: 80.00µs + preparation_step::preparation::prepare: 272.00µs + air::preparation_step::preparation::make_exec_ctx: 41.00µs + CallResultsRepr.deserialize: 14.00µs + air_parser::parser::air_parser::parse: 49.00µs + runner::execute: 19.81ms runner::farewell: 1.30ms from_success_result: 1.28ms - populate_outcome_from_contexts: 1.17ms - signing_step::sign_produced_cids: 162.00µs - verification_step::verify: 6.26ms - verify: 1.04ms - multiple-sigs30 (24.71ms; 56.188 MiB, 56.188 MiB): signing multiple CIDs - air::runner::execute_air: 24.71ms - preparation_step::preparation::parse_data: 5.05ms - from_slice: 4.98ms - preparation_step::preparation::prepare: 444.00µs - air::preparation_step::preparation::make_exec_ctx: 208.00µs - air_parser::parser::air_parser::parse: 49.00µs - runner::execute: 10.47ms - runner::farewell: 3.69ms - from_success_result: 3.66ms - populate_outcome_from_contexts: 3.48ms - signing_step::sign_produced_cids: 654.00µs - verification_step::verify: 4.27ms - verify: 1.80ms - network-explore (4.40ms; 52.375 MiB, 52.375 MiB): 5 peers of network are discovered - air::runner::execute_air: 4.40ms - preparation_step::preparation::parse_data: 587.00µs - from_slice: 531.00µs + populate_outcome_from_contexts: 1.16ms + CallRequestsRepr.serialize: 621.00µs + InterpreterData::serialize: 332.00µs + signing_step::sign_produced_cids: 160.00µs + verification_step::verify: 81.00µs + verify: 12.00µs + call-results500 (18.92ms; 54.438 MiB, 54.438 MiB): multiple call results + air::runner::execute_air: 18.92ms + preparation_step::preparation::parse_data: 664.00µs + try_from_slice: 624.00µs + preparation_step::preparation::prepare: 394.00µs + air::preparation_step::preparation::make_exec_ctx: 162.00µs + CallResultsRepr.deserialize: 132.00µs + air_parser::parser::air_parser::parse: 50.00µs + runner::execute: 14.93ms + runner::farewell: 2.27ms + from_success_result: 2.25ms + populate_outcome_from_contexts: 1.87ms + CallRequestsRepr.serialize: 15.00µs + InterpreterData::serialize: 1.30ms + signing_step::sign_produced_cids: 434.00µs + verification_step::verify: 84.00µs + verify: 10.00µs + canon-map-key-by-lens (14.93ms; 56.625 MiB, 56.625 MiB): benchmarking a map insert operation + air::runner::execute_air: 14.93ms + preparation_step::preparation::parse_data: 4.07ms + try_from_slice: 4.03ms + preparation_step::preparation::prepare: 552.00µs + air::preparation_step::preparation::make_exec_ctx: 318.00µs + CallResultsRepr.deserialize: 11.00µs + air_parser::parser::air_parser::parse: 56.00µs + runner::execute: 2.76ms + runner::farewell: 2.81ms + from_success_result: 2.79ms + populate_outcome_from_contexts: 2.44ms + CallRequestsRepr.serialize: 14.00µs + InterpreterData::serialize: 2.05ms + signing_step::sign_produced_cids: 157.00µs + verification_step::verify: 4.43ms + verify: 3.90ms + canon-map-key-element-by-lens (15.00ms; 56.625 MiB, 56.625 MiB): benchmarking a map insert operation + air::runner::execute_air: 15.00ms + preparation_step::preparation::parse_data: 4.08ms + try_from_slice: 4.03ms + preparation_step::preparation::prepare: 557.00µs + air::preparation_step::preparation::make_exec_ctx: 316.00µs + CallResultsRepr.deserialize: 11.00µs + air_parser::parser::air_parser::parse: 57.00µs + runner::execute: 2.77ms + runner::farewell: 2.83ms + from_success_result: 2.81ms + populate_outcome_from_contexts: 2.47ms + CallRequestsRepr.serialize: 15.00µs + InterpreterData::serialize: 2.08ms + signing_step::sign_produced_cids: 158.00µs + verification_step::verify: 4.44ms + verify: 3.91ms + canon-map-multiple-keys (12.45ms; 54.500 MiB, 54.500 MiB): benchmarking a map insert operation + air::runner::execute_air: 12.45ms + preparation_step::preparation::parse_data: 350.00µs + try_from_slice: 309.00µs preparation_step::preparation::prepare: 273.00µs - air::preparation_step::preparation::make_exec_ctx: 23.00µs - air_parser::parser::air_parser::parse: 68.00µs - runner::execute: 159.00µs - runner::farewell: 369.00µs - from_success_result: 346.00µs - populate_outcome_from_contexts: 301.00µs - signing_step::sign_produced_cids: 162.00µs - verification_step::verify: 2.72ms - verify: 64.00µs - null (834.00µs; 52.375 MiB, 52.375 MiB): Empty data and null script - air::runner::execute_air: 834.00µs - preparation_step::preparation::parse_data: 19.00µs - preparation_step::preparation::prepare: 224.00µs - air::preparation_step::preparation::make_exec_ctx: 15.00µs + air::preparation_step::preparation::make_exec_ctx: 43.00µs + CallResultsRepr.deserialize: 12.00µs + air_parser::parser::air_parser::parse: 47.00µs + runner::execute: 8.62ms + runner::farewell: 2.35ms + from_success_result: 2.33ms + populate_outcome_from_contexts: 2.04ms + CallRequestsRepr.serialize: 14.00µs + InterpreterData::serialize: 1.69ms + signing_step::sign_produced_cids: 160.00µs + verification_step::verify: 557.00µs + verify: 28.00µs + canon-map-scalar-multiple-keys (5.23ms; 53.125 MiB, 53.125 MiB): benchmarking a map insert operation + air::runner::execute_air: 5.23ms + preparation_step::preparation::parse_data: 348.00µs + try_from_slice: 309.00µs + preparation_step::preparation::prepare: 264.00µs + air::preparation_step::preparation::make_exec_ctx: 41.00µs + CallResultsRepr.deserialize: 10.00µs + air_parser::parser::air_parser::parse: 46.00µs + runner::execute: 3.29ms + runner::farewell: 485.00µs + from_success_result: 463.00µs + populate_outcome_from_contexts: 425.00µs + CallRequestsRepr.serialize: 14.00µs + InterpreterData::serialize: 131.00µs + signing_step::sign_produced_cids: 156.00µs + verification_step::verify: 555.00µs + verify: 28.00µs + canon-map-scalar-single-key (4.28ms; 53.000 MiB, 53.000 MiB): benchmarking a map insert operation + air::runner::execute_air: 4.28ms + preparation_step::preparation::parse_data: 379.00µs + try_from_slice: 341.00µs + preparation_step::preparation::prepare: 259.00µs + air::preparation_step::preparation::make_exec_ctx: 40.00µs + CallResultsRepr.deserialize: 10.00µs + air_parser::parser::air_parser::parse: 43.00µs + runner::execute: 2.29ms + runner::farewell: 486.00µs + from_success_result: 464.00µs + populate_outcome_from_contexts: 414.00µs + CallRequestsRepr.serialize: 13.00µs + InterpreterData::serialize: 140.00µs + signing_step::sign_produced_cids: 156.00µs + verification_step::verify: 587.00µs + verify: 60.00µs + canon-map-single-key (10.71ms; 55.312 MiB, 55.312 MiB): benchmarking a map insert operation + air::runner::execute_air: 10.71ms + preparation_step::preparation::parse_data: 372.00µs + try_from_slice: 335.00µs + preparation_step::preparation::prepare: 258.00µs + air::preparation_step::preparation::make_exec_ctx: 40.00µs + CallResultsRepr.deserialize: 10.00µs + air_parser::parser::air_parser::parse: 42.00µs + runner::execute: 6.56ms + runner::farewell: 2.64ms + from_success_result: 2.61ms + populate_outcome_from_contexts: 2.38ms + CallRequestsRepr.serialize: 13.00µs + InterpreterData::serialize: 2.06ms + signing_step::sign_produced_cids: 155.00µs + verification_step::verify: 593.00µs + verify: 61.00µs + dashboard (8.33ms; 52.625 MiB, 52.625 MiB): big dashboard test + air::runner::execute_air: 8.33ms + preparation_step::preparation::parse_data: 1.31ms + try_from_slice: 1.26ms + preparation_step::preparation::prepare: 366.00µs + air::preparation_step::preparation::make_exec_ctx: 63.00µs + CallResultsRepr.deserialize: 10.00µs + air_parser::parser::air_parser::parse: 128.00µs + runner::execute: 1.07ms + runner::farewell: 699.00µs + from_success_result: 678.00µs + populate_outcome_from_contexts: 634.00µs + CallRequestsRepr.serialize: 18.00µs + InterpreterData::serialize: 364.00µs + signing_step::sign_produced_cids: 158.00µs + verification_step::verify: 4.58ms + verify: 192.00µs + long-data (6.46ms; 53.812 MiB, 53.812 MiB): Long data trace + air::runner::execute_air: 6.46ms + preparation_step::preparation::parse_data: 2.43ms + try_from_slice: 2.39ms + preparation_step::preparation::prepare: 260.00µs + air::preparation_step::preparation::make_exec_ctx: 65.00µs + CallResultsRepr.deserialize: 11.00µs air_parser::parser::air_parser::parse: 19.00µs runner::execute: 9.00µs - runner::farewell: 256.00µs - from_success_result: 235.00µs - populate_outcome_from_contexts: 195.00µs - signing_step::sign_produced_cids: 161.00µs + runner::farewell: 1.17ms + from_success_result: 1.15ms + populate_outcome_from_contexts: 1.11ms + CallRequestsRepr.serialize: 14.00µs + InterpreterData::serialize: 547.00µs + signing_step::sign_produced_cids: 156.00µs + verification_step::verify: 2.30ms + verify: 827.00µs + multiple-cids10 (3.43ms; 52.438 MiB, 52.438 MiB): verifying multiple CIDs for single peer + air::runner::execute_air: 3.43ms + preparation_step::preparation::parse_data: 466.00µs + try_from_slice: 416.00µs + preparation_step::preparation::prepare: 270.00µs + air::preparation_step::preparation::make_exec_ctx: 53.00µs + CallResultsRepr.deserialize: 10.00µs + air_parser::parser::air_parser::parse: 44.00µs + runner::execute: 564.00µs + runner::farewell: 504.00µs + from_success_result: 483.00µs + populate_outcome_from_contexts: 433.00µs + CallRequestsRepr.serialize: 14.00µs + InterpreterData::serialize: 200.00µs + signing_step::sign_produced_cids: 155.00µs + verification_step::verify: 1.34ms + verify: 228.00µs + multiple-peers8 (13.62ms; 53.375 MiB, 53.375 MiB): verifying many CIDs for many peers + air::runner::execute_air: 13.62ms + preparation_step::preparation::parse_data: 1.76ms + try_from_slice: 1.70ms + preparation_step::preparation::prepare: 353.00µs + air::preparation_step::preparation::make_exec_ctx: 124.00µs + CallResultsRepr.deserialize: 10.00µs + air_parser::parser::air_parser::parse: 50.00µs + runner::execute: 3.67ms + runner::farewell: 1.36ms + from_success_result: 1.33ms + populate_outcome_from_contexts: 1.23ms + CallRequestsRepr.serialize: 15.00µs + InterpreterData::serialize: 928.00µs + signing_step::sign_produced_cids: 157.00µs + verification_step::verify: 6.20ms + verify: 1.03ms + multiple-sigs30 (24.67ms; 56.188 MiB, 56.188 MiB): signing multiple CIDs + air::runner::execute_air: 24.67ms + preparation_step::preparation::parse_data: 4.96ms + try_from_slice: 4.89ms + preparation_step::preparation::prepare: 469.00µs + air::preparation_step::preparation::make_exec_ctx: 240.00µs + CallResultsRepr.deserialize: 11.00µs + air_parser::parser::air_parser::parse: 50.00µs + runner::execute: 10.37ms + runner::farewell: 3.79ms + from_success_result: 3.77ms + populate_outcome_from_contexts: 3.60ms + CallRequestsRepr.serialize: 14.00µs + InterpreterData::serialize: 2.62ms + signing_step::sign_produced_cids: 665.00µs + verification_step::verify: 4.27ms + verify: 1.76ms + network-explore (4.44ms; 52.375 MiB, 52.375 MiB): 5 peers of network are discovered + air::runner::execute_air: 4.44ms + preparation_step::preparation::parse_data: 588.00µs + try_from_slice: 536.00µs + preparation_step::preparation::prepare: 283.00µs + air::preparation_step::preparation::make_exec_ctx: 44.00µs + CallResultsRepr.deserialize: 10.00µs + air_parser::parser::air_parser::parse: 67.00µs + runner::execute: 163.00µs + runner::farewell: 416.00µs + from_success_result: 395.00µs + populate_outcome_from_contexts: 356.00µs + CallRequestsRepr.serialize: 14.00µs + InterpreterData::serialize: 134.00µs + signing_step::sign_produced_cids: 157.00µs + verification_step::verify: 2.70ms + verify: 62.00µs + null (950.00µs; 52.375 MiB, 52.375 MiB): Empty data and null script + air::runner::execute_air: 950.00µs + preparation_step::preparation::parse_data: 17.00µs + preparation_step::preparation::prepare: 261.00µs + air::preparation_step::preparation::make_exec_ctx: 39.00µs + CallResultsRepr.deserialize: 10.00µs + air_parser::parser::air_parser::parse: 18.00µs + runner::execute: 9.00µs + runner::farewell: 326.00µs + from_success_result: 306.00µs + populate_outcome_from_contexts: 272.00µs + CallRequestsRepr.serialize: 13.00µs + InterpreterData::serialize: 42.00µs + signing_step::sign_produced_cids: 175.00µs + verification_step::verify: 34.00µs + verify: 10.00µs + parser-10000-100 (28.86ms; 54.625 MiB, 54.625 MiB): long air script with lot of variable assignments + air::runner::execute_air: 28.86ms + preparation_step::preparation::parse_data: 16.00µs + preparation_step::preparation::prepare: 27.56ms + air::preparation_step::preparation::make_exec_ctx: 41.00µs + CallResultsRepr.deserialize: 11.00µs + air_parser::parser::air_parser::parse: 27.34ms + runner::execute: 27.00µs + runner::farewell: 312.00µs + from_success_result: 290.00µs + populate_outcome_from_contexts: 256.00µs + CallRequestsRepr.serialize: 13.00µs + InterpreterData::serialize: 44.00µs + signing_step::sign_produced_cids: 158.00µs verification_step::verify: 35.00µs verify: 10.00µs - parser-10000-100 (28.73ms; 54.625 MiB, 54.625 MiB): long air script with lot of variable assignments - air::runner::execute_air: 28.73ms - preparation_step::preparation::parse_data: 20.00µs - preparation_step::preparation::prepare: 27.47ms - air::preparation_step::preparation::make_exec_ctx: 17.00µs - air_parser::parser::air_parser::parse: 27.23ms - runner::execute: 27.00µs - runner::farewell: 263.00µs - from_success_result: 240.00µs - populate_outcome_from_contexts: 201.00µs - signing_step::sign_produced_cids: 162.00µs - verification_step::verify: 36.00µs - verify: 10.00µs - parser-calls-10000-100 (25.94ms; 54.375 MiB, 54.375 MiB): multiple calls parser benchmark - air::runner::execute_air: 25.94ms - preparation_step::preparation::parse_data: 18.00µs - preparation_step::preparation::prepare: 24.66ms - air::preparation_step::preparation::make_exec_ctx: 15.00µs - air_parser::parser::air_parser::parse: 24.46ms + parser-calls-10000-100 (25.49ms; 54.375 MiB, 54.375 MiB): multiple calls parser benchmark + air::runner::execute_air: 25.49ms + preparation_step::preparation::parse_data: 17.00µs + preparation_step::preparation::prepare: 24.18ms + air::preparation_step::preparation::make_exec_ctx: 38.00µs + CallResultsRepr.deserialize: 10.00µs + air_parser::parser::air_parser::parse: 23.94ms runner::execute: 28.00µs - runner::farewell: 255.00µs - from_success_result: 233.00µs - populate_outcome_from_contexts: 195.00µs - signing_step::sign_produced_cids: 160.00µs - verification_step::verify: 36.00µs - verify: 10.00µs - populate-map-multiple-keys (4.40ms; 53.000 MiB, 53.000 MiB): benchmarking a map insert operation - air::runner::execute_air: 4.40ms - preparation_step::preparation::parse_data: 131.00µs - from_slice: 91.00µs - preparation_step::preparation::prepare: 243.00µs - air::preparation_step::preparation::make_exec_ctx: 17.00µs - air_parser::parser::air_parser::parse: 48.00µs - runner::execute: 2.80ms - runner::farewell: 383.00µs - from_success_result: 361.00µs - populate_outcome_from_contexts: 321.00µs + runner::farewell: 311.00µs + from_success_result: 290.00µs + populate_outcome_from_contexts: 256.00µs + CallRequestsRepr.serialize: 14.00µs + InterpreterData::serialize: 44.00µs signing_step::sign_produced_cids: 158.00µs - verification_step::verify: 557.00µs - verify: 27.00µs - populate-map-single-key (3.62ms; 52.938 MiB, 52.938 MiB): benchmarking a map insert operation - air::runner::execute_air: 3.62ms - preparation_step::preparation::parse_data: 200.00µs - from_slice: 159.00µs - preparation_step::preparation::prepare: 244.00µs - air::preparation_step::preparation::make_exec_ctx: 17.00µs + verification_step::verify: 35.00µs + verify: 10.00µs + populate-map-multiple-keys (4.51ms; 53.000 MiB, 53.000 MiB): benchmarking a map insert operation + air::runner::execute_air: 4.51ms + preparation_step::preparation::parse_data: 133.00µs + try_from_slice: 95.00µs + preparation_step::preparation::prepare: 273.00µs + air::preparation_step::preparation::make_exec_ctx: 42.00µs + CallResultsRepr.deserialize: 11.00µs + air_parser::parser::air_parser::parse: 49.00µs + runner::execute: 2.83ms + runner::farewell: 425.00µs + from_success_result: 402.00µs + populate_outcome_from_contexts: 366.00µs + CallRequestsRepr.serialize: 14.00µs + InterpreterData::serialize: 129.00µs + signing_step::sign_produced_cids: 157.00µs + verification_step::verify: 554.00µs + verify: 30.00µs + populate-map-single-key (3.67ms; 52.938 MiB, 52.938 MiB): benchmarking a map insert operation + air::runner::execute_air: 3.67ms + preparation_step::preparation::parse_data: 198.00µs + try_from_slice: 161.00µs + preparation_step::preparation::prepare: 261.00µs + air::preparation_step::preparation::make_exec_ctx: 40.00µs + CallResultsRepr.deserialize: 10.00µs air_parser::parser::air_parser::parse: 45.00µs runner::execute: 1.89ms - runner::farewell: 403.00µs - from_success_result: 381.00µs - populate_outcome_from_contexts: 325.00µs - signing_step::sign_produced_cids: 160.00µs - verification_step::verify: 586.00µs + runner::farewell: 442.00µs + from_success_result: 420.00µs + populate_outcome_from_contexts: 371.00µs + CallRequestsRepr.serialize: 14.00µs + InterpreterData::serialize: 140.00µs + signing_step::sign_produced_cids: 154.00µs + verification_step::verify: 582.00µs verify: 60.00µs diff --git a/crates/air-lib/interpreter-data/Cargo.toml b/crates/air-lib/interpreter-data/Cargo.toml index 436a09b8..3c0a98ae 100644 --- a/crates/air-lib/interpreter-data/Cargo.toml +++ b/crates/air-lib/interpreter-data/Cargo.toml @@ -19,6 +19,7 @@ air-utils = { version = "0.2.0", path = "../utils" } aquavm-air-parser = { version = "0.11.0", path = "../air-parser" } air-interpreter-cid = { version = "0.7.0", path = "../interpreter-cid" } air-interpreter-signatures = { version = "0.1.5", path = "../interpreter-signatures" } +air-interpreter-sede = { version = "0.1.0", path = "../interpreter-sede", features = ["json"] } polyplets = { version = "0.5.1", path = "../polyplets" } fluence-keypair = { version = "0.10.3", default-features = false } diff --git a/crates/air-lib/interpreter-data/src/interpreter_data.rs b/crates/air-lib/interpreter-data/src/interpreter_data.rs index 7f6c8b1a..d966b098 100644 --- a/crates/air-lib/interpreter-data/src/interpreter_data.rs +++ b/crates/air-lib/interpreter-data/src/interpreter_data.rs @@ -15,11 +15,17 @@ */ pub(crate) mod errors; +pub(crate) mod repr; pub mod verification; +pub use self::repr::InterpreterDataFormat; +pub use self::repr::InterpreterDataRepr; use crate::CidInfo; use crate::ExecutionTrace; +use air_interpreter_sede::FromSerialized; +use air_interpreter_sede::Representation; +use air_interpreter_sede::ToSerialized; use air_interpreter_signatures::SignatureStore; use air_utils::measure; @@ -97,17 +103,27 @@ impl InterpreterData { } /// Tries to de InterpreterData from slice according to the data version. - pub fn try_from_slice(slice: &[u8]) -> Result { + pub fn try_from_slice( + slice: &[u8], + ) -> Result::DeserializeError> { measure!( - serde_json::from_slice(slice), + InterpreterDataRepr.deserialize(slice), tracing::Level::INFO, - "serde_json::from_slice" + "InterpreterData::try_from_slice" ) } /// Tries to de only versions part of interpreter data. - pub fn try_get_versions(slice: &[u8]) -> Result { - serde_json::from_slice(slice) + pub fn try_get_versions( + slice: &[u8], + ) -> Result::DeserializeError> { + InterpreterDataRepr.deserialize(slice) + } + + pub fn serialize( + &self, + ) -> Result, ::SerializeError> { + InterpreterDataRepr.serialize(self) } } diff --git a/crates/air-lib/interpreter-data/src/interpreter_data/repr.rs b/crates/air-lib/interpreter-data/src/interpreter_data/repr.rs new file mode 100644 index 00000000..eb2ce8cd --- /dev/null +++ b/crates/air-lib/interpreter-data/src/interpreter_data/repr.rs @@ -0,0 +1,75 @@ +/* + * Copyright 2023 Fluence Labs Limited + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +use crate::InterpreterData; +use crate::Versions; + +use air_interpreter_sede::Format; +use air_interpreter_sede::FromSerialized; +use air_interpreter_sede::JsonFormat; +use air_interpreter_sede::Representation; +use air_interpreter_sede::ToSerialized; +use air_interpreter_sede::ToWriter; + +#[derive(Default, Debug)] +pub struct InterpreterDataRepr; + +pub type InterpreterDataFormat = JsonFormat; + +impl Representation for InterpreterDataRepr { + type SerializeError = >::SerializationError; + type DeserializeError = + >::DeserializationError; + type WriteError = >::WriteError; + type Format = InterpreterDataFormat; + type SerializedValue = Vec; // TODO a typed wrapper + + fn get_format(&self) -> InterpreterDataFormat { + InterpreterDataFormat::default() + } +} + +impl ToSerialized for InterpreterDataRepr { + #[inline] + fn serialize(&self, value: &InterpreterData) -> Result, Self::SerializeError> { + Self::get_format(self).to_vec(value) + } +} + +impl FromSerialized for InterpreterDataRepr { + #[inline] + fn deserialize(&self, repr: &[u8]) -> Result { + Self::get_format(self).from_slice(repr) + } +} + +impl ToWriter for InterpreterDataRepr { + #[inline] + fn to_writer( + &self, + value: &InterpreterData, + writer: &mut W, + ) -> Result<(), Self::WriteError> { + Self::get_format(self).to_writer(value, writer) + } +} + +impl FromSerialized for InterpreterDataRepr { + #[inline] + fn deserialize(&self, repr: &[u8]) -> Result { + Self::get_format(self).from_slice(repr) + } +} diff --git a/crates/air-lib/interpreter-interface/Cargo.toml b/crates/air-lib/interpreter-interface/Cargo.toml index 2dff8aea..50b43d45 100644 --- a/crates/air-lib/interpreter-interface/Cargo.toml +++ b/crates/air-lib/interpreter-interface/Cargo.toml @@ -17,10 +17,13 @@ path = "src/lib.rs" [dependencies] marine-rs-sdk = {version = "0.10.2", optional = true } fluence-it-types = { version = "0.4.1", optional = true } +air-interpreter-sede = { version = "0.1.0", path = "../interpreter-sede", features = ["json"] } +marine-call-parameters = { version = "0.10.1", default-features = false } serde = "1.0.190" serde_json = "1.0.108" +serde_bytes = "0.11.12" [features] default = ["marine"] -marine = ["marine-rs-sdk", "fluence-it-types"] +marine = ["marine-rs-sdk", "fluence-it-types", "air-interpreter-sede/marine", "marine-call-parameters/marine-abi"] diff --git a/crates/air-lib/interpreter-interface/src/call_request_parameters.rs b/crates/air-lib/interpreter-interface/src/call_request_parameters.rs index 1aee2f38..5e620d9f 100644 --- a/crates/air-lib/interpreter-interface/src/call_request_parameters.rs +++ b/crates/air-lib/interpreter-interface/src/call_request_parameters.rs @@ -14,14 +14,70 @@ * limitations under the License. */ +use air_interpreter_sede::define_simple_representation; +use air_interpreter_sede::derive_serialized_type; +use air_interpreter_sede::Format; +use air_interpreter_sede::FromSerialized; +use air_interpreter_sede::JsonFormat; +use air_interpreter_sede::Representation; + +use marine_call_parameters::SecurityTetraplet; #[cfg(feature = "marine")] use marine_rs_sdk::marine; use serde::Deserialize; use serde::Serialize; + use std::collections::HashMap; +use std::rc::Rc; pub type CallRequests = HashMap; +derive_serialized_type!(SerializedCallArguments); +derive_serialized_type!(SerializedTetraplets); +derive_serialized_type!(SerializedCallRequests); + +pub type CallArgumentsFormat = JsonFormat; +pub type TetrapletsFormat = JsonFormat; +pub type CallRequestsFormat = JsonFormat; + +define_simple_representation! { + CallArgumentsRepr, + Vec, + CallArgumentsFormat, + SerializedCallArguments +} + +pub type CallArgumentsDeserializeError = ::DeserializeError; + +define_simple_representation! { + TetrapletsRepr, + // additional implementation for Vec> is defined below + // TODO allow this macro to define implementations for multiple types + Vec>>, + TetrapletsFormat, + SerializedTetraplets +} + +pub type TetrapletDeserializeError = ::DeserializeError; + +define_simple_representation! { + CallRequestsRepr, + CallRequests, + CallRequestsFormat, + SerializedCallRequests +} + +pub type CallRequestsDeserializeError = ::DeserializeError; + +impl FromSerialized>> for TetrapletsRepr { + fn deserialize( + &self, + repr: &[u8], + ) -> Result>, Self::DeserializeError> { + CallArgumentsRepr.get_format().from_slice(repr) + } +} + /// Contains arguments of a call instruction and all other necessary information /// required for calling a service. #[cfg_attr(feature = "marine", marine)] @@ -34,18 +90,18 @@ pub struct CallRequestParams { pub function_name: String, /// Serialized to JSON string Vec of arguments that should be passed to a service. - pub arguments: String, + pub arguments: SerializedCallArguments, /// Serialized to JSON string Vec> that should be passed to a service. - pub tetraplets: String, + pub tetraplets: SerializedTetraplets, } impl CallRequestParams { pub fn new( service_id: String, function_name: String, - arguments: String, - tetraplets: String, + arguments: SerializedCallArguments, + tetraplets: SerializedTetraplets, ) -> Self { Self { service_id, diff --git a/crates/air-lib/interpreter-interface/src/call_service_result.rs b/crates/air-lib/interpreter-interface/src/call_service_result.rs index 65bdbc4d..946a4e7a 100644 --- a/crates/air-lib/interpreter-interface/src/call_service_result.rs +++ b/crates/air-lib/interpreter-interface/src/call_service_result.rs @@ -14,6 +14,10 @@ * limitations under the License. */ +use air_interpreter_sede::define_simple_representation; +use air_interpreter_sede::derive_serialized_type; +use air_interpreter_sede::JsonFormat; +use air_interpreter_sede::Representation; use serde::Deserialize; use serde::Serialize; use serde_json::Value as JValue; @@ -22,6 +26,20 @@ use std::collections::HashMap; pub type CallResults = HashMap; pub const CALL_SERVICE_SUCCESS: i32 = 0; +pub type CallResultsFormat = JsonFormat; + +derive_serialized_type!(SerializedCallResults); + +define_simple_representation! { + CallResultsRepr, + CallResults, + CallResultsFormat, + SerializedCallResults +} + +pub type CallResultsDeserializeError = ::DeserializeError; +pub type CallResultsSerializeError = ::SerializeError; + /// Represents an executed host function result. #[derive(Debug, Default, Clone, Serialize, Deserialize)] pub struct CallServiceResult { diff --git a/crates/air-lib/interpreter-interface/src/interpreter_outcome.rs b/crates/air-lib/interpreter-interface/src/interpreter_outcome.rs index 82e6698e..a6b0aa5d 100644 --- a/crates/air-lib/interpreter-interface/src/interpreter_outcome.rs +++ b/crates/air-lib/interpreter-interface/src/interpreter_outcome.rs @@ -51,8 +51,9 @@ impl InterpreterOutcome { error_message: String, data: Vec, next_peer_pks: Vec, - call_requests: Vec, + call_requests: SerializedCallRequests, ) -> Self { + let call_requests = call_requests.into(); Self { ret_code, error_message, @@ -81,7 +82,13 @@ impl InterpreterOutcome { let error_message = try_as_string(record_values.pop().unwrap(), "error_message")?; let ret_code = try_as_i64(record_values.pop().unwrap(), "ret_code")?; - let outcome = Self::new(ret_code, error_message, data, next_peer_pks, call_requests); + let outcome = Self::new( + ret_code, + error_message, + data, + next_peer_pks, + call_requests.into(), + ); Ok(outcome) } @@ -90,6 +97,8 @@ impl InterpreterOutcome { #[cfg(feature = "marine")] use fluence_it_types::ne_vec::NEVec; +use crate::SerializedCallRequests; + #[cfg(feature = "marine")] fn try_as_record(ivalue: IValue) -> Result, String> { match ivalue { diff --git a/crates/air-lib/interpreter-sede/Cargo.toml b/crates/air-lib/interpreter-sede/Cargo.toml new file mode 100644 index 00000000..4665f358 --- /dev/null +++ b/crates/air-lib/interpreter-sede/Cargo.toml @@ -0,0 +1,28 @@ +[package] +name = "air-interpreter-sede" +description = "AIR interpreter serialization and deserialization util module" +version = "0.1.0" +authors = ["Fluence Labs"] +edition = "2021" +license = "Apache-2.0" +documentation = "https://docs.rs/air-interpreter-sede" +repository = "https://github.com/fluencelabs/aquavm/tree/master/crates/air-lib/interpreter-sede" +keywords = ["fluence", "air", "programming-language", "TODO"] +categories = ["wasm"] + +[dependencies] +rmp-serde = { version = "1.1.2", optional = true } +serde = { version = "1.0.190" } +serde_json = { version = "1.0.108" } +marine-rs-sdk = { version = "0.10.0", optional = true } +unsigned-varint = { version = "0.8.0", default-features = false, features = ["std"] } +thiserror = "1.0.50" +serde_bytes = "0.11.12" + +[features] +default = [] +serde_json = [] +rmp-serde = ["dep:rmp-serde"] +marine = ["dep:marine-rs-sdk"] +json = ["serde_json"] +msgpack = ["rmp-serde"] diff --git a/crates/air-lib/interpreter-sede/src/format.rs b/crates/air-lib/interpreter-sede/src/format.rs new file mode 100644 index 00000000..11c42495 --- /dev/null +++ b/crates/air-lib/interpreter-sede/src/format.rs @@ -0,0 +1,49 @@ +/* + * Copyright 2023 Fluence Labs Limited + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +use std::fmt::Debug; + +pub trait Format { + type SerializationError: Debug; + type DeserializationError: Debug; + type WriteError: Debug; + + fn to_vec(&self, val: &Value) -> Result, Self::SerializationError>; + + // todo owned_from_slice + #[allow(clippy::wrong_self_convention)] + fn from_slice(&self, slice: &[u8]) -> Result; + + fn to_writer( + &self, + value: &Value, + write: &mut W, + ) -> Result<(), Self::WriteError>; +} + +pub trait BorrowFormat<'data, Value: 'data>: Format { + fn borrow_from_slice(&self, slice: &'data [u8]) -> Result; +} + +pub trait ArchivedFormat: Format { + type Archived; + type ValidationError; + + fn archived_from_slice<'data>( + &self, + slice: &'data [u8], + ) -> Result<&'data Self::Archived, Self::ValidationError>; +} diff --git a/crates/air-lib/interpreter-sede/src/lib.rs b/crates/air-lib/interpreter-sede/src/lib.rs new file mode 100644 index 00000000..db5b38ea --- /dev/null +++ b/crates/air-lib/interpreter-sede/src/lib.rs @@ -0,0 +1,52 @@ +/* + * Copyright 2023 Fluence Labs Limited + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +pub mod multiformat; + +pub(crate) mod format; +pub(crate) mod representation; +pub(crate) mod serialized_type; + +pub use crate::format::Format; +pub use crate::representation::FromSerialiedBorrow; +pub use crate::representation::FromSerialized; +pub use crate::representation::Representation; +pub use crate::representation::ToSerialized; +pub use crate::representation::ToWriter; + +#[cfg(feature = "rmp-serde")] +pub(crate) mod rmp_serde; +#[cfg(feature = "rmp-serde")] +pub use crate::rmp_serde::RmpSerdeFormat; +#[cfg(feature = "rmp-serde")] +pub use crate::rmp_serde::RmpSerdeMultiformat; + +#[cfg(feature = "msgpack")] +pub use crate::rmp_serde::RmpSerdeFormat as MsgPackFormat; +#[cfg(feature = "msgpack")] +pub use crate::rmp_serde::RmpSerdeMultiformat as MsgPackMultiformat; + +#[cfg(feature = "serde_json")] +pub(crate) mod serde_json; +#[cfg(feature = "serde_json")] +pub use crate::serde_json::SerdeJsonFormat; +#[cfg(feature = "serde_json")] +pub use crate::serde_json::SerdeJsonMultiformat; + +#[cfg(feature = "json")] +pub use crate::serde_json::SerdeJsonFormat as JsonFormat; +#[cfg(feature = "json")] +pub use crate::serde_json::SerdeJsonMultiformat as JsonMultiformat; diff --git a/crates/air-lib/interpreter-sede/src/multiformat.rs b/crates/air-lib/interpreter-sede/src/multiformat.rs new file mode 100644 index 00000000..a7a5637a --- /dev/null +++ b/crates/air-lib/interpreter-sede/src/multiformat.rs @@ -0,0 +1,94 @@ +/* + * Copyright 2023 Fluence Labs Limited + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +use std::io::Write; + +use crate::Format; + +use unsigned_varint::decode as varint_decode; +use unsigned_varint::encode as varint_encode; + +pub type SerializationCodec = u32; + +const ENCODING_BUFFER_CAPACITY: usize = 1024; + +#[derive(thiserror::Error, Debug)] +pub enum DecodeError { + #[error(transparent)] + Format(FormatError), + #[error("unsupported multiformat codec: {0}")] + Codec(SerializationCodec), + #[error("failed to parse multiformat: {0}")] + VarInt(#[from] varint_decode::Error), +} + +#[derive(thiserror::Error, Debug)] +pub enum EncodeError { + #[error(transparent)] + Format(FormatError), + #[error("failed to write: {0}")] + Io(#[from] std::io::Error), +} + +pub fn parse_multiformat_bytes( + data: &[u8], +) -> Result<(SerializationCodec, &[u8]), varint_decode::Error> { + varint_decode::u32(data) +} + +pub fn encode_multiformat>( + data: &Value, + codec: SerializationCodec, + format: &Fmt, +) -> Result, EncodeError<>::WriteError>> { + let mut output = Vec::with_capacity(ENCODING_BUFFER_CAPACITY); + + write_multiformat(data, codec, format, &mut output)?; + + Ok(output) +} + +pub fn write_multiformat, W: Write>( + data: &Value, + codec: SerializationCodec, + format: &Fmt, + output: &mut W, +) -> Result<(), EncodeError<>::WriteError>> { + // looks weird, but that's how the API is + let mut buf = varint_encode::u32_buffer(); + let codec_bytes = varint_encode::u32(codec, &mut buf); + output.write_all(codec_bytes)?; + format + .to_writer(data, output) + .map_err(EncodeError::Format)?; + Ok(()) +} + +pub fn decode_multiformat>( + multiformat_data: &[u8], + expected_codec: SerializationCodec, + format: &Fmt, +) -> Result>::DeserializationError>> { + let (data_codec, data) = parse_multiformat_bytes(multiformat_data)?; + + if data_codec != expected_codec { + // TODO we may be more permissive, having kind of registry for the possible incoming formats, akin to + // CID algorithms; but it may be *really* tricky to organize it + return Err(DecodeError::Codec(data_codec)); + } + + format.from_slice(data).map_err(DecodeError::Format) +} diff --git a/crates/air-lib/interpreter-sede/src/representation.rs b/crates/air-lib/interpreter-sede/src/representation.rs new file mode 100644 index 00000000..876d5830 --- /dev/null +++ b/crates/air-lib/interpreter-sede/src/representation.rs @@ -0,0 +1,111 @@ +/* + * Copyright 2023 Fluence Labs Limited + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/// A formatter intended for particular type, a base type that defines generic behavior +/// used by particular implementations. +pub trait Representation { + type SerializeError; + type DeserializeError; + type WriteError; + type Format; + type SerializedValue: std::ops::Deref; + + fn get_format(&self) -> Self::Format; +} + +/// Serialization trait restricted to for particular type. +pub trait ToSerialized: Representation { + fn serialize(&self, value: &Value) -> Result; +} + +/// Owned deserialization trait restricted to for particular type. +pub trait FromSerialized: Representation { + fn deserialize(&self, repr: &[u8]) -> Result; +} + +/// Borrow deserialization trait restricted to for particular type. +pub trait FromSerialiedBorrow<'data, Value: 'data>: Representation { + fn deserialize_borrow(&self, repr: &'data [u8]) -> Result; +} + +/// Writing deserialization trait restricted to for particular type. +pub trait ToWriter: Representation { + fn to_writer( + &self, + value: &Value, + writer: &mut W, + ) -> Result<(), Self::WriteError>; +} + +#[macro_export] +macro_rules! define_simple_representation { + ($repr_type:ident, $value_type:ty, $format_type:ty, $serialized_value:ty) => { + #[derive(Default)] + pub struct $repr_type; + + impl $crate::Representation for $repr_type { + type SerializeError = <$format_type as $crate::Format<$value_type>>::SerializationError; + + type DeserializeError = + <$format_type as $crate::Format<$value_type>>::DeserializationError; + + type WriteError = <$format_type as $crate::Format<$value_type>>::WriteError; + + type Format = $format_type; + + type SerializedValue = $serialized_value; + + #[inline] + fn get_format(&self) -> Self::Format { + <$format_type>::default() + } + } + + impl $crate::ToSerialized<$value_type> for $repr_type { + #[inline] + fn serialize( + &self, + value: &$value_type, + ) -> Result<$serialized_value, Self::SerializeError> { + use $crate::Format; + use $crate::Representation; + Self::get_format(self).to_vec(value).map(Into::into) + } + } + + impl $crate::FromSerialized<$value_type> for $repr_type { + #[inline] + fn deserialize(&self, repr: &[u8]) -> Result<$value_type, Self::DeserializeError> { + use $crate::Format; + use $crate::Representation; + Self::get_format(self).from_slice(repr) + } + } + + impl $crate::ToWriter<$value_type> for $repr_type { + #[inline] + fn to_writer( + &self, + value: &$value_type, + writer: &mut W, + ) -> Result<(), Self::WriteError> { + use $crate::Format; + use $crate::Representation; + Self::get_format(self).to_writer(value, writer) + } + } + }; +} diff --git a/crates/air-lib/interpreter-sede/src/rmp_serde.rs b/crates/air-lib/interpreter-sede/src/rmp_serde.rs new file mode 100644 index 00000000..a54ac9c6 --- /dev/null +++ b/crates/air-lib/interpreter-sede/src/rmp_serde.rs @@ -0,0 +1,95 @@ +/* + * Copyright 2023 Fluence Labs Limited + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +use crate::format::BorrowFormat; +use crate::multiformat::SerializationCodec; +use crate::Format; + +// https://github.com/multiformats/multicodec/blob/master/table.csv +const MULTIFORMAT_MSGPCK: SerializationCodec = 0x0201; + +// rmp_serde has config with human-readable representation too, but I'm not sure it worth it +#[derive(Copy, Clone, Default)] +pub struct RmpSerdeFormat; + +impl Format for RmpSerdeFormat +where + Value: serde::Serialize + serde::de::DeserializeOwned, +{ + type SerializationError = rmp_serde::encode::Error; + type DeserializationError = rmp_serde::decode::Error; + type WriteError = rmp_serde::encode::Error; + + #[inline] + fn to_vec(&self, val: &Value) -> Result, Self::SerializationError> { + rmp_serde::to_vec(val) + } + + #[inline] + fn from_slice(&self, slice: &[u8]) -> Result { + rmp_serde::from_slice(slice) + } + + #[inline] + fn to_writer( + &self, + value: &Value, + write: &mut W, + ) -> Result<(), Self::WriteError> { + value.serialize(&mut rmp_serde::Serializer::new(write)) + } +} + +impl<'data, Value: 'data> BorrowFormat<'data, Value> for RmpSerdeFormat +where + Value: serde::Serialize + for<'de> serde::Deserialize<'de>, +{ + #[inline] + fn borrow_from_slice(&self, slice: &'data [u8]) -> Result { + rmp_serde::from_slice(slice) + } +} + +#[derive(Copy, Clone, Default)] +pub struct RmpSerdeMultiformat; + +impl Format for RmpSerdeMultiformat +where + Value: serde::Serialize + serde::de::DeserializeOwned, +{ + type SerializationError = crate::multiformat::EncodeError; + type DeserializationError = crate::multiformat::DecodeError; + type WriteError = crate::multiformat::EncodeError; + + #[inline] + fn to_vec(&self, value: &Value) -> Result, Self::SerializationError> { + crate::multiformat::encode_multiformat(value, MULTIFORMAT_MSGPCK, &RmpSerdeFormat) + } + + #[inline] + fn from_slice(&self, slice: &[u8]) -> Result { + crate::multiformat::decode_multiformat(slice, MULTIFORMAT_MSGPCK, &RmpSerdeFormat) + } + + #[inline] + fn to_writer( + &self, + value: &Value, + write: &mut W, + ) -> Result<(), Self::WriteError> { + crate::multiformat::write_multiformat(value, MULTIFORMAT_MSGPCK, &RmpSerdeFormat, write) + } +} diff --git a/crates/air-lib/interpreter-sede/src/serde_json.rs b/crates/air-lib/interpreter-sede/src/serde_json.rs new file mode 100644 index 00000000..fb1aa531 --- /dev/null +++ b/crates/air-lib/interpreter-sede/src/serde_json.rs @@ -0,0 +1,84 @@ +/* + * Copyright 2023 Fluence Labs Limited + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +use crate::multiformat::SerializationCodec; +use crate::Format; + +// https://github.com/multiformats/multicodec/blob/master/table.csv +const MULTIFORMAT_JSON: SerializationCodec = 0x0200; + +// TODO a human-readability flag? +#[derive(Copy, Clone, Default)] +pub struct SerdeJsonFormat; + +impl Format for SerdeJsonFormat +where + Value: serde::Serialize + serde::de::DeserializeOwned, +{ + type SerializationError = serde_json::Error; + type DeserializationError = serde_json::Error; + type WriteError = serde_json::Error; + + #[inline] + fn to_vec(&self, value: &Value) -> Result, Self::SerializationError> { + serde_json::to_vec(value) + } + + #[inline] + fn from_slice(&self, slice: &[u8]) -> Result { + serde_json::from_slice(slice) + } + + #[inline] + fn to_writer( + &self, + value: &Value, + write: &mut W, + ) -> Result<(), Self::WriteError> { + serde_json::to_writer(write, value) + } +} + +#[derive(Copy, Clone, Default)] +pub struct SerdeJsonMultiformat; + +impl Format for SerdeJsonMultiformat +where + Value: serde::Serialize + serde::de::DeserializeOwned, +{ + type SerializationError = crate::multiformat::EncodeError; + type DeserializationError = crate::multiformat::DecodeError; + type WriteError = crate::multiformat::EncodeError; + + #[inline] + fn to_vec(&self, value: &Value) -> Result, Self::SerializationError> { + crate::multiformat::encode_multiformat(value, MULTIFORMAT_JSON, &SerdeJsonFormat) + } + + #[inline] + fn from_slice(&self, slice: &[u8]) -> Result { + crate::multiformat::decode_multiformat(slice, MULTIFORMAT_JSON, &SerdeJsonFormat) + } + + #[inline] + fn to_writer( + &self, + value: &Value, + write: &mut W, + ) -> Result<(), Self::WriteError> { + crate::multiformat::write_multiformat(value, MULTIFORMAT_JSON, &SerdeJsonFormat, write) + } +} diff --git a/crates/air-lib/interpreter-sede/src/serialized_type.rs b/crates/air-lib/interpreter-sede/src/serialized_type.rs new file mode 100644 index 00000000..944b8e10 --- /dev/null +++ b/crates/air-lib/interpreter-sede/src/serialized_type.rs @@ -0,0 +1,101 @@ +/* + * Copyright 2023 Fluence Labs Limited + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#[macro_export] +macro_rules! derive_serialized_type { + ($type_name:ident) => { + #[derive( + ::core::fmt::Debug, + ::core::default::Default, + ::serde::Serialize, + ::serde::Deserialize, + ::core::cmp::PartialEq, + ::core::cmp::Eq, + ::core::hash::Hash, + ::core::clone::Clone, + )] + #[serde(transparent)] + #[repr(transparent)] + #[cfg_attr( + any(feature = "marine", feature = "marine-abi"), + ::marine_rs_sdk::marine + )] + pub struct $type_name { + // it cannot be implemented as a tuple as marine doesn't support tuple structs + #[serde(with = "serde_bytes")] + value: ::std::vec::Vec, + } + + impl ::core::convert::From<::std::vec::Vec> for $type_name { + #[inline] + fn from(value: ::std::vec::Vec) -> Self { + Self { value } + } + } + + impl ::core::convert::From<$type_name> for ::std::vec::Vec { + #[inline] + fn from(value: $type_name) -> Self { + value.value + } + } + + impl ::core::ops::Deref for $type_name { + type Target = [u8]; + + #[inline] + fn deref(&self) -> &Self::Target { + &self.value + } + } + }; + + ($type_name:ident, $decl:meta) => { + #[derive( + ::core::fmt::Debug, + ::core::default::Default, + ::serde::Serialize, + ::serde::Deserialize, + ::core::cmp::PartialEq, + ::core::cmp::Eq, + ::core::hash::Hash, + ::core::clone::Clone, + )] + #[serde(transparent)] + #[repr(transparent)] + #[$decl] + pub struct $type_name { + // it cannot be implemented as a tuple as marine doesn't support tuple structs + value: ::std::vec::Vec, + } + + impl ::core::convert::From<::std::vec::Vec> for $type_name { + #[inline] + fn from(value: ::std::vec::Vec) -> Self { + Self { value } + } + } + + impl ::core::ops::Deref for $type_name { + type Target = [u8]; + + #[inline] + fn deref(&self) -> &Self::Target { + &self.value + } + } + }; +} diff --git a/crates/air-lib/test-utils/Cargo.toml b/crates/air-lib/test-utils/Cargo.toml index 49170fc2..a6135950 100644 --- a/crates/air-lib/test-utils/Cargo.toml +++ b/crates/air-lib/test-utils/Cargo.toml @@ -19,6 +19,7 @@ aquavm-air = { version = "0.55.0", path = "../../../air" } air-interpreter-cid = { version = "0.7.0", path = "../interpreter-cid" } air-interpreter-data = { version = "0.15.0", path = "../interpreter-data" } air-interpreter-interface = { version = "0.15.2", path = "../interpreter-interface" } +air-interpreter-sede = { version = "0.1.0", path = "../interpreter-sede" } air-interpreter-signatures = { version = "0.1.5", path = "../interpreter-signatures" } avm-interface = { version = "0.29.3", path = "../../../avm/interface" } avm-server = { version = "0.33.4", path = "../../../avm/server" } diff --git a/crates/air-lib/test-utils/src/lib.rs b/crates/air-lib/test-utils/src/lib.rs index 9aaccb6c..01f10fb3 100644 --- a/crates/air-lib/test-utils/src/lib.rs +++ b/crates/air-lib/test-utils/src/lib.rs @@ -35,6 +35,8 @@ pub mod native_test_runner; pub mod wasm_test_runner; pub use air::interpreter_data::*; +use air_interpreter_sede::ToSerialized; + use air::ExecutionCidState; pub use avm_interface::raw_outcome::*; pub use avm_server::*; @@ -84,7 +86,7 @@ pub fn trace_from_result(result: &RawAVMOutcome) -> ExecutionTrace { } pub fn data_from_result(result: &RawAVMOutcome) -> InterpreterData { - serde_json::from_slice(&result.data).expect("default serializer shouldn't fail") + InterpreterData::try_from_slice(&result.data).expect("default serializer shouldn't fail") } pub fn raw_data_from_trace( @@ -98,7 +100,9 @@ pub fn raw_data_from_trace( 0, semver::Version::new(1, 1, 1), ); - serde_json::to_vec(&data).expect("default serializer shouldn't fail") + InterpreterDataRepr + .serialize(&data) + .expect("default serializer shouldn't fail") } pub fn raw_data_from_trace_with_canon( @@ -118,7 +122,9 @@ pub fn raw_data_from_trace_with_canon( 0, semver::Version::new(1, 1, 1), ); - serde_json::to_vec(&data).expect("default serializer shouldn't fail") + InterpreterDataRepr + .serialize(&data) + .expect("default serializer shouldn't fail") } #[macro_export] diff --git a/crates/air-lib/test-utils/src/native_test_runner.rs b/crates/air-lib/test-utils/src/native_test_runner.rs index 3c643269..9c10c41d 100644 --- a/crates/air-lib/test-utils/src/native_test_runner.rs +++ b/crates/air-lib/test-utils/src/native_test_runner.rs @@ -15,7 +15,9 @@ */ use crate::test_runner::AirRunner; +use air_interpreter_interface::CallResultsRepr; use air_interpreter_interface::RunParameters; +use air_interpreter_sede::ToSerialized; use avm_server::avm_runner::*; use avm_server::into_raw_result; use fluence_keypair::KeyPair; @@ -46,7 +48,7 @@ impl AirRunner for NativeAirRunner { ) -> Result> { // 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 raw_call_results = CallResultsRepr.serialize(&raw_call_results).unwrap(); let current_peer_id = override_current_peer_id.unwrap_or_else(|| self.current_peer_id.clone()); diff --git a/crates/air-lib/test-utils/src/test_runner.rs b/crates/air-lib/test-utils/src/test_runner.rs index ac49177a..50ccaa4f 100644 --- a/crates/air-lib/test-utils/src/test_runner.rs +++ b/crates/air-lib/test-utils/src/test_runner.rs @@ -282,6 +282,12 @@ mod tests { ) .expect("call should be success"); + assert_eq!( + current_result_1.ret_code, 0, + "{:?}", + current_result_1.error_message + ); + let expected_current_call_requests = HashMap::new(); let expected_current_next_peers_pks = vec![spell_id.to_owned()]; diff --git a/junk/gen-bench-data/Cargo.toml b/junk/gen-bench-data/Cargo.toml index 40ad8c62..614ace4d 100644 --- a/junk/gen-bench-data/Cargo.toml +++ b/junk/gen-bench-data/Cargo.toml @@ -10,6 +10,7 @@ aquavm-air = { path = "../../air", features = ["gen_signatures", "check_signatur air-interpreter-cid = { path = "../../crates/air-lib/interpreter-cid" } air-interpreter-data = { path = "../../crates/air-lib/interpreter-data" } air-interpreter-interface = { path = "../../crates/air-lib/interpreter-interface" } +air-interpreter-sede = { path = "../../crates/air-lib/interpreter-sede", features = ["serde_json", "rmp-serde"] } air-interpreter-signatures = { path = "../../crates/air-lib/interpreter-signatures" } air-test-utils = { path = "../../crates/air-lib/test-utils" } air-testing-framework = { path = "../../crates/testing-framework" } diff --git a/junk/gen-bench-data/src/cid_benchmarking/mod.rs b/junk/gen-bench-data/src/cid_benchmarking/mod.rs index c7746e53..063d7e36 100644 --- a/junk/gen-bench-data/src/cid_benchmarking/mod.rs +++ b/junk/gen-bench-data/src/cid_benchmarking/mod.rs @@ -61,6 +61,7 @@ fn derive_peer_id(peer_name: &str, peer_id_cache: &mut HashMap) .clone() } +// input data is always JSON and doesn't depend on InterpreterData representation fn read_data(path: &str) -> T { let inp = std::fs::File::open(path).unwrap(); serde_json::from_reader(inp).unwrap() @@ -109,6 +110,8 @@ pub fn cid_benchmarking_data( peer_id: String, particle_id: &str, ) -> Vec { + use air_interpreter_sede::Format; + let mut curr_data: PreCidInterpeterData = read_data(curr_data_filename); let calls: TraceCalls = read_data("src/cid_benchmarking/simple-calls-info.json"); let mut calls = calls.into_iter(); @@ -158,7 +161,7 @@ pub fn cid_benchmarking_data( .unwrap() .insert("signatures".to_owned(), json!(ss)); - serde_json::to_vec(&curr_data).unwrap() + InterpreterDataFormat::default().to_vec(&curr_data).unwrap().into() } pub fn cid_benchmarking_long_data( diff --git a/junk/gen-bench-data/src/main.rs b/junk/gen-bench-data/src/main.rs index 7c33379c..ac061533 100644 --- a/junk/gen-bench-data/src/main.rs +++ b/junk/gen-bench-data/src/main.rs @@ -1,3 +1,9 @@ +use air_interpreter_data::InterpreterDataFormat; +use air_interpreter_sede::Format; +use air_interpreter_sede::RmpSerdeFormat; +use air_interpreter_sede::RmpSerdeMultiformat; +use air_interpreter_sede::SerdeJsonFormat; +use air_interpreter_sede::SerdeJsonMultiformat; use air_test_framework::*; use air_test_utils::key_utils::derive_dummy_keypair; use air_test_utils::prelude::*; @@ -6,7 +12,8 @@ use clap::Parser; use clap::Subcommand; use itertools::Itertools as _; use maplit::hashmap; -use serde::Serialize; + +use std::borrow::Cow; use std::collections::HashMap; use std::path::Path; use std::path::PathBuf; @@ -103,17 +110,17 @@ fn save_data(dest_dir: &Path, data: Data) -> Result<(), Box(&data.prev_data), )?; save_file( dest_dir, "cur_data.json", - &reformat_json_if_possible(&data.cur_data), + reformat_json_if_possible::(&data.cur_data), )?; save_file( dest_dir, "params.json", - &serde_json::to_vec_pretty(&data.params_json)?, + serde_json::to_vec_pretty(&data.params_json)?, )?; save_file(dest_dir, "keypair.ed25519", &data.keypair)?; @@ -123,7 +130,9 @@ fn save_data(dest_dir: &Path, data: Data) -> Result<(), Box( + &serde_json::to_vec(&call_results).unwrap(), + ), ) .unwrap(); } @@ -131,29 +140,61 @@ fn save_data(dest_dir: &Path, data: Data) -> Result<(), Box { + fn reformat(data: &[u8]) -> Cow<'_, [u8]>; +} + +impl Reformatter for SerdeJsonFormat { + /// make zero-indentation data for more convenient git diffs + fn reformat(data: &[u8]) -> Cow<'_, [u8]> { + use serde::ser::Serialize; + + let obj: serde_json::Value = serde_json::from_slice(data).unwrap(); + + let fmt = serde_json::ser::PrettyFormatter::with_indent(&[]); + let mut out = vec![]; + { + let mut ser = serde_json::ser::Serializer::with_formatter(&mut out, fmt); + obj.serialize(&mut ser).unwrap(); + } + + out.into() + } +} + +impl Reformatter for SerdeJsonMultiformat { + /// make zero-indentation data for more convenient git diffs + fn reformat(data: &[u8]) -> Cow<'_, [u8]> { + data.into() + } +} + +impl Reformatter for RmpSerdeFormat { + fn reformat(data: &[u8]) -> Cow<'_, [u8]> { + data.into() + } +} + +impl Reformatter for RmpSerdeMultiformat { + fn reformat(data: &[u8]) -> Cow<'_, [u8]> { + data.into() + } +} + /// make zero-indentation data for better git diffs -fn reformat_json_if_possible(data: &[u8]) -> Vec { +fn reformat_json_if_possible(data: &[u8]) -> Cow<'_, [u8]> { if data.is_empty() { return data.into(); } - let obj: serde_json::Value = serde_json::from_slice(data).unwrap(); - let fmt = serde_json::ser::PrettyFormatter::with_indent(&[]); - let mut out = vec![]; - let mut ser = serde_json::ser::Serializer::with_formatter(&mut out, fmt); - obj.serialize(&mut ser).unwrap(); - out + R::reformat(data) } -fn save_file( - dest_dir: &Path, - filename: &str, - data: impl AsRef<[u8]>, -) -> Result<(), Box> { +fn save_file(dest_dir: &Path, filename: &str, data: impl AsRef<[u8]>) -> std::io::Result<()> { let mut dest_dir = dest_dir.to_owned(); dest_dir.push(filename); - Ok(std::fs::write(dest_dir, data)?) + std::fs::write(dest_dir, data) } #[derive(Debug, Default)] diff --git a/tools/cli/air/Cargo.toml b/tools/cli/air/Cargo.toml index 5b860fbd..c405e5ec 100644 --- a/tools/cli/air/Cargo.toml +++ b/tools/cli/air/Cargo.toml @@ -15,6 +15,7 @@ air-beautifier = { version = "0.4.0", path = "../../../crates/beautifier" } avm-data-store = { version = "0.7.3", path = "../../../crates/data-store" } avm-interface = { version = "0.29.3", path = "../../../avm/interface" } air-interpreter-interface = { version = "0.15.2", path = "../../../crates/air-lib/interpreter-interface", default-features = false } +air-interpreter-sede = { version = "0.1.0", path = "../../../crates/air-lib/interpreter-sede", default-features = false } air-test-utils = { version = "0.13.0",path = "../../../crates/air-lib/test-utils", optional = true } anyhow = "1.0.75" diff --git a/tools/cli/air/src/trace/run.rs b/tools/cli/air/src/trace/run.rs index 2cedb849..68e8b60f 100644 --- a/tools/cli/air/src/trace/run.rs +++ b/tools/cli/air/src/trace/run.rs @@ -191,8 +191,8 @@ pub(crate) fn run(args: Args) -> anyhow::Result<()> { let result = runner .call_tracing( execution_data.air_script.clone(), - execution_data.prev_data.clone().into(), - execution_data.current_data.clone().into(), + execution_data.prev_data.clone(), + execution_data.current_data.clone(), particle.init_peer_id.clone().into_owned(), particle.timestamp, particle.ttl, @@ -276,7 +276,7 @@ fn read_call_results(call_results_path: Option<&Path>) -> anyhow::Result) -> anyhow::Result>, - default: &str, -) -> anyhow::Result { + default: &[u8], +) -> anyhow::Result> { match data_path { None => Ok(default.to_owned()), Some(data_path) => load_data(data_path.as_ref()), } } -fn load_data(data_path: &Path) -> anyhow::Result { - Ok(std::fs::read_to_string(data_path)?) +fn load_data(data_path: &Path) -> anyhow::Result> { + Ok(std::fs::read(data_path)?) } fn load_keypair_ed25519(path: &PathBuf) -> Result { diff --git a/tools/cli/air/src/trace/run/data/anomaly.rs b/tools/cli/air/src/trace/run/data/anomaly.rs index b29ff49f..850e7ffc 100644 --- a/tools/cli/air/src/trace/run/data/anomaly.rs +++ b/tools/cli/air/src/trace/run/data/anomaly.rs @@ -32,16 +32,13 @@ pub(crate) struct AnomalyDataArgs { pub(crate) fn load(args: &AnomalyDataArgs) -> anyhow::Result> { let anomaly_json = load_data(&args.anomaly_data_path).context("Failed to read anomaly data")?; let anomaly_data: AnomalyData<'_> = - serde_json::from_str(&anomaly_json).context("Failed to parse anomaly data")?; + serde_json::from_slice(&anomaly_json).context("Failed to parse anomaly data")?; let air_script = anomaly_data.air_script.to_string(); - let prev_data = String::from_utf8(anomaly_data.prev_data.to_vec()) - .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> = - serde_json::from_reader(&*anomaly_data.particle.to_vec()) - .context("Anomaly particle is not a valid JSON")?; + let prev_data = anomaly_data.prev_data.to_vec(); + let current_data = anomaly_data.current_data.to_vec(); + let particle: ParticleParameters<'static> = serde_json::from_slice(&anomaly_data.particle) + .context("Anomaly particle is not a valid JSON")?; Ok(ExecutionData { air_script, diff --git a/tools/cli/air/src/trace/run/data/mod.rs b/tools/cli/air/src/trace/run/data/mod.rs index 77de2cb4..b3f5a596 100644 --- a/tools/cli/air/src/trace/run/data/mod.rs +++ b/tools/cli/air/src/trace/run/data/mod.rs @@ -21,7 +21,7 @@ use avm_interface::ParticleParameters; pub(crate) struct ExecutionData<'ctx> { pub(crate) air_script: String, - pub(crate) current_data: String, - pub(crate) prev_data: String, + pub(crate) current_data: Vec, + pub(crate) prev_data: Vec, pub(crate) particle: ParticleParameters<'ctx>, } diff --git a/tools/cli/air/src/trace/run/data/plain.rs b/tools/cli/air/src/trace/run/data/plain.rs index d6feb5af..35be552f 100644 --- a/tools/cli/air/src/trace/run/data/plain.rs +++ b/tools/cli/air/src/trace/run/data/plain.rs @@ -22,7 +22,7 @@ use anyhow::Context; use std::path::{Path, PathBuf}; -const DEFAULT_DATA: &str = ""; +const DEFAULT_DATA: &[u8] = b""; #[derive(clap::Args, Debug)] pub(crate) struct PlainDataArgs { diff --git a/tools/cli/air/src/trace/run/native.rs b/tools/cli/air/src/trace/run/native.rs index 4356ae0a..d1a4cfd5 100644 --- a/tools/cli/air/src/trace/run/native.rs +++ b/tools/cli/air/src/trace/run/native.rs @@ -15,6 +15,7 @@ */ use super::runner::AirRunner; +use air_interpreter_interface::CallResultsRepr; use air_interpreter_interface::RunParameters; use avm_interface::raw_outcome::RawAVMOutcome; use fluence_keypair::KeyPair; @@ -38,11 +39,12 @@ impl AirRunner for NativeAvmRunner { keypair: &KeyPair, particle_id: String, ) -> anyhow::Result { + use air_interpreter_sede::ToSerialized; use avm_interface::into_raw_result; // 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 raw_call_results = CallResultsRepr.serialize(&raw_call_results).unwrap(); let key_format = keypair.key_format().into(); let secret_key_bytes = keypair.secret().expect("Failed to get secret key"); diff --git a/tools/cli/performance_metering/performance_metering/bench.py b/tools/cli/performance_metering/performance_metering/bench.py index 4b63a016..4cc5f03e 100644 --- a/tools/cli/performance_metering/performance_metering/bench.py +++ b/tools/cli/performance_metering/performance_metering/bench.py @@ -108,7 +108,19 @@ class Bench: ) lines = proc.stderr.decode("utf-8").split('\n') all_output.extend(lines) - return list(map(json.loads, filter(lambda x: x, all_output))) + + def try_to_parse_json(s): + try: + return json.loads(s) + except Exception: + logger.error("failed to parse JSON: %r", s) + return None + + return list(filter( + lambda x: x is not None, + map(try_to_parse_json, + filter(lambda x: x, all_output)) + )) def get_name(self): """Return the bench name."""