Clean up sr-io (#3609)

* Move trait `Printable` into `sr-primitives`

* Cleanup runtime io trie_root interfaces

* Remove last generic bits from sr-io interface

* Fix srml-sudo after master merge

* Fix benchmarks

* Runtime bump
This commit is contained in:
Bastian Köcher
2019-09-13 16:39:50 +02:00
committed by GitHub
parent 5cb8c0dc1c
commit 45d64a711c
34 changed files with 309 additions and 372 deletions
@@ -10,6 +10,7 @@ rstd = { package = "sr-std", path = "../../sr-std", default-features = false }
runtime_io = { package = "sr-io", path = "../../sr-io", default-features = false }
sandbox = { package = "sr-sandbox", path = "../../sr-sandbox", default-features = false }
primitives = { package = "substrate-primitives", path = "../../primitives", default-features = false }
sr-primitives = { package = "sr-primitives", path = "../../sr-primitives", default-features = false }
[build-dependencies]
wasm-builder-runner = { package = "substrate-wasm-builder-runner", version = "1.0.2", path = "../../utils/wasm-builder-runner" }
@@ -8,9 +8,10 @@ include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs"));
use rstd::{vec::Vec, slice, vec};
use runtime_io::{
set_storage, storage, clear_prefix, print, blake2_128, blake2_256,
twox_128, twox_256, ed25519_verify, sr25519_verify, ordered_trie_root
set_storage, storage, clear_prefix, blake2_128, blake2_256,
twox_128, twox_256, ed25519_verify, sr25519_verify,
};
use sr_primitives::{print, traits::{BlakeTwo256, Hash}};
use primitives::{ed25519, sr25519};
macro_rules! impl_stubs {
@@ -94,12 +95,12 @@ impl_stubs!(
[sr25519_verify(&sr25519::Signature(sig), &msg[..], &sr25519::Public(pubkey)) as u8].to_vec()
},
test_ordered_trie_root => |_| {
ordered_trie_root::<primitives::Blake2Hasher, _, _>(
&[
&b"zero"[..],
&b"one"[..],
&b"two"[..],
]
BlakeTwo256::ordered_trie_root(
vec![
b"zero"[..].into(),
b"one"[..].into(),
b"two"[..].into(),
],
).as_ref().to_vec()
},
test_sandbox => |code: &[u8]| {