Skip to content

Commit

Permalink
Make CheckNonce refuse transactions signed by accounts with no providers
Browse files Browse the repository at this point in the history
  • Loading branch information
zdave-parity committed Sep 14, 2023
1 parent 49c4b20 commit 3d637c3
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion substrate/frame/system/src/extensions/check_nonce.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ use codec::{Decode, Encode};
use frame_support::dispatch::DispatchInfo;
use scale_info::TypeInfo;
use sp_runtime::{
traits::{DispatchInfoOf, Dispatchable, One, SignedExtension},
traits::{DispatchInfoOf, Dispatchable, One, SignedExtension, Zero},
transaction_validity::{
InvalidTransaction, TransactionLongevity, TransactionValidity, TransactionValidityError,
ValidTransaction,
Expand Down Expand Up @@ -80,6 +80,10 @@ where
_len: usize,
) -> Result<(), TransactionValidityError> {
let mut account = crate::Account::<T>::get(who);
if account.providers.is_zero() && account.sufficients.is_zero() {
// Nonce storage not paid for
return Err(InvalidTransaction::Payment.into())
}
if self.0 != account.nonce {
return Err(if self.0 < account.nonce {
InvalidTransaction::Stale
Expand Down

0 comments on commit 3d637c3

Please sign in to comment.