mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 14:01:02 +00:00
Ease parachain candidate code fetching (#2593)
* code stored in para + modify CandidateDescriptor. * WIP: digest + some more impl * validation_code_hash in payload + check in inclusion * check in client + refator * tests * fix encoding indices * remove old todos * fix test * fix test * add test * fetch validation code inside collation-generation from the relay-chain * HashMismatch -> PoVHashMismatch + miscompilation * refactor, store hash when needed * storage rename: more specific but slightly too verbose * do not hash on candidate validation, fetch hash instead * better test * fix test * guide updates * don't panic in runtime Co-authored-by: Robert Habermeier <rphmeier@gmail.com>
This commit is contained in:
committed by
GitHub
parent
98082c5326
commit
beca01f118
@@ -21,6 +21,7 @@ use sp_std::vec::Vec;
|
||||
|
||||
use parity_scale_codec::{Encode, Decode, CompactAs};
|
||||
use sp_core::{RuntimeDebug, TypeId};
|
||||
use sp_runtime::traits::Hash as _;
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
use serde::{Serialize, Deserialize};
|
||||
@@ -45,7 +46,6 @@ pub struct HeadData(#[cfg_attr(feature = "std", serde(with="bytes"))] pub Vec<u8
|
||||
impl HeadData {
|
||||
/// Returns the hash of this head data.
|
||||
pub fn hash(&self) -> Hash {
|
||||
use sp_runtime::traits::Hash;
|
||||
sp_runtime::traits::BlakeTwo256::hash(&self.0)
|
||||
}
|
||||
}
|
||||
@@ -55,6 +55,13 @@ impl HeadData {
|
||||
#[cfg_attr(feature = "std", derive(Serialize, Deserialize, Hash, MallocSizeOf))]
|
||||
pub struct ValidationCode(#[cfg_attr(feature = "std", serde(with="bytes"))] pub Vec<u8>);
|
||||
|
||||
impl ValidationCode {
|
||||
/// Get the blake2-256 hash of the validation code bytes.
|
||||
pub fn hash(&self) -> Hash {
|
||||
sp_runtime::traits::BlakeTwo256::hash(&self.0[..])
|
||||
}
|
||||
}
|
||||
|
||||
/// Parachain block data.
|
||||
///
|
||||
/// Contains everything required to validate para-block, may contain block and witness data.
|
||||
|
||||
Reference in New Issue
Block a user