From 1b6608049963262e4a4127cbd498dddaddc07fea Mon Sep 17 00:00:00 2001 From: Parth Desai Date: Fri, 7 Mar 2025 19:55:55 +0400 Subject: [PATCH] call validate in pre_dispatch to have same validations for call --- pallets/subtensor/src/lib.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/pallets/subtensor/src/lib.rs b/pallets/subtensor/src/lib.rs index 25838b108..b355e9624 100644 --- a/pallets/subtensor/src/lib.rs +++ b/pallets/subtensor/src/lib.rs @@ -2207,9 +2207,13 @@ where self, who: &Self::AccountId, call: &Self::Call, - _info: &DispatchInfoOf, - _len: usize, + info: &DispatchInfoOf, + len: usize, ) -> Result { + // We need to perform same checks as Self::validate so that + // the validation is performed during Executive::apply_extrinsic as well. + // this prevents inclusion of invalid tx in a block by malicious block author. + self.validate(who, call, info, len)?; match call.is_sub_type() { Some(Call::add_stake { .. }) => { let transaction_fee = 100000;