Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Commit

Permalink
Rename: primitives/sr-io -> primitives/sp-io (#4328)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
kigawas authored and bkchr committed Dec 10, 2019
1 parent 2b80f06 commit b2a6bd9
Show file tree
Hide file tree
Showing 134 changed files with 312 additions and 315 deletions.
7 changes: 3 additions & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion bin/node-template/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
Expand Down
4 changes: 2 additions & 2 deletions bin/node-template/runtime/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand Down Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion bin/node-template/runtime/src/template.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}

Expand Down
2 changes: 1 addition & 1 deletion bin/node/cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion bin/node/cli/src/factory_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
2 changes: 1 addition & 1 deletion bin/node/executor/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
Expand Down
2 changes: 1 addition & 1 deletion bin/node/runtime/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand Down
2 changes: 1 addition & 1 deletion bin/node/runtime/src/impls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion bin/node/testing/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
Expand Down
2 changes: 1 addition & 1 deletion bin/node/testing/src/keyring.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
2 changes: 1 addition & 1 deletion client/consensus/aura/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
Expand Down
2 changes: 1 addition & 1 deletion client/consensus/babe/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
Expand Down
2 changes: 1 addition & 1 deletion client/executor/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
Expand Down
4 changes: 2 additions & 2 deletions client/executor/runtime-test/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand All @@ -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"]
34 changes: 17 additions & 17 deletions client/executor/runtime-test/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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},
};
Expand Down Expand Up @@ -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(())
Expand Down
Loading

0 comments on commit b2a6bd9

Please sign in to comment.