This repository was archived by the owner on Jan 11, 2024. It is now read-only.
Open
Conversation
adlrocha
reviewed
Dec 4, 2023
|
|
||
| pub fn reset(&mut self, head: BlockHeight) { | ||
| self.tail = None; | ||
| self.head = head; |
Contributor
There was a problem hiding this comment.
As discussed sync, I think with the new model where we enforced the defer execution of side-effects for top-down there is no need to use a head and a tail here.
| self.tail = Some((height, hash)); | ||
| } | ||
|
|
||
| pub fn reset(&mut self, head: BlockHeight) { |
Contributor
There was a problem hiding this comment.
Here you are just resetting the pointers. Is there no need to clean the content from the cache? We may be leaking outdated information by just changing the pointers, right?
added 2 commits
December 4, 2023 22:12
adlrocha
approved these changes
Dec 6, 2023
Contributor
adlrocha
left a comment
There was a problem hiding this comment.
LGTM. Thank you for simplifying the cache logic a lot 🙏
| .await | ||
| } | ||
|
|
||
| /// Poll the next block height. Returns finalized and executed block data. |
Contributor
There was a problem hiding this comment.
Maybe it is worth adding a comment here and be explicit about the height and data returned.
- We get
heightand return the state atparent_blockright?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
We should reset provider, i.e. clean cache, reset last committed and polling trackers after syncing with peer and also a potential reorg.
For potential reorg, we had this for block height check but not after block hashes are different. We should reset syncer and try from scratch (what else can we do beside crashing app).
After peer syncing, we need to reset provider because with peer syncing, we might have the last committed finality way ahead of the cache polled heights. Clean cache and restart syncer will make sure syncer is up to date.