Allow PostDispatchInfo to disable fees (#6749)

* initial mock

* add test

* remove unneeded clone

* Update frame/support/src/weights.rs

Co-authored-by: Alexander Theißen <alex.theissen@me.com>

* fix compile

* Update frame/support/src/weights.rs

Co-authored-by: Alexander Popiak <alexander.popiak@parity.io>

* Update frame/sudo/src/lib.rs

Co-authored-by: André Silva <123550+andresilva@users.noreply.github.com>

* Apply suggestions from code review

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>

Co-authored-by: Alexander Theißen <alex.theissen@me.com>
Co-authored-by: Alexander Popiak <alexander.popiak@parity.io>
Co-authored-by: André Silva <123550+andresilva@users.noreply.github.com>
Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
This commit is contained in:
Shawn Tabrizi
2020-07-29 14:30:10 +02:00
committed by GitHub
parent 6bfbb7c6f1
commit 6e6568167a
6 changed files with 127 additions and 11 deletions
@@ -575,7 +575,10 @@ mod tests {
new_test_ext().execute_with(|| {
// This is half of the max block weight
let info = DispatchInfo { weight: 512, ..Default::default() };
let post_info = PostDispatchInfo { actual_weight: Some(128), };
let post_info = PostDispatchInfo {
actual_weight: Some(128),
pays_fee: Default::default(),
};
let len = 0_usize;
// We allow 75% for normal transaction, so we put 25% - extrinsic base weight
@@ -601,7 +604,10 @@ mod tests {
fn signed_ext_check_weight_actual_weight_higher_than_max_is_capped() {
new_test_ext().execute_with(|| {
let info = DispatchInfo { weight: 512, ..Default::default() };
let post_info = PostDispatchInfo { actual_weight: Some(700), };
let post_info = PostDispatchInfo {
actual_weight: Some(700),
pays_fee: Default::default(),
};
let len = 0_usize;
BlockWeight::mutate(|current_weight| {