mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-12 15:51:12 +00:00
Rename: primitives/sr-std -> primitives/sp-std (#4327)
* primitives/sr-std -> primitives/std * fix * fix conflict * rstd -> sp-std * git mv * fix review * fix merge
This commit is contained in:
@@ -9,7 +9,7 @@ description = "Provides facilities for generating application specific crypto wr
|
||||
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"] }
|
||||
rstd = { package = "sp-std", path = "../sr-std", default-features = false }
|
||||
sp-std = { path = "../std", default-features = false }
|
||||
runtime-io = { package = "sp-io", path = "../../primitives/sr-io", default-features = false }
|
||||
|
||||
[dev-dependencies]
|
||||
@@ -18,7 +18,7 @@ sp-runtime = { path = "../../primitives/runtime" }
|
||||
|
||||
[features]
|
||||
default = [ "std" ]
|
||||
std = [ "full_crypto", "primitives/std", "codec/std", "serde", "rstd/std", "runtime-io/std" ]
|
||||
std = [ "full_crypto", "primitives/std", "codec/std", "serde", "sp-std/std", "runtime-io/std" ]
|
||||
|
||||
# This feature enables all crypto primitives for `no_std` builds like microcontrollers
|
||||
# or Intel SGX.
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
use crate::{RuntimePublic, KeyTypeId};
|
||||
|
||||
use rstd::vec::Vec;
|
||||
use sp_std::vec::Vec;
|
||||
|
||||
pub use primitives::ed25519::*;
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ pub use codec;
|
||||
#[cfg(feature = "std")]
|
||||
pub use serde;
|
||||
#[doc(hidden)]
|
||||
pub use rstd::{ops::Deref, vec::Vec};
|
||||
pub use sp_std::{ops::Deref, vec::Vec};
|
||||
|
||||
pub mod ed25519;
|
||||
pub mod sr25519;
|
||||
@@ -102,7 +102,7 @@ macro_rules! app_crypto_pair {
|
||||
type Seed = <$pair as $crate::Pair>::Seed;
|
||||
type Signature = Signature;
|
||||
type DeriveError = <$pair as $crate::Pair>::DeriveError;
|
||||
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
fn generate_with_phrase(password: Option<&str>) -> (Self, String, Self::Seed) {
|
||||
let r = <$pair>::generate_with_phrase(password);
|
||||
@@ -353,7 +353,7 @@ macro_rules! app_crypto_signature_not_full_crypto {
|
||||
)]
|
||||
pub struct Signature($sig);
|
||||
}
|
||||
|
||||
|
||||
impl $crate::CryptoType for Signature {}
|
||||
|
||||
impl $crate::AppKey for Signature {
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
use crate::{RuntimePublic, KeyTypeId};
|
||||
|
||||
use rstd::vec::Vec;
|
||||
use sp_std::vec::Vec;
|
||||
|
||||
pub use primitives::sr25519::*;
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ use primitives::crypto::Pair;
|
||||
|
||||
use codec::Codec;
|
||||
use primitives::crypto::{KeyTypeId, CryptoType, IsWrappedBy, Public};
|
||||
use rstd::{fmt::Debug, vec::Vec};
|
||||
use sp_std::{fmt::Debug, vec::Vec};
|
||||
|
||||
/// An application-specific key.
|
||||
pub trait AppKey: 'static + Send + Sync + Sized + CryptoType + Clone {
|
||||
@@ -42,9 +42,9 @@ pub trait AppKey: 'static + Send + Sync + Sized + CryptoType + Clone {
|
||||
|
||||
/// Type which implements Hash in std, not when no-std (std variant).
|
||||
#[cfg(any(feature = "std", feature = "full_crypto"))]
|
||||
pub trait MaybeHash: rstd::hash::Hash {}
|
||||
pub trait MaybeHash: sp_std::hash::Hash {}
|
||||
#[cfg(any(feature = "std", feature = "full_crypto"))]
|
||||
impl<T: rstd::hash::Hash> MaybeHash for T {}
|
||||
impl<T: sp_std::hash::Hash> MaybeHash for T {}
|
||||
|
||||
/// Type which implements Hash in std, not when no-std (no-std variant).
|
||||
#[cfg(all(not(feature = "std"), not(feature = "full_crypto")))]
|
||||
@@ -54,9 +54,9 @@ impl<T> MaybeHash for T {}
|
||||
|
||||
/// Type which implements Debug and Hash in std, not when no-std (no-std variant with crypto).
|
||||
#[cfg(all(not(feature = "std"), feature = "full_crypto"))]
|
||||
pub trait MaybeDebugHash: rstd::hash::Hash {}
|
||||
pub trait MaybeDebugHash: sp_std::hash::Hash {}
|
||||
#[cfg(all(not(feature = "std"), feature = "full_crypto"))]
|
||||
impl<T: rstd::hash::Hash> MaybeDebugHash for T {}
|
||||
impl<T: sp_std::hash::Hash> MaybeDebugHash for T {}
|
||||
|
||||
/// A application's public key.
|
||||
pub trait AppPublic:
|
||||
|
||||
@@ -8,7 +8,7 @@ edition = "2018"
|
||||
[dependencies]
|
||||
app-crypto = { package = "sc-application-crypto", path = "../application-crypto", default-features = false }
|
||||
codec = { package = "parity-scale-codec", default-features = false, version = "1.0.3" }
|
||||
rstd = { package = "sp-std", path = "../sr-std", default-features = false }
|
||||
sp-std = { path = "../std", default-features = false }
|
||||
sp-api = { path = "../sr-api", default-features = false }
|
||||
sp-runtime = { path = "../runtime", default-features = false }
|
||||
|
||||
@@ -17,7 +17,7 @@ default = ["std"]
|
||||
std = [
|
||||
"app-crypto/std",
|
||||
"codec/std",
|
||||
"rstd/std",
|
||||
"sp-std/std",
|
||||
"sp-api/std",
|
||||
"sp-runtime/std"
|
||||
]
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
#![cfg_attr(not(feature = "std"), no_std)]
|
||||
|
||||
use rstd::vec::Vec;
|
||||
use sp_std::vec::Vec;
|
||||
|
||||
mod app {
|
||||
use app_crypto::{app_crypto, key_types::AUTHORITY_DISCOVERY, sr25519};
|
||||
|
||||
@@ -8,14 +8,14 @@ edition = "2018"
|
||||
[dependencies]
|
||||
sp-inherents = { path = "../inherents", default-features = false }
|
||||
sp-runtime = { path = "../runtime", default-features = false }
|
||||
rstd = { package = "sp-std", path = "../sr-std", default-features = false }
|
||||
sp-std = { path = "../std", default-features = false }
|
||||
codec = { package = "parity-scale-codec", version = "1.0.0", default-features = false, features = ["derive"] }
|
||||
|
||||
[features]
|
||||
default = [ "std" ]
|
||||
std = [
|
||||
"codec/std",
|
||||
"rstd/std",
|
||||
"sp-std/std",
|
||||
"sp-inherents/std",
|
||||
"sp-runtime/std",
|
||||
]
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
#![cfg_attr(not(feature = "std"), no_std)]
|
||||
|
||||
use rstd::{result::Result, prelude::*};
|
||||
use sp_std::{result::Result, prelude::*};
|
||||
|
||||
use codec::{Encode, Decode};
|
||||
use sp_inherents::{Error, InherentIdentifier, InherentData, IsFatalError};
|
||||
|
||||
@@ -7,7 +7,7 @@ edition = "2018"
|
||||
[dependencies]
|
||||
sp-runtime = { path = "../../runtime", default-features = false }
|
||||
sp-api = { path = "../../sr-api", default-features = false }
|
||||
rstd = { package = "sp-std", path = "../../sr-std", default-features = false }
|
||||
sp-std = { path = "../../std", default-features = false }
|
||||
codec = { package = "parity-scale-codec", version = "1.0.6", default-features = false }
|
||||
inherents = { package = "sp-inherents", path = "../../inherents", default-features = false }
|
||||
|
||||
@@ -18,5 +18,5 @@ std = [
|
||||
"codec/std",
|
||||
"inherents/std",
|
||||
"sp-api/std",
|
||||
"rstd/std",
|
||||
"sp-std/std",
|
||||
]
|
||||
|
||||
@@ -64,7 +64,7 @@ sp_api::decl_runtime_apis! {
|
||||
/// Generate inherent extrinsics. The inherent data will vary from chain to chain.
|
||||
fn inherent_extrinsics(
|
||||
inherent: InherentData,
|
||||
) -> rstd::vec::Vec<<Block as BlockT>::Extrinsic>;
|
||||
) -> sp_std::vec::Vec<<Block as BlockT>::Extrinsic>;
|
||||
/// Check that the inherents are valid. The inherent data will vary from chain to chain.
|
||||
fn check_inherents(block: Block, data: InherentData) -> CheckInherentsResult;
|
||||
/// Generate a random seed.
|
||||
|
||||
@@ -8,7 +8,7 @@ edition = "2018"
|
||||
[dependencies]
|
||||
app-crypto = { package = "sc-application-crypto", path = "../../application-crypto", default-features = false }
|
||||
codec = { package = "parity-scale-codec", version = "1.0.0", default-features = false }
|
||||
rstd = { package = "sp-std", path = "../../sr-std", default-features = false }
|
||||
sp-std = { path = "../../std", default-features = false }
|
||||
sp-api = { path = "../../sr-api", default-features = false }
|
||||
sp-runtime = { path = "../../runtime", default-features = false }
|
||||
inherents = { package = "sp-inherents", path = "../../inherents", default-features = false }
|
||||
@@ -19,7 +19,7 @@ default = ["std"]
|
||||
std = [
|
||||
"app-crypto/std",
|
||||
"codec/std",
|
||||
"rstd/std",
|
||||
"sp-std/std",
|
||||
"sp-api/std",
|
||||
"sp-runtime/std",
|
||||
"inherents/std",
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
use sp_timestamp::TimestampInherentData;
|
||||
use inherents::{InherentIdentifier, InherentData, Error};
|
||||
use rstd::result::Result;
|
||||
use sp_std::result::Result;
|
||||
use codec::Decode;
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
#![cfg_attr(not(feature = "std"), no_std)]
|
||||
|
||||
use codec::{Encode, Decode, Codec};
|
||||
use rstd::vec::Vec;
|
||||
use sp_std::vec::Vec;
|
||||
use sp_runtime::ConsensusEngineId;
|
||||
|
||||
pub mod inherents;
|
||||
|
||||
@@ -8,7 +8,7 @@ edition = "2018"
|
||||
[dependencies]
|
||||
app-crypto = { package = "sc-application-crypto", path = "../../application-crypto", default-features = false }
|
||||
codec = { package = "parity-scale-codec", version = "1.0.0", default-features = false }
|
||||
rstd = { package = "sp-std", path = "../../sr-std", default-features = false }
|
||||
sp-std = { path = "../../std", default-features = false }
|
||||
schnorrkel = { version = "0.8.5", features = ["preaudit_deprecated"], optional = true }
|
||||
sp-api = { path = "../../sr-api", default-features = false }
|
||||
sp-consensus = { path = "../common", optional = true }
|
||||
@@ -21,7 +21,7 @@ default = ["std"]
|
||||
std = [
|
||||
"app-crypto/std",
|
||||
"codec/std",
|
||||
"rstd/std",
|
||||
"sp-std/std",
|
||||
"schnorrkel",
|
||||
"sp-api/std",
|
||||
"sp-consensus",
|
||||
|
||||
@@ -33,7 +33,7 @@ use schnorrkel::{
|
||||
SignatureError, errors::MultiSignatureStage,
|
||||
vrf::{VRFProof, VRFOutput, VRF_OUTPUT_LENGTH, VRF_PROOF_LENGTH}
|
||||
};
|
||||
use rstd::vec::Vec;
|
||||
use sp_std::vec::Vec;
|
||||
|
||||
|
||||
/// A BABE pre-runtime digest. This contains all data required to validate a
|
||||
|
||||
@@ -23,7 +23,7 @@ use sp_timestamp::TimestampInherentData;
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
use codec::Decode;
|
||||
use rstd::result::Result;
|
||||
use sp_std::result::Result;
|
||||
|
||||
/// The BABE inherent identifier.
|
||||
pub const INHERENT_IDENTIFIER: InherentIdentifier = *b"babeslot";
|
||||
|
||||
@@ -23,7 +23,7 @@ mod digest;
|
||||
pub mod inherents;
|
||||
|
||||
use codec::{Encode, Decode};
|
||||
use rstd::vec::Vec;
|
||||
use sp_std::vec::Vec;
|
||||
use sp_runtime::{ConsensusEngineId, RuntimeDebug};
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
|
||||
@@ -13,7 +13,7 @@ primitives = { package = "sp-core", path= "../../core" }
|
||||
inherents = { package = "sp-inherents", path = "../../inherents" }
|
||||
futures = { version = "0.3.1", features = ["thread-pool"] }
|
||||
futures-timer = "0.4.0"
|
||||
rstd = { package = "sp-std", path = "../../sr-std" }
|
||||
sp-std = { path = "../../std" }
|
||||
runtime_version = { package = "sp-version", path = "../../sr-version" }
|
||||
sp-runtime = { path = "../../runtime" }
|
||||
codec = { package = "parity-scale-codec", version = "1.0.0", features = ["derive"] }
|
||||
|
||||
@@ -7,7 +7,7 @@ edition = "2018"
|
||||
|
||||
[dependencies]
|
||||
sp-api = { path = "../../sr-api", default-features = false }
|
||||
rstd = { package = "sp-std", path = "../../sr-std", default-features = false }
|
||||
sp-std = { path = "../../std", default-features = false }
|
||||
sp-runtime = { path = "../../runtime", default-features = false }
|
||||
primitives = { package = "sp-core", path = "../../core", default-features = false }
|
||||
codec = { package = "parity-scale-codec", version = "1.0.0", default-features = false, features = ["derive"] }
|
||||
@@ -15,7 +15,7 @@ codec = { package = "parity-scale-codec", version = "1.0.0", default-features =
|
||||
[features]
|
||||
default = ["std"]
|
||||
std = [
|
||||
"rstd/std",
|
||||
"sp-std/std",
|
||||
"sp-api/std",
|
||||
"sp-runtime/std",
|
||||
"primitives/std",
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
#![cfg_attr(not(feature = "std"), no_std)]
|
||||
|
||||
use rstd::vec::Vec;
|
||||
use sp_std::vec::Vec;
|
||||
use sp_runtime::ConsensusEngineId;
|
||||
use codec::Decode;
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ authors = ["Parity Technologies <admin@parity.io>"]
|
||||
edition = "2018"
|
||||
|
||||
[dependencies]
|
||||
rstd = { package = "sp-std", path = "../sr-std", default-features = false }
|
||||
sp-std = { path = "../std", default-features = false }
|
||||
codec = { package = "parity-scale-codec", version = "1.0.0", default-features = false, features = ["derive"] }
|
||||
rustc-hex = { version = "2.0.1", default-features = false }
|
||||
log = { version = "0.4.8", default-features = false }
|
||||
@@ -73,7 +73,7 @@ std = [
|
||||
"codec/std",
|
||||
"hash256-std-hasher/std",
|
||||
"hash-db/std",
|
||||
"rstd/std",
|
||||
"sp-std/std",
|
||||
"serde",
|
||||
"rustc-hex/std",
|
||||
"twox-hash/std",
|
||||
|
||||
@@ -57,8 +57,8 @@ impl ChangesTrieConfiguration {
|
||||
) -> bool
|
||||
where
|
||||
Number: From<u32> + PartialEq +
|
||||
::rstd::ops::Rem<Output=Number> + ::rstd::ops::Sub<Output=Number> +
|
||||
::rstd::cmp::PartialOrd + Zero,
|
||||
::sp_std::ops::Rem<Output=Number> + ::sp_std::ops::Sub<Output=Number> +
|
||||
::sp_std::cmp::PartialOrd + Zero,
|
||||
{
|
||||
block > zero
|
||||
&& self.is_digest_build_enabled()
|
||||
@@ -92,8 +92,8 @@ impl ChangesTrieConfiguration {
|
||||
) -> Option<Number>
|
||||
where
|
||||
Number: Clone + From<u32> + PartialOrd + PartialEq +
|
||||
::rstd::ops::Add<Output=Number> + ::rstd::ops::Sub<Output=Number> +
|
||||
::rstd::ops::Div<Output=Number> + ::rstd::ops::Mul<Output=Number> + Zero,
|
||||
::sp_std::ops::Add<Output=Number> + ::sp_std::ops::Sub<Output=Number> +
|
||||
::sp_std::ops::Div<Output=Number> + ::sp_std::ops::Mul<Output=Number> + Zero,
|
||||
{
|
||||
if block <= zero {
|
||||
return None;
|
||||
@@ -126,8 +126,8 @@ impl ChangesTrieConfiguration {
|
||||
) -> Option<(Number, Number)>
|
||||
where
|
||||
Number: Clone + From<u32> + PartialOrd + PartialEq +
|
||||
::rstd::ops::Add<Output=Number> + ::rstd::ops::Sub<Output=Number> +
|
||||
::rstd::ops::Div<Output=Number> + ::rstd::ops::Mul<Output=Number>,
|
||||
::sp_std::ops::Add<Output=Number> + ::sp_std::ops::Sub<Output=Number> +
|
||||
::sp_std::ops::Div<Output=Number> + ::sp_std::ops::Mul<Output=Number>,
|
||||
{
|
||||
if !self.is_digest_build_enabled() {
|
||||
return None;
|
||||
@@ -160,8 +160,8 @@ impl ChangesTrieConfiguration {
|
||||
pub fn digest_level_at_block<Number>(&self, zero: Number, block: Number) -> Option<(u32, u32, u32)>
|
||||
where
|
||||
Number: Clone + From<u32> + PartialEq +
|
||||
::rstd::ops::Rem<Output=Number> + ::rstd::ops::Sub<Output=Number> +
|
||||
::rstd::cmp::PartialOrd + Zero,
|
||||
::sp_std::ops::Rem<Output=Number> + ::sp_std::ops::Sub<Output=Number> +
|
||||
::sp_std::cmp::PartialOrd + Zero,
|
||||
{
|
||||
if !self.is_digest_build_required_at_block(zero.clone(), block.clone()) {
|
||||
return None;
|
||||
|
||||
@@ -18,10 +18,10 @@
|
||||
//! Cryptographic utilities.
|
||||
// end::description[]
|
||||
|
||||
use rstd::{vec::Vec, hash::Hash};
|
||||
use sp_std::{vec::Vec, hash::Hash};
|
||||
#[cfg(feature = "std")]
|
||||
use rstd::convert::TryInto;
|
||||
use rstd::convert::TryFrom;
|
||||
use sp_std::convert::TryInto;
|
||||
use sp_std::convert::TryFrom;
|
||||
#[cfg(feature = "std")]
|
||||
use parking_lot::Mutex;
|
||||
#[cfg(feature = "std")]
|
||||
@@ -34,7 +34,7 @@ use base58::{FromBase58, ToBase58};
|
||||
|
||||
use zeroize::Zeroize;
|
||||
#[doc(hidden)]
|
||||
pub use rstd::ops::Deref;
|
||||
pub use sp_std::ops::Deref;
|
||||
use runtime_interface::pass_by::PassByInner;
|
||||
|
||||
/// The root phrase for our publicly known keys.
|
||||
@@ -86,7 +86,7 @@ impl<T: Zeroize> AsRef<T> for Protected<T> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: Zeroize> rstd::ops::Deref for Protected<T> {
|
||||
impl<T: Zeroize> sp_std::ops::Deref for Protected<T> {
|
||||
type Target = T;
|
||||
|
||||
fn deref(&self) -> &T {
|
||||
@@ -552,7 +552,7 @@ impl From<[u8; 32]> for AccountId32 {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> rstd::convert::TryFrom<&'a [u8]> for AccountId32 {
|
||||
impl<'a> sp_std::convert::TryFrom<&'a [u8]> for AccountId32 {
|
||||
type Error = ();
|
||||
fn try_from(x: &'a [u8]) -> Result<AccountId32, ()> {
|
||||
if x.len() == 32 {
|
||||
@@ -578,15 +578,15 @@ impl std::fmt::Display for AccountId32 {
|
||||
}
|
||||
}
|
||||
|
||||
impl rstd::fmt::Debug for AccountId32 {
|
||||
impl sp_std::fmt::Debug for AccountId32 {
|
||||
#[cfg(feature = "std")]
|
||||
fn fmt(&self, f: &mut rstd::fmt::Formatter) -> rstd::fmt::Result {
|
||||
fn fmt(&self, f: &mut sp_std::fmt::Formatter) -> sp_std::fmt::Result {
|
||||
let s = self.to_ss58check();
|
||||
write!(f, "{} ({}...)", crate::hexdisplay::HexDisplay::from(&self.0), &s[0..8])
|
||||
}
|
||||
|
||||
#[cfg(not(feature = "std"))]
|
||||
fn fmt(&self, _: &mut rstd::fmt::Formatter) -> rstd::fmt::Result {
|
||||
fn fmt(&self, _: &mut sp_std::fmt::Formatter) -> sp_std::fmt::Result {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
@@ -625,7 +625,7 @@ mod dummy {
|
||||
fn as_mut(&mut self) -> &mut[u8] {
|
||||
unsafe {
|
||||
#[allow(mutable_transmutes)]
|
||||
rstd::mem::transmute::<_, &'static mut [u8]>(&b""[..])
|
||||
sp_std::mem::transmute::<_, &'static mut [u8]>(&b""[..])
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -772,8 +772,8 @@ pub trait Pair: CryptoType + Sized + Clone + Send + Sync + 'static {
|
||||
///
|
||||
/// `None` is returned if no matches are found.
|
||||
#[cfg(feature = "std")]
|
||||
fn from_string_with_seed(s: &str, password_override: Option<&str>)
|
||||
-> Result<(Self, Option<Self::Seed>), SecretStringError>
|
||||
fn from_string_with_seed(s: &str, password_override: Option<&str>)
|
||||
-> Result<(Self, Option<Self::Seed>), SecretStringError>
|
||||
{
|
||||
let re = Regex::new(r"^(?P<phrase>[\d\w ]+)?(?P<path>(//?[^/]+)*)(///(?P<password>.*))?$")
|
||||
.expect("constructed from known-good static value; qed");
|
||||
|
||||
@@ -19,9 +19,9 @@
|
||||
// end::description[]
|
||||
|
||||
#[cfg(feature = "full_crypto")]
|
||||
use rstd::vec::Vec;
|
||||
use sp_std::vec::Vec;
|
||||
|
||||
use rstd::cmp::Ordering;
|
||||
use sp_std::cmp::Ordering;
|
||||
use codec::{Encode, Decode};
|
||||
|
||||
#[cfg(feature = "full_crypto")]
|
||||
@@ -102,7 +102,7 @@ impl AsMut<[u8]> for Public {
|
||||
}
|
||||
}
|
||||
|
||||
impl rstd::convert::TryFrom<&[u8]> for Public {
|
||||
impl sp_std::convert::TryFrom<&[u8]> for Public {
|
||||
type Error = ();
|
||||
|
||||
fn try_from(data: &[u8]) -> Result<Self, Self::Error> {
|
||||
@@ -166,8 +166,8 @@ impl<'de> Deserialize<'de> for Public {
|
||||
}
|
||||
|
||||
#[cfg(feature = "full_crypto")]
|
||||
impl rstd::hash::Hash for Public {
|
||||
fn hash<H: rstd::hash::Hasher>(&self, state: &mut H) {
|
||||
impl sp_std::hash::Hash for Public {
|
||||
fn hash<H: sp_std::hash::Hasher>(&self, state: &mut H) {
|
||||
self.0.hash(state);
|
||||
}
|
||||
}
|
||||
@@ -176,7 +176,7 @@ impl rstd::hash::Hash for Public {
|
||||
#[derive(Encode, Decode)]
|
||||
pub struct Signature([u8; 65]);
|
||||
|
||||
impl rstd::convert::TryFrom<&[u8]> for Signature {
|
||||
impl sp_std::convert::TryFrom<&[u8]> for Signature {
|
||||
type Error = ();
|
||||
|
||||
fn try_from(data: &[u8]) -> Result<Self, Self::Error> {
|
||||
@@ -261,9 +261,9 @@ impl std::fmt::Debug for Signature {
|
||||
}
|
||||
|
||||
#[cfg(feature = "full_crypto")]
|
||||
impl rstd::hash::Hash for Signature {
|
||||
fn hash<H: rstd::hash::Hasher>(&self, state: &mut H) {
|
||||
rstd::hash::Hash::hash(&self.0[..], state);
|
||||
impl sp_std::hash::Hash for Signature {
|
||||
fn hash<H: sp_std::hash::Hasher>(&self, state: &mut H) {
|
||||
sp_std::hash::Hash::hash(&self.0[..], state);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
// end::description[]
|
||||
|
||||
#[cfg(feature = "full_crypto")]
|
||||
use rstd::vec::Vec;
|
||||
use sp_std::vec::Vec;
|
||||
|
||||
use crate::{hash::H256, hash::H512};
|
||||
use codec::{Encode, Decode};
|
||||
@@ -40,7 +40,7 @@ use crate::crypto::Ss58Codec;
|
||||
use serde::{de, Serializer, Serialize, Deserializer, Deserialize};
|
||||
use crate::{crypto::{Public as TraitPublic, UncheckedFrom, CryptoType, Derive}};
|
||||
use runtime_interface::pass_by::PassByInner;
|
||||
use rstd::ops::Deref;
|
||||
use sp_std::ops::Deref;
|
||||
|
||||
/// A secret seed. It's not called a "secret key" because ring doesn't expose the secret keys
|
||||
/// of the key pair (yeah, dumb); as such we're forced to remember the seed manually if we
|
||||
@@ -94,7 +94,7 @@ impl Deref for Public {
|
||||
}
|
||||
}
|
||||
|
||||
impl rstd::convert::TryFrom<&[u8]> for Public {
|
||||
impl sp_std::convert::TryFrom<&[u8]> for Public {
|
||||
type Error = ();
|
||||
|
||||
fn try_from(data: &[u8]) -> Result<Self, Self::Error> {
|
||||
@@ -155,15 +155,15 @@ impl std::fmt::Display for Public {
|
||||
}
|
||||
}
|
||||
|
||||
impl rstd::fmt::Debug for Public {
|
||||
impl sp_std::fmt::Debug for Public {
|
||||
#[cfg(feature = "std")]
|
||||
fn fmt(&self, f: &mut rstd::fmt::Formatter) -> rstd::fmt::Result {
|
||||
fn fmt(&self, f: &mut sp_std::fmt::Formatter) -> sp_std::fmt::Result {
|
||||
let s = self.to_ss58check();
|
||||
write!(f, "{} ({}...)", crate::hexdisplay::HexDisplay::from(&self.0), &s[0..8])
|
||||
}
|
||||
|
||||
#[cfg(not(feature = "std"))]
|
||||
fn fmt(&self, _: &mut rstd::fmt::Formatter) -> rstd::fmt::Result {
|
||||
fn fmt(&self, _: &mut sp_std::fmt::Formatter) -> sp_std::fmt::Result {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
@@ -187,7 +187,7 @@ impl<'de> Deserialize<'de> for Public {
|
||||
#[derive(Encode, Decode, PassByInner)]
|
||||
pub struct Signature(pub [u8; 64]);
|
||||
|
||||
impl rstd::convert::TryFrom<&[u8]> for Signature {
|
||||
impl sp_std::convert::TryFrom<&[u8]> for Signature {
|
||||
type Error = ();
|
||||
|
||||
fn try_from(data: &[u8]) -> Result<Self, Self::Error> {
|
||||
@@ -270,22 +270,22 @@ impl AsMut<[u8]> for Signature {
|
||||
}
|
||||
}
|
||||
|
||||
impl rstd::fmt::Debug for Signature {
|
||||
impl sp_std::fmt::Debug for Signature {
|
||||
#[cfg(feature = "std")]
|
||||
fn fmt(&self, f: &mut rstd::fmt::Formatter) -> rstd::fmt::Result {
|
||||
fn fmt(&self, f: &mut sp_std::fmt::Formatter) -> sp_std::fmt::Result {
|
||||
write!(f, "{}", crate::hexdisplay::HexDisplay::from(&self.0))
|
||||
}
|
||||
|
||||
#[cfg(not(feature = "std"))]
|
||||
fn fmt(&self, _: &mut rstd::fmt::Formatter) -> rstd::fmt::Result {
|
||||
fn fmt(&self, _: &mut sp_std::fmt::Formatter) -> sp_std::fmt::Result {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "full_crypto")]
|
||||
impl rstd::hash::Hash for Signature {
|
||||
fn hash<H: rstd::hash::Hasher>(&self, state: &mut H) {
|
||||
rstd::hash::Hash::hash(&self.0[..], state);
|
||||
impl sp_std::hash::Hash for Signature {
|
||||
fn hash<H: sp_std::hash::Hasher>(&self, state: &mut H) {
|
||||
sp_std::hash::Hash::hash(&self.0[..], state);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -24,8 +24,8 @@ impl<'a> HexDisplay<'a> {
|
||||
pub fn from<R: AsBytesRef>(d: &'a R) -> Self { HexDisplay(d.as_bytes_ref()) }
|
||||
}
|
||||
|
||||
impl<'a> rstd::fmt::Display for HexDisplay<'a> {
|
||||
fn fmt(&self, f: &mut rstd::fmt::Formatter) -> Result<(), rstd::fmt::Error> {
|
||||
impl<'a> sp_std::fmt::Display for HexDisplay<'a> {
|
||||
fn fmt(&self, f: &mut sp_std::fmt::Formatter) -> Result<(), sp_std::fmt::Error> {
|
||||
if self.0.len() < 1027 {
|
||||
for byte in self.0 {
|
||||
f.write_fmt(format_args!("{:02x}", byte))?;
|
||||
@@ -43,8 +43,8 @@ impl<'a> rstd::fmt::Display for HexDisplay<'a> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> rstd::fmt::Debug for HexDisplay<'a> {
|
||||
fn fmt(&self, f: &mut rstd::fmt::Formatter) -> Result<(), rstd::fmt::Error> {
|
||||
impl<'a> sp_std::fmt::Debug for HexDisplay<'a> {
|
||||
fn fmt(&self, f: &mut sp_std::fmt::Formatter) -> Result<(), sp_std::fmt::Error> {
|
||||
for byte in self.0 {
|
||||
f.write_fmt(format_args!("{:02x}", byte))?;
|
||||
}
|
||||
|
||||
@@ -31,8 +31,8 @@ macro_rules! map {
|
||||
);
|
||||
}
|
||||
|
||||
use rstd::prelude::*;
|
||||
use rstd::ops::Deref;
|
||||
use sp_std::prelude::*;
|
||||
use sp_std::ops::Deref;
|
||||
#[cfg(feature = "std")]
|
||||
use std::borrow::Cow;
|
||||
#[cfg(feature = "std")]
|
||||
@@ -87,7 +87,7 @@ pub use self::hasher::blake2::Blake2Hasher;
|
||||
pub use primitives_storage as storage;
|
||||
|
||||
#[doc(hidden)]
|
||||
pub use rstd;
|
||||
pub use sp_std;
|
||||
|
||||
/// Context for executing a call into the runtime.
|
||||
pub enum ExecutionContext {
|
||||
@@ -147,7 +147,7 @@ impl OpaqueMetadata {
|
||||
}
|
||||
}
|
||||
|
||||
impl rstd::ops::Deref for OpaqueMetadata {
|
||||
impl sp_std::ops::Deref for OpaqueMetadata {
|
||||
type Target = Vec<u8>;
|
||||
|
||||
fn deref(&self) -> &Self::Target {
|
||||
@@ -165,8 +165,8 @@ pub enum NativeOrEncoded<R> {
|
||||
}
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
impl<R: codec::Encode> rstd::fmt::Debug for NativeOrEncoded<R> {
|
||||
fn fmt(&self, f: &mut rstd::fmt::Formatter) -> rstd::fmt::Result {
|
||||
impl<R: codec::Encode> sp_std::fmt::Debug for NativeOrEncoded<R> {
|
||||
fn fmt(&self, f: &mut sp_std::fmt::Formatter) -> sp_std::fmt::Result {
|
||||
hexdisplay::HexDisplay::from(&self.as_encoded().as_ref()).fmt(f)
|
||||
}
|
||||
}
|
||||
@@ -305,7 +305,7 @@ pub fn to_substrate_wasm_fn_return_value(value: &impl Encode) -> u64 {
|
||||
// Leak the output vector to avoid it being freed.
|
||||
// This is fine in a WASM context since the heap
|
||||
// will be discarded after the call.
|
||||
rstd::mem::forget(encoded);
|
||||
sp_std::mem::forget(encoded);
|
||||
|
||||
res
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
//! Offchain workers types
|
||||
|
||||
use codec::{Encode, Decode};
|
||||
use rstd::{prelude::{Vec, Box}, convert::TryFrom};
|
||||
use sp_std::{prelude::{Vec, Box}, convert::TryFrom};
|
||||
use crate::RuntimeDebug;
|
||||
use runtime_interface::pass_by::{PassByCodec, PassByInner, PassByEnum};
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
//! Definition of a sandbox environment.
|
||||
|
||||
use codec::{Encode, Decode};
|
||||
use rstd::vec::Vec;
|
||||
use sp_std::vec::Vec;
|
||||
|
||||
/// Error error that can be returned from host function.
|
||||
#[derive(Encode, Decode)]
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
//! for this to work.
|
||||
// end::description[]
|
||||
#[cfg(feature = "full_crypto")]
|
||||
use rstd::vec::Vec;
|
||||
use sp_std::vec::Vec;
|
||||
#[cfg(feature = "full_crypto")]
|
||||
use schnorrkel::{signing_context, ExpansionMode, Keypair, SecretKey, MiniSecretKey, PublicKey,
|
||||
derive::{Derivation, ChainCode, CHAIN_CODE_LENGTH}
|
||||
@@ -42,7 +42,7 @@ use crate::crypto::Ss58Codec;
|
||||
use crate::{crypto::{Public as TraitPublic, UncheckedFrom, CryptoType, Derive}};
|
||||
use crate::hash::{H256, H512};
|
||||
use codec::{Encode, Decode};
|
||||
use rstd::ops::Deref;
|
||||
use sp_std::ops::Deref;
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
use serde::{de, Deserialize, Deserializer, Serialize, Serializer};
|
||||
@@ -121,7 +121,7 @@ impl std::str::FromStr for Public {
|
||||
}
|
||||
}
|
||||
|
||||
impl rstd::convert::TryFrom<&[u8]> for Public {
|
||||
impl sp_std::convert::TryFrom<&[u8]> for Public {
|
||||
type Error = ();
|
||||
|
||||
fn try_from(data: &[u8]) -> Result<Self, Self::Error> {
|
||||
@@ -154,15 +154,15 @@ impl std::fmt::Display for Public {
|
||||
}
|
||||
}
|
||||
|
||||
impl rstd::fmt::Debug for Public {
|
||||
impl sp_std::fmt::Debug for Public {
|
||||
#[cfg(feature = "std")]
|
||||
fn fmt(&self, f: &mut rstd::fmt::Formatter) -> rstd::fmt::Result {
|
||||
fn fmt(&self, f: &mut sp_std::fmt::Formatter) -> sp_std::fmt::Result {
|
||||
let s = self.to_ss58check();
|
||||
write!(f, "{} ({}...)", crate::hexdisplay::HexDisplay::from(&self.0), &s[0..8])
|
||||
}
|
||||
|
||||
#[cfg(not(feature = "std"))]
|
||||
fn fmt(&self, _: &mut rstd::fmt::Formatter) -> rstd::fmt::Result {
|
||||
fn fmt(&self, _: &mut sp_std::fmt::Formatter) -> sp_std::fmt::Result {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
@@ -188,7 +188,7 @@ impl<'de> Deserialize<'de> for Public {
|
||||
#[derive(Encode, Decode, PassByInner)]
|
||||
pub struct Signature(pub [u8; 64]);
|
||||
|
||||
impl rstd::convert::TryFrom<&[u8]> for Signature {
|
||||
impl sp_std::convert::TryFrom<&[u8]> for Signature {
|
||||
type Error = ();
|
||||
|
||||
fn try_from(data: &[u8]) -> Result<Self, Self::Error> {
|
||||
@@ -278,22 +278,22 @@ impl From<schnorrkel::Signature> for Signature {
|
||||
}
|
||||
}
|
||||
|
||||
impl rstd::fmt::Debug for Signature {
|
||||
impl sp_std::fmt::Debug for Signature {
|
||||
#[cfg(feature = "std")]
|
||||
fn fmt(&self, f: &mut rstd::fmt::Formatter) -> rstd::fmt::Result {
|
||||
fn fmt(&self, f: &mut sp_std::fmt::Formatter) -> sp_std::fmt::Result {
|
||||
write!(f, "{}", crate::hexdisplay::HexDisplay::from(&self.0))
|
||||
}
|
||||
|
||||
#[cfg(not(feature = "std"))]
|
||||
fn fmt(&self, _: &mut rstd::fmt::Formatter) -> rstd::fmt::Result {
|
||||
fn fmt(&self, _: &mut sp_std::fmt::Formatter) -> sp_std::fmt::Result {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "full_crypto")]
|
||||
impl rstd::hash::Hash for Signature {
|
||||
fn hash<H: rstd::hash::Hasher>(&self, state: &mut H) {
|
||||
rstd::hash::Hash::hash(&self.0[..], state);
|
||||
impl sp_std::hash::Hash for Signature {
|
||||
fn hash<H: sp_std::hash::Hasher>(&self, state: &mut H) {
|
||||
sp_std::hash::Hash::hash(&self.0[..], state);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -184,7 +184,7 @@ macro_rules! wasm_export_functions {
|
||||
&[0u8; 0]
|
||||
} else {
|
||||
unsafe {
|
||||
$crate::rstd::slice::from_raw_parts(input_data, input_len)
|
||||
$crate::sp_std::slice::from_raw_parts(input_data, input_len)
|
||||
}
|
||||
};
|
||||
|
||||
@@ -212,7 +212,7 @@ macro_rules! wasm_export_functions {
|
||||
&[0u8; 0]
|
||||
} else {
|
||||
unsafe {
|
||||
$crate::rstd::slice::from_raw_parts(input_data, input_len)
|
||||
$crate::sp_std::slice::from_raw_parts(input_data, input_len)
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -6,11 +6,11 @@ edition = "2018"
|
||||
description = "Storage related primitives"
|
||||
|
||||
[dependencies]
|
||||
rstd = { package = "sp-std", path = "../../sr-std", default-features = false }
|
||||
sp-std = { path = "../../std", default-features = false }
|
||||
serde = { version = "1.0.101", optional = true, features = ["derive"] }
|
||||
impl-serde = { version = "0.2.3", optional = true }
|
||||
sp-debug-derive = { version = "2.0.0", path = "../debug-derive" }
|
||||
|
||||
[features]
|
||||
default = [ "std" ]
|
||||
std = [ "rstd/std", "serde", "impl-serde" ]
|
||||
std = [ "sp-std/std", "serde", "impl-serde" ]
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
use serde::{Serialize, Deserialize};
|
||||
use sp_debug_derive::RuntimeDebug;
|
||||
|
||||
use rstd::{vec::Vec, borrow::Cow};
|
||||
use sp_std::{vec::Vec, borrow::Cow};
|
||||
|
||||
/// Storage key.
|
||||
#[derive(PartialEq, Eq, RuntimeDebug)]
|
||||
|
||||
@@ -7,5 +7,5 @@ edition = "2018"
|
||||
|
||||
[dependencies]
|
||||
primitives-storage = { package = "sp-core-storage", path = "../core/storage" }
|
||||
rstd = { package = "sp-std", path = "../sr-std" }
|
||||
sp-std = { path = "../std" }
|
||||
environmental = { version = "1.0.2" }
|
||||
|
||||
@@ -7,7 +7,7 @@ edition = "2018"
|
||||
[dependencies]
|
||||
app-crypto = { package = "sc-application-crypto", path = "../application-crypto", default-features = false }
|
||||
codec = { package = "parity-scale-codec", version = "1.0.0", default-features = false, features = ["derive"] }
|
||||
rstd = { package = "sp-std", path = "../sr-std", default-features = false }
|
||||
sp-std = { path = "../std", default-features = false }
|
||||
serde = { version = "1.0.101", optional = true, features = ["derive"] }
|
||||
sp-api = { path = "../sr-api", default-features = false }
|
||||
sp-runtime = { path = "../runtime", default-features = false }
|
||||
@@ -17,7 +17,7 @@ default = ["std"]
|
||||
std = [
|
||||
"app-crypto/std",
|
||||
"codec/std",
|
||||
"rstd/std",
|
||||
"sp-std/std",
|
||||
"serde",
|
||||
"sp-api/std",
|
||||
"sp-runtime/std",
|
||||
|
||||
@@ -25,8 +25,8 @@ extern crate alloc;
|
||||
use serde::Serialize;
|
||||
use codec::{Encode, Decode, Input, Codec};
|
||||
use sp_runtime::{ConsensusEngineId, RuntimeDebug};
|
||||
use rstd::borrow::Cow;
|
||||
use rstd::vec::Vec;
|
||||
use sp_std::borrow::Cow;
|
||||
use sp_std::vec::Vec;
|
||||
|
||||
mod app {
|
||||
use app_crypto::{app_crypto, key_types::GRANDPA, ed25519};
|
||||
|
||||
@@ -7,12 +7,12 @@ edition = "2018"
|
||||
[dependencies]
|
||||
codec = { package = "parity-scale-codec", version = "1.0.0", default-features = false }
|
||||
inherents = { package = "sp-inherents", path = "../../primitives/inherents", default-features = false }
|
||||
rstd = { package = "sp-std", path = "../../primitives/sr-std", default-features = false }
|
||||
sp-std = { path = "../../primitives/std", default-features = false }
|
||||
|
||||
[features]
|
||||
default = ["std"]
|
||||
std = [
|
||||
"codec/std",
|
||||
"rstd/std",
|
||||
"sp-std/std",
|
||||
"inherents/std",
|
||||
]
|
||||
|
||||
@@ -6,7 +6,7 @@ edition = "2018"
|
||||
|
||||
[dependencies]
|
||||
parking_lot = { version = "0.9.0", optional = true }
|
||||
rstd = { package = "sp-std", path = "../sr-std", default-features = false }
|
||||
sp-std = { path = "../std", default-features = false }
|
||||
primitives = { package = "sp-core", path = "../core", default-features = false }
|
||||
codec = { package = "parity-scale-codec", version = "1.0.6", default-features = false, features = ["derive"] }
|
||||
derive_more = { version = "0.99.2", optional = true }
|
||||
@@ -15,7 +15,7 @@ derive_more = { version = "0.99.2", optional = true }
|
||||
default = [ "std" ]
|
||||
std = [
|
||||
"parking_lot",
|
||||
"rstd/std",
|
||||
"sp-std/std",
|
||||
"codec/std",
|
||||
"primitives/std",
|
||||
"derive_more",
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
|
||||
use codec::{Encode, Decode};
|
||||
|
||||
use rstd::{collections::btree_map::{BTreeMap, IntoIter, Entry}, vec::Vec};
|
||||
use sp_std::{collections::btree_map::{BTreeMap, IntoIter, Entry}, vec::Vec};
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
use parking_lot::RwLock;
|
||||
|
||||
@@ -6,7 +6,7 @@ edition = "2018"
|
||||
|
||||
[dependencies]
|
||||
serde = { version = "1.0.101", optional = true, features = ["derive"] }
|
||||
rstd = { package = "sp-std", path = "../sr-std", default-features = false }
|
||||
sp-std = { path = "../std", default-features = false }
|
||||
sp-runtime = { path = "../../primitives/runtime", default-features = false }
|
||||
|
||||
[dev-dependencies]
|
||||
@@ -18,6 +18,6 @@ rand = "0.7.2"
|
||||
default = ["std"]
|
||||
std = [
|
||||
"serde",
|
||||
"rstd/std",
|
||||
"sp-std/std",
|
||||
"sp-runtime/std",
|
||||
]
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
|
||||
#![cfg_attr(not(feature = "std"), no_std)]
|
||||
|
||||
use rstd::{prelude::*, collections::btree_map::BTreeMap};
|
||||
use sp_std::{prelude::*, collections::btree_map::BTreeMap};
|
||||
use sp_runtime::RuntimeDebug;
|
||||
use sp_runtime::{helpers_128bit::multiply_by_rational, Perbill, Rational128};
|
||||
use sp_runtime::traits::{Zero, Convert, Member, SimpleArithmetic, Saturating, Bounded};
|
||||
|
||||
@@ -23,7 +23,7 @@ use sp_runtime::{
|
||||
assert_eq_error_rate, Perbill,
|
||||
traits::{Convert, Member, SaturatedConversion}
|
||||
};
|
||||
use rstd::collections::btree_map::BTreeMap;
|
||||
use sp_std::collections::btree_map::BTreeMap;
|
||||
|
||||
pub(crate) struct TestCurrencyToVote;
|
||||
impl Convert<Balance, u64> for TestCurrencyToVote {
|
||||
@@ -149,7 +149,7 @@ pub(crate) fn elect_float<A, FS>(
|
||||
if let Some(winner) = candidates
|
||||
.iter_mut()
|
||||
.filter(|c| !c.elected)
|
||||
.min_by(|x, y| x.score.partial_cmp(&y.score).unwrap_or(rstd::cmp::Ordering::Equal))
|
||||
.min_by(|x, y| x.score.partial_cmp(&y.score).unwrap_or(sp_std::cmp::Ordering::Equal))
|
||||
{
|
||||
winner.elected = true;
|
||||
for n in &mut voters {
|
||||
@@ -250,10 +250,10 @@ pub(crate) fn do_equalize_float<A>(
|
||||
if backing_backed_stake.len() > 0 {
|
||||
let max_stake = backing_backed_stake
|
||||
.iter()
|
||||
.max_by(|x, y| x.partial_cmp(&y).unwrap_or(rstd::cmp::Ordering::Equal))
|
||||
.max_by(|x, y| x.partial_cmp(&y).unwrap_or(sp_std::cmp::Ordering::Equal))
|
||||
.expect("vector with positive length will have a max; qed");
|
||||
let min_stake = backed_stakes_iter
|
||||
.min_by(|x, y| x.partial_cmp(&y).unwrap_or(rstd::cmp::Ordering::Equal))
|
||||
.min_by(|x, y| x.partial_cmp(&y).unwrap_or(sp_std::cmp::Ordering::Equal))
|
||||
.expect("iterator with positive length will have a min; qed");
|
||||
|
||||
difference = max_stake - min_stake;
|
||||
@@ -277,7 +277,7 @@ pub(crate) fn do_equalize_float<A>(
|
||||
elected_edges.sort_unstable_by(|x, y|
|
||||
support_map.get(&x.0)
|
||||
.and_then(|x| support_map.get(&y.0).and_then(|y| x.total.partial_cmp(&y.total)))
|
||||
.unwrap_or(rstd::cmp::Ordering::Equal)
|
||||
.unwrap_or(sp_std::cmp::Ordering::Equal)
|
||||
);
|
||||
|
||||
let mut cumulative_stake = 0.0;
|
||||
|
||||
@@ -6,7 +6,7 @@ edition = "2018"
|
||||
|
||||
[dependencies]
|
||||
wasm-interface = { package = "sp-wasm-interface", path = "../wasm-interface", optional = true }
|
||||
rstd = { package = "sp-std", path = "../sr-std", default-features = false }
|
||||
sp-std = { path = "../std", default-features = false }
|
||||
sp-runtime-interface-proc-macro = { path = "proc-macro" }
|
||||
externalities = { package = "sp-externalities", path = "../externalities", optional = true }
|
||||
codec = { package = "parity-scale-codec", version = "1.0.6", default-features = false }
|
||||
@@ -25,7 +25,7 @@ runtime-io = { package = "sp-io", path = "../sr-io" }
|
||||
default = [ "std" ]
|
||||
std = [
|
||||
"wasm-interface",
|
||||
"rstd/std",
|
||||
"sp-std/std",
|
||||
"codec/std",
|
||||
"externalities",
|
||||
"environmental",
|
||||
|
||||
@@ -50,10 +50,10 @@ pub fn derive_impl(input: DeriveInput) -> Result<TokenStream> {
|
||||
type PassBy = #crate_::pass_by::Enum<#ident>;
|
||||
}
|
||||
|
||||
impl #crate_::rstd::convert::TryFrom<u8> for #ident {
|
||||
impl #crate_::sp_std::convert::TryFrom<u8> for #ident {
|
||||
type Error = ();
|
||||
|
||||
fn try_from(inner: u8) -> #crate_::rstd::result::Result<Self, ()> {
|
||||
fn try_from(inner: u8) -> #crate_::sp_std::result::Result<Self, ()> {
|
||||
match inner {
|
||||
#( #try_from_variants, )*
|
||||
_ => Err(()),
|
||||
|
||||
@@ -30,13 +30,13 @@ use wasm_interface::{FunctionContext, Result};
|
||||
|
||||
use codec::{Encode, Decode};
|
||||
|
||||
use rstd::{any::TypeId, mem, vec::Vec};
|
||||
use sp_std::{any::TypeId, mem, vec::Vec};
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
use rstd::borrow::Cow;
|
||||
use sp_std::borrow::Cow;
|
||||
|
||||
#[cfg(not(feature = "std"))]
|
||||
use rstd::{slice, boxed::Box};
|
||||
use sp_std::{slice, boxed::Box};
|
||||
|
||||
// Make sure that our assumptions for storing a pointer + its size in `u64` is valid.
|
||||
#[cfg(all(not(feature = "std"), not(feature = "disable_target_static_assertions")))]
|
||||
@@ -48,7 +48,7 @@ assert_eq_size!(*const u8, u32);
|
||||
pub fn pointer_and_len_to_u64(ptr: u32, len: u32) -> u64 {
|
||||
// The static assertions from above are changed into a runtime check.
|
||||
#[cfg(all(not(feature = "std"), feature = "disable_target_static_assertions"))]
|
||||
assert_eq!(4, rstd::mem::size_of::<usize>());
|
||||
assert_eq!(4, sp_std::mem::size_of::<usize>());
|
||||
|
||||
(u64::from(len) << 32) | u64::from(ptr)
|
||||
}
|
||||
@@ -57,7 +57,7 @@ pub fn pointer_and_len_to_u64(ptr: u32, len: u32) -> u64 {
|
||||
pub fn pointer_and_len_from_u64(val: u64) -> (u32, u32) {
|
||||
// The static assertions from above are changed into a runtime check.
|
||||
#[cfg(all(not(feature = "std"), feature = "disable_target_static_assertions"))]
|
||||
assert_eq!(4, rstd::mem::size_of::<usize>());
|
||||
assert_eq!(4, sp_std::mem::size_of::<usize>());
|
||||
|
||||
let ptr = (val & (!0u32 as u64)) as u32;
|
||||
let len = (val >> 32) as u32;
|
||||
@@ -373,7 +373,7 @@ impl_traits_for_arrays! {
|
||||
75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96,
|
||||
}
|
||||
|
||||
impl<T: codec::Codec, E: codec::Codec> PassBy for rstd::result::Result<T, E> {
|
||||
impl<T: codec::Codec, E: codec::Codec> PassBy for sp_std::result::Result<T, E> {
|
||||
type PassBy = Codec<Self>;
|
||||
}
|
||||
|
||||
|
||||
@@ -77,7 +77,7 @@
|
||||
pub use wasm_interface;
|
||||
|
||||
#[doc(hidden)]
|
||||
pub use rstd;
|
||||
pub use sp_std;
|
||||
|
||||
pub use sp_runtime_interface_proc_macro::runtime_interface;
|
||||
|
||||
|
||||
@@ -30,10 +30,10 @@ use crate::wasm::*;
|
||||
#[cfg(feature = "std")]
|
||||
use wasm_interface::{FunctionContext, Pointer, Result};
|
||||
|
||||
use rstd::{marker::PhantomData, convert::TryFrom};
|
||||
use sp_std::{marker::PhantomData, convert::TryFrom};
|
||||
|
||||
#[cfg(not(feature = "std"))]
|
||||
use rstd::{slice, vec::Vec};
|
||||
use sp_std::{slice, vec::Vec};
|
||||
|
||||
pub use sp_runtime_interface_proc_macro::{PassByCodec, PassByInner, PassByEnum};
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
use crate::RIType;
|
||||
|
||||
use rstd::cell::Cell;
|
||||
use sp_std::cell::Cell;
|
||||
|
||||
/// Something that can be created from a ffi value.
|
||||
///
|
||||
|
||||
@@ -7,7 +7,7 @@ build = "build.rs"
|
||||
|
||||
[dependencies]
|
||||
runtime-interface = { package = "sp-runtime-interface", path = "../", default-features = false }
|
||||
rstd = { package = "sp-std", path = "../../sr-std", default-features = false }
|
||||
sp-std = { path = "../../std", default-features = false }
|
||||
runtime-io = { package = "sp-io", path = "../../sr-io", default-features = false }
|
||||
primitives = { package = "sp-core", path = "../../core", default-features = false }
|
||||
|
||||
@@ -16,4 +16,4 @@ wasm-builder-runner = { package = "substrate-wasm-builder-runner", version = "1.
|
||||
|
||||
[features]
|
||||
default = [ "std" ]
|
||||
std = [ "runtime-interface/std", "rstd/std", "primitives/std", "runtime-io/std" ]
|
||||
std = [ "runtime-interface/std", "sp-std/std", "primitives/std", "runtime-io/std" ]
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
use runtime_interface::runtime_interface;
|
||||
|
||||
#[cfg(not(feature = "std"))]
|
||||
use rstd::{vec, vec::Vec, mem, convert::TryFrom};
|
||||
use sp_std::{vec, vec::Vec, mem, convert::TryFrom};
|
||||
|
||||
use primitives::{sr25519::Public, wasm_export_functions};
|
||||
|
||||
@@ -95,8 +95,8 @@ extern "C" {
|
||||
/// Make sure the old runtime interface needs to be imported.
|
||||
#[no_mangle]
|
||||
pub fn force_old_runtime_interface_import() {
|
||||
unsafe { ext_clear_storage(rstd::ptr::null(), 0); }
|
||||
unsafe { ext_keccak_256(rstd::ptr::null(), 0, rstd::ptr::null_mut()); }
|
||||
unsafe { ext_clear_storage(sp_std::ptr::null(), 0); }
|
||||
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`.
|
||||
@@ -173,7 +173,7 @@ wasm_export_functions! {
|
||||
fn test_invalid_utf8_data_should_return_an_error() {
|
||||
let data = vec![0, 159, 146, 150];
|
||||
// I'm an evil hacker, trying to hack!
|
||||
let data_str = unsafe { rstd::str::from_utf8_unchecked(&data) };
|
||||
let data_str = unsafe { sp_std::str::from_utf8_unchecked(&data) };
|
||||
|
||||
test_api::invalid_utf8_data(data_str);
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ codec = { package = "parity-scale-codec", version = "1.0.0", default-features =
|
||||
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 }
|
||||
rstd = { package = "sp-std", path = "../sr-std", default-features = false }
|
||||
sp-std = { path = "../std", default-features = false }
|
||||
runtime_io = { package = "sp-io", path = "../sr-io", default-features = false }
|
||||
log = { version = "0.4.8", optional = true }
|
||||
paste = "0.1.6"
|
||||
@@ -32,7 +32,7 @@ std = [
|
||||
"log",
|
||||
"primitives/std",
|
||||
"rand",
|
||||
"rstd/std",
|
||||
"sp-std/std",
|
||||
"runtime_io/std",
|
||||
"serde",
|
||||
"inherents/std",
|
||||
|
||||
@@ -22,7 +22,7 @@ use std::fmt;
|
||||
#[cfg(feature = "std")]
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use rstd::prelude::*;
|
||||
use sp_std::prelude::*;
|
||||
use primitives::RuntimeDebug;
|
||||
use crate::codec::{Codec, Encode, Decode};
|
||||
use crate::traits::{self, Member, Block as BlockT, Header as HeaderT, MaybeSerialize};
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
#[cfg(feature = "std")]
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use rstd::prelude::*;
|
||||
use sp_std::prelude::*;
|
||||
|
||||
use crate::ConsensusEngineId;
|
||||
use crate::codec::{Decode, Encode, Input, Error};
|
||||
|
||||
@@ -25,7 +25,7 @@ use crate::traits::{
|
||||
};
|
||||
use crate::generic::Digest;
|
||||
use primitives::U256;
|
||||
use rstd::{
|
||||
use sp_std::{
|
||||
convert::TryFrom,
|
||||
fmt::Debug,
|
||||
};
|
||||
@@ -104,10 +104,10 @@ impl<Number, Hash> codec::EncodeLike for Header<Number, Hash> where
|
||||
{}
|
||||
|
||||
impl<Number, Hash> traits::Header for Header<Number, Hash> where
|
||||
Number: Member + MaybeSerializeDeserialize + Debug + rstd::hash::Hash + MaybeDisplay +
|
||||
Number: Member + MaybeSerializeDeserialize + Debug + sp_std::hash::Hash + MaybeDisplay +
|
||||
SimpleArithmetic + Codec + Copy + Into<U256> + TryFrom<U256>,
|
||||
Hash: HashT,
|
||||
Hash::Output: Default + rstd::hash::Hash + Copy + Member +
|
||||
Hash::Output: Default + sp_std::hash::Hash + Copy + Member +
|
||||
MaybeSerialize + Debug + MaybeDisplay + SimpleBitOps + Codec,
|
||||
{
|
||||
type Number = Number;
|
||||
@@ -152,9 +152,9 @@ impl<Number, Hash> traits::Header for Header<Number, Hash> where
|
||||
}
|
||||
|
||||
impl<Number, Hash> Header<Number, Hash> where
|
||||
Number: Member + rstd::hash::Hash + Copy + MaybeDisplay + SimpleArithmetic + Codec + Into<U256> + TryFrom<U256>,
|
||||
Number: Member + sp_std::hash::Hash + Copy + MaybeDisplay + SimpleArithmetic + Codec + Into<U256> + TryFrom<U256>,
|
||||
Hash: HashT,
|
||||
Hash::Output: Default + rstd::hash::Hash + Copy + Member + MaybeDisplay + SimpleBitOps + Codec,
|
||||
Hash::Output: Default + sp_std::hash::Hash + Copy + Member + MaybeDisplay + SimpleBitOps + Codec,
|
||||
{
|
||||
/// Convenience helper for computing the hash of the header without having
|
||||
/// to import the trait.
|
||||
|
||||
@@ -37,10 +37,10 @@ pub use self::digest::{
|
||||
};
|
||||
|
||||
use crate::codec::Encode;
|
||||
use rstd::prelude::*;
|
||||
use sp_std::prelude::*;
|
||||
|
||||
fn encode_with_vec_prefix<T: Encode, F: Fn(&mut Vec<u8>)>(encoder: F) -> Vec<u8> {
|
||||
let size = ::rstd::mem::size_of::<T>();
|
||||
let size = ::sp_std::mem::size_of::<T>();
|
||||
let reserve = match size {
|
||||
0..=0b00111111 => 1,
|
||||
0..=0b00111111_11111111 => 2,
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
//! Generic implementation of an unchecked (pre-verification) extrinsic.
|
||||
|
||||
use rstd::{fmt, prelude::*};
|
||||
use sp_std::{fmt, prelude::*};
|
||||
use runtime_io::hashing::blake2_256;
|
||||
use codec::{Decode, Encode, EncodeLike, Input, Error};
|
||||
use crate::{
|
||||
@@ -322,7 +322,7 @@ mod tests {
|
||||
type DispatchInfo = ();
|
||||
type Pre = ();
|
||||
|
||||
fn additional_signed(&self) -> rstd::result::Result<(), TransactionValidityError> { Ok(()) }
|
||||
fn additional_signed(&self) -> sp_std::result::Result<(), TransactionValidityError> { Ok(()) }
|
||||
}
|
||||
|
||||
type Ex = UncheckedExtrinsic<TestAccountId, TestCall, TestSig, TestExtra>;
|
||||
|
||||
@@ -29,7 +29,7 @@ pub use codec;
|
||||
#[doc(hidden)]
|
||||
pub use serde;
|
||||
#[doc(hidden)]
|
||||
pub use rstd;
|
||||
pub use sp_std;
|
||||
|
||||
#[doc(hidden)]
|
||||
pub use paste;
|
||||
@@ -40,8 +40,8 @@ pub use app_crypto;
|
||||
#[cfg(feature = "std")]
|
||||
pub use primitives::storage::{StorageOverlay, ChildrenStorageOverlay};
|
||||
|
||||
use rstd::prelude::*;
|
||||
use rstd::convert::TryFrom;
|
||||
use sp_std::prelude::*;
|
||||
use sp_std::convert::TryFrom;
|
||||
use primitives::{crypto, ed25519, sr25519, ecdsa, hash::{H256, H512}};
|
||||
use codec::{Encode, Decode};
|
||||
|
||||
@@ -613,14 +613,14 @@ macro_rules! assert_eq_error_rate {
|
||||
#[derive(PartialEq, Eq, Clone, Default, Encode, Decode)]
|
||||
pub struct OpaqueExtrinsic(pub Vec<u8>);
|
||||
|
||||
impl rstd::fmt::Debug for OpaqueExtrinsic {
|
||||
impl sp_std::fmt::Debug for OpaqueExtrinsic {
|
||||
#[cfg(feature = "std")]
|
||||
fn fmt(&self, fmt: &mut rstd::fmt::Formatter) -> rstd::fmt::Result {
|
||||
fn fmt(&self, fmt: &mut sp_std::fmt::Formatter) -> sp_std::fmt::Result {
|
||||
write!(fmt, "{}", primitives::hexdisplay::HexDisplay::from(&self.0))
|
||||
}
|
||||
|
||||
#[cfg(not(feature = "std"))]
|
||||
fn fmt(&self, _fmt: &mut rstd::fmt::Formatter) -> rstd::fmt::Result {
|
||||
fn fmt(&self, _fmt: &mut sp_std::fmt::Formatter) -> sp_std::fmt::Result {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,10 +47,10 @@
|
||||
//! assert_eq!(body.error(), &None);
|
||||
//! ```
|
||||
|
||||
use rstd::str;
|
||||
use rstd::prelude::Vec;
|
||||
use sp_std::str;
|
||||
use sp_std::prelude::Vec;
|
||||
#[cfg(not(feature = "std"))]
|
||||
use rstd::prelude::vec;
|
||||
use sp_std::prelude::vec;
|
||||
use primitives::RuntimeDebug;
|
||||
use primitives::offchain::{
|
||||
Timestamp,
|
||||
@@ -111,7 +111,7 @@ mod header {
|
||||
/// Returns the name of this header.
|
||||
pub fn name(&self) -> &str {
|
||||
// Header keys are always produced from `&str` so this is safe.
|
||||
// we don't store them as `Strings` to avoid bringing `alloc::String` to rstd
|
||||
// we don't store them as `Strings` to avoid bringing `alloc::String` to sp-std
|
||||
// or here.
|
||||
unsafe { str::from_utf8_unchecked(&self.name) }
|
||||
}
|
||||
@@ -119,7 +119,7 @@ mod header {
|
||||
/// Returns the value of this header.
|
||||
pub fn value(&self) -> &str {
|
||||
// Header values are always produced from `&str` so this is safe.
|
||||
// we don't store them as `Strings` to avoid bringing `alloc::String` to rstd
|
||||
// we don't store them as `Strings` to avoid bringing `alloc::String` to sp-std
|
||||
// or here.
|
||||
unsafe { str::from_utf8_unchecked(&self.value) }
|
||||
}
|
||||
|
||||
@@ -16,8 +16,8 @@
|
||||
|
||||
//! Primitives for the runtime modules.
|
||||
|
||||
use rstd::prelude::*;
|
||||
use rstd::{self, result, marker::PhantomData, convert::{TryFrom, TryInto}, fmt::Debug};
|
||||
use sp_std::prelude::*;
|
||||
use sp_std::{self, result, marker::PhantomData, convert::{TryFrom, TryInto}, fmt::Debug};
|
||||
use runtime_io;
|
||||
#[cfg(feature = "std")]
|
||||
use std::fmt::Display;
|
||||
@@ -316,15 +316,15 @@ impl<T: Default + Eq + PartialEq> Clear for T {
|
||||
/// A meta trait for all bit ops.
|
||||
pub trait SimpleBitOps:
|
||||
Sized + Clear +
|
||||
rstd::ops::BitOr<Self, Output = Self> +
|
||||
rstd::ops::BitXor<Self, Output = Self> +
|
||||
rstd::ops::BitAnd<Self, Output = Self>
|
||||
sp_std::ops::BitOr<Self, Output = Self> +
|
||||
sp_std::ops::BitXor<Self, Output = Self> +
|
||||
sp_std::ops::BitAnd<Self, Output = Self>
|
||||
{}
|
||||
impl<T:
|
||||
Sized + Clear +
|
||||
rstd::ops::BitOr<Self, Output = Self> +
|
||||
rstd::ops::BitXor<Self, Output = Self> +
|
||||
rstd::ops::BitAnd<Self, Output = Self>
|
||||
sp_std::ops::BitOr<Self, Output = Self> +
|
||||
sp_std::ops::BitXor<Self, Output = Self> +
|
||||
sp_std::ops::BitAnd<Self, Output = Self>
|
||||
> SimpleBitOps for T {}
|
||||
|
||||
/// The block finalization trait. Implementing this lets you express what should happen
|
||||
@@ -369,7 +369,7 @@ pub trait OffchainWorker<BlockNumber> {
|
||||
// traits must be fulfilled by all type parameters.
|
||||
pub trait Hash: 'static + MaybeSerializeDeserialize + Debug + Clone + Eq + PartialEq {
|
||||
/// The hash type produced.
|
||||
type Output: Member + MaybeSerializeDeserialize + Debug + rstd::hash::Hash
|
||||
type Output: Member + MaybeSerializeDeserialize + Debug + sp_std::hash::Hash
|
||||
+ AsRef<[u8]> + AsMut<[u8]> + Copy + Default + Encode + Decode;
|
||||
|
||||
/// The associated hash_db Hasher type.
|
||||
@@ -481,7 +481,7 @@ impl_maybe_marker!(
|
||||
MaybeDisplay: Display;
|
||||
|
||||
/// A type that implements Hash when in std environment.
|
||||
MaybeHash: rstd::hash::Hash;
|
||||
MaybeHash: sp_std::hash::Hash;
|
||||
|
||||
/// A type that implements Serialize when in std environment.
|
||||
MaybeSerialize: Serialize;
|
||||
@@ -523,10 +523,10 @@ pub trait IsMember<MemberId> {
|
||||
/// You can also create a `new` one from those fields.
|
||||
pub trait Header: Clone + Send + Sync + Codec + Eq + MaybeSerialize + Debug + 'static {
|
||||
/// Header number.
|
||||
type Number: Member + MaybeSerializeDeserialize + Debug + rstd::hash::Hash
|
||||
type Number: Member + MaybeSerializeDeserialize + Debug + sp_std::hash::Hash
|
||||
+ Copy + MaybeDisplay + SimpleArithmetic + Codec;
|
||||
/// Header hash type
|
||||
type Hash: Member + MaybeSerializeDeserialize + Debug + rstd::hash::Hash
|
||||
type Hash: Member + MaybeSerializeDeserialize + Debug + sp_std::hash::Hash
|
||||
+ Copy + MaybeDisplay + Default + SimpleBitOps + Codec + AsRef<[u8]> + AsMut<[u8]>;
|
||||
/// Hashing algorithm
|
||||
type Hashing: Hash<Output = Self::Hash>;
|
||||
@@ -581,7 +581,7 @@ pub trait Block: Clone + Send + Sync + Codec + Eq + MaybeSerialize + Debug + 'st
|
||||
/// Header type.
|
||||
type Header: Header<Hash=Self::Hash>;
|
||||
/// Block hash type.
|
||||
type Hash: Member + MaybeSerializeDeserialize + Debug + rstd::hash::Hash
|
||||
type Hash: Member + MaybeSerializeDeserialize + Debug + sp_std::hash::Hash
|
||||
+ Copy + MaybeDisplay + Default + SimpleBitOps + Codec + AsRef<[u8]> + AsMut<[u8]>;
|
||||
|
||||
/// Returns a reference to the header.
|
||||
@@ -865,7 +865,7 @@ impl SignedExtension for () {
|
||||
type Call = ();
|
||||
type Pre = ();
|
||||
type DispatchInfo = ();
|
||||
fn additional_signed(&self) -> rstd::result::Result<(), TransactionValidityError> { Ok(()) }
|
||||
fn additional_signed(&self) -> sp_std::result::Result<(), TransactionValidityError> { Ok(()) }
|
||||
}
|
||||
|
||||
/// An "executable" piece of information, used by the standard Substrate Executive in order to
|
||||
@@ -906,7 +906,7 @@ pub trait Applyable: Sized + Send + Sync {
|
||||
}
|
||||
|
||||
/// Auxiliary wrapper that holds an api instance and binds it to the given lifetime.
|
||||
pub struct ApiRef<'a, T>(T, rstd::marker::PhantomData<&'a ()>);
|
||||
pub struct ApiRef<'a, T>(T, sp_std::marker::PhantomData<&'a ()>);
|
||||
|
||||
impl<'a, T> From<T> for ApiRef<'a, T> {
|
||||
fn from(api: T) -> Self {
|
||||
@@ -914,7 +914,7 @@ impl<'a, T> From<T> for ApiRef<'a, T> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, T> rstd::ops::Deref for ApiRef<'a, T> {
|
||||
impl<'a, T> sp_std::ops::Deref for ApiRef<'a, T> {
|
||||
type Target = T;
|
||||
|
||||
fn deref(&self) -> &Self::Target {
|
||||
@@ -922,7 +922,7 @@ impl<'a, T> rstd::ops::Deref for ApiRef<'a, T> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, T> rstd::ops::DerefMut for ApiRef<'a, T> {
|
||||
impl<'a, T> sp_std::ops::DerefMut for ApiRef<'a, T> {
|
||||
fn deref_mut(&mut self) -> &mut T {
|
||||
&mut self.0
|
||||
}
|
||||
@@ -1161,7 +1161,7 @@ macro_rules! impl_opaque_keys {
|
||||
/// The generated key pairs are stored in the keystore.
|
||||
///
|
||||
/// Returns the concatenated SCALE encoded public keys.
|
||||
pub fn generate(seed: Option<$crate::rstd::vec::Vec<u8>>) -> $crate::rstd::vec::Vec<u8> {
|
||||
pub fn generate(seed: Option<$crate::sp_std::vec::Vec<u8>>) -> $crate::sp_std::vec::Vec<u8> {
|
||||
let keys = Self{
|
||||
$(
|
||||
$field: <
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
//! Transaction validity interface.
|
||||
|
||||
use rstd::prelude::*;
|
||||
use sp_std::prelude::*;
|
||||
use crate::codec::{Encode, Decode};
|
||||
use crate::RuntimeDebug;
|
||||
|
||||
|
||||
@@ -6,9 +6,9 @@ edition = "2018"
|
||||
|
||||
[dependencies]
|
||||
sp-api = { path = "../sr-api", default-features = false }
|
||||
rstd = { package = "sp-std", path = "../sr-std", default-features = false }
|
||||
sp-std = { path = "../std", default-features = false }
|
||||
sp-runtime = { path = "../runtime", optional = true }
|
||||
|
||||
[features]
|
||||
default = [ "std" ]
|
||||
std = [ "sp-api/std", "rstd/std", "sp-runtime" ]
|
||||
std = [ "sp-api/std", "sp-std/std", "sp-runtime" ]
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
#![cfg_attr(not(feature = "std"), no_std)]
|
||||
|
||||
use rstd::vec::Vec;
|
||||
use sp_std::vec::Vec;
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
use sp_runtime::{generic::BlockId, traits::{ProvideRuntimeApi, Block as BlockT}};
|
||||
|
||||
@@ -8,7 +8,7 @@ edition = "2018"
|
||||
codec = { package = "parity-scale-codec", version = "1.0.0", default-features = false }
|
||||
sp-api-proc-macro = { path = "proc-macro" }
|
||||
primitives = { package = "sp-core", path = "../core", default-features = false }
|
||||
rstd = { package = "sp-std", path = "../sr-std", default-features = false }
|
||||
sp-std = { path = "../std", default-features = false }
|
||||
sp-runtime = { path = "../runtime", default-features = false }
|
||||
sp-version = { path = "../sr-version", default-features = false }
|
||||
state-machine = { package = "sp-state-machine", path = "../../primitives/state-machine", optional = true }
|
||||
@@ -26,7 +26,7 @@ default = [ "std" ]
|
||||
std = [
|
||||
"codec/std",
|
||||
"primitives/std",
|
||||
"rstd/std",
|
||||
"sp-std/std",
|
||||
"sp-runtime/std",
|
||||
"state-machine",
|
||||
"sp-version/std",
|
||||
|
||||
@@ -52,9 +52,9 @@ pub use primitives::{offchain, ExecutionContext};
|
||||
#[doc(hidden)]
|
||||
pub use sp_version::{ApiId, RuntimeVersion, ApisVec, create_apis_vec};
|
||||
#[doc(hidden)]
|
||||
pub use rstd::{slice, mem};
|
||||
pub use sp_std::{slice, mem};
|
||||
#[cfg(feature = "std")]
|
||||
use rstd::result;
|
||||
use sp_std::result;
|
||||
#[doc(hidden)]
|
||||
pub use codec::{Encode, Decode};
|
||||
use primitives::OpaqueMetadata;
|
||||
|
||||
@@ -8,7 +8,7 @@ edition = "2018"
|
||||
codec = { package = "parity-scale-codec", version = "1.0.0", default-features = false, features = ["derive"] }
|
||||
integer-sqrt = "0.1.2"
|
||||
num-traits = { version = "0.2.8", default-features = false }
|
||||
rstd = { package = "sp-std", path = "../sr-std", default-features = false }
|
||||
sp-std = { path = "../std", default-features = false }
|
||||
serde = { version = "1.0.101", optional = true, features = ["derive"] }
|
||||
sp-debug-derive = { path = "../../primitives/core/debug-derive", default-features = false }
|
||||
|
||||
@@ -22,7 +22,7 @@ default = ["std"]
|
||||
std = [
|
||||
"codec/std",
|
||||
"num-traits/std",
|
||||
"rstd/std",
|
||||
"sp-std/std",
|
||||
"serde",
|
||||
"sp-debug-derive/std",
|
||||
]
|
||||
|
||||
+15
-15
@@ -285,39 +285,30 @@ dependencies = [
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "sr-arithmetic"
|
||||
name = "sp-arithmetic"
|
||||
version = "2.0.0"
|
||||
dependencies = [
|
||||
"integer-sqrt 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"parity-scale-codec 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde 1.0.102 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"sr-std 2.0.0",
|
||||
"substrate-debug-derive 2.0.0",
|
||||
"sp-debug-derive 2.0.0",
|
||||
"sp-std 2.0.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "sr-arithmetic-fuzzer"
|
||||
name = "sp-arithmetic-fuzzer"
|
||||
version = "2.0.0"
|
||||
dependencies = [
|
||||
"honggfuzz 0.5.45 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"num-bigint 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"primitive-types 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"sr-arithmetic 2.0.0",
|
||||
"sp-arithmetic 2.0.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "sr-std"
|
||||
version = "2.0.0"
|
||||
|
||||
[[package]]
|
||||
name = "static_assertions"
|
||||
version = "1.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "substrate-debug-derive"
|
||||
name = "sp-debug-derive"
|
||||
version = "2.0.0"
|
||||
dependencies = [
|
||||
"proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
@@ -325,6 +316,15 @@ dependencies = [
|
||||
"syn 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "sp-std"
|
||||
version = "2.0.0"
|
||||
|
||||
[[package]]
|
||||
name = "static_assertions"
|
||||
version = "1.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "syn"
|
||||
version = "0.15.44"
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
//! Infinite precision unsigned integer for substrate runtime.
|
||||
|
||||
use num_traits::Zero;
|
||||
use rstd::{cmp::Ordering, ops, prelude::*, cell::RefCell, convert::TryFrom};
|
||||
use sp_std::{cmp::Ordering, ops, prelude::*, cell::RefCell, convert::TryFrom};
|
||||
|
||||
// A sensible value for this would be half of the dword size of the host machine. Since the
|
||||
// runtime is compiled to 32bit webassembly, using 32 and 64 for single and double respectively
|
||||
@@ -427,9 +427,9 @@ impl BigUint {
|
||||
}
|
||||
}
|
||||
|
||||
impl rstd::fmt::Debug for BigUint {
|
||||
impl sp_std::fmt::Debug for BigUint {
|
||||
#[cfg(feature = "std")]
|
||||
fn fmt(&self, f: &mut rstd::fmt::Formatter<'_>) -> rstd::fmt::Result {
|
||||
fn fmt(&self, f: &mut sp_std::fmt::Formatter<'_>) -> sp_std::fmt::Result {
|
||||
write!(
|
||||
f,
|
||||
"BigUint {{ {:?} ({:?})}}",
|
||||
@@ -439,7 +439,7 @@ impl rstd::fmt::Debug for BigUint {
|
||||
}
|
||||
|
||||
#[cfg(not(feature = "std"))]
|
||||
fn fmt(&self, _: &mut rstd::fmt::Formatter<'_>) -> rstd::fmt::Result {
|
||||
fn fmt(&self, _: &mut sp_std::fmt::Formatter<'_>) -> sp_std::fmt::Result {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -646,7 +646,7 @@ pub mod tests {
|
||||
|
||||
#[test]
|
||||
fn can_try_build_numbers_from_types() {
|
||||
use rstd::convert::TryFrom;
|
||||
use sp_std::convert::TryFrom;
|
||||
assert_eq!(u64::try_from(with_limbs(1)).unwrap(), 1);
|
||||
assert_eq!(u64::try_from(with_limbs(2)).unwrap(), u32::max_value() as u64 + 2);
|
||||
assert_eq!(
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Substrate. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
use rstd::{
|
||||
use sp_std::{
|
||||
ops, prelude::*,
|
||||
convert::{TryFrom, TryInto},
|
||||
};
|
||||
@@ -179,14 +179,14 @@ impl CheckedDiv for Fixed64 {
|
||||
}
|
||||
}
|
||||
|
||||
impl rstd::fmt::Debug for Fixed64 {
|
||||
impl sp_std::fmt::Debug for Fixed64 {
|
||||
#[cfg(feature = "std")]
|
||||
fn fmt(&self, f: &mut rstd::fmt::Formatter) -> rstd::fmt::Result {
|
||||
fn fmt(&self, f: &mut sp_std::fmt::Formatter) -> sp_std::fmt::Result {
|
||||
write!(f, "Fixed64({},{})", self.0 / DIV, (self.0 % DIV) / 1000)
|
||||
}
|
||||
|
||||
#[cfg(not(feature = "std"))]
|
||||
fn fmt(&self, _: &mut rstd::fmt::Formatter) -> rstd::fmt::Result {
|
||||
fn fmt(&self, _: &mut sp_std::fmt::Formatter) -> sp_std::fmt::Result {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
|
||||
use crate::biguint;
|
||||
use num_traits::Zero;
|
||||
use rstd::{cmp::{min, max}, convert::TryInto, mem};
|
||||
use sp_std::{cmp::{min, max}, convert::TryInto, mem};
|
||||
|
||||
/// Helper gcd function used in Rational128 implementation.
|
||||
pub fn gcd(a: u128, b: u128) -> u128 {
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
#[cfg(feature = "std")]
|
||||
use serde::{Serialize, Deserialize};
|
||||
|
||||
use rstd::{ops, prelude::*, convert::TryInto};
|
||||
use sp_std::{ops, prelude::*, convert::TryInto};
|
||||
use codec::{Encode, Decode, CompactAs};
|
||||
use crate::traits::{SaturatedConversion, UniqueSaturatedInto, Saturating};
|
||||
use sp_debug_derive::RuntimeDebug;
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Substrate. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
use rstd::{cmp::Ordering, prelude::*};
|
||||
use sp_std::{cmp::Ordering, prelude::*};
|
||||
use crate::helpers_128bit;
|
||||
use num_traits::Zero;
|
||||
use sp_debug_derive::RuntimeDebug;
|
||||
|
||||
@@ -16,14 +16,14 @@
|
||||
|
||||
//! Primitives for the runtime modules.
|
||||
|
||||
use rstd::{self, convert::{TryFrom, TryInto}};
|
||||
use sp_std::{self, convert::{TryFrom, TryInto}};
|
||||
use codec::HasCompact;
|
||||
pub use integer_sqrt::IntegerSquareRoot;
|
||||
pub use num_traits::{
|
||||
Zero, One, Bounded, CheckedAdd, CheckedSub, CheckedMul, CheckedDiv,
|
||||
CheckedShl, CheckedShr
|
||||
};
|
||||
use rstd::ops::{
|
||||
use sp_std::ops::{
|
||||
Add, Sub, Mul, Div, Rem, AddAssign, SubAssign, MulAssign, DivAssign,
|
||||
RemAssign, Shl, Shr
|
||||
};
|
||||
|
||||
@@ -8,7 +8,7 @@ edition = "2018"
|
||||
codec = { package = "parity-scale-codec", version = "1.0.6", default-features = false }
|
||||
hash-db = { version = "0.15.2", default-features = false }
|
||||
primitives = { package = "sp-core", path = "../core", default-features = false }
|
||||
rstd = { package = "sp-std", path = "../sr-std", default-features = false }
|
||||
sp-std = { path = "../std", default-features = false }
|
||||
libsecp256k1 = { version = "0.3.0", optional = true }
|
||||
sp-state-machine = { path = "../../primitives/state-machine", optional = true }
|
||||
runtime-interface = { package = "sp-runtime-interface", path = "../runtime-interface", default-features = false }
|
||||
@@ -21,7 +21,7 @@ default = ["std"]
|
||||
std = [
|
||||
"primitives/std",
|
||||
"codec/std",
|
||||
"rstd/std",
|
||||
"sp-std/std",
|
||||
"hash-db/std",
|
||||
"trie",
|
||||
"sp-state-machine",
|
||||
|
||||
@@ -28,10 +28,10 @@
|
||||
#![cfg_attr(not(feature = "std"),
|
||||
doc = "Substrate's runtime standard library as compiled without Rust's standard library.")]
|
||||
|
||||
use rstd::vec::Vec;
|
||||
use sp_std::vec::Vec;
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
use rstd::ops::Deref;
|
||||
use sp_std::ops::Deref;
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
use primitives::{
|
||||
@@ -775,7 +775,7 @@ mod allocator_impl {
|
||||
#[no_mangle]
|
||||
pub fn panic(info: &core::panic::PanicInfo) -> ! {
|
||||
unsafe {
|
||||
let message = rstd::alloc::format!("{}", info);
|
||||
let message = sp_std::alloc::format!("{}", info);
|
||||
logging::log(LogLevel::Error, "runtime", message.as_bytes());
|
||||
core::intrinsics::abort()
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ edition = "2018"
|
||||
[dependencies]
|
||||
wasmi = { version = "0.6.2", optional = true }
|
||||
primitives = { package = "sp-core", path = "../core", default-features = false }
|
||||
rstd = { package = "sp-std", path = "../sr-std", default-features = false }
|
||||
sp-std = { path = "../std", default-features = false }
|
||||
runtime-io = { package = "sp-io", path = "../sr-io", default-features = false }
|
||||
codec = { package = "parity-scale-codec", version = "1.0.0", default-features = false }
|
||||
|
||||
@@ -20,7 +20,7 @@ default = ["std"]
|
||||
std = [
|
||||
"wasmi",
|
||||
"primitives/std",
|
||||
"rstd/std",
|
||||
"sp-std/std",
|
||||
"codec/std",
|
||||
"runtime-io/std",
|
||||
]
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
#![cfg_attr(not(feature = "std"), no_std)]
|
||||
#![cfg_attr(not(feature = "std"), feature(core_intrinsics))]
|
||||
|
||||
use rstd::prelude::*;
|
||||
use sp_std::prelude::*;
|
||||
|
||||
pub use primitives::sandbox::{TypedValue, ReturnValue, HostError};
|
||||
|
||||
|
||||
@@ -14,8 +14,8 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Substrate. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
use rstd::collections::btree_map::BTreeMap;
|
||||
use rstd::fmt;
|
||||
use sp_std::collections::btree_map::BTreeMap;
|
||||
use sp_std::fmt;
|
||||
|
||||
use wasmi::{
|
||||
Externals, FuncInstance, FuncRef, GlobalDescriptor, GlobalRef, ImportResolver,
|
||||
|
||||
@@ -14,14 +14,14 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Substrate. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
use rstd::{prelude::*, slice, marker, mem, vec, rc::Rc};
|
||||
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;
|
||||
|
||||
mod ffi {
|
||||
use rstd::mem;
|
||||
use sp_std::mem;
|
||||
use super::HostFuncType;
|
||||
|
||||
/// Index into the default table that points to a `HostFuncType`.
|
||||
|
||||
@@ -7,12 +7,12 @@ edition = "2018"
|
||||
[dependencies]
|
||||
codec = { package = "parity-scale-codec", version = "1.0.0", default-features = false, features = ["derive"] }
|
||||
sp-runtime = { path = "../runtime", default-features = false }
|
||||
rstd = { package = "sp-std", path = "../sr-std", default-features = false }
|
||||
sp-std = { path = "../std", default-features = false }
|
||||
|
||||
[features]
|
||||
default = ["std"]
|
||||
std = [
|
||||
"codec/std",
|
||||
"sp-runtime/std",
|
||||
"rstd/std",
|
||||
"sp-std/std",
|
||||
]
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
//! Common traits and types that are useful for describing offences for usage in environments
|
||||
//! that use staking.
|
||||
|
||||
use rstd::vec::Vec;
|
||||
use sp_std::vec::Vec;
|
||||
|
||||
use codec::{Encode, Decode};
|
||||
use sp_runtime::Perbill;
|
||||
|
||||
@@ -8,7 +8,7 @@ edition = "2018"
|
||||
impl-serde = { version = "0.2.3", optional = true }
|
||||
serde = { version = "1.0.101", optional = true, features = ["derive"] }
|
||||
codec = { package = "parity-scale-codec", version = "1.0.5", default-features = false, features = ["derive"] }
|
||||
rstd = { package = "sp-std", path = "../sr-std", default-features = false }
|
||||
sp-std = { path = "../std", default-features = false }
|
||||
sp-runtime = { path = "../runtime", default-features = false }
|
||||
|
||||
[features]
|
||||
@@ -17,6 +17,6 @@ std = [
|
||||
"impl-serde",
|
||||
"serde",
|
||||
"codec/std",
|
||||
"rstd/std",
|
||||
"sp-std/std",
|
||||
"sp-runtime/std",
|
||||
]
|
||||
|
||||
@@ -6,7 +6,7 @@ edition = "2018"
|
||||
|
||||
[dependencies]
|
||||
sp-api = { path = "../sr-api", default-features = false }
|
||||
rstd = { package = "sp-std", path = "../sr-std", default-features = false }
|
||||
sp-std = { path = "../std", default-features = false }
|
||||
sp-runtime = { path = "../runtime", default-features = false }
|
||||
codec = { package = "parity-scale-codec", version = "1.0.0", default-features = false, features = ["derive"] }
|
||||
inherents = { package = "sp-inherents", path = "../inherents", default-features = false }
|
||||
@@ -16,7 +16,7 @@ impl-trait-for-tuples = "0.1.3"
|
||||
default = [ "std" ]
|
||||
std = [
|
||||
"sp-api/std",
|
||||
"rstd/std",
|
||||
"sp-std/std",
|
||||
"sp-runtime/std",
|
||||
"codec/std",
|
||||
"inherents/std",
|
||||
|
||||
@@ -13,7 +13,7 @@ harness = false
|
||||
|
||||
[dependencies]
|
||||
codec = { package = "parity-scale-codec", version = "1.0.0", default-features = false }
|
||||
rstd = { package = "sp-std", path = "../sr-std", default-features = false }
|
||||
sp-std = { path = "../std", default-features = false }
|
||||
hash-db = { version = "0.15.2", default-features = false }
|
||||
trie-db = { version = "0.16.0", default-features = false }
|
||||
trie-root = { version = "0.15.2", default-features = false }
|
||||
@@ -29,7 +29,7 @@ hex-literal = "0.2.1"
|
||||
[features]
|
||||
default = ["std"]
|
||||
std = [
|
||||
"rstd/std",
|
||||
"sp-std/std",
|
||||
"codec/std",
|
||||
"hash-db/std",
|
||||
"memory-db/std",
|
||||
|
||||
@@ -23,8 +23,8 @@ mod node_header;
|
||||
mod node_codec;
|
||||
mod trie_stream;
|
||||
|
||||
use rstd::boxed::Box;
|
||||
use rstd::vec::Vec;
|
||||
use sp_std::boxed::Box;
|
||||
use sp_std::vec::Vec;
|
||||
use hash_db::Hasher;
|
||||
/// Our `NodeCodec`-specific error.
|
||||
pub use error::Error;
|
||||
@@ -44,7 +44,7 @@ pub use hash_db::{HashDB as HashDBT, EMPTY_PREFIX};
|
||||
|
||||
#[derive(Default)]
|
||||
/// substrate trie layout
|
||||
pub struct Layout<H>(rstd::marker::PhantomData<H>);
|
||||
pub struct Layout<H>(sp_std::marker::PhantomData<H>);
|
||||
|
||||
impl<H: Hasher> TrieLayout for Layout<H> {
|
||||
const USE_EXTENSION: bool = false;
|
||||
|
||||
@@ -16,10 +16,10 @@
|
||||
|
||||
//! `NodeCodec` implementation for Substrate's trie format.
|
||||
|
||||
use rstd::marker::PhantomData;
|
||||
use rstd::ops::Range;
|
||||
use rstd::vec::Vec;
|
||||
use rstd::borrow::Borrow;
|
||||
use sp_std::marker::PhantomData;
|
||||
use sp_std::ops::Range;
|
||||
use sp_std::vec::Vec;
|
||||
use sp_std::borrow::Borrow;
|
||||
use codec::{Encode, Decode, Input, Compact};
|
||||
use hash_db::Hasher;
|
||||
use trie_db::{self, node::{NibbleSlicePlan, NodePlan, NodeHandlePlan}, ChildReference,
|
||||
@@ -30,7 +30,7 @@ use super::{node_header::{NodeHeader, NodeKind}};
|
||||
|
||||
/// Helper struct for trie node decoder. This implements `codec::Input` on a byte slice, while
|
||||
/// tracking the absolute position. This is similar to `std::io::Cursor` but does not implement
|
||||
/// `Read` and `io` is not in `rstd`.
|
||||
/// `Read` and `io` is not in `sp-std`.
|
||||
struct ByteSliceInput<'a> {
|
||||
data: &'a [u8],
|
||||
offset: usize,
|
||||
@@ -94,7 +94,7 @@ impl<H: Hasher> NodeCodecT for NodeCodec<H> {
|
||||
H::hash(<Self as NodeCodecT>::empty_node())
|
||||
}
|
||||
|
||||
fn decode_plan(data: &[u8]) -> rstd::result::Result<NodePlan, Self::Error> {
|
||||
fn decode_plan(data: &[u8]) -> sp_std::result::Result<NodePlan, Self::Error> {
|
||||
let mut input = ByteSliceInput::new(data);
|
||||
match NodeHeader::decode(&mut input)? {
|
||||
NodeHeader::Null => Ok(NodePlan::Empty),
|
||||
@@ -229,7 +229,7 @@ fn partial_from_iterator_encode<I: Iterator<Item = u8>>(
|
||||
nibble_count: usize,
|
||||
node_kind: NodeKind,
|
||||
) -> Vec<u8> {
|
||||
let nibble_count = rstd::cmp::min(trie_constants::NIBBLE_SIZE_BOUND, nibble_count);
|
||||
let nibble_count = sp_std::cmp::min(trie_constants::NIBBLE_SIZE_BOUND, nibble_count);
|
||||
|
||||
let mut output = Vec::with_capacity(3 + (nibble_count / nibble_ops::NIBBLE_PER_BYTE));
|
||||
match node_kind {
|
||||
@@ -247,7 +247,7 @@ fn partial_encode(partial: Partial, node_kind: NodeKind) -> Vec<u8> {
|
||||
let number_nibble_encoded = (partial.0).0 as usize;
|
||||
let nibble_count = partial.1.len() * nibble_ops::NIBBLE_PER_BYTE + number_nibble_encoded;
|
||||
|
||||
let nibble_count = rstd::cmp::min(trie_constants::NIBBLE_SIZE_BOUND, nibble_count);
|
||||
let nibble_count = sp_std::cmp::min(trie_constants::NIBBLE_SIZE_BOUND, nibble_count);
|
||||
|
||||
let mut output = Vec::with_capacity(3 + partial.1.len());
|
||||
match node_kind {
|
||||
@@ -290,4 +290,3 @@ impl Bitmap {
|
||||
dest[1] = (bitmap / 256) as u8;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
use crate::trie_constants;
|
||||
use codec::{Encode, Decode, Input, Output};
|
||||
use rstd::iter::once;
|
||||
use sp_std::iter::once;
|
||||
|
||||
/// A node header
|
||||
#[derive(Copy, Clone, PartialEq, Eq)]
|
||||
@@ -72,9 +72,9 @@ impl Decode for NodeHeader {
|
||||
/// Size encoding allows unlimited, length unefficient, representation, but
|
||||
/// is bounded to 16 bit maximum value to avoid possible DOS.
|
||||
pub(crate) fn size_and_prefix_iterator(size: usize, prefix: u8) -> impl Iterator<Item = u8> {
|
||||
let size = rstd::cmp::min(trie_constants::NIBBLE_SIZE_BOUND, size);
|
||||
let size = sp_std::cmp::min(trie_constants::NIBBLE_SIZE_BOUND, size);
|
||||
|
||||
let l1 = rstd::cmp::min(62, size);
|
||||
let l1 = sp_std::cmp::min(62, size);
|
||||
let (first_byte, mut rem) = if size == l1 {
|
||||
(once(prefix + l1 as u8), 0)
|
||||
} else {
|
||||
@@ -94,7 +94,7 @@ pub(crate) fn size_and_prefix_iterator(size: usize, prefix: u8) -> impl Iterator
|
||||
None
|
||||
}
|
||||
};
|
||||
first_byte.chain(rstd::iter::from_fn(next_bytes))
|
||||
first_byte.chain(sp_std::iter::from_fn(next_bytes))
|
||||
}
|
||||
|
||||
/// Encodes size and prefix to a stream output.
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
use hash_db::Hasher;
|
||||
use trie_root;
|
||||
use codec::Encode;
|
||||
use rstd::vec::Vec;
|
||||
use sp_std::vec::Vec;
|
||||
use crate::trie_constants;
|
||||
use crate::node_header::{NodeKind, size_and_prefix_iterator};
|
||||
use crate::node_codec::Bitmap;
|
||||
@@ -51,7 +51,7 @@ fn branch_node_bit_mask(has_children: impl Iterator<Item = bool>) -> (u8, u8) {
|
||||
|
||||
/// Create a leaf/branch node, encoding a number of nibbles.
|
||||
fn fuse_nibbles_node<'a>(nibbles: &'a [u8], kind: NodeKind) -> impl Iterator<Item = u8> + 'a {
|
||||
let size = rstd::cmp::min(trie_constants::NIBBLE_SIZE_BOUND, nibbles.len());
|
||||
let size = sp_std::cmp::min(trie_constants::NIBBLE_SIZE_BOUND, nibbles.len());
|
||||
|
||||
let iter_start = match kind {
|
||||
NodeKind::Leaf => size_and_prefix_iterator(size, trie_constants::LEAF_PREFIX_MASK),
|
||||
@@ -125,7 +125,7 @@ fn branch_node(has_value: bool, has_children: impl Iterator<Item = bool>) -> [u8
|
||||
result
|
||||
}
|
||||
|
||||
fn branch_node_buffered<I>(has_value: bool, has_children: I, output: &mut[u8])
|
||||
fn branch_node_buffered<I>(has_value: bool, has_children: I, output: &mut[u8])
|
||||
where
|
||||
I: Iterator<Item = bool>,
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user