Files
zeekay 1362566d34 Merge github/main into the hardening branch
Both sides carried work. Ours is the security pass: the stableswap amp=0
and empty-pool halts, the wei-per-swap leak, uint256 truncation in math,
three verifiers that returned a verdict without verifying, the cgo/non-cgo
consensus split in cggmp21, and the starkfri soundness floor. Theirs is
the fhe parameter set, the mldsa crafted-length refusal, and the naming
sweep.

Resolved per hunk rather than by side. Where both fixed one defect the
better fix survives alone, never two guards for one bug.
2026-08-28 20:13:25 -07:00

41 lines
1.4 KiB
Go

package pq
import (
"crypto/sha256"
rt "github.com/luxfi/precompile/corona"
"github.com/luxfi/precompile/examples"
)
// CoronaDemo exercises the Corona lattice threshold precompile (0x0200..0B).
// Corona requires a full threshold signing ceremony which is heavy to set up
// in a demo context. We test the input parsing and gas calculation path.
func CoronaDemo() []examples.Result {
// Build minimal input: threshold(4) + totalParties(4) + messageHash(32) + signature
// With threshold=2, totalParties=3
hash := sha256.Sum256([]byte("Lux precompile Corona demo"))
input := make([]byte, 0, 4+4+32)
input = append(input, examples.Uint32BE(2)...) // threshold
input = append(input, examples.Uint32BE(3)...) // total parties
input = append(input, hash[:]...) // message hash
// This will fail with "invalid input length" since we don't have a real
// Corona signature, but it exercises the precompile dispatch and gas calc
r := examples.CallPrecompileResult(
"Corona Threshold (parse test)",
rt.CoronaThresholdPrecompile,
rt.ContractCoronaThresholdAddress,
input,
func(out []byte) bool {
// Expected to fail validation but not panic
return true
},
)
// This is a parse/gas test -- it will error but that is expected
r.Pass = r.Error != nil // we EXPECT an error (short input)
r.Error = nil // clear the expected error for display
return []examples.Result{r}
}