Skip to content
This repository was archived by the owner on Jan 11, 2024. It is now read-only.

Conversation

@cryptoAtwill
Copy link
Contributor

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.


pub fn reset(&mut self, head: BlockHeight) {
self.tail = None;
self.head = head;
Copy link
Contributor

Choose a reason for hiding this comment

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

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) {
Copy link
Contributor

Choose a reason for hiding this comment

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

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?

Copy link
Contributor

@adlrocha adlrocha left a comment

Choose a reason for hiding this comment

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

LGTM. Thank you for simplifying the cache logic a lot 🙏

.await
}

/// Poll the next block height. Returns finalized and executed block data.
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe it is worth adding a comment here and be explicit about the height and data returned.

  • We get height and return the state at parent_block right?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants