Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(consensus): HeaviestSubtreeForkChoice (#505)
* Init dir structure * Added basic data structures * temp * Should be able to create from root * Fix style * Fmt * Renamed new to init * Make sure to walk up the tree when propagating the best slot * Added containsBlock * Add bestOverallSlot * Todo * Added subtreeDiff * Added HeaviestSubtreeForkChoice.setTreeRoot * Update subtreeDiff to return SortedMap * Fix style * Include call to propagateNewLeaf * Add some documentation with some ascii arts. * Added implementation for markForkInvalidCandidate * Fix compilation * Switch to SlotAndHash * Use struct name for annotating self * Added initForTest for testing * Fix leak * Testing HeaviestSubtreeForkChoice.testSetRoot * Fix subtreeDiff * Fix selecting of root in initForTest * Deinit children when removing from fork_infos * Added test for HeaviestSubtreeForkChoice.subtreeDiff * Added tests for HeaviestSubtreeForkChoice.ancestorIterator * Added test for HeaviestSubtreeForkChoice.testBestOverallSlot * Document the test tree structure * Added test for HeaviestSubtreeForkChoice.aggregateSlot * Added deepestSlot and extended HeaviestSubtreeForkChoice.aggregateSlot * Added stakeVotedAt * Add setStakeVotedAt to use in test * Extended Test * Add deepestOverallSlot * Completed HeaviestSubtreeForkChoice.aggregateSlot * Added test for HeaviestSubtreeForkChoice.isBestChild * Added setupDuplicateForks * Added test HeaviestSubtreeForkChoice.addNewLeafSlot_duplicate * Add isDuplicateConfirmed * Implemented markForkValidCandidate * Rename latest_invalid_ancestor to latestInvalidAncestor * Added HeaviestSubtreeForkChoice.markForkValidCandidate * Move test fork into a variable * Added test HeaviestSubtreeForkChoice.markForkValidandidate_mark_valid_then_ancestor_invalid * Remove placeholder tests * Make bestOverallSlot not returning a value an error case * Switch to logger * Remove processed todo comment * Made some methods that does not need to be public private * Documented addNewLeafSlot * Document propagateNewLeaf * Document isDeepestChild * Have impl of bestOverallSlot uniform with deepestOverallSlot * Document setTreeRoot * Added new line between fields and methods * Use equals instead of order for equality check * Improve variable names * Renaming and documentation * use self * Use sig.time.Duration * Rename HeaviestSubtreeForkChoice to just ForkChoice * Panic if node to be removed not found * Panic if new root is not found in fork infos * Updated comment * Have doInsertAggregateOperation as a standalone function * Added github issue * Removed MAX_ROOT_PRINT_SECONDS as it is not being used * Fix link * Replace errors with panic when slot not found in fork choice * Removed the need for alloc. Instead check contains first * Do not panic in markForkValidCandidate * Improve comment * refactor(svm): refactor transaction implementation (#513) * Transaction refactor * replace transaction builder * Removed CheckedReader * remove nullability from address lookups * Address PR comments * implement serialize * restore transaction unit tests * missed test case * address comments * Address PR comments * fix type issue * Extract signable component into message * add clone test * Renamed latest_invalid_ancestor to latest_duplicate_ancestor * Remove setting void to _ * Fix docs * Use while on optional * Simplify early return check * Simplify struct deconstruction * Pass UpdateOperations by ref * Rename slotAndHashes to slot_and_hashes * Move initForTest to a standalone utility function * Use std.testing.expectEqual * Use std.testing.expectEqual in more places * Have the expect as the first parameter * More std.testing.expectEqual * Added HeaviestSubtreeForkChoice.propagateNewLeaf * Change how the fork choice tree is represented in comments * Rename remaining occurance of best to heaviest * Comment with links to corresponding parts in Agave * Comment test with links to corresponding tests in Agave * Comment with links to corresponding parts in Agave * use doc comments to document struct fields --------- Co-authored-by: x19 <100000306+0xNineteen@users.noreply.github.com> Co-authored-by: Harold <41681731+yewman@users.noreply.github.com>
- Loading branch information