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

Lean ancestor iterator #725

wants to merge 7 commits into from

Lean ancestor iterator #725

wants to merge 7 commits into from


Copy link

@paulhauner paulhauner commented Dec 14, 2019

Issue Addressed


Proposed Changes

Introduces the LeanReverseAncestorIterator, which has the following properties:

  • Stores a customizable-length Vec<Hash256> and only replenishes it when required
    • Does not store an entire BeaconState
  • Favors landing on historical root backtrack states.
  • Handles both block and state roots without code duplication.

Reason for implementing:

  • For fork choice we're going to need a little cache of previous roots so we can reduce our DB reads. This iterator can act as a cache that is able to provide some roots from memory before needing to go to the DB.
  • Something similar will also likely be handy when we're pruning dead forks (we have to find highest common ancestors).
  • I think it's a good format to be optimized for:
    • Freezer db
    • Partial reading of beacon state (e.g., we can replenish this by only deserializing a couple of fields of the state).

@paulhauner paulhauner added the work-in-progress label Dec 14, 2019
@paulhauner paulhauner added this to the v0.2.0 milestone Dec 15, 2019
@paulhauner paulhauner removed this from the v0.2.0 milestone Dec 15, 2019
@paulhauner paulhauner added this to the v0.1.1 milestone Dec 15, 2019
Copy link
Member Author

@paulhauner paulhauner commented Jan 3, 2020

Closing because it has been superseded by #746

@paulhauner paulhauner closed this Jan 3, 2020
@paulhauner paulhauner deleted the lean-iter branch Feb 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet

Successfully merging this pull request may close these issues.

None yet

1 participant