Skip to content

Commit 9bdc8c6

Browse files
committed
skip adding weight if pays::no
1 parent 67e23ef commit 9bdc8c6

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,6 @@ pallet-timestamp = { git = "https://github.com/paritytech/polkadot-sdk.git", tag
112112
pallet-transaction-payment = { git = "https://github.com/paritytech/polkadot-sdk.git", tag = "polkadot-stable2409", default-features = false }
113113
pallet-transaction-payment-rpc = { git = "https://github.com/paritytech/polkadot-sdk.git", tag = "polkadot-stable2409" }
114114
pallet-transaction-payment-rpc-runtime-api = { git = "https://github.com/paritytech/polkadot-sdk.git", tag = "polkadot-stable2409", default-features = false }
115-
#pallet-utility = { git = "https://github.com/paritytech/polkadot-sdk.git", tag = "polkadot-stable2409", default-features = false }
116115
pallet-utility = { path = "pallets/utility", default-features = false }
117116
pallet-root-testing = { git = "https://github.com/paritytech/polkadot-sdk.git", tag = "polkadot-stable2409", default-features = false }
118117

pallets/utility/src/lib.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -474,10 +474,13 @@ pub mod pallet {
474474
let dispatch_infos = calls.iter().map(|call| call.get_dispatch_info());
475475
let (dispatch_weight, dispatch_class) = dispatch_infos.fold(
476476
(Weight::zero(), DispatchClass::Operational),
477-
|(total_weight, dispatch_class): (Weight, DispatchClass), di| {
477+
|(total_weight, dispatch_class), di| {
478478
(
479-
total_weight.saturating_add(di.weight),
480-
// If not all are `Operational`, we want to use `DispatchClass::Normal`.
479+
if di.pays_fee == Pays::Yes {
480+
total_weight.saturating_add(di.weight)
481+
} else {
482+
total_weight
483+
},
481484
if di.class == DispatchClass::Normal {
482485
di.class
483486
} else {

0 commit comments

Comments
 (0)