mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-12 19:21:13 +00:00
sp-std removal from substrate/primitives (#3274)
This PR removes sp-std crate from substrate/primitives sub-directories. For now crates that have `pub use` of sp-std or export macros that would necessitate users of the macros to `extern crate alloc` have been excluded from this PR. There should be no breaking changes in this PR. --------- Co-authored-by: Koute <koute@users.noreply.github.com>
This commit is contained in:
@@ -24,7 +24,6 @@ sp-application-crypto = { path = "../../application-crypto", default-features =
|
||||
sp-consensus-slots = { path = "../slots", default-features = false }
|
||||
sp-inherents = { path = "../../inherents", default-features = false }
|
||||
sp-runtime = { path = "../../runtime", default-features = false }
|
||||
sp-std = { path = "../../std", default-features = false }
|
||||
sp-timestamp = { path = "../../timestamp", default-features = false }
|
||||
|
||||
[features]
|
||||
@@ -38,7 +37,6 @@ std = [
|
||||
"sp-consensus-slots/std",
|
||||
"sp-inherents/std",
|
||||
"sp-runtime/std",
|
||||
"sp-std/std",
|
||||
"sp-timestamp/std",
|
||||
]
|
||||
|
||||
|
||||
@@ -19,9 +19,11 @@
|
||||
|
||||
#![cfg_attr(not(feature = "std"), no_std)]
|
||||
|
||||
extern crate alloc;
|
||||
|
||||
use alloc::vec::Vec;
|
||||
use codec::{Codec, Decode, Encode};
|
||||
use sp_runtime::ConsensusEngineId;
|
||||
use sp_std::vec::Vec;
|
||||
|
||||
pub mod digests;
|
||||
pub mod inherents;
|
||||
|
||||
@@ -26,7 +26,6 @@ sp-consensus-slots = { path = "../slots", default-features = false }
|
||||
sp-core = { path = "../../core", default-features = false }
|
||||
sp-inherents = { path = "../../inherents", default-features = false }
|
||||
sp-runtime = { path = "../../runtime", default-features = false }
|
||||
sp-std = { path = "../../std", default-features = false }
|
||||
sp-timestamp = { path = "../../timestamp", optional = true }
|
||||
|
||||
[features]
|
||||
@@ -42,7 +41,6 @@ std = [
|
||||
"sp-core/std",
|
||||
"sp-inherents/std",
|
||||
"sp-runtime/std",
|
||||
"sp-std/std",
|
||||
"sp-timestamp/std",
|
||||
]
|
||||
|
||||
|
||||
@@ -22,9 +22,10 @@ use super::{
|
||||
BabeEpochConfiguration, Randomness, Slot, BABE_ENGINE_ID,
|
||||
};
|
||||
|
||||
#[cfg(not(feature = "std"))]
|
||||
use alloc::vec::Vec;
|
||||
use sp_core::sr25519::vrf::VrfSignature;
|
||||
use sp_runtime::{DigestItem, RuntimeDebug};
|
||||
use sp_std::vec::Vec;
|
||||
|
||||
use codec::{Decode, Encode, MaxEncodedLen};
|
||||
use scale_info::TypeInfo;
|
||||
|
||||
@@ -20,15 +20,18 @@
|
||||
#![forbid(unsafe_code, missing_docs, unused_variables, unused_imports)]
|
||||
#![cfg_attr(not(feature = "std"), no_std)]
|
||||
|
||||
extern crate alloc;
|
||||
|
||||
pub mod digests;
|
||||
pub mod inherents;
|
||||
|
||||
#[cfg(not(feature = "std"))]
|
||||
use alloc::vec::Vec;
|
||||
use codec::{Decode, Encode, MaxEncodedLen};
|
||||
use scale_info::TypeInfo;
|
||||
#[cfg(feature = "serde")]
|
||||
use serde::{Deserialize, Serialize};
|
||||
use sp_runtime::{traits::Header, ConsensusEngineId, RuntimeDebug};
|
||||
use sp_std::vec::Vec;
|
||||
|
||||
use crate::digests::{NextConfigDescriptor, NextEpochDescriptor};
|
||||
|
||||
|
||||
@@ -26,7 +26,6 @@ sp-io = { path = "../../io", default-features = false }
|
||||
sp-mmr-primitives = { path = "../../merkle-mountain-range", default-features = false }
|
||||
sp-runtime = { path = "../../runtime", default-features = false }
|
||||
sp-keystore = { path = "../../keystore", default-features = false }
|
||||
sp-std = { path = "../../std", default-features = false }
|
||||
strum = { version = "0.24.1", features = ["derive"], default-features = false }
|
||||
lazy_static = { version = "1.4.0", optional = true }
|
||||
|
||||
@@ -49,7 +48,6 @@ std = [
|
||||
"sp-keystore/std",
|
||||
"sp-mmr-primitives/std",
|
||||
"sp-runtime/std",
|
||||
"sp-std/std",
|
||||
"strum/std",
|
||||
]
|
||||
|
||||
|
||||
@@ -15,9 +15,10 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
use alloc::{vec, vec::Vec};
|
||||
use codec::{Decode, Encode, Error, Input};
|
||||
use core::cmp;
|
||||
use scale_info::TypeInfo;
|
||||
use sp_std::{cmp, prelude::*};
|
||||
|
||||
use crate::{Payload, ValidatorSetId};
|
||||
|
||||
@@ -97,10 +98,10 @@ pub struct SignedCommitment<TBlockNumber, TSignature> {
|
||||
pub signatures: Vec<Option<TSignature>>,
|
||||
}
|
||||
|
||||
impl<TBlockNumber: sp_std::fmt::Debug, TSignature> sp_std::fmt::Display
|
||||
impl<TBlockNumber: core::fmt::Debug, TSignature> core::fmt::Display
|
||||
for SignedCommitment<TBlockNumber, TSignature>
|
||||
{
|
||||
fn fmt(&self, f: &mut sp_std::fmt::Formatter<'_>) -> sp_std::fmt::Result {
|
||||
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
|
||||
let signatures_count = self.signatures.iter().filter(|s| s.is_some()).count();
|
||||
write!(
|
||||
f,
|
||||
@@ -254,8 +255,8 @@ pub enum VersionedFinalityProof<N, S> {
|
||||
V1(SignedCommitment<N, S>),
|
||||
}
|
||||
|
||||
impl<N: sp_std::fmt::Debug, S> sp_std::fmt::Display for VersionedFinalityProof<N, S> {
|
||||
fn fmt(&self, f: &mut sp_std::fmt::Formatter<'_>) -> sp_std::fmt::Result {
|
||||
impl<N: core::fmt::Debug, S> core::fmt::Display for VersionedFinalityProof<N, S> {
|
||||
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
|
||||
match self {
|
||||
VersionedFinalityProof::V1(sc) => write!(f, "VersionedFinalityProof::V1({})", sc),
|
||||
}
|
||||
|
||||
@@ -31,6 +31,8 @@
|
||||
//! it will use a different set of keys. For Polkadot use case we plan to use `secp256k1` for BEEFY,
|
||||
//! while GRANDPA uses `ed25519`.
|
||||
|
||||
extern crate alloc;
|
||||
|
||||
mod commitment;
|
||||
mod payload;
|
||||
|
||||
@@ -44,13 +46,13 @@ pub mod test_utils;
|
||||
pub use commitment::{Commitment, SignedCommitment, VersionedFinalityProof};
|
||||
pub use payload::{known_payloads, BeefyPayloadId, Payload, PayloadProvider};
|
||||
|
||||
use alloc::vec::Vec;
|
||||
use codec::{Codec, Decode, Encode};
|
||||
use core::fmt::{Debug, Display};
|
||||
use scale_info::TypeInfo;
|
||||
use sp_application_crypto::{AppCrypto, AppPublic, ByteArray, RuntimeAppPublic};
|
||||
use sp_core::H256;
|
||||
use sp_runtime::traits::{Hash, Keccak256, NumberFor};
|
||||
use sp_std::prelude::*;
|
||||
|
||||
/// Key type for BEEFY module.
|
||||
pub const KEY_TYPE: sp_core::crypto::KeyTypeId = sp_application_crypto::key_types::BEEFY;
|
||||
|
||||
@@ -26,7 +26,8 @@
|
||||
//! but we imagine they will be useful for other chains that either want to bridge with Polkadot
|
||||
//! or are completely standalone, but heavily inspired by Polkadot.
|
||||
|
||||
use crate::{ecdsa_crypto::AuthorityId, ConsensusLog, MmrRootHash, Vec, BEEFY_ENGINE_ID};
|
||||
use crate::{ecdsa_crypto::AuthorityId, ConsensusLog, MmrRootHash, BEEFY_ENGINE_ID};
|
||||
use alloc::vec::Vec;
|
||||
use codec::{Decode, Encode, MaxEncodedLen};
|
||||
use scale_info::TypeInfo;
|
||||
use sp_runtime::{
|
||||
@@ -150,10 +151,11 @@ pub use mmr_root_provider::MmrRootProvider;
|
||||
mod mmr_root_provider {
|
||||
use super::*;
|
||||
use crate::{known_payloads, payload::PayloadProvider, Payload};
|
||||
use alloc::sync::Arc;
|
||||
use core::marker::PhantomData;
|
||||
use sp_api::ProvideRuntimeApi;
|
||||
use sp_mmr_primitives::MmrApi;
|
||||
use sp_runtime::traits::NumberFor;
|
||||
use sp_std::{marker::PhantomData, sync::Arc};
|
||||
|
||||
/// A [`crate::Payload`] provider where payload is Merkle Mountain Range root hash.
|
||||
///
|
||||
|
||||
@@ -15,10 +15,10 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
use alloc::{vec, vec::Vec};
|
||||
use codec::{Decode, Encode};
|
||||
use scale_info::TypeInfo;
|
||||
use sp_runtime::traits::Block;
|
||||
use sp_std::prelude::*;
|
||||
|
||||
/// Id of different payloads in the [`crate::Commitment`] data.
|
||||
pub type BeefyPayloadId = [u8; 2];
|
||||
|
||||
@@ -23,9 +23,8 @@
|
||||
//! verification. This allows lowering the data and computation cost of verifying the
|
||||
//! signed commitment.
|
||||
|
||||
use sp_std::prelude::*;
|
||||
|
||||
use crate::commitment::{Commitment, SignedCommitment};
|
||||
use alloc::vec::Vec;
|
||||
|
||||
/// A light form of [SignedCommitment].
|
||||
///
|
||||
|
||||
@@ -27,7 +27,6 @@ sp-application-crypto = { path = "../../application-crypto", default-features =
|
||||
sp-core = { path = "../../core", default-features = false }
|
||||
sp-keystore = { path = "../../keystore", default-features = false, optional = true }
|
||||
sp-runtime = { path = "../../runtime", default-features = false }
|
||||
sp-std = { path = "../../std", default-features = false }
|
||||
|
||||
[features]
|
||||
default = ["std"]
|
||||
@@ -42,7 +41,6 @@ std = [
|
||||
"sp-core/std",
|
||||
"sp-keystore/std",
|
||||
"sp-runtime/std",
|
||||
"sp-std/std",
|
||||
]
|
||||
|
||||
# Serde support without relying on std features.
|
||||
|
||||
@@ -19,9 +19,12 @@
|
||||
|
||||
#![cfg_attr(not(feature = "std"), no_std)]
|
||||
|
||||
extern crate alloc;
|
||||
|
||||
#[cfg(feature = "serde")]
|
||||
use serde::Serialize;
|
||||
|
||||
use alloc::vec::Vec;
|
||||
use codec::{Codec, Decode, Encode};
|
||||
use scale_info::TypeInfo;
|
||||
#[cfg(feature = "std")]
|
||||
@@ -30,7 +33,6 @@ use sp_runtime::{
|
||||
traits::{Header as HeaderT, NumberFor},
|
||||
ConsensusEngineId, RuntimeDebug,
|
||||
};
|
||||
use sp_std::vec::Vec;
|
||||
|
||||
/// The log target to be used by client code.
|
||||
pub const CLIENT_LOG_TARGET: &str = "grandpa";
|
||||
|
||||
@@ -20,7 +20,6 @@ codec = { package = "parity-scale-codec", version = "3.6.1", default-features =
|
||||
sp-api = { path = "../../api", default-features = false }
|
||||
sp-core = { path = "../../core", default-features = false }
|
||||
sp-runtime = { path = "../../runtime", default-features = false }
|
||||
sp-std = { path = "../../std", default-features = false }
|
||||
|
||||
[features]
|
||||
default = ["std"]
|
||||
@@ -29,5 +28,4 @@ std = [
|
||||
"sp-api/std",
|
||||
"sp-core/std",
|
||||
"sp-runtime/std",
|
||||
"sp-std/std",
|
||||
]
|
||||
|
||||
@@ -19,9 +19,12 @@
|
||||
|
||||
#![cfg_attr(not(feature = "std"), no_std)]
|
||||
|
||||
extern crate alloc;
|
||||
|
||||
#[cfg(not(feature = "std"))]
|
||||
use alloc::vec::Vec;
|
||||
use codec::Decode;
|
||||
use sp_runtime::ConsensusEngineId;
|
||||
use sp_std::vec::Vec;
|
||||
|
||||
/// The `ConsensusEngineId` of PoW.
|
||||
pub const POW_ENGINE_ID: ConsensusEngineId = [b'p', b'o', b'w', b'_'];
|
||||
|
||||
@@ -26,7 +26,6 @@ sp-application-crypto = { path = "../../application-crypto", default-features =
|
||||
sp-consensus-slots = { path = "../slots", default-features = false }
|
||||
sp-core = { path = "../../core", default-features = false, features = ["bandersnatch-experimental"] }
|
||||
sp-runtime = { path = "../../runtime", default-features = false }
|
||||
sp-std = { path = "../../std", default-features = false }
|
||||
|
||||
[features]
|
||||
default = ["std"]
|
||||
@@ -39,7 +38,6 @@ std = [
|
||||
"sp-consensus-slots/std",
|
||||
"sp-core/std",
|
||||
"sp-runtime/std",
|
||||
"sp-std/std",
|
||||
]
|
||||
|
||||
# Serde support without relying on std features.
|
||||
|
||||
@@ -25,8 +25,9 @@ use crate::{
|
||||
use scale_codec::{Decode, Encode, MaxEncodedLen};
|
||||
use scale_info::TypeInfo;
|
||||
|
||||
#[cfg(not(feature = "std"))]
|
||||
use alloc::vec::Vec;
|
||||
use sp_runtime::{DigestItem, RuntimeDebug};
|
||||
use sp_std::vec::Vec;
|
||||
|
||||
/// Epoch slot claim digest entry.
|
||||
///
|
||||
|
||||
@@ -21,11 +21,13 @@
|
||||
#![forbid(unsafe_code, missing_docs, unused_variables, unused_imports)]
|
||||
#![cfg_attr(not(feature = "std"), no_std)]
|
||||
|
||||
extern crate alloc;
|
||||
|
||||
use alloc::vec::Vec;
|
||||
use scale_codec::{Decode, Encode, MaxEncodedLen};
|
||||
use scale_info::TypeInfo;
|
||||
use sp_core::crypto::KeyTypeId;
|
||||
use sp_runtime::{ConsensusEngineId, RuntimeDebug};
|
||||
use sp_std::vec::Vec;
|
||||
|
||||
pub use sp_consensus_slots::{Slot, SlotDuration};
|
||||
|
||||
|
||||
@@ -18,9 +18,10 @@
|
||||
//! Utilities related to VRF input, pre-output and signatures.
|
||||
|
||||
use crate::{Randomness, TicketBody, TicketId};
|
||||
#[cfg(not(feature = "std"))]
|
||||
use alloc::vec::Vec;
|
||||
use scale_codec::Encode;
|
||||
use sp_consensus_slots::Slot;
|
||||
use sp_std::vec::Vec;
|
||||
|
||||
pub use sp_core::bandersnatch::{
|
||||
ring_vrf::{RingProver, RingVerifier, RingVerifierData, RingVrfSignature},
|
||||
|
||||
@@ -19,7 +19,6 @@ targets = ["x86_64-unknown-linux-gnu"]
|
||||
codec = { package = "parity-scale-codec", version = "3.6.1", default-features = false, features = ["derive", "max-encoded-len"] }
|
||||
scale-info = { version = "2.10.0", default-features = false, features = ["derive"] }
|
||||
serde = { features = ["alloc", "derive"], optional = true, workspace = true }
|
||||
sp-std = { path = "../../std", default-features = false }
|
||||
sp-timestamp = { path = "../../timestamp", default-features = false }
|
||||
|
||||
[features]
|
||||
@@ -28,7 +27,6 @@ std = [
|
||||
"codec/std",
|
||||
"scale-info/std",
|
||||
"serde/std",
|
||||
"sp-std/std",
|
||||
"sp-timestamp/std",
|
||||
]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user