mirror of
https://github.com/luxfi/chains.git
synced 2026-09-24 00:26:00 +00:00
chains: complete Ringtail → Corona purge across thresholdvm + quantumvm + dexvm
Continuation of dc31d5b (quantumvm consumer-side leak after consensus
repo migration) — the rename was incomplete; this pass closes it.
Identifier renames in chains/{quantumvm,thresholdvm,dexvm}:
- NTTForwardRingtail / NTTInverseRingtail / BatchNTTForwardRingtail
→ NTTForward/Inverse/BatchNTTForwardCorona (Quasar GPU dispatch)
- LaneRingtail (CertLane enum)
→ LaneCorona
- ProtocolRingtail (Protocol enum)
→ ProtocolCorona (string value already "corona")
- All Ringtail-prefixed local identifiers in quantumvm/{quasar,
quasar_witness,block,vm,vm_test,signer,stamper,service}.go,
thresholdvm/{client,protocols,rpc,types/{ceremony,share},
runtime/m_chain_adapter,cert/lane_test,protocol_executor_test}.go,
dexvm/factory.go
Directory + file rename:
thresholdvm/protocol/ringtail_general/ringtail.go
→ thresholdvm/protocol/corona_general/corona.go
package ringtail_general → package corona_general
evm/main.go: replace single `precompile/ringtail` blank-import with
the canonical LP-4200 unified PQCrypto block (mlkem 0x012201,
mldsa 0x012202, slhdsa 0x012203, pulsar 0x012204, p3q 0x012205,
corona 0x012206) + xwing.
External test that imports threshold's renamed wrapper:
thresholdvm/protocol_executor_test.go now imports
"github.com/luxfi/threshold/protocols/corona" (was protocols/ringtail).
Resolves via the workspace `./threshold` entry pointing at the
local renamed wrapper; downstream chains/go.mod still pins
luxfi/threshold v1.5.5 and will tidy clean once threshold cuts the
next tag.
Build: go build ./... PASS (only harmless duplicate-rpath warnings
from the cevm cgo link).
Tests:
thresholdvm + subpackages PASS
quantumvm PASS
This commit is contained in:
+1
-1
@@ -12,7 +12,7 @@
|
||||
// - LX-First arbitrage strategy support
|
||||
//
|
||||
// Architecture:
|
||||
// - Uses Quasar consensus (BLS + Ringtail + ML-DSA) for finality
|
||||
// - Uses Quasar consensus (BLS + Corona + ML-DSA) for finality
|
||||
// - Integrates with Warp 1.5 for cross-chain messaging
|
||||
// - Supports both spot and perpetual trading
|
||||
// - Designed for institutional-grade performance
|
||||
|
||||
+8
-6
@@ -24,12 +24,14 @@ import (
|
||||
// ── VRF ──────────────────────────────────────────────
|
||||
_ "github.com/luxfi/precompile/vrf" // 0x3213 ECVRF verify (RFC 9381)
|
||||
|
||||
// ── Post-Quantum (FIPS 203/204/205) ──────────────────
|
||||
_ "github.com/luxfi/precompile/mldsa" // 0x0200..06 ML-DSA verify (Dilithium)
|
||||
_ "github.com/luxfi/precompile/mlkem" // 0x0200..07 ML-KEM encap/decap (Kyber)
|
||||
_ "github.com/luxfi/precompile/slhdsa" // 0x0600..01 SLH-DSA verify (SPHINCS+)
|
||||
_ "github.com/luxfi/precompile/ringtail" // 0x0200..0B Ringtail lattice threshold
|
||||
_ "github.com/luxfi/precompile/xwing" // 0x2221 X-Wing hybrid KEM (X25519+ML-KEM)
|
||||
// ── Post-Quantum (FIPS 203/204/205) — LP-4200 unified block ──────────
|
||||
_ "github.com/luxfi/precompile/mlkem" // 0x012201 ML-KEM (FIPS 203 — Module-LWE KEM)
|
||||
_ "github.com/luxfi/precompile/mldsa" // 0x012202 ML-DSA (FIPS 204 — Module-LWE signature)
|
||||
_ "github.com/luxfi/precompile/slhdsa" // 0x012203 SLH-DSA (FIPS 205 — hash-based signature)
|
||||
_ "github.com/luxfi/precompile/pulsar" // 0x012204 Pulsar (Module-LWE threshold FIPS 204)
|
||||
_ "github.com/luxfi/precompile/p3q" // 0x012205 P3Q (strict-PQ STARK / FRI / cSHAKE256)
|
||||
_ "github.com/luxfi/precompile/corona" // 0x012206 Corona (Ring-LWE threshold)
|
||||
_ "github.com/luxfi/precompile/xwing" // 0x2221 X-Wing hybrid KEM (X25519+ML-KEM)
|
||||
|
||||
// ── Hashing / ZK Curves ─────────────────────────────
|
||||
_ "github.com/luxfi/precompile/babyjubjub" // 0x0500..07 Baby Jubjub (BN254 twisted Edwards)
|
||||
|
||||
+1
-1
@@ -127,7 +127,7 @@ func (b *Block) Verify(ctx context.Context) error {
|
||||
sigs[i] = tx.GetQuantumSignature()
|
||||
}
|
||||
|
||||
if b.vm.Config.RingtailEnabled {
|
||||
if b.vm.Config.CoronaEnabled {
|
||||
if err := b.vm.quantumSigner.ParallelVerify(msgs, sigs); err != nil {
|
||||
return errBlockVerificationFailed
|
||||
}
|
||||
|
||||
@@ -22,8 +22,8 @@ type Config struct {
|
||||
// Quantum signature algorithm version
|
||||
QuantumAlgorithmVersion uint32
|
||||
|
||||
// Ringtail key size in bytes
|
||||
RingtailKeySize int
|
||||
// Corona key size in bytes
|
||||
CoronaKeySize int
|
||||
|
||||
// Enable quantum stamp validation
|
||||
QuantumStampEnabled bool
|
||||
@@ -40,8 +40,8 @@ type Config struct {
|
||||
// Maximum quantum signature cache size
|
||||
QuantumSigCacheSize int
|
||||
|
||||
// Enable Ringtail key support
|
||||
RingtailEnabled bool
|
||||
// Enable Corona key support
|
||||
CoronaEnabled bool
|
||||
|
||||
// Minimum confirmations for quantum stamps
|
||||
MinQuantumConfirmations uint32
|
||||
@@ -58,13 +58,13 @@ func DefaultConfig() Config {
|
||||
QuantumVerificationFee: 500,
|
||||
MaxParallelTxs: 100,
|
||||
QuantumAlgorithmVersion: 1,
|
||||
RingtailKeySize: 1024,
|
||||
CoronaKeySize: 1024,
|
||||
QuantumStampEnabled: true,
|
||||
QuantumStampWindow: 30 * time.Second,
|
||||
QuantumTime: time.Unix(1704067200, 0), // Jan 1, 2025
|
||||
ParallelBatchSize: 10,
|
||||
QuantumSigCacheSize: 10000,
|
||||
RingtailEnabled: true,
|
||||
CoronaEnabled: true,
|
||||
MinQuantumConfirmations: 1,
|
||||
GPUBatchThreshold: 8,
|
||||
}
|
||||
@@ -86,8 +86,8 @@ func (c *Config) Validate() error {
|
||||
if c.QuantumSigCacheSize <= 0 {
|
||||
c.QuantumSigCacheSize = 10000
|
||||
}
|
||||
if c.RingtailKeySize < 512 {
|
||||
c.RingtailKeySize = 1024
|
||||
if c.CoronaKeySize < 512 {
|
||||
c.CoronaKeySize = 1024
|
||||
}
|
||||
if c.GPUBatchThreshold <= 0 {
|
||||
c.GPUBatchThreshold = 8
|
||||
|
||||
+11
-11
@@ -21,7 +21,7 @@ import (
|
||||
|
||||
var (
|
||||
ErrInvalidQuantumSignature = errors.New("invalid quantum signature")
|
||||
ErrInvalidRingtailKey = errors.New("invalid ringtail key")
|
||||
ErrInvalidCoronaKey = errors.New("invalid corona key")
|
||||
ErrQuantumStampExpired = errors.New("quantum stamp expired")
|
||||
ErrQuantumVerificationFailed = errors.New("quantum verification failed")
|
||||
ErrUnsupportedAlgorithm = errors.New("unsupported quantum algorithm")
|
||||
@@ -50,13 +50,13 @@ type QuantumSignature struct {
|
||||
Timestamp time.Time
|
||||
PublicKey []byte
|
||||
Signature []byte
|
||||
RingtailKey []byte
|
||||
CoronaKey []byte
|
||||
QuantumStamp []byte
|
||||
}
|
||||
|
||||
// MLDSAValidatorKey is the per-validator ML-DSA identity key used by the Q-Chain
|
||||
// (chains/quantumvm) to attest individual round digests. It is NOT the Ringtail
|
||||
// threshold share -- that lives in luxfi/threshold/protocols/ringtail and feeds
|
||||
// (chains/quantumvm) to attest individual round digests. It is NOT the Corona
|
||||
// threshold share -- that lives in luxfi/threshold/protocols/corona and feeds
|
||||
// the Q-witness aggregation in consensus/protocol/quasar.
|
||||
type MLDSAValidatorKey struct {
|
||||
Version uint32
|
||||
@@ -92,12 +92,12 @@ func NewQuantumSigner(log log.Logger, algorithmVersion uint32, keySize int, stam
|
||||
}
|
||||
}
|
||||
|
||||
// GenerateRingtailKey generates a new ML-DSA validator identity key.
|
||||
// The "Ringtail" name is preserved on the public method for wire/RPC
|
||||
// compatibility (qvm.generateRingtailKey); the underlying type is
|
||||
// GenerateCoronaKey generates a new ML-DSA validator identity key.
|
||||
// The "Corona" name is preserved on the public method for wire/RPC
|
||||
// compatibility (qvm.generateCoronaKey); the underlying type is
|
||||
// MLDSAValidatorKey, which is the per-validator ML-DSA identity, not a
|
||||
// Ringtail threshold share.
|
||||
func (qs *QuantumSigner) GenerateRingtailKey() (*MLDSAValidatorKey, error) {
|
||||
// Corona threshold share.
|
||||
func (qs *QuantumSigner) GenerateCoronaKey() (*MLDSAValidatorKey, error) {
|
||||
qs.mu.Lock()
|
||||
defer qs.mu.Unlock()
|
||||
|
||||
@@ -125,7 +125,7 @@ func (qs *QuantumSigner) GenerateRingtailKey() (*MLDSAValidatorKey, error) {
|
||||
// Sign creates a quantum signature for the given message using ML-DSA
|
||||
func (qs *QuantumSigner) Sign(message []byte, key *MLDSAValidatorKey) (*QuantumSignature, error) {
|
||||
if key == nil {
|
||||
return nil, ErrInvalidRingtailKey
|
||||
return nil, ErrInvalidCoronaKey
|
||||
}
|
||||
|
||||
// Restore ML-DSA key if not cached
|
||||
@@ -162,7 +162,7 @@ func (qs *QuantumSigner) Sign(message []byte, key *MLDSAValidatorKey) (*QuantumS
|
||||
Timestamp: time.Now(),
|
||||
PublicKey: key.PublicKey,
|
||||
Signature: signature,
|
||||
RingtailKey: key.PublicKey,
|
||||
CoronaKey: key.PublicKey,
|
||||
QuantumStamp: stamp,
|
||||
}
|
||||
|
||||
|
||||
+39
-39
@@ -4,7 +4,7 @@
|
||||
// Quasar: Quantum-Safe Finality Engine
|
||||
//
|
||||
// Like stellar fusion combining hydrogen into helium, Quasar unifies
|
||||
// classical BLS signatures with post-quantum Ringtail signatures.
|
||||
// classical BLS signatures with post-quantum Corona signatures.
|
||||
// Both burn in parallel - classical for speed, quantum for eternity.
|
||||
//
|
||||
// No block escapes the event horizon without quantum finality.
|
||||
@@ -23,24 +23,24 @@ import (
|
||||
"github.com/luxfi/log"
|
||||
)
|
||||
|
||||
// BlockSigs contains both BLS and Ringtail signatures for a block.
|
||||
// BlockSigs contains both BLS and Corona signatures for a block.
|
||||
// Both are produced in parallel during signing.
|
||||
type BlockSigs struct {
|
||||
BLS *quasar.BLSSignature
|
||||
Ringtail *quasar.CoronaSignature
|
||||
Corona *quasar.CoronaSignature
|
||||
}
|
||||
|
||||
// Quasar is the core Post-Quantum BFT consensus engine for Q-Chain.
|
||||
// Like a supermassive black hole, it pulls all blocks to quantum finality
|
||||
// using dual BLS+Ringtail threshold signatures:
|
||||
// using dual BLS+Corona threshold signatures:
|
||||
// - BLS threshold signatures (classical security, fast path)
|
||||
// - Ringtail threshold signatures (post-quantum, Ring-LWE based)
|
||||
// - Corona threshold signatures (post-quantum, Ring-LWE based)
|
||||
//
|
||||
// Blocks are NOT considered produced without BOTH thresholds being met.
|
||||
type Quasar struct {
|
||||
mu sync.RWMutex
|
||||
|
||||
// Core Quasar engine - provides both BLS and Ringtail signing directly
|
||||
// Core Quasar engine - provides both BLS and Corona signing directly
|
||||
quasar *quasar.Quasar
|
||||
|
||||
// Validator configuration
|
||||
@@ -57,7 +57,7 @@ type Quasar struct {
|
||||
}
|
||||
|
||||
// PendingBlock tracks a block awaiting dual signature finality.
|
||||
// Both BLS AND Ringtail must reach threshold for quantum finality.
|
||||
// Both BLS AND Corona must reach threshold for quantum finality.
|
||||
// Signatures are collected in parallel - either can complete first.
|
||||
type PendingBlock struct {
|
||||
BlockID ids.ID
|
||||
@@ -66,7 +66,7 @@ type PendingBlock struct {
|
||||
BLSSignatures []*quasar.BLSSignature // Classical threshold signatures (parallel)
|
||||
CoronaSignatures []*quasar.CoronaSignature // Post-quantum threshold signatures (parallel)
|
||||
BLSFinalized bool // BLS threshold reached
|
||||
RingtailFinalized bool // Ringtail threshold reached
|
||||
CoronaFinalized bool // Corona threshold reached
|
||||
Finalized bool // BOTH complete = quantum finality
|
||||
}
|
||||
|
||||
@@ -87,7 +87,7 @@ func NewQuasar(cfg QuasarConfig) (*Quasar, error) {
|
||||
cfg.TotalNodes = 3 // Default 3-node network
|
||||
}
|
||||
|
||||
// Initialize Quasar core with BLS + Ringtail
|
||||
// Initialize Quasar core with BLS + Corona
|
||||
qcore, err := quasar.NewQuasar(cfg.Threshold)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to create Quasar core: %w", err)
|
||||
@@ -106,12 +106,12 @@ func NewQuasar(cfg QuasarConfig) (*Quasar, error) {
|
||||
return q, nil
|
||||
}
|
||||
|
||||
// InitializeDualThreshold sets up BLS and Ringtail threshold keys for a new epoch
|
||||
// InitializeDualThreshold sets up BLS and Corona threshold keys for a new epoch
|
||||
func (q *Quasar) InitializeDualThreshold(ctx context.Context) error {
|
||||
q.mu.Lock()
|
||||
defer q.mu.Unlock()
|
||||
|
||||
// Generate dual threshold keys (BLS + Ringtail)
|
||||
// Generate dual threshold keys (BLS + Corona)
|
||||
config, err := quasar.GenerateDualKeys(q.threshold, q.totalNodes)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to generate dual threshold keys: %w", err)
|
||||
@@ -139,13 +139,13 @@ func (q *Quasar) InitializeDualThreshold(ctx context.Context) error {
|
||||
q.log.Info("───────────────────────────────────────────────────────────────────")
|
||||
q.log.Info("║ Threshold:", log.Int("t", q.threshold), log.Int("n", q.totalNodes))
|
||||
q.log.Info("║ BLS Threshold Mode:", log.Bool("enabled", signer.IsThresholdMode()))
|
||||
q.log.Info("║ Ringtail PQ Mode:", log.Bool("enabled", signer.IsDualThresholdMode()))
|
||||
q.log.Info("║ Corona PQ Mode:", log.Bool("enabled", signer.IsDualThresholdMode()))
|
||||
q.log.Info("═══════════════════════════════════════════════════════════════════")
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// SignBlock creates both BLS and Ringtail signatures for a block in parallel.
|
||||
// SignBlock creates both BLS and Corona signatures for a block in parallel.
|
||||
// Returns both signatures; both must reach threshold for quantum finality.
|
||||
func (q *Quasar) SignBlock(ctx context.Context, blockID ids.ID, blockHash []byte, height uint64) (*BlockSigs, error) {
|
||||
q.mu.Lock()
|
||||
@@ -194,7 +194,7 @@ func (q *Quasar) SignBlock(ctx context.Context, blockID ids.ID, blockHash []byte
|
||||
}
|
||||
}()
|
||||
|
||||
// Ringtail signing (Round 1 - D matrix + MACs)
|
||||
// Corona signing (Round 1 - D matrix + MACs)
|
||||
go func() {
|
||||
defer wg.Done()
|
||||
sessionID := int(height) // Use height as session ID
|
||||
@@ -220,7 +220,7 @@ func (q *Quasar) SignBlock(ctx context.Context, blockID ids.ID, blockHash []byte
|
||||
return nil, fmt.Errorf("BLS sign failed: %w", blsErr)
|
||||
}
|
||||
if pqErr != nil {
|
||||
return nil, fmt.Errorf("Ringtail sign failed: %w", pqErr)
|
||||
return nil, fmt.Errorf("Corona sign failed: %w", pqErr)
|
||||
}
|
||||
|
||||
q.mu.Lock()
|
||||
@@ -228,14 +228,14 @@ func (q *Quasar) SignBlock(ctx context.Context, blockID ids.ID, blockHash []byte
|
||||
pending.CoronaSignatures = append(pending.CoronaSignatures, pqSig)
|
||||
q.mu.Unlock()
|
||||
|
||||
q.log.Debug("Block signed with Quasar (BLS + Ringtail parallel)",
|
||||
q.log.Debug("Block signed with Quasar (BLS + Corona parallel)",
|
||||
"blockID", blockID,
|
||||
"height", height,
|
||||
"blsSigCount", len(pending.BLSSignatures),
|
||||
"coronaSigCount", len(pending.CoronaSignatures),
|
||||
)
|
||||
|
||||
return &BlockSigs{BLS: blsSig, Ringtail: pqSig}, nil
|
||||
return &BlockSigs{BLS: blsSig, Corona: pqSig}, nil
|
||||
}
|
||||
|
||||
// AddBLSSignature adds a BLS signature from another validator
|
||||
@@ -259,7 +259,7 @@ func (q *Quasar) AddBLSSignature(blockID ids.ID, sig *quasar.BLSSignature) error
|
||||
return nil
|
||||
}
|
||||
|
||||
// AddCoronaSignature adds a Ringtail signature from another validator
|
||||
// AddCoronaSignature adds a Corona signature from another validator
|
||||
func (q *Quasar) AddCoronaSignature(blockID ids.ID, sig *quasar.CoronaSignature) error {
|
||||
q.mu.Lock()
|
||||
defer q.mu.Unlock()
|
||||
@@ -271,7 +271,7 @@ func (q *Quasar) AddCoronaSignature(blockID ids.ID, sig *quasar.CoronaSignature)
|
||||
|
||||
pending.CoronaSignatures = append(pending.CoronaSignatures, sig)
|
||||
|
||||
q.log.Debug("Added Ringtail signature",
|
||||
q.log.Debug("Added Corona signature",
|
||||
"blockID", blockID,
|
||||
"coronaSigCount", len(pending.CoronaSignatures),
|
||||
"threshold", q.threshold,
|
||||
@@ -281,7 +281,7 @@ func (q *Quasar) AddCoronaSignature(blockID ids.ID, sig *quasar.CoronaSignature)
|
||||
}
|
||||
|
||||
// TryFinalize attempts to finalize a block if BOTH threshold signatures are collected.
|
||||
// Quantum finality requires both BLS AND Ringtail thresholds to be met.
|
||||
// Quantum finality requires both BLS AND Corona thresholds to be met.
|
||||
func (q *Quasar) TryFinalize(ctx context.Context, blockID ids.ID) (*quasar.AggregatedSignature, bool, error) {
|
||||
q.mu.Lock()
|
||||
defer q.mu.Unlock()
|
||||
@@ -325,12 +325,12 @@ func (q *Quasar) TryFinalize(ctx context.Context, blockID ids.ID) (*quasar.Aggre
|
||||
}
|
||||
}
|
||||
|
||||
// Check Ringtail threshold
|
||||
if !pending.RingtailFinalized {
|
||||
// Check Corona threshold
|
||||
if !pending.CoronaFinalized {
|
||||
if len(pending.CoronaSignatures) >= q.threshold {
|
||||
// Ringtail finalized when threshold reached
|
||||
pending.RingtailFinalized = true
|
||||
q.log.Debug("Ringtail threshold reached",
|
||||
// Corona finalized when threshold reached
|
||||
pending.CoronaFinalized = true
|
||||
q.log.Debug("Corona threshold reached",
|
||||
"blockID", blockID,
|
||||
"count", len(pending.CoronaSignatures),
|
||||
)
|
||||
@@ -338,7 +338,7 @@ func (q *Quasar) TryFinalize(ctx context.Context, blockID ids.ID) (*quasar.Aggre
|
||||
}
|
||||
|
||||
// Both must be finalized for quantum finality
|
||||
if pending.BLSFinalized && pending.RingtailFinalized {
|
||||
if pending.BLSFinalized && pending.CoronaFinalized {
|
||||
pending.Finalized = true
|
||||
q.finalizedBlocks[blockID] = true
|
||||
|
||||
@@ -359,7 +359,7 @@ func (q *Quasar) TryFinalize(ctx context.Context, blockID ids.ID) (*quasar.Aggre
|
||||
q.log.Info("║ Block ID:", log.Stringer("blockID", blockID))
|
||||
q.log.Info("║ Height:", log.Uint64("height", pending.Height))
|
||||
q.log.Info("║ BLS Signatures:", log.Int("count", len(pending.BLSSignatures)))
|
||||
q.log.Info("║ Ringtail Signatures:", log.Int("count", len(pending.CoronaSignatures)))
|
||||
q.log.Info("║ Corona Signatures:", log.Int("count", len(pending.CoronaSignatures)))
|
||||
q.log.Info("║ Quantum Finality:", log.Bool("complete", true))
|
||||
q.log.Info("═══════════════════════════════════════════════════════════════════")
|
||||
|
||||
@@ -369,9 +369,9 @@ func (q *Quasar) TryFinalize(ctx context.Context, blockID ids.ID) (*quasar.Aggre
|
||||
q.log.Debug("Insufficient signatures for quantum finalization",
|
||||
"blockID", blockID,
|
||||
"blsHave", len(pending.BLSSignatures),
|
||||
"ringtailHave", len(pending.CoronaSignatures),
|
||||
"coronaHave", len(pending.CoronaSignatures),
|
||||
"blsFinalized", pending.BLSFinalized,
|
||||
"ringtailFinalized", pending.RingtailFinalized,
|
||||
"coronaFinalized", pending.CoronaFinalized,
|
||||
"need", q.threshold,
|
||||
)
|
||||
|
||||
@@ -428,21 +428,21 @@ func (q *Quasar) AddValidator(validatorID string, weight uint64) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// NTTForwardRingtail transforms Ringtail polynomial coefficients to NTT domain
|
||||
// NTTForwardCorona transforms Corona polynomial coefficients to NTT domain
|
||||
// using GPU acceleration when available. This enables O(n log n) polynomial
|
||||
// multiplication in the Ring-LWE scheme used by Ringtail threshold signatures.
|
||||
func (q *Quasar) NTTForwardRingtail(coefficients []uint64) ([]uint64, error) {
|
||||
// multiplication in the Ring-LWE scheme used by Corona threshold signatures.
|
||||
func (q *Quasar) NTTForwardCorona(coefficients []uint64) ([]uint64, error) {
|
||||
params := accellattice.NTTParams{
|
||||
N: 256, // Ring dimension for Ringtail (X^256 + 1)
|
||||
N: 256, // Ring dimension for Corona (X^256 + 1)
|
||||
Modulus: 8380417, // Dilithium prime q
|
||||
Root: 1753, // Primitive 256th root of unity mod q
|
||||
}
|
||||
return accellattice.NTTForward(params, coefficients)
|
||||
}
|
||||
|
||||
// NTTInverseRingtail transforms NTT-domain values back to coefficient form
|
||||
// NTTInverseCorona transforms NTT-domain values back to coefficient form
|
||||
// using GPU acceleration when available.
|
||||
func (q *Quasar) NTTInverseRingtail(evaluations []uint64) ([]uint64, error) {
|
||||
func (q *Quasar) NTTInverseCorona(evaluations []uint64) ([]uint64, error) {
|
||||
params := accellattice.NTTParams{
|
||||
N: 256,
|
||||
Modulus: 8380417,
|
||||
@@ -451,9 +451,9 @@ func (q *Quasar) NTTInverseRingtail(evaluations []uint64) ([]uint64, error) {
|
||||
return accellattice.NTTInverse(params, evaluations)
|
||||
}
|
||||
|
||||
// BatchNTTForwardRingtail transforms multiple polynomials in parallel on GPU.
|
||||
// Used when processing multiple Ringtail signature shares simultaneously.
|
||||
func (q *Quasar) BatchNTTForwardRingtail(polys [][]uint64) ([][]uint64, error) {
|
||||
// BatchNTTForwardCorona transforms multiple polynomials in parallel on GPU.
|
||||
// Used when processing multiple Corona signature shares simultaneously.
|
||||
func (q *Quasar) BatchNTTForwardCorona(polys [][]uint64) ([][]uint64, error) {
|
||||
params := accellattice.NTTParams{
|
||||
N: 256,
|
||||
Modulus: 8380417,
|
||||
@@ -482,7 +482,7 @@ func (q *Quasar) Cleanup(minHeight uint64) {
|
||||
}
|
||||
|
||||
// QuasarBridge is an alias for Quasar - the hybrid P/Q consensus bridge
|
||||
// that connects P-Chain BLS + Q-Chain Ringtail for dual signature finality
|
||||
// that connects P-Chain BLS + Q-Chain Corona for dual signature finality
|
||||
type QuasarBridge = Quasar
|
||||
|
||||
// QuasarBridgeConfig is an alias for QuasarConfig
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
// Copyright (C) 2019-2025, Lux Industries Inc. All rights reserved.
|
||||
// See the file LICENSE for licensing terms.
|
||||
//
|
||||
// Q-Chain Ringtail witness producer for Quasar parallel-witness finality
|
||||
// Q-Chain Corona witness producer for Quasar parallel-witness finality
|
||||
// (LP-020 §2 Consensus Modes, witness set bit WitnessQ).
|
||||
//
|
||||
// The Q-Chain VM is the parallel finality witness for the Q lane. Each
|
||||
// consensus round, the Quasar driver pushes a 32-byte round digest to this
|
||||
// adapter; the adapter drives the underlying Ringtail 2-round threshold
|
||||
// adapter; the adapter drives the underlying Corona 2-round threshold
|
||||
// ceremony (Module-LWE, eprint 2024/1113) and returns the resulting
|
||||
// threshold signature as the round's Q-witness.
|
||||
//
|
||||
@@ -26,7 +26,7 @@ import (
|
||||
// QWitnessAdapter adapts the Q-Chain Quasar engine to the consensus
|
||||
// QWitnessProducer interface used by the Quasar round driver.
|
||||
//
|
||||
// TODO(pqz): wire to a real per-round Ringtail ceremony driver. The current
|
||||
// TODO(pqz): wire to a real per-round Corona ceremony driver. The current
|
||||
// quantumvm.Quasar engine signs per-block by validator id; a per-consensus-
|
||||
// round driver is required to land a true Q-witness. See LP-020 §9
|
||||
// Implementation, "Three-lane signing".
|
||||
@@ -42,11 +42,11 @@ func NewQWitnessAdapter(engine *Quasar) *QWitnessAdapter {
|
||||
}
|
||||
|
||||
// ErrQWitnessNotWired is returned by QWitnessAdapter.Witness until the
|
||||
// per-round Ringtail driver lands. The interface is in place so the
|
||||
// per-round Corona driver lands. The interface is in place so the
|
||||
// consensus driver can be configured today.
|
||||
var ErrQWitnessNotWired = errors.New("Q-Chain per-round Ringtail driver not wired (TODO LP-020 §9)")
|
||||
var ErrQWitnessNotWired = errors.New("Q-Chain per-round Corona driver not wired (TODO LP-020 §9)")
|
||||
|
||||
// Witness produces a Ringtail threshold signature over the round digest.
|
||||
// Witness produces a Corona threshold signature over the round digest.
|
||||
// Signature matches consensus/protocol/quasar.QWitnessProducer.
|
||||
//
|
||||
// Returns ErrQWitnessNotWired today; the round driver treats this as the
|
||||
@@ -58,9 +58,9 @@ func (a *QWitnessAdapter) Witness(ctx context.Context, digest [32]byte) ([]byte,
|
||||
if a.engine == nil {
|
||||
return nil, ErrQWitnessNotWired
|
||||
}
|
||||
// Eventual implementation: drive a Ringtail 2-round threshold ceremony
|
||||
// (a.engine.SignBlock + AddRingtailSignature loop with consensus peers,
|
||||
// then TryFinalize) and return the aggregated Ringtail bytes from the
|
||||
// Eventual implementation: drive a Corona 2-round threshold ceremony
|
||||
// (a.engine.SignBlock + AddCoronaSignature loop with consensus peers,
|
||||
// then TryFinalize) and return the aggregated Corona bytes from the
|
||||
// resulting AggregatedSignature.
|
||||
_ = ctx
|
||||
_ = digest
|
||||
|
||||
+16
-16
@@ -69,25 +69,25 @@ func (s *Service) GetBlock(r *http.Request, args *GetBlockArgs, reply *GetBlockR
|
||||
return nil
|
||||
}
|
||||
|
||||
// GenerateRingtailKeyArgs are the arguments for GenerateRingtailKey
|
||||
type GenerateRingtailKeyArgs struct{}
|
||||
// GenerateCoronaKeyArgs are the arguments for GenerateCoronaKey
|
||||
type GenerateCoronaKeyArgs struct{}
|
||||
|
||||
// GenerateRingtailKeyReply is the reply for GenerateRingtailKey
|
||||
type GenerateRingtailKeyReply struct {
|
||||
// GenerateCoronaKeyReply is the reply for GenerateCoronaKey
|
||||
type GenerateCoronaKeyReply struct {
|
||||
PublicKey string `json:"publicKey"`
|
||||
Version uint32 `json:"version"`
|
||||
KeySize int `json:"keySize"`
|
||||
}
|
||||
|
||||
// GenerateRingtailKey generates a new Ringtail key pair
|
||||
func (s *Service) GenerateRingtailKey(r *http.Request, args *GenerateRingtailKeyArgs, reply *GenerateRingtailKeyReply) error {
|
||||
if !s.vm.Config.RingtailEnabled {
|
||||
return errors.New("ringtail keys are not enabled")
|
||||
// GenerateCoronaKey generates a new Corona key pair
|
||||
func (s *Service) GenerateCoronaKey(r *http.Request, args *GenerateCoronaKeyArgs, reply *GenerateCoronaKeyReply) error {
|
||||
if !s.vm.Config.CoronaEnabled {
|
||||
return errors.New("corona keys are not enabled")
|
||||
}
|
||||
|
||||
key, err := s.vm.quantumSigner.GenerateRingtailKey()
|
||||
key, err := s.vm.quantumSigner.GenerateCoronaKey()
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to generate ringtail key: %w", err)
|
||||
return fmt.Errorf("failed to generate corona key: %w", err)
|
||||
}
|
||||
|
||||
reply.PublicKey = fmt.Sprintf("%x", key.PublicKey)
|
||||
@@ -197,7 +197,7 @@ type GetHealthReply struct {
|
||||
Healthy bool `json:"healthy"`
|
||||
Version string `json:"version"`
|
||||
QuantumEnabled bool `json:"quantumEnabled"`
|
||||
RingtailEnabled bool `json:"ringtailEnabled"`
|
||||
CoronaEnabled bool `json:"coronaEnabled"`
|
||||
PendingTxCount int `json:"pendingTxCount"`
|
||||
ParallelWorkers int `json:"parallelWorkers"`
|
||||
}
|
||||
@@ -212,7 +212,7 @@ func (s *Service) GetHealth(r *http.Request, args *GetHealthArgs, reply *GetHeal
|
||||
reply.Healthy = health.Healthy
|
||||
reply.Version = health.Details["version"]
|
||||
reply.QuantumEnabled = s.vm.Config.QuantumStampEnabled
|
||||
reply.RingtailEnabled = s.vm.Config.RingtailEnabled
|
||||
reply.CoronaEnabled = s.vm.Config.CoronaEnabled
|
||||
reply.PendingTxCount = s.vm.txPool.PendingCount()
|
||||
reply.ParallelWorkers = s.vm.parallelWorkers
|
||||
|
||||
@@ -229,9 +229,9 @@ type GetConfigReply struct {
|
||||
QuantumVerificationFee uint64 `json:"quantumVerificationFee"`
|
||||
MaxParallelTxs int `json:"maxParallelTxs"`
|
||||
QuantumAlgorithmVersion uint32 `json:"quantumAlgorithmVersion"`
|
||||
RingtailKeySize int `json:"ringtailKeySize"`
|
||||
CoronaKeySize int `json:"coronaKeySize"`
|
||||
QuantumStampEnabled bool `json:"quantumStampEnabled"`
|
||||
RingtailEnabled bool `json:"ringtailEnabled"`
|
||||
CoronaEnabled bool `json:"coronaEnabled"`
|
||||
ParallelBatchSize int `json:"parallelBatchSize"`
|
||||
}
|
||||
|
||||
@@ -242,9 +242,9 @@ func (s *Service) GetConfig(r *http.Request, args *GetConfigArgs, reply *GetConf
|
||||
reply.QuantumVerificationFee = s.vm.Config.QuantumVerificationFee
|
||||
reply.MaxParallelTxs = s.vm.Config.MaxParallelTxs
|
||||
reply.QuantumAlgorithmVersion = s.vm.Config.QuantumAlgorithmVersion
|
||||
reply.RingtailKeySize = s.vm.Config.RingtailKeySize
|
||||
reply.CoronaKeySize = s.vm.Config.CoronaKeySize
|
||||
reply.QuantumStampEnabled = s.vm.Config.QuantumStampEnabled
|
||||
reply.RingtailEnabled = s.vm.Config.RingtailEnabled
|
||||
reply.CoronaEnabled = s.vm.Config.CoronaEnabled
|
||||
reply.ParallelBatchSize = s.vm.Config.ParallelBatchSize
|
||||
|
||||
return nil
|
||||
|
||||
@@ -141,7 +141,7 @@ func NewQuantumStamper(log log.Logger, mode QuantumStampMode, cacheSize int) (*Q
|
||||
return nil, fmt.Errorf("failed to initialize signers: %w", err)
|
||||
}
|
||||
|
||||
// Initialize Ringtail quantum signer for additional security
|
||||
// Initialize Corona quantum signer for additional security
|
||||
qs.quantumSigner = quantum.NewQuantumSigner(log, 1, 256, 5*time.Minute, cacheSize)
|
||||
|
||||
// Start worker goroutines
|
||||
|
||||
+16
-16
@@ -82,8 +82,8 @@ type VM struct {
|
||||
quantumSigner *quantum.QuantumSigner
|
||||
quantumCache *cache.LRU[ids.ID, *quantum.QuantumSignature]
|
||||
|
||||
// Hybrid P/Q consensus bridge (connects P-Chain BLS + Q-Chain Ringtail)
|
||||
// Uses Quasar consensus for dual BLS+Ringtail threshold signatures
|
||||
// Hybrid P/Q consensus bridge (connects P-Chain BLS + Q-Chain Corona)
|
||||
// Uses Quasar consensus for dual BLS+Corona threshold signatures
|
||||
quasarBridge *QuasarBridge
|
||||
|
||||
// Consensus and validation
|
||||
@@ -147,7 +147,7 @@ func (vm *VM) Initialize(ctx context.Context, init luxvm.Init) error {
|
||||
vm.quantumSigner = quantum.NewQuantumSigner(
|
||||
vm.log,
|
||||
vm.Config.QuantumAlgorithmVersion,
|
||||
vm.Config.RingtailKeySize,
|
||||
vm.Config.CoronaKeySize,
|
||||
vm.Config.QuantumStampWindow,
|
||||
vm.Config.QuantumSigCacheSize,
|
||||
)
|
||||
@@ -194,7 +194,7 @@ func (vm *VM) Initialize(ctx context.Context, init luxvm.Init) error {
|
||||
return fmt.Errorf("failed to initialize HTTP handlers: %w", err)
|
||||
}
|
||||
|
||||
// Initialize Quasar hybrid consensus bridge (BLS + Ringtail)
|
||||
// Initialize Quasar hybrid consensus bridge (BLS + Corona)
|
||||
quasarCfg := QuasarBridgeConfig{
|
||||
ValidatorID: vm.blockchainID.String(),
|
||||
Threshold: 0, // Will be set to 2/3+1 based on total nodes
|
||||
@@ -211,9 +211,9 @@ func (vm *VM) Initialize(ctx context.Context, init luxvm.Init) error {
|
||||
vm.log.Info("║ QVM INITIALIZED with Quasar PQ-BFT Consensus ║")
|
||||
vm.log.Info("───────────────────────────────────────────────────────────────────")
|
||||
vm.log.Info("║ Quantum Signatures: ML-DSA (NIST PQC)", log.Bool("enabled", vm.Config.QuantumStampEnabled))
|
||||
vm.log.Info("║ Ringtail Threshold: Ring-LWE PQ", log.Bool("enabled", vm.Config.RingtailEnabled))
|
||||
vm.log.Info("║ Corona Threshold: Ring-LWE PQ", log.Bool("enabled", vm.Config.CoronaEnabled))
|
||||
vm.log.Info("║ BLS Threshold: Classical fast path", log.Bool("enabled", true))
|
||||
vm.log.Info("║ Quasar Hybrid: BLS + Ringtail dual signing", log.Bool("enabled", true))
|
||||
vm.log.Info("║ Quasar Hybrid: BLS + Corona dual signing", log.Bool("enabled", true))
|
||||
vm.log.Info("║ Parallel TX Processing:", log.Int("maxParallel", vm.Config.MaxParallelTxs))
|
||||
vm.log.Info("═══════════════════════════════════════════════════════════════════")
|
||||
|
||||
@@ -413,7 +413,7 @@ func (vm *VM) signBlockWithQuantum(block *Block) error {
|
||||
ctx := context.Background()
|
||||
blockData := block.Bytes()
|
||||
|
||||
// Use Quasar bridge for dual BLS+Ringtail threshold signing
|
||||
// Use Quasar bridge for dual BLS+Corona threshold signing
|
||||
if vm.quasarBridge != nil {
|
||||
_, err := vm.quasarBridge.SignBlock(ctx, block.ID(), blockData, block.Height())
|
||||
if err != nil {
|
||||
@@ -427,9 +427,9 @@ func (vm *VM) signBlockWithQuantum(block *Block) error {
|
||||
}
|
||||
|
||||
// Also sign with ML-DSA for quantum resistance (standalone signature)
|
||||
key, err := vm.quantumSigner.GenerateRingtailKey()
|
||||
key, err := vm.quantumSigner.GenerateCoronaKey()
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to generate ringtail key: %w", err)
|
||||
return fmt.Errorf("failed to generate corona key: %w", err)
|
||||
}
|
||||
|
||||
sig, err := vm.quantumSigner.Sign(blockData, key)
|
||||
@@ -560,7 +560,7 @@ func (vm *VM) HealthCheck(ctx context.Context) (chain.HealthResult, error) {
|
||||
Details: map[string]string{
|
||||
"version": Version,
|
||||
"quantumEnabled": fmt.Sprintf("%v", vm.Config.QuantumStampEnabled),
|
||||
"ringtailEnabled": fmt.Sprintf("%v", vm.Config.RingtailEnabled),
|
||||
"coronaEnabled": fmt.Sprintf("%v", vm.Config.CoronaEnabled),
|
||||
"pendingTxs": fmt.Sprintf("%d", vm.txPool.PendingCount()),
|
||||
},
|
||||
}, nil
|
||||
@@ -596,7 +596,7 @@ func (vm *VM) NewHTTPHandler(ctx context.Context) (http.Handler, error) {
|
||||
}
|
||||
|
||||
// SetPreference sets the preferred block. Implements chain.ChainVM.
|
||||
// Q-Chain uses BLS+Ringtail threshold finality rather than preference,
|
||||
// Q-Chain uses BLS+Corona threshold finality rather than preference,
|
||||
// so this is a no-op until preference-based fork choice is wired in.
|
||||
func (vm *VM) SetPreference(ctx context.Context, blockID ids.ID) error {
|
||||
return nil
|
||||
@@ -633,7 +633,7 @@ func (vm *VM) GetEngine() consensusdag.Engine {
|
||||
}
|
||||
|
||||
// GetQuasarBridge returns the Quasar hybrid consensus bridge
|
||||
// This provides BLS + Ringtail dual threshold signatures for PQ finality
|
||||
// This provides BLS + Corona dual threshold signatures for PQ finality
|
||||
func (vm *VM) GetQuasarBridge() *QuasarBridge {
|
||||
vm.lock.RLock()
|
||||
defer vm.lock.RUnlock()
|
||||
@@ -641,7 +641,7 @@ func (vm *VM) GetQuasarBridge() *QuasarBridge {
|
||||
}
|
||||
|
||||
// GetHybridBridge returns the hybrid finality bridge for P/Q chain consensus
|
||||
// This connects P-Chain BLS signatures with Q-Chain Ringtail for quantum finality
|
||||
// This connects P-Chain BLS signatures with Q-Chain Corona for quantum finality
|
||||
// Deprecated: Use GetQuasarBridge() for proper type safety
|
||||
func (vm *VM) GetHybridBridge() interface{} {
|
||||
return vm.GetQuasarBridge()
|
||||
@@ -658,7 +658,7 @@ func (vm *VM) SetHybridBridge(bridge interface{}) {
|
||||
}
|
||||
|
||||
// StampBlock implements QChainStamper interface for hybrid finality
|
||||
// Uses Quasar BLS+Ringtail for dual post-quantum threshold signatures
|
||||
// Uses Quasar BLS+Corona for dual post-quantum threshold signatures
|
||||
func (vm *VM) StampBlock(blockID interface{}, pChainHeight uint64, message []byte) (interface{}, error) {
|
||||
vm.lock.RLock()
|
||||
defer vm.lock.RUnlock()
|
||||
@@ -694,7 +694,7 @@ func (vm *VM) StampBlock(blockID interface{}, pChainHeight uint64, message []byt
|
||||
}
|
||||
|
||||
// Fallback: Generate quantum stamp using ML-DSA signer
|
||||
key, err := vm.quantumSigner.GenerateRingtailKey()
|
||||
key, err := vm.quantumSigner.GenerateCoronaKey()
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to generate key for stamp: %w", err)
|
||||
}
|
||||
@@ -717,7 +717,7 @@ func (vm *VM) StampBlock(blockID interface{}, pChainHeight uint64, message []byt
|
||||
func (vm *VM) VerifyStamp(stamp interface{}) error {
|
||||
switch s := stamp.(type) {
|
||||
case *quasar.QuasarSignature:
|
||||
// Quasar BLS + Ringtail threshold signature
|
||||
// Quasar BLS + Corona threshold signature
|
||||
if s.BLS == nil || len(s.BLS.Signature) == 0 {
|
||||
return errors.New("invalid Quasar BLS signature")
|
||||
}
|
||||
|
||||
+10
-10
@@ -50,8 +50,8 @@ func TestQuantumSigner(t *testing.T) {
|
||||
)
|
||||
require.NotNil(signer)
|
||||
|
||||
// Generate Ringtail key (now using real ML-DSA)
|
||||
key, err := signer.GenerateRingtailKey()
|
||||
// Generate Corona key (now using real ML-DSA)
|
||||
key, err := signer.GenerateCoronaKey()
|
||||
require.NoError(err)
|
||||
require.NotNil(key)
|
||||
// ML-DSA-44 key sizes: public=1312, private=2560
|
||||
@@ -93,7 +93,7 @@ func TestParallelVerification(t *testing.T) {
|
||||
signatures := make([]*quantum.QuantumSignature, numSigs)
|
||||
|
||||
for i := 0; i < numSigs; i++ {
|
||||
key, err := signer.GenerateRingtailKey()
|
||||
key, err := signer.GenerateCoronaKey()
|
||||
require.NoError(err)
|
||||
|
||||
message := []byte(string(rune('a'+i)) + " test message")
|
||||
@@ -125,7 +125,7 @@ func TestConfigValidation(t *testing.T) {
|
||||
cfg.MaxParallelTxs = -1
|
||||
cfg.ParallelBatchSize = 0
|
||||
cfg.QuantumSigCacheSize = -100
|
||||
cfg.RingtailKeySize = 256
|
||||
cfg.CoronaKeySize = 256
|
||||
|
||||
require.NoError(cfg.Validate())
|
||||
|
||||
@@ -133,7 +133,7 @@ func TestConfigValidation(t *testing.T) {
|
||||
require.Greater(cfg.MaxParallelTxs, 0)
|
||||
require.Greater(cfg.ParallelBatchSize, 0)
|
||||
require.Greater(cfg.QuantumSigCacheSize, 0)
|
||||
require.GreaterOrEqual(cfg.RingtailKeySize, 1024)
|
||||
require.GreaterOrEqual(cfg.CoronaKeySize, 1024)
|
||||
}
|
||||
|
||||
func TestGPUBatchVerifyFallback(t *testing.T) {
|
||||
@@ -155,7 +155,7 @@ func TestGPUBatchVerifyFallback(t *testing.T) {
|
||||
signatures := make([]*quantum.QuantumSignature, numSigs)
|
||||
|
||||
for i := 0; i < numSigs; i++ {
|
||||
key, err := signer.GenerateRingtailKey()
|
||||
key, err := signer.GenerateCoronaKey()
|
||||
require.NoError(err)
|
||||
|
||||
message := []byte(fmt.Sprintf("batch test message %d", i))
|
||||
@@ -198,7 +198,7 @@ func TestQuasarNTTMethods(t *testing.T) {
|
||||
}
|
||||
|
||||
// Forward NTT should produce 256-element output
|
||||
nttDomain, err := q.NTTForwardRingtail(coeffs)
|
||||
nttDomain, err := q.NTTForwardCorona(coeffs)
|
||||
require.NoError(err)
|
||||
require.Len(nttDomain, 256)
|
||||
|
||||
@@ -213,13 +213,13 @@ func TestQuasarNTTMethods(t *testing.T) {
|
||||
require.True(differ, "NTT output should differ from input")
|
||||
|
||||
// Inverse NTT should produce valid output
|
||||
recovered, err := q.NTTInverseRingtail(nttDomain)
|
||||
recovered, err := q.NTTInverseCorona(nttDomain)
|
||||
require.NoError(err)
|
||||
require.Len(recovered, 256)
|
||||
|
||||
// Batch NTT should handle multiple polynomials
|
||||
polys := [][]uint64{coeffs, nttDomain}
|
||||
batchResult, err := q.BatchNTTForwardRingtail(polys)
|
||||
batchResult, err := q.BatchNTTForwardCorona(polys)
|
||||
require.NoError(err)
|
||||
require.Len(batchResult, 2)
|
||||
}
|
||||
@@ -253,7 +253,7 @@ func TestQuantumStampExpiration(t *testing.T) {
|
||||
)
|
||||
|
||||
// Generate key and sign message
|
||||
key, err := signer.GenerateRingtailKey()
|
||||
key, err := signer.GenerateCoronaKey()
|
||||
require.NoError(err)
|
||||
|
||||
message := []byte("test message")
|
||||
|
||||
@@ -47,7 +47,7 @@ func TestRegister_MChainOwnedLanes(t *testing.T) {
|
||||
for _, lane := range []types.CertLane{
|
||||
types.LaneMChainCGGMP21,
|
||||
types.LaneMChainFROST,
|
||||
types.LaneMChainRingtailGen,
|
||||
types.LaneMChainCoronaGen,
|
||||
} {
|
||||
if err := r.Register(stubVerifier{lane: lane}); err != nil {
|
||||
t.Fatalf("register %d: %v", lane, err)
|
||||
@@ -56,7 +56,7 @@ func TestRegister_MChainOwnedLanes(t *testing.T) {
|
||||
for _, lane := range []types.CertLane{
|
||||
types.LaneMChainCGGMP21,
|
||||
types.LaneMChainFROST,
|
||||
types.LaneMChainRingtailGen,
|
||||
types.LaneMChainCoronaGen,
|
||||
} {
|
||||
if _, err := r.Verifier(lane); err != nil {
|
||||
t.Fatalf("lookup %d: %v", lane, err)
|
||||
|
||||
@@ -110,7 +110,7 @@ func (c *Client) call(ctx context.Context, method string, params interface{}, re
|
||||
// KeygenRequest contains parameters for key generation
|
||||
type KeygenRequest struct {
|
||||
KeyID string `json:"keyId"`
|
||||
Protocol string `json:"protocol"` // lss, cggmp21, bls, ringtail
|
||||
Protocol string `json:"protocol"` // lss, cggmp21, bls, corona
|
||||
Threshold int `json:"threshold"` // Optional
|
||||
TotalParties int `json:"totalParties"` // Optional
|
||||
}
|
||||
|
||||
+8
-8
@@ -1,17 +1,17 @@
|
||||
// Copyright (C) 2019-2025, Lux Industries Inc. All rights reserved.
|
||||
// See the file LICENSE for licensing terms.
|
||||
|
||||
// Package ringtail_general declares the M-Chain general-purpose
|
||||
// Ringtail (Ring-LWE) threshold protocol surface.
|
||||
// Package corona_general declares the M-Chain general-purpose
|
||||
// Corona (Ring-LWE) threshold protocol surface.
|
||||
//
|
||||
// This is **not** consensus-Ringtail. Consensus uses Ringtail at
|
||||
// This is **not** consensus-Corona. Consensus uses Corona at
|
||||
// fixed parameters as the post-quantum cert lane (Q-Chain runs that
|
||||
// ceremony, see LP-073). General-purpose Ringtail is for app-level
|
||||
// ceremony, see LP-073). General-purpose Corona is for app-level
|
||||
// threshold signing under a different parameter set; it lives on
|
||||
// M-Chain.
|
||||
//
|
||||
// Interface-only; implementation in chains/mchain/protocol/ringtail/.
|
||||
package ringtail_general
|
||||
// Interface-only; implementation in chains/mchain/protocol/corona/.
|
||||
package corona_general
|
||||
|
||||
import (
|
||||
"context"
|
||||
@@ -19,8 +19,8 @@ import (
|
||||
"github.com/luxfi/chains/thresholdvm/types"
|
||||
)
|
||||
|
||||
// Verifier validates Ringtail-general share payloads. Registered as
|
||||
// the LaneMChainRingtailGen verifier in the M-Chain LaneRegistry.
|
||||
// Verifier validates Corona-general share payloads. Registered as
|
||||
// the LaneMChainCoronaGen verifier in the M-Chain LaneRegistry.
|
||||
type Verifier interface {
|
||||
VerifyShare(subject [32]byte, share types.Share, payload []byte) error
|
||||
VerifyFinal(subject [32]byte, proof types.Proof) error
|
||||
@@ -19,7 +19,7 @@ import (
|
||||
"github.com/luxfi/threshold/protocols/cmp"
|
||||
"github.com/luxfi/threshold/protocols/frost"
|
||||
"github.com/luxfi/threshold/protocols/lss"
|
||||
"github.com/luxfi/threshold/protocols/ringtail"
|
||||
"github.com/luxfi/threshold/protocols/corona"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
@@ -849,12 +849,12 @@ func TestBLSThresholdWithDifferentSignerSets(t *testing.T) {
|
||||
}
|
||||
|
||||
// =============================================================================
|
||||
// Ringtail (Post-Quantum) Threshold Network Tests
|
||||
// Corona (Post-Quantum) Threshold Network Tests
|
||||
// =============================================================================
|
||||
|
||||
// TestRingtailSessionInit tests Ringtail session initialization
|
||||
// TestCoronaSessionInit tests Corona session initialization
|
||||
// This verifies the protocol can be started without requiring full MPC execution.
|
||||
func TestRingtailSessionInit(t *testing.T) {
|
||||
func TestCoronaSessionInit(t *testing.T) {
|
||||
require := require.New(t)
|
||||
|
||||
workerPool := pool.NewPool(4)
|
||||
@@ -865,7 +865,7 @@ func TestRingtailSessionInit(t *testing.T) {
|
||||
|
||||
// Verify keygen session can be created
|
||||
for _, id := range pIDs {
|
||||
startFunc := ringtail.Keygen(id, pIDs, threshold, workerPool)
|
||||
startFunc := corona.Keygen(id, pIDs, threshold, workerPool)
|
||||
require.NotNil(startFunc, "Keygen should return a function for %s", id)
|
||||
|
||||
session, err := startFunc([]byte("test-session"))
|
||||
@@ -875,7 +875,7 @@ func TestRingtailSessionInit(t *testing.T) {
|
||||
|
||||
// Verify sign session can be created with mock config
|
||||
for _, id := range pIDs {
|
||||
cfg := &ringtail.Config{
|
||||
cfg := &corona.Config{
|
||||
ID: id,
|
||||
Threshold: threshold,
|
||||
Participants: pIDs,
|
||||
@@ -884,13 +884,13 @@ func TestRingtailSessionInit(t *testing.T) {
|
||||
}
|
||||
|
||||
message := []byte("test message")
|
||||
signFunc := ringtail.SignWithConfig(cfg, pIDs[:threshold], message, workerPool)
|
||||
signFunc := corona.SignWithConfig(cfg, pIDs[:threshold], message, workerPool)
|
||||
require.NotNil(signFunc, "Sign should return a function for %s", id)
|
||||
}
|
||||
|
||||
// Verify refresh session can be created
|
||||
for _, id := range pIDs {
|
||||
cfg := &ringtail.Config{
|
||||
cfg := &corona.Config{
|
||||
ID: id,
|
||||
Threshold: threshold,
|
||||
Participants: pIDs,
|
||||
@@ -898,11 +898,11 @@ func TestRingtailSessionInit(t *testing.T) {
|
||||
PrivateShare: make([]byte, 32),
|
||||
}
|
||||
|
||||
refreshFunc := ringtail.Refresh(cfg, pIDs, threshold, workerPool)
|
||||
refreshFunc := corona.Refresh(cfg, pIDs, threshold, workerPool)
|
||||
require.NotNil(refreshFunc, "Refresh should return a function for %s", id)
|
||||
}
|
||||
|
||||
t.Log("Ringtail session initialization verified for keygen, sign, and refresh")
|
||||
t.Log("Corona session initialization verified for keygen, sign, and refresh")
|
||||
}
|
||||
|
||||
// =============================================================================
|
||||
|
||||
+22
-22
@@ -30,7 +30,7 @@ const (
|
||||
ProtocolBLS Protocol = "bls" // BLS threshold signatures
|
||||
|
||||
// Post-Quantum Threshold
|
||||
ProtocolRingtail Protocol = "ringtail" // Post-quantum lattice-based threshold
|
||||
ProtocolCorona Protocol = "corona" // Post-quantum lattice-based threshold
|
||||
|
||||
// Experimental
|
||||
ProtocolFrost Protocol = "frost" // FROST (Flexible Round-Optimized Schnorr Threshold)
|
||||
@@ -57,8 +57,8 @@ type ProtocolOptions struct {
|
||||
// BLS Options
|
||||
BLSScheme string `json:"blsScheme,omitempty"` // basic, min-pk, min-sig
|
||||
|
||||
// Ringtail Options
|
||||
RingtailSecurityLevel int `json:"ringtailSecurityLevel,omitempty"` // 128, 192, 256
|
||||
// Corona Options
|
||||
CoronaSecurityLevel int `json:"coronaSecurityLevel,omitempty"` // 128, 192, 256
|
||||
|
||||
// General Options
|
||||
TimeoutSeconds int `json:"timeoutSeconds,omitempty"`
|
||||
@@ -150,7 +150,7 @@ func NewProtocolRegistry(workerPool *pool.Pool) *ProtocolRegistry {
|
||||
reg.Register(&LSSHandler{pool: workerPool})
|
||||
reg.Register(&CGGMP21Handler{pool: workerPool})
|
||||
reg.Register(&BLSHandler{})
|
||||
reg.Register(&RingtailHandler{})
|
||||
reg.Register(&CoronaHandler{})
|
||||
|
||||
return reg
|
||||
}
|
||||
@@ -564,38 +564,38 @@ func (h *BLSHandler) Refresh(ctx context.Context, share KeyShare) (KeyShare, err
|
||||
}
|
||||
|
||||
// =============================================================================
|
||||
// Ringtail Handler (Post-Quantum)
|
||||
// Corona Handler (Post-Quantum)
|
||||
// =============================================================================
|
||||
|
||||
// RingtailHandler implements ProtocolHandler for post-quantum threshold signatures
|
||||
type RingtailHandler struct{}
|
||||
// CoronaHandler implements ProtocolHandler for post-quantum threshold signatures
|
||||
type CoronaHandler struct{}
|
||||
|
||||
func (h *RingtailHandler) Name() Protocol {
|
||||
return ProtocolRingtail
|
||||
func (h *CoronaHandler) Name() Protocol {
|
||||
return ProtocolCorona
|
||||
}
|
||||
|
||||
func (h *RingtailHandler) SupportedCurves() []string {
|
||||
func (h *CoronaHandler) SupportedCurves() []string {
|
||||
return []string{"lattice"}
|
||||
}
|
||||
|
||||
func (h *RingtailHandler) Keygen(ctx context.Context, partyID party.ID, partyIDs []party.ID, threshold int) (KeyShare, error) {
|
||||
return nil, errors.New("Ringtail keygen not yet implemented")
|
||||
func (h *CoronaHandler) Keygen(ctx context.Context, partyID party.ID, partyIDs []party.ID, threshold int) (KeyShare, error) {
|
||||
return nil, errors.New("Corona keygen not yet implemented")
|
||||
}
|
||||
|
||||
func (h *RingtailHandler) Sign(ctx context.Context, share KeyShare, message []byte, signers []party.ID) (Signature, error) {
|
||||
return nil, errors.New("Ringtail sign not yet implemented")
|
||||
func (h *CoronaHandler) Sign(ctx context.Context, share KeyShare, message []byte, signers []party.ID) (Signature, error) {
|
||||
return nil, errors.New("Corona sign not yet implemented")
|
||||
}
|
||||
|
||||
func (h *RingtailHandler) Verify(pubKey []byte, message []byte, signature Signature) (bool, error) {
|
||||
return false, errors.New("Ringtail verify not yet implemented")
|
||||
func (h *CoronaHandler) Verify(pubKey []byte, message []byte, signature Signature) (bool, error) {
|
||||
return false, errors.New("Corona verify not yet implemented")
|
||||
}
|
||||
|
||||
func (h *RingtailHandler) Reshare(ctx context.Context, share KeyShare, newPartyIDs []party.ID, newThreshold int) (KeyShare, error) {
|
||||
return nil, errors.New("Ringtail reshare not supported")
|
||||
func (h *CoronaHandler) Reshare(ctx context.Context, share KeyShare, newPartyIDs []party.ID, newThreshold int) (KeyShare, error) {
|
||||
return nil, errors.New("Corona reshare not supported")
|
||||
}
|
||||
|
||||
func (h *RingtailHandler) Refresh(ctx context.Context, share KeyShare) (KeyShare, error) {
|
||||
return nil, errors.New("Ringtail refresh not supported")
|
||||
func (h *CoronaHandler) Refresh(ctx context.Context, share KeyShare) (KeyShare, error) {
|
||||
return nil, errors.New("Corona refresh not supported")
|
||||
}
|
||||
|
||||
// =============================================================================
|
||||
@@ -638,8 +638,8 @@ func GetProtocolInfo() []ProtocolInfo {
|
||||
SupportsRefresh: false,
|
||||
},
|
||||
{
|
||||
Name: string(ProtocolRingtail),
|
||||
Description: "Ringtail - Post-quantum lattice-based threshold signatures",
|
||||
Name: string(ProtocolCorona),
|
||||
Description: "Corona - Post-quantum lattice-based threshold signatures",
|
||||
SupportedCurves: []string{"lattice"},
|
||||
KeySize: 2048, // Varies by security level
|
||||
SignatureSize: 2420, // Dilithium3 size
|
||||
|
||||
+1
-1
@@ -175,7 +175,7 @@ func (vm *VM) handleRPCMethod(method string, params json.RawMessage) (interface{
|
||||
// KeygenParams contains parameters for key generation
|
||||
type KeygenParams struct {
|
||||
KeyID string `json:"keyId"`
|
||||
Protocol string `json:"protocol"` // lss, cggmp21, bls, ringtail
|
||||
Protocol string `json:"protocol"` // lss, cggmp21, bls, corona
|
||||
RequestedBy string `json:"requestedBy"` // Chain ID
|
||||
Threshold int `json:"threshold"` // Optional override
|
||||
TotalParties int `json:"totalParties"` // Optional override
|
||||
|
||||
@@ -29,7 +29,7 @@ type MChainAdapter interface {
|
||||
|
||||
// Registry returns the M-Chain LaneRegistry. Must be owned by
|
||||
// OwnerMChain and have verifiers for LaneMChainCGGMP21,
|
||||
// LaneMChainFROST, LaneMChainRingtailGen registered.
|
||||
// LaneMChainFROST, LaneMChainCoronaGen registered.
|
||||
Registry() *cert.LaneRegistry
|
||||
|
||||
// CeremonyRoot returns mchain_ceremony_root at the current epoch.
|
||||
|
||||
@@ -57,7 +57,7 @@ const (
|
||||
KindUnknown CeremonyKind = 0
|
||||
KindCGGMP21 CeremonyKind = 1 // M-Chain: ECDSA threshold
|
||||
KindFROST CeremonyKind = 2 // M-Chain: Schnorr/EdDSA threshold
|
||||
KindRingtailGen CeremonyKind = 3 // M-Chain: PQ general-purpose threshold
|
||||
KindCoronaGen CeremonyKind = 3 // M-Chain: PQ general-purpose threshold
|
||||
KindTFHEKeygen CeremonyKind = 4 // M-Chain → F-Chain: TFHE bootstrap-key gen
|
||||
KindTFHECompute CeremonyKind = 5 // F-Chain: encrypted compute attestation
|
||||
KindTFHEBootstrap CeremonyKind = 6 // F-Chain: blind-rotate / bootstrap proof
|
||||
@@ -65,7 +65,7 @@ const (
|
||||
|
||||
// IsMChain reports whether the kind belongs to the M-Chain operational chain.
|
||||
func (k CeremonyKind) IsMChain() bool {
|
||||
return k == KindCGGMP21 || k == KindFROST || k == KindRingtailGen
|
||||
return k == KindCGGMP21 || k == KindFROST || k == KindCoronaGen
|
||||
}
|
||||
|
||||
// IsFChain reports whether the kind belongs to the F-Chain operational chain.
|
||||
|
||||
@@ -16,20 +16,20 @@ type CertLane uint8
|
||||
|
||||
const (
|
||||
LaneBLS CertLane = 0
|
||||
LaneRingtail CertLane = 1
|
||||
LaneCorona CertLane = 1
|
||||
LaneMLDSAGroth16 CertLane = 2
|
||||
LaneAChainAttest CertLane = 3
|
||||
LaneBChainBridge CertLane = 4
|
||||
LaneMChainCGGMP21 CertLane = 5
|
||||
LaneMChainFROST CertLane = 6
|
||||
LaneMChainRingtailGen CertLane = 7
|
||||
LaneMChainCoronaGen CertLane = 7
|
||||
LaneFChainTFHE CertLane = 8
|
||||
LaneFChainBootstrap CertLane = 9
|
||||
)
|
||||
|
||||
// IsMChain reports whether the lane is owned by M-Chain.
|
||||
func (l CertLane) IsMChain() bool {
|
||||
return l == LaneMChainCGGMP21 || l == LaneMChainFROST || l == LaneMChainRingtailGen
|
||||
return l == LaneMChainCGGMP21 || l == LaneMChainFROST || l == LaneMChainCoronaGen
|
||||
}
|
||||
|
||||
// IsFChain reports whether the lane is owned by F-Chain.
|
||||
|
||||
Reference in New Issue
Block a user