From 7ac0548a89b4fe78eee5387d45f509f605295911 Mon Sep 17 00:00:00 2001 From: plind-dm <59729252+plind-dm@users.noreply.github.com> Date: Thu, 9 Apr 2026 16:31:42 +0900 Subject: [PATCH 1/4] fix: clear RootAlphaDividendsPerSubnet on network removal RootAlphaDividendsPerSubnet is not cleaned up when a subnet is dissolved. Since netuids are recycled (subnet.rs:178-186), stale root dividend entries from the old subnet persist and become visible to the new subnet, potentially affecting run_coinbase dividend calculations. Add clear_prefix for RootAlphaDividendsPerSubnet alongside the existing AlphaDividendsPerSubnet cleanup in remove_network. Closes #1867 --- pallets/subtensor/src/coinbase/root.rs | 3 + pallets/subtensor/src/tests/networks.rs | 73 +++++++++++++++++++++++++ 2 files changed, 76 insertions(+) diff --git a/pallets/subtensor/src/coinbase/root.rs b/pallets/subtensor/src/coinbase/root.rs index a4f3c0df8c..413a503ce7 100644 --- a/pallets/subtensor/src/coinbase/root.rs +++ b/pallets/subtensor/src/coinbase/root.rs @@ -368,6 +368,9 @@ impl Pallet { let _ = NeuronCertificates::::clear_prefix(netuid, u32::MAX, None); let _ = Prometheus::::clear_prefix(netuid, u32::MAX, None); let _ = AlphaDividendsPerSubnet::::clear_prefix(netuid, u32::MAX, None); + let _ = RootAlphaDividendsPerSubnet::::clear_prefix(netuid, u32::MAX, None); + let _ = VotingPower::::clear_prefix(netuid, u32::MAX, None); + let _ = RootClaimed::::clear_prefix((netuid,), u32::MAX, None); let _ = PendingChildKeys::::clear_prefix(netuid, u32::MAX, None); let _ = AssociatedEvmAddress::::clear_prefix(netuid, u32::MAX, None); diff --git a/pallets/subtensor/src/tests/networks.rs b/pallets/subtensor/src/tests/networks.rs index 216c256a75..c389bebac6 100644 --- a/pallets/subtensor/src/tests/networks.rs +++ b/pallets/subtensor/src/tests/networks.rs @@ -2632,3 +2632,76 @@ fn register_network_non_associated_hotkey_does_not_withdraw_or_write_owner_alpha ); }); } + +#[test] +fn dissolve_network_clears_root_alpha_dividends() { + new_test_ext(0).execute_with(|| { + let cold = U256::from(1); + let hot = U256::from(2); + let net = add_dynamic_network(&hot, &cold); + + // Insert some root alpha dividend data for this subnet. + RootAlphaDividendsPerSubnet::::insert(net, hot, AlphaBalance::from(1000)); + assert!(RootAlphaDividendsPerSubnet::::contains_key(net, hot)); + + // Dissolve the network. + SubtensorModule::set_subnet_locked_balance(net, TaoBalance::from(0)); + SubnetTAO::::insert(net, TaoBalance::from(0)); + Emission::::insert(net, Vec::::new()); + assert_ok!(SubtensorModule::do_dissolve_network(net)); + + // RootAlphaDividendsPerSubnet should be cleared. + assert!( + !RootAlphaDividendsPerSubnet::::contains_key(net, hot), + "RootAlphaDividendsPerSubnet not cleaned up after network removal" + ); + }); +} + +#[test] +fn dissolve_network_clears_voting_power() { + new_test_ext(0).execute_with(|| { + let cold = U256::from(1); + let hot = U256::from(2); + let net = add_dynamic_network(&hot, &cold); + + // Insert voting power for a validator on this subnet. + VotingPower::::insert(net, hot, 9999u64); + assert!(VotingPower::::contains_key(net, hot)); + + // Dissolve the network. + SubtensorModule::set_subnet_locked_balance(net, TaoBalance::from(0)); + SubnetTAO::::insert(net, TaoBalance::from(0)); + Emission::::insert(net, Vec::::new()); + assert_ok!(SubtensorModule::do_dissolve_network(net)); + + assert!( + !VotingPower::::contains_key(net, hot), + "VotingPower not cleaned up after network removal" + ); + }); +} + +#[test] +fn dissolve_network_clears_root_claimed() { + new_test_ext(0).execute_with(|| { + let cold = U256::from(1); + let hot = U256::from(2); + let net = add_dynamic_network(&hot, &cold); + + // Simulate a recorded root claim for this subnet. + RootClaimed::::insert((net, hot, cold), 500u128); + assert!(RootClaimed::::contains_key((net, hot, cold))); + + // Dissolve the network. + SubtensorModule::set_subnet_locked_balance(net, TaoBalance::from(0)); + SubnetTAO::::insert(net, TaoBalance::from(0)); + Emission::::insert(net, Vec::::new()); + assert_ok!(SubtensorModule::do_dissolve_network(net)); + + assert!( + !RootClaimed::::contains_key((net, hot, cold)), + "RootClaimed not cleaned up after network removal" + ); + }); +} From 0010253ab4e4f93de4cb8a7eb2922829e8ad8716 Mon Sep 17 00:00:00 2001 From: plind-dm <59729252+plind-dm@users.noreply.github.com> Date: Thu, 9 Apr 2026 22:03:05 +0900 Subject: [PATCH 2/4] fix: clean up AllowancesStorage on subnet deregistration Add PrecompileCleanupInterface trait to allow the pallet to invoke cross-crate storage cleanup when a subnet is removed. The precompiles crate iterates and removes all AllowancesStorage entries matching the dissolved netuid, preventing stale EVM approvals from carrying over when the netuid is recycled. --- pallets/subtensor/src/coinbase/root.rs | 1 + pallets/subtensor/src/lib.rs | 5 +++ pallets/subtensor/src/macros/config.rs | 5 ++- pallets/subtensor/src/tests/mock.rs | 6 ++++ precompiles/src/lib.rs | 2 +- precompiles/src/staking.rs | 45 ++++++++++++++++++++++++++ runtime/src/lib.rs | 10 +++++- 7 files changed, 71 insertions(+), 3 deletions(-) diff --git a/pallets/subtensor/src/coinbase/root.rs b/pallets/subtensor/src/coinbase/root.rs index 413a503ce7..61bfeb260b 100644 --- a/pallets/subtensor/src/coinbase/root.rs +++ b/pallets/subtensor/src/coinbase/root.rs @@ -218,6 +218,7 @@ impl Pallet { Self::destroy_alpha_in_out_stakes(netuid)?; T::SwapInterface::clear_protocol_liquidity(netuid)?; T::CommitmentsInterface::purge_netuid(netuid); + T::PrecompileCleanupInterface::purge_netuid(netuid); // --- Remove the network Self::remove_network(netuid); diff --git a/pallets/subtensor/src/lib.rs b/pallets/subtensor/src/lib.rs index 3c56cebfa2..21086f6d10 100644 --- a/pallets/subtensor/src/lib.rs +++ b/pallets/subtensor/src/lib.rs @@ -2747,3 +2747,8 @@ impl ProxyInterface for () { pub trait CommitmentsInterface { fn purge_netuid(netuid: NetUid); } + +/// EVM precompile crates implement this to clean up storage when a subnet is removed. +pub trait PrecompileCleanupInterface { + fn purge_netuid(netuid: NetUid); +} diff --git a/pallets/subtensor/src/macros/config.rs b/pallets/subtensor/src/macros/config.rs index b3da63e437..280dd0a58e 100644 --- a/pallets/subtensor/src/macros/config.rs +++ b/pallets/subtensor/src/macros/config.rs @@ -6,7 +6,7 @@ use frame_support::pallet_macros::pallet_section; #[pallet_section] mod config { - use crate::{CommitmentsInterface, GetAlphaForTao, GetTaoForAlpha}; + use crate::{CommitmentsInterface, GetAlphaForTao, GetTaoForAlpha, PrecompileCleanupInterface}; use pallet_commitments::GetCommitments; use subtensor_runtime_common::AuthorshipInfo; use subtensor_swap_interface::{SwapEngine, SwapHandler}; @@ -60,6 +60,9 @@ mod config { /// Interface to clean commitments on network dissolution. type CommitmentsInterface: CommitmentsInterface; + /// Interface to clean EVM precompile storage on network dissolution. + type PrecompileCleanupInterface: PrecompileCleanupInterface; + /// Rate limit for associating an EVM key. type EvmKeyAssociateRateLimit: Get; diff --git a/pallets/subtensor/src/tests/mock.rs b/pallets/subtensor/src/tests/mock.rs index fa16b3d0f2..44fc33bd3c 100644 --- a/pallets/subtensor/src/tests/mock.rs +++ b/pallets/subtensor/src/tests/mock.rs @@ -319,6 +319,7 @@ impl crate::Config for Test { type GetCommitments = (); type MaxImmuneUidsPercentage = MaxImmuneUidsPercentage; type CommitmentsInterface = CommitmentsI; + type PrecompileCleanupInterface = PrecompileCleanupI; type EvmKeyAssociateRateLimit = EvmKeyAssociateRateLimit; type AuthorshipProvider = MockAuthorshipProvider; type WeightInfo = (); @@ -361,6 +362,11 @@ impl CommitmentsInterface for CommitmentsI { fn purge_netuid(_netuid: NetUid) {} } +pub struct PrecompileCleanupI; +impl PrecompileCleanupInterface for PrecompileCleanupI { + fn purge_netuid(_netuid: NetUid) {} +} + parameter_types! { pub MaximumSchedulerWeight: Weight = Perbill::from_percent(80) * BlockWeights::get().max_block; diff --git a/precompiles/src/lib.rs b/precompiles/src/lib.rs index a824ac39d4..c0203a77d7 100644 --- a/precompiles/src/lib.rs +++ b/precompiles/src/lib.rs @@ -55,7 +55,7 @@ mod metagraph; mod neuron; mod proxy; mod sr25519; -mod staking; +pub mod staking; mod storage_query; mod subnet; mod uid_lookup; diff --git a/precompiles/src/staking.rs b/precompiles/src/staking.rs index 30d28aaa13..752b23df60 100644 --- a/precompiles/src/staking.rs +++ b/precompiles/src/staking.rs @@ -74,6 +74,22 @@ pub type AllowancesStorage = StorageDoubleMap< ValueQuery, >; +/// Remove all AllowancesStorage entries whose key contains the given netuid. +pub fn purge_netuid_allowances(netuid: u16) { + let to_remove: Vec<(H160, (H160, u16))> = AllowancesStorage::iter() + .filter_map(|(approver, (spender, n), _)| { + if n == netuid { + Some((approver, (spender, n))) + } else { + None + } + }) + .collect(); + for (approver, key) in to_remove { + AllowancesStorage::remove(approver, key); + } +} + // Old StakingPrecompile had ETH-precision in values, which was not alligned with Substrate API. So // it's kinda deprecated, but exists for backward compatibility. Eventually, we should remove it // to stop supporting both precompiles. @@ -895,3 +911,32 @@ fn try_u64_from_u256(value: U256) -> Result { exit_status: ExitError::Other("the value is outside of u64 bounds".into()), }) } + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn purge_netuid_allowances_removes_only_target_netuid() { + sp_io::TestExternalities::default().execute_with(|| { + let approver = H160::from_low_u64_be(1); + let spender = H160::from_low_u64_be(2); + let netuid_a: u16 = 5; + let netuid_b: u16 = 7; + + AllowancesStorage::insert(approver, (spender, netuid_a), U256::from(100)); + AllowancesStorage::insert(approver, (spender, netuid_b), U256::from(200)); + + purge_netuid_allowances(netuid_a); + + assert_eq!( + AllowancesStorage::get(approver, (spender, netuid_a)), + U256::zero(), + ); + assert_eq!( + AllowancesStorage::get(approver, (spender, netuid_b)), + U256::from(200), + ); + }); + } +} diff --git a/runtime/src/lib.rs b/runtime/src/lib.rs index a077185341..626c4f4bce 100644 --- a/runtime/src/lib.rs +++ b/runtime/src/lib.rs @@ -41,7 +41,7 @@ use pallet_subtensor::rpc_info::{ stake_info::StakeInfo, subnet_info::{SubnetHyperparams, SubnetHyperparamsV2, SubnetInfo, SubnetInfov2}, }; -use pallet_subtensor::{CommitmentsInterface, ProxyInterface}; +use pallet_subtensor::{CommitmentsInterface, PrecompileCleanupInterface, ProxyInterface}; use pallet_subtensor_proxy as pallet_proxy; use pallet_subtensor_swap_runtime_api::{SimSwapResult, SubnetPrice}; use pallet_subtensor_utility as pallet_utility; @@ -878,6 +878,13 @@ impl CommitmentsInterface for CommitmentsI { } } +pub struct PrecompileCleanupI; +impl PrecompileCleanupInterface for PrecompileCleanupI { + fn purge_netuid(netuid: NetUid) { + subtensor_precompiles::staking::purge_netuid_allowances(>::from(netuid)); + } +} + parameter_types! { pub MaximumSchedulerWeight: Weight = Perbill::from_percent(80) * BlockWeights::get().max_block; @@ -1199,6 +1206,7 @@ impl pallet_subtensor::Config for Runtime { type GetCommitments = GetCommitmentsStruct; type MaxImmuneUidsPercentage = MaxImmuneUidsPercentage; type CommitmentsInterface = CommitmentsI; + type PrecompileCleanupInterface = PrecompileCleanupI; type EvmKeyAssociateRateLimit = EvmKeyAssociateRateLimit; type AuthorshipProvider = BlockAuthorFromAura; type WeightInfo = pallet_subtensor::weights::SubstrateWeight; From 2ebeb54d2284d3983d6de9a102af9107f24e471b Mon Sep 17 00:00:00 2001 From: plind-dm <59729252+plind-dm@users.noreply.github.com> Date: Thu, 9 Apr 2026 22:04:38 +0900 Subject: [PATCH 3/4] style: fix rustfmt formatting --- runtime/src/lib.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/runtime/src/lib.rs b/runtime/src/lib.rs index 626c4f4bce..bbcc3676b0 100644 --- a/runtime/src/lib.rs +++ b/runtime/src/lib.rs @@ -881,7 +881,9 @@ impl CommitmentsInterface for CommitmentsI { pub struct PrecompileCleanupI; impl PrecompileCleanupInterface for PrecompileCleanupI { fn purge_netuid(netuid: NetUid) { - subtensor_precompiles::staking::purge_netuid_allowances(>::from(netuid)); + subtensor_precompiles::staking::purge_netuid_allowances(>::from( + netuid, + )); } } From 7a8fbabfc07779a45f0b482b80ea48d891ba49cc Mon Sep 17 00:00:00 2001 From: plind-dm <59729252+plind-dm@users.noreply.github.com> Date: Thu, 9 Apr 2026 22:11:32 +0900 Subject: [PATCH 4/4] fix: add missing orphaned storage cleanup and mock wiring Add PrecompileCleanupInterface no-op to all test mocks (chain-extensions, eco-tests, admin-utils, transaction-fee). Clean up additional orphaned storage items on subnet deregistration: MinAllowedUids, MaxWeightsLimit, AdjustmentAlpha, AdjustmentInterval, MinNonImmuneUids, RootProp, RecycleOrBurn, RootClaimableThreshold, VotingPower, VotingPowerTrackingEnabled, VotingPowerDisableAtBlock, VotingPowerEmaAlpha. Move PrecompileCleanup struct into the precompiles crate for cleaner wiring. --- chain-extensions/src/mock.rs | 6 ++++++ eco-tests/src/mock.rs | 6 ++++++ pallets/admin-utils/src/tests/mock.rs | 6 ++++++ pallets/subtensor/src/coinbase/root.rs | 18 +++++++++++++++++- pallets/transaction-fee/src/tests/mock.rs | 6 ++++++ precompiles/src/lib.rs | 12 +++++++++++- runtime/src/lib.rs | 13 ++----------- 7 files changed, 54 insertions(+), 13 deletions(-) diff --git a/chain-extensions/src/mock.rs b/chain-extensions/src/mock.rs index e3b7eb2e94..2c744db9c6 100644 --- a/chain-extensions/src/mock.rs +++ b/chain-extensions/src/mock.rs @@ -421,6 +421,7 @@ impl pallet_subtensor::Config for Test { type GetCommitments = (); type MaxImmuneUidsPercentage = MaxImmuneUidsPercentage; type CommitmentsInterface = CommitmentsI; + type PrecompileCleanupInterface = PrecompileCleanupI; type EvmKeyAssociateRateLimit = EvmKeyAssociateRateLimit; type AuthorshipProvider = MockAuthorshipProvider; type WeightInfo = (); @@ -463,6 +464,11 @@ impl CommitmentsInterface for CommitmentsI { fn purge_netuid(_netuid: NetUid) {} } +pub struct PrecompileCleanupI; +impl pallet_subtensor::PrecompileCleanupInterface for PrecompileCleanupI { + fn purge_netuid(_netuid: NetUid) {} +} + parameter_types! { pub MaximumSchedulerWeight: Weight = Perbill::from_percent(80) * BlockWeights::get().max_block; diff --git a/eco-tests/src/mock.rs b/eco-tests/src/mock.rs index 65cb6eac03..16a74a899e 100644 --- a/eco-tests/src/mock.rs +++ b/eco-tests/src/mock.rs @@ -306,6 +306,7 @@ impl pallet_subtensor::Config for Test { type GetCommitments = (); type MaxImmuneUidsPercentage = MaxImmuneUidsPercentage; type CommitmentsInterface = CommitmentsI; + type PrecompileCleanupInterface = PrecompileCleanupI; type EvmKeyAssociateRateLimit = EvmKeyAssociateRateLimit; type AuthorshipProvider = MockAuthorshipProvider; type WeightInfo = (); @@ -346,6 +347,11 @@ impl CommitmentsInterface for CommitmentsI { fn purge_netuid(_netuid: NetUid) {} } +pub struct PrecompileCleanupI; +impl pallet_subtensor::PrecompileCleanupInterface for PrecompileCleanupI { + fn purge_netuid(_netuid: NetUid) {} +} + parameter_types! { pub MaximumSchedulerWeight: Weight = Perbill::from_percent(80) * BlockWeights::get().max_block; diff --git a/pallets/admin-utils/src/tests/mock.rs b/pallets/admin-utils/src/tests/mock.rs index 2596d80069..157dd84b4b 100644 --- a/pallets/admin-utils/src/tests/mock.rs +++ b/pallets/admin-utils/src/tests/mock.rs @@ -230,6 +230,7 @@ impl pallet_subtensor::Config for Test { type GetCommitments = (); type MaxImmuneUidsPercentage = MaxImmuneUidsPercentage; type CommitmentsInterface = CommitmentsI; + type PrecompileCleanupInterface = PrecompileCleanupI; type EvmKeyAssociateRateLimit = EvmKeyAssociateRateLimit; type AuthorshipProvider = MockAuthorshipProvider; type WeightInfo = (); @@ -366,6 +367,11 @@ impl pallet_subtensor::CommitmentsInterface for CommitmentsI { fn purge_netuid(_netuid: NetUid) {} } +pub struct PrecompileCleanupI; +impl pallet_subtensor::PrecompileCleanupInterface for PrecompileCleanupI { + fn purge_netuid(_netuid: NetUid) {} +} + pub struct GrandpaInterfaceImpl; impl crate::GrandpaInterface for GrandpaInterfaceImpl { fn schedule_change( diff --git a/pallets/subtensor/src/coinbase/root.rs b/pallets/subtensor/src/coinbase/root.rs index 61bfeb260b..09f3329568 100644 --- a/pallets/subtensor/src/coinbase/root.rs +++ b/pallets/subtensor/src/coinbase/root.rs @@ -16,7 +16,7 @@ // DEALINGS IN THE SOFTWARE. use super::*; -use crate::CommitmentsInterface; +use crate::{CommitmentsInterface, PrecompileCleanupInterface}; use safe_math::*; use substrate_fixed::types::{I64F64, U96F32}; use subtensor_runtime_common::{AlphaBalance, NetUid, NetUidStorageIndex, TaoBalance, Token}; @@ -283,9 +283,14 @@ impl Pallet { Kappa::::remove(netuid); Difficulty::::remove(netuid); MaxAllowedUids::::remove(netuid); + MinAllowedUids::::remove(netuid); ImmunityPeriod::::remove(netuid); ActivityCutoff::::remove(netuid); MinAllowedWeights::::remove(netuid); + MaxWeightsLimit::::remove(netuid); + AdjustmentAlpha::::remove(netuid); + AdjustmentInterval::::remove(netuid); + MinNonImmuneUids::::remove(netuid); RegistrationsThisInterval::::remove(netuid); POWRegistrationsThisInterval::::remove(netuid); BurnRegistrationsThisInterval::::remove(netuid); @@ -301,6 +306,11 @@ impl Pallet { SubnetEmaTaoFlow::::remove(netuid); SubnetTaoProvided::::remove(netuid); + // --- 12. Root / emission split parameters. + RootProp::::remove(netuid); + RecycleOrBurn::::remove(netuid); + RootClaimableThreshold::::remove(netuid); + // --- 13. Token / mechanism / registration toggles. TokenSymbol::::remove(netuid); SubnetMechanism::::remove(netuid); @@ -363,6 +373,12 @@ impl Pallet { StakeWeight::::remove(netuid); LoadedEmission::::remove(netuid); + // --- 18b. Voting power. + let _ = VotingPower::::clear_prefix(netuid, u32::MAX, None); + VotingPowerTrackingEnabled::::remove(netuid); + VotingPowerDisableAtBlock::::remove(netuid); + VotingPowerEmaAlpha::::remove(netuid); + // --- 19. DMAPs where netuid is the FIRST key: clear by prefix. let _ = BlockAtRegistration::::clear_prefix(netuid, u32::MAX, None); let _ = Axons::::clear_prefix(netuid, u32::MAX, None); diff --git a/pallets/transaction-fee/src/tests/mock.rs b/pallets/transaction-fee/src/tests/mock.rs index a897e82cb6..85e66898d8 100644 --- a/pallets/transaction-fee/src/tests/mock.rs +++ b/pallets/transaction-fee/src/tests/mock.rs @@ -302,6 +302,7 @@ impl pallet_subtensor::Config for Test { type GetCommitments = (); type MaxImmuneUidsPercentage = MaxImmuneUidsPercentage; type CommitmentsInterface = CommitmentsI; + type PrecompileCleanupInterface = PrecompileCleanupI; type EvmKeyAssociateRateLimit = EvmKeyAssociateRateLimit; type AuthorshipProvider = MockAuthorshipProvider; type WeightInfo = (); @@ -438,6 +439,11 @@ impl pallet_subtensor::CommitmentsInterface for CommitmentsI { fn purge_netuid(_netuid: NetUid) {} } +pub struct PrecompileCleanupI; +impl pallet_subtensor::PrecompileCleanupInterface for PrecompileCleanupI { + fn purge_netuid(_netuid: NetUid) {} +} + parameter_types! { pub MaximumSchedulerWeight: Weight = Perbill::from_percent(80) * BlockWeights::get().max_block; diff --git a/precompiles/src/lib.rs b/precompiles/src/lib.rs index c0203a77d7..2633de7405 100644 --- a/precompiles/src/lib.rs +++ b/precompiles/src/lib.rs @@ -38,7 +38,7 @@ pub use metagraph::MetagraphPrecompile; pub use neuron::NeuronPrecompile; pub use proxy::ProxyPrecompile; pub use sr25519::Sr25519Verify; -pub use staking::{StakingPrecompile, StakingPrecompileV2}; +pub use staking::{StakingPrecompile, StakingPrecompileV2, purge_netuid_allowances}; pub use storage_query::StorageQueryPrecompile; pub use subnet::SubnetPrecompile; pub use uid_lookup::UidLookupPrecompile; @@ -285,6 +285,16 @@ where } } +/// Implementation of [`pallet_subtensor::PrecompileCleanupInterface`] that cleans up +/// EVM precompile storage (e.g. staking allowances) when a subnet is deregistered. +pub struct PrecompileCleanup; + +impl pallet_subtensor::PrecompileCleanupInterface for PrecompileCleanup { + fn purge_netuid(netuid: subtensor_runtime_common::NetUid) { + purge_netuid_allowances(netuid.into()); + } +} + fn hash(a: u64) -> H160 { H160::from_low_u64_be(a) } diff --git a/runtime/src/lib.rs b/runtime/src/lib.rs index bbcc3676b0..7cdedb9dfa 100644 --- a/runtime/src/lib.rs +++ b/runtime/src/lib.rs @@ -41,7 +41,7 @@ use pallet_subtensor::rpc_info::{ stake_info::StakeInfo, subnet_info::{SubnetHyperparams, SubnetHyperparamsV2, SubnetInfo, SubnetInfov2}, }; -use pallet_subtensor::{CommitmentsInterface, PrecompileCleanupInterface, ProxyInterface}; +use pallet_subtensor::{CommitmentsInterface, ProxyInterface}; use pallet_subtensor_proxy as pallet_proxy; use pallet_subtensor_swap_runtime_api::{SimSwapResult, SubnetPrice}; use pallet_subtensor_utility as pallet_utility; @@ -878,15 +878,6 @@ impl CommitmentsInterface for CommitmentsI { } } -pub struct PrecompileCleanupI; -impl PrecompileCleanupInterface for PrecompileCleanupI { - fn purge_netuid(netuid: NetUid) { - subtensor_precompiles::staking::purge_netuid_allowances(>::from( - netuid, - )); - } -} - parameter_types! { pub MaximumSchedulerWeight: Weight = Perbill::from_percent(80) * BlockWeights::get().max_block; @@ -1208,7 +1199,7 @@ impl pallet_subtensor::Config for Runtime { type GetCommitments = GetCommitmentsStruct; type MaxImmuneUidsPercentage = MaxImmuneUidsPercentage; type CommitmentsInterface = CommitmentsI; - type PrecompileCleanupInterface = PrecompileCleanupI; + type PrecompileCleanupInterface = subtensor_precompiles::PrecompileCleanup; type EvmKeyAssociateRateLimit = EvmKeyAssociateRateLimit; type AuthorshipProvider = BlockAuthorFromAura; type WeightInfo = pallet_subtensor::weights::SubstrateWeight;