Skip to content

Commit 814f235

Browse files
svyatonikbkchr
authored andcommitted
use DecodeLimit when decoding incoming calls (#1344)
1 parent 9b4d44b commit 814f235

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

bridges/bin/runtime-common/Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ frame-support = { git = "https://github.com/paritytech/substrate", branch = "mas
2929
frame-system = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false, optional = true }
3030
pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false, optional = true }
3131
pallet-transaction-payment = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
32+
sp-api = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
3233
sp-core = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
3334
sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
3435
sp-state-machine = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false, optional = true }
@@ -50,6 +51,7 @@ std = [
5051
"pallet-bridge-messages/std",
5152
"pallet-transaction-payment/std",
5253
"scale-info/std",
54+
"sp-api/std",
5355
"sp-core/std",
5456
"sp-runtime/std",
5557
"sp-state-machine/std",

bridges/bin/runtime-common/src/messages.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ use bp_runtime::{
3030
messages::{DispatchFeePayment, MessageDispatchResult},
3131
ChainId, Size, StorageProofChecker,
3232
};
33-
use codec::{Decode, Encode};
33+
use codec::{Decode, DecodeLimit, Encode};
3434
use frame_support::{
3535
traits::{Currency, ExistenceRequirement},
3636
weights::{Weight, WeightToFeePolynomial},
@@ -521,7 +521,11 @@ pub mod target {
521521
for Result<DecodedCall, ()>
522522
{
523523
fn from(encoded_call: FromBridgedChainEncodedMessageCall<DecodedCall>) -> Self {
524-
DecodedCall::decode(&mut &encoded_call.encoded_call[..]).map_err(drop)
524+
DecodedCall::decode_with_depth_limit(
525+
sp_api::MAX_EXTRINSIC_DEPTH,
526+
&mut &encoded_call.encoded_call[..],
527+
)
528+
.map_err(drop)
525529
}
526530
}
527531

0 commit comments

Comments
 (0)