Files
zeekay 4e6885fbe8 chore: initial commit — tree had no git at all
github.com/luxfi/coronad existed only as loose files: no .git, no history, no
remote. Invisible to any sweep that looks for a .git directory, and an rm -rf
would have destroyed it unrecoverably.

Includes two dependency repairs.

1. It did not build: "unknown revision v1.16.98" — the v1.16.x line was DELETED
   from github.com/luxfi/geth. The requirement is baked into published modules
   (crypto/constants/warp pin the dead tag, some also `exclude` the
   alternative), so requiring crypto v1.20.2 / constants v1.6.2 / warp v1.24.1
   is what escapes it.

2. Dropped two replace directives pointing at absolute paths on one disk:

       replace github.com/luxfi/corona => /Users/z/work/lux/corona
       replace github.com/luxfi/warp   => /Users/z/work/lux/warp

   Those would have made this module resolvable ONLY on this machine — CI or
   any other checkout could never build it. They were also unnecessary: the
   published versions the `require` lines already name (corona v0.10.4) build
   and test clean without them.

Verified: go build ./... exits 0, go test ./... 1 ok / 0 fail.
The compiled coronad binary is ignored rather than committed.

NOTE: no remote — luxfi/coronad does not exist on GitHub. Still one copy.
2026-07-26 05:22:22 -07:00

39 lines
1.2 KiB
Go

// Copyright (C) 2019-2026, Lux Industries Inc. All rights reserved.
// See the file LICENSE for licensing terms.
package coronad
import (
"errors"
"fmt"
"github.com/luxfi/corona/threshold"
"github.com/luxfi/warp"
warppulsar "github.com/luxfi/warp/pulsar"
)
// ToEvidence serializes a Corona threshold signature into the warp.CoronaEvidence
// the Corona finality lane verifies. The signature bytes use warp/pulsar's
// canonical Corona wire form (SerializeCoronaSig) — the exact inverse of the
// DeserializeCoronaSig the RingtailVerifier runs — so emit and verify cannot
// drift. Routing (ChainID, KeyEraID, Generation) comes from the era.
func ToEvidence(era *Era, sig *threshold.Signature) (warp.CoronaEvidence, error) {
if era == nil || era.inner == nil {
return warp.CoronaEvidence{}, ErrUninitializedEra
}
if sig == nil {
return warp.CoronaEvidence{}, errors.New("coronad: nil signature")
}
sigBytes, err := warppulsar.SerializeCoronaSig(sig)
if err != nil {
return warp.CoronaEvidence{}, fmt.Errorf("coronad: serialize corona signature: %w", err)
}
return warp.CoronaEvidence{
ChainID: era.ChainID(),
KeyEraID: era.KeyEraID(),
Generation: era.Generation(),
Sig: sigBytes,
}, nil
}