This repository has been archived by the owner on Nov 15, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Use a BoundedVec
in ValidationResult
#6603
Merged
paritytech-processbot
merged 10 commits into
master
from
mrcnski/boundedvec-validationresult
Feb 16, 2023
Merged
Use a BoundedVec
in ValidationResult
#6603
paritytech-processbot
merged 10 commits into
master
from
mrcnski/boundedvec-validationresult
Feb 16, 2023
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
> Use a `BoundedVec` for `upward_messages` and `horizontal_messages` in order to > limit the number of individual messages/memory allocations right at decoding > time. The reason for this is that the `ValidationResult` may contain a code > upgrade (including a full PVF binary), so the total size limit can't be set > too low and this limit will still allow several millions of upward messages, > which will (due to the memory allocator overhead) already have a > non-negligible memory footprint in decoded form.
mrcnski
added
A0-please_review
Pull request needs code review.
B0-silent
Changes should not be mentioned in any release notes
C1-low
PR touches the given topic and has a low impact on builders.
D3-trivial 🧸
PR contains trivial changes in a runtime directory that do not require an audit.
labels
Jan 22, 2023
bkchr
suggested changes
Jan 22, 2023
mrcnski
added a commit
to paritytech/parity-scale-codec
that referenced
this pull request
Jan 23, 2023
This is necessary to implement a custom `Decode` for `BoundedVec`. See: paritytech/polkadot#6603 (comment) > You want to ensure that you don't even start try decoding/allocating when the length of the vector is more than the > allowed maximum. > You first decode length of the vector and then early reject if that is too long.
eskimor
reviewed
Jan 25, 2023
ggwpez
reviewed
Jan 25, 2023
mrcnski
added a commit
to paritytech/parity-scale-codec
that referenced
this pull request
Jan 26, 2023
* Export `decode_vec_with_len` This is necessary to implement a custom `Decode` for `BoundedVec`. See: paritytech/polkadot#6603 (comment) > You want to ensure that you don't even start try decoding/allocating when the length of the vector is more than the > allowed maximum. > You first decode length of the vector and then early reject if that is too long. * Actually export `decode_vec_with_len` * Bump version
bkchr
approved these changes
Jan 26, 2023
eskimor
approved these changes
Jan 29, 2023
This comment was marked as outdated.
This comment was marked as outdated.
bot merge |
Error: Statuses failed for adbe1e4 |
mrcnski
added
the
E5-needs_cumulus_pr
This is an issue that needs to be implemented upstream in Cumulus.
label
Feb 3, 2023
Can someone please advise me on the cumulus companion? I need to convert the What should happen on error? Is it OK to panic here? Or maybe better to handle it before storing it? |
mrcnski
removed
the
E5-needs_cumulus_pr
This is an issue that needs to be implemented upstream in Cumulus.
label
Feb 5, 2023
koute
reviewed
Feb 16, 2023
runtime/parachains/src/builder.rs
Outdated
@@ -535,8 +535,8 @@ impl<T: paras_inherent::Config> BenchBuilder<T> { | |||
validation_code_hash, | |||
}, | |||
commitments: CandidateCommitments::<u32> { | |||
upward_messages: Vec::new(), | |||
horizontal_messages: Vec::new(), | |||
upward_messages: vec![].try_into().unwrap(), |
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.
Any particular reason why you're using try_into().unwrap()
here instead of just Default::default()
(which would eliminate the unwrap
)?
bot merge |
Error: "Check reviews" status is not passing for paritytech/cumulus#2161 |
bot merge |
paritytech-processbot
bot
deleted the
mrcnski/boundedvec-validationresult
branch
February 16, 2023 15:08
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
A0-please_review
Pull request needs code review.
B0-silent
Changes should not be mentioned in any release notes
C1-low
PR touches the given topic and has a low impact on builders.
D3-trivial 🧸
PR contains trivial changes in a runtime directory that do not require an audit.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
PULL REQUEST
Overview
Considerations
BoundedVec<UpwardMessage, ConstU32<MAX_UPWARD_MESSAGE_NUM>>
shouldn't be exported as its own type, as there is some duplication.Vec
->BoundedVec
a breaking change anywhere? I hope not, as the encoding is the same: https://github.com/paritytech/substrate/blob/2dff067e9f7f6f3cc4dbfdaaa97753eccc407689/primitives/core/src/bounded/bounded_vec.rs#L323Related Issue
Closes https://github.com/paritytech/srlabs_findings/issues/257
cumulus companion: paritytech/cumulus#2161