Files
threshold/protocols/example/example.go
zeekay b41c78f5b3 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 (bf88f5a) 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

37 lines
950 B
Go

package example
import (
"fmt"
"github.com/luxfi/threshold/internal/round"
"github.com/luxfi/threshold/pkg/party"
"github.com/luxfi/threshold/pkg/protocol"
"github.com/luxfi/threshold/protocols/example/xor"
)
const (
protocolID = "example/xor"
protocolRounds round.Number = 2
)
// StartXOR is a function that creates the first round with all necessary information to create a protocol.Handler.
func StartXOR(selfID party.ID, partyIDs party.IDSlice) protocol.StartFunc {
return func(sessionID []byte) (round.Session, error) {
info := round.Info{
ProtocolID: protocolID,
FinalRoundNumber: protocolRounds,
SelfID: selfID,
PartyIDs: partyIDs,
}
// create the helper with a description of the protocol
helper, err := round.NewSession(info, sessionID, nil)
if err != nil {
return nil, fmt.Errorf("xor: %w", err)
}
r := &xor.Round1{
Base: helper,
}
return r, nil
}
}