Remove inherent in pallet-babe (#8124)

This commit is contained in:
Guillaume Thiolliere
2021-02-16 19:03:59 +01:00
committed by GitHub
parent f49aae65a8
commit f35a27cca0
10 changed files with 66 additions and 57 deletions
+15 -9
View File
@@ -25,7 +25,7 @@ use sp_runtime::{Perbill, FixedPointNumber};
use node_runtime::{
CheckedExtrinsic, Call, Runtime, Balances, TransactionPayment, Multiplier,
TransactionByteFee,
constants::currency::*,
constants::{time::SLOT_DURATION, currency::*},
};
use node_primitives::Balance;
use node_testing::keyring::*;
@@ -46,6 +46,7 @@ fn fee_multiplier_increases_and_decreases_on_big_weight() {
let mut tt = new_test_ext(compact_code_unwrap(), false);
let time1 = 42 * 1000;
// big one in terms of weight.
let block1 = construct_block(
&mut tt,
@@ -54,15 +55,17 @@ fn fee_multiplier_increases_and_decreases_on_big_weight() {
vec![
CheckedExtrinsic {
signed: None,
function: Call::Timestamp(pallet_timestamp::Call::set(42 * 1000)),
function: Call::Timestamp(pallet_timestamp::Call::set(time1)),
},
CheckedExtrinsic {
signed: Some((charlie(), signed_extra(0, 0))),
function: Call::System(frame_system::Call::fill_block(Perbill::from_percent(60))),
}
]
],
(time1 / SLOT_DURATION).into(),
);
let time2 = 52 * 1000;
// small one in terms of weight.
let block2 = construct_block(
&mut tt,
@@ -71,13 +74,14 @@ fn fee_multiplier_increases_and_decreases_on_big_weight() {
vec![
CheckedExtrinsic {
signed: None,
function: Call::Timestamp(pallet_timestamp::Call::set(52 * 1000)),
function: Call::Timestamp(pallet_timestamp::Call::set(time2)),
},
CheckedExtrinsic {
signed: Some((charlie(), signed_extra(1, 0))),
function: Call::System(frame_system::Call::remark(vec![0; 1])),
}
]
],
(time2 / SLOT_DURATION).into(),
);
println!(
@@ -219,7 +223,7 @@ fn block_weight_capacity_report() {
let mut time = 10;
let mut nonce: Index = 0;
let mut block_number = 1;
let mut previous_hash: Hash = GENESIS_HASH.into();
let mut previous_hash: node_primitives::Hash = GENESIS_HASH.into();
loop {
let num_transfers = block_number * factor;
@@ -238,7 +242,8 @@ fn block_weight_capacity_report() {
&mut tt,
block_number,
previous_hash,
xts
xts,
(time * 1000 / SLOT_DURATION).into(),
);
let len = block.0.len();
@@ -286,7 +291,7 @@ fn block_length_capacity_report() {
let mut time = 10;
let mut nonce: Index = 0;
let mut block_number = 1;
let mut previous_hash: Hash = GENESIS_HASH.into();
let mut previous_hash: node_primitives::Hash = GENESIS_HASH.into();
loop {
// NOTE: this is super slow. Can probably be improved.
@@ -303,7 +308,8 @@ fn block_length_capacity_report() {
signed: Some((charlie(), signed_extra(nonce, 0))),
function: Call::System(frame_system::Call::remark(vec![0u8; (block_number * factor) as usize])),
},
]
],
(time * 1000 / SLOT_DURATION).into(),
);
let len = block.0.len();