mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-30 00:17:56 +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:
@@ -20,7 +20,7 @@
|
||||
#[cfg(feature = "std")]
|
||||
use std::fmt;
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
#[cfg(feature = "serde")]
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::{
|
||||
@@ -76,9 +76,9 @@ impl<Block: BlockT> fmt::Display for BlockId<Block> {
|
||||
|
||||
/// Abstraction over a substrate block.
|
||||
#[derive(PartialEq, Eq, Clone, Encode, Decode, RuntimeDebug, scale_info::TypeInfo)]
|
||||
#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]
|
||||
#[cfg_attr(feature = "std", serde(rename_all = "camelCase"))]
|
||||
#[cfg_attr(feature = "std", serde(deny_unknown_fields))]
|
||||
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
||||
#[cfg_attr(feature = "serde", serde(rename_all = "camelCase"))]
|
||||
#[cfg_attr(feature = "serde", serde(deny_unknown_fields))]
|
||||
pub struct Block<Header, Extrinsic: MaybeSerialize> {
|
||||
/// The block header.
|
||||
pub header: Header,
|
||||
@@ -114,9 +114,9 @@ where
|
||||
|
||||
/// Abstraction over a substrate block and justification.
|
||||
#[derive(PartialEq, Eq, Clone, Encode, Decode, RuntimeDebug)]
|
||||
#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]
|
||||
#[cfg_attr(feature = "std", serde(rename_all = "camelCase"))]
|
||||
#[cfg_attr(feature = "std", serde(deny_unknown_fields))]
|
||||
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
||||
#[cfg_attr(feature = "serde", serde(rename_all = "camelCase"))]
|
||||
#[cfg_attr(feature = "serde", serde(deny_unknown_fields))]
|
||||
pub struct SignedBlock<Block> {
|
||||
/// Full block.
|
||||
pub block: Block,
|
||||
|
||||
@@ -17,8 +17,10 @@
|
||||
|
||||
//! Generic implementation of a digest.
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
#[cfg(feature = "serde")]
|
||||
use serde::{Deserialize, Serialize};
|
||||
#[cfg(all(not(feature = "std"), feature = "serde"))]
|
||||
use sp_std::alloc::format;
|
||||
|
||||
use sp_std::prelude::*;
|
||||
|
||||
@@ -34,7 +36,7 @@ use sp_core::RuntimeDebug;
|
||||
|
||||
/// Generic header digest.
|
||||
#[derive(PartialEq, Eq, Clone, Encode, Decode, RuntimeDebug, TypeInfo, Default)]
|
||||
#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]
|
||||
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
||||
pub struct Digest {
|
||||
/// A list of logs in the digest.
|
||||
pub logs: Vec<DigestItem>,
|
||||
@@ -106,7 +108,7 @@ pub enum DigestItem {
|
||||
RuntimeEnvironmentUpdated,
|
||||
}
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
#[cfg(feature = "serde")]
|
||||
impl serde::Serialize for DigestItem {
|
||||
fn serialize<S>(&self, seq: S) -> Result<S::Ok, S::Error>
|
||||
where
|
||||
@@ -116,7 +118,7 @@ impl serde::Serialize for DigestItem {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
#[cfg(feature = "serde")]
|
||||
impl<'a> serde::Deserialize<'a> for DigestItem {
|
||||
fn deserialize<D>(de: D) -> Result<Self, D::Error>
|
||||
where
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
|
||||
//! Generic implementation of an unchecked (pre-verification) extrinsic.
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
#[cfg(feature = "serde")]
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::codec::{Decode, Encode, Error, Input, Output};
|
||||
@@ -30,7 +30,7 @@ pub type Phase = u64;
|
||||
|
||||
/// An era to describe the longevity of a transaction.
|
||||
#[derive(PartialEq, Eq, Clone, Copy, sp_core::RuntimeDebug)]
|
||||
#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]
|
||||
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
||||
pub enum Era {
|
||||
/// The transaction is valid forever. The genesis hash must be present in the signed content.
|
||||
Immortal,
|
||||
|
||||
@@ -26,22 +26,22 @@ use crate::{
|
||||
MaybeSerializeDeserialize, Member, SimpleBitOps,
|
||||
},
|
||||
};
|
||||
#[cfg(feature = "std")]
|
||||
#[cfg(feature = "serde")]
|
||||
use serde::{Deserialize, Serialize};
|
||||
use sp_core::U256;
|
||||
use sp_std::fmt::Debug;
|
||||
|
||||
/// Abstraction over a block header for a substrate chain.
|
||||
#[derive(Encode, Decode, PartialEq, Eq, Clone, sp_core::RuntimeDebug, TypeInfo)]
|
||||
#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]
|
||||
#[cfg_attr(feature = "std", serde(rename_all = "camelCase"))]
|
||||
#[cfg_attr(feature = "std", serde(deny_unknown_fields))]
|
||||
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
||||
#[cfg_attr(feature = "serde", serde(rename_all = "camelCase"))]
|
||||
#[cfg_attr(feature = "serde", serde(deny_unknown_fields))]
|
||||
pub struct Header<Number: Copy + Into<U256> + TryFrom<U256>, Hash: HashT> {
|
||||
/// The parent hash.
|
||||
pub parent_hash: Hash::Output,
|
||||
/// The block number.
|
||||
#[cfg_attr(
|
||||
feature = "std",
|
||||
feature = "serde",
|
||||
serde(serialize_with = "serialize_number", deserialize_with = "deserialize_number")
|
||||
)]
|
||||
#[codec(compact)]
|
||||
@@ -54,7 +54,7 @@ pub struct Header<Number: Copy + Into<U256> + TryFrom<U256>, Hash: HashT> {
|
||||
pub digest: Digest,
|
||||
}
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
#[cfg(feature = "serde")]
|
||||
pub fn serialize_number<S, T: Copy + Into<U256> + TryFrom<U256>>(
|
||||
val: &T,
|
||||
s: S,
|
||||
@@ -66,7 +66,7 @@ where
|
||||
serde::Serialize::serialize(&u256, s)
|
||||
}
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
#[cfg(feature = "serde")]
|
||||
pub fn deserialize_number<'a, D, T: Copy + Into<U256> + TryFrom<U256>>(d: D) -> Result<T, D::Error>
|
||||
where
|
||||
D: serde::Deserializer<'a>,
|
||||
|
||||
@@ -29,6 +29,8 @@ use crate::{
|
||||
use codec::{Compact, Decode, Encode, EncodeLike, Error, Input};
|
||||
use scale_info::{build::Fields, meta_type, Path, StaticTypeInfo, Type, TypeInfo, TypeParameter};
|
||||
use sp_io::hashing::blake2_256;
|
||||
#[cfg(all(not(feature = "std"), feature = "serde"))]
|
||||
use sp_std::alloc::format;
|
||||
use sp_std::{fmt, prelude::*};
|
||||
|
||||
/// Current version of the [`UncheckedExtrinsic`] encoded format.
|
||||
@@ -317,7 +319,7 @@ where
|
||||
{
|
||||
}
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
#[cfg(feature = "serde")]
|
||||
impl<Address: Encode, Signature: Encode, Call: Encode, Extra: SignedExtension> serde::Serialize
|
||||
for UncheckedExtrinsic<Address, Call, Signature, Extra>
|
||||
{
|
||||
@@ -329,7 +331,7 @@ impl<Address: Encode, Signature: Encode, Call: Encode, Extra: SignedExtension> s
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
#[cfg(feature = "serde")]
|
||||
impl<'a, Address: Decode, Signature: Decode, Call: Decode, Extra: SignedExtension>
|
||||
serde::Deserialize<'a> for UncheckedExtrinsic<Address, Call, Signature, Extra>
|
||||
{
|
||||
|
||||
@@ -20,12 +20,12 @@
|
||||
use crate::{ArithmeticError, TokenError};
|
||||
use codec::{Decode, Encode};
|
||||
use scale_info::TypeInfo;
|
||||
#[cfg(feature = "std")]
|
||||
#[cfg(feature = "serde")]
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
/// [`ModuleError`] type definition before BlockBuilder API version 6.
|
||||
#[derive(Eq, Clone, Copy, Encode, Decode, Debug, TypeInfo)]
|
||||
#[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,
|
||||
@@ -33,7 +33,7 @@ pub struct ModuleError {
|
||||
pub error: u8,
|
||||
/// Optional error message.
|
||||
#[codec(skip)]
|
||||
#[cfg_attr(feature = "std", serde(skip_deserializing))]
|
||||
#[cfg_attr(feature = "serde", serde(skip_deserializing))]
|
||||
pub message: Option<&'static str>,
|
||||
}
|
||||
|
||||
@@ -45,12 +45,12 @@ impl PartialEq for ModuleError {
|
||||
|
||||
/// [`DispatchError`] type definition before BlockBuilder API version 6.
|
||||
#[derive(Eq, Clone, Copy, Encode, Decode, Debug, TypeInfo, PartialEq)]
|
||||
#[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.
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -129,7 +129,7 @@ impl std::fmt::Display for RuntimeString {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
#[cfg(feature = "serde")]
|
||||
impl serde::Serialize for RuntimeString {
|
||||
fn serialize<S: serde::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
|
||||
match self {
|
||||
@@ -139,10 +139,10 @@ impl serde::Serialize for RuntimeString {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
#[cfg(feature = "serde")]
|
||||
impl<'de> serde::Deserialize<'de> for RuntimeString {
|
||||
fn deserialize<D: serde::Deserializer<'de>>(de: D) -> Result<Self, D::Error> {
|
||||
String::deserialize(de).map(Self::Owned)
|
||||
Ok(Self::Owned(serde::Deserialize::deserialize(de)?))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ use crate::{
|
||||
DispatchResult,
|
||||
};
|
||||
use impl_trait_for_tuples::impl_for_tuples;
|
||||
#[cfg(feature = "std")]
|
||||
#[cfg(feature = "serde")]
|
||||
use serde::{de::DeserializeOwned, Deserialize, Serialize};
|
||||
use sp_application_crypto::AppCrypto;
|
||||
pub use sp_arithmetic::traits::{
|
||||
@@ -716,7 +716,7 @@ pub trait Hash:
|
||||
|
||||
/// Blake2-256 Hash implementation.
|
||||
#[derive(PartialEq, Eq, Clone, RuntimeDebug, TypeInfo)]
|
||||
#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]
|
||||
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
||||
pub struct BlakeTwo256;
|
||||
|
||||
impl Hasher for BlakeTwo256 {
|
||||
@@ -743,7 +743,7 @@ impl Hash for BlakeTwo256 {
|
||||
|
||||
/// Keccak-256 Hash implementation.
|
||||
#[derive(PartialEq, Eq, Clone, RuntimeDebug, TypeInfo)]
|
||||
#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]
|
||||
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
||||
pub struct Keccak256;
|
||||
|
||||
impl Hasher for Keccak256 {
|
||||
@@ -824,11 +824,13 @@ sp_core::impl_maybe_marker!(
|
||||
|
||||
/// A type that implements Hash when in std environment.
|
||||
trait MaybeHash: sp_std::hash::Hash;
|
||||
);
|
||||
|
||||
/// A type that implements Serialize when in std environment.
|
||||
sp_core::impl_maybe_marker_std_or_serde!(
|
||||
/// A type that implements Serialize when in std environment or serde feature is activated.
|
||||
trait MaybeSerialize: Serialize;
|
||||
|
||||
/// A type that implements Serialize, DeserializeOwned and Debug when in std environment.
|
||||
/// A type that implements Serialize, DeserializeOwned and Debug when in std environment or serde feature is activated.
|
||||
trait MaybeSerializeDeserialize: DeserializeOwned, Serialize;
|
||||
);
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ pub type TransactionTag = Vec<u8>;
|
||||
|
||||
/// An invalid transaction validity.
|
||||
#[derive(Clone, PartialEq, Eq, Encode, Decode, Copy, RuntimeDebug, TypeInfo)]
|
||||
#[cfg_attr(feature = "std", derive(serde::Serialize, serde::Deserialize))]
|
||||
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
|
||||
pub enum InvalidTransaction {
|
||||
/// The call of the transaction is not expected.
|
||||
Call,
|
||||
@@ -119,7 +119,7 @@ impl From<InvalidTransaction> for &'static str {
|
||||
|
||||
/// An unknown transaction validity.
|
||||
#[derive(Clone, PartialEq, Eq, Encode, Decode, Copy, RuntimeDebug, TypeInfo)]
|
||||
#[cfg_attr(feature = "std", derive(serde::Serialize, serde::Deserialize))]
|
||||
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
|
||||
pub enum UnknownTransaction {
|
||||
/// Could not lookup some information that is required to validate the transaction.
|
||||
CannotLookup,
|
||||
@@ -143,7 +143,7 @@ impl From<UnknownTransaction> for &'static str {
|
||||
|
||||
/// Errors that can occur while checking the validity of a transaction.
|
||||
#[derive(Clone, PartialEq, Eq, Encode, Decode, Copy, RuntimeDebug, TypeInfo)]
|
||||
#[cfg_attr(feature = "std", derive(serde::Serialize, serde::Deserialize))]
|
||||
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
|
||||
pub enum TransactionValidityError {
|
||||
/// The transaction is invalid.
|
||||
Invalid(InvalidTransaction),
|
||||
|
||||
Reference in New Issue
Block a user