mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 18:07:58 +00:00
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:
committed by
Bastian Köcher
parent
1f84d6d41d
commit
4f2cdb20c1
@@ -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",
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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()
|
||||
}
|
||||
|
||||
|
||||
@@ -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}};
|
||||
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user