Commit 65f3963
committed
feat(frost/signing): RFC-21 Phase 1B -- optional AttemptContextHash field
Extends the three FROST/tbtc-signer protocol message types with an
optional 32-byte AttemptContextHash field that binds the message to a
specific RFC-21 AttemptContext (introduced in Phase 1A).
* nativeFROSTRoundOneCommitmentMessage
* nativeFROSTRoundTwoSignatureShareMessage
* buildTaggedTBTCSignerRoundContributionMessage
Migration contract (Phase 1B intentionally limited):
* Field uses omitempty -- absent on the wire when the sender has not
bound the message to a context. Old peers continue to interop.
* Receiver-side Unmarshal validates length-when-present (must be
exactly AttemptContextHashFieldLength = 32) but does not yet match
against the locally-computed context. Higher-level acceptance lands
in a later RFC-21 phase behind a build tag.
* Shared helpers in attempt_context_binding.go convert between the
on-wire []byte form and the canonical [32]byte hash form. Senders
use SetAttemptContextHash; receivers use GetAttemptContextHash to
get the hash + presence flag.
Equal-or-reject is extended to compare AttemptContextHash bytewise,
so a peer that retransmits the same contribution but mutates the
binding mid-stream triggers the existing first-write-wins reject
path (introduced in PR #3959).
17 new tests cover: length validation; array<->slice round-trip
without caller aliasing; per-message marshal/unmarshal round-trip
with field absent and present; backward compatibility with
pre-Phase-1B JSON; wrong-length rejection; equal-or-reject
sensitivity to the new field. All pass under
`go test -tags 'frost_native frost_tbtc_signer' ./pkg/frost/...`
plus the pkg/tbtc regression subset.
Refs RFC-21 (docs/rfc/rfc-21-*); stacked on Phase 1A (#3963).1 parent cb26865 commit 65f3963
4 files changed
Lines changed: 502 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
0 commit comments