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

Tracking: NonFinalizedState Implementation #1250

Closed
21 tasks done
yaahc opened this issue Nov 5, 2020 · 2 comments
Closed
21 tasks done

Tracking: NonFinalizedState Implementation #1250

yaahc opened this issue Nov 5, 2020 · 2 comments
Assignees
Labels
C-tracking-issue Category: This is a tracking issue for other tasks

Comments

@yaahc
Copy link
Contributor

yaahc commented Nov 5, 2020

Non-Finalized State Implementation

Chain

  • Implement the Chain type
    • Chain::push -- Chain logic only is required to check this box, it's fine to stub out the full contextual verification checks for later.
    • Chain::pop_root
    • Chain::pop_tip
    • Chain::fork
Bug Fixes
  • impl Ord for Chain
    • Update comments and RFC to document that BTreeSet orders the lowest item first (least work chain), and that next_back is how you get the best chain
  • Test the best chain is selected correctly
  • Test the best chain height is correctly returned
Testing
  • Use proptests to check that Chain operations are implemented correctly

ChainSet

Bug Fixes
  • ChainSet::commit_block
    • If the block is a pre-Sapling block, panic.
  • ChainSet::best_chain_len
    • Return u32 like Depth, to avoid confusion with the best chain tip height

MemoryState

  • Use Chain, ChainSet to implement MemoryState
  • Correctly handle duplicate blocks in CommitBlock

QueuedBlocks

  • Check that the right queued blocks are pruned
yaahc added a commit that referenced this issue Nov 9, 2020
Prior to this PR `memory_state` defined and implemented functionality for three different types, `Chain`, `NonFinalizedState`, and `QueuedBlocks`. Each of these components will need a fair number of unit tests, and I realized that as its currently organized it would be difficult to organize the tests or at a glance figure out which tests are testing which components.

This PR changes the organization of `memory_state` such that each component it exports is defined in its own module. In follow up PRs each module will get its own test module, which will focus exclusively on unit tests for the item defined there-in.

- [Tracking Issue](#1250)
@mpguerra
Copy link
Contributor

Another one for the Firs Alpha Release milestone?

@yaahc yaahc added this to the First Alpha Release milestone Nov 11, 2020
@yaahc yaahc self-assigned this Nov 11, 2020
@teor2345 teor2345 added the C-tracking-issue Category: This is a tracking issue for other tasks label Nov 11, 2020
@teor2345
Copy link
Contributor

@yaahc let's open a new ticket for the sprout and sapling anchors, and close this ticket?

@yaahc yaahc closed this as completed Nov 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-tracking-issue Category: This is a tracking issue for other tasks
Projects
None yet
Development

No branches or pull requests

3 participants