mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 10:31:03 +00:00
Serialize/Deserialize trait implemented in no-std for numerous types (#7312)
* ParaId: Serialize/Deserialize trait implemented in no-std
* Serialize/Deserialize trait implemented in no-std for more types
* serde in deps enabled
* fix
* missing types added
* update lockfile for {"substrate"}
* ".git/.scripts/commands/fmt/fmt.sh"
---------
Co-authored-by: parity-processbot <>
This commit is contained in:
committed by
GitHub
parent
306270b889
commit
a767358122
@@ -10,17 +10,17 @@ version.workspace = true
|
||||
# this crate for WASM. This is critical to avoid forcing all parachain WASM into implementing
|
||||
# various unnecessary Substrate-specific endpoints.
|
||||
parity-scale-codec = { version = "3.4.0", default-features = false, features = [ "derive" ] }
|
||||
scale-info = { version = "2.5.0", default-features = false, features = ["derive"] }
|
||||
scale-info = { version = "2.5.0", default-features = false, features = ["derive", "serde"] }
|
||||
sp-std = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
|
||||
sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
|
||||
sp-core = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
|
||||
sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false, features = ["serde"] }
|
||||
sp-core = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false, features = ["serde"] }
|
||||
frame-support = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
|
||||
polkadot-core-primitives = { path = "../core-primitives", default-features = false }
|
||||
derive_more = "0.99.11"
|
||||
bounded-collections = { version = "0.1.7", default-features = false }
|
||||
bounded-collections = { version = "0.1.7", default-features = false, features = ["serde"] }
|
||||
|
||||
# all optional crates.
|
||||
serde = { version = "1.0.163", default-features = false, features = [ "derive" ], optional = true }
|
||||
serde = { version = "1.0.163", default-features = false, features = ["derive", "alloc"] }
|
||||
|
||||
[features]
|
||||
default = ["std"]
|
||||
|
||||
@@ -23,14 +23,9 @@ use bounded_collections::{BoundedVec, ConstU32};
|
||||
use frame_support::weights::Weight;
|
||||
use parity_scale_codec::{CompactAs, Decode, Encode, MaxEncodedLen};
|
||||
use scale_info::TypeInfo;
|
||||
use sp_core::{RuntimeDebug, TypeId};
|
||||
use sp_runtime::traits::Hash as _;
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
use sp_core::bytes;
|
||||
use sp_core::{bytes, RuntimeDebug, TypeId};
|
||||
use sp_runtime::traits::Hash as _;
|
||||
|
||||
use polkadot_core_primitives::{Hash, OutboundHrmpMessage};
|
||||
|
||||
@@ -39,10 +34,21 @@ pub use polkadot_core_primitives::BlockNumber as RelayChainBlockNumber;
|
||||
|
||||
/// Parachain head data included in the chain.
|
||||
#[derive(
|
||||
PartialEq, Eq, Clone, PartialOrd, Ord, Encode, Decode, RuntimeDebug, derive_more::From, TypeInfo,
|
||||
PartialEq,
|
||||
Eq,
|
||||
Clone,
|
||||
PartialOrd,
|
||||
Ord,
|
||||
Encode,
|
||||
Decode,
|
||||
RuntimeDebug,
|
||||
derive_more::From,
|
||||
TypeInfo,
|
||||
Serialize,
|
||||
Deserialize,
|
||||
)]
|
||||
#[cfg_attr(feature = "std", derive(Serialize, Deserialize, Hash, Default))]
|
||||
pub struct HeadData(#[cfg_attr(feature = "std", serde(with = "bytes"))] pub Vec<u8>);
|
||||
#[cfg_attr(feature = "std", derive(Hash, Default))]
|
||||
pub struct HeadData(#[serde(with = "bytes")] pub Vec<u8>);
|
||||
|
||||
impl HeadData {
|
||||
/// Returns the hash of this head data.
|
||||
@@ -52,9 +58,20 @@ impl HeadData {
|
||||
}
|
||||
|
||||
/// Parachain validation code.
|
||||
#[derive(PartialEq, Eq, Clone, Encode, Decode, RuntimeDebug, derive_more::From, TypeInfo)]
|
||||
#[cfg_attr(feature = "std", derive(Serialize, Deserialize, Hash))]
|
||||
pub struct ValidationCode(#[cfg_attr(feature = "std", serde(with = "bytes"))] pub Vec<u8>);
|
||||
#[derive(
|
||||
PartialEq,
|
||||
Eq,
|
||||
Clone,
|
||||
Encode,
|
||||
Decode,
|
||||
RuntimeDebug,
|
||||
derive_more::From,
|
||||
TypeInfo,
|
||||
Serialize,
|
||||
Deserialize,
|
||||
)]
|
||||
#[cfg_attr(feature = "std", derive(Hash))]
|
||||
pub struct ValidationCode(#[serde(with = "bytes")] pub Vec<u8>);
|
||||
|
||||
impl ValidationCode {
|
||||
/// Get the blake2-256 hash of the validation code bytes.
|
||||
@@ -129,9 +146,11 @@ pub struct BlockData(#[cfg_attr(feature = "std", serde(with = "bytes"))] pub Vec
|
||||
PartialEq,
|
||||
PartialOrd,
|
||||
RuntimeDebug,
|
||||
serde::Serialize,
|
||||
serde::Deserialize,
|
||||
TypeInfo,
|
||||
)]
|
||||
#[cfg_attr(feature = "std", derive(serde::Serialize, serde::Deserialize, derive_more::Display))]
|
||||
#[cfg_attr(feature = "std", derive(derive_more::Display))]
|
||||
pub struct Id(u32);
|
||||
|
||||
impl TypeId for Id {
|
||||
|
||||
Reference in New Issue
Block a user