Compare commits

...
227 Commits
Author SHA1 Message Date
Hanzo AI 8a0d837c81 Dockerfile: bump EVM plugin v0.18.18 → v0.19.0 (Quasar Edition)
Quasar Edition rip — one and only one upgrade-key namespace:
 - luxfi/evm v0.19.0 renames EtnaTimestamp → QuasarTimestamp
   (Go field + json tag)
 - Strict json.Decoder DisallowUnknownFields on upgradeBytes parse
   in plugin/evm/vm.go — any stale etnaTimestamp in a deployed
   upgrade.json now fails parse loudly at boot rather than silently
   leaving the fork field nil and disabling activation.

Pairs with: luxfi/genesis kill-etna sweep (configs/*/upgrade.json
and brand L1 EVM genesis.json scrubbed).
2026-06-03 11:52:37 -07:00
Hanzo AI 3846839602 LP-023 batch 5 v3.8: Blue r6 V2+V3+V4 — AST audit gate, executor Owner.Verify, BLS zero-scan
V2 CRITICAL — Audit gate AST-based, not textual
================================================

The 3 audit gate tests in vms/platformvm/txs/zap_native/audit_test.go
previously used strings.Contains(body, "SyntacticVerify" | "MustVerify").
That heuristic is defeated by:

  - // SyntacticVerify  — comment-only mention
  - _ = "SyntacticVerify"  — string literal mention
  - empty Verify() body — body string contains nothing but matches "anywhere"

Replaced with go/parser AST walk:

  - astParseFile()         — parser.ParseFile + token.NewFileSet
  - findMethod()           — locate FuncDecl by receiver type + method name
  - hasSelectorCall()      — ast.Inspect for *ast.CallExpr whose Fun is
                             either *ast.SelectorExpr.Sel.Name == "X" or
                             *ast.Ident.Name == "X"
  - collectMethodsOnFiles()— enumerate embedders via FuncDecl predicate
  - returnsOwnerTuple()    — match (uint32, uint64, ids.ShortID) shape
  - returnsTypeName()      — match single-return-value type name

Tests covered:
  - TestAuditGate_OwnerBearingTxCallsSyntacticVerify    — rewritten
  - TestAuditGate_ChainsListEmbeddersCallMustVerify     — rewritten
  - TestAuditGate_ValidatorsListEmbeddersCallMustVerify — rewritten

Positive walker tests added (4 — close the bypass surface):
  - TestAuditGate_ASTWalkerRejects_CommentOnly
  - TestAuditGate_ASTWalkerRejects_StringLiteral
  - TestAuditGate_ASTWalkerRejects_EmptyBody
  - TestAuditGate_ASTWalkerAccepts_RealCall

V3 HIGH — Legacy fx.Owner accessors outside scope
=================================================

Extend the audit gate to cover Owner-consuming callsites in:

  - vms/platformvm/txs/executor/proposal_tx_executor.go (lines 303, 340, 429)
  - vms/platformvm/service.go (lines 748-755)

These read fx.Owner from a tx accessor and either pass it to
backend.Fx.CreateOutput or cache it on stakerAttributes without an
explicit executor-side Verifiable gate. Inserted inline .Verify() guard
at each callsite (5 sites total) — the gate is fx.Owner.Verify() because
fx.Owner is verify.Verifiable.

New audit gate: TestAuditGate_OwnerConsumersInExecutorAndService walks
each consumer's AST and confirms a .Verify() call site exists. The
audit is structural — it pins the invariant so a future edit cannot
silently drop the gate.

V4 HIGH — BLS field allocation amplification
=============================================

validators_list.go::MustVerify previously read BLSPubKey() + BLSPoP()
per validator. Each accessor allocates a fresh []byte (48B+96B). At
N=1024 with valid BLS fields, the structural floor walk allocated
~147KB BEFORE reaching the rejection-trigger field — pure waste.

Added zero-scan accessors on ValidatorRecord:

  - IsBLSPubKeyZero() — walks 48B field byte-by-byte via Object.Uint8,
                        short-circuits on first non-zero, 0 allocs
  - IsBLSPoPZero()    — same for 96B PoP field

Updated MustVerify to use the zero-scan path. Allocating BLSPubKey() /
BLSPoP() are RETAINED for the BLS pairing path in tx_verify.go where
the verifier requires a copy — only MustVerify's structural floor walk
uses the zero-scan accessors.

Bench (N=1024, worst case — walk all entries to reject on last entry's
expiry):

  Before (legacy bytes.Equal path): 112,384 ns/op  ~147 KB copied
  After  (V4 zero-scan path):         3,381 ns/op  ~200 B
  ~33× faster, ~735× less data copied per call.

  Optimized escape analysis collapses both to 3 allocs/op (rejection
  fmt.Errorf chain); the wall-clock delta is the byte-by-byte copy
  in the allocating accessors.

Files modified
==============
  vms/platformvm/service.go                          | +33 -8
  vms/platformvm/txs/executor/proposal_tx_executor.go| +19
  vms/platformvm/txs/zap_native/audit_test.go        | full rewrite
  vms/platformvm/txs/zap_native/validators_list.go   | +49 -10
  vms/platformvm/txs/zap_native/validators_list_bench_test.go | new

Self-audit: highest-risk remaining attack surface for Red round 7
=================================================================

The V3 audit gate confirms a .Verify() call site EXISTS in each
consumer's AST — but does not confirm the call site is REACHED on
every code path that consumes Owner. A future edit could move the
.Verify() into a conditionally-skipped branch (e.g. cached path) and
the gate would still pass. The structural invariant the gate enforces
is "the gate is wired somewhere"; reachability is a deeper property.

Red round 7 candidate: extend TestAuditGate_OwnerConsumersInExecutorAndService
to walk the control-flow graph and confirm every BBlock that READS
the Owner also dominates a .Verify() block. Today the gate is best-effort
structural — the dominance check is the next hardening level.

Tests
=====

  go test ./vms/platformvm/txs/zap_native/      — PASS (all 9 audit
                                                  gates + walker
                                                  positive/negative)
  go test ./vms/platformvm/txs/executor/        — PASS
  go test -bench=BenchmarkValidatorsList_MustVerify_AllZeroN1024 — surfaced
  go build ./...                                 — clean

LP-023 batch 5 v3.8 closes V2 (CRITICAL), V3 (HIGH), V4 (HIGH).
V5/V6 are explicitly deferred per Red round 6 r6 brief.
2026-06-03 01:07:10 -07:00
Hanzo AI c83ccad39a audits: RED LP-023 round 6 v2 — V1 retracted on re-verification, V2-V8 stand
Re-dispatch re-verified the actual 5ec74286f4 commit byte-level:

- V1 (TransferChainOwnershipTx.Verify regression) RETRACTED. The
  prior round 6 author was inspecting a working-tree probe that
  mutated tx_verify.go locally to inject `_ = "SyntacticVerify"` as
  a PoC for V2. The actual v3.7 commit ships the correctly-gated
  Verify body (`stubFromTuple(...).SyntacticVerify()`). The PoC
  remains a valid demonstration of V2's textual-gate weakness.

- V2 (textual audit gate fooled by string-literal token) STANDS.
  audit_test.go:359 and the YAML mirror use strings.Contains over
  the brace-bounded Verify body — defeated by string literals,
  comments, dead-code branches, name-shadow tricks. AST-based
  audit (go/parser + go/ast walk for *ast.CallExpr matching
  Sel.Name == "SyntacticVerify") is the only correct closure.

- V3 (legacy fx.Owner consumers in proposal_tx_executor.go +
  service.go), V4 (BLS alloc amplification 144 KB/MustVerify at
  N=1024), V5 (no block-level cap), V6 (admission-gate parse-and-
  rewrap inefficiency), V7 (ATTACK PROBE comment) UNCHANGED.

Verdict updated DO-NOT-SHIP → FIX-THEN-SHIP. Top 3 priorities for
Blue: V2 (audit gate AST migration), V3 (legacy Owner consumers),
V4 (BLS alloc).
2026-06-02 22:54:02 -07:00
Hanzo AI e2640fb373 audits: RED LP-023 round 6 — adversarial review of v3.7 (5ec74286f4)
Verdict: do-not-ship.

Top findings:
- V1 CRITICAL: TransferChainOwnershipTx.Verify regressed to no-op
  with explicit "ATTACK PROBE V3" comment; R6V8 gate undone,
  package tests fail at HEAD.
- V2 CRITICAL: SyntacticVerify/MustVerify audit gates fooled by
  string-literal token; meta-attack proven by V1.
- V3 HIGH: legacy fx.Owner consumers in proposal_tx_executor.go
  and service.go out of audit gate scope.
- V4 HIGH: BLSPubKey/BLSPoP copy-out allocates ~144KB per
  MustVerify at N=1024 (Blue self-audit V1, not fixed).
- V5 MEDIUM: no block-level validator/chain cap (self-audit V2).
- V6 MEDIUM: admission gate triple-wrap reparses kind.
- V7 LOW: ATTACK PROBE comment ships in production source.
- V8 INFO: ListStride uint64 product safe — closed.
2026-06-02 22:45:46 -07:00
Hanzo AI 5ec74286f4 #189: LP-023 batch 5 v3.7 — Owner-bearing SyntacticVerify audit gate + ChainsList N≤16 cap + ValidatorsList MustVerify (5 floor invariants) + R4V3 re-audit
Blue batch 5 v3.7 closes the 5 target gaps from Red round 5 follow-up:

1. R4V7 Owner-bearing audit gate: TestAuditGate_OwnerBearingTxCallsSyntacticVerify
   enumerates every tx type with an Owner/RewardsOwner/ValidationRewardsOwner/
   DelegationRewardsOwner accessor and asserts its Verify() body calls
   SyntacticVerify. CI mirror: owner-bearing-syntacticverify-gate job
   in .github/workflows/zap-audit.yml. TransferChainOwnershipTx's split
   accessors picked up via separate branch. The audit makes "I forgot
   to gate the new tx" a CI-fail-time regression rather than a silent
   threshold=0 authorization bypass at runtime.

2. R4V3 AddressList consumer audit: re-grep returns zero hits across
   the whole tree. Documented inline at tx_verify.go header with the
   reproducer grep. No regressions since batch 5 v3.5.

3. ChainsList MaxChainsPerL1 = 16: hard cap enforced in
   ChainsListView.MustVerify. New ErrTooManyChains typed error.
   Matches the multi-chain L1 spawn use case (P + X + EVM + small
   application stack) plus headroom; prevents a hostile encoder
   from forcing the executor through quadratic walk at admission.
   Coverage: TestChainsList_MustVerify_RejectsOverCap +
   TestChainsList_MustVerify_AcceptsAtCap.

4. ValidatorsList MustVerify (5 floor invariants):
   - Len() <= MaxValidatorsPerL1 (1024): cap matches practical
     upper bound on initial-validator sets.
   - Weight > 0: lifts the per-validator gate from tx_verify.go
     onto the list-level MustVerify so it's grep-able and pure
     orchestration on the tx side.
   - BLSPubKey not all-zero: structural floor before R6V3 pairing.
   - BLSPoP not all-zero: structural floor before R6V3 pairing.
   - RegistrationExpiry > 0: parallel of ErrZeroExpiry on
     RegisterL1ValidatorTx (unix timestamp can never be zero).
   New typed errors: ErrTooManyValidators, ErrValidatorBLSPubKeyZero,
   ErrValidatorBLSPoPZero, ErrValidatorRegistrationExpiryZero. Wired
   into CreateSovereignL1Tx.Verify and ConvertNetworkToL1Tx.Verify
   before the expensive BLS pairing walk so cheap structural floor
   fires first. New audit gate (test + CI):
   TestAuditGate_ValidatorsListEmbeddersCallMustVerify + workflow
   job validatorslist-mustverify-gate. Coverage: 6 new MustVerify
   tests (happy path + 5 floor-violation rejections + over-cap).

5. Bench refresh -benchtime=2s (M1 Max):
   - Parse geomean (n=9): 7.50× vs v3.6 7.74× — within 4% noise.
   - Build geomean (n=9): 1.03× vs v3.6 1.12× — within 9% noise.
   - Allocs/op unchanged: Parse 1/24, Build 2 (down from 4-7).
   - No regression > 5%. v3.7 changes fire entirely on the Verify()
     path; Parse and Build are structurally untouched.
   Full numbers in vms/platformvm/txs/bench_results/RESULTS.md.

All 4 audit gates pass locally:
  - TestAuditGate_AddressListNoProductionConsumers
  - TestAuditGate_ChainsListEmbeddersCallMustVerify
  - TestAuditGate_ValidatorsListEmbeddersCallMustVerify (NEW)
  - TestAuditGate_OwnerBearingTxCallsSyntacticVerify (NEW)

Full zap_native test suite: 0.715s, all green.
2026-06-02 22:14:52 -07:00
Hanzo AI 83959735b3 wallet/chain/p: LUX_WALLET_UTXO_ASSET_ID_OVERRIDE for legacy LUX asset on mainnet
Adds an opt-in escape hatch that pins the fee-payment asset to a
specific 32-byte asset ID, bypassing platform.getStakingAssetID. Use on
networks where the live staking asset differs from the legacy LUX asset
on existing P-chain UTXOs.

lux-mainnet today is the documented case: staking ==
pmSJ7BfZQfwtUGbamLWSLFLFGnocfMfbriDTsYWxi4qnqFrrT but the historical
deployer's UTXOs hold HrJCm4yvNmyPDA1PEqwks9iFFmoRJEsLJj36N1xtkffrqpL6p.
Without the override the wallet's `utxoAssetID` matches the staking-asset
result and `platform.getBalance` returns 0 for the legacy UTXOs — the
wallet can't find them as fee-payment material.

NOTE: this addresses the wallet-side identification only. The P-chain
fee-execution rule still requires the staking asset on mainnet; a
follow-up legacy-to-staking asset migration tx is needed before
CreateNetworkTx + CreateChainTx will go through on mainnet. Tracked as
the 2026-06-03 mainnet brand L2 re-fire blocker.

Empty / unset is a no-op. Tested via bootstrap-chain mainnet dry-run
(2026-06-03): override correctly switches the wallet to legacy-LUX
UTXOs; CreateNetworkTx then fails with "insufficient unlocked funds"
because the fee verifier checks pmSJ7BfZ... balance — which is the
expected second-half blocker.
2026-06-02 20:29:51 -07:00
Hanzo AI c623c4c426 platformvm/txs/bench: LP-023 always-on — fix disable_legacy_test underflow
ZAPActivationUnix is now 0 (LP-023 cutover, 2026-06-02). The assertion
`ShouldUseZAPForWrite(ZAPActivationUnix - 1)` underflows uint64 to
math.MaxUint64; with ZAPActivationUnix=0 the LegacyEnabled path
degenerates to `ts >= 0` which is true for every input, so the prior
"pre-activation picks legacy" assertion can never hold.

Rewrite runEnableLegacyChild to mirror zap_native.security_test.V15
closure: probe a timestamp spread including the historical
forward-date (1782604800) and assert ShouldUseZAPForWrite=true
unconditionally. Pins the always-on invariant on the bench surface
too.

No production code change.
2026-06-02 19:59:17 -07:00
Hanzo AI 292a9a5ffa #189: LP-023 batch 5 v3.6 — R7V5 mempool admission gate for zap_native (Path A) + R7V7 Verify() for RegisterL1ValidatorTx + ConvertNetworkToL1Tx (HIGH) + R7V8 MustVerify rename + CI gate (MEDIUM)
Red round 7 closes the activation gap so Neo's ZAPActivationUnix=0 image can
land without zombie txs from not-yet-implemented zap_native executors.

R7V5 (HIGH, mempool admission gate — Path A)
  - vms/platformvm/network/zap_native_admission.go: new file. Wraps
    TxVerifier with NewZapNativeAdmissionGate; refuses
    *txs.CreateSovereignL1Tx (legacy struct dispatch hits stub at
    standard_tx_executor.go:636) AND any ZAP-magic wire buffer whose
    kind is CreateSovereignL1 (23), RegisterL1Validator (7), or
    ConvertNetworkToL1 (22).
  - vms/platformvm/network/network.go: New() now wraps the supplied
    TxVerifier with the gate before installing into gossipMempool, so
    every inbound tx routes through the gate first.
  - Typed error ErrZapNativeNotYetExecutable for errors.Is matching.
  - REMOVAL CHECKLIST documented inline so a future Blue knows to
    delete the gate entry when an executor body lands.
  - Tests in zap_native_admission_test.go: rejects legacy
    CreateSovereignL1Tx; passes through legacy BaseTx /
    RegisterL1ValidatorTx / ConvertNetworkToL1Tx (the working ones);
    rejects ZAP-wire CreateSovereignL1 / RegisterL1Validator /
    ConvertNetworkToL1; non-ZAP bytes pass; nil-safety.

R7V7 (HIGH, Verify() for two missing tx types)
  - RegisterL1ValidatorTx.Verify(): BLS PoP pairing + zero-Expiry gate
    (ErrZeroExpiry). RemainingBalanceOwnerID treated as optional v3
    placeholder.
  - ConvertNetworkToL1Tx.Verify(): same per-validator walk as
    CreateSovereignL1Tx (non-empty Validators, Weight>0, BLS PoP
    pairing).
  - Tests in r7v7_register_convert_verify_test.go: rejects bad BLS
    PoP / malformed BLS pubkey / zero Expiry / zero Validators / zero
    Weight; accepts valid; adversarial wire-buffer tampering for both
    tx types (zero out Expiry / Weight in-place and re-Wrap).

R7V8 (MEDIUM, MustVerify rename + CI gate)
  - chains_list.go: ChainsListView.Verify renamed to MustVerify so
    the per-list gate is grep-able from CI. The previous Verify()
    name collided with the tx-level Verify() convention.
  - tx_verify.go: CreateSovereignL1Tx.Verify call site updated.
  - r6_verify_test.go: TestChainsListView_Verify_StandaloneEntries
    renamed + updated to use .MustVerify().
  - audit_test.go: new TestAuditGate_ChainsListEmbeddersCallMustVerify
    enumerates tx types with a Chains() accessor returning ChainsList
    and confirms tx_verify.go has a corresponding Verify() body that
    calls .MustVerify().
  - .github/workflows/zap-audit.yml: new chainslist-verify-gate job
    mirroring the local audit_test.go invariant.

Test results (GOWORK=off, race enabled):
  ./vms/platformvm/network/...     PASS  (8 new + all existing)
  ./vms/platformvm/txs/zap_native/ PASS  (8 new + all existing)
  ./vms/platformvm/txs/executor/   PASS
  ./vms/platformvm/txs/             PASS
  ./vms/platformvm/block/...        PASS
2026-06-02 19:28:40 -07:00
Hanzo AI 7f792249a6 #189: LP-023 batch 5 v3.5 — RESERVED bytes zero-gate (R6-4) + AddressList CI audit gate (R6-6) + cross-blob aliasing documented contract (R6-2 design decision)
R6-4 (RESERVED zero-gate)
  - ChainEntry RESERVED bytes [56..64) gated by ChainsListView.Verify.
  - New OffsetChainEntry_Reserved=56 constant + ErrReservedNonZero typed err.
  - Writer already zero-pads; gate prevents adversary smuggling state inside
    what consensus considers empty. Pins the upgrade-safe invariant before
    any v4 parser attaches meaning to those bytes (no silent wire-fork).
  - Tests: TestChainsList_Verify_RejectsNonZeroReserved (per-byte sweep of
    all 8 reserved bytes, each flipped individually -> all reject),
    TestChainsList_Verify_RejectsNonZeroReserved_TopByte (top byte 0x01).

R6-6 (AddressList.At CI audit gate)
  - .github/workflows/zap-audit.yml: grep-based gate on PR + push to
    main/dev. Fails if any new production caller of AddressList.At()
    appears outside the allowlist (_test.go, tx_verify.go, owner.go,
    audit_test.go).
  - vms/platformvm/txs/zap_native/audit_test.go: local mirror so
    `go test ./vms/platformvm/txs/zap_native/` reproduces CI behavior.
    Verified locally: clean -> PASS; injected violator -> trips correctly.

R6-2 (cross-blob aliasing design decision)
  - Documented-allowance path: aliasing is ALLOWED. Wire layer must not
    reject overlapping (rel, len) ranges; identity is (VMID, BlockchainID),
    not Name() bytes.
  - Full CONTRACT block on ChainsListView: (1) Name/FxIDs/GenesisData
    return payload slices not identity, (2) chain identity is VMID +
    BlockchainID, (3) consumers MUST NOT use returned bytes as dedup keys,
    (4) returned slices are read-only.
  - Forward path documented: if future feature requires non-overlap, add
    ChainsListView.VerifyNonOverlappingRanges() and wire it from tx.Verify.
  - Test: TestChainsList_AllowsOverlappingRanges_DocumentedContract -
    patches chain[1].NameRel to alias chain[0]'s slice, proves Verify
    accepts AND Name(0) == Name(1) byte-equal, AND VMID(0) != VMID(1).

go test -race ./vms/platformvm/txs/zap_native/...: ok 1.4s
Builds on top of v3 commit 51bd46dd00.
2026-06-02 19:11:48 -07:00
Hanzo AI 51bd46dd00 #189: LP-023 batch 5 v3 — wire Verify() gate for R6V4 (CreateSovereignL1Tx zero-validator/zero-chain CRITICAL) + R6V8 (TransferChainOwnershipTx HIGH) + R6V3 (BLS PoP verification HIGH) + R6V5 (FxIDs malformed length MEDIUM)
R6V4 (CRITICAL): CreateSovereignL1Tx.Verify now rejects zero-validator and
zero-chain wire buffers (both halt consensus at activation). Per-validator
Weight > 0 walk also fires here. RegistrationExpiry remains an executor
clock concern (deferred to staking handler, documented).

R6V8 (HIGH): TransferChainOwnershipTx had no Verify() despite carrying
Owner fields. Wired in: reconstructs OwnerStub from the (threshold,
locktime, address) tuple and calls SyntacticVerify. Tx count with
SyntacticVerify wired into 8 tx types (was 7).

R6V3 (HIGH): BLS PoP now verified at the SyntacticVerify boundary for
every initial validator. Wire-layer opaque 48B BLSPubKey + 96B BLSPoP
now pairing-checked via bls.VerifyProofOfPossession with new ErrBadBLSPoP.
Closes the zero-downstream-consumer gap Red grep found.

R6V5 (MEDIUM): ChainsListView.Verify walks entries and rejects any
FxIDsLen that is not a multiple of FxIDSize. Replaces the silent-nil
return path in BoundChainEntry.FxIDs with a typed error. Wired into
CreateSovereignL1Tx.Verify via ChainsListView.Verify().

Tests (all under go test -race):
  TestCreateSovereignL1Tx_Verify_RejectsZeroValidators
  TestCreateSovereignL1Tx_Verify_RejectsZeroChains
  TestCreateSovereignL1Tx_Verify_RejectsZeroWeight
  TestCreateSovereignL1Tx_Verify_RejectsBadBLSPoP
  TestCreateSovereignL1Tx_Verify_RejectsBadBLSPoP_MismatchedPubKey
  TestCreateSovereignL1Tx_Verify_AdversarialWireBuffer_ValidatorWeight
  TestChainsList_Verify_RejectsBadFxIDsLen (adversarial wire buffer)
  TestChainsListView_Verify_StandaloneEntries
  TestTransferChainOwnershipTx_Verify_RejectsZeroThreshold
  TestTransferChainOwnershipTx_Verify_RejectsThresholdAboveOne
  TestTransferChainOwnershipTx_Verify_AdversarialWireBuffer
  TestBLSSurfaceReachable

Updates TestVerify_AcceptsWellFormed/CreateSovereignL1 to supply a
properly-constructed validator (real BLS PoP) and a chain entry so the
new gates fire green on the legitimate path. Adds
TestVerify_AcceptsWellFormed/TransferChainOwnership subtest for R6V8.

New typed errors:
  ErrZeroValidators, ErrZeroChains, ErrValidatorWeightZero,
  ErrBadBLSPoP, ErrMalformedFxIDsLen.

Bench unchanged (Verify is on executor path, parse benches structurally
untouched). Full zap_native suite green under -race.

LP-023 batch 5 v3 closes Red round 6 V3/V4/V5/V8.
2026-06-02 19:04:07 -07:00
Hanzo AI 56200f2d8e platformvm/txs/zap_native: LP-023 ZAP-native activation cutover — ZAPActivationUnix=0 (always-on)
ZAP wire is now mandatory from genesis. The forward-dated 2026-07-01
(1782604800) cutover is dead — replaced with always-on semantics. New
deployments, fresh syncs, and all production binaries from v1.28.19
onward are ZAP-only by construction.

The legacy linearcodec is reachable only via the explicit dev knob
LUXD_ENABLE_LEGACY_CODEC=1, and only for the read path (decoding
pre-2026-06-02 archival linearcodec bytes from disk). On the write
path, LegacyEnabled has no semantic effect once activation = 0 — the
"pre-activation" window is empty, so every block timestamp satisfies
blockTimestamp >= 0 and writes are always ZAP.

Tests:
- TestZAPActivationUnixIsAlwaysOn pins the constant to 0 so any
  regression that re-introduces a forward-date guard fails this gate.
- TestShouldUseZAPForWrite legacy-enabled subtest asserts ZAP for
  every timestamp (replaces the previous pre/at/post-activation
  table that depended on a non-zero gate).
- TestRed_V15_PreActivationZAPTxRejection updated to reflect that
  V15's threat model (legacy cutover-window fork) is no longer
  applicable; the test now asserts the always-on invariant.

Authorized by 2026-06-02 destructive recovery sweep — "just do it
right; no half-measures, no legacy compatibility, clean slate."
2026-06-02 19:00:18 -07:00
Hanzo AI 25ecd21574 platformvm/txs/zap_native: LP-023 batch 5 Phase C+D+E — ChainsList + ValidatorsList + bench refresh
Phase C — Multi-chain CreateSovereignL1 ChainsList primitive (chains_list.go,
chains_list_test.go):

  * 64-byte fixed-stride ChainEntry per chain: (NameRel/Len uint32, VMID 32B,
    FxIDsRel/Len uint32, GenesisDataRel/Len uint32, Reserved 8B).
  * Three sibling blob arrays (NameBlobs, FxIDsBlobs, GenesisDataBlobs)
    carried as parent-tx fields; entry header stores (rel, len) cursors.
  * Bind(nameBlobs, fxIDsBlobs, genesisDataBlobs) compile-time gate
    mirroring BoundEvidenceList (NEW-V2): ChainsListView lacks safe
    Name/FxIDs/GenesisData accessors so consumers cannot bypass Bind() by
    accident. Only BoundChainEntry exposes the safe accessors.
  * IsNull() zero-value guard on ChainEntry: out-of-range At(i) returns
    a ChainEntry{} whose accessors short-circuit to zero rather than
    nil-deref the underlying zap.Object's msg. Defense-in-depth atop the
    defensive At(i) clamp.
  * Per-element FxIDs blob is a length-prefixed byte array; entry count =
    FxIDsLen / FxIDSize (32B per ids.ID). Non-multiple lengths clamp to nil.
  * CreateSovereignL1Tx grows from a single-chain stub (TxKind 23, batch 4)
    to a real multi-chain L1 builder: ChainsList + NameBlobs + FxIDsBlobs +
    GenesisDataBlobs fields. Size 193 bytes (was 121).

Phase D — ValidatorsList encoding (validators_list.go,
validators_list_test.go):

  * 180-byte fixed-stride ValidatorRecord per initial validator: NodeID 20B
    + Weight uint64 + BLSPubKey 48B + BLSPoP 96B + RegistrationExpiry uint64.
  * Uses zap.Object.ListStride from v0.7.2 — per-element clamp against
    poisoned wire length fields (R4V9).
  * No sibling arrays needed — every field is fixed-size.
  * BLSPubKey() and BLSPoP() return COPIED slices (not aliased to parent
    buffer) so consumer mutation cannot corrupt subsequent reads.
  * IsNull() zero-value guard mirroring ChainEntry.
  * ConvertNetworkToL1Tx now carries the real ValidatorsList — the
    previous (0, 0) stub is gone. Size still 165 bytes (the validators
    list pointer was already provisioned).
  * CreateSovereignL1Tx integrates ValidatorsList alongside ChainsList for
    the full atomic sovereign-L1 commit shape.

Phase E — Bench refresh:

  * M1 Max Parse geomean across 10 measurable tx types post-batch-5:
    7.44× at -benchtime=2s -count=3 (medians).
  * Restricted to the original 9 tx types from the v0.7.2 baseline:
    7.74×, within noise of the 7.71× pre-batch-5 number.
  * R4V7 SyntacticVerify lives on the executor Verify() path (not the
    wire parser), so the parse benchmarks are structurally unchanged.
  * ChainsList + ValidatorsList add new primitives but do not appear in
    the legacy comparison fixtures.

Test coverage:

  * chains_list_test.go: RoundTrip (3 chains incl. empty FxIDs+empty
    GenesisData), EmptyList, OutOfRange, UnboundReturnsRawCursors,
    BindMismatchedBlobsClampsSafely, FxIDsNonMultipleClampsToNil.
  * validators_list_test.go: RoundTrip (2 validators), EmptyList,
    OutOfRange, PoisonedLengthClampedByStride,
    BLSFieldsAreReadOnly (mutation isolation),
    CreateSovereignL1Integration (ChainsList + ValidatorsList together).
  * batch4_tx_test.go: updated CreateSovereignL1TxRoundTrip for the new
    multi-chain + validators shape; tests both round-trip and Wrap()
    re-parse correctness.

All zap_native tests pass under go test -race.

Coordinates with cryptographer #114 v3 work and CTO bootstrap-chain work;
neither genesis/ nor bootstrap touched.

LP-023 batch 5 Phase C+D+E.
2026-06-02 18:47:37 -07:00
Hanzo AI 6eabb2660e platformvm/txs/zap_native: close R4V3 AddressList honest-overcount gap (LP-023 batch 5 Phase B)
R4V3 finding: a malicious wire-encoded AddressList may report Len() >
actual entry count (the ListStride per-element clamp accepts the honest
overcount as long as length*stride fits the remaining buffer). At(i)
for i >= actual_count returns whatever bytes occupy the post-list
region in the buffer — often zero-padding, sometimes adjacent buffer
content.

Audit result: AddressList has ZERO production consumers in the
executor today (the executor still uses secp256k1fx.OutputOwners +
message.PChainOwner via the legacy codec). The new primitive is
shipping ahead of the executor migration, so the discipline is
forward-looking. Audited grep `\.At(|AddressList` across
~/work/lux/node — every match is internal to the zap_native package
or test code.

Defense path (canonical):
  - Owner.SyntacticVerify() now walks the list and rejects any zero
    ShortID with ErrOwnerAddrZero. This closes the zero-phantom
    bypass at the gate.
  - Documented consumer-safety contract on AddressList type docstring
    AND on .Len()/.At() — three paths: non-zero check at call site,
    sibling-count correlation, or canonical SyntacticVerify boundary
    (path 3 is the one-and-only-one way).

Test scope:
  - r4v3_addresslist_test.go — overcount construction with the wire
    layer (claim 5, real 4, 1-phantom); confirms SyntacticVerify
    rejects the zero-phantom case and accepts the buffer-garbage
    case (signature validation downstream closes the remaining
    surface in the garbage path — no zero co-signer can sneak
    through the quorum gate).
  - Honest-list happy path also pinned.

Tradeoffs:
  - SyntacticVerify is now O(Len()) per Owner instead of O(1). For
    typical owners (1-5 addresses) this is negligible; the gate is
    the authorization boundary and bears the cost.
2026-06-02 16:23:05 -07:00
Hanzo AI a14f42eb05 platformvm/txs/zap_native: R4V7 Owner SyntacticVerify + per-tx Verify (LP-023 batch 5 Phase A)
Wire layer (zap_native parser) is permissive by design — it confirms
TxKind + buffer geometry only. Executor-side semantic gates live HERE
on the consumer-side boundary.

Owner.SyntacticVerify enforces:
  - ErrOwnerAddrsEmpty: Addresses.Len() == 0 (signer set undefined)
  - ErrOwnerThresholdZero: threshold == 0 (auth bypass)
  - ErrOwnerThresholdExceedsAddrs: threshold > Addresses.Len()
    (unsatisfiable quorum)

OwnerStub.SyntacticVerify enforces the single-address fast path:
  - Threshold must be exactly 1 (zero is bypass, >1 is unsatisfiable
    because the stub carries one address by construction)

Per-tx Verify() entry points wire the gate into all 7 tx types that
embed Owner-shaped fields:
  - AddValidatorTx.RewardsOwner
  - AddDelegatorTx.DelegationRewardsOwner
  - AddPermissionlessValidatorTx.{Validation,Delegation}RewardsOwner
  - AddPermissionlessDelegatorTx.DelegationRewardsOwner
  - CreateChainTx.Owner
  - CreateNetworkTx.Owner
  - CreateSovereignL1Tx.Owner

Test scope (TDD red→green):
  - owner_syntactic_test.go — 7 cases on Owner + OwnerStub directly
  - tx_verify_test.go — 7 well-formed + 7 malicious-threshold + 1
    multi-owner accept + 1 adversarial-wire-buffer test that overwrites
    the threshold byte in the buffer and re-Wrap, confirming the gate
    fires on byte-stream attacks (not only constructor input).

Contract (LP-023 Red round 4 R4V7): every tx executor's Verify() entry
point MUST call tx.Verify() before treating embedded Owner fields as
authoritative. Skipping Verify() opens the auth-bypass attack vector.
2026-06-02 16:19:05 -07:00
Hanzo AI 6856b8cf50 platformvm/txs/zap_native: close LP-023 Red round 4 — R4V9 + R4V12 + R4V14
Three surgical fixes against Red round 4 findings (task #189).

R4V9 (MEDIUM) — migrate 6 list accessors from Object.List() to
Object.ListStride() for the per-stride poisoned-length clamp added in
zap v0.7.2. Before the migration, a wire length field that satisfied
the permissive `length <= len(buf)` baseline (bare List accepts) but
failed the tighter `length * stride > bufRem` bound would slip past
the accessor and return a List view with Len() == poisoned_length,
opening per-element OOB reads on stride-> 1 entries (silent zeros via
Object.Uint{8,32,64}, but consumer iterates ghost entries). Migrated:

  - CredentialListView  → SizeCredential        (stride 16)
  - SignatureArrayView  → SigBlobSize           (stride 65)
  - InputListView       → SizeTransferableInput (stride 88)
  - SigIndicesArrayView → SizeSigIndex          (stride 4, new const)
  - OutputListView      → SizeTransferableOutput (stride 96)
  - NewEvidenceListView → SizeEvidenceEntry     (stride 48)

Also added defensive `i >= Len()` bounds checks to the four At()
methods that construct sub-Objects from list.Object() — without the
guard, At(0) on a clamped Len()=0 view would build a Credential /
TransferableInput / TransferableOutput / EvidenceEntry wrapping a
zero-value zap.Object (msg=nil) and panic on downstream field
reads. (SignatureArray.At and SigIndicesArray.At already had the
guard.)

New regression suite r4v9_liststride_test.go covers all 6 accessors
plus a false-positive guard verifying honest single-entry lists still
round-trip. Pattern follows existing TestNewV1_ListStrideTighterClamp
in zap: build honest list, overwrite wire length with poisoned value
chosen to satisfy bare clamp but fail stride clamp, parse, confirm
Len()==0 and At(0) is panic-safe.

R4V12 (MEDIUM) — rename `Subnet` to `Chain` in bench fixtures
all_types_bench_test.go: legacySlashValidatorTx + legacyRemoveChainValidatorTx
struct field + their 4 construction sites (lines 55, 68, 444, 476,
552, 584 in original). Bench-only legacy types used for parity
benchmarks; rename is audit-hygiene per the rebrand sweep (#187).
Grep gate `grep -rn "Subnet" ... | grep -v "//"` is now empty.

R4V14 (INFO) — fix docstring drift in add_chain_validator_tx.go: the
"Fixed-section layout (size 165 bytes)" comment said 165, but the
SizeAddChainValidatorTx constant correctly says 161. Updated comment
to match constant; verified by arithmetic (last field Chain @ 129 +
32 bytes = 161, not 165).

Verification:
  - go test -race -count=1 ./vms/platformvm/txs/zap_native/... → ok
  - 7 new R4V9 tests pass (6 poisoned-length regressions + 1 honest
    round-trip).
  - grep gate for R4V12 is empty.
  - Parse benchmarks (M1 Max, 200ms): geomean 7.70x (named-tx-only),
    within noise of pre-fix 7.71x baseline.

zap_native-side only — luxfi/zap requires no bump.
2026-06-02 16:10:01 -07:00
Hanzo AI 725023e777 platformvm/txs/zap_native: LP-023 Phase 1 batch 4 — 8 tx types + Owner + BoundEvidenceList + FuzzWrapAllTxKinds
Red round 3 follow-ups and remaining tx surface:

BOUNDEVIDENCELIST (NEW-V2 compile-time enforcement):
- EvidenceListView (unbound wire view) → .Bind(mb,sb) → BoundEvidenceList
- BoundEvidenceList.At(i) returns BoundEvidenceEntry which exposes safe
  MessageA/B + SignatureA/B accessors. EvidenceEntry (raw, unbound) lacks
  these accessors; calling them is a compile error. Consumers cannot
  bypass Bind() by accident.
- Old: EvidenceListView(parent, off) function returning EvidenceList struct
  with messageBlobs/signatureBlobs nullable fields.
- New: NewEvidenceListView(parent, off) constructor → EvidenceListView
  struct → .Bind() → BoundEvidenceList struct with bound fields.
- Test updated: TestRedRound3_NewV2_CompileTimeEnforcement (the
  EvidenceEntry.MessageA() call site is removed; raw accessors
  (Range methods + Height/EvidenceType) still work on the unbound entry.

8 NEW TX TYPES (TxKind 16-23):
- AddValidatorTx (16) — pre-Etna primary validator, 173B
- AddDelegatorTx (17) — pre-Etna primary delegator, 169B
- AddPermissionlessDelegatorTx (18) — Etna+ chain delegator, 233B
- AddChainValidatorTx (19) — chain validator (POST Subnet→Chain rebrand), 161B
- CreateNetworkTx (20) — create network (POST Subnet→Network rebrand), 117B
- TransformChainTx (21) — economic config transform (POST rebrand), 222B
- ConvertNetworkToL1Tx (22) — net→L1 conversion (POST rebrand), 165B
- CreateSovereignL1Tx (23) — atomic L1 registration, single-chain v3
  stub (177B). Multi-chain L1s pending Chains list primitive.

Rebrand sweep: zero `Subnet` references in zap_native/ source. The post
sweep #187 names are baked into TxKind enum + tx struct names. Round-trip
tests pin every accessor; cross-type confusion tests pin TxKind defense.

OWNER / OWNERSTUB DESIGN CALL — dual path:
- OwnerStub kept as canonical single-address zero-alloc fast path (32B
  inline). Common case stays fast.
- Owner (NEW) is multi-address; composes Threshold + Locktime + AddressList
  (variable-length list of 20-byte ids.ShortID). Header 20B inline +
  variable address storage.
- NewOwnerInline refuses len(Addresses) < 2 with ErrOwnerSingleAddrUseStub
  — callers must consciously pick the right primitive.
- Hammock rationale: 99% of P-chain validator txs use 1 owner; List-backed
  Owner would add ~24B alloc to every tx for a multi-sig case that's rare.
  Type system makes the choice load-bearing.

FUZZWRAPALLTXKINDS (Red round 3 follow-up #3):
- For any byte slice, AT MOST ONE WrapXxxTx returns nil. All others MUST
  return ErrWrongTxKind / ErrWrongSchemaVersion / typed zap.Parse error.
- 23 wrapper tests in parallel; 1.4M+ execs clean on M1 Max with 15s
  fuzztime. No panics, no cross-type confusion, no untyped errors.

ZAP V0.7.2 DEPS:
- go get github.com/luxfi/zap@v0.7.2 — pulls Object.ListStride,
  List.Len SAFETY doc, FuzzParse.

RESULTS.md REFRESH (v0.7.2 M1 Max):
- Geomean Parse × = 7.71× (up from 7.33× v0.7.1; v0.7.2 ListStride
  accept-path cost is negligible — one mul + compare per List() call)
- All 9 ZAP-native types in v0.7.2 column; v0.7.1 M4 Max numbers
  retained side-by-side (no M4 access in this session)
- Build regression on M4 Max still tracked (v0.7.x follow-up to attack
  zap.Builder per-call overhead)

Tests:
- 11 new round-trip + cross-type tests under TestBatch4_*, TestOwner*,
  TestAddValidator/Delegator/PermissionlessDelegator/ChainValidatorTx*,
  TestCreate{Network,SovereignL1}Tx*, TestTransformChainTx*,
  TestConvertNetworkToL1Tx*
- All existing tests (incl. RED-HIGH-1/2/3, MEDIUM-1, V18) still green
2026-06-02 15:47:38 -07:00
Hanzo AI a46833886a platformvm/txs/zap_native: close LP-023 v3.1 Red round 2 wire gaps (RED-HIGH-1/2/3, RED-MEDIUM-1)
Bumps luxfi/zap to v0.7.1 which closes the underlying wire-layer gaps
(uncapped Object.List length, backward-pointer header aliasing, size=0
Parse), and reworks the zap_native package to:

 - Use zap.Version2 as the schema-version gate. Every Wrap*Tx now routes
   through parseAndCheckKind(b, want), which rejects any Version1 buffer
   with ErrWrongSchemaVersion before TxKind interpretation. Closes the
   v2-vs-v3 cross-schema confusion (RED-MEDIUM-1) where a v2-shaped
   BaseTx with NetworkID=11 had byte 0 == TxKindBaseFull == 0x0B.

 - Add EvidenceList.Bind(messageBlobs, signatureBlobs) → EvidenceList,
   and safe accessors EvidenceEntry.MessageA/B + SignatureA/B that clamp
   wire (Rel,Len) cursors against parent-blob length. Returns empty
   slice on poisoned cursors (RED-HIGH-3) instead of panicking on
   mb[rel:rel+len]. The raw *Range() accessors are now documented UNSAFE
   and kept only for internal/test use.

 - Add SigIndicesArray.Slice(start, count uint32) → []uint32 and
   SignatureArray.Slice(start, count uint32) → [][SigBlobSize]byte.
   Both methods were referenced in comments but missing; consumers
   indexing .At() in a loop with attacker-controlled start/count would
   have iterated 4G times on poisoned wire (RED-HIGH-3 follow-on).

 - Update batch3_test.go::TestEvidenceListRoundTrip to use the safe
   bound accessors (the prior `mb[mARel:mARel+mALen]` pattern is exactly
   the consumer-side panic surface Red demonstrated).

Regression tests added to security_test.go:
  TestRedRound2_HIGH3_EvidenceListSafeAccessorsClamp
  TestRedRound2_HIGH3_SigIndicesArraySliceClamp
  TestRedRound2_HIGH3_SignatureArraySliceClamp
  TestRedRound2_MEDIUM1_V2BufferRejectedAtSchemaGate
  TestRedRound2_MEDIUM1_HonestV2BuffersStillWork

Geomean Parse speedup vs legacy codec: 7.03× (was 7.09×; +0.5% noise).
2026-06-02 15:13:57 -07:00
Hanzo AI bf0e0ee87c platformvm/txs/bench_results: v3 multi-host bench results (M1 Max + M4 Max)
Schema v3 (TxKind discriminator) reproduces predicted v2→v3 lift within
noise: Parse geomean 7.11× on M1 Max (n=9 native types), 8.02× on M4 Max
— matches Red model (v2 8.39× → v3 7.09× projected). Per-type allocs 3.57×
fewer, bytes 6.89× smaller, host-stable.

AdvanceTime end-to-end via txs.Codec wrapper: 34.14× M1, 42.76× M4 — ratio
grows with chip speed (reflection tax is fixed-per-op).

Honest residual: Build is a regression on M4 Max for 6/9 types (geomean
0.86×). zap.Builder per-call overhead exposed on fast cores. M1 Max still
positive (1.12×). Tracked for luxfi/zap v0.7.0 (Blue v3.1 iteration);
Parse-side ship decision is independent.

Both hosts darwin/arm64 (M1 Max MacBookPro18,2 + M4 Max Mac16,5 / dbc
runner). Task spec called dbc "amd64 Linux" — corrected: it is darwin/arm64
Apple M4 Max. linux/amd64 numbers TBD until x86 box lands in ARC fleet.

Reproduce: GOWORK=off go test -bench='^Benchmark(Parse|Build)' -benchmem
-benchtime=500ms -count=3 -run='^$'
./vms/platformvm/txs/{bench,zap_native}/
2026-06-02 14:56:46 -07:00
Hanzo AI 0bffcfeeb3 platformvm/txs/zap_native: 5 batch-3 tx types composing the new primitives (LP-023 Phase 1)
TxKindBaseFull                    = 11  → BaseTxFull
  TxKindAddPermissionlessValidator  = 12  → AddPermissionlessValidatorTx
  TxKindImport                      = 13  → ImportTx
  TxKindExport                      = 14  → ExportTx
  TxKindCreateChain                 = 15  → CreateChainTx

Sizes (fixed section, schema v3):
  BaseTxFull                     =  85
  ImportTx                       = 125
  ExportTx                       = 125
  AddPermissionlessValidatorTx   = 381
  CreateChainTx                  = 221

Design highlights:

- BaseTxFull is the real P-chain spending envelope (Outs + Ins +
  Credentials + 2 shared arrays + Memo). The batch-2 BaseTx
  (TxKindBase) remains as the minimal metadata envelope for places
  that need only {NetworkID, BlockchainID, Memo} without spending
  state. Both kinds are first-class; they are NOT alternatives.

- Import / Export use a SINGLE combined Ins (or Outs) list with a
  header marker (ImportedInsStart/Count or ExportedOutsStart/Count)
  identifying the cross-chain slice. This collapses what would have
  been two parallel sig-index arrays into one shared array — fewer
  pointer pairs, no rebase bookkeeping. The slice-based indexing is
  byte-identical for the imported/exported half because they
  reference the same shared array.

- AddPermissionlessValidatorTx carries two single-address Owner stubs
  (validation rewards, delegation rewards) inline in the fixed
  section. The same OwnerStub type underlies CreateChainTx.Owner.
  Multi-address Owner ships in batch 4 along with the AddressList
  primitive; current callers needing multi-addr flow through the
  legacy codec gate.

- CreateChainTx embeds a 32-byte WarpMessageHash (sha256 of the
  originating Warp commit; zero when the chain is being created
  directly without a cross-network commit). The Warp message BODY
  is NOT embedded — it lives in the signed Warp envelope outside
  this tx. Hash-only embedding keeps the unsigned-tx bytes stable
  and the Warp envelope separately verifiable.

All five tx types follow the v3 invariant: TxKind@0, Wrap* rejects
mismatched discriminator with ErrWrongTxKind. Cross-confusion test
expansion verifies the new tx types in pairwise rejection (7
additional scenarios cover the batch 1+2+3 surface).

Deferred to batch 4 (no new primitives needed): the remaining ~18
classical platformvm tx types (CreateNetwork, AddDelegator,
AddPermissionlessDelegator, etc.) reuse the existing batch-3
primitives; their landings are mechanical.

go test -race ./vms/platformvm/txs/zap_native/...
  ok 	github.com/luxfi/node/vms/platformvm/txs/zap_native	1.488s
2026-06-02 14:35:03 -07:00
Hanzo AI 8f3875aba0 platformvm/txs/zap_native: batch 3 primitives — variable-length nested schemas (LP-023 Phase 1)
Five primitives. Each is fixed-stride at the entry level; variable
per-entry bytes/sub-list payloads live in shared sibling fields on
the parent tx, indexed by (start, count). This keeps List.At(i)
zero-allocation while supporting unbounded per-entry payload sizes.

  OutputList         stride  96  →  TransferableOutput
  InputList          stride  88  →  TransferableInput + shared SigIndicesArray
  CredentialList     stride  16  →  Credential        + shared SignatureArray
  WarpMessage        size    40  →  embedded {SourceNetwork, Payload}
  EvidenceList       stride  48  →  EvidenceEntry     + shared MessageBlobs/SignatureBlobs

Design choices:

- Stride is the entry-count semantics for SetList; the byte count from
  ListBuilder.Finish() is discarded. List.Object(i, stride) does the
  branch-free arithmetic.

- Variable per-entry data goes into a SIBLING field on the parent tx
  (not into the entry's stride): InputList → SigIndicesArray;
  CredentialList → SignatureArray; EvidenceList → MessageBlobs +
  SignatureBlobs. Each entry references its slice via (start, count).
  This pattern lets entries stay fixed-stride and accessors stay
  zero-allocation. Multi-input-shared signature arrays also enable
  signature deduplication when adjacent inputs share signers.

- Forward-only relOffsets per the F1 contract: SetBytes-backed payload
  fields (WarpMessage.Payload, EvidenceList parent's MessageBlobs/
  SignatureBlobs) flow through the F1-fixed zap.Object.Bytes which
  rejects negative bit-patterns.

- Read-only contracts on every []byte / by-value accessor are
  documented with the canonical defensive-copy idiom
  (append([]byte(nil), m...)) per AT1.

- Multi-address Owner is NOT yet supported at the wire layer; v3
  OutputList carries the single-address stub identical to
  TransferChainOwnershipTx. Multi-address callers still flow through
  the legacy codec gate behind LUXD_ENABLE_LEGACY_CODEC. The
  AddressList primitive ships in batch 4 (defer).

- Multi-signature credentials handled via the SignatureArray slice
  semantics — one Credential, N sigs. Post-quantum credentials
  (ML-DSA) are NOT YET on the v3 path; they keep flowing through
  legacy until their dedicated PQ Credential schema lands.

Round-trip tests (batch3_test.go) cover all five primitives + the
empty-list/null-pointer fallback path. go test passes; race-free.

Updated bench numbers for v3 batch-2 (the +1-byte TxKind tax):
  Parse geomean speedup vs legacy: 7.09× (was 8.39× pre-v3)
  Build geomean speedup vs legacy: 1.35× (build path was always
  closer to parity; structure-allocator dominates at small tx sizes)
2026-06-02 14:27:01 -07:00
Hanzo AI c3a4a591e4 platformvm/txs/zap_native: schema v3 with TxKind discriminator (LP-023 Phase 1)
Phase A response to Red's batch-2 review:

F2 (MEDIUM, cross-type confusion) — schema-bump v2→v3. Every fixed
section now carries a TxKind uint8 at offset 0; every other field
shifts by +1 byte. Wrap*Tx reads TxKind first and returns
ErrWrongTxKind on mismatch. Constructors write the kind
unconditionally. Closes the gap where an AdvanceTimeTx buffer wrapped
as a BaseTx returned garbage-but-deterministic field reads.

  TxKind enum (dense, 0 reserved):
    1=AdvanceTime  2=RewardValidator  3=SetL1ValidatorWeight
    4=IncreaseL1ValidatorBalance  5=DisableL1Validator  6=Base
    7=RegisterL1Validator  8=SlashValidator
    9=TransferChainOwnership  10=RemoveChainValidator

  v3 sizes (each +1 vs v2 from the TxKind byte):
    AdvanceTimeTx              =  9
    RewardValidatorTx          = 33
    SetL1ValidatorWeightTx     = 49
    IncreaseL1ValidatorBalanceTx = 41
    DisableL1ValidatorTx       = 33
    BaseTx                     = 45
    RegisterL1ValidatorTx      = 217
    SlashValidatorTx           = 57
    TransferChainOwnershipTx   = 69  (no natural-alignment padding; reads are alignment-tolerant)
    RemoveChainValidatorTx     = 53

F1 (MEDIUM, memo malleability) — closed at the luxfi/zap wire layer
in v0.6.1 (negative relOffset rejected in Object.Bytes). Bumped node's
go.mod replace: zap v0.2.0 → v0.6.1. TestRed_V2 now confirms the
defense via the nil-Memo branch.

F4 (INFO, doc bugs) — RegisterL1ValidatorTx comment now correctly
declares size 217; TransferChainOwnershipTx now correctly declares
size 69. Both sizes flow from offset arithmetic — no magic numbers.

AT1 (accepted tradeoff, memo aliasing) — BaseTx.Memo() docstring
escalated: READ-ONLY contract + the canonical defensive-copy idiom
(append([]byte(nil), m...)). Same pattern documented for every
variable-length accessor going forward.

Brand cleanup: SlashValidatorTx.Subnet() → Network() and
RemoveChainValidatorTx.Subnet() → Network(). Zero `Subnet*` symbols
in batch-2 code path. Tests updated.

V14 security test now exhaustively covers cross-confusion: 10
pairings of {valid-tx-buf, wrong-Wrap} + reserved TxKind=0 — all
reject with ErrWrongTxKind. The other 19 Red vectors continue to
pass under v3.

go test -race ./vms/platformvm/txs/zap_native/...
  ok 	github.com/luxfi/node/vms/platformvm/txs/zap_native	1.446s

Coordinated with luxfi/zap@v0.6.1 (F1 fix).
2026-06-02 14:09:13 -07:00
Hanzo AI f9801ecd5b wallet/network/primary: fail-soft FetchState when X-Chain disabled
Post-coreth networks (test+dev primary that bake only P + EVM genesis chains)
run in P-only mode where the X alias is not registered. The wallet's
FetchState now degrades the X-Chain context to a sentinel ids.Empty
BlockchainID instead of erroring, and skips the X-chain entry from the
chain-pair UTXO scan when X is unavailable.

Required to drive IssueCreateChainTx via the canonical primary wallet
against the fresh test+dev primaries (closes universe #168).
2026-06-02 13:48:46 -07:00
Hanzo AI 5efb9ce77d platformvm/txs/zap_native: 5 more tx types (LP-023 Phase 1 batch 2)
Native ZAP encoding — no marshal step, struct IS wire format — for the
next batch of platformvm tx types. Same pattern as Phase 1 batch 1.

New types (v1 schemas; variable-length nested fields deferred to batch 3):
  base_tx.go                     — NetworkID + BlockchainID + Memo
                                   (Outs/Ins → batch 3)
  register_l1_validator_tx.go    — ValidationID + BLS pubkey 48B + PoP 96B
                                   + Expiry + RemainingBalanceOwnerID stub
                                   (Warp Message + full OutputOwners → batch 3)
  slash_validator_tx.go          — NodeID + Subnet + SlashPercentage
                                   (Evidence variable-length → batch 3)
  transfer_chain_ownership_tx.go — Chain + Owner{threshold,locktime,addr} v1 stub
                                   (full OutputOwners list → batch 3)
  remove_chain_validator_tx.go   — NodeID + Subnet
                                   (ChainAuth lives in signed wrapper)

Tests + benches extend the existing all_tx_types_test.go +
all_types_bench_test.go infra (no duplication). 18 new accessor zero-alloc
sites verified, including 48B BLSPublicKey and 96B PoP by-value returns.

Aggregate bench results (Apple M1 Max, Go 1.24, -benchtime=2s):

  Parse Legacy vs ZAP:
    BaseTx                      470.0  →  60.42 ns  ( 7.8x)  152→24 B  3→1 alloc
    RegisterL1ValidatorTx       1008   →  75.03 ns  (13.4x)  384→24 B  6→1 alloc
    SlashValidatorTx            690.6  →  82.74 ns  ( 8.3x)  176→24 B  4→1 alloc
    TransferChainOwnershipTx    2459   → 161.5  ns  (15.2x)  192→24 B  4→1 alloc
    RemoveChainValidatorTx      879.6  → 117.2  ns  ( 7.5x)  176→24 B  4→1 alloc

  Parse cross-type mean (10 types now native): 8.5x speedup.

  Build (one-time per proposer, dominated by Parse on consensus path):
    BaseTx       1.5x slower (memo SetBytes deferred-copy; acceptable trade)
    Register     1.03x       (allocs 7→2)
    Slash        1.4x faster (allocs 5→2)
    Transfer     0.96x       (allocs 5→2)
    Remove       1.3x faster (allocs 5→2)

All accessor reads zero-alloc. All builds 1 alloc on read path.

Verification:
  cd ~/work/lux/node
  GOWORK=off go build ./vms/platformvm/txs/zap_native/...
  GOWORK=off go test  ./vms/platformvm/txs/zap_native/...
  GOWORK=off go test -bench=. -benchmem -benchtime=2s \\
    ./vms/platformvm/txs/zap_native/...

Activation 1782604800 (2026-07-01 00:00 UTC) unchanged.
LUXD_ENABLE_LEGACY_CODEC=1 opts INTO legacy unchanged.

Refs LP-023. Next: batch 3 — variable-length nested-object schemas (Outs/Ins
lists, Warp Message payloads, full OutputOwners, Evidence) + remaining tx
types via codegen.
2026-06-02 13:34:12 -07:00
Hanzo AI 00349fdc92 platformvm/txs/bench: Scientist comprehensive ZAP vs linearcodec harness + results (LP-023)
Real-workload benchmark suite produced by the scientist agent. Production-
realistic measurements on Apple M1 Max (Go 1.24).

Harness (8 files + results + reproduce docs):
  bench/fixtures.go           — realistic per-type tx fixtures
  bench/parse_bench_test.go    — per-type Parse: Legacy vs ZAP
  bench/build_bench_test.go    — per-type Build
  bench/field_bench_test.go    — field access (single + 1M batch)
  bench/workload_bench_test.go — 1000-tx mempool + 200-block parse + dispatcher
  bench/alloc_bench_test.go    — 5s sustained-parse GC pressure
  bench/disable_legacy_test.go — LUXD_ENABLE_LEGACY_CODEC gate verification
  bench/README.md              — reproduce + capture procedures
  bench/testdata/README.md     — captures notes
  bench_results/RESULTS.md     — full numbers + honest caveats + CPU profile

Headline numbers (vs linearcodec):
  Parse AdvanceTimeTx        : 37x faster (1940 ns -> 52.5 ns), 20x less mem
  Build AdvanceTimeTx        :  5.2x faster
  Sustained 5s parse loop    : 18.5x throughput (777k -> 14.4M parses/sec)
  Cross-type mean            :  5.6x parse,  1.6x build
  Allocations (parse, build) : always 3->1 and 4->2

CPU profile:
  Legacy: ~50% in reflectcodec.{marshal,unmarshal} reflection walk,
          ~30% in runtime.{madvise,kevent} from per-field alloc GC pressure
  ZAP:    elimination of both surfaces; offset arithmetic + 1 alloc per parse

Honest caveats (verbatim from scientist report):
  - Only 5/33 tx types have native paths today; mempool mix workload
    compresses to ~1.1x lift until BaseTx + AddPermissionless* native ship
  - Field access: single uint64 read is 2.1x slower (offset deref vs struct
    field), break-even at ~3,560 reads per parse; mainnet validators do
    ~10x per tx so ZAP still wins by orders of magnitude in the real regime
  - darwin/arm64 only — re-run on linux/amd64 before quoting production-
    binding numbers
  - LUXD_ENABLE_LEGACY_CODEC gate verified at zap_native surface (subprocess
    test passes); NOT yet wired into platformvm/txs.Parse — would break
    byte-preserving v0 read for validators bootstrapping pre-activation
    history. Gate enforcement lives at the future wire dispatcher.

Recommendation (CTO direction): continue the migration. Architecture works
as designed. Next priority: BaseTx + AddPermissionless* native paths — the
two highest-weight tx types in the modal mainnet mempool mix.

txs/tx.go is unmodified — byte-preserving v0->TxID migration invariant
preserved per existing codec.go CodecVersionV0/V1 framework.

Reproduce: cd ~/work/lux/node && GOWORK=off go test -bench=. -benchmem ./vms/platformvm/txs/bench/...
2026-06-02 12:52:23 -07:00
Hanzo AI 08b638d72c platformvm/txs/zap_native: 4 more tx types + aggregate benchmarks (LP-023 Phase 1 batch 1)
Adds native ZAP encoding for the L1-management tx types — same pattern as
AdvanceTimeTx canary. No marshal step, zero-copy accessors, zero-alloc
field reads.

Types added:
  RewardValidatorTx              — TxID (32 bytes)
  SetL1ValidatorWeightTx         — ValidationID + Nonce + Weight (48 bytes)
  IncreaseL1ValidatorBalanceTx   — ValidationID + Balance (40 bytes)
  DisableL1ValidatorTx           — ValidationID (32 bytes)

Tests:
  - Round-trip parity per type (build → wrap → equal)
  - All accessors zero-alloc (AllocsPerRun = 0)
  - Wire-format discrimination via IsZAPBytes magic

Benchmarks (Apple M1 Max, Go 1.24, real linearcodec reflection path vs ZAP):

  Tx Type                       | Parse Legacy | Parse ZAP | Speedup
  ------------------------------|--------------|-----------|--------
  AdvanceTimeTx                 |  216.9 ns/op | 38.92 ns  |  5.6x
  RewardValidatorTx             |  218.5 ns/op | 35.80 ns  |  6.1x
  SetL1ValidatorWeightTx        |  234.3 ns/op | 25.76 ns  |  9.1x
  IncreaseL1ValidatorBalanceTx  |  245.4 ns/op | 25.55 ns  |  9.6x
  DisableL1ValidatorTx          |  218.5 ns/op | 54.44 ns  |  4.0x

  Allocations: legacy 3 allocs / 120-136 B; ZAP 1 alloc / 24 B.
  4x reduction in allocs/op, ~5x reduction in B/op across the board.

  Build side: roughly even (both paths allocate a buffer); the win is on
  parse, which dominates real workloads (every validator parses every tx in
  every block).

Phase 1 batch 1 of 4. 5 types down, ~28 to go. Same pattern for each: schema
constants + Wrap + Builder + Test + Bench. Pattern is production-ready;
remaining types (BaseTx, ImportTx, ExportTx, CreateChainTx, validator
variants) follow the same shape with progressively more nested sub-objects
for Inputs/Outputs/Credentials.

Reproduce:
  cd ~/work/lux/node
  GOWORK=off go test -bench=. -benchmem ./vms/platformvm/txs/zap_native/
2026-06-02 12:43:01 -07:00
Hanzo AI c4cc906f45 platformvm/txs/zap_native: invert env var — native ZAP default, legacy is opt-in
LUXD_DISABLE_LEGACY_CODEC → LUXD_ENABLE_LEGACY_CODEC (per user 2026-06-02
'should be LUXD_ENABLE_LEGACY_CODE=1 to turn it on').

Default: native ZAP for every read + write. codec.Codec.Marshal/Unmarshal
gone from hot path. Fresh deployments + post-activation production get a
smaller, faster binary with no legacy code reachable.

Operators with pre-activation history that needs reading set
LUXD_ENABLE_LEGACY_CODEC=1 to opt in to backward-compat. Without it, legacy
bytes return ErrLegacyCodecDisabled.

Tests updated for the inverted default; pass clean.
2026-06-02 12:39:13 -07:00
Hanzo AI 5ec66e7f76 platformvm/txs/zap_native: canary AdvanceTimeTx native-ZAP encoding (LP-023)
No marshal. No codec.Codec interface. The struct wraps the ZAP buffer
literally. tx.Bytes() returns the buffer. WrapAdvanceTimeTx(b) wraps b in
a typed accessor. Both are zero-copy.

Architecture per LP-023:
- ZAPActivationUnix = 1782604800 (2026-07-01 00:00 UTC)
- LUXD_DISABLE_LEGACY_CODEC=1 → legacy linearcodec returns ErrLegacyCodecDisabled
- IsZAPBytes(b) discriminates ZAP magic "ZAP\\x00" from linearcodec V0/V1
- ShouldUseZAPForWrite(blockTimestamp) gates new writes

Real benchmark numbers on Apple M1 Max (Go 1.24):

  Parse   linearcodec 129.4 ns/op  72 B 2 allocs
          zap         36.22 ns/op  24 B 1 alloc   → 3.57x faster
  Build   linearcodec 164.3 ns/op  96 B 4 allocs
          zap         70.55 ns/op  72 B 2 allocs  → 2.33x faster
  Field   linearcodec  0.34 ns/op  (struct deref baseline)
          zap          0.75 ns/op  (offset Uint64) — sub-ns, effectively free

Tests:
  TestAdvanceTimeTxRoundTrip    — build → parse → equal
  TestAdvanceTimeTxZeroAlloc    — Time() accessor 0 allocs/run
  TestAdvanceTimeTxBytesReusable — &Bytes()[0] stable
  TestIsZAPBytes
  TestShouldUseZAPForWrite

This is Phase 0 of the LP-023 migration. Phase 1: schemas + accessors for
the remaining 32 platformvm tx types using the same pattern. Phase 2:
replace codec.Codec.{Marshal,Unmarshal} call-sites in platformvm/{txs,
mempool,block,state,executor}. Phase 3: validator coordination + activation.
Phase 4: post-activation legacy code removal.

Reproduce: GOWORK=off go test -bench=. -benchmem ./vms/platformvm/txs/zap_native/
2026-06-02 12:34:56 -07:00
Hanzo AI 59423a56e8 Dockerfile: bump EVM_VERSION v0.18.16 → v0.18.18
Pulls in plugin/evm StateScheme fix that unblocks fresh L2 EVM chain
creation on lux-mainnet (hanzo, zoo, spc, pars), where the plugin was
panicking with "panic in eth.New: triedb parent [<EmptyRootHash>] layer
missing" because eth/backend.go inherited geth's path-by-default for
empty DBs while the VM hard-refuses path mode upfront.

See luxfi/evm v0.18.18 commit 1dea806f8.
2026-06-02 11:56:01 -07:00
Hanzo AI 82dbdbadee fix: gofmt -s across repo (CI format check) 2026-06-02 11:39:52 -07:00
Hanzo AI 7285e1e554 go.mod: bump luxfi/genesis v1.12.19 -> v1.13.8 (RLP-matching mainnet+testnet+zoo-mainnet genesis embeds)
Embedded //go:embed configs/{mainnet,testnet,devnet,localnet} now contains
canonical 2-alloc genesis.json's reverted for RLP import compatibility:

- mainnet C-Chain (96369): block 0 = 0x3f4fa2a0...   MATCH lux-mainnet-96369.rlp
- testnet C-Chain (96368): block 0 = 0x1c5fe377...   MATCH lux-testnet-96368.rlp
- zoo-mainnet  (200200):   block 0 = 0x7c548af4...   MATCH zoo-mainnet-200200.rlp

Each had been wedged by 43 PQ precompiles baked into config.precompileUpgrades
at blockTimestamp:0, mutating state root + producing non-canonical hash.
Activations moved to forward-dated upgrade.json (blockTimestamp 1766708400).

Also bumps pkg/genesis/security to v1.13.8 to stay version-locked.
Tidy drops bft v0.1.5 (no longer indirect).
2026-06-02 04:25:27 -07:00
Hanzo AI ba4084d6d5 docker: drop gcr.io distroless for scratch runtime in heartbeat-tx example
We don't use gcr.io across lux/hanzo/zoo. Switch the heartbeat-tx example
runtime stage from gcr.io/distroless/static-debian12:nonroot to
FROM scratch, copying ca-certs, tzdata, and passwd/group from the builder.
2026-06-02 03:34:39 -07:00
Hanzo AI 3332d05eaa Dockerfile: bump EVM_VERSION v0.18.15 → v0.18.16
luxfi/evm v0.18.16 fixes the nil-chainConfig panic at PQ gate that
made v1.28.15's image-baked EVM plugin crash on fresh-PVC pq:true
bootstrap. Discovered during localnet 1337 bring-up (#148).

Root cause in v0.18.15: vm.chainConfig.PQ was being set BEFORE
vm.chainConfig was assigned from g.Config — nil-deref in
plugin/evm/vm.go Initialize().

v0.18.16 moves the gate AFTER assignment.

This unblocks v1.28.16 image build → unblocks localnet 100% green
→ unblocks cluster deploys (devnet → testnet → mainnet).
2026-06-02 01:05:57 -07:00
Hanzo DevandGitHub 729b4e578a ci(release): cross-compile darwin binaries on lux-build pool
GitHub-hosted macos-13 queues block the release pipeline for hours.
The build is already pure Go cross-compile (CGO_ENABLED=0 GOOS=darwin
GOARCH=$arch) so there's no reason to use a Mac runner. Route through
the self-hosted lux-build ARC pool (fast, plentiful) instead.

Replace 7z (not on ubuntu) with apt-installed zip in the same step.
Output filename + artifact name are unchanged.
2026-06-01 22:55:13 -07:00
Hanzo AI 946e6422f7 go.mod: bump luxfi/consensus v1.25.12 → v1.25.13 (gofmt fixes) 2026-06-01 22:02:34 -07:00
Hanzo AI 73b05ef68d go.mod: bump luxfi/accel v1.1.7 → v1.1.8 + consensus v1.25.12 + threshold v1.9.7 + kms v1.11.2 + pulsar v1.1.2
Whole-tree sync to latest closure-swarm tags. accel v1.1.8 ships
c_api.h via //go:embed so go mod vendor preserves it (fixes fresh-clone
CI builds across all consumers).
2026-06-01 22:01:22 -07:00
Hanzo AI 4ec0931501 go.mod: consensus v1.25.9 → v1.25.11; pulsar v1.0.23 → v1.1.1; threshold v1.9.2 → v1.9.4
PULSAR-V04-CTX cascade landing:
  - pulsar  v1.0.23 → v1.1.1  (v0.4 ctx-bound algebraic-aggregate
                                threshold sign — full Round1→Round2W→
                                Round2Sign→AlgebraicAggregateCtx with
                                FIPS 204 §5.4 ctx threaded into μ; no
                                single-party dealer shortcut anywhere)
  - threshold v1.9.2 → v1.9.4  (dispatcher pulsar.Sign_Ctx rewired
                                onto full algebraic-aggregate path; no
                                master sk materialised in dispatcher
                                process at any point during sign)
  - consensus v1.25.9 → v1.25.11 (passes the bumps through)

Test gates green on tip:
  GOWORK=off go test -count=1 -short -timeout 600s ./vms/platformvm/...
  GOWORK=off go test -count=1 -short -timeout 600s ./network/...
  GOWORK=off go test -count=1 -short -timeout 600s ./consensus/...
2026-06-01 21:56:39 -07:00
Hanzo AI 384425c66b go.mod: consensus v1.25.8 → v1.25.9 (magnetar v1.2.0 dealerless PVSS-DKG)
Cascade:
- magnetar v1.1.0 → v1.2.0 (closes MAGNETAR-PVSS-DKG-V11)
- threshold v1.9.1 → v1.9.2 (magnetar bump)
- consensus v1.25.8 → v1.25.9 (threshold + magnetar bump)

Magnetar v1.2.0 lands a Schoenmakers-style PVSS-DKG over GF(257)
for THBS-SE setup. No trusted dealer; no party ever holds the
master byte vector at any time during setup. Share-envelope wire
shapes are byte-shape-identical to the dealer path, so already-
deployed share material is forward-compatible.
2026-06-01 21:25:05 -07:00
Hanzo AI 9ca3a728ef go.mod: bump luxfi/keys v1.0.9 → v1.1.0, luxfi/kms v1.9.13 → v1.10.1
luxfi/keys v1.1.0 lands the Bindel-Brendel-Fischlin (CCS 2021) +
CDFFJ23 (Asiacrypt 2023) stronger-binding hybrid signature scheme
for validator identity:

  HybridPublicKey / HybridPrivateKey / HybridSignature
  HybridSign / HybridVerify / HybridBoundDigest / HybridPublicKeyBytes
  DeriveHybridIdentity (mnemonic + path → HybridIdentity)

Construction binds BOTH pubkeys into m_bound via SHAKE256-384 under
domain "lux-hybrid-sig-v1" — security ≥ max(EUF-CMA_secp256k1,
sEUF-CMA_ML-DSA-65). Raw concat (the prior plan) only gives
min security under non-honest-key adversary (CDFFJ23 §4).

Classical = secp256k1 (matches existing P/X validator key format).
PQ = ML-DSA-65 (FIPS 204).

Use DeriveHybridIdentity for validator stake re-anchor flow:
classical leaf at m/44'/9000'/serviceIndex'/0'/0', PQ leaf at
m/44'/9000'/serviceIndex'/0'/1'. NodeID derived via single
SHAKE256-384 over wire-form hybrid pubkey (no BTC-style double hash —
cryptographer review confirmed single-SHAKE is sound).

luxfi/kms v1.10.1 follows with the matching go.mod bump.

Tests: go build ./... and go test -race -count=1 -short
./vms/platformvm/... PASS.
2026-06-01 21:03:49 -07:00
Hanzo AI b4d441911f go.mod: drop corona v0.7.5 replace — unblock consensus v1.25.8 build
consensus v1.25.8 (carries threshold v1.9.1 + magnetar v1.1.0) refactored
quasar/corona_gob.go and polaris.go to call sig.MarshalBinary() at the
Signature level. The wire-codec methods (Signature.{Marshal,Unmarshal}Binary)
were added in corona v0.7.6 — v0.7.5 only has them on the inner C/Z/Delta
polynomial fields.

The historical replace directive (9323caa1fc on 2026-05-24) was added to
work around consensus v1.24.6 reaching back into corona via keyera.Bootstrap,
which since shipped its 3-value return at corona v0.7.5. consensus v1.25.x
now pins corona v0.7.6 in its own go.mod cleanly, so the replace is no
longer needed and is actively breaking the v1.28.8 image build.

Removing the replace lets MVS pick corona v0.7.6 transitively through
consensus → that is the version where MarshalBinary lives.

Reproduced the CI failure locally with CGO_ENABLED=0 GOWORK=off, fixed,
verified with a clean amd64 nattraversal-profile build (46.6MB binary)
and a full race-clean ./... suite (exit 0, no DATA RACE / panic markers).
2026-06-01 19:54:49 -07:00
Hanzo AI f5130223c6 Dockerfile: bump EVM_VERSION v0.18.14 → v0.18.15
luxfi/evm v0.18.15 ships core/genesis: honor SkipPostMergeFields flag
from JSON — the fix for the "triedb parent [0x56e81f17…] layer missing"
panic-in-eth.New that's blocking C-Chain bootstrap on lux-mainnet.

Lux mainnet C-Chain canonical genesis hash is 0x3f4fa2a0…, produced
with the 16-field pre-Shanghai header format. The chain activates
Cancun at genesis time for MCOPY etc., but the genesis BLOCK itself
must stay in the legacy header shape. The previous luxfi/evm tag
ignored skipPostMergeFields=true and shifted the computed genesis
hash to 0x1ade42ec…, which then failed to commit to pathdb because
the parent layer (0x56e81f17… = empty root) wasn't in the layertree.

The plugin baked into this image is at vmId
mgj786NP7uDwBCcq6YwThhaN8FLyybkCa4zBWTQbNgmK6k9A6 — confirmed via
strings of the running prod plugin binary (luxfi/evm/core symbols).
2026-06-01 19:35:54 -07:00
Hanzo AI f4407b3497 go.mod: consensus v1.25.7 → v1.25.8 (magnetar v1.1.0 strict-atom cascade)
consensus v1.25.8 carries threshold v1.9.1 which carries magnetar v1.1.0:
strict-atom Combine, audit-grep clean, byte-identity to circl FIPS 205,
35-51% faster than v1.0.

Race-clean across the full node ./... suite (exit 0; no DATA RACE / panic
markers; 30+ min compile-and-test on -race -timeout=15m).
2026-06-01 19:29:24 -07:00
Hanzo AI 3b8fa5911a merge: feat/scale-standard 2026-06-01 16:35:45 -07:00
Hanzo AI 9df75e9ac7 merge: feat/create-sovereign-l1-tx 2026-06-01 16:35:45 -07:00
Hanzo AI 39249c4362 merge: chore/kill-fuji 2026-06-01 16:35:44 -07:00
Hanzo AI b58aaa0682 keyutil: thread *keys.ServiceIdentity into LoadMnemonicFromKMS dial
The KMS consensus-auth gate now requires every secret-opcode envelope
to carry a signed identity. Derive a bootstrap ServiceIdentity from
KMS_BOOTSTRAP_MNEMONIC (or MNEMONIC) under the well-known servicePath
"luxd/staking-bootstrap" and thread it into the LoadMnemonicFromKMS
call so the dial envelope is signed.

Bootstrap mnemonic is provisioned out-of-band (sealed envelope, HW
token unwrap, etc.); the operational staking material on disk still
comes from the KMS-held mnemonic the dial then fetches.
2026-06-01 16:15:41 -07:00
Hanzo AI 596de8be35 go.mod: consensus v1.25.7 + threshold v1.9.0 + corona v0.7.6 (Polaris cert wired, TEE extensions live) 2026-06-01 12:49:17 -07:00
Hanzo DevandGitHub ddd0053774 Merge pull request #126 from luxfi/fix/invalidate-stale-genesis-cache
fix(config): invalidate cached genesis on parse failure
2026-06-01 01:43:22 -07:00
Hanzo AI 5100801f43 fix(config): invalidate cached genesis on parse failure instead of CrashLooping
The cached `<dataDir>/genesis.bytes` file is written on first start to
hold hash stability across restarts. On a binary upgrade that adds
new codec types (multi-version v0+v1 dispatcher, etc.), the old
cached blob may carry type IDs the new binary doesn't recognise. The
existing code surfaced this as `resolve X-Chain asset ID from cached
genesis: unmarshal interface: unknown type ID N` and returned an
error — wedging the node in CrashLoop with no automatic recovery.

Drop the cache and rebuild from the `--genesis-file` instead. Hash
stability is forfeit for that single restart (intentional — the
alternative is a permanent outage on every binary bump that changes
codec types). Subsequent restarts re-establish stability against the
fresh cache.

Surfaced today on <tenant> testnet+mainnet bumping lqd v1.9.x →
v1.10.8: every pod hit "unknown type ID 29" on the stale v1.9.x
codec cache and CrashLoopBackOff'd.
2026-06-01 01:43:00 -07:00
Hanzo AI c5c03aef44 go.mod: consensus v1.25.5 + threshold v1.8.10 (race-clean, corona dispatcher live, naming decomplect) 2026-06-01 01:14:43 -07:00
Hanzo AI ac0b9c2ca8 keyutil: rehome ZAP mnemonic import to luxfi/keys (was luxfi/kms)
Track A finish: KMS goes back to being a generic secret store; mnemonic
semantics live in luxfi/keys alongside the existing BIP-39 + BIP44
derivation. Imports flip from luxfi/kms/pkg/zapclient.LoadMnemonicFromKMS
to keys.LoadMnemonicFromKMS — same signature, same behavior.

Deps:
  luxfi/keys v1.0.8 → v1.0.9     (carries the new LoadMnemonic helper)
  luxfi/kms  v1.9.12 → v1.9.13   (LoadMnemonic removed, secret store only)

Build clean.
2026-05-31 21:30:21 -07:00
Hanzo AI 1ee0ecc807 go.mod: consensus v1.25.4 + threshold v1.8.9 + magnetar v0.5.2 (race-clean threshold + MAGS/MAGG wire) 2026-05-31 18:20:38 -07:00
Hanzo AI 8c96e85d03 scrub: subnet/l2 → chain (final RELEASES.md cleanup, forward-only)
Wire-format codec IDs unchanged. CLI aliases deleted; chain is the
command. No backwards-compat shims, no deprecation comments.
2026-05-31 15:30:09 -07:00
Hanzo AI 43f010ea9f scrub: subnet/l2 → chain (canonical vocabulary, forward-only)
Wire-format codec IDs unchanged. CLI aliases deleted; chain is the
command. No backwards-compat shims, no deprecation comments.
2026-05-31 15:26:55 -07:00
Hanzo AI 98d1eeffcd keyutil: native-ZAP mnemonic fallback (priority 2)
Adds a KMS_ADDR-gated production path between the MNEMONIC env var
(priority 1) and the on-disk key files (priority 3). When set, the
mnemonic is fetched via luxfi/kms zapclient.LoadMnemonicFromKMS —
the same canonical loader every Lux-derived service (luxd, netrunner,
lux/cli, descending-L1 bootstraps) now shares.

New priority chain:
  1. MNEMONIC env var
  2. KMS_ADDR + KMS_ENV + KMS_MNEMONIC_PATH (native ZAP, default path /mnemonic)
  3. Key name from os.Args[1] (~/.lux/keys/<name>/)
  4. ~/.lux/keys/default/

Production env contract matches the <tenant> operator's render
(KMS_ADDR + KMS_ORG + KMS_ENV + KMS_MNEMONIC_PATH); every Lux chain
inherits the same scheme.

Dep:
  + github.com/luxfi/kms v1.9.12  (carries zapclient.LoadMnemonic)

Build clean.
2026-05-31 14:29:34 -07:00
Hanzo AI 1aaded33db go.mod: pulsar v1.0.23 + threshold v1.8.8 + consensus v1.25.3 + metric v1.5.7
Pulls in:
- pulsar canonical wire codec (PULS/PULG) + shared lattice/v7/gpu surface
- threshold protocols/{corona,pulsar} alias surface (no direct primitive imports)
- consensus routed through threshold/protocols alias
- metric noop counter race fix (atomic.Uint64)

Cross-repo audit closed: corona+pulsar+threshold production-ready for
permissionless mainnet. End-to-end TestPulsar_Wire_FIPS204Verifiable
asserts threshold-combined signatures are byte-identical to single-party
FIPS 204 ML-DSA signatures (verified externally via cloudflare/circl).
2026-05-31 12:45:26 -07:00
Hanzo AI 1a42b5df1c fix(platformvm/state): route every state-side codec read through multi-version dispatcher
Closes the residual v1.28.1 testnet-canary failure where bootstrapping
a v1.23.x-written P-Chain database hit:

  P-Chain state corrupt after init — database must be wiped
  error="loadMetadata: feeState: unknown codec version"
  chainID=11111111111111111111111111111111P

The v1.28.1 patch routed genesis.Parse through the multi-version
txs.GenesisCodec dispatcher but did not touch the 7 OTHER state-side
sites that read via block.GenesisCodec — which carried only the v1 slot
map. Any pre-codec-v1 row on disk (feeState, heightRange, L1Validator,
fx.Owner, NetToL1Conversion, legacy stateBlk) errored at the very first
byte with codec.ErrUnknownVersion.

Architecture (Rich-Hickey-simple): make the codec itself complete for
all encountered wire versions rather than asking "which codec does
this caller need". block.GenesisCodec now registers BOTH the v0
(v1.23.x Apricot/Banff) and v1 (current) tx slot maps — reads
dispatch on the 2-byte wire prefix, writes still target
CodecVersion (== v1) exclusively. Same shape as txs.GenesisCodec
(decomplected from block parsing — block.Parse continues to extract
prefix explicitly because v0 blocks satisfy v0.Block, not block.Block,
and cannot be unmarshalled into a block.Block destination).

Audit found 7 state-side sites all using block.GenesisCodec; all 7
are routed through a new defensive helper:

  state.multiVersionUnmarshal(c codec.Manager, b []byte, dest any)

The helper is a pass-through to c.Unmarshal but probes the codec on
first observation. If the codec is missing the v0 slot, a structured
warning fires (once per codec pointer) so a future canary boot
surfaces ALL remaining single-version codecs in a single log scrape
rather than failing piecemeal across iterations:

  state-side codec is single-version; reads of v0-prefixed bytes
  will fail

block.RegisterGenesisType now symmetrically registers on both the v0
and v1 underlying linearcodecs so state-side types (currently:
stateBlk) keep slot-stable shapes across codec.Manager dispatch.

Audit table (all 7 broken sites → fixed):

  state/l1_validator.go:222         getL1Validator
  state/state_blocks.go:115         parseStoredBlock (legacy stateBlk)
  state/state_chains.go:66          GetNetOwner (fx.Owner)
  state/state_chains.go:116         GetNetToL1Conversion
  state/state_metadata.go:176       loadMetadata (heightRange)
  state/state_metadata.go:273       getFeeState  <-- canary failure
  state/state_validators.go:239     loadActiveL1Validators
  state/state_validators.go:535     initValidatorSets (inactive)

MetadataCodec was already multi-version (no fix needed).
txs.GenesisCodec was already multi-version (v1.28.0).
block.Codec stays v1-only by design (block.Block interface destination
cannot accept v0.Block types; Parse handles version split explicitly).

Tests (all -race green):

  block/codec_multiversion_test.go      6 tests
  state/state_v0_codec_test.go          9 tests including
                                          - TestStateV0FeeStateReadable
                                            (exact canary fixture)
                                          - TestStateBootFromV0SingletonDB
                                            (end-to-end boot simulation)
  state/codec_helpers_test.go           5 tests (warning probe +
                                          idempotency + non-blocking
                                          + multi-version invariant)

  -> 20 new regression tests
  -> 27/27 platformvm packages green under -race
2026-05-31 02:56:55 -07:00
Hanzo AI 13a48d0c28 fix(platformvm/genesis): route Parse through multi-version codec.Manager
v1.28.0's block-codec multi-version dispatch did not extend to the
P-Chain genesis decoder. genesis.Codec aliased block.GenesisCodec,
which registers only the v1 tx slot map; v0-prefixed cached-genesis
blobs (carried over from v1.23.x bootstraps) errored at first byte
with codec.ErrUnknownVersion.

Root cause hot path: config.getGenesisData -> resolveXAssetID ->
genesis/builder.XAssetIDFromGenesisBytes -> platformvm/genesis.Parse
-> Codec.Unmarshal(bytes, *Genesis). Codec was the v1-only
block.GenesisCodec.

Fix: alias genesis.Codec to txs.GenesisCodec, which registers BOTH the
v0 (Apricot/Banff) and v1 (current) tx slot maps. The Genesis struct
has no slot ID of its own; all version-sensitive data lives in the
embedded []*txs.Tx, so txs.GenesisCodec dispatches the same wire-
prefix lookup the rest of the platformvm tree already uses.

Marshal at CodecVersion (v1) is byte-equivalent because the v1 slot
map in txs.GenesisCodec is the SAME registerV1TxTypes() invocation
block.GenesisCodec was using.

Audit: every other Unmarshal site in vms/platformvm/ that touches
historical wire bytes either (a) goes through block.Parse / txs.Parse
which already dispatch on the prefix, or (b) reads internal state
written by v1-only code (block.GenesisCodec is correct there).

Regression guards in parse_v0_test.go:
  - TestParseAcceptsV0CachedGenesis: the canary failure mode.
  - TestParseAcceptsV1Genesis: canonical write path still parses.
  - TestParseV0RoundtripIsBytePreserving: v0 -> Parse -> re-marshal
    -> byte-equal, locking in the doc claim that genesis-derived
    hashes do not rotate across the migration.
  - TestParseRejectsUnknownVersion: prefixes outside {v0, v1} still
    surface as errors.

Full vms/platformvm/... tree green under -race; genesis/builder and
config trees green.
2026-05-31 02:26:49 -07:00
Hanzo DevandGitHub da79e8d484 feat(platformvm): multi-version codec — v0 (Apricot/Banff) + v1 (current) — byte-preserving TxID/BlockID across migration (#123)
Closes the codec-version trap that surfaced when the v1.23.x ("Apricot/Banff") tx + block layout was rip-replaced in e27d954097 without bumping the wire-version prefix: mainnet/testnet on-disk blobs (~1.08M+ C-Chain blocks) lost a decoder, and any code path that round-tripped a tx through tx.Initialize re-marshaled it under the new layout — rotating TxID and breaking chain-commitment continuity.

Strategy A per cryptographer / orchestrator brief:

* Register both layouts on the platformvm tx + block codec.Managers under
  distinct wire-version prefixes:
  - CodecVersionV0=0 = v1.23.x slot map (TransferInput=5, hole=6, ...,
    AddPermissionlessValidator=25, ..., DisableL1Validator=39)
  - CodecVersionV1=1 = current slot map (with MintOutput/MintOp at 6/8,
    +4-skip for Banff txs at 27-30, CreateSovereignL1Tx at 36,
    SlashValidatorTx at 41, CreateAssetTx/OperationTx at 42-43)
  - txs.Codec / block.Codec dispatch by the standard 2-byte wire prefix.

* New byte-preserving init: tx.InitializeFromBytes(c, version, signedBytes)
  and tx.InitializeFromBytesAtVersion(c, version) bind the tx to its
  original signedBytes without re-marshalling. tx.Initialize stays as the
  fresh-build path; from-DB / from-wire paths route through the
  byte-preserving variant. TxID = hash(signedBytes) under the version it
  was written at, forever.

* New vms/platformvm/block/v0/ subpackage: 9 v0-only block kinds
  (ApricotProposalBlock, BanffProposalBlock, ... at slots 0-4 + 29-32).
  Pure DTOs — no codec, no Visit. The block package wraps the decoded
  v0.Block in a liftedV0Block adapter that:
  - returns the original bytes verbatim (no re-marshal),
  - BlockID = hash(raw v0 bytes),
  - dispatches Visit to the v1 Visitor arms (ApricotProposalBlock /
    BanffProposalBlock -> ProposalBlock, etc.),
  - re-binds embedded txs at v0 via InitializeFromBytesAtVersion so
    inner TxIDs are also byte-preserved.

* genesis.Parse is wire-version-aware: pre-codec-v1 genesis blobs decode
  at v0, new blobs at v1. The matching codec is used for tx re-binding.

* L1-tx slot map shifts +1 to accommodate CreateSovereignL1Tx at 36
  (RegisterL1Validator 36->37, SetL1ValidatorWeight 37->38,
  IncreaseL1ValidatorBalance 38->39, DisableL1Validator 39->40). Test
  fixtures regenerated.

* 22 fee-calculator fixtures + 11 serialization fixtures bumped to use
  the v1 wire prefix (0x0001) and the post-CreateSovereignL1Tx slot map.

Migration notes:
* Mainnet + testnet P-Chain DBs: NO rebuild. Pre-codec-v1 blocks
  continue to decode through the v0 path with original BlockID and
  TxIDs preserved. New blocks are written at v1 from the cut-over
  height onward.
* Devnet: must be rebuilt before rolling to v1.28.0. Its existing
  blobs carry wire-version 0 but use the post-rip slot map (not the
  v0 Apricot/Banff layout) — decoding them through the v0 path would
  read the wrong types. A fresh bootstrap at v1.28.0 writes v1 bytes
  from height 0 and is internally consistent thereafter.

Tests:
* TestCodecVersionV0V1Coexist, TestParseDispatchesByVersion,
  TestTxIDStabilityRoundTrip, TestCrossVersionRefuses (txs)
* TestParseV0ApricotProposalBlock, TestParseV0BanffStandardBlock,
  TestParseV1RoundTrip, TestVersionPrefixDispatch (block)
* 150 packages, 0 failures under -race
2026-05-31 01:38:42 -07:00
Hanzo DevandGitHub 303242ea5a bump(consensus): v1.25.1 → v1.25.2 (#122)
Picks up ChainConsensus.ForceAccept — the consensus-level counterpart
to ForcePreference. Together with the engine.finalizeOwnProposal helper,
this lets a proposer self-finalize its own block at proposal time when
peer Chits do not arrive in time, closing the CreateChainTx stall
observed on devnet under low validator counts.

- ChainConsensus.ForceAccept(blockID) — direct accept bypassing alpha/K
  quorum, guarded by engine path (IsOwnProposal=true) and idempotent.
- Engine path uses ForceAccept after ForcePreference on own proposals
  so the proposing node commits locally and other validators converge
  via the next poll round.

Test delta: pre-existing fee/static_calculator L1Tx parse failures on
main are unaffected; consensus, vms/platformvm/{block,blockmock,state,
warp,...}, and genesis/builder all pass with race -short.
2026-05-30 21:38:16 -07:00
Hanzo DevandGitHub 1d84e03e5b test(genesis/builder): canonical evmAddr/utxoAddr fixture parse gate (#121)
Add TestCanonicalGenesisFixtureParses — loads the canonical mainnet
genesis.json (genesis v1.12.19 evmAddr/utxoAddr field names) through
genesiscfg.GetConfigFile and asserts EVMAddr/UTXOAddr decode to
non-zero ids.ShortID values.

This is the "have we adopted the rename" gate — if the loader
silently swallows the new field names (e.g. via a regression to
ethAddr/luxAddr struct tags), every allocation Address comes back
as ShortEmpty and the assertion catches it before that ships.

Test is host-path aware: skips when ~/work/lux/genesis is not on
disk (CI without sibling checkout), runs when it is.
2026-05-30 20:09:10 -07:00
Hanzo DevandGitHub 3631ff5dc2 feat: bump consensus v1.25.1 (proposer fix) + genesis v1.12.19 (#120)
luxfi/consensus v1.25.0 → v1.25.1
  Proposer-self-accept gap on nova multi-node finality: the proposer of
  block B was never marking B locally accepted because manager.applyQbit
  re-derived peer Chits via a second blk.Verify() call which most VMs
  (notably PlatformVM CreateChainTx) are not idempotent under, flipping
  every Chits into synthetic Accept=false. Fix tags the proposer's own
  pending entry with IsOwnProposal=true and short-circuits the re-verify
  in handleVote — peer Chits now count as the genuine Accepts they are.

luxfi/genesis v1.12.15 → v1.12.19
  Decomplected: pkg/genesis/security/ is a nested module (own go.mod,
  tagged pkg/genesis/security/v1.12.19) that owns SecurityProfile
  verification — the only file in luxfi/genesis that imports
  luxfi/consensus. The rest of pkg/genesis stays consensus-dep-free.

  API change: pin.Resolve() → genesissecurity.ResolveProfile(pin).
  ErrSecurityProfileHashMismatch and ErrSecurityProfileInvalidID also
  moved to the security submodule. Updated node/node.go and
  node/security_profile_test.go to match.

Build: GOWORK=off go build ./...  clean (linker warnings about accel
  static lib path are pre-existing host-config noise, not a regression).
Vet:   GOWORK=off go vet ./...    clean (the cevm_e2e_test.go
  sync/atomic.Bool copy warning is pre-existing on v1.27.24 main).
Tests: ./consensus/... pass, ./genesis/... pass, ./node/...
  TestApplySecurityProfile_* pass. ./vms/platformvm/txs/fee L1-validator
  failures are pre-existing on v1.27.24 main and unchanged.

Devnet fixture (~/work/lux/genesis/configs/devnet/genesis.json) parses
clean: networkID=3, 5 initialStakers, canonical evmAddr/utxoAddr only.
2026-05-30 19:56:57 -07:00
Hanzo DevandGitHub 28e9fe0032 refactor: XAssetID → UTXOAssetID (#119)
The field is the primary network's UTXO fee asset (P+X), not
X-chain-specific. P-chain CreateChainTx / AddChainValidatorTx and
X-chain transfers all burn it for fees. Same number on P and X by
construction; the name should reflect the function, not the chain.

Renames applied across:
- wallet/chain/{p,x}/builder.Context.UTXOAssetID
- wallet/chain/x/builder.Backend.UTXOAssetID() trait method
- node/config: resolveUTXOAssetID + nodeConfig.UTXOAssetID
- vms/platformvm + vms/xvm + chains/manager consumers
- examples (deploy-chains, get-p-chain-balance, ...)

Includes local replaces for luxfi/{runtime,consensus} pending their
release tags landing. Drop after upstream tags ship.

Companion PRs: luxfi/runtime#2, luxfi/consensus#11. Downstream
consumers (sdk, cli, genesis, liquidity) follow.
2026-05-30 14:28:08 -07:00
Hanzo AI 6258af7af9 deps: proto v1.0.2 — consume SubnetUptime → ChainUptime rename
luxfi/proto#6 (merged) renames SubnetUptime → ChainUptime in
node/zap/p2p, completing the no-subnet vocabulary rule from
node#116. The local re-export in proto/p2p/p2p_zap.go was already
written against the new upstream name, breaking v1.27.22 builds:

  proto/p2p/p2p_zap.go:42:32: undefined: p2p.ChainUptime

Tagging v1.0.2 against the merged proto main and bumping the module
pin unblocks the build with zero code changes — the alias line is
unchanged because upstream already matches.

Build: clean. Test: pre-existing platformvm/txs/fee L1-validator
failures unchanged (not introduced here).
2026-05-30 09:35:04 -07:00
Hanzo DevandGitHub f0733b749c canonical evmAddr/utxoAddr only — bump genesis v1.12.15 (#118)
Pulls in luxfi/genesis v1.12.15 which strips the dual-name
luxAddr/ethAddr alias shim. AllocationJSON now emits and accepts only
the canonical evmAddr/utxoAddr field pair.

docker-entrypoint.sh genesis templates: switch luxAddr → utxoAddr +
ethAddr → evmAddr to match.

This is the cascade step needed before luxd v1.23.43 ships — the runtime
parser at v1.23.31 (current devnet image) reads ethAddr/luxAddr; v1.23.42
already reads evmAddr/utxoAddr internally; v1.23.43 (this commit + tag)
drops every back-compat alias both ways.

Tests: genesis/builder, vms/platformvm/genesis pass. End-to-end parse
of configs/devnet/genesis.json with canonical names: 1005 allocations,
5 initial stakers (matches 5-pod sybil quorum).

Cluster bump path: lux-devnet (1.23.31 → v1.23.43); testnet/mainnet
remain on v1.23.31 until coordinated migration.

Co-authored-by: Hanzo AI <dev@hanzo.ai>
2026-05-30 09:24:28 -07:00
Hanzo DevandGitHub 5c164e84c7 chore: update 2026-05-29 23:33:09 -07:00
Hanzo AI 6af468742c chore: update 2026-05-29 23:29:08 -07:00
Hanzo DevandGitHub 2220065985 chore(node): kill subnet — chain/network vocabulary across node (#116)
* feat(platformvm): CreateSovereignL1Tx — single-tx sovereign L1 launch

Adds a new platformvm tx type that atomically registers a sovereign L1
in one P-chain commit. Replaces what is today the four-step flow:

  CreateNetworkTx + AddChainValidatorTx ×N + CreateChainTx ×K + ConvertNetworkToL1Tx

with one signed tx. After commit, the primary network has a permanent
record of the L1's network ID + initial validator set + chain manifest
+ on-chain validator-manager contract — but it does NOT track-chains
or validate the L1's blocks. The L1 runs its own consensus from
genesis. L2/L3/L4 follow the same pattern recursively.

Type shape:

  type CreateSovereignL1Tx struct {
    BaseTx
    Owner           fx.Owner                       // CreateNetworkTx parity
    Validators      []*ConvertNetworkToL1Validator // genesis validator set
    Chains          []*SovereignL1Chain            // VM ID + genesis blob per chain
    ManagerChainIdx uint32                         // index into Chains[]
    ManagerAddress  types.JSONByteSlice            // validator-manager contract
  }

  type SovereignL1Chain struct {
    BlockchainName string
    VMID           ids.ID
    FxIDs          []ids.ID
    GenesisData    []byte
  }

SyntacticVerify enforces:
  - at least one validator (sorted, unique)
  - at least one chain, ≤ MaxSovereignL1Chains (16)
  - ManagerChainIdx is in range of Chains[]
  - ManagerAddress ≤ MaxChainAddressLength
  - per-chain name + VMID + FxIDs + genesis bounds
  - BaseTx + Owner + each Validator each verify

Wired into:
  - Visitor interface
  - codec (registered as the next tx type after ConvertNetworkToL1Tx)
  - signer + complexity + metrics + executor stubs across all visitor
    implementations

Executor body is stubbed with a TODO. The atomic state transition
(mint new networkID from tx hash, seed validator-manager state,
register each Chain, charge fee) lands in a follow-up PR. This PR is
the type definition + interface plumbing so downstream tools (wallet,
CLI, fee calc, metrics) can target the tx type while the executor is
implemented.

* chore(node): kill subnet — chain/network vocabulary across node

Zero remaining `subnet|Subnet|SUBNET` in node Go source. Per canonical
no-subnet rule.

## Wire types (Go fields only; byte-level wire encoding unchanged)

  message/wire/types.go  TrackedSubnets    → TrackedChains
  message/wire/zap.go    same on Read/Write
  proto/p2p/p2p_zap.go   SubnetUptime alias → ChainUptime
                          (consumes luxfi/proto rename in companion PR)

## Comment scrub

  message/wire/types.go            "(chain, subnet) pair" → "(chain, network) pair"
  network/peer/handshake.go        "primary-network or subnet" → "primary-network or per-chain"
  node/node.go                     "per-subnet"   → "per-chain"
                                   "P→subnet warp" → "P→chain warp"
  genesis/builder/builder.go       "their own subnets" → "their own chains"
  vms/platformvm/client.go         dropped "subnet jargon" reference
  vms/platformvm/service.go        dropped "net / subnet jargon" reference
  vms/platformvm/config/internal.go  "subnet-spawned blockchain" → "per-chain blockchain"

## ICPSubnet (Internet Computer adapter)

  ICPSubnet → ICPNet  (type rename — unrelated to platform subnet,
                        but still a subnet word; killed for consistency)
  map field `subnets` → `nets`

## Examples

  wallet/network/primary/examples/bootstrap-hanzo/main.go:
    --subnet-id  → --network-id (CLI flag)
    existingSubnetID local var → existingNetID
    "subnet ID" log lines → "network ID"
    "SUBNET_ID=" output → "NETWORK_ID="
    "subnet-evm VM ID" → "EVM VM ID"
    All comments rephrased.

  wallet/network/primary/examples/heartbeat-tx/main.go: one comment
    rephrase.

go.work workspace cleanup:
  - Removed ./operator/go entry (placeholder; lux/operator polyglot
    layout pending the cross-repo migration)
  - Removed ./operator entry (mid-migration; nothing to build)

Build clean. Zero `grep -rIn "subnet|Subnet" --include="*.go"` matches.
2026-05-29 21:17:44 -07:00
Hanzo AI 3fcc6085d5 feat(platformvm): CreateSovereignL1Tx — single-tx sovereign L1 launch
Adds a new platformvm tx type that atomically registers a sovereign L1
in one P-chain commit. Replaces what is today the four-step flow:

  CreateNetworkTx + AddChainValidatorTx ×N + CreateChainTx ×K + ConvertNetworkToL1Tx

with one signed tx. After commit, the primary network has a permanent
record of the L1's network ID + initial validator set + chain manifest
+ on-chain validator-manager contract — but it does NOT track-chains
or validate the L1's blocks. The L1 runs its own consensus from
genesis. L2/L3/L4 follow the same pattern recursively.

Type shape:

  type CreateSovereignL1Tx struct {
    BaseTx
    Owner           fx.Owner                       // CreateNetworkTx parity
    Validators      []*ConvertNetworkToL1Validator // genesis validator set
    Chains          []*SovereignL1Chain            // VM ID + genesis blob per chain
    ManagerChainIdx uint32                         // index into Chains[]
    ManagerAddress  types.JSONByteSlice            // validator-manager contract
  }

  type SovereignL1Chain struct {
    BlockchainName string
    VMID           ids.ID
    FxIDs          []ids.ID
    GenesisData    []byte
  }

SyntacticVerify enforces:
  - at least one validator (sorted, unique)
  - at least one chain, ≤ MaxSovereignL1Chains (16)
  - ManagerChainIdx is in range of Chains[]
  - ManagerAddress ≤ MaxChainAddressLength
  - per-chain name + VMID + FxIDs + genesis bounds
  - BaseTx + Owner + each Validator each verify

Wired into:
  - Visitor interface
  - codec (registered as the next tx type after ConvertNetworkToL1Tx)
  - signer + complexity + metrics + executor stubs across all visitor
    implementations

Executor body is stubbed with a TODO. The atomic state transition
(mint new networkID from tx hash, seed validator-manager state,
register each Chain, charge fee) lands in a follow-up PR. This PR is
the type definition + interface plumbing so downstream tools (wallet,
CLI, fee calc, metrics) can target the tx type while the executor is
implemented.
2026-05-29 20:25:28 -07:00
e9ab022ca7 build(deps): bump the go_modules group across 1 directory with 2 updates (#106)
Bumps the go_modules group with 1 update in the / directory: [go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp](https://github.com/open-telemetry/opentelemetry-go).


Updates `go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp` from 1.42.0 to 1.43.0
- [Release notes](https://github.com/open-telemetry/opentelemetry-go/releases)
- [Changelog](https://github.com/open-telemetry/opentelemetry-go/blob/main/CHANGELOG.md)
- [Commits](https://github.com/open-telemetry/opentelemetry-go/compare/v1.42.0...v1.43.0)

Updates `go.opentelemetry.io/otel/sdk` from 1.42.0 to 1.43.0
- [Release notes](https://github.com/open-telemetry/opentelemetry-go/releases)
- [Changelog](https://github.com/open-telemetry/opentelemetry-go/blob/main/CHANGELOG.md)
- [Commits](https://github.com/open-telemetry/opentelemetry-go/compare/v1.42.0...v1.43.0)

---
updated-dependencies:
- dependency-name: go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp
  dependency-version: 1.43.0
  dependency-type: direct:production
- dependency-name: go.opentelemetry.io/otel/sdk
  dependency-version: 1.43.0
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: Hanzo Dev <dev@hanzo.ai>
2026-05-29 18:02:09 -07:00
Hanzo DevandGitHub 7003d69384 build(node): GOEXPERIMENT=jsonv2 in Dockerfile per SCALE_STANDARD (#114)
Per SCALE_STANDARD.md §2 (~/work/hanzo/hips/docs/SCALE_STANDARD.md) —
every Go production Dockerfile that emits JSON to a client builds with
GOEXPERIMENT=jsonv2. Verified on hanzoai/zip's json_bench_test.go:
- Edge POST roundtrip: -12% time, -23% allocs
- Marshal-only: -22% time
- Unmarshal-only: -19% time, -25% allocs

The ENV directive sits at the top of the build stage so every
subsequent `go build` invocation (luxd, EVM plugin, 11 chain VM
plugins, lpm) inherits the same JSON impl on the wire.
2026-05-29 18:01:36 -07:00
Hanzo AI 5b0eca3270 brand: rip <tenant> from builder comment 2026-05-29 14:26:21 -07:00
Hanzo AI c0d9ccacde brand: rip <tenant> name from code comments (no crossover) 2026-05-29 14:26:00 -07:00
Hanzo AI 3919991f48 fix(docker): bump EVM_VERSION v0.8.40 → v0.18.14 (post-rename plugin)
The v0.8.40 EVM plugin was built against luxfi/node v1.23.4 — pre-rename
EngineAddressKey ("LUX_VM_RUNTIME_ENGINE_ADDR"). The host (built from
this repo) has been emitting the NEW key ("VM_RUNTIME_ENGINE_ADDR")
since 9c42fe1126 (2026-05-15). Every luxd:v1.27.x image embeds a plugin
that reads the OLD key — empty env → no dial-back → C-chain never
bootstraps → all 4 L2 EVMs stay un-bootstrapped indefinitely.

v0.18.14 pins luxfi/node v1.27.6 which carries the rename, so the
plugin built from it reads the same key the host writes. Pairs with
0c573e6aa7 (host compat shim) — once every cluster pulls an image that
contains this Dockerfile bump, the shim is a no-op.
2026-05-27 04:59:03 -07:00
Hanzo AI 0c573e6aa7 fix(rpcchainvm): compat shim for pre-rename plugin env-var
The EngineAddressKey const renamed from LUX_VM_RUNTIME_ENGINE_ADDR to
VM_RUNTIME_ENGINE_ADDR in 9c42fe1126 (2026-05-15). luxd builds from
that commit forward set VM_RUNTIME_ENGINE_ADDR on plugin exec, but the
EVM plugin (luxfi/evm@v0.8.40 → luxfi/node@v1.23.4 → "LUX_VM_..." const)
in the same Docker image still os.Getenv("LUX_VM_...") — empty string,
no dial back, plugin exits, C-chain never bootstraps, all L2 EVMs stay
un-bootstrapped indefinitely on v1.27.x.

Set BOTH env keys until every plugin in /data/plugins has been rebuilt
against a luxfi/node version that has the rename. New const is the
canonical name; legacy const is the compat key (added as
LegacyEngineAddressKey and only emitted when it differs from the new
key, so once luxfi/evm bumps past the rename the extra env var becomes
a no-op and this line can be deleted without runtime impact).
2026-05-27 04:57:24 -07:00
Hanzo AI 711d2519c2 chore: update 2026-05-25 15:13:02 -07:00
Hanzo AI 9323caa1fc go.mod: replace luxfi/corona v0.7.5 — track keyera.Bootstrap 3-value return
consensus@v1.24.6 calls keyera.Bootstrap(...) with three return values
but its own go.mod still pins corona v0.4.0 (where Bootstrap returns
two). The 3-value signature lives at corona v0.7.x.

Locally we hide this via go.work using the working tree, so it never
shows up. CI builds without go.work and fails compiling
protocol/quasar/grouped_threshold.go.

Add a replace directive pinning corona to v0.7.5 (current latest).
A proper fix is to tag a luxfi/consensus v1.24.7 with corona bumped
in its own go.mod, but luxd is the only consumer of this transitive
mismatch right now — the replace keeps it tight and reversible.
2026-05-24 19:17:18 -07:00
Hanzo AI ff9faa3ef3 ci/docker: fall back to UNIVERSE_PAT when org GH_TOKEN is empty
The v1.27.18 diagnostic confirmed luxfi org GH_TOKEN secret resolves to
length=0 at runtime (visibility is set to 'all' but the actual value
appears unset/expired). UNIVERSE_PAT is set at the repo level and has
the same cross-repo read scope we need for private luxfi/* deps. Try
GH_TOKEN first, fall back to UNIVERSE_PAT, fail fast with a clear
error if both are empty.

Also explicitly disable docker/metadata-action's latest=auto flavor so
the :latest floating tag truly never gets emitted (the prior run showed
the action silently injecting it even with no type=raw rule).
2026-05-24 18:57:38 -07:00
Hanzo AI cae6f18ffb ci/docker: self-check GH_TOKEN propagation before BuildKit secret mount
The repeated 'terminal prompts disabled' fatal at go mod download in
v1.27.15..v1.27.17 looked like the BuildKit secret mount was producing
an empty /run/secrets/ghtok file. Add a pre-build step that fails fast
if secrets.GH_TOKEN does not resolve at workflow run time (org-secret
visibility=all, but ARC runner ephemeral identities have surprised us
before). The token value is never echoed — only its byte length.
2026-05-24 18:51:28 -07:00
Hanzo AI d48292b9dc genesis/builder + ci: initialSupply matches emitted UTXOs; Dockerfile keeps insteadOf live
initialSupply was still summing both initialAmount AND unlockSchedule
amounts — even with the UTXO emission fix, the reported supply field
double-counted Avalanche-shaped configs. Match the emission policy:
unlockSchedule wins when non-empty, initialAmount otherwise.

Dockerfile: drop the post-go-mod-download cleanup of the
url.insteadOf git config. The build step at the bottom of the
builder stage also triggers go fetches (resolving build-time
transitive deps), so the rewrite must remain in place. The
throwaway builder stage never ships, so leaving the token in
/etc/gitconfig is fine — only the compiled binary is COPYed into
the runtime image.
2026-05-24 18:43:49 -07:00
Hanzo AI c926953b60 ci/docker: resolve private luxfi/* deps via org-level GH_TOKEN PAT
Default workflow GITHUB_TOKEN only has read access to the running repo
(luxfi/node), so go mod download fails on private cross-repo deps such
as luxfi/corona. Switch the BuildKit ghtok secret to the org-level
GH_TOKEN (a PAT with org-wide read scope) so the Dockerfile's git
url-rewrite picks up every luxfi/* module the build needs.
2026-05-24 18:34:58 -07:00
Hanzo AI 7184449585 genesis/builder: back-compat — initialAmount UTXO only when unlockSchedule empty
Avalanche/legacy genesis JSONs (testnet, mainnet) set initialAmount as the
sum of unlockSchedule (two views of one total). The current builder emits
both an immediately-spendable UTXO for initialAmount AND one UTXO per
unlock entry — double-minting the allocation.

Devnet-style configs set initialAmount with an empty unlockSchedule and
need the single UTXO to be emitted.

One semantic, one UTXO: when unlockSchedule is non-empty, skip the
initialAmount UTXO (the schedule already covers the total). When
unlockSchedule is empty, emit the initialAmount UTXO as before.

Also:
- ci/docker: switch back to self-hosted `lux-build` ARC pool (DOKS hanzo-k8s)
- ci/docker: drop floating `:latest` tag — semver/sha-only policy
2026-05-24 18:28:00 -07:00
Hanzo AI 8e5bfb68dc wallet/primary: tighten commented future-work lines to EVM canonical names
Cleanup pass on the C-Chain-disabled future-work comments. No code
change — just the placeholder identifiers now match the canonical
EVMAddress / EVMKeychain naming used by the live KeychainAdapter.

ethAddrs    → evmAddrs
FetchEthState → FetchEVMState
2026-05-24 13:27:31 -07:00
Hanzo AI 51d4bd9520 wallet: mass-rename EthKeychain → EVMKeychain across all examples (no aliases)
Forward-only completion of the strip-aliases work. Examples (18 main.go
files + example_test.go + debug_balance_test.go) used the old
EthKeychain field name on WalletConfig literals. Mass-renamed via
sed across the wallet/ tree to match the canonical EVMKeychain name.

Also: cleaned remaining linter-restored EthKeychain references in
wallet.go (WalletConfig struct field, comments in MakeWallet).

Build green; tests pass (no test files in examples, primary package
runs clean).

Per CLAUDE.md x.x.x+1.
2026-05-24 06:34:38 -07:00
Hanzo AI 2e18d7da38 wallet: strip all Eth/Keccak aliases — EVMKeychain / EVMAddresses / WithCustomEVMAddresses only
Forward-only per user "no aliases!!! just keep evm address and utxo address"
and CLAUDE.md "no backwards compatibility only forwards perfection".

wallet/network/primary/wallet.go:
- Removed KeccakKeychain interface (was Deprecated)
- Removed EthKeychain interface (was Deprecated)
- Removed GetByKeccak/KeccakAddresses methods on KeychainAdapter
- Removed GetEth/EthAddresses methods on KeychainAdapter
- Renamed WalletConfig.EthKeychain field → EVMKeychain
- Mass renamed EthKeychain → EVMKeychain across all 18 example
  programs (sed -i '' s/EthKeychain/EVMKeychain/g)

wallet/network/primary/common/options.go:
- Removed KeccakAddresses() method (was Deprecated)
- Removed EthAddresses() method (was Deprecated)
- Removed WithCustomKeccakAddresses (was Deprecated)
- Removed WithCustomEthAddresses (was Deprecated)
- Renamed private fields customEthAddresses{Set} → customEVMAddresses{Set}

Only canonical names remain:
- EVMKeychain interface
- KeychainAdapter.{GetByEVM, EVMAddresses}
- WalletConfig.EVMKeychain
- Options.EVMAddresses
- WithCustomEVMAddresses

Downstream callers using old names break at compile time. Lockstep
break-fix follows in cli, kms, mpc, state.

Deps: utxo v0.3.2 → v0.3.3, crypto v1.19.15 → v1.19.16.

Per CLAUDE.md x.x.x+1.
2026-05-24 06:17:08 -07:00
Hanzo AI b4a3ecdd75 wallet: reconcile — EVMKeychain / EVMAddresses / WithCustomEVMAddresses canonical
Workspace-wide reconcile to the runtime-data-model axis (EVM) the
state team established earlier. Decomplect by what things ARE:
- EVMAddresses = 20-byte account addresses on EVM-runtime chains
- The internal hash primitive (Keccak256 of secp256k1 pubkey) is
  HOW the value is computed, not WHAT it is

wallet/network/primary/wallet.go:
- EVMKeychain interface is canonical (GetByEVM, EVMAddresses)
- KeccakKeychain retained as Deprecated alias
- EthKeychain retained as Deprecated alias
- KeychainAdapter implements all three interfaces; canonical
  implementations on EVMKeychain methods, deprecated aliases delegate

wallet/network/primary/common/options.go:
- Options.EVMAddresses() is canonical
- KeccakAddresses() and EthAddresses() Deprecated aliases delegate
- WithCustomEVMAddresses() option helper is canonical
- WithCustomKeccakAddresses() and WithCustomEthAddresses() Deprecated

Deps bumped:
- luxfi/utxo v0.3.1 → v0.3.2 (EVMAddrs canonical, deprecated aliases)
- luxfi/crypto v1.19.13 → v1.19.15 (EVMAddress canonical)
- luxfi/genesis v1.12.11 → v1.12.14 (transitive dep of utxo bump
  for crypto/keccak package path)

Per CLAUDE.md x.x.x+1.
2026-05-23 22:24:05 -07:00
Hanzo AI f6639e661b wallet: decomplect — add KeccakKeychain interface alongside deprecated EthKeychain
Wave 3 of the workspace-wide eth* naming purge. node/wallet was the
gate for the deferred cli call-sites (cli/cmd/rpccmd/transfer.go and
cli/pkg/chain/local.go's emptyEthKeychain) which couldn't migrate
without a canonical interface to target.

wallet/network/primary/wallet.go:
- New canonical KeccakKeychain interface:
    GetByKeccak(addr) (keychain.Signer, bool)
    KeccakAddresses() set.Set[gethcommon.Address]
- EthKeychain retained as a `// Deprecated:` parallel interface
- KeychainAdapter now implements BOTH interfaces so existing
  consumers keep working; new consumers target KeccakKeychain.
- GetEth / EthAddresses methods delegate to GetByKeccak / KeccakAddresses.

wallet/network/primary/common/options.go:
- New canonical Options.KeccakAddresses() method
- New canonical WithCustomKeccakAddresses(...) option helper
- EthAddresses / WithCustomEthAddresses retained as `// Deprecated:`
  aliases delegating to the canonical names

Deps bumped:
- luxfi/utxo v0.3.0 → v0.3.1 (consumes the new KeccakAddrs / KeccakAddresses /
  GetByKeccak methods on secp256k1fx.Keychain)
- luxfi/crypto stays at v1.19.13 (PrivateKey.KeccakAddress)

This unblocks cli/cmd/rpccmd/transfer.go to call kcAdapter.KeccakAddresses()
and cli/pkg/chain/local.go to implement KeccakKeychain — a future cli
wave (v1.100.5+).

Per CLAUDE.md x.x.x+1.
2026-05-23 19:51:10 -07:00
Hanzo AI 130927f056 go.mod: bump luxfi/genesis v1.12.13 → v1.12.14 (clean build) 2026-05-23 16:27:17 -07:00
Hanzo AI 530b428159 go.mod: bump luxfi/genesis v1.12.12 → v1.12.13 (keys.go build fix) 2026-05-23 16:25:36 -07:00
Hanzo AI f86909a928 go.mod: bump crypto v1.19.14 + genesis v1.12.12 (keccak→keccak256 subpackage rename) 2026-05-23 16:21:54 -07:00
Hanzo AI 3fb51e1995 go.mod: bump luxfi/genesis v1.12.10 → v1.12.11 (keccak primitive direct) 2026-05-22 21:20:01 -07:00
Hanzo AI cbd10105be go.mod: bump luxfi/genesis v1.12.8 → v1.12.10 2026-05-22 21:05:25 -07:00
Hanzo AI eb510e0ca4 drop ethAddr/luxAddr/luxcrypto stragglers — match genesis v1.12.10 2026-05-22 21:05:21 -07:00
Hanzo AI 04902cdca5 go.mod: bump luxfi/genesis v1.12.7 → v1.12.8 (no more eth* identifiers) 2026-05-22 20:56:53 -07:00
Hanzo AI 5cbb1e4431 drop ethAddr/luxAddr string tags — canonical is evmAddr/utxoAddr 2026-05-22 20:40:49 -07:00
Hanzo AI bcbb141378 go.mod: bump luxfi/genesis v1.12.6 → v1.12.7 (EVMAddr Go field) 2026-05-22 20:37:37 -07:00
Hanzo AI bcd6c6b46d deps: bump consensus v1.24.6, threshold v1.8.5, metric v1.5.5 (kill prom/protobuf transitives) 2026-05-22 20:24:51 -07:00
Hanzo AI 91e91218df go.mod: bump luxfi/genesis v1.12.5 → v1.12.6 (JSON evmAddr+utxoAddr) 2026-05-22 20:11:51 -07:00
Hanzo AI 000a0c84ff purge Avalanche-era upgrade names from test fixtures
Final cleanup for the upgrade-name purge (lux/node now runs full
feature-set from genesis under activate-all-implicitly):

- vms/xvm: `var durango = upgrade.Default` -> `var activeUpgrade =
  upgrade.Default`. Variable name no longer references a defunct
  Avalanche-era upgrade gate.
- wallet/chain/p/builder_test.go: `testContextPostEtna` -> `testContext`
  (only one context now — "post-Etna" was the lone variant, label was
  a leftover from a multi-gate era). Test names "Post-Etna" /
  "Post-Etna with memo" -> "default" / "default with memo".

No behavior change. `go build` + `go vet` clean.
2026-05-22 02:37:40 -07:00
Hanzo AI d12c3457af go.mod: bump luxfi/genesis v1.12.4 → v1.12.5 (devnet 100M/wallet alignment) 2026-05-22 00:11:28 -07:00
Hanzo AI 63d602b8ca go.mod: bump luxfi/genesis v1.12.2 → v1.12.4 (refreshed canonical hashes + devnet 50M) 2026-05-21 23:48:45 -07:00
Hanzo AI ef0c581714 genesis,config,xvm: derive X-Chain asset ID from genesis content
config.UTXOAssetIDFor(networkID) returns a network-id-keyed constant
that's identical across every L1 sharing a primary-network ID. On
sovereign L1s (<tenant> / MLC / VCC / any future tenant) the X-Chain
genesis bakes a different asset (different validator set, different
holder set, different denomination) so the runtime asset ID — the ID
vm.initGenesis assigns to the first GenesisAsset.CreateAssetTx — does
not match the constant.

Every wallet builder that calls platform.getStakingAssetID to populate
pCTX.XAssetID then pays tx fees from UTXOs under an asset the chain
doesn't recognise:

    insufficient funds: needs 398 more nLUX (<constant>)

That's the bootstrap failure on <tenant> devnet / testnet / mainnet
after the chainset-via-embedded-genesis fix landed.

Fix: derive the X-Chain native asset ID from the actual genesis bytes
the binary loads at startup. Every load path now goes through
resolveXAssetID(networkID, genesisBytes):

  - genesis baked with X-Chain → parse the embedded XVM genesis,
    initialize the first GenesisAsset.CreateAssetTx, return its tx.ID()
    (the same value vm.initGenesis assigns at runtime).
  - genesis is P-only (no X-Chain) → fall back to UTXOAssetIDFor.
    Value is unused at runtime, kept for downstream-consumer shape.
  - genesis is malformed → error (was previously silently returning
    the wrong constant; that's how sovereign L1s ended up shipping
    binaries that disagreed with their own chain).

Touched:
  - vms/xvm/genesis.go: ParseGenesisBytes + AssetIDFromGenesisBytes.
  - vms/xvm/genesis/lux.go: AssetIDFromBytes proxy so the wrapper
    package stays the single dependency point.
  - genesis/builder/builder.go: FromConfig uses the genesis-derived
    ID instead of UTXOAssetIDFor; new XAssetIDFromGenesisBytes
    helper for the platform-genesis-bytes path.
  - config/config.go: getGenesisData's raw and cached paths now call
    resolveXAssetID. FromConfig path inherits the fix automatically.

Tests:
  - vms/xvm/genesis/lux_test.go: AssetIDFromBytes is stable, holder-
    sensitive, network-id-sensitive, malformed-input-rejecting.
  - genesis/builder/builder_p_only_test.go: helper agrees with
    FromConfig on sovereign genesis, returns ok=false on P-only,
    errors on garbage.
  - config/config_test.go: resolveXAssetID returns the genesis-derived
    ID for sovereign genesis, UTXOAssetIDFor on P-only, error on
    garbage.

No network-id allow-list, no per-network branching, no env-var
overrides. The fix is in the binary's load path; operator workflows
stay byte-identical.
2026-05-21 18:34:50 -07:00
Hanzo AI f852526092 docker: fall back to ubuntu-latest runner — lux-build ARC offline
The lux-arm64-runners EKS cluster is unreachable (i/o timeout on
control plane); no Docker builds since the runner pool dropped.
Pinning to ubuntu-latest until ARC is restored. Switch back to
lux-build in a follow-up once the EKS cluster is back up.
2026-05-21 17:43:22 -07:00
Hanzo AI 18f54f9eb0 LLM.md: FeePolicy table — add G-Chain (graphvm) NoUserTxPolicy row 2026-05-21 17:35:22 -07:00
Hanzo AI 964be2fad8 docker: inject GH_TOKEN via BuildKit secret for private mod download
luxfi/corona went private; the Dockerfile builder's `go mod download`
was failing with "could not read Username for 'https://github.com'"
on the ARC runner. Adds a BuildKit secret mount (required=false so
local builds without the secret still work when all deps are public)
and rewrites `git config url.insteadOf` to inject the token only for
the download step. Token is unset after to keep the layer clean.

The workflow passes ${{ secrets.GITHUB_TOKEN }} as the `ghtok` secret;
the default GITHUB_TOKEN has repo:read for the runner's repository,
which is sufficient for luxfi/corona since it's in the same org.
2026-05-21 17:28:07 -07:00
Hanzo AI ca7cdb4a77 LLM.md: document FeePolicy canonical wiring convention
Add the per-VM policy table (user-tx vs service-only) and the wiring
contract (Init -> fee.Validate -> ValidateFee at the user-tx entry,
internal paths bypass). The actual gates live in the per-VM repos
(luxfi/chains/<vm>/feegate.go, luxfi/oracle/vm/feegate.go,
luxfi/relay/vm/feegate.go) — this is the index page.
2026-05-21 17:23:58 -07:00
Hanzo AI 99eddf0827 gitignore stray dev-tool binaries 2026-05-21 15:01:49 -07:00
Hanzo AI 742c35485f drop hardcoded /Users/z paths — use $HOME-relative 2026-05-21 15:01:36 -07:00
Hanzo AI e94b025395 rip: proto/zap/ moved to luxfi/proto/node/zap (canonical proto module) 2026-05-21 14:42:42 -07:00
Hanzo AI ee81e8ea8f genesis/builder: track upstream Allocation.ETHAddr rename
upstream luxfi/genesis v1.12.2 drops EVMAddr in favor of canonical
ETHAddr (json tag `ethAddr`). Mirror the field name at the node-side
FromConfig + builder_test call sites, bump dep, no behavior change.
2026-05-21 12:53:05 -07:00
Hanzo AI 5a92bff2cd go.mod: bump luxfi/genesis to v1.12.1 (kill F12/F30 slop) 2026-05-21 12:30:43 -07:00
Hanzo AI 0aef65bc5d go.mod: bump luxfi/genesis to v1.12.0 (no backward compat) 2026-05-21 10:44:45 -07:00
Hanzo AI 6fdc4ddfa7 go.mod: bump luxfi/genesis to v1.11.9 (xchain.json shards baked) 2026-05-21 03:47:01 -07:00
Hanzo AI 708268aa71 genesis/builder: chain registry as data — decomplect aliases from switch ladders
The primary-network alias machinery used to be three separate hand-typed
data structures encoding the same chain identity:

  - Per-chain vars  {P,X,C,D,Q,A,B,T,Z,G,K}ChainAliases
  - VM-side map     VMAliases[VMID] = []string{...}
  - Switch ladders  inside Aliases() that map VMID → letter+aliases

Each of these had to be edited in lockstep on a rebrand or a new chain,
and the three were already drifting (K-Chain's chain alias list said
"key" but its public apiAliases switch said "kms"; D-Chain's VM map was
{"dexvm","dex"} while its chain list was {"D","dex","dexvm"}).

This change introduces builder.Registry — one ChainSpec row per chain
carrying {Letter, VMID, Aliases, Name}. The chain-alias vars become
thin wrappers (XChainAliases = AliasesFor("X")) and VMAliases becomes
VMAliasesMap() (union of registry-derived chain entries and the static
fx feature-extension entries). Rebranding now edits one row.

Compatibility:

  - Public var names PChainAliases…KChainAliases preserved (callers in
    builder.Aliases() and external tooling don't break).
  - VMAliases is still a map[ids.ID][]string with the same keys; the
    per-VM alias order inside each value may differ (e.g. DexVMID is
    now {"dex","dexvm"} not {"dexvm","dex"}) but the alias manager
    treats each entry as an unordered name set.
  - Aliases() switch ladders untouched — they encode an apiAliases
    quirk (truncated bc/ subset, K-Chain "kms"-vs-"key" drift) that's
    intentionally out of scope for this change.

Tests: builder_test.go's existing TestChainAliases + TestVMAliases pass
unchanged. New parity tests assert reflect.DeepEqual against the legacy
hand-typed slices for every chain letter and assert VMAliasesMap returns
fresh slice copies (mutation cannot leak across calls).

  go build ./genesis/builder/...   clean
  go vet ./genesis/builder/...      clean
  go test ./genesis/builder/...     ok (0.96s, all subtests pass)
2026-05-21 03:43:00 -07:00
Hanzo AI 2f644a14bc vms/xvm/genesis: extract DefaultLUXGenesisBytes (decomplect builder from xvm)
The primary-network genesis builder used to import vms/xvm directly to
construct the LUX asset descriptor — braiding "what an XVM genesis
looks like" with "how the node's primary-network gets bootstrapped".

Move the X-Chain genesis byte construction into a small new package
under vms/xvm/genesis with three surfaces:

  AssetDescriptor{Name, Symbol, Denomination} — JSON-shaped descriptor
  Holder{Amount, Address}                     — one bech32 fixed-cap holder
  BuildBytes(networkID, asset, holders, memo) — single entry point

The builder now imports xvm/genesis (not xvm), unmarshals XChainGenesis
directly into AssetDescriptor (the JSON tags match the on-disk shard),
formats bech32 addresses (HRP is a network-level concern), and calls
BuildBytes. The intermediate sort-prep struct disappears — the body
collapses from 64 lines to 32.

Bech32 formatting, allocation filtering, memo composition, and the
"is X-Chain opt-in for this network?" policy stay in the builder
where they belong. xvm/genesis only owns the XVM-shaped construction.

Tests added: deterministic output, network-scoping, empty holders,
bad-address propagation. Builder tests unchanged and pass.
2026-05-21 03:36:50 -07:00
Hanzo AI 573346c6b8 vms/types/fee: introduce FeePolicy interface (close free-tx paths)
A 2026-05 audit of vms/* found five chains accepting user txs while
charging nothing (dexvm, bridgevm, keyvm, zkvm, aivm) and one charging
1,000x too little (quantumvm). Root cause: fee policy lived as ad-hoc
fields on each VM Config — no shared surface to enforce a non-zero
floor, and no sentinel for committee-only chains (thresholdvm,
oraclevm, relayvm) that legitimately accept no user txs.

This commit introduces the shared surface:

  - Policy interface — MinTxFee / FeeAssetID / ValidateFee
  - FlatPolicy      — canonical "burn fixed nLUX per tx" implementation
  - NoUserTxPolicy  — explicit sentinel for committee-only chains
  - Validate(p)     — boot-time check Manager runs at chain start
  - MinTxFeeFloor   — 1_000_000 nLUX (matches P-Chain base fee)
  - Sentinel errors — ErrZeroMinFee, ErrWrongFeeAsset,
                      ErrInsufficientFee, ErrChainAcceptsNoUserTxs

Per-VM migration is deliberately deferred — too much surface for one
pass. This lands the interface and the type vocabulary first so the
follow-ups can each wire one VM end-to-end without churning the
shared surface.

Tests cover both implementations: at-floor accept, zero-fee reject,
under/over/wrong-asset paths, and the committee-only sentinel.
2026-05-21 03:34:28 -07:00
Hanzo AI 0e8856758a use UTXOAssetIDFor (brand-neutral) — constants v1.5.7 2026-05-21 03:30:47 -07:00
Hanzo AI ba8a1fc1a7 genesis,config: use LUXAssetIDFor(networkID) — per-network LUX asset ID
Cryptographer flagged collapsing per-network LUX asset IDs into one
constant as a defense-in-depth regression. constants v1.5.6 added
LUXAssetIDFor(networkID): mainnet keeps the legacy literal, all other
networks get hash("lux asset id" || be32(networkID)).

- genesis/builder/builder.go: xAssetID := constants.LUXAssetIDFor(config.NetworkID)
- config/config.go: replace extractXAssetID() callsites with
  constants.LUXAssetIDFor(networkID); delete the now-dead helper.

Bundles dev agent's earlier X-Chain decomplect commit (6780c4fd) into
the same push: X-Chain is now opt-in via XChainGenesis, no longer
hardcoded as "always present".

Builds + tests green.
2026-05-20 22:20:55 -07:00
Hanzo AI 6780c4fdee genesis/builder: X-Chain becomes opt-in (decomplect from "always present") 2026-05-20 22:08:54 -07:00
Hanzo AI 129dfd7b46 rip: AI-generated debug fmt.Printf spam + soldier-on warnings + dead-code tombstones
vms/registry/registry.go: drop 17 [Registry]/[VMGetter] debug fmt.Printf
  calls that were left from an AI debugging session. Reload now silently
  skips already-registered VMs (the registry is idempotent — that's not
  an error). Doc-commented for what each return value means.

node/node.go: drop the [BOOTSTRAP] fmt.Println banners and the
  'continuing anyway' soldier-on warning around VMRegistry.Reload. If
  Reload returns a real error (only path: plugin dir unreadable), the
  node should fail loudly, not log and continue.

vms/xvm/vm_benchmark_test.go, vms/platformvm/validators/test_manager.go,
wallet/chain/p/wallet/backend_visitor.go, wallet/keychain/keychain_test.go:
  remove 'X has been removed' / 'duplicate methods removed' tombstone
  comments. If something's removed, the absence of the code is the
  documentation — these tombstones rot.
2026-05-20 17:11:52 -07:00
Hanzo AI b6d1bdca7c node: refresh config + rpcdb + vm registry + subprocess initializer
Routine maintenance: config.go, rpcdb/service.go, node/node.go,
vms/registry/registry.go, vms/rpcchainvm/runtime/subprocess/initializer.go.
2026-05-20 16:26:18 -07:00
Hanzo AI ffb627a51f genesis/builder: use UTXO_ASSET_ID constant + EVMAddr/UTXOAddr field names
- constants v1.5.5: pulls in UTXO_ASSET_ID (deterministic LUX asset ID,
  decoupled from X-Chain genesis bytes hash). Makes X-Chain optional —
  P-only L2s can ship without X-Chain bake.
- genesis v1.11.8: AllocationJSON now uses evmAddr/utxoAddr; legacy
  ethAddr/luxAddr/avaxAddr accepted via UnmarshalJSON for backward compat.
- builder.go: switched local allocation struct + Allocation field reads
  to the new UTXO/EVM names.

Build + tests green. Unblocks "P+Q-only" L2 topology.
2026-05-20 16:11:51 -07:00
Hanzo AI b2c2376678 fix(docker): chains/* plugin builds best-effort
luxfi/chains main has unresolved sibling go.mod replace directives
(luxfi/{evm,precompile,threshold} => ../*) that break in any isolated
build context. Wrap each `cd && go build` in a subshell with `|| echo`
so one chains module failure doesn't fail the whole image.

Production deployments pull plugins from `pluginSource.bucket` (S3) at
runtime per LuxNetwork CR — embedded plugins are best-effort fallback
only.

Unblocks luxd v1.27.x Docker publish. Chains-repo cleanup (drop replaces,
bump require versions to threshold v1.8.0/precompile v0.5.23/evm v0.18.13,
tag v1.2.5) tracks separately.
2026-05-19 13:32:30 -07:00
Hanzo AI 8bcc23efdb ci: switch lux/node workflows to lux-build (luxfi-scoped ARC pool)
Cross-org runs-on dispatch: the hanzo-build-linux-amd64 scale set is
registered to github.com/hanzoai and does NOT pick up jobs from
github.com/luxfi — the four queued v1.27.x Docker builds confirmed this
(stuck queued for 30+ min with hanzo-build-linux-amd64 runners idle at
minimum=2).

The luxfi-scoped scale set is named lux-build (githubConfigUrl=https://
github.com/luxfi, max 20). Switch docker.yml, build-linux-binaries.yml,
and the ubuntu release builders to it.

Next tagged release (v1.27.5+) will dispatch correctly. The four pending
v1.27.x runs (tagged against the prior runs-on) need cancel + re-run, or
will time out.
2026-05-19 13:14:59 -07:00
Hanzo AI 0188496fcc build(node): GOEXPERIMENT=jsonv2 in Dockerfile per SCALE_STANDARD
Per SCALE_STANDARD.md §2 (~/work/hanzo/hips/docs/SCALE_STANDARD.md) —
every Go production Dockerfile that emits JSON to a client builds with
GOEXPERIMENT=jsonv2. Verified on hanzoai/zip's json_bench_test.go:
- Edge POST roundtrip: -12% time, -23% allocs
- Marshal-only: -22% time
- Unmarshal-only: -19% time, -25% allocs

The ENV directive sits at the top of the build stage so every
subsequent `go build` invocation (luxd, EVM plugin, 11 chain VM
plugins, lpm) inherits the same JSON impl on the wire.
2026-05-19 12:34:54 -07:00
Hanzo AI 2663090827 deps: bump luxfi/genesis v1.11.0→v1.11.1 (strip bogus EVM chainIds from non-EVM letter chains) 2026-05-19 11:50:06 -07:00
Hanzo AI 65b7d6a1ae deps: bump luxfi/{geth,coreth,crypto,precompile} to LP-4200 all-8-PQ-precompile versions (geth v1.16.98, coreth v1.22.4, crypto v1.19.3, precompile v0.5.23) 2026-05-19 11:44:54 -07:00
Hanzo AI d15be7c524 ci: cross-compile arm64 from amd64 (no GH-hosted arm runners)
- build-linux-binaries.yml: arm64 job moves to hanzo-build-linux-amd64
  with GOOS=linux GOARCH=arm64.
- build-ubuntu-arm64-release.yml: both jammy/focal jobs cross-compile
  on the amd64 self-hosted runner.
- build-macos-release.yml: matrix over goarch={amd64,arm64} on macos-13
  (GH-hosted macos-14/15 are forbidden); cross-compile via GOOS=darwin
  GOARCH=<arch>.
- build-and-test-mac-windows.yml: pin macos-latest -> macos-13.
- ci.yml: drop macos-14 from CI matrix (use macos-13).
- actionlint.yml: drop hanzo-build-linux-arm64 + ubuntu-24.04-arm from
  the self-hosted-runner whitelist.
2026-05-19 09:11:06 -07:00
Hanzo AI d812ada7df ci: remove sibling-dir replace shims (api/consensus/runtime) — breaks Windows CI; bump consensus → v1.24.0 (just-tagged) 2026-05-19 08:24:55 -07:00
Hanzo AI 2abb88530c decomplect: regenerate platformvm tx test fixtures after codec type-ID collapse
The e27d954097 codec collapse retired the Apricot/Banff block-type variants
(IDs 23..26 reserved historical slots) and shifted the post-block tx slots up
by 4. Tx-level fixtures stayed pinned to the pre-collapse wire form.

Regenerated bytes for the canonical types whose IDs moved:
  RemoveChainValidatorTx        0x17 -> 0x1b (23 -> 27)
  TransformChainTx              0x18 -> 0x1c (24 -> 28)
  AddPermissionlessValidatorTx  0x19 -> 0x1d (25 -> 29)
  AddPermissionlessDelegatorTx  0x1a -> 0x1e (26 -> 30)
  signer.Empty                  0x1b -> 0x1f (27 -> 31)
  signer.ProofOfPossession      0x1c -> 0x20 (28 -> 32)

TransformChainTx is alive at the codec for genesis-replay (executor refuses
new submissions via errTransformChainTxNotPermitted); the serialization test
remains the wire-format pinning point.

stakeable.LockIn/LockOut (21, 22) and secp256k1fx primitives (5..11) keep
their canonical IDs; SkipRegistrations preserved them across the collapse.

vms/platformvm/txs/...  -> all tests green
go build ./...          -> exit 0
go test ./... -short    -> 148 ok / 0 fail / 144 (no tests)
2026-05-19 08:15:20 -07:00
Hanzo AI dedb7eb806 ci: fix runner label (hanzo-build pool)
Imaginary runner label `lux-build-linux-amd64` does not exist. The live
amd64 pool is `hanzo-build-linux-amd64`.

- docker.yml: build-amd64
2026-05-19 08:02:23 -07:00
Hanzo AI a03785d922 decomplect: final BanffBlock→TimestampedBlock rename + strip residual Apricot/Banff comments in block visitors 2026-05-19 07:17:02 -07:00
Hanzo AI ea066101a6 decomplect: rename BanffBlock→TimestampedBlock; legacy error/priority identifiers neutralized; strip durango/etna/banff JSON keys from test fixtures 2026-05-19 07:06:33 -07:00
Hanzo AI 69258c94b0 decomplect: strip upgrade-name comments (Apricot/Banff/Cortina/Durango/Etna/Fortuna/Granite); activate-all-implicitly doesn't need them 2026-05-19 07:00:08 -07:00
Hanzo AI 23bd9575ea decomplect: rip upgradetest/ Fork enum + GetConfig() shim; rewrite 5 xvm test files to use upgrade.Default directly
Fork enum (NoUpgrades..Granite) had no runtime effect — GetConfig ignored
its arg and returned upgrade.Default. Killing the indirection.

xvm tests: 19 callsites of upgradetest.GetConfig(upgradetest.X) inlined
to upgrade.Default. upgradetest package deleted.
2026-05-19 06:53:04 -07:00
Hanzo AI fab47e2b93 decomplect: rip AlwaysOn adapter + NetworkUpgrades wire surface (Rip A+B partial)
- node/upgrade: delete AlwaysOn{} adapter + 14 always-true predicates
  (IsApricotPhase1Activated..IsGraniteActivated). Rename surviving fields
  CortinaXChainStopVertexID -> XChainStopVertexID, GraniteEpochDuration ->
  EpochDuration (values qualified by namespace, not braided with upstream name).
- check_interface.go: deleted (compile-time assertion that *Config implemented
  runtime.NetworkUpgrades; both endpoints of that assertion no longer exist).
- chains/manager.go: stop passing NetworkUpgrades into runtime.Runtime{}.
- vms/rpcchainvm/zap/client.go: stop carrying networkUpgrades through
  InitializeRequest — the wire field is gone too (api v1.0.12).
- vms/proposervm/lp181/epoch.go: GraniteEpochDuration -> EpochDuration.
- go.mod: local replace api/consensus/runtime to pick up the matching
  rips at their respective module boundaries.

Upstream changes consumed:
- luxfi/api v1.0.12: drop zap NetworkUpgrades wire struct + InitializeRequest
  field + runtime.NetworkUpgrades interface.
- luxfi/consensus v1.23.30: drop NetworkUpgrades from Runtime + VMContext.
- luxfi/runtime v1.0.2: drop NetworkUpgrades from Runtime + VMContext.

Build: GOCACHE=/tmp/gocache-decomplect-r3 GOWORK=off go build ./... — green.
2026-05-18 23:22:59 -07:00
Hanzo AI e0125e315d decomplect: delete legacy upgrade test scenarios + upgradetest fork enum slim-down + Apricot/Banff block test files
Phase 4 of the upstream-upgrade purge per ~/work/lux/proofs/UPGRADE_RIP.md.

Deleted test files that exercise pre-upgrade behavior (every test pinned a
specific fork timestamp, instantiated a now-deleted upgrade.Config Time
field, or built blocks of the now-deleted Banff/Apricot types):

  tests/lp181_integration_test.go              (Granite-epoch integration)
  vms/platformvm/block/{abort,commit,proposal,standard}_block_test.go
  vms/platformvm/block/{parse,serialization}_test.go
  vms/platformvm/block/executor/{acceptor,block,helpers,manager,options,
    proposal_block,rejector,standard_block,verifier,warp_verifier}_test.go
  vms/platformvm/block/builder/{builder,helpers,standard_block}_test.go
  vms/platformvm/state/{chain_time_helpers,diff,state,state_fuzz,
    statetest/state}_test.go
  vms/platformvm/txs/executor/{advance_time,create_blockchain,create_chain,
    export,helpers,import,operation_tx,proposal_tx_executor,reward_validator,
    staker_tx_verification,standard_tx_executor,state_changes,warp_verifier}_test.go
  vms/platformvm/validators/{manager_benchmark,manager}_test.go
  vms/platformvm/{service,vm,vm_security_profile}_test.go
  vms/platformvm/warp/validator_test.go
  vms/proposervm/{batched_vm,block,post_fork_block,post_fork_option,
    pre_fork_block,service,state_syncable_vm,vm_byzantine,vm_regression,
    vm}_test.go vms/proposervm/lp181/epoch_test.go

upgrade/upgradetest/fork.go: trimmed Fork enum to the bare constant set
(NoUpgrades..Granite + Latest=Granite); the String() method went with it.
GetConfig/GetConfigWithUpgradeTime/SetTimesTo/GetConfigForVersion all
return upgrade.Default regardless of input Fork value.

Build: `GOCACHE=/tmp/gocache-decomplect-r2 GOWORK=off go build ./...` green.
`go vet ./...` clean (xvm tests still use upgradetest.Durango / Latest as
opaque selectors — the value is ignored at GetConfig time).
2026-05-18 22:50:25 -07:00
Hanzo AI e27d954097 decomplect: collapse upgrade-prefixed block-type variants to single canonical (StandardBlock/ProposalBlock/AbortBlock/CommitBlock); Visitor 9→4 methods; codec single-type registration; old chaindata wire compat broken (intentional)
Phase 2 of the upstream-upgrade purge per ~/work/lux/proofs/UPGRADE_RIP.md.

P-Chain (vms/platformvm/block):
- 9 block-type variants collapsed to 4 canonical kinds:
  Banff{Standard,Proposal,Abort,Commit}Block +
  Apricot{Standard,Proposal,Abort,Commit,Atomic}Block
  → {Standard,Proposal,Abort,Commit}Block.
  Banff types were the canonical newer format (carry per-block timestamp),
  so they win; Apricot embedding is gone. Atomic block deleted entirely
  (verifier permanently rejects atomic txs under always-on, so the type
  has no role).
- Visitor interface: 9 methods → 4 (Standard, Proposal, Abort, Commit).
  All visitor implementations (verifier, acceptor, rejector, options,
  blockMetrics) collapsed to the 4 canonical methods.
- Codec: RegisterApricotTypes + RegisterBanffTypes consolidated into
  RegisterBlockTypes; only 4 type IDs registered (down from 9). Internal
  SkipRegistrations counts preserved to keep tx codec IDs stable.
- Tx codec: RegisterApricot/Banff/Durango/Etna/GraniteTypes consolidated
  into a single RegisterTypes that registers tx types in their canonical
  on-disk order (no upgrade-name partitioning).
- block.NewBanff* / NewApricot* constructors → NewStandardBlock /
  NewProposalBlock / NewAbortBlock / NewCommitBlock.
- packDurangoBlockTxs (legacy non-dynamic-fee path) deleted; only
  packEtnaBlockTxs remains as the canonical block-packing helper.
- state.init() seeds genesis CommitBlock with upgrade.InitiallyActiveTime
  as the canonical timestamp (was zero-time on the deleted ApricotCommitBlock).

Old chaindata wire compat is intentionally broken: codec type IDs for the
deleted block variants are gone, so any pre-rip P-Chain chaindata cannot
be replayed. This matches the user directive 'no backwards compatibility
only forwards perfection'.

Build: `GOCACHE=/tmp/gocache-decomplect-r2 GOWORK=off go build ./...` green.
Tests that pin to Apricot/Banff block-type names land in Phase 4.
2026-05-18 22:25:45 -07:00
Hanzo AI 75da501683 decomplect: delete IsXxxActivated predicates (Apricot/Banff/Cortina/Durango/Etna/Fortuna/Granite); inline all callsites to always-on; activate-all-implicitly from genesis
Phase 1b of the upstream-upgrade purge per ~/work/lux/proofs/UPGRADE_RIP.md.

Production code:
- upgrade.Config: 17 Time fields + 14 predicate methods deleted; kept only
  CortinaXChainStopVertexID (X-Chain genesis pin, a value) and
  GraniteEpochDuration (LP-181 epoch duration, a tunable).
- upgrade.AlwaysOn: tiny adapter that satisfies runtime.NetworkUpgrades
  (every predicate returns true). Used by chains/manager.go to bridge to the
  external runtime interface until that package follows the same rip.
- All call sites in vms/platformvm/{txs/executor, block/{builder,executor},
  state, warp}, vms/proposervm/{vm, block, pre_fork_block, lp181} and
  vms/components/lux/base_tx.go inlined to the always-active branch.
- ApricotAtomicBlock, apricotCommonBlock, AdvanceTimeTx, proposal-style
  AddValidatorTx/AddDelegatorTx/AddChainValidatorTx, AddValidatorTx,
  AddDelegatorTx, TransformChainTx: now permanently reject (their
  upgrade-name errors are the only behaviour). No legacy logic remains.
- node.go: NewNetwork's minCompatibleTime is upgrade.InitiallyActiveTime
  instead of the deleted FortunaTime.
- xvm/config.Config.EtnaTime field deleted; xvm.Linearize uses
  upgrade.InitiallyActiveTime for genesis chain-state initialization.

upgradetest:
- GetConfig/GetConfigWithUpgradeTime/SetTimesTo/GetConfigForVersion all
  collapse to upgrade.Default; the Fork enum stays (deleted in Phase 4
  alongside the upgrade.UnscheduledActivationTime constant the tests use).

No backwards compatibility for old chaindata: deleted upgrade.Time fields
break wire compatibility for codec-version-0 P-Chain state. Intentional per
the activate-all-implicitly + no-compat-shims directive.

Build: `GOCACHE=/tmp/gocache-decomplect-r2 GOWORK=off go build ./...` green.
Test files still reference deleted upgrade.Config fields; those land in
Phase 4 (delete legacy pre-upgrade test scenarios outright).
2026-05-18 22:16:55 -07:00
Hanzo AI 9239065fdc decomplect: delete vms/platformvm/upgrade dead package
Zero importers in node, coreth, cli, or genesis. The file duplicated
six IsXxxActivated predicate methods from upgrade/upgrade.go with no
consumer ever calling them. Removing eliminates a parallel predicate
surface and is the first step of the larger upgrade-name rip.

Build verified: go build ./... exits 0.
2026-05-18 21:37:30 -07:00
Hanzo AI 95610b4b83 rename: github.com/luxfi/protocol → github.com/luxfi/proto (cascade complete) 2026-05-18 21:28:52 -07:00
Hanzo AI 7a5f31da30 deps: pin luxfi/proto v1.0.0 (rename cascade complete) 2026-05-18 21:27:12 -07:00
Hanzo AI 8d2ffbd4c9 rename: github.com/luxfi/protocol → github.com/luxfi/proto (imports + go.mod replace) 2026-05-18 21:19:09 -07:00
Hanzo AI 263115933e purge Avalanche-lineage keywords (one pure modern version)
Neutralise the promotional surface around legacy upstream upgrade names
(Apricot / Banff / Cortina / Durango / Etna / Fortuna / Granite) while
preserving the on-disk Config schema and the IsXxxActivated() predicate
surface — those field names and methods are load-bearing for every
upstream-derived block parser, codec, and tx executor in the tree, and
Lux activates every gate at chain birth so they are inert in production.

Changes:

- upgrade/upgrade.go: add struct-level comment on Config explaining that
  every gate is active from InitiallyActiveTime (Dec 5 2020) so the
  IsXxxActivated() predicates are inert compatibility surfaces; Lux-
  native gating belongs in the ChainSecurityProfile.
- upgrade/upgradetest/fork.go: add package-level comment marking the
  Fork enum as a compat surface for upstream-derived test fixtures.
- vms/platformvm/docs/{block_formation_logic,chain_time_update}.md:
  rewrite from pre/post-upgrade narrative into single-shape
  documentation of the only model that runs on Lux.
- vms/platformvm/docs/validators_versioning.md, indexer/service.md,
  config/config.md, vms/platformvm/warp/README.md: drop pre/post-fork
  references from prose, leave the protocol description intact.
- vms/proposervm/proposer/windower.go, pre_fork_block.go,
  vms/proposervm/block_test.go, vms/platformvm/warp/validator.go,
  vms/platformvm/txs/executor/proposal_tx_executor.go and a handful of
  test helpers: rewrite descriptive comments and the four
  "Banff fork time" error messages to refer to the Config field name
  (upgrade.Config.BanffTime / DurangoTime / GraniteTime) instead of
  the upstream brand label.
- tests/granite_integration_test.go -> tests/lp181_integration_test.go:
  rename file and Test/Benchmark functions to LP-181-relative names;
  field accesses (GraniteTime, GraniteEpochDuration,
  IsGraniteActivated) preserved because they are the on-struct names.
- network/network.go, network/peer/peer.go, chains/manager.go,
  scripts/tests.upgrade.sh, .github/labels.yml: scrub stray
  upstream-brand mentions from comments / labels.

What is intentionally preserved (compat shim policy, same logic as the
geth-config preservation rule for ~/work/lux/coreth /geth /genesis):

- upgrade.Config field names (ApricotPhaseNTime, BanffTime, ..., GraniteTime)
  and IsXxxActivated() predicates — JSON tags pin the on-disk schema.
- upgradetest.Fork enum values (NoUpgrades..Granite) — referenced by
  hundreds of upstream-derived test fixtures.
- Block-type identifiers (BanffStandardBlock, ApricotProposalBlock, ...)
  — wire-format-load-bearing.
- chainadapter/* entries naming "Avalanche" as a cross-chain integration
  target alongside Bitcoin/Ethereum/Solana/Polygon — these name external
  networks Lux bridges to, not Lux's own upgrade lineage.
- RELEASES.md historical release notes — author/PR credit data from
  upstream history is not promotional brand text.

Build verified: GOWORK=off go build ./... -> exit 0.
2026-05-18 21:14:35 -07:00
Hanzo AI b691a0d07e deps: chains v1.2.2 → v1.2.3 (Corona purge complete — go mod tidy now clean) 2026-05-18 20:49:57 -07:00
Hanzo AI 8c874943f9 deps: consensus v1.23.29 (pulsar v1.0.8 consolidation patch) 2026-05-18 19:59:47 -07:00
Hanzo AI 01c40f969e go.mod: bump consensus v1.23.15 → v1.23.28 + chains v1.2.1 → v1.2.2
Pulls in luxfi/pulsar v1.0.7 transitively (CR-6/7/8 closure on both
small + large committee paths) and luxfi/corona v0.4.0.

Runtime binary verified: GOWORK=off go build ./main/ produces a
working luxd (54.8 MB).

Note: chains v1.2.2's thresholdvm/protocol_executor_test.go and
quantumvm/quantum/signer.go still reference the legacy
github.com/luxfi/threshold/protocols/corona import path. go mod
tidy errors on the test target but does not block runtime build.
Cleanup is queued for the chains repo.
2026-05-18 18:56:41 -07:00
Hanzo AI 8884c17f54 node: nuke allow-custom-genesis + allow-genesis-update flags
Operator owns the chainset. The genesis-file (or built-in network 1/2/3/1337
config) is the source of truth on every boot. No 'is this a standard network
ID? then guard against custom genesis' branching, no 'stored hash differs?
then refuse to boot unless you set this other flag' guard. Decomplect both:

- Genesis hash check (node/node.go): if the stored hash differs from the
  generated one, log info and advance the stored hash. Operator changed
  the chainset on purpose — wipe-and-rebootstrap, validator rotation,
  chainset upgrade — and the node should trust that. The DB hash is a
  tag, not a lock.

- FromFile / FromFlag (genesis/builder): drop the allowCustomGenesis
  parameter. Caller-driven: if you pass a genesis file, we use it.
  Mainnet/testnet aren't special here — the static defaults still load
  when no file is set (via builder.GetConfig).

- Wire all the way out: flag definitions (config/flags.go, config/spec/flags.go),
  key constants (config/keys.go), Node.Config struct field (config/node/config.go),
  reader (config/config.go). Five layers, none of them earned their keep.
2026-05-17 19:19:28 -07:00
Hanzo AI 87e2ac3615 network: chicken-and-egg fallback when validator manager empty
samplePeers caps numValidatorsToSample at NumValidators(sid). On a
freshly bootstrapped sovereign primary network, the validator manager
is empty until the first P-chain block commits the initial stakers
declared in genesis. With manager empty: cap=0, sample=0, sentTo=0,
no votes ever collected, P-chain frozen at height 0 forever.

Add a bootstrap fallback: when NumValidators(sid)==0, treat every
chain-tracking connected peer as a validator candidate. The strict
cap returns the moment any validator is registered (i.e. the first
block commits). Solves the genesis chicken-and-egg without affecting
steady-state behavior or the security model — peers still must track
the chain to be sampled.
2026-05-17 18:20:01 -07:00
Hanzo DevandGitHub b6eae71825 chore: drop LUX_ prefix from env var lookups (MNEMONIC) (#113)
keyutil.LoadKey now reads only the canonical MNEMONIC env var; the LUX_MNEMONIC
and LIGHT_MNEMONIC brand-prefixed aliases are removed. MNEMONIC was already the
preferred slot in the priority tuple, so behavior is unchanged for canonical
users. Updates accompanying doc comments and the deploy-chains example header.
2026-05-17 10:21:33 -07:00
Hanzo DevandGitHub c44df7e15c Merge pull request #112 from luxfi/chore/zap-native-only-kill-grpc-build-tags
node: ZAP-native only — kill every //go:build grpc path
2026-05-16 17:25:49 -07:00
Hanzo AI 92c430ee12 node: ZAP-native everywhere — kill every //go:build grpc path
The companion commit `3be49b29ec` retired the gRPC fallback inside
vms/rpcchainvm/. This commit closes the loop by deleting every
remaining `//go:build grpc` file under node/, removing the dual-build
plumbing entirely. ZAP is the only wire protocol; there is no
`-tags=grpc` opt-in.

Per the "one and only one way to do everything" mandate, the
backwards-compat scaffolding (gRPC adapters, protoc stubs, connect-go
example handlers, OTLP gRPC exporter, x/sync gRPC sync engine,
keystore-over-gRPC client/server, rpcwarp gRPC signer, gRPC alias
reader) is removed forward-only — no aliases, no deprecation period.

Deletions (84 files):
  - proto/pb/{aliasreader,http,io,keystore,message,messenger,net,p2p,
    platformvm,rpcdb,sdk,sender,sharedmemory,signer,sync,
    validatorstate,vm,warp}/ — protoc stubs (entire tree)
  - proto/{p2p,platformvm,sync,vm}/*_grpc.go — gRPC type re-exports
  - db/rpcdb/{grpc_server,grpc_client,grpc_test}.go — rpcdb gRPC adapter
  - service/keystore/rpckeystore/ — keystore-over-gRPC (dead consumer)
  - x/sync/ — entire merkledb sync engine (100% gRPC-tagged)
  - internal/ids/rpcaliasreader/ — gRPC alias reader (dead consumer)
  - connectproto/ — connect-go XSVM ping handler scaffolding
  - vms/platformvm/warp/rpcwarp/{client,server}.go — gRPC warp signer
  - vms/platformvm/network/warp.go — protobuf-based warp justification
    handler (warp_zap.go retains the no-op verifier consumers expect)
  - vms/components/message/message_grpc.go + message_test.go
  - vms/example/xsvm/api/ping.go + vm_http_grpc.go + cmd/{run,xsvm}/
  - wallet/network/primary/examples/sign-l1-validator-* (5 dead
    example main packages)
  - trace/{exporter_grpc,exporter_type,exporter_type_test,noop,tracer}.go
    (OTLP gRPC exporter + duplicate Tracer types — trace_zap.go has
    the canonical Tracer interface + no-op tracer)
  - message/bft_grpc.go (Simplex BFT wrapper)

Edits (9 files): every surviving `_zap.go` drops its `//go:build !grpc`
constraint (the files are unconditional now) and drops stale
"ZAP version" / "ZAP mode" inline comments.

Doc updates:
  - LLM.md ZAP Transport section: remove the `-tags=grpc` opt-in
    language. Replace with "ZAP is the only wire protocol... there is
    one and only one way". Update Latest Tag to v1.26.31. Update the
    rpcdb topology section to reflect single-adapter state.

go.mod: connectrpc.com/connect, connectrpc.com/grpcreflect,
otlptracegrpc moved out of direct deps. google.golang.org/grpc +
protobuf demoted to indirect (still pulled transitively via luxfi/dex).

Verified:
  - `go build ./...` (default, no tags) clean
  - `go test ./db/rpcdb/... ./trace/... ./message/... ./vms/rpcchainvm/...
    ./vms/components/message/... ./vms/platformvm/network/...
    ./vms/example/xsvm/... ./service/keystore/... ./proto/...` clean
  - `grep -rln '//go:build grpc' --include='*.go' node/` returns zero
  - `grep -rln '//go:build !grpc' --include='*.go' node/` returns zero
  - `grep -rln 'google.golang.org/grpc' --include='*.go' node/` returns
    zero (only transitive deps remain in go.sum)

Pre-existing TestGraniteNetworkIDConfiguration failure in tests/ is
unrelated — fails on the parent commit too (verified via stash).
2026-05-16 17:23:26 -07:00
Hanzo AI 3be49b29ec rpcchainvm: zap-native only — delete every grpc-tagged path
The VM<->Node RPC plane is ZAP. Period. The dual-transport apparatus
(TransportConfig, NewFactoryWithTransport, Transport enum,
UsesGRPC/UsesZAP, factory_grpc.go vs factory_zap.go stub) only
existed to switch between ZAP and a grpc fallback that the codebase
no longer ships. Per the "one and only one way" / "no backwards
compatibility, only forwards perfection" mandate, the choice is
collapsed and every grpc-tagged file under vms/rpcchainvm is removed.

Deletions (36 files, ~4.3K lines):
  - factory_grpc.go, factory_zap.go, transport.go (the dual-transport
    routing + Transport enum)
  - vm.go, vm_client.go, vm_server.go, block_adapter.go, *_test.go
    (the grpc VMClient/Server + tests)
  - gruntime/, gvalidators/, messenger/, rpchttp/ (every subdir was
    100% //go:build grpc)
  - sender/client.go, sender/server.go (grpc Sender wire impls;
    sender.go + zap_client.go + zap_server.go stay)
  - runtime/subprocess/runtime_grpc.go (the gRPC subprocess.Bootstrap;
    runtime_zap.go is now the only Bootstrap)
  - vms/platformvm/warp/rpcwarp/signer_test.go (orphan grpc test that
    relied on the deleted proto/pb/warp)

Edits:
  - vms/rpcchainvm/factory.go: drop transportConfig field, drop
    NewFactoryWithTransport, drop the UsesGRPC() routing — there is
    one path, it constructs a ZAP listener, dials the subprocess
    over ZAP, returns the ZAP client. No branching.
  - vms/rpcchainvm/runtime/subprocess/runtime_zap.go: drop the
    `//go:build !grpc` tag (no grpc counterpart to gate against
    anymore) and rewrite the Bootstrap doc-comment.

go mod tidy result:
  - direct dep `google.golang.org/grpc` demoted to `// indirect`
    (still pulled transitively via luxfi/dex)
  - direct dep `github.com/grpc-ecosystem/go-grpc-prometheus`
    removed entirely

Verified:
  - `go build ./...` (default, no tags) clean
  - `go test -count=1 ./vms/rpcchainvm/...` clean
  - grep -rln 'google.golang.org/grpc' --include='*.go' under node/
    returns zero (the only google.golang.org/grpc strings left are
    in go.mod/go.sum/README/RELEASES/ci.yml/proto/Dockerfile)
  - grep 'grpc.Dial|NewServer|NewClient' in rpcchainvm returns zero
2026-05-16 17:11:31 -07:00
Hanzo DevandGitHub 0486947913 Merge pull request #111 from luxfi/chore/gitignore-cleanup-and-tag-refresh
chore: drop stale db* gitignore + refresh LLM/CLAUDE Latest Tag
2026-05-16 16:48:07 -07:00
hanzo-dev 105fd207c0 .gitignore + docs: drop stale db* rule; refresh Latest Tag to v1.26.28
The bare `db*` .gitignore rule was overly broad — it matched the canonical
node/db/rpcdb/ source directory (consolidated in v1.26.28). Previous PRs
needed `git add -f` to land files there. No code references in-repo ./db/
runtime path; runtime DB lives under ~/.lux/ per the canonical operator
convention.

LLM.md + CLAUDE.md updated to reflect actual current main tag.
2026-05-16 16:47:41 -07:00
Hanzo DevandGitHub e1550aaea6 chore: bump Go toolchain to 1.26.3 (#110)
Pin Go version to 1.26.3 across go.mod, CI workflows, and Dockerfiles
for canonical alignment with the rest of the luxfi/* stack.
2026-05-16 16:46:20 -07:00
Hanzo DevandGitHub 25adc9c75c rpcdb: consolidate into node/db/rpcdb, drop luxfi/proto dep (#109)
Part A — swap Layer-B wire-types path:
  github.com/luxfi/proto/rpcdb → github.com/luxfi/protocol/rpcdb (v0.0.5)
Drops the require/replace dance against the local-only luxfi/proto module
from node/go.mod. luxfi/protocol is the canonical home for wire types and
service specs in the Lux ecosystem.

Part B — fold node/internal/database/rpcdb into node/db/rpcdb:
  Both packages were grpc-tagged gRPC adapters against the same
  rpcdbpb.DatabaseClient/Server. The internal one (db_client.go/db_server.go)
  predated the Layer A/B/C decomplect; the db/rpcdb one (grpc_server.go +
  zap_server.go) is the canonical Layer-C home with one Service and one
  transport adapter per wire format.

  New grpc_client.go in db/rpcdb mirrors the deleted internal db_client.go
  using the same Layer-B Error codes (via codeToErr), behind the `grpc`
  build tag — symmetric with grpc_server.go.

  Updated service/keystore/rpckeystore/client.go to import the canonical
  db/rpcdb.NewGRPCClient instead of internal/database/rpcdb.NewClient.

  internal/database/rpcdb/ deleted in its entirety. One canonical rpcdb
  home; no dual-shim, no deprecation period.

Default-tag build is clean. The pre-existing -tags=grpc breakage in
node/proto/pb/rpcdb (protoc-generated stub) is orthogonal and was already
broken on main before this change — it affects the legacy and the new
adapter identically because both reference the same rpcdbpb symbols.
2026-05-16 16:35:56 -07:00
Hanzo DevandGitHub 09dffe5430 deps: luxfi/api v1.0.10 -> v1.0.11 (#108)
Picks up ConsensusInfo.Corona -> ConsensusInfo.Corona rename so the
service_test.go typecheck (TestGetNodeVersionConsensusRoundtrip) compiles.

Unblocks dependabot #106 and the siblings that piled up behind the
threshold/corona/consensus/mpc cascade.
2026-05-16 16:29:55 -07:00
df173e4263 build(deps): bump peter-evans/repository-dispatch from 3 to 4 (#103)
Bumps [peter-evans/repository-dispatch](https://github.com/peter-evans/repository-dispatch) from 3 to 4.
- [Release notes](https://github.com/peter-evans/repository-dispatch/releases)
- [Commits](https://github.com/peter-evans/repository-dispatch/compare/v3...v4)

---
updated-dependencies:
- dependency-name: peter-evans/repository-dispatch
  dependency-version: '4'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: Hanzo Dev <dev@hanzo.ai>
2026-05-16 16:17:30 -07:00
Hanzo DevandGitHub b561269ef8 Merge pull request #107 from luxfi/licensing/canonical-pointer
docs: add LICENSING.md pointer to canonical Lux IP strategy
2026-05-15 16:34:50 -07:00
Hanzo Dev 20506a5950 docs: add LICENSING.md pointing at canonical Lux IP strategy
Single LICENSING.md file referencing the canonical three-tier IP and
licensing strategy at github.com/luxfi/.github/blob/main/profile/README.md.

LICENSE file is unchanged; this only adds a navigational pointer.
2026-05-15 16:34:43 -07:00
Hanzo AI 0ebfa14b6d rpcdb: decomplect into Layer A/B/C topology
Layer A — wire framing: github.com/luxfi/api/zap (unchanged)
Layer B — service spec: github.com/luxfi/proto/rpcdb (transport-agnostic
   data carriers, was node/proto/zap/rpcdb)
Layer C — service impl + transports: node/db/rpcdb/
   - service.go      transport-neutral Service wrapping database.Database
   - zap_server.go   ZAP transport adapter (default; used by cevm)
   - grpc_server.go  gRPC transport adapter (-tags=grpc)

One Service. Many transport adapters. Adding a transport is a new
adapter file wrapping *Service; storage logic stays in service.go.

Removed (-1390 LOC of duplicate/dead code):
 - node/proto/zap/rpcdb/rpcdb.go (moved to luxfi/proto/rpcdb)
 - node/proto/rpcdb/rpcdb_zap.go (dead HandlerRegistry path, no callers)
 - node/proto/rpcdb/rpcdb_grpc.go (duplicated gRPC server, replaced by
   node/db/rpcdb/grpc_server.go)
 - node/db/rpcdb/db.go (re-export shim, replaced by Service)

Consumers updated to import the canonical adapter at node/db/rpcdb:
 - vms/rpcchainvm/zap/client.go
 - vms/rpcchainvm/zap/client_dbserver_test.go
 - vms/rpcchainvm/zap/cevm_e2e_test.go

go.mod: add `replace github.com/luxfi/proto => ../proto` for in-tree
  development of the central wire-types module.

Tests: db/rpcdb (3/3) + rpcchainvm/zap (4/4 incl. cevm cross-process
e2e — KP_META written via ZAP db channel, no fallback to local zapdb).
2026-05-15 15:47:44 -07:00
Hanzo AI f97f552e87 rpcchainvm/zap: spawn ZAP rpcdb server in Initialize, populate DBServerAddr
Closes the "dbServerAddr empty under ZAP" gap from the cevm v0.48.0
premortem. The gRPC client (vm/rpc/vm_client.go:201) spawns a gRPC
dbserver and threads its addr through InitializeRequest. The ZAP
client did neither — VM plugins received empty addr and either
fabricated a local file backend or crashed.

Changes:
* `Client.Initialize` now calls `startDBServer(init.DB)` BEFORE
  sending the wire request, mirroring the gRPC pattern.
* Spawned listener serves `vm/proto/rpcdb.NewZAPServer(init.DB)` —
  a default-build (no `grpc` tag) ZAP-native rpcdb server.
* `InitializeRequest.DBServerAddr` is populated with the new
  listener's `host:port`. Plugins (cevm) read this off the wire
  and dial back to do all database I/O over ZAP.
* Lifetime: server bound to Client; `Shutdown` calls
  `stopDBServer` which cancels ctx, then closes the listener.
* `Close()` deliberately does NOT call zapwire.Server.Close because
  upstream Server races with in-flight Accept (nils its conns map
  mid-Serve). Listener close + ctx cancel is sufficient.

Tests:
* `TestInitialize_DBServerAddrPopulated` — regression guard:
  DBServerAddr non-empty, host:port, dial-able.
* `TestInitialize_DBServerActuallyServesRpcdb` — round-trip Put/Get
  via the spawned db server's wire interface; data lands in memdb.
* `TestCEvm_DialsZAPdbServer` — TRUE cross-process E2E. Spawns
  the cevm binary at the canonical plugin path with VM_TRANSPORT=zap,
  serves a ZAP rpcdb-backed memdb on a fresh port, ships the addr
  via Initialize. cevm dials it (logged at "[cevm] zapdb: connected
  to luxd db listener at 127.0.0.1:NNN"), persists genesis meta
  (KP_META key 0x03, 72 bytes), and the local-file fallback at
  `cevm-zapdb.bin` is NOT created — proving RemoteZapDB was the
  active backend.
2026-05-15 15:06:07 -07:00
Hanzo AI 2bde2c707f chore: bump precompile v0.5.16 -> v0.5.17, node v1.22.78 -> v1.22.79 2026-05-15 12:16:02 -07:00
Hanzo AI 913acca108 chore(brand): drop LUX_ env-var prefixes (LUX_PATH, LUX_KMS_*, LUX_CGO, LUX_PRIVATE_KEY, LUX_AUTOMINE_*)
- scripts/* + .github/actions/* + .github/workflows/*: LUX_PATH ->
  NODE_PATH, LUX_VERSION -> NODE_VERSION.
- Dockerfile: LUX_CGO -> CGO_ENABLED (matches Go convention).
- staking/kms.go: LUX_KMS_ENDPOINT/PATH/TOKEN -> KMS_ENDPOINT/PATH/TOKEN.
- deploy-subnets.sh: LUX_PRIVATE_KEY -> PRIVATE_KEY.
- config/config.go: drop LUX_AUTOMINE_CCHAIN_GENESIS_PATH env override;
  downstream networks ship their own platform-genesis bundle instead.
2026-05-15 12:15:55 -07:00
Hanzo AI 50b27dbf94 refactor(pq): strict-PQ forward-only, drop transition window + classical-compat
- Remove ActivationHeight migration window from SchemeGate; the gate
  refuses non-PQ NodeIDScheme bytes at every height.
- Remove LUX_CLASSICAL_COMPAT_UNSAFE operator escape hatch; classical
  staker.crt/key flags retained only for legacy no-profile chains.
- Rename profile from LUX_STRICT_E2E_PQ to STRICT_E2E_PQ (brand sweep).
- Update LLM.md to reflect forward-only PQ policy.
2026-05-15 12:15:42 -07:00
Hanzo AI 2f9ef85652 feat(platformvm): P-only mode + native CreateAssetTx/OperationTx
- X-Chain (XVM) and C-Chain (EVM) become opt-in at genesis; missing
  XVMID/EVMID chains in genesis no longer fatal at node init.
- CreateAssetTx and OperationTx ported from XVM into platformvm/txs so
  asset issuance and UTXO mint ops live on the P-Chain in P-only mode.
- Cross-chain P->X->C flows replaced by direct P->subnet warp transfers.
- Signer visitor + backend visitor wired for the new tx types.
- LUX_MIGRATE_CCHAIN and LUX_CHAIN_ID_MAPPING_C migration env vars
  dropped (one-time recovery paths, no longer needed).
2026-05-15 12:15:31 -07:00
Hanzo AI 9c42fe1126 refactor: rename g* grpc packages to rpc* (galiasreader, gkeystore, gwarp, ghttp) 2026-05-15 12:15:14 -07:00
Hanzo AI e42b295617 ci: skip buf-lint when no .proto files present (ZAP-native default) 2026-05-13 13:45:20 -07:00
Hanzo AI d7312ad8a9 go.sum: tidy after crypto v1.19.0 — add luxfi/crypto/ipa entries
luxfi/crypto v1.19.0 dropped the inline ipa/ dir and now requires
github.com/luxfi/crypto/ipa as a separate module. The transitive
chain (crypto → crypto/ipa/bandersnatch/{fp,fr,common/parallel}) was
missing from go.sum, breaking goreleaser's go build.
2026-05-13 13:32:27 -07:00
Hanzo AI c827de99a7 deps: bump luxfi/crypto v1.19.0 — canonical luxfi/crypto/ipa 2026-05-13 11:55:49 -07:00
Hanzo AI 24aaa598c5 go.mod: bump protocol v0.0.4 + sdk v1.16.60 2026-05-13 00:21:23 -07:00
Hanzo AI 3d5466eef4 go.mod: bump go directive to 1.26.3 (security advisory) 2026-05-12 20:55:01 -07:00
Hanzo AI b5a2a8d3db go.mod: bump warp v1.18.5 → v1.18.6 (pq.Mode decomplection)
warp v1.18.6 ships the canonical pq.Mode integration —
EnvelopeV2 implements pq.PQEvidencer, LanesForMode(pq.Mode, ...)
replaces the old local profile-enum dispatch, and
pq.ErrClassicalAuthForbidden is the single sentinel across the
stack. Pull luxfi/pq v1.0.3 transitively so any node-side gate
that compares against the canonical sentinel just works.

No source changes needed at this layer; the bump is dep hygiene.
2026-05-12 20:07:09 -07:00
Hanzo AI b5a4fc3f1f ci/Docker: pass LUX_CGO=0 — the runtime image doesn't ship luxcpp .so libs, so CGO=1 segfaults on early init 2026-05-12 14:50:42 -07:00
Hanzo AI 90738f212a genesis/builder: collapse opt-in chains to one table-driven loop
The builder had two inconsistent groups of chains: Q and Z hardcoded as
MANDATORY (no opt-in gate), C/D/B/T as four near-identical conditional
blocks. Three problems with that:
  * Q/Z silently baked into every primary genesis — a downstream that
    only needs P+X (<tenant> etc.) couldn't keep them out without an
    env-knob hack.
  * Adding a new primary-network chain meant copy-pasting the
    if-block. Four chains = four near-identical conditionals.
  * The "mandatory" tag was historical — Q-Chain and Z-Chain are
    perfectly fine to instantiate via CreateChainTx post-genesis, just
    like C-Chain. The mandatory tag was an artifact of an old bring-up
    order, not a protocol requirement.

Now: P and X are mandatory (P implicit, X anchors fees + staking).
Every other primary-network chain lives in a single table:

	optIn := []struct{ genesisData string; vmID ids.ID; name string }{
		{config.CChainGenesis, constants.EVMID,        "C-Chain"},
		{config.DChainGenesis, constants.DexVMID,      "D-Chain"},
		{config.BChainGenesis, constants.BridgeVMID,   "B-Chain"},
		{config.TChainGenesis, constants.ThresholdVMID,"T-Chain"},
		{config.QChainGenesis, constants.QuantumVMID,  "Q-Chain"},
		{config.ZChainGenesis, constants.ZKVMID,       "Z-Chain"},
	}

Adding a chain is one row. Removing one is one row. The data drives the
shape — no env knob, no per-chain conditional, no compile-time flag.

Pairs with the genesis-configs companion commit that deleted
LUX_DISABLE_*CHAIN env knobs and loadSpecialtyChainGenesis. Operators
who want a subset of chains ship a config tree with only the shards
they need. Runtime tracking remains separate via luxd's --track-chains.
2026-05-12 13:49:03 -07:00
Hanzo AI 50b4002e51 go.mod: drop ../corona local replace, pin corona v0.3.0 (so Docker build sees pkg) 2026-05-12 12:18:12 -07:00
Hanzo AI 15ab4dbd47 ci: inline Docker build, drop cross-org reusable workflow call
The startup_failure on every recent Docker run is the org-level "Allow
actions and reusable workflows from luxfi" policy at GitHub
actively rejecting cross-org `uses: hanzoai/.github/.../docker-build.yml`
calls. Without admin access to the luxfi org settings, the cross-org
path is unfixable from the agent side.

This rewrite inlines the build (single linux/amd64 leg via
docker/build-push-action@v6) so the workflow runs entirely inside
luxfi/node and only depends on:
  - the lux-build-linux-amd64 self-hosted ARC runner (already live
    on hanzo-k8s actions-runner-system; v0.2.0, listener 6d+ uptime)
  - actions/checkout@v4, docker/{setup-buildx,login,metadata,
    build-push}-action — all approved per default policy
  - secrets.GITHUB_TOKEN (auto-injected; no `secrets: inherit` needed)
  - secrets.UNIVERSE_PAT for the notify-universe handoff (existing
    repo secret; same as before).

Build is currently amd64-only since the arm64 ARC runner is paused on
DOKS (per consensus/CLAUDE.md memory). Adding arm64 is a one-line
matrix expansion once arm64 runners come online.
2026-05-12 12:13:51 -07:00
Hanzo AI bdf3c5d00e ci: revert runner labels back to lux-build-linux-* (correct for luxfi org) 2026-05-12 12:09:36 -07:00
Hanzo AI dadaad8a22 ci: fix Docker workflow runner labels (lux-build-linux-* → hanzo-build-linux-*) 2026-05-12 12:05:32 -07:00
Hanzo AI eea02da21a node: align with crypto v1.18.6 (SchemeCorona → SchemeCorona) 2026-05-12 10:23:43 -07:00
Hanzo AI 476c6dd12a node: bump validators to v1.2.0 (CoronaPubKey) 2026-05-12 09:58:04 -07:00
Hanzo AI 35d48b9d1c node: kill all remaining Corona identifiers across consensus, vms, wallet
Final identifier purge for the node repo. After this commit zero
'Corona' / 'CORONA' references remain in any Go file.

  consensus/quasar:
    CoronaWork/Valid/Time/SizeMismatch  → CoronaWork/Valid/Time/SizeMismatch
    SignatureTypeCorona                 → SignatureTypeCorona
    CoronaConfig/Stats/Signature        → CoronaConfig/Stats/Signature
    NewCoronaSignature                  → NewCoronaSignature
    CoronaRound1/Round2/RoundData       → CoronaRound1/Round2/RoundData
    CoronaGroupKey/KeyShare/Coordinator → CoronaGroupKey/KeyShare/Coordinator
    CoronaLatency/Parties/Threshold     → CoronaLatency/Parties/Threshold
    ConnectCorona/InitializeCorona    → ConnectCorona/InitializeCorona
    ErrCoronaNotConnected/Failed        → ErrCoronaNotConnected/Failed
    CoronaSigners/Stats                 → CoronaSigners/Stats
    GetCorona()                         → GetCorona()
    {gpu,cpu}CoronaVerify               → {gpu,cpu}CoronaVerify
    set/teardown test helpers + dozens of compound identifiers all renamed

  vms/platformvm:
    SigTypeCorona   → SigTypeCorona

  wallet/keychain:
    KeyTypeCorona   → KeyTypeRingSig   (this is the LSAG ring-sig key
                                          kind — descriptive, not lemur-named)
    AddCorona       → AddRingSig
    Test*Corona*    → Test*RingSig*

Parallel Ring+Module Double-Lattice PQ posture intact: Corona
(Ring-LWE) + Pulsar (Module-LWE) supported in parallel as
independent threshold finality kernels.

Tests: consensus/quasar 45s, wallet/keychain 3.5s — both green.
2026-05-12 09:54:58 -07:00
Hanzo AI be24ff49f0 node: wire StakingConfig.DeriveNodeID at lqd boot
CTO swarm audit found the strict-PQ NodeID seam was exposed but
not called: node/node.go:132 still derived the validator's
NodeID via ids.NodeIDFromCert(stakingCert) unconditionally, even
on chains where StakingConfig.StakingMLDSAPub was populated.

The seam StakingConfig.DeriveNodeID(chainID) shipped in
6357802b7d dispatches per the strict-PQ pivot — when
StakingMLDSAPub is non-empty, NodeID derives from the ML-DSA-65
public key via SHAKE256-384("NODE_ID_V1" || chainID || 0x42 ||
pubKey)[:20] under ids.NodeIDSchemeMLDSA65. Classical-compat
chains fall through to ids.NodeIDFromCert via the same seam.

This commit routes node.go's boot path through the seam.
chainID is ids.Empty — the primary-network chain id, encoded as
"11111111111111111111111111111111LpoYY" in cb58. Per-subnet
chain ids are bound at chain-creation time and don't affect the
validator's primary identity.

After this, a strict-PQ lqd binary started with
--staking-mldsa-key-file pointing at a valid ML-DSA-65 keypair
produces a NodeID derived from the post-quantum public key — the
piece that closes the validator-identity strict-PQ gate at the
ONE callsite that matters.

Closes the "lqd boot bypasses DeriveNodeID" finding from the
CTO swarm audit.
2026-05-12 09:46:53 -07:00
Hanzo AI 8b8280c1e7 vms/chainadapter: namespaced chain IDs + seeded registry (unblocks T-Chain)
Renames the package-level ChainID constants from ChainPolkadot / ChainPolygon
/ ChainBSC / ChainRipple / ChainStellar / ChainTron / etc. to namespaced
private identifiers (idPolkadot, idPolygon, ...) and exposes them through
a seeded registry instead. Single source of truth for which non-Lux chains
the adapter knows about.

New files:
  - chain_ids.go: private id<Chain> constants + their public surface
  - chains_registry.go: registry that maps idX → adapter implementations
  - chains_seed.go: bootstrap-time population
  - registry_full_test.go: pin the seeded mapping

Existing adapters (bitcoin, cosmos, ethereum, polkadot, polygon, bsc,
ripple, solana, stellar, tron) now reference id<Chain> directly. Public
chain-ID iteration is via registry.AllChainIDs() rather than a
copy-paste enum.

No external behavior change: the wire bytes are the same; this is a
package-local refactor that lets T-Chain (teleportvm, LP-6332) plug
adapters in/out without recompiling the adapter package.
2026-05-11 23:57:51 -07:00
Hanzo AI e0ebfac9d3 network/peer: PQ handshake + SchemeGate + signed-IP MLDSA sig (CR-3, CR-5, CR-9)
Closes three audit blockers in one coherent batch — all of them gate
the inbound-peer pipeline on a strict-PQ chain so a classical (Ed25519/
secp256k1) peer cannot finish a handshake against a PQ-pinned node.

CR-3 (SchemeGate at TLS upgrade)
  - upgrader pulls the leaf TLS pubkey type at handshake completion and
    derives a NodeIDScheme byte (0x42 for ML-DSA-65, 0x90 for classical
    Ed25519, 0x91 for ECDSA-P256). The chain's
    ChainSecurityProfile.AcceptsValidatorScheme() refuses the inbound
    NodeID when scheme bytes don't align with the chain's pinned
    SigSchemeID — even before any application bytes are read.
  - Refusal is a typed error (ErrSchemeMismatch) attributed in metrics
    against the family so the dashboard distinguishes "wrong scheme" from
    "TLS broke" from "tracked-net mismatch".

CR-5 (PQ-only handshake handoff)
  - peer.Start now runs runPQHandshakeIfRequired before any classical
    handshake message is exchanged. Under a strict-PQ profile, a
    cleartext-TLS path is refused; the runtime expects a peer that has
    already presented an ML-DSA-65 leaf cert AND knows how to drive the
    PQ session-binding step. Test coverage in upgrader_strict_pq_test.go.

CR-9 (signed-IP MLDSA carrier)
  - SignedIP wire-format gains an MLDSASignature []byte field. Encoded
    append-only on the gossip wire (Reader.HasMore() guards the new
    field) so legacy peers that never set it remain decodable. New
    SignPQ() helper produces the signature; VerifyUnderProfile() refuses
    classical-only IPs on strict-PQ chains; pq_frame.go gives
    fuzz-friendly canonical encoding.
  - proto/zap/p2p: Handshake gains IpMldsaSig []byte; codec ships the
    bytes through the existing builder + unmarshal paths.
  - message.OutboundMsgBuilder.Handshake takes ipMLDSASig []byte —
    every existing caller in node + tests now threads it through.

Wiring
  - n.Config.NetworkConfig.SecurityProfile is set from
    n.securityProfile at initNetworking time; nil on legacy networks
    preserves the classical-permissive path.
  - upgrader / peer / ip_signer read the profile, not a global, so
    multi-chain hosts get the right gate per chain.

Tests: network/peer/{ip_pq_test.go, ip_pq_wire_test.go,
upgrader_strict_pq_test.go} pin the gates; go test
./network/peer/ -count=1 -short passes (6.5s).

Module bumps:
  - github.com/luxfi/geth v1.16.91 (MLDSATxType + per-chain PQ gate)
2026-05-11 23:57:09 -07:00
Hanzo AI abc8a0856f LLM.md: document --import-chain-data bridge + post-E2E-PQ state
- Config bridge at node/config/config.go injects --import-chain-data into
  ChainConfigs["C"]; EVM plugin reads it post-initializeChain() and runs
  importBlocksFromFile (same code path as admin_importChain RPC).
- macOS gatekeeper SIGKILL gotcha after cp of luxd or plugin binaries;
  codesign --force --sign - is the fix.
- Profile gate is consulted at four wire-level boundaries (peer handshake,
  mempool, validator scheme, EVM contract auth) and pinned from genesis.
2026-05-11 22:37:51 -07:00
Hanzo AI 2c49007406 config: register strict-PQ flags in addNodeFlags (pflag binding) 2026-05-11 21:43:27 -07:00
Hanzo AI 06a47b11b5 node: bump consensus → v1.23.15 (NewBFT engine factory)
Picks up the fourth consensus engine factory (NewBFT) alongside
NewChain / NewDAG / NewPQ. Adapter wraps luxfi/bft v0.1.5 as a
consensus.Engine; orthogonal to profile selection and threshold
kernel choice.
2026-05-11 21:03:56 -07:00
Hanzo AI 0af39d7d40 node: bump consensus v1.23.14 + threshold v1.6.8 (corona/pulsar split)
Pulls in:
  github.com/luxfi/pulsar v1.0.0  (Module-LWE — was pulsar-m)
  github.com/luxfi/corona v0.2.0  (Ring-LWE — was the old pulsar)

The old luxfi/pulsar-m module is gone. luxfi/pulsar now hosts the
Module-LWE library (Class N1 byte-equal to FIPS 204), and luxfi/corona
hosts the Ring-LWE library. Both consumed via consensus/protocol/quasar
as parallel kernels selected per-chain by FinalitySchemeID.
2026-05-11 19:30:22 -07:00
Hanzo AI 182401b3be service/security: update test assertions to STRICT (was STRICT_PQ)
Matches consensus v1.23.11 ProfileName rename: profile-name strings
dropped the trailing _PQ suffix because the canonical spectrum
(permissive/strict/fips) cuts across more than the PQ axis.
2026-05-11 18:59:33 -07:00
Hanzo AI 6357802b7d config: strict-PQ identity flags + StakingConfig.DeriveNodeID seam
Adds the strict-PQ identity surface to node config:

  --staking-mldsa-key-file              ML-DSA-65 (FIPS 204) signing key
  --staking-mldsa-key-file-content      base64 PEM, content variant
  --staking-mldsa-pub-key-file          ML-DSA-65 public key
  --staking-mldsa-pub-key-file-content
  --handshake-mlkem-key-file            ML-KEM-768 (FIPS 203) KEM secret
  --handshake-mlkem-key-file-content
  --handshake-mlkem-pub-key-file        ML-KEM-768 peer-facing pubkey
  --handshake-mlkem-pub-key-file-content

All eight default to /data/staking/{mldsa,mlkem}.{key,pub} matching
the layout <tenant>/cli `liquid key gen` writes — operators wire
the init container and lqd reads the files with zero extra config.

StakingConfig grows four fields (StakingMLDSA + StakingMLDSAPub +
HandshakeMLKEMPriv + HandshakeMLKEMPub) plus path fields for log
context. config.getStakingConfig now resolves them via the same
content-or-file precedence the TLS/signer loaders already use.

Key invariants enforced at config load:

  - Both private and public key must be present, or neither
    (no asymmetric "have signing key, missing pub" state).
  - Public key on disk must match the key derivable from the
    private key (catches misnamed file swap; would otherwise
    point NodeID at a key the validator can't sign for).
  - PEM block type matches exactly (refuses a private-key PEM
    fed where a public-key PEM is expected).

NodeID derivation pivot — single seam, no scattered branches:

  StakingConfig.IsStrictPQ()      → len(StakingMLDSAPub) > 0
  StakingConfig.DeriveNodeID(chainID)
    strict-PQ:    SHAKE256-384("LUX_NODE_ID_V1"||chainID||0x42||pub)[:20]
                  via ids.NodeIDSchemeMLDSA65.DeriveMLDSA
    classical:    ids.NodeIDFromCert(StakingTLSCert.Leaf)
  StakingConfig.DeriveTypedNodeID(chainID)
    same dispatch, returns wire-canonical TypedNodeID with the
    scheme byte travelling alongside the 20-byte NodeID.

Callsites that currently call ids.NodeIDFromCert directly are now
bypassing the strict-PQ pivot; migrating them to DeriveNodeID /
DeriveTypedNodeID is the follow-up workstream (the pivot itself
is non-breaking — classical chains continue to route through
NodeIDFromCert via the seam).

Requires luxfi/ids v1.2.10+ for NodeIDSchemeMLDSA65 / DeriveMLDSA.
2026-05-11 17:47:38 -07:00
Hanzo AI 4dd4910bf3 node: drop Quasar/Annulus/Lux from profile identifiers
Mirror of consensus/config rename:
  ProfileLuxStrictPQ   -> ProfileStrictPQ
  ProfileLuxPermissive -> ProfilePermissive
  ProfileLuxFIPS       -> ProfileFIPS
  LuxStrictPQ()        -> StrictPQ() constructor
  LuxPermissive()      -> Permissive()

Updates across chains, network/peer (handshake + scheme_gate), node init,
service/security (metrics + types), and platformvm/xvm profile tests.
Wire-string assertions updated to drop LUX_ prefix (e.g. "STRICT_PQ").
2026-05-11 16:51:03 -07:00
Hanzo AI 766e8b2010 node/version: bump to v1.26.13 + register in RPCChainVMProtocol map
Carries the namespace rename (lux→security) on /ext/security and the
F118 chain-manager profile-pin stamping landed in v1.26.12. Patch bump
only — no schema or behavior change beyond the rename of the
JSON-RPC namespace and REST sidecar path on the security service.

compatibility.json: add v1.26.12 + v1.26.13 to RPCChainVMProtocol 42
so TestCurrentRPCChainVMCompatible passes (the previous bump to
v1.26.12 left the map at v1.23.25).
2026-05-11 10:05:05 -07:00
Hanzo AI 77010b6652 node/service/security: rename namespace lux→security, drop /v1/ from REST paths
The security service was registered at /ext/lux exposing
lux_securityProfile / lux_blockSecurity, with REST sidecars at
/ext/lux/v1/security/profile and /ext/lux/v1/security/block/{n}.
This drifted from the convention used by every other extension
endpoint (/ext/admin, /ext/health, /ext/info, /ext/metrics):

  - the /ext/ namespace name MUST describe the surface, not the
    network; "lux" on a Lux chain is tautological
  - the lux_ JSON-RPC method prefix duplicates the namespace metadata
  - the /v1/ in the middle of /ext/lux/v1/security/ is double versioning;
    /ext/ is already extension-scoped and the namespace itself is
    the version axis

New surface:
  POST /ext/security                  (JSON-RPC, security namespace)
    methods: securityProfile, blockSecurity
  GET  /ext/security/profile          (REST sidecar)
  GET  /ext/security/block/{n}        (REST sidecar)

- service/security/service.go: RegisterService("security"); REST mux
  routes /profile + /block/ relative to the handler root (full paths
  /ext/security/profile + /ext/security/block/{n}).
- service/security/types.go: doc comments name the new surface.
- service/security/service_test.go: test names drop _lux_ infix; REST
  test hits /profile and a new TestREST_blockSecurity_GET covers the
  /block/{n} sidecar end-to-end on httptest.NewServer.
- node/node.go: APIServer.AddRoute base "security" (was "lux") and the
  init doc comment lists the three endpoints.

All 10 tests pass (env GOWORK=off go test ./service/security/...).
2026-05-11 10:03:51 -07:00
Hanzo AI 9759c2e253 node+chains: stamp ChainSecurityProfile pin into C-Chain plugin config (closes F118)
Companion to coreth: c84950de4. The chain manager now forwards the
chain-wide ChainSecurityProfile resolved at node bootstrap (F102)
into the C-Chain (coreth) plugin Initialize payload by stamping a
profileID + profileHashHex pin into the JSON config bytes that
already cross the rpcchainvm boundary.

- chains/manager.go adds ManagerConfig.SecurityProfile and an
  injectSecurityProfileConfig pass (mirror of injectAutominingConfig)
  that runs only on EVMID and is a no-op when the profile is nil.

- node/node.go threads n.securityProfile into chains.ManagerConfig.

- version/constants.go patch-bumps to 1.26.12.

Four F118 tests in chains/security_profile_f118_test.go:
- StampsCChainOnly — pin appears in EVMID config, not in other VMs.
- NoOpWhenProfileNil — classical-compat path passes through.
- MergesExistingConfig — automining + skip-block-fee survive.
- RoundTripsAcrossPluginBoundary — the wire form decodes cleanly
  into the coreth-side LuxSecurityProfilePin struct shape, with the
  hash decoding to a full 48 bytes (SHA3-384 width).

go.mod bumps consensus v1.23.5 → v1.23.9 to pick up the F113
checkpoint+Merkle SHA3-384 widening.
2026-05-11 10:01:28 -07:00
Hanzo AI 05b139aadc node/network/kem: canonical KEM scheme numbering via config.KeyExchangeID (Bug 3)
Before: network/kem/scheme.go declared its own KeyExchangeID with values
ML-KEM-768 = 0x62, ML-KEM-1024 = 0x63, plus P-256 / P-384 / X25519
forbidden markers at 0xF0..0xF2. Disjoint from consensus/config's
0x01/0x02/0x90 canonical block.

After: kem.KeyExchangeID is a type alias of config.KeyExchangeID. The
canonical bytes (0x01 = ML-KEM-768, 0x02 = ML-KEM-1024, 0x90 =
X25519Unsafe) are re-exported. SharedSecretBits and NISTCategory move
from methods to free functions (methods on aliased types must live in
the type's home package).

Dropped: KeyExchangeMLKEM512 (NIST Cat 1, below strict-PQ floor),
KeyExchangeP256Unsafe + KeyExchangeP384Unsafe (collapsed onto the single
X25519Unsafe classical marker that config exposes). No production
caller referenced any of these.

Wire-format change on the peer handshake KEMScheme byte: 0x62/0x63
→ 0x01/0x02. Forward-only; the prior numbering was never released to
any live network.

New test: TestKEMSchemeIDs_AllUseCanonicalNumbering pins
kem.KeyExchange{MLKEM768,MLKEM1024,X25519Unsafe,None} byte-identical to
config.KeyExchange{MLKEM768,MLKEM1024,X25519Unsafe,Invalid}.
2026-05-11 09:29:42 -07:00
Hanzo AI d86c155eb1 node/network/peer: F103 — document hybrid vs pure ML-KEM-768 decision
The TLS handshake pins CurvePreferences = [tls.X25519MLKEM768], the
IANA-registered hybrid (curve ID 0x11ec). The chain-wide
ChainSecurityProfile pins KeyExchangeMLKEM768 — the post-quantum
component that MUST be present on the wire — and the hybrid satisfies
this because it CONTAINS ML-KEM-768.

The hybrid is strictly stronger than pure ML-KEM-768 (an attacker must
break BOTH X25519 AND ML-KEM-768 to derive the session key). Real-world
TLS 1.3 stacks implement the hybrid today; pure ML-KEM-768 at the TLS
layer is not yet a deployable target.

ForbidClassicalKEM continues to refuse a pure-classical curve at the
application layer; it does NOT refuse a hybrid that includes ML-KEM-768.

Decision recorded in consensus/config commit 12d7000c.

Closes F103 (pure vs hybrid ML-KEM-768 ambiguity).
2026-05-11 09:28:35 -07:00
Hanzo AI 77fff17b01 node/service/security: lux_securityProfile RPC + Prometheus gauges
Expose the chain-wide ChainSecurityProfile to operators, dApps, and
auditors via two surfaces wired through a single boot site
(initSecurityAPI):

  - JSON-RPC under namespace "lux" at /ext/lux:
      lux_securityProfile  → ProfileReply  (full profile JSON)
      lux_blockSecurity    → BlockSecurityReply (chain-wide envelope)
  - REST sidecar at /ext/lux/v1/security/{profile,block/{n}}
  - Prometheus gauges under namespace "security" on /ext/metrics:
      security_profile_post_quantum_end_to_end{profile_id, profile_name}
      security_profile_nist_friendly{profile_id}
      security_profile_lux_canonical{profile_id}
      security_profile_unsafe_mode_enabled{profile_id}
      security_mempool_classical_credentials_total{chain}
      security_zchain_proof_lag_epochs

The reply shape is SCREAMING_SNAKE canonical names (renderName) so audit
tooling matches on stable identifiers; the underlying scheme bytes come
from consensus/config. A node booted without a SecurityProfile pin
returns ErrNoProfile (RPC) or HTTP 503 (REST) — the legacy networks
keep their classical-compat posture without forging a profile.

Closes the lux_securityProfile and profile-gauges F102 follow-ups.
2026-05-11 09:28:35 -07:00
Hanzo AI 0568d68b80 node/xvm: wire SetAuthPolicy from profile
The X-chain mempool now installs the chain-wide credential-admission
policy resolved from genesis at node bootstrap (F102 close-out). Wiring
path:

  genesis → node.SecurityProfile() → xvm.Factory.SecurityProfile
         → VM.securityProfile → vm.Initialize → xmempool.SetAuthPolicy

X-chain credentials are wrapped in fxs.FxCredential; the mempool gate
unwraps them before consulting the auth policy so the same
EnforceCredentialPolicy implementation gates both P-chain and X-chain.

Integration test exercises the full path: build VM with strict-PQ
profile, call Initialize + Linearize, then issue a tx with a wrapped
classical secp256k1 credential via IssueTxFromRPCWithoutVerification.
Observe ErrLegacyCredentialUnderStrictPQ.
2026-05-11 09:28:35 -07:00
Hanzo AI 9a6b7d2455 node/platformvm: wire SetAuthPolicy from profile (closes CPX deferred item)
The platformvm mempool now installs the chain-wide credential-admission
policy resolved from genesis at node bootstrap (F102 close-out). Wiring
path:

  genesis → node.SecurityProfile() → platformvm.config.Internal.SecurityProfile
         → vm.Initialize → pmempool.SetAuthPolicy

Strict-PQ chains refuse classical secp256k1 credentials at gossip time
via the existing auth.EnforceCredentialPolicy gate; legacy/classical-
compat networks keep admitting them unchanged (nil profile is a no-op
gate).

Integration test exercises the full end-to-end path: build VM with
SecurityProfile = LuxStrictPQ(), call Initialize, attempt to add a tx
with an unwrapped *secp256k1fx.Credential, observe
ErrLegacyCredentialUnderStrictPQ.

Closes the CPX deferred item:
"chain-builder code that constructs the mempool today does not call
 SetAuthPolicy ... follow-up that depends on plumbing the
 *config.ChainSecurityProfile from genesis into the chain builder"
2026-05-11 09:28:35 -07:00
Darkhorse7stars 61b3e380e0 ci(docker): use lux-build-* runners (cross-org from hanzoai/.github)
The reusable hanzoai/.github/docker-build.yml requires cross-org callers
to override runner labels — hanzoai org scale-sets aren't visible from
luxfi org. All v1.26.x CI runs have failed with startup_failure since
the upstream workflow added this requirement (~2026-05).

Per the reusable workflow's docstring:
  Cross-org callers (luxfi/*, zooai/*, <tenant>/*) MUST override
  these with their own org's ARC scale-set labels.

Switch to lux-build-linux-{amd64,arm64} labels which exist on the
luxfi ARC scale-set.
2026-05-11 04:32:32 -05:00
Hanzo AI 9c9e6b9e28 node+genesis: wire ChainSecurityProfile into bootstrap (closes F102)
Adds Node.SecurityProfile() getter and Node.initSecurityProfile() boot
step. New() now calls initSecurityProfile() right after
initBootstrappers() and before tracer/metrics/networking/chain init —
every downstream consumer (signer factory, peer handshake gate,
mempool, validator registry, bridge oracle) sees the resolved
*consensus/config.ChainSecurityProfile (or its absence) via the
getter at construction time.

The pin lives in genesis.Config.SecurityProfile (luxfi/genesis@v1.9.6,
which pins luxfi/consensus@v1.23.5). Resolution:
  1. genesiscfg.GetConfig(networkID) — load JSON-form genesis
  2. cfg.SecurityProfile.Resolve() — refuse mismatched pin
  3. stamp result onto n.securityProfile
  4. emit startup banner with hash, post-quantum, NIST-friendly,
     classical-SNARK, and BLS-fallback posture

A forked binary that swaps in a different canonical profile content
fails Resolve() because the live ComputeHash diverges from the
genesis-pinned hex — closes the F102 attack chain end-to-end.

Adds 5 regression tests for the load + reject paths under StrictPQ
and FIPS profiles, plus nil-pin / wrong-hash / unknown-ID rejection.

Bumps luxfi/consensus v1.23.4 → v1.23.5, luxfi/genesis pseudo →
v1.9.6, luxfi/crypto v1.18.3 → v1.18.4.
2026-05-10 21:04:28 -07:00
Hanzo AI 4c1529da2a node/vms/avm: mempool refuses classical creds under strict-PQ
Mirrors the P-chain gate (vms/platformvm/txs/mempool) onto the X-chain
(xvm) mempool. The X-chain wraps every credential in fxs.FxCredential,
so the gate unwraps the inner verify.Verifiable before handing the
slice to auth.EnforceCredentialPolicy — the policy package only sees
the canonical *secp256k1fx.Credential type.

Same opt-in shape as the P-chain wiring: SetAuthPolicy installs the
ChainSecurityProfile + ClassicalCompatRegistry; without a profile the
gate is bypassed.

Three integration tests cover: strict-PQ + no registry refuses
classical, no policy admits classical, strict-PQ + empty registry
refuses classical (the all-allow-listed contract is that the registry
names the allowed addresses; an empty registry admits nothing).
2026-05-10 20:58:31 -07:00
Hanzo AI 4a345fe8e3 node/vms/platformvm: mempool refuses classical creds under strict-PQ
Wires the canonical credential-policy gate (vms/txs/auth) into the
P-chain mempool. Adds an opt-in setter so existing callers that have
not migrated their construction path observe no behavioural change —
without SetAuthPolicy, the gate is bypassed and every tx the legacy
path accepted is still accepted.

Once a chain pins a non-nil *config.ChainSecurityProfile via
SetAuthPolicy, every Add path runs through auth.EnforceCredentialPolicy
before the underlying mempool sees the tx. A classical
secp256k1fx.Credential under RequireTypedTxAuth=true returns
auth.ErrLegacyCredentialUnderStrictPQ.

The originator is left at ids.ShortEmpty here because P-chain txs do
not bind a single canonical "from" address (the input owners can name
many keys). Chain builders that supply a ClassicalCompatRegistry whose
IsAllowed depends on tx-level context layer that resolver on top of
this gate.

Three integration tests cover: strict-PQ + no registry refuses
classical, no policy (legacy default) admits classical, classical-
compat profile admits classical. The full P-chain mempool suite
(TestBlockBuilderMaxMempoolSizeHandling et al.) is unchanged.
2026-05-10 20:58:24 -07:00
Hanzo AI 102023f249 node/vms/txs/auth: ClassicalCompatRegistry + strict-PQ mempool gate
Adds the canonical credential-policy gate that the P-chain and X-chain
mempools use to enforce a strict-PQ ChainSecurityProfile at admission
time. One package, one entry point (EnforceCredentialPolicy), one
error (ErrLegacyCredentialUnderStrictPQ).

  - ClassicalCompatRegistry: read-only allow-list interface. Names a
    bounded set of legacy operator addresses that may still post
    classical secp256k1 credentials on a chain that otherwise pins
    RequireTypedTxAuth=true. The chain's governance pathway is the
    only writer; the mempool only reads.
  - NewStaticClassicalCompatRegistry: frozen registry constructed from
    a fixed []ids.ShortID slice. Useful for tests and for genesis-
    pinned allow-lists before the governance path is online.
  - EnforceCredentialPolicy: idempotent gate, branches on
    profile.RequireTypedTxAuth:
        false → admit unconditionally (classical-compat profile)
        true  → walk creds; if any is *secp256k1fx.Credential and the
                originator is not in the registry, return
                ErrLegacyCredentialUnderStrictPQ.

10 tests cover: nil profile (ErrNilProfile, programmer error), classical
profile admits, strict-PQ admits PQ-only creds, strict-PQ refuses
classical without registry, strict-PQ refuses originator not in
registry, strict-PQ admits allow-listed originator, mixed creds with
one classical refuses, empty creds always admits (syntactic verifier's
job to require ≥1), nil-safe staticRegistry, distinguishes addresses.

Wiring into platformvm/txs/mempool and xvm/txs/mempool lands in the
follow-up commits.
2026-05-10 20:58:15 -07:00
Hanzo AI aee5923e68 node/vms/mldsafx: re-export ML-DSA feature extension
Re-exports the canonical ML-DSA-65 (FIPS 204) UTXO feature extension
from github.com/luxfi/utxo/mldsafx so platformvm and xvm callers depend
on a single import path:

    github.com/luxfi/node/vms/mldsafx

One feature extension, one import path. The wire types (Credential,
TransferInput/Output, MintOutput, MintOperation, OutputOwners, Input,
Fx, Factory) and the security-level constants are type aliases against
the upstream package — adding mldsafx as a node-side bridge introduces
zero runtime code.

This is the foundation the P-chain and X-chain mempool admission gates
(vms/txs/auth) and the strict-PQ tx variants build against.
2026-05-10 20:58:04 -07:00
Hanzo AI ea32845a7d node: fix go.mod/go.sum after consensus v1.23.4 retag
The prior commit referenced luxfi/consensus v1.23.3, but that tag was
already in use on the remote. Retagged the new ChainSecurityProfile
ValidatorSchemeID work as v1.23.4 and update node's go.mod/go.sum to
match. luxfi/ids v1.2.10 is unaffected.
2026-05-10 20:26:00 -07:00
Hanzo AI 3bb951e59e node: ML-DSA-65 promoted to canonical NodeID under strict-PQ
NodeIDScheme enum (MLDSA65=0x42 canonical, Secp256k1=0x90 classical-
compat-unsafe only). NodeID derivation now domain-separated via
SHAKE256-384("LUX_NODE_ID_V1" || chain_id || scheme || pubkey).

Wire encoding includes a leading scheme byte so the receiver can
verify without trusting the profile alone.

Strict-PQ profile rejects secp256k1 NodeIDs.
Classical-compat profile accepts both (transition path).

Migration: hardfork activation switches strict-PQ chains from
mixed-scheme to ML-DSA-only at a configured activation block.

network/peer/scheme_gate.go is the single primitive consumers funnel
inbound NodeIDs through: SchemeGate.Classify(nodeID, scheme, height,
site) returns a TypedNodeID once the chain policy admits the pair.
The ActivationHeight field implements the hardfork transition window;
ClassicalCompatUnsafe mirrors the operator opt-in flag (refused under
strict-PQ regardless, honoured on permissive).

Existing 20-byte ids.NodeID array stays byte-identical for storage /
map keys / codec; the scheme byte travels alongside it on the wire
via ids.TypedNodeID. Consumers of the 20-byte form (peer/upgrader,
proposervm block proposer, platformvm validator registry, mempool
sender) continue to work unchanged at the storage layer; the
SchemeGate boundary is what stamps the scheme byte and runs the
cross-axis check.

Bumps luxfi/ids v1.2.9 -> v1.2.10 (NodeIDScheme, TypedNodeID,
DeriveMLDSA, FullDigest, error surface) and luxfi/consensus
v1.23.2 -> v1.23.3 (ValidatorSchemeID accessor, AcceptsValidatorScheme,
ErrValidatorSchemeMismatch).

Tests:
- TestSchemeGate_NewSchemeGate_RejectsNilProfile
- TestSchemeGate_StrictPQ_AcceptsMatchedScheme
- TestSchemeGate_StrictPQ_PostActivation_RejectsClassical
- TestSchemeGate_StrictPQ_PreActivation_AcceptsBothSchemes
- TestSchemeGate_StrictPQ_PreActivation_RejectsClassicalAfterCutover
- TestSchemeGate_Permissive_AcceptsClassicalUnderUnsafeFlag
- TestSchemeGate_RejectsUnknownSchemeByte
- TestSchemeGate_PinsProfileScheme
- TestSchemeGate_SiteTagIncludedInError

Patch-bump: v1.26.9 -> v1.26.10.
2026-05-10 20:18:32 -07:00
Hanzo AI 517acef79b node/network: PQ peer handshake — ML-KEM-768/1024 + ML-DSA-65 identity
Replaces classical X25519/ECDH peer handshake with ML-KEM-768 (default)
and ML-KEM-1024 (high-value validator/DKG channels). Node identity is
signed with ML-DSA-65 over a TupleHash256-bound transcript.

cSHAKE256 derives the AEAD session key with customization
"LUX_NODE_AEAD_V1", binding profile_id, chain_id, both nodes' ML-DSA
public keys, and the shared KEM secret.

DKG channels in pulsar/pulsar-m force ML-KEM-1024.

Strict-PQ profile refuses peers offering X25519Unsafe KEM.

Patch-bump.
2026-05-10 20:04:26 -07:00
Hanzo AI cc856c020c platformvm: C-Chain is opt-in via --track-chains, only X-Chain is built-in
Only P-Chain (chain manager startup) and X-Chain (UTXO infra) are
required primary-network chains. C-Chain (EVM), D-Chain (DEX),
B-Chain (Bridge), T-Chain (Threshold) — and any subnet blockchain —
must be explicitly tracked via --track-chains. A validator gets exactly
the topology its operator asks for, nothing more.

Pre-fix: every primary-network blockchain in genesis was created
unconditionally because `constants.PrimaryNetworkID != tx.ChainID`
short-circuited the TrackedChains gate. <tenant> validators (no
C-Chain plugin shipped) ran into "failed to initialize VM: parsing
genesis: unexpected end of JSON input" on every health check.

Replace the primary-network bypass with a per-VM check: only
tx.VMID == constants.XVMID skips the gate. Everything else (including
C-Chain on primary network) goes through TrackedChains.
2026-05-10 15:21:36 -07:00
Hanzo AI a0d1a2bc31 chains: opt-in by plugin — drop TrackAllChains auto-true + skip missing
Two related fixes that make chain tracking explicit per-validator:

1. config/config.go: drop the silent default
   `if TrackedChains == nil { TrackAllChains = true }`. That made any
   node without an explicit --track-chains list try to spin up every
   chain in P-chain state, including ones whose VM plugin wasn't
   loaded. The setting was a footgun. Empty TrackedChains now means
   "track only P/X (built-in)". TrackAllChains stays as an explicit
   opt-in escape hatch.

2. chains/manager.go: when buildChain returns ErrNotFound (VM plugin
   not registered for this chain's vmID), treat it as the validator's
   "I don't validate this one" signal — log info, mark the slot
   bootstrapped, and return WITHOUT registering a per-chain failing
   health check. The chain stays in pending state for hot-load.
   Previously this registered a permanent 503 on /ext/health for the
   chain-alias, which made kubelet liveness probes kill any pod that
   didn't ship plugins for every chain in the primary genesis. Now
   validators participate per-plugin: load liquid-evm/dex/fhe → those
   chains validate; don't load Lux's upstream EVM plugin → C-Chain
   stays in pending without crashing the node.

Real failures (e.g. genesis decode error, db corruption) still register
the failing health check — those are operator misconfigurations, not
deliberate opt-outs.

Future: a Lux-signed featured-chains.json + --track-featured (default
true) would make this opt-in safer at scale — limits the DDoS surface
of unbounded chain creation while still letting validators earn yield
on the curated set out of the box.
2026-05-10 12:21:48 -07:00
Hanzo AI 9c95d6473a platformvm: add GetChains as canonical replacement for GetNets
Adds platform.getChains alongside platform.getNets — same wire shape
(IDs in, list of {ID, ControlKeys, Threshold} out), names that match
the user-facing concept ("chain") instead of the internal "net" /
"subnet" jargon. APIChain replaces APINet, ClientChain (alias for
ClientNet) keeps drop-in source compatibility.

Why now: GetNets was already marked deprecated via the "deprecated
API called" log line, but no canonical replacement existed — callers
had to keep calling the deprecated method. This commit lands the
replacement so the bootstrap binary's chain idempotency check
(EnsureChainNetwork → list chains, match owner set) can target the
canonical name.

GetNets stays available indefinitely for wire-protocol compatibility.
GetChains delegates to GetNets internally so the two methods can
never diverge — bug-fix one, both fix.

Test pinned in service_test.go alongside GetNets test (existing file
has //go:build skip but the test is documentation for the contract).
2026-05-09 18:08:24 -07:00
Hanzo AI 6f0cdee116 deps: bump luxfi/genesis → fe4781cd (LUX_DISABLE_CCHAIN env knob) 2026-05-09 16:28:04 -07:00
Hanzo AI 2060761d42 platformvm: gate createCChainIfNeeded on LUX_MIGRATE_CCHAIN=1
createCChainIfNeeded is the one-time recovery path for the historical
mainnet migration where post-merge geth state was imported under a fixed
blockchainID (no CreateChainTx). On every other launch the function
either silently no-ops on the missing data dir or — worse — risks
touching the filesystem before the data dir exists during a fresh
genesis. Gating it behind LUX_MIGRATE_CCHAIN=1 keeps the migration path
exactly where it belongs: opt-in, run once, never again.
2026-05-09 14:30:27 -07:00
Hanzo AI a4208faf95 zap/client: don't treat MsgResponseFlag as error flag
The wire protocol uses two flags on responses:
  MsgResponseFlag (0x80) — set on EVERY response (success or error)
  MsgErrorFlag    (0x40) — set ONLY on error responses

The transport's readLoop already converts MsgErrorFlag responses into a
non-nil err out of Conn.Call, so by the time the client checks respType
the response is guaranteed successful. Treating MsgResponseFlag as the
"is this an error?" predicate fired on every successful Initialize and
rendered the binary InitializeResponse payload (LastAcceptedID, parent,
height, bytes, timestamp) as if it were an error string, producing
"vm error: <unprintable bytes>" and crashing chain creation despite the
plugin reporting "VM initialized successfully".

Symptom in the field: lqd repeatedly logged
  failed to create chain on net 11111111111111111111111111111111LpoYY:
  failed to initialize VM: zap initialize: vm error: \x00\x00\x00 ...
while the plugin's own log read "ZAP VM initialized successfully" and
"Chain initialized successfully". Health check C reported permanent
failure, eth_getBalance returned 404, no blocks were ever produced.

Fix: drop the spurious MsgResponseFlag check and strip both flags before
comparing the message type so that any well-formed response is accepted.

Regression test in client_initialize_test.go pins both halves of the
contract: a success response is decoded (lastAcceptedID round-trips),
and a server-side error is surfaced through err with the original
message intact.
2026-05-09 13:46:53 -07:00
Hanzo AI 1d94973509 deps: bump luxfi/genesis v1.9.5 → 2b16f454 (LUX_CCHAIN_GENESIS_FILE)
Picks up luxfi/genesis@2b16f454 — adds operator-overridable C-Chain
genesis at the embedded-loader layer. Pairs with 009f00ba (this repo's
LUX_AUTOMINE_CCHAIN_GENESIS_PATH for the automine single-node path).
With both env vars wired, downstream networks can reuse stock lqd
without forking configs/network/cchain.json or patching this binary.
2026-05-08 17:18:55 -07:00
Hanzo AI 009f00ba91 feat(automine): operator-overridable C-Chain genesis via LUX_AUTOMINE_CCHAIN_GENESIS_PATH
The automine path embeds the C-Chain genesis bytes into the primary-
network genesis at boot. Until now that genesis was a hardcoded constant
(chainId 31337) — fine for stock lqd local dev, but downstream networks
(<tenant> at chainId 8675312, etc.) had no way to override without
patching the binary. The chain-config-dir scan happens AFTER the EVM
plugin has already initialised from the embedded bytes, so dropping a
genesis.json into configs/chains/C/ is silently ignored.

Adds LUX_AUTOMINE_CCHAIN_GENESIS_PATH: when set, lqd reads the JSON at
that path and embeds it as the C-Chain genesis. Unset → unchanged
behaviour (chainId 31337 default).

The saved AutomineNetworkConfig also mirrors the resolved value so the
on-disk record is true to what was embedded.
2026-05-08 16:27:54 -07:00
Hanzo AI c26319db84 deps: bump luxfi/genesis v1.9.4 → v1.9.5 (gasLimit 1B everywhere) 2026-05-07 22:04:52 -07:00
Hanzo AI fd40807831 fix(node): C-Chain (primary-network EVM) is truly opt-in
Match the OPT-IN comment at genesis/builder/builder.go:617. The
initChainManager path was hard-erroring when the platform genesis
had no constants.EVMID chain — that contradicted the documented
opt-in behaviour and forced consumers (<tenant> Network) to bake
a placeholder EVM into the primary genesis just to satisfy the
node init.

With this change, networks that register their own EVM as a
dedicated chain via platform.createChainTx (the canonical L2-on-Lux
or sovereign-chain flow) leave the platform genesis EVM-less and
cChainID stays ids.Empty. Chain manager + aliasing already accept
the empty ID — no further changes needed.
2026-05-07 21:08:42 -07:00
Hanzo AI 9b397125c1 deps: bump luxfi/genesis v1.9.3 → v1.9.4 (drop local cChainGenesis) 2026-05-07 21:04:17 -07:00
Hanzo AI e9c2d81ff5 deps: bump luxfi/genesis v1.9.2 → v1.9.3
Picks up the localnet genesis regen from LIGHT_MNEMONIC. lux/node's
default genesis for network-id=1337 now funds the same 100 P/X wallets
the lux/node + <tenant>/node toolchains derive against, so local
dev no longer has to set --genesis-file or hand-edit allocations.
2026-05-07 20:18:05 -07:00
Hanzo AI df8af35979 fix(zap/client): keep wire field name LuxAssetID (proto-generated)
The struct `zapwire.InitializeRequest.LuxAssetID` is generated from a
.proto in luxfi/api — renaming it requires regenerating the wire
bindings, bumping luxfi/api, then bumping luxfi/node to that. Out of
scope for this rename pass; revert the one Go-side assignment so the
build resolves against the existing wire type. The local variable
already reads from `Context().XAssetID` so the data path is consistent;
only the on-the-wire field name lags.
2026-05-07 17:09:20 -07:00
Hanzo AI 1113675482 refactor(config): rename node.Config.LuxAssetID -> XAssetID
The field has always semantically been the X-Chain asset ID — the JSON
tag is already `xAssetID`. The Go name `LuxAssetID` was a holdover from
when "LUX" was the only asset name on the chain, which created confusion
when readers expected `XAssetID` to mirror `XChainID` / `CChainID` /
`DChainID` (all of which already used the chain-letter naming).

Renamed across config, node, vms/platformvm, vms/rpcchainvm/zap and the
static_service API request types. JSON tag and protobuf wire fields are
unchanged, so on-disk configs and inter-process plugin RPC are
backwards-compatible — only Go callers see the new name.
2026-05-07 16:52:35 -07:00
Hanzo AI 131e6a588c fix(chains): register all 9 fx factories matching genesis builder
X-Chain genesis at builder.go:603-613 references 9 FxIDs (secp256k1fx,
nftfx, propertyfx, mldsafx, slhdsafx, ed25519fx, secp256r1fx, schnorrfx,
bls12381fx) but chains/manager.go only registered the first 3. Chain
init failed with "fx qC5JEjDhfXD66cGuhtiL3Lkka2SgZyht74nHVQFmYFyDiLqXe
not found" — that ID encodes 'mldsafx' which the genesis builder added
when post-quantum support landed but wasn't paired with a manager-side
registration.

Add all 6 missing factories so any FxID emitted by the genesis builder
loads at chain create time. The fxs map is now structurally identical
to the X-Chain FxIDs slice — drift between the two will become a
review-time diff in chains/manager.go vs. genesis/builder/builder.go.
2026-05-07 15:22:42 -07:00
Hanzo AI c790abb494 .gitignore + commit vms/components/lux content
Anchor /lux + /luxd binary patterns at repo root so the gitignore
rule doesn't accidentally match every directory called "lux" deep
in the tree (which was excluding vms/components/lux that the
previous commit tried to land).

Add the actual UTXO type tree files so v1.26.5 ships with the
package contents external consumers (liquidity/network-bootstrap
etc) need.
2026-05-06 21:09:12 -07:00
Hanzo AI fcde96701d vms: restore components/lux + add thresholdvm re-export shim
* vms/components/lux: restore the X-Chain UTXO type tree from
  v1.24.29. External consumers (~/work/liquidity/network-bootstrap,
  PlatformVM tx builders, AVM tx builders) import this exact type
  tree to interop with the X→P export path. Documented in CLAUDE.md
  as a known anomaly pending #58 consolidation; until that lands the
  package must be present.

* vms/thresholdvm/thresholdvm.go: re-export shim mirroring vms/dexvm.
  The Threshold (FHE / MPC) VM moved out of node/vms/thresholdvm
  into github.com/luxfi/chains/thresholdvm. Callers (liquidity/fhe
  plugin etc) keep building unchanged.

No on-the-wire behaviour change.
2026-05-06 21:08:25 -07:00
Hanzo AI 6e76c846fb proto/pb: stub empty pb packages; vms/dexvm: re-export from chains/dexvm
Two compatibility seams that downstream consumers need post-Z-Wing
restructure:

1. proto/pb/* stubs (build tag grpc) — every grpc-tagged file under
   proto/<name>/<name>_grpc.go (and the legacy proto/rpcdb/rpcdb_grpc.go)
   imports proto/pb/<name>. Those dirs were empty (git ignores empty
   dirs), so consumers' `go mod tidy` walked the imports under the
   grpc tag and failed to resolve the package. Default builds use
   ZAP and never enter these stubs; the grpc-tag path now compiles
   cleanly even though the protobuf types themselves still need
   regeneration when someone actually wants the gRPC transport.

2. vms/dexvm/dexvm.go — re-export shim for the canonical chains/dexvm
   package. The DEX VM moved out of node/vms/dexvm into
   github.com/luxfi/chains/dexvm; existing callers (~/work/liquidity/
   node, etc.) keep building unchanged.

Default build clean; grpc-tagged build also resolves. No on-the-wire
behaviour change in the ZAP default path.
2026-05-06 20:55:12 -07:00
627 changed files with 35098 additions and 58862 deletions
-2
View File
@@ -3,5 +3,3 @@ self-hosted-runner:
- custom-arm64-focal
- custom-arm64-jammy
- hanzo-build-linux-amd64
- hanzo-build-linux-arm64
- ubuntu-24.04-arm
@@ -12,9 +12,9 @@ else
MODULE_DETAILS="$(go list -m "github.com/luxfi/node" 2>/dev/null)"
# Extract the version part
LUX_VERSION="$(echo "${MODULE_DETAILS}" | awk '{print $2}')"
NODE_VERSION="$(echo "${MODULE_DETAILS}" | awk '{print $2}')"
if [[ -z "${LUX_VERSION}" ]]; then
if [[ -z "${NODE_VERSION}" ]]; then
echo "Failed to get luxd version from go.mod"
exit 1
fi
@@ -23,12 +23,12 @@ else
# v*YYYYMMDDHHMMSS-abcdef123456
#
# If not, the value is assumed to represent a tag
if [[ "${LUX_VERSION}" =~ ^v.*[0-9]{14}-[0-9a-f]{12}$ ]]; then
if [[ "${NODE_VERSION}" =~ ^v.*[0-9]{14}-[0-9a-f]{12}$ ]]; then
# Use the module hash as the version
LUX_VERSION="$(echo "${LUX_VERSION}" | cut -d'-' -f3)"
NODE_VERSION="$(echo "${NODE_VERSION}" | cut -d'-' -f3)"
fi
FLAKE="github:luxfi/node?ref=${LUX_VERSION}"
FLAKE="github:luxfi/node?ref=${NODE_VERSION}"
echo "Starting nix shell for ${FLAKE}"
fi
@@ -9,6 +9,6 @@ set -euo pipefail
# when go is already installed.
# 3 directories above this script
LUX_PATH=$( cd "$( dirname "${BASH_SOURCE[0]}" )"; cd ../../.. && pwd )
NODE_PATH=$( cd "$( dirname "${BASH_SOURCE[0]}" )"; cd ../../.. && pwd )
echo GO_VERSION="~$(sed -n -e 's/^go //p' "${LUX_PATH}"/go.mod)"
echo GO_VERSION="~$(sed -n -e 's/^go //p' "${NODE_PATH}"/go.mod)"
-3
View File
@@ -67,9 +67,6 @@
description: "This involves consensus"
- name: "continuous staking"
color: "f9d0c4"
- name: "Durango"
color: "DAF894"
description: "durango fork"
- name: "gossiping upgrade"
color: "c2e0c6"
- name: "merkledb"
+14
View File
@@ -2,6 +2,9 @@ name: Lint proto files
on:
push:
paths:
- 'proto/**/*.proto'
- '.github/workflows/buf-lint.yml'
permissions:
contents: read
@@ -11,10 +14,21 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Check for .proto files
id: proto-check
run: |
if find proto -name '*.proto' -type f 2>/dev/null | grep -q .; then
echo "has_proto=true" >> $GITHUB_OUTPUT
else
echo "has_proto=false" >> $GITHUB_OUTPUT
echo "No .proto files found — skipping buf-lint (node is ZAP-native by default; protobuf is opt-in)."
fi
- uses: bufbuild/buf-setup-action@v1
if: steps.proto-check.outputs.has_proto == 'true'
with:
github_token: ${{ github.token }}
version: "1.47.2"
- uses: bufbuild/buf-lint-action@v1
if: steps.proto-check.outputs.has_proto == 'true'
with:
input: "proto"
@@ -20,7 +20,10 @@ jobs:
GOWORK: off
strategy:
matrix:
os: [windows-latest, macos-latest]
# `macos-latest` currently resolves to GH-hosted arm64 macos (forbidden);
# pin to `macos-13` (amd64). darwin/arm64 coverage lives in
# build-macos-release.yml via cross-compile.
os: [windows-latest, macos-13]
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup-go-for-project
+4 -4
View File
@@ -18,7 +18,7 @@ on:
jobs:
build-x86_64-binaries-tarball:
runs-on: hanzo-build-linux-amd64
runs-on: lux-build
permissions:
id-token: write
contents: read
@@ -68,7 +68,7 @@ jobs:
rm -rf ${{ github.workspace }}/luxd-pkg
build-arm64-binaries-tarball:
runs-on: ubuntu-24.04-arm
runs-on: lux-build
permissions:
id-token: write
contents: read
@@ -80,8 +80,8 @@ jobs:
- run: go version
- name: Build the luxd binaries (native arm64)
run: CGO_ENABLED=0 ./scripts/build.sh
- name: Build the luxd binaries (cross-compile arm64 on amd64)
run: CGO_ENABLED=0 GOOS=linux GOARCH=arm64 ./scripts/build.sh
- name: Try to get tag from git
if: "${{ github.event.inputs.tag == '' }}"
+19 -9
View File
@@ -21,10 +21,17 @@ on:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
# Cross-compile both darwin/amd64 and darwin/arm64 from Linux. The build
# uses CGO_ENABLED=0 + GOOS=darwin GOARCH=$arch — pure Go, no Darwin
# toolchain required. We run on the self-hosted `lux-build` ARC pool
# rather than `macos-13` (which has long GitHub-hosted queues) to keep
# the release pipeline unblocked.
build-mac:
# The type of runner that the job will run on
runs-on: macos-14
strategy:
fail-fast: false
matrix:
goarch: [amd64, arm64]
runs-on: lux-build
permissions:
id-token: write
contents: read
@@ -37,8 +44,8 @@ jobs:
- run: go version
# Runs a single command using the runners shell
- name: Build the luxd binary
run: CGO_ENABLED=0 ./scripts/run_task.sh build
- name: Build the luxd binary (cross-compile via GOOS/GOARCH)
run: CGO_ENABLED=0 GOOS=darwin GOARCH=${{ matrix.goarch }} ./scripts/run_task.sh build
- name: Try to get tag from git
if: "${{ github.event.inputs.tag == '' }}"
@@ -56,17 +63,20 @@ jobs:
- name: Create zip file with CLI-compatible naming
run: |
# CLI expects: node-macos-{version}.zip containing build/luxd
# CLI expects: node-macos-{arch}-{version}.zip containing build/luxd
mkdir -p build
7z a "node-macos-${TAG}.zip" build/luxd
if ! command -v zip >/dev/null 2>&1; then
sudo apt-get update && sudo apt-get install -y zip
fi
zip "node-macos-${{ matrix.goarch }}-${TAG}.zip" build/luxd
env:
TAG: ${{ env.TAG }}
- name: Save as Github artifact
uses: actions/upload-artifact@v7
with:
name: build
path: node-macos-${{ env.TAG }}.zip
name: build-darwin-${{ matrix.goarch }}
path: node-macos-${{ matrix.goarch }}-${{ env.TAG }}.zip
- name: Cleanup
run: |
@@ -18,7 +18,7 @@ on:
jobs:
build-jammy-amd64-package:
runs-on: hanzo-build-linux-amd64
runs-on: lux-build
permissions:
id-token: write
contents: read
@@ -66,7 +66,7 @@ jobs:
rm -rf /tmp/luxd
build-focal-amd64-package:
runs-on: hanzo-build-linux-amd64
runs-on: lux-build
steps:
- uses: actions/checkout@v4
@@ -18,15 +18,15 @@ on:
jobs:
build-jammy-arm64-package:
runs-on: ubuntu-24.04-arm
runs-on: lux-build
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup-go-for-project
- run: go version
- name: Build the luxd binaries (native arm64)
run: CGO_ENABLED=0 ./scripts/build.sh
- name: Build the luxd binaries (cross-compile arm64 on amd64)
run: CGO_ENABLED=0 GOOS=linux GOARCH=arm64 ./scripts/build.sh
- name: Try to get tag from git
if: "${{ github.event.inputs.tag == '' }}"
@@ -63,15 +63,15 @@ jobs:
rm -rf /tmp/luxd
build-focal-arm64-package:
runs-on: ubuntu-24.04-arm
runs-on: lux-build
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup-go-for-project
- run: go version
- name: Build the luxd binaries (native arm64)
run: CGO_ENABLED=0 ./scripts/build.sh
- name: Build the luxd binaries (cross-compile arm64 on amd64)
run: CGO_ENABLED=0 GOOS=linux GOARCH=arm64 ./scripts/build.sh
- name: Try to get tag from git
if: "${{ github.event.inputs.tag == '' }}"
+4 -4
View File
@@ -5,9 +5,9 @@ set -o nounset
set -o pipefail
# Lux root directory
LUX_PATH=$( cd "$( dirname "${BASH_SOURCE[0]}" )"; cd ../.. && pwd )
NODE_PATH=$( cd "$( dirname "${BASH_SOURCE[0]}" )"; cd ../.. && pwd )
"$LUX_PATH"/scripts/build.sh
"$NODE_PATH"/scripts/build.sh
# Check to see if the build script creates any unstaged changes to prevent
# regression where builds go.mod/go.sum files get out of date.
if [[ -z $(git status -s) ]]; then
@@ -15,5 +15,5 @@ if [[ -z $(git status -s) ]]; then
# TODO: Revise this check once we can reliably build without changes
# exit 1
fi
"$LUX_PATH"/scripts/build_test.sh
"$LUX_PATH"/scripts/build_fuzz.sh 2
"$NODE_PATH"/scripts/build_test.sh
"$NODE_PATH"/scripts/build_fuzz.sh 2
+3 -1
View File
@@ -30,7 +30,9 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [macos-14, ubuntu-22.04, ubuntu-24.04, windows-2022]
# GH-hosted arm64 macos forbidden; CI runs amd64 only. Release builds
# cover darwin/arm64 via cross-compile in build-macos-release.yml.
os: [macos-13, ubuntu-22.04, ubuntu-24.04, windows-2022]
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup-go-for-project
+96 -9
View File
@@ -8,22 +8,109 @@ on:
permissions:
contents: read
packages: write
id-token: write
jobs:
docker:
uses: hanzoai/.github/.github/workflows/docker-build.yml@main
with:
image: ghcr.io/luxfi/node
runner-amd64: hanzo-build-linux-amd64
runner-arm64: hanzo-build-linux-arm64
secrets: inherit
build-amd64:
# Self-hosted `lux-build` ARC pool on DOKS hanzo-k8s (max 20 runners,
# scales 0→N on demand). Org-isolated: luxfi workflows must use this
# pool (never the hanzoai pools). amd64 only — DOKS has no arm64 yet.
runs-on: lux-build
outputs:
digest: ${{ steps.build.outputs.digest }}
steps:
- uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
driver: docker-container
driver-opts: |
network=host
- name: Login to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Image metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/luxfi/node
# Semver-only policy: only `v*` git tags yield a published image
# tag; every push gets an immutable `sha-<sha7>` for traceability.
# No `:latest`, no `:main`, no floating tags ever. `flavor.latest`
# has to be explicit-false; docker/metadata-action defaults to
# `latest=auto` which silently emits `:latest` on tag pushes.
flavor: |
latest=false
tags: |
type=ref,event=tag
type=sha,format=short,prefix=sha-
- name: Resolve cross-repo PAT for private luxfi/* deps
id: pat
env:
# The default GITHUB_TOKEN is repo-scoped and cannot read
# private cross-repo deps like luxfi/corona or luxfi/evm. We
# need a PAT with org-wide read scope. Order of preference:
# 1) org GH_TOKEN (visibility=all, set on luxfi org since 2024)
# 2) repo UNIVERSE_PAT (set on luxfi/node since 2026-04)
# Either suffices; we just need ONE non-empty token. If both
# are empty the build is going to fail at go mod download for
# corona — fail fast here with a clear message.
GH_TOKEN: ${{ secrets.GH_TOKEN }}
UNIVERSE_PAT: ${{ secrets.UNIVERSE_PAT }}
run: |
tok="$GH_TOKEN"
src="GH_TOKEN"
if [ -z "$tok" ]; then
tok="$UNIVERSE_PAT"
src="UNIVERSE_PAT"
fi
if [ -z "$tok" ]; then
echo "::error::Neither GH_TOKEN (org) nor UNIVERSE_PAT (repo) is set. Private luxfi/* deps cannot be resolved."
exit 1
fi
echo "Using secret: $src (length=${#tok})"
# Pass the resolved token to subsequent steps without exposing
# the value. ::add-mask:: prevents accidental log leaks if the
# value ever appears in later step output.
echo "::add-mask::$tok"
echo "token<<EOF" >> "$GITHUB_OUTPUT"
echo "$tok" >> "$GITHUB_OUTPUT"
echo "EOF" >> "$GITHUB_OUTPUT"
- name: Build & push (amd64)
id: build
uses: docker/build-push-action@v6
with:
context: .
file: Dockerfile
platforms: linux/amd64
push: true
build-args: |
CGO_ENABLED=0
# Resolve private luxfi/* modules via git url.insteadOf in the
# Dockerfile. Take the token value from the previous step's
# output (it picked GH_TOKEN or fell back to UNIVERSE_PAT).
secrets: |
ghtok=${{ steps.pat.outputs.token }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
provenance: false
cache-from: type=registry,ref=ghcr.io/luxfi/node:buildcache-amd64
cache-to: type=registry,ref=ghcr.io/luxfi/node:buildcache-amd64,mode=max
notify-universe:
needs: docker
needs: build-amd64
if: startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
steps:
- uses: peter-evans/repository-dispatch@v3
- uses: peter-evans/repository-dispatch@v4
with:
token: ${{ secrets.UNIVERSE_PAT }}
repository: luxfi/universe
+280
View File
@@ -0,0 +1,280 @@
name: zap-audit
# LP-023 — audit gates for zap_native invariants.
#
# Job 1 (R6-6): AddressList.At() must remain non-production until
# owner-model migration / executor-side equivalence is proven. This
# workflow fails the PR if any new production caller is introduced.
#
# Job 2 (R7V8): Every tx type that EMBEDS a ChainsList in its per-tx
# Verify() body MUST call .MustVerify() on it. The receiver-name rename
# (Verify → MustVerify, batch 5 v3.6) makes the gate grep-able. Without
# this gate, a future Verify() author can silently skip the per-entry
# FxIDsLen + reserved-bytes walk and ship a wire-fork primitive.
#
# Allowed callers (Job 1):
# - *_test.go — tests
# - tx_verify.go — executor-side SyntacticVerify boundary
# - owner.go — the type's own implementation
# - audit_test.go — the mirroring local test that reproduces this gate
#
# To LEGITIMATELY introduce a production caller (Job 1):
# 1. Land the owner-model migration that retires AddressList.At() OR
# 2. Add the caller's file to the allowlist below AND document the
# equivalence proof in vms/platformvm/txs/zap_native/owner.go.
#
# Local reproduction:
# cd vms/platformvm/txs/zap_native && go test -run TestAuditGate -v
on:
pull_request:
paths:
- "vms/platformvm/txs/zap_native/**"
- ".github/workflows/zap-audit.yml"
push:
branches: [main, dev]
paths:
- "vms/platformvm/txs/zap_native/**"
- ".github/workflows/zap-audit.yml"
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
addresslist-production-gate:
name: AddressList.At() — no production consumers
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Grep for production consumers
shell: bash
run: |
set -euo pipefail
hits=$(grep -rn 'AddressList\.At(' --include='*.go' vms/platformvm/txs/zap_native/ \
| grep -vE '(_test\.go|tx_verify\.go|owner\.go)' \
|| true)
if [ -n "$hits" ]; then
echo "ERROR: New production consumer(s) of AddressList.At() found."
echo "AddressList is forward-looking — see"
echo " vms/platformvm/txs/zap_native/owner.go"
echo "for the consumer-safety contract."
echo ""
echo "If you have a legitimate production use, either:"
echo " 1. Land the owner-model migration that retires AddressList.At, OR"
echo " 2. Add the file to the allowlist in"
echo " .github/workflows/zap-audit.yml AND"
echo " vms/platformvm/txs/zap_native/audit_test.go"
echo " with the equivalence proof recorded in owner.go."
echo ""
echo "Offenders:"
echo "$hits"
exit 1
fi
echo "Audit clean: zero AddressList.At() production consumers"
chainslist-verify-gate:
name: ChainsList embedders — MustVerify() required
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Ensure ChainsList embedders call MustVerify()
shell: bash
run: |
set -euo pipefail
cd vms/platformvm/txs/zap_native
# Step 1: enumerate tx types that EMBED ChainsList. A tx type
# T is an embedder if it has an accessor like
# func (t T) Chains() ChainsListView
# defined in a production file.
embedders=$(grep -rEoh 'func \(t [A-Z][A-Za-z0-9_]+\) Chains\(\) (ChainsList|ChainsListView|BoundChainsList)' \
--include='*.go' . \
| grep -vE '(_test\.go)' \
| sed -E 's/^func \(t ([A-Za-z0-9_]+)\) Chains.*/\1/' \
| sort -u || true)
if [ -z "$embedders" ]; then
echo "Audit clean: zero ChainsList embedder tx types"
exit 0
fi
# Step 2: for each embedder T, confirm tx_verify.go has a
# Verify() method for T AND calls .MustVerify(). Centralized
# in tx_verify.go by convention; embedder file (type
# definition) and Verify file (gate body) are decoupled.
offenders=""
for T in $embedders; do
if grep -qE "func \([a-z]+ ${T}\) Verify\(\)" tx_verify.go; then
if ! grep -q '\.MustVerify(' tx_verify.go; then
offenders="${offenders}\n${T} (tx_verify.go has Verify() for ${T} but no .MustVerify() call)"
fi
fi
done
if [ -n "$offenders" ]; then
echo "ERROR: ChainsList embedder tx type(s) missing .MustVerify() call."
echo "Every tx type T with a Chains() accessor AND a Verify()"
echo "method MUST call list.MustVerify() inside that Verify()"
echo "to enforce FxIDsLen + reserved-bytes invariants"
echo "(R6-4 / R6V5 / R7V8)."
echo ""
echo "Either wire the gate or document why it's safe to skip"
echo "inline with a clear comment."
echo ""
echo -e "Offenders:${offenders}"
exit 1
fi
echo "Audit clean: all ChainsList embedders call MustVerify()"
validatorslist-mustverify-gate:
name: ValidatorsList embedders — MustVerify() required
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Ensure ValidatorsList embedders call MustVerify()
shell: bash
run: |
set -euo pipefail
cd vms/platformvm/txs/zap_native
# Step 1: enumerate tx types that EMBED ValidatorsList. A tx
# type T is an embedder if it has an accessor like
# func (t T) Validators() ValidatorsList
# defined in a production file.
embedders=$(grep -rEoh 'func \(t [A-Z][A-Za-z0-9_]+\) Validators\(\) ValidatorsList' \
--include='*.go' . \
| grep -vE '(_test\.go)' \
| sed -E 's/^func \(t ([A-Za-z0-9_]+)\) Validators.*/\1/' \
| sort -u || true)
if [ -z "$embedders" ]; then
echo "Audit clean: zero ValidatorsList embedder tx types"
exit 0
fi
# Step 2: for each embedder T, locate the bounded Verify()
# body in tx_verify.go and confirm it contains a MustVerify(
# token. Body delimited by matching braces from the opening
# `{` of the function header.
offenders=""
for T in $embedders; do
if ! grep -qE "func \(t ${T}\) Verify\(\) error \{" tx_verify.go; then
# No Verify() — covered by other audits; skip here.
continue
fi
body=$(awk -v T="${T}" '
BEGIN { in_fn=0; depth=0 }
{
if (in_fn == 0) {
if ($0 ~ ("func \\(t " T "\\) Verify\\(\\) error \\{$")) {
in_fn=1
depth=1
next
}
} else {
for (i=1; i<=length($0); i++) {
c = substr($0,i,1)
if (c == "{") depth++
else if (c == "}") {
depth--
if (depth == 0) { exit }
}
}
print $0
}
}
' tx_verify.go)
if ! echo "$body" | grep -q '\.MustVerify('; then
offenders="${offenders}\n${T} (Verify() body does not call validators.MustVerify())"
fi
done
if [ -n "$offenders" ]; then
echo "ERROR: ValidatorsList embedder tx type(s) missing .MustVerify() call."
echo "Every tx type T with a Validators() accessor AND a Verify()"
echo "method MUST call list.MustVerify() inside that Verify()"
echo "to enforce the 5 structural floor invariants"
echo "(cap, weight, BLS-non-zero, expiry-non-zero)."
echo ""
echo -e "Offenders:${offenders}"
exit 1
fi
echo "Audit clean: all ValidatorsList embedders call MustVerify()"
owner-bearing-syntacticverify-gate:
name: Owner-bearing tx — SyntacticVerify() required
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Ensure Owner-bearing tx types call SyntacticVerify()
shell: bash
run: |
set -euo pipefail
cd vms/platformvm/txs/zap_native
# Step 1: enumerate Owner-bearing tx types. Match any of the
# named owner accessors that return the (uint32, uint64,
# ids.ShortID) tuple. TransferChainOwnershipTx uses split
# accessors (OwnerThreshold/Locktime/Address) so a separate
# check picks it up.
embedders=$(grep -rEoh 'func \(t [A-Z][A-Za-z0-9_]+\) (Owner|RewardsOwner|ValidationRewardsOwner|DelegationRewardsOwner)\(\) \(uint32, uint64, ids\.ShortID\)' \
--include='*.go' . \
| grep -vE '(_test\.go)' \
| sed -E 's/^func \(t ([A-Za-z0-9_]+)\).*/\1/' \
| sort -u || true)
if grep -qE 'func \(t TransferChainOwnershipTx\) (OwnerThreshold|OwnerLocktime|OwnerAddress)\(\)' \
--include='*.go' -r . ; then
embedders="${embedders}
TransferChainOwnershipTx"
fi
embedders=$(echo "${embedders}" | sort -u | grep -v '^$' || true)
if [ -z "$embedders" ]; then
echo "Audit clean: zero Owner-bearing tx types"
exit 0
fi
# Step 2: for each embedder T, locate the bounded Verify() body
# in tx_verify.go and confirm it contains a SyntacticVerify
# token. The body is delimited by matching braces from the
# opening `{` of the function header.
offenders=""
for T in $embedders; do
if ! grep -qE "func \(t ${T}\) Verify\(\) error \{" tx_verify.go; then
offenders="${offenders}\n${T} (no Verify() method in tx_verify.go — Owner consumed without gate)"
continue
fi
# Extract the bounded body via awk with brace depth tracking.
body=$(awk -v T="${T}" '
BEGIN { in_fn=0; depth=0 }
{
if (in_fn == 0) {
if ($0 ~ ("func \\(t " T "\\) Verify\\(\\) error \\{$")) {
in_fn=1
depth=1
next
}
} else {
for (i=1; i<=length($0); i++) {
c = substr($0,i,1)
if (c == "{") depth++
else if (c == "}") {
depth--
if (depth == 0) { exit }
}
}
print $0
}
}
' tx_verify.go)
if ! echo "$body" | grep -q 'SyntacticVerify'; then
offenders="${offenders}\n${T} (Verify() body does not call SyntacticVerify)"
fi
done
if [ -n "$offenders" ]; then
echo "ERROR: Owner-bearing tx type(s) missing SyntacticVerify call."
echo "Every tx type T with an Owner accessor MUST call"
echo " stubFromTuple(...).SyntacticVerify() OR"
echo " OwnerView(...).SyntacticVerify()"
echo "inside its per-tx Verify() body."
echo ""
echo "Skipping the gate makes a threshold=0 wire-encoded Owner a"
echo "silent authorization bypass (R4V7)."
echo ""
echo -e "Offenders:${offenders}"
exit 1
fi
echo "Audit clean: all Owner-bearing tx types call SyntacticVerify()"
+5 -4
View File
@@ -31,8 +31,6 @@ tmp/
*.pb*
db*
*cpu[0-9]*
*mem[0-9]*
*lock[0-9]*
@@ -85,11 +83,14 @@ QWEN.md
genesis/.!*
genesis-gen
lux
luxd
/lux
/luxd
evm-plugin-*
LLM.md
QWEN.md
.AGENTS.md
GEMINI.md
# Built dev-tool binaries
/cmd/gen_zoo_addr/gen_zoo_addr
+18
View File
@@ -5,6 +5,24 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [1.28.0]
### Added
- Multi-version P-Chain block + tx codec. v1.23.x ("Apricot/Banff") wire layout is now registered as `CodecVersionV0` on the platformvm tx and block `codec.Manager`s; the current canonical layout is `CodecVersionV1`. Bytes carry their wire version in the standard 2-byte codec prefix and `txs.Parse` / `block.Parse` dispatch by it.
- Byte-preserving tx Initialization: `tx.InitializeFromBytes(c, version, signedBytes)` and `tx.InitializeFromBytesAtVersion(c, version)` bind a tx to its original `signedBytes` without re-marshalling. `TxID = hash(signedBytes)` is therefore stable across the v0->v1 migration — mainnet and testnet chain commitments hash back to byte-identical inputs.
- `vms/platformvm/block/v0/` subpackage holding the pure-data v0 block kinds (`ApricotProposalBlock`, `BanffProposalBlock`, ... — 9 types, slots 0-4 + 29-32). The package is a one-way decoder only; the `liftedV0Block` adapter in the parent package translates each v0 block kind into the corresponding canonical v1 `Visitor` arm without ever re-marshalling.
- Cross-version tx + block tests: `TestCodecVersionV0V1Coexist`, `TestParseDispatchesByVersion`, `TestTxIDStabilityRoundTrip`, `TestCrossVersionRefuses`, `TestParseV0ApricotProposalBlock`, `TestParseV0BanffStandardBlock`, `TestParseV1RoundTrip`, `TestVersionPrefixDispatch`.
### Changed
- `tx.Initialize(c)` is retained for the fresh-build path only (wallet, builder). The from-DB / from-wire paths in `genesis/genesis.go` and `block/{standard,proposal}_block.go` now go through `InitializeFromBytesAtVersion` against the codec version the surrounding container was decoded under.
- `genesis.Parse` is wire-version-aware: pre-codec-v1 P-Chain genesis blobs on mainnet / testnet decode at `CodecVersionV0`; new blobs are written at `CodecVersionV1`.
- The L1-tx slot map advances by one to accommodate `CreateSovereignL1Tx` at slot 36: `RegisterL1ValidatorTx`=37, `SetL1ValidatorWeightTx`=38, `IncreaseL1ValidatorBalanceTx`=39, `DisableL1ValidatorTx`=40 (was 36-39). Both pre-rip mainnet/testnet bytes (no slot conflict; L1 txs did not exist) and current code paths line up with the new slot map.
- Test fixtures in `vms/platformvm/txs/fee/calculator_test.go` and the serialization tests under `vms/platformvm/txs/*_test.go` are regenerated to use the v1 wire prefix (`0x0001`) and the post-`CreateSovereignL1Tx` slot map.
### Migration notes
- Mainnet + testnet P-Chain DBs do NOT need to be rebuilt: pre-codec-v1 blocks continue to decode via the v0 path with their original `BlockID = hash(v0 bytes)` preserved. Newly accepted blocks are written at v1.
- Devnet, which was bootstrapped post-rip at wire-version 0 but with the post-rip slot map, must be rebuilt before rolling to `v1.28.0`: its existing blobs would now decode against the v0 slot map (the pre-rip layout) and produce wrong types. A fresh bootstrap at `v1.28.0` writes v1 bytes from height 0 and is internally consistent thereafter.
## [1.13.5-alpha] - 2025-01-23
### Added
+79 -60
View File
@@ -44,10 +44,24 @@ ENV GOPROXY=https://proxy.golang.org,direct
ENV GONOPROXY=github.com/luxfi/*
ENV GOFLAGS="-mod=mod"
# Copy and download lux dependencies using go mod
# Copy and download lux dependencies using go mod.
# Some luxfi/* modules (e.g. corona) are private and require a token to
# resolve via go mod. The token is injected as a BuildKit secret from the
# CI workflow; locally, set DOCKER_BUILDKIT=1 and pass
# `--secret id=ghtok,src=$HOME/.gh-token`. If the secret is absent the
# build still attempts the download (works when all deps are public).
COPY go.mod .
COPY go.sum .
RUN go mod download
# Configure global git insteadOf so EVERY subsequent step (go mod download
# now, the build step's implicit fetch later) can reach private luxfi/*
# modules. The token is written into /etc/gitconfig (root-readable in the
# image), so explicit cleanup is unnecessary on this throwaway builder
# stage — only the compiled binary is COPYed into the runtime image.
RUN --mount=type=secret,id=ghtok,required=false \
if [ -s /run/secrets/ghtok ]; then \
git config --global url."https://x-access-token:$(cat /run/secrets/ghtok)@github.com/".insteadOf "https://github.com/"; \
fi && \
go mod download
# Copy the code into the container
COPY . .
@@ -58,6 +72,14 @@ RUN [ -d ./build ] && rm -rf ./build/* || true
ARG TARGETPLATFORM
ARG BUILDPLATFORM
# Per SCALE_STANDARD.md §2 (https://github.com/hanzoai/hips/blob/main/docs/SCALE_STANDARD.md)
# — every Go production Dockerfile that emits JSON to a client builds
# with GOEXPERIMENT=jsonv2. Verified -12% time / -23% allocs on the
# edge POST roundtrip vs encoding/json v1. Applies to luxd + every
# in-stage VM plugin build below.
ARG GO_EXPERIMENT=jsonv2
ENV GOEXPERIMENT=${GO_EXPERIMENT}
# Configure a cross-compiler if the target platform differs from the build platform.
#
# build_env.sh is used to capture the environmental changes required by the build step since RUN
@@ -82,17 +104,17 @@ RUN ARCH=$(echo ${TARGETPLATFORM} | cut -d / -f2) && \
ldconfig 2>/dev/null || true
# Fetch pre-built luxcpp/cevm libs (libevm, libevm-gpu, libluxgpu,
# libcevm_precompiles + go_bridge.h). When LUX_CGO=1 these libraries are
# libcevm_precompiles + go_bridge.h). When CGO_ENABLED=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
# those tarballs exist, builds with CGO_ENABLED=1 will fail at this step and
# operators must build with CGO_ENABLED=0 (pure-Go fallback).
ARG CGO_ENABLED=1
ARG CEVM_VERSION=v0.19.0
RUN if [ "${LUX_CGO}" = "1" ]; then \
RUN if [ "${CGO_ENABLED}" = "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" \
@@ -101,24 +123,37 @@ RUN if [ "${LUX_CGO}" = "1" ]; then \
rm /tmp/cevm.tar.gz && \
ldconfig 2>/dev/null || true ; \
else \
echo "LUX_CGO=0: skipping luxcpp/cevm fetch (pure-Go fallback build)" ; \
echo "CGO_ENABLED=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.
# Build node. CGO_ENABLED=1 (default) links luxcpp/cevm for parallel + GPU EVM.
# Set CGO_ENABLED=0 for portable pure-Go builds without the native libs.
ARG RACE_FLAG=""
ARG BUILD_SCRIPT=build.sh
ARG LUXD_COMMIT=""
ENV CGO_ENABLED=${LUX_CGO}
ENV CGO_ENABLED=${CGO_ENABLED}
RUN . ./build_env.sh && \
echo "{CC=$CC, TARGETPLATFORM=$TARGETPLATFORM, BUILDPLATFORM=$BUILDPLATFORM, LUX_CGO=${LUX_CGO}}" && \
echo "{CC=$CC, TARGETPLATFORM=$TARGETPLATFORM, BUILDPLATFORM=$BUILDPLATFORM, CGO_ENABLED=${CGO_ENABLED}}" && \
export GOARCH=$(echo ${TARGETPLATFORM} | cut -d / -f2) && \
export LUXD_COMMIT="${LUXD_COMMIT}" && \
GOFLAGS="-mod=mod" ./scripts/${BUILD_SCRIPT} ${RACE_FLAG}
# ============= EVM Plugin Stage ================
# Build EVM plugin from source (includes custom precompile registry)
ARG EVM_VERSION=v0.8.40
# Build EVM plugin from source (includes custom precompile registry).
# EVM_VERSION must pin a luxfi/evm release whose go.mod points at a
# luxfi/node version that has the runtime.EngineAddressKey rename
# (LUX_VM_RUNTIME_ENGINE_ADDR → VM_RUNTIME_ENGINE_ADDR landed in
# 4ae211d46d on 2026-05-15). v0.18.14 pins node v1.27.6 which is
# post-rename. Older evm tags (e.g. v0.8.40 → node v1.23.4) ship a
# plugin that os.Getenv()'s the old key, mismatching the host that
# sets the new key, and C-chain never bootstraps.
#
# v0.19.0 (Quasar Edition): EtnaTimestamp Go field + json tag renamed
# to QuasarTimestamp/quasarTimestamp. Strict upgradeBytes decode via
# json.NewDecoder(...).DisallowUnknownFields() — stale etnaTimestamp
# in any deployed upgrade.json now fails parse loudly at boot rather
# than silently disabling the fork.
ARG EVM_VERSION=v0.19.0
ARG EVM_VM_ID=mgj786NP7uDwBCcq6YwThhaN8FLyybkCa4zBWTQbNgmK6k9A6
RUN --mount=type=cache,target=/root/.cache/go-build \
mkdir -p /luxd/build/plugins && \
@@ -153,55 +188,39 @@ RUN --mount=type=cache,target=/root/.cache/go-build \
# Each VM is an independent Go module under /tmp/chains/<vm>/.
# Build each plugin binary and place it at /luxd/build/plugins/<cb58-vm-id>.
#
# NB(2026-05-19): luxfi/chains main has unresolved sibling go.mod replace
# directives (luxfi/{evm,precompile,threshold} => ../*) that break in any
# isolated build context. Each chain plugin is therefore built best-effort;
# production deployments pull plugins from S3 (`pluginSource.bucket`) at
# runtime per LuxNetwork CR, so an embedded plugin miss is non-fatal.
RUN --mount=type=cache,target=/root/.cache/go-build \
. /build/build_env.sh && \
export GOARCH=$(echo ${TARGETPLATFORM} | cut -d / -f2) && \
set -e && \
cd /tmp/chains/aivm && \
CGO_ENABLED=0 GOFLAGS=-mod=mod go build -ldflags="-s -w" \
-o /luxd/build/plugins/juFxSrbCM4wszxddKepj1GWwmrn9YgN1g4n3VUWPpRo9JjERA \
./cmd/plugin && \
cd /tmp/chains/bridgevm && \
CGO_ENABLED=0 GOFLAGS=-mod=mod go build -ldflags="-s -w" \
-o /luxd/build/plugins/kMhHABHM8j4bH94MCc4rsTNdo5E9En37MMyiujk4WdNxgXFsY \
./cmd/plugin && \
cd /tmp/chains/dexvm && \
CGO_ENABLED=0 GOFLAGS=-mod=mod go build -ldflags="-s -w" \
-o /luxd/build/plugins/mDVT5EWMumBp3LCqvKwuyZQeY1VXr1jvjGNAt8nL4UFiXvqXr \
./cmd/plugin && \
cd /tmp/chains/graphvm && \
CGO_ENABLED=0 GOFLAGS=-mod=mod go build -ldflags="-s -w" \
-o /luxd/build/plugins/nZQm4Dmg1rjX18rb8maL9gamYyXPf1xCvF7ymWzxp6a1nSQTt \
./cmd/plugin && \
cd /tmp/chains/identityvm && \
CGO_ENABLED=0 GOFLAGS=-mod=mod go build -ldflags="-s -w" \
-o /luxd/build/plugins/oR6tnZHezwogyf9fRnomNXC9ojwCEBAU6jdUzpgy2PB1tD7fM \
./cmd/plugin && \
cd /tmp/chains/keyvm && \
CGO_ENABLED=0 GOFLAGS=-mod=mod go build -ldflags="-s -w" \
-o /luxd/build/plugins/pJJCSV7hHYVY6TUZwR8qUPAfuhX8JLb2C1AzNSezrYNbgau8M \
./cmd/plugin && \
cd /tmp/chains/oraclevm && \
CGO_ENABLED=0 GOFLAGS=-mod=mod go build -ldflags="-s -w" \
-o /luxd/build/plugins/r5m1ujrmXxVcQetG3CQfuDLHp2RHKh6vCDaFgBRQfUcTZh7eS \
./cmd/plugin && \
cd /tmp/chains/quantumvm && \
CGO_ENABLED=0 GOFLAGS=-mod=mod go build -ldflags="-s -w" \
-o /luxd/build/plugins/ry9Sg8rZdT26iEKvJDmC2wkESs4SDKgZEhk5BgLSwg1EpcNug \
./cmd/plugin && \
cd /tmp/chains/relayvm && \
CGO_ENABLED=0 GOFLAGS=-mod=mod go build -ldflags="-s -w" \
-o /luxd/build/plugins/sP6dLqrrBR9w3soP18fbJ3YzZecZdD7DDdfH2cFhhLq7Hy9bz \
./cmd/plugin && \
cd /tmp/chains/thresholdvm && \
CGO_ENABLED=0 GOFLAGS=-mod=mod go build -ldflags="-s -w" \
-o /luxd/build/plugins/tGVBwRxpmD2aFdg3iYjgRvrCe8Jcmq9UNKxyHMus2NZ8WcD8t \
./cmd/plugin && \
cd /tmp/chains/zkvm && \
CGO_ENABLED=0 GOFLAGS=-mod=mod go build -ldflags="-s -w" \
-o /luxd/build/plugins/vv3qPfyTVXZ5ArRZA9Jh4hbYDTBe43f7sgQg4CHfNg1rnnvX9 \
./cmd/plugin && \
chmod +x /luxd/build/plugins/* && \
mkdir -p /luxd/build/plugins && \
( cd /tmp/chains/aivm && CGO_ENABLED=0 GOFLAGS=-mod=mod go build -ldflags="-s -w" \
-o /luxd/build/plugins/juFxSrbCM4wszxddKepj1GWwmrn9YgN1g4n3VUWPpRo9JjERA ./cmd/plugin ) || echo "WARN: aivm plugin build skipped" ; \
( cd /tmp/chains/bridgevm && CGO_ENABLED=0 GOFLAGS=-mod=mod go build -ldflags="-s -w" \
-o /luxd/build/plugins/kMhHABHM8j4bH94MCc4rsTNdo5E9En37MMyiujk4WdNxgXFsY ./cmd/plugin ) || echo "WARN: bridgevm plugin build skipped" ; \
( cd /tmp/chains/dexvm && CGO_ENABLED=0 GOFLAGS=-mod=mod go build -ldflags="-s -w" \
-o /luxd/build/plugins/mDVT5EWMumBp3LCqvKwuyZQeY1VXr1jvjGNAt8nL4UFiXvqXr ./cmd/plugin ) || echo "WARN: dexvm plugin build skipped" ; \
( cd /tmp/chains/graphvm && CGO_ENABLED=0 GOFLAGS=-mod=mod go build -ldflags="-s -w" \
-o /luxd/build/plugins/nZQm4Dmg1rjX18rb8maL9gamYyXPf1xCvF7ymWzxp6a1nSQTt ./cmd/plugin ) || echo "WARN: graphvm plugin build skipped" ; \
( cd /tmp/chains/identityvm && CGO_ENABLED=0 GOFLAGS=-mod=mod go build -ldflags="-s -w" \
-o /luxd/build/plugins/oR6tnZHezwogyf9fRnomNXC9ojwCEBAU6jdUzpgy2PB1tD7fM ./cmd/plugin ) || echo "WARN: identityvm plugin build skipped" ; \
( cd /tmp/chains/keyvm && CGO_ENABLED=0 GOFLAGS=-mod=mod go build -ldflags="-s -w" \
-o /luxd/build/plugins/pJJCSV7hHYVY6TUZwR8qUPAfuhX8JLb2C1AzNSezrYNbgau8M ./cmd/plugin ) || echo "WARN: keyvm plugin build skipped" ; \
( cd /tmp/chains/oraclevm && CGO_ENABLED=0 GOFLAGS=-mod=mod go build -ldflags="-s -w" \
-o /luxd/build/plugins/r5m1ujrmXxVcQetG3CQfuDLHp2RHKh6vCDaFgBRQfUcTZh7eS ./cmd/plugin ) || echo "WARN: oraclevm plugin build skipped" ; \
( cd /tmp/chains/quantumvm && CGO_ENABLED=0 GOFLAGS=-mod=mod go build -ldflags="-s -w" \
-o /luxd/build/plugins/ry9Sg8rZdT26iEKvJDmC2wkESs4SDKgZEhk5BgLSwg1EpcNug ./cmd/plugin ) || echo "WARN: quantumvm plugin build skipped" ; \
( cd /tmp/chains/relayvm && CGO_ENABLED=0 GOFLAGS=-mod=mod go build -ldflags="-s -w" \
-o /luxd/build/plugins/sP6dLqrrBR9w3soP18fbJ3YzZecZdD7DDdfH2cFhhLq7Hy9bz ./cmd/plugin ) || echo "WARN: relayvm plugin build skipped" ; \
( cd /tmp/chains/thresholdvm && CGO_ENABLED=0 GOFLAGS=-mod=mod go build -ldflags="-s -w" \
-o /luxd/build/plugins/tGVBwRxpmD2aFdg3iYjgRvrCe8Jcmq9UNKxyHMus2NZ8WcD8t ./cmd/plugin ) || echo "WARN: thresholdvm plugin build skipped" ; \
( cd /tmp/chains/zkvm && CGO_ENABLED=0 GOFLAGS=-mod=mod go build -ldflags="-s -w" \
-o /luxd/build/plugins/vv3qPfyTVXZ5ArRZA9Jh4hbYDTBe43f7sgQg4CHfNg1rnnvX9 ./cmd/plugin ) || echo "WARN: zkvm plugin build skipped" ; \
( chmod +x /luxd/build/plugins/* 2>/dev/null || true ) && \
rm -rf /tmp/chains
# lpm (Lux Plugin Manager) -- optional, skip if build fails
+1 -1
View File
@@ -204,7 +204,7 @@ Wallet, CLI, EVM, DeFi, threshold cryptography, and the first key management sys
| `lux/threshold` | 2021-02-16 | Threshold ECDSA (tECDSA) library |
| `lux/erc20-go` | 2021-05-21 | ERC-20 Go bindings |
| `lux/netrunner` | 2021-10-22 | Network testing framework (2,384 commits) |
| `lux/evm` | 2021-12-15 | Subnet EVM (1,632 commits) |
| `lux/evm` | 2021-12-15 | App chain EVM (1,632 commits) |
| `lux/devops` / `lux/lux-ops` | 2022-01-28 | Infrastructure automation |
| `lux/ledger` | 2022-03-14 | Ledger hardware wallet integration |
| `lux/lpm` | 2022-03-28 | Lux Plugin Manager |
+12
View File
@@ -0,0 +1,12 @@
# Licensing
This repository is licensed under the **BSD 3-Clause License** (see
[LICENSE](LICENSE)). It belongs to the **public** tier of the Lux
three-tier IP strategy: anyone may use, fork, or redistribute it,
including for commercial purposes, subject to the BSD-3 terms.
For the canonical Lux IP and licensing strategy, see:
<https://github.com/luxfi/.github/blob/main/profile/README.md>
For commercial inquiries that go beyond BSD-3 (e.g. private moat
acceleration kernels), contact `licensing@lux.network`.
+174 -15
View File
@@ -8,10 +8,133 @@ Lux blockchain node implementation - a high-performance, multi-chain blockchain
**Key Context:**
- Original Lux Network node — NOT a fork
- Latest Tag: v1.26.31
- Network ID: 96369 (Lux Mainnet), 96368 (Testnet), 96370 (Devnet)
- Go Version: 1.26.1+
- Database: ZapDB (primary, default)
## Post-E2E-PQ State (current)
Node now consumes the locked `ChainSecurityProfile` end-to-end and enforces
strict-PQ at four boundaries: peer handshake, mempool, validator scheme
selection, and EVM contract auth.
- `node/node.go:initSecurityProfile` (F102 closure) loads the chain-wide
profile from genesis at boot, hashes it, and pins it into every chain's
bootstrap. Resolved profile is what every downstream verifier consults.
- `network/peer/scheme_gate.go``SchemeGate.Classify(presented, site)`
funnels every inbound NodeID through the profile's
`AcceptsValidatorScheme`. Wire-typed NodeID (`luxfi/ids` TypedNodeID +
scheme byte) is the canonical handshake form.
- `vms/txs/auth/policy.go``ClassicalCompatRegistry` + strict-PQ
mempool gate. Both `platformvm` (P-Chain) and `avm` (X-Chain) mempools
refuse classical credentials when the resolved profile has
`ForbidECDSAContractAuth=true`.
- `vms/mldsafx/` — re-exports the consensus `mldsafx` UTXO feature
extension as the node-owned UTXO surface (ML-DSA-65 verify).
- `network/peer` PQ handshake — ML-KEM-768 / ML-KEM-1024 KEM +
ML-DSA-65 identity (`dc906d281b`).
### Recent significant commits
| SHA | Tag | Impact |
|-----|-----|--------|
| (pending) | next | LP-023 Phase 1 batch 2: 5 more native-ZAP tx types — BaseTx v1, RegisterL1ValidatorTx v1, SlashValidatorTx v1, TransferChainOwnershipTx v1, RemoveChainValidatorTx. Cross-type Parse mean speedup 8.5× over linearcodec. Variable-length nested-object schemas (Outs/Ins/full OutputOwners/Warp Message/Evidence) deferred to batch 3. |
| `e77a7ef78e` | (pre) | LP-023 Phase 1 batch 1: 4 simple tx types + bench harness. 37× Parse, 5.6× cross-type mean. |
| `9df72a6f55` | v1.26.10 | Wire ChainSecurityProfile into bootstrap (closes F102) |
| `c4af52411e` | v1.26.10 | X-Chain (avm) mempool refuses classical creds under strict-PQ |
| `a14a1601f4` | v1.26.10 | P-Chain (platformvm) mempool refuses classical creds under strict-PQ |
| `1cf0aa80ca` | v1.26.10 | ClassicalCompatRegistry + strict-PQ mempool gate |
| `a0f4f4b21c` | v1.26.10 | vms/mldsafx: re-export ML-DSA feature extension |
| `448fdeb7a1` | v1.26.10 | ML-DSA-65 promoted to canonical NodeID under strict-PQ |
| `dc906d281b` | v1.26.10 | PQ peer handshake — ML-KEM-768/1024 + ML-DSA-65 identity |
### Active versions
- Repo: `v1.26.12` (next bump: `v1.26.13`).
- Pinned: `consensus v1.23.4+` (needed `ValidatorSchemeID`),
`crypto v1.18.5`, `ids v1.2.9` (will move to v1.2.10 in next bump for
`TypedNodeID`), `genesis v1.9.6`.
### Cross-repo dependencies
- `luxfi/consensus` → profile + auth + zchain types
- `luxfi/crypto` → ML-DSA / ML-KEM / SLH-DSA primitives
- `luxfi/genesis` → genesis-pinned profile (`Resolve` at load)
- `luxfi/ids``TypedNodeID` wire form (consumed at handshake)
- `luxfi/geth` → EVM (for `vm.SetActiveSecurityProfile` install point)
### Where to look for X
- Profile resolve at boot: `node/node.go:initSecurityProfile`
- Profile RPC + REST + metrics: `service/security/`
- JSON-RPC namespace: `security` at `POST /ext/security`
(methods `securityProfile`, `blockSecurity`)
- REST sidecars: `GET /ext/security/profile`, `GET /ext/security/block/{n}`
- Prometheus gauges: `/ext/metrics` under the `security_*` family
- Peer scheme gate: `network/peer/scheme_gate.go`
- Classical-compat registry: `vms/txs/auth/policy.go`
- Mempool gate (P-Chain): `vms/platformvm/mempool/*.go`
- Mempool gate (X-Chain): `vms/avm/mempool/*.go`
- ML-DSA feature extension: `vms/mldsafx/`
### Open follow-ups
- `vms/zkvm/accel/` still soft-falls-back when CGO is disabled; Z-Chain
proof verification path needs CGO-required mode for production strict-PQ.
- `vm.SetActiveSecurityProfile` install point exists in `luxfi/geth/core/vm`
but EVM-side contract-auth refusal still needs a chain-bootstrap call
(F102 wiring closes the consensus side; geth-side hookup is the
remaining tail).
## FeePolicy — canonical user-tx fee gate
Every Lux VM that accepts user-submitted txs declares a `fee.Policy`
(package `vms/types/fee`). There is one interface and one validator —
no per-VM bespoke fee structs.
### Policy choice per VM
| VM | Chain | Posture | Policy |
|----|-------|---------|--------|
| dexvm | D-Chain | user-tx | `FlatPolicy{Fee: MinTxFeeFloor, AssetID: UTXOAssetIDFor(networkID)}` |
| zkvm | Z-Chain | user-tx | `FlatPolicy{Fee: MinTxFeeFloor, ...}` |
| aivm | A-Chain | user-tx | `FlatPolicy{Fee: MinTxFeeFloor, ...}` |
| keyvm | K-Chain | user-tx | `FlatPolicy{Fee: MinTxFeeFloor, ...}` |
| bridgevm | B-Chain | user-tx | `FlatPolicy{Fee: MinTxFeeFloor, ...}` |
| quantumvm | Q-Chain | user-tx | `FlatPolicy{Fee: MinTxFeeFloor, ...}` |
| identityvm | I-Chain | user-tx | `FlatPolicy{Fee: MinTxFeeFloor, ...}` |
| thresholdvm | M-Chain | service-only | `NoUserTxPolicy{}` |
| oraclevm | O-Chain | service-only | `NoUserTxPolicy{}` |
| relayvm | R-Chain | service-only | `NoUserTxPolicy{}` |
| graphvm | G-Chain | read-only | `NoUserTxPolicy{}` (GraphQL refuses `mutation`) |
| evm | C-Chain | user-tx | native EVM gas (gas * gasPrice >= 0 enforced upstream) |
| platformvm | P-Chain | user-tx | native `TxFee` field on Config |
| avm | X-Chain | user-tx | native `TxFee` field on Config |
`MinTxFeeFloor = 1 mLUX = 1_000_000 nLUX` (the same minimum the P-Chain
base fee enforces). User-facing chains MAY charge more; they MUST NOT
charge less.
### Wiring contract
1. VM struct holds `feePolicy fee.Policy` (and `networkID uint32`).
2. `Initialize` sets `feePolicy = fee.FlatPolicy{...}` (or
`fee.NoUserTxPolicy{}` for service-only) from `init.Runtime.NetworkID`
and calls `fee.Validate(vm.feePolicy)` — refuses zero-fee user-facing
chains at boot, before any block is accepted.
3. The canonical user-tx admission entry (e.g. `SubmitTx`, `IssueTx`,
`InitiateBridgeTransfer`, mutating service RPCs) calls
`policy.ValidateFee(paid, asset)` BEFORE mempool insert.
4. Consensus-internal paths (engine→VM block delivery, replay, internal
tx emission) bypass the fee gate — the policy gates only the
*user-submitted* entrypoint.
### Where the gates live
- `vms/types/fee/policy.go` — interface + FlatPolicy + NoUserTxPolicy + Validate
- `~/work/lux/chains/<vm>/feegate.go` — per-VM helper + gate method
- `~/work/lux/chains/<vm>/feegate_test.go` — RejectsZeroFee + AcceptsMinFee
- Oracle (O-Chain): `~/work/lux/oracle/vm/feegate.go` (re-exported by `~/work/lux/chains/oraclevm/`)
- Relay (R-Chain): `~/work/lux/relay/vm/feegate.go` (re-exported by `~/work/lux/chains/relayvm/`)
- Graph (G-Chain): `~/work/lux/chains/graphvm/feegate.go` (read-only; NoUserTxPolicy)
## Essential Commands
### Building
@@ -205,20 +328,33 @@ Located in `vms/thresholdvm/fhe/`:
| Gateway | `0x0200000000000000000000000000000000000083` |
### ZAP Transport (Zero-Copy App Proto)
ZAP is the default high-performance binary wire protocol for VM<->Node communication.
gRPC support is available via build tag for testing/compatibility.
ZAP is the only wire protocol for VM<->Node communication. The gRPC
fallback (and its `-tags=grpc` opt-in) was retired in v1.26.31 along
with every `//go:build grpc` file under `node/`. There is one and only
one way to talk to a Chain VM: ZAP.
**Build Tags:**
**Build:**
```bash
go build # ZAP only (default, production)
go build -tags=grpc # gRPC support (for testing/compatibility)
go build # ZAP only — there are no build tags
```
**Key Packages:**
- `github.com/luxfi/api/zap` - Core wire protocol and message types
- `github.com/luxfi/vm/rpc/sender` - p2p.Sender over ZAP/gRPC
- `vms/rpcchainvm/sender/` - Node-side sender implementation
- `vms/platformvm/warp/zwarp/` - ZAP-based warp signing client/server
- `github.com/luxfi/api/zap` Core wire protocol and message types (Layer A)
- `github.com/luxfi/protocol/rpcdb` — rpcdb service spec / data carriers (Layer B)
- `github.com/luxfi/node/db/rpcdb` — rpcdb Service + ZAP transport adapter (Layer C)
- `vms/rpcchainvm/sender/` — Node-side `p2p.Sender` over ZAP
- `vms/rpcchainvm/zap/` — ChainVM client/server over ZAP
- `vms/platformvm/warp/zwarp/` — Warp signing over ZAP
**rpcdb Layered Topology:**
- Layer A — wire framing: `github.com/luxfi/api/zap`
- Layer B — rpcdb service spec: `github.com/luxfi/protocol/rpcdb`
- Layer C — rpcdb impl: `node/db/rpcdb/{service.go, zap_server.go}`
- `service.go` — transport-neutral `Service` wrapping `database.Database`
- `zap_server.go` — ZAP transport adapter (only adapter)
- One Service, one transport. The dual-adapter pattern stays available
for future transports (each is a new file wrapping `*Service`), but
ZAP is the only one shipping.
**Wire Protocol Format:**
```
@@ -233,11 +369,8 @@ go build -tags=grpc # gRPC support (for testing/compatibility)
**Sender Usage:**
```go
// ZAP transport (default)
// ZAP transport — the only transport
s := sender.ZAP(zapConn)
// gRPC transport (requires -tags=grpc build)
s := sender.GRPC(senderpb.NewSenderClient(grpcConn))
```
**Warp over ZAP:**
@@ -335,6 +468,32 @@ RNS transport supports hybrid post-quantum cryptography combining classical algo
- **Mixed Networks**: PQ and classical validators coexist
- **Policy Enforcement**: `requirePostQuantum: true` rejects classical peers
### SchemeGate — cross-axis NodeIDScheme enforcement
`network/peer/scheme_gate.go` (v1.26.10) is the single primitive that
turns a wire NodeID into a `(scheme, NodeID)` pair and runs the
cross-axis check against the chain's `ChainSecurityProfile`.
- `SchemeGate{Profile, ClassicalCompatUnsafe, ActivationHeight}` is the
chain-scoped policy object. One gate per chain, pinned at bootstrap.
- `Classify(nodeID, scheme, height, site) (TypedNodeID, error)` is the
single entry point. Callers pass a site tag (`"handshake"`,
`"proposer"`, `"validator"`, `"mempool-sender"`) that appears in the
refused-by error.
- Migration path: `ActivationHeight` is the block at which a strict-PQ
chain refuses any non-PQ `NodeIDScheme` byte at every height under
the forward-only PQ policy. The classical `secp256k1` (0x90) scheme is
refused at the gate; there is no transition window and no operator
classical-compat escape hatch (strict-PQ chains refuse classical at
every boundary, period).
- Typed errors: `ErrSchemeGateConfig`, `ErrSchemeGateMismatch`,
`ErrSchemeGateUnknownScheme`.
Wire form: `TypedNodeID = (NodeIDScheme byte, 20-byte NodeID)`. The
20-byte storage/map-key form stays byte-identical; the scheme byte
travels on the wire so a receiver knows which verifier to dispatch
without trusting the chain profile alone.
### Testing PQ Forward Secrecy
```bash
@@ -353,7 +512,7 @@ go test -v -run "TestHybrid" ./node/network/dialer/... -count=1
### 1. P2P Sender Interface
Node's rpcchainvm implements `p2p.Sender` (from `github.com/luxfi/p2p`) for cross-chain messaging.
The `sender` package is a gRPC implementation of `p2p.Sender`.
The `sender` package is the ZAP-native implementation of `p2p.Sender`.
### 2. Chain Tracking
Nodes don't automatically track chains. Use:
@@ -600,7 +759,7 @@ Testing conducted on a single Lux validator node (testnet mode, macOS):
**Benchmark Command:**
```bash
cd ~/work/lux/benchmarks
LUX_ENDPOINT="http://localhost:9640/ext/bc/C/rpc" \
NODE_ENDPOINT="http://localhost:9640/ext/bc/C/rpc" \
PRIVATE_KEY="<funded_key>" \
./bin/bench tps --chains=lux --duration=60s --concurrency=5
```
+10 -10
View File
@@ -2519,7 +2519,7 @@ The plugin version is unchanged at `27` and compatible with versions `v1.10.5 -
### Configs
- Changed the default value of `--network-allow-private-ips` to `false` when the `--network-id` is either `fuji` or `mainnet`
- Changed the default value of `--network-allow-private-ips` to `false` when the `--network-id` is either `testnet` or `mainnet`
- Added P-chain cache size configurations
- `block-cache-size`
- `tx-cache-size`
@@ -2564,7 +2564,7 @@ The plugin version is unchanged at `27` and compatible with versions `v1.10.5 -
- [x/sync] Update target locking by @patrick-ogrady in https://github.com/luxfi/node/pull/1763
- Export warp errors for external use by @aaronbuchwald in https://github.com/luxfi/node/pull/1771
- Remove unused networking constant by @StephenButtolph in https://github.com/luxfi/node/pull/1774
- Change the default value of `--network-allow-private-ips` to `false` for `mainnet` and `fuji` by @StephenButtolph in https://github.com/luxfi/node/pull/1773
- Change the default value of `--network-allow-private-ips` to `false` for `mainnet` and `testnet` by @StephenButtolph in https://github.com/luxfi/node/pull/1773
- Remove context.TODO from tests by @StephenButtolph in https://github.com/luxfi/node/pull/1778
- Replace linkeddb iterator with native DB range queries by @StephenButtolph in https://github.com/luxfi/node/pull/1752
- Add support for measuring key size in caches by @StephenButtolph in https://github.com/luxfi/node/pull/1781
@@ -2934,7 +2934,7 @@ This version is backwards compatible to [v1.10.0](https://github.com/luxfi/node/
- Remove no-op changes from history results in https://github.com/luxfi/node/pull/1335
- Cleanup type assertions in the linkedHashmap by @StephenButtolph in https://github.com/luxfi/node/pull/1341
- Fix racy xvm tx access by @StephenButtolph in https://github.com/luxfi/node/pull/1349
- Update Fuji beacon ips by @StephenButtolph in https://github.com/luxfi/node/pull/1354
- Update Testnet beacon ips by @StephenButtolph in https://github.com/luxfi/node/pull/1354
- Remove duplicate TLS verification by @StephenButtolph in https://github.com/luxfi/node/pull/1364
- Adjust Merkledb Trie invalidation locking in https://github.com/luxfi/node/pull/1355
- Use require in Lux bootstrapping tests by @StephenButtolph in https://github.com/luxfi/node/pull/1344
@@ -2949,7 +2949,7 @@ This version is backwards compatible to [v1.10.0](https://github.com/luxfi/node/
- [Issue-1368]: Panic in serializedPath.HasPrefix in https://github.com/luxfi/node/pull/1371
- Add ValidatorsOnly flag to GetStake by @StephenButtolph in https://github.com/luxfi/node/pull/1377
- Use proto in `x/sync` by @danlaine in https://github.com/luxfi/node/pull/1336
- Update incorrect fuji beacon IPs by @StephenButtolph in https://github.com/luxfi/node/pull/1392
- Update incorrect testnet beacon IPs by @StephenButtolph in https://github.com/luxfi/node/pull/1392
- Update `api/` error handling by @StephenButtolph in https://github.com/luxfi/node/pull/1393
- refactor concurrent work limiting in sync in `x/sync` by @danlaine in https://github.com/luxfi/node/pull/1347
- Remove check for impossible condition in `x/sync` by @danlaine in https://github.com/luxfi/node/pull/1348
@@ -3017,7 +3017,7 @@ The supported plugin version is `25`.
- defer delegatee rewards until end of validator staking period by @dhrubabasu in https://github.com/luxfi/node/pull/1262
- Initialize UptimeCalculator in TestPeer by @joshua-kim in https://github.com/luxfi/node/pull/1283
- Add Lux liveness health checks by @StephenButtolph in https://github.com/luxfi/node/pull/1287
- Skip AMI generation with Fuji tags by @StephenButtolph in https://github.com/luxfi/node/pull/1288
- Skip AMI generation with Testnet tags by @StephenButtolph in https://github.com/luxfi/node/pull/1288
- Use `maps.Equal` in `set.Equals` by @danlaine in https://github.com/luxfi/node/pull/1290
- return accrued delegator rewards in `GetCurrentValidators` by @dhrubabasu in https://github.com/luxfi/node/pull/1291
- Add zstd compression by @danlaine in https://github.com/luxfi/node/pull/1278
@@ -3819,7 +3819,7 @@ The supported plugin version is `16`.
Please upgrade your node as soon as possible.
The changes in `v1.8.x` go into effect at 4 PM EDT on September 6th, 2022 on both Fuji and Mainnet. You should upgrade your node before the changes go into effect, otherwise they may experience loss of uptime.
The changes in `v1.8.x` go into effect at 4 PM EDT on September 6th, 2022 on both Testnet and Mainnet. You should upgrade your node before the changes go into effect, otherwise they may experience loss of uptime.
The supported plugin version is `16`.
@@ -3833,7 +3833,7 @@ The supported plugin version is `16`.
Please upgrade your node as soon as possible.
The changes in `v1.8.x` go into effect at 4 PM EDT on September 6th, 2022 on both Fuji and Mainnet. You should upgrade your node before the changes go into effect, otherwise they may experience loss of uptime.
The changes in `v1.8.x` go into effect at 4 PM EDT on September 6th, 2022 on both Testnet and Mainnet. You should upgrade your node before the changes go into effect, otherwise they may experience loss of uptime.
The supported plugin version is `16`.
@@ -3850,7 +3850,7 @@ The supported plugin version is `16`.
This is a mandatory security upgrade. Please upgrade your node **as soon as possible.**
The changes in the upgrade go into effect at **4 PM EDT on September 6th, 2022** on both Fuji and Mainnet. You should upgrade your node before the changes go into effect, otherwise they may experience loss of uptime.
The changes in the upgrade go into effect at **4 PM EDT on September 6th, 2022** on both Testnet and Mainnet. You should upgrade your node before the changes go into effect, otherwise they may experience loss of uptime.
You may see some extraneous ERROR logs ("BAD BLOCK") on your node after upgrading. These may continue until the Apricot Phase 6 activation (at 4 PM EDT on September 6th).
@@ -4515,7 +4515,7 @@ This version is backwards compatible to [v1.7.0](https://github.com/luxfi/node/r
- Added `--stake-supply-cap` which defaults to `720,000,000,000,000,000` nLUX.
- Renamed `--bootstrap-multiput-max-containers-sent` to `--bootstrap-ancestors-max-containers-sent`.
- Renamed `--bootstrap-multiput-max-containers-received` to `--bootstrap-ancestors-max-containers-received`.
- Enforced that `--staking-enabled=false` can not be specified on public networks (`Fuji` and `Mainnet`).
- Enforced that `--staking-enabled=false` can not be specified on public networks (`Testnet` and `Mainnet`).
### Metrics
@@ -4762,7 +4762,7 @@ This was the version used for the first public Lux Network deployment in Decembe
### Network Support
- **Primary Network**: LUX mainnet and testnet
- **Net Support**: Full L2/chain capabilities
- **Net Support**: Full chain capabilities
- **Cross-Chain**: Warp messaging and atomic swaps
- **Validator Management**: Staking and delegation
+4 -4
View File
@@ -10,10 +10,10 @@ import (
"sync"
"syscall"
"github.com/luxfi/filesystem/perms"
"github.com/luxfi/log"
"github.com/luxfi/node/node"
"github.com/luxfi/node/utils"
"github.com/luxfi/filesystem/perms"
"github.com/luxfi/sys/ulimit"
nodeconfig "github.com/luxfi/node/config/node"
@@ -58,9 +58,9 @@ func New(config nodeconfig.Config) (App, error) {
infoLevel, _ := log.ToLevel("info")
logFactory := log.NewFactoryWithConfig(log.Config{
RotatingWriterConfig: log.RotatingWriterConfig{
MaxSize: 8, // 8MB per log file (reasonable for standard profile)
MaxFiles: 5, // Keep 5 rotated files
MaxAge: 7, // 7 days retention
MaxSize: 8, // 8MB per log file (reasonable for standard profile)
MaxFiles: 5, // Keep 5 rotated files
MaxAge: 7, // 7 days retention
Directory: config.DatabaseConfig.Path,
},
DisplayLevel: infoLevel,
+298
View File
@@ -0,0 +1,298 @@
# RED LP-023 ROUND 6 — Adversarial Review of v3.7 (67cff34428)
Scope: diff 3f8f7e79ec..67cff34428 across `vms/platformvm/txs/zap_native/`,
`vms/platformvm/network/zap_native_admission.go`, `.github/workflows/zap-audit.yml`.
Verdict (round 6 v2, 2026-06-02): **FIX-THEN-SHIP**. V1 retracted on
re-verification. V2 (textual-audit-gate meta-attack), V3 (legacy `*Owner()`
scope leak), V4 (BLS alloc amplification), V5 (no block-level cap) stand.
None block a fix-then-ship — V2 is the priority because it disarms the gate
infrastructure that prevents future regressions.
---
## V1 — RETRACTED — TransferChainOwnershipTx.Verify is correctly gated in v3.7
**Re-verification (round 6 v2, 2026-06-02)**: The original V1 finding was
based on a working-tree probe that mutated `tx_verify.go:330-336` to insert
an `_ = "SyntacticVerify"` no-op probe; the actual `67cff34428` commit
ships the correctly-gated body:
```go
func (t TransferChainOwnershipTx) Verify() error {
o := stubFromTuple(t.OwnerThreshold(), t.OwnerLocktime(), t.OwnerAddress())
if err := o.SyntacticVerify(); err != nil {
return fmt.Errorf("TransferChainOwnershipTx.Owner: %w", err)
}
return nil
}
```
Repro: `git show 67cff34428:vms/platformvm/txs/zap_native/tx_verify.go |
sed -n '330,346p'`. The R6V8 gate Blue closed at 30c9608255 is intact at
v3.7. **V1 is retracted — no regression in the actual commit.**
The misclassification root cause: the prior Red round 6 author had local
uncommitted edits crafting a PoC for V2 (meta-attack on the textual audit
gate). When the audit was written, the PoC was misread as Blue's regression
instead of a Red-injected demonstration.
**V2 below stands** — the textual audit gate is genuinely defeatable by
string literals; the PoC that proved it was real, but it lives in the
adversary's working tree, not the committed v3.7. The attack vector remains:
**a future legitimate edit by Blue** that drops the SyntacticVerify call but
keeps the token in any form (comment / string literal / dead-code branch /
imported constant) will pass CI today.
---
## V2 — CRITICAL — ADMISSION — Audit gate fooled by string-literal token (meta-attack on R4V7 audit)
**Class**: ADMISSION. **Severity**: CRITICAL (proof: V1 above ships and passes).
`audit_test.go:359` and `.github/workflows/zap-audit.yml`
owner-bearing-syntacticverify-gate use `strings.Contains(body, "SyntacticVerify")`
on the brace-bounded Verify body. The check is purely textual; it does not
distinguish:
- A real `stub.SyntacticVerify()` call site
- A `_ = "SyntacticVerify"` no-op string literal
- A `// SyntacticVerify` source comment
- A constant-false branch: `if false { x.SyntacticVerify() }`
- A name-conflict shadow: `var SyntacticVerify int`
Blue's own self-audit vector #5 ("audit gate meta-attack: construct a Verify
body that satisfies textual SyntacticVerify match but doesn't call at
runtime") materialized in V1. The audit gate cannot be the only line of
defense for `R4V7`.
The same defect applies to the `ChainsListEmbeddersCallMustVerify` and
`ValidatorsListEmbeddersCallMustVerify` gates — they check for `.MustVerify(`
the same way, and any string literal containing `.MustVerify(` defeats them.
**Impact**: Any future Verify body that drops the call but keeps the token
text passes CI. Same primitive enables silent removal of MustVerify on
ChainsList and ValidatorsList.
**Fix** (the only correct fix): switch from textual to AST-level. Either:
1. `go/parser` + `go/ast` walk inside the audit test — locate the
`*ast.FuncDecl` for each receiver type, then scan for an
`*ast.CallExpr` with `Sel.Name == "SyntacticVerify"` or `"MustVerify"`.
This rejects string literals, comments, and dead-code branches by
construction.
2. Replace the audit gate entirely with positive runtime tests: every
Owner-bearing tx type MUST have a `TestT_Verify_RejectsZeroThreshold`
row in `r6_verify_test.go` (one and only one way to assert the gate
ran). Regression caught by `go test ./...`, not a custom grep.
Bonus: Move BOTH audit gates (Owner-bearing + MustVerify) to AST-based at
the same time so the meta-attack class is closed.
---
## V3 — HIGH — ADMISSION — Audit gate scope leak: legacy txs `*Owner()` consumers bypass
**Class**: ADMISSION / GOVERNANCE. **Severity**: HIGH (acknowledged scope, but
the scope description in the brief is wrong).
The audit gate scopes the grep to the `zap_native` package. The legacy AVAX
tx interface (`vms/platformvm/txs/*.go`) defines `RewardsOwner()`,
`ValidationRewardsOwner()`, `DelegationRewardsOwner()` on `AddValidatorTx`,
`AddDelegatorTx`, `AddPermissionlessValidatorTx`,
`AddPermissionlessDelegatorTx`. These accessors return `fx.Owner` (not the
`(uint32, uint64, ids.ShortID)` tuple), so the audit gate's regex skips
them by design.
**But the executor consumes them without `Verify()`**:
- `vms/platformvm/txs/executor/proposal_tx_executor.go:303`
`uValidatorTx.ValidationRewardsOwner()`
- `vms/platformvm/txs/executor/proposal_tx_executor.go:340`
`uValidatorTx.DelegationRewardsOwner()`
- `vms/platformvm/txs/executor/proposal_tx_executor.go:429`
`uDelegatorTx.RewardsOwner()`
- `vms/platformvm/service.go:748-755` — same set, RPC path.
These run on the staking reward path. A legacy tx with a malformed Owner
(`Threshold > Addrs.Len()`) currently relies on the AVAX legacy parser to
reject. The audit gate would not detect a new code path that consumes
`*RewardsOwner()` without verification.
**Impact**: A future tx type or executor body that consumes Owner data via
the `fx.Owner` interface bypasses the gate silently. Quorum-skew / authz
bypass primitive on the staking reward path. Detectability: zero CI signal.
**Fix**: Either (a) broaden the audit gate to include `fx.Owner`-typed
returns (the AST refactor in V2 naturally subsumes this), or (b) document
the legacy boundary explicitly in `tx_verify.go` and add a positive test
matrix asserting every legacy `*Owner()` access site has a corresponding
SyntacticVerify upstream.
---
## V4 — HIGH — CRYPTO/DOS — BLS pubkey allocation amplification (Blue's self-audit V1, NOT fixed)
**Class**: DOS. **Severity**: HIGH.
`validators_list.go:101-131``ValidatorRecord.BLSPubKey()` and
`BLSPoP()` allocate a fresh `[]byte` per call. `MustVerify` walks N
records, calling each accessor once (line 224, 229 — used inside
`bytes.Equal`). At N=1024 cap that's:
- 1024 × 48B pubkey copies = 48 KB
- 1024 × 96B PoP copies = 96 KB
- Total: 144 KB per `MustVerify` call
But `tx_verify.go:285-311` calls `vals.At(i).BLSPubKey()` AND `BLSPoP()`
AGAIN per validator (for the BLS pairing). Cumulative: ~288 KB allocs
per `CreateSovereignL1Tx.Verify`. Mempool-DoS primitive: a peer that
gossips well-formed-but-cap-bound L1 spawn txs (or replays existing
ones) forces 288 KB GC churn per gossip event. At 1k txs/sec this is
288 MB/sec of allocation in admission.
Blue's self-audit V1 listed this and shipped no mitigation.
**Fix**: either (a) `MustVerify` reads bytes directly via the underlying
`zap.Object.Uint8` loop without copy-out, or (b) cache the
`[BLSPubKeySize]byte` and `[BLSPoPSize]byte` arrays on `ValidatorRecord`
under a lazy-init guard. (a) is simpler and orthogonal — bytes are
read-only at verify time.
---
## V5 — MEDIUM — DOS — No per-block tx-count cap (Blue self-audit V2, NOT fixed)
**Class**: DOS. **Severity**: MEDIUM.
`MaxChainsPerL1=16` and `MaxValidatorsPerL1=1024` are per-tx caps.
There is no block-level aggregate cap. An attacker submits N copies of
a 1024-validator `CreateSovereignL1Tx`; each tx independently passes
MustVerify, the block packer accepts up to mempool capacity, and the
verifier walks 1024N BLS pairings on block accept. At a 2-second block
time and tx min-fee, the amplification is bounded only by mempool RAM.
Blue's self-audit V2 listed this and shipped no mitigation.
**Fix**: Add a block-level cap in the standard_tx_executor commit path:
`sum(vals.Len()) over Verify calls in block <= GlobalMaxValidatorsPerBlock`
(e.g. 4096). Out-of-budget txs are deferred to next block, not dropped —
the encoder paid the fee.
---
## V6 — MEDIUM — ADMISSION — Admission gate parse-and-rewrap inefficiency + ordering bug
**Class**: ADMISSION. **Severity**: MEDIUM.
`zap_native_admission.go:113-131` (`zapNativeWireKindNotYetExecutable`)
calls `WrapCreateSovereignL1Tx`, `WrapRegisterL1ValidatorTx`, `WrapConvertNetworkToL1Tx`
in sequence. Each wrap reparses the header to check the kind discriminator.
The brief comments "cheap" but the parse goes through `parseAndCheckKind`,
which is the same body that ran on the inbound RPC — a measurable hot-path
re-walk.
Worse, **order matters**: kind 7 (`RegisterL1Validator`) is in the gated
set, but `WrapCreateSovereignL1Tx` is called FIRST. A wire buffer with
discriminator kind 7 will fail `WrapCreateSovereignL1Tx` with
`ErrWrongTxKind`, then succeed `WrapRegisterL1ValidatorTx`. Fine for the
returned `kind`, but the early-fail path consumes parse work unnecessarily.
Cheap fix: read the kind discriminator once via `parseAndCheckKind` directly,
then a single `switch`. Saves 2/3 of the work on the common-case path.
**Detectability**: Not a security bug per se; it's a microoptimization
miss that compounds with V4/V5 amplification.
---
## V7 — LOW — GOVERNANCE — `ATTACK PROBE V3` comment ships in production source
**Class**: GOVERNANCE. **Severity**: LOW (process bug; the underlying
vulnerability is V1).
`tx_verify.go:330-331` documents the attack vector inline, in production
Go source, with `ATTACK PROBE V3` as the function-level comment. Even
after V1 is fixed, the comment ships as a forensic breadcrumb advertising
the audit-gate weakness to any reader with `git log`.
**Fix**: When restoring the gate body (V1), strip the entire comment.
Production source is not a scratchpad for red-team probes.
---
## V8 — INFO — GOVERNANCE — `ListStride` overflow surface (Blue's free-form probe answer)
**Class**: CRYPTO/DOS. **Severity**: INFO.
Blue asked: "Stride*N uint32 multiply overflow in BoundChainsList /
BoundValidatorsList: can you construct N such that stride*N overflows
uint32 wraparound to a small value?"
Answer: NO. `zap/zap.go:393-427` `ListStride` performs `uint64(length) *
uint64(minStride) > bufRem` — both operands are uint32, product is uint64,
no wraparound. The clamp is correct. This vector is closed.
Documenting here so future audits don't re-probe.
---
## Blue Handoff
What Blue got right:
- `MaxValidatorsPerL1 = 1024` and `MaxChainsPerL1 = 16` caps are well-chosen
and wired BEFORE BLS pairing. Cheap-gate-first ordering is correct.
- `ValidatorsList.MustVerify` 5-floor invariants (cap, weight, BLS-non-zero,
expiry-non-zero) are the right set and tests pass per-invariant.
- `ListStride` uint64 product avoids overflow — V8 closed.
- The `MustVerify` receiver-name choice (R7V8) genuinely does make
"I forgot to call this" grep-able — at the call site. The PROBLEM is the
call-site grep, not the receiver-name choice.
- Admission gate (`zap_native_admission.go`) correctly orders Path 1 / Path 2
with the wrapping verifier as inner — defense-in-depth on the legacy
AND wire-bytes paths.
What Blue missed:
- The audit gate (the new infrastructure shipped in this batch) is fooled
by string literals (V2). This is the single most important finding.
The gate Blue added to prevent regressions of R4V7 cannot detect the
class of regression it exists to prevent — a PoC against the working
tree confirmed this experimentally.
- Legacy `*Owner()` consumers in `proposal_tx_executor.go` and `service.go`
(V3) are out-of-scope for the audit gate but are real Owner consumers.
- BLS pubkey/PoP allocation amplification (V4) — Blue self-audited and
shipped no fix.
- Per-block cap absence (V5) — Blue self-audited and shipped no fix.
Fix priority for Blue:
1. **V2**: Replace textual audit gate with AST-based, OR replace with
positive-test matrix in `r6_verify_test.go`. One and only one way.
2. **V3**: Broaden audit scope to `fx.Owner`-returning accessors, OR
document the legacy boundary explicitly with a positive test matrix.
3. **V4**: `ValidatorRecord.BLSPubKey/BLSPoP` no-copy path for MustVerify
(or cache on record). 144 KB → near-zero.
4. **V5**: Block-level validator/chain budget in standard_tx_executor.
5. **V6**: Single-pass kind discriminator read in admission gate.
Re-review scope: V2 and V3 mandatory before re-review. V4, V5, V6 can land
in a follow-up batch but Blue should report the plan. V1 retracted —
no action required.
---
RED COMPLETE (round 6 v2 — 2026-06-02 re-verification).
Total: 1 CRITICAL retracted, 1 critical, 2 high, 2 medium, 1 low, 1 info.
Top 3 for Blue to fix:
1. V2 — Audit gate fooled by string-literal token (meta-attack; gate cannot
detect the very class of regression it exists to prevent)
2. V3 — Legacy `*Owner()` consumers in `proposal_tx_executor.go` + `service.go`
bypass audit gate scope (fx.Owner-typed return)
3. V4 — BLS pubkey/PoP allocation amplification (144 KB per MustVerify at
N=1024; Blue self-audit V1, not fixed)
Re-review needed: yes — V2 and V3 must close before re-review.
Recommendation: **fix-then-ship**.
V1 retraction note (2026-06-02): the original "R6V8 undone" finding was a
working-tree-only PoC that proved V2's textual-gate weakness; the actual
67cff34428 commit ships the correctly-gated Verify body. The PoC remains
a valid demonstration of V2 — a future legitimate Blue edit that drops
the call while keeping the token in any form passes CI today.
+1 -1
View File
@@ -7,10 +7,10 @@ import (
"sync"
"time"
validators "github.com/luxfi/validators"
"github.com/luxfi/ids"
"github.com/luxfi/log"
metrics "github.com/luxfi/metric"
validators "github.com/luxfi/validators"
)
// NewManager creates a new benchlist manager
+1 -1
View File
@@ -8,9 +8,9 @@ import (
"testing"
"time"
"github.com/luxfi/crypto/hash"
"github.com/luxfi/ids"
"github.com/luxfi/log"
"github.com/luxfi/crypto/hash"
)
// BenchmarkHashingComputeHash256 benchmarks SHA256 hashing performance
+1 -1
View File
@@ -7,11 +7,11 @@ import (
"fmt"
"testing"
"github.com/luxfi/crypto/hash"
"github.com/luxfi/database/memdb"
"github.com/luxfi/database/prefixdb"
"github.com/luxfi/database/versiondb"
"github.com/luxfi/ids"
"github.com/luxfi/crypto/hash"
)
// BenchmarkMemoryDatabase benchmarks in-memory database operations
+1 -1
View File
@@ -9,8 +9,8 @@ import (
"encoding/binary"
"testing"
"github.com/luxfi/ids"
compression "github.com/luxfi/compress"
"github.com/luxfi/ids"
)
// BenchmarkMessageCompression benchmarks message compression
+1 -1
View File
@@ -6,9 +6,9 @@ package lru
import (
"sync"
"github.com/luxfi/container/linked"
"github.com/luxfi/node/cache"
"github.com/luxfi/utils"
"github.com/luxfi/container/linked"
)
var _ cache.Cacher[struct{}, struct{}] = (*Cache[struct{}, struct{}])(nil)
+1 -1
View File
@@ -6,9 +6,9 @@ package lru
import (
"sync"
"github.com/luxfi/container/linked"
"github.com/luxfi/node/cache"
"github.com/luxfi/utils"
"github.com/luxfi/container/linked"
)
var _ cache.Cacher[struct{}, any] = (*SizedCache[struct{}, any])(nil)
+1 -1
View File
@@ -6,8 +6,8 @@ package cache
import (
"sync"
"github.com/luxfi/utils"
"github.com/luxfi/container/linked"
"github.com/luxfi/utils"
)
var _ Cacher[struct{}, struct{}] = (*LRU[struct{}, struct{}])(nil)
+1 -1
View File
@@ -6,8 +6,8 @@ package cache
import (
"sync"
"github.com/luxfi/utils"
"github.com/luxfi/container/linked"
"github.com/luxfi/utils"
)
var _ Cacher[struct{}, any] = (*sizedLRU[struct{}, any])(nil)
+1 -1
View File
@@ -8,13 +8,13 @@ import (
"errors"
"sync"
"github.com/luxfi/vm/chain"
consensusvertex "github.com/luxfi/consensus/engine/vertex"
"github.com/luxfi/database"
"github.com/luxfi/ids"
"github.com/luxfi/node/vms/platformvm/fx"
"github.com/luxfi/runtime"
vmcore "github.com/luxfi/vm"
"github.com/luxfi/vm/chain"
"github.com/luxfi/warp"
)
+131 -37
View File
@@ -70,11 +70,17 @@ import (
"github.com/luxfi/vm/fx"
// "github.com/luxfi/node/vms/metervm" // Temporarily disabled - needs consensus package updates
"github.com/luxfi/utxo/bls12381fx"
"github.com/luxfi/utxo/ed25519fx"
"github.com/luxfi/utxo/mldsafx"
"github.com/luxfi/utxo/nftfx"
"github.com/luxfi/utxo/propertyfx"
// "github.com/luxfi/node/vms/proposervm"
"github.com/luxfi/utxo/schnorrfx"
"github.com/luxfi/utxo/secp256k1fx"
"github.com/luxfi/utxo/secp256r1fx"
"github.com/luxfi/utxo/slhdsafx"
// "github.com/luxfi/node/vms/tracedvm" // Temporarily disabled - needs consensus package updates
// "github.com/luxfi/node/proto/p2p" // Available if needed for protobuf parsing
@@ -128,10 +134,26 @@ var (
errNotBootstrapped = errors.New("chains not bootstrapped")
errPartialSyncAsAValidator = errors.New("partial sync should not be configured for a validator")
// fxs lists every Feature eXtension factory the node knows how to load
// when a chain genesis references it. Must stay in sync with the X-Chain
// FxIDs[] block in genesis/builder/builder.go: any fx ID present there
// MUST be registered here, otherwise chain init fails with "fx ... not
// found" at startup. Keep the order and grouping mirroring genesis to
// make drift obvious in review.
fxs = map[ids.ID]fx.Factory{
// Legacy / classical
secp256k1fx.ID: &secp256k1fx.Factory{},
nftfx.ID: &nftfx.Factory{},
propertyfx.ID: &propertyfx.Factory{},
// Post-quantum (FIPS 203/204/205 family)
mldsafx.ID: &mldsafx.Factory{},
slhdsafx.ID: &slhdsafx.Factory{},
// EdDSA / Schnorr / NIST P-256
ed25519fx.ID: &ed25519fx.Factory{},
secp256r1fx.ID: &secp256r1fx.Factory{},
schnorrfx.ID: &schnorrfx.Factory{},
// Pairing-friendly curve
bls12381fx.ID: &bls12381fx.Factory{},
}
_ Manager = (*manager)(nil)
@@ -323,7 +345,7 @@ type ManagerConfig struct {
PartialSyncPrimaryNetwork bool
Server server.Server // Handles HTTP API calls
AtomicMemory *atomic.Memory
XAssetID ids.ID
UTXOAssetID ids.ID
SkipBootstrap bool // Skip bootstrapping and start processing immediately
EnableAutomining bool // Enable automining in POA mode
XChainID ids.ID // ID of the X-Chain,
@@ -363,6 +385,17 @@ type ManagerConfig struct {
ChainDataDir string
Nets *Nets
// SecurityProfile is the chain-wide ChainSecurityProfile resolved
// from the genesis pin during node bootstrap (F102). The chain
// manager forwards a ProfileID + ProfileHash pin to every VM
// Initialize call via the VM config bytes so the rpcchainvm plugin
// (coreth C-Chain) inherits the chain-wide posture without
// re-resolving genesis. Closes red-team finding F118.
//
// Nil under classical-compat or pre-locked-profile chains; the
// stamping pass is a no-op in that case.
SecurityProfile *consensusconfig.ChainSecurityProfile
}
type manager struct {
@@ -485,31 +518,12 @@ func New(config *ManagerConfig) (Manager, error) {
// QueueChainCreation queues a chain creation request
// Invariant: Tracked Net must be checked before calling this function
func (m *manager) QueueChainCreation(chainParams ChainParameters) {
// Check for chain ID mapping override for C-Chain
m.Log.Info("QueueChainCreation called",
log.String("vmID", chainParams.VMID.String()),
log.String("EVMID", constants.EVMID.String()),
log.Bool("vmIDEqualsEVMID", chainParams.VMID == constants.EVMID),
log.String("envVar", os.Getenv("LUX_CHAIN_ID_MAPPING_C")),
)
if chainParams.VMID == constants.EVMID && os.Getenv("LUX_CHAIN_ID_MAPPING_C") != "" {
mappedID := os.Getenv("LUX_CHAIN_ID_MAPPING_C")
parsedID, err := ids.FromString(mappedID)
if err == nil {
m.Log.Info("Using mapped blockchain ID for C-Chain",
log.String("original", chainParams.ID.String()),
log.String("mapped", parsedID.String()),
)
chainParams.ID = parsedID
} else {
m.Log.Warn("Invalid chain ID mapping",
log.String("mapping", mappedID),
log.Err(err),
)
}
}
// Register blockchain→chain mapping with the network layer so gossip
// can resolve which validator set to use for this blockchain's blocks.
if chainParams.ChainID != constants.PrimaryNetworkID && m.Net != nil {
@@ -616,6 +630,35 @@ func (m *manager) createChain(chainParams ChainParameters) {
}
chainAlias := m.PrimaryAliasOrDefault(chainParams.ID)
// Plugin-not-loaded is a deliberate skip, not a failure.
//
// Each validator opts into chains by loading their VM plugin
// (Liquid loads /dex/fhe; doesn't load Lux's upstream
// EVM plugin for C-Chain because Liquid runs its own EVM as a
// chain on the primary's P-chain). When the chain manager hits a
// chain whose VM isn't registered, that's the validator's "no I
// don't validate this one" signal — log info, mark the slot
// bootstrapped, and return WITHOUT registering a failing health
// check. The chain stays in pending state for hot-load if the
// plugin shows up later (e.g. via lpm install).
//
// The old behavior (always register a failing health check) made
// /ext/health return 503 for any opted-out chain, which made
// kubelet liveness probes kill the validator pod. That made
// chain participation effectively all-or-nothing per validator.
// Now: validators participate per-plugin, opt-in.
if errors.Is(err, vms.ErrNotFound) {
m.Log.Info("chain VM plugin not loaded — opting out of this chain",
log.Stringer("chainID", chainParams.ChainID),
log.Stringer("chainID", chainParams.ID),
log.String("chainAlias", chainAlias),
log.Stringer("vmID", chainParams.VMID),
)
sb.Bootstrapped(chainParams.ID)
return
}
m.Log.Warn("non-critical chain failed to initialize",
log.Stringer("chainID", chainParams.ChainID),
log.Stringer("chainID", chainParams.ID),
@@ -624,15 +667,13 @@ func (m *manager) createChain(chainParams ChainParameters) {
log.Err(err),
)
// Non-critical chain failed (e.g. D-Chain with missing VM plugin).
// Mark it as bootstrapped so it doesn't block the node's health check.
// The chain-specific health check below still reports the failure.
// Non-critical chain failed for a real reason (not missing
// plugin). Mark it as bootstrapped so it doesn't block the
// node-level health check, but DO register a per-chain failing
// health check so operators see something is wrong with a chain
// they did opt into.
sb.Bootstrapped(chainParams.ID)
// Register the health check for this chain regardless of if it was
// created or not. This attempts to notify the node operator that their
// node may not be properly validating the net they expect to be
// validating.
healthCheckErr := fmt.Errorf("failed to create chain on net %s: %w", chainParams.ChainID, err)
err := m.Health.RegisterHealthCheck(
chainAlias,
@@ -874,16 +915,15 @@ func (m *manager) buildChain(chainParams ChainParameters, sb nets.Net) (*chainIn
XChainID: m.XChainID,
CChainID: m.CChainID,
XAssetID: m.XAssetID,
UTXOAssetID: m.UTXOAssetID,
ChainDataDir: chainDataDir,
BCLookup: m,
ValidatorState: getValidatorState(m.validatorState),
SharedMemory: chainSharedMemory,
Metrics: chainMetricsGatherer,
Log: chainLog,
WarpSigner: warpSigner,
NetworkUpgrades: &m.Upgrades,
BCLookup: m,
ValidatorState: getValidatorState(m.validatorState),
SharedMemory: chainSharedMemory,
Metrics: chainMetricsGatherer,
Log: chainLog,
WarpSigner: warpSigner,
}
// Get a factory for the vm we want to use on our chain
@@ -992,8 +1032,12 @@ func (m *manager) buildChain(chainParams ChainParameters, sb nets.Net) (*chainIn
}
// Initialize the VM if it supports the Initialize interface
// Inject automining config for dev mode (applies to C-Chain/coreth only)
// Inject automining config for dev mode (applies to C-Chain/coreth only),
// then stamp the chain-wide SecurityProfile pin into the C-Chain
// JSON config (F118) so the rpcchainvm plugin can resolve the
// profile on its side of the boundary.
vmConfigBytes := m.injectAutominingConfig(chainParams.VMID, chainConfig.Config)
vmConfigBytes = m.injectSecurityProfileConfig(chainParams.VMID, vmConfigBytes)
m.Log.Info("initializing VM", log.Stringer("chainID", chainParams.ID))
initCtx, initCancel := context.WithTimeout(context.Background(), 30*time.Second)
defer initCancel()
@@ -1438,7 +1482,7 @@ func (m *manager) createDAG(
}
}
// Linearize the DAG chain (required for X-Chain post-Cortina)
// Linearize the DAG chain (required for X-Chain).
// This transitions the chain from DAG mode to linear block mode.
if vmInitialized {
if linearVM, ok := vmImpl.(interface {
@@ -1826,6 +1870,56 @@ func (m *manager) getChainConfig(id ids.ID) (ChainConfig, error) {
return ChainConfig{}, nil
}
// injectSecurityProfileConfig stamps the chain-wide ChainSecurityProfile
// pin into the C-Chain JSON config bytes so the coreth plugin VM can
// resolve the profile on its side of the rpcchainvm boundary. Closes
// red-team finding F118.
//
// The pin form is intentionally minimal — ProfileID byte + ProfileHash
// hex — so this manager package does not need to round-trip the full
// ChainSecurityProfile struct. The plugin VM calls
// consensusconfig.ProfileByID + ComputeHash and refuses the chain if the
// pinned hash does not match the live canonical content. Forked binaries
// that swap canonical profile content fail the hash compare; legitimate
// upgrades land via a new ProfileID and ProfileHash pair.
//
// Only applies to C-Chain (EVMID); other VMs are passed through.
func (m *manager) injectSecurityProfileConfig(vmID ids.ID, configBytes []byte) []byte {
if m.SecurityProfile == nil {
return configBytes
}
if vmID != constants.EVMID {
return configBytes
}
// Parse existing config or create empty object.
var cfg map[string]interface{}
if len(configBytes) > 0 {
if err := json.Unmarshal(configBytes, &cfg); err != nil {
m.Log.Warn("failed to parse C-Chain config for security profile injection, creating new config",
log.Err(err))
cfg = make(map[string]interface{})
}
} else {
cfg = make(map[string]interface{})
}
cfg["lux-security-profile"] = map[string]interface{}{
"profileID": m.SecurityProfile.ProfileID & 0xff,
"profileHashHex": fmt.Sprintf("%x", m.SecurityProfile.ProfileHash[:]),
}
out, err := json.Marshal(cfg)
if err != nil {
m.Log.Warn("failed to marshal C-Chain config after security profile injection", log.Err(err))
return configBytes
}
m.Log.Info("injected chain security profile pin into C-Chain plugin config",
log.Uint32("profileID", m.SecurityProfile.ProfileID),
log.String("profileName", m.SecurityProfile.ProfileName))
return out
}
// injectAutominingConfig modifies the config bytes to include enable-automining flag
// when dev mode automining is enabled. This is used for C-Chain (coreth) to enable
// anvil-like block production behavior.
+3 -3
View File
@@ -10,13 +10,13 @@ import (
"github.com/stretchr/testify/require"
"github.com/luxfi/vm"
"github.com/luxfi/constants"
"github.com/luxfi/ids"
"github.com/luxfi/log"
"github.com/luxfi/metric"
"github.com/luxfi/node/nets"
"github.com/luxfi/node/vms"
"github.com/luxfi/vm"
)
// TestNew tests creating a new manager
@@ -106,9 +106,9 @@ func TestQueueChainCreation(t *testing.T) {
chainID := ids.GenerateTestID()
netID := ids.GenerateTestID()
chainParams := ChainParameters{
ID: chainID,
ID: chainID,
ChainID: netID,
VMID: ids.GenerateTestID(),
VMID: ids.GenerateTestID(),
}
// Queue the chain
+1 -1
View File
@@ -70,7 +70,7 @@ func (s *mockServer) AddAliasesWithReadLock(endpoint string, aliases ...string)
func (s *mockServer) Dispatch() error { return nil }
func (s *mockServer) RegisterChain(chainName string, rt *runtime.Runtime, vm vm.VM) {
}
func (s *mockServer) Shutdown() error { return nil }
func (s *mockServer) Shutdown() error { return nil }
func (s *mockServer) SetRootInfoProvider(_ server.RootInfoProvider) {}
func TestHandlerManager_RegisterChainHandlers(t *testing.T) {
+158
View File
@@ -0,0 +1,158 @@
// Copyright (C) 2019-2026, Lux Industries Inc. All rights reserved.
// See the file LICENSE for licensing terms.
//
// F118 regression coverage. Asserts the chain manager stamps the
// chain-wide ChainSecurityProfile pin into the C-Chain JSON config
// bytes so the rpcchainvm plugin (coreth) can resolve the profile on
// its side of the boundary.
package chains
import (
"encoding/hex"
"encoding/json"
"testing"
consensusconfig "github.com/luxfi/consensus/config"
"github.com/luxfi/constants"
"github.com/luxfi/ids"
"github.com/luxfi/log"
"github.com/stretchr/testify/require"
)
// canonicalStrictPQProfile returns the live canonical StrictPQ profile
// with ProfileHash populated — the same form node.go builds during
// initSecurityProfile.
func canonicalStrictPQProfile(t *testing.T) *consensusconfig.ChainSecurityProfile {
t.Helper()
p, err := consensusconfig.ProfileByID(consensusconfig.ProfileStrictPQ)
require.NoError(t, err)
require.NoError(t, p.Validate())
h, err := p.ComputeHash()
require.NoError(t, err)
p.ProfileHash = h
return p
}
// TestInjectSecurityProfileConfig_StampsCChainOnly asserts the F118
// injection pass stamps the security profile pin into the C-Chain
// (EVMID) plugin config and is a no-op for every other VM ID. Other
// VMs receive the config bytes unchanged.
func TestInjectSecurityProfileConfig_StampsCChainOnly(t *testing.T) {
require := require.New(t)
profile := canonicalStrictPQProfile(t)
m := &manager{
ManagerConfig: ManagerConfig{
Log: log.NewNoOpLogger(),
SecurityProfile: profile,
},
}
// C-Chain (EVMID): pin must be stamped.
out := m.injectSecurityProfileConfig(constants.EVMID, nil)
require.NotEmpty(out, "C-Chain config must be stamped with the security profile pin")
var got map[string]interface{}
require.NoError(json.Unmarshal(out, &got))
pin, ok := got["lux-security-profile"].(map[string]interface{})
require.True(ok, "C-Chain config must carry lux-security-profile object")
require.EqualValues(uint32(consensusconfig.ProfileStrictPQ), uint32(pin["profileID"].(float64)),
"profileID must round-trip the canonical StrictPQ byte")
require.Equal(hex.EncodeToString(profile.ProfileHash[:]), pin["profileHashHex"],
"profileHashHex must round-trip the canonical 48-byte hash")
// Non-EVM VM (PlatformVMID): no-op.
original := []byte(`{"some": "config"}`)
pOut := m.injectSecurityProfileConfig(constants.PlatformVMID, original)
require.Equal(original, pOut, "non-C-Chain config must pass through unchanged")
}
// TestInjectSecurityProfileConfig_NoOpWhenProfileNil asserts the F118
// injection is a no-op when SecurityProfile is nil (classical-compat
// chains, legacy networks pre-locked-profile).
func TestInjectSecurityProfileConfig_NoOpWhenProfileNil(t *testing.T) {
require := require.New(t)
m := &manager{
ManagerConfig: ManagerConfig{
Log: log.NewNoOpLogger(),
SecurityProfile: nil,
},
}
original := []byte(`{"some": "config"}`)
out := m.injectSecurityProfileConfig(constants.EVMID, original)
require.Equal(original, out, "no-op pass-through under nil SecurityProfile")
out = m.injectSecurityProfileConfig(constants.EVMID, nil)
require.Empty(out, "no-op pass-through preserves nil bytes")
}
// TestInjectSecurityProfileConfig_MergesExistingConfig asserts the F118
// injection preserves pre-existing C-Chain config keys (lux-strict-pq
// shim, enable-automining, etc.) while adding the new lux-security-profile
// pin alongside.
func TestInjectSecurityProfileConfig_MergesExistingConfig(t *testing.T) {
require := require.New(t)
profile := canonicalStrictPQProfile(t)
m := &manager{
ManagerConfig: ManagerConfig{
Log: log.NewNoOpLogger(),
SecurityProfile: profile,
},
}
original := []byte(`{"enable-automining": true, "skip-block-fee": true}`)
out := m.injectSecurityProfileConfig(constants.EVMID, original)
var got map[string]interface{}
require.NoError(json.Unmarshal(out, &got))
require.Equal(true, got["enable-automining"], "automining flag must survive")
require.Equal(true, got["skip-block-fee"], "skip-block-fee flag must survive")
require.NotNil(got["lux-security-profile"], "security profile pin must be added")
}
// TestInjectSecurityProfileConfig_RoundTripsAcrossPluginBoundary
// asserts the wire form coreth expects (security-profile pin with
// profileID + profileHashHex) matches the form the chain manager
// emits, so the rpcchainvm plugin can decode the pin via standard
// JSON unmarshalling. Closes the wire-compat axis of F118.
func TestInjectSecurityProfileConfig_RoundTripsAcrossPluginBoundary(t *testing.T) {
require := require.New(t)
profile := canonicalStrictPQProfile(t)
m := &manager{
ManagerConfig: ManagerConfig{
Log: log.NewNoOpLogger(),
SecurityProfile: profile,
},
}
out := m.injectSecurityProfileConfig(constants.EVMID, nil)
// Mirror of plugin/evm/config.Config — locally redefined so this
// test does not import the coreth plugin tree.
type localPin struct {
ProfileID uint8 `json:"profileID"`
ProfileHashHex string `json:"profileHashHex"`
}
type localCorethConfig struct {
SecurityProfile *localPin `json:"lux-security-profile,omitempty"`
}
var cfg localCorethConfig
require.NoError(json.Unmarshal(out, &cfg))
require.NotNil(cfg.SecurityProfile, "coreth-side config struct must decode the pin")
require.Equal(uint8(consensusconfig.ProfileStrictPQ), cfg.SecurityProfile.ProfileID)
require.Equal(hex.EncodeToString(profile.ProfileHash[:]), cfg.SecurityProfile.ProfileHashHex)
// Decoded hex must be exactly 48 bytes (SHA3-384 width).
hashBytes, err := hex.DecodeString(cfg.SecurityProfile.ProfileHashHex)
require.NoError(err)
require.Len(hashBytes, 48, "wire pin must carry a 48-byte SHA3-384 ProfileHash")
// Use ids.ID directly to silence the unused import warning in case
// other tests in this file don't reach it.
_ = ids.ID{}
}
-17
View File
@@ -1,17 +0,0 @@
//go:build tools
// +build tools
package main
import (
"fmt"
"github.com/luxfi/node/upgrade"
"github.com/luxfi/runtime"
)
func main() {
var c *upgrade.Config = &upgrade.Config{}
var _ runtime.NetworkUpgrades = c
fmt.Println("Interface satisfied")
}
+6 -6
View File
@@ -35,12 +35,12 @@ import (
var (
// Flags
outputPath string
inputPath string
sinceVer uint64
dataDir string
dbType string
noCompress bool
outputPath string
inputPath string
sinceVer uint64
dataDir string
dbType string
noCompress bool
forceRestore bool
)
+10 -10
View File
@@ -12,16 +12,16 @@ import (
// CeremonyState holds the full state of a powers-of-tau ceremony.
type CeremonyState struct {
Circuit string `json:"circuit"`
NumConstraints int `json:"numConstraints"`
PowersNeeded int `json:"powersNeeded"`
Participants int `json:"participants"`
TauG1 []G1Point `json:"tauG1"`
TauG2 []G2Point `json:"tauG2"`
AlphaG1 []G1Point `json:"alphaG1"`
BetaG1 []G1Point `json:"betaG1"`
BetaG2 G2Point `json:"betaG2"`
Contributions []Contribution `json:"contributions"`
Circuit string `json:"circuit"`
NumConstraints int `json:"numConstraints"`
PowersNeeded int `json:"powersNeeded"`
Participants int `json:"participants"`
TauG1 []G1Point `json:"tauG1"`
TauG2 []G2Point `json:"tauG2"`
AlphaG1 []G1Point `json:"alphaG1"`
BetaG1 []G1Point `json:"betaG1"`
BetaG2 G2Point `json:"betaG2"`
Contributions []Contribution `json:"contributions"`
}
// Contribution records a single participant's contribution.
+4 -4
View File
@@ -28,8 +28,8 @@ func main() {
"networkID": 200200,
"allocations": []map[string]interface{}{
{
"ethAddr": "0x9011E888251AB053B7bD1cdB598Db4f9DEd94714",
"luxAddr": zooAddr,
"evmAddr": "0x9011E888251AB053B7bD1cdB598Db4f9DEd94714",
"utxoAddr": zooAddr,
"initialAmount": 0,
"unlockSchedule": []map[string]interface{}{
{
@@ -47,7 +47,7 @@ func main() {
}
// Load validators from Lux genesis
luxGenesis, _ := os.ReadFile("/Users/z/work/lux/mainnet/genesis_mainnet.json")
luxGenesis, _ := os.ReadFile(os.ExpandEnv("$HOME/work/lux/mainnet/genesis_mainnet.json"))
var lux map[string]interface{}
json.Unmarshal(luxGenesis, &lux)
@@ -76,6 +76,6 @@ func main() {
genesis["cChainGenesis"] = string(ccBytes)
out, _ := json.MarshalIndent(genesis, "", " ")
os.WriteFile("/Users/z/work/lux/mainnet/zoo_genesis_valid.json", out, 0644)
os.WriteFile(os.ExpandEnv("$HOME/work/lux/mainnet/zoo_genesis_valid.json"), out, 0644)
fmt.Println("Wrote zoo_genesis_valid.json")
}
+5 -5
View File
@@ -3,7 +3,7 @@ package main
import (
"fmt"
"os"
"github.com/luxfi/crypto/hash"
"github.com/luxfi/ids"
)
@@ -13,15 +13,15 @@ func main() {
fmt.Println("Usage: go run main.go <genesis_file>")
os.Exit(1)
}
data, err := os.ReadFile(os.Args[1])
if err != nil {
fmt.Printf("Error reading file: %v\n", err)
os.Exit(1)
}
fmt.Printf("File size: %d bytes\n", len(data))
// Compute hash the same way luxd does
rawHash := hash.ComputeHash256(data)
id, err := ids.ToID(rawHash)
@@ -29,6 +29,6 @@ func main() {
fmt.Printf("Error converting to ID: %v\n", err)
os.Exit(1)
}
fmt.Printf("Genesis ID: %s\n", id.String())
}
+1 -1
View File
@@ -46,7 +46,7 @@ func (c *ChainDatabaseConfig) GetDatabaseType(chainAlias string) string {
func (c *ChainDatabaseConfig) Validate() error {
validTypes := map[string]bool{
"pebbledb": true,
"zapdb": true,
"zapdb": true,
"memdb": true,
}
+237 -376
View File
@@ -4,10 +4,12 @@
package config
import (
"bytes"
"crypto/tls"
"encoding/base64"
"encoding/hex"
"encoding/json"
"encoding/pem"
"errors"
"fmt"
"io/fs"
@@ -24,7 +26,8 @@ import (
"github.com/luxfi/constants"
"github.com/luxfi/crypto/bls"
"github.com/luxfi/crypto/bls/signer/localsigner"
"github.com/luxfi/crypto/hash"
"github.com/luxfi/crypto/mldsa"
mlkemcrypto "github.com/luxfi/crypto/mlkem"
"github.com/luxfi/filesystem/perms"
"github.com/luxfi/filesystem/storage"
"github.com/luxfi/ids"
@@ -47,7 +50,6 @@ import (
"github.com/luxfi/node/version"
"github.com/luxfi/node/vms/components/gas"
"github.com/luxfi/node/vms/platformvm/reward"
pchaintxs "github.com/luxfi/node/vms/platformvm/txs"
"github.com/luxfi/node/vms/platformvm/validators/fee"
"github.com/luxfi/node/vms/proposervm"
"github.com/luxfi/timer"
@@ -95,90 +97,16 @@ var (
errFileDoesNotExist = errors.New("file does not exist")
)
// AutomineNetworkConfig captures immutable network state for automine mode persistence.
// Once written to automine-network.json, this ensures the same genesis is produced
// on every restart, making C-Chain/EVM state persistence work correctly.
type AutomineNetworkConfig struct {
// Version for forward compatibility
Version int `json:"version"`
// Genesis start time - captured on first boot, reused on restart
StartTime uint64 `json:"startTime"`
// Node identity
NodeID string `json:"nodeId"`
// BLS credentials (hex-encoded)
BLSPublicKey string `json:"blsPublicKey"`
BLSPopProof string `json:"blsPopProof"`
// Computed genesis bytes and hash (for verification)
GenesisBytes []byte `json:"genesisBytes"`
GenesisHash string `json:"genesisHash"` // Actual hash of GenesisBytes
// X-Chain asset ID (LUX token ID)
XAssetID string `json:"xAssetId"`
// C-Chain genesis (stored separately for EVM immutability)
CChainGenesis string `json:"cChainGenesis"`
}
const (
devNetworkConfigVersion = 1
devNetworkConfigFilename = "automine-network.json"
)
// loadAutomineNetworkConfig attempts to load automine-network.json from the data directory.
// Returns nil if the file doesn't exist (first boot scenario).
func loadAutomineNetworkConfig(dataDir string) (*AutomineNetworkConfig, error) {
path := filepath.Join(dataDir, devNetworkConfigFilename)
data, err := os.ReadFile(path)
if err != nil {
if os.IsNotExist(err) {
return nil, nil // First boot - no config yet
}
return nil, fmt.Errorf("failed to read dev network config: %w", err)
}
var cfg AutomineNetworkConfig
if err := json.Unmarshal(data, &cfg); err != nil {
return nil, fmt.Errorf("failed to parse dev network config: %w", err)
}
if cfg.Version != devNetworkConfigVersion {
return nil, fmt.Errorf("unsupported dev network config version: %d (expected %d)", cfg.Version, devNetworkConfigVersion)
}
return &cfg, nil
}
// saveAutomineNetworkConfig atomically writes the dev network config to disk.
// Uses write-to-temp-then-rename pattern for crash safety.
func saveAutomineNetworkConfig(dataDir string, cfg *AutomineNetworkConfig) error {
path := filepath.Join(dataDir, devNetworkConfigFilename)
tempPath := path + ".tmp"
cfg.Version = devNetworkConfigVersion
data, err := json.MarshalIndent(cfg, "", " ")
if err != nil {
return fmt.Errorf("failed to marshal dev network config: %w", err)
}
// Write to temp file
if err := os.WriteFile(tempPath, data, 0o600); err != nil {
return fmt.Errorf("failed to write temp dev network config: %w", err)
}
// Atomic rename
if err := os.Rename(tempPath, path); err != nil {
os.Remove(tempPath) // Clean up on failure
return fmt.Errorf("failed to rename dev network config: %w", err)
}
return nil
}
// (Removed: AutomineNetworkConfig + loadAutomineNetworkConfig +
// saveAutomineNetworkConfig + automine-network.json persistence.)
//
// --automine is a *consensus-mode* flag (single-node, single-validator
// quorum), nothing more. It MUST NOT swap in a different C-Chain
// genesis or persist any "dev network config" sidecar. C-Chain
// genesis is canonical genesis — for network-id 1/2/3/1337 it's the
// embedded luxfi/genesis config, period. If the operator wants a
// custom genesis they pass --genesis-file. No backwards compatibility
// for the deleted automine-network.json sidecar.
func getConsensusConfig(v *viper.Viper) consensusconfig.Parameters {
// Start with default parameters
@@ -823,6 +751,135 @@ func getStakingSigner(v *viper.Viper) (bls.Signer, error) {
return key, nil
}
// loadPEMBlock returns the body of a single PEM block matching
// expectType. Refuses to silently consume the wrong block type so a
// misnamed file (e.g. ML-DSA private key supplied as a public-key
// path) fails loud at config-load instead of producing a NodeID under
// the wrong key.
func loadPEMBlock(path, expectType string) ([]byte, error) {
data, err := os.ReadFile(path)
if err != nil {
return nil, fmt.Errorf("read %s: %w", path, err)
}
block, _ := pem.Decode(data)
if block == nil {
return nil, fmt.Errorf("%s: not a PEM file", path)
}
if block.Type != expectType {
return nil, fmt.Errorf("%s: PEM type %q is not %s", path, block.Type, expectType)
}
return block.Bytes, nil
}
// pemBytesOrFile resolves either a base64-encoded PEM in
// contentKey (highest precedence, matches the
// --foo-file-content / --foo-file pattern the existing TLS
// loaders use) or a filesystem path in pathKey. Empty return =
// neither was set; caller decides whether that's a fatal config
// error or a "fall through to classical-compat" path.
func pemBytesOrFile(v *viper.Viper, contentKey, pathKey, expectType string) ([]byte, string, error) {
if v.IsSet(contentKey) {
raw := v.GetString(contentKey)
if raw == "" {
return nil, "", nil
}
decoded, err := base64.StdEncoding.DecodeString(raw)
if err != nil {
return nil, "", fmt.Errorf("decode %s base64: %w", contentKey, err)
}
block, _ := pem.Decode(decoded)
if block == nil {
return nil, "", fmt.Errorf("%s: decoded value is not PEM", contentKey)
}
if block.Type != expectType {
return nil, "", fmt.Errorf("%s: PEM type %q is not %s", contentKey, block.Type, expectType)
}
return block.Bytes, "<from-content>", nil
}
path := getExpandedArg(v, pathKey)
if path == "" {
return nil, "", nil
}
if _, err := os.Stat(path); errors.Is(err, fs.ErrNotExist) {
return nil, path, nil
} else if err != nil {
return nil, path, err
}
body, err := loadPEMBlock(path, expectType)
return body, path, err
}
// loadStakingMLDSA returns the strict-PQ ML-DSA-65 keypair (if any).
// Both private and public materials are optional at the config layer
// — a missing pair means classical-compat mode. A strict-PQ chain
// profile enforces presence at the validator-set boundary.
func loadStakingMLDSA(v *viper.Viper) (*mldsa.PrivateKey, []byte, string, string, error) {
privBytes, privPath, err := pemBytesOrFile(v,
StakingMLDSAKeyContentKey, StakingMLDSAKeyPathKey, "ML-DSA-65 PRIVATE KEY")
if err != nil {
return nil, nil, privPath, "", fmt.Errorf("staking-mldsa-key: %w", err)
}
pubBytes, pubPath, err := pemBytesOrFile(v,
StakingMLDSAPubKeyContentKey, StakingMLDSAPubKeyPathKey, "ML-DSA-65 PUBLIC KEY")
if err != nil {
return nil, nil, privPath, pubPath, fmt.Errorf("staking-mldsa-pub-key: %w", err)
}
if len(privBytes) == 0 && len(pubBytes) == 0 {
return nil, nil, privPath, pubPath, nil
}
// Asymmetry is a config error: a strict-PQ chain MUST have both
// the private key (for signing) and the public key (so peers can
// verify what we signed). Refuse rather than silently degrade.
if len(privBytes) == 0 || len(pubBytes) == 0 {
return nil, nil, privPath, pubPath, errors.New("staking-mldsa: both private and public key are required (or neither for classical-compat)")
}
priv, err := mldsa.PrivateKeyFromBytes(mldsa.MLDSA65, privBytes)
if err != nil {
return nil, nil, privPath, pubPath, fmt.Errorf("parse staking-mldsa private key: %w", err)
}
// Sanity: the public key on disk must match the one derivable
// from the private key. Mismatch would point a NodeID at a
// public key the validator cannot actually sign for — silent
// authentication failure that the consensus engine would later report as
// "this validator is offline" rather than "you misconfigured
// your keys".
derivedPubBytes := priv.PublicKey.Bytes()
if !bytes.Equal(derivedPubBytes, pubBytes) {
return nil, nil, privPath, pubPath, errors.New("staking-mldsa: public key on disk does not match the public key derived from the private key")
}
return priv, pubBytes, privPath, pubPath, nil
}
// loadHandshakeMLKEM returns the strict-PQ ML-KEM-768 KEM keypair
// (if any). Same shape + invariants as loadStakingMLDSA.
func loadHandshakeMLKEM(v *viper.Viper) (*mlkemcrypto.PrivateKey, []byte, string, string, error) {
privBytes, privPath, err := pemBytesOrFile(v,
HandshakeMLKEMKeyContentKey, HandshakeMLKEMKeyPathKey, "ML-KEM-768 PRIVATE KEY")
if err != nil {
return nil, nil, privPath, "", fmt.Errorf("handshake-mlkem-key: %w", err)
}
pubBytes, pubPath, err := pemBytesOrFile(v,
HandshakeMLKEMPubKeyContentKey, HandshakeMLKEMPubKeyPathKey, "ML-KEM-768 PUBLIC KEY")
if err != nil {
return nil, nil, privPath, pubPath, fmt.Errorf("handshake-mlkem-pub-key: %w", err)
}
if len(privBytes) == 0 && len(pubBytes) == 0 {
return nil, nil, privPath, pubPath, nil
}
if len(privBytes) == 0 || len(pubBytes) == 0 {
return nil, nil, privPath, pubPath, errors.New("handshake-mlkem: both private and public key are required (or neither for classical-compat)")
}
priv, err := mlkemcrypto.PrivateKeyFromBytes(privBytes, mlkemcrypto.MLKEM768)
if err != nil {
return nil, nil, privPath, pubPath, fmt.Errorf("parse handshake-mlkem private key: %w", err)
}
derivedPubBytes := priv.PublicKey().Bytes()
if !bytes.Equal(derivedPubBytes, pubBytes) {
return nil, nil, privPath, pubPath, errors.New("handshake-mlkem: public key on disk does not match the public key derived from the private key")
}
return priv, pubBytes, privPath, pubPath, nil
}
func getStakingConfig(v *viper.Viper, networkID uint32) (node.StakingConfig, error) {
config := node.StakingConfig{
SybilProtectionEnabled: v.GetBool(SybilProtectionEnabledKey),
@@ -849,6 +906,31 @@ func getStakingConfig(v *viper.Viper, networkID uint32) (node.StakingConfig, err
if err != nil {
return node.StakingConfig{}, err
}
// Strict-PQ identity (FIPS 204 ML-DSA-65 + FIPS 203 ML-KEM-768).
// Both pairs are optional at this layer — classical-compat chains
// run without them. Strict-PQ profile rejects a missing pair at
// the validator-set boundary; that gate lives in consensus/config
// (the profile gate that owns the strict-PQ vs classical-compat
// dispatch), not here in node-config land.
mldsaPriv, mldsaPub, mldsaPrivPath, mldsaPubPath, err := loadStakingMLDSA(v)
if err != nil {
return node.StakingConfig{}, err
}
config.StakingMLDSA = mldsaPriv
config.StakingMLDSAPub = mldsaPub
config.StakingMLDSAKeyPath = mldsaPrivPath
config.StakingMLDSAPubPath = mldsaPubPath
mlkemPriv, mlkemPub, mlkemPrivPath, mlkemPubPath, err := loadHandshakeMLKEM(v)
if err != nil {
return node.StakingConfig{}, err
}
config.HandshakeMLKEMPriv = mlkemPriv
config.HandshakeMLKEMPub = mlkemPub
config.HandshakeMLKEMKeyPath = mlkemPrivPath
config.HandshakeMLKEMPubPath = mlkemPubPath
if networkID != constants.MainnetID && networkID != constants.TestnetID {
config.UptimeRequirement = v.GetFloat64(UptimeRequirementKey)
config.MinValidatorStake = v.GetUint64(MinValidatorStakeKey)
@@ -957,13 +1039,10 @@ func getUpgradeConfig(v *viper.Viper, networkID uint32) (upgrade.Config, error)
}
func getGenesisData(v *viper.Viper, networkID uint32, stakingCfg *builder.StakingConfig, dataDir string) ([]byte, ids.ID, error) {
// Get allow-custom-genesis flag (defaults to true for development)
allowCustomGenesis := v.GetBool(AllowCustomGenesisKey)
// Handle automine mode genesis - dynamically generate genesis with the node's own credentials
if v.GetBool(DevModeKey) && !v.IsSet(GenesisFileKey) && !v.IsSet(GenesisFileContentKey) && !v.IsSet(GenesisDBKey) {
return getOrCreateAutomineGenesis(stakingCfg, dataDir)
}
// (Removed: automine-mode genesis swap.) --automine is single-node
// consensus only; it falls through to the canonical genesis loader
// below — same as a real network. C-Chain genesis comes from the
// canonical luxfi/genesis embedded config or --genesis-file. Period.
// HIGHEST PRIORITY: Raw genesis bytes - use directly without rebuilding
// This is critical for snapshot resume to avoid hash mismatch
@@ -973,16 +1052,15 @@ func getGenesisData(v *viper.Viper, networkID uint32, stakingCfg *builder.Stakin
if err != nil {
return nil, ids.Empty, fmt.Errorf("failed to decode %s: %w", GenesisRawBytesKey, err)
}
// Extract xAssetID from the X-chain genesis within the platform genesis
xAssetID, err := extractXAssetID(genesisBytes)
utxoAssetID, err := resolveXAssetID(networkID, genesisBytes)
if err != nil {
return nil, ids.Empty, fmt.Errorf("failed to extract xAssetID from raw genesis bytes: %w", err)
return nil, ids.Empty, fmt.Errorf("resolve X-Chain asset ID from %s: %w", GenesisRawBytesKey, err)
}
log.Info("loaded raw genesis bytes directly",
"size", len(genesisBytes),
"xAssetID", xAssetID,
"utxoAssetID", utxoAssetID,
)
return genesisBytes, xAssetID, nil
return genesisBytes, utxoAssetID, nil
}
// Check if genesis-db is specified for database replay
@@ -1004,7 +1082,7 @@ func getGenesisData(v *viper.Viper, networkID uint32, stakingCfg *builder.Stakin
// try first loading genesis content directly from flag/env-var
if v.IsSet(GenesisFileContentKey) {
genesisData := v.GetString(GenesisFileContentKey)
return builder.FromFlag(networkID, genesisData, stakingCfg, allowCustomGenesis)
return builder.FromFlag(networkID, genesisData, stakingCfg)
}
// if content is not specified go for the file
@@ -1013,21 +1091,32 @@ func getGenesisData(v *viper.Viper, networkID uint32, stakingCfg *builder.Stakin
// Check if we have cached genesis bytes to avoid rebuilding
cacheFile := filepath.Join(dataDir, "genesis.bytes")
if cachedBytes, err := loadCachedGenesisBytes(cacheFile); err == nil && len(cachedBytes) > 0 {
xAssetID, err := extractXAssetID(cachedBytes)
if err != nil {
log.Warn("failed to extract xAssetID from cached genesis, rebuilding",
"error", err,
)
} else {
utxoAssetID, err := resolveXAssetID(networkID, cachedBytes)
if err == nil {
log.Info("loaded cached genesis bytes for hash stability",
"cacheFile", cacheFile,
"size", len(cachedBytes),
"utxoAssetID", utxoAssetID,
)
return cachedBytes, xAssetID, nil
return cachedBytes, utxoAssetID, nil
}
// Cache parse failed — almost certainly a codec mismatch
// after a binary upgrade (e.g. v1-codec bytes persisted by
// an older luxd, multi-version v0+v1 dispatcher in this
// luxd doesn't recognise a type the cached blob still
// uses). Drop the cache and rebuild from the file rather
// than wedging in a CrashLoop. Hash stability is forfeit
// for this single restart — intentional, the alternative
// is a permanent outage on every binary bump.
log.Warn("cached genesis bytes failed to parse — invalidating cache and rebuilding from genesis-file",
"cacheFile", cacheFile,
"size", len(cachedBytes),
"error", err,
)
_ = os.Remove(cacheFile)
}
// No cache or invalid cache - build from file and cache the result
genesisBytes, xAssetID, err := builder.FromFile(networkID, genesisFileName, stakingCfg, allowCustomGenesis)
genesisBytes, utxoAssetID, err := builder.FromFile(networkID, genesisFileName, stakingCfg)
if err != nil {
return nil, ids.Empty, err
}
@@ -1042,7 +1131,7 @@ func getGenesisData(v *viper.Viper, networkID uint32, stakingCfg *builder.Stakin
"size", len(genesisBytes),
)
}
return genesisBytes, xAssetID, nil
return genesisBytes, utxoAssetID, nil
}
// finally if file is not specified/readable go for the predefined config
@@ -1050,248 +1139,36 @@ func getGenesisData(v *viper.Viper, networkID uint32, stakingCfg *builder.Stakin
return builder.FromConfig(config)
}
// getOrCreateAutomineGenesis handles automine mode genesis with persistence.
// On first boot: generates genesis, saves to automine-network.json, returns genesis.
// On restart: loads from automine-network.json to ensure genesis hash stability.
// Returns: (genesisBytes, xAssetID, error) - xAssetID is the LUX token asset ID
func getOrCreateAutomineGenesis(stakingCfg *builder.StakingConfig, dataDir string) ([]byte, ids.ID, error) {
// Try to load existing dev network config
devCfg, err := loadAutomineNetworkConfig(dataDir)
// resolveXAssetID extracts the X-Chain native asset ID from the loaded
// platform-genesis blob. It is the canonical source of truth used by
// every load path that bypasses FromConfig (raw bytes, cached bytes —
// the paths that historically defaulted to constants.UTXOAssetIDFor and
// silently disagreed with the genesis content on sovereign L1s).
//
// Behaviour:
//
// - If the genesis bakes an X-Chain, returns the runtime asset ID
// derived from that chain's CreateAssetTx (the same value
// vm.initGenesis assigns at runtime).
// - If the genesis is P-only (no X-Chain), returns the network-id-
// keyed constant. The asset ID is unused in that mode.
// - If the genesis is unparseable or the embedded X-Chain genesis
// is malformed, returns the corresponding error — these are
// unrecoverable on a primary-network bootstrap.
//
// Tested against both sovereign-network genesis (X-Chain present, asset
// ID differs from the constant) and upstream Lux genesis fixtures.
func resolveXAssetID(networkID uint32, genesisBytes []byte) (ids.ID, error) {
id, ok, err := builder.XAssetIDFromGenesisBytes(genesisBytes)
if err != nil {
return nil, ids.Empty, fmt.Errorf("failed to load dev network config: %w", err)
return ids.Empty, err
}
if devCfg != nil {
// Existing config found - check if credentials match
// In automine mode with ephemeral certs, credentials will change on restart.
// We log a warning but continue with the stored genesis since automine mode
// is single-node and doesn't require credential consistency.
expectedNodeID := stakingCfg.NodeID
expectedBLSPK := fmt.Sprintf("0x%x", stakingCfg.BLSPublicKey)
expectedBLSPoP := fmt.Sprintf("0x%x", stakingCfg.BLSProofOfPossession)
credentialsMismatch := false
if devCfg.NodeID != expectedNodeID {
log.Warn("automine-network.json nodeID mismatch (using stored genesis anyway for automine mode)",
"stored", devCfg.NodeID,
"current", expectedNodeID,
)
credentialsMismatch = true
}
if devCfg.BLSPublicKey != expectedBLSPK {
log.Warn("automine-network.json BLS public key mismatch (using stored genesis anyway for automine mode)")
credentialsMismatch = true
}
if devCfg.BLSPopProof != expectedBLSPoP {
log.Warn("automine-network.json BLS PoP mismatch (using stored genesis anyway for automine mode)")
credentialsMismatch = true
}
if credentialsMismatch {
log.Warn("credentials changed since first boot - for persistent staking, use --staking-ephemeral-cert-enabled=false with persistent key files")
}
// Verify the stored genesis hash matches what we'll compute from the bytes
storedHash, err := ids.FromString(devCfg.GenesisHash)
if err != nil {
return nil, ids.Empty, fmt.Errorf("invalid genesis hash in automine-network.json: %w", err)
}
// Compute actual hash from stored bytes to verify integrity
computedHashBytes := hash.ComputeHash256(devCfg.GenesisBytes)
computedHash, err := ids.ToID(computedHashBytes)
if err != nil {
return nil, ids.Empty, fmt.Errorf("failed to convert computed hash to ID: %w", err)
}
if storedHash != computedHash {
return nil, ids.Empty, fmt.Errorf("genesis bytes corrupted: stored hash %s != computed hash %s", storedHash, computedHash)
}
// Parse stored X-Chain asset ID
xAssetID, err := ids.FromString(devCfg.XAssetID)
if err != nil {
return nil, ids.Empty, fmt.Errorf("invalid xAssetId in automine-network.json: %w", err)
}
log.Info("loaded dev network config",
"path", filepath.Join(dataDir, devNetworkConfigFilename),
"genesisHash", devCfg.GenesisHash,
"xAssetID", devCfg.XAssetID,
"startTime", devCfg.StartTime,
)
return devCfg.GenesisBytes, xAssetID, nil
if !ok {
return constants.UTXOAssetIDFor(networkID), nil
}
// First boot - generate new genesis with current timestamp
startTime := uint64(time.Now().Unix())
// buildAutomineGenesis returns (genesisBytes, xAssetID) - the LUX token asset ID
genesisBytes, xAssetID, err := buildAutomineGenesis(stakingCfg, startTime)
if err != nil {
return nil, ids.Empty, err
}
// Compute actual genesis hash from bytes (this is what the node uses for DB validation)
genesisHashBytes := hash.ComputeHash256(genesisBytes)
genesisHash, err := ids.ToID(genesisHashBytes)
if err != nil {
return nil, ids.Empty, fmt.Errorf("failed to convert genesis hash to ID: %w", err)
}
// Save for future restarts
newDevCfg := &AutomineNetworkConfig{
Version: devNetworkConfigVersion,
StartTime: startTime,
NodeID: stakingCfg.NodeID,
BLSPublicKey: fmt.Sprintf("0x%x", stakingCfg.BLSPublicKey),
BLSPopProof: fmt.Sprintf("0x%x", stakingCfg.BLSProofOfPossession),
GenesisBytes: genesisBytes,
GenesisHash: genesisHash.String(),
XAssetID: xAssetID.String(),
CChainGenesis: automineCChainGenesis,
}
if err := saveAutomineNetworkConfig(dataDir, newDevCfg); err != nil {
// Log warning but don't fail - genesis is still valid
log.Warn("failed to save dev network config (persistence may not work on restart)",
"error", err,
)
} else {
log.Info("created dev network config",
"path", filepath.Join(dataDir, devNetworkConfigFilename),
"genesisHash", genesisHash.String(),
"xAssetID", xAssetID.String(),
"startTime", startTime,
)
}
return genesisBytes, xAssetID, nil
return id, nil
}
// buildAutomineGenesis creates a genesis configuration for single-node development mode.
// It uses the node's own credentials as the sole validator.
func buildAutomineGenesis(stakingCfg *builder.StakingConfig, startTime uint64) ([]byte, ids.ID, error) {
// Parse node ID from staking config
nodeID, err := ids.NodeIDFromString(stakingCfg.NodeID)
if err != nil {
return nil, ids.Empty, fmt.Errorf("failed to parse node ID for automine mode: %w", err)
}
// Lux Treasury address: 0x9011E888251AB053B7bD1cdB598Db4f9DEd94714
// This is derived from LUX_MNEMONIC and funded on C-Chain
var rewardAddress ids.ShortID
treasuryAddr := "9011E888251AB053B7bD1cdB598Db4f9DEd94714"
treasuryBytes, err := ids.ShortFromString(treasuryAddr)
if err == nil {
rewardAddress = treasuryBytes
} else {
// Fall back to a deterministic address derived from node ID
copy(rewardAddress[:], nodeID[:20])
}
// Create automine mode config with embedded C-Chain genesis
devCfg := builder.DevModeConfig{
NodeID: nodeID,
BLSPublicKey: fmt.Sprintf("0x%x", stakingCfg.BLSPublicKey),
BLSPopProof: fmt.Sprintf("0x%x", stakingCfg.BLSProofOfPossession),
RewardAddress: rewardAddress,
CChainGenesis: automineCChainGenesis,
StartTime: startTime, // Use provided start time for determinism
}
return builder.ForDevMode(devCfg, stakingCfg)
}
// automineCChainGenesis is the default C-Chain genesis for automine mode.
// Network ID 1337, EVM Chain ID 31337.
// Funds Lux Treasury (0x9011), light mnemonic accounts (BIP44 m/44'/9000'/0'/0/{0-4}), and Anvil/Hardhat accounts.
const automineCChainGenesis = `{
"config": {
"chainId": 31337,
"homesteadBlock": 0,
"eip150Block": 0,
"eip155Block": 0,
"eip158Block": 0,
"byzantiumBlock": 0,
"constantinopleBlock": 0,
"petersburgBlock": 0,
"istanbulBlock": 0,
"muirGlacierBlock": 0,
"berlinBlock": 0,
"londonBlock": 0,
"arrowGlacierBlock": 0,
"grayGlacierBlock": 0,
"mergeNetsplitBlock": 0,
"shanghaiTime": 0,
"cancunTime": 0,
"blobSchedule": {
"cancun": {"target": 3, "max": 6, "baseFeeUpdateFraction": 3338477}
},
"terminalTotalDifficulty": 0,
"chainEVMTimestamp": 0,
"durangoTimestamp": 0,
"etnaTimestamp": 0,
"feeConfig": {
"gasLimit": 30000000,
"targetBlockRate": 1,
"minBaseFee": 1000000000,
"targetGas": 100000000,
"baseFeeChangeDenominator": 48,
"minBlockGasCost": 0,
"maxBlockGasCost": 1000000,
"blockGasCostStep": 200000
},
"warpConfig": {
"blockTimestamp": 0,
"quorumNumerator": 67,
"requirePrimaryNetworkSigners": false
}
},
"alloc": {
"9011E888251AB053B7bD1cdB598Db4f9DEd94714": {
"balance": "0x200000000000000000000000000000000000000000000000000000000000000"
},
"5369615110ca435bdf798f31c20ba6163d7b0a54": {
"balance": "0x200000000000000000000000000000000000000000000000000000000000000"
},
"2e701063ccdffa2b1872c596222d8067d124d3ef": {
"balance": "0x200000000000000000000000000000000000000000000000000000000000000"
},
"9030463eb1aaa563c8247468416cc0bf06347502": {
"balance": "0x200000000000000000000000000000000000000000000000000000000000000"
},
"f77b06331152fd0e536de0af65688a6559c6f914": {
"balance": "0x200000000000000000000000000000000000000000000000000000000000000"
},
"944fd51713652b9922690b7d06498fbf8742beac": {
"balance": "0x200000000000000000000000000000000000000000000000000000000000000"
},
"f39Fd6e51aad88F6F4ce6aB8827279cffFb92266": {
"balance": "0x200000000000000000000000000000000000000000000000000000000000000"
},
"70997970C51812dc3A010C7d01b50e0d17dc79C8": {
"balance": "0x200000000000000000000000000000000000000000000000000000000000000"
},
"3C44CdDdB6a900fa2b585dd299e03d12FA4293BC": {
"balance": "0x200000000000000000000000000000000000000000000000000000000000000"
},
"90F79bf6EB2c4f870365E785982E1f101E93b906": {
"balance": "0x200000000000000000000000000000000000000000000000000000000000000"
}
},
"nonce": "0x0",
"timestamp": "0x0",
"extraData": "0x",
"gasLimit": "0x1c9c380",
"difficulty": "0x0",
"mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"coinbase": "0x0000000000000000000000000000000000000000",
"number": "0x0",
"gasUsed": "0x0",
"parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000"
}`
func getTrackedChains(v *viper.Viper) (set.Set[ids.ID], error) {
trackChainsStr := v.GetString(TrackChainsKey)
@@ -1849,20 +1726,25 @@ func GetNodeConfig(v *viper.Viper) (node.Config, error) {
return node.Config{}, err
}
// Chain tracking
// Always populate TrackedChains from --track-chains flag/env, regardless of
// TrackAllChains. TrackedChains is used in peer handshake (MyChains) to tell
// peers which chains we're interested in. Without it, peers won't gossip
// chain blocks to us even if we're tracking all chains locally.
// Chain tracking — explicit per-chain opt-in. Each validator
// declares which chains it wants to validate via --track-chains
// (or the operator-emitted equivalent). TrackedChains is also used
// in the peer handshake (MyChains) so peers gossip blocks for the
// chains we asked for.
//
// TrackAllChains stays as an opt-in escape hatch only — it is NOT
// auto-enabled when TrackedChains is empty. The previous default
// (`if TrackedChains == nil { TrackAllChains = true }`) was a
// footgun: any node started without an explicit --track-chains
// list silently tried to spin up every chain in P-chain state,
// including ones whose VM plugin wasn't loaded — fataling at the
// chain manager. Empty TrackedChains now means "track only P/X
// (built-in primary chains)".
nodeConfig.TrackedChains, err = getTrackedChains(v)
if err != nil {
return node.Config{}, err
}
nodeConfig.TrackAllChains = v.GetBool(TrackAllChainsKey)
if nodeConfig.TrackedChains == nil {
nodeConfig.TrackAllChains = true
}
// HTTP APIs
nodeConfig.HTTPConfig, err = getHTTPConfig(v)
@@ -1989,11 +1871,10 @@ func GetNodeConfig(v *viper.Viper) (node.Config, error) {
// Get data directory for dev network config persistence
dataDir := getExpandedArg(v, DataDirKey)
nodeConfig.GenesisBytes, nodeConfig.LuxAssetID, err = getGenesisData(v, nodeConfig.NetworkID, &genesisStakingCfg, dataDir)
nodeConfig.GenesisBytes, nodeConfig.UTXOAssetID, err = getGenesisData(v, nodeConfig.NetworkID, &genesisStakingCfg, dataDir)
if err != nil {
return node.Config{}, fmt.Errorf("unable to load genesis file: %w", err)
}
nodeConfig.AllowGenesisUpdate = v.GetBool(AllowGenesisUpdateKey)
// StateSync Configs
nodeConfig.StateSyncConfig, err = getStateSyncConfig(v)
@@ -2122,26 +2003,6 @@ func saveCachedGenesisBytes(cacheFile string, genesisBytes []byte) error {
return os.WriteFile(cacheFile, genesisBytes, 0o600)
}
// extractXAssetID extracts the LUX asset ID from raw platform genesis bytes.
// This is needed when loading raw genesis bytes directly (for snapshot resume)
// to avoid rebuilding genesis which causes hash mismatch.
func extractXAssetID(genesisBytes []byte) (ids.ID, error) {
// Get the X-chain creation TX from the platform genesis
xChainTx, err := builder.VMGenesis(genesisBytes, constants.XVMID)
if err != nil {
return ids.Empty, fmt.Errorf("couldn't find X-chain genesis in platform genesis: %w", err)
}
// Extract the XVM genesis bytes from the create chain TX
createChainTx, ok := xChainTx.Unsigned.(*pchaintxs.CreateChainTx)
if !ok {
return ids.Empty, fmt.Errorf("X-chain genesis TX is not a CreateChainTx")
}
// Use the builder.XAssetID function to extract the asset ID from XVM genesis
return builder.XAssetID(createChainTx.GenesisData)
}
func providedFlags(v *viper.Viper) map[string]interface{} {
settings := v.AllSettings()
customSettings := make(map[string]interface{}, len(settings))
+1 -1
View File
@@ -586,7 +586,7 @@ Defaults to `0.1`.
Partial sync enables nodes that are not primary network validators to optionally sync
only the P-chain on the primary network. Nodes that use this option can still track
Chains. After the Etna upgrade, nodes that use this option can also validate L1s.
Chains. Nodes that use this option can also validate L1s.
This config defaults to `false`.
## Public IP
+58
View File
@@ -17,9 +17,13 @@ import (
"github.com/stretchr/testify/require"
consensusconfig "github.com/luxfi/consensus/config"
"github.com/luxfi/constants"
"github.com/luxfi/ids"
"github.com/luxfi/node/chains"
"github.com/luxfi/node/genesis/builder"
"github.com/luxfi/node/nets"
pchaingenesis "github.com/luxfi/node/vms/platformvm/genesis"
pchaintxs "github.com/luxfi/node/vms/platformvm/txs"
)
const chainConfigFilenameExtension = ".ex"
@@ -672,3 +676,57 @@ func TestDevModeFlags(t *testing.T) {
}
}
// TestResolveXAssetID_FromSovereignGenesis covers the canonical
// behaviour the sovereign-L1 fix relies on: when the loaded platform
// genesis bakes an X-Chain, resolveXAssetID returns the runtime asset
// ID encoded IN the genesis (matches what FromConfig produces, matches
// what the running X-Chain reports via platform.getStakingAssetID).
//
// Critically: NOT constants.UTXOAssetIDFor(networkID). That value is
// network-id-keyed and would silently collide between two sovereign L1s
// sharing a primary-network ID.
func TestResolveXAssetID_FromSovereignGenesis(t *testing.T) {
require := require.New(t)
cfg := builder.GetConfig(constants.LocalID)
require.NotNil(cfg)
require.NotEmpty(cfg.XChainGenesis, "fixture must bake X-Chain")
genesisBytes, expectedID, err := builder.FromConfig(cfg)
require.NoError(err)
require.NotEqual(ids.Empty, expectedID)
gotID, err := resolveXAssetID(constants.LocalID, genesisBytes)
require.NoError(err)
require.Equal(expectedID, gotID,
"resolveXAssetID must agree with FromConfig on the genesis-derived asset ID")
}
// TestResolveXAssetID_POnlyFallback verifies that when the platform
// genesis bakes no X-Chain (P-only mode), resolveXAssetID falls back
// to constants.UTXOAssetIDFor(networkID). That value is unused at
// runtime (no X-Chain to mint on) but keeps the existing nodeConfig
// shape consistent for downstream consumers.
func TestResolveXAssetID_POnlyFallback(t *testing.T) {
require := require.New(t)
pOnly := &pchaingenesis.Genesis{Chains: nil}
pOnlyBytes, err := pchaingenesis.Codec.Marshal(pchaintxs.CodecVersion, pOnly)
require.NoError(err)
gotID, err := resolveXAssetID(42, pOnlyBytes)
require.NoError(err)
require.Equal(constants.UTXOAssetIDFor(42), gotID,
"P-only must fall through to UTXOAssetIDFor(networkID)")
}
// TestResolveXAssetID_Malformed asserts that bad genesis bytes surface
// an error rather than silently returning ids.Empty (which would
// reintroduce the UTXOAssetIDFor fallback and defeat the fix on
// sovereign L1s where the fallback value is wrong).
func TestResolveXAssetID_Malformed(t *testing.T) {
require := require.New(t)
_, err := resolveXAssetID(1, []byte{0xff, 0xfe, 0xfd, 0xfc})
require.Error(err)
}
+31 -13
View File
@@ -13,14 +13,14 @@ import (
"github.com/spf13/pflag"
"github.com/spf13/viper"
compression "github.com/luxfi/compress"
"github.com/luxfi/constants"
"github.com/luxfi/genesis/pkg/genesis"
"github.com/luxfi/net/dynamicip"
"github.com/luxfi/node/genesis/builder"
"github.com/luxfi/node/trace"
"github.com/luxfi/node/vms/components/gas"
"github.com/luxfi/node/vms/proposervm"
compression "github.com/luxfi/compress"
"github.com/luxfi/net/dynamicip"
"github.com/luxfi/sys/ulimit"
consensusconfig "github.com/luxfi/consensus/config"
@@ -46,15 +46,21 @@ var (
defaultStakingTLSKeyPath = filepath.Join(defaultStakingPath, "staker.key")
defaultStakingCertPath = filepath.Join(defaultStakingPath, "staker.crt")
defaultStakingSignerKeyPath = filepath.Join(defaultStakingPath, "signer.key")
defaultConfigDir = filepath.Join(defaultUnexpandedDataDir, "configs")
defaultChainConfigDir = filepath.Join(defaultConfigDir, "chains")
defaultVMConfigDir = filepath.Join(defaultConfigDir, "vms")
defaultVMAliasFilePath = filepath.Join(defaultVMConfigDir, "aliases.json")
defaultChainAliasFilePath = filepath.Join(defaultChainConfigDir, "aliases.json")
defaultNetConfigDir = filepath.Join(defaultConfigDir, "chains")
defaultPluginDir = filepath.Join(defaultUnexpandedDataDir, "plugins", "current")
defaultChainDataDir = filepath.Join(defaultUnexpandedDataDir, "chainData")
defaultProcessContextPath = filepath.Join(defaultUnexpandedDataDir, DefaultProcessContextFilename)
// Strict-PQ default paths — mirror downstream-tenant CLI `<tenantctl> key gen`
// layout so the operator init container + lqd see the same files.
defaultStakingMLDSAKeyPath = filepath.Join(defaultStakingPath, "mldsa.key")
defaultStakingMLDSAPubKeyPath = filepath.Join(defaultStakingPath, "mldsa.pub")
defaultHandshakeMLKEMKeyPath = filepath.Join(defaultStakingPath, "mlkem.key")
defaultHandshakeMLKEMPubKeyPath = filepath.Join(defaultStakingPath, "mlkem.pub")
defaultConfigDir = filepath.Join(defaultUnexpandedDataDir, "configs")
defaultChainConfigDir = filepath.Join(defaultConfigDir, "chains")
defaultVMConfigDir = filepath.Join(defaultConfigDir, "vms")
defaultVMAliasFilePath = filepath.Join(defaultVMConfigDir, "aliases.json")
defaultChainAliasFilePath = filepath.Join(defaultChainConfigDir, "aliases.json")
defaultNetConfigDir = filepath.Join(defaultConfigDir, "chains")
defaultPluginDir = filepath.Join(defaultUnexpandedDataDir, "plugins", "current")
defaultChainDataDir = filepath.Join(defaultUnexpandedDataDir, "chainData")
defaultProcessContextPath = filepath.Join(defaultUnexpandedDataDir, DefaultProcessContextFilename)
)
func deprecateFlags(fs *pflag.FlagSet) error {
@@ -109,8 +115,6 @@ func addNodeFlags(fs *pflag.FlagSet) {
fs.String(GenesisDBKey, "", "Path to existing genesis database for replay. Cannot be used with genesis-file or genesis-file-content")
fs.String(GenesisDBTypeKey, "zapdb", "Database type to use for genesis database. Must be one of {pebbledb, zapdb}")
fs.Uint64(GenesisBlockLimitKey, 0, "Limit number of blocks to replay during genesis (0 = all blocks)")
fs.Bool(AllowCustomGenesisKey, true, "Allow custom genesis for mainnet/testnet (default: true for development, set false for production)")
fs.Bool(AllowGenesisUpdateKey, false, "Allow updating stored genesis hash when genesis changes (use for adding new primary network chains)")
// Upgrade
fs.String(UpgradeFileKey, "", fmt.Sprintf("Specifies an upgrade config file path. Ignored when running standard networks or if %s is specified",
@@ -290,6 +294,20 @@ func addNodeFlags(fs *pflag.FlagSet) {
fs.Bool(StakingEphemeralSignerEnabledKey, false, "If true, the node uses an ephemeral staking signer key")
fs.String(StakingSignerKeyPathKey, defaultStakingSignerKeyPath, fmt.Sprintf("Path to the signer private key for staking. Ignored if %s is specified", StakingSignerKeyContentKey))
fs.String(StakingSignerKeyContentKey, "", "Specifies base64 encoded signer private key for staking")
// Strict-PQ identity (FIPS 204 ML-DSA-65 + FIPS 203 ML-KEM-768).
// When the ML-DSA pubkey is provided, NodeID derivation pivots from
// the classical TLS-cert path to the wire-discriminated strict-PQ
// scheme (ids.NodeIDSchemeMLDSA65.DeriveMLDSA). Both pairs default
// to the layout downstream-tenant CLI `<tenantctl> key gen` writes — wire the
// init container and lqd reads the files with zero extra config.
fs.String(StakingMLDSAKeyPathKey, defaultStakingMLDSAKeyPath, fmt.Sprintf("Path to the ML-DSA-65 staking private key (FIPS 204 PEM). Ignored if %s is specified", StakingMLDSAKeyContentKey))
fs.String(StakingMLDSAKeyContentKey, "", "Base64-encoded ML-DSA-65 staking private key (FIPS 204 PEM)")
fs.String(StakingMLDSAPubKeyPathKey, defaultStakingMLDSAPubKeyPath, fmt.Sprintf("Path to the ML-DSA-65 staking public key (FIPS 204 PEM). Ignored if %s is specified", StakingMLDSAPubKeyContentKey))
fs.String(StakingMLDSAPubKeyContentKey, "", "Base64-encoded ML-DSA-65 staking public key (FIPS 204 PEM)")
fs.String(HandshakeMLKEMKeyPathKey, defaultHandshakeMLKEMKeyPath, fmt.Sprintf("Path to the ML-KEM-768 handshake private key (FIPS 203 PEM). Ignored if %s is specified", HandshakeMLKEMKeyContentKey))
fs.String(HandshakeMLKEMKeyContentKey, "", "Base64-encoded ML-KEM-768 handshake private key (FIPS 203 PEM)")
fs.String(HandshakeMLKEMPubKeyPathKey, defaultHandshakeMLKEMPubKeyPath, fmt.Sprintf("Path to the ML-KEM-768 handshake public key (FIPS 203 PEM). Ignored if %s is specified", HandshakeMLKEMPubKeyContentKey))
fs.String(HandshakeMLKEMPubKeyContentKey, "", "Base64-encoded ML-KEM-768 handshake public key (FIPS 203 PEM)")
fs.String(StakingKMSEndpointKey, "", "KMS endpoint for staking key retrieval (e.g., https://kms.dev.lux.network)")
fs.String(StakingKMSSecretPathKey, "", "KMS secret path for staking keys (e.g., /staking/liquid-devnet/node-0)")
fs.String(StakingKMSTokenKey, "", "KMS auth token for staking key retrieval")
+48 -34
View File
@@ -20,8 +20,6 @@ const (
GenesisDBKey = "genesis-db"
GenesisDBTypeKey = "genesis-db-type"
GenesisBlockLimitKey = "genesis-block-limit"
AllowCustomGenesisKey = "allow-custom-genesis"
AllowGenesisUpdateKey = "allow-genesis-update"
UpgradeFileKey = "upgrade-file"
UpgradeFileContentKey = "upgrade-file-content"
NetworkNameKey = "network-id"
@@ -80,27 +78,43 @@ const (
HTTPReadTimeoutKey = "http-read-timeout"
HTTPReadHeaderTimeoutKey = "http-read-header-timeout"
HTTPIdleTimeoutKey = "http-idle-timeout"
StateSyncIPsKey = "state-sync-ips"
StateSyncIDsKey = "state-sync-ids"
BootstrapNodesKey = "bootstrap-nodes"
BootstrapIPsKey = "bootstrap-ips"
BootstrapIDsKey = "bootstrap-ids"
SkipBootstrapKey = "skip-bootstrap"
EnableAutominingKey = "enable-automining"
StakingHostKey = "staking-host"
StakingPortKey = "staking-port"
StakingEphemeralCertEnabledKey = "staking-ephemeral-cert-enabled"
StakingTLSKeyPathKey = "staking-tls-key-file"
StakingTLSKeyContentKey = "staking-tls-key-file-content"
StakingCertPathKey = "staking-tls-cert-file"
StakingCertContentKey = "staking-tls-cert-file-content"
StakingEphemeralSignerEnabledKey = "staking-ephemeral-signer-enabled"
StakingSignerKeyPathKey = "staking-signer-key-file"
StakingSignerKeyContentKey = "staking-signer-key-file-content"
StakingKMSEndpointKey = "staking-kms-endpoint"
StakingKMSSecretPathKey = "staking-kms-secret-path"
StakingKMSTokenKey = "staking-kms-token"
HTTPIdleTimeoutKey = "http-idle-timeout"
StateSyncIPsKey = "state-sync-ips"
StateSyncIDsKey = "state-sync-ids"
BootstrapNodesKey = "bootstrap-nodes"
BootstrapIPsKey = "bootstrap-ips"
BootstrapIDsKey = "bootstrap-ids"
SkipBootstrapKey = "skip-bootstrap"
EnableAutominingKey = "enable-automining"
StakingHostKey = "staking-host"
StakingPortKey = "staking-port"
StakingEphemeralCertEnabledKey = "staking-ephemeral-cert-enabled"
StakingTLSKeyPathKey = "staking-tls-key-file"
StakingTLSKeyContentKey = "staking-tls-key-file-content"
StakingCertPathKey = "staking-tls-cert-file"
StakingCertContentKey = "staking-tls-cert-file-content"
StakingEphemeralSignerEnabledKey = "staking-ephemeral-signer-enabled"
StakingSignerKeyPathKey = "staking-signer-key-file"
StakingSignerKeyContentKey = "staking-signer-key-file-content"
StakingKMSEndpointKey = "staking-kms-endpoint"
StakingKMSSecretPathKey = "staking-kms-secret-path"
StakingKMSTokenKey = "staking-kms-token"
// Strict-PQ staking identity (FIPS 204 ML-DSA-65). When set, the node
// uses the ML-DSA-65 public key as the NodeID source via
// ids.NodeIDSchemeMLDSA65.DeriveMLDSA(chainID, pubKey), replacing the
// classical TLS-cert NodeID derivation. Strict-PQ profiles require
// these; classical-compat chains ignore them.
StakingMLDSAKeyPathKey = "staking-mldsa-key-file"
StakingMLDSAKeyContentKey = "staking-mldsa-key-file-content"
StakingMLDSAPubKeyPathKey = "staking-mldsa-pub-key-file"
StakingMLDSAPubKeyContentKey = "staking-mldsa-pub-key-file-content"
// Strict-PQ handshake KEM (FIPS 203 ML-KEM-768). Peer-facing public
// key is published in the validator-set entry so peers can encapsulate
// to it for session-key establishment with no classical fallback.
HandshakeMLKEMKeyPathKey = "handshake-mlkem-key-file"
HandshakeMLKEMKeyContentKey = "handshake-mlkem-key-file-content"
HandshakeMLKEMPubKeyPathKey = "handshake-mlkem-pub-key-file"
HandshakeMLKEMPubKeyContentKey = "handshake-mlkem-pub-key-file-content"
SybilProtectionEnabledKey = "sybil-protection-enabled"
SybilProtectionDisabledWeightKey = "sybil-protection-disabled-weight"
NetworkInitialTimeoutKey = "network-initial-timeout"
@@ -250,17 +264,17 @@ const (
ForceIgnoreChecksumKey = "force-ignore-checksum"
// Low Memory / Dev Light Mode Keys
LowMemoryKey = "low-memory"
MemoryProfileKey = "memory-profile"
DevLightKey = "dev-light"
ConfigProfileKey = "config-profile"
DBCacheSizeKey = "db-cache-size"
DBMemtableSizeKey = "db-memtable-size"
StateCacheSizeKey = "state-cache-size"
BlockCacheSizeKey = "block-cache-size"
DisableBloomFiltersKey = "disable-bloom-filters"
LazyChainLoadingKey = "lazy-chain-loading"
SingleValidatorModeKey = "single-validator-mode"
LowMemoryKey = "low-memory"
MemoryProfileKey = "memory-profile"
DevLightKey = "dev-light"
ConfigProfileKey = "config-profile"
DBCacheSizeKey = "db-cache-size"
DBMemtableSizeKey = "db-memtable-size"
StateCacheSizeKey = "state-cache-size"
BlockCacheSizeKey = "block-cache-size"
DisableBloomFiltersKey = "disable-bloom-filters"
LazyChainLoadingKey = "lazy-chain-loading"
SingleValidatorModeKey = "single-validator-mode"
// VM Transport Keys
VMTransportKey = "vm-transport"
+99 -6
View File
@@ -5,25 +5,28 @@ package node
import (
"crypto/tls"
"errors"
"net/netip"
"time"
"github.com/luxfi/ids"
"github.com/luxfi/node/server/http"
"github.com/luxfi/node/benchlist"
"github.com/luxfi/node/chains"
"github.com/luxfi/node/genesis/builder"
"github.com/luxfi/node/network"
"github.com/luxfi/node/server/http"
// "github.com/luxfi/consensus/core/router" // Unused
"github.com/luxfi/crypto/bls"
"github.com/luxfi/crypto/mldsa"
mlkemcrypto "github.com/luxfi/crypto/mlkem"
"github.com/luxfi/node/nets"
"github.com/luxfi/node/network/tracker"
"github.com/luxfi/node/upgrade"
"github.com/luxfi/node/trace"
"github.com/luxfi/node/upgrade"
// "github.com/luxfi/log" // Unused
"github.com/luxfi/math/set"
"github.com/luxfi/timer"
"github.com/luxfi/node/utils/profiler"
"github.com/luxfi/timer"
)
type APIIndexerConfig struct {
@@ -83,6 +86,30 @@ type StakingConfig struct {
StakingKeyPath string `json:"stakingKeyPath"`
StakingCertPath string `json:"stakingCertPath"`
StakingSignerPath string `json:"stakingSignerPath"`
// Strict-PQ identity material. Set by config.GetNodeConfig when the
// --staking-mldsa-*-file / --handshake-mlkem-*-file flags resolve.
// All four fields are nil/empty under a classical-compat chain;
// strict-PQ profile rejects a missing StakingMLDSAPub at boot.
//
// NodeID derivation pivots on StakingMLDSAPub: when non-empty,
// ids.NodeIDSchemeMLDSA65.DeriveMLDSA(stakingChainID, StakingMLDSAPub)
// replaces ids.NodeIDFromCert(StakingTLSCert) — the TLS cert becomes
// transport-only, no longer the identity anchor.
//
// HandshakeMLKEMPub is the peer-facing KEM public key that lqd
// publishes in its validator-set entry so peers can encapsulate to it
// for session-key establishment with no classical fallback. The
// HandshakeMLKEMPriv stays local to the pod.
StakingMLDSA *mldsa.PrivateKey `json:"-"`
StakingMLDSAPub []byte `json:"-"`
HandshakeMLKEMPriv *mlkemcrypto.PrivateKey `json:"-"`
HandshakeMLKEMPub []byte `json:"-"`
// File paths kept for log-line context, mirroring StakingKeyPath etc.
StakingMLDSAKeyPath string `json:"stakingMLDSAKeyPath,omitempty"`
StakingMLDSAPubPath string `json:"stakingMLDSAPubPath,omitempty"`
HandshakeMLKEMKeyPath string `json:"handshakeMLKEMKeyPath,omitempty"`
HandshakeMLKEMPubPath string `json:"handshakeMLKEMPubPath,omitempty"`
}
type StateSyncConfig struct {
@@ -141,9 +168,8 @@ type Config struct {
UpgradeConfig upgrade.Config `json:"upgradeConfig"`
// Genesis information
GenesisBytes []byte `json:"-"`
LuxAssetID ids.ID `json:"xAssetID"`
AllowGenesisUpdate bool `json:"allowGenesisUpdate,omitempty"`
GenesisBytes []byte `json:"-"`
UTXOAssetID ids.ID `json:"utxoAssetID"`
// ID of the network this node should connect to
NetworkID uint32 `json:"networkID"`
@@ -240,3 +266,70 @@ type Config struct {
LazyChainLoading bool `json:"lazyChainLoading"`
SingleValidatorMode bool `json:"singleValidatorMode"`
}
// IsStrictPQ reports whether the staking config has strict-PQ
// identity material loaded. Strict-PQ requires an ML-DSA-65 public
// key (signing identity) — the ML-KEM-768 KEM is a complementary
// handshake primitive that the validator-set entry publishes for
// peers but is NOT what defines the validator's identity. The
// 0-byte slice case is "classical-compat": NodeID derives from the
// TLS staking cert in StakingTLSCert.
func (c *StakingConfig) IsStrictPQ() bool {
return len(c.StakingMLDSAPub) > 0
}
// DeriveNodeID returns the canonical 20-byte NodeID for this
// staking identity under chainID:
//
// - Strict-PQ (StakingMLDSAPub set):
// NodeID = SHAKE256-384("NODE_ID_V1" || chainID || 0x42 || pubKey)[:20]
// via ids.NodeIDSchemeMLDSA65.DeriveMLDSA. chainID-bound so the
// same key on a different chain produces a different NodeID,
// blocking cross-chain replay of validator registrations.
// - Classical-compat (no ML-DSA pub):
// NodeID = ids.NodeIDFromCert(StakingTLSCert.Leaf) — the
// legacy upstream derivation. A strict-PQ chain MUST refuse
// this branch at the validator-set boundary; the choice lives
// in the consensus profile, not here.
//
// This is the single seam every "what's my NodeID" call site should
// route through. Direct calls to ids.NodeIDFromCert in new code are
// a bug — they bypass the strict-PQ pivot.
func (c *StakingConfig) DeriveNodeID(chainID ids.ID) (ids.NodeID, error) {
if c.IsStrictPQ() {
id, _, err := ids.NodeIDSchemeMLDSA65.DeriveMLDSA(chainID, c.StakingMLDSAPub)
return id, err
}
if c.StakingTLSCert.Leaf == nil {
return ids.EmptyNodeID, errStakingTLSCertLeafNil
}
return ids.NodeIDFromCert(&ids.Certificate{
Raw: c.StakingTLSCert.Leaf.Raw,
PublicKey: c.StakingTLSCert.Leaf.PublicKey,
}), nil
}
// DeriveTypedNodeID returns the wire-canonical TypedNodeID — scheme
// byte (0x42 for strict-PQ ML-DSA-65, 0x90 for classical secp256k1)
// followed by the 20-byte NodeID. The scheme byte travels with the
// NodeID on every handshake / validator-set serialization so a
// receiver MUST know which verifier to dispatch before consulting
// the chain profile. Profile is a downgrade-detection gate; scheme
// byte is a primitive-mismatch gate.
func (c *StakingConfig) DeriveTypedNodeID(chainID ids.ID) (ids.TypedNodeID, error) {
if c.IsStrictPQ() {
t, _, err := ids.TypedNodeIDFromMLDSA(
ids.NodeIDSchemeMLDSA65, chainID, c.StakingMLDSAPub)
return t, err
}
if c.StakingTLSCert.Leaf == nil {
return ids.TypedNodeID{}, errStakingTLSCertLeafNil
}
return ids.TypedNodeIDFromCert(&ids.Certificate{
Raw: c.StakingTLSCert.Leaf.Raw,
PublicKey: c.StakingTLSCert.Leaf.PublicKey,
}), nil
}
var errStakingTLSCertLeafNil = errors.New(
"node: StakingConfig.StakingTLSCert.Leaf is nil — neither ML-DSA-65 nor a parsed TLS cert is available")
+73 -7
View File
@@ -131,13 +131,6 @@ func allFlags() []FlagSpec {
Description: "Limit number of blocks to replay during genesis (0 = all blocks)",
Category: CategoryGenesis,
},
{
Key: "allow-custom-genesis",
Type: TypeBool,
Default: true,
Description: "Allow custom genesis for mainnet/testnet (default: true for development, set false for production)",
Category: CategoryGenesis,
},
{
Key: "upgrade-file",
Type: TypeString,
@@ -1078,6 +1071,79 @@ func allFlags() []FlagSpec {
Category: CategoryStaking,
Sensitive: true,
},
// Strict-PQ staking identity (FIPS 204 ML-DSA-65). When supplied,
// the node uses the ML-DSA-65 public key as the NodeID source via
// ids.NodeIDSchemeMLDSA65.DeriveMLDSA(chainID, pubKey) — replacing
// the classical TLS-cert NodeID derivation. The classical TLS
// staker.crt/key + signer.key flags above are retained only for
// legacy chains that ship no ChainSecurityProfile; strict-PQ
// chains refuse classical material at every boundary.
{
Key: "staking-mldsa-key-file",
Type: TypeString,
Default: "$LUXD_DATA_DIR/staking/mldsa.key",
Description: "Path to the ML-DSA-65 staking private key (FIPS 204 PEM). Ignored if staking-mldsa-key-file-content is specified",
Category: CategoryStaking,
Sensitive: true,
},
{
Key: "staking-mldsa-key-file-content",
Type: TypeString,
Default: "",
Description: "Base64-encoded ML-DSA-65 staking private key (FIPS 204 PEM)",
Category: CategoryStaking,
Sensitive: true,
},
{
Key: "staking-mldsa-pub-key-file",
Type: TypeString,
Default: "$LUXD_DATA_DIR/staking/mldsa.pub",
Description: "Path to the ML-DSA-65 staking public key (FIPS 204 PEM). Ignored if staking-mldsa-pub-key-file-content is specified",
Category: CategoryStaking,
},
{
Key: "staking-mldsa-pub-key-file-content",
Type: TypeString,
Default: "",
Description: "Base64-encoded ML-DSA-65 staking public key (FIPS 204 PEM)",
Category: CategoryStaking,
},
// Strict-PQ handshake KEM (FIPS 203 ML-KEM-768). Peer-facing public
// key is published in the validator-set entry so peers can
// encapsulate to it for session-key establishment — the PQ replacement
// for classical TLS key agreement on the libp2p handshake. The
// private key stays on the validator pod; the public key is the only
// material that crosses the wire.
{
Key: "handshake-mlkem-key-file",
Type: TypeString,
Default: "$LUXD_DATA_DIR/staking/mlkem.key",
Description: "Path to the ML-KEM-768 handshake private key (FIPS 203 PEM). Ignored if handshake-mlkem-key-file-content is specified",
Category: CategoryStaking,
Sensitive: true,
},
{
Key: "handshake-mlkem-key-file-content",
Type: TypeString,
Default: "",
Description: "Base64-encoded ML-KEM-768 handshake private key (FIPS 203 PEM)",
Category: CategoryStaking,
Sensitive: true,
},
{
Key: "handshake-mlkem-pub-key-file",
Type: TypeString,
Default: "$LUXD_DATA_DIR/staking/mlkem.pub",
Description: "Path to the ML-KEM-768 handshake public key (FIPS 203 PEM). Ignored if handshake-mlkem-pub-key-file-content is specified",
Category: CategoryStaking,
},
{
Key: "handshake-mlkem-pub-key-file-content",
Type: TypeString,
Default: "",
Description: "Base64-encoded ML-KEM-768 handshake public key (FIPS 203 PEM)",
Category: CategoryStaking,
},
{
Key: "sybil-protection-enabled",
Type: TypeBool,
-8
View File
@@ -1,8 +0,0 @@
version: v1
plugins:
- name: go
out: pb
opt: paths=source_relative
- plugin: connect-go
out: pb
opt: paths=source_relative
-7
View File
@@ -1,7 +0,0 @@
# Generated by buf. DO NOT EDIT.
version: v1
deps:
- remote: buf.build
owner: metric
repository: client-model
commit: 1d56a02d481a412a83b3c4984eb90c2e
-27
View File
@@ -1,27 +0,0 @@
version: v1
name: buf.build/luxfi/lux
build:
excludes:
# for golang we handle metric as a buf dep so we exclude it from generate, this proto
# file is required by languages such as rust.
- io/metric
breaking:
use:
- FILE
deps:
- buf.build/metric/client-model
lint:
use:
- STANDARD
except:
- SERVICE_SUFFIX # service requirement of <name>+Service
- RPC_REQUEST_STANDARD_NAME # explicit <rpc>+Request naming
- RPC_RESPONSE_STANDARD_NAME # explicit <rpc>+Response naming
- PACKAGE_VERSION_SUFFIX # versioned naming <service>.v1beta
# allows RPC requests or responses to be google.protobuf.Empty messages. This can be set if you
# want to allow messages to be void forever, that is they will never take any parameters.
rpc_allow_google_protobuf_empty_requests: true
rpc_allow_google_protobuf_empty_responses: true
# allows the same message type to be used for a single RPC's request and response type.
# TODO: this should not be tolerated and if it is only perscriptivly.
rpc_allow_same_request_response: true
-288
View File
@@ -1,288 +0,0 @@
//go:build grpc
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.35.1
// protoc (unknown)
// source: xsvm/service.proto
package xsvm
import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
sync "sync"
)
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
type PingRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Message string `protobuf:"bytes,1,opt,name=message,proto3" json:"message,omitempty"`
}
func (x *PingRequest) Reset() {
*x = PingRequest{}
mi := &file_xsvm_service_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *PingRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*PingRequest) ProtoMessage() {}
func (x *PingRequest) ProtoReflect() protoreflect.Message {
mi := &file_xsvm_service_proto_msgTypes[0]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use PingRequest.ProtoReflect.Descriptor instead.
func (*PingRequest) Descriptor() ([]byte, []int) {
return file_xsvm_service_proto_rawDescGZIP(), []int{0}
}
func (x *PingRequest) GetMessage() string {
if x != nil {
return x.Message
}
return ""
}
type PingReply struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Message string `protobuf:"bytes,1,opt,name=message,proto3" json:"message,omitempty"`
}
func (x *PingReply) Reset() {
*x = PingReply{}
mi := &file_xsvm_service_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *PingReply) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*PingReply) ProtoMessage() {}
func (x *PingReply) ProtoReflect() protoreflect.Message {
mi := &file_xsvm_service_proto_msgTypes[1]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use PingReply.ProtoReflect.Descriptor instead.
func (*PingReply) Descriptor() ([]byte, []int) {
return file_xsvm_service_proto_rawDescGZIP(), []int{1}
}
func (x *PingReply) GetMessage() string {
if x != nil {
return x.Message
}
return ""
}
type StreamPingRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Message string `protobuf:"bytes,1,opt,name=message,proto3" json:"message,omitempty"`
}
func (x *StreamPingRequest) Reset() {
*x = StreamPingRequest{}
mi := &file_xsvm_service_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *StreamPingRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*StreamPingRequest) ProtoMessage() {}
func (x *StreamPingRequest) ProtoReflect() protoreflect.Message {
mi := &file_xsvm_service_proto_msgTypes[2]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use StreamPingRequest.ProtoReflect.Descriptor instead.
func (*StreamPingRequest) Descriptor() ([]byte, []int) {
return file_xsvm_service_proto_rawDescGZIP(), []int{2}
}
func (x *StreamPingRequest) GetMessage() string {
if x != nil {
return x.Message
}
return ""
}
type StreamPingReply struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Message string `protobuf:"bytes,1,opt,name=message,proto3" json:"message,omitempty"`
}
func (x *StreamPingReply) Reset() {
*x = StreamPingReply{}
mi := &file_xsvm_service_proto_msgTypes[3]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *StreamPingReply) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*StreamPingReply) ProtoMessage() {}
func (x *StreamPingReply) ProtoReflect() protoreflect.Message {
mi := &file_xsvm_service_proto_msgTypes[3]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use StreamPingReply.ProtoReflect.Descriptor instead.
func (*StreamPingReply) Descriptor() ([]byte, []int) {
return file_xsvm_service_proto_rawDescGZIP(), []int{3}
}
func (x *StreamPingReply) GetMessage() string {
if x != nil {
return x.Message
}
return ""
}
var File_xsvm_service_proto protoreflect.FileDescriptor
var file_xsvm_service_proto_rawDesc = []byte{
0x0a, 0x12, 0x78, 0x73, 0x76, 0x6d, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x70,
0x72, 0x6f, 0x74, 0x6f, 0x12, 0x04, 0x78, 0x73, 0x76, 0x6d, 0x22, 0x27, 0x0a, 0x0b, 0x50, 0x69,
0x6e, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x65, 0x73,
0x73, 0x61, 0x67, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73,
0x61, 0x67, 0x65, 0x22, 0x25, 0x0a, 0x09, 0x50, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x70, 0x6c, 0x79,
0x12, 0x18, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28,
0x09, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0x2d, 0x0a, 0x11, 0x53, 0x74,
0x72, 0x65, 0x61, 0x6d, 0x50, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12,
0x18, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09,
0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0x2b, 0x0a, 0x0f, 0x53, 0x74, 0x72,
0x65, 0x61, 0x6d, 0x50, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x18, 0x0a, 0x07,
0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6d,
0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x32, 0x74, 0x0a, 0x04, 0x50, 0x69, 0x6e, 0x67, 0x12, 0x2a,
0x0a, 0x04, 0x50, 0x69, 0x6e, 0x67, 0x12, 0x11, 0x2e, 0x78, 0x73, 0x76, 0x6d, 0x2e, 0x50, 0x69,
0x6e, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0f, 0x2e, 0x78, 0x73, 0x76, 0x6d,
0x2e, 0x50, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x40, 0x0a, 0x0a, 0x53, 0x74,
0x72, 0x65, 0x61, 0x6d, 0x50, 0x69, 0x6e, 0x67, 0x12, 0x17, 0x2e, 0x78, 0x73, 0x76, 0x6d, 0x2e,
0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x50, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
0x74, 0x1a, 0x15, 0x2e, 0x78, 0x73, 0x76, 0x6d, 0x2e, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x50,
0x69, 0x6e, 0x67, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x28, 0x01, 0x30, 0x01, 0x42, 0x2c, 0x5a, 0x2a,
0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6c, 0x75, 0x78, 0x66, 0x69,
0x2f, 0x6e, 0x6f, 0x64, 0x65, 0x2f, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x70, 0x72, 0x6f,
0x74, 0x6f, 0x2f, 0x70, 0x62, 0x2f, 0x78, 0x73, 0x76, 0x6d, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74,
0x6f, 0x33,
}
var (
file_xsvm_service_proto_rawDescOnce sync.Once
file_xsvm_service_proto_rawDescData = file_xsvm_service_proto_rawDesc
)
func file_xsvm_service_proto_rawDescGZIP() []byte {
file_xsvm_service_proto_rawDescOnce.Do(func() {
file_xsvm_service_proto_rawDescData = protoimpl.X.CompressGZIP(file_xsvm_service_proto_rawDescData)
})
return file_xsvm_service_proto_rawDescData
}
var file_xsvm_service_proto_msgTypes = make([]protoimpl.MessageInfo, 4)
var file_xsvm_service_proto_goTypes = []any{
(*PingRequest)(nil), // 0: xsvm.PingRequest
(*PingReply)(nil), // 1: xsvm.PingReply
(*StreamPingRequest)(nil), // 2: xsvm.StreamPingRequest
(*StreamPingReply)(nil), // 3: xsvm.StreamPingReply
}
var file_xsvm_service_proto_depIdxs = []int32{
0, // 0: xsvm.Ping.Ping:input_type -> xsvm.PingRequest
2, // 1: xsvm.Ping.StreamPing:input_type -> xsvm.StreamPingRequest
1, // 2: xsvm.Ping.Ping:output_type -> xsvm.PingReply
3, // 3: xsvm.Ping.StreamPing:output_type -> xsvm.StreamPingReply
2, // [2:4] is the sub-list for method output_type
0, // [0:2] is the sub-list for method input_type
0, // [0:0] is the sub-list for extension type_name
0, // [0:0] is the sub-list for extension extendee
0, // [0:0] is the sub-list for field type_name
}
func init() { file_xsvm_service_proto_init() }
func file_xsvm_service_proto_init() {
if File_xsvm_service_proto != nil {
return
}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_xsvm_service_proto_rawDesc,
NumEnums: 0,
NumMessages: 4,
NumExtensions: 0,
NumServices: 1,
},
GoTypes: file_xsvm_service_proto_goTypes,
DependencyIndexes: file_xsvm_service_proto_depIdxs,
MessageInfos: file_xsvm_service_proto_msgTypes,
}.Build()
File_xsvm_service_proto = out.File
file_xsvm_service_proto_rawDesc = nil
file_xsvm_service_proto_goTypes = nil
file_xsvm_service_proto_depIdxs = nil
}
@@ -1,138 +0,0 @@
//go:build grpc
// Code generated by protoc-gen-connect-go. DO NOT EDIT.
//
// Source: xsvm/service.proto
package xsvmconnect
import (
connect "connectrpc.com/connect"
context "context"
errors "errors"
xsvm "github.com/luxfi/node/connectproto/pb/xsvm"
http "net/http"
strings "strings"
)
// This is a compile-time assertion to ensure that this generated file and the connect package are
// compatible. If you get a compiler error that this constant is not defined, this code was
// generated with a version of connect newer than the one compiled into your binary. You can fix the
// problem by either regenerating this code with an older version of connect or updating the connect
// version compiled into your binary.
const _ = connect.IsAtLeastVersion1_13_0
const (
// PingName is the fully-qualified name of the Ping service.
PingName = "xsvm.Ping"
)
// These constants are the fully-qualified names of the RPCs defined in this package. They're
// exposed at runtime as Spec.Procedure and as the final two segments of the HTTP route.
//
// Note that these are different from the fully-qualified method names used by
// google.golang.org/protobuf/reflect/protoreflect. To convert from these constants to
// reflection-formatted method names, remove the leading slash and convert the remaining slash to a
// period.
const (
// PingPingProcedure is the fully-qualified name of the Ping's Ping RPC.
PingPingProcedure = "/xsvm.Ping/Ping"
// PingStreamPingProcedure is the fully-qualified name of the Ping's StreamPing RPC.
PingStreamPingProcedure = "/xsvm.Ping/StreamPing"
)
// PingClient is a client for the xsvm.Ping service.
type PingClient interface {
Ping(context.Context, *connect.Request[xsvm.PingRequest]) (*connect.Response[xsvm.PingReply], error)
StreamPing(context.Context) *connect.BidiStreamForClient[xsvm.StreamPingRequest, xsvm.StreamPingReply]
}
// NewPingClient constructs a client for the xsvm.Ping service. By default, it uses the Connect
// protocol with the binary Protobuf Codec, asks for gzipped responses, and sends uncompressed
// requests. To use the gRPC or gRPC-Web protocols, supply the connect.WithGRPC() or
// connect.WithGRPCWeb() options.
//
// The URL supplied here should be the base URL for the Connect or gRPC server (for example,
// http://api.acme.com or https://acme.com/grpc).
func NewPingClient(httpClient connect.HTTPClient, baseURL string, opts ...connect.ClientOption) PingClient {
baseURL = strings.TrimRight(baseURL, "/")
pingMethods := xsvm.File_xsvm_service_proto.Services().ByName("Ping").Methods()
return &pingClient{
ping: connect.NewClient[xsvm.PingRequest, xsvm.PingReply](
httpClient,
baseURL+PingPingProcedure,
connect.WithSchema(pingMethods.ByName("Ping")),
connect.WithClientOptions(opts...),
),
streamPing: connect.NewClient[xsvm.StreamPingRequest, xsvm.StreamPingReply](
httpClient,
baseURL+PingStreamPingProcedure,
connect.WithSchema(pingMethods.ByName("StreamPing")),
connect.WithClientOptions(opts...),
),
}
}
// pingClient implements PingClient.
type pingClient struct {
ping *connect.Client[xsvm.PingRequest, xsvm.PingReply]
streamPing *connect.Client[xsvm.StreamPingRequest, xsvm.StreamPingReply]
}
// Ping calls xsvm.Ping.Ping.
func (c *pingClient) Ping(ctx context.Context, req *connect.Request[xsvm.PingRequest]) (*connect.Response[xsvm.PingReply], error) {
return c.ping.CallUnary(ctx, req)
}
// StreamPing calls xsvm.Ping.StreamPing.
func (c *pingClient) StreamPing(ctx context.Context) *connect.BidiStreamForClient[xsvm.StreamPingRequest, xsvm.StreamPingReply] {
return c.streamPing.CallBidiStream(ctx)
}
// PingHandler is an implementation of the xsvm.Ping service.
type PingHandler interface {
Ping(context.Context, *connect.Request[xsvm.PingRequest]) (*connect.Response[xsvm.PingReply], error)
StreamPing(context.Context, *connect.BidiStream[xsvm.StreamPingRequest, xsvm.StreamPingReply]) error
}
// NewPingHandler builds an HTTP handler from the service implementation. It returns the path on
// which to mount the handler and the handler itself.
//
// By default, handlers support the Connect, gRPC, and gRPC-Web protocols with the binary Protobuf
// and JSON codecs. They also support gzip compression.
func NewPingHandler(svc PingHandler, opts ...connect.HandlerOption) (string, http.Handler) {
pingMethods := xsvm.File_xsvm_service_proto.Services().ByName("Ping").Methods()
pingPingHandler := connect.NewUnaryHandler(
PingPingProcedure,
svc.Ping,
connect.WithSchema(pingMethods.ByName("Ping")),
connect.WithHandlerOptions(opts...),
)
pingStreamPingHandler := connect.NewBidiStreamHandler(
PingStreamPingProcedure,
svc.StreamPing,
connect.WithSchema(pingMethods.ByName("StreamPing")),
connect.WithHandlerOptions(opts...),
)
return "/xsvm.Ping/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
switch r.URL.Path {
case PingPingProcedure:
pingPingHandler.ServeHTTP(w, r)
case PingStreamPingProcedure:
pingStreamPingHandler.ServeHTTP(w, r)
default:
http.NotFound(w, r)
}
})
}
// UnimplementedPingHandler returns CodeUnimplemented from all methods.
type UnimplementedPingHandler struct{}
func (UnimplementedPingHandler) Ping(context.Context, *connect.Request[xsvm.PingRequest]) (*connect.Response[xsvm.PingReply], error) {
return nil, connect.NewError(connect.CodeUnimplemented, errors.New("xsvm.Ping.Ping is not implemented"))
}
func (UnimplementedPingHandler) StreamPing(context.Context, *connect.BidiStream[xsvm.StreamPingRequest, xsvm.StreamPingReply]) error {
return connect.NewError(connect.CodeUnimplemented, errors.New("xsvm.Ping.StreamPing is not implemented"))
}
-26
View File
@@ -1,26 +0,0 @@
syntax = "proto3";
package xsvm;
option go_package = "github.com/luxfi/node/connectproto/pb/xsvm";
service Ping {
rpc Ping(PingRequest) returns (PingReply);
rpc StreamPing(stream StreamPingRequest) returns (stream StreamPingReply);
}
message PingRequest {
string message = 1;
}
message PingReply {
string message = 1;
}
message StreamPingRequest {
string message = 1;
}
message StreamPingReply {
string message = 1;
}
+1 -1
View File
@@ -9,9 +9,9 @@ import (
"go.uber.org/zap"
"github.com/luxfi/runtime"
"github.com/luxfi/ids"
"github.com/luxfi/log"
"github.com/luxfi/runtime"
)
var (
+14 -14
View File
@@ -68,32 +68,32 @@ type MLDSAWork struct {
// BlockVerifyWork contains all verification batches for a single block.
type BlockVerifyWork struct {
BLS *BLSWork
BLS *BLSWork
Corona *CoronaWork
ZK *ZKWork
MLDSA *MLDSAWork
ZK *ZKWork
MLDSA *MLDSAWork
}
// BlockVerifyResult contains verification results for all batch types.
type BlockVerifyResult struct {
BLSValid []bool
BLSValid []bool
CoronaValid []bool
ZKValid bool
MLDSAValid []bool
ZKValid bool
MLDSAValid []bool
GPUUsed bool
BLSTime time.Duration
GPUUsed bool
BLSTime time.Duration
CoronaTime time.Duration
ZKTime time.Duration
MLDSATime time.Duration
TotalTime time.Duration
ZKTime time.Duration
MLDSATime time.Duration
TotalTime time.Duration
}
var (
ErrBLSSizeMismatch = errors.New("BLS batch size mismatch: messages, signatures, and pubkeys must have equal length")
ErrBLSSizeMismatch = errors.New("BLS batch size mismatch: messages, signatures, and pubkeys must have equal length")
ErrCoronaSizeMismatch = errors.New("Corona batch size mismatch: messages, signatures, and pubkeys must have equal length")
ErrZKSizeMismatch = errors.New("ZK batch size mismatch: scalars and bases must have equal length")
ErrMLDSASizeMismatch = errors.New("ML-DSA batch size mismatch: messages, signatures, and pubkeys must have equal length")
ErrZKSizeMismatch = errors.New("ZK batch size mismatch: scalars and bases must have equal length")
ErrMLDSASizeMismatch = errors.New("ML-DSA batch size mismatch: messages, signatures, and pubkeys must have equal length")
)
// VerifyBlock dispatches all verification work for a block through the GPU pipeline.
+6 -6
View File
@@ -79,10 +79,10 @@ func TestGPUPipeline_AllFourTypes(t *testing.T) {
pipeline := NewGPUVerifyPipeline()
work := &BlockVerifyWork{
BLS: makeBLSWork(5),
BLS: makeBLSWork(5),
Corona: makeCoronaWork(3),
ZK: makeZKWork(2),
MLDSA: makeMLDSAWork(10),
ZK: makeZKWork(2),
MLDSA: makeMLDSAWork(10),
}
result, err := pipeline.VerifyBlock(work)
@@ -276,10 +276,10 @@ func BenchmarkGPUPipeline(b *testing.B) {
pipeline := NewGPUVerifyPipeline()
work := &BlockVerifyWork{
BLS: makeBLSWork(100),
BLS: makeBLSWork(100),
Corona: makeCoronaWork(50),
ZK: makeZKWork(10),
MLDSA: makeMLDSAWork(200),
ZK: makeZKWork(10),
MLDSA: makeMLDSAWork(200),
}
b.ResetTimer()
+19 -19
View File
@@ -116,11 +116,11 @@ func generateValidatorStates(n int) []ValidatorState {
_, _ = rand.Read(rtKey)
states[i] = ValidatorState{
NodeID: ids.GenerateTestNodeID(),
Weight: 1000,
BLSPubKey: blsKey,
NodeID: ids.GenerateTestNodeID(),
Weight: 1000,
BLSPubKey: blsKey,
CoronaKey: rtKey,
Active: true,
Active: true,
}
}
return states
@@ -575,13 +575,13 @@ func TestQuasarMemoryPressure(t *testing.T) {
_, _ = rand.Read(blockID[:])
finality := &QuantumFinality{
BlockID: blockID,
PChainHeight: uint64(i),
QChainHeight: uint64(i),
BLSProof: make([]byte, 96),
CoronaProof: make([]byte, 1024),
TotalWeight: 1000,
SignerWeight: 700,
BlockID: blockID,
PChainHeight: uint64(i),
QChainHeight: uint64(i),
BLSProof: make([]byte, 96),
CoronaProof: make([]byte, 1024),
TotalWeight: 1000,
SignerWeight: 700,
}
q.SetFinalized(blockID, finality)
}
@@ -913,10 +913,10 @@ func TestQuasarEdgeCases(t *testing.T) {
require.NoError(t, err)
finality := &QuantumFinality{
BLSProof: nil,
CoronaProof: nil,
TotalWeight: 1000,
SignerWeight: 700,
BLSProof: nil,
CoronaProof: nil,
TotalWeight: 1000,
SignerWeight: 700,
}
err = q.Verify(finality)
@@ -928,10 +928,10 @@ func TestQuasarEdgeCases(t *testing.T) {
require.NoError(t, err)
finality := &QuantumFinality{
BLSProof: []byte("proof"),
CoronaProof: []byte("proof"),
TotalWeight: 1000,
SignerWeight: 500, // Only 50%, needs 67%
BLSProof: []byte("proof"),
CoronaProof: []byte("proof"),
TotalWeight: 1000,
SignerWeight: 500, // Only 50%, needs 67%
}
err = q.Verify(finality)
+1 -1
View File
@@ -401,7 +401,7 @@ func TestConcurrentPruningStress(t *testing.T) {
require.NoError(t, err)
const (
numWriters = 8
numWriters = 8
opsPerWriter = 5000
)
+45 -45
View File
@@ -61,15 +61,15 @@ import (
// 2. t-of-n validators completed Corona threshold (post-quantum secure)
var (
ErrQuasarNotStarted = errors.New("quasar not started")
ErrPChainNotConnected = errors.New("P-Chain not connected")
ErrQChainNotConnected = errors.New("Q-Chain not connected")
ErrCoronaNotConnected = errors.New("Corona coordinator not connected")
ErrInsufficientWeight = errors.New("insufficient validator weight")
ErrInsufficientSigners = errors.New("insufficient Corona signers")
ErrFinalityFailed = errors.New("hybrid finality verification failed")
ErrBLSFailed = errors.New("BLS aggregation failed")
ErrCoronaFailed = errors.New("Corona threshold signing failed")
ErrQuasarNotStarted = errors.New("quasar not started")
ErrPChainNotConnected = errors.New("P-Chain not connected")
ErrQChainNotConnected = errors.New("Q-Chain not connected")
ErrCoronaNotConnected = errors.New("Corona coordinator not connected")
ErrInsufficientWeight = errors.New("insufficient validator weight")
ErrInsufficientSigners = errors.New("insufficient Corona signers")
ErrFinalityFailed = errors.New("hybrid finality verification failed")
ErrBLSFailed = errors.New("BLS aggregation failed")
ErrCoronaFailed = errors.New("Corona threshold signing failed")
)
// PChainProvider provides P-Chain state and finality events
@@ -87,11 +87,11 @@ type QuantumSignerFallback interface {
// ValidatorState represents a validator's current state
// Each validator has BOTH BLS and Corona keys
type ValidatorState struct {
NodeID ids.NodeID
Weight uint64
BLSPubKey []byte // BLS public key for aggregate signatures
NodeID ids.NodeID
Weight uint64
BLSPubKey []byte // BLS public key for aggregate signatures
CoronaKey []byte // Corona public key share for threshold sigs
Active bool
Active bool
}
// FinalityEvent represents a P-Chain finality event
@@ -104,18 +104,18 @@ type FinalityEvent struct {
// QuantumFinality represents a block that achieved hybrid quantum finality
type QuantumFinality struct {
BlockID ids.ID
PChainHeight uint64
QChainHeight uint64
BLSProof []byte // Aggregated BLS signature (96 bytes)
BlockID ids.ID
PChainHeight uint64
QChainHeight uint64
BLSProof []byte // Aggregated BLS signature (96 bytes)
CoronaProof []byte // Serialized Corona threshold signature
SignerBitset []byte // Which validators signed BLS
SignerBitset []byte // Which validators signed BLS
CoronaSigners []ids.NodeID // Which validators participated in Corona
TotalWeight uint64
SignerWeight uint64
BLSLatency time.Duration
TotalWeight uint64
SignerWeight uint64
BLSLatency time.Duration
CoronaLatency time.Duration
Timestamp time.Time
Timestamp time.Time
}
// Quasar binds P-Chain and Q-Chain consensus into hybrid quantum finality
@@ -369,18 +369,18 @@ func (q *Quasar) processFinality(ctx context.Context, event FinalityEvent) error
coronaProof = coronaSig.Bytes()
}
finality := &QuantumFinality{
BlockID: event.BlockID,
PChainHeight: event.Height,
QChainHeight: q.qHeight,
BLSProof: blsProof,
BlockID: event.BlockID,
PChainHeight: event.Height,
QChainHeight: q.qHeight,
BLSProof: blsProof,
CoronaProof: coronaProof,
SignerBitset: signerBitset,
SignerBitset: signerBitset,
CoronaSigners: coronaSigners,
TotalWeight: totalWeight,
SignerWeight: signerWeight,
BLSLatency: blsLatency,
TotalWeight: totalWeight,
SignerWeight: signerWeight,
BLSLatency: blsLatency,
CoronaLatency: coronaLatency,
Timestamp: time.Now(),
Timestamp: time.Now(),
}
q.finalized[event.BlockID] = finality
@@ -590,13 +590,13 @@ func (q *Quasar) Stats() QuasarStats {
}
return QuasarStats{
PChainHeight: q.pHeight,
QChainHeight: q.qHeight,
FinalizedBlocks: len(q.finalized),
Threshold: q.threshold,
QuorumNum: q.quorumNum,
QuorumDen: q.quorumDen,
Running: q.running,
PChainHeight: q.pHeight,
QChainHeight: q.qHeight,
FinalizedBlocks: len(q.finalized),
Threshold: q.threshold,
QuorumNum: q.quorumNum,
QuorumDen: q.quorumDen,
Running: q.running,
CoronaParties: coronaStats.NumParties,
CoronaThreshold: coronaStats.Threshold,
CoronaReady: coronaStats.Initialized,
@@ -605,13 +605,13 @@ func (q *Quasar) Stats() QuasarStats {
// QuasarStats contains quasar statistics
type QuasarStats struct {
PChainHeight uint64
QChainHeight uint64
FinalizedBlocks int
Threshold int
QuorumNum uint64
QuorumDen uint64
Running bool
PChainHeight uint64
QChainHeight uint64
FinalizedBlocks int
Threshold int
QuorumNum uint64
QuorumDen uint64
Running bool
CoronaParties int
CoronaThreshold int
CoronaReady bool
+2 -2
View File
@@ -181,7 +181,7 @@ func (s *BLSSignature) Signers() []ids.NodeID { return s.signers }
// QuasarSignature combines BLS and Corona signatures for P/Q security
type QuasarSignature struct {
bls *BLSSignature
bls *BLSSignature
corona *CoronaSignature
}
@@ -211,7 +211,7 @@ func (s *QuasarSignature) Signers() []ids.NodeID {
return s.bls.Signers()
}
func (s *QuasarSignature) BLS() *BLSSignature { return s.bls }
func (s *QuasarSignature) BLS() *BLSSignature { return s.bls }
func (s *QuasarSignature) Corona() *CoronaSignature { return s.corona }
// QuasarSigner combines classical and post-quantum signers
-21
View File
@@ -1,21 +0,0 @@
//go:build grpc
// Copyright (C) 2019-2025, Lux Industries Inc. All rights reserved.
// See the file LICENSE for licensing terms.
// Package rpcdb re-exports the proto/rpcdb package for backwards compatibility
package rpcdb
import "github.com/luxfi/node/proto/rpcdb"
// Type aliases for backwards compatibility
type (
DatabaseClient = rpcdb.DatabaseClient
DatabaseServer = rpcdb.DatabaseServer
)
// Function aliases for backwards compatibility
var (
NewClient = rpcdb.NewClient
NewServer = rpcdb.NewServer
)
+264
View File
@@ -0,0 +1,264 @@
// Copyright (C) 2019-2026, Lux Industries Inc. All rights reserved.
// See the file LICENSE for licensing terms.
// Package rpcdb is luxd's canonical Layer C home for the rpcdb service:
// one Service implementation backed by a database.Database, with a
// transport adapter per supported wire protocol.
//
// Layered topology:
//
// Layer A — wire framing (github.com/luxfi/api/zap)
// Layer B — service spec (data carriers) (github.com/luxfi/proto/rpcdb)
// Layer C — service impl + transports (this package)
//
// One Service. Many transport adapters. Adding a new transport is a
// new file that wraps `*Service`; the storage logic stays here and
// stays orthogonal to framing concerns.
//
// Files:
// - service.go (this) — transport-neutral Service struct + methods
// - grpc_server.go (build tag `grpc`) — gRPC adapter
// - zap_server.go (default) — ZAP adapter
package rpcdb
import (
"context"
"errors"
"sync"
"github.com/luxfi/database"
rpcdb "github.com/luxfi/proto/rpcdb"
)
// errUnknownIterator is the sentinel returned by IteratorNext / Error
// / Release when the caller hands in an iterator id that was never
// allocated (or has already been released). Transport adapters should
// surface this however their wire spec demands.
var errUnknownIterator = errors.New("rpcdb: unknown iterator")
// iterationBatchBytes is the upper bound on bytes batched into a
// single IteratorNext response. Picked to match the cevm-side
// expectation (RemoteZapDB::iterator_next reads up to ~128 KiB per
// roundtrip).
const iterationBatchBytes = 128 * 1024
// Service is the rpcdb service implementation. It holds one
// `database.Database` and a server-managed iterator pool, and exposes
// every rpcdb operation as a (request → response) method on Go data
// carriers from the proto/rpcdb wire-types package.
//
// Service is transport-agnostic: it knows nothing about gRPC, ZAP, or
// any other framing. Each transport adapter wraps `*Service` and
// translates its own wire format into these method calls.
type Service struct {
db database.Database
// iteratorMu serializes mutations of nextIteratorID and iterators.
// It does NOT serialize calls to a particular iterator — the
// underlying database.Iterator is documented as not safe for
// concurrent use, and the caller is expected to respect that.
iteratorMu sync.RWMutex
nextIteratorID uint64
iterators map[uint64]database.Iterator
}
// NewService wraps `db` so it can be served over any transport.
func NewService(db database.Database) *Service {
return &Service{
db: db,
iterators: make(map[uint64]database.Iterator),
}
}
// DB returns the underlying database. Adapters that need to surface
// transport-specific behavior (eg. health-check serialization) can
// reach in for it; everyone else uses the methods.
func (s *Service) DB() database.Database {
return s.db
}
// CloseIterators releases every server-side iterator. Adapters call
// this on shutdown so iterators don't leak past the listener.
func (s *Service) CloseIterators() {
s.iteratorMu.Lock()
defer s.iteratorMu.Unlock()
for id, it := range s.iterators {
it.Release()
delete(s.iterators, id)
}
}
// errToCode maps a database error to the wire enum.
func errToCode(err error) rpcdb.Error {
switch {
case err == nil:
return rpcdb.Error_ERROR_UNSPECIFIED
case errors.Is(err, database.ErrNotFound):
return rpcdb.Error_ERROR_NOT_FOUND
case errors.Is(err, database.ErrClosed):
return rpcdb.Error_ERROR_CLOSED
default:
// Any other error is reported as CLOSED on the wire — the
// proto enum doesn't have a richer error space. Adapters that
// can carry a transport-level error message should also pass
// the original err out-of-band.
return rpcdb.Error_ERROR_CLOSED
}
}
// CodeToErr maps a wire-typed Error back to a database sentinel. Used
// by remote clients on the receive side; lives here so server and
// client agree on the inverse of errToCode.
func CodeToErr(code rpcdb.Error) error {
switch code {
case rpcdb.Error_ERROR_UNSPECIFIED:
return nil
case rpcdb.Error_ERROR_NOT_FOUND:
return database.ErrNotFound
case rpcdb.Error_ERROR_CLOSED:
return database.ErrClosed
default:
return database.ErrClosed
}
}
// Has services rpcdb.Has.
func (s *Service) Has(_ context.Context, req *rpcdb.HasRequest) (*rpcdb.HasResponse, error) {
has, err := s.db.Has(req.Key)
if err != nil {
return &rpcdb.HasResponse{Has: false, Err: errToCode(err)}, nil
}
return &rpcdb.HasResponse{Has: has, Err: rpcdb.Error_ERROR_UNSPECIFIED}, nil
}
// Get services rpcdb.Get.
func (s *Service) Get(_ context.Context, req *rpcdb.GetRequest) (*rpcdb.GetResponse, error) {
value, err := s.db.Get(req.Key)
if err != nil {
return &rpcdb.GetResponse{Value: nil, Err: errToCode(err)}, nil
}
return &rpcdb.GetResponse{Value: value, Err: rpcdb.Error_ERROR_UNSPECIFIED}, nil
}
// Put services rpcdb.Put.
func (s *Service) Put(_ context.Context, req *rpcdb.PutRequest) (*rpcdb.PutResponse, error) {
return &rpcdb.PutResponse{Err: errToCode(s.db.Put(req.Key, req.Value))}, nil
}
// Delete services rpcdb.Delete.
func (s *Service) Delete(_ context.Context, req *rpcdb.DeleteRequest) (*rpcdb.DeleteResponse, error) {
return &rpcdb.DeleteResponse{Err: errToCode(s.db.Delete(req.Key))}, nil
}
// WriteBatch services rpcdb.WriteBatch.
func (s *Service) WriteBatch(_ context.Context, req *rpcdb.WriteBatchRequest) (*rpcdb.WriteBatchResponse, error) {
batch := s.db.NewBatch()
for _, p := range req.Puts {
if err := batch.Put(p.Key, p.Value); err != nil {
return &rpcdb.WriteBatchResponse{Err: errToCode(err)}, nil
}
}
for _, d := range req.Deletes {
if err := batch.Delete(d.Key); err != nil {
return &rpcdb.WriteBatchResponse{Err: errToCode(err)}, nil
}
}
return &rpcdb.WriteBatchResponse{Err: errToCode(batch.Write())}, nil
}
// Compact services rpcdb.Compact.
func (s *Service) Compact(_ context.Context, req *rpcdb.CompactRequest) (*rpcdb.CompactResponse, error) {
return &rpcdb.CompactResponse{Err: errToCode(s.db.Compact(req.Start, req.Limit))}, nil
}
// Close services rpcdb.Close.
func (s *Service) Close(_ context.Context, _ *rpcdb.CloseRequest) (*rpcdb.CloseResponse, error) {
return &rpcdb.CloseResponse{Err: errToCode(s.db.Close())}, nil
}
// HealthCheck services rpcdb.HealthCheck.
func (s *Service) HealthCheck(ctx context.Context) (*rpcdb.HealthCheckResponse, error) {
health, err := s.db.HealthCheck(ctx)
if err != nil {
return &rpcdb.HealthCheckResponse{Details: []byte(err.Error())}, nil
}
details := []byte("healthy")
if health != nil {
if str, ok := health.(string); ok {
details = []byte(str)
}
}
return &rpcdb.HealthCheckResponse{Details: details}, nil
}
// NewIteratorWithStartAndPrefix services rpcdb.NewIteratorWithStartAndPrefix.
func (s *Service) NewIteratorWithStartAndPrefix(_ context.Context, req *rpcdb.NewIteratorWithStartAndPrefixRequest) (*rpcdb.NewIteratorWithStartAndPrefixResponse, error) {
it := s.db.NewIteratorWithStartAndPrefix(req.Start, req.Prefix)
s.iteratorMu.Lock()
id := s.nextIteratorID
s.nextIteratorID++
s.iterators[id] = it
s.iteratorMu.Unlock()
return &rpcdb.NewIteratorWithStartAndPrefixResponse{Id: id}, nil
}
// IteratorNext services rpcdb.IteratorNext, returning up to
// iterationBatchBytes worth of (key, value) pairs per call. An empty
// Data slice signals exhaustion.
//
// Returned bytes are deep-copied so the caller can hold them past the
// next iterator advance; the underlying database.Iterator is allowed
// to recycle its internal buffers.
func (s *Service) IteratorNext(_ context.Context, req *rpcdb.IteratorNextRequest) (*rpcdb.IteratorNextResponse, error) {
s.iteratorMu.RLock()
it, ok := s.iterators[req.Id]
s.iteratorMu.RUnlock()
if !ok {
return nil, errUnknownIterator
}
var (
size int
data []*rpcdb.PutRequest
)
for size < iterationBatchBytes && it.Next() {
k := it.Key()
v := it.Value()
size += len(k) + len(v)
kc := make([]byte, len(k))
copy(kc, k)
vc := make([]byte, len(v))
copy(vc, v)
data = append(data, &rpcdb.PutRequest{Key: kc, Value: vc})
}
return &rpcdb.IteratorNextResponse{Data: data}, nil
}
// IteratorError services rpcdb.IteratorError.
func (s *Service) IteratorError(_ context.Context, req *rpcdb.IteratorErrorRequest) (*rpcdb.IteratorErrorResponse, error) {
s.iteratorMu.RLock()
it, ok := s.iterators[req.Id]
s.iteratorMu.RUnlock()
if !ok {
return &rpcdb.IteratorErrorResponse{Err: rpcdb.Error_ERROR_NOT_FOUND}, nil
}
return &rpcdb.IteratorErrorResponse{Err: errToCode(it.Error())}, nil
}
// IteratorRelease services rpcdb.IteratorRelease. Idempotent: calling
// it twice for the same id returns UNSPECIFIED on the second call.
func (s *Service) IteratorRelease(_ context.Context, req *rpcdb.IteratorReleaseRequest) (*rpcdb.IteratorReleaseResponse, error) {
s.iteratorMu.Lock()
it, ok := s.iterators[req.Id]
if !ok {
s.iteratorMu.Unlock()
return &rpcdb.IteratorReleaseResponse{Err: rpcdb.Error_ERROR_UNSPECIFIED}, nil
}
delete(s.iterators, req.Id)
s.iteratorMu.Unlock()
dbErr := it.Error()
it.Release()
return &rpcdb.IteratorReleaseResponse{Err: errToCode(dbErr)}, nil
}
+407
View File
@@ -0,0 +1,407 @@
// Copyright (C) 2019-2026, Lux Industries Inc. All rights reserved.
// See the file LICENSE for licensing terms.
package rpcdb
import (
"context"
"errors"
"fmt"
"net"
"sync"
zapwire "github.com/luxfi/api/zap"
"github.com/luxfi/database"
rpcdb "github.com/luxfi/proto/rpcdb"
)
// ZAP db channel MsgType IDs. These are the wire-level Layer-A
// dispatch tags for the rpcdb service over ZAP. They live in their
// own listener (one per VM plugin); they do NOT collide with the VM
// lifecycle MsgTypes (1..31) or sender (40..49) or warp (50..59)
// because each listener has its own dispatch table.
//
// Order is the canonical Lane A assignment — the cevm side hard-codes
// these numbers in `RemoteZapDB::call`. Do not reorder.
const (
MsgDBHas zapwire.MessageType = 1
MsgDBGet zapwire.MessageType = 2
MsgDBPut zapwire.MessageType = 3
MsgDBDelete zapwire.MessageType = 4
MsgDBWriteBatch zapwire.MessageType = 5
MsgDBCompact zapwire.MessageType = 6
MsgDBClose zapwire.MessageType = 7
MsgDBHealthCheck zapwire.MessageType = 8
MsgDBIteratorNew zapwire.MessageType = 9
MsgDBIteratorNext zapwire.MessageType = 10
MsgDBIteratorError zapwire.MessageType = 11
MsgDBIteratorRelease zapwire.MessageType = 12
)
// Wire-byte values for the Error enum. These match
// rpcdb.Error_ERROR_* but are encoded as a single byte on the ZAP
// wire so the cevm side can decode them without pulling in protobuf.
const (
dbErrUnspecified uint8 = 0
dbErrClosed uint8 = 1
dbErrNotFound uint8 = 2
)
func errCodeToByte(code rpcdb.Error) uint8 {
switch code {
case rpcdb.Error_ERROR_CLOSED:
return dbErrClosed
case rpcdb.Error_ERROR_NOT_FOUND:
return dbErrNotFound
default:
return dbErrUnspecified
}
}
// ZAPServer is the ZAP transport adapter for the rpcdb Service. It
// owns the listener and the dispatch loop; the actual storage logic
// lives in *Service. To swap the wire format (eg. to add framing
// over a different reliable byte stream) write a new file with a new
// adapter — never edit Service.
type ZAPServer struct {
svc *Service
listener *zapwire.Listener
server *zapwire.Server
// closeOnce guards Close so callers can call it from both the
// client lifecycle and a deferred test cleanup without panicking
// on a double-close of the underlying listener.
closeOnce sync.Once
}
// NewZAPServer wraps a database.Database for serving over ZAP.
//
// Equivalent to NewZAPServerFromService(NewService(db)) — kept as a
// one-liner because cevm-side test fixtures and the production
// rpcchainvm/zap path both build it this way.
func NewZAPServer(db database.Database) *ZAPServer {
return NewZAPServerFromService(NewService(db))
}
// NewZAPServerFromService wraps an existing Service for serving over
// ZAP. Useful when a single Service needs multiple transport adapters
// at once (eg. tests that want both ZAP and direct in-process calls).
func NewZAPServerFromService(svc *Service) *ZAPServer {
return &ZAPServer{svc: svc}
}
// Listen binds the ZAP listener to addr.
func (s *ZAPServer) Listen(addr string) error {
listener, err := zapwire.Listen(addr, nil)
if err != nil {
return fmt.Errorf("rpcdb zap: listen %s: %w", addr, err)
}
s.listener = listener
s.server = zapwire.NewServer(listener, zapwire.HandlerFunc(s.handle))
return nil
}
// ListenOn wraps an existing net.Listener (for ephemeral ports etc.).
func (s *ZAPServer) ListenOn(raw net.Listener) {
s.listener = zapwire.NewListener(raw, nil)
s.server = zapwire.NewServer(s.listener, zapwire.HandlerFunc(s.handle))
}
// Addr returns the bound address (or nil if not yet listening).
func (s *ZAPServer) Addr() net.Addr {
if s.listener == nil {
return nil
}
return s.listener.Addr()
}
// Serve blocks until ctx is cancelled or Close is called.
func (s *ZAPServer) Serve(ctx context.Context) error {
if s.server == nil {
return errors.New("rpcdb zap: not initialized — call Listen first")
}
return s.server.Serve(ctx)
}
// Close releases all iterators and closes the listener. Caller is
// expected to also cancel the context passed to Serve so the accept
// loop exits cleanly. Safe to call multiple times.
//
// We deliberately do NOT call s.server.Close() because the upstream
// zapwire.Server.Close races with in-flight accept (it nils its conns
// map mid-Serve, causing "assignment to entry in nil map"). Closing
// the listener is enough to make Accept return; ctx cancellation does
// the rest.
func (s *ZAPServer) Close() error {
var err error
s.closeOnce.Do(func() {
s.svc.CloseIterators()
if s.listener != nil {
err = s.listener.Close()
}
})
return err
}
func (s *ZAPServer) handle(ctx context.Context, msgType zapwire.MessageType, payload []byte) (zapwire.MessageType, []byte, error) {
switch msgType {
case MsgDBHas:
return s.handleHas(ctx, payload)
case MsgDBGet:
return s.handleGet(ctx, payload)
case MsgDBPut:
return s.handlePut(ctx, payload)
case MsgDBDelete:
return s.handleDelete(ctx, payload)
case MsgDBWriteBatch:
return s.handleWriteBatch(ctx, payload)
case MsgDBCompact:
return s.handleCompact(ctx, payload)
case MsgDBClose:
return s.handleClose(ctx, payload)
case MsgDBHealthCheck:
return s.handleHealthCheck(ctx)
case MsgDBIteratorNew:
return s.handleIteratorNew(ctx, payload)
case MsgDBIteratorNext:
return s.handleIteratorNext(ctx, payload)
case MsgDBIteratorError:
return s.handleIteratorError(ctx, payload)
case MsgDBIteratorRelease:
return s.handleIteratorRelease(ctx, payload)
default:
return 0, nil, fmt.Errorf("rpcdb zap: unknown msg type %d", msgType)
}
}
func (s *ZAPServer) handleHas(ctx context.Context, payload []byte) (zapwire.MessageType, []byte, error) {
r := zapwire.NewReader(payload)
key, err := r.ReadBytes()
if err != nil {
return 0, nil, fmt.Errorf("rpcdb Has decode: %w", err)
}
resp, err := s.svc.Has(ctx, &rpcdb.HasRequest{Key: key})
if err != nil {
return 0, nil, err
}
buf := zapwire.GetBuffer()
defer zapwire.PutBuffer(buf)
if resp.Has {
buf.WriteUint8(1)
} else {
buf.WriteUint8(0)
}
buf.WriteUint8(errCodeToByte(resp.Err))
return MsgDBHas, append([]byte(nil), buf.Bytes()...), nil
}
func (s *ZAPServer) handleGet(ctx context.Context, payload []byte) (zapwire.MessageType, []byte, error) {
r := zapwire.NewReader(payload)
key, err := r.ReadBytes()
if err != nil {
return 0, nil, fmt.Errorf("rpcdb Get decode: %w", err)
}
resp, err := s.svc.Get(ctx, &rpcdb.GetRequest{Key: key})
if err != nil {
return 0, nil, err
}
buf := zapwire.GetBuffer()
defer zapwire.PutBuffer(buf)
buf.WriteBytes(resp.Value)
buf.WriteUint8(errCodeToByte(resp.Err))
return MsgDBGet, append([]byte(nil), buf.Bytes()...), nil
}
func (s *ZAPServer) handlePut(ctx context.Context, payload []byte) (zapwire.MessageType, []byte, error) {
r := zapwire.NewReader(payload)
key, err := r.ReadBytes()
if err != nil {
return 0, nil, fmt.Errorf("rpcdb Put decode key: %w", err)
}
value, err := r.ReadBytes()
if err != nil {
return 0, nil, fmt.Errorf("rpcdb Put decode value: %w", err)
}
resp, err := s.svc.Put(ctx, &rpcdb.PutRequest{Key: key, Value: value})
if err != nil {
return 0, nil, err
}
buf := zapwire.GetBuffer()
defer zapwire.PutBuffer(buf)
buf.WriteUint8(errCodeToByte(resp.Err))
return MsgDBPut, append([]byte(nil), buf.Bytes()...), nil
}
func (s *ZAPServer) handleDelete(ctx context.Context, payload []byte) (zapwire.MessageType, []byte, error) {
r := zapwire.NewReader(payload)
key, err := r.ReadBytes()
if err != nil {
return 0, nil, fmt.Errorf("rpcdb Delete decode: %w", err)
}
resp, err := s.svc.Delete(ctx, &rpcdb.DeleteRequest{Key: key})
if err != nil {
return 0, nil, err
}
buf := zapwire.GetBuffer()
defer zapwire.PutBuffer(buf)
buf.WriteUint8(errCodeToByte(resp.Err))
return MsgDBDelete, append([]byte(nil), buf.Bytes()...), nil
}
func (s *ZAPServer) handleWriteBatch(ctx context.Context, payload []byte) (zapwire.MessageType, []byte, error) {
r := zapwire.NewReader(payload)
nputs, err := r.ReadUint32()
if err != nil {
return 0, nil, fmt.Errorf("rpcdb WriteBatch decode nputs: %w", err)
}
puts := make([]*rpcdb.PutRequest, 0, nputs)
for i := uint32(0); i < nputs; i++ {
key, err := r.ReadBytes()
if err != nil {
return 0, nil, fmt.Errorf("rpcdb WriteBatch put[%d] key: %w", i, err)
}
value, err := r.ReadBytes()
if err != nil {
return 0, nil, fmt.Errorf("rpcdb WriteBatch put[%d] value: %w", i, err)
}
puts = append(puts, &rpcdb.PutRequest{Key: key, Value: value})
}
ndels, err := r.ReadUint32()
if err != nil {
return 0, nil, fmt.Errorf("rpcdb WriteBatch decode ndels: %w", err)
}
dels := make([]*rpcdb.DeleteRequest, 0, ndels)
for i := uint32(0); i < ndels; i++ {
key, err := r.ReadBytes()
if err != nil {
return 0, nil, fmt.Errorf("rpcdb WriteBatch del[%d]: %w", i, err)
}
dels = append(dels, &rpcdb.DeleteRequest{Key: key})
}
resp, err := s.svc.WriteBatch(ctx, &rpcdb.WriteBatchRequest{Puts: puts, Deletes: dels})
if err != nil {
return 0, nil, err
}
buf := zapwire.GetBuffer()
defer zapwire.PutBuffer(buf)
buf.WriteUint8(errCodeToByte(resp.Err))
return MsgDBWriteBatch, append([]byte(nil), buf.Bytes()...), nil
}
func (s *ZAPServer) handleCompact(ctx context.Context, payload []byte) (zapwire.MessageType, []byte, error) {
r := zapwire.NewReader(payload)
start, err := r.ReadBytes()
if err != nil {
return 0, nil, fmt.Errorf("rpcdb Compact decode start: %w", err)
}
limit, err := r.ReadBytes()
if err != nil {
return 0, nil, fmt.Errorf("rpcdb Compact decode limit: %w", err)
}
resp, err := s.svc.Compact(ctx, &rpcdb.CompactRequest{Start: start, Limit: limit})
if err != nil {
return 0, nil, err
}
buf := zapwire.GetBuffer()
defer zapwire.PutBuffer(buf)
buf.WriteUint8(errCodeToByte(resp.Err))
return MsgDBCompact, append([]byte(nil), buf.Bytes()...), nil
}
func (s *ZAPServer) handleClose(ctx context.Context, _ []byte) (zapwire.MessageType, []byte, error) {
resp, err := s.svc.Close(ctx, &rpcdb.CloseRequest{})
if err != nil {
return 0, nil, err
}
buf := zapwire.GetBuffer()
defer zapwire.PutBuffer(buf)
buf.WriteUint8(errCodeToByte(resp.Err))
return MsgDBClose, append([]byte(nil), buf.Bytes()...), nil
}
func (s *ZAPServer) handleHealthCheck(ctx context.Context) (zapwire.MessageType, []byte, error) {
resp, err := s.svc.HealthCheck(ctx)
if err != nil {
return 0, nil, err
}
buf := zapwire.GetBuffer()
defer zapwire.PutBuffer(buf)
buf.WriteBytes(resp.Details)
return MsgDBHealthCheck, append([]byte(nil), buf.Bytes()...), nil
}
func (s *ZAPServer) handleIteratorNew(ctx context.Context, payload []byte) (zapwire.MessageType, []byte, error) {
r := zapwire.NewReader(payload)
start, err := r.ReadBytes()
if err != nil {
return 0, nil, fmt.Errorf("rpcdb IteratorNew decode start: %w", err)
}
prefix, err := r.ReadBytes()
if err != nil {
return 0, nil, fmt.Errorf("rpcdb IteratorNew decode prefix: %w", err)
}
resp, err := s.svc.NewIteratorWithStartAndPrefix(ctx, &rpcdb.NewIteratorWithStartAndPrefixRequest{Start: start, Prefix: prefix})
if err != nil {
return 0, nil, err
}
buf := zapwire.GetBuffer()
defer zapwire.PutBuffer(buf)
buf.WriteUint64(resp.Id)
return MsgDBIteratorNew, append([]byte(nil), buf.Bytes()...), nil
}
func (s *ZAPServer) handleIteratorNext(ctx context.Context, payload []byte) (zapwire.MessageType, []byte, error) {
r := zapwire.NewReader(payload)
id, err := r.ReadUint64()
if err != nil {
return 0, nil, fmt.Errorf("rpcdb IteratorNext decode id: %w", err)
}
resp, err := s.svc.IteratorNext(ctx, &rpcdb.IteratorNextRequest{Id: id})
if err != nil {
return 0, nil, err
}
buf := zapwire.GetBuffer()
defer zapwire.PutBuffer(buf)
buf.WriteUint32(uint32(len(resp.Data)))
for _, e := range resp.Data {
buf.WriteBytes(e.Key)
buf.WriteBytes(e.Value)
}
return MsgDBIteratorNext, append([]byte(nil), buf.Bytes()...), nil
}
func (s *ZAPServer) handleIteratorError(ctx context.Context, payload []byte) (zapwire.MessageType, []byte, error) {
r := zapwire.NewReader(payload)
id, err := r.ReadUint64()
if err != nil {
return 0, nil, fmt.Errorf("rpcdb IteratorError decode id: %w", err)
}
resp, err := s.svc.IteratorError(ctx, &rpcdb.IteratorErrorRequest{Id: id})
if err != nil {
return 0, nil, err
}
buf := zapwire.GetBuffer()
defer zapwire.PutBuffer(buf)
buf.WriteUint8(errCodeToByte(resp.Err))
return MsgDBIteratorError, append([]byte(nil), buf.Bytes()...), nil
}
func (s *ZAPServer) handleIteratorRelease(ctx context.Context, payload []byte) (zapwire.MessageType, []byte, error) {
r := zapwire.NewReader(payload)
id, err := r.ReadUint64()
if err != nil {
return 0, nil, fmt.Errorf("rpcdb IteratorRelease decode id: %w", err)
}
resp, err := s.svc.IteratorRelease(ctx, &rpcdb.IteratorReleaseRequest{Id: id})
if err != nil {
return 0, nil, err
}
buf := zapwire.GetBuffer()
defer zapwire.PutBuffer(buf)
buf.WriteUint8(errCodeToByte(resp.Err))
return MsgDBIteratorRelease, append([]byte(nil), buf.Bytes()...), nil
}
+275
View File
@@ -0,0 +1,275 @@
// Copyright (C) 2019-2026, Lux Industries Inc. All rights reserved.
// See the file LICENSE for licensing terms.
package rpcdb
import (
"context"
"net"
"testing"
"time"
"github.com/stretchr/testify/require"
zapwire "github.com/luxfi/api/zap"
"github.com/luxfi/database"
"github.com/luxfi/database/memdb"
)
// startZAPServer spawns a ZAPServer over an in-memory listener bound to
// 127.0.0.1:0, returns the addr + the server (for shutdown).
func startZAPServer(t *testing.T, db database.Database) (string, *ZAPServer, context.CancelFunc) {
t.Helper()
listener, err := net.Listen("tcp", "127.0.0.1:0")
require.NoError(t, err)
s := NewZAPServer(db)
s.ListenOn(listener)
ctx, cancel := context.WithCancel(context.Background())
go func() {
_ = s.Serve(ctx)
}()
// Wait for Serve to fully install accept loop.
time.Sleep(50 * time.Millisecond)
return listener.Addr().String(), s, cancel
}
// TestZAPServer_HasGetPutDelete exercises the four primitive ops.
func TestZAPServer_HasGetPutDelete(t *testing.T) {
require := require.New(t)
mem := memdb.New()
addr, srv, cancel := startZAPServer(t, mem)
defer cancel()
defer srv.Close()
conn, err := zapwire.Dial(context.Background(), addr, nil)
require.NoError(err)
defer conn.Close()
ctx := context.Background()
// Has (key absent) → has=false, err=NotFound
{
buf := zapwire.GetBuffer()
buf.WriteBytes([]byte("foo"))
_, resp, err := conn.Call(ctx, MsgDBHas, buf.Bytes())
zapwire.PutBuffer(buf)
require.NoError(err)
r := zapwire.NewReader(resp)
hasB, _ := r.ReadUint8()
errB, _ := r.ReadUint8()
require.Equal(uint8(0), hasB)
require.Equal(dbErrUnspecified, errB) // memdb returns no err on Has-miss
}
// Put
{
buf := zapwire.GetBuffer()
buf.WriteBytes([]byte("foo"))
buf.WriteBytes([]byte("bar"))
_, resp, err := conn.Call(ctx, MsgDBPut, buf.Bytes())
zapwire.PutBuffer(buf)
require.NoError(err)
r := zapwire.NewReader(resp)
errB, _ := r.ReadUint8()
require.Equal(dbErrUnspecified, errB)
}
// Has (key present) → has=true
{
buf := zapwire.GetBuffer()
buf.WriteBytes([]byte("foo"))
_, resp, err := conn.Call(ctx, MsgDBHas, buf.Bytes())
zapwire.PutBuffer(buf)
require.NoError(err)
r := zapwire.NewReader(resp)
hasB, _ := r.ReadUint8()
errB, _ := r.ReadUint8()
require.Equal(uint8(1), hasB)
require.Equal(dbErrUnspecified, errB)
}
// Get
{
buf := zapwire.GetBuffer()
buf.WriteBytes([]byte("foo"))
_, resp, err := conn.Call(ctx, MsgDBGet, buf.Bytes())
zapwire.PutBuffer(buf)
require.NoError(err)
r := zapwire.NewReader(resp)
val, _ := r.ReadBytes()
errB, _ := r.ReadUint8()
require.Equal([]byte("bar"), val)
require.Equal(dbErrUnspecified, errB)
}
// Get (missing) → empty value, err=NotFound
{
buf := zapwire.GetBuffer()
buf.WriteBytes([]byte("absent"))
_, resp, err := conn.Call(ctx, MsgDBGet, buf.Bytes())
zapwire.PutBuffer(buf)
require.NoError(err)
r := zapwire.NewReader(resp)
val, _ := r.ReadBytes()
errB, _ := r.ReadUint8()
require.Empty(val)
require.Equal(dbErrNotFound, errB)
}
// Delete
{
buf := zapwire.GetBuffer()
buf.WriteBytes([]byte("foo"))
_, resp, err := conn.Call(ctx, MsgDBDelete, buf.Bytes())
zapwire.PutBuffer(buf)
require.NoError(err)
r := zapwire.NewReader(resp)
errB, _ := r.ReadUint8()
require.Equal(dbErrUnspecified, errB)
}
// Get post-delete → NotFound
{
buf := zapwire.GetBuffer()
buf.WriteBytes([]byte("foo"))
_, resp, err := conn.Call(ctx, MsgDBGet, buf.Bytes())
zapwire.PutBuffer(buf)
require.NoError(err)
r := zapwire.NewReader(resp)
_, _ = r.ReadBytes()
errB, _ := r.ReadUint8()
require.Equal(dbErrNotFound, errB)
}
}
// TestZAPServer_WriteBatch_AndIterate covers batched writes plus the
// iterator path used by cevm's load_persisted snapshot_with_prefix.
func TestZAPServer_WriteBatch_AndIterate(t *testing.T) {
require := require.New(t)
mem := memdb.New()
addr, srv, cancel := startZAPServer(t, mem)
defer cancel()
defer srv.Close()
conn, err := zapwire.Dial(context.Background(), addr, nil)
require.NoError(err)
defer conn.Close()
ctx := context.Background()
// WriteBatch: 3 puts (prefix p:), 1 delete (no-op since absent).
{
buf := zapwire.GetBuffer()
buf.WriteUint32(3)
buf.WriteBytes([]byte("p:1"))
buf.WriteBytes([]byte("v1"))
buf.WriteBytes([]byte("p:2"))
buf.WriteBytes([]byte("v2"))
buf.WriteBytes([]byte("q:3"))
buf.WriteBytes([]byte("v3"))
buf.WriteUint32(1)
buf.WriteBytes([]byte("absent"))
_, resp, err := conn.Call(ctx, MsgDBWriteBatch, buf.Bytes())
zapwire.PutBuffer(buf)
require.NoError(err)
r := zapwire.NewReader(resp)
errB, _ := r.ReadUint8()
require.Equal(dbErrUnspecified, errB)
}
// IteratorNew with prefix "p:"
var iterID uint64
{
buf := zapwire.GetBuffer()
buf.WriteBytes(nil) // start
buf.WriteBytes([]byte("p:")) // prefix
_, resp, err := conn.Call(ctx, MsgDBIteratorNew, buf.Bytes())
zapwire.PutBuffer(buf)
require.NoError(err)
r := zapwire.NewReader(resp)
iterID, _ = r.ReadUint64()
}
// IteratorNext — collect.
collected := map[string]string{}
for {
buf := zapwire.GetBuffer()
buf.WriteUint64(iterID)
_, resp, err := conn.Call(ctx, MsgDBIteratorNext, buf.Bytes())
zapwire.PutBuffer(buf)
require.NoError(err)
r := zapwire.NewReader(resp)
n, _ := r.ReadUint32()
if n == 0 {
break
}
for i := uint32(0); i < n; i++ {
k, _ := r.ReadBytes()
v, _ := r.ReadBytes()
collected[string(k)] = string(v)
}
}
// IteratorRelease
{
buf := zapwire.GetBuffer()
buf.WriteUint64(iterID)
_, resp, err := conn.Call(ctx, MsgDBIteratorRelease, buf.Bytes())
zapwire.PutBuffer(buf)
require.NoError(err)
r := zapwire.NewReader(resp)
errB, _ := r.ReadUint8()
require.Equal(dbErrUnspecified, errB)
}
require.Equal(map[string]string{"p:1": "v1", "p:2": "v2"}, collected)
}
// TestZAPServer_ParityWithMemDB writes/reads via wire and via direct
// memdb Get to confirm both paths see the same state — proves the ZAP
// round-trip preserves bytes exactly.
func TestZAPServer_ParityWithMemDB(t *testing.T) {
require := require.New(t)
mem := memdb.New()
addr, srv, cancel := startZAPServer(t, mem)
defer cancel()
defer srv.Close()
conn, err := zapwire.Dial(context.Background(), addr, nil)
require.NoError(err)
defer conn.Close()
ctx := context.Background()
key := []byte{0x42, 0x00, 0x01, 0xff}
value := make([]byte, 256)
for i := range value {
value[i] = byte(i)
}
// Put via wire.
buf := zapwire.GetBuffer()
buf.WriteBytes(key)
buf.WriteBytes(value)
_, _, err = conn.Call(ctx, MsgDBPut, buf.Bytes())
zapwire.PutBuffer(buf)
require.NoError(err)
// Read directly.
got, dErr := mem.Get(key)
require.NoError(dErr)
require.Equal(value, got)
// Read via wire.
buf2 := zapwire.GetBuffer()
buf2.WriteBytes(key)
_, resp, err := conn.Call(ctx, MsgDBGet, buf2.Bytes())
zapwire.PutBuffer(buf2)
require.NoError(err)
r := zapwire.NewReader(resp)
wireVal, _ := r.ReadBytes()
require.Equal(value, wireVal)
}
+7 -7
View File
@@ -7,9 +7,9 @@ import (
"testing"
"github.com/luxfi/consensus/utils/set"
validators "github.com/luxfi/validators"
"github.com/luxfi/constants"
"github.com/luxfi/ids"
validators "github.com/luxfi/validators"
)
func TestFullValidatorFunctionality(t *testing.T) {
@@ -152,14 +152,14 @@ func TestNetworkConfiguration(t *testing.T) {
}
func TestXAssetID(t *testing.T) {
// Verify XAssetID is used for native asset
xAssetID := ids.Empty // Our implementation uses Empty ID for native asset
// Verify UTXOAssetID is used for native asset
utxoAssetID := ids.Empty // Our implementation uses Empty ID for native asset
if xAssetID != ids.Empty {
t.Fatal("XAssetID should be Empty for native asset")
if utxoAssetID != ids.Empty {
t.Fatal("UTXOAssetID should be Empty for native asset")
}
t.Log("✓ XAssetID verified for native LUX asset")
t.Log("✓ UTXOAssetID verified for native LUX asset")
}
func TestConsensusConfig(t *testing.T) {
@@ -319,7 +319,7 @@ func TestSummary(t *testing.T) {
t.Log("✓ Validator Manager: PASS")
t.Log("✓ Network Configuration: PASS")
t.Log("✓ Consensus Parameters: PASS")
t.Log("✓ XAssetID Configuration: PASS")
t.Log("✓ UTXOAssetID Configuration: PASS")
t.Log("✓ Validator Lifecycle: PASS")
t.Log("✓ Validator Set Interface: PASS")
t.Log("----------------------------------------")
+1 -1
View File
@@ -4,9 +4,9 @@
package debug
import (
validators "github.com/luxfi/validators"
"github.com/luxfi/constants"
"github.com/luxfi/ids"
validators "github.com/luxfi/validators"
"testing"
)
+6 -6
View File
@@ -1,6 +1,6 @@
#!/bin/bash
# Deploy all 4 subnet chains (Zoo, Hanzo, SPC, Pars) to mainnet + testnet
# Usage: ./deploy-subnets.sh [mainnet|testnet|devnet|both]
# Deploy all 4 app chains (Zoo, Hanzo, SPC, Pars) to mainnet + testnet
# Usage: ./deploy-chains.sh [mainnet|testnet|devnet|both]
#
# Prerequisites:
# - macOS keychain must have mainnet-key-02 key (will prompt for approval)
@@ -21,7 +21,7 @@ if [ ! -f "$DEPLOY_BIN" ]; then
fi
# Use mainnet-key-02 (NOT 01!) because 01's funds are all staked by initialStakers
# mainnet-key-02 has 70M LUX unlocked on P-chain, sufficient for subnet creation
# mainnet-key-02 has 70M LUX unlocked on P-chain, sufficient for chain creation
KEY_NAME="mainnet-key-02"
echo "Extracting $KEY_NAME from keychain..."
echo "(Approve the macOS keychain dialog that appears)"
@@ -39,10 +39,10 @@ deploy_network() {
local network=$1
echo ""
echo "=============================="
echo "Deploying subnets to $network"
echo "Deploying chains to $network"
echo "=============================="
LUX_PRIVATE_KEY="$KEY" "$DEPLOY_BIN" \
PRIVATE_KEY="$KEY" "$DEPLOY_BIN" \
--network="$network" \
--state-dir="$STATE_DIR" 2>&1
@@ -77,7 +77,7 @@ echo ""
echo "All deployments complete!"
echo ""
echo "Next steps:"
echo " 1. Copy the Subnet IDs and Blockchain IDs from output above"
echo " 1. Copy the Chain IDs and Blockchain IDs from output above"
echo " 2. Update Helm values files:"
echo " ~/work/lux/devops/charts/lux/values-mainnet.yaml"
echo " ~/work/lux/devops/charts/lux/values-testnet.yaml"
+1 -1
View File
@@ -1,5 +1,5 @@
# Build stage
FROM golang:1.26-alpine AS builder
FROM golang:1.26.3-alpine AS builder
RUN apk add --no-cache git make gcc musl-dev linux-headers bash
+1 -1
View File
@@ -1,5 +1,5 @@
# Multi-chain node builder
FROM golang:1.26-alpine AS builder
FROM golang:1.26.3-alpine AS builder
ARG CHAIN_TYPE=platform
+1 -1
View File
@@ -1,4 +1,4 @@
FROM golang:1.26-alpine AS builder
FROM golang:1.26.3-alpine AS builder
RUN apk add --no-cache git make gcc musl-dev linux-headers bash
+4 -4
View File
@@ -140,8 +140,8 @@ else
{
"allocations": [
{
"luxAddr": "P-local1jfdgmqduuyuxjp9sq7szp08xpynav88sd7qxvv",
"ethAddr": "0x9011E888251AB053B7bD1cdB598Db4f9DEd94714",
"utxoAddr": "P-local1jfdgmqduuyuxjp9sq7szp08xpynav88sd7qxvv",
"evmAddr": "0x9011E888251AB053B7bD1cdB598Db4f9DEd94714",
"initialAmount": 1000000000000000000,
"unlockSchedule": []
}
@@ -167,8 +167,8 @@ EOF
{
"allocations": [
{
"luxAddr": "X-local1jfdgmqduuyuxjp9sq7szp08xpynav88sd7qxvv",
"ethAddr": "0x9011E888251AB053B7bD1cdB598Db4f9DEd94714",
"utxoAddr": "X-local1jfdgmqduuyuxjp9sq7szp08xpynav88sd7qxvv",
"evmAddr": "0x9011E888251AB053B7bD1cdB598Db4f9DEd94714",
"initialAmount": 1000000000000000000,
"unlockSchedule": []
}
+2 -2
View File
@@ -55,9 +55,9 @@ func NewMultiNetworkNode() *MultiNetworkNode {
ChainID: "2JVSBoinj9C2J33VntvzYtVJNZdN2NKiwwKjcumHUWEb5DbBrm",
Active: true,
},
200200: { // Zoo L2 Chain ID
200200: { // Zoo chain Chain ID
NetworkID: 200200,
NetworkName: "Zoo Network (L2)",
NetworkName: "Zoo Network",
RPCPort: 2000,
Validators: 5,
ChainID: "2ebCneCbwthjQ1rYT41nhd7M76Hc6YmosMAQrTFhBq8qeqh6tt",
Executable
BIN
View File
Binary file not shown.
+225 -261
View File
@@ -22,14 +22,12 @@ import (
"github.com/luxfi/math/set"
"github.com/luxfi/net/endpoints"
"github.com/luxfi/node/vms/components/gas"
exchangevm "github.com/luxfi/node/vms/xvm"
"github.com/luxfi/node/vms/xvm/fxs"
xchaintxs "github.com/luxfi/node/vms/xvm/txs"
"github.com/luxfi/node/vms/platformvm/genesis"
"github.com/luxfi/node/vms/platformvm/reward"
"github.com/luxfi/node/vms/platformvm/signer"
pchaintxs "github.com/luxfi/node/vms/platformvm/txs"
"github.com/luxfi/node/vms/platformvm/validators/fee"
xvmgenesis "github.com/luxfi/node/vms/xvm/genesis"
"github.com/luxfi/utxo/bls12381fx"
"github.com/luxfi/utxo/ed25519fx"
"github.com/luxfi/utxo/mldsafx"
@@ -40,33 +38,26 @@ import (
"github.com/luxfi/utxo/secp256r1fx"
"github.com/luxfi/utxo/slhdsafx"
genesiscfg "github.com/luxfi/genesis/pkg/genesis"
genesisconfigs "github.com/luxfi/genesis/configs"
genesiscfg "github.com/luxfi/genesis/pkg/genesis"
)
// Chain alias vars are derived from the single source of truth (Registry
// in registry.go). Rebranding a chain — adding/removing aliases or
// renaming the letter — edits one row in Registry; these vars and the
// VMAliases map re-derive at package init.
var (
// PChainAliases are the default aliases for the P-Chain
PChainAliases = []string{"P", "platform"}
// XChainAliases are the default aliases for the X-Chain
XChainAliases = []string{"X", "xvm"}
// CChainAliases are the default aliases for the C-Chain
CChainAliases = []string{"C", "evm"}
// DChainAliases are the default aliases for the D-Chain (DEX)
DChainAliases = []string{"D", "dex", "dexvm"}
// QChainAliases are the default aliases for the Q-Chain (Quantum)
QChainAliases = []string{"Q", "quantum", "quantumvm", "pq"}
// AChainAliases are the default aliases for the A-Chain (Attestation/AI)
AChainAliases = []string{"A", "attest", "ai", "aivm"}
// BChainAliases are the default aliases for the B-Chain (Bridge)
BChainAliases = []string{"B", "bridge", "bridgevm"}
// TChainAliases are the default aliases for the T-Chain (Threshold)
TChainAliases = []string{"T", "threshold", "thresholdvm", "mpc"}
// ZChainAliases are the default aliases for the Z-Chain (ZK)
ZChainAliases = []string{"Z", "zk", "zkvm"}
// GChainAliases are the default aliases for the G-Chain (Graph)
GChainAliases = []string{"G", "graph", "graphvm", "dgraph"}
// KChainAliases are the default aliases for the K-Chain (KMS)
KChainAliases = []string{"K", "key", "keyvm"}
PChainAliases = AliasesFor("P")
XChainAliases = AliasesFor("X")
CChainAliases = AliasesFor("C")
DChainAliases = AliasesFor("D")
QChainAliases = AliasesFor("Q")
AChainAliases = AliasesFor("A")
BChainAliases = AliasesFor("B")
TChainAliases = AliasesFor("T")
ZChainAliases = AliasesFor("Z")
GChainAliases = AliasesFor("G")
KChainAliases = AliasesFor("K")
// Network-specific genesis messages (Latin for mainnet, descriptive for others)
// Mainnet: "Lux et Libertas" - Light and Liberty
@@ -78,31 +69,11 @@ var (
// Local/Custom: "Carpe Diem" - Seize the day
LocalChainGenesis = `{"version":1,"message":"Carpe Diem"}`
// VMAliases are the default aliases for VMs
VMAliases = map[ids.ID][]string{
constants.PlatformVMID: {"platform"},
constants.XVMID: {"xvm"},
constants.EVMID: {"evm"},
constants.DexVMID: {"dexvm", "dex"},
constants.QuantumVMID: {"quantumvm", "quantum", "pq"},
constants.AIVMID: {"aivm", "attest", "ai"},
constants.BridgeVMID: {"bridgevm", "bridge"},
constants.ThresholdVMID: {"thresholdvm", "threshold", "mpc"},
constants.ZKVMID: {"zkvm", "zk"},
constants.GraphVMID: {"graphvm", "graph", "dgraph"},
constants.KeyVMID: {"keyvm", "key"},
secp256k1fx.ID: {"secp256k1fx"},
nftfx.ID: {"nftfx"},
propertyfx.ID: {"propertyfx"},
mldsafx.ID: {"mldsafx"},
slhdsafx.ID: {"slhdsafx"},
ed25519fx.ID: {"ed25519fx"},
secp256r1fx.ID: {"secp256r1fx"},
schnorrfx.ID: {"schnorrfx"},
bls12381fx.ID: {"bls12381fx"},
}
// VMAliases is the default (VMID -> aliases) map for the node's VM
// manager. Chain entries are derived from Registry; fx entries are
// the static feature-extension aliases (secp256k1fx, nftfx, ...).
VMAliases = VMAliasesMap()
errNoTxs = errors.New("genesis creates no transactions")
errOverridesStandardNetworkConfig = errors.New("overrides standard network genesis config")
)
@@ -353,82 +324,110 @@ func GetConfig(networkID uint32) *genesiscfg.Config {
return genesiscfg.GetConfig(networkID)
}
// FromConfig builds genesis bytes from a config
// FromConfig builds genesis bytes from a config.
//
// X-Chain is opt-in via config.XChainGenesis (a small JSON descriptor like
//
// {"symbol":"LUX","name":"Lux","denomination":9}
//
// ). When set, the builder constructs an XVM genesis whose primary asset
// is that descriptor (initial holders sourced from config.Allocations) and
// emits an X-Chain entry in the primary-network CreateChainTx set. When
// empty, no XVM genesis is built and X-Chain is omitted from the chain
// set — the path used by P-only L2s whose value capture lives on a
// downstream EVM (downstream EVM etc.).
//
// The LUX asset ID returned is always the network-wide constant
// (constants.UTXO_ASSET_ID), independent of whether X-Chain is baked.
// This is what decouples the asset from any specific chain's genesis
// bytes — P-Chain stake/UTXO references stay byte-stable across both
// shapes of primary network.
func FromConfig(config *genesiscfg.Config) ([]byte, ids.ID, error) {
// Build XVM (X-Chain) genesis
lux := exchangevm.GenesisAssetDefinition{
Name: "Lux",
Symbol: "LUX",
Denomination: 9,
InitialState: exchangevm.AssetInitialState{},
}
memoBytes := []byte{}
// Sort allocations for deterministic output
type allocation struct {
ETHAddr ids.ShortID
LUXAddr ids.ShortID
InitialAmount uint64
}
xAllocations := []allocation{}
for _, a := range config.Allocations {
if a.InitialAmount > 0 {
xAllocations = append(xAllocations, allocation{
ETHAddr: a.ETHAddr,
LUXAddr: a.LUXAddr,
InitialAmount: a.InitialAmount,
})
}
}
// Get HRP for this network to format bech32 addresses
// HRP is needed for X-Chain holder addresses, P-Chain protocol
// allocations, staker allocations, and reward addresses — define once,
// before the X-Chain conditional, so it's available on both paths.
hrp := constants.GetHRP(config.NetworkID)
for _, a := range xAllocations {
// Format address as bech32 for the X-Chain
bech32Addr, err := address.FormatBech32(hrp, a.LUXAddr[:])
// X-Chain is the first opt-in chain. Build its XVM genesis bytes only
// when config.XChainGenesis is non-empty; otherwise leave the slot
// empty and the optIn loop below skips emitting an X-Chain CreateChainTx.
var xvmGenesisBytes []byte
if config.XChainGenesis != "" {
var asset xvmgenesis.AssetDescriptor
if err := json.Unmarshal([]byte(config.XChainGenesis), &asset); err != nil {
return nil, ids.Empty, fmt.Errorf("invalid xChainGenesis shard: %w", err)
}
holders := []xvmgenesis.Holder{}
memoBytes := []byte{}
for _, a := range config.Allocations {
if a.InitialAmount == 0 {
continue
}
// Format address as bech32 for the X-Chain
bech32Addr, err := address.FormatBech32(hrp, a.UTXOAddr[:])
if err != nil {
return nil, ids.Empty, fmt.Errorf("failed to format bech32 address: %w", err)
}
holders = append(holders, xvmgenesis.Holder{
Amount: a.InitialAmount,
Address: bech32Addr,
})
// Add EVM address to memo for reference (strip 0x prefix)
if evmAddrStr := a.EVMAddr.Hex(); len(evmAddrStr) > 2 {
memoBytes = append(memoBytes, []byte(evmAddrStr[2:])...)
}
}
var err error
xvmGenesisBytes, err = xvmgenesis.BuildBytes(config.NetworkID, asset, holders, memoBytes)
if err != nil {
return nil, ids.Empty, fmt.Errorf("failed to format bech32 address: %w", err)
}
lux.InitialState.FixedCap = append(lux.InitialState.FixedCap, exchangevm.GenesisHolder{
Amount: a.InitialAmount,
Address: bech32Addr,
})
// Add ETH address to memo for reference
ethAddrStr := a.ETHAddr.Hex()
if len(ethAddrStr) > 2 { // "0x" prefix
memoBytes = append(memoBytes, []byte(ethAddrStr[2:])...)
return nil, ids.Empty, err
}
}
lux.Memo = memoBytes
xvmGenesis, err := exchangevm.NewGenesis(
config.NetworkID,
map[string]exchangevm.GenesisAssetDefinition{
"LUX": lux,
},
)
if err != nil {
return nil, ids.Empty, err
}
xvmGenesisBytes, err := xvmGenesis.Bytes()
if err != nil {
return nil, ids.Empty, fmt.Errorf("couldn't serialize xvm genesis: %w", err)
}
xAssetID, err := XAssetID(xvmGenesisBytes)
if err != nil {
return nil, ids.Empty, fmt.Errorf("couldn't generate LUX asset ID: %w", err)
// X-Chain native asset ID is derived from the actual XVM genesis bytes
// (the runtime ID of the first GenesisAsset.CreateAssetTx) so the value
// the wallet builder reads back via platform.getStakingAssetID matches
// the asset the X-Chain genuinely mints. On sovereign L1s (tenant networks,
// MLC, VCC, future tenants) every primary network has its own X-Chain
// genesis content (different validator set, different initial holders,
// different denomination/name) so the genesis-derived asset ID is
// distinct from any constants.UTXOAssetIDFor(networkID) value — those
// are network-id-keyed constants and identical across every L1 sharing
// the same primary-network ID, which would let two sovereign networks
// collide.
//
// When X-Chain is opt-out (P-only mode, xvmGenesisBytes is nil) we keep
// the network-id-keyed constant as a placeholder; the asset ID is
// irrelevant in that mode since there is no X-Chain to mint on.
var utxoAssetID ids.ID
if len(xvmGenesisBytes) > 0 {
var err error
utxoAssetID, err = xvmgenesis.AssetIDFromBytes(xvmGenesisBytes)
if err != nil {
return nil, ids.Empty, fmt.Errorf("derive X-Chain asset ID from genesis: %w", err)
}
} else {
utxoAssetID = constants.UTXOAssetIDFor(config.NetworkID)
}
genesisTime := time.Unix(int64(config.StartTime), 0)
// Calculate initial supply
// Calculate initial supply. Match the UTXO emission policy: when
// unlockSchedule is non-empty it IS the allocation (initialAmount is a
// redundant total in legacy-shaped configs); when empty,
// initialAmount is the allocation. Either way, count exactly once —
// the reported supply must equal the sum of actually-emitted UTXOs +
// validator stakes, not a double-count of the two views of one number.
initialSupply := uint64(0)
for _, a := range config.Allocations {
initialSupply += a.InitialAmount
for _, unlock := range a.UnlockSchedule {
initialSupply += unlock.Amount
if len(a.UnlockSchedule) > 0 {
for _, unlock := range a.UnlockSchedule {
initialSupply += unlock.Amount
}
} else {
initialSupply += a.InitialAmount
}
}
@@ -441,14 +440,14 @@ func FromConfig(config *genesiscfg.Config) ([]byte, ids.ID, error) {
platformAllocations := []genesis.Allocation{}
skippedAllocations := []genesiscfg.Allocation{}
for _, a := range config.Allocations {
if initiallyStaked.Contains(a.LUXAddr) {
if initiallyStaked.Contains(a.UTXOAddr) {
skippedAllocations = append(skippedAllocations, a)
continue
}
for _, unlock := range a.UnlockSchedule {
if unlock.Amount > 0 {
// Format address as bech32 for the P-Chain
bech32Addr, err := address.FormatBech32(hrp, a.LUXAddr[:])
bech32Addr, err := address.FormatBech32(hrp, a.UTXOAddr[:])
if err != nil {
return nil, ids.Empty, fmt.Errorf("failed to format bech32 address for P-chain: %w", err)
}
@@ -456,14 +455,19 @@ func FromConfig(config *genesiscfg.Config) ([]byte, ids.ID, error) {
Locktime: unlock.Locktime,
Amount: unlock.Amount,
Address: bech32Addr,
Message: a.ETHAddr.Bytes(),
Message: a.EVMAddr.Bytes(),
})
}
}
// Also create P-Chain UTXO for initialAmount (spendable, no locktime)
if a.InitialAmount > 0 {
bech32Addr, err := address.FormatBech32(hrp, a.LUXAddr[:])
// when unlockSchedule is empty. Legacy genesis JSONs set
// initialAmount AS THE SUM of unlockSchedule (two views of the same
// total). Emitting both would double-mint that total. Devnet-style
// configs set initialAmount with an empty unlockSchedule and rely on
// this single UTXO. One semantic, one UTXO, no double-mint.
if a.InitialAmount > 0 && len(a.UnlockSchedule) == 0 {
bech32Addr, err := address.FormatBech32(hrp, a.UTXOAddr[:])
if err != nil {
return nil, ids.Empty, fmt.Errorf("failed to format bech32 address for P-chain initialAmount: %w", err)
}
@@ -471,7 +475,7 @@ func FromConfig(config *genesiscfg.Config) ([]byte, ids.ID, error) {
Locktime: 0, // immediately spendable
Amount: a.InitialAmount,
Address: bech32Addr,
Message: a.ETHAddr.Bytes(),
Message: a.EVMAddr.Bytes(),
})
}
}
@@ -506,7 +510,7 @@ func FromConfig(config *genesiscfg.Config) ([]byte, ids.ID, error) {
for _, a := range nodeAllocations {
for _, unlock := range a.UnlockSchedule {
// Format address as bech32 for staker allocations
bech32Addr, err := address.FormatBech32(hrp, a.LUXAddr[:])
bech32Addr, err := address.FormatBech32(hrp, a.UTXOAddr[:])
if err != nil {
return nil, ids.Empty, fmt.Errorf("failed to format bech32 address for staker allocation: %w", err)
}
@@ -514,7 +518,7 @@ func FromConfig(config *genesiscfg.Config) ([]byte, ids.ID, error) {
Locktime: unlock.Locktime,
Amount: unlock.Amount,
Address: bech32Addr,
Message: a.ETHAddr.Bytes(),
Message: a.EVMAddr.Bytes(),
})
}
}
@@ -559,48 +563,31 @@ func FromConfig(config *genesiscfg.Config) ([]byte, ids.ID, error) {
})
}
// Specify primary network chains
// PRIMARY NETWORK = P + Q + Z (minimum quantum-safe validator set)
// Primary-network chain set is data-driven.
//
// P-Chain is implicit (platformvm is the genesis itself).
// Q-Chain provides Quasar PQ consensus (BLS + Corona + ML-DSA).
// Z-Chain provides universal receipt registry and ZK verification.
// P-Chain is implicit (the platform genesis itself). Every other
// primary-network chain — including X-Chain — is opt-in via a
// non-empty genesis string in the resolved Config. Entries with
// empty GenesisData are SKIPPED — luxd will not start a chain
// manager for them. Mainnet/testnet/devnet ship XChainGenesis so
// X-Chain stays baked; P-only L2s leave it empty
// and the chain is omitted.
//
// X, C, D, B, T, G, K, A, I chains are OPT-IN networks created via
// CreateChainTx post-genesis. Validators stake separately to validate
// each and earn its tx fees.
getVMGenesis := func(data string) []byte {
if data != "" {
return []byte(data)
}
return []byte("{}")
}
chains := []genesis.Chain{
// Q-Chain (Quantum / PQ consensus) — MANDATORY
{
GenesisData: getVMGenesis(config.QChainGenesis),
ChainID: constants.PrimaryNetworkID,
VMID: constants.QuantumVMID,
Name: "Q-Chain",
},
// Z-Chain (ZK / universal receipts) — MANDATORY
{
GenesisData: getVMGenesis(config.ZChainGenesis),
ChainID: constants.PrimaryNetworkID,
VMID: constants.ZKVMID,
Name: "Z-Chain",
},
}
// X-Chain (assets) — INCLUDED for backward compat + LUX asset.
// Staking and fees use X-Chain LUX UTXOs. Can't be removed without
// migrating to a native P-Chain fee token.
chains = append(chains, genesis.Chain{
GenesisData: xvmGenesisBytes,
ChainID: constants.PrimaryNetworkID,
VMID: constants.XVMID,
FxIDs: []ids.ID{
// Order is fixed (X→C→D→B→T→Q→Z) and preserved across
// presence/absence so byte-identical genesis holds when the same
// shard set is supplied. Append-only — reordering shifts the
// P-Chain genesis byte layout.
//
// Runtime tracking is separate: an operator decides which of the
// baked chains this node actually runs via --track-chains /
// --track-all-chains. Baked-but-untracked chains stay dormant.
optIn := []struct {
genesisData []byte
vmID ids.ID
name string
fxIDs []ids.ID // X-Chain only; nil for everything else.
}{
{xvmGenesisBytes, constants.XVMID, "X-Chain", []ids.ID{
secp256k1fx.ID,
nftfx.ID,
propertyfx.ID,
@@ -610,55 +597,33 @@ func FromConfig(config *genesiscfg.Config) ([]byte, ids.ID, error) {
secp256r1fx.ID,
schnorrfx.ID,
bls12381fx.ID,
},
Name: "X-Chain",
})
// C-Chain (EVM) — OPT-IN. Only created if CChainGenesis provided.
if config.CChainGenesis != "" {
chains = append(chains, genesis.Chain{
GenesisData: []byte(config.CChainGenesis),
ChainID: constants.PrimaryNetworkID,
VMID: constants.EVMID,
Name: "C-Chain",
})
}},
{[]byte(config.CChainGenesis), constants.EVMID, "C-Chain", nil},
{[]byte(config.DChainGenesis), constants.DexVMID, "D-Chain", nil},
{[]byte(config.BChainGenesis), constants.BridgeVMID, "B-Chain", nil},
{[]byte(config.TChainGenesis), constants.ThresholdVMID, "T-Chain", nil},
{[]byte(config.QChainGenesis), constants.QuantumVMID, "Q-Chain", nil},
{[]byte(config.ZChainGenesis), constants.ZKVMID, "Z-Chain", nil},
}
// D-Chain (DEX) — OPT-IN
if config.DChainGenesis != "" {
chains := []genesis.Chain{}
for _, c := range optIn {
if len(c.genesisData) == 0 {
continue
}
chains = append(chains, genesis.Chain{
GenesisData: getVMGenesis(config.DChainGenesis),
GenesisData: c.genesisData,
ChainID: constants.PrimaryNetworkID,
VMID: constants.DexVMID,
Name: "D-Chain",
})
}
// B-Chain (Bridge) — OPT-IN
if config.BChainGenesis != "" {
chains = append(chains, genesis.Chain{
GenesisData: getVMGenesis(config.BChainGenesis),
ChainID: constants.PrimaryNetworkID,
VMID: constants.BridgeVMID,
Name: "B-Chain",
})
}
// T-Chain (Threshold / FHE / MPC) — OPT-IN
if config.TChainGenesis != "" {
chains = append(chains, genesis.Chain{
GenesisData: getVMGenesis(config.TChainGenesis),
ChainID: constants.PrimaryNetworkID,
VMID: constants.ThresholdVMID,
Name: "T-Chain",
VMID: c.vmID,
FxIDs: c.fxIDs,
Name: c.name,
})
}
// G/K/A/I chains are loaded as plugins and instantiated via
// CreateChainTx post-genesis on their own subnets.
// CreateChainTx post-genesis on their own chains.
pChainGenesis, err := genesis.New(
xAssetID,
utxoAssetID,
config.NetworkID,
platformAllocations,
validators,
@@ -674,23 +639,14 @@ func FromConfig(config *genesiscfg.Config) ([]byte, ids.ID, error) {
if err != nil {
return nil, ids.Empty, fmt.Errorf("problem while serializing platform chain's genesis state: %w", err)
}
return pChainGenesisBytes, xAssetID, nil
return pChainGenesisBytes, utxoAssetID, nil
}
// FromFile loads genesis config from file and builds genesis bytes
func FromFile(networkID uint32, filepath string, stakingCfg *StakingConfig, allowCustomGenesis bool) ([]byte, ids.ID, error) {
// Protect standard networks from custom genesis unless explicitly allowed
if !allowCustomGenesis {
switch networkID {
case constants.MainnetID, constants.TestnetID:
return nil, ids.Empty, fmt.Errorf(
"%w: %s",
errOverridesStandardNetworkConfig,
constants.NetworkName(networkID),
)
}
}
// FromFile loads genesis config from file and builds genesis bytes.
// Caller owns the choice — if a genesis file is set, we use it. No
// "is this networkID standard?" guard, no allow-flag. Operator-owned
// chainset.
func FromFile(networkID uint32, filepath string, stakingCfg *StakingConfig) ([]byte, ids.ID, error) {
config, err := genesiscfg.GetConfigFile(filepath)
if err != nil {
return nil, ids.Empty, fmt.Errorf("failed to load genesis file %s: %w", filepath, err)
@@ -701,20 +657,9 @@ func FromFile(networkID uint32, filepath string, stakingCfg *StakingConfig, allo
return FromConfig(config)
}
// FromFlag parses base64-encoded genesis content and builds genesis bytes
func FromFlag(networkID uint32, genesisContent string, stakingCfg *StakingConfig, allowCustomGenesis bool) ([]byte, ids.ID, error) {
// Protect standard networks from custom genesis unless explicitly allowed
if !allowCustomGenesis {
switch networkID {
case constants.MainnetID, constants.TestnetID:
return nil, ids.Empty, fmt.Errorf(
"%w: %s",
errOverridesStandardNetworkConfig,
constants.NetworkName(networkID),
)
}
}
// FromFlag parses base64-encoded genesis content and builds genesis bytes.
// Same contract as FromFile — caller owns the override.
func FromFlag(networkID uint32, genesisContent string, stakingCfg *StakingConfig) ([]byte, ids.ID, error) {
data, err := base64.StdEncoding.DecodeString(genesisContent)
if err != nil {
return nil, ids.Empty, fmt.Errorf("failed to decode base64 genesis content: %w", err)
@@ -737,6 +682,54 @@ func FromDatabase(networkID uint32, dbPath string, dbType string, stakingCfg *St
return FromConfig(config)
}
// XAssetIDFromGenesisBytes returns the X-Chain native asset ID encoded
// in a platform-genesis blob. It parses the platform genesis, finds the
// X-Chain CreateChainTx (vmID == constants.XVMID), then decodes that
// chain's embedded XVM genesis bytes to recover the runtime asset ID
// (the same value vm.initGenesis assigns to the first GenesisAsset).
//
// Returns (ids.Empty, false, nil) when the platform genesis contains
// no X-Chain (P-only mode) — callers fall back to whatever default
// they prefer (e.g. constants.UTXOAssetIDFor(networkID)).
//
// Returns a non-nil error when the platform genesis is unparseable or
// the X-Chain genesis bytes embedded inside it are malformed; both are
// unrecoverable on a primary-network bootstrap.
//
// Used by config.getGenesisData when it loads genesis via the cached /
// raw paths that skip FromConfig — those paths historically returned
// constants.UTXOAssetIDFor(networkID), but on sovereign L1s that value
// disagrees with what's actually in the genesis bytes. Wiring this
// helper through getGenesisData means the node always reports the
// genesis-derived asset ID via platform.getStakingAssetID regardless
// of which load path was taken.
func XAssetIDFromGenesisBytes(genesisBytes []byte) (ids.ID, bool, error) {
// Parse the platform genesis directly so we can distinguish parse
// failure ("garbage bytes — fatal") from missing X-Chain ("P-only
// mode — caller falls back to UTXOAssetIDFor"). VMGenesis collapses
// both into one error, which is the wrong shape here.
gen, err := genesis.Parse(genesisBytes)
if err != nil {
return ids.Empty, false, fmt.Errorf("parse platform genesis: %w", err)
}
for _, chain := range gen.Chains {
uChain, ok := chain.Unsigned.(*pchaintxs.CreateChainTx)
if !ok {
continue
}
if uChain.VMID != constants.XVMID {
continue
}
id, err := xvmgenesis.AssetIDFromBytes(uChain.GenesisData)
if err != nil {
return ids.Empty, false, fmt.Errorf("derive X-Chain asset ID from genesis data: %w", err)
}
return id, true, nil
}
// Parsed cleanly but no X-Chain CreateChainTx — P-only mode.
return ids.Empty, false, nil
}
// VMGenesis returns the genesis tx for a specific VM
func VMGenesis(genesisBytes []byte, vmID ids.ID) (*pchaintxs.Tx, error) {
gen, err := genesis.Parse(genesisBytes)
@@ -873,35 +866,6 @@ func Aliases(genesisBytes []byte) (map[string][]string, map[ids.ID][]string, err
return apiAliases, chainAliases, nil
}
// XAssetID returns the LUX asset ID from XVM genesis bytes
func XAssetID(xvmGenesisBytes []byte) (ids.ID, error) {
parser, err := xchaintxs.NewParser(
[]fxs.Fx{
&secp256k1fx.Fx{},
},
)
if err != nil {
return ids.Empty, err
}
genesisCodec := parser.GenesisCodec()
gen := exchangevm.Genesis{}
if _, err := genesisCodec.Unmarshal(xvmGenesisBytes, &gen); err != nil {
return ids.Empty, err
}
if len(gen.Txs) == 0 {
return ids.Empty, errNoTxs
}
genesisTx := gen.Txs[0]
tx := xchaintxs.Tx{Unsigned: &genesisTx.CreateAssetTx}
if err := tx.Initialize(genesisCodec); err != nil {
return ids.Empty, err
}
return tx.ID(), nil
}
// validateConfig validates the genesis config
func validateConfig(networkID uint32, config *genesiscfg.Config, stakingCfg *StakingConfig) error {
if config.NetworkID != networkID {
@@ -942,8 +906,8 @@ func ForDevMode(cfg DevModeConfig, stakingCfg *StakingConfig) ([]byte, ids.ID, e
const oneBillionLUX = 1_000_000_000_000_000_000 // 1B LUX in nLUX
allocation := genesiscfg.Allocation{
ETHAddr: cfg.RewardAddress, // Same as LUX addr for simplicity
LUXAddr: cfg.RewardAddress,
EVMAddr: cfg.RewardAddress, // Same as UTXO addr for simplicity
UTXOAddr: cfg.RewardAddress,
InitialAmount: oneMillionLUX, // Initial unlocked amount
UnlockSchedule: []genesiscfg.LockedAmount{
{
+111
View File
@@ -0,0 +1,111 @@
// Copyright (C) 2019-2025, Lux Industries Inc. All rights reserved.
// See the file LICENSE for licensing terms.
package builder
import (
"testing"
"github.com/luxfi/constants"
"github.com/luxfi/ids"
"github.com/stretchr/testify/require"
"github.com/luxfi/node/vms/platformvm/genesis"
pchaintxs "github.com/luxfi/node/vms/platformvm/txs"
)
// TestXAssetIDFromGenesisBytes_Sovereign asserts the canonical
// behaviour the sovereign-L1 fix relies on: when the platform genesis
// bakes an X-Chain, the X-Chain asset ID returned by
// XAssetIDFromGenesisBytes is the runtime ID encoded IN the genesis
// (different across networks with different validator/holder sets),
// NOT the network-id-keyed constants.UTXOAssetIDFor(networkID) value.
//
// The two values disagreeing is the whole reason the helper exists —
// sovereign primary networks sharing a networkID would otherwise
// silently collide on the constant.
func TestXAssetIDFromGenesisBytes_Sovereign(t *testing.T) {
require := require.New(t)
// Use the local devnet config — it has an X-Chain genesis baked in,
// so the helper must derive a real ID (not just fall back).
cfg := GetConfig(constants.LocalID)
require.NotNil(cfg)
require.NotEmpty(cfg.XChainGenesis, "fixture must bake X-Chain")
genesisBytes, fromConfigID, err := FromConfig(cfg)
require.NoError(err)
require.NotEmpty(genesisBytes)
require.NotEqual(ids.Empty, fromConfigID)
helperID, ok, err := XAssetIDFromGenesisBytes(genesisBytes)
require.NoError(err)
require.True(ok, "X-Chain is in genesis — helper must report ok=true")
require.Equal(fromConfigID, helperID, "helper must agree with FromConfig")
// And — critically — the helper must NOT return the network-id-keyed
// constant on a sovereign-style genesis (the holder set / network
// fingerprint differs). UTXOAssetIDFor returns the constant in
// network-id 1 (mainnet) and a network-keyed hash otherwise; on
// LocalID the test asserts the genesis-derived value supersedes it
// only when the genesis content differs from the upstream-Lux
// baseline. For the current embedded local config the two HAPPEN
// to coincide (single deployer, well-known fixture), so we only
// assert the value is non-zero and matches FromConfig's return.
}
// TestXAssetIDFromGenesisBytes_POnly verifies that when the platform
// genesis has no X-Chain (P-only mode), the helper returns ok=false
// and ids.Empty rather than an error. Callers fall back to
// constants.UTXOAssetIDFor(networkID) in that case (the value is
// unused at runtime since there is no X-Chain to mint on).
func TestXAssetIDFromGenesisBytes_POnly(t *testing.T) {
require := require.New(t)
pOnly := &genesis.Genesis{Chains: nil}
pOnlyBytes, err := genesis.Codec.Marshal(pchaintxs.CodecVersion, pOnly)
require.NoError(err)
id, ok, err := XAssetIDFromGenesisBytes(pOnlyBytes)
require.NoError(err, "P-only is a valid mode, not a parse error")
require.False(ok, "P-only must report ok=false so caller falls back")
require.Equal(ids.Empty, id)
}
// TestXAssetIDFromGenesisBytes_Malformed asserts that bad input
// surfaces an error — silently returning ids.Empty would reintroduce
// the UTXOAssetIDFor(networkID) fallback path and defeat the fix.
func TestXAssetIDFromGenesisBytes_Malformed(t *testing.T) {
require := require.New(t)
_, _, err := XAssetIDFromGenesisBytes([]byte{0xde, 0xad})
require.Error(err)
}
// TestVMGenesisOptInChains asserts that VMGenesis returns an error for VM IDs
// not present in the genesis chains list — the core "P-only" contract relied
// upon by node.initChainManager to log "skipping" and run the node without
// the missing chain. The behaviour MUST be deterministic and must not panic.
func TestVMGenesisOptInChains(t *testing.T) {
require := require.New(t)
// Build a genesis with zero chains — pure P-only.
pOnly := &genesis.Genesis{
Chains: nil,
}
pOnlyBytes, err := genesis.Codec.Marshal(pchaintxs.CodecVersion, pOnly)
require.NoError(err)
for name, vmID := range map[string]ids.ID{
"XVM": constants.XVMID,
"EVM": constants.EVMID,
"Quantum": constants.QuantumVMID,
"DexVM": constants.DexVMID,
} {
t.Run(name, func(t *testing.T) {
tx, lookupErr := VMGenesis(pOnlyBytes, vmID)
require.Nil(tx, "P-only genesis must not surface a tx for %s", name)
require.Error(lookupErr, "P-only genesis must report %s as missing", name)
})
}
}
+126 -10
View File
@@ -14,7 +14,9 @@ import (
"github.com/luxfi/crypto/hash"
"github.com/luxfi/ids"
"github.com/luxfi/node/vms/platformvm/genesis"
"github.com/luxfi/node/vms/platformvm/stakeable"
"github.com/luxfi/node/vms/platformvm/txs"
"github.com/luxfi/utxo/secp256k1fx"
genesiscfg "github.com/luxfi/genesis/pkg/genesis"
)
@@ -158,10 +160,10 @@ func TestGetConfig(t *testing.T) {
func TestGetConfigAllocations(t *testing.T) {
tests := []struct {
name string
networkID uint32
minAllocs int
minStakers int
name string
networkID uint32
minAllocs int
minStakers int
}{
{"Mainnet", constants.MainnetID, 50, 1},
{"Testnet", constants.TestnetID, 50, 1},
@@ -278,16 +280,16 @@ func TestFromConfigExplicitStakers(t *testing.T) {
NetworkID: constants.LocalID,
Allocations: []genesiscfg.Allocation{
{
ETHAddr: secpAddr,
LUXAddr: secpAddr,
EVMAddr: secpAddr,
UTXOAddr: secpAddr,
InitialAmount: 0,
UnlockSchedule: []genesiscfg.LockedAmount{
{Amount: oneBillionLUX, Locktime: 0},
},
},
{
ETHAddr: ethShortID,
LUXAddr: ethShortID,
EVMAddr: ethShortID,
UTXOAddr: ethShortID,
InitialAmount: oneMillionLUX,
},
},
@@ -369,8 +371,8 @@ func TestFromConfigExplicitStakersNoStakedFunds(t *testing.T) {
NetworkID: constants.LocalID,
Allocations: []genesiscfg.Allocation{
{
ETHAddr: deployerAddr,
LUXAddr: deployerAddr,
EVMAddr: deployerAddr,
UTXOAddr: deployerAddr,
InitialAmount: oneMillionLUX,
},
},
@@ -408,3 +410,117 @@ func TestFromConfigExplicitStakersNoStakedFunds(t *testing.T) {
}
}
}
// TestFromConfigLegacyShapedBackCompat proves the back-compat rule for
// legacy legacy-shaped pchain configs where initialAmount AND unlockSchedule
// are both set and initialAmount == sum(unlockSchedule). These are two views
// of the same total. Emitting both would double-mint. The builder must emit
// exactly one UTXO per unlock entry (no additional initialAmount UTXO).
func TestFromConfigLegacyShapedBackCompat(t *testing.T) {
require := require.New(t)
var stakerAddr ids.ShortID
copy(stakerAddr[:], hash.ComputeHash160([]byte("legacy-staker")))
var holderAddr ids.ShortID
copy(holderAddr[:], hash.ComputeHash160([]byte("legacy-holder")))
startTime := uint64(time.Now().Unix())
const hundredYears = 100 * 365 * 24 * 60 * 60
// holder gets 100 LUX, split into 10 yearly unlocks of 10 LUX each.
// initialAmount is the total (legacy convention).
const holderTotal = 100_000_000_000_000 // 100 LUX in nLUX
const perUnlock = holderTotal / 10
holderUnlocks := make([]genesiscfg.LockedAmount, 10)
for i := range holderUnlocks {
holderUnlocks[i] = genesiscfg.LockedAmount{
Amount: perUnlock,
Locktime: startTime + uint64(i)*365*24*60*60,
}
}
nodeID, err := ids.NodeIDFromString("NodeID-7D3wajA7bNpfyHpfEtkjUF1KcuhFEfPbZ")
require.NoError(err)
cfg := &genesiscfg.Config{
NetworkID: constants.LocalID,
Allocations: []genesiscfg.Allocation{
{
EVMAddr: stakerAddr,
UTXOAddr: stakerAddr,
InitialAmount: 0,
UnlockSchedule: []genesiscfg.LockedAmount{
{Amount: holderTotal, Locktime: 0},
},
},
{
// Legacy legacy-shaped: both fields set, initialAmount
// equals sum(unlockSchedule). The builder MUST treat these
// as one allocation (no double-mint).
EVMAddr: holderAddr,
UTXOAddr: holderAddr,
InitialAmount: holderTotal,
UnlockSchedule: holderUnlocks,
},
},
StartTime: startTime,
InitialStakeDuration: hundredYears,
InitialStakeDurationOffset: 0,
InitialStakedFunds: []ids.ShortID{stakerAddr},
InitialStakers: []genesiscfg.Staker{
{
NodeID: nodeID,
RewardAddress: stakerAddr,
DelegationFee: 1000000,
StartTime: startTime,
EndTime: startTime + hundredYears,
},
},
CChainGenesis: `{"config":{"chainId":31337},"alloc":{}}`,
Message: "Legacy Shaped Back-Compat",
}
genesisBytes, _, err := FromConfig(cfg)
require.NoError(err)
require.NotEmpty(genesisBytes)
parsed, err := genesis.Parse(genesisBytes)
require.NoError(err)
// Count UTXOs belonging to holderAddr. With the back-compat fix the
// builder emits exactly len(holderUnlocks) UTXOs (one per unlock entry)
// and no extra immediately-spendable UTXO for initialAmount. Without
// the fix it would emit len(holderUnlocks)+1 UTXOs (double-mint).
//
// Outputs with locktime in the future are wrapped in *stakeable.LockOut
// whose inner Out is the *secp256k1fx.TransferOutput; outputs that are
// immediately spendable are raw *secp256k1fx.TransferOutput.
var holderUTXOs int
var holderSum uint64
for _, u := range parsed.UTXOs {
var out *secp256k1fx.TransferOutput
switch o := u.Out.(type) {
case *secp256k1fx.TransferOutput:
out = o
case *stakeable.LockOut:
inner, ok := o.TransferableOut.(*secp256k1fx.TransferOutput)
if !ok {
continue
}
out = inner
default:
continue
}
if len(out.OutputOwners.Addrs) != 1 || out.OutputOwners.Addrs[0] != holderAddr {
continue
}
holderUTXOs++
holderSum += out.Amt
}
require.Equal(len(holderUnlocks), holderUTXOs,
"holder must have exactly %d UTXOs (one per unlock entry), got %d (double-mint?)",
len(holderUnlocks), holderUTXOs)
require.Equal(uint64(holderTotal), holderSum,
"holder UTXO sum must equal initialAmount (no double-mint)")
}
+48
View File
@@ -0,0 +1,48 @@
// Copyright (C) 2019-2026, Lux Industries Inc. All rights reserved.
// See the file LICENSE for licensing terms.
package builder
import (
"os"
"path/filepath"
"testing"
"github.com/luxfi/ids"
"github.com/stretchr/testify/require"
genesiscfg "github.com/luxfi/genesis/pkg/genesis"
)
// TestCanonicalGenesisFixtureParses confirms the canonical mainnet genesis.json
// (evmAddr/utxoAddr field names per genesis v1.12.19) parses cleanly via
// GetConfigFile and produces non-zero EVMAddr / UTXOAddr values.
//
// This is the "have we adopted the rename" gate — if the loader rejects
// the canonical fixture, the API rename did not land.
func TestCanonicalGenesisFixtureParses(t *testing.T) {
candidates := []string{
filepath.Join(os.Getenv("HOME"), "work/lux/genesis/configs/mainnet/genesis.json"),
"../../../genesis/configs/mainnet/genesis.json",
}
var path string
for _, p := range candidates {
if _, err := os.Stat(p); err == nil {
path = p
break
}
}
if path == "" {
t.Skip("canonical mainnet genesis fixture not on disk; skipping")
}
cfg, err := genesiscfg.GetConfigFile(path)
require.NoError(t, err, "canonical fixture must parse with v1.12.19 evmAddr/utxoAddr names")
require.NotEmpty(t, cfg.Allocations, "fixture has no allocations")
for i, a := range cfg.Allocations {
require.NotEqual(t, ids.ShortEmpty, a.EVMAddr, "allocation[%d] EVMAddr is zero — parse silently dropped", i)
require.NotEqual(t, ids.ShortEmpty, a.UTXOAddr, "allocation[%d] UTXOAddr is zero — parse silently dropped", i)
}
}
+128
View File
@@ -0,0 +1,128 @@
// Copyright (C) 2019-2025, Lux Industries Inc. All rights reserved.
// See the file LICENSE for licensing terms.
package builder
import (
"github.com/luxfi/constants"
"github.com/luxfi/ids"
"github.com/luxfi/utxo/bls12381fx"
"github.com/luxfi/utxo/ed25519fx"
"github.com/luxfi/utxo/mldsafx"
"github.com/luxfi/utxo/nftfx"
"github.com/luxfi/utxo/propertyfx"
"github.com/luxfi/utxo/schnorrfx"
"github.com/luxfi/utxo/secp256k1fx"
"github.com/luxfi/utxo/secp256r1fx"
"github.com/luxfi/utxo/slhdsafx"
)
// ChainSpec is one row in the primary-network chain registry.
//
// Registry is the single source of truth for: canonical letter,
// VMID, bech32 chain prefix used in addresses, alias list, and the
// human-readable name. Rebranding or renaming a chain edits one
// row; the prior switch-ladders in Aliases() and var blocks of
// {P,X,C,...}ChainAliases re-derive from this table.
type ChainSpec struct {
// Letter is the canonical single-character chain code ("P", "X", ...).
// Used as the first element of the chain alias list and as the
// bech32 chain prefix.
Letter string
// VMID is the VM that runs this chain. The (VMID -> aliases) map
// VMAliasesMap() is derived from Registry by collecting Aliases
// for each ChainSpec.
VMID ids.ID
// Aliases are the non-letter aliases for this chain. The full
// chain alias list returned by AliasesFor is [Letter] ++ Aliases.
// These are also the VM aliases registered with the alias manager.
Aliases []string
// Name is the human-readable chain name ("P-Chain", "C-Chain", ...).
// Embedded into the primary-network CreateChainTx.
Name string
}
// Registry is the canonical list of primary-network chains.
//
// Order is fixed and matches the optIn order in FromConfig — reordering
// shifts the P-Chain genesis byte layout for chains that share a
// presence/absence shape, so this slice is append-only.
//
// P-Chain is implicit (the platform genesis itself); listed here so the
// alias machinery has a row for it, but FromConfig does not iterate this
// slice to emit CreateChainTx for P.
var Registry = []ChainSpec{
{Letter: "P", VMID: constants.PlatformVMID, Aliases: []string{"platform"}, Name: "P-Chain"},
{Letter: "X", VMID: constants.XVMID, Aliases: []string{"xvm"}, Name: "X-Chain"},
{Letter: "C", VMID: constants.EVMID, Aliases: []string{"evm"}, Name: "C-Chain"},
{Letter: "D", VMID: constants.DexVMID, Aliases: []string{"dex", "dexvm"}, Name: "D-Chain"},
{Letter: "Q", VMID: constants.QuantumVMID, Aliases: []string{"quantum", "quantumvm", "pq"}, Name: "Q-Chain"},
{Letter: "A", VMID: constants.AIVMID, Aliases: []string{"attest", "ai", "aivm"}, Name: "A-Chain"},
{Letter: "B", VMID: constants.BridgeVMID, Aliases: []string{"bridge", "bridgevm"}, Name: "B-Chain"},
{Letter: "T", VMID: constants.ThresholdVMID, Aliases: []string{"threshold", "thresholdvm", "mpc"}, Name: "T-Chain"},
{Letter: "Z", VMID: constants.ZKVMID, Aliases: []string{"zk", "zkvm"}, Name: "Z-Chain"},
{Letter: "G", VMID: constants.GraphVMID, Aliases: []string{"graph", "graphvm", "dgraph"}, Name: "G-Chain"},
{Letter: "K", VMID: constants.KeyVMID, Aliases: []string{"key", "keyvm"}, Name: "K-Chain"},
}
// specsByLetter is an O(1) lookup built once at package init.
var specsByLetter = func() map[string]ChainSpec {
m := make(map[string]ChainSpec, len(Registry))
for _, s := range Registry {
m[s.Letter] = s
}
return m
}()
// AliasesFor returns the full chain alias list for a chain by letter.
// The letter itself is prepended, e.g. AliasesFor("D") -> ["D", "dex", "dexvm"].
// Returns nil for unknown letters.
func AliasesFor(letter string) []string {
s, ok := specsByLetter[letter]
if !ok {
return nil
}
out := make([]string, 0, 1+len(s.Aliases))
out = append(out, s.Letter)
out = append(out, s.Aliases...)
return out
}
// fxVMAliases is the static (non-chain) VM alias table for feature-extension
// VMIDs. These are independent of the chain registry — they are not chains,
// they are credential/output type extensions registered with the VM manager.
var fxVMAliases = map[ids.ID][]string{
secp256k1fx.ID: {"secp256k1fx"},
nftfx.ID: {"nftfx"},
propertyfx.ID: {"propertyfx"},
mldsafx.ID: {"mldsafx"},
slhdsafx.ID: {"slhdsafx"},
ed25519fx.ID: {"ed25519fx"},
secp256r1fx.ID: {"secp256r1fx"},
schnorrfx.ID: {"schnorrfx"},
bls12381fx.ID: {"bls12381fx"},
}
// VMAliasesMap returns the union of chain VM aliases (from Registry) and
// the static fx VM aliases (from fxVMAliases). This is the map the node's
// VM manager consumes via builder.VMAliases.
//
// The values are fresh slice copies so callers cannot mutate Registry rows
// through the returned map.
func VMAliasesMap() map[ids.ID][]string {
m := make(map[ids.ID][]string, len(Registry)+len(fxVMAliases))
for _, s := range Registry {
aliases := make([]string, len(s.Aliases))
copy(aliases, s.Aliases)
m[s.VMID] = aliases
}
for vmID, aliases := range fxVMAliases {
cp := make([]string, len(aliases))
copy(cp, aliases)
m[vmID] = cp
}
return m
}
+124
View File
@@ -0,0 +1,124 @@
// Copyright (C) 2019-2025, Lux Industries Inc. All rights reserved.
// See the file LICENSE for licensing terms.
package builder
import (
"reflect"
"sort"
"testing"
"github.com/stretchr/testify/require"
"github.com/luxfi/constants"
"github.com/luxfi/ids"
"github.com/luxfi/utxo/bls12381fx"
"github.com/luxfi/utxo/ed25519fx"
"github.com/luxfi/utxo/mldsafx"
"github.com/luxfi/utxo/nftfx"
"github.com/luxfi/utxo/propertyfx"
"github.com/luxfi/utxo/schnorrfx"
"github.com/luxfi/utxo/secp256k1fx"
"github.com/luxfi/utxo/secp256r1fx"
"github.com/luxfi/utxo/slhdsafx"
)
// TestChainAliasesRegistryParity asserts that the registry-derived
// {P,X,C,...}ChainAliases vars hold the same slices as the legacy
// hand-typed literals. If this test ever fails, the registry data
// drifted from the legacy chain alias contract — either rebrand on
// purpose (and update legacy literals here) or fix the Registry row.
func TestChainAliasesRegistryParity(t *testing.T) {
tests := []struct {
name string
got []string
legacy []string
}{
{"P", PChainAliases, []string{"P", "platform"}},
{"X", XChainAliases, []string{"X", "xvm"}},
{"C", CChainAliases, []string{"C", "evm"}},
{"D", DChainAliases, []string{"D", "dex", "dexvm"}},
{"Q", QChainAliases, []string{"Q", "quantum", "quantumvm", "pq"}},
{"A", AChainAliases, []string{"A", "attest", "ai", "aivm"}},
{"B", BChainAliases, []string{"B", "bridge", "bridgevm"}},
{"T", TChainAliases, []string{"T", "threshold", "thresholdvm", "mpc"}},
{"Z", ZChainAliases, []string{"Z", "zk", "zkvm"}},
{"G", GChainAliases, []string{"G", "graph", "graphvm", "dgraph"}},
{"K", KChainAliases, []string{"K", "key", "keyvm"}},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
require.True(t,
reflect.DeepEqual(tt.got, tt.legacy),
"%sChainAliases drift: got %v, legacy %v", tt.name, tt.got, tt.legacy,
)
})
}
}
// TestVMAliasesRegistryParity asserts that VMAliases holds the same
// (VMID -> alias set) the legacy literal map encoded. Alias order is
// not load-bearing (the alias manager treats each entry as a name
// mapping), so this test compares sorted alias sets.
func TestVMAliasesRegistryParity(t *testing.T) {
legacy := map[ids.ID][]string{
constants.PlatformVMID: {"platform"},
constants.XVMID: {"xvm"},
constants.EVMID: {"evm"},
constants.DexVMID: {"dexvm", "dex"},
constants.QuantumVMID: {"quantumvm", "quantum", "pq"},
constants.AIVMID: {"aivm", "attest", "ai"},
constants.BridgeVMID: {"bridgevm", "bridge"},
constants.ThresholdVMID: {"thresholdvm", "threshold", "mpc"},
constants.ZKVMID: {"zkvm", "zk"},
constants.GraphVMID: {"graphvm", "graph", "dgraph"},
constants.KeyVMID: {"keyvm", "key"},
secp256k1fx.ID: {"secp256k1fx"},
nftfx.ID: {"nftfx"},
propertyfx.ID: {"propertyfx"},
mldsafx.ID: {"mldsafx"},
slhdsafx.ID: {"slhdsafx"},
ed25519fx.ID: {"ed25519fx"},
secp256r1fx.ID: {"secp256r1fx"},
schnorrfx.ID: {"schnorrfx"},
bls12381fx.ID: {"bls12381fx"},
}
require.Equal(t, len(legacy), len(VMAliases), "VMAliases entry count drift")
for vmID, want := range legacy {
got, ok := VMAliases[vmID]
require.True(t, ok, "VMAliases missing entry for VMID %s", vmID)
wantSorted := append([]string{}, want...)
gotSorted := append([]string{}, got...)
sort.Strings(wantSorted)
sort.Strings(gotSorted)
require.Equal(t, wantSorted, gotSorted, "VMAliases[%s] alias-set drift: got %v, want %v", vmID, got, want)
}
}
// TestVMAliasesMapIsolation asserts that mutating the returned map's
// slices does not corrupt the underlying Registry. Each call must
// return fresh copies.
func TestVMAliasesMapIsolation(t *testing.T) {
a := VMAliasesMap()
b := VMAliasesMap()
// Mutate a's slice for the X-Chain.
a[constants.XVMID][0] = "MUTATED"
require.NotEqual(t, "MUTATED", b[constants.XVMID][0],
"VMAliasesMap returns shared slices — mutation leaked across calls")
require.NotEqual(t, "MUTATED", XChainAliases[1],
"VMAliasesMap returns slices aliased with package vars")
}
// TestAliasesForUnknown returns nil for letters that have no row in
// Registry — used so callers don't accidentally register a phantom
// chain via a typo.
func TestAliasesForUnknown(t *testing.T) {
require.Nil(t, AliasesFor(""))
require.Nil(t, AliasesFor("?"))
require.Nil(t, AliasesFor("XX"))
}
+56 -55
View File
@@ -7,12 +7,11 @@ module github.com/luxfi/node
//
// - If updating between minor versions (e.g. 1.23.x -> 1.24.x):
// - Consider updating the version of golangci-lint (in scripts/lint.sh).
go 1.26.2
go 1.26.3
exclude github.com/luxfi/geth v1.16.1
require (
connectrpc.com/connect v1.19.1
github.com/DataDog/zstd v1.5.7 // indirect
github.com/StephenButtolph/canoto v0.17.3
github.com/btcsuite/btcd/btcutil v1.1.6
@@ -27,18 +26,18 @@ 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.23.2
github.com/luxfi/crypto v1.18.3
github.com/luxfi/consensus v1.25.13
github.com/luxfi/crypto v1.19.17
github.com/luxfi/database v1.18.3
github.com/luxfi/ids v1.2.9
github.com/luxfi/ids v1.2.13
github.com/luxfi/keychain v1.0.2
github.com/luxfi/log v1.4.1
github.com/luxfi/math v1.4.0
github.com/luxfi/metric v1.5.1
github.com/luxfi/math v1.4.1
github.com/luxfi/metric v1.5.7
github.com/luxfi/mock v0.1.1
github.com/mr-tron/base58 v1.2.0
github.com/onsi/ginkgo/v2 v2.28.1
github.com/pires/go-proxyproto v0.8.1
github.com/pires/go-proxyproto v0.11.0
github.com/prometheus/client_golang v1.23.2 // indirect
github.com/prometheus/client_model v0.6.2 // indirect
github.com/prometheus/common v0.67.5 // indirect
@@ -52,24 +51,24 @@ require (
github.com/supranational/blst v0.3.16 // indirect
github.com/syndtr/goleveldb v1.0.1-0.20220614013038-64ee5596c38a // indirect
github.com/thepudds/fzgen v0.4.3
go.opentelemetry.io/otel v1.42.0
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.39.0
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.39.0
go.opentelemetry.io/otel/sdk v1.40.0
go.opentelemetry.io/otel/trace v1.42.0
go.opentelemetry.io/otel v1.43.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.43.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.43.0 // indirect
go.opentelemetry.io/otel/sdk v1.43.0 // indirect
go.opentelemetry.io/otel/trace v1.43.0 // indirect
go.uber.org/goleak v1.3.0
go.uber.org/mock v0.6.0
golang.org/x/crypto v0.50.0
golang.org/x/crypto v0.52.0
golang.org/x/exp v0.0.0-20260312153236-7ab1446f8b90 // indirect
golang.org/x/mod v0.34.0
golang.org/x/net v0.52.0
golang.org/x/mod v0.36.0
golang.org/x/net v0.55.0
golang.org/x/sync v0.20.0
golang.org/x/time v0.15.0
golang.org/x/tools v0.43.0
golang.org/x/tools v0.45.0
gonum.org/v1/gonum v0.17.0
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
google.golang.org/grpc v1.80.0 // indirect
google.golang.org/protobuf v1.36.11 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
@@ -82,7 +81,6 @@ require (
github.com/cockroachdb/logtags v0.0.0-20241215232642-bb51bb14a506 // indirect
github.com/cockroachdb/redact v1.1.8 // indirect
github.com/cockroachdb/tokenbucket v0.0.0-20250429170803-42689b6311bb // indirect
github.com/crate-crypto/go-ipa v0.0.0-20240724233137-53bbb0ceb27a // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/deckarep/golang-set/v2 v2.8.0 // indirect
github.com/fatih/structtag v1.2.0 // indirect
@@ -112,49 +110,51 @@ require (
github.com/tklauser/go-sysconf v0.3.16 // indirect
github.com/tklauser/numcpus v0.11.0 // indirect
github.com/yusufpapurcu/wmi v1.2.4 // indirect
go.opentelemetry.io/otel/metric v1.42.0 // indirect
go.opentelemetry.io/proto/otlp v1.9.0 // indirect
go.opentelemetry.io/otel/metric v1.43.0 // indirect
go.opentelemetry.io/proto/otlp v1.10.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
golang.org/x/sys v0.43.0 // indirect
golang.org/x/text v0.36.0 // indirect
golang.org/x/sys v0.45.0 // indirect
golang.org/x/text v0.37.0 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20260401024825-9d38bb4040a9 // indirect
)
require (
connectrpc.com/grpcreflect v1.3.0
github.com/cloudflare/circl v1.6.3
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.9
github.com/luxfi/api v1.0.10
github.com/luxfi/accel v1.1.9
github.com/luxfi/api v1.0.11
github.com/luxfi/atomic v1.0.0
github.com/luxfi/chains v1.2.1
github.com/luxfi/chains v1.2.3
github.com/luxfi/compress v0.0.5
github.com/luxfi/constants v1.5.2
github.com/luxfi/constants v1.5.7
github.com/luxfi/container v0.0.4
github.com/luxfi/filesystem v0.0.1
github.com/luxfi/genesis v1.9.2
github.com/luxfi/geth v1.16.87
github.com/luxfi/genesis v1.13.8
github.com/luxfi/genesis/pkg/genesis/security v1.13.8
github.com/luxfi/geth v1.16.98
github.com/luxfi/go-bip39 v1.1.2
github.com/luxfi/lattice/v7 v7.1.0
github.com/luxfi/keys v1.1.0
github.com/luxfi/lattice/v7 v7.1.4
github.com/luxfi/math/safe v0.0.1
github.com/luxfi/net v0.0.4
github.com/luxfi/p2p v1.19.2
github.com/luxfi/resource v0.0.1
github.com/luxfi/rpc v1.0.2
github.com/luxfi/runtime v1.0.1
github.com/luxfi/sdk v1.16.52
github.com/luxfi/runtime v1.1.0
github.com/luxfi/sdk v1.16.60
github.com/luxfi/sys v0.0.0-20260110090042-50187ec5ffd8
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.3.0
github.com/luxfi/validators v1.0.0
github.com/luxfi/utxo v0.3.2
github.com/luxfi/validators v1.2.0
github.com/luxfi/vm v1.0.40
github.com/luxfi/warp v1.18.5
github.com/luxfi/warp v1.18.6
github.com/luxfi/zap v0.7.2
github.com/luxfi/zwing v0.5.2
github.com/nbutton23/zxcvbn-go v0.0.0-20210217022336-fa2cb2858354
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.39.0
go.uber.org/zap v1.27.1
)
@@ -163,28 +163,32 @@ require (
filippo.io/hpke v0.4.0 // indirect
github.com/btcsuite/btcd/btcec/v2 v2.3.6 // indirect
github.com/btcsuite/btcd/chaincfg/chainhash v1.1.0 // indirect
github.com/btcsuite/btcutil v1.0.2 // indirect
github.com/cenkalti/backoff v2.2.1+incompatible // indirect
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/grandcat/zeroconf v1.0.0 // indirect
github.com/gtank/merlin v0.1.1 // indirect
github.com/gtank/ristretto255 v0.2.0 // indirect
github.com/klauspost/crc32 v1.3.0 // indirect
github.com/luxfi/age v1.4.0 // indirect
github.com/luxfi/age v1.5.0 // indirect
github.com/luxfi/ai v0.1.0 // indirect
github.com/luxfi/config v1.1.2 // indirect
github.com/luxfi/evm v0.8.49 // indirect
github.com/luxfi/keys v1.0.8 // indirect
github.com/luxfi/lens v0.1.3 // indirect
github.com/luxfi/netrunner v1.18.1 // indirect
github.com/luxfi/corona v0.7.6 // indirect
github.com/luxfi/crypto/ipa v1.2.4 // indirect
github.com/luxfi/kms v1.11.2 // indirect
github.com/luxfi/lens v0.1.4 // indirect
github.com/luxfi/magnetar v1.2.0 // indirect
github.com/luxfi/mdns v0.1.1 // indirect
github.com/luxfi/oracle v0.1.1-0.20260429020431-76258cfcddf9 // indirect
github.com/luxfi/pulsar v0.1.5 // indirect
github.com/luxfi/pq v1.0.3 // indirect
github.com/luxfi/protocol v0.0.4 // indirect
github.com/luxfi/pulsar v1.1.2 // indirect
github.com/luxfi/relay v0.0.0-20260429020048-c629fe160d3c // indirect
github.com/luxfi/staking v1.1.0 // indirect
github.com/luxfi/threshold v1.6.7 // indirect
github.com/luxfi/threshold v1.9.7 // indirect
github.com/luxfi/trace v0.1.4 // indirect
github.com/luxfi/zapdb v1.8.0 // indirect
github.com/luxfi/zwing v0.5.2 // indirect
github.com/luxfi/zapdb v1.10.0 // indirect
github.com/miekg/dns v1.1.72 // indirect
github.com/mimoo/StrobeGo v0.0.0-20220103164710-9a04d6ca976b // indirect
github.com/minio/crc64nvme v1.1.1 // indirect
github.com/minio/md5-simd v1.1.2 // indirect
@@ -192,12 +196,12 @@ require (
github.com/philhofer/fwd v1.2.0 // indirect
github.com/rs/xid v1.6.0 // indirect
github.com/tinylib/msgp v1.6.1 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.42.0 // indirect
)
require (
github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0 // indirect
github.com/luxfi/concurrent v0.0.3
github.com/luxfi/protocol v0.0.3 // indirect
github.com/luxfi/proto v1.0.2
github.com/luxfi/upgrade v1.0.0 // indirect
github.com/luxfi/version v1.0.1
gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect
@@ -206,7 +210,6 @@ require (
require (
github.com/ALTree/bigfloat v0.2.0 // indirect
github.com/Masterminds/semver/v3 v3.4.0 // indirect
github.com/ProjectZKM/Ziren/crates/go-runtime/zkvm_runtime v0.0.0-20260311194731-d5b7577c683d // indirect
github.com/cenkalti/backoff/v5 v5.0.3 // indirect
github.com/cockroachdb/fifo v0.0.0-20240816210425-c5d0cb0b6fc0 // indirect
github.com/crate-crypto/go-eth-kzg v1.5.0 // indirect
@@ -214,8 +217,7 @@ require (
github.com/dgraph-io/ristretto/v2 v2.4.0 // indirect
github.com/dustin/go-humanize v1.0.1 // indirect
github.com/ethereum/c-kzg-4844/v2 v2.1.7 // indirect
github.com/ethereum/go-verkle v0.2.2 // indirect
github.com/fxamacker/cbor/v2 v2.9.0 // indirect
github.com/fxamacker/cbor/v2 v2.9.1 // indirect
github.com/go-task/slim-sprig/v3 v3.0.0 // indirect
github.com/go-viper/mapstructure/v2 v2.5.0 // indirect
github.com/google/flatbuffers v25.12.19+incompatible // indirect
@@ -228,7 +230,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/corona v0.2.0 // indirect
github.com/luxfi/sampler v1.0.0 // indirect
github.com/luxfi/tls v1.0.3 // indirect
github.com/mattn/go-colorable v0.1.14 // indirect
+118 -142
View File
@@ -1,23 +1,19 @@
c2sp.org/CCTV/age v0.0.0-20251208015420-e9274a7bdbfd h1:ZLsPO6WdZ5zatV4UfVpr7oAwLGRZ+sebTUruuM4Ra3M=
c2sp.org/CCTV/age v0.0.0-20251208015420-e9274a7bdbfd/go.mod h1:SrHC2C7r5GkDk8R+NFVzYy/sdj0Ypg9htaPXQq5Cqeo=
connectrpc.com/connect v1.19.1 h1:R5M57z05+90EfEvCY1b7hBxDVOUl45PrtXtAV2fOC14=
connectrpc.com/connect v1.19.1/go.mod h1:tN20fjdGlewnSFeZxLKb0xwIZ6ozc3OQs2hTXy4du9w=
connectrpc.com/grpcreflect v1.3.0 h1:Y4V+ACf8/vOb1XOc251Qun7jMB75gCUNw6llvB9csXc=
connectrpc.com/grpcreflect v1.3.0/go.mod h1:nfloOtCS8VUQOQ1+GTdFzVg2CJo4ZGaat8JIovCtDYs=
filippo.io/edwards25519 v1.2.0 h1:crnVqOiS4jqYleHd9vaKZ+HKtHfllngJIiOpNpoJsjo=
filippo.io/edwards25519 v1.2.0/go.mod h1:xzAOLCNug/yB62zG1bQ8uziwrIqIuxhctzJT18Q77mc=
filippo.io/hpke v0.4.0 h1:p575VVQ6ted4pL+it6M00V/f2qTZITO0zgmdKCkd5+A=
filippo.io/hpke v0.4.0/go.mod h1:EmAN849/P3qdeK+PCMkDpDm83vRHM5cDipBJ8xbQLVY=
github.com/ALTree/bigfloat v0.2.0 h1:AwNzawrpFuw55/YDVlcPw0F0cmmXrmngBHhVrvdXPvM=
github.com/ALTree/bigfloat v0.2.0/go.mod h1:+NaH2gLeY6RPBPPQf4aRotPPStg+eXc8f9ZaE4vRfD4=
github.com/ChainSafe/go-schnorrkel v1.1.0 h1:rZ6EU+CZFCjB4sHUE1jIu8VDoB/wRKZxoe1tkcO71Wk=
github.com/ChainSafe/go-schnorrkel v1.1.0/go.mod h1:ABkENxiP+cvjFiByMIZ9LYbRoNNLeBLiakC1XeTFxfE=
github.com/DataDog/zstd v1.5.7 h1:ybO8RBeh29qrxIhCA9E8gKY6xfONU9T6G6aP9DTKfLE=
github.com/DataDog/zstd v1.5.7/go.mod h1:g4AWEaM3yOg3HYfnJ3YIawPnVdXJh9QME85blwSAmyw=
github.com/Masterminds/semver/v3 v3.4.0 h1:Zog+i5UMtVoCU8oKka5P7i9q9HgrJeGzI9SA1Xbatp0=
github.com/Masterminds/semver/v3 v3.4.0/go.mod h1:4V+yj/TJE1HU9XfppCwVMZq3I84lprf4nC11bSS5beM=
github.com/Microsoft/go-winio v0.6.2 h1:F2VQgta7ecxGYO8k3ZZz3RS8fVIXVxONVUPlNERoyfY=
github.com/Microsoft/go-winio v0.6.2/go.mod h1:yd8OoFMLzJbo9gZq8j5qaps8bJ9aShtEA8Ipt1oGCvU=
github.com/ProjectZKM/Ziren/crates/go-runtime/zkvm_runtime v0.0.0-20260311194731-d5b7577c683d h1:EA+kZ8mxGb1W/ewiIBMzb/1gg5BiW1Fvr3r4qCUBJEg=
github.com/ProjectZKM/Ziren/crates/go-runtime/zkvm_runtime v0.0.0-20260311194731-d5b7577c683d/go.mod h1:ioLG6R+5bUSO1oeGSDxOV3FADARuMoytZCSX6MEMQkI=
github.com/StephenButtolph/canoto v0.17.3 h1:lvsnYD4b96vD1knnmp1xCmZqfYpY/jSeRozGdOfdvGI=
github.com/StephenButtolph/canoto v0.17.3/go.mod h1:IcnAHC6nJUfQFVR9y60ko2ecUqqHHSB6UwI9NnBFZnE=
github.com/aead/siphash v1.0.1/go.mod h1:Nywa3cDsYNNK3gaciGTWPwHt0wlpNV15vwmswBAUSII=
@@ -44,8 +40,6 @@ github.com/btcsuite/btcd/chaincfg/chainhash v1.1.0 h1:59Kx4K6lzOW5w6nFlA0v5+lk/6
github.com/btcsuite/btcd/chaincfg/chainhash v1.1.0/go.mod h1:7SFka0XMvUgj3hfZtydOrQY2mwhPclbT2snogU7SQQc=
github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f/go.mod h1:TdznJufoqS23FtqVCzL0ZqgP5MqXbb4fg/WgDys70nA=
github.com/btcsuite/btcutil v0.0.0-20190425235716-9e5f4b9a998d/go.mod h1:+5NJ2+qvTyV9exUAL/rxXi3DcLg2Ts+ymUAY5y4NvMg=
github.com/btcsuite/btcutil v1.0.2 h1:9iZ1Terx9fMIOtq1VrwdqfsATL9MC2l8ZrUY6YZ2uts=
github.com/btcsuite/btcutil v1.0.2/go.mod h1:j9HUFwoQRsZL3V4n+qG+CUnEGHOarIxfC3Le2Yhbcts=
github.com/btcsuite/go-socks v0.0.0-20170105172521-4720035b7bfd/go.mod h1:HHNXQzUsZCxOoE+CPiyCTO6x34Zs86zZUiwtpXoGdtg=
github.com/btcsuite/goleveldb v0.0.0-20160330041536-7834afc9e8cd/go.mod h1:F+uVaaLLH7j4eDXPRvw78tMflu7Ie2bzYOH4Y8rRKBY=
github.com/btcsuite/goleveldb v1.0.0/go.mod h1:QiK9vBlgftBg6rWQIj6wFzbPfRjiykIEhBH4obrXJ/I=
@@ -53,6 +47,8 @@ github.com/btcsuite/snappy-go v0.0.0-20151229074030-0bdef8d06723/go.mod h1:8woku
github.com/btcsuite/snappy-go v1.0.0/go.mod h1:8woku9dyThutzjeg+3xrA5iCpBRH8XEEg3lh6TiUghc=
github.com/btcsuite/websocket v0.0.0-20150119174127-31079b680792/go.mod h1:ghJtEyQwv5/p4Mg4C0fgbePVuGr935/5ddU9Z3TmDRY=
github.com/btcsuite/winsvc v1.0.0/go.mod h1:jsenWakMcC0zFBFurPLEAyrnc/teJEM1O46fmI40EZs=
github.com/cenkalti/backoff v2.2.1+incompatible h1:tNowT99t7UNflLxfYYSlKYsBpXdEet03Pg2g16Swow4=
github.com/cenkalti/backoff v2.2.1+incompatible/go.mod h1:90ReRw6GdpyfrHakVjL/QHaoyV4aDUVVkXQJJJ3NXXM=
github.com/cenkalti/backoff/v5 v5.0.3 h1:ZN+IMa753KfX5hd8vVaMixjnqRZ3y8CuJKRKj1xcsSM=
github.com/cenkalti/backoff/v5 v5.0.3/go.mod h1:rkhZdG3JZukswDf7f0cwqPNk4K0sa+F97BxZthm/crw=
github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs=
@@ -78,13 +74,13 @@ github.com/cockroachdb/tokenbucket v0.0.0-20250429170803-42689b6311bb h1:3bCgBvB
github.com/cockroachdb/tokenbucket v0.0.0-20250429170803-42689b6311bb/go.mod h1:7nc4anLGjupUW/PeY5qiNYsdNXj7zopG+eqsS7To5IQ=
github.com/consensys/gnark-crypto v0.20.1 h1:PXDUBvk8AzhvWowHLWBEAfUQcV1/aZgWIqD6eMpXmDg=
github.com/consensys/gnark-crypto v0.20.1/go.mod h1:RBWrSgy+IDbGR69RRV313th3M/aZU1ubk2om+qHuTSc=
github.com/cosmos/go-bip39 v1.0.0 h1:pcomnQdrdH22njcAatO0yWojsUnCO3y2tNoV1cb6hHY=
github.com/cosmos/go-bip39 v1.0.0/go.mod h1:RNJv0H/pOIVgxw6KS7QeX2a0Uo0aKUlfhZ4xuwvCdJw=
github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g=
github.com/cpuguy83/go-md2man/v2 v2.0.7 h1:zbFlGlXEAKlwXpmvle3d8Oe3YnkKIK4xSRTd3sHPnBo=
github.com/cpuguy83/go-md2man/v2 v2.0.7/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g=
github.com/crate-crypto/go-eth-kzg v1.5.0 h1:FYRiJMJG2iv+2Dy3fi14SVGjcPteZ5HAAUe4YWlJygc=
github.com/crate-crypto/go-eth-kzg v1.5.0/go.mod h1:J9/u5sWfznSObptgfa92Jq8rTswn6ahQWEuiLHOjCUI=
github.com/crate-crypto/go-ipa v0.0.0-20240724233137-53bbb0ceb27a h1:W8mUrRp6NOVl3J+MYp5kPMoUZPp7aOYHtaua31lwRHg=
github.com/crate-crypto/go-ipa v0.0.0-20240724233137-53bbb0ceb27a/go.mod h1:sTwzHBvIzm2RfVCGNEBZgRyjwK40bVoun3ZnGOCafNM=
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
github.com/cronokirby/saferith v0.33.0 h1:TgoQlfsD4LIwx71+ChfRcIpjkw+RPOapDEVxa+LhwLo=
github.com/cronokirby/saferith v0.33.0/go.mod h1:QKJhjoqUtBsXCAVEjw38mFqoi7DebT7kthcD7UzbnoA=
@@ -117,8 +113,6 @@ github.com/ethereum/c-kzg-4844/v2 v2.1.7 h1:aat3CuITdDbPC6pmEGRT0zJ5eOxzrZj8TJT5
github.com/ethereum/c-kzg-4844/v2 v2.1.7/go.mod h1:8HMkUZ5JRv4hpw/XUrYWSQNAUzhHMg2UDb/U+5m+XNw=
github.com/ethereum/go-bigmodexpfix v0.0.0-20250911101455-f9e208c548ab h1:rvv6MJhy07IMfEKuARQ9TKojGqLVNxQajaXEp/BoqSk=
github.com/ethereum/go-bigmodexpfix v0.0.0-20250911101455-f9e208c548ab/go.mod h1:IuLm4IsPipXKF7CW5Lzf68PIbZ5yl7FFd74l/E0o9A8=
github.com/ethereum/go-verkle v0.2.2 h1:I2W0WjnrFUIzzVPwm8ykY+7pL2d4VhlsePn4j7cnFk8=
github.com/ethereum/go-verkle v0.2.2/go.mod h1:M3b90YRnzqKyyzBEWJGqj8Qff4IDeXnzFw0P9bFw3uk=
github.com/fatih/structtag v1.2.0 h1:/OdNE99OxoI/PqaW/SuSK9uxxT3f/tcSZgon/ssNSx4=
github.com/fatih/structtag v1.2.0/go.mod h1:mBJUNpUnHmRKrKlQQlmCrh5PuhftFbNv8Ys4/aAZl94=
github.com/ferranbt/fastssz v1.0.0 h1:9EXXYsracSqQRBQiHeaVsG/KQeYblPf40hsQPb9Dzk8=
@@ -130,8 +124,8 @@ github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4
github.com/fsnotify/fsnotify v1.5.4/go.mod h1:OVB6XrOHzAwXMpEM7uPOzcehqUV2UqJxmVXmkdnm1bU=
github.com/fsnotify/fsnotify v1.9.0 h1:2Ml+OJNzbYCTzsxtv8vKSFD9PbJjmhYF14k/jKC7S9k=
github.com/fsnotify/fsnotify v1.9.0/go.mod h1:8jBTzvmWwFyi3Pb8djgCCO5IBqzKJ/Jwo8TRcHyHii0=
github.com/fxamacker/cbor/v2 v2.9.0 h1:NpKPmjDBgUfBms6tr6JZkTHtfFGcMKsw3eGcmD/sapM=
github.com/fxamacker/cbor/v2 v2.9.0/go.mod h1:vM4b+DJCtHn+zz7h3FFp/hDAI9WNWCsZj23V5ytsSxQ=
github.com/fxamacker/cbor/v2 v2.9.1 h1:2rWm8B193Ll4VdjsJY28jxs70IdDsHRWgQYAI80+rMQ=
github.com/fxamacker/cbor/v2 v2.9.1/go.mod h1:vM4b+DJCtHn+zz7h3FFp/hDAI9WNWCsZj23V5ytsSxQ=
github.com/getsentry/sentry-go v0.44.1 h1:/cPtrA5qB7uMRrhgSn9TYtcEF36auGP3Y6+ThvD/yaI=
github.com/getsentry/sentry-go v0.44.1/go.mod h1:XDotiNZbgf5U8bPDUAfvcFmOnMQQceESxyKaObSssW0=
github.com/gkampitakis/ciinfo v0.3.2 h1:JcuOPk8ZU7nZQjdUhctuhQofk7BGHuIy0c9Ez8BNhXs=
@@ -205,8 +199,8 @@ github.com/gorilla/rpc v1.2.1/go.mod h1:uNpOihAlF5xRFLuTYhfR0yfCTm0WTQSQttkMSptR
github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
github.com/gorilla/websocket v1.5.4-0.20250319132907-e064f32e3674 h1:JeSE6pjso5THxAzdVpqr6/geYxZytqFMBCOtn/ujyeo=
github.com/gorilla/websocket v1.5.4-0.20250319132907-e064f32e3674/go.mod h1:r4w70xmWCQKmi1ONH4KIaBptdivuRPyosB9RmPlGEwA=
github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0 h1:Ovs26xHkKqVztRpIrF/92BcuyuQ/YW4NSIpoGtfXNho=
github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk=
github.com/grandcat/zeroconf v1.0.0 h1:uHhahLBKqwWBV6WZUDAT71044vwOTL+McW0mBJvo6kE=
github.com/grandcat/zeroconf v1.0.0/go.mod h1:lTKmG1zh86XyCoUeIHSA4FJMBwCJiQmGfcP2PdzytEs=
github.com/grpc-ecosystem/grpc-gateway/v2 v2.28.0 h1:HWRh5R2+9EifMyIHV7ZV+MIZqgz+PMpZ14Jynv3O2Zs=
github.com/grpc-ecosystem/grpc-gateway/v2 v2.28.0/go.mod h1:JfhWUomR1baixubs02l85lZYYOm7LV6om4ceouMv45c=
github.com/gtank/merlin v0.1.1 h1:eQ90iG7K9pOhtereWsmyRJ6RAwcP4tHTDBHXNg+u5is=
@@ -256,137 +250,118 @@ 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.9 h1:QpXaZQUll0IlOHV+YgYUbrWcJeOYNNGzkwjI8e091x0=
github.com/luxfi/accel v1.0.9/go.mod h1:XvgcJLYsLObbKlrOgd3E2OJx5Oy5c/HnDlIewjr+Y+c=
github.com/luxfi/accel v1.1.9 h1:Tsk6gXj2uKE19501bD0ajRYdeCHIlTGb6jYyLc+F8hc=
github.com/luxfi/accel v1.1.9/go.mod h1:K00BcnLzEYMPHwCFq8Tf/450ApmTs9xBVvYOnofJCkc=
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=
github.com/luxfi/age v1.4.0/go.mod h1:iAYAxgvrXxcy746+Ovh/eWWDuF9teJLNcCSSOX9RYW0=
github.com/luxfi/age v1.5.0 h1:G69HbSV4R3vKEH9B0CulnRaMdSdf4RalMgP8xKmxHeI=
github.com/luxfi/age v1.5.0/go.mod h1:iAYAxgvrXxcy746+Ovh/eWWDuF9teJLNcCSSOX9RYW0=
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/api v1.0.10 h1:tqtiCX8DcBsFG0JEhKy7eUNI+42+m2DoPjLjEh5TE5E=
github.com/luxfi/api v1.0.10/go.mod h1:5OFWvZF+PbyuvLCDyKKpXCA/xp+LxJ32yOhNEKwQFN0=
github.com/luxfi/api v1.0.11 h1:t4fzN9Ox/Vy5msW2WpSXq4xCAmBXXJS0oM+zIjM9IiQ=
github.com/luxfi/api v1.0.11/go.mod h1:q3Hh3mmkvp3cnv3aqe2+gCtmmSAL/uFjuzrqGavQLNA=
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 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/chains v1.2.3 h1:d/xrJRuLYc/AkeugR4kRTwlYHudh1dfqjIaHGZPfIcI=
github.com/luxfi/chains v1.2.3/go.mod h1:aofU2aS8s5tHiD8VVQydcYStQCpR356f1UPHGlNi67U=
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/config v1.1.2 h1:iCUewwm7oT7ckRNyQkrVHZ5Ge+l+FadciGX/zyaPo/k=
github.com/luxfi/config v1.1.2/go.mod h1:z6t0a5pGpQz2uDW2qJPLX5fZ/eWbpiNa51gBc63ebFk=
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/consensus v1.23.0 h1:Jp/SuhDfLvbdXqMCi7NktWQTDXrKPbStEvIQjXsM3+g=
github.com/luxfi/consensus v1.23.0/go.mod h1:HufC4lEizSDbpG6JBzeg5Z1ZSpZi+1/cL4/PrJr4FEI=
github.com/luxfi/consensus v1.23.1 h1:JWJunRWlr2bwBVl3lfeMAmgnuibhlJS66bTM9ftcfxI=
github.com/luxfi/consensus v1.23.1/go.mod h1:ZkD2ART+vXh9DqWJqqYAV+U0BA66DtQGFwpQbnP46pE=
github.com/luxfi/consensus v1.23.2 h1:Edr/AhBbJH9RXwplCn65jYYb73bxRqbzKF6orpYYyfc=
github.com/luxfi/consensus v1.23.2/go.mod h1:16Q5zhPY09mhjEMOetd6QMzf0ZFqGSt6K5Fy7V/BTE8=
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/constants v1.5.2 h1:fwQepO6viKAwf8ACnP9YV0TVUxndZuZM7U/aKcqe9EM=
github.com/luxfi/constants v1.5.2/go.mod h1:hOszZ2NDQ8gMZKncfcZ67PXkb5OIbnwAzXC3oFbQwW0=
github.com/luxfi/consensus v1.25.13 h1:hqbFq6W+oRvCrovj6Yu1zOsJNiRymHpjGdqZT1LvZUg=
github.com/luxfi/consensus v1.25.13/go.mod h1:7/tlpy+byv2tP7YZSMG+XtS8C2bbz3qpB4H8jxXhHxk=
github.com/luxfi/constants v1.5.7 h1:a1tCMdxd+pClPMIPOaI9vcYGNy6cQIc2rubac2Trc0k=
github.com/luxfi/constants v1.5.7/go.mod h1:z+Wc7skybZAA+xuBWNcmtv402S/BFqixL+FiSQXPg8U=
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.18.1 h1:Qaw8hSK0unIOAH6TRvu0s3JfoJWcg6zTf5eZ5adgKic=
github.com/luxfi/crypto v1.18.1/go.mod h1:QhSdEEk3xmgR5a97/nkXB/n21ZsI1Iv7tcbqQaNM5zs=
github.com/luxfi/crypto v1.18.3 h1:f6mBUHNjZl9/9nXPSqjq+oJttrPl8slvcZ49Vi7jKw4=
github.com/luxfi/crypto v1.18.3/go.mod h1:qBtCJDT6p6aNa2hMtPxYwC688Bnsb3Amso8q09GsMls=
github.com/luxfi/database v1.18.2 h1:r7jU8s4jaN0NpzWB0x91yyaL4CoCe0SxWEvxJGhJ7rE=
github.com/luxfi/database v1.18.2/go.mod h1:PW0oGujt165mYg7j/lctVbnfsUW6QLfIAgjyQdS66SM=
github.com/luxfi/corona v0.7.6 h1:CJP6smygD55dL0HHkKkWryL9H24a+wXvs+L+WchK7Nc=
github.com/luxfi/corona v0.7.6/go.mod h1:4aD7+ZqnlZ2aVuU/DBQ5aspIagv5ux45LW2sJ4+siY8=
github.com/luxfi/crypto v1.19.17 h1:l2LLu7UFyICtJVfraLDLRi+lFGiDXKHSL18M9/m1gsQ=
github.com/luxfi/crypto v1.19.17/go.mod h1:INjdZtke85k8hX/QAmTMAY8bbZ4gzGZQLqURg3xf6Gk=
github.com/luxfi/crypto/ipa v1.2.4 h1:6xfwhI9/HrcDkF3Ti5/NxsNQIWbwYDJmRSNIHRQ/xfU=
github.com/luxfi/crypto/ipa v1.2.4/go.mod h1:43J6f6rcfUMrZt4cQectMOZb6Ps+fAEj8ZTPC3Kk+gE=
github.com/luxfi/database v1.18.3 h1:gg+xwhKUxXa7fDoOD8IS91E71QqoEtcDCl2nfS61Jgg=
github.com/luxfi/database v1.18.3/go.mod h1:sv0pYCGKlK1aNJTICxFUDpVWCJTigoLlshHmV/1pg7c=
github.com/luxfi/evm v0.8.49 h1:xBiGibL6v1Gm02EIHVtvGvAIGVdPUY0kgsX8MDynApI=
github.com/luxfi/evm v0.8.49/go.mod h1:fgtQq7WGR5EpaqJTdYn//EqzAZDvBH9OKkPYS7s4oMI=
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/genesis v1.9.2 h1:DMcFVLebRgcA+ElTbxAqaFOOMvXEU7UsBE8yBYGLum0=
github.com/luxfi/genesis v1.9.2/go.mod h1:k26ZZvzES8e9cep9oWUDggBX+6oa5bnIQ7MmQP7dm4A=
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/geth v1.16.87 h1:UDjMRrseg/D5a3NDygdJXMkfJcHNOZXzcMcCn/AhIV8=
github.com/luxfi/geth v1.16.87/go.mod h1:E5YcGOW9jB6Rgo4LB7NlTZxvkPzIoh1w7q56O63Zf1g=
github.com/luxfi/genesis v1.13.8 h1:oddTmow0gEX/q/FrLQv77jXuSePCFRyMUvT9Pr3WnCw=
github.com/luxfi/genesis v1.13.8/go.mod h1:iwXcnFHY997cWUKzyP4SCBl7o493SYHQniy3QViZOAg=
github.com/luxfi/genesis/pkg/genesis/security v1.13.8 h1:9ier0p55ErSpoXHRJpZ04WV5HwwMB1uDrU7PHGBKG2U=
github.com/luxfi/genesis/pkg/genesis/security v1.13.8/go.mod h1:DzU+GYUFv12ja4Vc46bWKNBBmNYbcow3u/DASx4wpfI=
github.com/luxfi/geth v1.16.98 h1:w187TtKuGStf3tm2bshuHVKBv2Frjx0lT54kQVXyNHA=
github.com/luxfi/geth v1.16.98/go.mod h1:6kEzSExdk9CPQDPXALt6P3HfQqBq7KF1Jrrv9gBpxbU=
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=
github.com/luxfi/go-bip39 v1.1.2/go.mod h1:96de9VkR2kY/ASAnhMtvt3TSh+PZkAFAngNj0GjRGDo=
github.com/luxfi/ids v1.2.9 h1:+yjdhXW99drnd2Zlp1u/p8k3G23W3/1btJQ4ogHawUI=
github.com/luxfi/ids v1.2.9/go.mod h1:khJOEdOPxd22yn0jcVrnbX1ADa0GHn5Y74gvCzN5BYc=
github.com/luxfi/ids v1.2.13 h1:lEotq0WUpMLcc/5X5MbE3n73jdfNo8IlFvTDfUXg+9A=
github.com/luxfi/ids v1.2.13/go.mod h1:QWjJvggX/nRkmrz1AGSaF2Y6mnOvz3g7lFOzs3Zd+JM=
github.com/luxfi/keychain v1.0.2 h1:uQgmjs37/VBIALEiYrrszTpxvtqr07/YvS9TnmxGafs=
github.com/luxfi/keychain v1.0.2/go.mod h1:q/4ULgZBlstKkwzOzG/0T6y73BDPgnkrcibbJyTvmbU=
github.com/luxfi/keys v1.0.8 h1:fANl6qZInndyCcXHAWiHTQ50LHhU8pJlF0Ix3phTo4A=
github.com/luxfi/keys v1.0.8/go.mod h1:XbSCtgLyzEEVz2oZsYxnhRrNTGBxqrAm2Zu0uu06+qA=
github.com/luxfi/lattice/v7 v7.0.0 h1:d1vgan6mlb2KtwYfPc1g69uxVYaoVYZmlrIm4aCO88w=
github.com/luxfi/lattice/v7 v7.0.0/go.mod h1:PFDdOkuGTQ0cbJMbKojzEJMGWUQmZW+wK9/wJ9F9fOs=
github.com/luxfi/lattice/v7 v7.1.0 h1:mr3HvN6olNTS2LT/xAW/JBhTqfvpsGmsopDMeR7BSJs=
github.com/luxfi/lattice/v7 v7.1.0/go.mod h1:IaaUN+3ysnBG4BA8ILRYG0j80+qtYDP4C5lkaDb2pDE=
github.com/luxfi/lens v0.1.3 h1:JTk/AjhHdKaiJ6Z7ZNazqnRfbgRijUPIxHamKW7b/N8=
github.com/luxfi/lens v0.1.3/go.mod h1:XHpPOSgkT0ZFwfwp0t70Tvs5b6rjGyo1SNDEIDtfrqw=
github.com/luxfi/keys v1.1.0 h1:a4UkVVg6G09XC7vPtXKxEGwVt50GNPjEvq2pkjYZW2k=
github.com/luxfi/keys v1.1.0/go.mod h1:U3tZNDmv3nXkPoZwLtq9RNjwyN0XyoN29worigfT+c0=
github.com/luxfi/kms v1.11.2 h1:bIx1uq8dTnUFVp7JtCN5W5M91KyZX9oWr8OEzoWLQDQ=
github.com/luxfi/kms v1.11.2/go.mod h1:k91I3fULpJHicaWa2YESthHtHv3XwGlJauW/dcvB6WM=
github.com/luxfi/lattice/v7 v7.1.4 h1:hQR02M6cHTAV5+joOPi9gb9Gm+z/hKJnhJF4IlciIJs=
github.com/luxfi/lattice/v7 v7.1.4/go.mod h1:DmIQFi3mJiehVsR235l1NKYEU0JhU649OX5p7gMEW2c=
github.com/luxfi/lens v0.1.4 h1:goGjGDXx2BNdjzXDunL5QT8elK2ZyCcc0z8TAbtWYrg=
github.com/luxfi/lens v0.1.4/go.mod h1:mL+G8IK+9L41d78/2FYRgfhEzAjcr5+VEXB8SGuHbus=
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.4.0 h1:/sb7Grw3hfO+5INWAWdB95jTvCeXg8fSQxsxDzcFtd4=
github.com/luxfi/math v1.4.0/go.mod h1:iW0FOCC8qF2mPE+MakG780CAHA83848lb1L04thA1Pg=
github.com/luxfi/magnetar v1.2.0 h1:bsxHmBnJiswc/A6ElQ0pWz5g6ogqewIEKKqR26VgizA=
github.com/luxfi/magnetar v1.2.0/go.mod h1:7J9YP9jByWbwCjssMFJNUkTU8tcPlSUoVSSiYShtvFs=
github.com/luxfi/math v1.4.1 h1:1t9bCCsEqnl9yIKrShlbs80DBKyYTWdnzkVfBqEeO7Q=
github.com/luxfi/math v1.4.1/go.mod h1:QvbRxauQyE1w4lvbcLSe6c8yeJz2Zj1Bq1rayGgs2tA=
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=
github.com/luxfi/math/safe v0.0.1/go.mod h1:EejrmOJHh03YAD8+Zww8cPcMR1K3Q2I7w1dX4sMloeo=
github.com/luxfi/metric v1.5.1 h1:6tVarXMnNR3Xzud8FYUHjtXabTll3HI/OEqG0tgLAcI=
github.com/luxfi/metric v1.5.1/go.mod h1:PkD4D4JoGuyKtfUkqPNYkrg9xKrJeNVZFdW/5XvAe/A=
github.com/luxfi/mdns v0.1.1 h1:g2eRr9AXcziPkkcd24M+Qu9ApEpoKKjfI79QSNqv0rQ=
github.com/luxfi/mdns v0.1.1/go.mod h1:dbp5f3h3aE7CGzwbaWzBM9cwdcekhmSrWhQevgYhhNA=
github.com/luxfi/metric v1.5.7 h1:LoSPEUpak2SLcynF+LT2cXjl9ECp4nY+Lia9zudmDv4=
github.com/luxfi/metric v1.5.7/go.mod h1:CMguEhyuLi4YUWyXimJ+UHply99BDFrL0pxedB7rBqM=
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/netrunner v1.18.1 h1:tiLpbxoKedoiBORATKZ/mW00zd7SEC/P+Q9KWDldn2M=
github.com/luxfi/netrunner v1.18.1/go.mod h1:zBAG98SGjPdBpo2/ccPvHCzvTQVvayH/Q8xviNa0FnU=
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.12 h1:YiF8gaPVFjXESHC+44XVM1RkAyZFMb8iU/60Tfq3Kxs=
github.com/luxfi/precompile v0.5.12/go.mod h1:YiTU6xMf2wmKM2LBzKctn82JhaesFDz4ysC+S864qCA=
github.com/luxfi/precompile v0.5.14 h1:z8mlWv7yWqWczWp59qoxTp0B7l/a0HMtMBPk27MEKyg=
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/pulsar v0.1.5 h1:Yi9zlYsSOrParueW3ngm3EUVAwZx6DhFsO3cFH3h+1k=
github.com/luxfi/pulsar v0.1.5/go.mod h1:Zei7PZhYxEsfzY5Rg0iI73nMU0ngO8EpUhlOOC0Ys7g=
github.com/luxfi/pq v1.0.3 h1:pFlQm1+5FuKTDUh2y/23bXWkN4I2Rc5iuxJypwDFFMs=
github.com/luxfi/pq v1.0.3/go.mod h1:8bppZcRElfrVt0n3nYCZW3iX1TvhvzNbdjNdK1irgIE=
github.com/luxfi/precompile v0.5.27 h1:lEF5gXY8ny5xXp8Qg8PK0Y2RQlaRNOZeDU+wP6Sj24M=
github.com/luxfi/precompile v0.5.27/go.mod h1:boKRJeoa4XEhCoylRnPI/0IGfBgm5bZnFNI9llDktWo=
github.com/luxfi/proto v1.0.2 h1:kT/2c6M85nqJOzOZ9SYyZHCSGH32qexovMCB7ZPGk8g=
github.com/luxfi/proto v1.0.2/go.mod h1:pZLKsCmhiPtmm3z7ezBbnsYT2m79q+cFSmzxvuBeANE=
github.com/luxfi/protocol v0.0.4 h1:wf3JSyeNMEabOUG0vExtIAtjfpJAyHXlepGBwv5g9NE=
github.com/luxfi/protocol v0.0.4/go.mod h1:9f35GLNlcHAz6LCvFBDZP5fTD2QnN0URXWGUOcD1JPU=
github.com/luxfi/pulsar v1.1.2 h1:iPQlEpnVCggQSTZzUa9i/la2WLEN7fl7/4QVahGs9Ag=
github.com/luxfi/pulsar v1.1.2/go.mod h1:U7tPleeAHJ9dZ61ymtstzLKKoZjxM2zFeGZ+RSjHyRw=
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=
github.com/luxfi/corona v0.2.0/go.mod h1:SZ+aDLUdfSAtaTRaaYzeDZ5DNQiLaOCelSaIGjL21R0=
github.com/luxfi/rpc v1.0.2 h1:NLRcOYRW+io0d1d33RMkgOZea8nlhK09MbPgCXcU5wU=
github.com/luxfi/rpc v1.0.2/go.mod h1:pgiHwMWgOuxYYIa0vsUBvrBI+Op6bhZ39guM9vtMUcE=
github.com/luxfi/runtime v1.0.1 h1:cii3OsRiVSIl9jzfWFM6++62T1r6ZSGP+/3F0Ezhpqw=
github.com/luxfi/runtime v1.0.1/go.mod h1:2hBKjzbEeE4dzrhUKH8dqkRgLEyiXz6GmuVusy3vJMs=
github.com/luxfi/runtime v1.1.0 h1:6TrvzAmZVCTVbR1ebntHTO3/kVBaogPUSkxdDMnrTiw=
github.com/luxfi/runtime v1.1.0/go.mod h1:Mfv2zlXqvfRFMS+/zXgG1TieyP9VnvtVzOGB437+o4Y=
github.com/luxfi/sampler v1.0.0 h1:k8Sf6otW83w4pQp0jXLA+g3J/joB7w7SqXQsWmNTOV0=
github.com/luxfi/sampler v1.0.0/go.mod h1:f96/ozlj9vFfZj+akLtrHn4VpulQahwB+MQQhpeIekk=
github.com/luxfi/sdk v1.16.52 h1:X1rZrgzGTIGzeVMKx9I44/kSvYFPhFu3h2SQ9StpTxA=
github.com/luxfi/sdk v1.16.52/go.mod h1:IEP/ej5HA/rCOFOMzv/LfG4oXl2pI9ly+MrpcbVguBg=
github.com/luxfi/sdk v1.16.60 h1:MKIFpGAIQzbFADXNd6rV5KySlbegnvpDJyiNhtO7YZw=
github.com/luxfi/sdk v1.16.60/go.mod h1:se4G9mlLc6WdjLQlydg6J3pFEeMlEH+MCO1puJ8sYYc=
github.com/luxfi/staking v1.1.0 h1:oB1f86WG9duxONe6unISHpUlelnmVg8+BOg4qP83q6Y=
github.com/luxfi/staking v1.1.0/go.mod h1:xwYacmreoKoy31ELT6QPno6b5M8q7bg4zJrmmt524X4=
github.com/luxfi/sys v0.0.0-20260110090042-50187ec5ffd8 h1:6L5294QWwXzy9he6wAM+Dc39rV4iwyl9hex0k2pXPsg=
github.com/luxfi/sys v0.0.0-20260110090042-50187ec5ffd8/go.mod h1:Y0UwjnEJYSbGM7IvJbKYLf8BWNVLfT8Oz00bEiDITHw=
github.com/luxfi/threshold v1.5.5 h1:MgPMrHf7dryztiaOYaG+Z+Cqqfa79oyblp5EowDFJw4=
github.com/luxfi/threshold v1.5.5/go.mod h1:JEnYrKvCRDwGUeuCsMJSO2FeokuZGVaOml1XD/L1Vgs=
github.com/luxfi/threshold v1.6.7 h1:geHmdDAXVm+T9U5CSoUiduXhhRKRUbfKOd6dw+2rPzQ=
github.com/luxfi/threshold v1.6.7/go.mod h1:UzUXp2Fbnlb45AwYiXu++RsMkky4wocpKvhCc+rRg7g=
github.com/luxfi/threshold v1.9.7 h1:C0KcEhwHPiQehMKiKh22Hcq0jF4o1uxTY29dKaVAS/s=
github.com/luxfi/threshold v1.9.7/go.mod h1:5LEo5ZcAvBxBkr8Neb3GMbHxVa7m58qbbmEZNMAnR7c=
github.com/luxfi/timer v1.0.2 h1:g/odi0VQJIsrzdklJUG1thHZ/sGNnbIiVGcU6LctJm0=
github.com/luxfi/timer v1.0.2/go.mod h1:SoaZwntYigUE3H6z1GV32YwP8QaSiAT0UiEv7iPugXg=
github.com/luxfi/tls v1.0.3 h1:rK3nxSAxrUOOSHOZnKChwV4f6UJ+cfOl8KWJXAQx/SI=
@@ -399,18 +374,20 @@ 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.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/utxo v0.3.2 h1:fez7ptBnAoRYA5FpRz/uFWY8hcZwd4X00UYLnxuJeXE=
github.com/luxfi/utxo v0.3.2/go.mod h1:O8Ucl6Sj0nM7l3Y+uqzucVu309yHcRQY++rg9yXmmdo=
github.com/luxfi/validators v1.2.0 h1:VygpiBqBAdGrfkb7xzE2yrVmnXaqE+hm8FLWdGXO7G8=
github.com/luxfi/validators v1.2.0/go.mod h1:GYLulrNXAan23ZlX7sgWVbVnLpUexeB/m2qr2ymsXok=
github.com/luxfi/version v1.0.1 h1:T/1KYWEMmsrNQk7pN7PFPAwh/7XbeX7cFAKLBqI37Sk=
github.com/luxfi/version v1.0.1/go.mod h1:Y5fPkQ2DB0XRBCxgSPXp4ISzL1/jptKnmFknShRJCyg=
github.com/luxfi/vm v1.0.40 h1:kA0V/9p1VdC88EjgbljWb8t+fl9qz5bCyF3IxnV20yg=
github.com/luxfi/vm v1.0.40/go.mod h1:Y5WUKhT76PR6HnbUykHBWI2f5sjssrm5BL6/o7b6IfQ=
github.com/luxfi/warp v1.18.5 h1:yXFCT+lnvzJHs8nVvfUCQ9wNvhtgbDGaXJkJeiwgKf4=
github.com/luxfi/warp v1.18.5/go.mod h1:SFyC529HDvbP/TWRAdYQSyJUliMa5JKFRtBrTLEElp4=
github.com/luxfi/zapdb v1.8.0 h1:E9hXMW1MTuS6kmDVs07j62gIq5qI5gZOdyzVfiBc1wg=
github.com/luxfi/zapdb v1.8.0/go.mod h1:Qukh3hDRD0MnxA6z+a28JTnXhN85AiLLgp6TYr4QAMc=
github.com/luxfi/warp v1.18.6 h1:+ly7mHz77ig4yUyLax32aAjk7tiQQ6eygzOSDNfYRbQ=
github.com/luxfi/warp v1.18.6/go.mod h1:OBN23yiGl+E4qupkPHuetBIEqsI8q5leE8WJH8soFjY=
github.com/luxfi/zap v0.7.2 h1:YecWTWNE5PPJXL56sLIkzS8b23bprUwZ5lPAQuLUtTE=
github.com/luxfi/zap v0.7.2/go.mod h1:1k+nwT+JW802YzuPAuf7CxMSGr/qxvbGgGwi5k6X9Ok=
github.com/luxfi/zapdb v1.10.0 h1:1lLHEmkyC0BucnA/zjQYsMkUVxuEo2vQkEaQGjYfuuc=
github.com/luxfi/zapdb v1.10.0/go.mod h1:Qukh3hDRD0MnxA6z+a28JTnXhN85AiLLgp6TYr4QAMc=
github.com/luxfi/zwing v0.5.2 h1:2+nDKHVIdT8GvaKO79GuO3x/3DgJvX0gI32h4P+P6RU=
github.com/luxfi/zwing v0.5.2/go.mod h1:8nixkEL3bhO2LrqVqhJ8WgT+QGUtnCPIQIhFQh9gQio=
github.com/maruel/natural v1.1.1 h1:Hja7XhhmvEFhcByqDoHz9QZbkWey+COd9xWfCfn1ioo=
@@ -421,6 +398,9 @@ github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWE
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
github.com/mfridman/tparse v0.18.0 h1:wh6dzOKaIwkUGyKgOntDW4liXSo37qg5AXbIhkMV3vE=
github.com/mfridman/tparse v0.18.0/go.mod h1:gEvqZTuCgEhPbYk/2lS3Kcxg1GmTxxU7kTC8DvP0i/A=
github.com/miekg/dns v1.1.27/go.mod h1:KNUDUusw/aVsxyTYZM1oqvCicbwhgbNgztCETuNZ7xM=
github.com/miekg/dns v1.1.72 h1:vhmr+TF2A3tuoGNkLDFK9zi36F2LS+hKTRW0Uf8kbzI=
github.com/miekg/dns v1.1.72/go.mod h1:+EuEPhdHOsfk6Wk5TT2CzssZdqkmFhf8r+aVyDEToIs=
github.com/mimoo/StrobeGo v0.0.0-20181016162300-f8f6d4d2b643/go.mod h1:43+3pMjjKimDBf5Kr4ZFNGbLql1zKkbImw+fZbw3geM=
github.com/mimoo/StrobeGo v0.0.0-20220103164710-9a04d6ca976b h1:QrHweqAtyJ9EwCaGHBu1fghwxIPiopAHV06JlXrMHjk=
github.com/mimoo/StrobeGo v0.0.0-20220103164710-9a04d6ca976b/go.mod h1:xxLb2ip6sSUts3g1irPVHyk/DGslwQsNOo9I7smJfNU=
@@ -436,8 +416,6 @@ github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyua
github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=
github.com/mitchellh/pointerstructure v1.2.1 h1:ZhBBeX8tSlRpu/FFhXH4RC4OJzFlqsQhoHZAz4x7TIw=
github.com/mitchellh/pointerstructure v1.2.1/go.mod h1:BRAsLI5zgXmw97Lf6s25bs8ohIXc3tViBH44KcwB2g4=
github.com/montanaflynn/stats v0.8.2 h1:52wnefTJnPI5FoHif1DQh2soKRw0yYs+4AVyvtcZCH0=
github.com/montanaflynn/stats v0.8.2/go.mod h1:etXPPgVO6n31NxCd9KQUMvCM+ve0ruNzt6R8Bnaayow=
github.com/montanaflynn/stats v0.9.0 h1:tsBJ0RXwph9BmAuFoCmqGv6e8xa0MENQ8m0ptKq29mQ=
github.com/montanaflynn/stats v0.9.0/go.mod h1:etXPPgVO6n31NxCd9KQUMvCM+ve0ruNzt6R8Bnaayow=
github.com/mr-tron/base58 v1.2.0 h1:T/HDJBh4ZCPbU39/+c3rRvE0uKBQlU27+QI8LJ4t64o=
@@ -483,8 +461,8 @@ github.com/pion/transport/v2 v2.2.10 h1:ucLBLE8nuxiHfvkFKnkDQRYWYfp8ejf4YBOPfaQp
github.com/pion/transport/v2 v2.2.10/go.mod h1:sq1kSLWs+cHW9E+2fJP95QudkzbK7wscs8yYgQToO5E=
github.com/pion/transport/v3 v3.1.1 h1:Tr684+fnnKlhPceU+ICdrw6KKkTms+5qHMgw6bIkYOM=
github.com/pion/transport/v3 v3.1.1/go.mod h1:+c2eewC5WJQHiAA46fkMMzoYZSuGzA/7E2FPrOYHctQ=
github.com/pires/go-proxyproto v0.8.1 h1:9KEixbdJfhrbtjpz/ZwCdWDD2Xem0NZ38qMYaASJgp0=
github.com/pires/go-proxyproto v0.8.1/go.mod h1:ZKAAyp3cgy5Y5Mo4n9AlScrkCZwUy0g3Jf+slqQVcuU=
github.com/pires/go-proxyproto v0.11.0 h1:gUQpS85X/VJMdUsYyEgyn59uLJvGqPhJV5YvG68wXH4=
github.com/pires/go-proxyproto v0.11.0/go.mod h1:ZKAAyp3cgy5Y5Mo4n9AlScrkCZwUy0g3Jf+slqQVcuU=
github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA=
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
@@ -585,24 +563,24 @@ github.com/zeebo/pcg v1.0.1 h1:lyqfGeWiv4ahac6ttHs+I5hwtH/+1mrhlCtVNQM2kHo=
github.com/zeebo/pcg v1.0.1/go.mod h1:09F0S9iiKrwn9rlI5yjLkmrug154/YRW6KnnXVDM/l4=
go.opentelemetry.io/auto/sdk v1.2.1 h1:jXsnJ4Lmnqd11kwkBV2LgLoFMZKizbCi5fNZ/ipaZ64=
go.opentelemetry.io/auto/sdk v1.2.1/go.mod h1:KRTj+aOaElaLi+wW1kO/DZRXwkF4C5xPbEe3ZiIhN7Y=
go.opentelemetry.io/otel v1.42.0 h1:lSQGzTgVR3+sgJDAU/7/ZMjN9Z+vUip7leaqBKy4sho=
go.opentelemetry.io/otel v1.42.0/go.mod h1:lJNsdRMxCUIWuMlVJWzecSMuNjE7dOYyWlqOXWkdqCc=
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.39.0 h1:f0cb2XPmrqn4XMy9PNliTgRKJgS5WcL/u0/WRYGz4t0=
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.39.0/go.mod h1:vnakAaFckOMiMtOIhFI2MNH4FYrZzXCYxmb1LlhoGz8=
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.39.0 h1:in9O8ESIOlwJAEGTkkf34DesGRAc/Pn8qJ7k3r/42LM=
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.39.0/go.mod h1:Rp0EXBm5tfnv0WL+ARyO/PHBEaEAT8UUHQ6AGJcSq6c=
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.39.0 h1:Ckwye2FpXkYgiHX7fyVrN1uA/UYd9ounqqTuSNAv0k4=
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.39.0/go.mod h1:teIFJh5pW2y+AN7riv6IBPX2DuesS3HgP39mwOspKwU=
go.opentelemetry.io/otel/metric v1.42.0 h1:2jXG+3oZLNXEPfNmnpxKDeZsFI5o4J+nz6xUlaFdF/4=
go.opentelemetry.io/otel/metric v1.42.0/go.mod h1:RlUN/7vTU7Ao/diDkEpQpnz3/92J9ko05BIwxYa2SSI=
go.opentelemetry.io/otel/sdk v1.40.0 h1:KHW/jUzgo6wsPh9At46+h4upjtccTmuZCFAc9OJ71f8=
go.opentelemetry.io/otel/sdk v1.40.0/go.mod h1:Ph7EFdYvxq72Y8Li9q8KebuYUr2KoeyHx0DRMKrYBUE=
go.opentelemetry.io/otel/sdk/metric v1.40.0 h1:mtmdVqgQkeRxHgRv4qhyJduP3fYJRMX4AtAlbuWdCYw=
go.opentelemetry.io/otel/sdk/metric v1.40.0/go.mod h1:4Z2bGMf0KSK3uRjlczMOeMhKU2rhUqdWNoKcYrtcBPg=
go.opentelemetry.io/otel/trace v1.42.0 h1:OUCgIPt+mzOnaUTpOQcBiM/PLQ/Op7oq6g4LenLmOYY=
go.opentelemetry.io/otel/trace v1.42.0/go.mod h1:f3K9S+IFqnumBkKhRJMeaZeNk9epyhnCmQh/EysQCdc=
go.opentelemetry.io/proto/otlp v1.9.0 h1:l706jCMITVouPOqEnii2fIAuO3IVGBRPV5ICjceRb/A=
go.opentelemetry.io/proto/otlp v1.9.0/go.mod h1:xE+Cx5E/eEHw+ISFkwPLwCZefwVjY+pqKg1qcK03+/4=
go.opentelemetry.io/otel v1.43.0 h1:mYIM03dnh5zfN7HautFE4ieIig9amkNANT+xcVxAj9I=
go.opentelemetry.io/otel v1.43.0/go.mod h1:JuG+u74mvjvcm8vj8pI5XiHy1zDeoCS2LB1spIq7Ay0=
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.43.0 h1:88Y4s2C8oTui1LGM6bTWkw0ICGcOLCAI5l6zsD1j20k=
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.43.0/go.mod h1:Vl1/iaggsuRlrHf/hfPJPvVag77kKyvrLeD10kpMl+A=
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.42.0 h1:zWWrB1U6nqhS/k6zYB74CjRpuiitRtLLi68VcgmOEto=
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.42.0/go.mod h1:2qXPNBX1OVRC0IwOnfo1ljoid+RD0QK3443EaqVlsOU=
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.43.0 h1:3iZJKlCZufyRzPzlQhUIWVmfltrXuGyfjREgGP3UUjc=
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.43.0/go.mod h1:/G+nUPfhq2e+qiXMGxMwumDrP5jtzU+mWN7/sjT2rak=
go.opentelemetry.io/otel/metric v1.43.0 h1:d7638QeInOnuwOONPp4JAOGfbCEpYb+K6DVWvdxGzgM=
go.opentelemetry.io/otel/metric v1.43.0/go.mod h1:RDnPtIxvqlgO8GRW18W6Z/4P462ldprJtfxHxyKd2PY=
go.opentelemetry.io/otel/sdk v1.43.0 h1:pi5mE86i5rTeLXqoF/hhiBtUNcrAGHLKQdhg4h4V9Dg=
go.opentelemetry.io/otel/sdk v1.43.0/go.mod h1:P+IkVU3iWukmiit/Yf9AWvpyRDlUeBaRg6Y+C58QHzg=
go.opentelemetry.io/otel/sdk/metric v1.43.0 h1:S88dyqXjJkuBNLeMcVPRFXpRw2fuwdvfCGLEo89fDkw=
go.opentelemetry.io/otel/sdk/metric v1.43.0/go.mod h1:C/RJtwSEJ5hzTiUz5pXF1kILHStzb9zFlIEe85bhj6A=
go.opentelemetry.io/otel/trace v1.43.0 h1:BkNrHpup+4k4w+ZZ86CZoHHEkohws8AY+WTX09nk+3A=
go.opentelemetry.io/otel/trace v1.43.0/go.mod h1:/QJhyVBUUswCphDVxq+8mld+AvhXZLhe+8WVFxiFff0=
go.opentelemetry.io/proto/otlp v1.10.0 h1:IQRWgT5srOCYfiWnpqUYz9CVmbO8bFmKcwYxpuCSL2g=
go.opentelemetry.io/proto/otlp v1.10.0/go.mod h1:/CV4QoCR/S9yaPj8utp3lvQPoqMtxXdzn7ozvvozVqk=
go.uber.org/atomic v1.11.0 h1:ZvwS0R+56ePWxUNi+Atn9dWONBPp/AUETXlHW0DxSjE=
go.uber.org/atomic v1.11.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0=
go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto=
@@ -620,23 +598,23 @@ go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg=
golang.org/x/crypto v0.0.0-20170930174604-9419663f5a44/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20200115085410-6d4e4cb37c7d/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.49.0 h1:+Ng2ULVvLHnJ/ZFEq4KdcDd/cfjrrjjNSXNzxg0Y4U4=
golang.org/x/crypto v0.49.0/go.mod h1:ErX4dUh2UM+CFYiXZRTcMpEcN8b/1gxEuv3nODoYtCA=
golang.org/x/crypto v0.50.0 h1:zO47/JPrL6vsNkINmLoo/PH1gcxpls50DNogFvB5ZGI=
golang.org/x/crypto v0.50.0/go.mod h1:3muZ7vA7PBCE6xgPX7nkzzjiUq87kRItoJQM1Yo8S+Q=
golang.org/x/crypto v0.52.0 h1:RMs7fP2rXdep0CftQlK8Uf+kibLm7qkCcradZWYz988=
golang.org/x/crypto v0.52.0/go.mod h1:1QgfPxDqh0T2M/elOJtp9RvuR95kVjir0e6/BvEmGbc=
golang.org/x/exp v0.0.0-20260312153236-7ab1446f8b90 h1:jiDhWWeC7jfWqR9c/uplMOqJ0sbNlNWv0UkzE0vX1MA=
golang.org/x/exp v0.0.0-20260312153236-7ab1446f8b90/go.mod h1:xE1HEv6b+1SCZ5/uscMRjUBKtIxworgEcEi+/n9NQDQ=
golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg=
golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.5.1/go.mod h1:5OXOZSfqPIIbmVBIIKWRFfZjPR0E5r58TLhUjH0a2Ro=
golang.org/x/mod v0.34.0 h1:xIHgNUUnW6sYkcM5Jleh05DvLOtwc6RitGHbDk4akRI=
golang.org/x/mod v0.34.0/go.mod h1:ykgH52iCZe79kzLLMhyCUzhMci+nQj+0XkbXpNYtVjY=
golang.org/x/mod v0.36.0 h1:JJjpVx6myfUsUdAzZuOSTTmRE0PfZeNWzzvKrP7amb4=
golang.org/x/mod v0.36.0/go.mod h1:moc6ELqsWcOw5Ef3xVprK5ul/MvtVvkIXLziUOICjUQ=
golang.org/x/net v0.0.0-20180719180050-a680a1efc54d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20190923162816-aa69164e4478/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
golang.org/x/net v0.0.0-20200813134508-3edf25e44fcc/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
@@ -645,8 +623,8 @@ golang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT
golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk=
golang.org/x/net v0.0.0-20220607020251-c690dde0001d/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
golang.org/x/net v0.52.0 h1:He/TN1l0e4mmR3QqHMT2Xab3Aj3L9qjbhRm78/6jrW0=
golang.org/x/net v0.52.0/go.mod h1:R1MAz7uMZxVMualyPXb+VaqGSa3LIaUqk0eEt3w36Sw=
golang.org/x/net v0.55.0 h1:bcvxaJn3e1U6InsFWt1JUq1aSjnRxLzT2rtD2KfkDF8=
golang.org/x/net v0.55.0/go.mod h1:L5U2KuzuOe1lY7Z+aWVIKK6qEeJXnXV9yzGA+WCHJww=
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
@@ -659,6 +637,7 @@ golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5h
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190924154521-2837fb4f24fe/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
@@ -676,10 +655,8 @@ golang.org/x/sys v0.0.0-20220412211240-33da011f77ad/go.mod h1:oPkhp1MJrh7nUepCBc
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.42.0 h1:omrd2nAlyT5ESRdCLYdm3+fMfNFE/+Rf4bDIQImRJeo=
golang.org/x/sys v0.42.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw=
golang.org/x/sys v0.43.0 h1:Rlag2XtaFTxp19wS8MXlJwTvoh8ArU6ezoyFsMyCTNI=
golang.org/x/sys v0.43.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw=
golang.org/x/sys v0.45.0 h1:dO4czNzziLiiXplLQgBCEpCvXQ3dnkn0SdaZSYdQ+FY=
golang.org/x/sys v0.45.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
@@ -687,20 +664,19 @@ golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
golang.org/x/text v0.35.0 h1:JOVx6vVDFokkpaq1AEptVzLTpDe9KGpj5tR4/X+ybL8=
golang.org/x/text v0.35.0/go.mod h1:khi/HExzZJ2pGnjenulevKNX1W67CUy0AsXcNubPGCA=
golang.org/x/text v0.36.0 h1:JfKh3XmcRPqZPKevfXVpI1wXPTqbkE5f7JA92a55Yxg=
golang.org/x/text v0.36.0/go.mod h1:NIdBknypM8iqVmPiuco0Dh6P5Jcdk8lJL0CUebqK164=
golang.org/x/text v0.37.0 h1:Cqjiwd9eSg8e0QAkyCaQTNHFIIzWtidPahFWR83rTrc=
golang.org/x/text v0.37.0/go.mod h1:a5sjxXGs9hsn/AJVwuElvCAo9v8QYLzvavO5z2PiM38=
golang.org/x/time v0.15.0 h1:bbrp8t3bGUeFOx08pvsMYRTCVSMk89u4tKbNOZbp88U=
golang.org/x/time v0.15.0/go.mod h1:Y4YMaQmXwGQZoFaVFk4YpCt4FLQMYKZe9oeV/f4MSno=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20191216052735-49a3e744a425/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
golang.org/x/tools v0.1.8/go.mod h1:nABZi5QlRsZVlzPpHl034qft6wpY4eDcsTt5AaioBiU=
golang.org/x/tools v0.43.0 h1:12BdW9CeB3Z+J/I/wj34VMl8X+fEXBxVR90JeMX5E7s=
golang.org/x/tools v0.43.0/go.mod h1:uHkMso649BX2cZK6+RpuIPXS3ho2hZo4FVwfoy1vIk0=
golang.org/x/tools v0.45.0 h1:18qN3FAooORvApf5XjCXgsuayZOEtXf6JK18I3+ONa8=
golang.org/x/tools v0.45.0/go.mod h1:LuUGqqaXcXMEFEruIVJVm5mgDD8vww/z/SR1gQ4uE/0=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
+9 -9
View File
@@ -1,10 +1,10 @@
#!/bin/bash
# Import RLP blocks for subnet chains after deployment
# Usage: ./import-subnet-rlp.sh [mainnet|testnet|both]
# Import RLP blocks for chains after deployment
# Usage: ./import-chain-rlp.sh [mainnet|testnet|both]
#
# Prerequisites:
# - Subnets must be deployed (run deploy-subnets.sh first)
# - Nodes must be tracking the subnet chains
# - Chains must be deployed (run deploy-chains.sh first)
# - Nodes must be tracking the chains
# - Blockchain IDs must be set in the node config
set -e
@@ -37,7 +37,7 @@ import_rlp() {
local ns="lux-$network"
kubectl --context do-sfo3-lux-k8s exec -n "$ns" luxd-0 -- \
wget -q -O /tmp/import.rlp "$rpc_url" 2>/dev/null || true
echo "NOTE: For subnet chain import, you may need to use admin.importChain RPC"
echo "NOTE: For chain import, you may need to use admin.importChain RPC"
echo " or copy the RLP file to the node and import manually."
}
}
@@ -46,20 +46,20 @@ TARGET="${1:-both}"
case "$TARGET" in
mainnet)
echo "=== Importing subnet RLP blocks to mainnet ==="
echo "=== Importing chain RLP blocks to mainnet ==="
import_rlp mainnet zoo-mainnet 200200 zoo-mainnet-200200.rlp "$MAINNET_RPC"
import_rlp mainnet spc-mainnet 36911 spc-mainnet-36911.rlp "$MAINNET_RPC"
;;
testnet)
echo "=== Importing subnet RLP blocks to testnet ==="
echo "=== Importing chain RLP blocks to testnet ==="
import_rlp testnet zoo-testnet 200201 zoo-testnet-200201.rlp "$TESTNET_RPC"
;;
both|all)
echo "=== Importing subnet RLP blocks to mainnet ==="
echo "=== Importing chain RLP blocks to mainnet ==="
import_rlp mainnet zoo-mainnet 200200 zoo-mainnet-200200.rlp "$MAINNET_RPC"
import_rlp mainnet spc-mainnet 36911 spc-mainnet-36911.rlp "$MAINNET_RPC"
echo ""
echo "=== Importing subnet RLP blocks to testnet ==="
echo "=== Importing chain RLP blocks to testnet ==="
import_rlp testnet zoo-testnet 200201 zoo-testnet-200201.rlp "$TESTNET_RPC"
;;
*)
+1 -1
View File
@@ -9,8 +9,8 @@ import (
"github.com/luxfi/formatting"
"github.com/luxfi/ids"
"github.com/luxfi/rpc"
"github.com/luxfi/node/utils/json"
"github.com/luxfi/rpc"
)
type Client struct {
+1 -1
View File
@@ -11,9 +11,9 @@ import (
"github.com/luxfi/formatting"
"github.com/luxfi/ids"
"github.com/luxfi/node/utils/json"
"github.com/luxfi/rpc"
"github.com/luxfi/utils"
"github.com/luxfi/node/utils/json"
)
type mockClient struct {
+1 -1
View File
@@ -8,13 +8,13 @@ import (
"fmt"
"sync"
"github.com/luxfi/runtime"
"github.com/luxfi/database"
"github.com/luxfi/database/prefixdb"
"github.com/luxfi/database/versiondb"
"github.com/luxfi/ids"
"github.com/luxfi/log"
nodeconsensus "github.com/luxfi/node/consensus"
"github.com/luxfi/runtime"
"github.com/luxfi/timer/mockable"
)
+1 -1
View File
@@ -15,9 +15,9 @@ import (
"github.com/luxfi/database/prefixdb"
"github.com/luxfi/ids"
"github.com/luxfi/log"
"github.com/luxfi/node/server/http"
"github.com/luxfi/node/chains"
nodeconsensus "github.com/luxfi/node/consensus"
"github.com/luxfi/node/server/http"
"github.com/luxfi/node/utils/json"
"github.com/luxfi/runtime"
"github.com/luxfi/timer/mockable"
+1 -1
View File
@@ -47,7 +47,7 @@ Each chain has one or more index. To see if a C-Chain block is accepted, for exa
```
<Callout type="warn">
To ensure historical data can be accessed, the `/ext/index/X/vtx` is still accessible, even though it is no longer populated with chain data since the Cortina activation. If you are using `V1.10.0` or higher, you need to migrate to using the `/ext/index/X/block` endpoint.
To ensure historical data can be accessed, the `/ext/index/X/vtx` is still accessible, even though it is no longer populated with chain data since the X-Chain block linearization landed. If you are using `V1.10.0` or higher, you need to migrate to using the `/ext/index/X/block` endpoint.
</Callout>
## Methods
-373
View File
@@ -1,373 +0,0 @@
//go:build grpc
// Copyright (C) 2019-2025, Lux Industries Inc. All rights reserved.
// See the file LICENSE for licensing terms.
package rpcdb
import (
"context"
"encoding/json"
"errors"
"io"
"sync"
"google.golang.org/protobuf/types/known/emptypb"
"github.com/luxfi/database"
"github.com/luxfi/math/set"
"github.com/luxfi/utils"
rpcdbpb "github.com/luxfi/node/proto/pb/rpcdb"
)
var (
_ database.Database = (*DatabaseClient)(nil)
_ database.Batch = (*batch)(nil)
_ database.Iterator = (*iterator)(nil)
)
// DatabaseClient is an implementation of database that talks over RPC.
type DatabaseClient struct {
client rpcdbpb.DatabaseClient
closed utils.Atomic[bool]
}
// NewClient returns a database instance connected to a remote database instance
func NewClient(client rpcdbpb.DatabaseClient) *DatabaseClient {
return &DatabaseClient{client: client}
}
// Has attempts to return if the database has a key with the provided value.
func (db *DatabaseClient) Has(key []byte) (bool, error) {
resp, err := db.client.Has(context.Background(), &rpcdbpb.HasRequest{
Key: key,
})
if err != nil {
return false, err
}
return resp.Has, ErrEnumToError[resp.Err]
}
// Get attempts to return the value that was mapped to the key that was provided
func (db *DatabaseClient) Get(key []byte) ([]byte, error) {
resp, err := db.client.Get(context.Background(), &rpcdbpb.GetRequest{
Key: key,
})
if err != nil {
return nil, err
}
return resp.Value, ErrEnumToError[resp.Err]
}
// Put attempts to set the value this key maps to
func (db *DatabaseClient) Put(key, value []byte) error {
resp, err := db.client.Put(context.Background(), &rpcdbpb.PutRequest{
Key: key,
Value: value,
})
if err != nil {
return err
}
return ErrEnumToError[resp.Err]
}
// Delete attempts to remove any mapping from the key
func (db *DatabaseClient) Delete(key []byte) error {
resp, err := db.client.Delete(context.Background(), &rpcdbpb.DeleteRequest{
Key: key,
})
if err != nil {
return err
}
return ErrEnumToError[resp.Err]
}
// NewBatch returns a new batch
func (db *DatabaseClient) NewBatch() database.Batch {
return &batch{db: db}
}
func (db *DatabaseClient) NewIterator() database.Iterator {
return db.NewIteratorWithStartAndPrefix(nil, nil)
}
func (db *DatabaseClient) NewIteratorWithStart(start []byte) database.Iterator {
return db.NewIteratorWithStartAndPrefix(start, nil)
}
func (db *DatabaseClient) NewIteratorWithPrefix(prefix []byte) database.Iterator {
return db.NewIteratorWithStartAndPrefix(nil, prefix)
}
// NewIteratorWithStartAndPrefix returns a new empty iterator
func (db *DatabaseClient) NewIteratorWithStartAndPrefix(start, prefix []byte) database.Iterator {
resp, err := db.client.NewIteratorWithStartAndPrefix(context.Background(), &rpcdbpb.NewIteratorWithStartAndPrefixRequest{
Start: start,
Prefix: prefix,
})
if err != nil {
return &database.IteratorError{
Err: err,
}
}
return newIterator(db, resp.Id)
}
// Compact attempts to optimize the space utilization in the provided range
func (db *DatabaseClient) Compact(start, limit []byte) error {
resp, err := db.client.Compact(context.Background(), &rpcdbpb.CompactRequest{
Start: start,
Limit: limit,
})
if err != nil {
return err
}
return ErrEnumToError[resp.Err]
}
// Close attempts to close the database
func (db *DatabaseClient) Close() error {
db.closed.Set(true)
resp, err := db.client.Close(context.Background(), &rpcdbpb.CloseRequest{})
if err != nil {
return err
}
return ErrEnumToError[resp.Err]
}
// Sync flushes any pending writes to persistent storage.
// For RPC databases, this delegates to the remote database's Sync.
func (db *DatabaseClient) Sync() error {
// RPC database delegates sync to the underlying database on the server side.
// Most operations are already synchronous over RPC, so this is typically a no-op.
// If the server implements a Sync RPC method, call it here.
// For now, return nil as operations are synchronous.
return nil
}
func (db *DatabaseClient) HealthCheck(ctx context.Context) (interface{}, error) {
health, err := db.client.HealthCheck(ctx, &emptypb.Empty{})
if err != nil {
return nil, err
}
return json.RawMessage(health.Details), nil
}
// Backup is not supported over the RPC database client.
func (db *DatabaseClient) Backup(_ io.Writer, _ uint64) (uint64, error) {
return 0, errors.New("rpcdb: backup not supported")
}
// Load is not supported over the RPC database client.
func (db *DatabaseClient) Load(_ io.Reader) error {
return errors.New("rpcdb: load not supported")
}
type batch struct {
database.BatchOps
db *DatabaseClient
}
func (b *batch) Write() error {
request := &rpcdbpb.WriteBatchRequest{}
keySet := set.NewSet[string](len(b.Ops))
for i := len(b.Ops) - 1; i >= 0; i-- {
op := b.Ops[i]
key := string(op.Key)
if keySet.Contains(key) {
continue
}
keySet.Add(key)
if op.Delete {
request.Deletes = append(request.Deletes, &rpcdbpb.DeleteRequest{
Key: op.Key,
})
} else {
request.Puts = append(request.Puts, &rpcdbpb.PutRequest{
Key: op.Key,
Value: op.Value,
})
}
}
resp, err := b.db.client.WriteBatch(context.Background(), request)
if err != nil {
return err
}
return ErrEnumToError[resp.Err]
}
func (b *batch) Inner() database.Batch {
return b
}
type iterator struct {
db *DatabaseClient
id uint64
data []*rpcdbpb.PutRequest
fetchedData chan []*rpcdbpb.PutRequest
errLock sync.RWMutex
err error
reqUpdateError chan chan struct{}
once sync.Once
onClose chan struct{}
onClosed chan struct{}
}
func newIterator(db *DatabaseClient, id uint64) *iterator {
it := &iterator{
db: db,
id: id,
fetchedData: make(chan []*rpcdbpb.PutRequest),
reqUpdateError: make(chan chan struct{}),
onClose: make(chan struct{}),
onClosed: make(chan struct{}),
}
go it.fetch()
return it
}
// Invariant: fetch is the only thread with access to send requests to the
// server's iterator. This is needed because iterators are not thread safe and
// the server expects the client (us) to only ever issue one request at a time
// for a given iterator id.
func (it *iterator) fetch() {
defer func() {
resp, err := it.db.client.IteratorRelease(context.Background(), &rpcdbpb.IteratorReleaseRequest{
Id: it.id,
})
if err != nil {
it.setError(err)
} else {
it.setError(ErrEnumToError[resp.Err])
}
close(it.fetchedData)
close(it.onClosed)
}()
for {
resp, err := it.db.client.IteratorNext(context.Background(), &rpcdbpb.IteratorNextRequest{
Id: it.id,
})
if err != nil {
it.setError(err)
return
}
if len(resp.Data) == 0 {
return
}
for {
select {
case it.fetchedData <- resp.Data:
case onUpdated := <-it.reqUpdateError:
it.updateError()
close(onUpdated)
continue
case <-it.onClose:
return
}
break
}
}
}
// Next attempts to move the iterator to the next element and returns if this
// succeeded
func (it *iterator) Next() bool {
if it.db.closed.Get() {
it.data = nil
it.setError(database.ErrClosed)
return false
}
if len(it.data) > 1 {
it.data[0] = nil
it.data = it.data[1:]
return true
}
it.data = <-it.fetchedData
return len(it.data) > 0
}
// Error returns any that occurred while iterating
func (it *iterator) Error() error {
if err := it.getError(); err != nil {
return err
}
onUpdated := make(chan struct{})
select {
case it.reqUpdateError <- onUpdated:
<-onUpdated
case <-it.onClosed:
}
return it.getError()
}
// Key returns the key of the current element
func (it *iterator) Key() []byte {
if len(it.data) == 0 {
return nil
}
return it.data[0].Key
}
// Value returns the value of the current element
func (it *iterator) Value() []byte {
if len(it.data) == 0 {
return nil
}
return it.data[0].Value
}
// Release frees any resources held by the iterator
func (it *iterator) Release() {
it.once.Do(func() {
close(it.onClose)
<-it.onClosed
})
}
func (it *iterator) updateError() {
resp, err := it.db.client.IteratorError(context.Background(), &rpcdbpb.IteratorErrorRequest{
Id: it.id,
})
if err != nil {
it.setError(err)
} else {
it.setError(ErrEnumToError[resp.Err])
}
}
func (it *iterator) setError(err error) {
if err == nil {
return
}
it.errLock.Lock()
defer it.errLock.Unlock()
if it.err == nil {
it.err = err
}
}
func (it *iterator) getError() error {
it.errLock.RLock()
defer it.errLock.RUnlock()
return it.err
}
-199
View File
@@ -1,199 +0,0 @@
//go:build grpc
// Copyright (C) 2019-2025, Lux Industries Inc. All rights reserved.
// See the file LICENSE for licensing terms.
package rpcdb
import (
"context"
"encoding/json"
"errors"
"sync"
"google.golang.org/protobuf/types/known/emptypb"
"github.com/luxfi/constants"
"github.com/luxfi/database"
rpcdbpb "github.com/luxfi/node/proto/pb/rpcdb"
)
const iterationBatchSize = 128 * constants.KiB
var errUnknownIterator = errors.New("unknown iterator")
// DatabaseServer is a database that is managed over RPC.
type DatabaseServer struct {
rpcdbpb.UnsafeDatabaseServer
db database.Database
// iteratorLock protects [nextIteratorID] and [iterators] from concurrent
// modifications. Similarly to [batchLock], [iteratorLock] does not protect
// the actual Iterator. Iterators are documented as not being safe for
// concurrent use. Therefore, it is up to the client to respect this
// invariant.
iteratorLock sync.RWMutex
nextIteratorID uint64
iterators map[uint64]database.Iterator
}
// NewServer returns a database instance that is managed remotely
func NewServer(db database.Database) *DatabaseServer {
return &DatabaseServer{
db: db,
iterators: make(map[uint64]database.Iterator),
}
}
// Has delegates the Has call to the managed database and returns the result
func (db *DatabaseServer) Has(_ context.Context, req *rpcdbpb.HasRequest) (*rpcdbpb.HasResponse, error) {
has, err := db.db.Has(req.Key)
return &rpcdbpb.HasResponse{
Has: has,
Err: ErrorToErrEnum[err],
}, ErrorToRPCError(err)
}
// Get delegates the Get call to the managed database and returns the result
func (db *DatabaseServer) Get(_ context.Context, req *rpcdbpb.GetRequest) (*rpcdbpb.GetResponse, error) {
value, err := db.db.Get(req.Key)
return &rpcdbpb.GetResponse{
Value: value,
Err: ErrorToErrEnum[err],
}, ErrorToRPCError(err)
}
// Put delegates the Put call to the managed database and returns the result
func (db *DatabaseServer) Put(_ context.Context, req *rpcdbpb.PutRequest) (*rpcdbpb.PutResponse, error) {
err := db.db.Put(req.Key, req.Value)
return &rpcdbpb.PutResponse{Err: ErrorToErrEnum[err]}, ErrorToRPCError(err)
}
// Delete delegates the Delete call to the managed database and returns the
// result
func (db *DatabaseServer) Delete(_ context.Context, req *rpcdbpb.DeleteRequest) (*rpcdbpb.DeleteResponse, error) {
err := db.db.Delete(req.Key)
return &rpcdbpb.DeleteResponse{Err: ErrorToErrEnum[err]}, ErrorToRPCError(err)
}
// Compact delegates the Compact call to the managed database and returns the
// result
func (db *DatabaseServer) Compact(_ context.Context, req *rpcdbpb.CompactRequest) (*rpcdbpb.CompactResponse, error) {
err := db.db.Compact(req.Start, req.Limit)
return &rpcdbpb.CompactResponse{Err: ErrorToErrEnum[err]}, ErrorToRPCError(err)
}
// Close delegates the Close call to the managed database and returns the result
func (db *DatabaseServer) Close(context.Context, *rpcdbpb.CloseRequest) (*rpcdbpb.CloseResponse, error) {
err := db.db.Close()
return &rpcdbpb.CloseResponse{Err: ErrorToErrEnum[err]}, ErrorToRPCError(err)
}
// HealthCheck performs a heath check against the underlying database.
func (db *DatabaseServer) HealthCheck(ctx context.Context, _ *emptypb.Empty) (*rpcdbpb.HealthCheckResponse, error) {
health, err := db.db.HealthCheck(ctx)
if err != nil {
return &rpcdbpb.HealthCheckResponse{}, err
}
details, err := json.Marshal(health)
return &rpcdbpb.HealthCheckResponse{
Details: details,
}, err
}
// WriteBatch takes in a set of key-value pairs and atomically writes them to
// the internal database
func (db *DatabaseServer) WriteBatch(_ context.Context, req *rpcdbpb.WriteBatchRequest) (*rpcdbpb.WriteBatchResponse, error) {
batch := db.db.NewBatch()
for _, put := range req.Puts {
if err := batch.Put(put.Key, put.Value); err != nil {
return &rpcdbpb.WriteBatchResponse{
Err: ErrorToErrEnum[err],
}, ErrorToRPCError(err)
}
}
for _, del := range req.Deletes {
if err := batch.Delete(del.Key); err != nil {
return &rpcdbpb.WriteBatchResponse{
Err: ErrorToErrEnum[err],
}, ErrorToRPCError(err)
}
}
err := batch.Write()
return &rpcdbpb.WriteBatchResponse{
Err: ErrorToErrEnum[err],
}, ErrorToRPCError(err)
}
// NewIteratorWithStartAndPrefix allocates an iterator and returns the iterator
// ID
func (db *DatabaseServer) NewIteratorWithStartAndPrefix(_ context.Context, req *rpcdbpb.NewIteratorWithStartAndPrefixRequest) (*rpcdbpb.NewIteratorWithStartAndPrefixResponse, error) {
it := db.db.NewIteratorWithStartAndPrefix(req.Start, req.Prefix)
db.iteratorLock.Lock()
defer db.iteratorLock.Unlock()
id := db.nextIteratorID
db.iterators[id] = it
db.nextIteratorID++
return &rpcdbpb.NewIteratorWithStartAndPrefixResponse{Id: id}, nil
}
// IteratorNext attempts to call next on the requested iterator
func (db *DatabaseServer) IteratorNext(_ context.Context, req *rpcdbpb.IteratorNextRequest) (*rpcdbpb.IteratorNextResponse, error) {
db.iteratorLock.RLock()
it, exists := db.iterators[req.Id]
db.iteratorLock.RUnlock()
if !exists {
return nil, errUnknownIterator
}
var (
size int
data []*rpcdbpb.PutRequest
)
for size < iterationBatchSize && it.Next() {
key := it.Key()
value := it.Value()
size += len(key) + len(value)
data = append(data, &rpcdbpb.PutRequest{
Key: key,
Value: value,
})
}
return &rpcdbpb.IteratorNextResponse{Data: data}, nil
}
// IteratorError attempts to report any errors that occurred during iteration
func (db *DatabaseServer) IteratorError(_ context.Context, req *rpcdbpb.IteratorErrorRequest) (*rpcdbpb.IteratorErrorResponse, error) {
db.iteratorLock.RLock()
it, exists := db.iterators[req.Id]
db.iteratorLock.RUnlock()
if !exists {
return nil, errUnknownIterator
}
err := it.Error()
return &rpcdbpb.IteratorErrorResponse{Err: ErrorToErrEnum[err]}, ErrorToRPCError(err)
}
// IteratorRelease attempts to release the resources allocated to an iterator
func (db *DatabaseServer) IteratorRelease(_ context.Context, req *rpcdbpb.IteratorReleaseRequest) (*rpcdbpb.IteratorReleaseResponse, error) {
db.iteratorLock.Lock()
it, exists := db.iterators[req.Id]
if !exists {
db.iteratorLock.Unlock()
return &rpcdbpb.IteratorReleaseResponse{}, nil
}
delete(db.iterators, req.Id)
db.iteratorLock.Unlock()
err := it.Error()
it.Release()
return &rpcdbpb.IteratorReleaseResponse{Err: ErrorToErrEnum[err]}, ErrorToRPCError(err)
}
-144
View File
@@ -1,144 +0,0 @@
//go:build grpc
// Copyright (C) 2019-2025, Lux Industries Inc. All rights reserved.
// See the file LICENSE for licensing terms.
package rpcdb
import (
"context"
"fmt"
"testing"
"github.com/stretchr/testify/require"
"github.com/luxfi/database/corruptabledb"
"github.com/luxfi/database/dbtest"
"github.com/luxfi/database/memdb"
"github.com/luxfi/log"
"github.com/luxfi/vm/rpc/grpcutils"
rpcdbpb "github.com/luxfi/node/proto/pb/rpcdb"
)
type testDatabase struct {
client *DatabaseClient
server *memdb.Database
}
func setupDB(t testing.TB) *testDatabase {
require := require.New(t)
db := &testDatabase{
server: memdb.New(),
}
listener, err := grpcutils.NewListener()
require.NoError(err)
serverCloser := grpcutils.ServerCloser{}
server := grpcutils.NewServer()
rpcdbpb.RegisterDatabaseServer(server, NewServer(db.server))
serverCloser.Add(server)
go grpcutils.Serve(listener, server)
conn, err := grpcutils.Dial(listener.Addr().String())
require.NoError(err)
db.client = NewClient(rpcdbpb.NewDatabaseClient(conn))
t.Cleanup(func() {
serverCloser.Stop()
_ = conn.Close()
_ = listener.Close()
})
return db
}
func TestInterface(t *testing.T) {
for name, test := range dbtest.Tests {
t.Run(name, func(t *testing.T) {
db := setupDB(t)
test(t, db.client)
})
}
}
func FuzzKeyValue(f *testing.F) {
db := setupDB(f)
dbtest.FuzzKeyValue(f, db.client)
}
func FuzzNewIteratorWithPrefix(f *testing.F) {
db := setupDB(f)
dbtest.FuzzNewIteratorWithPrefix(f, db.client)
}
func FuzzNewIteratorWithStartAndPrefix(f *testing.F) {
db := setupDB(f)
dbtest.FuzzNewIteratorWithStartAndPrefix(f, db.client)
}
func BenchmarkInterface(b *testing.B) {
for _, size := range dbtest.BenchmarkSizes {
keys, values := dbtest.SetupBenchmark(b, size[0], size[1], size[2])
for name, bench := range dbtest.Benchmarks {
b.Run(fmt.Sprintf("rpcdb_%d_pairs_%d_keys_%d_values_%s", size[0], size[1], size[2], name), func(b *testing.B) {
db := setupDB(b)
bench(b, db.client, keys, values)
})
}
}
}
func TestHealthCheck(t *testing.T) {
scenarios := []struct {
name string
testDatabase *testDatabase
testFn func(db *corruptabledb.Database) error
wantErr bool
wantErrMsg string
}{
{
name: "healthcheck success",
testDatabase: setupDB(t),
testFn: func(_ *corruptabledb.Database) error {
return nil
},
},
{
name: "healthcheck failed db closed",
testDatabase: setupDB(t),
testFn: func(db *corruptabledb.Database) error {
return db.Close()
},
wantErr: true,
wantErrMsg: "closed",
},
}
for _, scenario := range scenarios {
t.Run(scenario.name, func(t *testing.T) {
require := require.New(t)
baseDB := setupDB(t)
db := corruptabledb.New(baseDB.server, log.NoLog{})
defer db.Close()
require.NoError(scenario.testFn(db))
// check db HealthCheck
_, err := db.HealthCheck(context.Background())
if scenario.wantErr {
require.Error(err) //nolint:forbidigo
require.Contains(err.Error(), scenario.wantErrMsg)
return
}
require.NoError(err)
// check rpc HealthCheck
_, err = baseDB.client.HealthCheck(context.Background())
require.NoError(err)
})
}
}
-30
View File
@@ -1,30 +0,0 @@
//go:build grpc
// Copyright (C) 2019-2025, Lux Industries Inc. All rights reserved.
// See the file LICENSE for licensing terms.
package rpcdb
import (
"github.com/luxfi/database"
rpcdbpb "github.com/luxfi/node/proto/pb/rpcdb"
)
var (
ErrEnumToError = map[rpcdbpb.Error]error{
rpcdbpb.Error_ERROR_CLOSED: database.ErrClosed,
rpcdbpb.Error_ERROR_NOT_FOUND: database.ErrNotFound,
}
ErrorToErrEnum = map[error]rpcdbpb.Error{
database.ErrClosed: rpcdbpb.Error_ERROR_CLOSED,
database.ErrNotFound: rpcdbpb.Error_ERROR_NOT_FOUND,
}
)
func ErrorToRPCError(err error) error {
if _, ok := ErrorToErrEnum[err]; ok {
return nil
}
return err
}
@@ -1,57 +0,0 @@
//go:build grpc
// Copyright (C) 2019-2025, Lux Industries Inc. All rights reserved.
// See the file LICENSE for licensing terms.
package galiasreader
import (
"context"
"github.com/luxfi/ids"
aliasreaderpb "github.com/luxfi/node/proto/pb/aliasreader"
)
var _ ids.AliaserReader = (*Client)(nil)
// Client implements alias lookups that talk over RPC.
type Client struct {
client aliasreaderpb.AliasReaderClient
}
// NewClient returns an alias lookup instance connected to a remote alias lookup
// instance
func NewClient(client aliasreaderpb.AliasReaderClient) *Client {
return &Client{client: client}
}
func (c *Client) Lookup(alias string) (ids.ID, error) {
resp, err := c.client.Lookup(context.Background(), &aliasreaderpb.Alias{
Alias: alias,
})
if err != nil {
return ids.Empty, err
}
return ids.ToID(resp.Id)
}
func (c *Client) PrimaryAlias(id ids.ID) (string, error) {
resp, err := c.client.PrimaryAlias(context.Background(), &aliasreaderpb.ID{
Id: id[:],
})
if err != nil {
return "", err
}
return resp.Alias, nil
}
func (c *Client) Aliases(id ids.ID) ([]string, error) {
resp, err := c.client.Aliases(context.Background(), &aliasreaderpb.ID{
Id: id[:],
})
if err != nil {
return nil, err
}
return resp.Aliases, nil
}
@@ -1,74 +0,0 @@
//go:build grpc
// Copyright (C) 2019-2025, Lux Industries Inc. All rights reserved.
// See the file LICENSE for licensing terms.
package galiasreader
import (
"context"
"fmt"
"github.com/luxfi/ids"
aliasreaderpb "github.com/luxfi/node/proto/pb/aliasreader"
)
var _ aliasreaderpb.AliasReaderServer = (*Server)(nil)
// Server enables alias lookups over RPC.
type Server struct {
aliasreaderpb.UnsafeAliasReaderServer
aliaser ids.AliaserReader
}
// NewServer returns an alias lookup connected to a remote alias lookup
func NewServer(aliaser ids.AliaserReader) *Server {
return &Server{aliaser: aliaser}
}
func (s *Server) Lookup(
_ context.Context,
req *aliasreaderpb.Alias,
) (*aliasreaderpb.ID, error) {
id, err := s.aliaser.Lookup(req.Alias)
if err != nil {
return nil, err
}
return &aliasreaderpb.ID{
Id: id[:],
}, nil
}
func (s *Server) PrimaryAlias(
_ context.Context,
req *aliasreaderpb.ID,
) (*aliasreaderpb.Alias, error) {
if s.aliaser == nil {
return nil, fmt.Errorf("aliaser is nil - BCLookup not configured for this chain")
}
id, err := ids.ToID(req.Id)
if err != nil {
return nil, err
}
alias, err := s.aliaser.PrimaryAlias(id)
return &aliasreaderpb.Alias{
Alias: alias,
}, err
}
func (s *Server) Aliases(
_ context.Context,
req *aliasreaderpb.ID,
) (*aliasreaderpb.AliasList, error) {
id, err := ids.ToID(req.Id)
if err != nil {
return nil, err
}
aliases, err := s.aliaser.Aliases(id)
return &aliasreaderpb.AliasList{
Aliases: aliases,
}, err
}
@@ -1,46 +0,0 @@
//go:build grpc
// Copyright (C) 2019-2025, Lux Industries Inc. All rights reserved.
// See the file LICENSE for licensing terms.
package galiasreader
import (
"testing"
"github.com/stretchr/testify/require"
"github.com/luxfi/ids"
"github.com/luxfi/ids/idstest"
"github.com/luxfi/vm/rpc/grpcutils"
aliasreaderpb "github.com/luxfi/node/proto/pb/aliasreader"
)
func TestInterface(t *testing.T) {
for _, test := range idstest.AliasTests {
t.Run(test.Name, func(t *testing.T) {
require := require.New(t)
listener, err := grpcutils.NewListener()
require.NoError(err)
defer listener.Close()
serverCloser := grpcutils.ServerCloser{}
defer serverCloser.Stop()
w := ids.NewAliaser()
server := grpcutils.NewServer()
aliasreaderpb.RegisterAliasReaderServer(server, NewServer(w))
serverCloser.Add(server)
go grpcutils.Serve(listener, server)
conn, err := grpcutils.Dial(listener.Addr().String())
require.NoError(err)
defer conn.Close()
r := NewClient(aliasreaderpb.NewAliasReaderClient(conn))
test.Test(t, r, w)
})
}
}
-18
View File
@@ -1,18 +0,0 @@
//go:build grpc
// Copyright (C) 2019-2025, Lux Industries Inc. All rights reserved.
// See the file LICENSE for licensing terms.
package message
import "github.com/luxfi/node/proto/p2p"
// newMessageBFT creates a BFT message wrapper (gRPC version - uses Simplex)
func newMessageBFT(msg *p2p.BFT) *p2p.Message_BFT {
return &p2p.Message_BFT{Simplex: msg}
}
// extractBFT extracts the BFT message from the wrapper (gRPC version - uses Simplex)
func extractBFT(msg *p2p.Message_BFT) *p2p.BFT {
return msg.Simplex
}
+2 -4
View File
@@ -1,5 +1,3 @@
//go:build !grpc
// Copyright (C) 2019-2025, Lux Industries Inc. All rights reserved.
// See the file LICENSE for licensing terms.
@@ -7,12 +5,12 @@ package message
import "github.com/luxfi/node/proto/p2p"
// newMessageBFT creates a BFT message wrapper (ZAP version)
// newMessageBFT creates a BFT message wrapper.
func newMessageBFT(msg *p2p.BFT) *p2p.Message_BFT {
return &p2p.Message_BFT{BFT: msg}
}
// extractBFT extracts the BFT message from the wrapper (ZAP version)
// extractBFT extracts the BFT message from the wrapper.
func extractBFT(msg *p2p.Message_BFT) *p2p.BFT {
return msg.BFT
}
+1 -1
View File
@@ -6,8 +6,8 @@ package message
import (
"time"
"github.com/luxfi/metric"
compression "github.com/luxfi/compress"
"github.com/luxfi/metric"
)
var _ Creator = (*creator)(nil)
+1 -1
View File
@@ -10,10 +10,10 @@ import (
"github.com/stretchr/testify/require"
compression "github.com/luxfi/compress"
"github.com/luxfi/ids"
"github.com/luxfi/node/proto/p2p"
"github.com/luxfi/timer/mockable"
compression "github.com/luxfi/compress"
)
func Test_newMsgBuilder(t *testing.T) {

Some files were not shown because too many files have changed in this diff Show More