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

Reject a QC if bitset size of its strong_votes or weak_votes is invalid #346

Merged
merged 3 commits into from
Jul 8, 2024

Conversation

linh2931
Copy link
Member

@linh2931 linh2931 commented Jul 8, 2024

If the bitset size of strong_votes or weak_votes in q QC does not match the number of finalizers for the factive finalizer policy the QC refers to, reject the QC.

This PR also adds tests for the validation.

Resolves #334

@linh2931 linh2931 requested review from greg7mdp and heifner July 8, 2024 15:37
// create a valid_quorum_certificate
valid_quorum_certificate qc(strong_votes, {}, agg_sig);

BOOST_CHECK_EXCEPTION( bsp->verify_qc(qc), block_validate_exception, eosio::testing::fc_exception_message_starts_with("vote bitset size is not the same as the number of finalizers") );
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is the exception not invalid_qc_claim that is trigerred by the EOS_ASSERT?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks.

invalid_qc_claim is derived from block_validate_exception:

FC_DECLARE_DERIVED_EXCEPTION( invalid_qc_claim, block_validate_exception,
.
Used block_validate_exception for keeping consistent with existing usage.

But it is better to be more specific. Changed all of the usages.

@linh2931 linh2931 merged commit abc65ce into main Jul 8, 2024
36 checks passed
@linh2931 linh2931 deleted the validate_qc_bitset_size branch July 8, 2024 21:08
@ericpassmore
Copy link
Contributor

Note:start
group: STABILITY
category: INTERNALS
summary: Validate QC by bitsize of votes.
Note:end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants