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

consensus/beacon: simplify header split #48

Merged
merged 1 commit into from
Dec 12, 2022

Conversation

rjl493456442
Copy link

@rjl493456442 rjl493456442 commented Dec 12, 2022

This PR simplifies the logic for splitting headers.

Before we verify the header batch in VerifyHeaders function, we should strictly
split the provided headers into two parts: one before the ttd(including the terminal
block) and one after the ttd.

Then we can hold the truth that the tds of pre-headers(except potential terminal
block) don't exceed the ttd, no matter the header difficulty is correct or not
(can be fake, but will be detected later in verification). And also td tds of post-headers
must all exceed the ttd(since the assumed difficulty is zero).

Then we can deliver the separated headers into corresponding verification functions
which will detect all invalid headers, e.g. difficulty is invalid.

Copy link
Owner

@holiman holiman left a comment

Choose a reason for hiding this comment

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

LGTM

@holiman holiman merged commit 79ed233 into holiman:test_update_merge Dec 12, 2022
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.

2 participants