feat!(execution-engine): Store call executed values as CIDs in the data (#401)

The trace stores CID strings for call result values.  These strings are to be resolved to real values with `InterpreterData::cid_store` map.
This commit is contained in:
Ivan Boldyrev
2022-12-26 15:45:14 +07:00
committed by GitHub
parent 004ce10abd
commit 0226c062f8
46 changed files with 942 additions and 172 deletions

View File

@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
## [0.12.0] - 2022-12-21
+ New `cid` field of the `InterpreterOutcome` contains CID of the data.
## [0.11.1] - 2022-09-13
### Other

View File

@ -1,7 +1,7 @@
[package]
name = "air-interpreter-interface"
description = "Interface of the AIR interpreter"
version = "0.11.2"
version = "0.12.0"
authors = ["Fluence Labs"]
edition = "2018"
license = "Apache-2.0"
@ -15,6 +15,7 @@ name = "air_interpreter_interface"
path = "src/lib.rs"
[dependencies]
air-interpreter-cid = { version = "0.1.0", path = "../interpreter-cid" }
marine-rs-sdk = { version = "0.7.1", optional = true }
fluence-it-types = { version = "0.3.2", optional = true }

View File

@ -43,6 +43,9 @@ pub struct InterpreterOutcome {
/// Collected parameters of all met call instructions that could be executed on a current peer.
pub call_requests: Vec<u8>,
/// IPLD CID of the data field.
pub cid: String,
}
impl InterpreterOutcome {
@ -53,12 +56,15 @@ impl InterpreterOutcome {
next_peer_pks: Vec<String>,
call_requests: Vec<u8>,
) -> Self {
let cid = air_interpreter_cid::json_data_cid(&data).into();
Self {
ret_code,
error_message,
data,
next_peer_pks,
call_requests,
cid,
}
}
}
@ -81,13 +87,7 @@ 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 {
ret_code,
error_message,
data,
next_peer_pks,
call_requests,
};
let outcome = Self::new(ret_code, error_message, data, next_peer_pks, call_requests);
Ok(outcome)
}