Revert and redo #952 (#1133)

* Revert "Pruning changes trie without digests (#952)"

This reverts commit 6f9a505fba.

* pruning changes tries without digests

* u64::max_value()

* Update wasm files and fix merge conflict

* Fixes tests
This commit is contained in:
Bastian Köcher
2018-11-18 10:09:18 +01:00
committed by Gav Wood
parent 6f9a505fba
commit d149f3358a
28 changed files with 290 additions and 131 deletions
+22
View File
@@ -17,10 +17,14 @@
//! A `CodeExecutor` specialisation which uses natively compiled runtime when the wasm to be
//! executed is equivalent to the natively compiled code.
#![cfg_attr(feature = "benchmarks", feature(test))]
extern crate node_runtime;
#[macro_use] extern crate substrate_executor;
#[cfg_attr(test, macro_use)] extern crate substrate_primitives as primitives;
#[cfg(feature = "benchmarks")] extern crate test;
#[cfg(test)] extern crate substrate_keyring as keyring;
#[cfg(test)] extern crate sr_primitives as runtime_primitives;
#[cfg(test)] extern crate srml_support as runtime_support;
@@ -230,10 +234,12 @@ mod tests {
transfer_fee: 0,
creation_fee: 0,
reclaim_rebate: 0,
_genesis_phantom_data: Default::default(),
}),
session: Some(SessionConfig {
session_length: 2,
validators: vec![One.to_raw_public().into(), Two.to_raw_public().into(), three],
_genesis_phantom_data: Default::default(),
}),
staking: Some(StakingConfig {
sessions_per_era: 2,
@@ -247,6 +253,7 @@ mod tests {
current_offline_slash: 0,
current_session_reward: 0,
offline_slash_grace: 0,
_genesis_phantom_data: Default::default(),
}),
democracy: Some(Default::default()),
council_seats: Some(Default::default()),
@@ -744,4 +751,19 @@ mod tests {
assert!(t.storage_changes_root(Default::default(), 0).is_some());
}
#[cfg(feature = "benchmarks")]
mod benches {
use super::*;
use test::Bencher;
#[bench]
fn wasm_execute_block(b: &mut Bencher) {
b.iter(|| {
let mut t = new_test_ext(false);
WasmExecutor::new().call(&mut t, 8, COMPACT_CODE, "execute_block", &block1(false).0).unwrap();
WasmExecutor::new().call(&mut t, 8, COMPACT_CODE, "execute_block", &block2().0).unwrap();
});
}
}
}