-
Notifications
You must be signed in to change notification settings - Fork 238
fix: sync service for non zero height starts with empty store #2834
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
Conversation
|
The latest Buf updates on your PR. Results from workflow CI / buf-check (pull_request).
|
|
Claude finished @tac0turtle's task —— View job Comprehensive Code ReviewI've completed a thorough review of PR #2834 focusing on the sync service fix for non-zero height starts with empty store. Below is my analysis organized by key focus areas. 1. Code Quality & Architecture✅ Strengths
|
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #2834 +/- ##
==========================================
+ Coverage 64.67% 64.89% +0.22%
==========================================
Files 81 81
Lines 7173 7242 +69
==========================================
+ Hits 4639 4700 +61
- Misses 1995 1998 +3
- Partials 539 544 +5
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
alpe
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
utAck 👍
|
testing a few other fixes so will wait off on merging this |
<!-- Please read and fill out this form before submitting your PR. Please make sure you have reviewed our contributors guide before submitting your first PR. NOTE: PR titles should follow semantic commits: https://www.conventionalcommits.org/en/v1.0.0/ --> ## Overview <!-- Please provide an explanation of the PR, including the appropriate context, background, goal, and rationale. If there is an issue with this information, please provide a tl;dr and link the issue. Ex: Closes #<issue number> --> add store-info command to inspect p2p store to see what is present
<!-- Please read and fill out this form before submitting your PR. Please make sure you have reviewed our contributors guide before submitting your first PR. NOTE: PR titles should follow semantic commits: https://www.conventionalcommits.org/en/v1.0.0/ --> ## Overview <!-- Please provide an explanation of the PR, including the appropriate context, background, goal, and rationale. If there is an issue with this information, please provide a tl;dr and link the issue. Ex: Closes #<issue number> --> This pr removes the trsuted hash approach to sync. this works for celestia node since they do not reconstruct state so they can jump to a height that is closer to the head. With Evolve this assumption is incorrect, we ned to reconstruct state, meaning we either need to sync from genesis or download a db snapshot then start the node from there.
| heightToQuery uint64 | ||
| ) | ||
|
|
||
| if syncService.conf.Node.TrustedHash != "" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I removed this as we can not start syncing from a random height as we are in the process of reconstructing state. While this is something that is useful for light mode, we should aim to simplify the system before working on light mode as today its not a priority.
Instead we check the p2p store to see if we have a height, if not then we go to genesis.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is that actually? You should be able to ignore the previous state checks for that block and just start from an abitrary block?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in the future when we begin pruning state, i believe with how goheader works we wont be able to use the genesis height as our trusted height if its not present. In this case we should use what is present in the store. We can also opt to use the trusted hash but possibly from the other store.
The trusted hash approach is useful for things like the light node but becuase this isnt a concern for today then we should optimize for what is being used
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
okay, so it cannot be used to fetch that height to the p2p peers?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it will request the height from a peer, you are correct, but we cant do much with that info. If we are syncing from p2p or da then we would have a store already so its best to trust what we have already. If we have an empty store, we will either sync from genesis or grab a hosted snapshot, so we will have something in the store.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, I mean in the use case you want to start to sync from a specific height with an empty state. I still do no understand why it wouldn't be supported.
We'd init the store at that height, and like with a pruned state, you won't be able to query prior to that trusted height. but that wouldn't differ from a pruned state.
Anyway, I agree that it is fine to delete it to simplify, but I do believe it shouldn't take much eventually to make it work. In my head it'd simply work list this:
- Fetch height X (as trusted height) from peer
- Init store with that height
- In syncing (as i believe the edge case you've just synced a node and it immediately failover to this one as executor (raft) does not need to be supported) our ev-node store would be empty, but we can have a dummy X-1 height, and sync X-1->X verification for this special case
- X -> X+1 would then work fine.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in this scenario you will need to provide some sort of state otherwise syncing wont work as we wont be able to verify apphashes and other hashes. If we want to support this then we need a form of state sync, which id argue is overkill. I think its better to provide a protocol that queries for latest snapshot from a s3 bucket or something similar. There isnt a trust issue here because once you download if something is tampered you will fail at syncing.
julienrbrt
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
first walkthrough
| heightToQuery uint64 | ||
| ) | ||
|
|
||
| if syncService.conf.Node.TrustedHash != "" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is that actually? You should be able to ignore the previous state checks for that block and just start from an abitrary block?
julienrbrt
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK!
| heightToQuery uint64 | ||
| ) | ||
|
|
||
| if syncService.conf.Node.TrustedHash != "" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, I mean in the use case you want to start to sync from a specific height with an empty state. I still do no understand why it wouldn't be supported.
We'd init the store at that height, and like with a pruned state, you won't be able to query prior to that trusted height. but that wouldn't differ from a pruned state.
Anyway, I agree that it is fine to delete it to simplify, but I do believe it shouldn't take much eventually to make it work. In my head it'd simply work list this:
- Fetch height X (as trusted height) from peer
- Init store with that height
- In syncing (as i believe the edge case you've just synced a node and it immediately failover to this one as executor (raft) does not need to be supported) our ev-node store would be empty, but we can have a dummy X-1 height, and sync X-1->X verification for this special case
- X -> X+1 would then work fine.
Overview
sync service fix for when we are not on genesis but have an empty store
in 1.0.0-beta.9 we fixed writing to p2p store but the issue is when the store is empty AND we are not in genesis then the store is not initialised, this pr aims to fix this