Files
zeekay 75be0e607e round: rename Helper to Base — name the value, not the laziness
round.Helper was the canonical anti-pattern: a bare-noun
qualifier-name that told you nothing about what the type does. The
type is the embeddable Session implementation that protocol round
structs anchor on — its VALUE is "the base every round builds on".
Rename it to that.

  type Helper struct { ... }   → type Base struct { ... }
  func (h *Helper) ...         → func (h *Base) ...
  func NewSession(...) (*Helper, error) → (*Base, error)
  Output { *Helper }           → Output { *Base }
  Abort  { *Helper }           → Abort  { *Base }
  round.Helper                 → round.Base   (18 files)
  Helper: helper               → Base: helper (struct literal init)
  r.Helper.X / r.Helper        → r.Base.X / r.Base (field access)

internal/round/helper.go    → base.go
internal/round/helper_test.go → base_test.go

Forward-only — no type alias, no deprecation. The Go FAQ pointer-
receiver consistency landed in the prior commit (f7b1365) so the
method set is already aligned; this commit only renames the type.

Build + vet clean; round / CMP keygen smoke / FROST keygen all
PASS unchanged.
2026-06-01 00:26:33 -07:00

50 lines
1.2 KiB
Go

package presign
import (
"github.com/luxfi/threshold/internal/round"
"github.com/luxfi/threshold/pkg/ecdsa"
"github.com/luxfi/threshold/pkg/math/curve"
"github.com/luxfi/threshold/pkg/party"
)
var _ round.Round = (*sign1)(nil)
type sign1 struct {
*round.Base
// PublicKey = X
PublicKey curve.Point
// Message = m
Message []byte
// PreSignature = (R, {R̄ⱼ,Sⱼ}ⱼ, kᵢ, χᵢ)
PreSignature *ecdsa.PreSignature
}
// VerifyMessage implements round.Round.
func (r *sign1) VerifyMessage(round.Message) error { return nil }
// StoreMessage implements round.Round.
func (r *sign1) StoreMessage(round.Message) error { return nil }
func (r *sign1) Finalize(out chan<- *round.Message) (round.Session, error) {
// σᵢ = kᵢm+rχᵢ (mod q)
SigmaShare := r.PreSignature.SignatureShare(r.Message)
err := r.BroadcastMessage(out, &broadcastSign2{
Sigma: SigmaShare,
})
if err != nil {
return r, err
}
return &sign2{
sign1: r,
SigmaShares: map[party.ID]curve.Scalar{r.SelfID(): SigmaShare},
}, nil
}
// MessageContent implements round.Round.
func (*sign1) MessageContent() round.Content { return nil }
// Number implements round.Round.
func (*sign1) Number() round.Number { return 1 }