mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-15 10:21:05 +00:00
Remove unneeded Serde requirements (#1076)
* Remove superfluous serde requirements. * Try to ensure hash is serde * Fixups * Building again * Attempt to reenable Block (doesn't build) * Fixes compilation for node cli * Fixes test compilation * Fix wasm * Fix tests * Remove unneeded changes * Fix up comments * Reenable some code * Compile error when origin misused. * Remove unnecessary includes of `serde_derive` * Cleanups
This commit is contained in:
@@ -246,7 +246,7 @@ tuple_impl!(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W,
|
||||
pub trait Hash: 'static + MaybeSerializeDebug + Clone + Eq + PartialEq { // Stupid bug in the Rust compiler believes derived
|
||||
// traits must be fulfilled by all type parameters.
|
||||
/// The hash type produced.
|
||||
type Output: Member + AsRef<[u8]> + AsMut<[u8]>;
|
||||
type Output: Member + MaybeSerializeDebug + AsRef<[u8]> + AsMut<[u8]>;
|
||||
|
||||
/// Produce the hash of some byte-slice.
|
||||
fn hash(s: &[u8]) -> Self::Output;
|
||||
@@ -365,6 +365,16 @@ pub trait MaybeSerializeDebugButNotDeserialize {}
|
||||
#[cfg(not(feature = "std"))]
|
||||
impl<T> MaybeSerializeDebugButNotDeserialize for T {}
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
pub trait MaybeSerialize: Serialize {}
|
||||
#[cfg(feature = "std")]
|
||||
impl<T: Serialize> MaybeSerialize for T {}
|
||||
|
||||
#[cfg(not(feature = "std"))]
|
||||
pub trait MaybeSerialize {}
|
||||
#[cfg(not(feature = "std"))]
|
||||
impl<T> MaybeSerialize for T {}
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
pub trait MaybeSerializeDebug: Serialize + DeserializeOwned + Debug {}
|
||||
#[cfg(feature = "std")]
|
||||
@@ -375,6 +385,16 @@ pub trait MaybeSerializeDebug {}
|
||||
#[cfg(not(feature = "std"))]
|
||||
impl<T> MaybeSerializeDebug for T {}
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
pub trait MaybeDebug: Debug {}
|
||||
#[cfg(feature = "std")]
|
||||
impl<T: Debug> MaybeDebug for T {}
|
||||
|
||||
#[cfg(not(feature = "std"))]
|
||||
pub trait MaybeDebug {}
|
||||
#[cfg(not(feature = "std"))]
|
||||
impl<T> MaybeDebug for T {}
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
pub trait MaybeDisplay: Display {}
|
||||
#[cfg(feature = "std")]
|
||||
@@ -395,9 +415,8 @@ pub trait MaybeDecode {}
|
||||
#[cfg(not(feature = "std"))]
|
||||
impl<T> MaybeDecode for T {}
|
||||
|
||||
|
||||
pub trait Member: Send + Sync + Sized + MaybeSerializeDebug + Eq + PartialEq + Clone + 'static {}
|
||||
impl<T: Send + Sync + Sized + MaybeSerializeDebug + Eq + PartialEq + Clone + 'static> Member for T {}
|
||||
pub trait Member: Send + Sync + Sized + MaybeDebug + Eq + PartialEq + Clone + 'static {}
|
||||
impl<T: Send + Sync + Sized + MaybeDebug + Eq + PartialEq + Clone + 'static> Member for T {}
|
||||
|
||||
/// Something which fulfills the abstract idea of a Substrate header. It has types for a `Number`,
|
||||
/// a `Hash` and a `Digest`. It provides access to an `extrinsics_root`, `state_root` and
|
||||
@@ -405,8 +424,8 @@ impl<T: Send + Sync + Sized + MaybeSerializeDebug + Eq + PartialEq + Clone + 'st
|
||||
///
|
||||
/// You can also create a `new` one from those fields.
|
||||
pub trait Header: Clone + Send + Sync + Codec + Eq + MaybeSerializeDebug + 'static {
|
||||
type Number: Member + ::rstd::hash::Hash + Copy + MaybeDisplay + SimpleArithmetic + Codec;
|
||||
type Hash: Member + ::rstd::hash::Hash + Copy + MaybeDisplay + Default + SimpleBitOps + Codec + AsRef<[u8]> + AsMut<[u8]>;
|
||||
type Number: Member + MaybeSerializeDebug + ::rstd::hash::Hash + Copy + MaybeDisplay + SimpleArithmetic + Codec;
|
||||
type Hash: Member + MaybeSerializeDebug + ::rstd::hash::Hash + Copy + MaybeDisplay + Default + SimpleBitOps + Codec + AsRef<[u8]> + AsMut<[u8]>;
|
||||
type Hashing: Hash<Output = Self::Hash>;
|
||||
type Digest: Digest<Hash = Self::Hash>;
|
||||
|
||||
@@ -445,9 +464,9 @@ pub trait Header: Clone + Send + Sync + Codec + Eq + MaybeSerializeDebug + 'stat
|
||||
///
|
||||
/// You can get an iterator over each of the `extrinsics` and retrieve the `header`.
|
||||
pub trait Block: Clone + Send + Sync + Codec + Eq + MaybeSerializeDebug + 'static {
|
||||
type Extrinsic: Member + Codec + Extrinsic;
|
||||
type Extrinsic: Member + Codec + Extrinsic + MaybeSerialize;
|
||||
type Header: Header<Hash=Self::Hash>;
|
||||
type Hash: Member + ::rstd::hash::Hash + Copy + MaybeDisplay + Default + SimpleBitOps + Codec + AsRef<[u8]> + AsMut<[u8]>;
|
||||
type Hash: Member + MaybeSerializeDebug + ::rstd::hash::Hash + Copy + MaybeDisplay + Default + SimpleBitOps + Codec + AsRef<[u8]> + AsMut<[u8]>;
|
||||
|
||||
fn header(&self) -> &Self::Header;
|
||||
fn extrinsics(&self) -> &[Self::Extrinsic];
|
||||
@@ -458,6 +477,13 @@ pub trait Block: Clone + Send + Sync + Codec + Eq + MaybeSerializeDebug + 'stati
|
||||
}
|
||||
}
|
||||
|
||||
/// Something that acts like an `Extrinsic`.
|
||||
pub trait Extrinsic {
|
||||
/// Is this `Extrinsic` signed?
|
||||
/// If no information are available about signed/unsigned, `None` should be returned.
|
||||
fn is_signed(&self) -> Option<bool> { None }
|
||||
}
|
||||
|
||||
/// Extract the hashing type for a block.
|
||||
pub type HashFor<B> = <<B as Block>::Header as Header>::Hashing;
|
||||
/// Extract the number type for a block.
|
||||
@@ -516,8 +542,8 @@ pub trait Applyable: Sized + Send + Sync {
|
||||
|
||||
/// Something that acts like a `Digest` - it can have `Log`s `push`ed onto it and these `Log`s are
|
||||
/// each `Codec`.
|
||||
pub trait Digest: Member + Default {
|
||||
type Hash: Member;
|
||||
pub trait Digest: Member + MaybeSerializeDebug + Default {
|
||||
type Hash: Member + MaybeSerializeDebug;
|
||||
type Item: DigestItem<Hash = Self::Hash>;
|
||||
|
||||
/// Get reference to all digest items.
|
||||
@@ -539,9 +565,9 @@ pub trait Digest: Member + Default {
|
||||
/// for casting member to 'system' log items, known to substrate.
|
||||
///
|
||||
/// If the runtime does not supports some 'system' items, use `()` as a stub.
|
||||
pub trait DigestItem: Codec + Member {
|
||||
type Hash: Member;
|
||||
type AuthorityId: Member;
|
||||
pub trait DigestItem: Codec + Member + MaybeSerializeDebug {
|
||||
type Hash: Member + MaybeSerializeDebug;
|
||||
type AuthorityId: Member + MaybeSerializeDebug;
|
||||
|
||||
/// Returns Some if the entry is the `AuthoritiesChange` entry.
|
||||
fn as_authorities_change(&self) -> Option<&[Self::AuthorityId]>;
|
||||
@@ -571,10 +597,3 @@ pub trait ProvideInherent {
|
||||
block: &Block, data: Self::Inherent, extract_function: &F
|
||||
) -> Result<(), Self::Error>;
|
||||
}
|
||||
|
||||
/// Something that acts like an `Extrinsic`.
|
||||
pub trait Extrinsic {
|
||||
/// Is this `Extrinsic` signed?
|
||||
/// If no information are available about signed/unsigned, `None` should be returned.
|
||||
fn is_signed(&self) -> Option<bool> { None }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user