deps: api v1.0.5 chains v1.2.1 utxo v0.3.0 accel v1.0.9; fix BLS PublicKey []byte signature; service/info Consensus surfacing

This commit is contained in:
Hanzo AI
2026-05-05 16:59:52 -07:00
parent 23db515448
commit 071630ece8
13 changed files with 223 additions and 224 deletions
+27 -4
View File
@@ -81,14 +81,37 @@ RUN ARCH=$(echo ${TARGETPLATFORM} | cut -d / -f2) && \
rm /tmp/accel.tar.gz && \
ldconfig 2>/dev/null || true
# Build node. CGO_ENABLED=0 for portable builds (GPU accel uses pure Go fallbacks).
# Set CGO_ENABLED=1 + install libluxaccel from luxcpp for GPU acceleration.
# Fetch pre-built luxcpp/cevm libs (libevm, libevm-gpu, libluxgpu,
# libcevm_precompiles + go_bridge.h). When LUX_CGO=1 these libraries are
# linked into the C-Chain plugin via github.com/luxfi/chains/evm/cevm
# and become the default execution backend (parallel + GPU EVM).
#
# CI/RELEASE GAP: the luxcpp/cevm release artifacts MUST publish per-arch
# tarballs at the URL below for both linux-x86_64 and linux-arm64. Until
# those tarballs exist, builds with LUX_CGO=1 will fail at this step and
# operators must build with LUX_CGO=0 (pure-Go fallback).
ARG LUX_CGO=1
ARG CEVM_VERSION=v0.19.0
RUN if [ "${LUX_CGO}" = "1" ]; then \
ARCH=$(echo ${TARGETPLATFORM} | cut -d / -f2) && \
if [ "$ARCH" = "amd64" ]; then CEVM_ARCH="linux-x86_64"; else CEVM_ARCH="linux-arm64"; fi && \
wget -q "https://github.com/luxcpp/cevm/releases/download/${CEVM_VERSION}/luxcpp-cevm-${CEVM_ARCH}.tar.gz" \
-O /tmp/cevm.tar.gz && \
tar -xzf /tmp/cevm.tar.gz -C /usr/local && \
rm /tmp/cevm.tar.gz && \
ldconfig 2>/dev/null || true ; \
else \
echo "LUX_CGO=0: skipping luxcpp/cevm fetch (pure-Go fallback build)" ; \
fi
# Build node. LUX_CGO=1 (default) links luxcpp/cevm for parallel + GPU EVM.
# Set LUX_CGO=0 for portable pure-Go builds without the native libs.
ARG RACE_FLAG=""
ARG BUILD_SCRIPT=build.sh
ARG LUXD_COMMIT=""
ENV CGO_ENABLED=0
ENV CGO_ENABLED=${LUX_CGO}
RUN . ./build_env.sh && \
echo "{CC=$CC, TARGETPLATFORM=$TARGETPLATFORM, BUILDPLATFORM=$BUILDPLATFORM}" && \
echo "{CC=$CC, TARGETPLATFORM=$TARGETPLATFORM, BUILDPLATFORM=$BUILDPLATFORM, LUX_CGO=${LUX_CGO}}" && \
export GOARCH=$(echo ${TARGETPLATFORM} | cut -d / -f2) && \
export LUXD_COMMIT="${LUXD_COMMIT}" && \
GOFLAGS="-mod=mod" ./scripts/${BUILD_SCRIPT} ${RACE_FLAG}
+12 -11
View File
@@ -13,23 +13,24 @@ Note: "Vote (wire format: Chits)" should be used where clarification is needed.
### acceptor.go
Provides `Acceptor` interface for block acceptance callbacks:
Node-side `Acceptor` interface for block acceptance callbacks:
- `Accept()` called before container committed as accepted
- `AcceptorGroup` manages multiple acceptors per chain
- `AcceptorGroup` manages chain-ID-keyed acceptors (used by indexer + warp)
- Thread-safe with RWMutex
### engine/chain/vote.go
Vote message types for consensus:
- `VoteMessage` - Vote for specific block (wire format: Chits)
- `UnsolicitedVoteRequestID` - Constant for fast-follow votes
The canonical consensus `Acceptor` lives in `luxfi/consensus/core`. This
package's variant differs in that it takes a `*runtime.Runtime` (node-side
runtime context) rather than a `context.Context`, and supports multi-chain
registration via `AcceptorGroup`.
### quasar/
Hybrid quantum-safe finality engine:
- `Quasar` - Main consensus coordinator
- `CoronaCoordinator` - Post-quantum threshold signatures
- `CoronaSignature`, `BLSSignature`, `QuasarSignature` - Signature types
Node-side wiring around `github.com/luxfi/consensus/protocol/quasar`:
- `Quasar` - Wraps the canonical engine with P-Chain provider + finality channel
- `CoronaCoordinator` - Stub for threshold signing (real keys loaded later)
- `CoronaSignature`, `BLSSignature`, `QuasarSignature` - Node-side signature wrappers
Imports `github.com/luxfi/consensus/protocol/quasar` for the actual protocol.
## Architecture Notes
+27 -39
View File
@@ -1,50 +1,34 @@
# Consensus Package
# Consensus Package (Node-Side Integration)
This package provides consensus infrastructure for the Lux node.
This package provides node-side glue around the canonical consensus engine
in [`github.com/luxfi/consensus`](https://github.com/luxfi/consensus). It does
NOT implement the consensus protocol — it only wires the engine into the
node's chain manager, indexer, and IPC layers.
## Overview
The consensus package contains:
- **Acceptor**: Callback mechanism for accepted blocks/vertices
- **Quasar**: Hybrid quantum-safe finality engine (BLS + Corona)
- **Engine**: Chain and DAG consensus engine interfaces
## Vote Terminology
This package uses "Vote" as the semantic name for validator responses to block proposals.
**Vote (wire format: Chits)**: A validator's agreement or preference for a specific block. On the network wire, votes are transmitted using the "Chits" message format for backwards compatibility with existing protocols.
```go
// VoteMessage represents a vote for a specific block.
// This is a semantic wrapper - the wire format remains Chits.
type VoteMessage struct {
BlockID ids.ID
RequestID uint32
}
```
The `UnsolicitedVoteRequestID` constant (value 0) indicates a vote sent without a prior request, used in fast-follow scenarios.
- **Acceptor**: Callback mechanism invoked when consensus accepts a block /
vertex. Adapts chain-ID-keyed runtime contexts to the node's indexer and
warp IPC.
- **Quasar**: Node-side wiring around `consensus/protocol/quasar` (BLS +
Corona hybrid finality). Adapts P-Chain validator state, BLS signing
keys, and the Corona threshold coordinator.
## Package Structure
```
consensus/
acceptor.go # Acceptor interface and group management
engine/
chain/
vote.go # Vote message types (wire format: Chits)
quasar/
quasar.go # Hybrid BLS + Corona finality
types.go # Signature types and interfaces
config.go # Configuration
gpu_ntt.go # GPU acceleration for NTT operations
acceptor.go # Acceptor interface + chain-ID-keyed AcceptorGroup
quasar/ # Node-side wrapper around luxfi/consensus/protocol/quasar
zap/ # ZAP agentic-consensus / DID bridge (self-contained)
```
## Acceptor
The `Acceptor` interface is called before containers are committed as accepted:
The `Acceptor` interface is called before containers are committed as
accepted:
```go
type Acceptor interface {
@@ -54,13 +38,17 @@ type Acceptor interface {
Multiple acceptors can be registered per chain via `AcceptorGroup`.
## Quasar Consensus
## Quasar Integration
Quasar provides hybrid quantum-safe finality by combining:
The `quasar/` subpackage wraps `github.com/luxfi/consensus/protocol/quasar`
and provides node-specific wiring:
1. **BLS Aggregate Signatures** - Fast classical signatures (96 bytes)
2. **Corona Threshold Signatures** - Post-quantum threshold signatures (t-of-n)
1. **P-Chain provider** — feeds live validator state from PlatformVM's
validator manager into the engine.
2. **Quantum fallback signer** — adapts the node's BLS signing key.
3. **Corona coordinator stub** — placeholder until real threshold key
material is loaded.
Both signature paths run in parallel, and blocks achieve finality only when both complete with sufficient weight.
See `quasar/README.md` for detailed documentation.
The actual hybrid finality protocol (BLS + Corona + ML-DSA threshold
signing) lives in `luxfi/consensus`. See that repository for protocol
details, parameter tuning, and benchmarks.
+12 -20
View File
@@ -2,33 +2,25 @@
// See the file LICENSE for licensing terms.
/*
Package consensus provides consensus infrastructure for the Lux node.
Package consensus provides node-side consensus integration for the Lux node.
# Terminology
This package uses "Vote" as the semantic name for validator responses to
block proposals. On the network wire, votes are transmitted using the
"Chits" message format for backwards compatibility.
Vote (wire format: Chits): A validator's agreement or preference for a
specific block. The VoteMessage type wraps this semantic concept while
the underlying protocol uses Chits.
The canonical consensus protocol implementation lives in the
github.com/luxfi/consensus module. This package only contains the node-side
glue (Acceptor callbacks, Quasar wiring) needed to wire the consensus engine
into the node's chain manager and indexer.
# Components
The package contains several components:
Acceptor: Callback interface invoked before blocks are committed as
accepted. Multiple acceptors can be registered per chain via AcceptorGroup.
This is the node-side hook that adapts consensus acceptance to chain-ID-keyed
runtime contexts (indexer, warp, IPC).
Engine: Chain and DAG consensus engine interfaces located in the engine
subpackage. The chain/vote.go file defines vote message types.
Quasar: Node-side wiring around github.com/luxfi/consensus/protocol/quasar.
The quasar subpackage adapts P-Chain validator state, BLS signers, and the
Corona threshold coordinator into the canonical consensus engine.
Quasar: Hybrid quantum-safe finality engine combining BLS aggregate
signatures (classical) with Corona threshold signatures (post-quantum).
Located in the quasar subpackage.
# Quasar Consensus
# Quasar Integration
The Quasar engine achieves hybrid finality by running two signature paths
in parallel:
@@ -38,6 +30,6 @@ in parallel:
Blocks achieve quantum finality only when both paths complete successfully.
See the quasar subpackage for detailed implementation.
See github.com/luxfi/consensus for the canonical protocol implementation.
*/
package consensus
-24
View File
@@ -1,24 +0,0 @@
// Copyright (C) 2019-2025, Lux Industries Inc. All rights reserved.
// See the file LICENSE for licensing terms.
/*
Package chain provides chain consensus engine types and interfaces.
# Vote Terminology
This package uses "Vote" as the semantic name for validator responses.
Vote (wire format: Chits): The underlying network protocol transmits
votes using the Chits message format for backwards compatibility.
The VoteMessage type provides a semantic wrapper around the wire format:
type VoteMessage struct {
BlockID ids.ID
RequestID uint32
}
UnsolicitedVoteRequestID (value 0) indicates a vote sent without a prior
request, used in fast-follow scenarios where a follower sends a vote back
to the proposer after accepting a gossiped block.
*/
package chain
-25
View File
@@ -1,25 +0,0 @@
// Copyright (C) 2019-2025, Lux Industries Inc. All rights reserved.
// See the file LICENSE for licensing terms.
package chain
import "github.com/luxfi/ids"
// Vote constants for consensus message handling.
//
// Vote is the semantic name for a validator's response to a block proposal.
// On the wire, votes are transmitted using the "Vote" message format
// for backwards compatibility with existing network protocols.
const (
// UnsolicitedVoteRequestID indicates a vote sent without a prior request.
// This is used in fast-follow scenarios where a follower node sends
// a vote back to the proposer after accepting a gossiped block.
UnsolicitedVoteRequestID = uint32(0)
)
// VoteMessage represents a vote for a specific block.
// This is a semantic wrapper - the wire format remains Vote.
type VoteMessage struct {
BlockID ids.ID
RequestID uint32
}
+14 -24
View File
@@ -27,13 +27,13 @@ require (
github.com/huin/goupnp v1.3.0
github.com/jackpal/gateway v1.1.1
github.com/jackpal/go-nat-pmp v1.0.2
github.com/luxfi/consensus v1.22.84
github.com/luxfi/crypto v1.17.56
github.com/luxfi/database v1.18.1
github.com/luxfi/consensus v1.22.85
github.com/luxfi/crypto v1.18.1
github.com/luxfi/database v1.18.2
github.com/luxfi/ids v1.2.9
github.com/luxfi/keychain v1.0.2
github.com/luxfi/log v1.4.1
github.com/luxfi/math v1.2.4
github.com/luxfi/math v1.4.0
github.com/luxfi/metric v1.5.1
github.com/luxfi/mock v0.1.1
github.com/mr-tron/base58 v1.2.0
@@ -67,8 +67,8 @@ require (
golang.org/x/time v0.15.0
golang.org/x/tools v0.43.0
gonum.org/v1/gonum v0.17.0
google.golang.org/genproto/googleapis/rpc v0.0.0-20260217215200-42d3e9bedb6d // indirect
google.golang.org/grpc v1.79.1
google.golang.org/genproto/googleapis/rpc v0.0.0-20260401024825-9d38bb4040a9 // indirect
google.golang.org/grpc v1.80.0
google.golang.org/protobuf v1.36.11
gopkg.in/yaml.v3 v3.0.1 // indirect
)
@@ -117,7 +117,7 @@ require (
go.uber.org/multierr v1.11.0 // indirect
golang.org/x/sys v0.42.0 // indirect
golang.org/x/text v0.35.0 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20260217215200-42d3e9bedb6d // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20260401024825-9d38bb4040a9 // indirect
)
require (
@@ -126,26 +126,16 @@ require (
github.com/consensys/gnark-crypto v0.20.1
github.com/golang-jwt/jwt/v4 v4.5.2
github.com/golang/mock v1.7.0-rc.1
github.com/luxfi/accel v1.0.7
github.com/luxfi/api v1.0.4
github.com/luxfi/accel v1.0.9
github.com/luxfi/api v1.0.5
github.com/luxfi/atomic v1.0.0
github.com/luxfi/chains/aivm v0.1.0
github.com/luxfi/chains/bridgevm v0.1.0
github.com/luxfi/chains/dexvm v0.1.0
github.com/luxfi/chains/graphvm v0.1.0
github.com/luxfi/chains/identityvm v0.1.0
github.com/luxfi/chains/keyvm v0.1.0
github.com/luxfi/chains/oraclevm v0.1.0
github.com/luxfi/chains/quantumvm v0.1.0
github.com/luxfi/chains/relayvm v0.1.0
github.com/luxfi/chains/thresholdvm v0.1.0
github.com/luxfi/chains/zkvm v0.1.0
github.com/luxfi/chains v1.2.1
github.com/luxfi/compress v0.0.5
github.com/luxfi/constants v1.4.7
github.com/luxfi/container v0.0.4
github.com/luxfi/filesystem v0.0.1
github.com/luxfi/genesis v1.8.2
github.com/luxfi/geth v1.16.77
github.com/luxfi/geth v1.16.86-0.20260413014255-3e903c3d2e06
github.com/luxfi/go-bip39 v1.1.2
github.com/luxfi/lattice/v7 v7.0.0
github.com/luxfi/math/safe v0.0.1
@@ -159,7 +149,7 @@ require (
github.com/luxfi/timer v1.0.2
github.com/luxfi/units v1.0.0
github.com/luxfi/utils v1.1.4
github.com/luxfi/utxo v0.2.9
github.com/luxfi/utxo v0.3.0
github.com/luxfi/validators v1.0.0
github.com/luxfi/vm v1.0.40
github.com/luxfi/warp v1.18.5
@@ -175,10 +165,11 @@ require (
github.com/decred/dcrd/crypto/blake256 v1.1.0 // indirect
github.com/go-ini/ini v1.67.0 // indirect
github.com/goccy/go-yaml v1.19.2 // indirect
github.com/hashicorp/go-bexpr v0.1.16 // indirect
github.com/klauspost/crc32 v1.3.0 // indirect
github.com/luxfi/age v1.4.0 // indirect
github.com/luxfi/ai v0.1.0 // indirect
github.com/luxfi/oracle v0.1.1-0.20260429020431-76258cfcddf9 // indirect
github.com/luxfi/relay v0.0.0-20260429020048-c629fe160d3c // indirect
github.com/luxfi/staking v1.1.0 // indirect
github.com/luxfi/threshold v1.5.5 // indirect
github.com/luxfi/trace v0.1.4 // indirect
@@ -225,7 +216,6 @@ require (
github.com/luxfi/formatting v1.0.1
github.com/luxfi/go-bip32 v1.0.2
github.com/luxfi/math/big v0.1.0 // indirect
github.com/luxfi/precompile v0.5.6 // indirect
github.com/luxfi/corona v0.2.0 // indirect
github.com/luxfi/sampler v1.0.0 // indirect
github.com/luxfi/tls v1.0.3 // indirect
+32 -50
View File
@@ -101,8 +101,6 @@ github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1/go.mod h1:hyedUtir6IdtD/7lIxGeC
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.4.1 h1:5RVFMOWjMyRy8cARdy79nAmgYw3hK/4HUq48LQ6Wwqo=
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.4.1/go.mod h1:ZXNYxsqcloTdSy/rNShjYzMhyjf0LaoftYK0p+A3h40=
github.com/decred/dcrd/lru v1.0.0/go.mod h1:mxKOwFd7lFjN2GZYsiz/ecgqR6kkYAl+0pz0tEMk218=
github.com/dgraph-io/badger/v4 v4.9.0 h1:tpqWb0NewSrCYqTvywbcXOhQdWcqephkVkbBmaaqHzc=
github.com/dgraph-io/badger/v4 v4.9.0/go.mod h1:5/MEx97uzdPUHR4KtkNt8asfI2T4JiEiQlV7kWUo8c0=
github.com/dgraph-io/ristretto/v2 v2.4.0 h1:I/w09yLjhdcVD2QV192UJcq8dPBaAJb9pOuMyNy0XlU=
github.com/dgraph-io/ristretto/v2 v2.4.0/go.mod h1:0KsrXtXvnv0EqnzyowllbVJB8yBonswa2lTCK2gGo9E=
github.com/dgryski/go-farm v0.0.0-20240924180020-3414d57e47da h1:aIftn67I1fkbMa512G+w+Pxci9hJPB8oMnkcP3iZF38=
@@ -250,8 +248,8 @@ github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0
github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw=
github.com/leanovate/gopter v0.2.11 h1:vRjThO1EKPb/1NsDXuDrzldR28RLkBflWYcU9CvzWu4=
github.com/leanovate/gopter v0.2.11/go.mod h1:aK3tzZP/C+p1m3SPRE4SYZFGP7jjkuSI4f7Xvpt0S9c=
github.com/luxfi/accel v1.0.7 h1:ksHieAp50umwqxqgyHk9WiOmXM54kia3IEDb5H7FsM8=
github.com/luxfi/accel v1.0.7/go.mod h1:iZD3oxffiMEIT/KvzD8bgwC/cBn4AYlMW3QJpbRa4RE=
github.com/luxfi/accel v1.0.9 h1:QpXaZQUll0IlOHV+YgYUbrWcJeOYNNGzkwjI8e091x0=
github.com/luxfi/accel v1.0.9/go.mod h1:XvgcJLYsLObbKlrOgd3E2OJx5Oy5c/HnDlIewjr+Y+c=
github.com/luxfi/address v1.0.1 h1:Sc4keyuVzBIvHr7uVeYZf2/WY9YDGUgDi/iiWenj49g=
github.com/luxfi/address v1.0.1/go.mod h1:5j3Eh66v9zvv1GbNdZwt+23krV8JlSDaRzmWZU8ZRM0=
github.com/luxfi/age v1.4.0 h1:tU5q65RQSQdaVq64Z/DVUhiPQMoMPQT6pr41LsvG0AQ=
@@ -260,58 +258,40 @@ github.com/luxfi/ai v0.1.0 h1:PwTGob0GJivbdqNpUs82bvwcE8/qxyTokxfY7BZVPoo=
github.com/luxfi/ai v0.1.0/go.mod h1:lTuY32dGjEJUgVheYuanlt1O0jHj0AZ09sUSpRsmH6M=
github.com/luxfi/api v1.0.4 h1:5altGkSSk3zIsGzK/NPhRQe/It5QMHrAPgBVg2TMkK4=
github.com/luxfi/api v1.0.4/go.mod h1:Znr2A+SDJBCZ7ofxeq0MswHI0gk0cJsIYJLcu3tT8JY=
github.com/luxfi/api v1.0.5 h1:5+sepMbIBDzeIA0QTO66X/2D4SR8dKEQwQpdrmFmr+Q=
github.com/luxfi/api v1.0.5/go.mod h1:5OFWvZF+PbyuvLCDyKKpXCA/xp+LxJ32yOhNEKwQFN0=
github.com/luxfi/atomic v1.0.0 h1:xUV60MuzRvXngaQ1sM0yVC2v4TRoLlUGkkH7M9PS4yw=
github.com/luxfi/atomic v1.0.0/go.mod h1:0G2mTlQ6TXWHICUHrUUPu1/qAiIyR4gSZ2tva9ci/bI=
github.com/luxfi/cache v1.2.1 h1:kAzOS55/hmYeNKR+0HAKv4ma48Y6JjkI8UQeqdZ8bfI=
github.com/luxfi/cache v1.2.1/go.mod h1:co7JTxZZHpKT31Yh01LFp5aZOxmoUg157FhBLQdQHVU=
github.com/luxfi/chains/aivm v0.1.0 h1:YpPPMhDmP/B+DII/Z78ChKc54AHMyhl5fydXX0ByMDQ=
github.com/luxfi/chains/aivm v0.1.0/go.mod h1:fjM7TNcL9JrzYqSBQDxxxJ8SpLLupqI6tiMXBMdcZp8=
github.com/luxfi/chains/bridgevm v0.1.0 h1:ObrmZXFVA1kEvm8QnBUEJhgmQO3OsMNibVJ24eJ0vUs=
github.com/luxfi/chains/bridgevm v0.1.0/go.mod h1:n6mqD/zC6GsDgR/WwNHG/ER5C234rIsA1AEZEiDWHFE=
github.com/luxfi/chains/dexvm v0.1.0 h1:VW0cmn8lwbFI56kMRuMcQj3v/Yi2M1hkNdqyW+ACySw=
github.com/luxfi/chains/dexvm v0.1.0/go.mod h1:89+FkQFgcUxB3mJESZr2iG1up+31e7CeuZyW3yEg2Hk=
github.com/luxfi/chains/graphvm v0.1.0 h1:1GBSYnBdkhJUVey4aTGVGOZs20eQWxSMHpksZvmsLWw=
github.com/luxfi/chains/graphvm v0.1.0/go.mod h1:iQG+VZTZHT/l7Ud1u4ZkG0y89Y+XEiCULMvcID15uxI=
github.com/luxfi/chains/identityvm v0.1.0 h1:YvWI0hv3ZF/+7E6daKfSsAr9wT9LWrbWkR5ZTr/fNWQ=
github.com/luxfi/chains/identityvm v0.1.0/go.mod h1:/nvul4m2ZpoIIBgOC4K3zUO/bxXtRyN/hSIkkp66Fxs=
github.com/luxfi/chains/keyvm v0.1.0 h1:fd6IDIRPg2M55sd6ftVnMnRGEvC9VK9XhgPAR4NE77c=
github.com/luxfi/chains/keyvm v0.1.0/go.mod h1:eEoBpT1QFtTYOAZPFQhc42D+rSDxcEAVtXsnZ3vk9+Y=
github.com/luxfi/chains/oraclevm v0.1.0 h1:2gNjuOub40DYytixY0IU6utQXFBVs4UOxfzyYFWRJ2A=
github.com/luxfi/chains/oraclevm v0.1.0/go.mod h1:ILRwHBWErwp20PasJuG9STcGbMytzyKXYRy9+AFV7PM=
github.com/luxfi/chains/quantumvm v0.1.0 h1:m30BrKok89htmnVSHUS+3IZrTAnluOQmLdojsGAFSBc=
github.com/luxfi/chains/quantumvm v0.1.0/go.mod h1:md7Q7GgUd7ujj5fUlHYNvIgsVHH5p4hhxZ9wdrXDaEg=
github.com/luxfi/chains/relayvm v0.1.0 h1:fTnehkZs2bXhjMpC6hFgoaUoseB/OB0XlentHHHmiDw=
github.com/luxfi/chains/relayvm v0.1.0/go.mod h1:ZxH3bFQ35/RO9wTFenysB+uJVuPKl2+NSBXMKtrjxpE=
github.com/luxfi/chains/thresholdvm v0.1.0 h1:56BAjconHGcX5rZNUhdvNNR21BJx5hW0dqMFCZ9zUqU=
github.com/luxfi/chains/thresholdvm v0.1.0/go.mod h1:OntEY7I37YTb41DAzT0t5BQ7x0+4wA0zmjKMvwkyqg8=
github.com/luxfi/chains/zkvm v0.1.0 h1:ef9S7t3WSjUfWHOvG7WGNdZ9PyujCekZiHAbKy/ri3g=
github.com/luxfi/chains/zkvm v0.1.0/go.mod h1:GNKMh3urLzSa3rsPQHYH7vcSmd2Jo6hnPuj/GinmqFE=
github.com/luxfi/chains v1.2.0 h1:AOoJ9OeMzzdPZV1NmKHl4KxxCiRBgUHHERU5llVEuFY=
github.com/luxfi/chains v1.2.0/go.mod h1:B5D2saO5i1HT1CvdWr4zfJRccMeSf02qHBf/1X2ZELE=
github.com/luxfi/chains v1.2.1 h1:eeqekwYV8E1OTIGFwzKBcI+9JGNzm3pfg+56qUn3BTQ=
github.com/luxfi/chains v1.2.1/go.mod h1:B5D2saO5i1HT1CvdWr4zfJRccMeSf02qHBf/1X2ZELE=
github.com/luxfi/codec v1.1.4 h1:Yl8ZalMNkqo7cD6R9AjczAajkLOmsjyZ9+DASVYHrvg=
github.com/luxfi/codec v1.1.4/go.mod h1:oGQ3j6E8c2P0pL0irYtWkrB1hmDUFIE0puXHK4gV5KI=
github.com/luxfi/compress v0.0.5 h1:4tEUHw5MK1bu5UOjfYCt4OKMiH7yykIgmGPRA/BfJTM=
github.com/luxfi/compress v0.0.5/go.mod h1:Cc1yxD2pfzrvpO32W2GDwLKff+CylHEvzZh2Ko8RSIU=
github.com/luxfi/concurrent v0.0.3 h1:eJyv1fhaC0jMLMw6+QS774cUmp7GK+ouMgvLCqnC7cc=
github.com/luxfi/concurrent v0.0.3/go.mod h1:Aj/FR5NpM0cB2P4Nt3+tz9+dV6V+LUW4HuMgSjwq5hw=
github.com/luxfi/consensus v1.22.84 h1:fKw4n7fY+lCWW5HSx/ciGeRSxv4knODQGWh6lBWAveQ=
github.com/luxfi/consensus v1.22.84/go.mod h1:y6y+bVjvpDLkkTBCCKLcch6R4PRW8EA+lTfr+6sB6F8=
github.com/luxfi/consensus v1.22.85 h1:S/XpPF+eDapbZb4AIu0Vr1GXzg/sAxjrAff2M2mkOx0=
github.com/luxfi/consensus v1.22.85/go.mod h1:y6y+bVjvpDLkkTBCCKLcch6R4PRW8EA+lTfr+6sB6F8=
github.com/luxfi/constants v1.4.7 h1:e/Qs+DQP3pugle3Zncq6fZCxKgqqtbyD/z7Gm4ZjsYg=
github.com/luxfi/constants v1.4.7/go.mod h1:hOszZ2NDQ8gMZKncfcZ67PXkb5OIbnwAzXC3oFbQwW0=
github.com/luxfi/container v0.0.4 h1:BXhF82WyfqVP5mjlNcr7tP0Fcnvl0Ap1rkiu+rq5XuM=
github.com/luxfi/container v0.0.4/go.mod h1:Z3SpmMF5d4t77MM0nHYXURpn+EMVaeu1fhbd/3BGaek=
github.com/luxfi/crypto v1.17.55 h1:D3FqoN4a5vAxag8gexR4uEp6NLQk2FyX+XT1FEtBSd4=
github.com/luxfi/crypto v1.17.55/go.mod h1:GnAkhQ7HNs3X0Tzx5nOONS3kl0yRmWHbDcRO5ffILsg=
github.com/luxfi/crypto v1.17.56 h1:k7eOZtJSpXJRuxzwqjtCoaw2N3i7dYPBFpjmx9vS+Uk=
github.com/luxfi/crypto v1.17.56/go.mod h1:trloMo4znuc3gp8IjYx8uIna3e4pDpaWI1y2YDeMbNo=
github.com/luxfi/database v1.18.1 h1:Bvovo6MW3XSdUd1DkGNluB2tyvyiT/+N5d3QVwtoNo8=
github.com/luxfi/database v1.18.1/go.mod h1:PW0oGujt165mYg7j/lctVbnfsUW6QLfIAgjyQdS66SM=
github.com/luxfi/crypto v1.18.1 h1:Qaw8hSK0unIOAH6TRvu0s3JfoJWcg6zTf5eZ5adgKic=
github.com/luxfi/crypto v1.18.1/go.mod h1:QhSdEEk3xmgR5a97/nkXB/n21ZsI1Iv7tcbqQaNM5zs=
github.com/luxfi/database v1.18.2 h1:r7jU8s4jaN0NpzWB0x91yyaL4CoCe0SxWEvxJGhJ7rE=
github.com/luxfi/database v1.18.2/go.mod h1:PW0oGujt165mYg7j/lctVbnfsUW6QLfIAgjyQdS66SM=
github.com/luxfi/filesystem v0.0.1 h1:VZ6xMFKaAPBW/ddlMsDnI2G0VU1lV5rYaVcW5d+KwEY=
github.com/luxfi/filesystem v0.0.1/go.mod h1:OQVSU6XNwqrr1AI+MqkID2taHUclx7NYmmr3svgttec=
github.com/luxfi/formatting v1.0.1 h1:ZnE1rAdEUds9yAegdVdGDOBGN6hLMPOv6E03Fp8IEYo=
github.com/luxfi/formatting v1.0.1/go.mod h1:mYzNf5DJOiqSSKUPzNj5dKy4tstFbN3pZlkI5716eKc=
github.com/luxfi/genesis v1.8.2 h1:jFFMDO/yyzq1KzL5FaXzkDV84BIFt72446jP56jPdcQ=
github.com/luxfi/genesis v1.8.2/go.mod h1:k26ZZvzES8e9cep9oWUDggBX+6oa5bnIQ7MmQP7dm4A=
github.com/luxfi/geth v1.16.77 h1:bFbSV6C0KCqU6bFtq+I8hJw9bWAj2hCZXyx0fJPIUfo=
github.com/luxfi/geth v1.16.77/go.mod h1:al8oFHXxsVly+Y3fcRHIhNhBSgAFNRR5Ey6YKemEDUs=
github.com/luxfi/geth v1.16.86-0.20260413014255-3e903c3d2e06 h1:NAIcfesKGSITw/mYTQpq62igXqUiDR7gekx8rQTKBmQ=
github.com/luxfi/geth v1.16.86-0.20260413014255-3e903c3d2e06/go.mod h1:OdpR6OnAsYROywc8wm7W0lPn1z06DjgVmRL/F8dz5Kw=
github.com/luxfi/go-bip32 v1.0.2 h1:7vFbb+Wr4Z499q2tuCLdd7wWjtn8sH+HWBlx76mhH9Y=
github.com/luxfi/go-bip32 v1.0.2/go.mod h1:bc7/LXDKAJQZ/F0Xjf5yXaTZxY9/ssLb4FC+Hxn/cDk=
github.com/luxfi/go-bip39 v1.1.2 h1:p+wLMPGs6MLQh7q0YIsmy2EhHL7LHiELEGTJko6t/Jg=
@@ -324,8 +304,8 @@ github.com/luxfi/lattice/v7 v7.0.0 h1:d1vgan6mlb2KtwYfPc1g69uxVYaoVYZmlrIm4aCO88
github.com/luxfi/lattice/v7 v7.0.0/go.mod h1:PFDdOkuGTQ0cbJMbKojzEJMGWUQmZW+wK9/wJ9F9fOs=
github.com/luxfi/log v1.4.1 h1:rIfFRodb9jrD/w7KayaUk0Oc+37PaQQdKEEMJCjR8gw=
github.com/luxfi/log v1.4.1/go.mod h1:64IE3xRMJcpkQwnPUfJw3pDj7wU0kRS7BZ9wM7R72jk=
github.com/luxfi/math v1.2.4 h1:iVz7s0gToCNUU/2cLT8gUa8MLzc0YRp4jBmeXBeKdXk=
github.com/luxfi/math v1.2.4/go.mod h1:i+Am9YvFsqDE75ZW8MPE62XCXGukXNiN/7mD9SKxxZY=
github.com/luxfi/math v1.4.0 h1:/sb7Grw3hfO+5INWAWdB95jTvCeXg8fSQxsxDzcFtd4=
github.com/luxfi/math v1.4.0/go.mod h1:iW0FOCC8qF2mPE+MakG780CAHA83848lb1L04thA1Pg=
github.com/luxfi/math/big v0.1.0 h1:Vz4c0RsZVPdIKPsHPgAJChH/R3p15WHRUz7LkLf+NIQ=
github.com/luxfi/math/big v0.1.0/go.mod h1:BuxSu22RbO93xBLk5Eam5nldFponoJ73xDFz4uJ3Huk=
github.com/luxfi/math/safe v0.0.1 h1:GfSBINV9mOFgHzd32JbgfHSLhlNn0BwnP43rteYEosc=
@@ -336,12 +316,16 @@ github.com/luxfi/mock v0.1.1 h1:0HEtIjg1J6CWz+IUyP6rsGqNWTcmxjFnSQIhaDuARwY=
github.com/luxfi/mock v0.1.1/go.mod h1:jo35akl3Vtd8LbzDts8VJ0jmSVycrd1/eBi6g6t5hKU=
github.com/luxfi/net v0.0.4 h1:z1d6Q5c9/79jb4vF0XwBBjlF5swH5NsgfaXA+Pgojq8=
github.com/luxfi/net v0.0.4/go.mod h1:QvgHzCa767cVWtPpui0P7HW1IrA2+c++hhvaQ/t0yyw=
github.com/luxfi/oracle v0.1.1-0.20260429020431-76258cfcddf9 h1:y+foW/ZJuTEb/AUUaJGrll2PVWumTiydWZuYJV4bJ/k=
github.com/luxfi/oracle v0.1.1-0.20260429020431-76258cfcddf9/go.mod h1:ueeF3b4SrhpCNb8hUYeP/kV7qgkp/BKKjsKbUhEjg40=
github.com/luxfi/p2p v1.19.2 h1:uqZq7ofmEDbXlTkv1QThtci01Q+dmDkNmAPeORIyP8E=
github.com/luxfi/p2p v1.19.2/go.mod h1:tI9Bt1R0ouvVtJvXG4e20GlGeV4AR230k4mFF9Vglzk=
github.com/luxfi/precompile v0.5.6 h1:d6qHVpRV1Nct97BxRpLuBQvlYmlg53sleGtq+iRWtyc=
github.com/luxfi/precompile v0.5.6/go.mod h1:Jz14VhQrU90mVgm/nTStQHdq8cLSOBHMF9UpJQjPFec=
github.com/luxfi/precompile v0.5.12 h1:YiF8gaPVFjXESHC+44XVM1RkAyZFMb8iU/60Tfq3Kxs=
github.com/luxfi/precompile v0.5.12/go.mod h1:YiTU6xMf2wmKM2LBzKctn82JhaesFDz4ysC+S864qCA=
github.com/luxfi/protocol v0.0.3 h1:Teytlu6Gbd0HqJXuDvV84ArqRabEFR40yDNNQUOCpVE=
github.com/luxfi/protocol v0.0.3/go.mod h1:ZSA1i7f2SlN129UG7rUZ+doHvf5/mtiurJMqRwGB4M8=
github.com/luxfi/relay v0.0.0-20260429020048-c629fe160d3c h1:wiOLqdEEjIoq+Uubkm6F6GYQue+rzqnITScM3ohWGqI=
github.com/luxfi/relay v0.0.0-20260429020048-c629fe160d3c/go.mod h1:P408Sn9NGwtcDOoGdkmWe0484dkWDvEvDDBM44Cv+s4=
github.com/luxfi/resource v0.0.1 h1:mTh+ICWSy548GTUSSyx7V/X5dV18oEwxZeQEYGJQhD4=
github.com/luxfi/resource v0.0.1/go.mod h1:wWpZktciYwIi6RNqA+fHwzmPrUJa7PRX7urfwT+spRE=
github.com/luxfi/corona v0.2.0 h1:DbLMZmE//2T2wXXS/gEkKZrTbre9LD+7EE/tz5SQszU=
@@ -372,10 +356,8 @@ github.com/luxfi/upgrade v1.0.0 h1:mM6YXvU8VzoclA7IdtuE5bmnMuFquYxjKUUW84LJz54=
github.com/luxfi/upgrade v1.0.0/go.mod h1:DZF7dO4erhUEKf907B2e65k4/vGkCPkUngpvIEUS3eI=
github.com/luxfi/utils v1.1.4 h1:8OY0jXCkpp6OotN1Y++6DATJkvtEwzq2k0p56imJlAk=
github.com/luxfi/utils v1.1.4/go.mod h1:c3yz1RjzrB+cs5GZm+q1T3/2cCKElO9vxm9yRRtgSEM=
github.com/luxfi/utxo v0.2.8 h1:+uGBHsuqdGW8hq50HfNvAzy/KS32EPWYK9ODjjzXW8Q=
github.com/luxfi/utxo v0.2.8/go.mod h1:lRA7XK1ree1xs8qBZKnSSHxZMBadOEsqhZOqxnOpgcw=
github.com/luxfi/utxo v0.2.9 h1:oaTE4JoBZFWkbuxAB3Q/wEak27riikN719IMC26NxGI=
github.com/luxfi/utxo v0.2.9/go.mod h1:pTd21USbVfCmeudLWoRq5SCqrqkLdC/E8SGf/rHMEg4=
github.com/luxfi/utxo v0.3.0 h1:Ok9VrICkFTRKjf3oTOovIPbPwiRpEZQ/MEFw7gFxpPo=
github.com/luxfi/utxo v0.3.0/go.mod h1:e1KQHhjYTpc0zugPbGuffezUoz2ZFvha5I3LoFB10/M=
github.com/luxfi/validators v1.0.0 h1:zE1HJM1lfvC+v1Lalg+MUgkKBGFWnwTfOOmXraiNnpE=
github.com/luxfi/validators v1.0.0/go.mod h1:QGppjtI/gqprbplWc10J+4OIK8UYWpv+53mfH2aKhy4=
github.com/luxfi/version v1.0.1 h1:T/1KYWEMmsrNQk7pN7PFPAwh/7XbeX7cFAKLBqI37Sk=
@@ -669,12 +651,12 @@ golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8T
golang.org/x/xerrors v0.0.0-20220517211312-f3a8303e98df/go.mod h1:K8+ghG5WaK9qNqU5K3HdILfMLy1f3aNYFI/wnl100a8=
gonum.org/v1/gonum v0.17.0 h1:VbpOemQlsSMrYmn7T2OUvQ4dqxQXU+ouZFQsZOx50z4=
gonum.org/v1/gonum v0.17.0/go.mod h1:El3tOrEuMpv2UdMrbNlKEh9vd86bmQ6vqIcDwxEOc1E=
google.golang.org/genproto/googleapis/api v0.0.0-20260217215200-42d3e9bedb6d h1:EocjzKLywydp5uZ5tJ79iP6Q0UjDnyiHkGRWxuPBP8s=
google.golang.org/genproto/googleapis/api v0.0.0-20260217215200-42d3e9bedb6d/go.mod h1:48U2I+QQUYhsFrg2SY6r+nJzeOtjey7j//WBESw+qyQ=
google.golang.org/genproto/googleapis/rpc v0.0.0-20260217215200-42d3e9bedb6d h1:t/LOSXPJ9R0B6fnZNyALBRfZBH0Uy0gT+uR+SJ6syqQ=
google.golang.org/genproto/googleapis/rpc v0.0.0-20260217215200-42d3e9bedb6d/go.mod h1:4Hqkh8ycfw05ld/3BWL7rJOSfebL2Q+DVDeRgYgxUU8=
google.golang.org/grpc v1.79.1 h1:zGhSi45ODB9/p3VAawt9a+O/MULLl9dpizzNNpq7flY=
google.golang.org/grpc v1.79.1/go.mod h1:KmT0Kjez+0dde/v2j9vzwoAScgEPx/Bw1CYChhHLrHQ=
google.golang.org/genproto/googleapis/api v0.0.0-20260401024825-9d38bb4040a9 h1:VPWxll4HlMw1Vs/qXtN7BvhZqsS9cdAittCNvVENElA=
google.golang.org/genproto/googleapis/api v0.0.0-20260401024825-9d38bb4040a9/go.mod h1:7QBABkRtR8z+TEnmXTqIqwJLlzrZKVfAUm7tY3yGv0M=
google.golang.org/genproto/googleapis/rpc v0.0.0-20260401024825-9d38bb4040a9 h1:m8qni9SQFH0tJc1X0vmnpw/0t+AImlSvp30sEupozUg=
google.golang.org/genproto/googleapis/rpc v0.0.0-20260401024825-9d38bb4040a9/go.mod h1:4Hqkh8ycfw05ld/3BWL7rJOSfebL2Q+DVDeRgYgxUU8=
google.golang.org/grpc v1.80.0 h1:Xr6m2WmWZLETvUNvIUmeD5OAagMw3FiKmMlTdViWsHM=
google.golang.org/grpc v1.80.0/go.mod h1:ho/dLnxwi3EDJA4Zghp7k2Ec1+c2jqup0bFkw07bwF4=
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=
google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM=
+28 -13
View File
@@ -12,6 +12,7 @@ import (
"github.com/luxfi/ids"
"github.com/luxfi/node/consensus/quasar"
"github.com/luxfi/node/genesis/builder"
nodevalidators "github.com/luxfi/validators"
)
// initQuasar creates and starts the Quasar hybrid finality engine.
@@ -34,16 +35,17 @@ func (n *Node) initQuasar() error {
return fmt.Errorf("quasar create: %w", err)
}
// Wire P-Chain provider — delivers validator state and finality events.
// This is a stub adapter returning only the local node as validator.
// Wire to PlatformVM's native finality subscription for production
// multi-validator consensus.
// Wire P-Chain provider — delivers validator state from PlatformVM's
// validator manager (n.vdrs is populated by initValidatorSets() from
// genesis + on-chain stakers). Finality events are emitted by
// PChainAcceptedSubscriber once block acceptance is wired; for now the
// channel exists but is not driven from outside (Run loop blocks on it).
provider := &pChainProvider{
nodeID: n.ID,
vdrs: n.vdrs,
finCh: make(chan quasar.FinalityEvent, 64),
}
q.ConnectPChain(provider)
n.Log.Warn("quasar using stub validator provider — wire to PlatformVM for production")
// Wire quantum fallback signer using the node's BLS key.
// Satisfies the Start() precondition (quantumFallback != nil).
@@ -65,22 +67,35 @@ func (n *Node) initQuasar() error {
return nil
}
// pChainProvider is a minimal PChainProvider adapter.
// Provides initial wiring for Quasar until PlatformVM exposes
// a native finality subscription.
// pChainProvider adapts the node's PlatformVM-backed validator manager to
// quasar.PChainProvider. GetValidators reads the live primary-network set
// (BLS pubkey + light/weight) so Quasar's t-of-n threshold tracks the real
// staker set as it changes. Finality events are pushed via finCh by the
// block-acceptance bridge (wired separately).
type pChainProvider struct {
nodeID ids.NodeID
vdrs nodevalidators.Manager
finCh chan quasar.FinalityEvent
}
func (p *pChainProvider) GetFinalizedHeight() uint64 { return 0 }
func (p *pChainProvider) GetValidators(_ uint64) ([]quasar.ValidatorState, error) {
return []quasar.ValidatorState{{
NodeID: p.nodeID,
Weight: 1,
Active: true,
}}, nil
if p.vdrs == nil {
return nil, fmt.Errorf("validator manager not initialized")
}
vmap := p.vdrs.GetMap(constants.PrimaryNetworkID)
out := make([]quasar.ValidatorState, 0, len(vmap))
for nodeID, v := range vmap {
// PublicKey is already serialized BLS bytes from validators.GetValidatorOutput.
out = append(out, quasar.ValidatorState{
NodeID: nodeID,
Weight: v.Weight,
BLSPubKey: v.PublicKey,
Active: true,
})
}
return out, nil
}
func (p *pChainProvider) SubscribeFinality() <-chan quasar.FinalityEvent {
+2 -1
View File
@@ -14,6 +14,7 @@ import (
"github.com/luxfi/chains/keyvm"
"github.com/luxfi/chains/oraclevm"
"github.com/luxfi/chains/quantumvm"
quantumvmconfig "github.com/luxfi/chains/quantumvm/config"
"github.com/luxfi/chains/relayvm"
"github.com/luxfi/chains/thresholdvm"
"github.com/luxfi/chains/zkvm"
@@ -39,7 +40,7 @@ func (n *Node) registerOptionalVMs() error {
{"IdentityVM (I-Chain)", identityvm.VMID, &identityvm.Factory{}},
{"KeyVM (K-Chain)", keyvm.VMID, &keyvm.Factory{}},
{"OracleVM (O-Chain)", oraclevm.VMID, &oraclevm.Factory{}},
{"QuantumVM (Q-Chain)", quantumvm.VMID, &quantumvm.Factory{}},
{"QuantumVM (Q-Chain)", quantumvm.VMID, &quantumvm.Factory{Config: quantumvmconfig.DefaultConfig()}},
{"RelayVM (R-Chain)", relayvm.VMID, &relayvm.Factory{}},
{"ThresholdVM (T-Chain)", thresholdvm.VMID, &thresholdvm.Factory{}},
{"ZKVM (Z-Chain)", zkvm.VMID, &zkvm.Factory{}},
-13
View File
@@ -4,19 +4,6 @@ github.com/luxfi/node/database=Batch=database/mock_batch.go
github.com/luxfi/node/database=Iterator=database/mock_iterator.go
github.com/luxfi/node/message=OutboundMessage=message/mock_message.go
github.com/luxfi/node/message=OutboundMsgBuilder=message/mock_outbound_message_builder.go
github.com/luxfi/node/consensus/consensus/linear=Block=consensus/consensus/linear/lineartest/mock_block.go
github.com/luxfi/node/consensus/engine/dag/vertex=LinearizableVM=consensus/engine/dag/vertex/mock_vm.go
github.com/luxfi/node/consensus/engine/linear/block=BuildBlockWithRuntimeChainVM=consensus/engine/linear/block/mock_build_block_with_context_vm.go
github.com/luxfi/node/consensus/engine/linear/block=ChainVM=consensus/engine/linear/block/mock_chain_vm.go
github.com/luxfi/node/consensus/engine/linear/block=StateSyncableVM=consensus/engine/linear/block/mock_state_syncable_vm.go
github.com/luxfi/node/consensus/engine/linear/block=WithVerifyRuntime=consensus/engine/linear/block/mock_with_verify_context.go
github.com/luxfi/node/consensus/networking/handler=Handler=consensus/networking/handler/mock_handler.go
github.com/luxfi/node/consensus/networking/timeout=Manager=consensus/networking/timeout/mock_manager.go
github.com/luxfi/node/consensus/networking/tracker=Targeter=consensus/networking/tracker/mock_targeter.go
github.com/luxfi/node/consensus/networking/tracker=Tracker=consensus/networking/tracker/mock_resource_tracker.go
github.com/luxfi/node/consensus/uptime=Calculator=consensus/uptime/mock_calculator.go
github.com/luxfi/node/consensus/validators=State=consensus/validators/mock_state.go
github.com/luxfi/node/consensus/validators=NetConnector=consensus/validators/mock_chain_connector.go
github.com/luxfi/node/utils/filesystem=Reader=utils/filesystem/mock_io.go
github.com/luxfi/node/utils/hashing=Hasher=utils/hashing/mock_hasher.go
github.com/luxfi/node/utils/resource=User=utils/resource/mock_user.go
+11
View File
@@ -76,6 +76,13 @@ type Parameters struct {
TxFee uint64
CreateAssetTxFee uint64
// Consensus is the consensus configuration snapshot for this node. The
// node binary populates it at boot from the live engine state so the
// info.getNodeVersion handler can return it without round-tripping
// into the chain manager. Nil means "do not advertise" (pre-wired
// callers, tests).
Consensus *apiinfo.ConsensusInfo
}
func NewService(
@@ -152,6 +159,10 @@ func (i *Info) GetNodeVersion(_ *http.Request, _ *struct{}, reply *apiinfo.GetNo
reply.RPCProtocolVersion = apitypes.Uint32(version.RPCChainVMProtocol)
reply.GitCommit = version.GitCommit
reply.VMVersions = map[string]string{}
if i.Consensus != nil {
c := *i.Consensus
reply.Consensus = &c
}
return nil
}
+58
View File
@@ -4,6 +4,7 @@
package info
import (
"encoding/json"
"errors"
"net/http/httptest"
"testing"
@@ -14,6 +15,7 @@ import (
apiinfo "github.com/luxfi/api/info"
"github.com/luxfi/ids"
"github.com/luxfi/log"
"github.com/luxfi/node/version"
"github.com/luxfi/node/vms/vmsmock"
)
@@ -38,6 +40,62 @@ func initGetVMsTest(t *testing.T) *getVMsTest {
}
}
// TestGetNodeVersionConsensusRoundtrip verifies the consensus subobject is
// surfaced via info.getNodeVersion when wired through Parameters and is
// omitted entirely (omitempty) when left unset.
func TestGetNodeVersionConsensusRoundtrip(t *testing.T) {
require := require.New(t)
consensus := &apiinfo.ConsensusInfo{
Mode: "triple",
BLS: true,
Corona: true,
MLDSA: true,
PlatformVM: true,
}
app := &version.Application{Name: "lux", Major: 1, Minor: 0, Patch: 0}
info := &Info{
Parameters: Parameters{
Version: app,
Consensus: consensus,
},
log: log.NewNoOpLogger(),
}
req := httptest.NewRequest("POST", "/ext/info", nil)
reply := apiinfo.GetNodeVersionReply{}
require.NoError(info.GetNodeVersion(req, nil, &reply))
require.NotNil(reply.Consensus)
require.Equal(*consensus, *reply.Consensus)
// Mutating the reply value must not bleed back into Parameters — confirms
// the handler returns a copy, not a shared pointer.
reply.Consensus.Mode = "classical"
require.Equal("triple", info.Consensus.Mode)
// JSON omitempty: when Consensus is unset, it must not appear in the
// serialised reply at all (legacy clients ignore it; new clients can
// detect "not advertised" vs "classical" mode).
bare := &Info{
Parameters: Parameters{Version: app},
log: log.NewNoOpLogger(),
}
bareReply := apiinfo.GetNodeVersionReply{}
require.NoError(bare.GetNodeVersion(req, nil, &bareReply))
require.Nil(bareReply.Consensus)
encoded, err := json.Marshal(bareReply)
require.NoError(err)
require.NotContains(string(encoded), "consensus")
encoded, err = json.Marshal(reply)
require.NoError(err)
require.Contains(string(encoded), `"consensus"`)
require.Contains(string(encoded), `"mode":"classical"`)
}
// Tests GetVMs in the happy-case
func TestGetVMsSuccess(t *testing.T) {
require := require.New(t)