feat(interpreter-cid)!: use Blake3 for CIDs (#729)

Change to more efficient cryptography hash implementation.
This commit is contained in:
Ivan Boldyrev 2023-10-23 17:16:15 +04:00 committed by GitHub
parent 2b944eb348
commit 776d81a1db
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 486 additions and 473 deletions

2
.gitmodules vendored
View File

@ -1,4 +1,4 @@
[submodule "benches/performance_metering"]
path = benches/performance_metering
url = git@github.com:fluencelabs/aquavm-benchmark-data.git
branch = chore/update-benchmark-limit-1024
branch = tmp/sigs-with-blake2

15
Cargo.lock generated
View File

@ -96,6 +96,7 @@ dependencies = [
name = "air-interpreter-cid"
version = "0.5.0"
dependencies = [
"blake3",
"cid",
"multihash 0.18.1",
"serde",
@ -753,20 +754,20 @@ dependencies = [
[[package]]
name = "blake2s_simd"
version = "1.0.1"
version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6637f448b9e61dfadbdcbae9a885fadee1f3eaffb1f8d3c1965d3ade8bdfd44f"
checksum = "94230421e395b9920d23df13ea5d77a20e1725331f90fbbf6df6040b33f756ae"
dependencies = [
"arrayref",
"arrayvec 0.7.4",
"constant_time_eq 0.2.6",
"constant_time_eq 0.3.0",
]
[[package]]
name = "blake3"
version = "1.4.1"
version = "1.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "199c42ab6972d92c9f8995f086273d25c42fc0f7b2a1fcefba465c1352d25ba5"
checksum = "0231f06152bf547e9c2b5194f247cd97aacf6dcd8b15d8e5ec0663f64580da87"
dependencies = [
"arrayref",
"arrayvec 0.7.4",
@ -4280,9 +4281,9 @@ dependencies = [
[[package]]
name = "proc-macro2"
version = "1.0.67"
version = "1.0.66"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3d433d9f1a3e8c1263d9456598b16fec66f4acc9a74dacffd35c7bb09b3a1328"
checksum = "18fb31db3f9bddb2ea821cde30a9f70117e3f119938b5ee630b7403aa6e2ead9"
dependencies = [
"unicode-ident",
]

View File

@ -222,9 +222,13 @@ fn test_canon_value_not_found() {
),
];
let missing_cid = "bagaaieraondvznakk2hi3kfaixhnceatpykz7cikytniqo3lc7ogkgz2qbeq";
let missing_cid = "bagaaihra3ijwi5gxk5odex3qfo32u5prci4giaz4ysel67m4a5hk3l432djq";
let value_store: CidStore<_> = cid_state.value_tracker.into();
assert!(value_store.get(&CID::<_>::new(missing_cid)).is_some());
assert!(
value_store.get(&CID::<_>::new(missing_cid)).is_some(),
"{:#?}",
value_store
);
// Override with fake data.
cid_state.value_tracker = CidTracker::<_>::new();
@ -267,9 +271,13 @@ fn test_canon_root_tetraplet_not_found() {
),
];
let missing_cid = "bagaaiera2bwoxisr5k7qlbzhxi2jmdqlgqybqgxcfwt3v652nqdo5fyc665q";
let missing_cid = "bagaaihraydnoggy3vbf42ebqdjffuqnqpiwk2ryytc4esqasavlo6zzv7e4a";
let tetraplet_store: CidStore<_> = cid_state.tetraplet_tracker.into();
assert!(tetraplet_store.get(&CID::<_>::new(missing_cid)).is_some());
assert!(
tetraplet_store.get(&CID::<_>::new(missing_cid)).is_some(),
"{:#?}",
tetraplet_store
);
let mut fake_tetraplet_tracker = CidTracker::<_>::new();
fake_tetraplet_tracker
@ -282,7 +290,7 @@ fn test_canon_root_tetraplet_not_found() {
let result = call_vm!(vm, <_>::default(), air_script, vec![], cur_data);
let expected_error = ValueForCidNotFound("tetraplet", missing_cid.into());
assert!(check_error(&result, expected_error));
assert_error_eq!(&result, expected_error);
}
#[test]
@ -323,10 +331,13 @@ fn test_canon_tetraplet_not_found() {
&mut cid_state,
),
];
let missing_cid = "bagaaierawgvzxeomczgjfgaf7jhbap27kqihlzm4i4na42uoi36lgzfrzwdq";
let missing_cid = "bagaaihrasj5rizxwp3gypeiszoyq6nwmlvyu3fxqmfv6yu7uvuir6litgyna";
let tetraplet_store: CidStore<_> = cid_state.tetraplet_tracker.into();
assert!(tetraplet_store.get(&CID::<_>::new(missing_cid)).is_some());
assert!(
tetraplet_store.get(&CID::<_>::new(missing_cid)).is_some(),
"{:#?}",
tetraplet_store
);
let mut fake_tetraplet_tracker = CidTracker::<_>::new();
fake_tetraplet_tracker
@ -338,7 +349,7 @@ fn test_canon_tetraplet_not_found() {
let result = call_vm!(vm, <_>::default(), air_script, vec![], cur_data);
let expected_error = ValueForCidNotFound("tetraplet", missing_cid.into());
assert!(check_error(&result, expected_error), "{}", result.error_message);
assert_error_eq!(&result, expected_error);
}
#[test]
@ -374,9 +385,13 @@ fn test_canon_agg_not_found() {
),
];
let missing_cid = "bagaaierar6b2hcv2ir66tmbwocj5h7yofseqlzxma2n67z5wybtto5ujrekq";
let missing_cid = "bagaaihraqxwgyh7ihp2cmyt6piqqm7s2bz2xr2sgohzn34tnstksoyb4wsza";
let canon_element_store: CidStore<_> = cid_state.canon_element_tracker.into();
assert!(canon_element_store.get(&CID::<_>::new(missing_cid)).is_some());
assert!(
canon_element_store.get(&CID::<_>::new(missing_cid)).is_some(),
"{:#?}",
canon_element_store
);
// Fake data
cid_state.canon_element_tracker = <_>::default();

View File

@ -40,10 +40,11 @@ fn test_missing_cid() {
];
cid_state.service_result_agg_tracker = <_>::default();
let missing_cid = extract_service_result_cid(&trace[0]);
let cur_data = raw_data_from_trace(trace, cid_state);
let result = call_vm!(vm, <_>::default(), air_script, vec![], cur_data);
let missing_cid = "bagaaierajmqwu6mhm7iw5mxxy647ri6yznuwjxfm72u4u5a5zdasfid4xwiq".into();
let expected_error = ValueForCidNotFound("service result aggregate", missing_cid);
let expected_error = ValueForCidNotFound("service result aggregate", missing_cid.get_inner());
assert!(check_error(&result, expected_error), "{:?}", result);
}

View File

@ -374,6 +374,8 @@ fn test_merge_scalar_mismatch() {
let mut cid_state2 = ExecutionCidState::default();
let trace1 = ExecutionTrace::from(vec![scalar_tracked!(42, cid_state1, peer = "peer")]);
let trace2 = ExecutionTrace::from(vec![scalar_tracked!(43, cid_state2, peer = "peer")]);
let cid1 = extract_service_result_cid(&trace1[0.into()]);
let cid2 = extract_service_result_cid(&trace2[0.into()]);
let data1 = raw_data_from_trace(trace1, cid_state1);
let data2 = raw_data_from_trace(trace2, cid_state2);
@ -381,11 +383,14 @@ fn test_merge_scalar_mismatch() {
assert_eq!(result.ret_code, 20000);
assert_eq!(
result.error_message,
concat!(
r#"on instruction 'call "peer" ("" "") [] var' trace handler encountered an error:"#,
r#" values in call results are not equal:"#,
r#" Scalar(CID("bagaaierautomsqybwfcilogqikd6sxzhaqkrout64cosdlpo7p6wvod4miza"))"#,
r#" != Scalar(CID("bagaaieraywolxobx5koykfm7lnjtpci6wt4ccqqehbbhpebomznlzaszhgya"))"#
format!(
concat!(
r#"on instruction 'call "peer" ("" "") [] var' trace handler encountered an error:"#,
r#" values in call results are not equal:"#,
r#" Scalar({:?})"#,
r#" != Scalar({:?})"#
),
cid1, cid2
)
);
}
@ -425,6 +430,8 @@ fn test_merge_stream_mismatch() {
let mut cid_state2 = ExecutionCidState::default();
let trace1 = ExecutionTrace::from(vec![stream_tracked!(42, 0, cid_state1, peer = "peer")]);
let trace2 = ExecutionTrace::from(vec![stream_tracked!(43, 0, cid_state2, peer = "peer")]);
let cid1 = extract_service_result_cid(&trace1[0.into()]);
let cid2 = extract_service_result_cid(&trace2[0.into()]);
let data1 = raw_data_from_trace(trace1, cid_state1);
let data2 = raw_data_from_trace(trace2, cid_state2);
@ -432,11 +439,14 @@ fn test_merge_stream_mismatch() {
assert_eq!(result.ret_code, 20000);
assert_eq!(
result.error_message,
concat!(
r#"on instruction 'call "peer" ("" "") [] $var' trace handler encountered an error:"#,
r#" values in call results are not equal:"#,
r#" Stream { cid: CID("bagaaierautomsqybwfcilogqikd6sxzhaqkrout64cosdlpo7p6wvod4miza"), generation: 0 }"#,
r#" != Stream { cid: CID("bagaaieraywolxobx5koykfm7lnjtpci6wt4ccqqehbbhpebomznlzaszhgya"), generation: 0 }"#
format!(
concat!(
r#"on instruction 'call "peer" ("" "") [] $var' trace handler encountered an error:"#,
r#" values in call results are not equal:"#,
r#" Stream {{ cid: {:?}, generation: 0 }}"#,
r#" != Stream {{ cid: {:?}, generation: 0 }}"#
),
cid1, cid2
)
);
}
@ -464,14 +474,15 @@ fn test_merge_unused_mismatch() {
let data2 = raw_data_from_trace(trace2, <_>::default());
let result = avm.call(air, data1, data2, <_>::default()).unwrap();
// TODO rewrite here and above with assert_error_eq
assert_eq!(result.ret_code, 20000);
assert_eq!(
result.error_message,
concat!(
r#"on instruction 'call "peer" ("" "") [] ' trace handler encountered an error:"#,
r#" values in call results are not equal:"#,
r#" Unused(CID("bagaaieraondvznakk2hi3kfaixhnceatpykz7cikytniqo3lc7ogkgz2qbeq"))"#,
r#" != Unused(CID("bagaaieraitfxgdccasakar33kbnoncxvbd5zb6lm6dwfjrvnc2kj3vbh6e5a"))"#
r#" Unused(CID("bagaaihra3ijwi5gxk5odex3qfo32u5prci4giaz4ysel67m4a5hk3l432djq"))"#,
r#" != Unused(CID("bagaaihrahhyeotni37z6kds47boxa2llqffxlz4vqt7jbt76jeimm6eu7uhq"))"#
)
);
}

View File

@ -447,10 +447,10 @@ fn test_attack_replay() {
let nested_error = fluence_keypair::error::VerificationError::Ed25519(
dalek_error,
// will break if signed data format changes
"3eSuF5uvjQvmvSC6vu5Kmb8bJcswXhNUcqsSG9USEad1oNgnpAcBNm2maM4Tyk3BsLYnwdwNEj4KiJ4pqence7XF".to_owned(),
"8ATKuSr1J6NvqT3PBBf3qcDWsnDcnNpznFBSdzAVJnASV8MHrc15zKYYQkCcywcXFPgXJAdEzTNdhixDQKQjDL4".to_owned(),
"6m3zmtymxDL56KBpNgKqc7QiGRuWuxr82bG2q7dF5xCD".to_owned(),
);
let cids: Vec<Rc<CidRef>> = vec!["bagaaieraazcwm4lxybe4pwlisvcgpv4mii63nxouogvf4ihkmz762mnhea7a".into()];
let cids: Vec<Rc<CidRef>> = vec!["bagaaihra7fcndppbd44kltfjcy6ihc4fmxepwt256vswc7x2qqgznazx3j3a".into()];
let expected = PreparationError::DataSignatureCheckError(verification::DataVerifierError::SignatureMismatch {
error: nested_error.into(),
cids,

View File

@ -94,7 +94,7 @@ fn test_attack_replace_value() {
&res,
PreparationError::CidStoreVerificationError(CidStoreVerificationError::MismatchError {
type_name: "serde_json::value::Value",
cid_repr: "bagaaierabjifaczkgq2745dsq57lelki2r5cfduunmfzsgvxiavi2ahwwmwq".into(),
cid_repr: "bagaaihrayhxgqijfajraxivb7hxwshhbsdqk4j5zyqypb54zggmn5v7mmwxq".into(),
})
);
}
@ -167,7 +167,7 @@ fn test_attack_replace_tetraplet() {
&res,
PreparationError::CidStoreVerificationError(CidStoreVerificationError::MismatchError {
type_name: "marine_call_parameters::SecurityTetraplet",
cid_repr: "bagaaierapisclqfeq36psuo6uxiazvcash32pndayqlwxrqchii2ykxerfba".into(),
cid_repr: "bagaaihraqlxlbr5q54odmlqwrzpw4smuxzzqbrfas6c7ajhb73samtrjkkva".into(),
})
);
}
@ -247,7 +247,7 @@ fn test_attack_replace_call_result() {
&res,
PreparationError::CidStoreVerificationError(CidStoreVerificationError::MismatchError {
type_name: "air_interpreter_data::executed_state::ServiceResultCidAggregate",
cid_repr: "bagaaierarbji6ebokx3pantdp6xg2l57bhdj7pmlydwe2wnbd6fdkatg7xka".into(),
cid_repr: "bagaaihrai3ii6rephch2kv2efkbolmhfjvpj2w3fyr2tj6lavd4yiloy2ybq".into(),
})
);
}
@ -334,7 +334,7 @@ fn test_attack_replace_canon_value() {
&res,
PreparationError::CidStoreVerificationError(CidStoreVerificationError::MismatchError {
type_name: "air_interpreter_data::executed_state::CanonCidAggregate",
cid_repr: "bagaaierayrb7yu6tvdofr3d7tvuzx7fb3uve27rqty4ckzy7ox66oicuhjjq".into(),
cid_repr: "bagaaihram3i44lmbxmukumwohtp2dkocgdqjwzixddzxjmzlvhea7aid5l7q".into(),
})
);
}
@ -430,7 +430,7 @@ fn test_attack_replace_canon_result_values() {
&res,
PreparationError::CidStoreVerificationError(CidStoreVerificationError::MismatchError {
type_name: "air_interpreter_data::executed_state::CanonResultCidAggregate",
cid_repr: "bagaaieratezrhuyz2eprlmiidxywv6ir2tmswlxycad37noykg3p5oxhs5tq".into(),
cid_repr: "bagaaihrar7xfyl5usjhn5s6xisvwkh55zyq5lvjnwr6j5j3yjutf55aowqea".into(),
})
);
}
@ -530,7 +530,7 @@ fn test_attack_replace_canon_result_tetraplet() {
&res,
PreparationError::CidStoreVerificationError(CidStoreVerificationError::MismatchError {
type_name: "air_interpreter_data::executed_state::CanonResultCidAggregate",
cid_repr: "bagaaieratezrhuyz2eprlmiidxywv6ir2tmswlxycad37noykg3p5oxhs5tq".into(),
cid_repr: "bagaaihrar7xfyl5usjhn5s6xisvwkh55zyq5lvjnwr6j5j3yjutf55aowqea".into(),
})
);
}

View File

@ -67,8 +67,8 @@ fn test_runtime_executed_call_argument_hash() {
&bob_res,
UncatchableError::InstructionParametersMismatch {
param: "call argument_hash",
expected_value: "bagaaieraxbvr5ii3fajw7zjcjoor4maxw7x3ndkpvyfzbreubyga7cntsb5a".to_owned(),
stored_value: "bagaaieralq23ubl3bxyggvynq44g6p5233fla7hrr2jrspeamml4zu2iapvq".to_owned(),
expected_value: "bagaaihraryhzxrhasfve7jwovrl4rb4j45lljt5prmoci34y3i6qx7joxy2a".to_owned(),
stored_value: "bagaaihra7w4yil3eqnjimo4d3yp4kr2yra2o6svycab67oymtseafak4la6a".to_owned(),
}
);
}
@ -191,8 +191,8 @@ fn test_runtime_executed_failed_argument_hash() {
param: "call argument_hash",
// please note that order is important here: if values are swapped, then the error is
// handled by Executed branch, not Failed branch
expected_value: "bagaaieraxbvr5ii3fajw7zjcjoor4maxw7x3ndkpvyfzbreubyga7cntsb5a".to_owned(),
stored_value: "bagaaieralq23ubl3bxyggvynq44g6p5233fla7hrr2jrspeamml4zu2iapvq".to_owned(),
expected_value: "bagaaihraryhzxrhasfve7jwovrl4rb4j45lljt5prmoci34y3i6qx7joxy2a".to_owned(),
stored_value: "bagaaihra7w4yil3eqnjimo4d3yp4kr2yra2o6svycab67oymtseafak4la6a".to_owned(),
}
);
}

