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
+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",
+1 -1
View File
@@ -80,7 +80,7 @@ impl module::Trait for Runtime {
type Event = Event;
}
fn new_test_ext() -> runtime_io::TestExternalities {
fn new_test_ext() -> sp_io::TestExternalities {
system::GenesisConfig::default().build_storage::<Runtime>().unwrap().into()
}
+7 -7
View File
@@ -119,7 +119,7 @@ use support::{
use codec::{Encode, Decode};
#[cfg(any(feature = "std", test))]
use runtime_io::TestExternalities;
use sp_io::TestExternalities;
#[cfg(any(feature = "std", test))]
use primitives::ChangesTrieConfiguration;
@@ -422,11 +422,11 @@ decl_storage! {
build(|config: &GenesisConfig| {
use codec::Encode;
runtime_io::storage::set(well_known_keys::CODE, &config.code);
runtime_io::storage::set(well_known_keys::EXTRINSIC_INDEX, &0u32.encode());
sp_io::storage::set(well_known_keys::CODE, &config.code);
sp_io::storage::set(well_known_keys::EXTRINSIC_INDEX, &0u32.encode());
if let Some(ref changes_trie_config) = config.changes_trie_config {
runtime_io::storage::set(
sp_io::storage::set(
well_known_keys::CHANGES_TRIE_CONFIG,
&changes_trie_config.encode(),
);
@@ -668,9 +668,9 @@ impl<T: Trait> Module<T> {
}
}
let storage_root = T::Hash::decode(&mut &runtime_io::storage::root()[..])
let storage_root = T::Hash::decode(&mut &sp_io::storage::root()[..])
.expect("Node is configured to use the same hash; qed");
let storage_changes_root = runtime_io::storage::changes_root(&parent_hash.encode());
let storage_changes_root = sp_io::storage::changes_root(&parent_hash.encode());
// we can't compute changes trie root earlier && put it to the Digest
// because it will include all currently existing temporaries.
@@ -1187,7 +1187,7 @@ mod tests {
const CALL: &<Test as Trait>::Call = &();
fn new_test_ext() -> runtime_io::TestExternalities {
fn new_test_ext() -> sp_io::TestExternalities {
GenesisConfig::default().build_storage::<Test>().unwrap().into()
}
+2 -2
View File
@@ -111,7 +111,7 @@ pub trait SubmitSignedTransaction<T: crate::Trait, Call> {
::create_transaction::<Self::Signer>(call, public, id, expected)
.ok_or(())?;
let xt = Self::Extrinsic::new(call, Some(signature_data)).ok_or(())?;
runtime_io::offchain::submit_transaction(xt.encode())
sp_io::offchain::submit_transaction(xt.encode())
}
}
@@ -126,7 +126,7 @@ pub trait SubmitUnsignedTransaction<T: crate::Trait, Call> {
/// and `Err` if transaction was rejected from the pool.
fn submit_unsigned(call: impl Into<Call>) -> Result<(), ()> {
let xt = Self::Extrinsic::new(call.into(), None).ok_or(())?;
runtime_io::offchain::submit_transaction(xt.encode())
sp_io::offchain::submit_transaction(xt.encode())
}
}
+1 -1
View File
@@ -16,7 +16,7 @@ sp-timestamp = { path = "../../primitives/timestamp", default-features = false }
impl-trait-for-tuples = "0.1.3"
[dev-dependencies]
runtime-io ={ package = "sp-io", path = "../../primitives/sr-io" }
sp-io ={ path = "../../primitives/io" }
primitives = { package = "sp-core", path = "../../primitives/core" }
[features]
+1 -1
View File
@@ -241,7 +241,7 @@ mod tests {
use super::*;
use support::{impl_outer_origin, assert_ok, parameter_types, weights::Weight};
use runtime_io::TestExternalities;
use sp_io::TestExternalities;
use primitives::H256;
use sp_runtime::{Perbill, traits::{BlakeTwo256, IdentityLookup}, testing::Header};
@@ -13,7 +13,7 @@ system = { package = "frame-system", path = "../system", default-features = fals
transaction-payment-rpc-runtime-api = { package = "pallet-transaction-payment-rpc-runtime-api", path = "./rpc/runtime-api", 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" }
balances = { package = "pallet-balances", path = "../balances" }
@@ -380,7 +380,7 @@ mod tests {
TRANSACTION_BYTE_FEE.with(|v| *v.borrow_mut() = self.byte_fee);
WEIGHT_TO_FEE.with(|v| *v.borrow_mut() = self.weight_to_fee);
}
pub fn build(self) -> runtime_io::TestExternalities {
pub fn build(self) -> sp_io::TestExternalities {
self.set_constants();
let mut t = system::GenesisConfig::default().build_storage::<Runtime>().unwrap();
balances::GenesisConfig::<Runtime> {
+1 -1
View File
@@ -14,7 +14,7 @@ system = { package = "frame-system", path = "../system", default-features = fals
balances = { package = "pallet-balances", path = "../balances", 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
@@ -422,7 +422,7 @@ mod tests {
type Balances = balances::Module<Test>;
type Treasury = 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();
balances::GenesisConfig::<Test>{
// Total issuance will be 200 with treasury account initialized at ED.
@@ -620,7 +620,7 @@ mod tests {
vesting: vec![],
}.assimilate_storage(&mut t).unwrap();
// Treasury genesis config is not build thus treasury account does not exist
let mut t: runtime_io::TestExternalities = t.into();
let mut t: sp_io::TestExternalities = t.into();
t.execute_with(|| {
assert_eq!(Balances::free_balance(&Treasury::account_id()), 0); // Account does not exist
+2 -2
View File
@@ -11,7 +11,7 @@ support = { package = "frame-support", path = "../support", default-features = f
system = { package = "frame-system", path = "../system", 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" }
@@ -25,6 +25,6 @@ std = [
"sp-runtime/std",
"support/std",
"system/std",
"runtime-io/std",
"sp-io/std",
"sp-std/std"
]
+1 -1
View File
@@ -132,7 +132,7 @@ mod tests {
type Balances = balances::Module<Test>;
type Utility = 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();
balances::GenesisConfig::<Test> {
balances: vec![(1, 10), (2, 0)],