mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-09 21:21:11 +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 @@ primitives = { package = "sp-core", path = "../core", default-features = false }
|
||||
codec = { package = "parity-scale-codec", version = "1.0.0", default-features = false, features = ["derive"] }
|
||||
serde = { version = "1.0.101", optional = true, features = ["derive"] }
|
||||
sp-std = { path = "../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]
|
||||
test-client = { package = "substrate-test-runtime-client", path = "../../test/utils/runtime/client" }
|
||||
@@ -18,7 +18,7 @@ sp-runtime = { path = "../../primitives/runtime" }
|
||||
|
||||
[features]
|
||||
default = [ "std" ]
|
||||
std = [ "full_crypto", "primitives/std", "codec/std", "serde", "sp-std/std", "runtime-io/std" ]
|
||||
std = [ "full_crypto", "primitives/std", "codec/std", "serde", "sp-std/std", "sp-io/std" ]
|
||||
|
||||
# This feature enables all crypto primitives for `no_std` builds like microcontrollers
|
||||
# or Intel SGX.
|
||||
|
||||
@@ -39,19 +39,19 @@ impl RuntimePublic for Public {
|
||||
type Signature = Signature;
|
||||
|
||||
fn all(key_type: KeyTypeId) -> crate::Vec<Self> {
|
||||
runtime_io::crypto::ed25519_public_keys(key_type)
|
||||
sp_io::crypto::ed25519_public_keys(key_type)
|
||||
}
|
||||
|
||||
fn generate_pair(key_type: KeyTypeId, seed: Option<Vec<u8>>) -> Self {
|
||||
runtime_io::crypto::ed25519_generate(key_type, seed)
|
||||
sp_io::crypto::ed25519_generate(key_type, seed)
|
||||
}
|
||||
|
||||
fn sign<M: AsRef<[u8]>>(&self, key_type: KeyTypeId, msg: &M) -> Option<Self::Signature> {
|
||||
runtime_io::crypto::ed25519_sign(key_type, self, msg.as_ref())
|
||||
sp_io::crypto::ed25519_sign(key_type, self, msg.as_ref())
|
||||
}
|
||||
|
||||
fn verify<M: AsRef<[u8]>>(&self, msg: &M, signature: &Self::Signature) -> bool {
|
||||
runtime_io::crypto::ed25519_verify(&signature, msg.as_ref(), self)
|
||||
sp_io::crypto::ed25519_verify(&signature, msg.as_ref(), self)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -39,19 +39,19 @@ impl RuntimePublic for Public {
|
||||
type Signature = Signature;
|
||||
|
||||
fn all(key_type: KeyTypeId) -> crate::Vec<Self> {
|
||||
runtime_io::crypto::sr25519_public_keys(key_type)
|
||||
sp_io::crypto::sr25519_public_keys(key_type)
|
||||
}
|
||||
|
||||
fn generate_pair(key_type: KeyTypeId, seed: Option<Vec<u8>>) -> Self {
|
||||
runtime_io::crypto::sr25519_generate(key_type, seed)
|
||||
sp_io::crypto::sr25519_generate(key_type, seed)
|
||||
}
|
||||
|
||||
fn sign<M: AsRef<[u8]>>(&self, key_type: KeyTypeId, msg: &M) -> Option<Self::Signature> {
|
||||
runtime_io::crypto::sr25519_sign(key_type, self, msg.as_ref())
|
||||
sp_io::crypto::sr25519_sign(key_type, self, msg.as_ref())
|
||||
}
|
||||
|
||||
fn verify<M: AsRef<[u8]>>(&self, msg: &M, signature: &Self::Signature) -> bool {
|
||||
runtime_io::crypto::sr25519_verify(&signature, msg.as_ref(), self)
|
||||
sp_io::crypto::sr25519_verify(&signature, msg.as_ref(), self)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -235,7 +235,7 @@ pub trait TypeId {
|
||||
|
||||
/// A log level matching the one from `log` crate.
|
||||
///
|
||||
/// Used internally by `runtime_io::log` method.
|
||||
/// Used internally by `sp_io::log` method.
|
||||
#[derive(Encode, Decode, runtime_interface::pass_by::PassByEnum, Copy, Clone)]
|
||||
pub enum LogLevel {
|
||||
/// `Error` log level.
|
||||
|
||||
@@ -11,7 +11,7 @@ sp-runtime = { path = "../../primitives/runtime", default-features = false }
|
||||
|
||||
[dev-dependencies]
|
||||
substrate-test-utils = { path = "../../test/utils" }
|
||||
runtime-io ={ package = "sp-io", path = "../../primitives/sr-io" }
|
||||
sp-io ={ path = "../../primitives/io" }
|
||||
rand = "0.7.2"
|
||||
|
||||
[features]
|
||||
|
||||
@@ -19,7 +19,7 @@ executor = { package = "sc-executor", path = "../../client/executor" }
|
||||
test-wasm = { package = "sp-runtime-interface-test-wasm", path = "test-wasm" }
|
||||
state_machine = { package = "sp-state-machine", path = "../../primitives/state-machine" }
|
||||
primitives = { package = "sp-core", path = "../core" }
|
||||
runtime-io = { package = "sp-io", path = "../sr-io" }
|
||||
sp-io = { path = "../io" }
|
||||
|
||||
[features]
|
||||
default = [ "std" ]
|
||||
|
||||
@@ -134,7 +134,7 @@ mod tests {
|
||||
_,
|
||||
(
|
||||
HF,
|
||||
runtime_io::SubstrateHostFunctions,
|
||||
sp_io::SubstrateHostFunctions,
|
||||
executor::deprecated_host_interface::SubstrateExternals
|
||||
)
|
||||
>(
|
||||
|
||||
@@ -8,7 +8,7 @@ build = "build.rs"
|
||||
[dependencies]
|
||||
runtime-interface = { package = "sp-runtime-interface", path = "../", default-features = false }
|
||||
sp-std = { path = "../../std", default-features = false }
|
||||
runtime-io = { package = "sp-io", path = "../../sr-io", default-features = false }
|
||||
sp-io = { path = "../../io", default-features = false }
|
||||
primitives = { package = "sp-core", path = "../../core", default-features = false }
|
||||
|
||||
[build-dependencies]
|
||||
@@ -16,4 +16,4 @@ wasm-builder-runner = { package = "substrate-wasm-builder-runner", version = "1.
|
||||
|
||||
[features]
|
||||
default = [ "std" ]
|
||||
std = [ "runtime-interface/std", "sp-std/std", "primitives/std", "runtime-io/std" ]
|
||||
std = [ "runtime-interface/std", "sp-std/std", "primitives/std", "sp-io/std" ]
|
||||
|
||||
@@ -99,11 +99,11 @@ pub fn force_old_runtime_interface_import() {
|
||||
unsafe { ext_keccak_256(sp_std::ptr::null(), 0, sp_std::ptr::null_mut()); }
|
||||
}
|
||||
|
||||
/// This function is not used, but we require it for the compiler to include `runtime-io`.
|
||||
/// `runtime-io` is required for its panic and oom handler.
|
||||
/// This function is not used, but we require it for the compiler to include `sp-io`.
|
||||
/// `sp-io` is required for its panic and oom handler.
|
||||
#[no_mangle]
|
||||
pub fn import_runtime_io() {
|
||||
runtime_io::misc::print_utf8(&[]);
|
||||
pub fn import_sp_io() {
|
||||
sp_io::misc::print_utf8(&[]);
|
||||
}
|
||||
|
||||
wasm_export_functions! {
|
||||
|
||||
@@ -11,7 +11,7 @@ primitives = { package = "sp-core", path = "../core", default-features = false
|
||||
app-crypto = { package = "sc-application-crypto", path = "../application-crypto", default-features = false }
|
||||
arithmetic = { package = "sp-arithmetic", path = "../sr-arithmetic", default-features = false }
|
||||
sp-std = { path = "../std", default-features = false }
|
||||
runtime_io = { package = "sp-io", path = "../sr-io", default-features = false }
|
||||
sp-io = { path = "../io", default-features = false }
|
||||
log = { version = "0.4.8", optional = true }
|
||||
paste = "0.1.6"
|
||||
rand = { version = "0.7.2", optional = true }
|
||||
@@ -33,7 +33,7 @@ std = [
|
||||
"primitives/std",
|
||||
"rand",
|
||||
"sp-std/std",
|
||||
"runtime_io/std",
|
||||
"sp-io/std",
|
||||
"serde",
|
||||
"inherents/std",
|
||||
]
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
//! Generic implementation of an unchecked (pre-verification) extrinsic.
|
||||
|
||||
use sp_std::{fmt, prelude::*};
|
||||
use runtime_io::hashing::blake2_256;
|
||||
use sp_io::hashing::blake2_256;
|
||||
use codec::{Decode, Encode, EncodeLike, Input, Error};
|
||||
use crate::{
|
||||
traits::{self, Member, MaybeDisplay, SignedExtension, Checkable, Extrinsic, IdentifyAccount},
|
||||
@@ -282,7 +282,7 @@ where
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use runtime_io::hashing::blake2_256;
|
||||
use sp_io::hashing::blake2_256;
|
||||
use crate::codec::{Encode, Decode};
|
||||
use crate::traits::{SignedExtension, IdentifyAccount, IdentityLookup};
|
||||
use serde::{Serialize, Deserialize};
|
||||
|
||||
@@ -243,7 +243,7 @@ impl traits::IdentifyAccount for MultiSigner {
|
||||
match self {
|
||||
MultiSigner::Ed25519(who) => <[u8; 32]>::from(who).into(),
|
||||
MultiSigner::Sr25519(who) => <[u8; 32]>::from(who).into(),
|
||||
MultiSigner::Ecdsa(who) => runtime_io::hashing::blake2_256(who.as_ref()).into(),
|
||||
MultiSigner::Ecdsa(who) => sp_io::hashing::blake2_256(who.as_ref()).into(),
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -306,10 +306,10 @@ impl Verify for MultiSignature {
|
||||
(MultiSignature::Ed25519(ref sig), who) => sig.verify(msg, &ed25519::Public::from_slice(who.as_ref())),
|
||||
(MultiSignature::Sr25519(ref sig), who) => sig.verify(msg, &sr25519::Public::from_slice(who.as_ref())),
|
||||
(MultiSignature::Ecdsa(ref sig), who) => {
|
||||
let m = runtime_io::hashing::blake2_256(msg.get());
|
||||
match runtime_io::crypto::secp256k1_ecdsa_recover_compressed(sig.as_ref(), &m) {
|
||||
let m = sp_io::hashing::blake2_256(msg.get());
|
||||
match sp_io::crypto::secp256k1_ecdsa_recover_compressed(sig.as_ref(), &m) {
|
||||
Ok(pubkey) =>
|
||||
&runtime_io::hashing::blake2_256(pubkey.as_ref())
|
||||
&sp_io::hashing::blake2_256(pubkey.as_ref())
|
||||
== <dyn AsRef<[u8; 32]>>::as_ref(who),
|
||||
_ => false,
|
||||
}
|
||||
|
||||
@@ -221,7 +221,7 @@ impl<'a, I: AsRef<[u8]>, T: IntoIterator<Item=I>> Request<'a, T> {
|
||||
let meta = &[];
|
||||
|
||||
// start an http request.
|
||||
let id = runtime_io::offchain::http_request_start(
|
||||
let id = sp_io::offchain::http_request_start(
|
||||
self.method.as_ref(),
|
||||
self.url,
|
||||
meta,
|
||||
@@ -229,7 +229,7 @@ impl<'a, I: AsRef<[u8]>, T: IntoIterator<Item=I>> Request<'a, T> {
|
||||
|
||||
// add custom headers
|
||||
for header in &self.headers {
|
||||
runtime_io::offchain::http_request_add_header(
|
||||
sp_io::offchain::http_request_add_header(
|
||||
id,
|
||||
header.name(),
|
||||
header.value(),
|
||||
@@ -238,11 +238,11 @@ impl<'a, I: AsRef<[u8]>, T: IntoIterator<Item=I>> Request<'a, T> {
|
||||
|
||||
// write body
|
||||
for chunk in self.body {
|
||||
runtime_io::offchain::http_request_write_body(id, chunk.as_ref(), self.deadline)?;
|
||||
sp_io::offchain::http_request_write_body(id, chunk.as_ref(), self.deadline)?;
|
||||
}
|
||||
|
||||
// finalise the request
|
||||
runtime_io::offchain::http_request_write_body(id, &[], self.deadline)?;
|
||||
sp_io::offchain::http_request_write_body(id, &[], self.deadline)?;
|
||||
|
||||
Ok(PendingRequest {
|
||||
id,
|
||||
@@ -307,7 +307,7 @@ impl PendingRequest {
|
||||
deadline: impl Into<Option<Timestamp>>
|
||||
) -> Vec<Result<HttpResult, PendingRequest>> {
|
||||
let ids = requests.iter().map(|r| r.id).collect::<Vec<_>>();
|
||||
let statuses = runtime_io::offchain::http_response_wait(&ids, deadline.into());
|
||||
let statuses = sp_io::offchain::http_response_wait(&ids, deadline.into());
|
||||
|
||||
statuses
|
||||
.into_iter()
|
||||
@@ -346,7 +346,7 @@ impl Response {
|
||||
pub fn headers(&mut self) -> &Headers {
|
||||
if self.headers.is_none() {
|
||||
self.headers = Some(
|
||||
Headers { raw: runtime_io::offchain::http_response_headers(self.id) },
|
||||
Headers { raw: sp_io::offchain::http_response_headers(self.id) },
|
||||
);
|
||||
}
|
||||
self.headers.as_ref().expect("Headers were just set; qed")
|
||||
@@ -426,7 +426,7 @@ impl Iterator for ResponseBody {
|
||||
}
|
||||
|
||||
if self.filled_up_to.is_none() {
|
||||
let result = runtime_io::offchain::http_response_read_body(
|
||||
let result = sp_io::offchain::http_response_read_body(
|
||||
self.id,
|
||||
&mut self.buffer,
|
||||
self.deadline);
|
||||
@@ -515,7 +515,7 @@ impl<'a> HeadersIterator<'a> {
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use runtime_io::TestExternalities;
|
||||
use sp_io::TestExternalities;
|
||||
use primitives::offchain::{
|
||||
OffchainExt,
|
||||
testing,
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
use sp_std::prelude::*;
|
||||
use sp_std::{self, result, marker::PhantomData, convert::{TryFrom, TryInto}, fmt::Debug};
|
||||
use runtime_io;
|
||||
use sp_io;
|
||||
#[cfg(feature = "std")]
|
||||
use std::fmt::Display;
|
||||
#[cfg(feature = "std")]
|
||||
@@ -84,23 +84,23 @@ pub trait Verify {
|
||||
impl Verify for primitives::ed25519::Signature {
|
||||
type Signer = primitives::ed25519::Public;
|
||||
fn verify<L: Lazy<[u8]>>(&self, mut msg: L, signer: &primitives::ed25519::Public) -> bool {
|
||||
runtime_io::crypto::ed25519_verify(self, msg.get(), signer)
|
||||
sp_io::crypto::ed25519_verify(self, msg.get(), signer)
|
||||
}
|
||||
}
|
||||
|
||||
impl Verify for primitives::sr25519::Signature {
|
||||
type Signer = primitives::sr25519::Public;
|
||||
fn verify<L: Lazy<[u8]>>(&self, mut msg: L, signer: &primitives::sr25519::Public) -> bool {
|
||||
runtime_io::crypto::sr25519_verify(self, msg.get(), signer)
|
||||
sp_io::crypto::sr25519_verify(self, msg.get(), signer)
|
||||
}
|
||||
}
|
||||
|
||||
impl Verify for primitives::ecdsa::Signature {
|
||||
type Signer = primitives::ecdsa::Public;
|
||||
fn verify<L: Lazy<[u8]>>(&self, mut msg: L, signer: &primitives::ecdsa::Public) -> bool {
|
||||
match runtime_io::crypto::secp256k1_ecdsa_recover_compressed(
|
||||
match sp_io::crypto::secp256k1_ecdsa_recover_compressed(
|
||||
self.as_ref(),
|
||||
&runtime_io::hashing::blake2_256(msg.get()),
|
||||
&sp_io::hashing::blake2_256(msg.get()),
|
||||
) {
|
||||
Ok(pubkey) => <dyn AsRef<[u8]>>::as_ref(signer) == &pubkey[..],
|
||||
_ => false,
|
||||
@@ -399,15 +399,15 @@ impl Hash for BlakeTwo256 {
|
||||
type Output = primitives::H256;
|
||||
type Hasher = Blake2Hasher;
|
||||
fn hash(s: &[u8]) -> Self::Output {
|
||||
runtime_io::hashing::blake2_256(s).into()
|
||||
sp_io::hashing::blake2_256(s).into()
|
||||
}
|
||||
|
||||
fn trie_root(input: Vec<(Vec<u8>, Vec<u8>)>) -> Self::Output {
|
||||
runtime_io::trie::blake2_256_root(input)
|
||||
sp_io::trie::blake2_256_root(input)
|
||||
}
|
||||
|
||||
fn ordered_trie_root(input: Vec<Vec<u8>>) -> Self::Output {
|
||||
runtime_io::trie::blake2_256_ordered_root(input)
|
||||
sp_io::trie::blake2_256_ordered_root(input)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1233,19 +1233,19 @@ impl Printable for usize {
|
||||
|
||||
impl Printable for u64 {
|
||||
fn print(&self) {
|
||||
runtime_io::misc::print_num(*self);
|
||||
sp_io::misc::print_num(*self);
|
||||
}
|
||||
}
|
||||
|
||||
impl Printable for &[u8] {
|
||||
fn print(&self) {
|
||||
runtime_io::misc::print_hex(self);
|
||||
sp_io::misc::print_hex(self);
|
||||
}
|
||||
}
|
||||
|
||||
impl Printable for &str {
|
||||
fn print(&self) {
|
||||
runtime_io::misc::print_utf8(self.as_bytes());
|
||||
sp_io::misc::print_utf8(self.as_bytes());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ edition = "2018"
|
||||
wasmi = { version = "0.6.2", optional = true }
|
||||
primitives = { package = "sp-core", path = "../core", default-features = false }
|
||||
sp-std = { path = "../std", default-features = false }
|
||||
runtime-io = { package = "sp-io", path = "../sr-io", default-features = false }
|
||||
sp-io = { path = "../io", default-features = false }
|
||||
codec = { package = "parity-scale-codec", version = "1.0.0", default-features = false }
|
||||
|
||||
[dev-dependencies]
|
||||
@@ -22,6 +22,6 @@ std = [
|
||||
"primitives/std",
|
||||
"sp-std/std",
|
||||
"codec/std",
|
||||
"runtime-io/std",
|
||||
"sp-io/std",
|
||||
]
|
||||
strict = []
|
||||
|
||||
@@ -18,7 +18,7 @@ use sp_std::{prelude::*, slice, marker, mem, vec, rc::Rc};
|
||||
use codec::{Decode, Encode};
|
||||
use primitives::sandbox as sandbox_primitives;
|
||||
use super::{Error, TypedValue, ReturnValue, HostFuncType};
|
||||
use runtime_io::sandbox;
|
||||
use sp_io::sandbox;
|
||||
|
||||
mod ffi {
|
||||
use sp_std::mem;
|
||||
|
||||
@@ -113,7 +113,7 @@ impl<S: TrieBackendStorage<H>, H: Hasher> TrieBackendEssence<S, H> where H::Out:
|
||||
// The key just after the one given in input, basically `key++0`.
|
||||
// Note: We are sure this is the next key if:
|
||||
// * size of key has no limit (i.e. we can always add 0 to the path),
|
||||
// * and no keys can be inserted between `key` and `key++0` (this is ensured by sr-io).
|
||||
// * and no keys can be inserted between `key` and `key++0` (this is ensured by sp-io).
|
||||
let mut potential_next_key = Vec::with_capacity(key.len() + 1);
|
||||
potential_next_key.extend_from_slice(key);
|
||||
potential_next_key.push(0);
|
||||
|
||||
Reference in New Issue
Block a user