mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-06 00:58:02 +00:00
BREAKING: Rename Call & Event (#11981)
* rename Event to RuntimeEvent * rename Call * rename in runtimes * small fix * rename Event * small fix & rename RuntimeCall back to Call for now * small fixes * more renaming * a bit more renaming * fmt * small fix * commit * prep for renaming associated types * fix * rename associated Event type * rename to RuntimeEvent * commit * merge conflict fixes & fmt * additional renaming * fix. * fix decl_event * rename in tests * remove warnings * remove accidental rename * . * commit * update .stderr * fix in test * update .stderr * TRYBUILD=overwrite * docs * fmt * small change in docs * rename PalletEvent to Event * rename Call to RuntimeCall * renamed at wrong places :P * rename Call * rename * rename associated type * fix * fix & fmt * commit * frame-support-test * passing tests * update docs * rustdoc fix * update .stderr * wrong code in docs * merge fix * fix in error message * update .stderr * docs & error message * . * merge fix * merge fix * fmt * fmt * merge fix * more fixing * fmt * remove unused * fmt * fix Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>
This commit is contained in:
@@ -54,7 +54,7 @@ impl<T: Config + Send + Sync> CheckGenesis<T> {
|
||||
|
||||
impl<T: Config + Send + Sync> SignedExtension for CheckGenesis<T> {
|
||||
type AccountId = T::AccountId;
|
||||
type Call = <T as Config>::Call;
|
||||
type Call = <T as Config>::RuntimeCall;
|
||||
type AdditionalSigned = T::Hash;
|
||||
type Pre = ();
|
||||
const IDENTIFIER: &'static str = "CheckGenesis";
|
||||
|
||||
@@ -56,7 +56,7 @@ impl<T: Config + Send + Sync> sp_std::fmt::Debug for CheckMortality<T> {
|
||||
|
||||
impl<T: Config + Send + Sync> SignedExtension for CheckMortality<T> {
|
||||
type AccountId = T::AccountId;
|
||||
type Call = T::Call;
|
||||
type Call = T::RuntimeCall;
|
||||
type AdditionalSigned = T::Hash;
|
||||
type Pre = ();
|
||||
const IDENTIFIER: &'static str = "CheckMortality";
|
||||
|
||||
@@ -53,10 +53,10 @@ impl<T: Config + Send + Sync> CheckNonZeroSender<T> {
|
||||
|
||||
impl<T: Config + Send + Sync> SignedExtension for CheckNonZeroSender<T>
|
||||
where
|
||||
T::Call: Dispatchable<Info = DispatchInfo>,
|
||||
T::RuntimeCall: Dispatchable<Info = DispatchInfo>,
|
||||
{
|
||||
type AccountId = T::AccountId;
|
||||
type Call = T::Call;
|
||||
type Call = T::RuntimeCall;
|
||||
type AdditionalSigned = ();
|
||||
type Pre = ();
|
||||
const IDENTIFIER: &'static str = "CheckNonZeroSender";
|
||||
|
||||
@@ -60,10 +60,10 @@ impl<T: Config> sp_std::fmt::Debug for CheckNonce<T> {
|
||||
|
||||
impl<T: Config> SignedExtension for CheckNonce<T>
|
||||
where
|
||||
T::Call: Dispatchable<Info = DispatchInfo>,
|
||||
T::RuntimeCall: Dispatchable<Info = DispatchInfo>,
|
||||
{
|
||||
type AccountId = T::AccountId;
|
||||
type Call = T::Call;
|
||||
type Call = T::RuntimeCall;
|
||||
type AdditionalSigned = ();
|
||||
type Pre = ();
|
||||
const IDENTIFIER: &'static str = "CheckNonce";
|
||||
|
||||
@@ -54,7 +54,7 @@ impl<T: Config + Send + Sync> CheckSpecVersion<T> {
|
||||
|
||||
impl<T: Config + Send + Sync> SignedExtension for CheckSpecVersion<T> {
|
||||
type AccountId = T::AccountId;
|
||||
type Call = <T as Config>::Call;
|
||||
type Call = <T as Config>::RuntimeCall;
|
||||
type AdditionalSigned = u32;
|
||||
type Pre = ();
|
||||
const IDENTIFIER: &'static str = "CheckSpecVersion";
|
||||
|
||||
@@ -54,7 +54,7 @@ impl<T: Config + Send + Sync> CheckTxVersion<T> {
|
||||
|
||||
impl<T: Config + Send + Sync> SignedExtension for CheckTxVersion<T> {
|
||||
type AccountId = T::AccountId;
|
||||
type Call = <T as Config>::Call;
|
||||
type Call = <T as Config>::RuntimeCall;
|
||||
type AdditionalSigned = u32;
|
||||
type Pre = ();
|
||||
const IDENTIFIER: &'static str = "CheckTxVersion";
|
||||
|
||||
@@ -40,12 +40,12 @@ pub struct CheckWeight<T: Config + Send + Sync>(sp_std::marker::PhantomData<T>);
|
||||
|
||||
impl<T: Config + Send + Sync> CheckWeight<T>
|
||||
where
|
||||
T::Call: Dispatchable<Info = DispatchInfo, PostInfo = PostDispatchInfo>,
|
||||
T::RuntimeCall: Dispatchable<Info = DispatchInfo, PostInfo = PostDispatchInfo>,
|
||||
{
|
||||
/// Checks if the current extrinsic does not exceed the maximum weight a single extrinsic
|
||||
/// with given `DispatchClass` can have.
|
||||
fn check_extrinsic_weight(
|
||||
info: &DispatchInfoOf<T::Call>,
|
||||
info: &DispatchInfoOf<T::RuntimeCall>,
|
||||
) -> Result<(), TransactionValidityError> {
|
||||
let max = T::BlockWeights::get().get(info.class).max_extrinsic;
|
||||
match max {
|
||||
@@ -59,18 +59,18 @@ where
|
||||
///
|
||||
/// Upon successes, it returns the new block weight as a `Result`.
|
||||
fn check_block_weight(
|
||||
info: &DispatchInfoOf<T::Call>,
|
||||
info: &DispatchInfoOf<T::RuntimeCall>,
|
||||
) -> Result<crate::ConsumedWeight, TransactionValidityError> {
|
||||
let maximum_weight = T::BlockWeights::get();
|
||||
let all_weight = Pallet::<T>::block_weight();
|
||||
calculate_consumed_weight::<T::Call>(maximum_weight, all_weight, info)
|
||||
calculate_consumed_weight::<T::RuntimeCall>(maximum_weight, all_weight, info)
|
||||
}
|
||||
|
||||
/// Checks if the current extrinsic can fit into the block with respect to block length limits.
|
||||
///
|
||||
/// Upon successes, it returns the new block length as a `Result`.
|
||||
fn check_block_length(
|
||||
info: &DispatchInfoOf<T::Call>,
|
||||
info: &DispatchInfoOf<T::RuntimeCall>,
|
||||
len: usize,
|
||||
) -> Result<u32, TransactionValidityError> {
|
||||
let length_limit = T::BlockLength::get();
|
||||
@@ -93,7 +93,7 @@ where
|
||||
///
|
||||
/// It checks and notes the new weight and length.
|
||||
pub fn do_pre_dispatch(
|
||||
info: &DispatchInfoOf<T::Call>,
|
||||
info: &DispatchInfoOf<T::RuntimeCall>,
|
||||
len: usize,
|
||||
) -> Result<(), TransactionValidityError> {
|
||||
let next_len = Self::check_block_length(info, len)?;
|
||||
@@ -108,7 +108,7 @@ where
|
||||
/// Do the validate checks. This can be applied to both signed and unsigned.
|
||||
///
|
||||
/// It only checks that the block weight and length limit will not exceed.
|
||||
pub fn do_validate(info: &DispatchInfoOf<T::Call>, len: usize) -> TransactionValidity {
|
||||
pub fn do_validate(info: &DispatchInfoOf<T::RuntimeCall>, len: usize) -> TransactionValidity {
|
||||
// ignore the next length. If they return `Ok`, then it is below the limit.
|
||||
let _ = Self::check_block_length(info, len)?;
|
||||
// during validation we skip block limit check. Since the `validate_transaction`
|
||||
@@ -170,10 +170,10 @@ where
|
||||
|
||||
impl<T: Config + Send + Sync> SignedExtension for CheckWeight<T>
|
||||
where
|
||||
T::Call: Dispatchable<Info = DispatchInfo, PostInfo = PostDispatchInfo>,
|
||||
T::RuntimeCall: Dispatchable<Info = DispatchInfo, PostInfo = PostDispatchInfo>,
|
||||
{
|
||||
type AccountId = T::AccountId;
|
||||
type Call = T::Call;
|
||||
type Call = T::RuntimeCall;
|
||||
type AdditionalSigned = ();
|
||||
type Pre = ();
|
||||
const IDENTIFIER: &'static str = "CheckWeight";
|
||||
@@ -713,13 +713,13 @@ mod tests {
|
||||
};
|
||||
|
||||
// when
|
||||
assert_ok!(calculate_consumed_weight::<<Test as Config>::Call>(
|
||||
assert_ok!(calculate_consumed_weight::<<Test as Config>::RuntimeCall>(
|
||||
maximum_weight.clone(),
|
||||
all_weight.clone(),
|
||||
&mandatory1
|
||||
));
|
||||
assert_err!(
|
||||
calculate_consumed_weight::<<Test as Config>::Call>(
|
||||
calculate_consumed_weight::<<Test as Config>::RuntimeCall>(
|
||||
maximum_weight,
|
||||
all_weight,
|
||||
&mandatory2
|
||||
|
||||
Reference in New Issue
Block a user