Skip to content

Integrate GRANDPA voter in service - #46

Merged
motoZ-crypto merged 3 commits into
masterfrom
motoz/grandpa-service-integration
Apr 21, 2026
Merged

Integrate GRANDPA voter in service#46
motoZ-crypto merged 3 commits into
masterfrom
motoz/grandpa-service-integration

Conversation

@motoZ-crypto

@motoZ-crypto motoZ-crypto commented Apr 21, 2026

Copy link
Copy Markdown
Collaborator

Summary

Integrates the GRANDPA finality gadget into the node service layer. Block import is reordered so that GRANDPA wraps the PoW
block import, the GRANDPA notification protocol is registered on the network, and the GRANDPA voter task / RPC API are wired up. Voter participation is gated by Substrate's built-in --validator flag (reflected via config.role.is_authority()).

Changes

node/src/service.rs

  • Wires GRANDPA into the node service layer by placing it in front of the PoW block import.
  • Registers the GRANDPA notification protocol as part of service initialization.
  • Runs the GRANDPA voter only when the node is started as an authority via --validator.

rpc.rs

  • Introduced GrandpaDeps<B>.
  • Extended FullDeps / create_full to register the grandpa_* RPC methods.

Cargo.toml / node/Cargo.toml

  • Added workspace dependencies for sc-consensus-grandpa-rpc and sc-rpc.

Closes #18

- Add sc-consensus-grandpa and sp-consensus-grandpa to node deps
- Build GRANDPA block import in new_partial and use it as the inner
  block import of PowBlockImport, with the same instance registered as
  justification import for the PoW import queue
- Carry (grandpa_block_import, grandpa_link, telemetry) through the
  PartialComponents `other` field for use by new_full
- Add sc-consensus-grandpa-rpc and sc-rpc deps
- Register GRANDPA notification protocol on the network
- Expose GRANDPA RPC (grandpa_*) via FullDeps / GrandpaDeps
@motoZ-crypto motoZ-crypto added this to the Alpha-0.1 milestone Apr 21, 2026
@motoZ-crypto motoZ-crypto self-assigned this Apr 21, 2026
@motoZ-crypto motoZ-crypto added T-enhancement New feature or request A-grandpa GRANDPA finality and fork-choice A-node Node binary, service layer, CLI labels Apr 21, 2026
@motoZ-crypto
motoZ-crypto marked this pull request as ready for review April 21, 2026 15:49
@motoZ-crypto
motoZ-crypto merged commit b1351e8 into master Apr 21, 2026
1 check passed
@motoZ-crypto
motoZ-crypto deleted the motoz/grandpa-service-integration branch July 5, 2026 04:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-grandpa GRANDPA finality and fork-choice A-node Node binary, service layer, CLI T-enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Integrate GRANDPA voter in service

1 participant