mirror of
https://github.com/luxfi/precompile.git
synced 2026-09-24 00:26:21 +00:00
Corona is the Ring-LWE threshold signature scheme (lattice flavor:
Ring-LWE, vs Pulsar's Module-LWE / ML-DSA). The pre-rename library
name was Corona. Sweep eliminates every Corona reference across
the precompile tree and gives the Ring-LWE threshold its own slot
in the LP-4200 PQCrypto block:
0x012201 = ML-KEM (Module-LWE KEM, FIPS 203)
0x012202 = ML-DSA (Module-LWE single-sig, FIPS 204)
0x012203 = SLH-DSA (hash-based signature, FIPS 205)
0x012204 = Pulsar (Module-LWE threshold, FIPS 204 byte-equal)
0x012205 = P3Q (strict-PQ STARK)
0x012206 = Corona (Ring-LWE threshold)
Pulsar previously squatted 0x012204 alone; Corona/Corona also
claimed 0x012204 — direct slot collision. Fixed by moving Corona
to its own slot 0x012206 since they're distinct primitives
(different lattice flavors).
- Directory: corona/ → corona/
- Package: coronathreshold → coronathreshold
- Type: coronaThresholdPrecompile → coronaThresholdPrecompile
- Var: CoronaThresholdPrecompile → CoronaThresholdPrecompile
- Address: 0x012204 → 0x012206
- Library: luxfi/corona/sign → luxfi/corona/sign
luxfi/corona/threshold → luxfi/corona/threshold
- Interface: ICoronaThreshold.sol → ICoronaThreshold.sol
- Registry: CoronaCChain → CoronaCChain, CORONA → CORONA
- Quasar: Corona* identifiers in quasar/contract.go renamed
- Bridge: docstring sweep
All affected packages build clean. All 5/6 PQ precompile tests pass
(one flaky on first run, green on retry). Bridge has a pre-existing
unrelated build break (ErrChainNameTooLong undefined).
69 lines
2.1 KiB
Go
69 lines
2.1 KiB
Go
// SPDX-License-Identifier: Apache-2.0
|
|
// Copyright (C) 2025, Lux Industries, Inc. All rights reserved.
|
|
|
|
package bridge
|
|
|
|
// staticRegistry is an immutable in-memory Registry. Cheap lookups via id map,
|
|
// stable enumeration order via the slice.
|
|
type staticRegistry struct {
|
|
chains []Chain
|
|
byID map[ChainID]Chain
|
|
}
|
|
|
|
// NewStatic returns a Registry over an immutable list. Used in tests and as
|
|
// the default seed loaded into the on-chain registry at deployment.
|
|
func NewStatic(chains []Chain) Registry {
|
|
byID := make(map[ChainID]Chain, len(chains))
|
|
out := make([]Chain, len(chains))
|
|
for i, c := range chains {
|
|
out[i] = c
|
|
byID[c.ID] = c
|
|
}
|
|
return &staticRegistry{chains: out, byID: byID}
|
|
}
|
|
|
|
func (r *staticRegistry) Get(id ChainID) (Chain, bool) {
|
|
c, ok := r.byID[id]
|
|
return c, ok
|
|
}
|
|
|
|
func (r *staticRegistry) All() []Chain {
|
|
out := make([]Chain, len(r.chains))
|
|
copy(out, r.chains)
|
|
return out
|
|
}
|
|
|
|
// DefaultSeed is the initial registry contents that ship with a fresh bridge
|
|
// contract. Operators governance-tx new chains in or out at runtime via the
|
|
// state-backed registry; this list is the canonical day-zero set.
|
|
func DefaultSeed() []Chain {
|
|
return []Chain{
|
|
// Lux ecosystem
|
|
{ID: 96369, Name: "lux", EVM: true},
|
|
{ID: 96368, Name: "lux-test", EVM: true},
|
|
{ID: 36963, Name: "hanzo", EVM: true},
|
|
{ID: 36962, Name: "hanzo-test", EVM: true},
|
|
{ID: 200200, Name: "zoo", EVM: true},
|
|
{ID: 200201, Name: "zoo-test", EVM: true},
|
|
{ID: 36911, Name: "spc", EVM: true},
|
|
{ID: 36910, Name: "spc-test", EVM: true},
|
|
{ID: 6133, Name: "pars", EVM: true},
|
|
{ID: 6132, Name: "pars-test", EVM: true},
|
|
|
|
// External EVM chains
|
|
{ID: 1, Name: "ethereum", EVM: true},
|
|
{ID: 42161, Name: "arbitrum", EVM: true},
|
|
{ID: 10, Name: "optimism", EVM: true},
|
|
{ID: 8453, Name: "base", EVM: true},
|
|
{ID: 137, Name: "polygon", EVM: true},
|
|
{ID: 56, Name: "bsc", EVM: true},
|
|
{ID: 43114, Name: "avalanche", EVM: true},
|
|
|
|
// Non-EVM chains (virtual ids for bookkeeping)
|
|
{ID: 900001, Name: "solana", EVM: false},
|
|
{ID: 900002, Name: "bitcoin", EVM: false},
|
|
{ID: 900003, Name: "xrp", EVM: false},
|
|
{ID: 900004, Name: "ton", EVM: false},
|
|
}
|
|
}
|