-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[1.0] Harden ordered_diff #696
Conversation
… a block QC extension
…r extension as it can have
result.insert_indexes.emplace_back(t, target[t]); | ||
FC_ASSERT(result.insert_indexes.size() <= MAX_NUM_ARRAY_ELEMENTS); |
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.
Issue is that we insert before the FC_ASSERT. So the FC_ASSERT can be fine because result.insert_indexes.size() == MAX_NUM_ARRAY_ELEMENTS
, and the next emplace_back
will go over.
=> change the FC_ASSERT
to <
and move before the emplace_back
.
This applies to the other locations as well.
container.insert(container.begin() + index, std::move(value)); | ||
FC_ASSERT(container.size() <= MAX_NUM_ARRAY_ELEMENTS); |
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.
same here, change to <
and move before line 118.
FC_ASSERT(s < std::numeric_limits<SizeType>::max()); | ||
FC_ASSERT(t < std::numeric_limits<SizeType>::max()); |
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.
Please move these two before the if
, otherwise we skip the increments at line 84 and 89.
Replaced by #698 which targets updated branch. |
ordered_diff
is used to process the finalizer and proposer policy diffs from block header extensionfinality_extension
. Since thefinality_extension
, is provided to a node to validate, validate the diff duringapply_diff
.Related to #691