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

Handle staking info since kaia fork in downloader. #2160

Merged
merged 8 commits into from
May 21, 2024

Conversation

hyeonLewis
Copy link
Contributor

@hyeonLewis hyeonLewis commented May 13, 2024

Proposed changes

After kaia fork, the staking info for block N is determined at block N-1. Also, staking info is no longer stored in DB after kaia fork. This breaks current implementation of downloader to fetch staking info to verify headers (especially in snap sync). In this PR, all necessary staking info for block verification even after kaia fork will be requested to peer and stored in DB temporary. The stored staking info after kaia fork will be deleted after committing blocks to blockchain.

When kaia fork block is N and downloader tries to fetch staking info from N-10 to N+10 when staking interval is 4:

Sync state Fetched staking info Stored staking info
While syncing N-10, N-6, N-2, N-1, N, N+1, ... N+9 All 14 fetched
After sync - N-10, N-6, N-2

It enables snap sync which was disabled at #2154.

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

  • Please leave the issue numbers or links related to this PR here.

Further comments

If this is a relatively large or complex change, kick off the discussion by explaining why you chose the solution you did and what alternatives you considered, etc...

@hyeonLewis hyeonLewis self-assigned this May 13, 2024
@hyeonLewis hyeonLewis marked this pull request as draft May 13, 2024 12:55
@hyeonLewis hyeonLewis changed the title Handle staking info since kaia fork in downloader. [WIP] Handle staking info since kaia fork in downloader. May 13, 2024
@hyeonLewis hyeonLewis force-pushed the fix-stakinginfo-sync branch 3 times, most recently from 5bf2c26 to 52f7d64 Compare May 13, 2024 15:42
@hyeonLewis hyeonLewis mentioned this pull request May 14, 2024
9 tasks
@hyeonLewis hyeonLewis changed the title [WIP] Handle staking info since kaia fork in downloader. Handle staking info since kaia fork in downloader. May 17, 2024
@hyeonLewis hyeonLewis force-pushed the fix-stakinginfo-sync branch 2 times, most recently from 5bdd492 to a540e8a Compare May 18, 2024 02:47
@hyeonLewis hyeonLewis marked this pull request as ready for review May 18, 2024 04:25
blukat29
blukat29 previously approved these changes May 20, 2024
datasync/downloader/downloader.go Outdated Show resolved Hide resolved
@hyeonLewis hyeonLewis merged commit 0422c45 into dev May 21, 2024
11 checks passed
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

3 participants