mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-31 12:11:02 +00:00
Port safe commits from master to polkadot-staging (#2761)
* introduce bp_messages::ChainWithMessages (#2171) * Move Chain::ID from relay-level Chain to primitives-level Chain (#2181) * move Chain::ID from relay-level Chain to primitives-level Chain * removed chain IDs from bp-runtime * add missing file header * Some code grooming (#2276) * some code grooming: enable warn(missing_docs) for all piblic crates + added missing documentation + removed obsolete clippy/deny workarounds * removed strange allow + added comment related to other allow * removed incorrect_clone_impl_on_copy_type which is unknown to CI clippy
This commit is contained in:
committed by
Bastian Köcher
parent
37bb1e7909
commit
4004742e85
@@ -178,7 +178,7 @@ mod tests {
|
||||
RuntimeCall::Parachains(crate::Call::<TestRuntime, ()>::submit_parachain_heads {
|
||||
at_relay_block: (num, Default::default()),
|
||||
parachains,
|
||||
parachain_heads_proof: ParaHeadsProof(Vec::new()),
|
||||
parachain_heads_proof: ParaHeadsProof { storage_proof: Vec::new() },
|
||||
})
|
||||
.check_obsolete_submit_parachain_heads()
|
||||
.is_ok()
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
//! accepts storage proof of some parachain `Heads` entries from bridged relay chain.
|
||||
//! It requires corresponding relay headers to be already synced.
|
||||
|
||||
#![warn(missing_docs)]
|
||||
#![cfg_attr(not(feature = "std"), no_std)]
|
||||
|
||||
pub use weights::WeightInfo;
|
||||
@@ -98,27 +99,49 @@ pub mod pallet {
|
||||
#[pallet::generate_deposit(pub(super) fn deposit_event)]
|
||||
pub enum Event<T: Config<I>, I: 'static = ()> {
|
||||
/// The caller has provided head of parachain that the pallet is not configured to track.
|
||||
UntrackedParachainRejected { parachain: ParaId },
|
||||
UntrackedParachainRejected {
|
||||
/// Identifier of the parachain that is not tracked by the pallet.
|
||||
parachain: ParaId,
|
||||
},
|
||||
/// The caller has declared that he has provided given parachain head, but it is missing
|
||||
/// from the storage proof.
|
||||
MissingParachainHead { parachain: ParaId },
|
||||
MissingParachainHead {
|
||||
/// Identifier of the parachain with missing head.
|
||||
parachain: ParaId,
|
||||
},
|
||||
/// The caller has provided parachain head hash that is not matching the hash read from the
|
||||
/// storage proof.
|
||||
IncorrectParachainHeadHash {
|
||||
/// Identifier of the parachain with incorrect head hast.
|
||||
parachain: ParaId,
|
||||
/// Specified parachain head hash.
|
||||
parachain_head_hash: ParaHash,
|
||||
/// Actual parachain head hash.
|
||||
actual_parachain_head_hash: ParaHash,
|
||||
},
|
||||
/// The caller has provided obsolete parachain head, which is already known to the pallet.
|
||||
RejectedObsoleteParachainHead { parachain: ParaId, parachain_head_hash: ParaHash },
|
||||
RejectedObsoleteParachainHead {
|
||||
/// Identifier of the parachain with obsolete head.
|
||||
parachain: ParaId,
|
||||
/// Obsolete parachain head hash.
|
||||
parachain_head_hash: ParaHash,
|
||||
},
|
||||
/// The caller has provided parachain head that exceeds the maximal configured head size.
|
||||
RejectedLargeParachainHead {
|
||||
/// Identifier of the parachain with rejected head.
|
||||
parachain: ParaId,
|
||||
/// Parachain head hash.
|
||||
parachain_head_hash: ParaHash,
|
||||
/// Parachain head size.
|
||||
parachain_head_size: u32,
|
||||
},
|
||||
/// Parachain head has been updated.
|
||||
UpdatedParachainHead { parachain: ParaId, parachain_head_hash: ParaHash },
|
||||
UpdatedParachainHead {
|
||||
/// Identifier of the parachain that has been updated.
|
||||
parachain: ParaId,
|
||||
/// Parachain head hash.
|
||||
parachain_head_hash: ParaHash,
|
||||
},
|
||||
}
|
||||
|
||||
#[pallet::error]
|
||||
@@ -137,6 +160,7 @@ pub mod pallet {
|
||||
pub trait BoundedBridgeGrandpaConfig<I: 'static>:
|
||||
pallet_bridge_grandpa::Config<I, BridgedChain = Self::BridgedRelayChain>
|
||||
{
|
||||
/// Type of the bridged relay chain.
|
||||
type BridgedRelayChain: Chain<
|
||||
BlockNumber = RelayBlockNumber,
|
||||
Hash = RelayBlockHash,
|
||||
@@ -336,7 +360,7 @@ pub mod pallet {
|
||||
|
||||
let mut storage = GrandpaPalletOf::<T, I>::storage_proof_checker(
|
||||
relay_block_hash,
|
||||
parachain_heads_proof.0,
|
||||
parachain_heads_proof.storage_proof,
|
||||
)
|
||||
.map_err(Error::<T, I>::HeaderChainStorageProof)?;
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
use bp_header_chain::ChainWithGrandpa;
|
||||
use bp_polkadot_core::parachains::ParaId;
|
||||
use bp_runtime::{Chain, Parachain};
|
||||
use bp_runtime::{Chain, ChainId, Parachain};
|
||||
use frame_support::{
|
||||
construct_runtime, derive_impl, parameter_types, traits::ConstU32, weights::Weight,
|
||||
};
|
||||
@@ -49,6 +49,8 @@ pub type BigParachainHeader = sp_runtime::generic::Header<u128, BlakeTwo256>;
|
||||
pub struct Parachain1;
|
||||
|
||||
impl Chain for Parachain1 {
|
||||
const ID: ChainId = *b"pch1";
|
||||
|
||||
type BlockNumber = u64;
|
||||
type Hash = H256;
|
||||
type Hasher = RegularParachainHasher;
|
||||
@@ -73,6 +75,8 @@ impl Parachain for Parachain1 {
|
||||
pub struct Parachain2;
|
||||
|
||||
impl Chain for Parachain2 {
|
||||
const ID: ChainId = *b"pch2";
|
||||
|
||||
type BlockNumber = u64;
|
||||
type Hash = H256;
|
||||
type Hasher = RegularParachainHasher;
|
||||
@@ -97,6 +101,8 @@ impl Parachain for Parachain2 {
|
||||
pub struct Parachain3;
|
||||
|
||||
impl Chain for Parachain3 {
|
||||
const ID: ChainId = *b"pch3";
|
||||
|
||||
type BlockNumber = u64;
|
||||
type Hash = H256;
|
||||
type Hasher = RegularParachainHasher;
|
||||
@@ -122,6 +128,8 @@ impl Parachain for Parachain3 {
|
||||
pub struct BigParachain;
|
||||
|
||||
impl Chain for BigParachain {
|
||||
const ID: ChainId = *b"bpch";
|
||||
|
||||
type BlockNumber = u128;
|
||||
type Hash = H256;
|
||||
type Hasher = RegularParachainHasher;
|
||||
@@ -229,6 +237,8 @@ impl pallet_bridge_parachains::benchmarking::Config<()> for TestRuntime {
|
||||
pub struct TestBridgedChain;
|
||||
|
||||
impl Chain for TestBridgedChain {
|
||||
const ID: ChainId = *b"tbch";
|
||||
|
||||
type BlockNumber = crate::RelayBlockNumber;
|
||||
type Hash = crate::RelayBlockHash;
|
||||
type Hasher = crate::RelayBlockHasher;
|
||||
@@ -260,6 +270,8 @@ impl ChainWithGrandpa for TestBridgedChain {
|
||||
pub struct OtherBridgedChain;
|
||||
|
||||
impl Chain for OtherBridgedChain {
|
||||
const ID: ChainId = *b"obch";
|
||||
|
||||
type BlockNumber = u64;
|
||||
type Hash = crate::RelayBlockHash;
|
||||
type Hasher = crate::RelayBlockHasher;
|
||||
|
||||
Reference in New Issue
Block a user