Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions bin/node/runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
// and set impl_version to equal spec_version. If only runtime
// implementation changes and behavior does not, then leave spec_version as
// is and increment impl_version.
spec_version: 202,
impl_version: 202,
spec_version: 203,
impl_version: 203,
apis: RUNTIME_API_VERSIONS,
};

Expand Down
4 changes: 2 additions & 2 deletions frame/evm/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,8 @@ impl<T> ClassifyDispatch<T> for WeightForCallCreate {
}
}

impl PaysFee for WeightForCallCreate {
fn pays_fee(&self) -> bool {
impl<T> PaysFee<T> for WeightForCallCreate {
fn pays_fee(&self, _: T) -> bool {
true
}
}
Expand Down
4 changes: 2 additions & 2 deletions frame/example/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -301,8 +301,8 @@ impl<T: pallet_balances::Trait> ClassifyDispatch<(&BalanceOf<T>,)> for WeightFor
}
}

impl<T: pallet_balances::Trait> PaysFee for WeightForSetDummy<T> {
fn pays_fee(&self) -> bool {
impl<T: pallet_balances::Trait> PaysFee<(&BalanceOf<T>,)> for WeightForSetDummy<T> {
fn pays_fee(&self, _target: (&BalanceOf<T>,)) -> bool {
true
}
}
Expand Down
10 changes: 6 additions & 4 deletions frame/support/src/dispatch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1312,8 +1312,9 @@ macro_rules! decl_module {
&$weight,
($( $param_name, )*)
);
let pays_fee = <dyn $crate::dispatch::PaysFee>::pays_fee(
&$weight
let pays_fee = <dyn $crate::dispatch::PaysFee<( $( & $param, )* )>>::pays_fee(
&$weight,
($( $param_name, )*)
);
return $crate::dispatch::DispatchInfo { weight, class, pays_fee };
}
Expand All @@ -1331,8 +1332,9 @@ macro_rules! decl_module {
&$crate::dispatch::SimpleDispatchInfo::default(),
()
);
let pays_fee = <dyn $crate::dispatch::PaysFee>::pays_fee(
&$crate::dispatch::SimpleDispatchInfo::default()
let pays_fee = <dyn $crate::dispatch::PaysFee<_>>::pays_fee(
&$crate::dispatch::SimpleDispatchInfo::default(),
()
);
$crate::dispatch::DispatchInfo { weight, class, pays_fee }

Expand Down
8 changes: 4 additions & 4 deletions frame/support/src/weights.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ pub trait WeighBlock<BlockNumber> {

/// Indicates if dispatch function should pay fees or not.
/// If set to false, the block resource limits are applied, yet no fee is deducted.
pub trait PaysFee {
fn pays_fee(&self) -> bool {
pub trait PaysFee<T> {
fn pays_fee(&self, _target: T) -> bool {
true
}
}
Expand Down Expand Up @@ -208,8 +208,8 @@ impl<T> ClassifyDispatch<T> for SimpleDispatchInfo {
}
}

impl PaysFee for SimpleDispatchInfo {
fn pays_fee(&self) -> bool {
impl<T> PaysFee<T> for SimpleDispatchInfo {
fn pays_fee(&self, _: T) -> bool {
match self {
SimpleDispatchInfo::FixedNormal(_) => true,
SimpleDispatchInfo::MaxNormal => true,
Expand Down
38 changes: 23 additions & 15 deletions frame/utility/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -204,9 +204,9 @@ impl<Call: GetDispatchInfo> ClassifyDispatch<(&u16, &Box<Call>)> for Passthrough
call.get_dispatch_info().class
}
}
impl<Call: GetDispatchInfo> PaysFee for Passthrough<Call> {
fn pays_fee(&self) -> bool {
true
impl<Call: GetDispatchInfo> PaysFee<(&u16, &Box<Call>)> for Passthrough<Call> {
fn pays_fee(&self, (_, call): (&u16, &Box<Call>)) -> bool {
call.get_dispatch_info().pays_fee
}
}

Expand All @@ -226,13 +226,21 @@ impl<Call: GetDispatchInfo> WeighData<(&Vec<Call>,)> for BatchPassthrough<Call>
}
}
impl<Call: GetDispatchInfo> ClassifyDispatch<(&Vec<Call>,)> for BatchPassthrough<Call> {
fn classify_dispatch(&self, (_,): (&Vec<Call>,)) -> DispatchClass {
DispatchClass::Normal
fn classify_dispatch(&self, (calls,): (&Vec<Call>,)) -> DispatchClass {
let all_operational = calls.iter()
.map(|call| call.get_dispatch_info().class)
.all(|class| class == DispatchClass::Operational);
if all_operational {
DispatchClass::Operational
} else {
DispatchClass::Normal
}
}
}
impl<Call: GetDispatchInfo> PaysFee for BatchPassthrough<Call> {
fn pays_fee(&self) -> bool {
true
impl<Call: GetDispatchInfo> PaysFee<(&Vec<Call>,)> for BatchPassthrough<Call> {
fn pays_fee(&self, (calls,): (&Vec<Call>,)) -> bool {
calls.iter()
.any(|call| call.get_dispatch_info().pays_fee)
}
}

Expand All @@ -254,16 +262,16 @@ for MultiPassthrough<Call, AccountId, Timepoint>
impl<Call: GetDispatchInfo, AccountId, Timepoint> ClassifyDispatch<(&u16, &Vec<AccountId>, &Timepoint, &Box<Call>)>
for MultiPassthrough<Call, AccountId, Timepoint>
{
fn classify_dispatch(&self, (_, _, _, _): (&u16, &Vec<AccountId>, &Timepoint, &Box<Call>))
fn classify_dispatch(&self, (_, _, _, call): (&u16, &Vec<AccountId>, &Timepoint, &Box<Call>))
-> DispatchClass
{
DispatchClass::Normal
call.get_dispatch_info().class
}
}
impl<Call: GetDispatchInfo, AccountId, Timepoint> PaysFee
impl<Call: GetDispatchInfo, AccountId, Timepoint> PaysFee<(&u16, &Vec<AccountId>, &Timepoint, &Box<Call>)>
for MultiPassthrough<Call, AccountId, Timepoint>
{
fn pays_fee(&self) -> bool {
fn pays_fee(&self, _: (&u16, &Vec<AccountId>, &Timepoint, &Box<Call>)) -> bool {
true
}
}
Expand All @@ -286,16 +294,16 @@ for SigsLen<AccountId, Timepoint>
impl<AccountId, Timepoint> ClassifyDispatch<(&u16, &Vec<AccountId>, &Timepoint, &[u8; 32])>
for SigsLen<AccountId, Timepoint>
{
fn classify_dispatch(&self, (_, _, _, _): (&u16, &Vec<AccountId>, &Timepoint, &[u8; 32]))
fn classify_dispatch(&self, _: (&u16, &Vec<AccountId>, &Timepoint, &[u8; 32]))
-> DispatchClass
{
DispatchClass::Normal
}
}
impl<AccountId, Timepoint> PaysFee
impl<AccountId, Timepoint> PaysFee<(&u16, &Vec<AccountId>, &Timepoint, &[u8; 32])>
for SigsLen<AccountId, Timepoint>
{
fn pays_fee(&self) -> bool {
fn pays_fee(&self, _: (&u16, &Vec<AccountId>, &Timepoint, &[u8; 32])) -> bool {
true
}
}
Expand Down