mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 05:51:02 +00:00
Moves Block to frame_system instead of construct_runtime and removes Header and BlockNumber (#2790)
* Fixes
* Removes unused import
* Uses Block and removes BlockNumber/Header from Chain
* Fixes bridges
* Fixes
* Removes unused import
* Fixes build
* Uses correct RelayBlock
* Minor fix
* Fixes glutton-kusama
* Uses correct RelayBlock
* Minor fix
* Fixes benchmark for pallet-bridge-parachains
* Adds appropriate constraints
* Minor fixes
* Removes unused import
* Fixes integrity tests
* Minor fixes
* Updates trait bounds
* Uses custom bound for AsPrimitive
* Fixes trait bounds
* Revert "Fixes trait bounds"
This reverts commit 0b0f42f583f3a616a88afe45fcd06d31e7d9a06f.
* Revert "Uses custom bound for AsPrimitive"
This reverts commit 838e5281adf8b6e9632a2abb9cd550db4ae24126.
* No AsPrimitive trait bound for now
* Removes bounds on Number
* update lockfile for {"substrate", "polkadot"}
* Formatting
* ".git/.scripts/commands/fmt/fmt.sh"
* Minor fix
---------
Co-authored-by: parity-processbot <>
This commit is contained in:
Generated
+268
-269
File diff suppressed because it is too large
Load Diff
@@ -38,15 +38,15 @@ macro_rules! assert_chain_types(
|
|||||||
// if one of asserts fail, then either bridge isn't configured properly (or alternatively - non-standard
|
// if one of asserts fail, then either bridge isn't configured properly (or alternatively - non-standard
|
||||||
// configuration is used), or something has broke existing configuration (meaning that all bridged chains
|
// configuration is used), or something has broke existing configuration (meaning that all bridged chains
|
||||||
// and relays will stop functioning)
|
// and relays will stop functioning)
|
||||||
use frame_system::Config as SystemConfig;
|
use frame_system::{Config as SystemConfig, pallet_prelude::*};
|
||||||
use static_assertions::assert_type_eq_all;
|
use static_assertions::assert_type_eq_all;
|
||||||
|
|
||||||
assert_type_eq_all!(<$r as SystemConfig>::Index, bp_runtime::IndexOf<$this>);
|
assert_type_eq_all!(<$r as SystemConfig>::Index, bp_runtime::IndexOf<$this>);
|
||||||
assert_type_eq_all!(<$r as SystemConfig>::BlockNumber, bp_runtime::BlockNumberOf<$this>);
|
assert_type_eq_all!(BlockNumberFor<$r>, bp_runtime::BlockNumberOf<$this>);
|
||||||
assert_type_eq_all!(<$r as SystemConfig>::Hash, bp_runtime::HashOf<$this>);
|
assert_type_eq_all!(<$r as SystemConfig>::Hash, bp_runtime::HashOf<$this>);
|
||||||
assert_type_eq_all!(<$r as SystemConfig>::Hashing, bp_runtime::HasherOf<$this>);
|
assert_type_eq_all!(<$r as SystemConfig>::Hashing, bp_runtime::HasherOf<$this>);
|
||||||
assert_type_eq_all!(<$r as SystemConfig>::AccountId, bp_runtime::AccountIdOf<$this>);
|
assert_type_eq_all!(<$r as SystemConfig>::AccountId, bp_runtime::AccountIdOf<$this>);
|
||||||
assert_type_eq_all!(<$r as SystemConfig>::Header, bp_runtime::HeaderOf<$this>);
|
assert_type_eq_all!(HeaderFor<$r>, bp_runtime::HeaderOf<$this>);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -63,12 +63,8 @@ pub type ThisChainHasher = BlakeTwo256;
|
|||||||
pub type ThisChainRuntimeCall = RuntimeCall;
|
pub type ThisChainRuntimeCall = RuntimeCall;
|
||||||
/// Runtime call origin at `ThisChain`.
|
/// Runtime call origin at `ThisChain`.
|
||||||
pub type ThisChainCallOrigin = RuntimeOrigin;
|
pub type ThisChainCallOrigin = RuntimeOrigin;
|
||||||
/// Header of `ThisChain`.
|
// Block of `ThisChain`.
|
||||||
pub type ThisChainHeader = sp_runtime::generic::Header<ThisChainBlockNumber, ThisChainHasher>;
|
pub type ThisChainBlock = frame_system::mocking::MockBlockU32<TestRuntime>;
|
||||||
/// Block of `ThisChain`.
|
|
||||||
pub type ThisChainBlock = frame_system::mocking::MockBlock<TestRuntime>;
|
|
||||||
/// Unchecked extrinsic of `ThisChain`.
|
|
||||||
pub type ThisChainUncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic<TestRuntime>;
|
|
||||||
|
|
||||||
/// Account identifier at the `BridgedChain`.
|
/// Account identifier at the `BridgedChain`.
|
||||||
pub type BridgedChainAccountId = u128;
|
pub type BridgedChainAccountId = u128;
|
||||||
@@ -83,6 +79,8 @@ pub type BridgedChainHasher = BlakeTwo256;
|
|||||||
/// Header of the `BridgedChain`.
|
/// Header of the `BridgedChain`.
|
||||||
pub type BridgedChainHeader =
|
pub type BridgedChainHeader =
|
||||||
sp_runtime::generic::Header<BridgedChainBlockNumber, BridgedChainHasher>;
|
sp_runtime::generic::Header<BridgedChainBlockNumber, BridgedChainHasher>;
|
||||||
|
/// Block of the `BridgedChain`.
|
||||||
|
pub type BridgedChainBlock = frame_system::mocking::MockBlockU32<TestRuntime>;
|
||||||
|
|
||||||
/// Rewards payment procedure.
|
/// Rewards payment procedure.
|
||||||
pub type TestPaymentProcedure = PayRewardFromAccount<Balances, ThisChainAccountId>;
|
pub type TestPaymentProcedure = PayRewardFromAccount<Balances, ThisChainAccountId>;
|
||||||
@@ -108,10 +106,7 @@ pub const BRIDGED_CHAIN_MAX_EXTRINSIC_WEIGHT: usize = 2048;
|
|||||||
pub const BRIDGED_CHAIN_MAX_EXTRINSIC_SIZE: u32 = 1024;
|
pub const BRIDGED_CHAIN_MAX_EXTRINSIC_SIZE: u32 = 1024;
|
||||||
|
|
||||||
frame_support::construct_runtime! {
|
frame_support::construct_runtime! {
|
||||||
pub enum TestRuntime where
|
pub enum TestRuntime
|
||||||
Block = ThisChainBlock,
|
|
||||||
NodeBlock = ThisChainBlock,
|
|
||||||
UncheckedExtrinsic = ThisChainUncheckedExtrinsic,
|
|
||||||
{
|
{
|
||||||
System: frame_system::{Pallet, Call, Config<T>, Storage, Event<T>},
|
System: frame_system::{Pallet, Call, Config<T>, Storage, Event<T>},
|
||||||
Utility: pallet_utility,
|
Utility: pallet_utility,
|
||||||
@@ -150,12 +145,11 @@ impl frame_system::Config for TestRuntime {
|
|||||||
type RuntimeOrigin = RuntimeOrigin;
|
type RuntimeOrigin = RuntimeOrigin;
|
||||||
type Index = u64;
|
type Index = u64;
|
||||||
type RuntimeCall = RuntimeCall;
|
type RuntimeCall = RuntimeCall;
|
||||||
type BlockNumber = ThisChainBlockNumber;
|
|
||||||
type Hash = ThisChainHash;
|
type Hash = ThisChainHash;
|
||||||
type Hashing = ThisChainHasher;
|
type Hashing = ThisChainHasher;
|
||||||
type AccountId = ThisChainAccountId;
|
type AccountId = ThisChainAccountId;
|
||||||
type Lookup = IdentityLookup<Self::AccountId>;
|
type Lookup = IdentityLookup<Self::AccountId>;
|
||||||
type Header = ThisChainHeader;
|
type Block = ThisChainBlock;
|
||||||
type RuntimeEvent = RuntimeEvent;
|
type RuntimeEvent = RuntimeEvent;
|
||||||
type BlockHashCount = ConstU32<250>;
|
type BlockHashCount = ConstU32<250>;
|
||||||
type Version = ();
|
type Version = ();
|
||||||
@@ -318,10 +312,9 @@ impl From<BridgedChainOrigin>
|
|||||||
pub struct ThisUnderlyingChain;
|
pub struct ThisUnderlyingChain;
|
||||||
|
|
||||||
impl Chain for ThisUnderlyingChain {
|
impl Chain for ThisUnderlyingChain {
|
||||||
type BlockNumber = ThisChainBlockNumber;
|
type Block = ThisChainBlock;
|
||||||
type Hash = ThisChainHash;
|
type Hash = ThisChainHash;
|
||||||
type Hasher = ThisChainHasher;
|
type Hasher = ThisChainHasher;
|
||||||
type Header = ThisChainHeader;
|
|
||||||
type AccountId = ThisChainAccountId;
|
type AccountId = ThisChainAccountId;
|
||||||
type Balance = ThisChainBalance;
|
type Balance = ThisChainBalance;
|
||||||
type Index = u32;
|
type Index = u32;
|
||||||
@@ -358,10 +351,9 @@ pub struct BridgedUnderlyingParachain;
|
|||||||
pub struct BridgedChainCall;
|
pub struct BridgedChainCall;
|
||||||
|
|
||||||
impl Chain for BridgedUnderlyingChain {
|
impl Chain for BridgedUnderlyingChain {
|
||||||
type BlockNumber = BridgedChainBlockNumber;
|
type Block = BridgedChainBlock;
|
||||||
type Hash = BridgedChainHash;
|
type Hash = BridgedChainHash;
|
||||||
type Hasher = BridgedChainHasher;
|
type Hasher = BridgedChainHasher;
|
||||||
type Header = BridgedChainHeader;
|
|
||||||
type AccountId = BridgedChainAccountId;
|
type AccountId = BridgedChainAccountId;
|
||||||
type Balance = BridgedChainBalance;
|
type Balance = BridgedChainBalance;
|
||||||
type Index = u32;
|
type Index = u32;
|
||||||
@@ -384,10 +376,9 @@ impl ChainWithGrandpa for BridgedUnderlyingChain {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl Chain for BridgedUnderlyingParachain {
|
impl Chain for BridgedUnderlyingParachain {
|
||||||
type BlockNumber = BridgedChainBlockNumber;
|
type Block = BridgedChainBlock;
|
||||||
type Hash = BridgedChainHash;
|
type Hash = BridgedChainHash;
|
||||||
type Hasher = BridgedChainHasher;
|
type Hasher = BridgedChainHasher;
|
||||||
type Header = BridgedChainHeader;
|
|
||||||
type AccountId = BridgedChainAccountId;
|
type AccountId = BridgedChainAccountId;
|
||||||
type Balance = BridgedChainBalance;
|
type Balance = BridgedChainBalance;
|
||||||
type Index = u32;
|
type Index = u32;
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ where
|
|||||||
+ pallet_bridge_grandpa::Config<R::BridgesGrandpaPalletInstance>,
|
+ pallet_bridge_grandpa::Config<R::BridgesGrandpaPalletInstance>,
|
||||||
PI: 'static,
|
PI: 'static,
|
||||||
<R as pallet_bridge_grandpa::Config<R::BridgesGrandpaPalletInstance>>::BridgedChain:
|
<R as pallet_bridge_grandpa::Config<R::BridgesGrandpaPalletInstance>>::BridgedChain:
|
||||||
bp_runtime::Chain<BlockNumber = RelayBlockNumber, Hash = RelayBlockHash>,
|
bp_runtime::Chain<Block = pallet_bridge_parachains::RelayBlock, Hash = RelayBlockHash>,
|
||||||
{
|
{
|
||||||
let parachain_head = ParaHead(vec![0u8; parachain_head_size as usize]);
|
let parachain_head = ParaHead(vec![0u8; parachain_head_size as usize]);
|
||||||
|
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ use crate::messages_call_ext::{
|
|||||||
};
|
};
|
||||||
use bp_messages::{LaneId, MessageNonce};
|
use bp_messages::{LaneId, MessageNonce};
|
||||||
use bp_relayers::{RewardsAccountOwner, RewardsAccountParams};
|
use bp_relayers::{RewardsAccountOwner, RewardsAccountParams};
|
||||||
use bp_runtime::{Parachain, ParachainIdOf, RangeInclusiveExt, StaticStrProvider};
|
use bp_runtime::{Chain, Parachain, ParachainIdOf, RangeInclusiveExt, StaticStrProvider};
|
||||||
use codec::{Decode, Encode};
|
use codec::{Decode, Encode};
|
||||||
use frame_support::{
|
use frame_support::{
|
||||||
dispatch::{CallableCallFor, DispatchInfo, Dispatchable, PostDispatchInfo},
|
dispatch::{CallableCallFor, DispatchInfo, Dispatchable, PostDispatchInfo},
|
||||||
@@ -47,7 +47,10 @@ use pallet_transaction_payment::{Config as TransactionPaymentConfig, OnChargeTra
|
|||||||
use pallet_utility::{Call as UtilityCall, Config as UtilityConfig, Pallet as UtilityPallet};
|
use pallet_utility::{Call as UtilityCall, Config as UtilityConfig, Pallet as UtilityPallet};
|
||||||
use scale_info::TypeInfo;
|
use scale_info::TypeInfo;
|
||||||
use sp_runtime::{
|
use sp_runtime::{
|
||||||
traits::{DispatchInfoOf, Get, PostDispatchInfoOf, SignedExtension, Zero},
|
traits::{
|
||||||
|
Block as BlockT, DispatchInfoOf, Get, Header as HeaderT, PostDispatchInfoOf,
|
||||||
|
SignedExtension, Zero,
|
||||||
|
},
|
||||||
transaction_validity::{
|
transaction_validity::{
|
||||||
TransactionPriority, TransactionValidity, TransactionValidityError, ValidTransactionBuilder,
|
TransactionPriority, TransactionValidity, TransactionValidityError, ValidTransactionBuilder,
|
||||||
},
|
},
|
||||||
@@ -278,6 +281,7 @@ where
|
|||||||
+ GrandpaCallSubType<Runtime, Runtime::BridgesGrandpaPalletInstance>
|
+ GrandpaCallSubType<Runtime, Runtime::BridgesGrandpaPalletInstance>
|
||||||
+ ParachainsCallSubType<Runtime, Para::Instance>
|
+ ParachainsCallSubType<Runtime, Para::Instance>
|
||||||
+ MessagesCallSubType<Runtime, Msgs::Instance>,
|
+ MessagesCallSubType<Runtime, Msgs::Instance>,
|
||||||
|
<<<Runtime as BoundedBridgeGrandpaConfig<Runtime::BridgesGrandpaPalletInstance>>::BridgedRelayChain as Chain>::Block as BlockT>::Header: HeaderT<Number = RelayBlockNumber>
|
||||||
{
|
{
|
||||||
fn expand_call<'a>(&self, call: &'a CallOf<Runtime>) -> Vec<&'a CallOf<Runtime>> {
|
fn expand_call<'a>(&self, call: &'a CallOf<Runtime>) -> Vec<&'a CallOf<Runtime>> {
|
||||||
match call.is_sub_type() {
|
match call.is_sub_type() {
|
||||||
@@ -525,6 +529,7 @@ where
|
|||||||
+ GrandpaCallSubType<Runtime, Runtime::BridgesGrandpaPalletInstance>
|
+ GrandpaCallSubType<Runtime, Runtime::BridgesGrandpaPalletInstance>
|
||||||
+ ParachainsCallSubType<Runtime, Para::Instance>
|
+ ParachainsCallSubType<Runtime, Para::Instance>
|
||||||
+ MessagesCallSubType<Runtime, Msgs::Instance>,
|
+ MessagesCallSubType<Runtime, Msgs::Instance>,
|
||||||
|
<<<Runtime as BoundedBridgeGrandpaConfig<Runtime::BridgesGrandpaPalletInstance>>::BridgedRelayChain as Chain>::Block as BlockT>::Header: HeaderT<Number = RelayBlockNumber>
|
||||||
{
|
{
|
||||||
const IDENTIFIER: &'static str = Id::STR;
|
const IDENTIFIER: &'static str = Id::STR;
|
||||||
type AccountId = Runtime::AccountId;
|
type AccountId = Runtime::AccountId;
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ use bp_header_chain::{justification::GrandpaJustification, ChainWithGrandpa};
|
|||||||
use bp_runtime::BlockNumberOf;
|
use bp_runtime::BlockNumberOf;
|
||||||
use codec::Encode;
|
use codec::Encode;
|
||||||
use frame_support::{dispatch::CallableCallFor, traits::IsSubType, weights::Weight, RuntimeDebug};
|
use frame_support::{dispatch::CallableCallFor, traits::IsSubType, weights::Weight, RuntimeDebug};
|
||||||
|
use frame_system::pallet_prelude::HeaderFor;
|
||||||
use sp_runtime::{
|
use sp_runtime::{
|
||||||
traits::{Header, Zero},
|
traits::{Header, Zero},
|
||||||
transaction_validity::{InvalidTransaction, TransactionValidity, ValidTransaction},
|
transaction_validity::{InvalidTransaction, TransactionValidity, ValidTransaction},
|
||||||
@@ -178,8 +179,9 @@ pub(crate) fn submit_finality_proof_info_from_args<T: Config<I>, I: 'static>(
|
|||||||
|
|
||||||
/// Returns maximal expected size of `submit_finality_proof` call arguments.
|
/// Returns maximal expected size of `submit_finality_proof` call arguments.
|
||||||
fn max_expected_call_size<T: Config<I>, I: 'static>(required_precommits: u32) -> u32 {
|
fn max_expected_call_size<T: Config<I>, I: 'static>(required_precommits: u32) -> u32 {
|
||||||
let max_expected_justification_size =
|
let max_expected_justification_size = GrandpaJustification::<HeaderFor<T>>::max_reasonable_size::<
|
||||||
GrandpaJustification::max_reasonable_size::<T::BridgedChain>(required_precommits);
|
T::BridgedChain,
|
||||||
|
>(required_precommits);
|
||||||
|
|
||||||
// call arguments are header and justification
|
// call arguments are header and justification
|
||||||
T::BridgedChain::MAX_HEADER_SIZE.saturating_add(max_expected_justification_size)
|
T::BridgedChain::MAX_HEADER_SIZE.saturating_add(max_expected_justification_size)
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ use frame_support::{
|
|||||||
};
|
};
|
||||||
use sp_core::sr25519::Signature;
|
use sp_core::sr25519::Signature;
|
||||||
use sp_runtime::{
|
use sp_runtime::{
|
||||||
testing::{Header, H256},
|
testing::H256,
|
||||||
traits::{BlakeTwo256, IdentityLookup},
|
traits::{BlakeTwo256, IdentityLookup},
|
||||||
Perbill,
|
Perbill,
|
||||||
};
|
};
|
||||||
@@ -36,17 +36,13 @@ pub type TestHeader = crate::BridgedHeader<TestRuntime, ()>;
|
|||||||
pub type TestNumber = crate::BridgedBlockNumber<TestRuntime, ()>;
|
pub type TestNumber = crate::BridgedBlockNumber<TestRuntime, ()>;
|
||||||
|
|
||||||
type Block = frame_system::mocking::MockBlock<TestRuntime>;
|
type Block = frame_system::mocking::MockBlock<TestRuntime>;
|
||||||
type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic<TestRuntime>;
|
|
||||||
|
|
||||||
pub const MAX_BRIDGED_AUTHORITIES: u32 = 5;
|
pub const MAX_BRIDGED_AUTHORITIES: u32 = 5;
|
||||||
|
|
||||||
use crate as grandpa;
|
use crate as grandpa;
|
||||||
|
|
||||||
construct_runtime! {
|
construct_runtime! {
|
||||||
pub enum TestRuntime where
|
pub enum TestRuntime
|
||||||
Block = Block,
|
|
||||||
NodeBlock = Block,
|
|
||||||
UncheckedExtrinsic = UncheckedExtrinsic,
|
|
||||||
{
|
{
|
||||||
System: frame_system::{Pallet, Call, Config<T>, Storage, Event<T>},
|
System: frame_system::{Pallet, Call, Config<T>, Storage, Event<T>},
|
||||||
Grandpa: grandpa::{Pallet, Call, Event<T>},
|
Grandpa: grandpa::{Pallet, Call, Event<T>},
|
||||||
@@ -63,12 +59,11 @@ impl frame_system::Config for TestRuntime {
|
|||||||
type RuntimeOrigin = RuntimeOrigin;
|
type RuntimeOrigin = RuntimeOrigin;
|
||||||
type Index = u64;
|
type Index = u64;
|
||||||
type RuntimeCall = RuntimeCall;
|
type RuntimeCall = RuntimeCall;
|
||||||
type BlockNumber = u64;
|
|
||||||
type Hash = H256;
|
type Hash = H256;
|
||||||
type Hashing = BlakeTwo256;
|
type Hashing = BlakeTwo256;
|
||||||
type AccountId = AccountId;
|
type AccountId = AccountId;
|
||||||
type Lookup = IdentityLookup<Self::AccountId>;
|
type Lookup = IdentityLookup<Self::AccountId>;
|
||||||
type Header = Header;
|
type Block = Block;
|
||||||
type RuntimeEvent = RuntimeEvent;
|
type RuntimeEvent = RuntimeEvent;
|
||||||
type BlockHashCount = ConstU64<250>;
|
type BlockHashCount = ConstU64<250>;
|
||||||
type Version = ();
|
type Version = ();
|
||||||
@@ -105,10 +100,9 @@ impl grandpa::Config for TestRuntime {
|
|||||||
pub struct TestBridgedChain;
|
pub struct TestBridgedChain;
|
||||||
|
|
||||||
impl Chain for TestBridgedChain {
|
impl Chain for TestBridgedChain {
|
||||||
type BlockNumber = <TestRuntime as frame_system::Config>::BlockNumber;
|
type Block = Block;
|
||||||
type Hash = <TestRuntime as frame_system::Config>::Hash;
|
type Hash = <TestRuntime as frame_system::Config>::Hash;
|
||||||
type Hasher = <TestRuntime as frame_system::Config>::Hashing;
|
type Hasher = <TestRuntime as frame_system::Config>::Hashing;
|
||||||
type Header = <TestRuntime as frame_system::Config>::Header;
|
|
||||||
|
|
||||||
type AccountId = AccountId;
|
type AccountId = AccountId;
|
||||||
type Balance = u64;
|
type Balance = u64;
|
||||||
|
|||||||
@@ -188,9 +188,9 @@ pub mod pallet {
|
|||||||
#[pallet::hooks]
|
#[pallet::hooks]
|
||||||
impl<T: Config<I>, I: 'static> Hooks<BlockNumberFor<T>> for Pallet<T, I>
|
impl<T: Config<I>, I: 'static> Hooks<BlockNumberFor<T>> for Pallet<T, I>
|
||||||
where
|
where
|
||||||
u32: TryFrom<<T as frame_system::Config>::BlockNumber>,
|
u32: TryFrom<BlockNumberFor<T>>,
|
||||||
{
|
{
|
||||||
fn on_idle(_block: T::BlockNumber, remaining_weight: Weight) -> Weight {
|
fn on_idle(_block: BlockNumberFor<T>, remaining_weight: Weight) -> Weight {
|
||||||
// we'll need at least to read outbound lane state, kill a message and update lane state
|
// we'll need at least to read outbound lane state, kill a message and update lane state
|
||||||
let db_weight = T::DbWeight::get();
|
let db_weight = T::DbWeight::get();
|
||||||
if !remaining_weight.all_gte(db_weight.reads_writes(1, 2)) {
|
if !remaining_weight.all_gte(db_weight.reads_writes(1, 2)) {
|
||||||
|
|||||||
@@ -39,7 +39,6 @@ use frame_support::{
|
|||||||
use scale_info::TypeInfo;
|
use scale_info::TypeInfo;
|
||||||
use sp_core::H256;
|
use sp_core::H256;
|
||||||
use sp_runtime::{
|
use sp_runtime::{
|
||||||
testing::Header as SubstrateHeader,
|
|
||||||
traits::{BlakeTwo256, ConstU32, IdentityLookup},
|
traits::{BlakeTwo256, ConstU32, IdentityLookup},
|
||||||
BuildStorage, Perbill,
|
BuildStorage, Perbill,
|
||||||
};
|
};
|
||||||
@@ -71,15 +70,11 @@ pub type TestRelayer = u64;
|
|||||||
pub type TestDispatchLevelResult = ();
|
pub type TestDispatchLevelResult = ();
|
||||||
|
|
||||||
type Block = frame_system::mocking::MockBlock<TestRuntime>;
|
type Block = frame_system::mocking::MockBlock<TestRuntime>;
|
||||||
type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic<TestRuntime>;
|
|
||||||
|
|
||||||
use crate as pallet_bridge_messages;
|
use crate as pallet_bridge_messages;
|
||||||
|
|
||||||
frame_support::construct_runtime! {
|
frame_support::construct_runtime! {
|
||||||
pub enum TestRuntime where
|
pub enum TestRuntime
|
||||||
Block = Block,
|
|
||||||
NodeBlock = Block,
|
|
||||||
UncheckedExtrinsic = UncheckedExtrinsic,
|
|
||||||
{
|
{
|
||||||
System: frame_system::{Pallet, Call, Config<T>, Storage, Event<T>},
|
System: frame_system::{Pallet, Call, Config<T>, Storage, Event<T>},
|
||||||
Balances: pallet_balances::{Pallet, Call, Event<T>},
|
Balances: pallet_balances::{Pallet, Call, Event<T>},
|
||||||
@@ -100,12 +95,11 @@ impl frame_system::Config for TestRuntime {
|
|||||||
type RuntimeOrigin = RuntimeOrigin;
|
type RuntimeOrigin = RuntimeOrigin;
|
||||||
type Index = u64;
|
type Index = u64;
|
||||||
type RuntimeCall = RuntimeCall;
|
type RuntimeCall = RuntimeCall;
|
||||||
type BlockNumber = u64;
|
|
||||||
type Hash = H256;
|
type Hash = H256;
|
||||||
type Hashing = BlakeTwo256;
|
type Hashing = BlakeTwo256;
|
||||||
type AccountId = AccountId;
|
type AccountId = AccountId;
|
||||||
type Lookup = IdentityLookup<Self::AccountId>;
|
type Lookup = IdentityLookup<Self::AccountId>;
|
||||||
type Header = SubstrateHeader;
|
type Block = Block;
|
||||||
type RuntimeEvent = RuntimeEvent;
|
type RuntimeEvent = RuntimeEvent;
|
||||||
type BlockHashCount = ConstU64<250>;
|
type BlockHashCount = ConstU64<250>;
|
||||||
type Version = ();
|
type Version = ();
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ benchmarks_instance_pallet! {
|
|||||||
where
|
where
|
||||||
<T as pallet_bridge_grandpa::Config<T::BridgesGrandpaPalletInstance>>::BridgedChain:
|
<T as pallet_bridge_grandpa::Config<T::BridgesGrandpaPalletInstance>>::BridgedChain:
|
||||||
bp_runtime::Chain<
|
bp_runtime::Chain<
|
||||||
BlockNumber = RelayBlockNumber,
|
Block = crate::RelayBlock,
|
||||||
Hash = RelayBlockHash,
|
Hash = RelayBlockHash,
|
||||||
Hasher = RelayBlockHasher,
|
Hasher = RelayBlockHasher,
|
||||||
>,
|
>,
|
||||||
|
|||||||
@@ -63,6 +63,8 @@ pub type RelayBlockHash = bp_polkadot_core::Hash;
|
|||||||
pub type RelayBlockNumber = bp_polkadot_core::BlockNumber;
|
pub type RelayBlockNumber = bp_polkadot_core::BlockNumber;
|
||||||
/// Hasher of the bridged relay chain.
|
/// Hasher of the bridged relay chain.
|
||||||
pub type RelayBlockHasher = bp_polkadot_core::Hasher;
|
pub type RelayBlockHasher = bp_polkadot_core::Hasher;
|
||||||
|
/// Block type of the bridged relay chain.
|
||||||
|
pub type RelayBlock = bp_polkadot_core::Block;
|
||||||
|
|
||||||
/// Artifacts of the parachains head update.
|
/// Artifacts of the parachains head update.
|
||||||
struct UpdateParachainHeadArtifacts {
|
struct UpdateParachainHeadArtifacts {
|
||||||
@@ -137,18 +139,15 @@ pub mod pallet {
|
|||||||
pub trait BoundedBridgeGrandpaConfig<I: 'static>:
|
pub trait BoundedBridgeGrandpaConfig<I: 'static>:
|
||||||
pallet_bridge_grandpa::Config<I, BridgedChain = Self::BridgedRelayChain>
|
pallet_bridge_grandpa::Config<I, BridgedChain = Self::BridgedRelayChain>
|
||||||
{
|
{
|
||||||
type BridgedRelayChain: Chain<
|
type BridgedRelayChain: Chain<Hash = RelayBlockHash, Hasher = RelayBlockHasher>;
|
||||||
BlockNumber = RelayBlockNumber,
|
|
||||||
Hash = RelayBlockHash,
|
|
||||||
Hasher = RelayBlockHasher,
|
|
||||||
>;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T, I: 'static> BoundedBridgeGrandpaConfig<I> for T
|
impl<T, I: 'static> BoundedBridgeGrandpaConfig<I> for T
|
||||||
where
|
where
|
||||||
T: pallet_bridge_grandpa::Config<I>,
|
T: pallet_bridge_grandpa::Config<I>,
|
||||||
T::BridgedChain:
|
T::BridgedChain: Chain<Hash = RelayBlockHash, Hasher = RelayBlockHasher>,
|
||||||
Chain<BlockNumber = RelayBlockNumber, Hash = RelayBlockHash, Hasher = RelayBlockHasher>,
|
<<T::BridgedChain as Chain>::Block as sp_runtime::traits::Block>::Header:
|
||||||
|
sp_runtime::traits::Header<Number = RelayBlockNumber>,
|
||||||
{
|
{
|
||||||
type BridgedRelayChain = T::BridgedChain;
|
type BridgedRelayChain = T::BridgedChain;
|
||||||
}
|
}
|
||||||
@@ -323,7 +322,7 @@ pub mod pallet {
|
|||||||
>::get(relay_block_hash)
|
>::get(relay_block_hash)
|
||||||
.ok_or(Error::<T, I>::UnknownRelayChainBlock)?;
|
.ok_or(Error::<T, I>::UnknownRelayChainBlock)?;
|
||||||
ensure!(
|
ensure!(
|
||||||
relay_block.number == relay_block_number,
|
relay_block.number == relay_block_number.into(),
|
||||||
Error::<T, I>::InvalidRelayChainBlockNumber,
|
Error::<T, I>::InvalidRelayChainBlockNumber,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@@ -19,8 +19,8 @@ use bp_polkadot_core::parachains::ParaId;
|
|||||||
use bp_runtime::{Chain, Parachain};
|
use bp_runtime::{Chain, Parachain};
|
||||||
use frame_support::{construct_runtime, parameter_types, traits::ConstU32, weights::Weight};
|
use frame_support::{construct_runtime, parameter_types, traits::ConstU32, weights::Weight};
|
||||||
use sp_runtime::{
|
use sp_runtime::{
|
||||||
testing::{Header, H256},
|
testing::H256,
|
||||||
traits::{BlakeTwo256, Header as HeaderT, IdentityLookup},
|
traits::{BlakeTwo256, Header, IdentityLookup},
|
||||||
MultiSignature, Perbill,
|
MultiSignature, Perbill,
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -33,7 +33,6 @@ pub type RelayBlockHeader =
|
|||||||
sp_runtime::generic::Header<crate::RelayBlockNumber, crate::RelayBlockHasher>;
|
sp_runtime::generic::Header<crate::RelayBlockNumber, crate::RelayBlockHasher>;
|
||||||
|
|
||||||
type Block = frame_system::mocking::MockBlock<TestRuntime>;
|
type Block = frame_system::mocking::MockBlock<TestRuntime>;
|
||||||
type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic<TestRuntime>;
|
|
||||||
|
|
||||||
pub const PARAS_PALLET_NAME: &str = "Paras";
|
pub const PARAS_PALLET_NAME: &str = "Paras";
|
||||||
pub const UNTRACKED_PARACHAIN_ID: u32 = 10;
|
pub const UNTRACKED_PARACHAIN_ID: u32 = 10;
|
||||||
@@ -49,10 +48,9 @@ pub type BigParachainHeader = sp_runtime::generic::Header<u128, BlakeTwo256>;
|
|||||||
pub struct Parachain1;
|
pub struct Parachain1;
|
||||||
|
|
||||||
impl Chain for Parachain1 {
|
impl Chain for Parachain1 {
|
||||||
type BlockNumber = u64;
|
type Block = Block;
|
||||||
type Hash = H256;
|
type Hash = H256;
|
||||||
type Hasher = RegularParachainHasher;
|
type Hasher = RegularParachainHasher;
|
||||||
type Header = RegularParachainHeader;
|
|
||||||
type AccountId = u64;
|
type AccountId = u64;
|
||||||
type Balance = u64;
|
type Balance = u64;
|
||||||
type Index = u64;
|
type Index = u64;
|
||||||
@@ -73,10 +71,9 @@ impl Parachain for Parachain1 {
|
|||||||
pub struct Parachain2;
|
pub struct Parachain2;
|
||||||
|
|
||||||
impl Chain for Parachain2 {
|
impl Chain for Parachain2 {
|
||||||
type BlockNumber = u64;
|
type Block = Block;
|
||||||
type Hash = H256;
|
type Hash = H256;
|
||||||
type Hasher = RegularParachainHasher;
|
type Hasher = RegularParachainHasher;
|
||||||
type Header = RegularParachainHeader;
|
|
||||||
type AccountId = u64;
|
type AccountId = u64;
|
||||||
type Balance = u64;
|
type Balance = u64;
|
||||||
type Index = u64;
|
type Index = u64;
|
||||||
@@ -97,10 +94,9 @@ impl Parachain for Parachain2 {
|
|||||||
pub struct Parachain3;
|
pub struct Parachain3;
|
||||||
|
|
||||||
impl Chain for Parachain3 {
|
impl Chain for Parachain3 {
|
||||||
type BlockNumber = u64;
|
type Block = Block;
|
||||||
type Hash = H256;
|
type Hash = H256;
|
||||||
type Hasher = RegularParachainHasher;
|
type Hasher = RegularParachainHasher;
|
||||||
type Header = RegularParachainHeader;
|
|
||||||
type AccountId = u64;
|
type AccountId = u64;
|
||||||
type Balance = u64;
|
type Balance = u64;
|
||||||
type Index = u64;
|
type Index = u64;
|
||||||
@@ -121,11 +117,12 @@ impl Parachain for Parachain3 {
|
|||||||
// this parachain is using u128 as block number and stored head data size exceeds limit
|
// this parachain is using u128 as block number and stored head data size exceeds limit
|
||||||
pub struct BigParachain;
|
pub struct BigParachain;
|
||||||
|
|
||||||
|
type BigBlock = frame_system::mocking::MockBlockU128<TestRuntime>;
|
||||||
|
|
||||||
impl Chain for BigParachain {
|
impl Chain for BigParachain {
|
||||||
type BlockNumber = u128;
|
type Block = BigBlock;
|
||||||
type Hash = H256;
|
type Hash = H256;
|
||||||
type Hasher = RegularParachainHasher;
|
type Hasher = RegularParachainHasher;
|
||||||
type Header = BigParachainHeader;
|
|
||||||
type AccountId = u64;
|
type AccountId = u64;
|
||||||
type Balance = u64;
|
type Balance = u64;
|
||||||
type Index = u64;
|
type Index = u64;
|
||||||
@@ -144,10 +141,7 @@ impl Parachain for BigParachain {
|
|||||||
}
|
}
|
||||||
|
|
||||||
construct_runtime! {
|
construct_runtime! {
|
||||||
pub enum TestRuntime where
|
pub enum TestRuntime
|
||||||
Block = Block,
|
|
||||||
NodeBlock = Block,
|
|
||||||
UncheckedExtrinsic = UncheckedExtrinsic,
|
|
||||||
{
|
{
|
||||||
System: frame_system::{Pallet, Call, Config<T>, Storage, Event<T>},
|
System: frame_system::{Pallet, Call, Config<T>, Storage, Event<T>},
|
||||||
Grandpa1: pallet_bridge_grandpa::<Instance1>::{Pallet, Event<T>},
|
Grandpa1: pallet_bridge_grandpa::<Instance1>::{Pallet, Event<T>},
|
||||||
@@ -167,12 +161,11 @@ impl frame_system::Config for TestRuntime {
|
|||||||
type RuntimeOrigin = RuntimeOrigin;
|
type RuntimeOrigin = RuntimeOrigin;
|
||||||
type Index = u64;
|
type Index = u64;
|
||||||
type RuntimeCall = RuntimeCall;
|
type RuntimeCall = RuntimeCall;
|
||||||
type BlockNumber = TestNumber;
|
|
||||||
type Hash = H256;
|
type Hash = H256;
|
||||||
type Hashing = RegularParachainHasher;
|
type Hashing = RegularParachainHasher;
|
||||||
type AccountId = AccountId;
|
type AccountId = AccountId;
|
||||||
type Lookup = IdentityLookup<Self::AccountId>;
|
type Lookup = IdentityLookup<Self::AccountId>;
|
||||||
type Header = Header;
|
type Block = Block;
|
||||||
type RuntimeEvent = RuntimeEvent;
|
type RuntimeEvent = RuntimeEvent;
|
||||||
type BlockHashCount = BlockHashCount;
|
type BlockHashCount = BlockHashCount;
|
||||||
type Version = ();
|
type Version = ();
|
||||||
@@ -263,10 +256,9 @@ impl pallet_bridge_parachains::benchmarking::Config<()> for TestRuntime {
|
|||||||
pub struct TestBridgedChain;
|
pub struct TestBridgedChain;
|
||||||
|
|
||||||
impl Chain for TestBridgedChain {
|
impl Chain for TestBridgedChain {
|
||||||
type BlockNumber = crate::RelayBlockNumber;
|
type Block = crate::RelayBlock;
|
||||||
type Hash = crate::RelayBlockHash;
|
type Hash = crate::RelayBlockHash;
|
||||||
type Hasher = crate::RelayBlockHasher;
|
type Hasher = crate::RelayBlockHasher;
|
||||||
type Header = RelayBlockHeader;
|
|
||||||
|
|
||||||
type AccountId = AccountId;
|
type AccountId = AccountId;
|
||||||
type Balance = u32;
|
type Balance = u32;
|
||||||
@@ -294,10 +286,9 @@ impl ChainWithGrandpa for TestBridgedChain {
|
|||||||
pub struct OtherBridgedChain;
|
pub struct OtherBridgedChain;
|
||||||
|
|
||||||
impl Chain for OtherBridgedChain {
|
impl Chain for OtherBridgedChain {
|
||||||
type BlockNumber = u64;
|
type Block = Block;
|
||||||
type Hash = crate::RelayBlockHash;
|
type Hash = crate::RelayBlockHash;
|
||||||
type Hasher = crate::RelayBlockHasher;
|
type Hasher = crate::RelayBlockHasher;
|
||||||
type Header = sp_runtime::generic::Header<u64, crate::RelayBlockHasher>;
|
|
||||||
|
|
||||||
type AccountId = AccountId;
|
type AccountId = AccountId;
|
||||||
type Balance = u32;
|
type Balance = u32;
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ pub mod pallet {
|
|||||||
/// Pay rewards scheme.
|
/// Pay rewards scheme.
|
||||||
type PaymentProcedure: PaymentProcedure<Self::AccountId, Self::Reward>;
|
type PaymentProcedure: PaymentProcedure<Self::AccountId, Self::Reward>;
|
||||||
/// Stake and slash scheme.
|
/// Stake and slash scheme.
|
||||||
type StakeAndSlash: StakeAndSlash<Self::AccountId, Self::BlockNumber, Self::Reward>;
|
type StakeAndSlash: StakeAndSlash<Self::AccountId, BlockNumberFor<Self>, Self::Reward>;
|
||||||
/// Pallet call weights.
|
/// Pallet call weights.
|
||||||
type WeightInfo: WeightInfoExt;
|
type WeightInfo: WeightInfoExt;
|
||||||
}
|
}
|
||||||
@@ -117,7 +117,7 @@ pub mod pallet {
|
|||||||
/// Registration allows relayer to get priority boost for its message delivery transactions.
|
/// Registration allows relayer to get priority boost for its message delivery transactions.
|
||||||
#[pallet::call_index(1)]
|
#[pallet::call_index(1)]
|
||||||
#[pallet::weight(T::WeightInfo::register())]
|
#[pallet::weight(T::WeightInfo::register())]
|
||||||
pub fn register(origin: OriginFor<T>, valid_till: T::BlockNumber) -> DispatchResult {
|
pub fn register(origin: OriginFor<T>, valid_till: BlockNumberFor<T>) -> DispatchResult {
|
||||||
let relayer = ensure_signed(origin)?;
|
let relayer = ensure_signed(origin)?;
|
||||||
|
|
||||||
// valid till must be larger than the current block number and the lease must be larger
|
// valid till must be larger than the current block number and the lease must be larger
|
||||||
@@ -330,10 +330,10 @@ pub mod pallet {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Return required registration lease.
|
/// Return required registration lease.
|
||||||
pub(crate) fn required_registration_lease() -> T::BlockNumber {
|
pub(crate) fn required_registration_lease() -> BlockNumberFor<T> {
|
||||||
<T::StakeAndSlash as StakeAndSlash<
|
<T::StakeAndSlash as StakeAndSlash<
|
||||||
T::AccountId,
|
T::AccountId,
|
||||||
T::BlockNumber,
|
BlockNumberFor<T>,
|
||||||
T::Reward,
|
T::Reward,
|
||||||
>>::RequiredRegistrationLease::get()
|
>>::RequiredRegistrationLease::get()
|
||||||
}
|
}
|
||||||
@@ -342,7 +342,7 @@ pub mod pallet {
|
|||||||
pub(crate) fn required_stake() -> T::Reward {
|
pub(crate) fn required_stake() -> T::Reward {
|
||||||
<T::StakeAndSlash as StakeAndSlash<
|
<T::StakeAndSlash as StakeAndSlash<
|
||||||
T::AccountId,
|
T::AccountId,
|
||||||
T::BlockNumber,
|
BlockNumberFor<T>,
|
||||||
T::Reward,
|
T::Reward,
|
||||||
>>::RequiredStake::get()
|
>>::RequiredStake::get()
|
||||||
}
|
}
|
||||||
@@ -383,7 +383,7 @@ pub mod pallet {
|
|||||||
/// Relayer account that has been registered.
|
/// Relayer account that has been registered.
|
||||||
relayer: T::AccountId,
|
relayer: T::AccountId,
|
||||||
/// Relayer registration.
|
/// Relayer registration.
|
||||||
registration: Registration<T::BlockNumber, T::Reward>,
|
registration: Registration<BlockNumberFor<T>, T::Reward>,
|
||||||
},
|
},
|
||||||
/// Relayer has been `deregistered`.
|
/// Relayer has been `deregistered`.
|
||||||
Deregistered {
|
Deregistered {
|
||||||
@@ -395,7 +395,7 @@ pub mod pallet {
|
|||||||
/// Relayer account that has been `deregistered`.
|
/// Relayer account that has been `deregistered`.
|
||||||
relayer: T::AccountId,
|
relayer: T::AccountId,
|
||||||
/// Registration that was removed.
|
/// Registration that was removed.
|
||||||
registration: Registration<T::BlockNumber, T::Reward>,
|
registration: Registration<BlockNumberFor<T>, T::Reward>,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -445,7 +445,7 @@ pub mod pallet {
|
|||||||
_,
|
_,
|
||||||
Blake2_128Concat,
|
Blake2_128Concat,
|
||||||
T::AccountId,
|
T::AccountId,
|
||||||
Registration<T::BlockNumber, T::Reward>,
|
Registration<BlockNumberFor<T>, T::Reward>,
|
||||||
OptionQuery,
|
OptionQuery,
|
||||||
>;
|
>;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,7 +25,6 @@ use bp_relayers::{
|
|||||||
use frame_support::{parameter_types, traits::fungible::Mutate, weights::RuntimeDbWeight};
|
use frame_support::{parameter_types, traits::fungible::Mutate, weights::RuntimeDbWeight};
|
||||||
use sp_core::H256;
|
use sp_core::H256;
|
||||||
use sp_runtime::{
|
use sp_runtime::{
|
||||||
testing::Header as SubstrateHeader,
|
|
||||||
traits::{BlakeTwo256, ConstU32, IdentityLookup},
|
traits::{BlakeTwo256, ConstU32, IdentityLookup},
|
||||||
BuildStorage,
|
BuildStorage,
|
||||||
};
|
};
|
||||||
@@ -44,13 +43,9 @@ pub type TestStakeAndSlash = pallet_bridge_relayers::StakeAndSlashNamed<
|
|||||||
>;
|
>;
|
||||||
|
|
||||||
type Block = frame_system::mocking::MockBlock<TestRuntime>;
|
type Block = frame_system::mocking::MockBlock<TestRuntime>;
|
||||||
type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic<TestRuntime>;
|
|
||||||
|
|
||||||
frame_support::construct_runtime! {
|
frame_support::construct_runtime! {
|
||||||
pub enum TestRuntime where
|
pub enum TestRuntime
|
||||||
Block = Block,
|
|
||||||
NodeBlock = Block,
|
|
||||||
UncheckedExtrinsic = UncheckedExtrinsic,
|
|
||||||
{
|
{
|
||||||
System: frame_system::{Pallet, Call, Config<T>, Storage, Event<T>},
|
System: frame_system::{Pallet, Call, Config<T>, Storage, Event<T>},
|
||||||
Balances: pallet_balances::{Pallet, Event<T>},
|
Balances: pallet_balances::{Pallet, Event<T>},
|
||||||
@@ -70,12 +65,11 @@ impl frame_system::Config for TestRuntime {
|
|||||||
type RuntimeOrigin = RuntimeOrigin;
|
type RuntimeOrigin = RuntimeOrigin;
|
||||||
type Index = u64;
|
type Index = u64;
|
||||||
type RuntimeCall = RuntimeCall;
|
type RuntimeCall = RuntimeCall;
|
||||||
type BlockNumber = BlockNumber;
|
|
||||||
type Hash = H256;
|
type Hash = H256;
|
||||||
type Hashing = BlakeTwo256;
|
type Hashing = BlakeTwo256;
|
||||||
type AccountId = AccountId;
|
type AccountId = AccountId;
|
||||||
type Lookup = IdentityLookup<Self::AccountId>;
|
type Lookup = IdentityLookup<Self::AccountId>;
|
||||||
type Header = SubstrateHeader;
|
type Block = Block;
|
||||||
type RuntimeEvent = RuntimeEvent;
|
type RuntimeEvent = RuntimeEvent;
|
||||||
type BlockHashCount = frame_support::traits::ConstU64<250>;
|
type BlockHashCount = frame_support::traits::ConstU64<250>;
|
||||||
type Version = ();
|
type Version = ();
|
||||||
|
|||||||
@@ -17,8 +17,8 @@
|
|||||||
#![cfg_attr(not(feature = "std"), no_std)]
|
#![cfg_attr(not(feature = "std"), no_std)]
|
||||||
|
|
||||||
pub use bp_polkadot_core::{
|
pub use bp_polkadot_core::{
|
||||||
AccountId, AccountInfoStorageMapKeyProvider, AccountPublic, Balance, BlockNumber, Hash, Hasher,
|
AccountId, AccountInfoStorageMapKeyProvider, AccountPublic, Balance, Block, BlockNumber, Hash,
|
||||||
Hashing, Header, Index, Nonce, Perbill, Signature, SignedBlock, UncheckedExtrinsic,
|
Hasher, Hashing, Header, Index, Nonce, Perbill, Signature, SignedBlock, UncheckedExtrinsic,
|
||||||
EXTRA_STORAGE_PROOF_SIZE, TX_EXTRA_BYTES,
|
EXTRA_STORAGE_PROOF_SIZE, TX_EXTRA_BYTES,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -36,11 +36,9 @@ use sp_std::prelude::*;
|
|||||||
pub struct BridgeHubKusama;
|
pub struct BridgeHubKusama;
|
||||||
|
|
||||||
impl Chain for BridgeHubKusama {
|
impl Chain for BridgeHubKusama {
|
||||||
type BlockNumber = BlockNumber;
|
|
||||||
type Hash = Hash;
|
type Hash = Hash;
|
||||||
type Hasher = Hasher;
|
type Hasher = Hasher;
|
||||||
type Header = Header;
|
type Block = Block;
|
||||||
|
|
||||||
type AccountId = AccountId;
|
type AccountId = AccountId;
|
||||||
type Balance = Balance;
|
type Balance = Balance;
|
||||||
type Index = Index;
|
type Index = Index;
|
||||||
|
|||||||
@@ -32,11 +32,9 @@ use sp_std::prelude::*;
|
|||||||
pub struct BridgeHubPolkadot;
|
pub struct BridgeHubPolkadot;
|
||||||
|
|
||||||
impl Chain for BridgeHubPolkadot {
|
impl Chain for BridgeHubPolkadot {
|
||||||
type BlockNumber = BlockNumber;
|
|
||||||
type Hash = Hash;
|
type Hash = Hash;
|
||||||
type Hasher = Hasher;
|
type Hasher = Hasher;
|
||||||
type Header = Header;
|
type Block = Block;
|
||||||
|
|
||||||
type AccountId = AccountId;
|
type AccountId = AccountId;
|
||||||
type Balance = Balance;
|
type Balance = Balance;
|
||||||
type Index = Index;
|
type Index = Index;
|
||||||
|
|||||||
@@ -36,11 +36,9 @@ use sp_std::prelude::*;
|
|||||||
pub struct BridgeHubRococo;
|
pub struct BridgeHubRococo;
|
||||||
|
|
||||||
impl Chain for BridgeHubRococo {
|
impl Chain for BridgeHubRococo {
|
||||||
type BlockNumber = BlockNumber;
|
|
||||||
type Hash = Hash;
|
type Hash = Hash;
|
||||||
type Hasher = Hasher;
|
type Hasher = Hasher;
|
||||||
type Header = Header;
|
type Block = Block;
|
||||||
|
|
||||||
type AccountId = AccountId;
|
type AccountId = AccountId;
|
||||||
type Balance = Balance;
|
type Balance = Balance;
|
||||||
type Index = Index;
|
type Index = Index;
|
||||||
|
|||||||
@@ -32,11 +32,9 @@ use sp_std::prelude::*;
|
|||||||
pub struct BridgeHubWococo;
|
pub struct BridgeHubWococo;
|
||||||
|
|
||||||
impl Chain for BridgeHubWococo {
|
impl Chain for BridgeHubWococo {
|
||||||
type BlockNumber = BlockNumber;
|
|
||||||
type Hash = Hash;
|
type Hash = Hash;
|
||||||
type Hasher = Hasher;
|
type Hasher = Hasher;
|
||||||
type Header = Header;
|
type Block = Block;
|
||||||
|
|
||||||
type AccountId = AccountId;
|
type AccountId = AccountId;
|
||||||
type Balance = Balance;
|
type Balance = Balance;
|
||||||
type Index = Index;
|
type Index = Index;
|
||||||
|
|||||||
@@ -28,10 +28,9 @@ use frame_support::weights::Weight;
|
|||||||
pub struct Kusama;
|
pub struct Kusama;
|
||||||
|
|
||||||
impl Chain for Kusama {
|
impl Chain for Kusama {
|
||||||
type BlockNumber = <PolkadotLike as Chain>::BlockNumber;
|
type Block = <PolkadotLike as Chain>::Block;
|
||||||
type Hash = <PolkadotLike as Chain>::Hash;
|
type Hash = <PolkadotLike as Chain>::Hash;
|
||||||
type Hasher = <PolkadotLike as Chain>::Hasher;
|
type Hasher = <PolkadotLike as Chain>::Hasher;
|
||||||
type Header = <PolkadotLike as Chain>::Header;
|
|
||||||
|
|
||||||
type AccountId = <PolkadotLike as Chain>::AccountId;
|
type AccountId = <PolkadotLike as Chain>::AccountId;
|
||||||
type Balance = <PolkadotLike as Chain>::Balance;
|
type Balance = <PolkadotLike as Chain>::Balance;
|
||||||
|
|||||||
@@ -28,10 +28,9 @@ use frame_support::weights::Weight;
|
|||||||
pub struct Polkadot;
|
pub struct Polkadot;
|
||||||
|
|
||||||
impl Chain for Polkadot {
|
impl Chain for Polkadot {
|
||||||
type BlockNumber = <PolkadotLike as Chain>::BlockNumber;
|
type Block = <PolkadotLike as Chain>::Block;
|
||||||
type Hash = <PolkadotLike as Chain>::Hash;
|
type Hash = <PolkadotLike as Chain>::Hash;
|
||||||
type Hasher = <PolkadotLike as Chain>::Hasher;
|
type Hasher = <PolkadotLike as Chain>::Hasher;
|
||||||
type Header = <PolkadotLike as Chain>::Header;
|
|
||||||
|
|
||||||
type AccountId = <PolkadotLike as Chain>::AccountId;
|
type AccountId = <PolkadotLike as Chain>::AccountId;
|
||||||
type Balance = <PolkadotLike as Chain>::Balance;
|
type Balance = <PolkadotLike as Chain>::Balance;
|
||||||
|
|||||||
@@ -28,11 +28,9 @@ use frame_support::{parameter_types, weights::Weight};
|
|||||||
pub struct Rococo;
|
pub struct Rococo;
|
||||||
|
|
||||||
impl Chain for Rococo {
|
impl Chain for Rococo {
|
||||||
type BlockNumber = <PolkadotLike as Chain>::BlockNumber;
|
type Block = <PolkadotLike as Chain>::Block;
|
||||||
type Hash = <PolkadotLike as Chain>::Hash;
|
type Hash = <PolkadotLike as Chain>::Hash;
|
||||||
type Hasher = <PolkadotLike as Chain>::Hasher;
|
type Hasher = <PolkadotLike as Chain>::Hasher;
|
||||||
type Header = <PolkadotLike as Chain>::Header;
|
|
||||||
|
|
||||||
type AccountId = <PolkadotLike as Chain>::AccountId;
|
type AccountId = <PolkadotLike as Chain>::AccountId;
|
||||||
type Balance = <PolkadotLike as Chain>::Balance;
|
type Balance = <PolkadotLike as Chain>::Balance;
|
||||||
type Index = <PolkadotLike as Chain>::Index;
|
type Index = <PolkadotLike as Chain>::Index;
|
||||||
|
|||||||
@@ -31,11 +31,9 @@ use frame_support::weights::Weight;
|
|||||||
pub struct Wococo;
|
pub struct Wococo;
|
||||||
|
|
||||||
impl Chain for Wococo {
|
impl Chain for Wococo {
|
||||||
type BlockNumber = <PolkadotLike as Chain>::BlockNumber;
|
type Block = <PolkadotLike as Chain>::Block;
|
||||||
type Hash = <PolkadotLike as Chain>::Hash;
|
type Hash = <PolkadotLike as Chain>::Hash;
|
||||||
type Hasher = <PolkadotLike as Chain>::Hasher;
|
type Hasher = <PolkadotLike as Chain>::Hasher;
|
||||||
type Header = <PolkadotLike as Chain>::Header;
|
|
||||||
|
|
||||||
type AccountId = <PolkadotLike as Chain>::AccountId;
|
type AccountId = <PolkadotLike as Chain>::AccountId;
|
||||||
type Balance = <PolkadotLike as Chain>::Balance;
|
type Balance = <PolkadotLike as Chain>::Balance;
|
||||||
type Index = <PolkadotLike as Chain>::Index;
|
type Index = <PolkadotLike as Chain>::Index;
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ impl<H: HeaderT> GrandpaJustification<H> {
|
|||||||
/// any precise calculations - that's just an estimation.
|
/// any precise calculations - that's just an estimation.
|
||||||
pub fn max_reasonable_size<C>(required_precommits: u32) -> u32
|
pub fn max_reasonable_size<C>(required_precommits: u32) -> u32
|
||||||
where
|
where
|
||||||
C: Chain<Header = H> + ChainWithGrandpa,
|
C: Chain + ChainWithGrandpa,
|
||||||
{
|
{
|
||||||
// we don't need precise results here - just estimations, so some details
|
// we don't need precise results here - just estimations, so some details
|
||||||
// are removed from computations (e.g. bytes required to encode vector length)
|
// are removed from computations (e.g. bytes required to encode vector length)
|
||||||
@@ -159,10 +159,7 @@ pub fn verify_and_optimize_justification<Header: HeaderT>(
|
|||||||
authorities_set_id: SetId,
|
authorities_set_id: SetId,
|
||||||
authorities_set: &VoterSet<AuthorityId>,
|
authorities_set: &VoterSet<AuthorityId>,
|
||||||
justification: GrandpaJustification<Header>,
|
justification: GrandpaJustification<Header>,
|
||||||
) -> Result<GrandpaJustification<Header>, Error>
|
) -> Result<GrandpaJustification<Header>, Error> {
|
||||||
where
|
|
||||||
Header::Number: finality_grandpa::BlockNumberOps,
|
|
||||||
{
|
|
||||||
let mut optimizer = OptimizationCallbacks(Vec::new());
|
let mut optimizer = OptimizationCallbacks(Vec::new());
|
||||||
verify_justification_with_callbacks(
|
verify_justification_with_callbacks(
|
||||||
finalized_target,
|
finalized_target,
|
||||||
@@ -180,10 +177,7 @@ pub fn verify_justification<Header: HeaderT>(
|
|||||||
authorities_set_id: SetId,
|
authorities_set_id: SetId,
|
||||||
authorities_set: &VoterSet<AuthorityId>,
|
authorities_set: &VoterSet<AuthorityId>,
|
||||||
justification: &GrandpaJustification<Header>,
|
justification: &GrandpaJustification<Header>,
|
||||||
) -> Result<(), Error>
|
) -> Result<(), Error> {
|
||||||
where
|
|
||||||
Header::Number: finality_grandpa::BlockNumberOps,
|
|
||||||
{
|
|
||||||
verify_justification_with_callbacks(
|
verify_justification_with_callbacks(
|
||||||
finalized_target,
|
finalized_target,
|
||||||
authorities_set_id,
|
authorities_set_id,
|
||||||
@@ -259,10 +253,7 @@ fn verify_justification_with_callbacks<Header: HeaderT, C: VerificationCallbacks
|
|||||||
authorities_set: &VoterSet<AuthorityId>,
|
authorities_set: &VoterSet<AuthorityId>,
|
||||||
justification: &GrandpaJustification<Header>,
|
justification: &GrandpaJustification<Header>,
|
||||||
callbacks: &mut C,
|
callbacks: &mut C,
|
||||||
) -> Result<(), Error>
|
) -> Result<(), Error> {
|
||||||
where
|
|
||||||
Header::Number: finality_grandpa::BlockNumberOps,
|
|
||||||
{
|
|
||||||
// ensure that it is justification for the expected header
|
// ensure that it is justification for the expected header
|
||||||
if (justification.commit.target_hash, justification.commit.target_number) != finalized_target {
|
if (justification.commit.target_hash, justification.commit.target_number) != finalized_target {
|
||||||
return Err(Error::InvalidJustificationTarget)
|
return Err(Error::InvalidJustificationTarget)
|
||||||
|
|||||||
@@ -229,11 +229,9 @@ pub type Address = MultiAddress<AccountId, ()>;
|
|||||||
pub struct PolkadotLike;
|
pub struct PolkadotLike;
|
||||||
|
|
||||||
impl Chain for PolkadotLike {
|
impl Chain for PolkadotLike {
|
||||||
type BlockNumber = BlockNumber;
|
|
||||||
type Hash = Hash;
|
type Hash = Hash;
|
||||||
type Hasher = Hasher;
|
type Hasher = Hasher;
|
||||||
type Header = Header;
|
type Block = Block;
|
||||||
|
|
||||||
type AccountId = AccountId;
|
type AccountId = AccountId;
|
||||||
type Balance = Balance;
|
type Balance = Balance;
|
||||||
type Index = Index;
|
type Index = Index;
|
||||||
|
|||||||
@@ -14,18 +14,18 @@
|
|||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with Parity Bridges Common. If not, see <http://www.gnu.org/licenses/>.
|
// along with Parity Bridges Common. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
use crate::HeaderIdProvider;
|
|
||||||
use codec::{Decode, Encode, MaxEncodedLen};
|
use codec::{Decode, Encode, MaxEncodedLen};
|
||||||
use frame_support::{weights::Weight, Parameter};
|
use frame_support::{weights::Weight, Parameter};
|
||||||
use num_traits::{AsPrimitive, Bounded, CheckedSub, Saturating, SaturatingAdd, Zero};
|
use num_traits::{Bounded, CheckedSub, SaturatingAdd, Zero};
|
||||||
use sp_runtime::{
|
use sp_runtime::{
|
||||||
traits::{
|
traits::{
|
||||||
AtLeast32Bit, AtLeast32BitUnsigned, Hash as HashT, Header as HeaderT, MaybeDisplay,
|
AtLeast32Bit, AtLeast32BitUnsigned, Block as BlockT, Hash as HashT, Header as HeaderT,
|
||||||
MaybeSerialize, MaybeSerializeDeserialize, Member, SimpleBitOps, Verify,
|
HeaderProvider, MaybeDisplay, MaybeSerialize, MaybeSerializeDeserialize, Member,
|
||||||
|
SimpleBitOps, Verify,
|
||||||
},
|
},
|
||||||
FixedPointOperand,
|
FixedPointOperand,
|
||||||
};
|
};
|
||||||
use sp_std::{convert::TryFrom, fmt::Debug, hash::Hash, str::FromStr, vec, vec::Vec};
|
use sp_std::{convert::TryFrom, fmt::Debug, hash::Hash, vec, vec::Vec};
|
||||||
|
|
||||||
/// Chain call, that is either SCALE-encoded, or decoded.
|
/// Chain call, that is either SCALE-encoded, or decoded.
|
||||||
#[derive(Debug, Clone, PartialEq)]
|
#[derive(Debug, Clone, PartialEq)]
|
||||||
@@ -91,27 +91,6 @@ impl<ChainCall: Encode> Encode for EncodedOrDecodedCall<ChainCall> {
|
|||||||
|
|
||||||
/// Minimal Substrate-based chain representation that may be used from no_std environment.
|
/// Minimal Substrate-based chain representation that may be used from no_std environment.
|
||||||
pub trait Chain: Send + Sync + 'static {
|
pub trait Chain: Send + Sync + 'static {
|
||||||
/// A type that fulfills the abstract idea of what a Substrate block number is.
|
|
||||||
// Constraits come from the associated Number type of `sp_runtime::traits::Header`
|
|
||||||
// See here for more info:
|
|
||||||
// https://crates.parity.io/sp_runtime/traits/trait.Header.html#associatedtype.Number
|
|
||||||
//
|
|
||||||
// Note that the `AsPrimitive<usize>` trait is required by the GRANDPA justification
|
|
||||||
// verifier, and is not usually part of a Substrate Header's Number type.
|
|
||||||
type BlockNumber: Parameter
|
|
||||||
+ Member
|
|
||||||
+ MaybeSerializeDeserialize
|
|
||||||
+ Hash
|
|
||||||
+ Copy
|
|
||||||
+ Default
|
|
||||||
+ MaybeDisplay
|
|
||||||
+ AtLeast32BitUnsigned
|
|
||||||
+ FromStr
|
|
||||||
+ AsPrimitive<usize>
|
|
||||||
+ Default
|
|
||||||
+ Saturating
|
|
||||||
+ MaxEncodedLen;
|
|
||||||
|
|
||||||
/// A type that fulfills the abstract idea of what a Substrate hash is.
|
/// A type that fulfills the abstract idea of what a Substrate hash is.
|
||||||
// Constraits come from the associated Hash type of `sp_runtime::traits::Header`
|
// Constraits come from the associated Hash type of `sp_runtime::traits::Header`
|
||||||
// See here for more info:
|
// See here for more info:
|
||||||
@@ -136,13 +115,10 @@ pub trait Chain: Send + Sync + 'static {
|
|||||||
// https://crates.parity.io/sp_runtime/traits/trait.Header.html#associatedtype.Hashing
|
// https://crates.parity.io/sp_runtime/traits/trait.Header.html#associatedtype.Hashing
|
||||||
type Hasher: HashT<Output = Self::Hash>;
|
type Hasher: HashT<Output = Self::Hash>;
|
||||||
|
|
||||||
/// A type that fulfills the abstract idea of what a Substrate header is.
|
/// A type that fulfills the abstract idea of what a Substrate block is.
|
||||||
// See here for more info:
|
// See here for more info:
|
||||||
// https://crates.parity.io/sp_runtime/traits/trait.Header.html
|
// https://crates.parity.io/sp_runtime/traits/trait.Block.html
|
||||||
type Header: Parameter
|
type Block: Parameter + BlockT<Hash = Self::Hash> + MaybeSerialize;
|
||||||
+ HeaderT<Number = Self::BlockNumber, Hash = Self::Hash>
|
|
||||||
+ HeaderIdProvider<Self::Header>
|
|
||||||
+ MaybeSerializeDeserialize;
|
|
||||||
|
|
||||||
/// The user account identifier type for the runtime.
|
/// The user account identifier type for the runtime.
|
||||||
type AccountId: Parameter
|
type AccountId: Parameter
|
||||||
@@ -200,10 +176,9 @@ impl<T> Chain for T
|
|||||||
where
|
where
|
||||||
T: Send + Sync + 'static + UnderlyingChainProvider,
|
T: Send + Sync + 'static + UnderlyingChainProvider,
|
||||||
{
|
{
|
||||||
type BlockNumber = <T::Chain as Chain>::BlockNumber;
|
|
||||||
type Hash = <T::Chain as Chain>::Hash;
|
type Hash = <T::Chain as Chain>::Hash;
|
||||||
type Hasher = <T::Chain as Chain>::Hasher;
|
type Hasher = <T::Chain as Chain>::Hasher;
|
||||||
type Header = <T::Chain as Chain>::Header;
|
type Block = <T::Chain as Chain>::Block;
|
||||||
type AccountId = <T::Chain as Chain>::AccountId;
|
type AccountId = <T::Chain as Chain>::AccountId;
|
||||||
type Balance = <T::Chain as Chain>::Balance;
|
type Balance = <T::Chain as Chain>::Balance;
|
||||||
type Index = <T::Chain as Chain>::Index;
|
type Index = <T::Chain as Chain>::Index;
|
||||||
@@ -244,7 +219,7 @@ impl<Para: Parachain> frame_support::traits::Get<u32> for ParachainIdOf<Para> {
|
|||||||
pub type UnderlyingChainOf<C> = <C as UnderlyingChainProvider>::Chain;
|
pub type UnderlyingChainOf<C> = <C as UnderlyingChainProvider>::Chain;
|
||||||
|
|
||||||
/// Block number used by the chain.
|
/// Block number used by the chain.
|
||||||
pub type BlockNumberOf<C> = <C as Chain>::BlockNumber;
|
pub type BlockNumberOf<C> = <<<C as Chain>::Block as HeaderProvider>::HeaderT as HeaderT>::Number;
|
||||||
|
|
||||||
/// Hash type used by the chain.
|
/// Hash type used by the chain.
|
||||||
pub type HashOf<C> = <C as Chain>::Hash;
|
pub type HashOf<C> = <C as Chain>::Hash;
|
||||||
@@ -253,7 +228,7 @@ pub type HashOf<C> = <C as Chain>::Hash;
|
|||||||
pub type HasherOf<C> = <C as Chain>::Hasher;
|
pub type HasherOf<C> = <C as Chain>::Hasher;
|
||||||
|
|
||||||
/// Header type used by the chain.
|
/// Header type used by the chain.
|
||||||
pub type HeaderOf<C> = <C as Chain>::Header;
|
pub type HeaderOf<C> = <<C as Chain>::Block as HeaderProvider>::HeaderT;
|
||||||
|
|
||||||
/// Account id type used by the chain.
|
/// Account id type used by the chain.
|
||||||
pub type AccountIdOf<C> = <C as Chain>::AccountId;
|
pub type AccountIdOf<C> = <C as Chain>::AccountId;
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ use frame_support::{
|
|||||||
dispatch::DispatchResult,
|
dispatch::DispatchResult,
|
||||||
traits::{Currency, EnsureOrigin, Get, ReservableCurrency},
|
traits::{Currency, EnsureOrigin, Get, ReservableCurrency},
|
||||||
};
|
};
|
||||||
use frame_system::{EventRecord, RawOrigin};
|
use frame_system::{pallet_prelude::BlockNumberFor, EventRecord, RawOrigin};
|
||||||
use pallet_authorship::EventHandler;
|
use pallet_authorship::EventHandler;
|
||||||
use pallet_session::{self as session, SessionManager};
|
use pallet_session::{self as session, SessionManager};
|
||||||
use sp_std::prelude::*;
|
use sp_std::prelude::*;
|
||||||
@@ -289,7 +289,7 @@ benchmarks! {
|
|||||||
T::Currency::minimum_balance() * 4u32.into(),
|
T::Currency::minimum_balance() * 4u32.into(),
|
||||||
);
|
);
|
||||||
let author = account("author", 0, SEED);
|
let author = account("author", 0, SEED);
|
||||||
let new_block: T::BlockNumber = 10u32.into();
|
let new_block: BlockNumberFor<T> = 10u32.into();
|
||||||
|
|
||||||
frame_system::Pallet::<T>::set_block_number(new_block);
|
frame_system::Pallet::<T>::set_block_number(new_block);
|
||||||
assert!(T::Currency::free_balance(&author) == 0u32.into());
|
assert!(T::Currency::free_balance(&author) == 0u32.into());
|
||||||
@@ -312,8 +312,8 @@ benchmarks! {
|
|||||||
register_validators::<T>(c);
|
register_validators::<T>(c);
|
||||||
register_candidates::<T>(c);
|
register_candidates::<T>(c);
|
||||||
|
|
||||||
let new_block: T::BlockNumber = 1800u32.into();
|
let new_block: BlockNumberFor<T> = 1800u32.into();
|
||||||
let zero_block: T::BlockNumber = 0u32.into();
|
let zero_block: BlockNumberFor<T> = 0u32.into();
|
||||||
let candidates = <Candidates<T>>::get();
|
let candidates = <Candidates<T>>::get();
|
||||||
|
|
||||||
let non_removals = c.saturating_sub(r);
|
let non_removals = c.saturating_sub(r);
|
||||||
|
|||||||
@@ -143,7 +143,7 @@ pub mod pallet {
|
|||||||
type MaxInvulnerables: Get<u32>;
|
type MaxInvulnerables: Get<u32>;
|
||||||
|
|
||||||
// Will be kicked if block is not produced in threshold.
|
// Will be kicked if block is not produced in threshold.
|
||||||
type KickThreshold: Get<Self::BlockNumber>;
|
type KickThreshold: Get<BlockNumberFor<Self>>;
|
||||||
|
|
||||||
/// A stable ID for a validator.
|
/// A stable ID for a validator.
|
||||||
type ValidatorId: Member + Parameter;
|
type ValidatorId: Member + Parameter;
|
||||||
@@ -195,7 +195,7 @@ pub mod pallet {
|
|||||||
#[pallet::storage]
|
#[pallet::storage]
|
||||||
#[pallet::getter(fn last_authored_block)]
|
#[pallet::getter(fn last_authored_block)]
|
||||||
pub type LastAuthoredBlock<T: Config> =
|
pub type LastAuthoredBlock<T: Config> =
|
||||||
StorageMap<_, Twox64Concat, T::AccountId, T::BlockNumber, ValueQuery>;
|
StorageMap<_, Twox64Concat, T::AccountId, BlockNumberFor<T>, ValueQuery>;
|
||||||
|
|
||||||
/// Desired number of candidates.
|
/// Desired number of candidates.
|
||||||
///
|
///
|
||||||
@@ -648,7 +648,7 @@ pub mod pallet {
|
|||||||
/// Keep track of number of authored blocks per authority, uncles are counted as well since
|
/// Keep track of number of authored blocks per authority, uncles are counted as well since
|
||||||
/// they're a valid proof of being online.
|
/// they're a valid proof of being online.
|
||||||
impl<T: Config + pallet_authorship::Config>
|
impl<T: Config + pallet_authorship::Config>
|
||||||
pallet_authorship::EventHandler<T::AccountId, T::BlockNumber> for Pallet<T>
|
pallet_authorship::EventHandler<T::AccountId, BlockNumberFor<T>> for Pallet<T>
|
||||||
{
|
{
|
||||||
fn note_author(author: T::AccountId) {
|
fn note_author(author: T::AccountId) {
|
||||||
let pot = Self::account_id();
|
let pot = Self::account_id();
|
||||||
|
|||||||
@@ -24,20 +24,16 @@ use frame_system as system;
|
|||||||
use frame_system::EnsureSignedBy;
|
use frame_system::EnsureSignedBy;
|
||||||
use sp_core::H256;
|
use sp_core::H256;
|
||||||
use sp_runtime::{
|
use sp_runtime::{
|
||||||
testing::{Header, UintAuthorityId},
|
testing::UintAuthorityId,
|
||||||
traits::{BlakeTwo256, IdentityLookup, OpaqueKeys},
|
traits::{BlakeTwo256, IdentityLookup, OpaqueKeys},
|
||||||
BuildStorage, RuntimeAppPublic,
|
BuildStorage, RuntimeAppPublic,
|
||||||
};
|
};
|
||||||
|
|
||||||
type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic<Test>;
|
|
||||||
type Block = frame_system::mocking::MockBlock<Test>;
|
type Block = frame_system::mocking::MockBlock<Test>;
|
||||||
|
|
||||||
// Configure a mock runtime to test the pallet.
|
// Configure a mock runtime to test the pallet.
|
||||||
frame_support::construct_runtime!(
|
frame_support::construct_runtime!(
|
||||||
pub enum Test where
|
pub enum Test
|
||||||
Block = Block,
|
|
||||||
NodeBlock = Block,
|
|
||||||
UncheckedExtrinsic = UncheckedExtrinsic,
|
|
||||||
{
|
{
|
||||||
System: frame_system,
|
System: frame_system,
|
||||||
Timestamp: pallet_timestamp,
|
Timestamp: pallet_timestamp,
|
||||||
@@ -62,12 +58,11 @@ impl system::Config for Test {
|
|||||||
type RuntimeOrigin = RuntimeOrigin;
|
type RuntimeOrigin = RuntimeOrigin;
|
||||||
type RuntimeCall = RuntimeCall;
|
type RuntimeCall = RuntimeCall;
|
||||||
type Index = u64;
|
type Index = u64;
|
||||||
type BlockNumber = u64;
|
|
||||||
type Hash = H256;
|
type Hash = H256;
|
||||||
type Hashing = BlakeTwo256;
|
type Hashing = BlakeTwo256;
|
||||||
type AccountId = u64;
|
type AccountId = u64;
|
||||||
type Lookup = IdentityLookup<Self::AccountId>;
|
type Lookup = IdentityLookup<Self::AccountId>;
|
||||||
type Header = Header;
|
type Block = Block;
|
||||||
type RuntimeEvent = RuntimeEvent;
|
type RuntimeEvent = RuntimeEvent;
|
||||||
type BlockHashCount = BlockHashCount;
|
type BlockHashCount = BlockHashCount;
|
||||||
type Version = ();
|
type Version = ();
|
||||||
|
|||||||
@@ -139,7 +139,7 @@ pub mod pallet {
|
|||||||
|
|
||||||
#[pallet::hooks]
|
#[pallet::hooks]
|
||||||
impl<T: Config> Hooks<BlockNumberFor<T>> for Pallet<T> {
|
impl<T: Config> Hooks<BlockNumberFor<T>> for Pallet<T> {
|
||||||
fn on_idle(_now: T::BlockNumber, max_weight: Weight) -> Weight {
|
fn on_idle(_now: BlockNumberFor<T>, max_weight: Weight) -> Weight {
|
||||||
// on_idle processes additional messages with any remaining block weight.
|
// on_idle processes additional messages with any remaining block weight.
|
||||||
Self::service_queue(max_weight)
|
Self::service_queue(max_weight)
|
||||||
}
|
}
|
||||||
@@ -414,7 +414,6 @@ mod tests {
|
|||||||
use frame_support::{assert_noop, parameter_types, traits::OnIdle};
|
use frame_support::{assert_noop, parameter_types, traits::OnIdle};
|
||||||
use sp_core::H256;
|
use sp_core::H256;
|
||||||
use sp_runtime::{
|
use sp_runtime::{
|
||||||
testing::Header,
|
|
||||||
traits::{BlakeTwo256, IdentityLookup},
|
traits::{BlakeTwo256, IdentityLookup},
|
||||||
BuildStorage,
|
BuildStorage,
|
||||||
DispatchError::BadOrigin,
|
DispatchError::BadOrigin,
|
||||||
@@ -423,15 +422,11 @@ mod tests {
|
|||||||
use std::cell::RefCell;
|
use std::cell::RefCell;
|
||||||
use xcm::latest::{MultiLocation, OriginKind};
|
use xcm::latest::{MultiLocation, OriginKind};
|
||||||
|
|
||||||
type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic<Test>;
|
|
||||||
type Block = frame_system::mocking::MockBlock<Test>;
|
type Block = frame_system::mocking::MockBlock<Test>;
|
||||||
type Xcm = xcm::latest::Xcm<RuntimeCall>;
|
type Xcm = xcm::latest::Xcm<RuntimeCall>;
|
||||||
|
|
||||||
frame_support::construct_runtime!(
|
frame_support::construct_runtime!(
|
||||||
pub enum Test where
|
pub enum Test
|
||||||
Block = Block,
|
|
||||||
NodeBlock = Block,
|
|
||||||
UncheckedExtrinsic = UncheckedExtrinsic,
|
|
||||||
{
|
{
|
||||||
System: frame_system::{Pallet, Call, Config<T>, Storage, Event<T>},
|
System: frame_system::{Pallet, Call, Config<T>, Storage, Event<T>},
|
||||||
DmpQueue: dmp_queue::{Pallet, Call, Storage, Event<T>},
|
DmpQueue: dmp_queue::{Pallet, Call, Storage, Event<T>},
|
||||||
@@ -461,12 +456,11 @@ mod tests {
|
|||||||
type RuntimeOrigin = RuntimeOrigin;
|
type RuntimeOrigin = RuntimeOrigin;
|
||||||
type RuntimeCall = RuntimeCall;
|
type RuntimeCall = RuntimeCall;
|
||||||
type Index = u64;
|
type Index = u64;
|
||||||
type BlockNumber = u64;
|
|
||||||
type Hash = H256;
|
type Hash = H256;
|
||||||
type Hashing = BlakeTwo256;
|
type Hashing = BlakeTwo256;
|
||||||
type AccountId = AccountId;
|
type AccountId = AccountId;
|
||||||
type Lookup = IdentityLookup<Self::AccountId>;
|
type Lookup = IdentityLookup<Self::AccountId>;
|
||||||
type Header = Header;
|
type Block = Block;
|
||||||
type RuntimeEvent = RuntimeEvent;
|
type RuntimeEvent = RuntimeEvent;
|
||||||
type BlockHashCount = BlockHashCount;
|
type BlockHashCount = BlockHashCount;
|
||||||
type BlockLength = ();
|
type BlockLength = ();
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ use frame_support::{
|
|||||||
weights::Weight,
|
weights::Weight,
|
||||||
RuntimeDebug,
|
RuntimeDebug,
|
||||||
};
|
};
|
||||||
use frame_system::{ensure_none, ensure_root};
|
use frame_system::{ensure_none, ensure_root, pallet_prelude::HeaderFor};
|
||||||
use polkadot_parachain::primitives::RelayChainBlockNumber;
|
use polkadot_parachain::primitives::RelayChainBlockNumber;
|
||||||
use scale_info::TypeInfo;
|
use scale_info::TypeInfo;
|
||||||
use sp_runtime::{
|
use sp_runtime::{
|
||||||
@@ -197,7 +197,7 @@ pub mod pallet {
|
|||||||
|
|
||||||
#[pallet::hooks]
|
#[pallet::hooks]
|
||||||
impl<T: Config> Hooks<BlockNumberFor<T>> for Pallet<T> {
|
impl<T: Config> Hooks<BlockNumberFor<T>> for Pallet<T> {
|
||||||
fn on_finalize(_: T::BlockNumber) {
|
fn on_finalize(_: BlockNumberFor<T>) {
|
||||||
<DidSetValidationCode<T>>::kill();
|
<DidSetValidationCode<T>>::kill();
|
||||||
<UpgradeRestrictionSignal<T>>::kill();
|
<UpgradeRestrictionSignal<T>>::kill();
|
||||||
|
|
||||||
@@ -281,7 +281,7 @@ pub mod pallet {
|
|||||||
HrmpOutboundMessages::<T>::put(outbound_messages);
|
HrmpOutboundMessages::<T>::put(outbound_messages);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn on_initialize(_n: T::BlockNumber) -> Weight {
|
fn on_initialize(_n: BlockNumberFor<T>) -> Weight {
|
||||||
let mut weight = Weight::zero();
|
let mut weight = Weight::zero();
|
||||||
|
|
||||||
// To prevent removing `NewValidationCode` that was set by another `on_initialize`
|
// To prevent removing `NewValidationCode` that was set by another `on_initialize`
|
||||||
@@ -1016,7 +1016,7 @@ impl<T: Config> Pallet<T> {
|
|||||||
///
|
///
|
||||||
/// This is expected to be used by the
|
/// This is expected to be used by the
|
||||||
/// [`CollectCollationInfo`](cumulus_primitives_core::CollectCollationInfo) runtime api.
|
/// [`CollectCollationInfo`](cumulus_primitives_core::CollectCollationInfo) runtime api.
|
||||||
pub fn collect_collation_info(header: &T::Header) -> CollationInfo {
|
pub fn collect_collation_info(header: &HeaderFor<T>) -> CollationInfo {
|
||||||
CollationInfo {
|
CollationInfo {
|
||||||
hrmp_watermark: HrmpWatermark::<T>::get(),
|
hrmp_watermark: HrmpWatermark::<T>::get(),
|
||||||
horizontal_messages: HrmpOutboundMessages::<T>::get(),
|
horizontal_messages: HrmpOutboundMessages::<T>::get(),
|
||||||
|
|||||||
@@ -29,12 +29,11 @@ use frame_support::{
|
|||||||
traits::{OnFinalize, OnInitialize},
|
traits::{OnFinalize, OnInitialize},
|
||||||
weights::Weight,
|
weights::Weight,
|
||||||
};
|
};
|
||||||
use frame_system::RawOrigin;
|
use frame_system::{pallet_prelude::BlockNumberFor, RawOrigin};
|
||||||
use hex_literal::hex;
|
use hex_literal::hex;
|
||||||
use relay_chain::HrmpChannelId;
|
use relay_chain::HrmpChannelId;
|
||||||
use sp_core::{blake2_256, H256};
|
use sp_core::{blake2_256, H256};
|
||||||
use sp_runtime::{
|
use sp_runtime::{
|
||||||
testing::Header,
|
|
||||||
traits::{BlakeTwo256, IdentityLookup},
|
traits::{BlakeTwo256, IdentityLookup},
|
||||||
BuildStorage, DispatchErrorWithPostInfo,
|
BuildStorage, DispatchErrorWithPostInfo,
|
||||||
};
|
};
|
||||||
@@ -43,14 +42,10 @@ use std::cell::RefCell;
|
|||||||
|
|
||||||
use crate as parachain_system;
|
use crate as parachain_system;
|
||||||
|
|
||||||
type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic<Test>;
|
|
||||||
type Block = frame_system::mocking::MockBlock<Test>;
|
type Block = frame_system::mocking::MockBlock<Test>;
|
||||||
|
|
||||||
frame_support::construct_runtime!(
|
frame_support::construct_runtime!(
|
||||||
pub enum Test where
|
pub enum Test
|
||||||
Block = Block,
|
|
||||||
NodeBlock = Block,
|
|
||||||
UncheckedExtrinsic = UncheckedExtrinsic,
|
|
||||||
{
|
{
|
||||||
System: frame_system::{Pallet, Call, Config<T>, Storage, Event<T>},
|
System: frame_system::{Pallet, Call, Config<T>, Storage, Event<T>},
|
||||||
ParachainSystem: parachain_system::{Pallet, Call, Config<T>, Storage, Inherent, Event<T>, ValidateUnsigned},
|
ParachainSystem: parachain_system::{Pallet, Call, Config<T>, Storage, Inherent, Event<T>, ValidateUnsigned},
|
||||||
@@ -77,12 +72,11 @@ impl frame_system::Config for Test {
|
|||||||
type RuntimeOrigin = RuntimeOrigin;
|
type RuntimeOrigin = RuntimeOrigin;
|
||||||
type RuntimeCall = RuntimeCall;
|
type RuntimeCall = RuntimeCall;
|
||||||
type Index = u64;
|
type Index = u64;
|
||||||
type BlockNumber = u64;
|
|
||||||
type Hash = H256;
|
type Hash = H256;
|
||||||
type Hashing = BlakeTwo256;
|
type Hashing = BlakeTwo256;
|
||||||
type AccountId = u64;
|
type AccountId = u64;
|
||||||
type Lookup = IdentityLookup<Self::AccountId>;
|
type Lookup = IdentityLookup<Self::AccountId>;
|
||||||
type Header = Header;
|
type Block = Block;
|
||||||
type RuntimeEvent = RuntimeEvent;
|
type RuntimeEvent = RuntimeEvent;
|
||||||
type BlockHashCount = BlockHashCount;
|
type BlockHashCount = BlockHashCount;
|
||||||
type BlockLength = ();
|
type BlockLength = ();
|
||||||
@@ -212,7 +206,7 @@ fn wasm_ext() -> sp_io::TestExternalities {
|
|||||||
}
|
}
|
||||||
|
|
||||||
struct BlockTest {
|
struct BlockTest {
|
||||||
n: <Test as frame_system::Config>::BlockNumber,
|
n: BlockNumberFor<Test>,
|
||||||
within_block: Box<dyn Fn()>,
|
within_block: Box<dyn Fn()>,
|
||||||
after_block: Option<Box<dyn Fn()>>,
|
after_block: Option<Box<dyn Fn()>>,
|
||||||
}
|
}
|
||||||
@@ -243,7 +237,7 @@ impl BlockTests {
|
|||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
fn add<F>(self, n: <Test as frame_system::Config>::BlockNumber, within_block: F) -> Self
|
fn add<F>(self, n: BlockNumberFor<Test>, within_block: F) -> Self
|
||||||
where
|
where
|
||||||
F: 'static + Fn(),
|
F: 'static + Fn(),
|
||||||
{
|
{
|
||||||
@@ -252,7 +246,7 @@ impl BlockTests {
|
|||||||
|
|
||||||
fn add_with_post_test<F1, F2>(
|
fn add_with_post_test<F1, F2>(
|
||||||
self,
|
self,
|
||||||
n: <Test as frame_system::Config>::BlockNumber,
|
n: BlockNumberFor<Test>,
|
||||||
within_block: F1,
|
within_block: F1,
|
||||||
after_block: F2,
|
after_block: F2,
|
||||||
) -> Self
|
) -> Self
|
||||||
|
|||||||
@@ -115,7 +115,7 @@ pub mod pallet {
|
|||||||
|
|
||||||
#[pallet::hooks]
|
#[pallet::hooks]
|
||||||
impl<T: Config> Hooks<BlockNumberFor<T>> for Pallet<T> {
|
impl<T: Config> Hooks<BlockNumberFor<T>> for Pallet<T> {
|
||||||
fn on_idle(_now: T::BlockNumber, max_weight: Weight) -> Weight {
|
fn on_idle(_now: BlockNumberFor<T>, max_weight: Weight) -> Weight {
|
||||||
// on_idle processes additional messages with any remaining block weight.
|
// on_idle processes additional messages with any remaining block weight.
|
||||||
Self::service_xcmp_queue(max_weight)
|
Self::service_xcmp_queue(max_weight)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,7 +25,6 @@ use frame_support::{
|
|||||||
use frame_system::EnsureRoot;
|
use frame_system::EnsureRoot;
|
||||||
use sp_core::H256;
|
use sp_core::H256;
|
||||||
use sp_runtime::{
|
use sp_runtime::{
|
||||||
testing::Header,
|
|
||||||
traits::{BlakeTwo256, IdentityLookup},
|
traits::{BlakeTwo256, IdentityLookup},
|
||||||
BuildStorage,
|
BuildStorage,
|
||||||
};
|
};
|
||||||
@@ -33,15 +32,11 @@ use xcm::prelude::*;
|
|||||||
use xcm_builder::{CurrencyAdapter, FixedWeightBounds, IsConcrete, NativeAsset, ParentIsPreset};
|
use xcm_builder::{CurrencyAdapter, FixedWeightBounds, IsConcrete, NativeAsset, ParentIsPreset};
|
||||||
use xcm_executor::traits::ConvertOrigin;
|
use xcm_executor::traits::ConvertOrigin;
|
||||||
|
|
||||||
type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic<Test>;
|
|
||||||
type Block = frame_system::mocking::MockBlock<Test>;
|
type Block = frame_system::mocking::MockBlock<Test>;
|
||||||
|
|
||||||
// Configure a mock runtime to test the pallet.
|
// Configure a mock runtime to test the pallet.
|
||||||
frame_support::construct_runtime!(
|
frame_support::construct_runtime!(
|
||||||
pub enum Test where
|
pub enum Test
|
||||||
Block = Block,
|
|
||||||
NodeBlock = Block,
|
|
||||||
UncheckedExtrinsic = UncheckedExtrinsic,
|
|
||||||
{
|
{
|
||||||
System: frame_system::{Pallet, Call, Config<T>, Storage, Event<T>},
|
System: frame_system::{Pallet, Call, Config<T>, Storage, Event<T>},
|
||||||
Balances: pallet_balances::{Pallet, Call, Storage, Config<T>, Event<T>},
|
Balances: pallet_balances::{Pallet, Call, Storage, Config<T>, Event<T>},
|
||||||
@@ -67,12 +62,11 @@ impl frame_system::Config for Test {
|
|||||||
type RuntimeOrigin = RuntimeOrigin;
|
type RuntimeOrigin = RuntimeOrigin;
|
||||||
type RuntimeCall = RuntimeCall;
|
type RuntimeCall = RuntimeCall;
|
||||||
type Index = u64;
|
type Index = u64;
|
||||||
type BlockNumber = u64;
|
|
||||||
type Hash = H256;
|
type Hash = H256;
|
||||||
type Hashing = BlakeTwo256;
|
type Hashing = BlakeTwo256;
|
||||||
type AccountId = AccountId;
|
type AccountId = AccountId;
|
||||||
type Lookup = IdentityLookup<Self::AccountId>;
|
type Lookup = IdentityLookup<Self::AccountId>;
|
||||||
type Header = Header;
|
type Block = Block;
|
||||||
type RuntimeEvent = RuntimeEvent;
|
type RuntimeEvent = RuntimeEvent;
|
||||||
type BlockHashCount = BlockHashCount;
|
type BlockHashCount = BlockHashCount;
|
||||||
type Version = ();
|
type Version = ();
|
||||||
|
|||||||
@@ -2,20 +2,15 @@ use frame_support::{parameter_types, traits::Everything};
|
|||||||
use frame_system as system;
|
use frame_system as system;
|
||||||
use sp_core::H256;
|
use sp_core::H256;
|
||||||
use sp_runtime::{
|
use sp_runtime::{
|
||||||
testing::Header,
|
|
||||||
traits::{BlakeTwo256, IdentityLookup},
|
traits::{BlakeTwo256, IdentityLookup},
|
||||||
BuildStorage,
|
BuildStorage,
|
||||||
};
|
};
|
||||||
|
|
||||||
type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic<Test>;
|
|
||||||
type Block = frame_system::mocking::MockBlock<Test>;
|
type Block = frame_system::mocking::MockBlock<Test>;
|
||||||
|
|
||||||
// Configure a mock runtime to test the pallet.
|
// Configure a mock runtime to test the pallet.
|
||||||
frame_support::construct_runtime!(
|
frame_support::construct_runtime!(
|
||||||
pub enum Test where
|
pub enum Test
|
||||||
Block = Block,
|
|
||||||
NodeBlock = Block,
|
|
||||||
UncheckedExtrinsic = UncheckedExtrinsic,
|
|
||||||
{
|
{
|
||||||
System: frame_system::{Pallet, Call, Config<T>, Storage, Event<T>},
|
System: frame_system::{Pallet, Call, Config<T>, Storage, Event<T>},
|
||||||
TemplateModule: crate::{Pallet, Call, Storage, Event<T>},
|
TemplateModule: crate::{Pallet, Call, Storage, Event<T>},
|
||||||
@@ -35,12 +30,11 @@ impl system::Config for Test {
|
|||||||
type RuntimeOrigin = RuntimeOrigin;
|
type RuntimeOrigin = RuntimeOrigin;
|
||||||
type RuntimeCall = RuntimeCall;
|
type RuntimeCall = RuntimeCall;
|
||||||
type Index = u64;
|
type Index = u64;
|
||||||
type BlockNumber = u64;
|
|
||||||
type Hash = H256;
|
type Hash = H256;
|
||||||
type Hashing = BlakeTwo256;
|
type Hashing = BlakeTwo256;
|
||||||
type AccountId = u64;
|
type AccountId = u64;
|
||||||
type Lookup = IdentityLookup<Self::AccountId>;
|
type Lookup = IdentityLookup<Self::AccountId>;
|
||||||
type Header = Header;
|
type Block = Block;
|
||||||
type RuntimeEvent = RuntimeEvent;
|
type RuntimeEvent = RuntimeEvent;
|
||||||
type BlockHashCount = BlockHashCount;
|
type BlockHashCount = BlockHashCount;
|
||||||
type Version = ();
|
type Version = ();
|
||||||
|
|||||||
@@ -270,14 +270,12 @@ impl frame_system::Config for Runtime {
|
|||||||
type Lookup = AccountIdLookup<AccountId, ()>;
|
type Lookup = AccountIdLookup<AccountId, ()>;
|
||||||
/// The index type for storing how many extrinsics an account has signed.
|
/// The index type for storing how many extrinsics an account has signed.
|
||||||
type Index = Index;
|
type Index = Index;
|
||||||
/// The index type for blocks.
|
|
||||||
type BlockNumber = BlockNumber;
|
|
||||||
/// The type for hashing blocks and tries.
|
/// The type for hashing blocks and tries.
|
||||||
type Hash = Hash;
|
type Hash = Hash;
|
||||||
/// The hashing algorithm used.
|
/// The hashing algorithm used.
|
||||||
type Hashing = BlakeTwo256;
|
type Hashing = BlakeTwo256;
|
||||||
/// The header type.
|
/// The block type.
|
||||||
type Header = generic::Header<BlockNumber, BlakeTwo256>;
|
type Block = Block;
|
||||||
/// The ubiquitous event type.
|
/// The ubiquitous event type.
|
||||||
type RuntimeEvent = RuntimeEvent;
|
type RuntimeEvent = RuntimeEvent;
|
||||||
/// The ubiquitous origin type.
|
/// The ubiquitous origin type.
|
||||||
@@ -467,10 +465,7 @@ impl pallet_parachain_template::Config for Runtime {
|
|||||||
|
|
||||||
// Create the runtime by composing the FRAME pallets that were previously configured.
|
// Create the runtime by composing the FRAME pallets that were previously configured.
|
||||||
construct_runtime!(
|
construct_runtime!(
|
||||||
pub enum Runtime where
|
pub enum Runtime
|
||||||
Block = Block,
|
|
||||||
NodeBlock = opaque::Block,
|
|
||||||
UncheckedExtrinsic = UncheckedExtrinsic,
|
|
||||||
{
|
{
|
||||||
// System support stuff.
|
// System support stuff.
|
||||||
System: frame_system = 0,
|
System: frame_system = 0,
|
||||||
|
|||||||
@@ -131,21 +131,16 @@ mod tests {
|
|||||||
use polkadot_primitives::AccountId;
|
use polkadot_primitives::AccountId;
|
||||||
use sp_core::{ConstU64, H256};
|
use sp_core::{ConstU64, H256};
|
||||||
use sp_runtime::{
|
use sp_runtime::{
|
||||||
testing::Header,
|
|
||||||
traits::{BlakeTwo256, IdentityLookup},
|
traits::{BlakeTwo256, IdentityLookup},
|
||||||
BuildStorage, Perbill,
|
BuildStorage, Perbill,
|
||||||
};
|
};
|
||||||
use xcm::prelude::*;
|
use xcm::prelude::*;
|
||||||
|
|
||||||
type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic<Test>;
|
|
||||||
type Block = frame_system::mocking::MockBlock<Test>;
|
type Block = frame_system::mocking::MockBlock<Test>;
|
||||||
const TEST_ACCOUNT: AccountId = AccountId::new([1; 32]);
|
const TEST_ACCOUNT: AccountId = AccountId::new([1; 32]);
|
||||||
|
|
||||||
frame_support::construct_runtime!(
|
frame_support::construct_runtime!(
|
||||||
pub enum Test where
|
pub enum Test
|
||||||
Block = Block,
|
|
||||||
NodeBlock = Block,
|
|
||||||
UncheckedExtrinsic = UncheckedExtrinsic,
|
|
||||||
{
|
{
|
||||||
System: frame_system::{Pallet, Call, Config<T>, Storage, Event<T>},
|
System: frame_system::{Pallet, Call, Config<T>, Storage, Event<T>},
|
||||||
Balances: pallet_balances::{Pallet, Call, Storage, Config<T>, Event<T>},
|
Balances: pallet_balances::{Pallet, Call, Storage, Config<T>, Event<T>},
|
||||||
@@ -164,13 +159,12 @@ mod tests {
|
|||||||
type BaseCallFilter = frame_support::traits::Everything;
|
type BaseCallFilter = frame_support::traits::Everything;
|
||||||
type RuntimeOrigin = RuntimeOrigin;
|
type RuntimeOrigin = RuntimeOrigin;
|
||||||
type Index = u64;
|
type Index = u64;
|
||||||
type BlockNumber = u64;
|
|
||||||
type RuntimeCall = RuntimeCall;
|
type RuntimeCall = RuntimeCall;
|
||||||
type Hash = H256;
|
type Hash = H256;
|
||||||
type Hashing = BlakeTwo256;
|
type Hashing = BlakeTwo256;
|
||||||
type AccountId = AccountId;
|
type AccountId = AccountId;
|
||||||
type Lookup = IdentityLookup<Self::AccountId>;
|
type Lookup = IdentityLookup<Self::AccountId>;
|
||||||
type Header = Header;
|
type Block = Block;
|
||||||
type RuntimeEvent = RuntimeEvent;
|
type RuntimeEvent = RuntimeEvent;
|
||||||
type BlockHashCount = BlockHashCount;
|
type BlockHashCount = BlockHashCount;
|
||||||
type BlockLength = BlockLength;
|
type BlockLength = BlockLength;
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ pub mod pallet {
|
|||||||
/// The sent pings.
|
/// The sent pings.
|
||||||
#[pallet::storage]
|
#[pallet::storage]
|
||||||
pub(super) type Pings<T: Config> =
|
pub(super) type Pings<T: Config> =
|
||||||
StorageMap<_, Blake2_128Concat, u32, T::BlockNumber, OptionQuery>;
|
StorageMap<_, Blake2_128Concat, u32, BlockNumberFor<T>, OptionQuery>;
|
||||||
|
|
||||||
#[pallet::event]
|
#[pallet::event]
|
||||||
#[pallet::generate_deposit(pub(super) fn deposit_event)]
|
#[pallet::generate_deposit(pub(super) fn deposit_event)]
|
||||||
@@ -80,7 +80,7 @@ pub mod pallet {
|
|||||||
PingSent(ParaId, u32, Vec<u8>, XcmHash, MultiAssets),
|
PingSent(ParaId, u32, Vec<u8>, XcmHash, MultiAssets),
|
||||||
Pinged(ParaId, u32, Vec<u8>),
|
Pinged(ParaId, u32, Vec<u8>),
|
||||||
PongSent(ParaId, u32, Vec<u8>, XcmHash, MultiAssets),
|
PongSent(ParaId, u32, Vec<u8>, XcmHash, MultiAssets),
|
||||||
Ponged(ParaId, u32, Vec<u8>, T::BlockNumber),
|
Ponged(ParaId, u32, Vec<u8>, BlockNumberFor<T>),
|
||||||
ErrorSendingPing(SendError, ParaId, u32, Vec<u8>),
|
ErrorSendingPing(SendError, ParaId, u32, Vec<u8>),
|
||||||
ErrorSendingPong(SendError, ParaId, u32, Vec<u8>),
|
ErrorSendingPong(SendError, ParaId, u32, Vec<u8>),
|
||||||
UnknownPong(ParaId, u32, Vec<u8>),
|
UnknownPong(ParaId, u32, Vec<u8>),
|
||||||
@@ -96,7 +96,7 @@ pub mod pallet {
|
|||||||
|
|
||||||
#[pallet::hooks]
|
#[pallet::hooks]
|
||||||
impl<T: Config> Hooks<BlockNumberFor<T>> for Pallet<T> {
|
impl<T: Config> Hooks<BlockNumberFor<T>> for Pallet<T> {
|
||||||
fn on_finalize(n: T::BlockNumber) {
|
fn on_finalize(n: BlockNumberFor<T>) {
|
||||||
for (para, payload) in Targets::<T>::get().into_iter() {
|
for (para, payload) in Targets::<T>::get().into_iter() {
|
||||||
let seq = PingCount::<T>::mutate(|seq| {
|
let seq = PingCount::<T>::mutate(|seq| {
|
||||||
*seq += 1;
|
*seq += 1;
|
||||||
|
|||||||
@@ -67,8 +67,8 @@ use pallet_nfts::PalletFeatures;
|
|||||||
pub use parachains_common as common;
|
pub use parachains_common as common;
|
||||||
use parachains_common::{
|
use parachains_common::{
|
||||||
impls::{AssetsToBlockAuthor, DealWithFees},
|
impls::{AssetsToBlockAuthor, DealWithFees},
|
||||||
opaque, AccountId, AssetIdForTrustBackedAssets, AuraId, Balance, BlockNumber, Hash, Header,
|
AccountId, AssetIdForTrustBackedAssets, AuraId, Balance, BlockNumber, Hash, Header, Index,
|
||||||
Index, Signature, AVERAGE_ON_INITIALIZE_RATIO, DAYS, HOURS, MAXIMUM_BLOCK_WEIGHT,
|
Signature, AVERAGE_ON_INITIALIZE_RATIO, DAYS, HOURS, MAXIMUM_BLOCK_WEIGHT,
|
||||||
NORMAL_DISPATCH_RATIO, SLOT_DURATION,
|
NORMAL_DISPATCH_RATIO, SLOT_DURATION,
|
||||||
};
|
};
|
||||||
use xcm_config::{
|
use xcm_config::{
|
||||||
@@ -166,10 +166,9 @@ impl frame_system::Config for Runtime {
|
|||||||
type RuntimeCall = RuntimeCall;
|
type RuntimeCall = RuntimeCall;
|
||||||
type Lookup = AccountIdLookup<AccountId, ()>;
|
type Lookup = AccountIdLookup<AccountId, ()>;
|
||||||
type Index = Index;
|
type Index = Index;
|
||||||
type BlockNumber = BlockNumber;
|
|
||||||
type Hash = Hash;
|
type Hash = Hash;
|
||||||
type Hashing = BlakeTwo256;
|
type Hashing = BlakeTwo256;
|
||||||
type Header = Header;
|
type Block = Block;
|
||||||
type RuntimeEvent = RuntimeEvent;
|
type RuntimeEvent = RuntimeEvent;
|
||||||
type RuntimeOrigin = RuntimeOrigin;
|
type RuntimeOrigin = RuntimeOrigin;
|
||||||
type BlockHashCount = BlockHashCount;
|
type BlockHashCount = BlockHashCount;
|
||||||
@@ -736,10 +735,7 @@ impl pallet_nfts::Config for Runtime {
|
|||||||
|
|
||||||
// Create the runtime by composing the FRAME pallets that were previously configured.
|
// Create the runtime by composing the FRAME pallets that were previously configured.
|
||||||
construct_runtime!(
|
construct_runtime!(
|
||||||
pub enum Runtime where
|
pub enum Runtime
|
||||||
Block = Block,
|
|
||||||
NodeBlock = opaque::Block,
|
|
||||||
UncheckedExtrinsic = UncheckedExtrinsic,
|
|
||||||
{
|
{
|
||||||
// System support stuff.
|
// System support stuff.
|
||||||
System: frame_system::{Pallet, Call, Config<T>, Storage, Event<T>} = 0,
|
System: frame_system::{Pallet, Call, Config<T>, Storage, Event<T>} = 0,
|
||||||
|
|||||||
@@ -102,9 +102,9 @@ use pallet_nfts::PalletFeatures;
|
|||||||
pub use parachains_common as common;
|
pub use parachains_common as common;
|
||||||
use parachains_common::{
|
use parachains_common::{
|
||||||
impls::{AssetsToBlockAuthor, DealWithFees},
|
impls::{AssetsToBlockAuthor, DealWithFees},
|
||||||
opaque, AccountId, AssetHubPolkadotAuraId as AuraId, AssetIdForTrustBackedAssets, Balance,
|
AccountId, AssetHubPolkadotAuraId as AuraId, AssetIdForTrustBackedAssets, Balance, BlockNumber,
|
||||||
BlockNumber, Hash, Header, Index, Signature, AVERAGE_ON_INITIALIZE_RATIO, DAYS, HOURS,
|
Hash, Header, Index, Signature, AVERAGE_ON_INITIALIZE_RATIO, DAYS, HOURS, MAXIMUM_BLOCK_WEIGHT,
|
||||||
MAXIMUM_BLOCK_WEIGHT, NORMAL_DISPATCH_RATIO, SLOT_DURATION,
|
NORMAL_DISPATCH_RATIO, SLOT_DURATION,
|
||||||
};
|
};
|
||||||
use xcm_config::{
|
use xcm_config::{
|
||||||
DotLocation, FellowshipLocation, ForeignAssetsConvertedConcreteId, GovernanceLocation,
|
DotLocation, FellowshipLocation, ForeignAssetsConvertedConcreteId, GovernanceLocation,
|
||||||
@@ -184,10 +184,9 @@ impl frame_system::Config for Runtime {
|
|||||||
type RuntimeCall = RuntimeCall;
|
type RuntimeCall = RuntimeCall;
|
||||||
type Lookup = AccountIdLookup<AccountId, ()>;
|
type Lookup = AccountIdLookup<AccountId, ()>;
|
||||||
type Index = Index;
|
type Index = Index;
|
||||||
type BlockNumber = BlockNumber;
|
|
||||||
type Hash = Hash;
|
type Hash = Hash;
|
||||||
type Hashing = BlakeTwo256;
|
type Hashing = BlakeTwo256;
|
||||||
type Header = Header;
|
type Block = Block;
|
||||||
type RuntimeEvent = RuntimeEvent;
|
type RuntimeEvent = RuntimeEvent;
|
||||||
type RuntimeOrigin = RuntimeOrigin;
|
type RuntimeOrigin = RuntimeOrigin;
|
||||||
type BlockHashCount = BlockHashCount;
|
type BlockHashCount = BlockHashCount;
|
||||||
@@ -723,10 +722,7 @@ impl pallet_nfts::Config for Runtime {
|
|||||||
|
|
||||||
// Create the runtime by composing the FRAME pallets that were previously configured.
|
// Create the runtime by composing the FRAME pallets that were previously configured.
|
||||||
construct_runtime!(
|
construct_runtime!(
|
||||||
pub enum Runtime where
|
pub enum Runtime
|
||||||
Block = Block,
|
|
||||||
NodeBlock = opaque::Block,
|
|
||||||
UncheckedExtrinsic = UncheckedExtrinsic,
|
|
||||||
{
|
{
|
||||||
// System support stuff.
|
// System support stuff.
|
||||||
System: frame_system::{Pallet, Call, Config<T>, Storage, Event<T>} = 0,
|
System: frame_system::{Pallet, Call, Config<T>, Storage, Event<T>} = 0,
|
||||||
|
|||||||
@@ -52,9 +52,9 @@ use pallet_asset_conversion_tx_payment::AssetConversionAdapter;
|
|||||||
use pallet_nfts::PalletFeatures;
|
use pallet_nfts::PalletFeatures;
|
||||||
pub use parachains_common as common;
|
pub use parachains_common as common;
|
||||||
use parachains_common::{
|
use parachains_common::{
|
||||||
impls::DealWithFees, opaque, AccountId, AssetIdForTrustBackedAssets, AuraId, Balance,
|
impls::DealWithFees, AccountId, AssetIdForTrustBackedAssets, AuraId, Balance, BlockNumber,
|
||||||
BlockNumber, Hash, Header, Index, Signature, AVERAGE_ON_INITIALIZE_RATIO, DAYS, HOURS,
|
Hash, Header, Index, Signature, AVERAGE_ON_INITIALIZE_RATIO, DAYS, HOURS, MAXIMUM_BLOCK_WEIGHT,
|
||||||
MAXIMUM_BLOCK_WEIGHT, NORMAL_DISPATCH_RATIO, SLOT_DURATION,
|
NORMAL_DISPATCH_RATIO, SLOT_DURATION,
|
||||||
};
|
};
|
||||||
use sp_api::impl_runtime_apis;
|
use sp_api::impl_runtime_apis;
|
||||||
use sp_core::{crypto::KeyTypeId, OpaqueMetadata};
|
use sp_core::{crypto::KeyTypeId, OpaqueMetadata};
|
||||||
@@ -148,10 +148,9 @@ impl frame_system::Config for Runtime {
|
|||||||
type RuntimeCall = RuntimeCall;
|
type RuntimeCall = RuntimeCall;
|
||||||
type Lookup = AccountIdLookup<AccountId, ()>;
|
type Lookup = AccountIdLookup<AccountId, ()>;
|
||||||
type Index = Index;
|
type Index = Index;
|
||||||
type BlockNumber = BlockNumber;
|
|
||||||
type Hash = Hash;
|
type Hash = Hash;
|
||||||
type Hashing = BlakeTwo256;
|
type Hashing = BlakeTwo256;
|
||||||
type Header = Header;
|
type Block = Block;
|
||||||
type RuntimeEvent = RuntimeEvent;
|
type RuntimeEvent = RuntimeEvent;
|
||||||
type RuntimeOrigin = RuntimeOrigin;
|
type RuntimeOrigin = RuntimeOrigin;
|
||||||
type BlockHashCount = BlockHashCount;
|
type BlockHashCount = BlockHashCount;
|
||||||
@@ -761,10 +760,7 @@ impl pallet_nfts::Config for Runtime {
|
|||||||
|
|
||||||
// Create the runtime by composing the FRAME pallets that were previously configured.
|
// Create the runtime by composing the FRAME pallets that were previously configured.
|
||||||
construct_runtime!(
|
construct_runtime!(
|
||||||
pub enum Runtime where
|
pub enum Runtime
|
||||||
Block = Block,
|
|
||||||
NodeBlock = opaque::Block,
|
|
||||||
UncheckedExtrinsic = UncheckedExtrinsic,
|
|
||||||
{
|
{
|
||||||
// System support stuff.
|
// System support stuff.
|
||||||
System: frame_system::{Pallet, Call, Config<T>, Storage, Event<T>} = 0,
|
System: frame_system::{Pallet, Call, Config<T>, Storage, Event<T>} = 0,
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ use polkadot_runtime_common::{BlockHashCount, SlowAdjustingFeeUpdate};
|
|||||||
use weights::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight};
|
use weights::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight};
|
||||||
|
|
||||||
use parachains_common::{
|
use parachains_common::{
|
||||||
impls::DealWithFees, opaque, AccountId, Balance, BlockNumber, Hash, Header, Index, Signature,
|
impls::DealWithFees, AccountId, Balance, BlockNumber, Hash, Header, Index, Signature,
|
||||||
AVERAGE_ON_INITIALIZE_RATIO, HOURS, MAXIMUM_BLOCK_WEIGHT, NORMAL_DISPATCH_RATIO, SLOT_DURATION,
|
AVERAGE_ON_INITIALIZE_RATIO, HOURS, MAXIMUM_BLOCK_WEIGHT, NORMAL_DISPATCH_RATIO, SLOT_DURATION,
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -181,14 +181,12 @@ impl frame_system::Config for Runtime {
|
|||||||
type Lookup = AccountIdLookup<AccountId, ()>;
|
type Lookup = AccountIdLookup<AccountId, ()>;
|
||||||
/// The index type for storing how many extrinsics an account has signed.
|
/// The index type for storing how many extrinsics an account has signed.
|
||||||
type Index = Index;
|
type Index = Index;
|
||||||
/// The index type for blocks.
|
|
||||||
type BlockNumber = BlockNumber;
|
|
||||||
/// The type for hashing blocks and tries.
|
/// The type for hashing blocks and tries.
|
||||||
type Hash = Hash;
|
type Hash = Hash;
|
||||||
/// The hashing algorithm used.
|
/// The hashing algorithm used.
|
||||||
type Hashing = BlakeTwo256;
|
type Hashing = BlakeTwo256;
|
||||||
/// The header type.
|
/// The block type.
|
||||||
type Header = generic::Header<BlockNumber, BlakeTwo256>;
|
type Block = Block;
|
||||||
/// The ubiquitous event type.
|
/// The ubiquitous event type.
|
||||||
type RuntimeEvent = RuntimeEvent;
|
type RuntimeEvent = RuntimeEvent;
|
||||||
/// The ubiquitous origin type.
|
/// The ubiquitous origin type.
|
||||||
@@ -400,10 +398,7 @@ impl pallet_utility::Config for Runtime {
|
|||||||
|
|
||||||
// Create the runtime by composing the FRAME pallets that were previously configured.
|
// Create the runtime by composing the FRAME pallets that were previously configured.
|
||||||
construct_runtime!(
|
construct_runtime!(
|
||||||
pub enum Runtime where
|
pub enum Runtime
|
||||||
Block = Block,
|
|
||||||
NodeBlock = opaque::Block,
|
|
||||||
UncheckedExtrinsic = UncheckedExtrinsic,
|
|
||||||
{
|
{
|
||||||
// System support stuff.
|
// System support stuff.
|
||||||
System: frame_system::{Pallet, Call, Config<T>, Storage, Event<T>} = 0,
|
System: frame_system::{Pallet, Call, Config<T>, Storage, Event<T>} = 0,
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ use polkadot_runtime_common::{BlockHashCount, SlowAdjustingFeeUpdate};
|
|||||||
use weights::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight};
|
use weights::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight};
|
||||||
|
|
||||||
use parachains_common::{
|
use parachains_common::{
|
||||||
impls::DealWithFees, opaque, AccountId, Balance, BlockNumber, Hash, Header, Index, Signature,
|
impls::DealWithFees, AccountId, Balance, BlockNumber, Hash, Header, Index, Signature,
|
||||||
AVERAGE_ON_INITIALIZE_RATIO, HOURS, MAXIMUM_BLOCK_WEIGHT, NORMAL_DISPATCH_RATIO, SLOT_DURATION,
|
AVERAGE_ON_INITIALIZE_RATIO, HOURS, MAXIMUM_BLOCK_WEIGHT, NORMAL_DISPATCH_RATIO, SLOT_DURATION,
|
||||||
};
|
};
|
||||||
// XCM Imports
|
// XCM Imports
|
||||||
@@ -181,14 +181,12 @@ impl frame_system::Config for Runtime {
|
|||||||
type Lookup = AccountIdLookup<AccountId, ()>;
|
type Lookup = AccountIdLookup<AccountId, ()>;
|
||||||
/// The index type for storing how many extrinsics an account has signed.
|
/// The index type for storing how many extrinsics an account has signed.
|
||||||
type Index = Index;
|
type Index = Index;
|
||||||
/// The index type for blocks.
|
|
||||||
type BlockNumber = BlockNumber;
|
|
||||||
/// The type for hashing blocks and tries.
|
/// The type for hashing blocks and tries.
|
||||||
type Hash = Hash;
|
type Hash = Hash;
|
||||||
/// The hashing algorithm used.
|
/// The hashing algorithm used.
|
||||||
type Hashing = BlakeTwo256;
|
type Hashing = BlakeTwo256;
|
||||||
/// The header type.
|
/// The block type.
|
||||||
type Header = generic::Header<BlockNumber, BlakeTwo256>;
|
type Block = Block;
|
||||||
/// The ubiquitous event type.
|
/// The ubiquitous event type.
|
||||||
type RuntimeEvent = RuntimeEvent;
|
type RuntimeEvent = RuntimeEvent;
|
||||||
/// The ubiquitous origin type.
|
/// The ubiquitous origin type.
|
||||||
@@ -400,10 +398,7 @@ impl pallet_utility::Config for Runtime {
|
|||||||
|
|
||||||
// Create the runtime by composing the FRAME pallets that were previously configured.
|
// Create the runtime by composing the FRAME pallets that were previously configured.
|
||||||
construct_runtime!(
|
construct_runtime!(
|
||||||
pub enum Runtime where
|
pub enum Runtime
|
||||||
Block = Block,
|
|
||||||
NodeBlock = opaque::Block,
|
|
||||||
UncheckedExtrinsic = UncheckedExtrinsic,
|
|
||||||
{
|
{
|
||||||
// System support stuff.
|
// System support stuff.
|
||||||
System: frame_system::{Pallet, Call, Config<T>, Storage, Event<T>} = 0,
|
System: frame_system::{Pallet, Call, Config<T>, Storage, Event<T>} = 0,
|
||||||
|
|||||||
@@ -87,7 +87,7 @@ use bridge_runtime_common::{
|
|||||||
messages_xcm_extension::{XcmAsPlainPayload, XcmBlobMessageDispatch},
|
messages_xcm_extension::{XcmAsPlainPayload, XcmBlobMessageDispatch},
|
||||||
};
|
};
|
||||||
use parachains_common::{
|
use parachains_common::{
|
||||||
impls::DealWithFees, opaque, AccountId, Balance, BlockNumber, Hash, Header, Index, Signature,
|
impls::DealWithFees, AccountId, Balance, BlockNumber, Hash, Header, Index, Signature,
|
||||||
AVERAGE_ON_INITIALIZE_RATIO, HOURS, MAXIMUM_BLOCK_WEIGHT, NORMAL_DISPATCH_RATIO, SLOT_DURATION,
|
AVERAGE_ON_INITIALIZE_RATIO, HOURS, MAXIMUM_BLOCK_WEIGHT, NORMAL_DISPATCH_RATIO, SLOT_DURATION,
|
||||||
};
|
};
|
||||||
use xcm_executor::XcmExecutor;
|
use xcm_executor::XcmExecutor;
|
||||||
@@ -195,14 +195,12 @@ impl frame_system::Config for Runtime {
|
|||||||
type Lookup = AccountIdLookup<AccountId, ()>;
|
type Lookup = AccountIdLookup<AccountId, ()>;
|
||||||
/// The index type for storing how many extrinsics an account has signed.
|
/// The index type for storing how many extrinsics an account has signed.
|
||||||
type Index = Index;
|
type Index = Index;
|
||||||
/// The index type for blocks.
|
|
||||||
type BlockNumber = BlockNumber;
|
|
||||||
/// The type for hashing blocks and tries.
|
/// The type for hashing blocks and tries.
|
||||||
type Hash = Hash;
|
type Hash = Hash;
|
||||||
/// The hashing algorithm used.
|
/// The hashing algorithm used.
|
||||||
type Hashing = BlakeTwo256;
|
type Hashing = BlakeTwo256;
|
||||||
/// The header type.
|
/// The block type.
|
||||||
type Header = generic::Header<BlockNumber, BlakeTwo256>;
|
type Block = Block;
|
||||||
/// The ubiquitous event type.
|
/// The ubiquitous event type.
|
||||||
type RuntimeEvent = RuntimeEvent;
|
type RuntimeEvent = RuntimeEvent;
|
||||||
/// The ubiquitous origin type.
|
/// The ubiquitous origin type.
|
||||||
@@ -545,10 +543,7 @@ impl pallet_bridge_relayers::Config for Runtime {
|
|||||||
|
|
||||||
// Create the runtime by composing the FRAME pallets that were previously configured.
|
// Create the runtime by composing the FRAME pallets that were previously configured.
|
||||||
construct_runtime!(
|
construct_runtime!(
|
||||||
pub enum Runtime where
|
pub enum Runtime
|
||||||
Block = Block,
|
|
||||||
NodeBlock = opaque::Block,
|
|
||||||
UncheckedExtrinsic = UncheckedExtrinsic,
|
|
||||||
{
|
{
|
||||||
// System support stuff.
|
// System support stuff.
|
||||||
System: frame_system::{Pallet, Call, Config<T>, Storage, Event<T>} = 0,
|
System: frame_system::{Pallet, Call, Config<T>, Storage, Event<T>} = 0,
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ use bridge_hub_rococo_runtime::{
|
|||||||
};
|
};
|
||||||
use codec::{Decode, Encode};
|
use codec::{Decode, Encode};
|
||||||
use frame_support::parameter_types;
|
use frame_support::parameter_types;
|
||||||
|
use frame_system::pallet_prelude::HeaderFor;
|
||||||
use parachains_common::{AccountId, AuraId, Balance};
|
use parachains_common::{AccountId, AuraId, Balance};
|
||||||
use sp_keyring::AccountKeyring::Alice;
|
use sp_keyring::AccountKeyring::Alice;
|
||||||
use sp_runtime::{
|
use sp_runtime::{
|
||||||
@@ -81,7 +82,7 @@ fn construct_and_apply_extrinsic(
|
|||||||
r.unwrap()
|
r.unwrap()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn executive_init_block(header: &<Runtime as frame_system::Config>::Header) {
|
fn executive_init_block(header: &HeaderFor<Runtime>) {
|
||||||
Executive::initialize_block(header)
|
Executive::initialize_block(header)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ use frame_support::{
|
|||||||
assert_ok,
|
assert_ok,
|
||||||
traits::{Get, OriginTrait, PalletInfoAccess},
|
traits::{Get, OriginTrait, PalletInfoAccess},
|
||||||
};
|
};
|
||||||
|
use frame_system::pallet_prelude::{BlockNumberFor, HeaderFor};
|
||||||
use pallet_bridge_grandpa::BridgedHeader;
|
use pallet_bridge_grandpa::BridgedHeader;
|
||||||
use parachains_runtimes_test_utils::{
|
use parachains_runtimes_test_utils::{
|
||||||
mock_open_hrmp_channel, AccountIdOf, BalanceOf, CollatorSessionKeys, ExtBuilder, RuntimeHelper,
|
mock_open_hrmp_channel, AccountIdOf, BalanceOf, CollatorSessionKeys, ExtBuilder, RuntimeHelper,
|
||||||
@@ -590,7 +591,7 @@ pub fn complex_relay_extrinsic_works<Runtime, XcmConfig, HrmpChannelOpener, GPI,
|
|||||||
local_relay_chain_id: NetworkId,
|
local_relay_chain_id: NetworkId,
|
||||||
lane_id: LaneId,
|
lane_id: LaneId,
|
||||||
existential_deposit: BalanceOf<Runtime>,
|
existential_deposit: BalanceOf<Runtime>,
|
||||||
executive_init_block: fn(&<Runtime as frame_system::Config>::Header),
|
executive_init_block: fn(&HeaderFor<Runtime>),
|
||||||
construct_and_apply_extrinsic: fn(
|
construct_and_apply_extrinsic: fn(
|
||||||
sp_keyring::AccountKeyring,
|
sp_keyring::AccountKeyring,
|
||||||
pallet_utility::Call::<Runtime>
|
pallet_utility::Call::<Runtime>
|
||||||
@@ -653,10 +654,9 @@ pub fn complex_relay_extrinsic_works<Runtime, XcmConfig, HrmpChannelOpener, GPI,
|
|||||||
.with_tracing()
|
.with_tracing()
|
||||||
.build()
|
.build()
|
||||||
.execute_with(|| {
|
.execute_with(|| {
|
||||||
let zero: <Runtime as frame_system::Config>::BlockNumber = 0u32.into();
|
let zero: BlockNumberFor<Runtime> = 0u32.into();
|
||||||
let genesis_hash = frame_system::Pallet::<Runtime>::block_hash(zero);
|
let genesis_hash = frame_system::Pallet::<Runtime>::block_hash(zero);
|
||||||
let mut header: <Runtime as frame_system::Config>::Header =
|
let mut header: HeaderFor<Runtime> = bp_test_utils::test_header(1u32.into());
|
||||||
bp_test_utils::test_header(1u32.into());
|
|
||||||
header.set_parent_hash(genesis_hash);
|
header.set_parent_hash(genesis_hash);
|
||||||
executive_init_block(&header);
|
executive_init_block(&header);
|
||||||
|
|
||||||
|
|||||||
@@ -80,9 +80,9 @@ use frame_system::{
|
|||||||
};
|
};
|
||||||
pub use parachains_common as common;
|
pub use parachains_common as common;
|
||||||
use parachains_common::{
|
use parachains_common::{
|
||||||
impls::DealWithFees, opaque, AccountId, AuraId, Balance, BlockNumber, Hash, Header, Index,
|
impls::DealWithFees, AccountId, AuraId, Balance, BlockNumber, Hash, Header, Index, Signature,
|
||||||
Signature, AVERAGE_ON_INITIALIZE_RATIO, DAYS, HOURS, MAXIMUM_BLOCK_WEIGHT, MINUTES,
|
AVERAGE_ON_INITIALIZE_RATIO, DAYS, HOURS, MAXIMUM_BLOCK_WEIGHT, MINUTES, NORMAL_DISPATCH_RATIO,
|
||||||
NORMAL_DISPATCH_RATIO, SLOT_DURATION,
|
SLOT_DURATION,
|
||||||
};
|
};
|
||||||
use xcm_config::{GovernanceLocation, XcmConfig, XcmOriginToTransactDispatchOrigin};
|
use xcm_config::{GovernanceLocation, XcmConfig, XcmOriginToTransactDispatchOrigin};
|
||||||
|
|
||||||
@@ -160,10 +160,9 @@ impl frame_system::Config for Runtime {
|
|||||||
type RuntimeCall = RuntimeCall;
|
type RuntimeCall = RuntimeCall;
|
||||||
type Lookup = AccountIdLookup<AccountId, ()>;
|
type Lookup = AccountIdLookup<AccountId, ()>;
|
||||||
type Index = Index;
|
type Index = Index;
|
||||||
type BlockNumber = BlockNumber;
|
|
||||||
type Hash = Hash;
|
type Hash = Hash;
|
||||||
type Hashing = BlakeTwo256;
|
type Hashing = BlakeTwo256;
|
||||||
type Header = Header;
|
type Block = Block;
|
||||||
type RuntimeEvent = RuntimeEvent;
|
type RuntimeEvent = RuntimeEvent;
|
||||||
type RuntimeOrigin = RuntimeOrigin;
|
type RuntimeOrigin = RuntimeOrigin;
|
||||||
type BlockHashCount = BlockHashCount;
|
type BlockHashCount = BlockHashCount;
|
||||||
@@ -551,10 +550,7 @@ impl pallet_preimage::Config for Runtime {
|
|||||||
|
|
||||||
// Create the runtime by composing the FRAME pallets that were previously configured.
|
// Create the runtime by composing the FRAME pallets that were previously configured.
|
||||||
construct_runtime!(
|
construct_runtime!(
|
||||||
pub enum Runtime where
|
pub enum Runtime
|
||||||
Block = Block,
|
|
||||||
NodeBlock = opaque::Block,
|
|
||||||
UncheckedExtrinsic = UncheckedExtrinsic,
|
|
||||||
{
|
{
|
||||||
// System support stuff.
|
// System support stuff.
|
||||||
System: frame_system::{Pallet, Call, Config<T>, Storage, Event<T>} = 0,
|
System: frame_system::{Pallet, Call, Config<T>, Storage, Event<T>} = 0,
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ use frame_support::{
|
|||||||
use frame_system::limits::{BlockLength, BlockWeights};
|
use frame_system::limits::{BlockLength, BlockWeights};
|
||||||
pub use parachains_common as common;
|
pub use parachains_common as common;
|
||||||
use parachains_common::{
|
use parachains_common::{
|
||||||
impls::DealWithFees, opaque, AccountId, BlockNumber, Hash, Header, Index, Signature,
|
impls::DealWithFees, AccountId, BlockNumber, Hash, Header, Index, Signature,
|
||||||
AVERAGE_ON_INITIALIZE_RATIO, MAXIMUM_BLOCK_WEIGHT, MINUTES, NORMAL_DISPATCH_RATIO,
|
AVERAGE_ON_INITIALIZE_RATIO, MAXIMUM_BLOCK_WEIGHT, MINUTES, NORMAL_DISPATCH_RATIO,
|
||||||
SLOT_DURATION,
|
SLOT_DURATION,
|
||||||
};
|
};
|
||||||
@@ -175,10 +175,9 @@ impl frame_system::Config for Runtime {
|
|||||||
type RuntimeCall = RuntimeCall;
|
type RuntimeCall = RuntimeCall;
|
||||||
type Lookup = AccountIdLookup<AccountId, ()>;
|
type Lookup = AccountIdLookup<AccountId, ()>;
|
||||||
type Index = Index;
|
type Index = Index;
|
||||||
type BlockNumber = BlockNumber;
|
|
||||||
type Hash = Hash;
|
type Hash = Hash;
|
||||||
type Hashing = BlakeTwo256;
|
type Hashing = BlakeTwo256;
|
||||||
type Header = Header;
|
type Block = Block;
|
||||||
type RuntimeEvent = RuntimeEvent;
|
type RuntimeEvent = RuntimeEvent;
|
||||||
type RuntimeOrigin = RuntimeOrigin;
|
type RuntimeOrigin = RuntimeOrigin;
|
||||||
type BlockHashCount = BlockHashCount;
|
type BlockHashCount = BlockHashCount;
|
||||||
@@ -337,10 +336,7 @@ impl pallet_sudo::Config for Runtime {
|
|||||||
|
|
||||||
// Create the runtime by composing the FRAME pallets that were previously configured.
|
// Create the runtime by composing the FRAME pallets that were previously configured.
|
||||||
construct_runtime!(
|
construct_runtime!(
|
||||||
pub enum Runtime where
|
pub enum Runtime
|
||||||
Block = Block,
|
|
||||||
NodeBlock = opaque::Block,
|
|
||||||
UncheckedExtrinsic = UncheckedExtrinsic,
|
|
||||||
{
|
{
|
||||||
// System support stuff.
|
// System support stuff.
|
||||||
System: frame_system::{Pallet, Call, Config<T>, Storage, Event<T>} = 0,
|
System: frame_system::{Pallet, Call, Config<T>, Storage, Event<T>} = 0,
|
||||||
|
|||||||
@@ -143,10 +143,9 @@ impl frame_system::Config for Runtime {
|
|||||||
type RuntimeCall = RuntimeCall;
|
type RuntimeCall = RuntimeCall;
|
||||||
type Lookup = AccountIdLookup<AccountId, ()>;
|
type Lookup = AccountIdLookup<AccountId, ()>;
|
||||||
type Index = Index;
|
type Index = Index;
|
||||||
type BlockNumber = BlockNumber;
|
|
||||||
type Hash = Hash;
|
type Hash = Hash;
|
||||||
type Hashing = BlakeTwo256;
|
type Hashing = BlakeTwo256;
|
||||||
type Header = generic::Header<BlockNumber, BlakeTwo256>;
|
type Block = Block;
|
||||||
type RuntimeEvent = RuntimeEvent;
|
type RuntimeEvent = RuntimeEvent;
|
||||||
type RuntimeOrigin = RuntimeOrigin;
|
type RuntimeOrigin = RuntimeOrigin;
|
||||||
type BlockHashCount = BlockHashCount;
|
type BlockHashCount = BlockHashCount;
|
||||||
@@ -197,10 +196,7 @@ impl pallet_sudo::Config for Runtime {
|
|||||||
}
|
}
|
||||||
|
|
||||||
construct_runtime! {
|
construct_runtime! {
|
||||||
pub enum Runtime where
|
pub enum Runtime
|
||||||
Block = Block,
|
|
||||||
NodeBlock = generic::Block<Header, sp_runtime::OpaqueExtrinsic>,
|
|
||||||
UncheckedExtrinsic = UncheckedExtrinsic,
|
|
||||||
{
|
{
|
||||||
System: frame_system::{Pallet, Call, Storage, Config<T>, Event<T>} = 0,
|
System: frame_system::{Pallet, Call, Storage, Config<T>, Event<T>} = 0,
|
||||||
ParachainSystem: cumulus_pallet_parachain_system::{
|
ParachainSystem: cumulus_pallet_parachain_system::{
|
||||||
|
|||||||
@@ -126,14 +126,12 @@ impl frame_system::Config for Runtime {
|
|||||||
type Lookup = AccountIdLookup<AccountId, ()>;
|
type Lookup = AccountIdLookup<AccountId, ()>;
|
||||||
/// The index type for storing how many extrinsics an account has signed.
|
/// The index type for storing how many extrinsics an account has signed.
|
||||||
type Index = Index;
|
type Index = Index;
|
||||||
/// The index type for blocks.
|
|
||||||
type BlockNumber = BlockNumber;
|
|
||||||
/// The type for hashing blocks and tries.
|
/// The type for hashing blocks and tries.
|
||||||
type Hash = Hash;
|
type Hash = Hash;
|
||||||
/// The hashing algorithm used.
|
/// The hashing algorithm used.
|
||||||
type Hashing = BlakeTwo256;
|
type Hashing = BlakeTwo256;
|
||||||
/// The header type.
|
/// The block type.
|
||||||
type Header = generic::Header<BlockNumber, BlakeTwo256>;
|
type Block = Block;
|
||||||
/// The ubiquitous event type.
|
/// The ubiquitous event type.
|
||||||
type RuntimeEvent = RuntimeEvent;
|
type RuntimeEvent = RuntimeEvent;
|
||||||
/// The ubiquitous origin type.
|
/// The ubiquitous origin type.
|
||||||
@@ -182,10 +180,7 @@ impl cumulus_pallet_parachain_system::Config for Runtime {
|
|||||||
impl parachain_info::Config for Runtime {}
|
impl parachain_info::Config for Runtime {}
|
||||||
|
|
||||||
construct_runtime! {
|
construct_runtime! {
|
||||||
pub enum Runtime where
|
pub enum Runtime
|
||||||
Block = Block,
|
|
||||||
NodeBlock = generic::Block<Header, sp_runtime::OpaqueExtrinsic>,
|
|
||||||
UncheckedExtrinsic = UncheckedExtrinsic,
|
|
||||||
{
|
{
|
||||||
System: frame_system::{Pallet, Call, Storage, Config<T>, Event<T>},
|
System: frame_system::{Pallet, Call, Storage, Config<T>, Event<T>},
|
||||||
Sudo: pallet_sudo::{Pallet, Call, Storage, Config<T>, Event<T>},
|
Sudo: pallet_sudo::{Pallet, Call, Storage, Config<T>, Event<T>},
|
||||||
|
|||||||
@@ -134,14 +134,12 @@ impl frame_system::Config for Runtime {
|
|||||||
type Lookup = AccountIdLookup<AccountId, ()>;
|
type Lookup = AccountIdLookup<AccountId, ()>;
|
||||||
/// The index type for storing how many extrinsics an account has signed.
|
/// The index type for storing how many extrinsics an account has signed.
|
||||||
type Index = Index;
|
type Index = Index;
|
||||||
/// The index type for blocks.
|
|
||||||
type BlockNumber = BlockNumber;
|
|
||||||
/// The type for hashing blocks and tries.
|
/// The type for hashing blocks and tries.
|
||||||
type Hash = Hash;
|
type Hash = Hash;
|
||||||
/// The hashing algorithm used.
|
/// The hashing algorithm used.
|
||||||
type Hashing = BlakeTwo256;
|
type Hashing = BlakeTwo256;
|
||||||
/// The header type.
|
/// The block type.
|
||||||
type Header = generic::Header<BlockNumber, BlakeTwo256>;
|
type Block = Block;
|
||||||
/// The ubiquitous event type.
|
/// The ubiquitous event type.
|
||||||
type RuntimeEvent = RuntimeEvent;
|
type RuntimeEvent = RuntimeEvent;
|
||||||
/// The ubiquitous origin type.
|
/// The ubiquitous origin type.
|
||||||
@@ -185,10 +183,7 @@ impl cumulus_pallet_parachain_system::Config for Runtime {
|
|||||||
impl parachain_info::Config for Runtime {}
|
impl parachain_info::Config for Runtime {}
|
||||||
|
|
||||||
construct_runtime! {
|
construct_runtime! {
|
||||||
pub enum Runtime where
|
pub enum Runtime
|
||||||
Block = Block,
|
|
||||||
NodeBlock = generic::Block<Header, sp_runtime::OpaqueExtrinsic>,
|
|
||||||
UncheckedExtrinsic = UncheckedExtrinsic,
|
|
||||||
{
|
{
|
||||||
System: frame_system::{Pallet, Call, Storage, Config<T>, Event<T>},
|
System: frame_system::{Pallet, Call, Storage, Config<T>, Event<T>},
|
||||||
ParachainSystem: cumulus_pallet_parachain_system::{
|
ParachainSystem: cumulus_pallet_parachain_system::{
|
||||||
|
|||||||
@@ -318,14 +318,12 @@ impl frame_system::Config for Runtime {
|
|||||||
type Lookup = AccountIdLookup<AccountId, ()>;
|
type Lookup = AccountIdLookup<AccountId, ()>;
|
||||||
/// The index type for storing how many extrinsics an account has signed.
|
/// The index type for storing how many extrinsics an account has signed.
|
||||||
type Index = Index;
|
type Index = Index;
|
||||||
/// The index type for blocks.
|
|
||||||
type BlockNumber = BlockNumber;
|
|
||||||
/// The type for hashing blocks and tries.
|
/// The type for hashing blocks and tries.
|
||||||
type Hash = Hash;
|
type Hash = Hash;
|
||||||
/// The hashing algorithm used.
|
/// The hashing algorithm used.
|
||||||
type Hashing = BlakeTwo256;
|
type Hashing = BlakeTwo256;
|
||||||
/// The header type.
|
/// The block type.
|
||||||
type Header = generic::Header<BlockNumber, BlakeTwo256>;
|
type Block = Block;
|
||||||
/// The ubiquitous event type.
|
/// The ubiquitous event type.
|
||||||
type RuntimeEvent = RuntimeEvent;
|
type RuntimeEvent = RuntimeEvent;
|
||||||
/// The ubiquitous origin type.
|
/// The ubiquitous origin type.
|
||||||
@@ -551,10 +549,7 @@ impl pallet_sudo::Config for Runtime {
|
|||||||
|
|
||||||
// Create the runtime by composing the FRAME pallets that were previously configured.
|
// Create the runtime by composing the FRAME pallets that were previously configured.
|
||||||
construct_runtime!(
|
construct_runtime!(
|
||||||
pub enum Runtime where
|
pub enum Runtime
|
||||||
Block = Block,
|
|
||||||
NodeBlock = opaque::Block,
|
|
||||||
UncheckedExtrinsic = UncheckedExtrinsic,
|
|
||||||
{
|
{
|
||||||
// System support stuff.
|
// System support stuff.
|
||||||
System: frame_system::{Pallet, Call, Config<T>, Storage, Event<T>} = 0,
|
System: frame_system::{Pallet, Call, Config<T>, Storage, Event<T>} = 0,
|
||||||
|
|||||||
@@ -179,14 +179,12 @@ impl frame_system::Config for Runtime {
|
|||||||
type Lookup = AccountIdLookup<AccountId, ()>;
|
type Lookup = AccountIdLookup<AccountId, ()>;
|
||||||
/// The index type for storing how many extrinsics an account has signed.
|
/// The index type for storing how many extrinsics an account has signed.
|
||||||
type Index = Index;
|
type Index = Index;
|
||||||
/// The index type for blocks.
|
|
||||||
type BlockNumber = BlockNumber;
|
|
||||||
/// The type for hashing blocks and tries.
|
/// The type for hashing blocks and tries.
|
||||||
type Hash = Hash;
|
type Hash = Hash;
|
||||||
/// The hashing algorithm used.
|
/// The hashing algorithm used.
|
||||||
type Hashing = BlakeTwo256;
|
type Hashing = BlakeTwo256;
|
||||||
/// The header type.
|
/// The block type.
|
||||||
type Header = generic::Header<BlockNumber, BlakeTwo256>;
|
type Block = Block;
|
||||||
/// The ubiquitous event type.
|
/// The ubiquitous event type.
|
||||||
type RuntimeEvent = RuntimeEvent;
|
type RuntimeEvent = RuntimeEvent;
|
||||||
/// The ubiquitous origin type.
|
/// The ubiquitous origin type.
|
||||||
@@ -558,10 +556,7 @@ impl pallet_aura::Config for Runtime {
|
|||||||
}
|
}
|
||||||
|
|
||||||
construct_runtime! {
|
construct_runtime! {
|
||||||
pub enum Runtime where
|
pub enum Runtime
|
||||||
Block = Block,
|
|
||||||
NodeBlock = generic::Block<Header, sp_runtime::OpaqueExtrinsic>,
|
|
||||||
UncheckedExtrinsic = UncheckedExtrinsic,
|
|
||||||
{
|
{
|
||||||
System: frame_system::{Pallet, Call, Storage, Config<T>, Event<T>},
|
System: frame_system::{Pallet, Call, Storage, Config<T>, Event<T>},
|
||||||
Timestamp: pallet_timestamp::{Pallet, Call, Storage, Inherent},
|
Timestamp: pallet_timestamp::{Pallet, Call, Storage, Inherent},
|
||||||
|
|||||||
@@ -186,14 +186,12 @@ impl frame_system::Config for Runtime {
|
|||||||
type Lookup = IdentityLookup<AccountId>;
|
type Lookup = IdentityLookup<AccountId>;
|
||||||
/// The index type for storing how many extrinsics an account has signed.
|
/// The index type for storing how many extrinsics an account has signed.
|
||||||
type Index = Index;
|
type Index = Index;
|
||||||
/// The index type for blocks.
|
|
||||||
type BlockNumber = BlockNumber;
|
|
||||||
/// The type for hashing blocks and tries.
|
/// The type for hashing blocks and tries.
|
||||||
type Hash = Hash;
|
type Hash = Hash;
|
||||||
/// The hashing algorithm used.
|
/// The hashing algorithm used.
|
||||||
type Hashing = BlakeTwo256;
|
type Hashing = BlakeTwo256;
|
||||||
/// The header type.
|
/// The block type.
|
||||||
type Header = generic::Header<BlockNumber, BlakeTwo256>;
|
type Block = Block;
|
||||||
/// The ubiquitous event type.
|
/// The ubiquitous event type.
|
||||||
type RuntimeEvent = RuntimeEvent;
|
type RuntimeEvent = RuntimeEvent;
|
||||||
/// The ubiquitous origin type.
|
/// The ubiquitous origin type.
|
||||||
@@ -294,10 +292,7 @@ parameter_types! {
|
|||||||
impl test_pallet::Config for Runtime {}
|
impl test_pallet::Config for Runtime {}
|
||||||
|
|
||||||
construct_runtime! {
|
construct_runtime! {
|
||||||
pub enum Runtime where
|
pub enum Runtime
|
||||||
Block = Block,
|
|
||||||
NodeBlock = NodeBlock,
|
|
||||||
UncheckedExtrinsic = UncheckedExtrinsic,
|
|
||||||
{
|
{
|
||||||
System: frame_system,
|
System: frame_system,
|
||||||
ParachainSystem: cumulus_pallet_parachain_system,
|
ParachainSystem: cumulus_pallet_parachain_system,
|
||||||
|
|||||||
Reference in New Issue
Block a user