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

64 lines
2.0 KiB
Go

package sign
import (
"fmt"
"github.com/luxfi/threshold/internal/round"
"github.com/luxfi/threshold/pkg/party"
"github.com/luxfi/threshold/pkg/pool"
"github.com/luxfi/threshold/pkg/protocol"
"github.com/luxfi/threshold/protocols/doerner/keygen"
)
// StartSignReceiver starts the signature protocol for the receiver.
//
// This corresponds to protocol 4 of https://eprint.iacr.org/2018/499, simplified
// because we use a simple additive sharing instead of a polynomial sharing.
//
// The Receiver plays the role of "Bob".
func StartSignReceiver(config *keygen.ConfigReceiver, selfID, otherID party.ID, hash []byte, pl *pool.Pool) protocol.StartFunc {
return func(sessionID []byte) (round.Session, error) {
info := round.Info{
ProtocolID: "doerner/keygen",
FinalRoundNumber: 2,
SelfID: selfID,
PartyIDs: party.NewIDSlice([]party.ID{selfID, otherID}),
Threshold: 1,
Group: config.Group(),
}
helper, err := round.NewSession(info, sessionID, nil)
if err != nil {
return nil, fmt.Errorf("keygen.StartKeygen: %w", err)
}
return &round1R{Base: helper, config: config, hash: hash}, nil
}
}
// StartSignSender starts the signature protocol for the sender.
//
// This corresponds to protocol 4 of https://eprint.iacr.org/2018/499, simplified
// because we use a simple additive sharing instead of a polynomial sharing.
//
// The Sender plays the role of "Alice".
func StartSignSender(config *keygen.ConfigSender, selfID, otherID party.ID, hash []byte, pl *pool.Pool) protocol.StartFunc {
return func(sessionID []byte) (round.Session, error) {
info := round.Info{
ProtocolID: "doerner/keygen",
FinalRoundNumber: 2,
SelfID: selfID,
PartyIDs: party.NewIDSlice([]party.ID{selfID, otherID}),
Threshold: 1,
Group: config.Group(),
}
helper, err := round.NewSession(info, sessionID, nil)
if err != nil {
return nil, fmt.Errorf("keygen.StartKeygen: %w", err)
}
return &round1S{Base: helper, config: config, hash: hash}, nil
}
}