mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-29 16:07:57 +00:00
Add serde feature flag to primitives (#13027)
* add serde_full feature flag add serde_full to sp_runtime add space to toml add serde_full to application-crypto add serde_full to arithmetic fix arithmetic add serde full to beefy add serde full to consensus add serde_full to core add serdefull to finality grandpa add serde_full to several primitives crates make rpc no_std compatible add scale info to runtime make serializer no_std compatible add serde full to storage add full serde to version add serde full to weights add all serde_full features add . to comment add missing impl-serde fix no-std build fix build add full_crypto to serde_full serde_full also implements crypto full_serde does not work with full_crytpo. needs std no no_std serde impl possible also for crypto std is necessary no serde full for application crypto fix arithmetic fix tomls fix some things impl fmt for Signature add serialize to Public add impl_maybe_marker_serde_full fix sp-application-crypto toml add serde feature flag fix clippy fix toml grandpa fix grandpa rename if_std to if_serde keystore is not no_std compatible make keystore vrf no_std compatible fix nopos-elections fix rpc fix serializer fix test-primitives fix version add comment add serde full only import for format string remove all(serde_full and full_crypot) as serde_full enforces full_crypto make comment better readable even better comment clean up rpc toml clean up toml clean up serializer toml clean up storage toml fix std build update .lock fix sp-version move sp_std import test extern crate alloc replace sp_std with core add missing core sp_core: serde feature do not enforce full crypto application-crypto: serde feature do not enforce full crypto rename serde_full to serde add dep:serde and alloc to default feature add full_crypto and remove unnecessary debu/fmt impls for serde update comment remove obolsete change in display AccountId32 remove extra changes minimize diff revert keystore changes remove std from keystore remove full-crypto feature fix serde import fix comment fix feature = serde * rename serde_full to serde * move #[doc(hidden)] back * remove feature = full crypto require frm MultiSigner * reorder serde and scale_info import * fix bs58 missing alloc import in serde feature * add `from_string` to serde feature and add unimplemented * remove serde feature from fixed_point display * Remove serde/alloc Co-authored-by: Davide Galassi <davxy@datawok.net> * Update primitives/consensus/babe/Cargo.toml Co-authored-by: Bastian Köcher <git@kchr.de> * Update primitives/arithmetic/src/fixed_point.rs Co-authored-by: Bastian Köcher <git@kchr.de> * revert `from_string`fixed impl back to std only * remove duplicate runtime string impl * use sp_std::alloc * remove no_std compatible rpc * remove no_std compatibility from serializer * rename mpl_maybe_marker_serde to std_or_serde * update .lock * add sp-std to executor * fix sp-std import * fix sp_std::format import * use crate import * add serde feature * Update primitives/core/src/lib.rs --------- Co-authored-by: Davide Galassi <davxy@datawok.net> Co-authored-by: Bastian Köcher <git@kchr.de>
This commit is contained in:
@@ -24,7 +24,7 @@
|
||||
pub use codec;
|
||||
#[doc(hidden)]
|
||||
pub use scale_info;
|
||||
#[cfg(feature = "std")]
|
||||
#[cfg(feature = "serde")]
|
||||
#[doc(hidden)]
|
||||
pub use serde;
|
||||
#[doc(hidden)]
|
||||
@@ -52,6 +52,8 @@ use sp_std::prelude::*;
|
||||
|
||||
use codec::{Decode, Encode, MaxEncodedLen};
|
||||
use scale_info::TypeInfo;
|
||||
#[cfg(all(not(feature = "std"), feature = "serde"))]
|
||||
use sp_std::alloc::format;
|
||||
|
||||
pub mod curve;
|
||||
pub mod generic;
|
||||
@@ -122,7 +124,7 @@ pub type EncodedJustification = Vec<u8>;
|
||||
|
||||
/// Collection of justifications for a given block, multiple justifications may
|
||||
/// be provided by different consensus engines for the same block.
|
||||
#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]
|
||||
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Encode, Decode)]
|
||||
pub struct Justifications(Vec<Justification>);
|
||||
|
||||
@@ -179,7 +181,7 @@ impl From<Justification> for Justifications {
|
||||
use traits::{Lazy, Verify};
|
||||
|
||||
use crate::traits::IdentifyAccount;
|
||||
#[cfg(feature = "std")]
|
||||
#[cfg(feature = "serde")]
|
||||
pub use serde::{de::DeserializeOwned, Deserialize, Serialize};
|
||||
|
||||
/// Complex storage builder stuff.
|
||||
@@ -235,7 +237,7 @@ impl BuildStorage for () {
|
||||
pub type ConsensusEngineId = [u8; 4];
|
||||
|
||||
/// Signature verify that can work with any known signature types.
|
||||
#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]
|
||||
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
||||
#[derive(Eq, PartialEq, Clone, Encode, Decode, MaxEncodedLen, RuntimeDebug, TypeInfo)]
|
||||
pub enum MultiSignature {
|
||||
/// An Ed25519 signature.
|
||||
@@ -299,7 +301,7 @@ impl TryFrom<MultiSignature> for ecdsa::Signature {
|
||||
|
||||
/// Public key for any known crypto algorithm.
|
||||
#[derive(Eq, PartialEq, Ord, PartialOrd, Clone, Encode, Decode, RuntimeDebug, TypeInfo)]
|
||||
#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]
|
||||
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
||||
pub enum MultiSigner {
|
||||
/// An Ed25519 identity.
|
||||
Ed25519(ed25519::Public),
|
||||
@@ -427,7 +429,7 @@ impl Verify for MultiSignature {
|
||||
|
||||
/// Signature verify that can work with any known signature types..
|
||||
#[derive(Eq, PartialEq, Clone, Default, Encode, Decode, RuntimeDebug)]
|
||||
#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]
|
||||
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
||||
pub struct AnySignature(H512);
|
||||
|
||||
impl Verify for AnySignature {
|
||||
@@ -475,7 +477,7 @@ pub type DispatchResultWithInfo<T> = sp_std::result::Result<T, DispatchErrorWith
|
||||
|
||||
/// Reason why a pallet call failed.
|
||||
#[derive(Eq, Clone, Copy, Encode, Decode, Debug, TypeInfo, MaxEncodedLen)]
|
||||
#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]
|
||||
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
||||
pub struct ModuleError {
|
||||
/// Module index, matching the metadata module index.
|
||||
pub index: u8,
|
||||
@@ -483,7 +485,7 @@ pub struct ModuleError {
|
||||
pub error: [u8; MAX_MODULE_ERROR_ENCODED_SIZE],
|
||||
/// Optional error message.
|
||||
#[codec(skip)]
|
||||
#[cfg_attr(feature = "std", serde(skip_deserializing))]
|
||||
#[cfg_attr(feature = "serde", serde(skip_deserializing))]
|
||||
pub message: Option<&'static str>,
|
||||
}
|
||||
|
||||
@@ -495,7 +497,7 @@ impl PartialEq for ModuleError {
|
||||
|
||||
/// Errors related to transactional storage layers.
|
||||
#[derive(Eq, PartialEq, Clone, Copy, Encode, Decode, Debug, TypeInfo, MaxEncodedLen)]
|
||||
#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]
|
||||
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
||||
pub enum TransactionalError {
|
||||
/// Too many transactional layers have been spawned.
|
||||
LimitReached,
|
||||
@@ -520,12 +522,12 @@ impl From<TransactionalError> for DispatchError {
|
||||
|
||||
/// Reason why a dispatch call failed.
|
||||
#[derive(Eq, Clone, Copy, Encode, Decode, Debug, TypeInfo, PartialEq, MaxEncodedLen)]
|
||||
#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]
|
||||
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
||||
pub enum DispatchError {
|
||||
/// Some error occurred.
|
||||
Other(
|
||||
#[codec(skip)]
|
||||
#[cfg_attr(feature = "std", serde(skip_deserializing))]
|
||||
#[cfg_attr(feature = "serde", serde(skip_deserializing))]
|
||||
&'static str,
|
||||
),
|
||||
/// Failed to lookup some data.
|
||||
@@ -605,7 +607,7 @@ impl From<crate::traits::BadOrigin> for DispatchError {
|
||||
|
||||
/// Description of what went wrong when trying to complete an operation on a token.
|
||||
#[derive(Eq, PartialEq, Clone, Copy, Encode, Decode, Debug, TypeInfo, MaxEncodedLen)]
|
||||
#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]
|
||||
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
||||
pub enum TokenError {
|
||||
/// Funds are unavailable.
|
||||
FundsUnavailable,
|
||||
@@ -879,7 +881,7 @@ impl sp_std::fmt::Debug for OpaqueExtrinsic {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
#[cfg(feature = "serde")]
|
||||
impl ::serde::Serialize for OpaqueExtrinsic {
|
||||
fn serialize<S>(&self, seq: S) -> Result<S::Ok, S::Error>
|
||||
where
|
||||
@@ -889,7 +891,7 @@ impl ::serde::Serialize for OpaqueExtrinsic {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
#[cfg(feature = "serde")]
|
||||
impl<'a> ::serde::Deserialize<'a> for OpaqueExtrinsic {
|
||||
fn deserialize<D>(de: D) -> Result<Self, D::Error>
|
||||
where
|
||||
|
||||
Reference in New Issue
Block a user