Fix multiple parachain headers submission for single message delivery (#1916)

* switch off parachains relay when we don't need to relay parachains (temp solution)

* parachains relay now only works with single parachain

* fix usages of parachains relay

* revert hacky fix

* fixes

* fixed Westmint parachain ID

* fixed metrics

* fixed compilation

* fmt

* clippy

* call -> typed_state_call
This commit is contained in:
Svyatoslav Nikolsky
2023-03-01 13:26:13 +03:00
committed by Bastian Köcher
parent ba155f990f
commit e7f5560951
17 changed files with 418 additions and 801 deletions
+1 -1
View File
@@ -72,7 +72,7 @@ pub trait RelayChain: Chain {
/// Name of the bridge parachains pallet (used in `construct_runtime` macro call) that is
/// deployed at the **bridged** chain.
///
/// We assume that all chains that are bridging with this `ChainWithGrandpa` are using
/// We assume that all chains that are bridging with this `RelayChain` are using
/// the same name.
const PARACHAINS_FINALITY_PALLET_NAME: &'static str;
}
@@ -68,3 +68,51 @@ impl ChainWithBalances for TestChain {
unreachable!()
}
}
/// Primitives-level parachain that may be used in tests.
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct TestParachainBase;
impl bp_runtime::Chain for TestParachainBase {
type BlockNumber = u32;
type Hash = sp_core::H256;
type Hasher = sp_runtime::traits::BlakeTwo256;
type Header = sp_runtime::generic::Header<u32, sp_runtime::traits::BlakeTwo256>;
type AccountId = u32;
type Balance = u32;
type Index = u32;
type Signature = sp_runtime::testing::TestSignature;
fn max_extrinsic_size() -> u32 {
unreachable!()
}
fn max_extrinsic_weight() -> Weight {
unreachable!()
}
}
impl bp_runtime::Parachain for TestParachainBase {
const PARACHAIN_ID: u32 = 1000;
}
/// Parachain that may be used in tests.
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct TestParachain;
impl bp_runtime::UnderlyingChainProvider for TestParachain {
type Chain = TestParachainBase;
}
impl Chain for TestParachain {
const NAME: &'static str = "TestParachain";
const TOKEN_ID: Option<&'static str> = None;
const BEST_FINALIZED_HEADER_ID_METHOD: &'static str = "TestParachainMethod";
const AVERAGE_BLOCK_INTERVAL: Duration = Duration::from_millis(0);
type SignedBlock = sp_runtime::generic::SignedBlock<
sp_runtime::generic::Block<Self::Header, sp_runtime::OpaqueExtrinsic>,
>;
type Call = ();
}