feat(mining-slot): derive GRANDPA voters from recent mining activity#417
feat(mining-slot): derive GRANDPA voters from recent mining activity#417blakebyrnes wants to merge 1 commit intomainfrom
Conversation
8b360e3 to
c889f4a
Compare
|
@copilot can you review this before i mark public? |
|
@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. |
d9b2d1c to
3505fa4
Compare
There was a problem hiding this comment.
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.
3505fa4 to
8c938e0
Compare
8c938e0 to
61188e4
Compare
There was a problem hiding this comment.
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.
61188e4 to
43dabfb
Compare
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.