mirror of
https://github.com/luxfi/chains.git
synced 2026-09-24 00:26:00 +00:00
Continuation of eb0b44e (quantumvm consumer-side leak after consensus
repo migration) — the rename was incomplete; this pass closes it.
Identifier renames in chains/{quantumvm,thresholdvm,dexvm}:
- NTTForwardCorona / NTTInverseCorona / BatchNTTForwardCorona
→ NTTForward/Inverse/BatchNTTForwardCorona (Quasar GPU dispatch)
- LaneCorona (CertLane enum)
→ LaneCorona
- ProtocolCorona (Protocol enum)
→ ProtocolCorona (string value already "corona")
- All Corona-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/corona_general/corona.go
→ thresholdvm/protocol/corona_general/corona.go
package corona_general → package corona_general
evm/main.go: replace single `precompile/corona` 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/corona).
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
109 lines
6.1 KiB
Go
109 lines
6.1 KiB
Go
// Lux EVM plugin — C-Chain EVM with all precompiles enabled.
|
|
//
|
|
// Every precompile is explicitly imported. No umbrella packages.
|
|
// Genesis determines which are active at which block/timestamp.
|
|
package main
|
|
|
|
import (
|
|
"context"
|
|
"fmt"
|
|
"os"
|
|
|
|
"github.com/luxfi/evm/plugin/evm"
|
|
"github.com/luxfi/log"
|
|
"github.com/luxfi/sys/ulimit"
|
|
"github.com/luxfi/version"
|
|
"github.com/luxfi/vm/rpc"
|
|
|
|
// ── Curves ───────────────────────────────────────────
|
|
_ "github.com/luxfi/precompile/bls12381" // 0x000B-0x0011 BLS12-381 (EIP-2537)
|
|
_ "github.com/luxfi/precompile/ed25519" // 0x3211 Ed25519 verify
|
|
_ "github.com/luxfi/precompile/secp256r1" // 0x0100 P-256 verify (EIP-7212)
|
|
_ "github.com/luxfi/precompile/sr25519" // 0x0A00 Substrate SR25519 verify
|
|
|
|
// ── VRF ──────────────────────────────────────────────
|
|
_ "github.com/luxfi/precompile/vrf" // 0x3213 ECVRF verify (RFC 9381)
|
|
|
|
// ── 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)
|
|
_ "github.com/luxfi/precompile/blake3" // 0x0500..04 Blake3 hash
|
|
_ "github.com/luxfi/precompile/pasta" // 0x0500..08 Pallas + Vesta (Halo2)
|
|
_ "github.com/luxfi/precompile/pedersen" // 0x0500..06 Pedersen commitment (BN254)
|
|
_ "github.com/luxfi/precompile/poseidon" // 0x0500..05 Poseidon2 ZK-friendly hash
|
|
|
|
// ── Threshold Signatures ─────────────────────────────
|
|
_ "github.com/luxfi/precompile/cggmp21" // 0x0800..03 CGGMP21 ECDSA threshold
|
|
_ "github.com/luxfi/precompile/frost" // 0x0800..02 FROST EdDSA threshold
|
|
|
|
// ── AI ────────────────────────────────────────────────
|
|
_ "github.com/luxfi/precompile/ai" // 0x0300 AI mining / inference
|
|
_ "github.com/luxfi/precompile/attestation" // 0x0300..01 TEE attestation (NVTrust/SGX/SEV-SNP/TDX)
|
|
_ "github.com/luxfi/precompile/compute" // 0x0300..10 AI compute marketplace
|
|
|
|
// Pre-LP-4200 quasar precompiles retired — they shipped a forgeable
|
|
// Verkle stub (any (commitment, proof) with first-17-byte match
|
|
// returned 1). The canonical PQ verifiers live in the LP-4200
|
|
// 0x012200 block: ML-KEM/ML-DSA/SLH-DSA/Pulsar/P3Q/Corona.
|
|
|
|
// ── Bridge ───────────────────────────────────────────
|
|
_ "github.com/luxfi/precompile/bridge" // 0x0440-0443 Gateway + Router + Verifier + Liquidity
|
|
|
|
// ── FHE ──────────────────────────────────────────────
|
|
_ "github.com/luxfi/precompile/fhe" // 0x0700 Fully homomorphic encryption
|
|
|
|
// ── ZK Proofs ────────────────────────────────────────
|
|
_ "github.com/luxfi/precompile/zk" // 0x0900 Groth16 + PLONK + fflonk + Halo2
|
|
|
|
// ── Encryption / Privacy ─────────────────────────────
|
|
_ "github.com/luxfi/precompile/curve25519" // 0x9204 Edwards25519 point ops
|
|
_ "github.com/luxfi/precompile/hpke" // 0x9200 HPKE seal (public-key encrypt only)
|
|
_ "github.com/luxfi/precompile/ring" // 0x9202 Ring signature verify only
|
|
_ "github.com/luxfi/precompile/x25519" // 0x9203 X25519 Diffie-Hellman
|
|
|
|
// ── DEX (LX Suite 0x9010-0x9080) ─────────────────────
|
|
_ "github.com/luxfi/precompile/dex" // Pool + Oracle + Router + Hooks + Flash + Book + Vault + Price + Lend + Repayer + Liquidator + Transmuter
|
|
_ "github.com/luxfi/precompile/stableswap" // 0x0400..60 Curve StableSwap AMM invariant
|
|
|
|
// ── Graph ────────────────────────────────────────────
|
|
_ "github.com/luxfi/precompile/graph" // 0x0500 On-chain GraphQL
|
|
|
|
// ── Blob ─────────────────────────────────────────────
|
|
_ "github.com/luxfi/precompile/kzg4844" // 0xB002 EIP-4844 KZG commitments
|
|
|
|
// ── Registry ─────────────────────────────────────────
|
|
_ "github.com/luxfi/precompile/registry" // Precompile registry + BLS12-381 curves
|
|
)
|
|
|
|
func main() {
|
|
versionStr := fmt.Sprintf("Lux-EVM/1.0.0 [node=%s, rpcchainvm=%d]", version.Current, version.RPCChainVMProtocol)
|
|
|
|
if len(os.Args) > 1 && os.Args[1] == "version" {
|
|
fmt.Println(versionStr)
|
|
os.Exit(0)
|
|
}
|
|
|
|
if err := ulimit.Set(ulimit.DefaultFDLimit, log.Root()); err != nil {
|
|
fmt.Fprintf(os.Stderr, "failed to set fd limit: %s\n", err)
|
|
os.Exit(1)
|
|
}
|
|
|
|
// Resolve the execution backend before serving. With cgo this links
|
|
// luxcpp/cevm and selects AutoEVM (CppEVM when luxfi/evm is built
|
|
// with -tags cevm; GoEVM otherwise). Without cgo this stays on GoEVM.
|
|
selectExecutionBackend(log.Root())
|
|
|
|
if err := rpc.Serve(context.Background(), log.Root(), &evm.VM{}); err != nil {
|
|
fmt.Fprintf(os.Stderr, "rpc.Serve error: %s\n", err)
|
|
os.Exit(1)
|
|
}
|
|
}
|