mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-01 18:17:56 +00:00
Replace system config Index for Nonce (#14290)
* replace Index by Nonce * replace Index by Nonce * replace Index by Nonce * replace Index by Nonce * replace Index by Nonce * wip * remove index in lieu of nonce * wip * remove accountnonce in lieu of nonce * add minor improvement * rebase and merge conflicts
This commit is contained in:
@@ -50,7 +50,7 @@
|
||||
//! - [`CheckWeight`]: Checks the weight and length of the block and ensure that it does not
|
||||
//! exceed the limits.
|
||||
//! - [`CheckNonce`]: Checks the nonce of the transaction. Contains a single payload of type
|
||||
//! `T::Index`.
|
||||
//! `T::Nonce`.
|
||||
//! - [`CheckEra`]: Checks the era of the transaction. Contains a single payload of type `Era`.
|
||||
//! - [`CheckGenesis`]: Checks the provided genesis hash of the transaction. Must be a part of the
|
||||
//! signed payload of the transaction.
|
||||
@@ -217,7 +217,7 @@ pub mod pallet {
|
||||
|
||||
#[frame_support::register_default_impl(TestDefaultConfig)]
|
||||
impl DefaultConfig for TestDefaultConfig {
|
||||
type Index = u32;
|
||||
type Nonce = u32;
|
||||
type Hash = sp_core::hash::H256;
|
||||
type Hashing = sp_runtime::traits::BlakeTwo256;
|
||||
type AccountId = u64;
|
||||
@@ -273,9 +273,8 @@ pub mod pallet {
|
||||
+ Debug
|
||||
+ From<Call<Self>>;
|
||||
|
||||
/// Account index (aka nonce) type. This stores the number of previous transactions
|
||||
/// associated with a sender account.
|
||||
type Index: Parameter
|
||||
/// This stores the number of previous transactions associated with a sender account.
|
||||
type Nonce: Parameter
|
||||
+ Member
|
||||
+ MaybeSerializeDeserialize
|
||||
+ Debug
|
||||
@@ -554,7 +553,7 @@ pub mod pallet {
|
||||
_,
|
||||
Blake2_128Concat,
|
||||
T::AccountId,
|
||||
AccountInfo<T::Index, T::AccountData>,
|
||||
AccountInfo<T::Nonce, T::AccountData>,
|
||||
ValueQuery,
|
||||
>;
|
||||
|
||||
@@ -732,9 +731,9 @@ pub type RefCount = u32;
|
||||
|
||||
/// Information of an account.
|
||||
#[derive(Clone, Eq, PartialEq, Default, RuntimeDebug, Encode, Decode, TypeInfo, MaxEncodedLen)]
|
||||
pub struct AccountInfo<Index, AccountData> {
|
||||
pub struct AccountInfo<Nonce, AccountData> {
|
||||
/// The number of transactions this account has sent.
|
||||
pub nonce: Index,
|
||||
pub nonce: Nonce,
|
||||
/// The number of other modules that currently depend on this account's existence. The account
|
||||
/// cannot be reaped until this is zero.
|
||||
pub consumers: RefCount,
|
||||
@@ -1570,13 +1569,13 @@ impl<T: Config> Pallet<T> {
|
||||
}
|
||||
|
||||
/// Retrieve the account transaction counter from storage.
|
||||
pub fn account_nonce(who: impl EncodeLike<T::AccountId>) -> T::Index {
|
||||
pub fn account_nonce(who: impl EncodeLike<T::AccountId>) -> T::Nonce {
|
||||
Account::<T>::get(who).nonce
|
||||
}
|
||||
|
||||
/// Increment a particular account's nonce by 1.
|
||||
pub fn inc_account_nonce(who: impl EncodeLike<T::AccountId>) {
|
||||
Account::<T>::mutate(who, |a| a.nonce += T::Index::one());
|
||||
Account::<T>::mutate(who, |a| a.nonce += T::Nonce::one());
|
||||
}
|
||||
|
||||
/// Note what the extrinsic data of the current extrinsic index is.
|
||||
@@ -1632,7 +1631,7 @@ impl<T: Config> Pallet<T> {
|
||||
}
|
||||
|
||||
/// An account is being created.
|
||||
pub fn on_created_account(who: T::AccountId, _a: &mut AccountInfo<T::Index, T::AccountData>) {
|
||||
pub fn on_created_account(who: T::AccountId, _a: &mut AccountInfo<T::Nonce, T::AccountData>) {
|
||||
T::OnNewAccount::on_new_account(&who);
|
||||
Self::deposit_event(Event::NewAccount { account: who });
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user