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

Fix consensus check #6760

Merged
merged 7 commits into from
Jan 31, 2025
Merged

Fix consensus check #6760

merged 7 commits into from
Jan 31, 2025

Conversation

AdoAdoAdo
Copy link
Contributor

@AdoAdoAdo AdoAdoAdo commented Jan 30, 2025

Reasoning behind the pull request

  • previous proof verification fixes

Proposed changes

  • for the transition block prev proof should not be checked
  • the transition block for shard has a different consensus size (it follows the previous epoch rules), so the check of keys in consensus needs to be adapted.

Testing procedure

Pre-requisites

Based on the Contributing Guidelines the PR author and the reviewers must check the following requirements are met:

  • was the PR targeted to the correct branch?
  • if this is a larger feature that probably needs more than one PR, is there a feat branch created?
  • if this is a feat branch merging, do all satellite projects have a proper tag inside go.mod?

@AdoAdoAdo AdoAdoAdo marked this pull request as ready for review January 31, 2025 08:26
@@ -290,25 +294,43 @@ func (hsv *HeaderSigVerifier) VerifySignatureForHash(header data.HeaderHandler,
return multiSigVerifier.VerifyAggregatedSig(pubKeysSigners, hash, signature)
}

// VerifyHeaderWithProof checks if the proof on the header is correct
func (hsv *HeaderSigVerifier) VerifyHeaderWithProof(header data.HeaderHandler) error {
// VerifyHeaderWithPrevProof checks if the proof on the header is correct
Copy link
Collaborator

Choose a reason for hiding this comment

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

update comment as well.. or maybe consider unexporting this method? it is only used internally now

// VerifyHeaderWithProof checks if the proof on the header is correct
func (hsv *HeaderSigVerifier) VerifyHeaderWithProof(header data.HeaderHandler) error {
// VerifyHeaderWithPrevProof checks if the proof on the header is correct
func (hsv *HeaderSigVerifier) VerifyHeaderWithPrevProof(header data.HeaderHandler) error {
// first block for transition to equivalent proofs consensus does not have a previous proof
Copy link
Collaborator

Choose a reason for hiding this comment

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

this comment can be removed

err := verifyPrevProofForHeaderIntegrity(header)
if err != nil {
return err
}

prevProof := header.GetPreviousProof()
if common.IsEpochChangeBlockForFlagActivation(header, hsv.enableEpochsHandler, common.EquivalentMessagesFlag) {
return hsv.verifyHeaderProofAtTransition(header, prevProof)
Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't think this would ever be called, as this method, VerifyHeaderWithPrevProof, is called only if ShouldBlockHavePrevProof, but if block should have proof, it means it is not the epoch change block for flag activation, thus VerifySignature would go through L238-L250 for the epoch start block

@AdoAdoAdo AdoAdoAdo merged commit 3e24cfe into feat/equivalent-messages Jan 31, 2025
4 checks passed
@AdoAdoAdo AdoAdoAdo deleted the fix-consensus-check branch January 31, 2025 12:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants