New root_testing pallet (#12451)

* Move fill_block to RootOffences

* docs

* new pallet

* new line

* fix

* Update frame/root-testing/src/lib.rs

Co-authored-by: Bastian Köcher <git@kchr.de>

* Update frame/root-testing/src/lib.rs

Co-authored-by: Bastian Köcher <git@kchr.de>

* Update bin/node/runtime/src/lib.rs

Co-authored-by: Bastian Köcher <git@kchr.de>

* Update frame/root-testing/src/lib.rs

Co-authored-by: Bastian Köcher <git@kchr.de>

* Update frame/root-testing/src/lib.rs

Co-authored-by: Bastian Köcher <git@kchr.de>

* Update frame/root-testing/src/lib.rs

Co-authored-by: Bastian Köcher <git@kchr.de>

* fixes

* problem solved

* revert

* fix dependency

* hopefully making the CI happy

* ...

* dummy call

* remove dummy

* fix warning

Co-authored-by: Bastian Köcher <git@kchr.de>
This commit is contained in:
Sergej Sakac
2022-11-13 19:48:11 +01:00
committed by GitHub
parent 8c423baf32
commit e5910d971e
16 changed files with 134 additions and 33 deletions
+7 -2
View File
@@ -133,6 +133,7 @@ frame_support::construct_runtime!(
System: frame_system::{Pallet, Call, Config, Storage, Event<T>},
Timestamp: pallet_timestamp::{Call, Inherent},
Balances: pallet_balances::{Pallet, Call, Storage, Config<T>, Event<T>},
RootTesting: pallet_root_testing::{Pallet, Call, Storage},
Council: pallet_collective::<Instance1>,
Utility: utility::{Pallet, Call, Event},
Example: example::{Pallet, Call},
@@ -183,6 +184,8 @@ impl pallet_balances::Config for Test {
type WeightInfo = ();
}
impl pallet_root_testing::Config for Test {}
impl pallet_timestamp::Config for Test {
type Moment = u64;
type OnTimestampSet = ();
@@ -247,6 +250,7 @@ type UtilityCall = crate::Call<Test>;
use frame_system::Call as SystemCall;
use pallet_balances::{Call as BalancesCall, Error as BalancesError};
use pallet_root_testing::Call as RootTestingCall;
use pallet_timestamp::Call as TimestampCall;
pub fn new_test_ext() -> sp_io::TestExternalities {
@@ -469,8 +473,9 @@ fn batch_early_exit_works() {
fn batch_weight_calculation_doesnt_overflow() {
use sp_runtime::Perbill;
new_test_ext().execute_with(|| {
let big_call =
RuntimeCall::System(SystemCall::fill_block { ratio: Perbill::from_percent(50) });
let big_call = RuntimeCall::RootTesting(RootTestingCall::fill_block {
ratio: Perbill::from_percent(50),
});
assert_eq!(big_call.get_dispatch_info().weight, Weight::MAX / 2);
// 3 * 50% saturates to 100%