Skip to content

docs: BLS12-381 migration plan#35

Open
simonzg wants to merge 2 commits into
testnetfrom
bls12381-migration-plan
Open

docs: BLS12-381 migration plan#35
simonzg wants to merge 2 commits into
testnetfrom
bls12381-migration-plan

Conversation

@simonzg

@simonzg simonzg commented Apr 30, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds a detailed engineering plan for migrating Meter's BLS implementation from PBC (libgmp/libpbc CGo) to BLS12-381 (blst), aligning with the Ethereum beacon chain signature scheme.

Document covers

  • Analysis of the current PBC Type A implementation and all call sites
  • Target BLS12-381 spec (minimal-pubkey-size variant, 48-byte pubkeys, 96-byte sigs)
  • 5-PR breakdown with per-PR file lists, code sketches, and test requirements
  • Dual-key staking registration strategy (validators register BLS12-381 key before fork)
  • Fork-gated VerifyQC that handles both old and new blocks during historical sync
  • meter keygen-bls12381 CLI tool design (HKDF-derived from ECDSA key)
  • Wire format changes (KBlock size actually decreases slightly)
  • Dependency graph, risks/mitigations, open questions

PR dependency chain

PR 1 (new package + interface)
  └─ PR 2 (thread interface through types)
       ├─ PR 3 (staking dual-key)
       └─ PR 4 (fork gate)
            └─ PR 5 (fork height + tooling)

PRs 1–2 are additive with no consensus risk. PRs 3–5 require validator coordination before merging to mainnet.

🤖 Generated with Claude Code

simonzg and others added 2 commits April 30, 2026 14:45
5-PR plan to replace the PBC/libgmp CGo BLS implementation with
BLS12-381 (blst), matching the Ethereum beacon chain signature scheme.
Covers interface design, dual-key staking registration, fork-gated
block verification, key migration tooling, and testnet activation
timeline.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
After cross-referencing the full codebase, the original plan missed 14
files and several important concerns:

- Added missing files: qc_vote_manager.go, tc_vote_manager.go,
  pacemaker_assist.go, reactor_assist.go, reactor_bootstrap_committee.go,
  key_loader.go, utils.go, cmd/mdb/main.go
- TC (timeout certificate) signing path needs same fork-gate as QC
- QCVoteManager/TCVoteManager hold bls.System directly; must accept
  BLSCommon interface instead
- ComputeDoubleSigner in stats_tx.go calls bls.Verify directly and
  needs a fork-height branch for pre-fork evidence
- comboPubKey/SplitPubKey format is implementation-specific
- Delegate.BlsPubKey has a misleading JSON tag (never actually marshalled)
- Keystore format change spec (bls12381_public_key, bls12381_private_key)
- Pre-fork quorum check location (PrepareEnvForPacemaker)
- api/node CsPubKey length change affects external consumers
- candidateUpdate handler also needs BlsPubKey2 parsing

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.

1 participant