Commit 09f61d3
authored
spec(frost/roast): normative coordinator-seed derivation (RFC-21 Annex A) + cross-language conformance vectors (#4030)
Stacked on #3866 (base: `feat/frost-schnorr-migration-scaffold`).
Implements item 3 of the review feedback (duplicated, divergent protocol
constants) — Go half; the Rust half is the paired PR stacked on #4005.
## Problem
The coordinator-shuffle seed derivation exists twice, in two languages,
on two branches, with no single source of truth — and the two copies
disagree (flagged in #4026):
| | seed | attempt numbering |
|---|---|---|
| Go RFC-21 layer | `fold(SHA256(KeyGroup ‖ SessionID ‖ MessageDigest))`
| 0-based |
| Rust engine validation | `int64_be(MessageDigest[0..8])` (legacy
`signingAttemptSeed` convention) | 1-based wire |
At Phase-7 wiring, every Go-derived attempt context would fail the Rust
engine's strict-mode validation — a network-fracturing liveness failure
that property tests on either side cannot catch.
## What this PR does (Go half)
1. **RFC-21 Annex A (normative)** — single normative definition of the
derivation: inputs (including the exact `KeyGroupBytes` definition for
`FrostTBTCSignerV1` material — the UTF-8 bytes of the hex key-group
handle, treated opaquely), the 0-based composition with the
two's-complement-wrapping addition, the `wire = AttemptNumber + 1` FFI
mapping, and the accepted non-goals (unframed concatenation,
first-8-byte fold, grindability bounds) with rationale. The Go
derivation is adopted as normative: it binds key group + session +
digest rather than the digest alone, and the live `pkg/tbtc` signing
loop's legacy convention is explicitly documented as the thing Phase 7
migrates *from*.
2. **Generated conformance vectors** —
`pkg/frost/roast/testdata/coordinator_seed_vectors.json`: ten end-to-end
vectors (folded seed int64 + selected coordinator) covering attempts
0/1/3/5/7, sparse and production-size (n=100) member sets, opaque
key-group handles, and negative folded seeds. Regenerated from the
deterministic input matrix via `ROAST_SEED_VECTORS_REGEN=1 go test -run
TestRegenerateCoordinatorSeedVectors` — generation-from-spec rather than
hand-pinning, per the review.
3. **Conformance test** —
`TestCoordinatorSeedDerivation_ConformanceVectors` pins
`DeriveAttemptSeed → foldAttemptSeed → SelectCoordinator` end to end
against the file, asserts the wire-mapping invariant on every vector,
and requires at least one negative-seed pin so an unsigned-integer port
cannot pass.
The paired Rust PR switches the engine to this derivation (subtracting 1
from the wire attempt number before composition) and consumes a
byte-identical copy of the vector file, so either side drifting fails
its own CI rather than fracturing coordinator agreement in a mixed
deployment.
No behavior change on the Go side — it was already normative-conformant;
this PR makes that the *specified* behavior and pins it.
## Tests
`go test ./pkg/frost/...` passes; vectors verified present with 7
negative-seed pins out of 10.
🤖 Generated with [Claude Code](https://claude.com/claude-code)3 files changed
Lines changed: 899 additions & 0 deletions
File tree
- docs/rfc
- pkg/frost/roast
- testdata
Lines changed: 89 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
771 | 771 | | |
772 | 772 | | |
773 | 773 | | |
| 774 | + | |
| 775 | + | |
| 776 | + | |
| 777 | + | |
| 778 | + | |
| 779 | + | |
| 780 | + | |
| 781 | + | |
| 782 | + | |
| 783 | + | |
| 784 | + | |
| 785 | + | |
| 786 | + | |
| 787 | + | |
| 788 | + | |
| 789 | + | |
| 790 | + | |
| 791 | + | |
| 792 | + | |
| 793 | + | |
| 794 | + | |
| 795 | + | |
| 796 | + | |
| 797 | + | |
| 798 | + | |
| 799 | + | |
| 800 | + | |
| 801 | + | |
| 802 | + | |
| 803 | + | |
| 804 | + | |
| 805 | + | |
| 806 | + | |
| 807 | + | |
| 808 | + | |
| 809 | + | |
| 810 | + | |
| 811 | + | |
| 812 | + | |
| 813 | + | |
| 814 | + | |
| 815 | + | |
| 816 | + | |
| 817 | + | |
| 818 | + | |
| 819 | + | |
| 820 | + | |
| 821 | + | |
| 822 | + | |
| 823 | + | |
| 824 | + | |
| 825 | + | |
| 826 | + | |
| 827 | + | |
| 828 | + | |
| 829 | + | |
| 830 | + | |
| 831 | + | |
| 832 | + | |
| 833 | + | |
| 834 | + | |
| 835 | + | |
| 836 | + | |
| 837 | + | |
| 838 | + | |
| 839 | + | |
| 840 | + | |
| 841 | + | |
| 842 | + | |
| 843 | + | |
| 844 | + | |
| 845 | + | |
| 846 | + | |
| 847 | + | |
| 848 | + | |
| 849 | + | |
| 850 | + | |
| 851 | + | |
| 852 | + | |
| 853 | + | |
| 854 | + | |
| 855 | + | |
| 856 | + | |
| 857 | + | |
| 858 | + | |
| 859 | + | |
| 860 | + | |
| 861 | + | |
| 862 | + | |
774 | 863 | | |
775 | 864 | | |
776 | 865 | | |
| |||
0 commit comments