Skip to content

Commit 69e3a43

Browse files
authored
Merge pull request #1375 from ParthDesai/fix-tx-extension
call `validate` in `pre_dispatch` to have same validations
2 parents 5742411 + 1b66080 commit 69e3a43

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

pallets/subtensor/src/lib.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2207,9 +2207,13 @@ where
22072207
self,
22082208
who: &Self::AccountId,
22092209
call: &Self::Call,
2210-
_info: &DispatchInfoOf<Self::Call>,
2211-
_len: usize,
2210+
info: &DispatchInfoOf<Self::Call>,
2211+
len: usize,
22122212
) -> Result<Self::Pre, TransactionValidityError> {
2213+
// We need to perform same checks as Self::validate so that
2214+
// the validation is performed during Executive::apply_extrinsic as well.
2215+
// this prevents inclusion of invalid tx in a block by malicious block author.
2216+
self.validate(who, call, info, len)?;
22132217
match call.is_sub_type() {
22142218
Some(Call::add_stake { .. }) => {
22152219
let transaction_fee = 100000;

0 commit comments

Comments
 (0)