mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 09:21:04 +00:00
Use strong types in runtime for parachain heads and validation code (#964)
* use stronger types for HeadData and ValidationCode in runtime * fix weird debug compile error * fix runtime build * update invocations invalidation.rs * fix tests
This commit is contained in:
committed by
GitHub
parent
31dc9acf89
commit
a5034dbe98
@@ -33,15 +33,27 @@ use sp_core::bytes;
|
||||
pub type RelayChainBlockNumber = u32;
|
||||
|
||||
/// Parachain head data included in the chain.
|
||||
#[derive(PartialEq, Eq, Clone, PartialOrd, Ord, Encode, Decode)]
|
||||
#[cfg_attr(feature = "std", derive(Serialize, Deserialize, Debug, Default))]
|
||||
#[derive(PartialEq, Eq, Clone, PartialOrd, Ord, Encode, Decode, RuntimeDebug)]
|
||||
#[cfg_attr(feature = "std", derive(Serialize, Deserialize, Default))]
|
||||
pub struct HeadData(#[cfg_attr(feature = "std", serde(with="bytes"))] pub Vec<u8>);
|
||||
|
||||
impl From<Vec<u8>> for HeadData {
|
||||
fn from(head: Vec<u8>) -> Self {
|
||||
HeadData(head)
|
||||
}
|
||||
}
|
||||
|
||||
/// Parachain validation code.
|
||||
#[derive(Default, PartialEq, Eq, Clone, Encode, Decode)]
|
||||
#[cfg_attr(feature = "std", derive(Serialize, Deserialize, Debug))]
|
||||
#[derive(Default, PartialEq, Eq, Clone, Encode, Decode, RuntimeDebug)]
|
||||
#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]
|
||||
pub struct ValidationCode(#[cfg_attr(feature = "std", serde(with="bytes"))] pub Vec<u8>);
|
||||
|
||||
impl From<Vec<u8>> for ValidationCode {
|
||||
fn from(code: Vec<u8>) -> Self {
|
||||
ValidationCode(code)
|
||||
}
|
||||
}
|
||||
|
||||
/// Parachain block data.
|
||||
///
|
||||
/// Contains everything required to validate para-block, may contain block and witness data.
|
||||
|
||||
Reference in New Issue
Block a user