Rename: primitives/sr-io -> primitives/sp-io (#4328)

* primitives/sr-io -> primitives/io

* fix

* rename

* runtime-io -> sp-io

* git mv

* fix ci

* remove package name

* fix

* fix

* try minimizing diff

* try minimizing diff again

* try minimizing diff again
This commit is contained in:
Weiliang Li
2019-12-11 00:08:35 +09:00
committed by Bastian Köcher
parent 1f84d6d41d
commit 4f2cdb20c1
134 changed files with 312 additions and 315 deletions
+3 -4
View File
@@ -244,10 +244,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "bincode"
version = "1.2.0"
version = "1.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"autocfg 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
"byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.103 (registry+https://github.com/rust-lang/crates.io-index)",
]
@@ -7708,7 +7707,7 @@ version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"base64 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)",
"bincode 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"bincode 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"cranelift-codegen 0.50.0 (registry+https://github.com/rust-lang/crates.io-index)",
"cranelift-entity 0.50.0 (registry+https://github.com/rust-lang/crates.io-index)",
"cranelift-wasm 0.50.0 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -8049,7 +8048,7 @@ dependencies = [
"checksum base64 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0b25d992356d2eb0ed82172f5248873db5560c4721f564b13cb5193bda5e668e"
"checksum base64 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b41b7ea54a0c9d92199de89e20e58d49f02f8e699814ef3fdf266f6f748d15c7"
"checksum base64 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)" = "489d6c0ed21b11d038c31b6ceccca973e65d73ba3bd8ecb9a2babf5546164643"
"checksum bincode 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b8ab639324e3ee8774d296864fbc0dbbb256cf1a41c490b94cba90c082915f92"
"checksum bincode 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "5753e2a71534719bf3f4e57006c3a4f0d2c672a4b676eec84161f763eca87dbf"
"checksum bindgen 0.49.4 (registry+https://github.com/rust-lang/crates.io-index)" = "4c07087f3d5731bf3fb375a81841b99597e25dc11bd3bc72d16d43adf6624a6e"
"checksum bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693"
"checksum bitmask 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5da9b3d9f6f585199287a473f4f8dfab6566cf827d15c00c219f53c645687ead"
+1 -1
View File
@@ -119,7 +119,7 @@ members = [
"primitives/sr-api/proc-macro",
"primitives/sr-api/test",
"primitives/sr-arithmetic",
"primitives/sr-io",
"primitives/io",
"primitives/runtime",
"primitives/sr-sandbox",
"primitives/sr-staking-primitives",
+1 -1
View File
@@ -18,7 +18,7 @@ tokio = "0.1.22"
parking_lot = "0.9.0"
codec = { package = "parity-scale-codec", version = "1.0.0" }
trie-root = "0.15.2"
sp-io = { path = "../../primitives/sr-io" }
sp-io = { path = "../../primitives/io" }
sc-cli = { path = "../../client/cli" }
primitives = { package = "sp-core", path = "../../primitives/core" }
sc-executor = { path = "../../client/executor" }
@@ -18,7 +18,7 @@ offchain-primitives = { package = "sp-offchain", path = "../../../primitives/off
primitives = { package = "sp-core", path = "../../../primitives/core", default-features = false }
randomness-collective-flip = { package = "pallet-randomness-collective-flip", path = "../../../frame/randomness-collective-flip", default-features = false }
sp-std = { path = "../../../primitives/std", default-features = false }
runtime-io = { package = "sp-io", path = "../../../primitives/sr-io", default-features = false }
sp-io = { path = "../../../primitives/io", default-features = false }
safe-mix = { version = "1.0.0", default-features = false }
serde = { version = "1.0.101", optional = true, features = ["derive"] }
sp-api = { path = "../../../primitives/sr-api", default-features = false }
@@ -51,7 +51,7 @@ std = [
"primitives/std",
"randomness-collective-flip/std",
"sp-std/std",
"runtime-io/std",
"sp-io/std",
"safe-mix/std",
"serde",
"sp-api/std",
@@ -114,7 +114,7 @@ mod tests {
// This function basically just builds a genesis storage key/value store according to
// our desired mockup.
fn new_test_ext() -> runtime_io::TestExternalities {
fn new_test_ext() -> sp_io::TestExternalities {
system::GenesisConfig::default().build_storage::<Test>().unwrap().into()
}
+1 -1
View File
@@ -43,7 +43,7 @@ sp-timestamp = { path = "../../../primitives/timestamp", default-features = fals
sp-finality-tracker = { path = "../../../primitives/finality-tracker", default-features = false }
inherents = { package = "sp-inherents", path = "../../../primitives/inherents" }
keyring = { package = "sp-keyring", path = "../../../primitives/keyring" }
runtime-io = { package = "sp-io", path = "../../../primitives/sr-io" }
sp-io = { path = "../../../primitives/io" }
consensus-common = { package = "sp-consensus", path = "../../../primitives/consensus/common" }
# client dependencies
+1 -1
View File
@@ -247,7 +247,7 @@ fn sign<RA: RuntimeAdapter>(
let payload = (xt.function, extra.clone(), additional_signed);
let signature = payload.using_encoded(|b| {
if b.len() > 256 {
key.sign(&runtime_io::hashing::blake2_256(b))
key.sign(&sp_io::hashing::blake2_256(b))
} else {
key.sign(b)
}
+1 -1
View File
@@ -8,7 +8,7 @@ edition = "2018"
[dependencies]
trie-root = "0.15.2"
codec = { package = "parity-scale-codec", version = "1.0.0" }
runtime_io = { package = "sp-io", path = "../../../primitives/sr-io" }
sp-io = { path = "../../../primitives/io" }
state_machine = { package = "sp-state-machine", path = "../../../primitives/state-machine" }
sc-executor = { path = "../../../client/executor" }
primitives = { package = "sp-core", path = "../../../primitives/core" }
+1 -1
View File
@@ -66,7 +66,7 @@ transaction-payment-rpc-runtime-api = { package = "pallet-transaction-payment-rp
wasm-builder-runner = { package = "substrate-wasm-builder-runner", path = "../../../client/utils/wasm-builder-runner", version = "1.0.4" }
[dev-dependencies]
runtime_io = { package = "sp-io", path = "../../../primitives/sr-io" }
sp-io = { path = "../../../primitives/io" }
[features]
default = ["std"]
+1 -1
View File
@@ -150,7 +150,7 @@ mod tests {
}
fn run_with_system_weight<F>(w: Weight, assertions: F) where F: Fn() -> () {
let mut t: runtime_io::TestExternalities =
let mut t: sp_io::TestExternalities =
system::GenesisConfig::default().build_storage::<Runtime>().unwrap().into();
t.execute_with(|| {
System::set_block_limits(w, 0);
+1 -1
View File
@@ -17,7 +17,7 @@ node-executor = { path = "../executor" }
node-primitives = { path = "../primitives" }
node-runtime = { path = "../runtime" }
primitives = { package = "sp-core", path = "../../../primitives/core" }
runtime-io = { package = "sp-io", path = "../../../primitives/sr-io" }
sp-io = { path = "../../../primitives/io" }
runtime_support = { package = "frame-support", path = "../../../frame/support" }
session = { package = "pallet-session", path = "../../../frame/session" }
sp-runtime = { path = "../../../primitives/runtime" }
+1 -1
View File
@@ -84,7 +84,7 @@ pub fn sign(xt: CheckedExtrinsic, version: u32, genesis_hash: [u8; 32]) -> Unche
let key = AccountKeyring::from_account_id(&signed).unwrap();
let signature = payload.using_encoded(|b| {
if b.len() > 256 {
key.sign(&runtime_io::hashing::blake2_256(b))
key.sign(&sp_io::hashing::blake2_256(b))
} else {
key.sign(b)
}
+1 -1
View File
@@ -23,7 +23,7 @@ log = "0.4.8"
parking_lot = "0.9.0"
primitives = { package = "sp-core", path = "../../../primitives/core" }
sp-blockchain = { path = "../../../primitives/blockchain" }
runtime_io = { package = "sp-io", path = "../../../primitives/sr-io" }
sp-io = { path = "../../../primitives/io" }
runtime_version = { package = "sp-version", path = "../../../primitives/sr-version" }
slots = { package = "sc-consensus-slots", path = "../slots" }
sp-api = { path = "../../../primitives/sr-api" }
+1 -1
View File
@@ -14,7 +14,7 @@ num-bigint = "0.2.3"
num-rational = "0.2.2"
num-traits = "0.2.8"
runtime-version = { package = "sp-version", path = "../../../primitives/sr-version" }
runtime-io = { package = "sp-io", path = "../../../primitives/sr-io" }
sp-io = { path = "../../../primitives/io" }
inherents = { package = "sp-inherents", path = "../../../primitives/inherents" }
sp-timestamp = { path = "../../../primitives/timestamp" }
sc-telemetry = { path = "../../telemetry" }
+1 -1
View File
@@ -7,7 +7,7 @@ edition = "2018"
[dependencies]
derive_more = "0.99.2"
codec = { package = "parity-scale-codec", version = "1.0.0" }
runtime_io = { package = "sp-io", path = "../../primitives/sr-io" }
sp-io = { path = "../../primitives/io" }
primitives = { package = "sp-core", path = "../../primitives/core" }
trie = { package = "sp-trie", path = "../../primitives/trie" }
serializer = { package = "sp-serializer", path = "../../primitives/serializer" }
@@ -7,7 +7,7 @@ build = "build.rs"
[dependencies]
sp-std = { path = "../../../primitives/std", default-features = false }
runtime_io = { package = "sp-io", path = "../../../primitives/sr-io", default-features = false }
sp-io = { path = "../../../primitives/io", default-features = false }
sandbox = { package = "sp-sandbox", path = "../../../primitives/sr-sandbox", default-features = false }
primitives = { package = "sp-core", path = "../../../primitives/core", default-features = false }
sp-runtime = { package = "sp-runtime", path = "../../../primitives/runtime", default-features = false }
@@ -17,4 +17,4 @@ wasm-builder-runner = { package = "substrate-wasm-builder-runner", path = "../..
[features]
default = [ "std" ]
std = ["runtime_io/std", "sandbox/std", "sp-std/std"]
std = ["sp-io/std", "sandbox/std", "sp-std/std"]
@@ -9,7 +9,7 @@ include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs"));
use sp_std::{vec::Vec, vec};
#[cfg(not(feature = "std"))]
use runtime_io::{
use sp_io::{
storage, hashing::{blake2_128, blake2_256, sha2_256, twox_128, twox_256},
crypto::{ed25519_verify, sr25519_verify},
};
@@ -146,49 +146,49 @@ primitives::wasm_export_functions! {
fn test_offchain_local_storage() -> bool {
let kind = primitives::offchain::StorageKind::PERSISTENT;
assert_eq!(runtime_io::offchain::local_storage_get(kind, b"test"), None);
runtime_io::offchain::local_storage_set(kind, b"test", b"asd");
assert_eq!(runtime_io::offchain::local_storage_get(kind, b"test"), Some(b"asd".to_vec()));
assert_eq!(sp_io::offchain::local_storage_get(kind, b"test"), None);
sp_io::offchain::local_storage_set(kind, b"test", b"asd");
assert_eq!(sp_io::offchain::local_storage_get(kind, b"test"), Some(b"asd".to_vec()));
let res = runtime_io::offchain::local_storage_compare_and_set(
let res = sp_io::offchain::local_storage_compare_and_set(
kind,
b"test",
Some(b"asd".to_vec()),
b"",
);
assert_eq!(runtime_io::offchain::local_storage_get(kind, b"test"), Some(b"".to_vec()));
assert_eq!(sp_io::offchain::local_storage_get(kind, b"test"), Some(b"".to_vec()));
res
}
fn test_offchain_local_storage_with_none() {
let kind = primitives::offchain::StorageKind::PERSISTENT;
assert_eq!(runtime_io::offchain::local_storage_get(kind, b"test"), None);
assert_eq!(sp_io::offchain::local_storage_get(kind, b"test"), None);
let res = runtime_io::offchain::local_storage_compare_and_set(kind, b"test", None, b"value");
let res = sp_io::offchain::local_storage_compare_and_set(kind, b"test", None, b"value");
assert_eq!(res, true);
assert_eq!(runtime_io::offchain::local_storage_get(kind, b"test"), Some(b"value".to_vec()));
assert_eq!(sp_io::offchain::local_storage_get(kind, b"test"), Some(b"value".to_vec()));
}
fn test_offchain_http() -> bool {
use primitives::offchain::HttpRequestStatus;
let run = || -> Option<()> {
let id = runtime_io::offchain::http_request_start(
let id = sp_io::offchain::http_request_start(
"POST",
"http://localhost:12345",
&[],
).ok()?;
runtime_io::offchain::http_request_add_header(id, "X-Auth", "test").ok()?;
runtime_io::offchain::http_request_write_body(id, &[1, 2, 3, 4], None).ok()?;
runtime_io::offchain::http_request_write_body(id, &[], None).ok()?;
let status = runtime_io::offchain::http_response_wait(&[id], None);
sp_io::offchain::http_request_add_header(id, "X-Auth", "test").ok()?;
sp_io::offchain::http_request_write_body(id, &[1, 2, 3, 4], None).ok()?;
sp_io::offchain::http_request_write_body(id, &[], None).ok()?;
let status = sp_io::offchain::http_response_wait(&[id], None);
assert!(status == vec![HttpRequestStatus::Finished(200)], "Expected Finished(200) status.");
let headers = runtime_io::offchain::http_response_headers(id);
let headers = sp_io::offchain::http_response_headers(id);
assert_eq!(headers, vec![(b"X-Auth".to_vec(), b"hello".to_vec())]);
let mut buffer = vec![0; 64];
let read = runtime_io::offchain::http_response_read_body(id, &mut buffer, None).ok()?;
let read = sp_io::offchain::http_response_read_body(id, &mut buffer, None).ok()?;
assert_eq!(read, 3);
assert_eq!(&buffer[0..read as usize], &[1, 2, 3]);
let read = runtime_io::offchain::http_response_read_body(id, &mut buffer, None).ok()?;
let read = sp_io::offchain::http_response_read_body(id, &mut buffer, None).ok()?;
assert_eq!(read, 0);
Some(())
@@ -168,20 +168,20 @@ impl_wasm_host_interface! {
ext_print_utf8(utf8_data: Pointer<u8>, utf8_len: WordSize) {
if let Ok(utf8) = context.read_memory(utf8_data, utf8_len) {
runtime_io::misc::print_utf8(&utf8);
sp_io::misc::print_utf8(&utf8);
}
Ok(())
}
ext_print_hex(data: Pointer<u8>, len: WordSize) {
if let Ok(hex) = context.read_memory(data, len) {
runtime_io::misc::print_hex(&hex);
sp_io::misc::print_hex(&hex);
}
Ok(())
}
ext_print_num(number: u64) {
runtime_io::misc::print_num(number);
sp_io::misc::print_num(number);
Ok(())
}
@@ -200,7 +200,7 @@ impl_wasm_host_interface! {
let target_str = std::str::from_utf8(&target)
.map_err(|_| "Target invalid utf8 in ext_log")?;
runtime_io::logging::log(level.into(), &target_str, &message);
sp_io::logging::log(level.into(), &target_str, &message);
Ok(())
}
@@ -214,7 +214,7 @@ impl_wasm_host_interface! {
.map_err(|_| "Invalid attempt to determine key in ext_set_storage")?;
let value = context.read_memory(value_data, value_len)
.map_err(|_| "Invalid attempt to determine value in ext_set_storage")?;
Ok(runtime_io::storage::set(&key, &value))
Ok(sp_io::storage::set(&key, &value))
}
ext_set_child_storage(
@@ -232,7 +232,7 @@ impl_wasm_host_interface! {
let value = context.read_memory(value_data, value_len)
.map_err(|_| "Invalid attempt to determine value in ext_set_child_storage")?;
Ok(runtime_io::storage::child_set(&storage_key, &key, &value))
Ok(sp_io::storage::child_set(&storage_key, &key, &value))
}
ext_clear_child_storage(
@@ -246,19 +246,19 @@ impl_wasm_host_interface! {
let key = context.read_memory(key_data, key_len)
.map_err(|_| "Invalid attempt to determine key in ext_clear_child_storage")?;
Ok(runtime_io::storage::child_clear(&storage_key, &key))
Ok(sp_io::storage::child_clear(&storage_key, &key))
}
ext_clear_storage(key_data: Pointer<u8>, key_len: WordSize) {
let key = context.read_memory(key_data, key_len)
.map_err(|_| "Invalid attempt to determine key in ext_clear_storage")?;
Ok(runtime_io::storage::clear(&key))
Ok(sp_io::storage::clear(&key))
}
ext_exists_storage(key_data: Pointer<u8>, key_len: WordSize) -> u32 {
let key = context.read_memory(key_data, key_len)
.map_err(|_| "Invalid attempt to determine key in ext_exists_storage")?;
Ok(if runtime_io::storage::exists(&key) { 1 } else { 0 })
Ok(if sp_io::storage::exists(&key) { 1 } else { 0 })
}
ext_exists_child_storage(
@@ -272,13 +272,13 @@ impl_wasm_host_interface! {
let key = context.read_memory(key_data, key_len)
.map_err(|_| "Invalid attempt to determine key in ext_exists_child_storage")?;
Ok(if runtime_io::storage::child_exists(&storage_key, &key) { 1 } else { 0 })
Ok(if sp_io::storage::child_exists(&storage_key, &key) { 1 } else { 0 })
}
ext_clear_prefix(prefix_data: Pointer<u8>, prefix_len: WordSize) {
let prefix = context.read_memory(prefix_data, prefix_len)
.map_err(|_| "Invalid attempt to determine prefix in ext_clear_prefix")?;
Ok(runtime_io::storage::clear_prefix(&prefix))
Ok(sp_io::storage::clear_prefix(&prefix))
}
ext_clear_child_prefix(
@@ -291,13 +291,13 @@ impl_wasm_host_interface! {
.map_err(|_| "Invalid attempt to determine storage_key in ext_clear_child_prefix")?;
let prefix = context.read_memory(prefix_data, prefix_len)
.map_err(|_| "Invalid attempt to determine prefix in ext_clear_child_prefix")?;
Ok(runtime_io::storage::child_clear_prefix(&storage_key, &prefix))
Ok(sp_io::storage::child_clear_prefix(&storage_key, &prefix))
}
ext_kill_child_storage(storage_key_data: Pointer<u8>, storage_key_len: WordSize) {
let storage_key = context.read_memory(storage_key_data, storage_key_len)
.map_err(|_| "Invalid attempt to determine storage_key in ext_kill_child_storage")?;
Ok(runtime_io::storage::child_storage_kill(&storage_key))
Ok(sp_io::storage::child_storage_kill(&storage_key))
}
ext_get_allocated_storage(
@@ -308,7 +308,7 @@ impl_wasm_host_interface! {
let key = context.read_memory(key_data, key_len)
.map_err(|_| "Invalid attempt to determine key in ext_get_allocated_storage")?;
if let Some(value) = runtime_io::storage::get(&key) {
if let Some(value) = sp_io::storage::get(&key) {
let offset = context.allocate_memory(value.len() as u32)?;
context.write_memory(offset, &value)
.map_err(|_| "Invalid attempt to set memory in ext_get_allocated_storage")?;
@@ -334,7 +334,7 @@ impl_wasm_host_interface! {
let key = context.read_memory(key_data, key_len)
.map_err(|_| "Invalid attempt to determine key in ext_get_allocated_child_storage")?;
if let Some(value) = runtime_io::storage::child_get(&storage_key, &key) {
if let Some(value) = sp_io::storage::child_get(&storage_key, &key) {
let offset = context.allocate_memory(value.len() as u32)?;
context.write_memory(offset, &value)
.map_err(|_| "Invalid attempt to set memory in ext_get_allocated_child_storage")?;
@@ -358,7 +358,7 @@ impl_wasm_host_interface! {
let key = context.read_memory(key_data, key_len)
.map_err(|_| "Invalid attempt to get key in ext_get_storage_into")?;
if let Some(value) = runtime_io::storage::get(&key) {
if let Some(value) = sp_io::storage::get(&key) {
let data = &value[value.len().min(value_offset as usize)..];
let written = std::cmp::min(value_len as usize, data.len());
context.write_memory(value_data, &data[..written])
@@ -383,7 +383,7 @@ impl_wasm_host_interface! {
let key = context.read_memory(key_data, key_len)
.map_err(|_| "Invalid attempt to get key in ext_get_child_storage_into")?;
if let Some(value) = runtime_io::storage::child_get(&storage_key, &key) {
if let Some(value) = sp_io::storage::child_get(&storage_key, &key) {
let data = &value[value.len().min(value_offset as usize)..];
let written = std::cmp::min(value_len as usize, data.len());
context.write_memory(value_data, &data[..written])
@@ -395,7 +395,7 @@ impl_wasm_host_interface! {
}
ext_storage_root(result: Pointer<u8>) {
context.write_memory(result, runtime_io::storage::root().as_ref())
context.write_memory(result, sp_io::storage::root().as_ref())
.map_err(|_| "Invalid attempt to set memory in ext_storage_root".into())
}
@@ -406,7 +406,7 @@ impl_wasm_host_interface! {
) -> Pointer<u8> {
let storage_key = context.read_memory(storage_key_data, storage_key_len)
.map_err(|_| "Invalid attempt to determine storage_key in ext_child_storage_root")?;
let value = runtime_io::storage::child_root(&storage_key);
let value = sp_io::storage::child_root(&storage_key);
let offset = context.allocate_memory(value.len() as u32)?;
context.write_memory(offset, &value)
@@ -425,7 +425,7 @@ impl_wasm_host_interface! {
context.read_memory_into(parent_hash_data, &mut parent_hash[..])
.map_err(|_| "Invalid attempt to get parent_hash in ext_storage_changes_root")?;
if let Some(r) = runtime_io::storage::changes_root(&parent_hash) {
if let Some(r) = sp_io::storage::changes_root(&parent_hash) {
context.write_memory(result, &r[..])
.map_err(|_| "Invalid attempt to set memory in ext_storage_changes_root")?;
Ok(1)
@@ -459,7 +459,7 @@ impl_wasm_host_interface! {
}
ext_chain_id() -> u64 {
Ok(runtime_io::misc::chain_id())
Ok(sp_io::misc::chain_id())
}
ext_twox_64(data: Pointer<u8>, len: WordSize, out: Pointer<u8>) {
@@ -555,7 +555,7 @@ impl_wasm_host_interface! {
.map_err(|_| "Invalid attempt to get id in ext_ed25519_public_keys")?;
let key_type = KeyTypeId(id);
let keys = runtime_io::crypto::ed25519_public_keys(key_type).encode();
let keys = sp_io::crypto::ed25519_public_keys(key_type).encode();
let len = keys.len() as u32;
let offset = context.allocate_memory(len)?;
@@ -610,7 +610,7 @@ impl_wasm_host_interface! {
)
};
let pubkey = runtime_io::crypto::ed25519_generate(key_type, seed);
let pubkey = sp_io::crypto::ed25519_generate(key_type, seed);
context.write_memory(out, pubkey.as_ref())
.map_err(|_| "Invalid attempt to set out in ext_ed25519_generate".into())
@@ -638,7 +638,7 @@ impl_wasm_host_interface! {
let pub_key = ed25519::Public::try_from(pubkey.as_ref())
.map_err(|_| "Invalid `ed25519` public key")?;
let signature = runtime_io::crypto::ed25519_sign(key_type, &pub_key, &msg);
let signature = sp_io::crypto::ed25519_sign(key_type, &pub_key, &msg);
match signature {
Some(signature) => {
@@ -656,7 +656,7 @@ impl_wasm_host_interface! {
.map_err(|_| "Invalid attempt to get id in ext_sr25519_public_keys")?;
let key_type = KeyTypeId(id);
let keys = runtime_io::crypto::sr25519_public_keys(key_type).encode();
let keys = sp_io::crypto::sr25519_public_keys(key_type).encode();
let len = keys.len() as u32;
let offset = context.allocate_memory(len)?;
@@ -710,7 +710,7 @@ impl_wasm_host_interface! {
)
};
let pubkey = runtime_io::crypto::sr25519_generate(key_type, seed);
let pubkey = sp_io::crypto::sr25519_generate(key_type, seed);
context.write_memory(out, pubkey.as_ref())
.map_err(|_| "Invalid attempt to set out in ext_sr25519_generate".into())
@@ -738,7 +738,7 @@ impl_wasm_host_interface! {
let pub_key = sr25519::Public::try_from(pubkey.as_ref())
.map_err(|_| "Invalid `sr25519` public key")?;
let signature = runtime_io::crypto::sr25519_sign(key_type, &pub_key, &msg);
let signature = sp_io::crypto::sr25519_sign(key_type, &pub_key, &msg);
match signature {
Some(signature) => {
@@ -781,20 +781,20 @@ impl_wasm_host_interface! {
}
ext_is_validator() -> u32 {
if runtime_io::offchain::is_validator() { Ok(1) } else { Ok(0) }
if sp_io::offchain::is_validator() { Ok(1) } else { Ok(0) }
}
ext_submit_transaction(msg_data: Pointer<u8>, len: WordSize) -> u32 {
let extrinsic = context.read_memory(msg_data, len)
.map_err(|_| "OOB while ext_submit_transaction: wasm")?;
let res = runtime_io::offchain::submit_transaction(extrinsic);
let res = sp_io::offchain::submit_transaction(extrinsic);
Ok(if res.is_ok() { 0 } else { 1 })
}
ext_network_state(written_out: Pointer<u32>) -> Pointer<u8> {
let res = runtime_io::offchain::network_state();
let res = sp_io::offchain::network_state();
let encoded = res.encode();
let len = encoded.len() as u32;
@@ -809,17 +809,17 @@ impl_wasm_host_interface! {
}
ext_timestamp() -> u64 {
Ok(runtime_io::offchain::timestamp().unix_millis())
Ok(sp_io::offchain::timestamp().unix_millis())
}
ext_sleep_until(deadline: u64) {
runtime_io::offchain::sleep_until(offchain::Timestamp::from_unix_millis(deadline));
sp_io::offchain::sleep_until(offchain::Timestamp::from_unix_millis(deadline));
Ok(())
}
ext_random_seed(seed_data: Pointer<u8>) {
// NOTE the runtime as assumptions about seed size.
let seed = runtime_io::offchain::random_seed();
let seed = sp_io::offchain::random_seed();
context.write_memory(seed_data, &seed)
.map_err(|_| "Invalid attempt to set value in ext_random_seed")?;
@@ -840,7 +840,7 @@ impl_wasm_host_interface! {
let value = context.read_memory(value, value_len)
.map_err(|_| "OOB while ext_local_storage_set: wasm")?;
runtime_io::offchain::local_storage_set(kind, &key, &value);
sp_io::offchain::local_storage_set(kind, &key, &value);
Ok(())
}
@@ -856,7 +856,7 @@ impl_wasm_host_interface! {
let key = context.read_memory(key, key_len)
.map_err(|_| "OOB while ext_local_storage_get: wasm")?;
let maybe_value = runtime_io::offchain::local_storage_get(kind, &key);
let maybe_value = sp_io::offchain::local_storage_get(kind, &key);
let (offset, len) = if let Some(value) = maybe_value {
let offset = context.allocate_memory(value.len() as u32)?;
@@ -898,7 +898,7 @@ impl_wasm_host_interface! {
)
};
let res = runtime_io::offchain::local_storage_compare_and_set(
let res = sp_io::offchain::local_storage_compare_and_set(
kind,
&key,
old_value,
@@ -928,7 +928,7 @@ impl_wasm_host_interface! {
let url_str = str::from_utf8(&url)
.map_err(|_| "invalid str while ext_http_request_start: wasm")?;
let id = runtime_io::offchain::http_request_start(method_str, url_str, &meta);
let id = sp_io::offchain::http_request_start(method_str, url_str, &meta);
if let Ok(id) = id {
Ok(id.into())
@@ -954,7 +954,7 @@ impl_wasm_host_interface! {
let value_str = str::from_utf8(&value)
.map_err(|_| "Invalid str while ext_http_request_add_header: wasm")?;
let res = runtime_io::offchain::http_request_add_header(
let res = sp_io::offchain::http_request_add_header(
offchain::HttpRequestId(request_id as u16),
name_str,
value_str,
@@ -972,7 +972,7 @@ impl_wasm_host_interface! {
let chunk = context.read_memory(chunk, chunk_len)
.map_err(|_| "OOB while ext_http_request_write_body: wasm")?;
let res = runtime_io::offchain::http_request_write_body(
let res = sp_io::offchain::http_request_write_body(
offchain::HttpRequestId(request_id as u16),
&chunk,
deadline_to_timestamp(deadline),
@@ -998,7 +998,7 @@ impl_wasm_host_interface! {
)
.collect::<std::result::Result<Vec<_>, _>>()?;
let res = runtime_io::offchain::http_response_wait(&ids, deadline_to_timestamp(deadline))
let res = sp_io::offchain::http_response_wait(&ids, deadline_to_timestamp(deadline))
.into_iter()
.map(|status| u32::from(status))
.enumerate()
@@ -1019,7 +1019,7 @@ impl_wasm_host_interface! {
) -> Pointer<u8> {
use codec::Encode;
let headers = runtime_io::offchain::http_response_headers(
let headers = sp_io::offchain::http_response_headers(
offchain::HttpRequestId(request_id as u16),
);
@@ -1044,7 +1044,7 @@ impl_wasm_host_interface! {
let mut internal_buffer = Vec::with_capacity(buffer_len as usize);
internal_buffer.resize(buffer_len as usize, 0);
let res = runtime_io::offchain::http_response_read_body(
let res = sp_io::offchain::http_response_read_body(
offchain::HttpRequestId(request_id as u16),
&mut internal_buffer,
deadline_to_timestamp(deadline),
@@ -1072,4 +1072,3 @@ fn deadline_to_timestamp(deadline: u64) -> Option<offchain::Timestamp> {
Some(offchain::Timestamp::from_unix_millis(deadline))
}
}
@@ -40,7 +40,7 @@ fn call_in_wasm<E: Externalities>(
code: &[u8],
heap_pages: u64,
) -> crate::error::Result<Vec<u8>> {
crate::call_in_wasm::<E, runtime_io::SubstrateHostFunctions>(
crate::call_in_wasm::<E, sp_io::SubstrateHostFunctions>(
function,
call_data,
execution_method,
@@ -492,4 +492,3 @@ fn offchain_http_should_work(wasm_method: WasmExecutionMethod) {
true.encode(),
);
}
+2 -2
View File
@@ -94,13 +94,13 @@ pub trait RuntimeInfo {
mod tests {
use super::*;
use runtime_test::WASM_BINARY;
use runtime_io::TestExternalities;
use sp_io::TestExternalities;
#[test]
fn call_in_interpreted_wasm_works() {
let mut ext = TestExternalities::default();
let mut ext = ext.ext();
let res = call_in_wasm::<_, runtime_io::SubstrateHostFunctions>(
let res = call_in_wasm::<_, sp_io::SubstrateHostFunctions>(
"test_empty_return",
&[],
WasmExecutionMethod::Interpreted,
@@ -98,7 +98,7 @@ impl<D: NativeExecutionDispatch> NativeExecutor<D> {
/// `default_heap_pages` - Number of 64KB pages to allocate for Wasm execution.
/// Defaults to `DEFAULT_HEAP_PAGES` if `None` is provided.
pub fn new(fallback_method: WasmExecutionMethod, default_heap_pages: Option<u64>) -> Self {
let mut host_functions = runtime_io::SubstrateHostFunctions::host_functions();
let mut host_functions = sp_io::SubstrateHostFunctions::host_functions();
// Add the old and deprecated host functions as well, so that we support old wasm runtimes.
host_functions.extend(
crate::deprecated_host_interface::SubstrateExternals::host_functions(),
@@ -263,7 +263,7 @@ mod tests {
#[test]
fn host_functions_are_equal() {
let host_functions = runtime_io::SubstrateHostFunctions::host_functions();
let host_functions = sp_io::SubstrateHostFunctions::host_functions();
let equal = &host_functions[..] == &host_functions[..];
assert!(equal, "Host functions are not equal");
+1 -1
View File
@@ -33,7 +33,7 @@ assert_matches = "1.3.0"
futures01 = { package = "futures", version = "0.1.29" }
network = { package = "sc-network", path = "../network" }
rustc-hex = "2.0.1"
sp-io = { path = "../../primitives/sr-io" }
sp-io = { path = "../../primitives/io" }
test-client = { package = "substrate-test-runtime-client", path = "../../test/utils/runtime/client" }
tokio = "0.1.22"
txpool = { package = "sc-transaction-pool", path = "../transaction-pool" }
+1 -1
View File
@@ -29,7 +29,7 @@ serde_json = "1.0.41"
sysinfo = "0.9.5"
target_info = "0.1.0"
keystore = { package = "sc-keystore", path = "../keystore" }
sp-io = { path = "../../primitives/sr-io" }
sp-io = { path = "../../primitives/io" }
sp-runtime = { path = "../../primitives/runtime" }
sp-blockchain = { path = "../../primitives/blockchain" }
primitives = { package = "sp-core", path = "../../primitives/core" }
+1 -1
View File
@@ -20,7 +20,7 @@
# Wasm execution and the wasm side of Substrate Runtime Interface
/client/executor/ @pepyakin
/primitives/sr-io/ @pepyakin
/primitives/io/ @pepyakin
# Sandboxing capability of Substrate Runtime
/primitives/sr-sandbox/ @pepyakin
+1 -1
View File
@@ -17,7 +17,7 @@ system = { package = "frame-system", path = "../system", default-features = fals
[dev-dependencies]
primitives = { package = "sp-core", path = "../../primitives/core" }
sp-std = { path = "../../primitives/std" }
runtime-io = { package = "sp-io", path = "../../primitives/sr-io" }
sp-io = { path = "../../primitives/io" }
[features]
default = ["std"]
+1 -1
View File
@@ -287,7 +287,7 @@ mod tests {
// This function basically just builds a genesis storage key/value store according to
// our desired mockup.
fn new_test_ext() -> runtime_io::TestExternalities {
fn new_test_ext() -> sp_io::TestExternalities {
system::GenesisConfig::default().build_storage::<Test>().unwrap().into()
}
+2 -2
View File
@@ -13,7 +13,7 @@ sp-std = { path = "../../primitives/std", default-features = false }
serde = { version = "1.0.101", optional = true }
session = { package = "pallet-session", path = "../session", default-features = false }
sp-runtime = { path = "../../primitives/runtime", default-features = false }
runtime-io ={ package = "sp-io", path = "../../primitives/sr-io", default-features = false }
sp-io ={ path = "../../primitives/io", default-features = false }
support = { package = "frame-support", path = "../support", default-features = false }
sp-consensus-aura = { path = "../../primitives/consensus/aura", default-features = false}
system = { package = "frame-system", path = "../system", default-features = false }
@@ -31,7 +31,7 @@ std = [
"app-crypto/std",
"codec/std",
"inherents/std",
"runtime-io/std",
"sp-io/std",
"primitives/std",
"sp-std/std",
"serde",
+2 -2
View File
@@ -25,7 +25,7 @@ use sp_runtime::{
testing::{Header, UintAuthorityId},
};
use support::{impl_outer_origin, parameter_types, weights::Weight};
use runtime_io;
use sp_io;
use primitives::H256;
impl_outer_origin!{
@@ -72,7 +72,7 @@ impl Trait for Test {
type AuthorityId = AuthorityId;
}
pub fn new_test_ext(authorities: Vec<u64>) -> runtime_io::TestExternalities {
pub fn new_test_ext(authorities: Vec<u64>) -> sp_io::TestExternalities {
let mut t = system::GenesisConfig::default().build_storage::<Test>().unwrap();
GenesisConfig::<Test>{
authorities: authorities.into_iter().map(|a| UintAuthorityId(a).to_public_key()).collect(),
@@ -11,7 +11,7 @@ codec = { package = "parity-scale-codec", version = "1.0.0", default-features =
primitives = { package = "sp-core", path = "../../primitives/core", default-features = false }
sp-std = { path = "../../primitives/std", default-features = false }
serde = { version = "1.0.101", optional = true }
runtime-io = { package = "sp-io", path = "../../primitives/sr-io", default-features = false }
sp-io = { path = "../../primitives/io", default-features = false }
session = { package = "pallet-session", path = "../session", default-features = false, features = ["historical" ] }
sp-runtime = { path = "../../primitives/runtime", default-features = false }
support = { package = "frame-support", path = "../support", default-features = false }
@@ -27,8 +27,8 @@ std = [
"authority-discovery-primitives/std",
"codec/std",
"primitives/std",
"sp-io/std",
"sp-std/std",
"runtime-io/std",
"serde",
"session/std",
"sp-runtime/std",
@@ -95,7 +95,7 @@ mod tests {
use authority_discovery_primitives::{AuthorityPair};
use app_crypto::Pair;
use primitives::{crypto::key_types, H256};
use runtime_io::TestExternalities;
use sp_io::TestExternalities;
use sp_runtime::{
testing::{Header, UintAuthorityId}, traits::{ConvertInto, IdentityLookup, OpaqueKeys},
Perbill, KeyTypeId,
+2 -2
View File
@@ -14,7 +14,7 @@ sp-std = { path = "../../primitives/std", default-features = false }
sp-runtime = { path = "../../primitives/runtime", default-features = false }
support = { package = "frame-support", path = "../support", default-features = false }
system = { package = "frame-system", path = "../system", default-features = false }
runtime-io ={ package = "sp-io", path = "../../primitives/sr-io", default-features = false }
sp-io ={ path = "../../primitives/io", default-features = false }
impl-trait-for-tuples = "0.1.3"
[features]
@@ -27,6 +27,6 @@ std = [
"sp-std/std",
"support/std",
"system/std",
"runtime-io/std",
"sp-io/std",
"sp-authorship/std",
]
+1 -1
View File
@@ -492,7 +492,7 @@ mod tests {
)
}
fn new_test_ext() -> runtime_io::TestExternalities {
fn new_test_ext() -> sp_io::TestExternalities {
let t = system::GenesisConfig::default().build_storage::<Test>().unwrap();
t.into()
}
+2 -2
View File
@@ -18,7 +18,7 @@ timestamp = { package = "pallet-timestamp", path = "../timestamp", default-featu
sp-timestamp = { path = "../../primitives/timestamp", default-features = false }
session = { package = "pallet-session", path = "../session", default-features = false }
babe-primitives = { package = "sp-consensus-babe", path = "../../primitives/consensus/babe", default-features = false }
runtime-io ={ package = "sp-io", path = "../../primitives/sr-io", default-features = false }
sp-io ={ path = "../../primitives/io", default-features = false }
[dev-dependencies]
lazy_static = "1.4.0"
@@ -42,5 +42,5 @@ std = [
"inherents/std",
"babe-primitives/std",
"session/std",
"runtime-io/std",
"sp-io/std",
]
+1 -1
View File
@@ -523,7 +523,7 @@ fn compute_randomness(
s.extend_from_slice(&vrf_output[..]);
}
runtime_io::hashing::blake2_256(&s)
sp_io::hashing::blake2_256(&s)
}
impl<T: Trait> ProvideInherent for Module<T> {
+2 -2
View File
@@ -24,7 +24,7 @@ use sp_runtime::{
};
use sp_version::RuntimeVersion;
use support::{impl_outer_origin, parameter_types, weights::Weight};
use runtime_io;
use sp_io;
use primitives::{H256, Blake2Hasher};
impl_outer_origin!{
@@ -97,7 +97,7 @@ impl Trait for Test {
type EpochChangeTrigger = crate::ExternalTrigger;
}
pub fn new_test_ext(authorities: Vec<DummyValidatorId>) -> runtime_io::TestExternalities {
pub fn new_test_ext(authorities: Vec<DummyValidatorId>) -> sp_io::TestExternalities {
let mut t = system::GenesisConfig::default().build_storage::<Test>().unwrap();
GenesisConfig {
authorities: authorities.into_iter().map(|a| (UintAuthorityId(a).to_public_key(), 1)).collect(),
+1 -1
View File
@@ -14,7 +14,7 @@ support = { package = "frame-support", path = "../support", default-features = f
system = { package = "frame-system", path = "../system", default-features = false }
[dev-dependencies]
runtime-io = { package = "sp-io", path = "../../primitives/sr-io" }
sp-io = { path = "../../primitives/io" }
primitives = { package = "sp-core", path = "../../primitives/core" }
transaction-payment = { package = "pallet-transaction-payment", path = "../transaction-payment" }
+2 -2
View File
@@ -18,7 +18,7 @@
use sp_runtime::{Perbill, traits::{ConvertInto, IdentityLookup}, testing::Header};
use primitives::H256;
use runtime_io;
use sp_io;
use support::{impl_outer_origin, parameter_types};
use support::traits::Get;
use support::weights::{Weight, DispatchInfo};
@@ -148,7 +148,7 @@ impl ExtBuilder {
TRANSFER_FEE.with(|v| *v.borrow_mut() = self.transfer_fee);
CREATION_FEE.with(|v| *v.borrow_mut() = self.creation_fee);
}
pub fn build(self) -> runtime_io::TestExternalities {
pub fn build(self) -> sp_io::TestExternalities {
self.set_associated_consts();
let mut t = system::GenesisConfig::default().build_storage::<Runtime>().unwrap();
GenesisConfig::<Runtime> {
+2 -2
View File
@@ -10,7 +10,7 @@ safe-mix = { version = "1.0.0", default-features = false }
codec = { package = "parity-scale-codec", version = "1.0.0", default-features = false, features = ["derive"] }
primitives = { package = "sp-core", path = "../../primitives/core", default-features = false }
sp-std = { path = "../../primitives/std", default-features = false }
runtime-io = { package = "sp-io", path = "../../primitives/sr-io", default-features = false }
sp-io = { path = "../../primitives/io", default-features = false }
sp-runtime = { path = "../../primitives/runtime", default-features = false }
support = { package = "frame-support", path = "../support", default-features = false }
system = { package = "frame-system", path = "../system", default-features = false }
@@ -27,7 +27,7 @@ std = [
"primitives/std",
"sp-std/std",
"serde",
"runtime-io/std",
"sp-io/std",
"support/std",
"sp-runtime/std",
"system/std",
+1 -1
View File
@@ -437,7 +437,7 @@ mod tests {
}
);
fn make_ext() -> runtime_io::TestExternalities {
fn make_ext() -> sp_io::TestExternalities {
GenesisConfig {
collective_Instance1: Some(collective::GenesisConfig {
members: vec![1, 2, 3],
+2 -2
View File
@@ -12,7 +12,7 @@ parity-wasm = { version = "0.41.0", default-features = false }
wasmi-validation = { version = "0.3.0", default-features = false }
primitives = { package = "sp-core", path = "../../primitives/core", default-features = false }
sp-runtime = { path = "../../primitives/runtime", default-features = false }
runtime-io = { package = "sp-io", path = "../../primitives/sr-io", default-features = false }
sp-io = { path = "../../primitives/io", default-features = false }
sp-std = { path = "../../primitives/std", default-features = false }
sandbox = { package = "sp-sandbox", path = "../../primitives/sr-sandbox", default-features = false }
support = { package = "frame-support", path = "../support", default-features = false }
@@ -33,7 +33,7 @@ std = [
"codec/std",
"primitives/std",
"sp-runtime/std",
"runtime-io/std",
"sp-io/std",
"sp-std/std",
"sandbox/std",
"support/std",
+1 -1
View File
@@ -24,7 +24,7 @@ use crate::exec::StorageKey;
use sp_std::cell::RefCell;
use sp_std::collections::btree_map::{BTreeMap, Entry};
use sp_std::prelude::*;
use runtime_io::hashing::blake2_256;
use sp_io::hashing::blake2_256;
use sp_runtime::traits::{Bounded, Zero};
use support::traits::{Currency, Get, Imbalance, SignedImbalance, UpdateBalanceOutcome};
use support::{storage::child, StorageMap};
+2 -2
View File
@@ -111,7 +111,7 @@ use serde::{Serialize, Deserialize};
use primitives::crypto::UncheckedFrom;
use sp_std::{prelude::*, marker::PhantomData, fmt::Debug};
use codec::{Codec, Encode, Decode};
use runtime_io::hashing::blake2_256;
use sp_io::hashing::blake2_256;
use sp_runtime::{
traits::{Hash, StaticLookup, Zero, MaybeSerializeDeserialize, Member, SignedExtension},
transaction_validity::{
@@ -803,7 +803,7 @@ impl<T: Trait> Module<T> {
let tombstone = <TombstoneContractInfo<T>>::new(
// This operation is cheap enough because last_write (delta not included)
// is not this block as it has been checked earlier.
&runtime_io::storage::child_root(&origin_contract.trie_id)[..],
&sp_io::storage::child_root(&origin_contract.trie_id)[..],
code_hash,
);
+3 -3
View File
@@ -99,7 +99,7 @@ fn try_evict_or_and_pay_rent<T: Trait>(
if balance < subsistence_threshold {
// The contract cannot afford to leave a tombstone, so remove the contract info altogether.
<ContractInfoOf<T>>::remove(account);
runtime_io::storage::child_storage_kill(&contract.trie_id);
sp_io::storage::child_storage_kill(&contract.trie_id);
return (RentOutcome::Evicted, None);
}
@@ -146,7 +146,7 @@ fn try_evict_or_and_pay_rent<T: Trait>(
// threshold, so it leaves a tombstone.
// Note: this operation is heavy.
let child_storage_root = runtime_io::storage::child_root(&contract.trie_id);
let child_storage_root = sp_io::storage::child_root(&contract.trie_id);
let tombstone = <TombstoneContractInfo<T>>::new(
&child_storage_root[..],
@@ -155,7 +155,7 @@ fn try_evict_or_and_pay_rent<T: Trait>(
let tombstone_info = ContractInfo::Tombstone(tombstone);
<ContractInfoOf<T>>::insert(account, &tombstone_info);
runtime_io::storage::child_storage_kill(&contract.trie_id);
sp_io::storage::child_storage_kill(&contract.trie_id);
return (RentOutcome::Evicted, Some(tombstone_info));
}
+2 -2
View File
@@ -268,7 +268,7 @@ impl ExtBuilder {
INSTANTIATION_FEE.with(|v| *v.borrow_mut() = self.instantiation_fee);
BLOCK_GAS_LIMIT.with(|v| *v.borrow_mut() = self.block_gas_limit);
}
pub fn build(self) -> runtime_io::TestExternalities {
pub fn build(self) -> sp_io::TestExternalities {
self.set_associated_consts();
let mut t = system::GenesisConfig::default().build_storage::<Test>().unwrap();
balances::GenesisConfig::<Test> {
@@ -282,7 +282,7 @@ impl ExtBuilder {
},
gas_price: self.gas_price,
}.assimilate_storage(&mut t).unwrap();
runtime_io::TestExternalities::new(t)
sp_io::TestExternalities::new(t)
}
}
+2 -2
View File
@@ -9,7 +9,7 @@ serde = { version = "1.0.101", optional = true, features = ["derive"] }
safe-mix = { version = "1.0.0", default-features = false }
codec = { package = "parity-scale-codec", version = "1.0.0", default-features = false, features = ["derive"] }
sp-std = { path = "../../primitives/std", default-features = false }
runtime-io = { package = "sp-io", path = "../../primitives/sr-io", default-features = false }
sp-io = { path = "../../primitives/io", default-features = false }
sp-runtime = { path = "../../primitives/runtime", default-features = false }
support = { package = "frame-support", path = "../support", default-features = false }
system = { package = "frame-system", path = "../system", default-features = false }
@@ -25,7 +25,7 @@ std = [
"safe-mix/std",
"codec/std",
"sp-std/std",
"runtime-io/std",
"sp-io/std",
"support/std",
"sp-runtime/std",
"system/std",
+2 -2
View File
@@ -1200,14 +1200,14 @@ mod tests {
type Slash = ();
}
fn new_test_ext() -> runtime_io::TestExternalities {
fn new_test_ext() -> sp_io::TestExternalities {
let mut t = system::GenesisConfig::default().build_storage::<Test>().unwrap();
balances::GenesisConfig::<Test>{
balances: vec![(1, 10), (2, 20), (3, 30), (4, 40), (5, 50), (6, 60)],
vesting: vec![],
}.assimilate_storage(&mut t).unwrap();
GenesisConfig::default().assimilate_storage(&mut t).unwrap();
runtime_io::TestExternalities::new(t)
sp_io::TestExternalities::new(t)
}
type System = system::Module<Test>;
@@ -13,7 +13,7 @@ system = { package = "frame-system", path = "../system", default-features = fals
sp-std = { path = "../../primitives/std", default-features = false }
[dev-dependencies]
runtime_io = { package = "sp-io", path = "../../primitives/sr-io" }
sp-io = { path = "../../primitives/io" }
hex-literal = "0.2.1"
balances = { package = "pallet-balances", path = "../balances" }
primitives = { package = "sp-core", path = "../../primitives/core" }
@@ -929,7 +929,7 @@ mod tests {
self.term_duration = duration;
self
}
pub fn build(self) -> runtime_io::TestExternalities {
pub fn build(self) -> sp_io::TestExternalities {
VOTING_BOND.with(|v| *v.borrow_mut() = self.voter_bond);
TERM_DURATION.with(|v| *v.borrow_mut() = self.term_duration);
DESIRED_RUNNERS_UP.with(|v| *v.borrow_mut() = self.desired_runners_up);
+2 -2
View File
@@ -10,7 +10,7 @@ safe-mix = { version = "1.0.0", default-features = false }
codec = { package = "parity-scale-codec", version = "1.0.0", default-features = false, features = ["derive"] }
primitives = { package = "sp-core", path = "../../primitives/core", default-features = false }
sp-std = { path = "../../primitives/std", default-features = false }
runtime-io = { package = "sp-io", path = "../../primitives/sr-io", default-features = false }
sp-io = { path = "../../primitives/io", default-features = false }
sp-runtime = { path = "../../primitives/runtime", default-features = false }
support = { package = "frame-support", path = "../support", default-features = false }
system = { package = "frame-system", path = "../system", default-features = false }
@@ -27,7 +27,7 @@ std = [
"primitives/std",
"sp-std/std",
"serde",
"runtime-io/std",
"sp-io/std",
"support/std",
"sp-runtime/std",
"system/std",
+2 -2
View File
@@ -204,7 +204,7 @@ impl ExtBuilder {
self.desired_seats = seats;
self
}
pub fn build(self) -> runtime_io::TestExternalities {
pub fn build(self) -> sp_io::TestExternalities {
VOTER_BOND.with(|v| *v.borrow_mut() = self.voter_bond);
VOTING_FEE.with(|v| *v.borrow_mut() = self.voting_fee);
PRESENT_SLASH_PER_VOTER.with(|v| *v.borrow_mut() = self.bad_presentation_punishment);
@@ -274,7 +274,7 @@ pub(crate) fn locks(who: &u64) -> Vec<u64> {
Balances::locks(who).iter().map(|l| l.amount).collect::<Vec<u64>>()
}
pub(crate) fn new_test_ext_with_candidate_holes() -> runtime_io::TestExternalities {
pub(crate) fn new_test_ext_with_candidate_holes() -> sp_io::TestExternalities {
let mut t = ExtBuilder::default().build();
t.execute_with(|| {
<elections::Candidates<Test>>::put(vec![0, 0, 1]);
+2 -2
View File
@@ -14,7 +14,7 @@ balances = { package = "pallet-balances", path = "../balances", default-features
primitives = { package = "sp-core", path = "../../primitives/core", default-features = false }
sp-runtime = { path = "../../primitives/runtime", default-features = false }
sp-std = { path = "../../primitives/std", default-features = false }
runtime-io = { package = "sp-io", path = "../../primitives/sr-io", default-features = false }
sp-io = { path = "../../primitives/io", default-features = false }
primitive-types = { version = "0.6", default-features = false, features = ["rlp"] }
rlp = { version = "0.4", default-features = false }
evm = { version = "0.14", default-features = false }
@@ -30,7 +30,7 @@ std = [
"support/std",
"system/std",
"balances/std",
"runtime-io/std",
"sp-io/std",
"sp-std/std",
"sha3/std",
"rlp/std",
+1 -1
View File
@@ -96,7 +96,7 @@ impl<'vicinity, T: Trait> BackendT for Backend<'vicinity, T> {
}
fn chain_id(&self) -> U256 {
U256::from(runtime_io::misc::chain_id())
U256::from(sp_io::misc::chain_id())
}
fn exists(&self, _address: H160) -> bool {
+2 -2
View File
@@ -12,7 +12,7 @@ system = { package = "frame-system", path = "../system", default-features = fals
balances = { package = "pallet-balances", path = "../balances", default-features = false }
sp-runtime = { path = "../../primitives/runtime", default-features = false }
sp-std = { path = "../../primitives/std", default-features = false }
runtime-io = { package = "sp-io", path = "../../primitives/sr-io", default-features = false }
sp-io = { path = "../../primitives/io", default-features = false }
[dev-dependencies]
primitives = { package = "sp-core", path = "../../primitives/core" }
@@ -26,6 +26,6 @@ std = [
"support/std",
"system/std",
"balances/std",
"runtime-io/std",
"sp-io/std",
"sp-std/std"
]
+2 -2
View File
@@ -530,7 +530,7 @@ decl_module! {
fn offchain_worker(_n: T::BlockNumber) {
// We don't do anything here.
// but we could dispatch extrinsic (transaction/unsigned/inherent) using
// runtime_io::submit_extrinsic
// sp_io::submit_extrinsic
}
}
}
@@ -709,7 +709,7 @@ mod tests {
// This function basically just builds a genesis storage key/value store according to
// our desired mockup.
fn new_test_ext() -> runtime_io::TestExternalities {
fn new_test_ext() -> sp_io::TestExternalities {
let mut t = system::GenesisConfig::default().build_storage::<Test>().unwrap();
// We use default for brevity, but you can configure as desired if needed.
balances::GenesisConfig::<Test>::default().assimilate_storage(&mut t).unwrap();
+2 -2
View File
@@ -8,7 +8,7 @@ edition = "2018"
serde = { version = "1.0.101", optional = true }
codec = { package = "parity-scale-codec", version = "1.0.0", default-features = false, features = ["derive"] }
sp-std = { path = "../../primitives/std", default-features = false }
runtime-io ={ package = "sp-io", path = "../../primitives/sr-io", default-features = false }
sp-io ={ path = "../../primitives/io", default-features = false }
sp-runtime = { path = "../../primitives/runtime", default-features = false }
support = { package = "frame-support", path = "../support", default-features = false }
system = { package = "frame-system", path = "../system", default-features = false }
@@ -28,6 +28,6 @@ std = [
"serde",
"codec/std",
"sp-runtime/std",
"runtime-io/std",
"sp-io/std",
"system/std",
]
+2 -2
View File
@@ -493,7 +493,7 @@ mod tests {
}.assimilate_storage(&mut t).unwrap();
let xt = sp_runtime::testing::TestXt(sign_extra(1, 0, 0), Call::Balances(BalancesCall::transfer(2, 69)));
let weight = xt.get_dispatch_info().weight as u64;
let mut t = runtime_io::TestExternalities::new(t);
let mut t = sp_io::TestExternalities::new(t);
t.execute_with(|| {
Executive::initialize_block(&Header::new(
1,
@@ -509,7 +509,7 @@ mod tests {
});
}
fn new_test_ext(balance_factor: u64) -> runtime_io::TestExternalities {
fn new_test_ext(balance_factor: u64) -> sp_io::TestExternalities {
let mut t = system::GenesisConfig::default().build_storage::<Runtime>().unwrap();
balances::GenesisConfig::<Runtime> {
balances: vec![(1, 111 * balance_factor)],
+1 -1
View File
@@ -17,7 +17,7 @@ impl-trait-for-tuples = "0.1.3"
[dev-dependencies]
primitives = { package = "sp-core", path = "../../primitives/core", default-features = false }
runtime-io = { package = "sp-io", path = "../../primitives/sr-io", default-features = false }
sp-io = { path = "../../primitives/io", default-features = false }
[features]
default = ["std"]
+1 -1
View File
@@ -193,7 +193,7 @@ impl<T: Trait> ProvideInherent for Module<T> {
mod tests {
use super::*;
use runtime_io::TestExternalities;
use sp_io::TestExternalities;
use primitives::H256;
use sp_runtime::{
testing::Header, Perbill,
+1 -1
View File
@@ -13,7 +13,7 @@ support = { package = "frame-support", path = "../support", default-features = f
system = { package = "frame-system", path = "../system", default-features = false }
[dev-dependencies]
runtime-io ={ package = "sp-io", path = "../../primitives/sr-io" }
sp-io ={ path = "../../primitives/io" }
primitives = { package = "sp-core", path = "../../primitives/core" }
[features]
+2 -2
View File
@@ -117,7 +117,7 @@ impl ExtBuilder {
}
// builds genesis config
pub fn build(self) -> runtime_io::TestExternalities {
pub fn build(self) -> sp_io::TestExternalities {
let mut t = system::GenesisConfig::default().build_storage::<Test>().unwrap();
GenesisConfig::<Test> {
@@ -136,7 +136,7 @@ impl ExtBuilder {
// This function basically just builds a genesis storage key/value store according to
// our desired mockup.
pub fn new_test_ext() -> runtime_io::TestExternalities {
pub fn new_test_ext() -> sp_io::TestExternalities {
system::GenesisConfig::default()
.build_storage::<Test>()
.unwrap()
+1 -1
View File
@@ -18,7 +18,7 @@ session = { package = "pallet-session", path = "../session", default-features =
finality-tracker = { package = "pallet-finality-tracker", path = "../finality-tracker", default-features = false }
[dev-dependencies]
runtime-io ={ package = "sp-io", path = "../../primitives/sr-io" }
sp-io ={ path = "../../primitives/io" }
[features]
default = ["std"]
+2 -2
View File
@@ -19,7 +19,7 @@
#![cfg(test)]
use sp_runtime::{Perbill, DigestItem, traits::IdentityLookup, testing::{Header, UintAuthorityId}};
use runtime_io;
use sp_io;
use support::{impl_outer_origin, impl_outer_event, parameter_types, weights::Weight};
use primitives::H256;
use codec::{Encode, Decode};
@@ -81,7 +81,7 @@ pub fn to_authorities(vec: Vec<(u64, u64)>) -> AuthorityList {
.collect()
}
pub fn new_test_ext(authorities: Vec<(u64, u64)>) -> runtime_io::TestExternalities {
pub fn new_test_ext(authorities: Vec<(u64, u64)>) -> sp_io::TestExternalities {
let mut t = system::GenesisConfig::default().build_storage::<Test>().unwrap();
GenesisConfig {
authorities: to_authorities(authorities),
+2 -2
View File
@@ -9,7 +9,7 @@ serde = { version = "1.0.101", optional = true }
codec = { package = "parity-scale-codec", version = "1.0.0", default-features = false, features = ["derive"] }
enumflags2 = { version = "0.6.2" }
sp-std = { path = "../../primitives/std", default-features = false }
runtime-io = { package = "sp-io", path = "../../primitives/sr-io", default-features = false }
sp-io = { path = "../../primitives/io", default-features = false }
sp-runtime = { path = "../../primitives/runtime", default-features = false }
support = { package = "frame-support", path = "../support", default-features = false }
system = { package = "frame-system", path = "../system", default-features = false }
@@ -24,7 +24,7 @@ std = [
"serde",
"codec/std",
"sp-std/std",
"runtime-io/std",
"sp-io/std",
"sp-runtime/std",
"support/std",
"system/std",
+1 -1
View File
@@ -853,7 +853,7 @@ mod tests {
// This function basically just builds a genesis storage key/value store according to
// our desired mockup.
fn new_test_ext() -> runtime_io::TestExternalities {
fn new_test_ext() -> sp_io::TestExternalities {
let mut t = system::GenesisConfig::default().build_storage::<Test>().unwrap();
// We use default for brevity, but you can configure as desired if needed.
balances::GenesisConfig::<Test> {
+2 -2
View File
@@ -12,7 +12,7 @@ primitives = { package="sp-core", path = "../../primitives/core", default-featur
sp-std = { path = "../../primitives/std", default-features = false }
serde = { version = "1.0.101", optional = true }
session = { package = "pallet-session", path = "../session", default-features = false }
runtime-io = { package = "sp-io", path = "../../primitives/sr-io", default-features = false }
sp-io = { path = "../../primitives/io", default-features = false }
sp-runtime = { path = "../../primitives/runtime", default-features = false }
sp-staking = { path = "../../primitives/sr-staking-primitives", default-features = false }
support = { package = "frame-support", path = "../support", default-features = false }
@@ -28,7 +28,7 @@ std = [
"sp-std/std",
"serde",
"session/std",
"runtime-io/std",
"sp-io/std",
"sp-runtime/std",
"sp-staking/std",
"support/std",
+5 -5
View File
@@ -285,7 +285,7 @@ decl_module! {
debug::RuntimeLogger::init();
// Only send messages if we are a potential validator.
if runtime_io::offchain::is_validator() {
if sp_io::offchain::is_validator() {
Self::offchain(now);
}
}
@@ -408,7 +408,7 @@ impl<T: Trait> Module<T> {
continue;
}
let network_state = runtime_io::offchain::network_state()
let network_state = sp_io::offchain::network_state()
.map_err(|_| OffchainErr::NetworkState)?;
let heartbeat_data = Heartbeat {
block_number,
@@ -453,7 +453,7 @@ impl<T: Trait> Module<T> {
done,
gossipping_at,
};
runtime_io::offchain::local_storage_compare_and_set(
sp_io::offchain::local_storage_compare_and_set(
StorageKind::PERSISTENT,
DB_KEY,
curr_worker_status,
@@ -469,7 +469,7 @@ impl<T: Trait> Module<T> {
done,
gossipping_at,
};
runtime_io::offchain::local_storage_set(StorageKind::PERSISTENT, DB_KEY, &enc.encode());
sp_io::offchain::local_storage_set(StorageKind::PERSISTENT, DB_KEY, &enc.encode());
}
// Checks if a heartbeat gossip already occurred at this block number.
@@ -479,7 +479,7 @@ impl<T: Trait> Module<T> {
now: T::BlockNumber,
next_gossip: T::BlockNumber,
) -> Result<(Option<Vec<u8>>, bool), OffchainErr> {
let last_gossip = runtime_io::offchain::local_storage_get(StorageKind::PERSISTENT, DB_KEY);
let last_gossip = sp_io::offchain::local_storage_get(StorageKind::PERSISTENT, DB_KEY);
match last_gossip {
Some(last) => {
let worker_status: WorkerStatus<T::BlockNumber> = Decode::decode(&mut &last[..])
+2 -2
View File
@@ -27,7 +27,7 @@ use sp_runtime::testing::{Header, UintAuthorityId, TestXt};
use sp_runtime::traits::{IdentityLookup, BlakeTwo256, ConvertInto};
use primitives::H256;
use support::{impl_outer_origin, impl_outer_dispatch, parameter_types, weights::Weight};
use {runtime_io, system};
use {sp_io, system};
impl_outer_origin!{
pub enum Origin for Runtime {}
@@ -85,7 +85,7 @@ impl ReportOffence<u64, IdentificationTuple, Offence> for OffenceHandler {
}
}
pub fn new_test_ext() -> runtime_io::TestExternalities {
pub fn new_test_ext() -> sp_io::TestExternalities {
let t = system::GenesisConfig::default().build_storage::<Runtime>().unwrap();
t.into()
}
+2 -2
View File
@@ -224,7 +224,7 @@ fn should_generate_heartbeats() {
assert_eq!(heartbeat, Heartbeat {
block_number: 2,
network_state: runtime_io::offchain::network_state().unwrap(),
network_state: sp_io::offchain::network_state().unwrap(),
session_index: 2,
authority_index: 2,
});
@@ -329,7 +329,7 @@ fn should_not_send_a_report_if_already_online() {
assert_eq!(heartbeat, Heartbeat {
block_number: 4,
network_state: runtime_io::offchain::network_state().unwrap(),
network_state: sp_io::offchain::network_state().unwrap(),
session_index: 2,
authority_index: 0,
});
+2 -2
View File
@@ -10,7 +10,7 @@ safe-mix = { version = "1.0.0", default-features = false }
codec = { package = "parity-scale-codec", version = "1.0.0", default-features = false, features = ["derive"] }
sp-keyring = { path = "../../primitives/keyring", optional = true }
sp-std = { path = "../../primitives/std", default-features = false }
runtime-io = { package = "sp-io", path = "../../primitives/sr-io", default-features = false }
sp-io = { path = "../../primitives/io", default-features = false }
sp-runtime = { path = "../../primitives/runtime", default-features = false }
primitives = { package = "sp-core", path = "../../primitives/core", default-features = false }
support = { package = "frame-support", path = "../support", default-features = false }
@@ -28,7 +28,7 @@ std = [
"codec/std",
"primitives/std",
"sp-std/std",
"runtime-io/std",
"sp-io/std",
"support/std",
"sp-runtime/std",
"system/std",
+2 -2
View File
@@ -24,7 +24,7 @@ use sp_runtime::testing::Header;
use sp_runtime::Perbill;
use primitives::H256;
use support::{impl_outer_origin, parameter_types, weights::Weight};
use {runtime_io, system};
use {sp_io, system};
use crate::{GenesisConfig, Module, Trait, IsDeadAccount, OnNewAccount, ResolveHint};
impl_outer_origin!{
@@ -95,7 +95,7 @@ impl Trait for Runtime {
type Event = ();
}
pub fn new_test_ext() -> runtime_io::TestExternalities {
pub fn new_test_ext() -> sp_io::TestExternalities {
{
let mut h = ALIVE.borrow_mut();
h.clear();
+2 -2
View File
@@ -8,7 +8,7 @@ edition = "2018"
serde = { version = "1.0.101", optional = true }
codec = { package = "parity-scale-codec", version = "1.0.0", default-features = false }
sp-std = { path = "../../primitives/std", default-features = false }
runtime-io = { package = "sp-io", path = "../../primitives/sr-io", default-features = false }
sp-io = { path = "../../primitives/io", default-features = false }
support = { package = "frame-support", path = "../support", default-features = false }
system = { package = "frame-system", path = "../system", default-features = false }
sp-runtime = { path = "../../primitives/runtime", default-features = false }
@@ -23,7 +23,7 @@ std = [
"codec/std",
"sp-runtime/std",
"sp-std/std",
"runtime-io/std",
"sp-io/std",
"support/std",
"system/std",
]
+1 -1
View File
@@ -306,7 +306,7 @@ mod tests {
// This function basically just builds a genesis storage key/value store according to
// our desired mockup.
fn new_test_ext() -> runtime_io::TestExternalities {
fn new_test_ext() -> sp_io::TestExternalities {
let mut t = system::GenesisConfig::default().build_storage::<Test>().unwrap();
// We use default for brevity, but you can configure as desired if needed.
GenesisConfig::<Test>{
+2 -2
View File
@@ -8,7 +8,7 @@ edition = "2018"
serde = { version = "1.0.101", optional = true }
codec = { package = "parity-scale-codec", version = "1.0.0", default-features = false, features = ["derive"] }
sp-std = { path = "../../primitives/std", default-features = false }
runtime-io = { package = "sp-io", path = "../../primitives/sr-io", default-features = false }
sp-io = { path = "../../primitives/io", default-features = false }
sp-runtime = { path = "../../primitives/runtime", default-features = false }
support = { package = "frame-support", path = "../support", default-features = false }
system = { package = "frame-system", path = "../system", default-features = false }
@@ -23,7 +23,7 @@ std = [
"serde",
"codec/std",
"sp-std/std",
"runtime-io/std",
"sp-io/std",
"sp-runtime/std",
"support/std",
"system/std",
+1 -1
View File
@@ -306,7 +306,7 @@ mod tests {
// This function basically just builds a genesis storage key/value store according to
// our desired mockup.
fn new_test_ext() -> runtime_io::TestExternalities {
fn new_test_ext() -> sp_io::TestExternalities {
let mut t = system::GenesisConfig::default().build_storage::<Test>().unwrap();
// We use default for brevity, but you can configure as desired if needed.
balances::GenesisConfig::<Test> {
+1 -1
View File
@@ -15,7 +15,7 @@ support = { package = "frame-support", path = "../support", default-features = f
system = { package = "frame-system", path = "../system", default-features = false }
[dev-dependencies]
runtime-io = { package = "sp-io", path = "../../primitives/sr-io" }
sp-io = { path = "../../primitives/io" }
sp-core = { path = "../../primitives/core" }
[features]
+2 -2
View File
@@ -33,7 +33,7 @@ use support::{
impl_outer_origin, impl_outer_event, parameter_types, StorageMap, StorageDoubleMap,
weights::Weight,
};
use {runtime_io, system};
use {sp_io, system};
impl_outer_origin!{
pub enum Origin for Runtime {}
@@ -106,7 +106,7 @@ impl_outer_event! {
}
}
pub fn new_test_ext() -> runtime_io::TestExternalities {
pub fn new_test_ext() -> sp_io::TestExternalities {
let t = system::GenesisConfig::default().build_storage::<Runtime>().unwrap();
t.into()
}
@@ -14,7 +14,7 @@ sp-std = { path = "../../primitives/std", default-features = false }
[dev-dependencies]
primitives = { package = "sp-core", path = "../../primitives/core" }
runtime-io = { package = "sp-io", path = "../../primitives/sr-io" }
sp-io = { path = "../../primitives/io" }
[features]
default = ["std"]
@@ -193,7 +193,7 @@ mod tests {
type System = system::Module<Test>;
type CollectiveFlip = Module<Test>;
fn new_test_ext() -> runtime_io::TestExternalities {
fn new_test_ext() -> sp_io::TestExternalities {
let t = system::GenesisConfig::default().build_storage::<Test>().unwrap();
t.into()
}
+2 -2
View File
@@ -7,7 +7,7 @@ edition = "2018"
[dependencies]
codec = { package = "parity-scale-codec", version = "1.0.0", default-features = false, features = ["derive"] }
serde = { version = "1.0.101", optional = true }
runtime-io = { package = "sp-io", path = "../../primitives/sr-io", default-features = false }
sp-io = { path = "../../primitives/io", default-features = false }
sp-runtime = { path = "../../primitives/runtime", default-features = false }
sp-std = { path = "../../primitives/std", default-features = false }
support = { package = "frame-support", path = "../support", default-features = false }
@@ -22,7 +22,7 @@ default = ["std"]
std = [
"codec/std",
"serde",
"runtime-io/std",
"sp-io/std",
"sp-runtime/std",
"sp-std/std",
"support/std",
+1 -1
View File
@@ -125,7 +125,7 @@ impl Trait for Test {
// This function basically just builds a genesis storage key/value store according to
// our desired mockup.
pub fn new_test_ext() -> runtime_io::TestExternalities {
pub fn new_test_ext() -> sp_io::TestExternalities {
let mut t = system::GenesisConfig::default().build_storage::<Test>().unwrap();
// We use default for brevity, but you can configure as desired if needed.
balances::GenesisConfig::<Test> {
+2 -2
View File
@@ -15,7 +15,7 @@ support = { package = "frame-support", path = "../support", default-features = f
system = { package = "frame-system", path = "../system", default-features = false }
timestamp = { package = "pallet-timestamp", path = "../timestamp", default-features = false }
sp-trie = { path = "../../primitives/trie", default-features = false, optional = true }
runtime-io ={ package = "sp-io", path = "../../primitives/sr-io", default-features = false }
sp-io ={ path = "../../primitives/io", default-features = false }
impl-trait-for-tuples = "0.1.3"
[dev-dependencies]
@@ -36,5 +36,5 @@ std = [
"sp-staking/std",
"timestamp/std",
"sp-trie/std",
"runtime-io/std",
"sp-io/std",
]
+2 -2
View File
@@ -320,14 +320,14 @@ mod tests {
type Historical = Module<Test>;
fn new_test_ext() -> runtime_io::TestExternalities {
fn new_test_ext() -> sp_io::TestExternalities {
let mut t = system::GenesisConfig::default().build_storage::<Test>().unwrap();
crate::GenesisConfig::<Test> {
keys: NEXT_VALIDATORS.with(|l|
l.borrow().iter().cloned().map(|i| (i, UintAuthorityId(i).into())).collect()
),
}.assimilate_storage(&mut t).unwrap();
runtime_io::TestExternalities::new(t)
sp_io::TestExternalities::new(t)
}
#[test]
+2 -2
View File
@@ -729,14 +729,14 @@ mod tests {
reset_before_session_end_called, before_session_end_called,
};
fn new_test_ext() -> runtime_io::TestExternalities {
fn new_test_ext() -> sp_io::TestExternalities {
let mut t = system::GenesisConfig::default().build_storage::<Test>().unwrap();
GenesisConfig::<Test> {
keys: NEXT_VALIDATORS.with(|l|
l.borrow().iter().cloned().map(|i| (i, UintAuthorityId(i).into())).collect()
),
}.assimilate_storage(&mut t).unwrap();
runtime_io::TestExternalities::new(t)
sp_io::TestExternalities::new(t)
}
fn initialize_block(block: u64) {
+2 -2
View File
@@ -11,7 +11,7 @@ codec = { package = "parity-scale-codec", version = "1.0.0", default-features =
sp-keyring = { path = "../../primitives/keyring", optional = true }
sp-std = { path = "../../primitives/std", default-features = false }
phragmen = { package = "sp-phragmen", path = "../../primitives/phragmen", default-features = false }
runtime-io ={ package = "sp-io", path = "../../primitives/sr-io", default-features = false }
sp-io ={ path = "../../primitives/io", default-features = false }
sp-runtime = { path = "../../primitives/runtime", default-features = false }
sp-staking = { path = "../../primitives/sr-staking-primitives", default-features = false }
support = { package = "frame-support", path = "../support", default-features = false }
@@ -37,7 +37,7 @@ std = [
"codec/std",
"sp-std/std",
"phragmen/std",
"runtime-io/std",
"sp-io/std",
"support/std",
"sp-runtime/std",
"sp-staking/std",
+3 -3
View File
@@ -23,7 +23,7 @@ use sp_runtime::traits::{IdentityLookup, Convert, OpaqueKeys, OnInitialize, Satu
use sp_runtime::testing::{Header, UintAuthorityId};
use sp_staking::{SessionIndex, offence::{OffenceDetails, OnOffenceHandler}};
use primitives::{H256, crypto::key_types};
use runtime_io;
use sp_io;
use support::{
assert_ok, impl_outer_origin, parameter_types, StorageLinkedMap, StorageValue,
traits::{Currency, Get, FindAuthor},
@@ -289,7 +289,7 @@ impl ExtBuilder {
EXISTENTIAL_DEPOSIT.with(|v| *v.borrow_mut() = self.existential_deposit);
SLASH_DEFER_DURATION.with(|v| *v.borrow_mut() = self.slash_defer_duration);
}
pub fn build(self) -> runtime_io::TestExternalities {
pub fn build(self) -> sp_io::TestExternalities {
self.set_associated_consts();
let mut storage = system::GenesisConfig::default().build_storage::<Test>().unwrap();
let balance_factor = if self.existential_deposit > 0 {
@@ -355,7 +355,7 @@ impl ExtBuilder {
keys: validators.iter().map(|x| (*x, UintAuthorityId(*x))).collect(),
}.assimilate_storage(&mut storage);
let mut ext = runtime_io::TestExternalities::from(storage);
let mut ext = sp_io::TestExternalities::from(storage);
ext.execute_with(|| {
let validators = Session::validators();
SESSION.with(|x|
+2 -2
View File
@@ -8,7 +8,7 @@ edition = "2018"
serde = { version = "1.0.101", optional = true }
codec = { package = "parity-scale-codec", version = "1.0.0", default-features = false, features = ["derive"] }
sp-std = { path = "../../primitives/std", default-features = false }
runtime-io = { package = "sp-io", path = "../../primitives/sr-io", default-features = false }
sp-io = { path = "../../primitives/io", default-features = false }
sp-runtime = { path = "../../primitives/runtime", default-features = false }
support = { package = "frame-support", path = "../support", default-features = false }
system = { package = "frame-system", path = "../system", default-features = false }
@@ -22,7 +22,7 @@ std = [
"serde",
"codec/std",
"sp-std/std",
"runtime-io/std",
"sp-io/std",
"sp-runtime/std",
"support/std",
"system/std",
+2 -2
View File
@@ -10,7 +10,7 @@ serde = { version = "1.0.101", optional = true, features = ["derive"] }
codec = { package = "parity-scale-codec", version = "1.0.6", default-features = false, features = ["derive"] }
frame-metadata = { path = "../metadata", default-features = false }
sp-std = { path = "../../primitives/std", default-features = false }
runtime-io ={ package = "sp-io", path = "../../primitives/sr-io", default-features = false }
sp-io ={ path = "../../primitives/io", default-features = false }
sp-runtime = { path = "../../primitives/runtime", default-features = false }
primitives = { package = "sp-core", path = "../../primitives/core", default-features = false }
sp-arithmetic = { path = "../../primitives/sr-arithmetic", default-features = false }
@@ -34,7 +34,7 @@ std = [
"once_cell",
"bitmask/std",
"serde",
"runtime-io/std",
"sp-io/std",
"codec/std",
"sp-std/std",
"sp-runtime/std",
+2 -2
View File
@@ -155,7 +155,7 @@ impl fmt::Write for Writer {
impl Writer {
/// Print the content of this `Writer` out.
pub fn print(&self) {
runtime_io::misc::print_utf8(&self.0)
sp_io::misc::print_utf8(&self.0)
}
}
@@ -204,7 +204,7 @@ impl log::Log for RuntimeLogger {
let mut w = Writer::default();
let _ = core::write!(&mut w, "{}", record.args());
runtime_io::logging::log(
sp_io::logging::log(
record.level().into(),
record.target(),
&w.0,
+1 -1
View File
@@ -18,7 +18,7 @@
use codec::Codec;
use sp_std::prelude::Vec;
use runtime_io::hashing::{blake2_128, blake2_256, twox_64, twox_128, twox_256};
use sp_io::hashing::{blake2_128, blake2_256, twox_64, twox_128, twox_256};
// This trait must be kept coherent with frame-support-procedural HasherKind usage
pub trait Hashable: Sized {
+2 -2
View File
@@ -41,7 +41,7 @@ pub use paste;
#[doc(hidden)]
pub use state_machine::BasicExternalities;
#[doc(hidden)]
pub use runtime_io::storage::root as storage_root;
pub use sp_io::storage::root as storage_root;
#[doc(hidden)]
pub use sp_runtime::RuntimeDebug;
@@ -249,7 +249,7 @@ mod tests {
type Origin = u32;
}
fn new_test_ext() -> runtime_io::TestExternalities {
fn new_test_ext() -> sp_io::TestExternalities {
GenesisConfig::default().build_storage().unwrap().into()
}
+7 -7
View File
@@ -26,7 +26,7 @@ use codec::{Codec, Encode, Decode};
/// Return the value of the item in storage under `key`, or `None` if there is no explicit entry.
pub fn get<T: Decode + Sized>(storage_key: &[u8], key: &[u8]) -> Option<T> {
runtime_io::storage::child_get(storage_key, key).and_then(|v| {
sp_io::storage::child_get(storage_key, key).and_then(|v| {
Decode::decode(&mut &v[..]).map(Some).unwrap_or_else(|_| {
// TODO #3700: error should be handleable.
runtime_print!("ERROR: Corrupted state in child trie at {:?}/{:?}", storage_key, key);
@@ -59,7 +59,7 @@ pub fn get_or_else<T: Decode + Sized, F: FnOnce() -> T>(
/// Put `value` in storage under `key`.
pub fn put<T: Encode>(storage_key: &[u8], key: &[u8], value: &T) {
value.using_encoded(|slice| runtime_io::storage::child_set(storage_key, key, slice));
value.using_encoded(|slice| sp_io::storage::child_set(storage_key, key, slice));
}
/// Remove `key` from storage, returning its value if it had an explicit entry or `None` otherwise.
@@ -95,25 +95,25 @@ pub fn take_or_else<T: Codec + Sized, F: FnOnce() -> T>(
/// Check to see if `key` has an explicit entry in storage.
pub fn exists(storage_key: &[u8], key: &[u8]) -> bool {
runtime_io::storage::child_read(storage_key, key, &mut [0;0][..], 0).is_some()
sp_io::storage::child_read(storage_key, key, &mut [0;0][..], 0).is_some()
}
/// Remove all `storage_key` key/values
pub fn kill_storage(storage_key: &[u8]) {
runtime_io::storage::child_storage_kill(storage_key)
sp_io::storage::child_storage_kill(storage_key)
}
/// Ensure `key` has no explicit entry in storage.
pub fn kill(storage_key: &[u8], key: &[u8]) {
runtime_io::storage::child_clear(storage_key, key);
sp_io::storage::child_clear(storage_key, key);
}
/// Get a Vec of bytes from storage.
pub fn get_raw(storage_key: &[u8], key: &[u8]) -> Option<Vec<u8>> {
runtime_io::storage::child_get(storage_key, key)
sp_io::storage::child_get(storage_key, key)
}
/// Put a raw byte slice into storage.
pub fn put_raw(storage_key: &[u8], key: &[u8], value: &[u8]) {
runtime_io::storage::child_set(storage_key, key, value)
sp_io::storage::child_set(storage_key, key, value)
}
@@ -35,7 +35,7 @@ pub use value::StorageValue;
#[cfg(test)]
#[allow(dead_code)]
mod tests {
use runtime_io::TestExternalities;
use sp_io::TestExternalities;
use codec::{Encode, Decode};
use crate::storage::{unhashed, generator::{StorageValue, StorageLinkedMap}};
+3 -3
View File
@@ -364,7 +364,7 @@ impl<Value: Decode> Iterator for PrefixIterator<Value> {
type Item = Value;
fn next(&mut self) -> Option<Self::Item> {
match runtime_io::storage::next_key(&self.previous_key) {
match sp_io::storage::next_key(&self.previous_key) {
Some(next_key) if next_key.starts_with(&self.prefix[..]) => {
let value = unhashed::get(&next_key);
@@ -406,7 +406,7 @@ pub trait StoragePrefixedMap<Value: FullCodec> {
}
fn remove_all() {
runtime_io::storage::clear_prefix(&Self::final_prefix())
sp_io::storage::clear_prefix(&Self::final_prefix())
}
fn iter() -> PrefixIterator<Value> {
@@ -422,7 +422,7 @@ pub trait StoragePrefixedMap<Value: FullCodec> {
#[cfg(test)]
mod test {
use primitives::hashing::twox_128;
use runtime_io::TestExternalities;
use sp_io::TestExternalities;
use crate::storage::{unhashed, StoragePrefixedMap};
#[test]
@@ -21,7 +21,7 @@ use codec::{Encode, Decode};
/// Return the value of the item in storage under `key`, or `None` if there is no explicit entry.
pub fn get<T: Decode + Sized>(key: &[u8]) -> Option<T> {
runtime_io::storage::get(key).and_then(|val| {
sp_io::storage::get(key).and_then(|val| {
Decode::decode(&mut &val[..]).map(Some).unwrap_or_else(|_| {
// TODO #3700: error should be handleable.
runtime_print!("ERROR: Corrupted state at {:?}", key);
@@ -50,7 +50,7 @@ pub fn get_or_else<T: Decode + Sized, F: FnOnce() -> T>(key: &[u8], default_valu
/// Put `value` in storage under `key`.
pub fn put<T: Encode + ?Sized>(key: &[u8], value: &T) {
value.using_encoded(|slice| runtime_io::storage::set(key, slice));
value.using_encoded(|slice| sp_io::storage::set(key, slice));
}
/// Remove `key` from storage, returning its value if it had an explicit entry or `None` otherwise.
@@ -82,25 +82,25 @@ pub fn take_or_else<T: Decode + Sized, F: FnOnce() -> T>(key: &[u8], default_val
/// Check to see if `key` has an explicit entry in storage.
pub fn exists(key: &[u8]) -> bool {
runtime_io::storage::read(key, &mut [0;0][..], 0).is_some()
sp_io::storage::read(key, &mut [0;0][..], 0).is_some()
}
/// Ensure `key` has no explicit entry in storage.
pub fn kill(key: &[u8]) {
runtime_io::storage::clear(key);
sp_io::storage::clear(key);
}
/// Ensure keys with the given `prefix` have no entries in storage.
pub fn kill_prefix(prefix: &[u8]) {
runtime_io::storage::clear_prefix(prefix);
sp_io::storage::clear_prefix(prefix);
}
/// Get a Vec of bytes from storage.
pub fn get_raw(key: &[u8]) -> Option<Vec<u8>> {
runtime_io::storage::get(key)
sp_io::storage::get(key)
}
/// Put a raw byte slice into storage.
pub fn put_raw(key: &[u8], value: &[u8]) {
runtime_io::storage::set(key, value)
sp_io::storage::set(key, value)
}
+2 -2
View File
@@ -7,7 +7,7 @@ edition = "2018"
[dependencies]
serde = { version = "1.0.101", default-features = false, features = ["derive"] }
codec = { package = "parity-scale-codec", version = "1.0.0", default-features = false, features = ["derive"] }
runtime-io ={ package = "sp-io", path = "../../../primitives/sr-io", default-features = false }
sp-io ={ path = "../../../primitives/io", default-features = false }
state-machine ={ package = "sp-state-machine", path = "../../../primitives/state-machine", optional = true }
support = { package = "frame-support", version = "2", path = "../", default-features = false }
inherents = { package = "sp-inherents", path = "../../../primitives/inherents", default-features = false }
@@ -21,7 +21,7 @@ default = ["std"]
std = [
"serde/std",
"codec/std",
"runtime-io/std",
"sp-io/std",
"support/std",
"inherents/std",
"primitives/std",
@@ -19,7 +19,7 @@
#[allow(dead_code)]
mod tests {
use support::metadata::*;
use runtime_io::TestExternalities;
use sp_io::TestExternalities;
use std::marker::PhantomData;
use codec::{Encode, Decode, EncodeLike};
@@ -535,7 +535,7 @@ mod test3 {
#[cfg(test)]
#[allow(dead_code)]
mod test_append_and_len {
use runtime_io::TestExternalities;
use sp_io::TestExternalities;
use codec::{Encode, Decode};
pub trait Trait {
@@ -17,7 +17,7 @@
use support::storage::unhashed;
use codec::Encode;
use support::{StorageDoubleMap, StorageLinkedMap, StorageMap, StorageValue, StoragePrefixedMap};
use runtime_io::{TestExternalities, hashing::{twox_128, blake2_128, blake2_256}};
use sp_io::{TestExternalities, hashing::{twox_128, blake2_128, blake2_256}};
mod no_instance {
use codec::{Encode, Decode, EncodeLike};
@@ -271,7 +271,7 @@ pub type Header = generic::Header<BlockNumber, BlakeTwo256>;
pub type Block = generic::Block<Header, UncheckedExtrinsic>;
pub type UncheckedExtrinsic = generic::UncheckedExtrinsic<u32, Call, Signature, ()>;
fn new_test_ext() -> runtime_io::TestExternalities {
fn new_test_ext() -> sp_io::TestExternalities {
GenesisConfig{
module1_Instance1: Some(module1::GenesisConfig {
value: 3,
+2 -2
View File
@@ -10,7 +10,7 @@ safe-mix = { version = "1.0.0", default-features = false }
codec = { package = "parity-scale-codec", version = "1.0.0", default-features = false, features = ["derive"] }
primitives = { package = "sp-core", path = "../../primitives/core", default-features = false }
sp-std = { path = "../../primitives/std", default-features = false }
runtime-io ={ package = "sp-io", path = "../../primitives/sr-io", default-features = false }
sp-io ={ path = "../../primitives/io", default-features = false }
sp-runtime = { path = "../../primitives/runtime", default-features = false }
sp-version = { path = "../../primitives/sr-version", default-features = false }
support = { package = "frame-support", path = "../support", default-features = false }
@@ -27,7 +27,7 @@ std = [
"codec/std",
"primitives/std",
"sp-std/std",
"runtime-io/std",
"sp-io/std",
"support/std",
"sp-runtime/std",
"sp-version/std",

Some files were not shown because too many files have changed in this diff Show More