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

@ -16,7 +16,10 @@
use super::GlobalStreamGens;
use super::RestrictedStreamGens;
use crate::cid_store::CidStore;
use crate::ExecutionTrace;
use crate::JValue;
use air_utils::measure;
use serde::Deserialize;
@ -53,6 +56,9 @@ pub struct InterpreterData {
/// Version of interpreter produced this data.
pub interpreter_version: semver::Version,
/// Map CID to values
pub cid_store: CidStore<JValue>,
}
impl InterpreterData {
@ -64,6 +70,7 @@ impl InterpreterData {
last_call_request_id: 0,
restricted_streams: RestrictedStreamGens::new(),
interpreter_version,
cid_store: <_>::default(),
}
}
@ -71,9 +78,12 @@ impl InterpreterData {
trace: ExecutionTrace,
streams: GlobalStreamGens,
restricted_streams: RestrictedStreamGens,
cid_store: impl Into<CidStore<JValue>>,
last_call_request_id: u32,
interpreter_version: semver::Version,
) -> Self {
let cid_store = cid_store.into();
Self {
trace,
global_streams: streams,
@ -81,6 +91,7 @@ impl InterpreterData {
last_call_request_id,
restricted_streams,
interpreter_version,
cid_store,
}
}