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

parlia: fix verifyVoteAttestation when verify a batch of headers #2121

Conversation

buddh0
Copy link
Collaborator

@buddh0 buddh0 commented Dec 28, 2023

Description

parlia: fix verifyVoteAttestation when verify a batch of headers

Rationale

when full sync with other peers, it normally import a batch blocks in one time, so VerifyHeaders will be called.

suppose that there are N headers in headers: [header0,header1....hearderN-1],
when we do verifyVoteAttestation for headerM,
headerM-1 is just verified and not written into db, so fail to get headerM-1
output errlog as following
error detail

affect range:

  1. validator not affected
  2. few happens even when do a fullsync
    and even it happens, the node will just drop the current peer and continue to sync with other peers.

so no emergency

Example

add an example CLI or API response...

Changes

Notable changes:

  • add each change in a bullet point here
  • ...

@buddh0 buddh0 force-pushed the fix_verifyVoteAttestation_verify_batch_headers branch from 1ba218e to 55cec52 Compare December 28, 2023 08:28
@@ -1751,20 +1755,22 @@ func (p *Parlia) applyTransaction(
return nil
}

// GetJustifiedNumberAndHash returns the highest justified block's number and hash on the branch including and before `header`
func (p *Parlia) GetJustifiedNumberAndHash(chain consensus.ChainHeaderReader, header *types.Header) (uint64, common.Hash, error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

If it is better to use a similar function signature as p.snapshot?

func (p *Parlia) GetJustifiedNumberAndHash(chain consensus.ChainHeaderReader, header *types.Header, parents []*types.Header) (uint64, common.Hash, error) {

Copy link
Contributor

Choose a reason for hiding this comment

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

p.snapshot defination is bad, we define it by following clique,
it's params parents has different meaning with all other interfaces,
image

@buddh0 buddh0 requested a review from brilliant-lx January 3, 2024 02:23
Copy link
Collaborator

@zzzckck zzzckck left a comment

Choose a reason for hiding this comment

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

LGTM

@zzzckck zzzckck merged commit de1a126 into bnb-chain:develop Jan 3, 2024
5 checks passed
@buddh0 buddh0 deleted the fix_verifyVoteAttestation_verify_batch_headers branch January 19, 2024 03:25
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.

4 participants