-
Notifications
You must be signed in to change notification settings - Fork 379
Use DecodeLimit for decoding XCM messages #605
Conversation
pallets/xcm/src/lib.rs
Outdated
@@ -112,8 +115,11 @@ impl<T: Config> DmpMessageHandler for UnlimitedDmpExecution<T> { | |||
let mut used = 0; | |||
for (_sent_at, data) in iter { | |||
let id = sp_io::hashing::twox_64(&data[..]); | |||
let msg = VersionedXcm::<T::Call>::decode(&mut &data[..]) | |||
.map(Xcm::<T::Call>::try_from); | |||
let msg = VersionedXcm::<T::Call>::decode_and_advance_with_depth_limit( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here we don't really want to advance the data? We more want to decode all the data, otherwise it should be an error?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah ok, so decode
's default behaviour is to advance the cursor, albeit without any upper limit to the input data length, but if we wanna change the behaviour to "decode everything otherwise error", we can change that too.
Unsure what went wrong with CI here? Retried a couple of times, but the problem still persists. |
The error is known and needs to be fixed. However, it only appears on ci |
Fixes paritytech/srlabs_findings#117.
This PR upgrades parity-scale-codec to 2.3.0 (to pick up
decode_and_advance_with_depth_limit
) and adds an upper limit on the length of the XCM messages during decoding.