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

xcmp-queue: Fix handling of encoded blobs#889

Merged
bkchr merged 3 commits intomasterfrom
bkchr-fix-xcmp-queue
Jan 19, 2022
Merged

xcmp-queue: Fix handling of encoded blobs#889
bkchr merged 3 commits intomasterfrom
bkchr-fix-xcmp-queue

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
@bkchr bkchr requested review from KiChjang and gavofyork January 5, 2022 23:42
@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.

bkchr added 2 commits January 6, 2022 11:33
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.

3 participants