chore: regenerate umbrella crate, fix feature propagation
This commit is contained in:
@@ -52,7 +52,6 @@ use pezframe_support::{
|
||||
DefaultNoBound,
|
||||
};
|
||||
use pezpallet_transaction_payment::{ChargeTransactionPayment, OnChargeTransaction};
|
||||
use scale_info::TypeInfo;
|
||||
use pezsp_runtime::{
|
||||
traits::{
|
||||
AsSystemOriginSigner, DispatchInfoOf, Dispatchable, PostDispatchInfoOf, RefundWeight,
|
||||
@@ -60,6 +59,7 @@ use pezsp_runtime::{
|
||||
},
|
||||
transaction_validity::{InvalidTransaction, TransactionValidityError, ValidTransaction},
|
||||
};
|
||||
use scale_info::TypeInfo;
|
||||
|
||||
#[cfg(test)]
|
||||
mod mock;
|
||||
@@ -71,8 +71,8 @@ pub mod weights;
|
||||
mod benchmarking;
|
||||
|
||||
mod payment;
|
||||
use pezframe_support::{pezpallet_prelude::Weight, traits::tokens::AssetId};
|
||||
pub use payment::*;
|
||||
use pezframe_support::{pezpallet_prelude::Weight, traits::tokens::AssetId};
|
||||
pub use weights::WeightInfo;
|
||||
|
||||
/// Balance type alias for balances of the chain's native asset.
|
||||
@@ -112,7 +112,8 @@ pub mod pezpallet {
|
||||
pub trait Config: pezframe_system::Config + pezpallet_transaction_payment::Config {
|
||||
/// The overarching event type.
|
||||
#[allow(deprecated)]
|
||||
type RuntimeEvent: From<Event<Self>> + IsType<<Self as pezframe_system::Config>::RuntimeEvent>;
|
||||
type RuntimeEvent: From<Event<Self>>
|
||||
+ IsType<<Self as pezframe_system::Config>::RuntimeEvent>;
|
||||
/// The asset ID type that can be used for transaction payments in addition to a
|
||||
/// native asset.
|
||||
type AssetId: AssetId;
|
||||
@@ -316,7 +317,8 @@ where
|
||||
return Ok((ValidTransaction::default(), Val::NoCharge, origin));
|
||||
};
|
||||
// Non-mutating call of `compute_fee` to calculate the fee used in the transaction priority.
|
||||
let fee = pezpallet_transaction_payment::Pezpallet::<T>::compute_fee(len as u32, info, self.tip);
|
||||
let fee =
|
||||
pezpallet_transaction_payment::Pezpallet::<T>::compute_fee(len as u32, info, self.tip);
|
||||
self.can_withdraw_fee(&who, call, info, fee)?;
|
||||
let priority = ChargeTransactionPayment::<T>::get_priority(info, len, self.tip, fee);
|
||||
let validity = ValidTransaction { priority, ..Default::default() };
|
||||
|
||||
@@ -20,9 +20,8 @@ use pezframe_support::{
|
||||
derive_impl,
|
||||
dispatch::DispatchClass,
|
||||
instances::Instance2,
|
||||
ord_parameter_types,
|
||||
ord_parameter_types, parameter_types,
|
||||
pezpallet_prelude::*,
|
||||
parameter_types,
|
||||
traits::{
|
||||
fungible, fungibles,
|
||||
tokens::{
|
||||
@@ -157,7 +156,10 @@ pub struct DealWithFungiblesFees;
|
||||
impl OnUnbalanced<fungibles::Credit<AccountId, NativeAndAssets>> for DealWithFungiblesFees {
|
||||
fn on_unbalanceds(
|
||||
mut fees_then_tips: impl Iterator<
|
||||
Item = fungibles::Credit<<Runtime as pezframe_system::Config>::AccountId, NativeAndAssets>,
|
||||
Item = fungibles::Credit<
|
||||
<Runtime as pezframe_system::Config>::AccountId,
|
||||
NativeAndAssets,
|
||||
>,
|
||||
>,
|
||||
) {
|
||||
if let Some(fees) = fees_then_tips.next() {
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
|
||||
use super::*;
|
||||
|
||||
use mock::{ExtrinsicBaseWeight, *};
|
||||
use pezframe_support::{
|
||||
assert_ok,
|
||||
dispatch::{DispatchInfo, GetDispatchInfo, PostDispatchInfo},
|
||||
@@ -28,7 +29,6 @@ use pezframe_support::{
|
||||
weights::Weight,
|
||||
};
|
||||
use pezframe_system as system;
|
||||
use mock::{ExtrinsicBaseWeight, *};
|
||||
use pezpallet_balances::Call as BalancesCall;
|
||||
use pezsp_runtime::{
|
||||
traits::{DispatchTransaction, StaticLookup},
|
||||
|
||||
@@ -22,15 +22,15 @@
|
||||
|
||||
//! It does this by extending transactions to include an optional `AssetId` that specifies the asset
|
||||
//! to be used for payment (defaulting to the native token on `None`). It expects an
|
||||
//! [`OnChargeAssetTransaction`] implementation analogously to [`pezpallet-transaction-payment`]. The
|
||||
//! included [`FungiblesAdapter`] (implementing [`OnChargeAssetTransaction`]) determines the fee
|
||||
//! [`OnChargeAssetTransaction`] implementation analogously to [`pezpallet-transaction-payment`].
|
||||
//! The included [`FungiblesAdapter`] (implementing [`OnChargeAssetTransaction`]) determines the fee
|
||||
//! amount by converting the fee calculated by [`pezpallet-transaction-payment`] into the desired
|
||||
//! asset.
|
||||
//!
|
||||
//! ## Integration
|
||||
|
||||
//! This pezpallet wraps FRAME's transaction payment pezpallet and functions as a replacement. This means
|
||||
//! you should include both pallets in your `construct_runtime` macro, but only include this
|
||||
//! This pezpallet wraps FRAME's transaction payment pezpallet and functions as a replacement. This
|
||||
//! means you should include both pallets in your `construct_runtime` macro, but only include this
|
||||
//! pezpallet's [`TransactionExtension`] ([`ChargeAssetTxPayment`]).
|
||||
|
||||
#![cfg_attr(not(feature = "std"), no_std)]
|
||||
@@ -49,7 +49,6 @@ use pezframe_support::{
|
||||
DefaultNoBound,
|
||||
};
|
||||
use pezpallet_transaction_payment::OnChargeTransaction;
|
||||
use scale_info::TypeInfo;
|
||||
use pezsp_runtime::{
|
||||
traits::{
|
||||
AsSystemOriginSigner, DispatchInfoOf, Dispatchable, PostDispatchInfoOf, RefundWeight,
|
||||
@@ -57,6 +56,7 @@ use pezsp_runtime::{
|
||||
},
|
||||
transaction_validity::{InvalidTransaction, TransactionValidityError, ValidTransaction},
|
||||
};
|
||||
use scale_info::TypeInfo;
|
||||
|
||||
#[cfg(test)]
|
||||
mod mock;
|
||||
@@ -122,7 +122,8 @@ pub mod pezpallet {
|
||||
pub trait Config: pezframe_system::Config + pezpallet_transaction_payment::Config {
|
||||
/// The overarching event type.
|
||||
#[allow(deprecated)]
|
||||
type RuntimeEvent: From<Event<Self>> + IsType<<Self as pezframe_system::Config>::RuntimeEvent>;
|
||||
type RuntimeEvent: From<Event<Self>>
|
||||
+ IsType<<Self as pezframe_system::Config>::RuntimeEvent>;
|
||||
/// The fungibles instance used to pay for transactions in assets.
|
||||
type Fungibles: Balanced<Self::AccountId>;
|
||||
/// The actual transaction charging logic that charges the fees.
|
||||
@@ -335,7 +336,8 @@ where
|
||||
return Ok((ValidTransaction::default(), Val::NoCharge, origin));
|
||||
};
|
||||
// Non-mutating call of `compute_fee` to calculate the fee used in the transaction priority.
|
||||
let fee = pezpallet_transaction_payment::Pezpallet::<T>::compute_fee(len as u32, info, self.tip);
|
||||
let fee =
|
||||
pezpallet_transaction_payment::Pezpallet::<T>::compute_fee(len as u32, info, self.tip);
|
||||
self.can_withdraw_fee(&who, call, info, fee)?;
|
||||
let priority = ChargeTransactionPayment::<T>::get_priority(info, len, self.tip, fee);
|
||||
let val = Val::Charge { tip: self.tip, who: who.clone(), fee };
|
||||
|
||||
@@ -20,8 +20,8 @@ use codec;
|
||||
use pezframe_support::{
|
||||
derive_impl,
|
||||
dispatch::DispatchClass,
|
||||
pezpallet_prelude::*,
|
||||
parameter_types,
|
||||
pezpallet_prelude::*,
|
||||
traits::{AsEnsureOriginWithArg, ConstU32, ConstU64, ConstU8, FindAuthor},
|
||||
weights::{Weight, WeightToFee as WeightToFeeT},
|
||||
ConsensusEngineId,
|
||||
|
||||
@@ -29,11 +29,11 @@ use pezframe_support::{
|
||||
},
|
||||
unsigned::TransactionValidityError,
|
||||
};
|
||||
use scale_info::TypeInfo;
|
||||
use pezsp_runtime::{
|
||||
traits::{DispatchInfoOf, MaybeSerializeDeserialize, One, PostDispatchInfoOf},
|
||||
transaction_validity::InvalidTransaction,
|
||||
};
|
||||
use scale_info::TypeInfo;
|
||||
|
||||
/// Handle withdrawing, refunding and depositing of transaction fees.
|
||||
pub trait OnChargeAssetTransaction<T: Config> {
|
||||
@@ -112,8 +112,8 @@ impl<A, B: Balanced<A>> HandleCredit<A, B> for () {
|
||||
/// The credit handler is given the complete fee in terms of the asset used for the transaction.
|
||||
pub struct FungiblesAdapter<CON, HC>(PhantomData<(CON, HC)>);
|
||||
|
||||
/// Default implementation for a runtime instantiating this pezpallet, a balance to asset converter and
|
||||
/// a credit handler.
|
||||
/// Default implementation for a runtime instantiating this pezpallet, a balance to asset converter
|
||||
/// and a credit handler.
|
||||
impl<T, CON, HC> OnChargeAssetTransaction<T> for FungiblesAdapter<CON, HC>
|
||||
where
|
||||
T: Config,
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
|
||||
use super::*;
|
||||
|
||||
use mock::{ExtrinsicBaseWeight, *};
|
||||
use pezframe_support::{
|
||||
assert_ok,
|
||||
dispatch::{DispatchInfo, GetDispatchInfo, PostDispatchInfo},
|
||||
@@ -23,7 +24,6 @@ use pezframe_support::{
|
||||
weights::Weight,
|
||||
};
|
||||
use pezframe_system as system;
|
||||
use mock::{ExtrinsicBaseWeight, *};
|
||||
use pezpallet_balances::Call as BalancesCall;
|
||||
use pezsp_runtime::{
|
||||
traits::{DispatchTransaction, StaticLookup},
|
||||
|
||||
@@ -28,7 +28,9 @@ use jsonrpsee::{
|
||||
ErrorObjectOwned,
|
||||
},
|
||||
};
|
||||
use pezpallet_transaction_payment_rpc_runtime_api::{FeeDetails, InclusionFee, RuntimeDispatchInfo};
|
||||
use pezpallet_transaction_payment_rpc_runtime_api::{
|
||||
FeeDetails, InclusionFee, RuntimeDispatchInfo,
|
||||
};
|
||||
use pezsp_api::ProvideRuntimeApi;
|
||||
use pezsp_blockchain::HeaderBackend;
|
||||
use pezsp_core::Bytes;
|
||||
|
||||
@@ -22,15 +22,15 @@
|
||||
//! ## Overview
|
||||
//!
|
||||
//! It does this by wrapping an existing [`TransactionExtension`] implementation (e.g.
|
||||
//! [`pezpallet-transaction-payment`]) and checking if the dispatchable is feeless before applying the
|
||||
//! wrapped extension. If the dispatchable is indeed feeless, the extension is skipped and a custom
|
||||
//! event is emitted instead. Otherwise, the extension is applied as usual.
|
||||
//! [`pezpallet-transaction-payment`]) and checking if the dispatchable is feeless before applying
|
||||
//! the wrapped extension. If the dispatchable is indeed feeless, the extension is skipped and a
|
||||
//! custom event is emitted instead. Otherwise, the extension is applied as usual.
|
||||
//!
|
||||
//!
|
||||
//! ## Integration
|
||||
//!
|
||||
//! This pezpallet wraps an existing transaction payment pezpallet. This means you should both pallets
|
||||
//! in your [`construct_runtime`](pezframe_support::construct_runtime) macro and
|
||||
//! This pezpallet wraps an existing transaction payment pezpallet. This means you should both
|
||||
//! pallets in your [`construct_runtime`](pezframe_support::construct_runtime) macro and
|
||||
//! include this pezpallet's [`TransactionExtension`] ([`SkipCheckIfFeeless`]) that would accept the
|
||||
//! existing one as an argument.
|
||||
|
||||
@@ -45,7 +45,6 @@ use pezframe_support::{
|
||||
traits::{IsType, OriginTrait},
|
||||
weights::Weight,
|
||||
};
|
||||
use scale_info::{StaticTypeInfo, TypeInfo};
|
||||
use pezsp_runtime::{
|
||||
traits::{
|
||||
DispatchInfoOf, DispatchOriginOf, Implication, PostDispatchInfoOf, TransactionExtension,
|
||||
@@ -53,6 +52,7 @@ use pezsp_runtime::{
|
||||
},
|
||||
transaction_validity::TransactionValidityError,
|
||||
};
|
||||
use scale_info::{StaticTypeInfo, TypeInfo};
|
||||
|
||||
#[cfg(test)]
|
||||
mod mock;
|
||||
@@ -69,7 +69,8 @@ pub mod pezpallet {
|
||||
pub trait Config: pezframe_system::Config {
|
||||
/// The overarching event type.
|
||||
#[allow(deprecated)]
|
||||
type RuntimeEvent: From<Event<Self>> + IsType<<Self as pezframe_system::Config>::RuntimeEvent>;
|
||||
type RuntimeEvent: From<Event<Self>>
|
||||
+ IsType<<Self as pezframe_system::Config>::RuntimeEvent>;
|
||||
}
|
||||
|
||||
#[pezpallet::pezpallet]
|
||||
|
||||
@@ -50,6 +50,7 @@
|
||||
use codec::{Decode, DecodeWithMemTracking, Encode, MaxEncodedLen};
|
||||
use scale_info::TypeInfo;
|
||||
|
||||
pub use payment::*;
|
||||
use pezframe_support::{
|
||||
dispatch::{
|
||||
DispatchClass, DispatchInfo, DispatchResult, GetDispatchInfo, Pays, PostDispatchInfo,
|
||||
@@ -60,7 +61,6 @@ use pezframe_support::{
|
||||
RuntimeDebugNoBound,
|
||||
};
|
||||
pub use pezpallet::*;
|
||||
pub use payment::*;
|
||||
use pezsp_runtime::{
|
||||
traits::{
|
||||
Convert, DispatchInfoOf, Dispatchable, One, PostDispatchInfoOf, SaturatedConversion,
|
||||
@@ -352,7 +352,8 @@ pub mod pezpallet {
|
||||
/// The overarching event type.
|
||||
#[pezpallet::no_default_bounds]
|
||||
#[allow(deprecated)]
|
||||
type RuntimeEvent: From<Event<Self>> + IsType<<Self as pezframe_system::Config>::RuntimeEvent>;
|
||||
type RuntimeEvent: From<Event<Self>>
|
||||
+ IsType<<Self as pezframe_system::Config>::RuntimeEvent>;
|
||||
|
||||
/// Handler for withdrawing, refunding and depositing the transaction fee.
|
||||
/// Transaction fees are withdrawn before the transaction is executed.
|
||||
@@ -521,9 +522,9 @@ impl<T: Config> Pezpallet<T> {
|
||||
|
||||
/// Query the data that we know about the fee of a given `call`.
|
||||
///
|
||||
/// This pezpallet is not and cannot be aware of the internals of a signed extension, for example
|
||||
/// a tip. It only interprets the extrinsic as some encoded value and accounts for its weight
|
||||
/// and length, the runtime's extrinsic base weight, and the current fee multiplier.
|
||||
/// This pezpallet is not and cannot be aware of the internals of a signed extension, for
|
||||
/// example a tip. It only interprets the extrinsic as some encoded value and accounts for its
|
||||
/// weight and length, the runtime's extrinsic base weight, and the current fee multiplier.
|
||||
///
|
||||
/// All dispatchables must be annotated with weight and will have some fee info. This function
|
||||
/// always returns.
|
||||
|
||||
@@ -29,11 +29,11 @@ use pezframe_support::{
|
||||
},
|
||||
unsigned::TransactionValidityError,
|
||||
};
|
||||
use scale_info::TypeInfo;
|
||||
use pezsp_runtime::{
|
||||
traits::{CheckedSub, DispatchInfoOf, PostDispatchInfoOf, Saturating, Zero},
|
||||
transaction_validity::InvalidTransaction,
|
||||
};
|
||||
use scale_info::TypeInfo;
|
||||
|
||||
type NegativeImbalanceOf<C, T> =
|
||||
<C as Currency<<T as pezframe_system::Config>::AccountId>>::NegativeImbalance;
|
||||
@@ -104,9 +104,9 @@ pub trait TxCreditHold<T: Config> {
|
||||
type Credit: FullCodec + DecodeWithMemTracking + MaxEncodedLen + TypeInfo + SuppressedDrop;
|
||||
}
|
||||
|
||||
/// Implements transaction payment for a pezpallet implementing the [`pezframe_support::traits::fungible`]
|
||||
/// trait (eg. pezpallet_balances) using an unbalance handler (implementing
|
||||
/// [`OnUnbalanced`]).
|
||||
/// Implements transaction payment for a pezpallet implementing the
|
||||
/// [`pezframe_support::traits::fungible`] trait (eg. pezpallet_balances) using an unbalance handler
|
||||
/// (implementing [`OnUnbalanced`]).
|
||||
///
|
||||
/// The unbalance handler is given 2 unbalanceds in [`OnUnbalanced::on_unbalanceds`]: `fee` and
|
||||
/// then `tip`.
|
||||
|
||||
@@ -27,6 +27,7 @@ use pezsp_runtime::{
|
||||
BuildStorage,
|
||||
};
|
||||
|
||||
use mock::*;
|
||||
use pezframe_support::{
|
||||
assert_ok,
|
||||
dispatch::{DispatchClass, DispatchInfo, GetDispatchInfo, PostDispatchInfo},
|
||||
@@ -34,7 +35,6 @@ use pezframe_support::{
|
||||
weights::Weight,
|
||||
};
|
||||
use pezframe_system as system;
|
||||
use mock::*;
|
||||
use pezpallet_balances::Call as BalancesCall;
|
||||
|
||||
pub struct ExtBuilder {
|
||||
|
||||
Reference in New Issue
Block a user