Skip to content

max depth limit 100 #1667

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ pub mod check_nonce;
mod migrations;

use codec::{Compact, Decode, Encode};
use frame_support::pallet_prelude::InvalidTransaction;
use frame_support::traits::{Imbalance, InsideBoth};
use frame_support::{
dispatch::DispatchResultWithPostInfo,
Expand Down Expand Up @@ -1596,6 +1597,14 @@ impl_runtime_apis! {
tx: <Block as BlockT>::Extrinsic,
block_hash: <Block as BlockT>::Hash,
) -> TransactionValidity {
use codec::DecodeLimit;
use frame_support::pallet_prelude::ValidateUnsigned;
use frame_support::traits::ExtrinsicCall;
let encoded = tx.call().encode();
if let Err(e) = <Runtime as ValidateUnsigned>::Call::decode_all_with_depth_limit(100, &mut encoded.as_slice()) {
log::warn!("Failed to decode call: {:?}", e);
return Err(TransactionValidityError::Invalid(InvalidTransaction::Call));
}
Executive::validate_transaction(source, tx, block_hash)
}
}
Expand Down