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

VerifyRandao returns proper error when parent state is unavailable #2092

Merged
merged 3 commits into from Jan 19, 2024

Conversation

hyunsooda
Copy link
Contributor

@hyunsooda hyunsooda commented Jan 17, 2024

Proposed changes

Make VerifyRandao() return an appropriate error when the parent block state is not found.

Currently, the VerifyRandao() may return a "missing trie node" error when the parent state is not found. Specifically, the error may be triggered after a rewinding by debug_setHead, leading to downloader requests for older blocks lacking the required state. As these blocks undergo verification, they reach VerifyRandao(), but in full mode node the parent states are not stored, thereby throwing the "missing trie node" error.

The parent state is needed to determine the proposer's BLS public key, which is then used to verify the randomReveal field.

If the parent state is not found, VerifyHeader() now returns a consensus.ErrPrunedAncestor error so that BlockChain.InsertChain can take state regeneration path in https://github.com/klaytn/klaytn/blob/v1.12.0/blockchain/blockchain.go#L1992-L2017.

Types of changes

Please put an x in the boxes related to your change.

  • Bugfix
  • New feature or enhancement
  • Others

Checklist

Put an x in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your code.

  • I have read the CONTRIBUTING GUIDELINES doc
  • I have signed the CLA
  • Lint and unit tests pass locally with my changes ($ make test)
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)
  • Any dependent changes have been merged and published in downstream modules

Related issues

Further comments

@blukat29 blukat29 changed the title [RANDAO] Try code retreival once again if missing trie node error VerifyRandao returns proper error when parent state is unavailable Jan 19, 2024
@hyunsooda hyunsooda merged commit 9c33526 into klaytn:dev Jan 19, 2024
11 checks passed
@blukat29 blukat29 mentioned this pull request Jan 22, 2024
13 tasks
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.

None yet

4 participants