From 8169d7b1027c1184d7470e9ef326d8d3bf5eec49 Mon Sep 17 00:00:00 2001 From: alexthebuildr <116134064+ztsalexey@users.noreply.github.com> Date: Mon, 8 Dec 2025 13:57:09 -0700 Subject: [PATCH] Revert "MevShield / Transaction Extension" --- pallets/shield/src/lib.rs | 101 ++------------------------------------ 1 file changed, 5 insertions(+), 96 deletions(-) diff --git a/pallets/shield/src/lib.rs b/pallets/shield/src/lib.rs index 22cf3240a1..e60bb2a6dc 100644 --- a/pallets/shield/src/lib.rs +++ b/pallets/shield/src/lib.rs @@ -16,22 +16,20 @@ pub mod pallet { use super::*; use codec::Encode; use frame_support::{ - dispatch::{DispatchInfo, GetDispatchInfo, PostDispatchInfo}, + dispatch::{GetDispatchInfo, PostDispatchInfo}, pallet_prelude::*, traits::ConstU32, - traits::IsSubType, weights::Weight, }; use frame_system::pallet_prelude::*; use sp_consensus_aura::sr25519::AuthorityId as AuraAuthorityId; use sp_core::ByteArray; + use sp_runtime::transaction_validity::{ + InvalidTransaction, TransactionSource, ValidTransaction, + }; use sp_runtime::{ AccountId32, DispatchErrorWithPostInfo, RuntimeDebug, Saturating, - traits::{ - BadOrigin, DispatchInfoOf, DispatchOriginOf, Dispatchable, Hash, Implication, - TransactionExtension, - }, - transaction_validity::{InvalidTransaction, TransactionSource, ValidTransaction}, + traits::{BadOrigin, Hash}, }; use sp_std::{marker::PhantomData, prelude::*}; use subtensor_macros::freeze_struct; @@ -384,93 +382,4 @@ pub mod pallet { } } } - - #[freeze_struct("51f74eb54f5ab1fe")] - #[derive(Default, Encode, Decode, DecodeWithMemTracking, Clone, Eq, PartialEq, TypeInfo)] - pub struct MevShieldDecryptionFilter(pub PhantomData); - - impl sp_std::fmt::Debug for MevShieldDecryptionFilter { - fn fmt(&self, f: &mut sp_std::fmt::Formatter) -> sp_std::fmt::Result { - write!(f, "MevShieldDecryptionFilter") - } - } - - impl MevShieldDecryptionFilter { - pub fn new() -> Self { - Self(PhantomData) - } - - #[inline] - fn mev_failed_priority() -> TransactionPriority { - 1u64 - } - } - - impl TransactionExtension> - for MevShieldDecryptionFilter - where - ::RuntimeCall: - Dispatchable, - ::RuntimeCall: IsSubType>, - { - const IDENTIFIER: &'static str = "MevShieldDecryptionFilter"; - - type Implicit = (); - type Val = (); - type Pre = (); - - fn weight(&self, _call: &RuntimeCallFor) -> Weight { - // Only does light pattern matching; treat as free. - Weight::zero() - } - - fn validate( - &self, - origin: DispatchOriginOf>, - call: &RuntimeCallFor, - _info: &DispatchInfoOf>, - _len: usize, - _self_implicit: Self::Implicit, - _inherited_implication: &impl Implication, - source: TransactionSource, - ) -> ValidateResult> { - match call.is_sub_type() { - Some(Call::mark_decryption_failed { id, .. }) => { - match source { - TransactionSource::Local | TransactionSource::InBlock => { - let validity_res = - ValidTransaction::with_tag_prefix("mev-shield-failed") - .priority(Self::mev_failed_priority()) - .longevity(64) - .and_provides(id) - .propagate(false) - .build(); - - match validity_res { - Ok(validity) => Ok((validity, (), origin)), - Err(e) => Err(e), - } - } - - // Anything coming from the outside world (including *signed* - // transactions) is rejected at the pool boundary. - _ => Err(InvalidTransaction::Call.into()), - } - } - - _ => Ok((Default::default(), (), origin)), - } - } - - fn prepare( - self, - _val: Self::Val, - _origin: &DispatchOriginOf>, - _call: &RuntimeCallFor, - _info: &DispatchInfoOf>, - _len: usize, - ) -> Result { - Ok(()) - } - } }