Skip to content

feat(mining-slot): derive GRANDPA voters from recent mining activity#417

Open
blakebyrnes wants to merge 1 commit intomainfrom
pr/add-multigrandpa-voter-support
Open

feat(mining-slot): derive GRANDPA voters from recent mining activity#417
blakebyrnes wants to merge 1 commit intomainfrom
pr/add-multigrandpa-voter-support

Conversation

@blakebyrnes
Copy link
Contributor

Rotate GRANDPA authorities every 240 blocks using recently active mining operators, with a 3-rotation activity window and 2x liveness fallback window.

Normalize to a fixed 10,000 vote budget, enforce a 15% max per-authority share when feasible, and fall back to equal weighting below the 7-authority minimum needed to enforce that bound.

Also add node-side single-local-GRANDPA-key guards at startup and runtime to reduce accidental double-vote misconfiguration.

@blakebyrnes blakebyrnes force-pushed the pr/add-multigrandpa-voter-support branch from 8b360e3 to c889f4a Compare February 27, 2026 19:38
@blakebyrnes
Copy link
Contributor Author

@copilot can you review this before i mark public?

Copy link

Copilot AI commented Feb 27, 2026

@blakebyrnes I've opened a new pull request, #418, to work on those changes. Once the pull request is ready, I'll request review from you.

@blakebyrnes blakebyrnes changed the title feat(mining-slot): derive GRANDPA from recent mining activity feat(mining-slot): derive GRANDPA voters from recent mining activity Mar 8, 2026
@blakebyrnes blakebyrnes marked this pull request as ready for review March 8, 2026 19:30
Copilot AI review requested due to automatic review settings March 8, 2026 19:30
@blakebyrnes blakebyrnes force-pushed the pr/add-multigrandpa-voter-support branch 2 times, most recently from d9b2d1c to 3505fa4 Compare March 8, 2026 19:35
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Implements GRANDPA authority rotation driven by recent mining-slot activity, with vote-weight normalization and concentration caps, plus node-side safeguards to prevent misconfigured multiple local GRANDPA keys.

Changes:

  • Add mining-activity-based GRANDPA authority derivation (recency window + fallback window, normalization to a fixed vote budget, max-share guard, max authority count).
  • Wire the derivation into Argon/Canary runtimes’ GRANDPA rotation hook and add comprehensive pallet tests + mock config constants.
  • Add node startup/runtime guard to refuse (and detect) multiple local GRANDPA keys; update miner-running documentation on bid-close timing.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
runtime/common/src/config.rs Adjust rotation cadence and introduce new GRANDPA derivation configuration constants.
runtime/canary/src/lib.rs Use derived authorities for scheduled GRANDPA changes; plumb new mining-slot config associated types.
runtime/argon/src/lib.rs Same as Canary: derive and schedule authority changes; plumb config types.
pallets/mining_slot/src/lib.rs Expose new grandpa module and document the derivation policy in pallet docs; extend Config trait.
pallets/mining_slot/src/grandpa.rs New implementation for deriving GRANDPA authorities from recent mining activity and allocating weights.
pallets/mining_slot/src/mock.rs Add mock parameter_types for new GRANDPA derivation config hooks.
pallets/mining_slot/src/tests.rs Add targeted unit tests covering eligibility, window boundaries, determinism, caps, and invariants.
node/src/service.rs Add keystore guards to ensure a single local GRANDPA key at startup and during runtime.
docs/run-a-miner.md Update bid-close timing documentation (200 → 30 ticks).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@blakebyrnes blakebyrnes force-pushed the pr/add-multigrandpa-voter-support branch from 3505fa4 to 8c938e0 Compare March 8, 2026 20:52
Copilot AI review requested due to automatic review settings March 8, 2026 23:09
@blakebyrnes blakebyrnes force-pushed the pr/add-multigrandpa-voter-support branch from 8c938e0 to 61188e4 Compare March 8, 2026 23:09
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 10 out of 10 changed files in this pull request and generated 4 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Rotate GRANDPA authorities every 240 blocks using recently active mining operators, with a 3-rotation activity window and 2x liveness fallback window.

Normalize to a fixed 10,000 vote budget, enforce a 15% max per-authority share when feasible, and fall back to equal weighting below the 7-authority minimum needed to enforce that bound.

Also add node-side single-local-GRANDPA-key guards at startup and runtime to reduce accidental double-vote misconfiguration.
@blakebyrnes blakebyrnes force-pushed the pr/add-multigrandpa-voter-support branch from 61188e4 to 43dabfb Compare March 9, 2026 13:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants