mirror of
https://github.com/luxfi/precompile.git
synced 2026-07-27 03:33:45 +00:00
precompile: PQ canonical terminology (FIPS 203/204/205 + Pulsar + Lamport)
This commit is contained in:
@@ -182,7 +182,7 @@ Example hook implementations:
|
||||
|
||||
> **Canonical (LP-4200)**: the unified PQCrypto precompile block at
|
||||
> `0x012201..0x012204` is authoritative — ML-KEM `0x012201`, ML-DSA
|
||||
> `0x012202`, SLH-DSA `0x012203`, Corona `0x012204`. The `0x0600`
|
||||
> `0x012202`, SLH-DSA `0x012203`, Pulsar `0x012204`. The `0x0600`
|
||||
> (Post-Quantum) and `0x0800` (Threshold) ranges below are the legacy
|
||||
> per-VM mapping; new code MUST target the unified block. See
|
||||
> `~/work/lux/evm/LLM.md` for the canonical per-feature address table.
|
||||
@@ -241,7 +241,7 @@ Example hook implementations:
|
||||
#### Post-Quantum Crypto (0x0600-0x06FF)
|
||||
| Address | Name | Package | Description | Gas |
|
||||
|---------|------|---------|-------------|-----|
|
||||
| 0x0600 | ML_DSA | mldsa/ | NIST ML-DSA signatures (Dilithium) | 50,000 |
|
||||
| 0x0600 | ML_DSA | mldsa/ | NIST ML-DSA signatures (ML-DSA) | 50,000 |
|
||||
| 0x0601 | ML_KEM | mlkem/ | NIST ML-KEM key encapsulation | 25,000 |
|
||||
| 0x0602 | SLH_DSA | slhdsa/ | Stateless hash-based signatures | 75,000 |
|
||||
| 0x0603 | PQ_CRYPTO | pqcrypto/ | Multi-PQ operations | 30,000 |
|
||||
@@ -288,7 +288,7 @@ Example hook implementations:
|
||||
| **Z-Chain (Zoo)** | Warp, PoolManager, SwapRouter, AIMining, GraphQL |
|
||||
| **D-Chain (DEX)** | Warp, Full DEX suite, GraphQL |
|
||||
| **K-Chain (Keys)** | Warp, PQ Crypto, Privacy, Threshold, GraphQL |
|
||||
| **Q-Chain (Quantum)** | Warp, Full PQ suite, Corona, GraphQL |
|
||||
| **Q-Chain (Quantum)** | Warp, Full PQ suite, Pulsar, GraphQL |
|
||||
| **B-Chain (Bridge)** | Warp, TeleportBridge, GraphQL |
|
||||
|
||||
### Missing from Z-Chain (Zoo) for Full Integration
|
||||
@@ -298,7 +298,7 @@ Current Z-Chain precompiles are limited. To enable full native chain functionali
|
||||
| Feature | Missing Precompiles | Priority |
|
||||
|---------|---------------------|----------|
|
||||
| **Bridge** | TeleportBridge (0x0440), OmnichainRouter (0x0441) | HIGH |
|
||||
| **Threshold** | FROST (0x0800), CGGMP21 (0x0801), Corona (0x0802) | HIGH |
|
||||
| **Threshold** | FROST (0x0800), CGGMP21 (0x0801), Pulsar (0x0802) | HIGH |
|
||||
| **FHE** | FHE (0x0700), ECIES (0x0701) | MEDIUM |
|
||||
| **Full DEX** | HooksRegistry, FlashLoan, LendingPool, PerpEngine | MEDIUM |
|
||||
| **PQ Crypto** | ML-DSA (0x0600), ML-KEM (0x0601) | LOW |
|
||||
@@ -1019,7 +1019,7 @@ The Lux precompile system now provides comprehensive integration with all specia
|
||||
| VM | Chain | Precompile Package | Address Range | Purpose |
|
||||
|----|-------|-------------------|---------------|---------|
|
||||
| BridgeVM | B-Chain | `bridge/` | 0x0440-0x0445 | MPC-based cross-chain bridging |
|
||||
| ThresholdVM | T-Chain | `threshold/` | 0x0800-0x0813 | Threshold signatures (LSS, FROST, CGGMP21, Corona) |
|
||||
| ThresholdVM | T-Chain | `threshold/` | 0x0800-0x0813 | Threshold signatures (LSS, FROST, CGGMP21, Pulsar) |
|
||||
| ZKVM | Z-Chain | `zk/` | 0x0900-0x0932 | Zero-knowledge proofs, privacy, rollups |
|
||||
| QuantumVM | Q-Chain | `quantum/` | 0x0600-0x0632 | Post-quantum crypto, quantum stamps |
|
||||
|
||||
@@ -1072,7 +1072,7 @@ for `teleportvm` (LP-6332), which is unrelated.
|
||||
- secp256k1 (ECDSA)
|
||||
- Ed25519 (EdDSA)
|
||||
- BLS12-381
|
||||
- Corona (post-quantum)
|
||||
- Pulsar (post-quantum)
|
||||
- ML-DSA
|
||||
|
||||
### ZK Precompiles (zk/)
|
||||
@@ -1111,13 +1111,13 @@ EVM interface to QuantumVM for post-quantum security:
|
||||
| Address | Name | Description | Gas |
|
||||
|---------|------|-------------|-----|
|
||||
| 0x0600 | QUANTUM_VERIFY | Generic quantum signature verification | 75,000 |
|
||||
| 0x0601 | CORONA | Corona threshold signatures | 75,000 |
|
||||
| 0x0602 | ML_DSA | NIST ML-DSA (Dilithium) | 50,000 |
|
||||
| 0x0603 | ML_KEM | NIST ML-KEM (Kyber) | 25,000 |
|
||||
| 0x0604 | SLH_DSA | NIST SLH-DSA (SPHINCS+) | 100,000 |
|
||||
| 0x0610 | HYBRID_BLS_CORONA | BLS + Corona hybrid | 100,000 |
|
||||
| 0x0601 | CORONA | Pulsar threshold signatures | 75,000 |
|
||||
| 0x0602 | ML_DSA | NIST ML-DSA | 50,000 |
|
||||
| 0x0603 | ML_KEM | NIST ML-KEM | 25,000 |
|
||||
| 0x0604 | SLH_DSA | NIST SLH-DSA (FIPS 205, formerly SPHINCS+) | 100,000 |
|
||||
| 0x0610 | HYBRID_BLS_CORONA | BLS + Pulsar hybrid | 100,000 |
|
||||
| 0x0611 | HYBRID_ECDSA_MLDSA | ECDSA + ML-DSA hybrid | 100,000 |
|
||||
| 0x0612 | HYBRID_SCHNORR_CORONA | Schnorr + Corona hybrid | 100,000 |
|
||||
| 0x0612 | HYBRID_SCHNORR_CORONA | Schnorr + Pulsar hybrid | 100,000 |
|
||||
| 0x0620 | QUANTUM_STAMP | Quantum timestamp verification | 50,000 |
|
||||
| 0x0621 | QUANTUM_ANCHOR | Quantum anchor verification | 50,000 |
|
||||
| 0x0630 | BLS_VERIFY | BLS12-381 signature verification | 25,000 |
|
||||
@@ -1164,7 +1164,7 @@ EVM interface to QuantumVM for post-quantum security:
|
||||
│ └── verifier.go
|
||||
├── quasar/ # Quantum consensus
|
||||
├── ring/ # Ring signatures
|
||||
├── corona/ # Corona threshold
|
||||
├── corona/ # Pulsar threshold
|
||||
├── secp256r1/ # P-256 curve
|
||||
├── slhdsa/ # SLH-DSA signatures
|
||||
├── threshold/ # Threshold precompiles (0x0800-0x0813) [NEW]
|
||||
|
||||
@@ -95,9 +95,9 @@ Post-quantum cryptography replaces the hardness assumption.
|
||||
|
||||
| Precompile | Address | Standard | Hardness |
|
||||
|------------|---------|----------|----------|
|
||||
| `mldsa` | `0x0200..06` | FIPS 204 (Dilithium) | Module-LWE + Module-SIS |
|
||||
| `mlkem` | `0x0200..07` | FIPS 203 (Kyber) | Module-LWE |
|
||||
| `slhdsa` | `0x0600..01` | FIPS 205 (SPHINCS+) | Hash-based (no structured math) |
|
||||
| `mldsa` | `0x0200..06` | FIPS 204 (ML-DSA) | Module-LWE + Module-SIS |
|
||||
| `mlkem` | `0x0200..07` | FIPS 203 (ML-KEM) | Module-LWE |
|
||||
| `slhdsa` | `0x0600..01` | FIPS 205 (SLH-DSA (FIPS 205, formerly SPHINCS+)) | Hash-based (no structured math) |
|
||||
| `corona` | `0x0200..0B` | — | LWE threshold signatures |
|
||||
| `xwing` | `0x2221` | Draft hybrid | X25519 + ML-KEM-768 |
|
||||
|
||||
@@ -235,10 +235,10 @@ verifies those aggregates in one call.
|
||||
|
||||
| Precompile | Address | Verifies |
|
||||
|------------|---------|----------|
|
||||
| `quasar` | `0x0300..20-24` | BLS + Verkle + Corona + hybrid |
|
||||
| `quasar` | `0x0300..20-24` | BLS + Verkle + Pulsar + hybrid |
|
||||
|
||||
**Quasar** is the post-quantum consensus family: fast path uses BLS12-381
|
||||
aggregate signatures; PQ path uses Corona LWE threshold signatures; the
|
||||
aggregate signatures; PQ path uses Pulsar LWE threshold signatures; the
|
||||
two combine into a hybrid proof that's safe under both classical and quantum
|
||||
attackers. This precompile lets any contract (e.g. a bridge, a rollup)
|
||||
verify that a Quasar-consensus block was finalized.
|
||||
|
||||
+1
-1
@@ -72,7 +72,7 @@ The test suite is broad (341+ tests across 62 files) but shallow in exactly the
|
||||
| `verifySLHDSAGPU` — exported but untested | **MEDIUM** |
|
||||
| Gas = 0 (only tested once via `TestSLHDSAVerify_OutOfGas` with gas=1000, not gas=0) | **LOW** |
|
||||
|
||||
### 1.6 Corona Lattice Threshold (corona/)
|
||||
### 1.6 Pulsar Lattice Threshold (corona/)
|
||||
|
||||
| Missing Test | Severity |
|
||||
|-------------|----------|
|
||||
|
||||
+10
-10
@@ -1,10 +1,10 @@
|
||||
# Corona Threshold Signature Precompile
|
||||
# Pulsar Threshold Signature Precompile
|
||||
|
||||
Post-quantum threshold signature verification precompile for Lux EVM, implementing the LWE-based two-round threshold signature scheme from [Corona (ePrint 2024/1113)](https://eprint.iacr.org/2024/1113).
|
||||
Post-quantum threshold signature verification precompile for Lux EVM, implementing the LWE-based two-round threshold signature scheme from [Pulsar (ePrint 2024/1113)](https://eprint.iacr.org/2024/1113).
|
||||
|
||||
## Overview
|
||||
|
||||
The Corona Threshold precompile enables verification of lattice-based threshold signatures on-chain, providing post-quantum security for multi-party consensus protocols. This is a critical component of the Quasar quantum consensus mechanism.
|
||||
The Pulsar Threshold precompile enables verification of lattice-based threshold signatures on-chain, providing post-quantum security for multi-party consensus protocols. This is a critical component of the Quasar quantum consensus mechanism.
|
||||
|
||||
**Precompile Address**: `0x020000000000000000000000000000000000000B`
|
||||
|
||||
@@ -18,7 +18,7 @@ The Corona Threshold precompile enables verification of lattice-based threshold
|
||||
|
||||
## Algorithm
|
||||
|
||||
Corona implements a threshold signature scheme based on:
|
||||
Pulsar implements a threshold signature scheme based on:
|
||||
- **Lattice Cryptography**: LWE problem hardness
|
||||
- **Ring Learning With Errors**: Polynomial ring operations
|
||||
- **Threshold Secret Sharing**: Shamir's secret sharing over rings
|
||||
@@ -194,7 +194,7 @@ valid := sign.Verify(r, r_xi, r_nu, z, A, mu, bTilde, c, Delta)
|
||||
|
||||
## Quasar Consensus Integration
|
||||
|
||||
The Corona threshold precompile is designed for Quasar consensus:
|
||||
The Pulsar threshold precompile is designed for Quasar consensus:
|
||||
|
||||
```solidity
|
||||
contract QuasarConsensus {
|
||||
@@ -252,7 +252,7 @@ contract QuasarConsensus {
|
||||
|--------|---------------|-------------|----------------|
|
||||
| ECDSA (secp256k1) | 65 bytes | ~88μs | ❌ |
|
||||
| BLS | 96 bytes | ~2.1ms | ❌ |
|
||||
| **Corona** | **~20KB** | **~3.8ms** | **✅** |
|
||||
| **Pulsar** | **~20KB** | **~3.8ms** | **✅** |
|
||||
| ML-DSA-65 | 3.3KB | ~108μs | ✅ |
|
||||
| SLH-DSA | 7.9KB | ~4.2ms | ✅ |
|
||||
|
||||
@@ -298,7 +298,7 @@ function verify(bytes32 hash, bytes memory sig) public view {
|
||||
require(isAuthorized(signer), "Unauthorized");
|
||||
}
|
||||
|
||||
// After (Corona Threshold)
|
||||
// After (Pulsar Threshold)
|
||||
function verify(bytes32 hash, bytes memory sig) public view {
|
||||
CoronaThresholdLib.verifyOrRevert(
|
||||
THRESHOLD,
|
||||
@@ -316,7 +316,7 @@ function verify(bytes32 hash, bytes memory sig) public view {
|
||||
require(BLS.verify(aggregateKey, hash, sig), "Invalid");
|
||||
}
|
||||
|
||||
// After (Corona Threshold)
|
||||
// After (Pulsar Threshold)
|
||||
function verify(bytes32 hash, bytes memory sig) public view {
|
||||
require(
|
||||
verifyThresholdSignature(THRESHOLD, N, hash, sig),
|
||||
@@ -327,9 +327,9 @@ function verify(bytes32 hash, bytes memory sig) public view {
|
||||
|
||||
## References
|
||||
|
||||
- [Corona Paper (ePrint 2024/1113)](https://eprint.iacr.org/2024/1113)
|
||||
- [Pulsar Paper (ePrint 2024/1113)](https://eprint.iacr.org/2024/1113)
|
||||
- [Lattice Library](https://github.com/luxfi/lattice)
|
||||
- [Corona Implementation](/Users/z/work/lux/corona/)
|
||||
- [Pulsar Implementation](/Users/z/work/lux/corona/)
|
||||
- [Quasar Consensus](/Users/z/work/lux/node/consensus/protocol/quasar/)
|
||||
|
||||
## License
|
||||
|
||||
+1
-1
@@ -58,7 +58,7 @@ ThresholdVM at `~/work/lux/node/vms/thresholdvm/` is **complete and registered**
|
||||
- Factory registered in `node/node/vms_allvms.go:50` under `constants.ThresholdVMID`
|
||||
- Aliases: `T`, `threshold`, `thresholdvm`, `mpc`
|
||||
- Implements `chain.ChainVM` interface
|
||||
- Full MPC protocol suite (LSS, FROST, CGGMP21, Corona)
|
||||
- Full MPC protocol suite (LSS, FROST, CGGMP21, Pulsar)
|
||||
- FHE acceleration (GPU optional, CPU fallback)
|
||||
- RPC client implementation
|
||||
- 10+ Go files, extensive test coverage
|
||||
|
||||
@@ -27,7 +27,7 @@ Cryptography precompiles occupy addresses `0x0200...0005` through `0x0200...000D
|
||||
|
||||
| Address | Precompile | Gas | Description |
|
||||
|---------|------------|-----|-------------|
|
||||
| `0x...000B` | Corona | 150,000 | Post-quantum threshold signatures |
|
||||
| `0x...000B` | Pulsar | 150,000 | Post-quantum threshold signatures |
|
||||
| `0x...000C` | FROST | 50,000 | Schnorr threshold signatures |
|
||||
| `0x...000D` | CGGMP21 | 75,000 | ECDSA threshold signatures |
|
||||
|
||||
@@ -71,7 +71,7 @@ contract QuantumSafeContract {
|
||||
| ML-DSA-65 | 192-bit | NIST Level 3 |
|
||||
| ML-DSA-87 | 256-bit | NIST Level 5 |
|
||||
| SLH-DSA | Variable | NIST Level 1-5 |
|
||||
| Corona | 128-bit | Quantum-resistant |
|
||||
| Pulsar | 128-bit | Quantum-resistant |
|
||||
|
||||
## Related
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ Precompiles are native code executed by the EVM at reserved addresses, offering
|
||||
|
||||
| Category | Precompiles | Description |
|
||||
|----------|-------------|-------------|
|
||||
| [Cryptography](/docs/crypto) | ML-DSA, ML-KEM, SLH-DSA, FROST, Corona, CGGMP21 | Post-quantum and threshold signatures |
|
||||
| [Cryptography](/docs/crypto) | ML-DSA, ML-KEM, SLH-DSA, FROST, Pulsar, CGGMP21 | Post-quantum and threshold signatures |
|
||||
| [DEX](/docs/dex) | PoolManager, Hooks, Lending, Perpetuals | Uniswap v4-style DEX operations |
|
||||
| [FHE](/docs/fhe) | Encrypted operations | Fully Homomorphic Encryption |
|
||||
| [Oracle](/docs/oracle) | Price feeds, GraphQL | Native oracle and query interface |
|
||||
@@ -58,7 +58,7 @@ contract MyContract {
|
||||
| `0x...0008` | Warp | 120,000 | Cross-chain BLS messaging |
|
||||
| `0x...0009` | ML-KEM | 50,000 | FIPS 203 key encapsulation |
|
||||
| `0x...000A` | Quasar | Variable | Quantum consensus operations |
|
||||
| `0x...000B` | Corona | 150,000 | Post-quantum threshold signatures |
|
||||
| `0x...000B` | Pulsar | 150,000 | Post-quantum threshold signatures |
|
||||
| `0x...000C` | FROST | 50,000 | Schnorr threshold signatures |
|
||||
| `0x...000D` | CGGMP21 | 75,000 | ECDSA threshold signatures |
|
||||
|
||||
|
||||
+1
-1
@@ -235,7 +235,7 @@ Benchmarks on Apple M1 Max:
|
||||
|-----------|---------------|----------|--------------|
|
||||
| FROST (this) | 64 bytes | 50k-125k | ❌ |
|
||||
| CGGMP21 | 65 bytes | 75k-175k | ❌ |
|
||||
| Corona | 4KB | 150k-300k | ✅ |
|
||||
| Pulsar | 4KB | 150k-300k | ✅ |
|
||||
| BLS (Warp) | 96 bytes | 120k | ❌ |
|
||||
|
||||
## Integration with Lux Threshold
|
||||
|
||||
+2
-2
@@ -4,7 +4,7 @@ Post-quantum digital signature verification precompile for Lux EVM.
|
||||
|
||||
## Overview
|
||||
|
||||
The ML-DSA (Module-Lattice-Based Digital Signature Algorithm) precompile provides quantum-resistant signature verification based on the Dilithium algorithm and standardized in FIPS 204.
|
||||
The ML-DSA (Module-Lattice-Based Digital Signature Algorithm) precompile provides quantum-resistant signature verification based on the ML-DSA algorithm and standardized in FIPS 204.
|
||||
|
||||
**Precompile Address**: `0x0200000000000000000000000000000000000006`
|
||||
|
||||
@@ -189,7 +189,7 @@ go test -v -run TestMLDSAVerify_LargeMessage
|
||||
## References
|
||||
|
||||
- [FIPS 204: Module-Lattice-Based Digital Signature Standard](https://csrc.nist.gov/pubs/fips/204/final)
|
||||
- [Dilithium Specification](https://pq-crystals.org/dilithium/)
|
||||
- [ML-DSA Specification](https://pq-crystals.org/dilithium/)
|
||||
- [Cloudflare CIRCL Library](https://github.com/cloudflare/circl)
|
||||
|
||||
## Related Precompiles
|
||||
|
||||
+3
-3
@@ -8,7 +8,7 @@ This precompile implements **SLH-DSA (Stateless Hash-Based Digital Signature Alg
|
||||
|
||||
## FIPS 205 - SLH-DSA
|
||||
|
||||
SLH-DSA (formerly SPHINCS+) is a **post-quantum digital signature scheme** based on hash functions. It provides:
|
||||
SLH-DSA (FIPS 205, formerly SPHINCS+) is a **post-quantum digital signature scheme** based on hash functions. It provides:
|
||||
|
||||
- **Quantum Resistance**: Secure against attacks by quantum computers
|
||||
- **Stateless Operation**: No state management required (unlike XMSS)
|
||||
@@ -227,7 +227,7 @@ Large signatures are a characteristic of hash-based schemes:
|
||||
|
||||
- **Library**: Cloudflare CIRCL v1.6.1
|
||||
- **Standard**: FIPS 205 (Final)
|
||||
- **Algorithm**: SPHINCS+ with FIPS 205 parameters
|
||||
- **Algorithm**: SLH-DSA with FIPS 205 parameters
|
||||
- **Hash Functions**: SHA-256, SHA-512, SHAKE256
|
||||
- **Security Levels**: 128-bit, 192-bit, 256-bit
|
||||
|
||||
@@ -268,7 +268,7 @@ forge test --match-path "**/slhdsa/**"
|
||||
## References
|
||||
|
||||
- [FIPS 205: Stateless Hash-Based Digital Signature Standard](https://csrc.nist.gov/pubs/fips/205/final)
|
||||
- [SPHINCS+ Website](https://sphincs.org/)
|
||||
- [SLH-DSA Website](https://sphincs.org/)
|
||||
- [Cloudflare CIRCL Library](https://github.com/cloudflare/circl)
|
||||
- [NIST PQC Standardization](https://csrc.nist.gov/projects/post-quantum-cryptography)
|
||||
|
||||
|
||||
+1
-1
@@ -265,7 +265,7 @@ struct Groth16Proof {
|
||||
For post-quantum security, use:
|
||||
- **Poseidon2** (`0x0501`) for commitments
|
||||
- **ML-DSA** (`0x0300`) for signatures
|
||||
- **Corona** for threshold signatures
|
||||
- **Pulsar** for threshold signatures
|
||||
|
||||
### Trusted Setup
|
||||
|
||||
|
||||
Reference in New Issue
Block a user