mirror of
https://github.com/luxfi/chains.git
synced 2026-09-24 00:26:00 +00:00
- Remove attestation blank import (no init/module registration, dead code) - Remove aes, chacha20, ecies (secret keys in calldata are public on-chain) - Update comments for hpke (seal only) and ring (verify only)
102 lines
5.7 KiB
Go
102 lines
5.7 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
|
|
|
|
// ── 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/corona" // 0x0200..0B Corona lattice 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
|
|
|
|
// ── Consensus (Quasar) ───────────────────────────────
|
|
_ "github.com/luxfi/precompile/quasar" // 0x0300..20-24 BLS + Verkle + Corona + Hybrid verify
|
|
|
|
// ── 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 ─────────────────────────────
|
|
// REMOVED: aes (0x9210), chacha20 (0x9211), ecies (0x9201)
|
|
// Secret keys in calldata are public on-chain. Use FHE for encrypted compute.
|
|
_ "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
|
|
|
|
// ── 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
|
|
|
|
// ── REMOVED (no init/module registration — dead imports) ──
|
|
// _ "github.com/luxfi/precompile/attestation" — library only, no module registration
|
|
// _ "github.com/luxfi/precompile/pqcrypto" — umbrella, use mldsa + mlkem + slhdsa
|
|
// _ "github.com/luxfi/precompile/quantum" — umbrella, use mldsa + mlkem + slhdsa + corona
|
|
// _ "github.com/luxfi/precompile/threshold" — umbrella, use cggmp21 + frost + corona
|
|
)
|
|
|
|
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)
|
|
}
|
|
|
|
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)
|
|
}
|
|
}
|