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

make service use both finalized and non-finalized state #1239

Merged
merged 5 commits into from
Nov 1, 2020

Conversation

yaahc
Copy link
Contributor

@yaahc yaahc commented Oct 30, 2020

Motivation

The implementation of the state service was not updated fully when we added the NonFinalizedState component. Most of the requests still exclusively queried the FinalizedState. This caused bugs with syncing where block locators would not include the most recent blocks in the current best chain because they're only stored in the non-finalized state, which was being ignored.

Solution

This PR adds all the functions previously only exported on FinalizedState to the Service and NonFinalizedState components. It then implements each of the Service methods as first attempting to retrieve a piece of information from the memory state, if it exists, and if it doesn't falling back to the FinalizedState.

This PR also fixes some inconsistency issues with how we were doing error handling for sled errors and deserialization errors when reading from sled. All of these errors are indicative of bugs, and removing them greatly simplifies the composition of the sled and mem lookup calls.

The code in this pull request has:

  • Documentation Comments
  • Unit Tests and Property Tests

Review

Related Issues

Follow Up Work

@yaahc yaahc requested a review from hdevalence October 30, 2020 22:46
@yaahc yaahc self-assigned this Oct 30, 2020
@yaahc yaahc force-pushed the block-locator-fix branch from f0dc7f9 to b6b56ca Compare October 30, 2020 23:33
Copy link
Contributor

@hdevalence hdevalence left a comment

Choose a reason for hiding this comment

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

LGTM, this eliminates one known failure mode, so I'd like to merge it and work on fixing #1181 on top of it.

@hdevalence hdevalence merged commit 714def9 into main Nov 1, 2020
@hdevalence hdevalence deleted the block-locator-fix branch November 1, 2020 18:49
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.

2 participants