Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

xcmp-queue: Fix handling of encoded blobs #889

Merged
merged 3 commits into from
Jan 19, 2022
Merged

Conversation

bkchr
Copy link
Member

@bkchr bkchr commented Jan 5, 2022

With #701 we tried to fix some infinite loop related to encoded blobs, however that lead actually to
not being able to process encoded blobs at all. The reason for this is that decode_all doesn't
consume the given input. The point of this function is that it returns an error if the data couldn't
be decoded or there is still data left. However, this means that the check
remaining_fragments.len() < last_remaining_fragments.len() would always fail.

We remove the while loop, because we decode the entire fragment anyway or it fails. Aka, we don't
need to loop here. Next we remove the broken check and we directly reset the
remaining_fragments (because decode_all doesn't consume anything).

With #701 we tried to fix some infinite loop related to encoded blobs, however that lead actually to
not being able to process encoded blobs at all. The reason for this is that `decode_all` doesn't
consume the given input. The point of this function is that it returns an error if the data couldn't
be decoded or there is still data left. However, this means that the check
`remaining_fragments.len() < last_remaining_fragments.len()` would always fail.

We remove the while loop, because we decode the entire fragment anyway or it fails. Aka, we don't
need to loop here. Next we remove the broken check and we directly reset the
`remaining_fragments` (because `decode_all` doesn't consume anything).
@bkchr bkchr added A0-pleasereview B0-silent Changes should not be mentioned in any release notes labels Jan 5, 2022
@gilescope
Copy link
Contributor

Can we do a similar thing with the XcmpMessageFormat::ConcatenatedVersionedXcm case?

@bkchr
Copy link
Member Author

bkchr commented Jan 6, 2022

Can we do a similar thing with the XcmpMessageFormat::ConcatenatedVersionedXcm case?

This is not required.

We need to use a while loop, because there can be multiple `Vec<u8>`s. We also need to use `decode`,
because `decode_all` would otherwise return an error if the input is not empty afterwards.
@bkchr bkchr merged commit 4cc1223 into master Jan 19, 2022
@bkchr bkchr deleted the bkchr-fix-xcmp-queue branch January 19, 2022 15:57
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
B0-silent Changes should not be mentioned in any release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants