mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 10:31:03 +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:
@@ -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
|
||||
// configuration is used), or something has broke existing configuration (meaning that all bridged chains
|
||||
// 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;
|
||||
|
||||
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>::Hashing, bp_runtime::HasherOf<$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;
|
||||
/// Runtime call origin at `ThisChain`.
|
||||
pub type ThisChainCallOrigin = RuntimeOrigin;
|
||||
/// Header of `ThisChain`.
|
||||
pub type ThisChainHeader = sp_runtime::generic::Header<ThisChainBlockNumber, ThisChainHasher>;
|
||||
/// Block of `ThisChain`.
|
||||
pub type ThisChainBlock = frame_system::mocking::MockBlock<TestRuntime>;
|
||||
/// Unchecked extrinsic of `ThisChain`.
|
||||
pub type ThisChainUncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic<TestRuntime>;
|
||||
// Block of `ThisChain`.
|
||||
pub type ThisChainBlock = frame_system::mocking::MockBlockU32<TestRuntime>;
|
||||
|
||||
/// Account identifier at the `BridgedChain`.
|
||||
pub type BridgedChainAccountId = u128;
|
||||
@@ -83,6 +79,8 @@ pub type BridgedChainHasher = BlakeTwo256;
|
||||
/// Header of the `BridgedChain`.
|
||||
pub type BridgedChainHeader =
|
||||
sp_runtime::generic::Header<BridgedChainBlockNumber, BridgedChainHasher>;
|
||||
/// Block of the `BridgedChain`.
|
||||
pub type BridgedChainBlock = frame_system::mocking::MockBlockU32<TestRuntime>;
|
||||
|
||||
/// Rewards payment procedure.
|
||||
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;
|
||||
|
||||
frame_support::construct_runtime! {
|
||||
pub enum TestRuntime where
|
||||
Block = ThisChainBlock,
|
||||
NodeBlock = ThisChainBlock,
|
||||
UncheckedExtrinsic = ThisChainUncheckedExtrinsic,
|
||||
pub enum TestRuntime
|
||||
{
|
||||
System: frame_system::{Pallet, Call, Config<T>, Storage, Event<T>},
|
||||
Utility: pallet_utility,
|
||||
@@ -150,12 +145,11 @@ impl frame_system::Config for TestRuntime {
|
||||
type RuntimeOrigin = RuntimeOrigin;
|
||||
type Index = u64;
|
||||
type RuntimeCall = RuntimeCall;
|
||||
type BlockNumber = ThisChainBlockNumber;
|
||||
type Hash = ThisChainHash;
|
||||
type Hashing = ThisChainHasher;
|
||||
type AccountId = ThisChainAccountId;
|
||||
type Lookup = IdentityLookup<Self::AccountId>;
|
||||
type Header = ThisChainHeader;
|
||||
type Block = ThisChainBlock;
|
||||
type RuntimeEvent = RuntimeEvent;
|
||||
type BlockHashCount = ConstU32<250>;
|
||||
type Version = ();
|
||||
@@ -318,10 +312,9 @@ impl From<BridgedChainOrigin>
|
||||
pub struct ThisUnderlyingChain;
|
||||
|
||||
impl Chain for ThisUnderlyingChain {
|
||||
type BlockNumber = ThisChainBlockNumber;
|
||||
type Block = ThisChainBlock;
|
||||
type Hash = ThisChainHash;
|
||||
type Hasher = ThisChainHasher;
|
||||
type Header = ThisChainHeader;
|
||||
type AccountId = ThisChainAccountId;
|
||||
type Balance = ThisChainBalance;
|
||||
type Index = u32;
|
||||
@@ -358,10 +351,9 @@ pub struct BridgedUnderlyingParachain;
|
||||
pub struct BridgedChainCall;
|
||||
|
||||
impl Chain for BridgedUnderlyingChain {
|
||||
type BlockNumber = BridgedChainBlockNumber;
|
||||
type Block = BridgedChainBlock;
|
||||
type Hash = BridgedChainHash;
|
||||
type Hasher = BridgedChainHasher;
|
||||
type Header = BridgedChainHeader;
|
||||
type AccountId = BridgedChainAccountId;
|
||||
type Balance = BridgedChainBalance;
|
||||
type Index = u32;
|
||||
@@ -384,10 +376,9 @@ impl ChainWithGrandpa for BridgedUnderlyingChain {
|
||||
}
|
||||
|
||||
impl Chain for BridgedUnderlyingParachain {
|
||||
type BlockNumber = BridgedChainBlockNumber;
|
||||
type Block = BridgedChainBlock;
|
||||
type Hash = BridgedChainHash;
|
||||
type Hasher = BridgedChainHasher;
|
||||
type Header = BridgedChainHeader;
|
||||
type AccountId = BridgedChainAccountId;
|
||||
type Balance = BridgedChainBalance;
|
||||
type Index = u32;
|
||||
|
||||
@@ -46,7 +46,7 @@ where
|
||||
+ pallet_bridge_grandpa::Config<R::BridgesGrandpaPalletInstance>,
|
||||
PI: 'static,
|
||||
<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]);
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ use crate::messages_call_ext::{
|
||||
};
|
||||
use bp_messages::{LaneId, MessageNonce};
|
||||
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 frame_support::{
|
||||
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 scale_info::TypeInfo;
|
||||
use sp_runtime::{
|
||||
traits::{DispatchInfoOf, Get, PostDispatchInfoOf, SignedExtension, Zero},
|
||||
traits::{
|
||||
Block as BlockT, DispatchInfoOf, Get, Header as HeaderT, PostDispatchInfoOf,
|
||||
SignedExtension, Zero,
|
||||
},
|
||||
transaction_validity::{
|
||||
TransactionPriority, TransactionValidity, TransactionValidityError, ValidTransactionBuilder,
|
||||
},
|
||||
@@ -278,6 +281,7 @@ where
|
||||
+ GrandpaCallSubType<Runtime, Runtime::BridgesGrandpaPalletInstance>
|
||||
+ ParachainsCallSubType<Runtime, Para::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>> {
|
||||
match call.is_sub_type() {
|
||||
@@ -525,6 +529,7 @@ where
|
||||
+ GrandpaCallSubType<Runtime, Runtime::BridgesGrandpaPalletInstance>
|
||||
+ ParachainsCallSubType<Runtime, Para::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;
|
||||
type AccountId = Runtime::AccountId;
|
||||
|
||||
Reference in New Issue
Block a user