gossamer icon indicating copy to clipboard operation
gossamer copied to clipboard

Integrate Grandpa Standalone Package

Open jimjbrettj opened this issue 1 year ago • 1 comments

Issue summary

This epic is created to describe and track the effort to intergrate our standalone grandpa package into the gossamer codebase.

Tasks needed for the integration:

  • [x] Create the logic for handling authority set changes in grandpa. This logic can be found within substrate here. Being addressed by #3283
  • [x] Make the authority set type thread safe. Being addressed by #3351
  • [x] Use the db to store grandpa state, found here, although we should be able to simplify this logic for our use cases. Starting to be addressed here #3383
  • [ ] Write all the grandpa networking/communication logic, found in the substrate communication folder
  • [ ] The logic from lib.rs, which is the entrypoint to grandpa. This creates a wrapper around block_import object, which every imported block has to go through. Then a HalfLink object is created to link together the import object to the grandpa worker. Then using a HalfLink and a local config are used to run a granpda voter. Other logic this file contains is some communication logic, SharedVoterState, GrandpaParams, and VoterWork(future that powers the worker). Note: This file does not contain tests.
  • [ ] Logic for environment.rs. The environment in which grandpa executes. Contains VoterSetState, grandpa environment, completed round data, and equivocation logic. NOte: this file does not contain tests.
  • [x] Logic for finality proof. This file contains the logic to prove grandpa finality. Tests included! Addressed in #3582
  • [ ] Custom voting rules for grandpa. Also has tests!
  • [ ] block import logic. Block import handler for granpda. Justification import. Detect and make authority set changes. Import state logic. Note: No tests
  • [x] justification for block finality found here. Verifies commits and has AncestryChain logic. Note: no tests
  • [ ] notification streams for grandpa.
  • [ ] Grandpa tests, almost all of which can be found here.
  • [ ] until_imported is a helper stream for waiting until one or more blocks are imported before bassing through inner items. Buffers incoming messages until given hashes are imported. Note: need to come up with a way to keep track of the number of outstanding blocks that we are waiting on for the same message. Substrate uses the reference counting feature of the Arc pointer for this. Tests included!
  • [ ] rpc api for grandpa.

Tasks will be marked as complete when they are merged into the feature branch for this issue. This issue will be updated as more tasks are discovered and as progress is made. This issue will be closed when the feature branch is merged into development.

Subtasks

  • [ ] #3606
  • [x] #3612

jimjbrettj avatar Jul 13 '23 21:07 jimjbrettj

Given that the Polkadot full node calls sc_consensus_grandpa::run_grandpa_voter I'm adding this epic to the Full Node milestone.

timwu20 avatar Dec 05 '23 18:12 timwu20