Skip to content
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

Closed
wants to merge 7 commits into from

Conversation

heifner
Copy link
Member

@heifner heifner commented Sep 4, 2024

ordered_diff is used to process the finalizer and proposer policy diffs from block header extension finality_extension. Since the finality_extension, is provided to a node to validate, validate the diff during apply_diff.

Related to #691

@heifner heifner requested review from greg7mdp and arhag September 4, 2024 14:11
@heifner heifner added the OCI Work exclusive to OCI team label Sep 4, 2024
result.insert_indexes.emplace_back(t, target[t]);
FC_ASSERT(result.insert_indexes.size() <= MAX_NUM_ARRAY_ELEMENTS);
Copy link
Contributor

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);
Copy link
Contributor

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.

Comment on lines 45 to 46
FC_ASSERT(s < std::numeric_limits<SizeType>::max());
FC_ASSERT(t < std::numeric_limits<SizeType>::max());
Copy link
Contributor

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.

@heifner heifner changed the base branch from qc_claim_check to legacy_qc_ext_checks September 4, 2024 16:43
@heifner
Copy link
Member Author

heifner commented Sep 4, 2024

Replaced by #698 which targets updated branch.

@heifner heifner closed this Sep 4, 2024
@heifner heifner deleted the qc_claim_check-harden-diff branch September 4, 2024 18:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
OCI Work exclusive to OCI team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants