Files
threshold/protocols/corona/reshare/reshare.go
zeekay 8d5b2309db protocols/{corona,pulsar}: extend alias surface for consensus consumers
Adds the re-exports luxfi/consensus needs through the canonical
threshold/protocols alias surface so the consensus engine no longer
imports luxfi/corona/* or luxfi/pulsar/ref/go directly.

Protocols/corona top-level gains Params, NewParams, GenerateKeys,
VerifyBatch, VerifyBatchAll forwards on top of the existing
Signer/KeyShare/GroupKey/Round1Data/Round2Data/Signature/Verify/
NewSigner type aliases.

New subpackages mirror the luxfi/corona namespace:

  protocols/corona/keyera     -> luxfi/corona/keyera
  protocols/corona/primitives -> luxfi/corona/primitives
  protocols/corona/reshare    -> luxfi/corona/reshare
  protocols/corona/sign       -> luxfi/corona/sign
  protocols/corona/gpu        -> luxfi/corona/gpu

A new protocols/pulsar subpackage mirrors luxfi/pulsar/ref/go/pkg/pulsar
covering Mode constants, Params/ParamsP{44,65,87}/ParamsFor, the
key/share/signature types, identity layer (IdentityKey,
IdentityDirectory, SymmetricSession, GenerateIdentity), two-round
threshold signing (ThresholdSigner, NewThresholdSigner, Combine),
DKG (DKGSession, NewDKGSession, DKGOutput, DKGRound1Msg, DKGRound2Msg),
and the single-party FIPS 204 baseline (GenerateKey, Sign, VerifyCtx).

The re-exports are type aliases and thin function forwards; no
behaviour change. The underlying corona kernel and pulsar reference
implementation are unchanged.

go.mod bumps luxfi/corona v0.4.1 -> v0.7.5 (needed for the gpu
subpackage, which appeared at v0.7.2) and adds luxfi/pulsar v1.0.12
matching the consensus consumer. Pre-existing prometheus-stack indirect
deps stripped by go mod tidy because the metric sweep already removed
the direct consumer.

Closes the 22-file layering violation flagged by the 2026-05-31
integration audit. The consensus consumer that target these new
alias paths lands in a companion commit on luxfi/consensus.

Layering shape after:

  consensus -> threshold/protocols/{corona,pulsar}  (stable alias)
                 |
                 v
              luxfi/corona, luxfi/pulsar  (primitive implementations)
2026-05-31 12:37:54 -07:00

74 lines
2.9 KiB
Go

// Copyright (C) 2025-2026, Lux Industries Inc. All rights reserved.
// See the file LICENSE for licensing terms.
// Package reshare re-exports github.com/luxfi/corona/reshare through
// the threshold/protocols/corona alias surface. Downstream consumers
// (luxfi/consensus) target this import path so the consensus engine
// does not depend directly on the corona module.
//
// The activation circuit-breaker (VerifyActivation + ActivationCert)
// is the chain-level gate that admits a new committee only when the
// new shares can threshold-sign under the unchanged GroupKey.
package reshare
import (
"github.com/luxfi/corona/hash"
"github.com/luxfi/corona/reshare"
)
// HashSuite is the hash-family identifier the activation transcript
// binds to. Aliased from the corona/hash package so callers do not
// import that package directly. Passing nil resolves to the production
// default (Corona-SHA3).
type HashSuite = hash.HashSuite
// Activation-cert types and the chain-level circuit-breaker.
type (
// ActivationMessage is the canonical message the new committee
// threshold-signs to authorise the share-set transition. Its
// SignableBytes binds chain_id / network_id / key_era_id / group_id
// / old+new epoch numbers / old+new validator-set hashes /
// old+new threshold / group_public_key_hash / transcript hashes.
ActivationMessage = reshare.ActivationMessage
// ReshareTranscript is the public exchange transcript for the
// reshare ceremony. The activation message's transcript-hash
// field commits to this.
ReshareTranscript = reshare.ReshareTranscript
// ActivationCert is the threshold-signed activation message that
// VerifyActivation consults. The cert is admissible only when its
// embedded signature verifies under the unchanged GroupKey.
ActivationCert = reshare.ActivationCert
// TranscriptInputs is the structured input the chain layer feeds
// into transcript-hash derivation.
TranscriptInputs = reshare.TranscriptInputs
)
// Sentinel errors surfaced by VerifyActivation. Callers route on these
// via errors.Is.
var (
// ErrActivationFailed signals that the activation signature did
// not verify under the bound GroupKey.
ErrActivationFailed = reshare.ErrActivationFailed
)
// VerifyActivation is the chain-level circuit-breaker. The new
// share-set is admitted iff the supplied ActivationCert's embedded
// signature verifies under the bound GroupKey AND the local-view
// transcript / exchange hashes match the cert's commitment.
//
// suite=nil resolves to the production default (Corona-SHA3). Returns
// ErrActivationFailed when the verifier closure rejects the embedded
// signature.
func VerifyActivation(
cert *ActivationCert,
localTranscriptHash [32]byte,
localExchangeHash [32]byte,
suite HashSuite,
verifier func(message, signature []byte) bool,
) error {
return reshare.VerifyActivation(cert, localTranscriptHash, localExchangeHash, suite, verifier)
}