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:
Juan
2023-07-14 08:56:48 +02:00
committed by GitHub
parent 0fbeb31d50
commit 6a29a70a92
132 changed files with 234 additions and 235 deletions
@@ -19,7 +19,7 @@
use crate::{
substrate_test_pallet::pallet::Call as PalletCall, AccountId, Balance, BalancesCall,
CheckSubstrateCall, Extrinsic, Index, Pair, RuntimeCall, SignedPayload, TransferData,
CheckSubstrateCall, Extrinsic, Nonce, Pair, RuntimeCall, SignedPayload, TransferData,
};
use codec::Encode;
use frame_system::{CheckNonce, CheckWeight};
@@ -81,7 +81,7 @@ impl TryFrom<&Extrinsic> for TransferData {
pub struct ExtrinsicBuilder {
function: RuntimeCall,
signer: Option<Pair>,
nonce: Option<Index>,
nonce: Option<Nonce>,
}
impl ExtrinsicBuilder {
@@ -176,7 +176,7 @@ impl ExtrinsicBuilder {
}
/// Given `nonce` will be set in `Extrinsic`
pub fn nonce(mut self, nonce: Index) -> Self {
pub fn nonce(mut self, nonce: Nonce) -> Self {
self.nonce = Some(nonce);
self
}
+5 -5
View File
@@ -130,7 +130,7 @@ pub struct TransferData {
pub from: AccountId,
pub to: AccountId,
pub amount: Balance,
pub nonce: Index,
pub nonce: Nonce,
}
/// The address format for describing accounts.
@@ -156,7 +156,7 @@ pub type Hashing = BlakeTwo256;
/// The block number type used in this runtime.
pub type BlockNumber = u64;
/// Index of a transaction.
pub type Index = u64;
pub type Nonce = u64;
/// The item of a block digest.
pub type DigestItem = sp_runtime::generic::DigestItem;
/// The digest of a block.
@@ -345,7 +345,7 @@ impl frame_system::pallet::Config for Runtime {
type BlockLength = ();
type RuntimeOrigin = RuntimeOrigin;
type RuntimeCall = RuntimeCall;
type Index = Index;
type Nonce = Nonce;
type Hash = H256;
type Hashing = Hashing;
type AccountId = AccountId;
@@ -526,8 +526,8 @@ impl_runtime_apis! {
}
}
impl frame_system_rpc_runtime_api::AccountNonceApi<Block, AccountId, Index> for Runtime {
fn account_nonce(account: AccountId) -> Index {
impl frame_system_rpc_runtime_api::AccountNonceApi<Block, AccountId, Nonce> for Runtime {
fn account_nonce(account: AccountId) -> Nonce {
System::account_nonce(account)
}
}