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:
gupnik
2023-07-13 19:00:28 +05:30
committed by GitHub
parent 49145bdd9b
commit 24d6e46ad0
54 changed files with 449 additions and 633 deletions
+6 -12
View File
@@ -29,12 +29,11 @@ use frame_support::{
traits::{OnFinalize, OnInitialize},
weights::Weight,
};
use frame_system::RawOrigin;
use frame_system::{pallet_prelude::BlockNumberFor, RawOrigin};
use hex_literal::hex;
use relay_chain::HrmpChannelId;
use sp_core::{blake2_256, H256};
use sp_runtime::{
testing::Header,
traits::{BlakeTwo256, IdentityLookup},
BuildStorage, DispatchErrorWithPostInfo,
};
@@ -43,14 +42,10 @@ use std::cell::RefCell;
use crate as parachain_system;
type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic<Test>;
type Block = frame_system::mocking::MockBlock<Test>;
frame_support::construct_runtime!(
pub enum Test where
Block = Block,
NodeBlock = Block,
UncheckedExtrinsic = UncheckedExtrinsic,
pub enum Test
{
System: frame_system::{Pallet, Call, Config<T>, Storage, Event<T>},
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 RuntimeCall = RuntimeCall;
type Index = u64;
type BlockNumber = u64;
type Hash = H256;
type Hashing = BlakeTwo256;
type AccountId = u64;
type Lookup = IdentityLookup<Self::AccountId>;
type Header = Header;
type Block = Block;
type RuntimeEvent = RuntimeEvent;
type BlockHashCount = BlockHashCount;
type BlockLength = ();
@@ -212,7 +206,7 @@ fn wasm_ext() -> sp_io::TestExternalities {
}
struct BlockTest {
n: <Test as frame_system::Config>::BlockNumber,
n: BlockNumberFor<Test>,
within_block: Box<dyn Fn()>,
after_block: Option<Box<dyn Fn()>>,
}
@@ -243,7 +237,7 @@ impl BlockTests {
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
F: 'static + Fn(),
{
@@ -252,7 +246,7 @@ impl BlockTests {
fn add_with_post_test<F1, F2>(
self,
n: <Test as frame_system::Config>::BlockNumber,
n: BlockNumberFor<Test>,
within_block: F1,
after_block: F2,
) -> Self