Skip to content
Snippets Groups Projects
Unverified Commit 4ada34bd authored by Bastian Köcher's avatar Bastian Köcher Committed by GitHub
Browse files

`CheckOnlySudoAccount`: Provide some tags (#7838)


Close: https://github.com/paritytech/polkadot-sdk/issues/7816

---------

Co-authored-by: default avatarcmd[bot] <41898282+github-actions[bot]@users.noreply.github.com>
parent 007565a7
Branches
No related merge requests found
Pipeline #518400 waiting for manual action with stages
in 30 minutes and 13 seconds
......@@ -299,7 +299,6 @@ pub type TxExtension = (
frame_system::CheckTxVersion<Runtime>,
frame_system::CheckGenesis<Runtime>,
frame_system::CheckEra<Runtime>,
frame_system::CheckNonce<Runtime>,
frame_system::CheckWeight<Runtime>,
frame_system::WeightReclaim<Runtime>,
);
......
title: '`CheckOnlySudoAccount`: Provide some tags'
doc:
- audience: Runtime User
description: Let `CheckOnlySudoAccount` provide some tags to make the tx pool happy.
crates:
- name: pallet-sudo
bump: patch
......@@ -16,13 +16,14 @@
// limitations under the License.
use crate::{Config, Key};
use alloc::vec;
use codec::{Decode, DecodeWithMemTracking, Encode};
use core::{fmt, marker::PhantomData};
use frame_support::{dispatch::DispatchInfo, ensure, pallet_prelude::TransactionSource};
use scale_info::TypeInfo;
use sp_runtime::{
impl_tx_ext_default,
traits::{AsSystemOriginSigner, DispatchInfoOf, Dispatchable, TransactionExtension},
traits::{AsSystemOriginSigner, DispatchInfoOf, Dispatchable, Hash, TransactionExtension},
transaction_validity::{
InvalidTransaction, TransactionPriority, TransactionValidityError, UnknownTransaction,
ValidTransaction,
......@@ -31,7 +32,7 @@ use sp_runtime::{
/// Ensure that signed transactions are only valid if they are signed by sudo account.
///
/// In the initial phase of a chain without any tokens you can not prevent accounts from sending
/// In the initial phase of a chain without any tokens you cannot prevent accounts from sending
/// transactions.
/// These transactions would enter the transaction pool as the succeed the validation, but would
/// fail on applying them as they are not allowed/disabled/whatever. This would be some huge dos
......@@ -89,7 +90,7 @@ where
fn validate(
&self,
origin: <<T as frame_system::Config>::RuntimeCall as Dispatchable>::RuntimeOrigin,
_call: &<T as frame_system::Config>::RuntimeCall,
call: &<T as frame_system::Config>::RuntimeCall,
info: &DispatchInfoOf<<T as frame_system::Config>::RuntimeCall>,
_len: usize,
_self_implicit: Self::Implicit,
......@@ -110,6 +111,7 @@ where
Ok((
ValidTransaction {
priority: info.total_weight().ref_time() as TransactionPriority,
provides: vec![(who, T::Hashing::hash_of(call)).encode()],
..Default::default()
},
(),
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment