mirror of
https://github.com/luxfi/threshold.git
synced 2026-10-30 15:15:53 +00:00
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.
41 lines
1.1 KiB
Go
41 lines
1.1 KiB
Go
// Package keygen implements the LSS key generation protocol.
|
|
package keygen
|
|
|
|
import (
|
|
"github.com/luxfi/threshold/internal/round"
|
|
"github.com/luxfi/threshold/pkg/math/curve"
|
|
"github.com/luxfi/threshold/pkg/party"
|
|
"github.com/luxfi/threshold/pkg/pool"
|
|
"github.com/luxfi/threshold/pkg/protocol"
|
|
"github.com/luxfi/threshold/protocols/lss/config"
|
|
)
|
|
|
|
// Start initiates the LSS key generation protocol.
|
|
func Start(selfID party.ID, participants []party.ID, threshold int, group curve.Curve, pl *pool.Pool) protocol.StartFunc {
|
|
return func(sessionID []byte) (round.Session, error) {
|
|
info := round.Info{
|
|
ProtocolID: "lss/keygen",
|
|
FinalRoundNumber: 3,
|
|
SelfID: selfID,
|
|
PartyIDs: participants,
|
|
Threshold: threshold,
|
|
Group: group,
|
|
}
|
|
|
|
helper, err := round.NewSession(info, sessionID, pl)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return &round1{
|
|
Base: helper,
|
|
// sync.Map fields are zero-initialized and don't need explicit initialization
|
|
}, nil
|
|
}
|
|
}
|
|
|
|
// Result contains the final output of the keygen protocol
|
|
type Result struct {
|
|
Config *config.Config
|
|
}
|