From 00b8ed0217a39b09dcecaa83742b413ba61e0db8 Mon Sep 17 00:00:00 2001 From: Loris Moulin Date: Mon, 2 Mar 2026 17:30:13 -0300 Subject: [PATCH 1/4] remove CreateSignedTransaction impl deadcode --- chain-extensions/src/mock.rs | 16 ---------- pallets/admin-utils/src/tests/mock.rs | 16 ---------- pallets/commitments/src/mock.rs | 25 --------------- pallets/drand/src/lib.rs | 7 ++-- pallets/drand/src/mock.rs | 16 ---------- pallets/subtensor/src/tests/mock.rs | 16 ---------- pallets/transaction-fee/src/tests/mock.rs | 27 ---------------- runtime/src/lib.rs | 39 ----------------------- 8 files changed, 2 insertions(+), 160 deletions(-) diff --git a/chain-extensions/src/mock.rs b/chain-extensions/src/mock.rs index 45c7811adb..ef258a35e5 100644 --- a/chain-extensions/src/mock.rs +++ b/chain-extensions/src/mock.rs @@ -612,22 +612,6 @@ where } } -impl frame_system::offchain::CreateSignedTransaction for Test -where - RuntimeCall: From, -{ - fn create_signed_transaction< - C: frame_system::offchain::AppCrypto, - >( - call: >::RuntimeCall, - _public: Self::Public, - _account: Self::AccountId, - nonce: Self::Nonce, - ) -> Option { - Some(UncheckedExtrinsic::new_signed(call, nonce.into(), (), ())) - } -} - static TEST_LOGS_INIT: OnceLock<()> = OnceLock::new(); pub fn init_logs_for_tests() { diff --git a/pallets/admin-utils/src/tests/mock.rs b/pallets/admin-utils/src/tests/mock.rs index 2d51ecf105..aaeb7e8f7d 100644 --- a/pallets/admin-utils/src/tests/mock.rs +++ b/pallets/admin-utils/src/tests/mock.rs @@ -464,22 +464,6 @@ where } } -impl frame_system::offchain::CreateSignedTransaction for Test -where - RuntimeCall: From, -{ - fn create_signed_transaction< - C: frame_system::offchain::AppCrypto, - >( - call: >::RuntimeCall, - _public: Self::Public, - _account: Self::AccountId, - nonce: Self::Nonce, - ) -> Option { - Some(UncheckedExtrinsic::new_signed(call, nonce, (), ())) - } -} - // Build genesis storage according to the mock runtime. pub fn new_test_ext() -> sp_io::TestExternalities { sp_tracing::try_init_simple(); diff --git a/pallets/commitments/src/mock.rs b/pallets/commitments/src/mock.rs index 24e259b23c..98d49793c7 100644 --- a/pallets/commitments/src/mock.rs +++ b/pallets/commitments/src/mock.rs @@ -176,31 +176,6 @@ where } } -impl frame_system::offchain::CreateSignedTransaction for Test -where - RuntimeCall: From, -{ - fn create_signed_transaction< - C: frame_system::offchain::AppCrypto, - >( - call: >::RuntimeCall, - _public: Self::Public, - _account: Self::AccountId, - nonce: Self::Nonce, - ) -> Option { - // Create a dummy sr25519 signature from a raw byte array - let dummy_raw = [0u8; 64]; - let dummy_signature = sp_core::sr25519::Signature::from(dummy_raw); - let signature = test_crypto::Signature::from(dummy_signature); - Some(UncheckedExtrinsic::new_signed( - call, - nonce.into(), - signature, - (), - )) - } -} - pub fn new_test_ext() -> sp_io::TestExternalities { let t = frame_system::GenesisConfig::::default() .build_storage() diff --git a/pallets/drand/src/lib.rs b/pallets/drand/src/lib.rs index 8666781e56..e417b28f4b 100644 --- a/pallets/drand/src/lib.rs +++ b/pallets/drand/src/lib.rs @@ -43,8 +43,7 @@ use codec::Encode; use frame_support::{pallet_prelude::*, traits::Randomness}; use frame_system::{ offchain::{ - AppCrypto, CreateInherent, CreateSignedTransaction, SendUnsignedTransaction, SignedPayload, - Signer, SigningTypes, + AppCrypto, CreateInherent, SendUnsignedTransaction, SignedPayload, Signer, SigningTypes, }, pallet_prelude::BlockNumberFor, }; @@ -159,9 +158,7 @@ pub mod pallet { pub struct Pallet(_); #[pallet::config] - pub trait Config: - CreateSignedTransaction> + CreateInherent> + frame_system::Config - { + pub trait Config: CreateInherent> + SigningTypes + frame_system::Config { /// The identifier type for an offchain worker. type AuthorityId: AppCrypto; /// something that knows how to verify beacon pulses diff --git a/pallets/drand/src/mock.rs b/pallets/drand/src/mock.rs index 0d1a13b77d..7b6d58f17d 100644 --- a/pallets/drand/src/mock.rs +++ b/pallets/drand/src/mock.rs @@ -76,22 +76,6 @@ where } } -impl frame_system::offchain::CreateSignedTransaction for Test -where - RuntimeCall: From, -{ - fn create_signed_transaction< - C: frame_system::offchain::AppCrypto, - >( - call: RuntimeCall, - _public: ::Signer, - _account: AccountId, - nonce: u64, - ) -> Option { - Some(Extrinsic::new_signed(call, nonce, (), ())) - } -} - parameter_types! { pub const UnsignedPriority: u64 = 1 << 20; } diff --git a/pallets/subtensor/src/tests/mock.rs b/pallets/subtensor/src/tests/mock.rs index 7af9420ba3..3351887412 100644 --- a/pallets/subtensor/src/tests/mock.rs +++ b/pallets/subtensor/src/tests/mock.rs @@ -551,22 +551,6 @@ where } } -impl frame_system::offchain::CreateSignedTransaction for Test -where - RuntimeCall: From, -{ - fn create_signed_transaction< - C: frame_system::offchain::AppCrypto, - >( - call: >::RuntimeCall, - _public: Self::Public, - _account: Self::AccountId, - nonce: Self::Nonce, - ) -> Option { - Some(UncheckedExtrinsic::new_signed(call, nonce.into(), (), ())) - } -} - #[derive_impl(pallet_timestamp::config_preludes::TestDefaultConfig)] impl pallet_timestamp::Config for Test { type MinimumPeriod = ConstU64<0>; diff --git a/pallets/transaction-fee/src/tests/mock.rs b/pallets/transaction-fee/src/tests/mock.rs index e4572bbfea..b5e14ce3fb 100644 --- a/pallets/transaction-fee/src/tests/mock.rs +++ b/pallets/transaction-fee/src/tests/mock.rs @@ -515,33 +515,6 @@ where } } -impl frame_system::offchain::CreateSignedTransaction for Test -where - RuntimeCall: From, -{ - fn create_signed_transaction< - C: frame_system::offchain::AppCrypto, - >( - call: >::RuntimeCall, - _public: Self::Public, - _account: Self::AccountId, - nonce: Self::Nonce, - ) -> Option { - let extra: TransactionExtensions = ( - frame_system::CheckNonZeroSender::::new(), - frame_system::CheckWeight::::new(), - pallet_transaction_payment::ChargeTransactionPayment::::from(0), - ); - - Some(UncheckedExtrinsic::new_signed( - call, - nonce.into(), - (), - extra, - )) - } -} - // Build genesis storage according to the mock runtime. pub fn new_test_ext() -> sp_io::TestExternalities { sp_tracing::try_init_simple(); diff --git a/runtime/src/lib.rs b/runtime/src/lib.rs index 41a00e3f64..ebc249b04d 100644 --- a/runtime/src/lib.rs +++ b/runtime/src/lib.rs @@ -54,7 +54,6 @@ use sp_core::{ crypto::{ByteArray, KeyTypeId}, }; use sp_runtime::Cow; -use sp_runtime::generic::Era; use sp_runtime::{ AccountId32, ApplyExtrinsicResult, ConsensusEngineId, Percent, generic, impl_opaque_keys, traits::{ @@ -153,44 +152,6 @@ impl frame_system::offchain::CreateBare> for Runtime } } -impl frame_system::offchain::CreateSignedTransaction> for Runtime { - fn create_signed_transaction< - S: frame_system::offchain::AppCrypto, - >( - call: RuntimeCall, - public: Self::Public, - account: Self::AccountId, - nonce: Self::Nonce, - ) -> Option { - use sp_runtime::traits::StaticLookup; - - let address = ::Lookup::unlookup(account.clone()); - let extra: TransactionExtensions = ( - frame_system::CheckNonZeroSender::::new(), - frame_system::CheckSpecVersion::::new(), - frame_system::CheckTxVersion::::new(), - frame_system::CheckGenesis::::new(), - frame_system::CheckEra::::from(Era::Immortal), - check_nonce::CheckNonce::::from(nonce).into(), - frame_system::CheckWeight::::new(), - ChargeTransactionPaymentWrapper::new( - pallet_transaction_payment::ChargeTransactionPayment::::from(0), - ), - SudoTransactionExtension::::new(), - pallet_subtensor::SubtensorTransactionExtension::::new(), - pallet_drand::drand_priority::DrandPriority::::new(), - frame_metadata_hash_extension::CheckMetadataHash::::new(true), - ); - - let raw_payload = SignedPayload::new(call.clone(), extra.clone()).ok()?; - let signature = raw_payload.using_encoded(|payload| S::sign(payload, public))?; - - Some(UncheckedExtrinsic::new_signed( - call, address, signature, extra, - )) - } -} - // Subtensor module pub use pallet_scheduler; pub use pallet_subtensor; From 0e79fdfe6a0c13a5b86d25449afed50c9e76e177 Mon Sep 17 00:00:00 2001 From: Loris Moulin Date: Mon, 2 Mar 2026 17:36:06 -0300 Subject: [PATCH 2/4] replace deprecated CreateInherent/new_inherent with CreateBare/new_bare --- chain-extensions/src/mock.rs | 4 ++-- pallets/admin-utils/src/tests/mock.rs | 4 ++-- pallets/commitments/src/mock.rs | 4 ++-- pallets/drand/src/lib.rs | 4 ++-- pallets/drand/src/mock.rs | 4 ++-- pallets/subtensor/src/tests/mock.rs | 4 ++-- pallets/transaction-fee/src/tests/mock.rs | 4 ++-- 7 files changed, 14 insertions(+), 14 deletions(-) diff --git a/chain-extensions/src/mock.rs b/chain-extensions/src/mock.rs index ef258a35e5..8a30788038 100644 --- a/chain-extensions/src/mock.rs +++ b/chain-extensions/src/mock.rs @@ -603,12 +603,12 @@ where type RuntimeCall = RuntimeCall; } -impl frame_system::offchain::CreateInherent for Test +impl frame_system::offchain::CreateBare for Test where RuntimeCall: From, { fn create_bare(call: Self::RuntimeCall) -> Self::Extrinsic { - UncheckedExtrinsic::new_inherent(call) + UncheckedExtrinsic::new_bare(call) } } diff --git a/pallets/admin-utils/src/tests/mock.rs b/pallets/admin-utils/src/tests/mock.rs index aaeb7e8f7d..f18b6147a4 100644 --- a/pallets/admin-utils/src/tests/mock.rs +++ b/pallets/admin-utils/src/tests/mock.rs @@ -455,12 +455,12 @@ where type RuntimeCall = RuntimeCall; } -impl frame_system::offchain::CreateInherent for Test +impl frame_system::offchain::CreateBare for Test where RuntimeCall: From, { fn create_bare(call: Self::RuntimeCall) -> Self::Extrinsic { - UncheckedExtrinsic::new_inherent(call) + UncheckedExtrinsic::new_bare(call) } } diff --git a/pallets/commitments/src/mock.rs b/pallets/commitments/src/mock.rs index 98d49793c7..fd5325faf3 100644 --- a/pallets/commitments/src/mock.rs +++ b/pallets/commitments/src/mock.rs @@ -167,12 +167,12 @@ where type RuntimeCall = RuntimeCall; } -impl frame_system::offchain::CreateInherent for Test +impl frame_system::offchain::CreateBare for Test where RuntimeCall: From, { fn create_bare(call: Self::RuntimeCall) -> Self::Extrinsic { - UncheckedExtrinsic::new_inherent(call) + UncheckedExtrinsic::new_bare(call) } } diff --git a/pallets/drand/src/lib.rs b/pallets/drand/src/lib.rs index e417b28f4b..9b8dd0d1d3 100644 --- a/pallets/drand/src/lib.rs +++ b/pallets/drand/src/lib.rs @@ -43,7 +43,7 @@ use codec::Encode; use frame_support::{pallet_prelude::*, traits::Randomness}; use frame_system::{ offchain::{ - AppCrypto, CreateInherent, SendUnsignedTransaction, SignedPayload, Signer, SigningTypes, + AppCrypto, CreateBare, SendUnsignedTransaction, SignedPayload, Signer, SigningTypes, }, pallet_prelude::BlockNumberFor, }; @@ -158,7 +158,7 @@ pub mod pallet { pub struct Pallet(_); #[pallet::config] - pub trait Config: CreateInherent> + SigningTypes + frame_system::Config { + pub trait Config: CreateBare> + SigningTypes + frame_system::Config { /// The identifier type for an offchain worker. type AuthorityId: AppCrypto; /// something that knows how to verify beacon pulses diff --git a/pallets/drand/src/mock.rs b/pallets/drand/src/mock.rs index 7b6d58f17d..bfe0338e74 100644 --- a/pallets/drand/src/mock.rs +++ b/pallets/drand/src/mock.rs @@ -67,12 +67,12 @@ where type Extrinsic = Extrinsic; } -impl frame_system::offchain::CreateInherent for Test +impl frame_system::offchain::CreateBare for Test where RuntimeCall: From, { fn create_bare(call: RuntimeCall) -> Self::Extrinsic { - Extrinsic::new_inherent(call) + Extrinsic::new_bare(call) } } diff --git a/pallets/subtensor/src/tests/mock.rs b/pallets/subtensor/src/tests/mock.rs index 3351887412..8fc48851a6 100644 --- a/pallets/subtensor/src/tests/mock.rs +++ b/pallets/subtensor/src/tests/mock.rs @@ -542,12 +542,12 @@ where type RuntimeCall = RuntimeCall; } -impl frame_system::offchain::CreateInherent for Test +impl frame_system::offchain::CreateBare for Test where RuntimeCall: From, { fn create_bare(call: Self::RuntimeCall) -> Self::Extrinsic { - UncheckedExtrinsic::new_inherent(call) + UncheckedExtrinsic::new_bare(call) } } diff --git a/pallets/transaction-fee/src/tests/mock.rs b/pallets/transaction-fee/src/tests/mock.rs index b5e14ce3fb..99e12a6b91 100644 --- a/pallets/transaction-fee/src/tests/mock.rs +++ b/pallets/transaction-fee/src/tests/mock.rs @@ -506,12 +506,12 @@ where type RuntimeCall = RuntimeCall; } -impl frame_system::offchain::CreateInherent for Test +impl frame_system::offchain::CreateBare for Test where RuntimeCall: From, { fn create_bare(call: Self::RuntimeCall) -> Self::Extrinsic { - UncheckedExtrinsic::new_inherent(call) + UncheckedExtrinsic::new_bare(call) } } From 412fc4d6b91122c8cb211c2e47b3c7c6bda40919 Mon Sep 17 00:00:00 2001 From: Loris Moulin Date: Mon, 2 Mar 2026 17:40:46 -0300 Subject: [PATCH 3/4] fix clippy --- chain-extensions/src/mock.rs | 4 ++-- pallets/admin-utils/src/tests/mock.rs | 4 ++-- pallets/commitments/src/mock.rs | 3 +-- pallets/drand/src/mock.rs | 5 ++--- pallets/subtensor/src/tests/mock.rs | 4 ++-- pallets/transaction-fee/src/tests/mock.rs | 4 ++-- 6 files changed, 11 insertions(+), 13 deletions(-) diff --git a/chain-extensions/src/mock.rs b/chain-extensions/src/mock.rs index 8a30788038..bb548b6cbd 100644 --- a/chain-extensions/src/mock.rs +++ b/chain-extensions/src/mock.rs @@ -7,13 +7,13 @@ use core::num::NonZeroU64; use frame_support::dispatch::DispatchResult; -use frame_support::traits::{Contains, Everything, InherentBuilder, InsideBoth}; +use frame_support::traits::{Contains, Everything, InsideBoth}; use frame_support::weights::Weight; use frame_support::weights::constants::RocksDbWeight; use frame_support::{PalletId, derive_impl}; use frame_support::{assert_ok, parameter_types, traits::PrivilegeCmp}; use frame_system as system; -use frame_system::{EnsureRoot, RawOrigin, limits, offchain::CreateTransactionBase}; +use frame_system::{EnsureRoot, RawOrigin, limits}; use pallet_contracts::HoldReason as ContractsHoldReason; use pallet_subtensor::*; use pallet_subtensor_proxy as pallet_proxy; diff --git a/pallets/admin-utils/src/tests/mock.rs b/pallets/admin-utils/src/tests/mock.rs index f18b6147a4..514e390e16 100644 --- a/pallets/admin-utils/src/tests/mock.rs +++ b/pallets/admin-utils/src/tests/mock.rs @@ -4,9 +4,9 @@ use core::num::NonZeroU64; use frame_support::{ PalletId, assert_ok, derive_impl, parameter_types, - traits::{Everything, Hooks, InherentBuilder, PrivilegeCmp}, + traits::{Everything, Hooks, PrivilegeCmp}, }; -use frame_system::{self as system, offchain::CreateTransactionBase}; +use frame_system::{self as system}; use frame_system::{EnsureRoot, limits}; use sp_consensus_aura::sr25519::AuthorityId as AuraId; use sp_consensus_grandpa::AuthorityList as GrandpaAuthorityList; diff --git a/pallets/commitments/src/mock.rs b/pallets/commitments/src/mock.rs index fd5325faf3..f45e4bd2c2 100644 --- a/pallets/commitments/src/mock.rs +++ b/pallets/commitments/src/mock.rs @@ -3,9 +3,8 @@ use crate as pallet_commitments; use frame_support::{ derive_impl, pallet_prelude::{Get, TypeInfo}, - traits::{ConstU32, ConstU64, InherentBuilder}, + traits::{ConstU32, ConstU64}, }; -use frame_system::offchain::CreateTransactionBase; use sp_core::H256; use sp_runtime::{ BuildStorage, diff --git a/pallets/drand/src/mock.rs b/pallets/drand/src/mock.rs index bfe0338e74..20f4886132 100644 --- a/pallets/drand/src/mock.rs +++ b/pallets/drand/src/mock.rs @@ -3,14 +3,14 @@ use crate::verifier::*; use crate::*; use frame_support::{ derive_impl, parameter_types, - traits::{ConstU16, ConstU64, InherentBuilder}, + traits::{ConstU16, ConstU64}, }; use sp_core::{H256, sr25519::Signature}; use sp_keystore::{KeystoreExt, testing::MemoryKeystore}; use sp_runtime::{ BuildStorage, testing::TestXt, - traits::{BlakeTwo256, IdentifyAccount, IdentityLookup, Verify}, + traits::{BlakeTwo256, IdentityLookup, Verify}, }; type Block = frame_system::mocking::MockBlock; @@ -52,7 +52,6 @@ impl frame_system::Config for Test { } type Extrinsic = TestXt; -type AccountId = <::Signer as IdentifyAccount>::AccountId; impl frame_system::offchain::SigningTypes for Test { type Public = ::Signer; diff --git a/pallets/subtensor/src/tests/mock.rs b/pallets/subtensor/src/tests/mock.rs index 8fc48851a6..0efc6311ee 100644 --- a/pallets/subtensor/src/tests/mock.rs +++ b/pallets/subtensor/src/tests/mock.rs @@ -8,7 +8,7 @@ use core::num::NonZeroU64; use crate::utils::rate_limiting::TransactionType; use crate::*; -use frame_support::traits::{Contains, Everything, InherentBuilder, InsideBoth, InstanceFilter}; +use frame_support::traits::{Contains, Everything, InsideBoth, InstanceFilter}; use frame_support::weights::Weight; use frame_support::weights::constants::RocksDbWeight; use frame_support::{PalletId, derive_impl}; @@ -17,7 +17,7 @@ use frame_support::{ traits::{Hooks, PrivilegeCmp}, }; use frame_system as system; -use frame_system::{EnsureRoot, RawOrigin, limits, offchain::CreateTransactionBase}; +use frame_system::{EnsureRoot, RawOrigin, limits}; use pallet_subtensor_proxy as pallet_proxy; use pallet_subtensor_utility as pallet_utility; use sp_consensus_aura::sr25519::AuthorityId as AuraId; diff --git a/pallets/transaction-fee/src/tests/mock.rs b/pallets/transaction-fee/src/tests/mock.rs index 99e12a6b91..709fa23407 100644 --- a/pallets/transaction-fee/src/tests/mock.rs +++ b/pallets/transaction-fee/src/tests/mock.rs @@ -5,11 +5,11 @@ use core::num::NonZeroU64; use crate::TransactionFeeHandler; use frame_support::{ PalletId, assert_ok, derive_impl, parameter_types, - traits::{Everything, Hooks, InherentBuilder, PrivilegeCmp}, + traits::{Everything, Hooks, PrivilegeCmp}, weights::IdentityFee, }; use frame_system::{ - self as system, EnsureRoot, RawOrigin, limits, offchain::CreateTransactionBase, + self as system, EnsureRoot, RawOrigin, limits, }; pub use pallet_subtensor::*; pub use sp_core::U256; From d1395a7a4f4dd2e819d8756e88658c4cd0903468 Mon Sep 17 00:00:00 2001 From: Loris Moulin Date: Mon, 2 Mar 2026 17:44:52 -0300 Subject: [PATCH 4/4] cargo fmt --- pallets/transaction-fee/src/tests/mock.rs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/pallets/transaction-fee/src/tests/mock.rs b/pallets/transaction-fee/src/tests/mock.rs index 709fa23407..8870d07733 100644 --- a/pallets/transaction-fee/src/tests/mock.rs +++ b/pallets/transaction-fee/src/tests/mock.rs @@ -8,9 +8,7 @@ use frame_support::{ traits::{Everything, Hooks, PrivilegeCmp}, weights::IdentityFee, }; -use frame_system::{ - self as system, EnsureRoot, RawOrigin, limits, -}; +use frame_system::{self as system, EnsureRoot, RawOrigin, limits}; pub use pallet_subtensor::*; pub use sp_core::U256; use sp_core::{ConstU64, H256};