View File

@ -17,7 +17,6 @@
use air::interpreter_data::ExecutedState;
use air::ExecutionCidState;
use air::UncatchableError::*;
use air_interpreter_cid::CID;
use air_interpreter_data::ValueRef;
use air_test_framework::AirScriptExecutor;
use air_test_utils::prelude::*;
@ -83,10 +82,11 @@ fn call_result_not_correspond_to_instr() {
let scalar_value = 42;
let wrong_trace = vec![scalar!(scalar_value)];
let cid = extract_service_result_cid(&wrong_trace[0]);
let data = raw_data_from_trace(wrong_trace, <_>::default());
let result = peer_vm_1.call(script, "", data, <_>::default()).unwrap();
let value_ref = ValueRef::Scalar(CID::new("bagaaierax2kxw256denmh2rmtot4cnuvz7wrf6e2l7jnxhtv3qb6xvqj2vhq").into());
let value_ref = ValueRef::Scalar(cid);
let expected_error = CallResultNotCorrespondToInstr(value_ref);
assert!(check_error(&result, expected_error), "{:?}", result);
}
@ -123,10 +123,11 @@ fn value_for_cid_not_found() {
);
let wrong_trace = vec![scalar!(42)];
let cid = extract_service_result_cid(&wrong_trace[0]);
let data = raw_data_from_trace(wrong_trace, <_>::default());
let result = peer_vm_1.call(script, "", data, <_>::default()).unwrap();
let missing_cid = "bagaaierax2kxw256denmh2rmtot4cnuvz7wrf6e2l7jnxhtv3qb6xvqj2vhq".into();
let missing_cid = cid.get_inner();
let expected_error = ValueForCidNotFound("service result aggregate", missing_cid);
assert!(check_error(&result, expected_error));
}
@ -143,7 +144,7 @@ fn malformed_call_service_failed() {
let tetraplet_cid = cid_state.tetraplet_tracker.track_value(tetraplet).unwrap();
let service_result_agg = ServiceResultCidAggregate {
value_cid,
argument_hash: "bagaaieraj5j43immfovaya2uxnpzupwl4xwrfk2nryi3vbz4f4irmeqcxfcq".into(),
argument_hash: "bagaaihra2u6rrqrsclvhwyyalff3rg6omaqy63x7foowfc4myqwt46n32wvq".into(),
tetraplet_cid,
};
let service_result_agg_cid = cid_state

View File

@ -1505,21 +1505,21 @@
"stats": {
"air::runner::execute_air": {
"common_prefix": "air",
"duration": "8.66ms",
"duration": "8.70ms",
"nested": {
"preparation_step::preparation::parse_data": {
"common_prefix": "air_interpreter_data::interpreter_data::serde_json",
"duration": "4.81ms",
"duration": "4.88ms",
"nested": {
"from_slice": "4.76ms"
"from_slice": "4.83ms"
}
},
"preparation_step::preparation::prepare": {
"common_prefix": "",
"duration": "171.00µs",
"duration": "170.00µs",
"nested": {
"air::preparation_step::preparation::make_exec_ctx": "13.00µs",
"air_parser::parser::air_parser::parse": "31.00µs"
"air::preparation_step::preparation::make_exec_ctx": "18.00µs",
"air_parser::parser::air_parser::parse": "28.00µs"
}
},
"runner::execute": "12.00µs",
@ -1531,23 +1531,23 @@
"common_prefix": "air::farewell_step::outcome",
"duration": "3.28ms",
"nested": {
"populate_outcome_from_contexts": "3.25ms"
"populate_outcome_from_contexts": "3.24ms"
}
}
}
},
"signing_step::sign_produced_cids": "101.00µs",
"signing_step::sign_produced_cids": "102.00µs",
"verification_step::verify": {
"common_prefix": "air_interpreter_data::cid_info",
"duration": "83.00µs",
"duration": "79.00µs",
"nested": {
"verify": "12.00µs"
"verify": "10.00µs"
}
}
}
}
},
"total_time": "8.66ms"
"total_time": "8.70ms"
},
"dashboard": {
"comment": "big dashboard test",
@ -1558,55 +1558,55 @@
"stats": {
"air::runner::execute_air": {
"common_prefix": "air",
"duration": "6.70ms",
"duration": "6.55ms",
"nested": {
"preparation_step::preparation::parse_data": {
"common_prefix": "air_interpreter_data::interpreter_data::serde_json",
"duration": "999.00µs",
"duration": "1.00ms",
"nested": {
"from_slice": "941.00µs"
"from_slice": "946.00µs"
}
},
"preparation_step::preparation::prepare": {
"common_prefix": "",
"duration": "317.00µs",
"duration": "314.00µs",
"nested": {
"air::preparation_step::preparation::make_exec_ctx": "32.00µs",
"air_parser::parser::air_parser::parse": "162.00µs"
"air::preparation_step::preparation::make_exec_ctx": "34.00µs",
"air_parser::parser::air_parser::parse": "160.00µs"
}
},
"runner::execute": {
"common_prefix": "air::execution_step::instructions::call::resolved_call::serde_json",
"duration": "1.69ms",
"duration": "1.63ms",
"nested": {
"to_string(tetraplets)": "360.00µs"
"to_string(tetraplets)": "350.00µs"
}
},
"runner::farewell": {
"common_prefix": "air::farewell_step::outcome",
"duration": "459.00µs",
"duration": "460.00µs",
"nested": {
"from_success_result": {
"common_prefix": "air::farewell_step::outcome",
"duration": "439.00µs",
"duration": "440.00µs",
"nested": {
"populate_outcome_from_contexts": "397.00µs"
"populate_outcome_from_contexts": "393.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": "2.96ms",
"duration": "2.88ms",
"nested": {
"verify": "214.00µs"
"verify": "161.00µs"
}
}
}
}
},
"total_time": "6.70ms"
"total_time": "6.55ms"
},
"long_data": {
"comment": "Long data trace",
@ -1617,49 +1617,49 @@
"stats": {
"air::runner::execute_air": {
"common_prefix": "air",
"duration": "3.69ms",
"duration": "3.64ms",
"nested": {
"preparation_step::preparation::parse_data": {
"common_prefix": "air_interpreter_data::interpreter_data::serde_json",
"duration": "1.76ms",
"duration": "1.75ms",
"nested": {
"from_slice": "1.71ms"
}
},
"preparation_step::preparation::prepare": {
"common_prefix": "",
"duration": "171.00µs",
"duration": "166.00µs",
"nested": {
"air::preparation_step::preparation::make_exec_ctx": "14.00µs",
"air_parser::parser::air_parser::parse": "31.00µs"
"air::preparation_step::preparation::make_exec_ctx": "17.00µs",
"air_parser::parser::air_parser::parse": "26.00µs"
}
},
"runner::execute": "12.00µs",
"runner::farewell": {
"common_prefix": "air::farewell_step::outcome",
"duration": "930.00µs",
"duration": "929.00µs",
"nested": {
"from_success_result": {
"common_prefix": "air::farewell_step::outcome",
"duration": "910.00µs",
"nested": {
"populate_outcome_from_contexts": "870.00µs"
"populate_outcome_from_contexts": "871.00µs"
}
}
}
},
"signing_step::sign_produced_cids": "100.00µs",
"signing_step::sign_produced_cids": "102.00µs",
"verification_step::verify": {
"common_prefix": "air_interpreter_data::cid_info",
"duration": "530.00µs",
"duration": "522.00µs",
"nested": {
"verify": "12.00µs"
"verify": "10.00µs"
}
}
}
}
},
"total_time": "3.69ms"
"total_time": "3.64ms"
},
"multiple-cids10": {
"comment": "verifying multiple CIDs for single peer",
@ -1991,55 +1991,55 @@
"stats": {
"air::runner::execute_air": {
"common_prefix": "air",
"duration": "9.95ms",
"duration": "9.48ms",
"nested": {
"preparation_step::preparation::parse_data": {
"common_prefix": "air_interpreter_data::interpreter_data::serde_json",
"duration": "1.37ms",
"duration": "1.36ms",
"nested": {
"from_slice": "1.31ms"
}
},
"preparation_step::preparation::prepare": {
"common_prefix": "",
"duration": "256.00µs",
"duration": "254.00µs",
"nested": {
"air::preparation_step::preparation::make_exec_ctx": "71.00µs",
"air::preparation_step::preparation::make_exec_ctx": "72.00µs",
"air_parser::parser::air_parser::parse": "62.00µs"
}
},
"runner::execute": {
"common_prefix": "air::execution_step::instructions::call::resolved_call::serde_json",
"duration": "2.86ms",
"duration": "2.72ms",
"nested": {
"to_string(tetraplets)": "11.00µs"
"to_string(tetraplets)": "10.00µs"
}
},
"runner::farewell": {
"common_prefix": "air::farewell_step::outcome",
"duration": "904.00µs",
"duration": "915.00µs",
"nested": {
"from_success_result": {
"common_prefix": "air::farewell_step::outcome",
"duration": "884.00µs",
"duration": "896.00µs",
"nested": {
"populate_outcome_from_contexts": "785.00µs"
"populate_outcome_from_contexts": "788.00µs"
}
}
}
},
"signing_step::sign_produced_cids": "98.00µs",
"signing_step::sign_produced_cids": "102.00µs",
"verification_step::verify": {
"common_prefix": "air_interpreter_data::cid_info",
"duration": "4.28ms",
"duration": "3.97ms",
"nested": {
"verify": "1.01ms"
"verify": "762.00µs"
}
}
}
}
},
"total_time": "9.95ms"
"total_time": "9.48ms"
},
"multiple-sigs10": {
"comment": "signing multiple CIDs",
@ -2177,49 +2177,49 @@
"stats": {
"air::runner::execute_air": {
"common_prefix": "air",
"duration": "18.97ms",
"duration": "17.29ms",
"nested": {
"preparation_step::preparation::parse_data": {
"common_prefix": "air_interpreter_data::interpreter_data::serde_json",
"duration": "3.93ms",
"duration": "3.90ms",
"nested": {
"from_slice": "3.87ms"
"from_slice": "3.85ms"
}
},
"preparation_step::preparation::prepare": {
"common_prefix": "",
"duration": "333.00µs",
"duration": "332.00µs",
"nested": {
"air::preparation_step::preparation::make_exec_ctx": "148.00µs",
"air_parser::parser::air_parser::parse": "62.00µs"
"air::preparation_step::preparation::make_exec_ctx": "152.00µs",
"air_parser::parser::air_parser::parse": "61.00µs"
}
},
"runner::execute": "8.09ms",
"runner::execute": "6.87ms",
"runner::farewell": {
"common_prefix": "air::farewell_step::outcome",
"duration": "2.56ms",
"duration": "2.57ms",
"nested": {
"from_success_result": {
"common_prefix": "air::farewell_step::outcome",
"duration": "2.53ms",
"duration": "2.54ms",
"nested": {
"populate_outcome_from_contexts": "2.36ms"
}
}
}
},
"signing_step::sign_produced_cids": "436.00µs",
"signing_step::sign_produced_cids": "442.00µs",
"verification_step::verify": {
"common_prefix": "air_interpreter_data::cid_info",
"duration": "3.42ms",
"duration": "2.99ms",
"nested": {
"verify": "1.73ms"
"verify": "1.30ms"
}
}
}
}
},
"total_time": "18.97ms"
"total_time": "17.29ms"
},
"multiple-sigs50": {
"comment": "signing multiple CIDs",
@ -2283,55 +2283,55 @@
"stats": {
"air::runner::execute_air": {
"common_prefix": "air",
"duration": "3.17ms",
"duration": "3.06ms",
"nested": {
"preparation_step::preparation::parse_data": {
"common_prefix": "air_interpreter_data::interpreter_data::serde_json",
"duration": "494.00µs",
"duration": "484.00µs",
"nested": {
"from_slice": "437.00µs"
"from_slice": "428.00µs"
}
},
"preparation_step::preparation::prepare": {
"common_prefix": "",
"duration": "219.00µs",
"duration": "220.00µs",
"nested": {
"air::preparation_step::preparation::make_exec_ctx": "19.00µs",
"air::preparation_step::preparation::make_exec_ctx": "22.00µs",
"air_parser::parser::air_parser::parse": "76.00µs"
}
},
"runner::execute": {
"common_prefix": "air::execution_step::instructions::call::resolved_call::serde_json",
"duration": "171.00µs",
"duration": "162.00µs",
"nested": {
"to_string(tetraplets)": "10.00µs"
"to_string(tetraplets)": "13.00µs"
}
},
"runner::farewell": {
"common_prefix": "air::farewell_step::outcome",
"duration": "255.00µs",
"duration": "256.00µs",
"nested": {
"from_success_result": {
"common_prefix": "air::farewell_step::outcome",
"duration": "235.00µs",
"duration": "236.00µs",
"nested": {
"populate_outcome_from_contexts": "198.00µs"
"populate_outcome_from_contexts": "194.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": "1.74ms",
"duration": "1.69ms",
"nested": {
"verify": "79.00µs"
"verify": "67.00µs"
}
}
}
}
},
"total_time": "3.17ms"
"total_time": "3.06ms"
},
"network_explore": {
"comment": "5 peers of network are discovered",
@ -2427,18 +2427,18 @@
"stats": {
"air::runner::execute_air": {
"common_prefix": "air",
"duration": "745.00µs",
"duration": "725.00µs",
"nested": {
"preparation_step::preparation::parse_data": "24.00µs",
"preparation_step::preparation::parse_data": "29.00µs",
"preparation_step::preparation::prepare": {
"common_prefix": "",
"duration": "185.00µs",
"duration": "179.00µs",
"nested": {
"air::preparation_step::preparation::make_exec_ctx": "14.00µs",
"air::preparation_step::preparation::make_exec_ctx": "19.00µs",
"air_parser::parser::air_parser::parse": "33.00µs"
}
},
"runner::execute": "12.00µs",
"runner::execute": "11.00µs",
"runner::farewell": {
"common_prefix": "air::farewell_step::outcome",
"duration": "180.00µs",
@ -2447,15 +2447,15 @@
"common_prefix": "air::farewell_step::outcome",
"duration": "160.00µs",
"nested": {
"populate_outcome_from_contexts": "124.00µs"
"populate_outcome_from_contexts": "123.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": "40.00µs",
"duration": "45.00µs",
"nested": {
"verify": "12.00µs"
}
@ -2463,7 +2463,7 @@
}
}
},
"total_time": "745.00µs"
"total_time": "725.00µs"
},
"parser_10000_100": {
"comment": "Running very long AIR script with lot of variables and assignments",
@ -2474,35 +2474,35 @@
"stats": {
"air::runner::execute_air": {
"common_prefix": "air",
"duration": "23.63ms",
"duration": "23.33ms",
"nested": {
"preparation_step::preparation::parse_data": "26.00µs",
"preparation_step::preparation::parse_data": "28.00µs",
"preparation_step::preparation::prepare": {
"common_prefix": "",
"duration": "21.95ms",
"duration": "21.73ms",
"nested": {
"air::preparation_step::preparation::make_exec_ctx": "14.00µs",
"air_parser::parser::air_parser::parse": "21.81ms"
"air::preparation_step::preparation::make_exec_ctx": "18.00µs",
"air_parser::parser::air_parser::parse": "21.55ms"
}
},
"runner::execute": "57.00µs",
"runner::execute": "54.00µs",
"runner::farewell": {
"common_prefix": "air::farewell_step::outcome",
"duration": "177.00µs",
"duration": "179.00µs",
"nested": {
"from_success_result": {
"common_prefix": "air::farewell_step::outcome",
"duration": "157.00µs",
"duration": "160.00µs",
"nested": {
"populate_outcome_from_contexts": "125.00µs"
"populate_outcome_from_contexts": "122.00µs"
}
}
}
},
"signing_step::sign_produced_cids": "105.00µs",
"signing_step::sign_produced_cids": "113.00µs",
"verification_step::verify": {
"common_prefix": "air_interpreter_data::cid_info",
"duration": "39.00µs",
"duration": "44.00µs",
"nested": {
"verify": "12.00µs"
}
@ -2510,10 +2510,10 @@
}
}
},
"total_time": "23.63ms"
"total_time": "23.33ms"
}
},
"datetime": "2023-10-20 11:40:35.157398+00:00",
"datetime": "2023-10-20 13:46:12.008371+00:00",
"features": "check_signatures,gen_signatures",
"platform": "macOS-14.0-arm64-arm-64bit",
"version": "0.53.0"
@ -2529,49 +2529,49 @@
"stats": {
"air::runner::execute_air": {
"common_prefix": "air",
"duration": "12.11ms",
"duration": "11.90ms",
"nested": {
"preparation_step::preparation::parse_data": {
"common_prefix": "air_interpreter_data::interpreter_data::serde_json",
"duration": "6.80ms",
"duration": "6.61ms",
"nested": {
"from_slice": "6.74ms"
"from_slice": "6.55ms"
}
},
"preparation_step::preparation::prepare": {
"common_prefix": "",
"duration": "226.00µs",
"duration": "221.00µs",
"nested": {
"air::preparation_step::preparation::make_exec_ctx": "16.00µs",
"air_parser::parser::air_parser::parse": "20.00µs"
"air::preparation_step::preparation::make_exec_ctx": "18.00µs",
"air_parser::parser::air_parser::parse": "19.00µs"
}
},
"runner::execute": "10.00µs",
"runner::farewell": {
"common_prefix": "air::farewell_step::outcome",
"duration": "4.70ms",
"duration": "4.68ms",
"nested": {
"from_success_result": {
"common_prefix": "air::farewell_step::outcome",
"duration": "4.68ms",
"duration": "4.66ms",
"nested": {
"populate_outcome_from_contexts": "4.62ms"
"populate_outcome_from_contexts": "4.60ms"
}
}
}
},
"signing_step::sign_produced_cids": "161.00µs",
"signing_step::sign_produced_cids": "159.00µs",
"verification_step::verify": {
"common_prefix": "air_interpreter_data::cid_info",
"duration": "88.00µs",
"duration": "86.00µs",
"nested": {
"verify": "12.00µs"
"verify": "11.00µs"
}
}
}
}
},
"total_time": "12.11ms"
"total_time": "11.90ms"
},
"dashboard": {
"comment": "big dashboard test",
@ -2582,18 +2582,18 @@
"stats": {
"air::runner::execute_air": {
"common_prefix": "air",
"duration": "9.52ms",
"duration": "9.39ms",
"nested": {
"preparation_step::preparation::parse_data": {
"common_prefix": "air_interpreter_data::interpreter_data::serde_json",
"duration": "1.26ms",
"duration": "1.28ms",
"nested": {
"from_slice": "1.21ms"
"from_slice": "1.22ms"
}
},
"preparation_step::preparation::prepare": {
"common_prefix": "",
"duration": "354.00µs",
"duration": "351.00µs",
"nested": {
"air::preparation_step::preparation::make_exec_ctx": "41.00µs",
"air_parser::parser::air_parser::parse": "132.00µs"
@ -2601,36 +2601,36 @@
},
"runner::execute": {
"common_prefix": "air::execution_step::instructions::call::resolved_call::serde_json",
"duration": "2.27ms",
"duration": "2.22ms",
"nested": {
"to_string(tetraplets)": "449.00µs"
"to_string(tetraplets)": "448.00µs"
}
},
"runner::farewell": {
"common_prefix": "air::farewell_step::outcome",
"duration": "672.00µs",
"duration": "679.00µs",
"nested": {
"from_success_result": {
"common_prefix": "air::farewell_step::outcome",
"duration": "651.00µs",
"duration": "657.00µs",
"nested": {
"populate_outcome_from_contexts": "601.00µs"
"populate_outcome_from_contexts": "606.00µs"
}
}
}
},
"signing_step::sign_produced_cids": "163.00µs",
"signing_step::sign_produced_cids": "161.00µs",
"verification_step::verify": {
"common_prefix": "air_interpreter_data::cid_info",
"duration": "4.66ms",
"duration": "4.57ms",
"nested": {
"verify": "267.00µs"
"verify": "209.00µs"
}
}
}
}
},
"total_time": "9.52ms"
"total_time": "9.39ms"
},
"long_data": {
"comment": "Long data trace",
@ -2641,13 +2641,13 @@
"stats": {
"air::runner::execute_air": {
"common_prefix": "air",
"duration": "4.57ms",
"duration": "4.62ms",
"nested": {
"preparation_step::preparation::parse_data": {
"common_prefix": "air_interpreter_data::interpreter_data::serde_json",
"duration": "2.27ms",
"duration": "2.28ms",
"nested": {
"from_slice": "2.23ms"
"from_slice": "2.24ms"
}
},
"preparation_step::preparation::prepare": {
@ -2655,13 +2655,13 @@
"duration": "216.00µs",
"nested": {
"air::preparation_step::preparation::make_exec_ctx": "16.00µs",
"air_parser::parser::air_parser::parse": "18.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": "1.13ms",
"duration": "1.14ms",
"nested": {
"from_success_result": {
"common_prefix": "air::farewell_step::outcome",
@ -2675,7 +2675,7 @@
"signing_step::sign_produced_cids": "158.00µs",
"verification_step::verify": {
"common_prefix": "air_interpreter_data::cid_info",
"duration": "662.00µs",
"duration": "686.00µs",
"nested": {
"verify": "11.00µs"
}
@ -2683,7 +2683,7 @@
}
}
},
"total_time": "4.57ms"
"total_time": "4.62ms"
},
"multiple-cids10": {
"comment": "verifying multiple CIDs for single peer",
@ -3008,55 +3008,55 @@
"stats": {
"air::runner::execute_air": {
"common_prefix": "air",
"duration": "14.36ms",
"duration": "13.55ms",
"nested": {
"preparation_step::preparation::parse_data": {
"common_prefix": "air_interpreter_data::interpreter_data::serde_json",
"duration": "1.74ms",
"duration": "1.72ms",
"nested": {
"from_slice": "1.68ms"
"from_slice": "1.66ms"
}
},
"preparation_step::preparation::prepare": {
"common_prefix": "",
"duration": "333.00µs",
"duration": "332.00µs",
"nested": {
"air::preparation_step::preparation::make_exec_ctx": "102.00µs",
"air_parser::parser::air_parser::parse": "50.00µs"
"air_parser::parser::air_parser::parse": "51.00µs"
}
},
"runner::execute": {
"common_prefix": "air::execution_step::instructions::call::resolved_call::serde_json",
"duration": "3.96ms",
"duration": "3.62ms",
"nested": {
"to_string(tetraplets)": "15.00µs"
"to_string(tetraplets)": "16.00µs"
}
},
"runner::farewell": {
"common_prefix": "air::farewell_step::outcome",
"duration": "1.30ms",
"duration": "1.31ms",
"nested": {
"from_success_result": {
"common_prefix": "air::farewell_step::outcome",
"duration": "1.28ms",
"nested": {
"populate_outcome_from_contexts": "1.16ms"
"populate_outcome_from_contexts": "1.17ms"
}
}
}
},
"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": "6.74ms",
"duration": "6.26ms",
"nested": {
"verify": "1.45ms"
"verify": "1.11ms"
}
}
}
}
},
"total_time": "14.36ms"
"total_time": "13.55ms"
},
"multiple-sigs200": {
"comment": "signing multiple CIDs",
@ -3141,49 +3141,49 @@
"stats": {
"air::runner::execute_air": {
"common_prefix": "air",
"duration": "26.89ms",
"duration": "24.47ms",
"nested": {
"preparation_step::preparation::parse_data": {
"common_prefix": "air_interpreter_data::interpreter_data::serde_json",
"duration": "5.04ms",
"duration": "4.91ms",
"nested": {
"from_slice": "4.99ms"
"from_slice": "4.85ms"
}
},
"preparation_step::preparation::prepare": {
"common_prefix": "",
"duration": "454.00µs",
"duration": "441.00µs",
"nested": {
"air::preparation_step::preparation::make_exec_ctx": "219.00µs",
"air_parser::parser::air_parser::parse": "50.00µs"
"air::preparation_step::preparation::make_exec_ctx": "215.00µs",
"air_parser::parser::air_parser::parse": "49.00µs"
}
},
"runner::execute": "11.80ms",
"runner::execute": "10.13ms",
"runner::farewell": {
"common_prefix": "air::farewell_step::outcome",
"duration": "3.74ms",
"duration": "3.75ms",
"nested": {
"from_success_result": {
"common_prefix": "air::farewell_step::outcome",
"duration": "3.71ms",
"duration": "3.73ms",
"nested": {
"populate_outcome_from_contexts": "3.54ms"
"populate_outcome_from_contexts": "3.55ms"
}
}
}
},
"signing_step::sign_produced_cids": "678.00µs",
"signing_step::sign_produced_cids": "674.00µs",
"verification_step::verify": {
"common_prefix": "air_interpreter_data::cid_info",
"duration": "5.03ms",
"duration": "4.45ms",
"nested": {
"verify": "2.50ms"
"verify": "1.94ms"
}
}
}
}
},
"total_time": "26.89ms"
"total_time": "24.47ms"
},
"multiple-sigs50": {
"comment": "signing multiple CIDs",
@ -3268,55 +3268,55 @@
"stats": {
"air::runner::execute_air": {
"common_prefix": "air",
"duration": "4.43ms",
"duration": "4.36ms",
"nested": {
"preparation_step::preparation::parse_data": {
"common_prefix": "air_interpreter_data::interpreter_data::serde_json",
"duration": "572.00µs",
"duration": "575.00µs",
"nested": {
"from_slice": "519.00µs"
"from_slice": "520.00µs"
}
},
"preparation_step::preparation::prepare": {
"common_prefix": "",
"duration": "268.00µs",
"duration": "264.00µs",
"nested": {
"air::preparation_step::preparation::make_exec_ctx": "23.00µs",
"air_parser::parser::air_parser::parse": "67.00µs"
"air_parser::parser::air_parser::parse": "66.00µs"
}
},
"runner::execute": {
"common_prefix": "air::execution_step::instructions::call::resolved_call::serde_json",
"duration": "190.00µs",
"duration": "188.00µs",
"nested": {
"to_string(tetraplets)": "13.00µs"
"to_string(tetraplets)": "17.00µs"
}
},
"runner::farewell": {
"common_prefix": "air::farewell_step::outcome",
"duration": "366.00µs",
"duration": "361.00µs",
"nested": {
"from_success_result": {
"common_prefix": "air::farewell_step::outcome",
"duration": "344.00µs",
"duration": "340.00µs",
"nested": {
"populate_outcome_from_contexts": "301.00µs"
"populate_outcome_from_contexts": "298.00µs"
}
}
}
},
"signing_step::sign_produced_cids": "162.00µs",
"signing_step::sign_produced_cids": "160.00µs",
"verification_step::verify": {
"common_prefix": "air_interpreter_data::cid_info",
"duration": "2.75ms",
"duration": "2.68ms",
"nested": {
"verify": "79.00µs"
"verify": "65.00µs"
}
}
}
}
},
"total_time": "4.43ms"
"total_time": "4.36ms"
},
"null": {
"comment": "Empty data and null script",
@ -3327,43 +3327,43 @@
"stats": {
"air::runner::execute_air": {
"common_prefix": "air",
"duration": "848.00µs",
"duration": "828.00µs",
"nested": {
"preparation_step::preparation::parse_data": "18.00µs",
"preparation_step::preparation::prepare": {
"common_prefix": "",
"duration": "224.00µs",
"duration": "219.00µs",
"nested": {
"air::preparation_step::preparation::make_exec_ctx": "17.00µs",
"air::preparation_step::preparation::make_exec_ctx": "16.00µs",
"air_parser::parser::air_parser::parse": "19.00µs"
}
},
"runner::execute": "10.00µs",
"runner::farewell": {
"common_prefix": "air::farewell_step::outcome",
"duration": "257.00µs",
"duration": "249.00µs",
"nested": {
"from_success_result": {
"common_prefix": "air::farewell_step::outcome",
"duration": "234.00µs",
"duration": "227.00µs",
"nested": {
"populate_outcome_from_contexts": "194.00µs"
"populate_outcome_from_contexts": "188.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": "39.00µs",
"duration": "38.00µs",
"nested": {
"verify": "13.00µs"
"verify": "12.00µs"
}
}
}
}
},
"total_time": "848.00µs"
"total_time": "828.00µs"
},
"parser_10000_100": {
"comment": "Running very long AIR script with lot of variables and assignments",
@ -3374,46 +3374,46 @@
"stats": {
"air::runner::execute_air": {
"common_prefix": "air",
"duration": "30.20ms",
"duration": "29.93ms",
"nested": {
"preparation_step::preparation::parse_data": "16.00µs",
"preparation_step::preparation::parse_data": "20.00µs",
"preparation_step::preparation::prepare": {
"common_prefix": "",
"duration": "28.48ms",
"duration": "28.24ms",
"nested": {
"air::preparation_step::preparation::make_exec_ctx": "17.00µs",
"air_parser::parser::air_parser::parse": "28.28ms"
"air::preparation_step::preparation::make_exec_ctx": "18.00µs",
"air_parser::parser::air_parser::parse": "27.98ms"
}
},
"runner::execute": "30.00µs",
"runner::farewell": {
"common_prefix": "air::farewell_step::outcome",
"duration": "254.00µs",
"duration": "258.00µs",
"nested": {
"from_success_result": {
"common_prefix": "air::farewell_step::outcome",
"duration": "232.00µs",
"duration": "236.00µs",
"nested": {
"populate_outcome_from_contexts": "194.00µs"
"populate_outcome_from_contexts": "196.00µs"
}
}
}
},
"signing_step::sign_produced_cids": "159.00µs",
"signing_step::sign_produced_cids": "160.00µs",
"verification_step::verify": {
"common_prefix": "air_interpreter_data::cid_info",
"duration": "35.00µs",
"duration": "36.00µs",
"nested": {
"verify": "10.00µs"
"verify": "11.00µs"
}
}
}
}
},
"total_time": "30.20ms"
"total_time": "29.93ms"
}
},
"datetime": "2023-10-20 12:46:01.094988+00:00",
"datetime": "2023-10-20 13:56:40.619386+00:00",
"features": "check_signatures,gen_signatures",
"platform": "Linux-5.15.0-76-generic-x86_64-with-glibc2.29",
"version": "0.53.0"

View File

@ -410,53 +410,53 @@ Machine c1f3ea5950db0a10b44da931c25774d64ab25084f47d504f72f311e694550ff1:
new: 38.00µs
Machine d77ebe8481884bc3b2778c8083f1bf459e548e929edd87041beb14f6b868d35f:
Platform: macOS-14.0-arm64-arm-64bit
Timestamp: 2023-10-20 11:40:35.157398+00:00
Timestamp: 2023-10-20 13:46:12.008371+00:00
AquaVM version: 0.53.0
Benches:
Features: check_signatures,gen_signatures
big_values_data (8.66ms; 58.938 MiB, 58.938 MiB): Loading a trace with huge values
air::runner::execute_air: 8.66ms
preparation_step::preparation::parse_data: 4.81ms
from_slice: 4.76ms
preparation_step::preparation::prepare: 171.00µs
air::preparation_step::preparation::make_exec_ctx: 13.00µs
air_parser::parser::air_parser::parse: 31.00µs
big_values_data (8.70ms; 58.938 MiB, 58.938 MiB): Loading a trace with huge values
air::runner::execute_air: 8.70ms
preparation_step::preparation::parse_data: 4.88ms
from_slice: 4.83ms
preparation_step::preparation::prepare: 170.00µs
air::preparation_step::preparation::make_exec_ctx: 18.00µs
air_parser::parser::air_parser::parse: 28.00µs
runner::execute: 12.00µs
runner::farewell: 3.30ms
from_success_result: 3.28ms
populate_outcome_from_contexts: 3.25ms
signing_step::sign_produced_cids: 101.00µs
verification_step::verify: 83.00µs
verify: 12.00µs
dashboard (6.70ms; 52.625 MiB, 52.625 MiB): big dashboard test
air::runner::execute_air: 6.70ms
preparation_step::preparation::parse_data: 999.00µs
from_slice: 941.00µs
preparation_step::preparation::prepare: 317.00µs
air::preparation_step::preparation::make_exec_ctx: 32.00µs
air_parser::parser::air_parser::parse: 162.00µs
runner::execute: 1.69ms
to_string(tetraplets): 360.00µs
runner::farewell: 459.00µs
from_success_result: 439.00µs
populate_outcome_from_contexts: 397.00µs
signing_step::sign_produced_cids: 99.00µs
verification_step::verify: 2.96ms
verify: 214.00µs
long_data (3.69ms; 53.750 MiB, 53.750 MiB): Long data trace
air::runner::execute_air: 3.69ms
preparation_step::preparation::parse_data: 1.76ms
populate_outcome_from_contexts: 3.24ms
signing_step::sign_produced_cids: 102.00µs
verification_step::verify: 79.00µs
verify: 10.00µs
dashboard (6.55ms; 52.625 MiB, 52.625 MiB): big dashboard test
air::runner::execute_air: 6.55ms
preparation_step::preparation::parse_data: 1.00ms
from_slice: 946.00µs
preparation_step::preparation::prepare: 314.00µs
air::preparation_step::preparation::make_exec_ctx: 34.00µs
air_parser::parser::air_parser::parse: 160.00µs
runner::execute: 1.63ms
to_string(tetraplets): 350.00µs
runner::farewell: 460.00µs
from_success_result: 440.00µs
populate_outcome_from_contexts: 393.00µs
signing_step::sign_produced_cids: 102.00µs
verification_step::verify: 2.88ms
verify: 161.00µs
long_data (3.64ms; 53.750 MiB, 53.750 MiB): Long data trace
air::runner::execute_air: 3.64ms
preparation_step::preparation::parse_data: 1.75ms
from_slice: 1.71ms
preparation_step::preparation::prepare: 171.00µs
air::preparation_step::preparation::make_exec_ctx: 14.00µs
air_parser::parser::air_parser::parse: 31.00µs
preparation_step::preparation::prepare: 166.00µs
air::preparation_step::preparation::make_exec_ctx: 17.00µs
air_parser::parser::air_parser::parse: 26.00µs
runner::execute: 12.00µs
runner::farewell: 930.00µs
runner::farewell: 929.00µs
from_success_result: 910.00µs
populate_outcome_from_contexts: 870.00µs
signing_step::sign_produced_cids: 100.00µs
verification_step::verify: 530.00µs
verify: 12.00µs
populate_outcome_from_contexts: 871.00µs
signing_step::sign_produced_cids: 102.00µs
verification_step::verify: 522.00µs
verify: 10.00µs
multiple-cids10 (2.65ms; 52.438 MiB, 52.438 MiB): verifying multiple CIDs for single peer
air::runner::execute_air: 2.65ms
preparation_step::preparation::parse_data: 427.00µs
@ -538,21 +538,21 @@ Machine d77ebe8481884bc3b2778c8083f1bf459e548e929edd87041beb14f6b868d35f:
signing_step::sign_produced_cids: 109.00µs
verification_step::verify: 2.48ms
verify: 289.00µs
multiple-peers8 (9.95ms; 53.375 MiB, 53.375 MiB): verifying many CIDs for many peers
air::runner::execute_air: 9.95ms
preparation_step::preparation::parse_data: 1.37ms
multiple-peers8 (9.48ms; 53.375 MiB, 53.375 MiB): verifying many CIDs for many peers
air::runner::execute_air: 9.48ms
preparation_step::preparation::parse_data: 1.36ms
from_slice: 1.31ms
preparation_step::preparation::prepare: 256.00µs
air::preparation_step::preparation::make_exec_ctx: 71.00µs
preparation_step::preparation::prepare: 254.00µs
air::preparation_step::preparation::make_exec_ctx: 72.00µs
air_parser::parser::air_parser::parse: 62.00µs
runner::execute: 2.86ms
to_string(tetraplets): 11.00µs
runner::farewell: 904.00µs
from_success_result: 884.00µs
populate_outcome_from_contexts: 785.00µs
signing_step::sign_produced_cids: 98.00µs
verification_step::verify: 4.28ms
verify: 1.01ms
runner::execute: 2.72ms
to_string(tetraplets): 10.00µs
runner::farewell: 915.00µs
from_success_result: 896.00µs
populate_outcome_from_contexts: 788.00µs
signing_step::sign_produced_cids: 102.00µs
verification_step::verify: 3.97ms
verify: 762.00µs
multiple-sigs10 (13.63ms; 52.875 MiB, 52.875 MiB): signing multiple CIDs
air::runner::execute_air: 13.63ms
preparation_step::preparation::parse_data: 653.00µs
@ -587,20 +587,20 @@ Machine d77ebe8481884bc3b2778c8083f1bf459e548e929edd87041beb14f6b868d35f:
signing_step::sign_produced_cids: 22.05ms
verification_step::verify: 153.40ms
verify: 84.07ms
multiple-sigs30 (18.97ms; 56.188 MiB, 56.188 MiB): signing multiple CIDs
air::runner::execute_air: 18.97ms
preparation_step::preparation::parse_data: 3.93ms
from_slice: 3.87ms
preparation_step::preparation::prepare: 333.00µs
air::preparation_step::preparation::make_exec_ctx: 148.00µs
air_parser::parser::air_parser::parse: 62.00µs
runner::execute: 8.09ms
runner::farewell: 2.56ms
from_success_result: 2.53ms
multiple-sigs30 (17.29ms; 56.188 MiB, 56.188 MiB): signing multiple CIDs
air::runner::execute_air: 17.29ms
preparation_step::preparation::parse_data: 3.90ms
from_slice: 3.85ms
preparation_step::preparation::prepare: 332.00µs
air::preparation_step::preparation::make_exec_ctx: 152.00µs
air_parser::parser::air_parser::parse: 61.00µs
runner::execute: 6.87ms
runner::farewell: 2.57ms
from_success_result: 2.54ms
populate_outcome_from_contexts: 2.36ms
signing_step::sign_produced_cids: 436.00µs
verification_step::verify: 3.42ms
verify: 1.73ms
signing_step::sign_produced_cids: 442.00µs
verification_step::verify: 2.99ms
verify: 1.30ms
multiple-sigs50 (49.64ms; 62.625 MiB, 62.625 MiB): signing multiple CIDs
air::runner::execute_air: 49.64ms
preparation_step::preparation::parse_data: 10.52ms
@ -615,21 +615,21 @@ Machine d77ebe8481884bc3b2778c8083f1bf459e548e929edd87041beb14f6b868d35f:
signing_step::sign_produced_cids: 1.23ms
verification_step::verify: 8.51ms
verify: 4.56ms
network-explore (3.17ms; 52.375 MiB, 52.375 MiB): 5 peers of network are discovered
air::runner::execute_air: 3.17ms
preparation_step::preparation::parse_data: 494.00µs
from_slice: 437.00µs
preparation_step::preparation::prepare: 219.00µs
air::preparation_step::preparation::make_exec_ctx: 19.00µs
network-explore (3.06ms; 52.375 MiB, 52.375 MiB): 5 peers of network are discovered
air::runner::execute_air: 3.06ms
preparation_step::preparation::parse_data: 484.00µs
from_slice: 428.00µs
preparation_step::preparation::prepare: 220.00µs
air::preparation_step::preparation::make_exec_ctx: 22.00µs
air_parser::parser::air_parser::parse: 76.00µs
runner::execute: 171.00µs
to_string(tetraplets): 10.00µs
runner::farewell: 255.00µs
from_success_result: 235.00µs
populate_outcome_from_contexts: 198.00µs
signing_step::sign_produced_cids: 99.00µs
verification_step::verify: 1.74ms
verify: 79.00µs
runner::execute: 162.00µs
to_string(tetraplets): 13.00µs
runner::farewell: 256.00µs
from_success_result: 236.00µs
populate_outcome_from_contexts: 194.00µs
signing_step::sign_produced_cids: 101.00µs
verification_step::verify: 1.69ms
verify: 67.00µs
network_explore (5.23ms; 52.500 MiB, 52.500 MiB): 5 peers of network are discovered
air::runner::execute_air: 5.23ms
preparation_step::preparation::parse_data: 480.00µs
@ -651,80 +651,80 @@ Machine d77ebe8481884bc3b2778c8083f1bf459e548e929edd87041beb14f6b868d35f:
signing_step::sign_produced_cids: 112.00µs
verification_step::verify: 1.73ms
verify: 76.00µs
null (745.00µs; 52.375 MiB, 52.375 MiB): Empty data and null script
air::runner::execute_air: 745.00µs
preparation_step::preparation::parse_data: 24.00µs
preparation_step::preparation::prepare: 185.00µs
air::preparation_step::preparation::make_exec_ctx: 14.00µs
null (725.00µs; 52.375 MiB, 52.375 MiB): Empty data and null script
air::runner::execute_air: 725.00µs
preparation_step::preparation::parse_data: 29.00µs
preparation_step::preparation::prepare: 179.00µs
air::preparation_step::preparation::make_exec_ctx: 19.00µs
air_parser::parser::air_parser::parse: 33.00µs
runner::execute: 12.00µs
runner::execute: 11.00µs
runner::farewell: 180.00µs
from_success_result: 160.00µs
populate_outcome_from_contexts: 124.00µs
signing_step::sign_produced_cids: 107.00µs
verification_step::verify: 40.00µs
populate_outcome_from_contexts: 123.00µs
signing_step::sign_produced_cids: 109.00µs
verification_step::verify: 45.00µs
verify: 12.00µs
parser_10000_100 (23.63ms; 57.688 MiB, 57.688 MiB): Running very long AIR script with lot of variables and assignments
air::runner::execute_air: 23.63ms
preparation_step::preparation::parse_data: 26.00µs
preparation_step::preparation::prepare: 21.95ms
air::preparation_step::preparation::make_exec_ctx: 14.00µs
air_parser::parser::air_parser::parse: 21.81ms
runner::execute: 57.00µs
runner::farewell: 177.00µs
from_success_result: 157.00µs
populate_outcome_from_contexts: 125.00µs
signing_step::sign_produced_cids: 105.00µs
verification_step::verify: 39.00µs
parser_10000_100 (23.33ms; 57.688 MiB, 57.688 MiB): Running very long AIR script with lot of variables and assignments
air::runner::execute_air: 23.33ms
preparation_step::preparation::parse_data: 28.00µs
preparation_step::preparation::prepare: 21.73ms
air::preparation_step::preparation::make_exec_ctx: 18.00µs
air_parser::parser::air_parser::parse: 21.55ms
runner::execute: 54.00µs
runner::farewell: 179.00µs
from_success_result: 160.00µs
populate_outcome_from_contexts: 122.00µs
signing_step::sign_produced_cids: 113.00µs
verification_step::verify: 44.00µs
verify: 12.00µs
Machine e536f8eaae8c978493a773ba566ae3393e2e6240d6ea8e05b5ca1b8f77e9c441:
Platform: Linux-5.15.0-76-generic-x86_64-with-glibc2.29
Timestamp: 2023-10-20 12:46:01.094988+00:00
Timestamp: 2023-10-20 13:56:40.619386+00:00
AquaVM version: 0.53.0
Benches:
Features: check_signatures,gen_signatures
big_values_data (12.11ms; 58.938 MiB, 58.938 MiB): Loading a trace with huge values
air::runner::execute_air: 12.11ms
preparation_step::preparation::parse_data: 6.80ms
from_slice: 6.74ms
preparation_step::preparation::prepare: 226.00µs
air::preparation_step::preparation::make_exec_ctx: 16.00µs
air_parser::parser::air_parser::parse: 20.00µs
big_values_data (11.90ms; 58.938 MiB, 58.938 MiB): Loading a trace with huge values
air::runner::execute_air: 11.90ms
preparation_step::preparation::parse_data: 6.61ms
from_slice: 6.55ms
preparation_step::preparation::prepare: 221.00µs
air::preparation_step::preparation::make_exec_ctx: 18.00µs
air_parser::parser::air_parser::parse: 19.00µs
runner::execute: 10.00µs
runner::farewell: 4.70ms
from_success_result: 4.68ms
populate_outcome_from_contexts: 4.62ms
signing_step::sign_produced_cids: 161.00µs
verification_step::verify: 88.00µs
verify: 12.00µs
dashboard (9.52ms; 52.625 MiB, 52.625 MiB): big dashboard test
air::runner::execute_air: 9.52ms
preparation_step::preparation::parse_data: 1.26ms
from_slice: 1.21ms
preparation_step::preparation::prepare: 354.00µs
runner::farewell: 4.68ms
from_success_result: 4.66ms
populate_outcome_from_contexts: 4.60ms
signing_step::sign_produced_cids: 159.00µs
verification_step::verify: 86.00µs
verify: 11.00µs
dashboard (9.39ms; 52.625 MiB, 52.625 MiB): big dashboard test
air::runner::execute_air: 9.39ms
preparation_step::preparation::parse_data: 1.28ms
from_slice: 1.22ms
preparation_step::preparation::prepare: 351.00µs
air::preparation_step::preparation::make_exec_ctx: 41.00µs
air_parser::parser::air_parser::parse: 132.00µs
runner::execute: 2.27ms
to_string(tetraplets): 449.00µs
runner::farewell: 672.00µs
from_success_result: 651.00µs
populate_outcome_from_contexts: 601.00µs
signing_step::sign_produced_cids: 163.00µs
verification_step::verify: 4.66ms
verify: 267.00µs
long_data (4.57ms; 53.750 MiB, 53.750 MiB): Long data trace
air::runner::execute_air: 4.57ms
preparation_step::preparation::parse_data: 2.27ms
from_slice: 2.23ms
runner::execute: 2.22ms
to_string(tetraplets): 448.00µs
runner::farewell: 679.00µs
from_success_result: 657.00µs
populate_outcome_from_contexts: 606.00µs
signing_step::sign_produced_cids: 161.00µs
verification_step::verify: 4.57ms
verify: 209.00µs
long_data (4.62ms; 53.750 MiB, 53.750 MiB): Long data trace
air::runner::execute_air: 4.62ms
preparation_step::preparation::parse_data: 2.28ms
from_slice: 2.24ms
preparation_step::preparation::prepare: 216.00µs
air::preparation_step::preparation::make_exec_ctx: 16.00µs
air_parser::parser::air_parser::parse: 18.00µs
runner::execute: 10.00µs
runner::farewell: 1.13ms
air_parser::parser::air_parser::parse: 19.00µs
runner::execute: 9.00µs
runner::farewell: 1.14ms
from_success_result: 1.11ms
populate_outcome_from_contexts: 1.07ms
signing_step::sign_produced_cids: 158.00µs
verification_step::verify: 662.00µs
verification_step::verify: 686.00µs
verify: 11.00µs
multiple-cids10 (3.42ms; 52.438 MiB, 52.438 MiB): verifying multiple CIDs for single peer
air::runner::execute_air: 3.42ms
@ -804,21 +804,21 @@ Machine e536f8eaae8c978493a773ba566ae3393e2e6240d6ea8e05b5ca1b8f77e9c441:
signing_step::sign_produced_cids: 190.00µs
verification_step::verify: 70.22ms
verify: 44.09ms
multiple-peers8 (14.36ms; 53.375 MiB, 53.375 MiB): verifying many CIDs for many peers
air::runner::execute_air: 14.36ms
preparation_step::preparation::parse_data: 1.74ms
from_slice: 1.68ms
preparation_step::preparation::prepare: 333.00µs
multiple-peers8 (13.55ms; 53.375 MiB, 53.375 MiB): verifying many CIDs for many peers
air::runner::execute_air: 13.55ms
preparation_step::preparation::parse_data: 1.72ms
from_slice: 1.66ms
preparation_step::preparation::prepare: 332.00µs
air::preparation_step::preparation::make_exec_ctx: 102.00µs
air_parser::parser::air_parser::parse: 50.00µs
runner::execute: 3.96ms
to_string(tetraplets): 15.00µs
runner::farewell: 1.30ms
air_parser::parser::air_parser::parse: 51.00µs
runner::execute: 3.62ms
to_string(tetraplets): 16.00µs
runner::farewell: 1.31ms
from_success_result: 1.28ms
populate_outcome_from_contexts: 1.16ms
signing_step::sign_produced_cids: 161.00µs
verification_step::verify: 6.74ms
verify: 1.45ms
populate_outcome_from_contexts: 1.17ms
signing_step::sign_produced_cids: 158.00µs
verification_step::verify: 6.26ms
verify: 1.11ms
multiple-sigs200 (6.04s; 214.375 MiB, 214.375 MiB): signing multiple CIDs
air::runner::execute_air: 6.04s
preparation_step::preparation::parse_data: 219.80ms
@ -839,20 +839,20 @@ Machine e536f8eaae8c978493a773ba566ae3393e2e6240d6ea8e05b5ca1b8f77e9c441:
signing_step::sign_produced_cids: 30.84ms
verification_step::verify: 214.00ms
verify: 119.20ms
multiple-sigs30 (26.89ms; 56.188 MiB, 56.188 MiB): signing multiple CIDs
air::runner::execute_air: 26.89ms
preparation_step::preparation::parse_data: 5.04ms
from_slice: 4.99ms
preparation_step::preparation::prepare: 454.00µs
air::preparation_step::preparation::make_exec_ctx: 219.00µs
air_parser::parser::air_parser::parse: 50.00µs
runner::execute: 11.80ms
runner::farewell: 3.74ms
from_success_result: 3.71ms
populate_outcome_from_contexts: 3.54ms
signing_step::sign_produced_cids: 678.00µs
verification_step::verify: 5.03ms
verify: 2.50ms
multiple-sigs30 (24.47ms; 56.188 MiB, 56.188 MiB): signing multiple CIDs
air::runner::execute_air: 24.47ms
preparation_step::preparation::parse_data: 4.91ms
from_slice: 4.85ms
preparation_step::preparation::prepare: 441.00µs
air::preparation_step::preparation::make_exec_ctx: 215.00µs
air_parser::parser::air_parser::parse: 49.00µs
runner::execute: 10.13ms
runner::farewell: 3.75ms
from_success_result: 3.73ms
populate_outcome_from_contexts: 3.55ms
signing_step::sign_produced_cids: 674.00µs
verification_step::verify: 4.45ms
verify: 1.94ms
multiple-sigs50 (369.10ms; 62.562 MiB, 62.562 MiB): signing multiple CIDs
air::runner::execute_air: 369.10ms
preparation_step::preparation::parse_data: 13.94ms
@ -873,44 +873,44 @@ Machine e536f8eaae8c978493a773ba566ae3393e2e6240d6ea8e05b5ca1b8f77e9c441:
signing_step::sign_produced_cids: 1.77ms
verification_step::verify: 12.49ms
verify: 6.96ms
network-explore (4.43ms; 52.375 MiB, 52.375 MiB): 5 peers of network are discovered
air::runner::execute_air: 4.43ms
preparation_step::preparation::parse_data: 572.00µs
from_slice: 519.00µs
preparation_step::preparation::prepare: 268.00µs
network-explore (4.36ms; 52.375 MiB, 52.375 MiB): 5 peers of network are discovered
air::runner::execute_air: 4.36ms
preparation_step::preparation::parse_data: 575.00µs
from_slice: 520.00µs
preparation_step::preparation::prepare: 264.00µs
air::preparation_step::preparation::make_exec_ctx: 23.00µs
air_parser::parser::air_parser::parse: 67.00µs
runner::execute: 190.00µs
to_string(tetraplets): 13.00µs
runner::farewell: 366.00µs
from_success_result: 344.00µs
populate_outcome_from_contexts: 301.00µs
signing_step::sign_produced_cids: 162.00µs
verification_step::verify: 2.75ms
verify: 79.00µs
null (848.00µs; 52.375 MiB, 52.375 MiB): Empty data and null script
air::runner::execute_air: 848.00µs
air_parser::parser::air_parser::parse: 66.00µs
runner::execute: 188.00µs
to_string(tetraplets): 17.00µs
runner::farewell: 361.00µs
from_success_result: 340.00µs
populate_outcome_from_contexts: 298.00µs
signing_step::sign_produced_cids: 160.00µs
verification_step::verify: 2.68ms
verify: 65.00µs
null (828.00µs; 52.375 MiB, 52.375 MiB): Empty data and null script
air::runner::execute_air: 828.00µs
preparation_step::preparation::parse_data: 18.00µs
preparation_step::preparation::prepare: 224.00µs
air::preparation_step::preparation::make_exec_ctx: 17.00µs
preparation_step::preparation::prepare: 219.00µs
air::preparation_step::preparation::make_exec_ctx: 16.00µs
air_parser::parser::air_parser::parse: 19.00µs
runner::execute: 10.00µs
runner::farewell: 257.00µs
from_success_result: 234.00µs
populate_outcome_from_contexts: 194.00µs
signing_step::sign_produced_cids: 162.00µs
verification_step::verify: 39.00µs
verify: 13.00µs
parser_10000_100 (30.20ms; 57.688 MiB, 57.688 MiB): Running very long AIR script with lot of variables and assignments
air::runner::execute_air: 30.20ms
preparation_step::preparation::parse_data: 16.00µs
preparation_step::preparation::prepare: 28.48ms
air::preparation_step::preparation::make_exec_ctx: 17.00µs
air_parser::parser::air_parser::parse: 28.28ms
runner::farewell: 249.00µs
from_success_result: 227.00µs
populate_outcome_from_contexts: 188.00µs
signing_step::sign_produced_cids: 157.00µs
verification_step::verify: 38.00µs
verify: 12.00µs
parser_10000_100 (29.93ms; 57.688 MiB, 57.688 MiB): Running very long AIR script with lot of variables and assignments
air::runner::execute_air: 29.93ms
preparation_step::preparation::parse_data: 20.00µs
preparation_step::preparation::prepare: 28.24ms
air::preparation_step::preparation::make_exec_ctx: 18.00µs
air_parser::parser::air_parser::parse: 27.98ms
runner::execute: 30.00µs
runner::farewell: 254.00µs
from_success_result: 232.00µs
populate_outcome_from_contexts: 194.00µs
signing_step::sign_produced_cids: 159.00µs
verification_step::verify: 35.00µs
verify: 10.00µs
runner::farewell: 258.00µs
from_success_result: 236.00µs
populate_outcome_from_contexts: 196.00µs
signing_step::sign_produced_cids: 160.00µs
verification_step::verify: 36.00µs
verify: 11.00µs

@ -1 +1 @@
Subproject commit 75306fd8cacd5048dc9012ce032c3f45005ffa5e
Subproject commit 39b6445c0fc9db7ad74e176dbcb54d480279979e

View File

@ -11,8 +11,9 @@ keywords = ["fluence", "air", "programming-language", "cid", "ipld"]
categories = ["wasm"]
[dependencies]
blake3 = "1.5.0"
cid = { version = "0.10.1", default-features = false, features = ["std"] }
multihash = { version = "0.18.1", default-features = false, features = ["multihash-impl", "std", "sha2"] }
multihash = { version = "0.18.1", default-features = false, features = ["multihash-impl", "std", "blake3"] }
serde = { version = "1.0.164", features = ["derive", "rc"] }
serde_json = "1.0.95"
sha2 = "0.10.7"

View File

@ -93,22 +93,6 @@ impl<Val> std::hash::Hash for CID<Val> {
}
}
// TODO we might refactor this to `SerializationFormat` trait
// that both transform data to binary/text form (be it JSON, CBOR or something else)
// and produces CID too
pub fn json_data_cid<Val: ?Sized>(data: &[u8]) -> CID<Val> {
use cid::Cid;
use multihash::{Code, MultihashDigest};
// the Sha2_256 is current IPFS default hash
let digest = Code::Sha2_256.digest(data);
// seems to be better than RAW_CODEC = 0x55
const JSON_CODEC: u64 = 0x0200;
let cid = Cid::new_v1(JSON_CODEC, digest);
CID::new(cid.to_string())
}
pub struct CidCalculationError(serde_json::Error);
impl fmt::Debug for CidCalculationError {
@ -144,14 +128,13 @@ pub fn value_to_json_cid<Val: Serialize + ?Sized>(
) -> Result<CID<Val>, CidCalculationError> {
use cid::Cid;
use multihash::{Code, MultihashDigest};
use sha2::Digest;
let mut hasher = sha2::Sha256::new();
let mut hasher = blake3::Hasher::new();
serde_json::to_writer(BufWriter::with_capacity(8 * 1024, &mut hasher), value)?;
let hash = hasher.finalize();
let digest = Code::Sha2_256
.wrap(&hash)
let digest = Code::Blake3_256
.wrap(hash.as_bytes())
.expect("can't happend: incorrect hash length");
// seems to be better than RAW_CODEC = 0x55
const JSON_CODEC: u64 = 0x0200;

View File

@ -192,22 +192,22 @@ mod tests {
store.into_iter().collect::<HashMap<_, _>>(),
HashMap::from_iter(vec![
(
CID::new("bagaaierajwlhumardpzj6dv2ahcerm3vyfrjwl7nahg7zq5o3eprwv6v3vpa")
CID::new("bagaaihrarcyykpv4oj7zwdbepczyfthxya4og7s2rwvrzolm5kg2eu5dz3xa")
.into(),
json!("test").into()
),
(
CID::new("bagaaierauyk65lxcdxsrphpaqdpiymcszdnjaejyibv2ohbyyaziix35kt2a")
CID::new("bagaaihram6sitn77tquub77n2jzjgttrlwkverv44pv3gns6qghm6hx6d36a")
.into(),
json!([1, 2, 3]).into(),
),
(
CID::new("bagaaieranodle477gt6odhllqbhp6wr7k5d23jhkuixr2soadzjn3n4hlnfq")
CID::new("bagaaihra2y55tkbgv6i4d7vdoglfuzhbd3ra6e7ennpvfrmzaejwmbntusdq")
.into(),
json!(1).into(),
),
(
CID::new("bagaaierad7lci6475zdrps4h6fmcpmqyknz5z6bw6p6tmpjkfyueavqw4kaq")
CID::new("bagaaihracpzxhsrpviexa7k6glwdhyh3a4kvy6j7qlcqokzqbs3q424cmxyq")
.into(),
json!({
"key": 42,
@ -234,7 +234,7 @@ mod tests {
assert_eq!(
&*store
.get(&CID::new(
"bagaaierajwlhumardpzj6dv2ahcerm3vyfrjwl7nahg7zq5o3eprwv6v3vpa"
"bagaaihrarcyykpv4oj7zwdbepczyfthxya4og7s2rwvrzolm5kg2eu5dz3xa"
))
.unwrap(),
&json!("test"),
@ -242,7 +242,7 @@ mod tests {
assert_eq!(
&*store
.get(&CID::new(
"bagaaierauyk65lxcdxsrphpaqdpiymcszdnjaejyibv2ohbyyaziix35kt2a"
"bagaaihram6sitn77tquub77n2jzjgttrlwkverv44pv3gns6qghm6hx6d36a"
))
.unwrap(),
&json!([1, 2, 3]),
@ -250,7 +250,7 @@ mod tests {
assert_eq!(
&*store
.get(&CID::new(
"bagaaieranodle477gt6odhllqbhp6wr7k5d23jhkuixr2soadzjn3n4hlnfq"
"bagaaihra2y55tkbgv6i4d7vdoglfuzhbd3ra6e7ennpvfrmzaejwmbntusdq"
))
.unwrap(),
&json!(1),
@ -258,7 +258,7 @@ mod tests {
assert_eq!(
&*store
.get(&CID::new(
"bagaaierad7lci6475zdrps4h6fmcpmqyknz5z6bw6p6tmpjkfyueavqw4kaq"
"bagaaihracpzxhsrpviexa7k6glwdhyh3a4kvy6j7qlcqokzqbs3q424cmxyq"
))
.unwrap(),
&json!({"key": 42}),