Skip to content

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

Merged
zzzckck merged 1 commit intobnb-chain:developfrom
buddh0:fix_verifyVoteAttestation_verify_batch_headers
Jan 3, 2024
Merged

parlia: fix verifyVoteAttestation when verify a batch of headers#2121
zzzckck merged 1 commit intobnb-chain:developfrom
buddh0:fix_verifyVoteAttestation_verify_batch_headers

Conversation

@buddh0
Copy link
Copy Markdown
Contributor

@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
  • ...

}

// 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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
@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