Compare commits

..
Author SHA1 Message Date
Hanzo AI 7275bdf9d2 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:21 -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
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 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
Hanzo AI a2d1a828d1 deps: bump consensus v1.23.2 + threshold v1.6.7 + ZAP-native rpcdb
* consensus v1.23.2 — pulls threshold v1.6.7 with the LSS-Pulsar
  adapter (PulsarConfig, DynamicResharePulsar) needed by the epoch
  manager's resharing path.
* New proto/zap/rpcdb package — pure-Go wire types for the database
  RPC, no protobuf. Mirrors the proto/zap/{vm,p2p,sync,platformvm}
  pattern.
* New proto/rpcdb/rpcdb_zap.go (build tag !grpc) — full ZAP-native
  DatabaseClient + DatabaseServer + Register hook, implements
  database.Database against any Transport. The host's underlying DB
  is luxfi/database (zapdb in production); the protocol shape is
  identical regardless of which engine the host runs.
* Renamed the existing rpcdb.go to rpcdb_grpc.go so the two
  variants are mutually exclusive: build with no tag (ZAP default)
  or with `-tags=grpc` (protobuf path), never both.

examples/multi-network/multi-network-poc.go: drop duplicate-key map
entry where Q-Chain was illustrated as a separate network — Q-Chain
shares the primary network ID per LP-134, see comments on
MainnetID entry.

Net effect: full default build is ZAP-only PQ-secure-channel-aware,
RPC over a Z-Wing-encrypted ZAP transport, no gRPC/protobuf in the
critical path.
2026-05-06 19:18:03 -07:00
Hanzo AI a449f30a81 deps: cascade Z-Wing PQ stack + LocalID/CustomID split + verkle path fix
Pulls in:

* luxfi/constants  v1.5.2  — LocalID/CustomID semantic split, IsCustom()
* luxfi/genesis    v1.9.2  — same split mirrored at the configs layer
* luxfi/zwing      v0.5.2  — full PQ secure channel (X-Wing + ML-DSA-65 +
                              ChaCha20-Poly1305) with cross-language
                              wire-byte interop verified against Rust /
                              Python / TypeScript ports
* luxfi/api        v1.0.10 — zap.NewListener seam (used by zwing.ListenZAP)
* luxfi/netrunner  v1.18.1 — PQ-mandatory zapwire control RPC + same
                              LocalID rename
* luxfi/geth       v1.16.87 — verkle.Fr type fix (drop bandersnatch import)
* luxfi/consensus  v1.23.1  — banderwagon path move tracked

Source-side rename in this repo: every constants.CustomID call was
"the local 1337 dev network", so they all become constants.LocalID
(both the upgrade-config validation switch and the test fixtures).
The old constants.CustomID literal is now 0 — used as the explicit
"this is a user-defined custom network" sentinel, separate from the
LocalID dev network.

Plus a clarifying comment on the upgrade-config switch noting which
network IDs are permitted to override their upgrade schedule (any
non-well-known ID, including DevnetID/UnitTestID and any genuinely
custom user-defined network ID).

Z-Wing dialer + tests still green; all network/dialer, config,
config/node, config/spec, and genesis/builder tests pass.
2026-05-06 18:21:06 -07:00
Hanzo AI d1d0f45f5b network/dialer: add Z-Wing PQ secure-channel wrapper
Introduces ZWingDialer + ZWingListener which wrap any underlying
net.Conn (TCP, hostname, RNS mesh link, Unix socket, in-memory pipe)
with the canonical Lux PQ secure channel:

  IETF X-Wing KEM (X25519 + ML-KEM-768)
  Hybrid Ed25519 + ML-DSA-65 identity, signed transcript
  ChaCha20-Poly1305 with sequence-numbered nonces

Z-Wing's contract is "any net.Conn" — the same secure channel rides
unchanged on TCP today and on the existing RNS transport tomorrow
without a per-transport rewrite. The legacy LP-9701 in-RNS-link crypto
(rns_link.go) stays in place during the transition; new p2p paths
should layer ZWingDialer over the EndpointDialer instead of relying on
LP-9701's inline encryption.

Adds:
  network/dialer/zwing_dialer.go      ZWingDialer + ZWingListener
  network/dialer/zwing_dialer_test.go 5 e2e tests covering:
    - missing-identity rejection (dialer + listener)
    - real TCP listener + Z-Wing handshake + payload round trip
    - Wrap() over an arbitrary net.Conn (net.Pipe stand-in for RNS)
    - identity mismatch (MitM defence)
    - DialEndpoint over an Endpoint (works for IP, hostname, future RNS)

Bumps:
  github.com/luxfi/zwing v0.5.2 (full FIPS 204 PQ stack, cross-language
                                  wire-byte interop with Rust/Py/TS)
  github.com/luxfi/api   v1.0.10 (NewListener seam used by zwing.ListenZAP)

luxd-side wiring (node.go construction with a loaded LocalIdentity) is
the next follow-up; this commit lands the seam without behavioural
changes to the existing dialer interface.
2026-05-06 15:32:06 -07:00
Hanzo AI 08a53e41b9 canonical: rip vestigial protobuf — ZAP is the only wire protocol
Lux's primary wire protocol is ZAP (Zero-Copy App Proto). The protobuf
definitions and generated .pb.go files in proto/ trees were vestigial:
  - _grpc.pb.go gRPC service stubs were already gated behind
    //go:build grpc and not part of the default build
  - .pb.go message types had ZAP equivalents (*_zap.go) on every active
    code path

Default build was already 100% ZAP. Deleting the .proto + .pb.go +
_grpc.pb.go files removes dead code without functional change.

Verified clean build of node, p2p, vm after deletion.
2026-05-05 23:22:24 -07:00
Hanzo AI 00fa0653a1 canonical: SubnetID → ChainID; drop redundant L1ID/SubnetID fields
Lux unifies subnet (validator-set) and chain identity into a single
ChainID — every chain identifies itself by its ChainID, no separate
'subnet identifier' needed.

Wire/interface changes (BREAKING — coordinated rollout):
  - node/message/wire: ChainSubnetPair struct → ChainPingEntry; collapsed
    duplicate SubnetId field; ChainSubnetPairs → ChainIds
  - node/proto/zap/p2p: SubnetID → ChainID
  - node/vms/chainadapter: ICPBlock/ICPSubnet SubnetID → ChainID
  - validators/uptime: Calculator interface params subnetID → chainID
  - consensus/core/router: Connected method param subnetID → chainID
  - p2p/message: outbound_msg_builder var renames

Config/UI changes (cleanup):
  - genesis/pkg/genesis ChainEntry: dropped redundant SubnetID field
  - tui/views/ChainStatus: dropped redundant SubnetID field
  - cli: comment cleanup
  - benchmarks: deploy-subnets var rename
2026-05-05 22:11:04 -07:00
Hanzo AI 20250023d8 Snow → Quasar; clarify sub-protocols vs engines 2026-05-05 19:15:01 -07:00
Hanzo AI c4dbbdcc4e ci(docker): semver-only — drop :main/:dev/:test floating tags 2026-05-05 17:01:03 -07:00
Hanzo AI d004c909cf ci: lux-build → hanzo-build (single ARC fleet); remove .github/arc (operator owns ARC) 2026-05-05 17:00:50 -07:00
Hanzo AI 071630ece8 deps: api v1.0.5 chains v1.2.1 utxo v0.3.0 accel v1.0.9; fix BLS PublicKey []byte signature; service/info Consensus surfacing 2026-05-05 16:59:52 -07:00
Hanzo AI 23db515448 node: scrub Avalabs IP from .md docs (Go imports preserved) 2026-05-05 16:23:41 -07:00
Hanzo AI df56651331 node: scrub Avalabs IP brand refs 2026-05-05 16:22:40 -07:00
Hanzo AI 3774075c95 feat: clean up dead code, update deps, add xvm genesis/fx and genesis builder
Remove unused bloom filter, test helpers, metrics scaffolding, and
linearizable VM wrapper. Trim stale go.sum entries. Add genesis builder
helpers and xvm FX/genesis initialization.
2026-04-19 17:05:59 -07:00
Hanzo AI b8c12487e1 fix: deploy blockers from red+scientist swarm review
Blocking (would cause production incidents):
- env var prefix: LUX_* → LUXD_* (27 vars). Viper reads only LUXD_*;
  LUX_* silently ignored → node would start with default config on every env.
- admin API enabled + sybil disabled defaults: explicit LUXD_API_ADMIN_ENABLED=false
  and LUXD_SYBIL_PROTECTION_ENABLED=true in base ConfigMap.
- bootstrap peer config absent in new overlays: added LUXD_BOOTSTRAP_IPS /
  LUXD_BOOTSTRAP_IDS keys to base ConfigMap; overlays/operator populate per-env.

Defense-in-depth additions:
- ServiceAccount `luxd` with automountServiceAccountToken: false (no API access).
- PodDisruptionBudget maxUnavailable=1 (works at 5 → 100 validator scales).
- NetworkPolicy: ingress 9631/TCP from any (P2P), 9630/TCP cluster-only
  (HTTP), 9090/TCP monitoring-namespace only (metrics).
- podAntiAffinity preferredDuringScheduling by hostname — spread across nodes.
- updateStrategy: OnDelete — operator drains one pod at a time.
- podManagementPolicy: Parallel — validators start in any order.

Swarm verdict was NO-GO until these fixes. Addresses red critical #1 (admin
API), #2 (sybil), high #4 (gateway bypass via direct LB), medium #7 (no
NetworkPolicy/RBAC), and scientist blockers on env prefix + bootstrap.
2026-04-13 07:31:39 -07:00
Hanzo AI 2821ba9007 feat: fat image with 11 chain VM plugins + kustomize overlays
Single ghcr.io/luxfi/node image now includes luxd + EVM plugin +
all 11 chain VM plugins (aivm, bridgevm, dexvm, graphvm, identityvm,
keyvm, oraclevm, quantumvm, relayvm, thresholdvm, zkvm) built from
github.com/luxfi/chains.

Dockerfile: added plugin-builder stage that clones luxfi/chains and
builds each VM as a static binary placed at the CB58-encoded VM ID
path under /luxd/build/plugins/.

compose.yml: single-node local dev config (network-id=3, sybil off,
sample=1) replacing the stale docker/compose.yml.

k8s: replaced ad-hoc mainnet-only manifests with kustomize base +
4 overlays (localnet, devnet, testnet, mainnet). Each overlay patches
replicas, resources, storage class, network-id, and image tag.

Deleted: docker/Dockerfile, docker/compose.yml, docker/compose.genesis.yml,
k8s/luxd-statefulset.yaml, k8s/mainnet/ (entire directory).
2026-04-13 07:26:17 -07:00
Hanzo AI 862a8b72e7 deps: pin chains/* v0.1.0 + utxo v0.2.7 for goreleaser
Goreleaser runs with GOWORK=off so it cannot resolve local workspace
modules. Pin published versions:
  - github.com/luxfi/utxo v0.2.7 (adds InitRuntime forwarder)
  - github.com/luxfi/chains/{aivm,bridgevm,dexvm,graphvm,identityvm,
    keyvm,oraclevm,quantumvm,relayvm,thresholdvm,zkvm} v0.1.0

No replace directives — every dependency resolves to a published tag.
2026-04-13 07:06:55 -07:00
Hanzo AI 65d5f4f24b fix: add main/main.go entry point for luxd binary
Restores the missing entry point that .goreleaser.yml, Makefile, and
scripts/build.sh all expect at ./main. Without this file, the release
pipeline fails with 'couldn't find main file: stat main: no such file
or directory'.

The main wires:
  config.BuildFlagSet → config.BuildViper → config.GetNodeConfig
  → log.NewFactoryWithConfig → ulimit.Set
  → node.New(*node.Config, log.Factory, log.Logger)
  → n.Dispatch() with SIGINT/SIGTERM handling
  → exit n.ExitCode()

--version short-circuits to print version.CurrentApp.String() (e.g.
'luxd/1.23.25').

Not using the orphan app/ package (app.New takes nodeconfig.Config which
is a parallel type definition not produced by config.GetNodeConfig). The
app/ package can be migrated separately or removed.
2026-04-13 07:02:32 -07:00
Hanzo AI 8de1b78ed8 refactor: migrate UTXO components to standalone github.com/luxfi/utxo
One place, one way to define UTXO primitives. Delete the in-tree duplicate
at node/vms/components/lux/ and import the standalone luxfi/utxo package
with a 'lux' alias so existing call-sites (lux.UTXO, lux.TransferableInput,
etc.) remain unchanged in consumers.

Files changed: 167 imports rewritten, 2 directories deleted.

Build still green on the whole tree except pre-existing examples/multi-network
QChainMainnetID issue (unrelated).

Next: rename luxfi/utxo/luxmock → utxomock for full brand-neutrality; that
is a separate PR since it requires touching all consumer alias names.
2026-04-13 06:47:35 -07:00
Hanzo AI 0866b1a34e feat: complete mldsafx — ML-DSA-65 PQ signing for X-Chain UTXO 2026-04-13 05:34:08 -07:00
Hanzo AI 69bcba4420 refactor: delete node/vms/{aivm,bridgevm,dexvm,graphvm,identityvm,keyvm,oraclevm,quantumvm,relayvm,thresholdvm,zkvm}
VM implementations moved to github.com/luxfi/chains/<name>.
node/node/vms.go now imports from chains/ paths.

node/vms/ retains only primary network VMs (platformvm, xvm, evm)
plus VM infrastructure (manager, registry, rpcchainvm, tracedvm, etc).
2026-04-13 05:27:09 -07:00
Hanzo AI fa13771942 refactor: rename VM packages, delete teleportvm + servicenodevm
Consistent naming — package matches directory name:
- bvm → bridgevm
- gvm → graphvm
- qvm → quantumvm
- tvm → thresholdvm
- zvm → zkvm

Removed VMs (deduped):
- teleportvm/ — duplicated bridgevm+relayvm+oraclevm code (same MPC, same signing)
- servicenodevm/ — moved to dedicated repo github.com/luxfi/session

vms.go: 11 optional VMs (A/B/D/G/I/K/O/Q/R/T/Z) registered with new package names.
S-Chain (Session) registered separately as standalone plugin.
2026-04-13 05:15:50 -07:00
Hanzo AI 1ceb309a24 test: raise quasar coverage 40.6% -> 43.5%
Config validation, quorum params, lifecycle, set/get finalized,
BLS signature types, CoronaCoordinator sign/verify paths,
active/inactive validator weight filtering.

Remaining uncovered: GPU/NTT hardware code (requires CGO + GPU),
processFinality integration (requires P-Chain provider), Verify
(requires real BLS/Corona key material).
2026-04-13 05:07:24 -07:00
Hanzo AI 05d532944d refactor: primary network = P+Q+Z mandatory, C/D/B/T opt-in
The minimum quantum-safe validator set is:
  P — staking, validators, rewards (implicit)
  Q — Quasar PQ consensus (BLS + Corona + ML-DSA)
  Z — universal receipt registry + ZK verification
  X — assets (kept for LUX token / fee UTXOs, backward compat)

Opt-in (only created if *ChainGenesis provided):
  C — EVM contracts
  D — DEX
  B — Bridge
  T — Threshold/FHE/MPC

Validators stake extra + validate opt-in chains to earn their fees.
Fee split: each chain's tx fees distributed to its validators
proportional to stake weight.
2026-04-13 05:01:56 -07:00
Hanzo AI f6e63d60b2 clean: squash history (binaries stripped via filter-repo) 2026-04-13 03:45:21 -07:00
208 changed files with 963 additions and 10385 deletions
+5 -10
View File
@@ -21,17 +21,15 @@ on:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# 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.
# This workflow contains a single job called "build"
# Cross-compile both darwin/amd64 and darwin/arm64 on macos-13.
build-mac:
strategy:
fail-fast: false
matrix:
goarch: [amd64, arm64]
runs-on: lux-build
# The type of runner that the job will run on (GH-hosted arm64 macos forbidden).
runs-on: macos-13
permissions:
id-token: write
contents: read
@@ -65,10 +63,7 @@ jobs:
run: |
# CLI expects: node-macos-{arch}-{version}.zip containing build/luxd
mkdir -p build
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
7z a "node-macos-${{ matrix.goarch }}-${TAG}.zip" build/luxd
env:
TAG: ${{ env.TAG }}
-18
View File
@@ -5,24 +5,6 @@ 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
+1 -9
View File
@@ -72,14 +72,6 @@ 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
@@ -147,7 +139,7 @@ RUN . ./build_env.sh && \
# 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.
ARG EVM_VERSION=v0.18.18
ARG EVM_VERSION=v0.18.14
ARG EVM_VM_ID=mgj786NP7uDwBCcq6YwThhaN8FLyybkCa4zBWTQbNgmK6k9A6
RUN --mount=type=cache,target=/root/.cache/go-build \
mkdir -p /luxd/build/plugins && \
+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 | App chain EVM (1,632 commits) |
| `lux/evm` | 2021-12-15 | Subnet 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 |
+3 -34
View File
@@ -39,8 +39,6 @@ selection, and EVM contract auth.
| 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 |
@@ -307,39 +305,10 @@ github.com/luxfi/genesis (JSON config) → github.com/luxfi/node/genesis/build
- Genesis package has no node dependencies
- Builder package handles type conversions (string → ids.NodeID, uint64 → time.Duration)
### Building (GPU is an optional runtime drop-in — the build needs nothing)
```bash
go build ./... # default. Works everywhere, no setup.
CGO_ENABLED=1 go build ./... # same, but validating blst BLS (recommended)
```
Both build with **zero external setup** — no luxcpp, no `pkg-config`, no
install step. Crypto runs on the pure-Go / blst CPU path. (Requires
`github.com/luxfi/accel >= v1.2.1`, which made native HQC opt-in; older pins
need the GPU libs installed to build CGO=1.)
GPU acceleration (Apple Silicon Metal / CUDA) is a **runtime plugin**, never
a build dependency. To turn it on, drop the backend plugin somewhere and point
the node at it:
```bash
export LUX_GPU_BACKEND=metal
export LUX_GPU_BACKEND_PATH=/path/to/dir/with/libluxgpu_backend_metal.dylib
./build/luxd ... # crypto dispatches to the GPU; absent → CPU
```
The Metal plugin is built from `lux-private/gpu-kernels` (proprietary;
`cd backends/metal && cmake -B build && cmake --build build`). Its kernels are
KAT-proven byte-equal to the CPU oracle (`ctest --test-dir build` → 17/17:
BLS12-381, BN254 pairing, NTT, ML-DSA/ML-KEM/SLH-DSA NTT, FHE PBS). The same
node binary runs with or without it — no rebuild, no tags.
### CGO Dependencies
These accelerate on the GPU when the runtime plugin is present (graceful CPU
fallback otherwise — the build never requires them):
- `consensus/quasar` - GPU NTT acceleration (BLS12-381 batch verify, Corona NTT)
- `vms/thresholdvm/fhe` - GPU FHE operations (TFHE programmable bootstrap)
These require CGO for full functionality (graceful fallback when disabled):
- `consensus/quasar` - GPU NTT acceleration
- `vms/thresholdvm/fhe` - GPU FHE operations
- `x/blockdb` - zstd compression
### FHE (Fully Homomorphic Encryption)
+1 -1
View File
@@ -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 chain capabilities
- **Net Support**: Full L2/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,
+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"
compression "github.com/luxfi/compress"
"github.com/luxfi/ids"
compression "github.com/luxfi/compress"
)
// BenchmarkMessageCompression benchmarks message compression
BIN
View File
Binary file not shown.
+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/container/linked"
"github.com/luxfi/utils"
"github.com/luxfi/container/linked"
)
var _ Cacher[struct{}, struct{}] = (*LRU[struct{}, struct{}])(nil)
+1 -1
View File
@@ -6,8 +6,8 @@ package cache
import (
"sync"
"github.com/luxfi/container/linked"
"github.com/luxfi/utils"
"github.com/luxfi/container/linked"
)
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"
)
+3 -3
View File
@@ -345,7 +345,7 @@ type ManagerConfig struct {
PartialSyncPrimaryNetwork bool
Server server.Server // Handles HTTP API calls
AtomicMemory *atomic.Memory
UTXOAssetID ids.ID
XAssetID 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,
@@ -634,7 +634,7 @@ func (m *manager) createChain(chainParams ChainParameters) {
// Plugin-not-loaded is a deliberate skip, not a failure.
//
// Each validator opts into chains by loading their VM plugin
// (Liquid loads liquid-evm/dex/fhe; doesn't load Lux's upstream
// (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
@@ -915,7 +915,7 @@ func (m *manager) buildChain(chainParams ChainParameters, sb nets.Net) (*chainIn
XChainID: m.XChainID,
CChainID: m.CChainID,
UTXOAssetID: m.UTXOAssetID,
XAssetID: m.XAssetID,
ChainDataDir: chainDataDir,
BCLookup: m,
+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) {
+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.
+1 -1
View File
@@ -29,7 +29,7 @@ func main() {
"allocations": []map[string]interface{}{
{
"evmAddr": "0x9011E888251AB053B7bD1cdB598Db4f9DEd94714",
"utxoAddr": zooAddr,
"utxoAddr": zooAddr,
"initialAmount": 0,
"unlockSchedule": []map[string]interface{}{
{
+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,
}
+13 -25
View File
@@ -1052,15 +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)
}
utxoAssetID, err := resolveXAssetID(networkID, genesisBytes)
xAssetID, err := resolveXAssetID(networkID, genesisBytes)
if err != nil {
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),
"utxoAssetID", utxoAssetID,
"xAssetID", xAssetID,
)
return genesisBytes, utxoAssetID, nil
return genesisBytes, xAssetID, nil
}
// Check if genesis-db is specified for database replay
@@ -1091,32 +1091,19 @@ 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 {
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, utxoAssetID, nil
xAssetID, err := resolveXAssetID(networkID, cachedBytes)
if err != nil {
return nil, ids.Empty, fmt.Errorf("resolve X-Chain asset ID from cached genesis: %w", err)
}
// 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",
log.Info("loaded cached genesis bytes for hash stability",
"cacheFile", cacheFile,
"size", len(cachedBytes),
"error", err,
"xAssetID", xAssetID,
)
_ = os.Remove(cacheFile)
return cachedBytes, xAssetID, nil
}
// No cache or invalid cache - build from file and cache the result
genesisBytes, utxoAssetID, err := builder.FromFile(networkID, genesisFileName, stakingCfg)
genesisBytes, xAssetID, err := builder.FromFile(networkID, genesisFileName, stakingCfg)
if err != nil {
return nil, ids.Empty, err
}
@@ -1131,7 +1118,7 @@ func getGenesisData(v *viper.Viper, networkID uint32, stakingCfg *builder.Stakin
"size", len(genesisBytes),
)
}
return genesisBytes, utxoAssetID, nil
return genesisBytes, xAssetID, nil
}
// finally if file is not specified/readable go for the predefined config
@@ -1746,6 +1733,7 @@ func GetNodeConfig(v *viper.Viper) (node.Config, error) {
}
nodeConfig.TrackAllChains = v.GetBool(TrackAllChainsKey)
// HTTP APIs
nodeConfig.HTTPConfig, err = getHTTPConfig(v)
if err != nil {
@@ -1871,7 +1859,7 @@ func GetNodeConfig(v *viper.Viper) (node.Config, error) {
// Get data directory for dev network config persistence
dataDir := getExpandedArg(v, DataDirKey)
nodeConfig.GenesisBytes, nodeConfig.UTXOAssetID, err = getGenesisData(v, nodeConfig.NetworkID, &genesisStakingCfg, dataDir)
nodeConfig.GenesisBytes, nodeConfig.XAssetID, err = getGenesisData(v, nodeConfig.NetworkID, &genesisStakingCfg, dataDir)
if err != nil {
return node.Config{}, fmt.Errorf("unable to load genesis file: %w", err)
}
+1 -1
View File
@@ -16,8 +16,8 @@ import (
"github.com/spf13/viper"
"github.com/stretchr/testify/require"
consensusconfig "github.com/luxfi/consensus/config"
"github.com/luxfi/constants"
consensusconfig "github.com/luxfi/consensus/config"
"github.com/luxfi/ids"
"github.com/luxfi/node/chains"
"github.com/luxfi/node/genesis/builder"
+13 -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"
@@ -48,19 +48,19 @@ var (
defaultStakingSignerKeyPath = filepath.Join(defaultStakingPath, "signer.key")
// 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")
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)
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 {
+36 -36
View File
@@ -78,36 +78,36 @@ 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"
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.
@@ -264,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"
+10 -10
View File
@@ -10,23 +10,23 @@ import (
"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/trace"
"github.com/luxfi/node/upgrade"
"github.com/luxfi/node/trace"
// "github.com/luxfi/log" // Unused
"github.com/luxfi/math/set"
"github.com/luxfi/node/utils/profiler"
"github.com/luxfi/timer"
"github.com/luxfi/node/utils/profiler"
)
type APIIndexerConfig struct {
@@ -101,13 +101,13 @@ type StakingConfig struct {
// 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:"-"`
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"`
StakingMLDSAKeyPath string `json:"stakingMLDSAKeyPath,omitempty"`
StakingMLDSAPubPath string `json:"stakingMLDSAPubPath,omitempty"`
HandshakeMLKEMKeyPath string `json:"handshakeMLKEMKeyPath,omitempty"`
HandshakeMLKEMPubPath string `json:"handshakeMLKEMPubPath,omitempty"`
}
@@ -169,7 +169,7 @@ type Config struct {
// Genesis information
GenesisBytes []byte `json:"-"`
UTXOAssetID ids.ID `json:"utxoAssetID"`
XAssetID ids.ID `json:"xAssetID"`
// ID of the network this node should connect to
NetworkID uint32 `json:"networkID"`
+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
+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 UTXOAssetID is used for native asset
utxoAssetID := ids.Empty // Our implementation uses Empty ID for native asset
// Verify XAssetID is used for native asset
xAssetID := ids.Empty // Our implementation uses Empty ID for native asset
if utxoAssetID != ids.Empty {
t.Fatal("UTXOAssetID should be Empty for native asset")
if xAssetID != ids.Empty {
t.Fatal("XAssetID should be Empty for native asset")
}
t.Log("✓ UTXOAssetID verified for native LUX asset")
t.Log("✓ XAssetID 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("✓ UTXOAssetID Configuration: PASS")
t.Log("✓ XAssetID 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"
)
+5 -5
View File
@@ -1,6 +1,6 @@
#!/bin/bash
# Deploy all 4 app chains (Zoo, Hanzo, SPC, Pars) to mainnet + testnet
# Usage: ./deploy-chains.sh [mainnet|testnet|devnet|both]
# Deploy all 4 subnet chains (Zoo, Hanzo, SPC, Pars) to mainnet + testnet
# Usage: ./deploy-subnets.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 chain creation
# mainnet-key-02 has 70M LUX unlocked on P-chain, sufficient for subnet creation
KEY_NAME="mainnet-key-02"
echo "Extracting $KEY_NAME from keychain..."
echo "(Approve the macOS keychain dialog that appears)"
@@ -39,7 +39,7 @@ deploy_network() {
local network=$1
echo ""
echo "=============================="
echo "Deploying chains to $network"
echo "Deploying subnets to $network"
echo "=============================="
PRIVATE_KEY="$KEY" "$DEPLOY_BIN" \
@@ -77,7 +77,7 @@ echo ""
echo "All deployments complete!"
echo ""
echo "Next steps:"
echo " 1. Copy the Chain IDs and Blockchain IDs from output above"
echo " 1. Copy the Subnet 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"
Binary file not shown.
+1 -1
View File
@@ -12,7 +12,7 @@ COPY . .
RUN if [ "$CHAIN_TYPE" = "platform" ]; then \
go build -o luxd-p-chain ./cmd/luxd; \
elif [ "$CHAIN_TYPE" = "exchange" ]; then \
go build -tags ringtail -o luxd-x-chain ./cmd/luxd; \
go build -tags corona -o luxd-x-chain ./cmd/luxd; \
elif [ "$CHAIN_TYPE" = "contract" ]; then \
go build -tags evm -o luxd-c-chain ./cmd/luxd; \
else \
+4 -4
View File
@@ -140,8 +140,8 @@ else
{
"allocations": [
{
"utxoAddr": "P-local1jfdgmqduuyuxjp9sq7szp08xpynav88sd7qxvv",
"evmAddr": "0x9011E888251AB053B7bD1cdB598Db4f9DEd94714",
"luxAddr": "P-local1jfdgmqduuyuxjp9sq7szp08xpynav88sd7qxvv",
"ethAddr": "0x9011E888251AB053B7bD1cdB598Db4f9DEd94714",
"initialAmount": 1000000000000000000,
"unlockSchedule": []
}
@@ -167,8 +167,8 @@ EOF
{
"allocations": [
{
"utxoAddr": "X-local1jfdgmqduuyuxjp9sq7szp08xpynav88sd7qxvv",
"evmAddr": "0x9011E888251AB053B7bD1cdB598Db4f9DEd94714",
"luxAddr": "X-local1jfdgmqduuyuxjp9sq7szp08xpynav88sd7qxvv",
"ethAddr": "0x9011E888251AB053B7bD1cdB598Db4f9DEd94714",
"initialAmount": 1000000000000000000,
"unlockSchedule": []
}
+7 -7
View File
@@ -238,7 +238,7 @@ Final Validation
- **Security**: Quantum-resistant (192-bit)
- **Signatures**: ML-DSA-65 (Dilithium)
- **Privacy**: Ringtail ring signatures
- **Privacy**: Corona ring signatures
- **Performance**: ~1,500 TPS
### Implementation
@@ -247,7 +247,7 @@ Final Validation
type PQConsensus struct {
classicalSigner *bls.Signer
quantumSigner *mldsa.Signer
ringtailSigner *ringtail.Signer
coronaSigner *corona.Signer
threshold int
validatorSet []Validator
@@ -279,10 +279,10 @@ func (pq *PQConsensus) VerifyBlock(block Block, sig Signature) bool {
}
```
### Ringtail Privacy Layer
### Corona Privacy Layer
```go
type RingtailSignature struct {
type CoronaSignature struct {
Ring []PublicKey
Signature []byte
KeyImage []byte
@@ -292,11 +292,11 @@ func (pq *PQConsensus) CreateRingSignature(
message []byte,
signerKey PrivateKey,
ring []PublicKey,
) (*RingtailSignature, error) {
) (*CoronaSignature, error) {
// Create anonymous signature within ring
sig := pq.ringtailSigner.Sign(message, signerKey, ring)
sig := pq.coronaSigner.Sign(message, signerKey, ring)
return &RingtailSignature{
return &CoronaSignature{
Ring: ring,
Signature: sig.Bytes(),
KeyImage: sig.KeyImage(),
+3 -3
View File
@@ -25,7 +25,7 @@ Lux implements a 4-chain primary network architecture, each optimized for specif
│ (Quantum) │
│ │
│ Post-Quantum Consensus │
Ringtail Signatures │
Corona Signatures │
└─────────────────────────────────────────────────┘
```
@@ -76,7 +76,7 @@ Lux implements a 4-chain primary network architecture, each optimized for specif
**Purpose:** Post-quantum security layer
- Quantum-resistant cryptography
- ML-DSA-65 (Dilithium) signatures
- Ringtail ring signatures for privacy
- Corona ring signatures for privacy
- Hybrid classical/quantum consensus
**Key Features:**
@@ -301,7 +301,7 @@ Native cross-chain communication protocol:
| secp256k1 | ECDSA signatures | 128-bit |
| BLS12-381 | Threshold signatures | 128-bit |
| ML-DSA-65 | Post-quantum signatures | 192-bit |
| Ringtail | Ring signatures | 128-bit |
| Corona | Ring signatures | 128-bit |
| SHA-256 | Hashing | 128-bit |
| AES-256-GCM | Encryption | 256-bit |
@@ -307,11 +307,11 @@ Create `~/.luxd/configs/chains/Q/config.json`:
```json
{
"quantum-verification-enabled": true,
"ringtail-signatures-enabled": true,
"corona-signatures-enabled": true,
"post-quantum-algorithm": "ml-dsa-65",
"quantum-signature-cache-size": 10000,
"ring-signature-size": 16,
"ringtail-key-size": 1024,
"corona-key-size": 1024,
"quantum-stamp-enabled": true,
"quantum-stamp-window": "30s",
"parallel-batch-size": 10,
@@ -224,7 +224,7 @@ Create `~/.luxd/configs/chains/Q/config.json`:
```json
{
"quantum-verification-enabled": true,
"ringtail-signatures-enabled": true,
"corona-signatures-enabled": true,
"post-quantum-algorithm": "ml-dsa-65",
"ring-signature-size": 16,
"quantum-cache-size": 10000,
+2 -2
View File
@@ -55,9 +55,9 @@ func NewMultiNetworkNode() *MultiNetworkNode {
ChainID: "2JVSBoinj9C2J33VntvzYtVJNZdN2NKiwwKjcumHUWEb5DbBrm",
Active: true,
},
200200: { // Zoo chain Chain ID
200200: { // Zoo L2 Chain ID
NetworkID: 200200,
NetworkName: "Zoo Network",
NetworkName: "Zoo Network (L2)",
RPCPort: 2000,
Validators: 5,
ChainID: "2ebCneCbwthjQ1rYT41nhd7M76Hc6YmosMAQrTFhBq8qeqh6tt",
+7 -7
View File
@@ -23,11 +23,11 @@ import (
"github.com/luxfi/net/endpoints"
"github.com/luxfi/node/vms/components/gas"
"github.com/luxfi/node/vms/platformvm/genesis"
xvmgenesis "github.com/luxfi/node/vms/xvm/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"
@@ -38,8 +38,8 @@ import (
"github.com/luxfi/utxo/secp256r1fx"
"github.com/luxfi/utxo/slhdsafx"
genesisconfigs "github.com/luxfi/genesis/configs"
genesiscfg "github.com/luxfi/genesis/pkg/genesis"
genesisconfigs "github.com/luxfi/genesis/configs"
)
// Chain alias vars are derived from the single source of truth (Registry
@@ -401,15 +401,15 @@ func FromConfig(config *genesiscfg.Config) ([]byte, ids.ID, error) {
// 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
var xAssetID ids.ID
if len(xvmGenesisBytes) > 0 {
var err error
utxoAssetID, err = xvmgenesis.AssetIDFromBytes(xvmGenesisBytes)
xAssetID, 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)
xAssetID = constants.UTXOAssetIDFor(config.NetworkID)
}
genesisTime := time.Unix(int64(config.StartTime), 0)
@@ -623,7 +623,7 @@ func FromConfig(config *genesiscfg.Config) ([]byte, ids.ID, error) {
// CreateChainTx post-genesis on their own chains.
pChainGenesis, err := genesis.New(
utxoAssetID,
xAssetID,
config.NetworkID,
platformAllocations,
validators,
@@ -639,7 +639,7 @@ 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, utxoAssetID, nil
return pChainGenesisBytes, xAssetID, nil
}
// FromFile loads genesis config from file and builds genesis bytes.
+4 -4
View File
@@ -160,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},
-48
View File
@@ -1,48 +0,0 @@
// 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)
}
}
+1
View File
@@ -126,3 +126,4 @@ func VMAliasesMap() map[ids.ID][]string {
}
return m
}
+27 -34
View File
@@ -26,14 +26,14 @@ 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.25.13
github.com/luxfi/crypto v1.19.17
github.com/luxfi/consensus v1.24.6
github.com/luxfi/crypto v1.19.15
github.com/luxfi/database v1.18.3
github.com/luxfi/ids v1.2.13
github.com/luxfi/ids v1.2.10
github.com/luxfi/keychain v1.0.2
github.com/luxfi/log v1.4.1
github.com/luxfi/math v1.4.1
github.com/luxfi/metric v1.5.7
github.com/luxfi/metric v1.5.5
github.com/luxfi/mock v0.1.1
github.com/mr-tron/base58 v1.2.0
github.com/onsi/ginkgo/v2 v2.28.1
@@ -51,20 +51,20 @@ 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.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.opentelemetry.io/otel v1.42.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.42.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.42.0 // indirect
go.opentelemetry.io/otel/sdk v1.42.0 // indirect
go.opentelemetry.io/otel/trace v1.42.0 // indirect
go.uber.org/goleak v1.3.0
go.uber.org/mock v0.6.0
golang.org/x/crypto v0.52.0
golang.org/x/crypto v0.50.0
golang.org/x/exp v0.0.0-20260312153236-7ab1446f8b90 // indirect
golang.org/x/mod v0.36.0
golang.org/x/net v0.55.0
golang.org/x/mod v0.34.0
golang.org/x/net v0.52.0
golang.org/x/sync v0.20.0
golang.org/x/time v0.15.0
golang.org/x/tools v0.45.0
golang.org/x/tools v0.43.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 // indirect
@@ -110,11 +110,11 @@ 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.43.0 // indirect
go.opentelemetry.io/otel/metric v1.42.0 // indirect
go.opentelemetry.io/proto/otlp v1.10.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
golang.org/x/sys v0.45.0 // indirect
golang.org/x/text v0.37.0 // indirect
golang.org/x/sys v0.43.0 // indirect
golang.org/x/text v0.36.0 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20260401024825-9d38bb4040a9 // indirect
)
@@ -123,7 +123,7 @@ require (
github.com/consensys/gnark-crypto v0.20.1
github.com/golang-jwt/jwt/v4 v4.5.2
github.com/golang/mock v1.7.0-rc.1
github.com/luxfi/accel v1.1.9
github.com/luxfi/accel v1.1.4
github.com/luxfi/api v1.0.11
github.com/luxfi/atomic v1.0.0
github.com/luxfi/chains v1.2.3
@@ -131,18 +131,16 @@ require (
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.13.8
github.com/luxfi/genesis/pkg/genesis/security v1.13.8
github.com/luxfi/genesis v1.12.14
github.com/luxfi/geth v1.16.98
github.com/luxfi/go-bip39 v1.1.2
github.com/luxfi/keys v1.1.0
github.com/luxfi/lattice/v7 v7.1.4
github.com/luxfi/lattice/v7 v7.1.0
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.1.0
github.com/luxfi/runtime v1.0.1
github.com/luxfi/sdk v1.16.60
github.com/luxfi/sys v0.0.0-20260110090042-50187ec5ffd8
github.com/luxfi/timer v1.0.2
@@ -162,33 +160,26 @@ 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/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.5.0 // indirect
github.com/luxfi/ai v0.1.0 // indirect
github.com/luxfi/corona v0.7.6 // indirect
github.com/luxfi/corona v0.7.4 // 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/pq v1.0.3 // indirect
github.com/luxfi/protocol v0.0.4 // indirect
github.com/luxfi/pulsar v1.1.2 // indirect
github.com/luxfi/pulsar v1.0.12 // indirect
github.com/luxfi/relay v0.0.0-20260429020048-c629fe160d3c // indirect
github.com/luxfi/staking v1.1.0 // indirect
github.com/luxfi/threshold v1.9.7 // indirect
github.com/luxfi/threshold v1.8.5 // indirect
github.com/luxfi/trace v0.1.4 // indirect
github.com/luxfi/zap v0.6.1 // 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
@@ -201,7 +192,7 @@ require (
require (
github.com/luxfi/concurrent v0.0.3
github.com/luxfi/proto v1.0.2
github.com/luxfi/proto v1.0.1
github.com/luxfi/upgrade v1.0.0 // indirect
github.com/luxfi/version v1.0.1
gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect
@@ -217,7 +208,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/fxamacker/cbor/v2 v2.9.1 // indirect
github.com/fxamacker/cbor/v2 v2.9.0 // 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
@@ -245,3 +236,5 @@ require (
)
exclude github.com/ethereum/go-ethereum v1.10.26
replace github.com/luxfi/corona => github.com/luxfi/corona v0.7.5
+38 -82
View File
@@ -47,8 +47,6 @@ 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=
@@ -124,8 +122,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.1 h1:2rWm8B193Ll4VdjsJY28jxs70IdDsHRWgQYAI80+rMQ=
github.com/fxamacker/cbor/v2 v2.9.1/go.mod h1:vM4b+DJCtHn+zz7h3FFp/hDAI9WNWCsZj23V5ytsSxQ=
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/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=
@@ -199,8 +197,6 @@ 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/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=
@@ -250,10 +246,8 @@ github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0
github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw=
github.com/leanovate/gopter v0.2.11 h1:vRjThO1EKPb/1NsDXuDrzldR28RLkBflWYcU9CvzWu4=
github.com/leanovate/gopter v0.2.11/go.mod h1:aK3tzZP/C+p1m3SPRE4SYZFGP7jjkuSI4f7Xvpt0S9c=
github.com/luxfi/accel v1.1.8 h1:dFD1MSrVV7T4wrLcQbj+7vjfNSPxlRId3mJcTxMKoBM=
github.com/luxfi/accel v1.1.8/go.mod h1:K00BcnLzEYMPHwCFq8Tf/450ApmTs9xBVvYOnofJCkc=
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/accel v1.1.4 h1:UOvS/00vG6WByf2P1tGYRkoBcsUkFuCgw7o2xU03OoE=
github.com/luxfi/accel v1.1.4/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.5.0 h1:G69HbSV4R3vKEH9B0CulnRaMdSdf4RalMgP8xKmxHeI=
@@ -274,18 +268,16 @@ github.com/luxfi/compress v0.0.5 h1:4tEUHw5MK1bu5UOjfYCt4OKMiH7yykIgmGPRA/BfJTM=
github.com/luxfi/compress v0.0.5/go.mod h1:Cc1yxD2pfzrvpO32W2GDwLKff+CylHEvzZh2Ko8RSIU=
github.com/luxfi/concurrent v0.0.3 h1:eJyv1fhaC0jMLMw6+QS774cUmp7GK+ouMgvLCqnC7cc=
github.com/luxfi/concurrent v0.0.3/go.mod h1:Aj/FR5NpM0cB2P4Nt3+tz9+dV6V+LUW4HuMgSjwq5hw=
github.com/luxfi/consensus v1.25.13 h1:hqbFq6W+oRvCrovj6Yu1zOsJNiRymHpjGdqZT1LvZUg=
github.com/luxfi/consensus v1.25.13/go.mod h1:7/tlpy+byv2tP7YZSMG+XtS8C2bbz3qpB4H8jxXhHxk=
github.com/luxfi/consensus v1.24.6 h1:N65lAqHrykg0rymd9symfX0fuAhE3WCkPf6V6lNVKkM=
github.com/luxfi/consensus v1.24.6/go.mod h1:raSelEjRkcYB9tfNpEGcgisNkZw9+JTbHgjoBA+NdRU=
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/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/corona v0.7.5 h1:XqcnsKaiP/EyDJzmDhziS+kDhX34TsVQiXTM8PvRROg=
github.com/luxfi/corona v0.7.5/go.mod h1:4aD7+ZqnlZ2aVuU/DBQ5aspIagv5ux45LW2sJ4+siY8=
github.com/luxfi/crypto v1.19.15 h1:Tf+iPRXv08Rlj9k7iNtYy0e1tJWIgRcY0pTR4rQax6w=
github.com/luxfi/crypto v1.19.15/go.mod h1:INjdZtke85k8hX/QAmTMAY8bbZ4gzGZQLqURg3xf6Gk=
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=
@@ -294,44 +286,32 @@ github.com/luxfi/filesystem v0.0.1 h1:VZ6xMFKaAPBW/ddlMsDnI2G0VU1lV5rYaVcW5d+KwE
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.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/genesis v1.12.14 h1:/31ZAymyH+Zj/QCXI6To2agYLYF5pucBm5L2DIuGK+o=
github.com/luxfi/genesis v1.12.14/go.mod h1:QHBJQrOarpM1q+xgo7wL119CuLSsTjrFwYJLv5x9pwQ=
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.13 h1:lEotq0WUpMLcc/5X5MbE3n73jdfNo8IlFvTDfUXg+9A=
github.com/luxfi/ids v1.2.13/go.mod h1:QWjJvggX/nRkmrz1AGSaF2Y6mnOvz3g7lFOzs3Zd+JM=
github.com/luxfi/ids v1.2.10 h1:f1WILZE199ayMuqnEyB2WP1qfMZkmozOQXSVYtB3e5k=
github.com/luxfi/ids v1.2.10/go.mod h1:QBIwy3OHvrtskbUqKh1+OYRa6PsyR7f7oNX33sOfK7w=
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.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/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.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/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/mdns v0.1.0 h1:VB3mQcETc9j5SY1S6lAgFtuGr/rjWuDgPYnxS+OKWMQ=
github.com/luxfi/mdns v0.1.0/go.mod h1:/3dheKVjUk2yiS/ocH1IDzeLXOIe+kpVsErIGDOZdiQ=
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/metric v1.5.5 h1:JXruty5ZN/ljeRNaCSabQGg1Xr3re2E8wqajVUUs6w4=
github.com/luxfi/metric v1.5.5/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=
@@ -344,20 +324,20 @@ 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/proto v1.0.1 h1:pw+QlwWbXELJ+kOApBkUNnyFrIO/EuWsd/NzAKkBBOU=
github.com/luxfi/proto v1.0.1/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/pulsar v1.0.12 h1:SD+GGat5JuqKVhRSRojdKhHhmOWr7rz74IMFiP8PPeg=
github.com/luxfi/pulsar v1.0.12/go.mod h1:nWjIyef69Yv/y27lwy8hUfAE55lkj2GRP4zDIGZc1B0=
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/rpc v1.0.2 h1:NLRcOYRW+io0d1d33RMkgOZea8nlhK09MbPgCXcU5wU=
github.com/luxfi/rpc v1.0.2/go.mod h1:pgiHwMWgOuxYYIa0vsUBvrBI+Op6bhZ39guM9vtMUcE=
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/runtime v1.0.1 h1:cii3OsRiVSIl9jzfWFM6++62T1r6ZSGP+/3F0Ezhpqw=
github.com/luxfi/runtime v1.0.1/go.mod h1:2hBKjzbEeE4dzrhUKH8dqkRgLEyiXz6GmuVusy3vJMs=
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.60 h1:MKIFpGAIQzbFADXNd6rV5KySlbegnvpDJyiNhtO7YZw=
@@ -366,8 +346,8 @@ 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.9.7 h1:C0KcEhwHPiQehMKiKh22Hcq0jF4o1uxTY29dKaVAS/s=
github.com/luxfi/threshold v1.9.7/go.mod h1:5LEo5ZcAvBxBkr8Neb3GMbHxVa7m58qbbmEZNMAnR7c=
github.com/luxfi/threshold v1.8.5 h1:uUTzlc5z8xElxcF9HGLVY1HUX+vsseMX0uryPuOgr84=
github.com/luxfi/threshold v1.8.5/go.mod h1:d066yAD8CjSjOeuOYkE+P1/f93F14+NKYoHoJIGfVbI=
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=
@@ -390,10 +370,6 @@ 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.6 h1:+ly7mHz77ig4yUyLax32aAjk7tiQQ6eygzOSDNfYRbQ=
github.com/luxfi/warp v1.18.6/go.mod h1:OBN23yiGl+E4qupkPHuetBIEqsI8q5leE8WJH8soFjY=
github.com/luxfi/zap v0.2.0 h1:RzvOkp3EoN5UCkpnqfObHLM1sEHy7YcxXKuermhE/VA=
github.com/luxfi/zap v0.2.0/go.mod h1:2hydPSa/XMCMtfW6/DC9M5Bt03N5h75QwCV5Vypsqr4=
github.com/luxfi/zap v0.6.1 h1:CzFAHLj/2ZjJkv2cCZaSIq44U8nrHSziocVuXPYmeLQ=
github.com/luxfi/zap v0.6.1/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=
@@ -406,9 +382,6 @@ 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=
@@ -571,22 +544,22 @@ 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.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 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.42.0 h1:THuZiwpQZuHPul65w4WcwEnkX2QIuMT+UFoOrygtoJw=
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.42.0/go.mod h1:J2pvYM5NGHofZ2/Ru6zw/TNWnEQp5crgyDeSrYpXkAw=
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/otel/exporters/otlp/otlptrace/otlptracehttp v1.42.0 h1:uLXP+3mghfMf7XmV4PkGfFhFKuNWoCvvx5wP/wOXo0o=
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.42.0/go.mod h1:v0Tj04armyT59mnURNUJf7RCKcKzq+lgJs6QSjHjaTc=
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.42.0 h1:LyC8+jqk6UJwdrI/8VydAq/hvkFKNHZVIWuslJXYsDo=
go.opentelemetry.io/otel/sdk v1.42.0/go.mod h1:rGHCAxd9DAph0joO4W6OPwxjNTYWghRWmkHuGbayMts=
go.opentelemetry.io/otel/sdk/metric v1.42.0 h1:D/1QR46Clz6ajyZ3G8SgNlTJKBdGp84q9RKCAZ3YGuA=
go.opentelemetry.io/otel/sdk/metric v1.42.0/go.mod h1:Ua6AAlDKdZ7tdvaQKfSmnFTdHx37+J4ba8MwVCYM5hc=
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.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=
@@ -609,24 +582,17 @@ golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8U
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
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=
@@ -637,8 +603,6 @@ golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su
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=
@@ -651,7 +615,6 @@ 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=
@@ -671,8 +634,6 @@ 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.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=
@@ -682,21 +643,16 @@ 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.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=
BIN
View File
Binary file not shown.
+9 -9
View File
@@ -1,10 +1,10 @@
#!/bin/bash
# Import RLP blocks for chains after deployment
# Usage: ./import-chain-rlp.sh [mainnet|testnet|both]
# Import RLP blocks for subnet chains after deployment
# Usage: ./import-subnet-rlp.sh [mainnet|testnet|both]
#
# Prerequisites:
# - Chains must be deployed (run deploy-chains.sh first)
# - Nodes must be tracking the chains
# - Subnets must be deployed (run deploy-subnets.sh first)
# - Nodes must be tracking the subnet 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 chain import, you may need to use admin.importChain RPC"
echo "NOTE: For subnet 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 chain RLP blocks to mainnet ==="
echo "=== Importing subnet 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 chain RLP blocks to testnet ==="
echo "=== Importing subnet RLP blocks to testnet ==="
import_rlp testnet zoo-testnet 200201 zoo-testnet-200201.rlp "$TESTNET_RPC"
;;
both|all)
echo "=== Importing chain RLP blocks to mainnet ==="
echo "=== Importing subnet 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 chain RLP blocks to testnet ==="
echo "=== Importing subnet 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/node/utils/json"
"github.com/luxfi/rpc"
"github.com/luxfi/node/utils/json"
)
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
@@ -6,8 +6,8 @@ package message
import (
"time"
compression "github.com/luxfi/compress"
"github.com/luxfi/metric"
compression "github.com/luxfi/compress"
)
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) {
@@ -15,9 +15,9 @@ import (
time "time"
ids "github.com/luxfi/ids"
"github.com/luxfi/net/endpoints"
message "github.com/luxfi/node/message"
p2p "github.com/luxfi/node/proto/p2p"
"github.com/luxfi/net/endpoints"
gomock "go.uber.org/mock/gomock"
)
+1 -1
View File
@@ -8,12 +8,12 @@ import (
"fmt"
"time"
compression "github.com/luxfi/compress"
"github.com/luxfi/constants"
"github.com/luxfi/ids"
"github.com/luxfi/metric"
"github.com/luxfi/node/proto/p2p"
"github.com/luxfi/timer/mockable"
compression "github.com/luxfi/compress"
)
const (
+1 -1
View File
@@ -12,9 +12,9 @@ import (
"github.com/stretchr/testify/require"
compression "github.com/luxfi/compress"
"github.com/luxfi/ids"
"github.com/luxfi/node/proto/p2p"
compression "github.com/luxfi/compress"
)
var (
+1 -1
View File
@@ -12,10 +12,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/node/staking"
compression "github.com/luxfi/compress"
)
func TestMessage(t *testing.T) {
+1 -1
View File
@@ -17,8 +17,8 @@ import (
time "time"
ids "github.com/luxfi/ids"
"github.com/luxfi/net/endpoints"
p2p "github.com/luxfi/node/proto/p2p"
"github.com/luxfi/net/endpoints"
)
// MockOutboundMsgBuilder is a mock of OutboundMsgBuilder interface.
+56 -56
View File
@@ -17,41 +17,41 @@ const (
// Message is the top-level P2P message container
type Message struct {
// Only one of these should be set
CompressedZstd []byte
Ping *Ping
Pong *Pong
Handshake *Handshake
GetPeerList *GetPeerList
PeerList *PeerList
GetStateSummaryFrontier *GetStateSummaryFrontier
StateSummaryFrontier *StateSummaryFrontier
GetAcceptedStateSummary *GetAcceptedStateSummary
AcceptedStateSummary *AcceptedStateSummary
GetAcceptedFrontier *GetAcceptedFrontier
AcceptedFrontier *AcceptedFrontier
GetAccepted *GetAccepted
Accepted *Accepted
GetAncestors *GetAncestors
Ancestors *Ancestors
Get *Get
Put *Put
PushQuery *PushQuery
PullQuery *PullQuery
Chits *Chits
Request *Request
Response *Response
Gossip *Gossip
CompressedZstd []byte
Ping *Ping
Pong *Pong
Handshake *Handshake
GetPeerList *GetPeerList
PeerList *PeerList
GetStateSummaryFrontier *GetStateSummaryFrontier
StateSummaryFrontier *StateSummaryFrontier
GetAcceptedStateSummary *GetAcceptedStateSummary
AcceptedStateSummary *AcceptedStateSummary
GetAcceptedFrontier *GetAcceptedFrontier
AcceptedFrontier *AcceptedFrontier
GetAccepted *GetAccepted
Accepted *Accepted
GetAncestors *GetAncestors
Ancestors *Ancestors
Get *Get
Put *Put
PushQuery *PushQuery
PullQuery *PullQuery
Chits *Chits
Request *Request
Response *Response
Gossip *Gossip
BFT *BFT
}
// Ping message
type Ping struct {
Uptime uint32
ChainIds []*ChainPingEntry
Uptime uint32
ChainIds []*ChainPingEntry
}
// ChainPingEntry is the per-chain payload in Ping/Pong.
// In Lux's chain model each chain is its own validator set, so the legacy
// In Lux's L1/L2 model each chain is its own validator set, so the legacy
// (chain, network) pair collapses to a single chain identifier.
type ChainPingEntry struct {
ChainId []byte
@@ -59,24 +59,24 @@ type ChainPingEntry struct {
// Pong message
type Pong struct {
Uptime uint32
ChainIds []*ChainPingEntry
Uptime uint32
ChainIds []*ChainPingEntry
}
// Handshake message
type Handshake struct {
NetworkId uint32
MyTime uint64
IpAddr []byte
IpPort uint32
IpSigningTime uint64
IpNodeIdSig []byte
NetworkId uint32
MyTime uint64
IpAddr []byte
IpPort uint32
IpSigningTime uint64
IpNodeIdSig []byte
TrackedChains [][]byte
Client *Client
SupportedAcps []uint32
ObjectedAcps []uint32
KnownPeers *BloomFilter
IpBlsSig []byte
Client *Client
SupportedAcps []uint32
ObjectedAcps []uint32
KnownPeers *BloomFilter
IpBlsSig []byte
}
// Client info in handshake
@@ -210,9 +210,9 @@ type GetAncestors struct {
EngineType EngineType
}
func (m *GetAncestors) GetChainId() []byte { return m.ChainId }
func (m *GetAncestors) GetRequestId() uint32 { return m.RequestId }
func (m *GetAncestors) GetDeadline() uint64 { return m.Deadline }
func (m *GetAncestors) GetChainId() []byte { return m.ChainId }
func (m *GetAncestors) GetRequestId() uint32 { return m.RequestId }
func (m *GetAncestors) GetDeadline() uint64 { return m.Deadline }
func (m *GetAncestors) GetEngineType() EngineType { return m.EngineType }
// Ancestors message
@@ -240,10 +240,10 @@ func (m *Get) GetDeadline() uint64 { return m.Deadline }
// Put message
type Put struct {
ChainId []byte
RequestId uint32
Container []byte
EngineType EngineType
ChainId []byte
RequestId uint32
Container []byte
EngineType EngineType
}
func (m *Put) GetChainId() []byte { return m.ChainId }
@@ -251,11 +251,11 @@ func (m *Put) GetRequestId() uint32 { return m.RequestId }
// PushQuery message
type PushQuery struct {
ChainId []byte
RequestId uint32
Deadline uint64
Container []byte
EngineType EngineType
ChainId []byte
RequestId uint32
Deadline uint64
Container []byte
EngineType EngineType
RequestedHeight uint64
}
@@ -279,11 +279,11 @@ func (m *PullQuery) GetDeadline() uint64 { return m.Deadline }
// Chits message
type Chits struct {
ChainId []byte
RequestId uint32
PreferredId []byte
ChainId []byte
RequestId uint32
PreferredId []byte
PreferredIdAtHeight []byte
AcceptedId []byte
AcceptedId []byte
}
func (m *Chits) GetChainId() []byte { return m.ChainId }
+8 -7
View File
@@ -11,12 +11,12 @@ import (
const (
// Message type tags for ZAP encoding
tagCompressedZstd = 1
tagPing = 2
tagPong = 3
tagHandshake = 4
tagGetPeerList = 5
tagPeerList = 6
tagCompressedZstd = 1
tagPing = 2
tagPong = 3
tagHandshake = 4
tagGetPeerList = 5
tagPeerList = 6
tagGetStateSummaryFrontier = 7
tagStateSummaryFrontier = 8
tagGetAcceptedStateSummary = 9
@@ -35,12 +35,13 @@ const (
tagRequest = 22
tagResponse = 23
tagGossip = 24
tagBFT = 25
tagBFT = 25
)
var (
ErrInvalidMessage = errors.New("invalid wire message")
ErrUnknownTag = errors.New("unknown message tag")
)
// Buffer for zero-copy encoding
+4 -4
View File
@@ -19,7 +19,7 @@ func getPMPRouter() *pmpRouter {
// pmpRouter stub for minimal build
type pmpRouter struct{}
func (*pmpRouter) SupportsNAT() bool { return false }
func (*pmpRouter) MapPort(_, _ uint16, _ string, _ time.Duration) error { return nil }
func (*pmpRouter) UnmapPort(_, _ uint16) error { return nil }
func (*pmpRouter) ExternalIP() (netip.Addr, error) { return netip.Addr{}, nil }
func (*pmpRouter) SupportsNAT() bool { return false }
func (*pmpRouter) MapPort(_, _ uint16, _ string, _ time.Duration) error { return nil }
func (*pmpRouter) UnmapPort(_, _ uint16) error { return nil }
func (*pmpRouter) ExternalIP() (netip.Addr, error) { return netip.Addr{}, nil }
+4 -4
View File
@@ -19,7 +19,7 @@ func getUPnPRouter() *upnpRouter {
// upnpRouter stub for minimal build
type upnpRouter struct{}
func (*upnpRouter) SupportsNAT() bool { return false }
func (*upnpRouter) MapPort(_, _ uint16, _ string, _ time.Duration) error { return nil }
func (*upnpRouter) UnmapPort(_, _ uint16) error { return nil }
func (*upnpRouter) ExternalIP() (netip.Addr, error) { return netip.Addr{}, nil }
func (*upnpRouter) SupportsNAT() bool { return false }
func (*upnpRouter) MapPort(_, _ uint16, _ string, _ time.Duration) error { return nil }
func (*upnpRouter) UnmapPort(_, _ uint16) error { return nil }
func (*upnpRouter) ExternalIP() (netip.Addr, error) { return netip.Addr{}, nil }
+2 -2
View File
@@ -148,8 +148,8 @@ type Config struct {
// This allows chains to be sequenced by a different validator set than their own.
// Examples:
// - C-Chain → returns PrimaryNetworkID (sequenced by primary network validators)
// - Zoo chain (self-sequenced) → returns ZooChainID
// - Zoo chain (Lux-sequenced) → returns the Lux network's sequencerID
// - Zoo L2 (self-sequenced) → returns ZooChainID
// - Zoo L2 (Lux-sequenced) → returns the Lux network's sequencerID
// Default: returns chainID (self-sequenced).
SequencerIDForChain func(chainID ids.ID) ids.ID `json:"-"`
+6 -6
View File
@@ -220,7 +220,7 @@ type network struct {
router ExternalHandler
// blockchainToNetwork maps blockchain IDs to their chain network IDs.
// This is needed for chain gossip: when gossiping a block for another chain
// This is needed for chain gossip: when gossiping a block for an L2
// blockchain, we need to know which chain network's validator set to
// use for peer sampling, and which network ID to check in peers'
// trackedChains. Protected by peersLock.
@@ -598,13 +598,13 @@ func kemSessionScheme(p *consensusconfig.ChainSecurityProfile) kem.KeyExchangeID
// sequencerID returns the validator-set identity that sequences chainID.
// This resolves the distinction between:
// - chainID: execution domain (C-Chain, Zoo chain, etc.)
// - chainID: execution domain (C-Chain, Zoo L2, etc.)
// - sequencerID: validator-set / sequencing authority for a given chain
//
// For example:
// - C-Chain is sequenced by PrimaryNetworkID validators
// - A self-sequenced chain uses its own chainID as sequencerID
// - non-primary chains map to their chain ID for validator lookups
// - A self-sequenced L2 uses its own chainID as sequencerID
// - L2 blockchains map to their chain ID for validator lookups
func (n *network) sequencerID(chainID ids.ID) ids.ID {
// Primary network is a special routing concept; membership is still primary.
if chainID == constants.PrimaryNetworkID {
@@ -1305,7 +1305,7 @@ func (n *network) samplePeers(
isPrimaryNetwork := chainID == constants.PrimaryNetworkID || ids.IsNativeChain(chainID)
containsChainID := isPrimaryNetwork || trackedChains.Contains(chainID)
// For non-primary chains, also check if the peer tracks the chain ID.
// For L2 blockchains, also check if the peer tracks the chain ID.
// Peers advertise chain IDs (not blockchain IDs) in their tracked chains,
// but gossip uses blockchain IDs as the chainID parameter.
if !containsChainID {
@@ -1942,7 +1942,7 @@ func (n *network) TrackedChains() set.Set[ids.ID] {
// RegisterBlockchainNetwork registers a mapping from a blockchain ID to its
// chain network ID. This allows the gossip layer to correctly resolve which
// validator set to use when gossiping blocks for non-primary chains, and to check
// validator set to use when gossiping blocks for L2 chains, and to check
// whether peers are tracking the chain network that owns the blockchain.
func (n *network) RegisterBlockchainNetwork(blockchainID, networkID ids.ID) {
n.peersLock.Lock()
+1 -1
View File
@@ -152,7 +152,7 @@ type Config struct {
// Genesis information
GenesisBytes []byte `json:"-"`
UTXOAssetID ids.ID `json:"utxoAssetID"`
XAssetID ids.ID `json:"xAssetID"`
// ID of the network this node should connect to
NetworkID uint32 `json:"networkID"`
+5 -6
View File
@@ -32,7 +32,6 @@ import (
"github.com/luxfi/database"
"github.com/luxfi/database/prefixdb"
genesiscfg "github.com/luxfi/genesis/pkg/genesis"
genesissecurity "github.com/luxfi/genesis/pkg/genesis/security"
"github.com/luxfi/ids"
"github.com/luxfi/log"
"github.com/luxfi/math/set"
@@ -287,7 +286,7 @@ func New(
if err := n.addDefaultVMAliases(); err != nil {
return nil, fmt.Errorf("couldn't initialize API aliases: %w", err)
}
if err := n.initChainManager(n.Config.UTXOAssetID); err != nil { // Set up the chain manager
if err := n.initChainManager(n.Config.XAssetID); err != nil { // Set up the chain manager
return nil, fmt.Errorf("couldn't initialize chain manager: %w", err)
}
if err := n.initVMs(); err != nil { // Initialize the VM registry.
@@ -705,7 +704,7 @@ func (n *Node) initNetworking(reg metric.Registerer) error {
// strict-PQ chains. Nil on legacy / classical-compat networks.
n.Config.NetworkConfig.SecurityProfile = n.securityProfile
// Map native chains (P/C/X/etc.) to the primary network validator set.
// For non-primary chains, return ids.Empty to let blockchainToNetwork map resolve
// For L2 chains, return ids.Empty to let blockchainToNetwork map resolve
// the correct chain ID. Returning chainID here would short-circuit the
// lookup and cause chain messages to be sequenced under the wrong ID,
// preventing block propagation to other nodes.
@@ -1036,7 +1035,7 @@ func (n *Node) applySecurityProfile(pin *genesiscfg.SecurityProfile) error {
return nil
}
profile, err := genesissecurity.ResolveProfile(pin)
profile, err := pin.Resolve()
if err != nil {
return fmt.Errorf("genesis SecurityProfile failed to resolve: %w", err)
}
@@ -1258,7 +1257,7 @@ func (n *Node) addDefaultVMAliases() error {
// Create the chainManager and register the following VMs:
// XVM, Simple Payments DAG, Simple Payments Chain, and Platform VM
// Assumes n.DBManager, n.vdrs all initialized (non-nil)
func (n *Node) initChainManager(utxoAssetID ids.ID) error {
func (n *Node) initChainManager(xAssetID ids.ID) error {
// X-Chain (XVM, the historic exchange chain) is OPT-IN. Networks that
// don't bake an XVM into platform genesis run in "P-only" mode where
// asset creation and UTXO ops are first-class on the P-Chain (see
@@ -1353,7 +1352,7 @@ func (n *Node) initChainManager(utxoAssetID ids.ID) error {
NetworkID: n.Config.NetworkID,
Server: n.APIServer,
AtomicMemory: n.sharedMemory,
UTXOAssetID: utxoAssetID,
XAssetID: xAssetID,
XChainID: xChainID,
CChainID: cChainID,
DChainID: dChainID,
+2 -3
View File
@@ -11,7 +11,6 @@ import (
consensusconfig "github.com/luxfi/consensus/config"
genesiscfg "github.com/luxfi/genesis/pkg/genesis"
genesissecurity "github.com/luxfi/genesis/pkg/genesis/security"
"github.com/luxfi/log"
)
@@ -83,7 +82,7 @@ func TestApplySecurityProfile_HashMismatchRejected(t *testing.T) {
if err == nil {
t.Fatal("applySecurityProfile accepted a wrong-hash pin")
}
if !errors.Is(err, genesissecurity.ErrSecurityProfileHashMismatch) {
if !errors.Is(err, genesiscfg.ErrSecurityProfileHashMismatch) {
t.Errorf("applySecurityProfile returned %v; want wrap of ErrSecurityProfileHashMismatch", err)
}
if n.SecurityProfile() != nil {
@@ -104,7 +103,7 @@ func TestApplySecurityProfile_UnknownProfileIDRejected(t *testing.T) {
if err == nil {
t.Fatal("applySecurityProfile accepted an unknown ProfileID")
}
if !errors.Is(err, genesissecurity.ErrSecurityProfileInvalidID) {
if !errors.Is(err, genesiscfg.ErrSecurityProfileInvalidID) {
t.Errorf("applySecurityProfile returned %v; want wrap of ErrSecurityProfileInvalidID", err)
}
}
+1 -1
View File
@@ -110,7 +110,7 @@ func (v *ValidatorManager) Connected(nodeID ids.NodeID, nodeVersion *version.App
}
// Also add to ALL tracked chain validator sets so chain consensus
// engines can find validators for their chains. Without this, non-primary
// engines can find validators for their chains. Without this, L2
// chains can't gossip blocks because the validator set is empty.
for _, networkID := range v.trackedNetworks {
networkTxID := ids.Empty
+2
View File
@@ -363,6 +363,8 @@ func (i *Info) GetTxFee(_ *http.Request, _ *struct{}, reply *apiinfo.GetTxFeeRes
switch i.NetworkID {
case constants.MainnetID:
*reply = mainnetGetTxFeeResponse
// case constants.FujiID: // FujiID not available in constants package
// *reply = fujiGetTxFeeResponse
default:
*reply = defaultGetTxFeeResponse
}
+1 -1
View File
@@ -47,7 +47,7 @@ type Network struct {
Nets []*Net
}
// Net represents a net (non-primary chain) in the network
// Net represents a net (L2 chain) in the network
type Net struct {
ChainID ids.ID
Chains []*Chain
+2 -31
View File
@@ -19,36 +19,7 @@
"v1.23.24",
"v1.23.25",
"v1.26.12",
"v1.26.13",
"v1.27.0",
"v1.27.1",
"v1.27.2",
"v1.27.3",
"v1.27.4",
"v1.27.5",
"v1.27.6",
"v1.27.7",
"v1.27.8",
"v1.27.9",
"v1.27.10",
"v1.27.11",
"v1.27.12",
"v1.27.13",
"v1.27.14",
"v1.27.15",
"v1.27.16",
"v1.27.17",
"v1.27.18",
"v1.27.19",
"v1.27.20",
"v1.27.21",
"v1.27.22",
"v1.27.23",
"v1.27.24",
"v1.27.25",
"v1.27.26",
"v1.27.27",
"v1.28.0"
"v1.26.13"
],
"41": [
"v1.13.2"
@@ -163,4 +134,4 @@
"v1.8.5",
"v1.8.6"
]
}
}
+2 -2
View File
@@ -76,8 +76,8 @@ var (
// These should match the latest git tag
const (
defaultMajor = 1
defaultMinor = 28
defaultPatch = 0
defaultMinor = 26
defaultPatch = 13
)
func init() {
+3 -3
View File
@@ -179,7 +179,7 @@ type Chain struct {
// [Chains] are the chains that exist at genesis.
// [Time] is the Platform Chain's time at network genesis.
type BuildGenesisArgs struct {
UTXOAssetID ids.ID `json:"utxoAssetID"`
XAssetID ids.ID `json:"xAssetID"`
NetworkID json.Uint32 `json:"networkID"`
UTXOs []UTXO `json:"utxos"`
Validators []GenesisPermissionlessValidator `json:"validators"`
@@ -223,7 +223,7 @@ func (*StaticService) BuildGenesis(_ *http.Request, args *BuildGenesisArgs, repl
TxID: ids.Empty,
OutputIndex: uint32(i),
},
Asset: lux.Asset{ID: args.UTXOAssetID},
Asset: lux.Asset{ID: args.XAssetID},
Out: &secp256k1fx.TransferOutput{
Amt: uint64(apiUTXO.Amount),
OutputOwners: secp256k1fx.OutputOwners{
@@ -262,7 +262,7 @@ func (*StaticService) BuildGenesis(_ *http.Request, args *BuildGenesisArgs, repl
}
utxo := &lux.TransferableOutput{
Asset: lux.Asset{ID: args.UTXOAssetID},
Asset: lux.Asset{ID: args.XAssetID},
Out: &secp256k1fx.TransferOutput{
Amt: uint64(apiUTXO.Amount),
OutputOwners: secp256k1fx.OutputOwners{
+1 -1
View File
@@ -210,7 +210,7 @@ func TestBuildGenesisReturnsSortedValidators(t *testing.T) {
}
args := BuildGenesisArgs{
UTXOAssetID: ids.ID{'d', 'u', 'm', 'm', 'y', ' ', 'I', 'D'},
XAssetID: ids.ID{'d', 'u', 'm', 'm', 'y', ' ', 'I', 'D'},
UTXOs: []UTXO{
utxo,
},
+22 -114
View File
@@ -1,4 +1,4 @@
// Copyright (C) 2019-2026, Lux Industries Inc. All rights reserved.
// Copyright (C) 2019-2025, Lux Industries Inc. All rights reserved.
// See the file LICENSE for licensing terms.
package block
@@ -10,148 +10,56 @@ import (
"github.com/luxfi/codec"
"github.com/luxfi/codec/linearcodec"
"github.com/luxfi/codec/wrappers"
"github.com/luxfi/node/vms/platformvm/block/v0"
"github.com/luxfi/node/vms/platformvm/txs"
)
const (
// CodecVersionV0 is the v1.23.x ("Apricot/Banff") wire layout. It is
// retained as a READ-ONLY decoder so that pre-codec-v1 blocks on
// disk continue to deserialize and so that v0-derived BlockIDs and
// TxIDs remain stable. All write paths MUST use CodecVersionV1.
CodecVersionV0 = txs.CodecVersionV0
// CodecVersionV1 is the current canonical block-codec wire layout.
// Every block built by this binary is written at v1.
CodecVersionV1 = txs.CodecVersionV1
// CodecVersion is the canonical write version. All Marshal call
// sites in this package use CodecVersion so that any future bump of
// the write target updates exactly one symbol.
CodecVersion = CodecVersionV1
)
const CodecVersion = txs.CodecVersion
var (
// Codec is the standard-size block codec.Manager. It carries ONLY
// the v1 slot map and so decodes only v1-prefixed block bytes via
// codec.Manager dispatch. v0 block bytes must go through Parse,
// which routes prefix==0 to v0Codec for the v0 Block interface.
//
// Block-codec dispatch is explicitly two-step (Parse extracts the
// 2-byte prefix and selects v0Codec or Codec) because v0 blocks
// implement v0.Block, not block.Block — they cannot be unmarshalled
// into a block.Block destination. Hence Codec is v1-only by design.
Codec codec.Manager
// GenesisCodec is the unbounded-size codec.Manager used by both
// large-genesis decode AND every P-Chain state-side read of
// non-block byte values (feeState, L1Validator, NetToL1Conversion,
// fx.Owner, heightRange, legacy stateBlk). It registers BOTH the
// v0 (v1.23.x Apricot/Banff) and v1 (current) tx slot maps under
// CodecVersionV0 and CodecVersionV1 respectively, so a state read
// of pre-codec-v1 bytes (prefix=0x0000) dispatches into the v0
// slot map and a v1 read (prefix=0x0001) dispatches into v1.
//
// Writes still target CodecVersion (== CodecVersionV1) exclusively —
// the v0 slot map is a READ-ONLY decoder. This is the same shape
// that txs.GenesisCodec carries, which is why genesis.Codec aliases
// txs.GenesisCodec rather than this codec.
//
// Note that this codec does NOT register block.Block / v0.Block
// types directly — block parsing always goes through block.Parse,
// not GenesisCodec.Unmarshal(b, &Block). The v0 slot map registered
// here covers the tx + sub-tx slots referenced by serialized state
// values (e.g. fx.Owner -> secp256k1fx.OutputOwners).
// GenesisCodec allows blocks of larger than usual size to be parsed.
// While this gives flexibility in accommodating large genesis blocks
// it must not be used to parse new, unverified blocks which instead
// must be processed by Codec.
GenesisCodec codec.Manager
// v0Codec is the v1.23.x read-only codec.Manager. It registers v0
// block + tx slots and unmarshals into v0.Block (the v0 interface),
// not block.Block — these are two distinct interface destinations.
// External packages MUST NOT Marshal at v0; that is verified at
// Parse time (Parse never re-marshals).
v0Codec codec.Manager
Codec codec.Manager
// v0GenesisCodec mirrors v0Codec at large size.
v0GenesisCodec codec.Manager
// genesisLinearCodec is the underlying v1 codec for GenesisCodec.
// This is exposed for registering additional types from other
// packages (e.g. state) at the canonical write version.
// genesisLinearCodec is the underlying codec for GenesisCodec.
// This is exposed for registering additional types from other packages.
genesisLinearCodec linearcodec.Codec
// genesisLinearCodecV0 is the underlying v0 codec for GenesisCodec.
// Exposed so state-side types that want to be decodable from both
// v0 and v1 state bytes can register symmetrically via
// RegisterGenesisType.
genesisLinearCodecV0 linearcodec.Codec
)
func init() {
cV1 := linearcodec.NewDefault()
gcV1 := linearcodec.NewDefault()
gcV0 := linearcodec.NewDefault()
cV0 := linearcodec.NewDefault()
gcV0BlockOnly := linearcodec.NewDefault()
c := linearcodec.NewDefault()
gc := linearcodec.NewDefault()
errs := wrappers.Errs{}
for _, c := range []linearcodec.Codec{cV1, gcV1} {
for _, c := range []linearcodec.Codec{c, gc} {
errs.Add(RegisterBlockTypes(c))
}
// gcV0 carries only the v0 tx slot map (no block types) because
// GenesisCodec is the state-read codec, not a block-decode codec.
// Block parsing uses v0Codec / v0GenesisCodec (below).
errs.Add(v0.RegisterTxTypes(gcV0))
// cV0 and gcV0BlockOnly carry the full v0 block+tx slot map for
// block.Parse's v0 dispatch path.
for _, c := range []linearcodec.Codec{cV0, gcV0BlockOnly} {
errs.Add(v0.RegisterBlockTypes(c))
}
Codec = codec.NewDefaultManager()
GenesisCodec = codec.NewManager(math.MaxInt32)
v0Codec = codec.NewDefaultManager()
v0GenesisCodec = codec.NewManager(math.MaxInt32)
errs.Add(
Codec.RegisterCodec(CodecVersionV1, cV1),
// GenesisCodec carries BOTH v0 (read-only) AND v1 (read+write)
// slot maps so state-side reads of pre-codec-v1 bytes (mainnet,
// testnet bootstrapped at v1.23.x) succeed via Manager.Unmarshal
// dispatch on the 2-byte wire prefix. Writes still target
// CodecVersion (== v1).
GenesisCodec.RegisterCodec(CodecVersionV0, gcV0),
GenesisCodec.RegisterCodec(CodecVersionV1, gcV1),
v0Codec.RegisterCodec(CodecVersionV0, cV0),
v0GenesisCodec.RegisterCodec(CodecVersionV0, gcV0BlockOnly),
Codec.RegisterCodec(CodecVersion, c),
GenesisCodec.RegisterCodec(CodecVersion, gc),
)
if errs.Errored() {
panic(errs.Err)
}
genesisLinearCodec = gcV1
genesisLinearCodecV0 = gcV0
genesisLinearCodec = gc
}
// RegisterGenesisType registers a type with the GenesisCodec at BOTH
// the v0 and v1 slot positions. Used by other packages (e.g. state) to
// register types that are encountered in genesis bytes and state-read
// fallback paths. Registering at both versions keeps the slot ID
// identical across the codec.Manager dispatch so a v0-prefixed read of
// a state value (e.g. legacy stateBlk) lands on the same Go type as a
// v1-prefixed read.
//
// All registrations must succeed atomically: if the v0 registration
// fails (e.g. duplicate type) the v1 registration is still attempted so
// the underlying error is surfaced rather than silently leaving the
// codecs in a divergent state.
// RegisterGenesisType registers a type with the GenesisCodec.
// This is used by other packages (e.g. state) to register types that are
// only ever encountered in genesis bytes.
func RegisterGenesisType(val interface{}) error {
v0Err := genesisLinearCodecV0.RegisterType(val)
v1Err := genesisLinearCodec.RegisterType(val)
return errors.Join(v0Err, v1Err)
return genesisLinearCodec.RegisterType(val)
}
// RegisterBlockTypes registers the canonical v1 block type IDs. There
// is exactly one type per block kind: ProposalBlock, AbortBlock,
// CommitBlock, StandardBlock. Tx types come from txs.RegisterTypes
// (which registers the v1 tx slot layout).
// RegisterBlockTypes registers the canonical block type IDs. There is exactly
// one type per block kind: StandardBlock, ProposalBlock, CommitBlock,
// AbortBlock. Tx types come from txs.RegisterTypes.
func RegisterBlockTypes(targetCodec linearcodec.Codec) error {
return errors.Join(
txs.RegisterTypes(targetCodec),
@@ -1,164 +0,0 @@
// Copyright (C) 2019-2026, Lux Industries Inc. All rights reserved.
// See the file LICENSE for licensing terms.
package block
import (
"bytes"
"encoding/binary"
"testing"
"github.com/stretchr/testify/require"
"github.com/luxfi/codec"
"github.com/luxfi/node/vms/components/gas"
"github.com/luxfi/node/vms/platformvm/txs"
)
// TestGenesisCodecAcceptsV0FeeState is the regression guard for the
// v1.28.1 testnet-canary failure:
//
// P-Chain state corrupt after init — database must be wiped
// error="loadMetadata: feeState: unknown codec version"
//
// Pre-fix, block.GenesisCodec registered ONLY the v1 slot map. A
// testnet bootstrapped at v1.23.x had written feeState bytes with the
// v0 prefix (0x0000); v1.28.0+ called block.GenesisCodec.Unmarshal on
// those bytes, codec.Manager looked up version 0 in its map, missed,
// and returned codec.ErrUnknownVersion — surfacing as the
// "unknown codec version" error at loadMetadata: feeState.
//
// Post-fix, block.GenesisCodec is multi-version (v0 read-only + v1
// read+write). The 2-byte wire prefix selects the slot map; the
// gas.State struct is byte-equal across versions (no slot dispatch
// inside it), so v0 bytes decode into the same Go value.
func TestGenesisCodecAcceptsV0FeeState(t *testing.T) {
require := require.New(t)
original := gas.State{
Capacity: gas.Gas(1_000_000),
Excess: gas.Gas(424242),
}
v0Bytes, err := GenesisCodec.Marshal(CodecVersionV0, original)
require.NoError(err, "v0 marshal must succeed — proves the v0 slot map is registered on block.GenesisCodec")
require.GreaterOrEqual(len(v0Bytes), 2)
require.Equal(uint16(CodecVersionV0), binary.BigEndian.Uint16(v0Bytes[:2]),
"marshaled bytes must carry the v0 wire prefix")
// The bug: this Unmarshal used to fail with codec.ErrUnknownVersion.
var decoded gas.State
version, err := GenesisCodec.Unmarshal(v0Bytes, &decoded)
require.NoError(err, "v0-prefixed feeState must decode via the multi-version GenesisCodec")
require.Equal(uint16(CodecVersionV0), version)
require.Equal(original, decoded)
}
// TestGenesisCodecAcceptsV1FeeState is the no-regression guard for the
// canonical write path: every feeState written by this binary carries
// the v1 wire prefix and must continue to round-trip.
func TestGenesisCodecAcceptsV1FeeState(t *testing.T) {
require := require.New(t)
original := gas.State{
Capacity: gas.Gas(2_500_000),
Excess: gas.Gas(7777),
}
v1Bytes, err := GenesisCodec.Marshal(CodecVersion, original)
require.NoError(err)
require.Equal(uint16(CodecVersionV1), binary.BigEndian.Uint16(v1Bytes[:2]),
"canonical write path must emit v1 prefix")
var decoded gas.State
version, err := GenesisCodec.Unmarshal(v1Bytes, &decoded)
require.NoError(err)
require.Equal(uint16(CodecVersionV1), version)
require.Equal(original, decoded)
}
// TestGenesisCodecRejectsUnknownVersion locks in that the multi-version
// extension did NOT silently open the door to bogus prefixes. Only v0
// and v1 are registered on GenesisCodec; anything else must surface as
// codec.ErrUnknownVersion.
func TestGenesisCodecRejectsUnknownVersion(t *testing.T) {
require := require.New(t)
bogus := make([]byte, 16)
binary.BigEndian.PutUint16(bogus[:2], 0xFFFE)
var sink gas.State
_, err := GenesisCodec.Unmarshal(bogus, &sink)
require.ErrorIs(err, codec.ErrUnknownVersion)
}
// TestGenesisCodecV0RoundtripIsBytePreserving documents the byte-
// preserving guarantee for state values read at v0 and re-marshaled at
// v0 (e.g. for a migration/extraction tool). Linearcodec is
// deterministic — output must be byte-equal to input.
func TestGenesisCodecV0RoundtripIsBytePreserving(t *testing.T) {
require := require.New(t)
original := gas.State{
Capacity: gas.Gas(123),
Excess: gas.Gas(456),
}
v0Bytes, err := GenesisCodec.Marshal(CodecVersionV0, original)
require.NoError(err)
var decoded gas.State
_, err = GenesisCodec.Unmarshal(v0Bytes, &decoded)
require.NoError(err)
roundtripBytes, err := GenesisCodec.Marshal(CodecVersionV0, decoded)
require.NoError(err)
require.True(bytes.Equal(v0Bytes, roundtripBytes),
"v0 marshal -> unmarshal -> re-marshal must be byte-preserving (len in=%d, out=%d)",
len(v0Bytes), len(roundtripBytes))
}
// TestGenesisCodecCarriesBothVersions is a structural invariant test
// that prevents accidental regressions of the multi-version property.
// Future patches that add a new state-side type or refactor the codec
// init order will trip this if they drop either version slot.
func TestGenesisCodecCarriesBothVersions(t *testing.T) {
require := require.New(t)
// Marshal a value at each version. If either codec is missing,
// codec.Manager.Marshal returns ErrUnknownVersion.
for _, version := range []uint16{CodecVersionV0, CodecVersionV1} {
_, err := GenesisCodec.Marshal(version, gas.State{Capacity: 1, Excess: 2})
require.NoErrorf(err, "GenesisCodec must register version %d", version)
}
}
// TestGenesisCodecV0RegisteredTypesMatchTxsV0 asserts the v0 type slot
// map registered on block.GenesisCodec is the same shape as the one on
// txs.GenesisCodec. They share the registerV0TxTypes layout so that
// state values containing fx.Owner / signer.* / secp256k1fx.* types
// decode by the same slot IDs whether they were written via
// txs.GenesisCodec.Marshal or block.GenesisCodec.Marshal at v0.
//
// We cannot directly compare slot-ID maps (linearcodec doesn't expose
// them), so we cross-check by marshaling an interface-carrying value
// at v0 through both codecs and asserting byte-equality.
func TestGenesisCodecV0RegisteredTypesMatchTxsV0(t *testing.T) {
require := require.New(t)
// Use a simple wrapper that exercises slot dispatch on a known v0
// type. AdvanceTimeTx is registered at the same slot (20 in v1, 20
// in v0) on both codecs.
tx := &txs.AdvanceTimeTx{Time: 1234567890}
blockBytes, err := GenesisCodec.Marshal(CodecVersionV0, &tx)
require.NoError(err)
txsBytes, err := txs.GenesisCodec.Marshal(CodecVersionV0, &tx)
require.NoError(err)
require.True(bytes.Equal(blockBytes, txsBytes),
"block.GenesisCodec and txs.GenesisCodec must produce byte-equal v0 encodings (block=%d txs=%d)",
len(blockBytes), len(txsBytes))
}
-214
View File
@@ -1,214 +0,0 @@
// Copyright (C) 2019-2026, Lux Industries Inc. All rights reserved.
// See the file LICENSE for licensing terms.
package block
import (
"errors"
"fmt"
"time"
hash "github.com/luxfi/crypto/hash"
"github.com/luxfi/ids"
"github.com/luxfi/runtime"
"github.com/luxfi/node/vms/platformvm/block/v0"
"github.com/luxfi/node/vms/platformvm/txs"
)
// errLegacyAtomicBlock is returned when v0 decoding produces an
// ApricotAtomicBlock. The modern P-only network does not accept atomic
// blocks; any pre-Banff atomic block on disk must be handled by the
// caller (typically by skipping the entry — atomic block IDs are not
// reachable from the canonical Banff-era last-accepted chain).
var errLegacyAtomicBlock = errors.New("apricot atomic block is not supported on the P-only network")
// liftV0 wraps a v0-decoded block in an adapter that implements
// block.Block and dispatches Visit to the canonical v1 Visitor.
//
// The lifted block:
// - returns b verbatim from Bytes() (no re-marshal),
// - reports BlockID = hash(b),
// - reports Height/Parent/Txs delegated to the v0 struct,
// - dispatches Visit per the kind table:
// ApricotProposalBlock, BanffProposalBlock -> StandardBlock
// (proposal/commit/abort are dead block kinds on the P-only
// network — modern blocks are all StandardBlock with proposal
// txs inlined as decision txs; on the historical decode path
// we surface them via the StandardBlock visitor so the
// executor's StandardBlock arm runs the embedded txs without
// requiring a separate Apricot/Banff visitor surface),
// ApricotStandardBlock, BanffStandardBlock -> StandardBlock,
// ApricotAbortBlock, BanffAbortBlock -> AbortBlock,
// ApricotCommitBlock, BanffCommitBlock -> CommitBlock.
// - re-initializes each embedded tx via tx.InitializeFromBytes
// against the v0 tx codec, byte-preserving inner TxIDs.
//
// initVisit selects the v1 Visitor arm. The lifting table is the
// migration's only place where a v0 block kind maps to a v1 kind; once
// every block on disk is v1, this file becomes dead code and can be
// removed.
func liftV0(b v0.Block, raw []byte) (Block, error) {
switch v := b.(type) {
case *v0.ApricotAtomicBlock:
_ = v
return nil, errLegacyAtomicBlock
}
blkID := hash.ComputeHash256Array(raw)
lifted := &liftedV0Block{
blockID: blkID,
raw: raw,
v0: b,
parentID: b.ParentID(),
height: b.Height(),
timeUnix: b.TimestampUnix(),
txs: b.Txs(),
}
if err := lifted.initTxs(); err != nil {
return nil, fmt.Errorf("v0 lift: %w", err)
}
return lifted, nil
}
// liftedV0Block is the block.Block adapter around a v0-decoded block.
// It does not embed CommonBlock — the canonical CommonBlock owns its
// own bytes via SetBytes, which would re-derive BlockID from a
// marshalled v1 layout. The lifted block instead computes BlockID once
// at construction time from the original v0 bytes and stashes them.
type liftedV0Block struct {
blockID ids.ID
raw []byte
v0 v0.Block
parentID ids.ID
height uint64
timeUnix uint64
txs []*txs.Tx
}
func (b *liftedV0Block) ID() ids.ID { return b.blockID }
func (b *liftedV0Block) Parent() ids.ID { return b.parentID }
func (b *liftedV0Block) Bytes() []byte { return b.raw }
func (b *liftedV0Block) Height() uint64 { return b.height }
func (b *liftedV0Block) Txs() []*txs.Tx { return b.txs }
func (b *liftedV0Block) Timestamp() time.Time { return time.Unix(int64(b.timeUnix), 0) }
func (b *liftedV0Block) initialize(_ []byte) error {
// liftedV0Block has its identity (BlockID, raw bytes) committed at
// liftV0 construction time from the original input bytes. The
// argument here is the v1-marshalled bytes that block.Parse would
// derive for a v1 block; for a v0 block we ignore it and keep raw.
return nil
}
func (b *liftedV0Block) InitRuntime(rt *runtime.Runtime) {
for _, tx := range b.txs {
if tx == nil {
continue
}
tx.Unsigned.InitRuntime(rt)
}
}
// initTxs runs InitializeFromBytes on every embedded tx using the v0
// tx codec. The signed bytes the codec recorded during Unmarshal are
// what we need; we recover them by re-marshalling the unsigned half
// under v0 and slicing into the parent block's input bytes is not
// safe (the parent block bytes interleave block-header fields). The
// linearcodec leaves the unsigned/credentials split implicit in the
// stream offset, so the cleanest byte-preserving handle we have is to
// ask the v0 tx codec to Size(version, &tx.Unsigned) and then take
// the prefix from the tx's own bytes — but those bytes have not been
// set yet by linearcodec, only the struct fields.
//
// We therefore re-marshal each tx under the v0 codec to recover its
// signedBytes. The wire format is deterministic and the resulting
// bytes are byte-equal to whatever the v0 producer emitted; the
// re-marshal is a closed loop over the v0 layout the tx was decoded
// from. TxID = hash(re-marshalled v0 bytes) = TxID the chain
// originally committed.
//
// This single re-marshal is allowed only here, only against the v0
// codec, and only for txs whose Unsigned was decoded under v0. Under
// the v1 path, txs are byte-preserved via tx.Parse without any
// re-marshal.
func (b *liftedV0Block) initTxs() error {
for _, tx := range b.txs {
if tx == nil {
continue
}
if err := tx.InitializeFromBytesAtVersion(txs.GenesisCodec, txs.CodecVersionV0); err != nil {
return fmt.Errorf("byte-preserve v0 tx: %w", err)
}
}
return nil
}
func (b *liftedV0Block) Visit(v Visitor) error {
switch b.v0.(type) {
case *v0.ApricotAbortBlock, *v0.BanffAbortBlock:
return v.AbortBlock(b.asAbortBlock())
case *v0.ApricotCommitBlock, *v0.BanffCommitBlock:
return v.CommitBlock(b.asCommitBlock())
case *v0.ApricotProposalBlock, *v0.BanffProposalBlock:
return v.ProposalBlock(b.asProposalBlock())
case *v0.ApricotStandardBlock, *v0.BanffStandardBlock:
return v.StandardBlock(b.asStandardBlock())
default:
return fmt.Errorf("v0 lift: unhandled block kind %T", b.v0)
}
}
// asStandardBlock builds a *StandardBlock that mirrors the lifted v0
// block. The returned block uses the SAME raw bytes (so its BlockID
// matches b.blockID) and the SAME Txs slice (so the executor sees the
// same set of txs). This is the synthetic v1 view of a v0 block.
func (b *liftedV0Block) asStandardBlock() *StandardBlock {
return &StandardBlock{
Time: b.timeUnix,
CommonBlock: b.commonBlock(),
Transactions: b.txs,
}
}
func (b *liftedV0Block) asProposalBlock() *ProposalBlock {
// Modern ProposalBlock has Tx + Transactions tail. The lifted v0
// block's Txs() already returns the canonical ordering for both
// Apricot (single proposal Tx) and Banff (decision tail + proposal
// Tx). We split off the trailing element as the proposal tx.
tail := b.txs
if len(tail) == 0 {
return &ProposalBlock{
Time: b.timeUnix,
CommonBlock: b.commonBlock(),
}
}
last := tail[len(tail)-1]
return &ProposalBlock{
Time: b.timeUnix,
Transactions: tail[:len(tail)-1],
CommonBlock: b.commonBlock(),
Tx: last,
}
}
func (b *liftedV0Block) asAbortBlock() *AbortBlock {
return &AbortBlock{Time: b.timeUnix, CommonBlock: b.commonBlock()}
}
func (b *liftedV0Block) asCommitBlock() *CommitBlock {
return &CommitBlock{Time: b.timeUnix, CommonBlock: b.commonBlock()}
}
// commonBlock builds a CommonBlock whose BlockID + bytes are the
// lifted block's raw bytes / hash. This is the only place we copy the
// raw bytes into a v1-typed block, and it is read-only — the caller
// uses the synthetic block's visitor methods, never re-marshals it.
func (b *liftedV0Block) commonBlock() CommonBlock {
return CommonBlock{
PrntID: b.parentID,
Hght: b.height,
BlockID: b.blockID,
bytes: b.raw,
}
}
-127
View File
@@ -1,127 +0,0 @@
// Copyright (C) 2019-2026, Lux Industries Inc. All rights reserved.
// See the file LICENSE for licensing terms.
package block
import (
"bytes"
"testing"
"github.com/stretchr/testify/require"
hash "github.com/luxfi/crypto/hash"
"github.com/luxfi/node/vms/platformvm/block/v0"
"github.com/luxfi/node/vms/platformvm/txs"
)
// TestParseV0ApricotProposalBlock asserts that a hand-encoded
// ApricotProposalBlock (slot 0 in v0) decodes via Parse and is lifted
// into a *ProposalBlock with the original bytes preserved.
//
// The Apricot proposal flow on the modern P-only network is replayed
// through the canonical Visitor.ProposalBlock arm. The fixture here
// is constructed by re-marshalling a synthetic ApricotProposalBlock
// at v0 — this is a closed-loop test of the v0 codec's encode + decode
// path; on mainnet the bytes come from disk, not from re-encoding.
func TestParseV0ApricotProposalBlock(t *testing.T) {
require := require.New(t)
// Build a synthetic v0 ApricotProposalBlock carrying an
// AdvanceTimeTx proposal — the simplest decision form pre-Banff.
proposalTx := &txs.Tx{Unsigned: &txs.AdvanceTimeTx{Time: 1_700_000_000}}
require.NoError(proposalTx.InitializeFromBytesAtVersion(txs.GenesisCodec, txs.CodecVersionV0))
v0Blk := &v0.ApricotProposalBlock{
CommonBlock: v0.CommonBlock{Hght: 7},
Tx: proposalTx,
}
raw, err := v0GenesisCodec.Marshal(CodecVersionV0, &([]v0.Block{v0Blk})[0])
require.NoError(err, "v0 marshal of ApricotProposalBlock")
// Parse via the version-aware block.Parse path.
parsed, err := Parse(GenesisCodec, raw)
require.NoError(err, "parse v0 ApricotProposalBlock")
// The lifted block reports the canonical fields.
require.Equal(uint64(7), parsed.Height())
require.True(bytes.Equal(raw, parsed.Bytes()),
"lifted v0 block must return original bytes verbatim")
require.Equal(hash.ComputeHash256Array(raw), [32]byte(parsed.ID()),
"lifted v0 block ID = hash(raw v0 bytes)")
require.Len(parsed.Txs(), 1, "ApricotProposalBlock carries exactly one tx")
require.Equal(proposalTx.TxID, parsed.Txs()[0].TxID,
"embedded tx TxID byte-preserved")
}
// TestParseV0BanffStandardBlock asserts that a hand-encoded
// BanffStandardBlock (slot 32 in v0) decodes via Parse and lifts to
// a *StandardBlock that carries the original timestamp.
func TestParseV0BanffStandardBlock(t *testing.T) {
require := require.New(t)
decisionTx := &txs.Tx{Unsigned: &txs.AdvanceTimeTx{Time: 1_700_000_000}}
require.NoError(decisionTx.InitializeFromBytesAtVersion(txs.GenesisCodec, txs.CodecVersionV0))
v0Blk := &v0.BanffStandardBlock{
Time: 1_700_000_100,
ApricotStandardBlock: v0.ApricotStandardBlock{
CommonBlock: v0.CommonBlock{Hght: 42},
Transactions: []*txs.Tx{decisionTx},
},
}
raw, err := v0GenesisCodec.Marshal(CodecVersionV0, &([]v0.Block{v0Blk})[0])
require.NoError(err)
parsed, err := Parse(GenesisCodec, raw)
require.NoError(err)
require.Equal(uint64(42), parsed.Height())
require.True(bytes.Equal(raw, parsed.Bytes()))
require.Equal(hash.ComputeHash256Array(raw), [32]byte(parsed.ID()))
require.Len(parsed.Txs(), 1)
}
// TestParseV1RoundTrip asserts that the canonical v1 path is
// byte-preserving the same way: a v1 block decoded via Parse keeps
// its original bytes and its BlockID = hash(raw).
func TestParseV1RoundTrip(t *testing.T) {
require := require.New(t)
tx := &txs.Tx{Unsigned: &txs.AdvanceTimeTx{Time: 1_700_000_000}}
require.NoError(tx.InitializeFromBytesAtVersion(txs.GenesisCodec, txs.CodecVersionV1))
blk := &StandardBlock{
Time: 1_700_000_100,
CommonBlock: CommonBlock{Hght: 5},
Transactions: []*txs.Tx{tx},
}
// Use the canonical block-build path (initialize sets bytes
// from a Marshal).
require.NoError(initialize(blk, &blk.CommonBlock))
raw := blk.Bytes()
parsed, err := Parse(GenesisCodec, raw)
require.NoError(err)
require.Equal(uint64(5), parsed.Height())
require.True(bytes.Equal(raw, parsed.Bytes()))
require.Equal(blk.ID(), parsed.ID(), "BlockID stable across Parse")
}
// TestVersionPrefixDispatch asserts that Parse dispatches by the
// 2-byte wire prefix and rejects unknown versions.
func TestVersionPrefixDispatch(t *testing.T) {
require := require.New(t)
// Empty / too-short input.
_, err := Parse(GenesisCodec, []byte{})
require.ErrorIs(err, ErrShortBytes)
_, err = Parse(GenesisCodec, []byte{0x00})
require.ErrorIs(err, ErrShortBytes)
// Unknown version (v2+).
_, err = Parse(GenesisCodec, []byte{0x00, 0x02, 0x00})
require.Error(err, "unknown version must error")
}
+2 -85
View File
@@ -1,97 +1,14 @@
// Copyright (C) 2019-2026, Lux Industries Inc. All rights reserved.
// Copyright (C) 2019-2025, Lux Industries Inc. All rights reserved.
// See the file LICENSE for licensing terms.
package block
import (
"errors"
"fmt"
import "github.com/luxfi/codec"
"github.com/luxfi/codec"
"github.com/luxfi/node/vms/platformvm/block/v0"
)
// ErrShortBytes is returned when the input is shorter than the 2-byte
// codec-version prefix.
var ErrShortBytes = errors.New("block bytes too short for codec version prefix")
// Parse decodes a block byte stream produced by either the v0
// (v1.23.x) or v1 (current) block codec. The codec.Manager argument
// selects the SIZE class — Codec (1 MiB max) or GenesisCodec
// (unbounded). The actual VERSION is taken from the 2-byte wire prefix
// and dispatched to the matching slot map.
//
// Parse never re-marshals the input; BlockID = hash(b) verbatim and
// b is stashed on the returned block's CommonBlock. This is the
// byte-preserving path that keeps BlockIDs (and inner TxIDs) stable
// across the v0->v1 migration.
//
// c must be one of block.Codec or block.GenesisCodec. The v0 codec is
// selected internally based on the size class of c. Other codecs are
// rejected with codec.ErrUnknownVersion.
func Parse(c codec.Manager, b []byte) (Block, error) {
if len(b) < 2 {
return nil, ErrShortBytes
}
version := uint16(b[0])<<8 | uint16(b[1])
switch version {
case CodecVersionV1:
return parseV1(c, b)
case CodecVersionV0:
return parseV0(c, b)
default:
return nil, fmt.Errorf("%w: %d", codec.ErrUnknownVersion, version)
}
}
// parseV1 is the canonical block-decode path. Bytes are unmarshalled
// against the v1 slot map and the resulting Block keeps b as its
// authoritative bytes.
func parseV1(c codec.Manager, b []byte) (Block, error) {
var blk Block
if _, err := c.Unmarshal(b, &blk); err != nil {
return nil, err
}
return blk, blk.initialize(b)
}
// parseV0 decodes a v1.23.x ("Apricot/Banff") block. The v0 slot map
// is closed; the result is a v0-typed block (one of v0.ApricotXxx /
// v0.BanffXxx) that is wrapped in an adapter implementing block.Block.
//
// The adapter:
// - reports the original bytes verbatim (Bytes() returns b),
// - computes BlockID = hash(b),
// - translates Visit calls to the canonical v1 visitor
// (ApricotProposalBlock/BanffProposalBlock -> Visitor.ProposalBlock,
// ApricotStandardBlock/BanffStandardBlock -> Visitor.StandardBlock,
// etc.),
// - re-initializes embedded txs using their byte-preserving
// InitializeFromBytes path against the v0 tx codec, so inner TxIDs
// remain hash(originalTxBytes) under the v0 layout.
//
// ApricotAtomicBlock is decoded but rejected at the block boundary: the
// modern P-only network does not accept new atomic blocks, and any
// pre-Banff atomic block left on disk should have been replaced by the
// Banff history. We return an explicit error so the caller can decide
// whether to surface it as DB corruption or as a soft skip.
func parseV0(c codec.Manager, b []byte) (Block, error) {
v0c := v0CodecFor(c)
var v0blk v0.Block
if _, err := v0c.Unmarshal(b, &v0blk); err != nil {
return nil, err
}
return liftV0(v0blk, b)
}
// v0CodecFor returns the v0 codec.Manager that matches the size class
// of c. We mirror the size class so that a GenesisCodec caller (large
// max size) gets the v0GenesisCodec (also large) rather than v0Codec
// (1 MiB).
func v0CodecFor(c codec.Manager) codec.Manager {
if c == GenesisCodec {
return v0GenesisCodec
}
return v0Codec
}
+4 -4
View File
@@ -29,12 +29,12 @@ func (b *ProposalBlock) Timestamp() time.Time { return time.Unix(int64(b.Time),
func (b *ProposalBlock) initialize(bytes []byte) error {
b.CommonBlock.initialize(bytes)
if err := b.Tx.InitializeFromBytesAtVersion(txs.Codec, txs.CodecVersionV1); err != nil {
return fmt.Errorf("failed to initialize proposal tx: %w", err)
if err := b.Tx.Initialize(txs.Codec); err != nil {
return fmt.Errorf("failed to initialize tx: %w", err)
}
for _, tx := range b.Transactions {
if err := tx.InitializeFromBytesAtVersion(txs.Codec, txs.CodecVersionV1); err != nil {
return fmt.Errorf("failed to initialize decision tx: %w", err)
if err := tx.Initialize(txs.Codec); err != nil {
return fmt.Errorf("failed to initialize tx: %w", err)
}
}
return nil
+1 -5
View File
@@ -29,11 +29,7 @@ func (b *StandardBlock) Timestamp() time.Time { return time.Unix(int64(b.Time),
func (b *StandardBlock) initialize(bytes []byte) error {
b.CommonBlock.initialize(bytes)
for _, tx := range b.Transactions {
// Byte-preserving: re-derive signedBytes by re-marshalling at
// the canonical write version (v1). This is the v1 read path
// — v0 reads go through block.parseV0 + liftedV0Block, which
// rebinds via InitializeFromBytesAtVersion(v0).
if err := tx.InitializeFromBytesAtVersion(txs.Codec, txs.CodecVersionV1); err != nil {
if err := tx.Initialize(txs.Codec); err != nil {
return fmt.Errorf("failed to initialize tx: %w", err)
}
}
-204
View File
@@ -1,204 +0,0 @@
// Copyright (C) 2019-2026, Lux Industries Inc. All rights reserved.
// See the file LICENSE for licensing terms.
// Package v0 defines the v1.23.x ("Apricot/Banff") P-Chain block layout.
//
// These types EXIST ONLY FOR DECODING pre-codec-v1 blocks read from disk
// (mainnet, testnet) and from the wire during catch-up. New blocks are
// always written at codec version 1 using the canonical block types in
// the parent block package.
//
// Invariants:
// - Wire layout is byte-for-byte identical to v1.23.31's
// vms/platformvm/block package (slot IDs, struct layout).
// - Each v0 block satisfies block.Block by translating its Visit call
// to the canonical v1 visitor method (ApricotProposalBlock ->
// StandardBlock at proposal-tail position, etc.).
// - Block bytes are byte-preserved (BlockID = hash(input bytes); the
// input bytes are stashed on CommonBlock and returned verbatim by
// Bytes()). The block is never re-marshaled.
// - Embedded txs are byte-preserved via tx.InitializeFromBytes using
// the codec version their bytes were decoded under.
package v0
import (
"github.com/luxfi/codec/linearcodec"
"github.com/luxfi/codec/wrappers"
"github.com/luxfi/node/vms/platformvm/stakeable"
"github.com/luxfi/node/vms/platformvm/signer"
"github.com/luxfi/node/vms/platformvm/txs"
"github.com/luxfi/utxo/secp256k1fx"
)
// CodecVersion is the wire-version prefix for the v1.23.x layout.
const CodecVersion uint16 = 0
// RegisterBlockTypes registers the v0 block + tx type IDs in their
// canonical v1.23.x order on the given linearcodec.
//
// Slot map (block codec):
//
// 0-4 Apricot blocks (Proposal, Abort, Commit, Standard, Atomic)
// 5 secp256k1fx.TransferInput
// 6 [skipped — was MintOutput, never used on P-Chain]
// 7 secp256k1fx.TransferOutput
// 8 [skipped — was MintOperation, never used on P-Chain]
// 9-11 secp256k1fx.{Credential, Input, OutputOwners}
// 12-20 Apricot txs (AddValidator..RewardValidator)
// 21-22 stakeable.{LockIn, LockOut}
// 23-26 Banff txs (RemoveChainValidator..AddPermissionlessDelegator)
// 27-28 signer.{Empty, ProofOfPossession}
// 29-32 Banff blocks (Proposal, Abort, Commit, Standard)
// 33-34 Durango txs (TransferChainOwnership, BaseTx)
// 35-39 Etna txs (ConvertChainToL1..DisableL1Validator)
//
// ConvertChainToL1Tx is registered as the wire-format-equivalent
// ConvertNetworkToL1Tx (post-rename source type, identical struct
// layout, same slot 35). Codec wire matching is by slot ID, not type
// name; the rename did not change the serialized format.
func RegisterBlockTypes(c linearcodec.Codec) error {
errs := wrappers.Errs{}
// Slots 0-4: Apricot blocks.
errs.Add(
c.RegisterType(&ApricotProposalBlock{}),
c.RegisterType(&ApricotAbortBlock{}),
c.RegisterType(&ApricotCommitBlock{}),
c.RegisterType(&ApricotStandardBlock{}),
c.RegisterType(&ApricotAtomicBlock{}),
)
// Slots 5-11: secp256k1fx with two historical skips at 6 and 8.
errs.Add(c.RegisterType(&secp256k1fx.TransferInput{}))
c.SkipRegistrations(1)
errs.Add(c.RegisterType(&secp256k1fx.TransferOutput{}))
c.SkipRegistrations(1)
errs.Add(
c.RegisterType(&secp256k1fx.Credential{}),
c.RegisterType(&secp256k1fx.Input{}),
c.RegisterType(&secp256k1fx.OutputOwners{}),
)
// Slots 12-20: Apricot txs.
errs.Add(
c.RegisterType(&txs.AddValidatorTx{}),
c.RegisterType(&txs.AddChainValidatorTx{}),
c.RegisterType(&txs.AddDelegatorTx{}),
c.RegisterType(&txs.CreateNetworkTx{}),
c.RegisterType(&txs.CreateChainTx{}),
c.RegisterType(&txs.ImportTx{}),
c.RegisterType(&txs.ExportTx{}),
c.RegisterType(&txs.AdvanceTimeTx{}),
c.RegisterType(&txs.RewardValidatorTx{}),
)
// Slots 21-22: stakeable locks.
errs.Add(
c.RegisterType(&stakeable.LockIn{}),
c.RegisterType(&stakeable.LockOut{}),
)
// Slots 23-26: Banff txs.
errs.Add(
c.RegisterType(&txs.RemoveChainValidatorTx{}),
c.RegisterType(&txs.TransformChainTx{}),
c.RegisterType(&txs.AddPermissionlessValidatorTx{}),
c.RegisterType(&txs.AddPermissionlessDelegatorTx{}),
)
// Slots 27-28: signer types.
errs.Add(
c.RegisterType(&signer.Empty{}),
c.RegisterType(&signer.ProofOfPossession{}),
)
// Slots 29-32: Banff blocks.
errs.Add(
c.RegisterType(&BanffProposalBlock{}),
c.RegisterType(&BanffAbortBlock{}),
c.RegisterType(&BanffCommitBlock{}),
c.RegisterType(&BanffStandardBlock{}),
)
// Slots 33-34: Durango txs.
errs.Add(
c.RegisterType(&txs.TransferChainOwnershipTx{}),
c.RegisterType(&txs.BaseTx{}),
)
// Slots 35-39: Etna txs.
// Slot 35 was ConvertChainToL1Tx in v0 source; renamed to
// ConvertNetworkToL1Tx in v1.27.x with identical wire layout.
errs.Add(
c.RegisterType(&txs.ConvertNetworkToL1Tx{}),
c.RegisterType(&txs.RegisterL1ValidatorTx{}),
c.RegisterType(&txs.SetL1ValidatorWeightTx{}),
c.RegisterType(&txs.IncreaseL1ValidatorBalanceTx{}),
c.RegisterType(&txs.DisableL1ValidatorTx{}),
)
return errs.Err
}
// RegisterTxTypes registers the v0 type IDs in the tx-only ordering
// used by v1.23.x txs.init(). Apricot block slots (0-4) and Banff block
// slots (29-32) are SkipRegistrations rather than RegisterType so that
// shared tx slots line up with the block codec.
func RegisterTxTypes(c linearcodec.Codec) error {
errs := wrappers.Errs{}
// Slots 0-4: Apricot block slots reserved.
c.SkipRegistrations(5)
// Slots 5-11: secp256k1fx (with two historical skips at 6 and 8).
errs.Add(c.RegisterType(&secp256k1fx.TransferInput{}))
c.SkipRegistrations(1)
errs.Add(c.RegisterType(&secp256k1fx.TransferOutput{}))
c.SkipRegistrations(1)
errs.Add(
c.RegisterType(&secp256k1fx.Credential{}),
c.RegisterType(&secp256k1fx.Input{}),
c.RegisterType(&secp256k1fx.OutputOwners{}),
)
// Slots 12-22: Apricot txs + stakeable locks.
errs.Add(
c.RegisterType(&txs.AddValidatorTx{}),
c.RegisterType(&txs.AddChainValidatorTx{}),
c.RegisterType(&txs.AddDelegatorTx{}),
c.RegisterType(&txs.CreateNetworkTx{}),
c.RegisterType(&txs.CreateChainTx{}),
c.RegisterType(&txs.ImportTx{}),
c.RegisterType(&txs.ExportTx{}),
c.RegisterType(&txs.AdvanceTimeTx{}),
c.RegisterType(&txs.RewardValidatorTx{}),
c.RegisterType(&stakeable.LockIn{}),
c.RegisterType(&stakeable.LockOut{}),
)
// Slots 23-28: Banff txs + signer.
errs.Add(
c.RegisterType(&txs.RemoveChainValidatorTx{}),
c.RegisterType(&txs.TransformChainTx{}),
c.RegisterType(&txs.AddPermissionlessValidatorTx{}),
c.RegisterType(&txs.AddPermissionlessDelegatorTx{}),
c.RegisterType(&signer.Empty{}),
c.RegisterType(&signer.ProofOfPossession{}),
)
// Slots 29-32: Banff block slots reserved.
c.SkipRegistrations(4)
// Slots 33-39: Durango + Etna.
errs.Add(
c.RegisterType(&txs.TransferChainOwnershipTx{}),
c.RegisterType(&txs.BaseTx{}),
c.RegisterType(&txs.ConvertNetworkToL1Tx{}),
c.RegisterType(&txs.RegisterL1ValidatorTx{}),
c.RegisterType(&txs.SetL1ValidatorWeightTx{}),
c.RegisterType(&txs.IncreaseL1ValidatorBalanceTx{}),
c.RegisterType(&txs.DisableL1ValidatorTx{}),
)
return errs.Err
}
-142
View File
@@ -1,142 +0,0 @@
// Copyright (C) 2019-2026, Lux Industries Inc. All rights reserved.
// See the file LICENSE for licensing terms.
package v0
import (
"github.com/luxfi/ids"
"github.com/luxfi/node/vms/platformvm/txs"
)
// Block is the v0-decoder-side counterpart of block.Block. It is
// satisfied by every concrete v0 block kind so that the v0 codec can
// dispatch on an interface destination at unmarshal time. The parent
// block package wraps the returned v0.Block in an adapter that
// implements block.Block (which in turn dispatches to the canonical v1
// Visitor).
type Block interface {
// ParentID is the BlockID of the parent block.
ParentID() ids.ID
// Height is the block height. Genesis is at height 0.
Height() uint64
// TimestampUnix returns the block-header timestamp encoded in this
// block (Banff and later). Apricot blocks carry no header timestamp
// and return 0; the parent timestamp is used in their stead by the
// adapter.
TimestampUnix() uint64
// Txs returns the txs carried by this block in their canonical
// order. For ApricotProposalBlock the proposal Tx is the sole
// element; for BanffProposalBlock the proposal Tx is the trailing
// element (matching the v1.23.31 ProposalBlock.Txs() shape).
Txs() []*txs.Tx
}
// CommonBlock holds the parent-id + height fields shared across every
// v0 block kind. Wire layout: PrntID (ids.ID, 32 bytes) followed by
// Hght (uint64, 8 bytes). Byte-equal to v1.23.31 CommonBlock.
type CommonBlock struct {
PrntID ids.ID `serialize:"true" json:"parentID"`
Hght uint64 `serialize:"true" json:"height"`
}
// ApricotProposalBlock decodes slot 0. Carries no header timestamp;
// pre-Banff time advances were carried in AdvanceTimeTx, not in the
// block header.
type ApricotProposalBlock struct {
CommonBlock `serialize:"true"`
Tx *txs.Tx `serialize:"true" json:"tx"`
}
func (b *ApricotProposalBlock) ParentID() ids.ID { return b.PrntID }
func (b *ApricotProposalBlock) Height() uint64 { return b.Hght }
func (*ApricotProposalBlock) TimestampUnix() uint64 { return 0 }
func (b *ApricotProposalBlock) Txs() []*txs.Tx { return []*txs.Tx{b.Tx} }
// ApricotAbortBlock decodes slot 1.
type ApricotAbortBlock struct {
CommonBlock `serialize:"true"`
}
func (b *ApricotAbortBlock) ParentID() ids.ID { return b.PrntID }
func (b *ApricotAbortBlock) Height() uint64 { return b.Hght }
func (*ApricotAbortBlock) TimestampUnix() uint64 { return 0 }
func (*ApricotAbortBlock) Txs() []*txs.Tx { return nil }
// ApricotCommitBlock decodes slot 2.
type ApricotCommitBlock struct {
CommonBlock `serialize:"true"`
}
func (b *ApricotCommitBlock) ParentID() ids.ID { return b.PrntID }
func (b *ApricotCommitBlock) Height() uint64 { return b.Hght }
func (*ApricotCommitBlock) TimestampUnix() uint64 { return 0 }
func (*ApricotCommitBlock) Txs() []*txs.Tx { return nil }
// ApricotStandardBlock decodes slot 3.
type ApricotStandardBlock struct {
CommonBlock `serialize:"true"`
Transactions []*txs.Tx `serialize:"true" json:"txs"`
}
func (b *ApricotStandardBlock) ParentID() ids.ID { return b.PrntID }
func (b *ApricotStandardBlock) Height() uint64 { return b.Hght }
func (*ApricotStandardBlock) TimestampUnix() uint64 { return 0 }
func (b *ApricotStandardBlock) Txs() []*txs.Tx { return b.Transactions }
// ApricotAtomicBlock decodes slot 4. The atomic block flow is dead on
// the modern P-only network — Apricot atomic blocks only ever appear
// pre-Banff in legacy chain history.
type ApricotAtomicBlock struct {
CommonBlock `serialize:"true"`
Tx *txs.Tx `serialize:"true" json:"tx"`
}
func (b *ApricotAtomicBlock) ParentID() ids.ID { return b.PrntID }
func (b *ApricotAtomicBlock) Height() uint64 { return b.Hght }
func (*ApricotAtomicBlock) TimestampUnix() uint64 { return 0 }
func (b *ApricotAtomicBlock) Txs() []*txs.Tx { return []*txs.Tx{b.Tx} }
// BanffProposalBlock decodes slot 29. Carries a Banff-era per-block
// timestamp ahead of the embedded Apricot proposal block (which still
// holds the proposal Tx). The on-wire field order is Time, then
// Transactions (the decision-tx tail), then ApricotProposalBlock.
type BanffProposalBlock struct {
Time uint64 `serialize:"true" json:"time"`
Transactions []*txs.Tx `serialize:"true" json:"txs"`
ApricotProposalBlock `serialize:"true"`
}
func (b *BanffProposalBlock) TimestampUnix() uint64 { return b.Time }
func (b *BanffProposalBlock) Txs() []*txs.Tx {
out := make([]*txs.Tx, len(b.Transactions)+1)
copy(out, b.Transactions)
out[len(b.Transactions)] = b.ApricotProposalBlock.Tx
return out
}
// BanffAbortBlock decodes slot 30.
type BanffAbortBlock struct {
Time uint64 `serialize:"true" json:"time"`
ApricotAbortBlock `serialize:"true"`
}
func (b *BanffAbortBlock) TimestampUnix() uint64 { return b.Time }
// BanffCommitBlock decodes slot 31.
type BanffCommitBlock struct {
Time uint64 `serialize:"true" json:"time"`
ApricotCommitBlock `serialize:"true"`
}
func (b *BanffCommitBlock) TimestampUnix() uint64 { return b.Time }
// BanffStandardBlock decodes slot 32.
type BanffStandardBlock struct {
Time uint64 `serialize:"true" json:"time"`
ApricotStandardBlock `serialize:"true"`
}
func (b *BanffStandardBlock) TimestampUnix() uint64 { return b.Time }
+3 -31
View File
@@ -1,38 +1,10 @@
// Copyright (C) 2019-2026, Lux Industries Inc. All rights reserved.
// Copyright (C) 2019-2025, Lux Industries Inc. All rights reserved.
// See the file LICENSE for licensing terms.
package genesis
import (
"github.com/luxfi/node/vms/platformvm/block"
"github.com/luxfi/node/vms/platformvm/txs"
)
import "github.com/luxfi/node/vms/platformvm/block"
// CodecVersion is the canonical write version for new P-Chain genesis
// blobs. It is shared with the block codec (and txs codec) so a single
// constant bumps the whole stack.
const CodecVersion = block.CodecVersion
// Codec is the multi-version codec.Manager used to (un)marshal P-Chain
// genesis blobs. It is intentionally an alias for txs.GenesisCodec
// rather than block.GenesisCodec because:
//
// - txs.GenesisCodec registers BOTH the v0 (v1.23.x Apricot/Banff)
// and v1 (current) tx slot maps, so it can decode v0-prefixed
// cached-genesis blobs that pre-date the codec bump. block.Genesis
// Codec carries only the v1 slot map and errors on prefix=0 with
// codec.ErrUnknownVersion — exactly the failure mode that broke
// v1.28.0 testnet canary at first-byte parse of
// <data>/genesis.bytes.
// - The outer Genesis struct itself has no slot ID; all version-
// sensitive data lives in the embedded []*txs.Tx (validators,
// chains). Decoding via txs.GenesisCodec is therefore exactly the
// dispatch we need — version is taken from the 2-byte wire prefix
// and routed to the v0 or v1 tx slot map.
// - Marshal at CodecVersion (== v1) is unchanged: the v1 slot map in
// txs.GenesisCodec is byte-for-byte identical to the v1 slot map in
// block.GenesisCodec (both come from registerV1TxTypes).
//
// All write paths (Genesis.Bytes, New, static_service) MUST continue to
// use CodecVersion. v0 is a READ-ONLY decoder.
var Codec = txs.GenesisCodec
var Codec = block.GenesisCodec
+8 -29
View File
@@ -51,39 +51,18 @@ type Genesis struct {
Message string `serialize:"true"`
}
// Parse deserializes a P-Chain genesis blob produced by either the
// v0 (v1.23.x) or v1 (current) codec. Wire version is taken from the
// 2-byte codec prefix; the matching codec.Manager entry is used to
// unmarshal the outer Genesis struct, and embedded validator + chain
// txs are bound to their original signedBytes via InitializeFromBytes
// (NOT Initialize, which would re-marshal and rotate the TxID).
//
// TxID stability across the v0->v1 migration is preserved because:
// - v0 genesis blobs decode via the v0 slot map and embedded txs are
// re-bound at version 0; their hash(signedBytes) is identical to
// what the v1.23.x producer committed.
// - v1 genesis blobs decode via the v1 slot map; embedded txs are
// re-bound at version 1; bytes are deterministic so the result is
// byte-equal to what a v1 producer emits.
//
// Genesis blobs are typically produced fresh from the JSON config at
// each bootstrap (see New + Bytes), so the path that matters for
// mainnet/testnet is the v0 fallback: the originally-committed genesis
// hash is what subsequent block headers chain back to, and that hash
// is hash(v0 genesis bytes).
func Parse(genesisBytes []byte) (*Genesis, error) {
gen := &Genesis{}
version, err := Codec.Unmarshal(genesisBytes, gen)
if err != nil {
if _, err := Codec.Unmarshal(genesisBytes, gen); err != nil {
return nil, err
}
for _, tx := range gen.Validators {
if err := tx.InitializeFromBytesAtVersion(txs.GenesisCodec, version); err != nil {
if err := tx.Initialize(txs.GenesisCodec); err != nil {
return nil, err
}
}
for _, tx := range gen.Chains {
if err := tx.InitializeFromBytesAtVersion(txs.GenesisCodec, version); err != nil {
if err := tx.Initialize(txs.GenesisCodec); err != nil {
return nil, err
}
}
@@ -170,7 +149,7 @@ func bech32ToID(addrStr string) (ids.ShortID, error) {
}
// New builds the genesis state of the P-Chain (and thereby the Lux network.)
// [utxoAssetID] is the ID of the LUX asset
// [xAssetID] is the ID of the LUX asset
// [networkID] is the ID of the network
// [allocations] are the UTXOs on the Platform Chain that exist at genesis.
// [validators] are the validators of the primary network at genesis.
@@ -179,7 +158,7 @@ func bech32ToID(addrStr string) (ids.ShortID, error) {
// [initialSupply] is the initial supply of the LUX asset.
// [message] is the message to be sent to the genesis UTXOs.
func New(
utxoAssetID ids.ID,
xAssetID ids.ID,
networkID uint32,
allocations []Allocation,
validators []PermissionlessValidator,
@@ -204,7 +183,7 @@ func New(
TxID: ids.Empty,
OutputIndex: uint32(i),
},
Asset: lux.Asset{ID: utxoAssetID},
Asset: lux.Asset{ID: xAssetID},
Out: &secp256k1fx.TransferOutput{
Amt: allocation.Amount,
OutputOwners: secp256k1fx.OutputOwners{
@@ -242,7 +221,7 @@ func New(
}
utxo := &lux.TransferableOutput{
Asset: lux.Asset{ID: utxoAssetID},
Asset: lux.Asset{ID: xAssetID},
Out: &secp256k1fx.TransferOutput{
Amt: allocation.Amount,
OutputOwners: secp256k1fx.OutputOwners{
@@ -300,7 +279,7 @@ func New(
stakeAddr := owner.Addrs[0]
stake = []*lux.TransferableOutput{
{
Asset: lux.Asset{ID: utxoAssetID},
Asset: lux.Asset{ID: xAssetID},
Out: &secp256k1fx.TransferOutput{
Amt: weight,
OutputOwners: secp256k1fx.OutputOwners{
+4 -4
View File
@@ -194,14 +194,14 @@ func TestGenesis(t *testing.T) {
require := require.New(t)
genesis := createTestGenesis(t)
utxoAssetID := ids.ID{'d', 'u', 'm', 'm', 'y', ' ', 'I', 'D'}
xAssetID := ids.ID{'d', 'u', 'm', 'm', 'y', ' ', 'I', 'D'}
nodeID := ids.BuildTestNodeID([]byte{1})
require.Equal("Test Genesis", genesis.Message)
// Validate allocations
require.Len(genesis.UTXOs, 1)
utxo := genesis.UTXOs[0]
require.Equal(utxoAssetID, utxo.Asset.ID)
require.Equal(xAssetID, utxo.Asset.ID)
output, ok := utxo.Out.(*secp256k1fx.TransferOutput)
require.True(ok)
require.Equal(uint64(123456789), output.Amt)
@@ -285,9 +285,9 @@ func TestNewReturnsSortedValidators(t *testing.T) {
}},
}
utxoAssetID := ids.ID{'d', 'u', 'm', 'm', 'y', ' ', 'I', 'D'}
xAssetID := ids.ID{'d', 'u', 'm', 'm', 'y', ' ', 'I', 'D'}
genesis, err := New(
utxoAssetID,
xAssetID,
constants.UnitTestID,
[]Allocation{allocation},
[]PermissionlessValidator{
@@ -33,8 +33,8 @@ const (
var (
// Use a fixed test asset ID for X-chain native asset
UTXOAssetID = ids.ID{'l', 'u', 'x', ' ', 'a', 's', 's', 'e', 't', ' ', 'i', 'd'}
XAsset = lux.Asset{ID: UTXOAssetID}
XAssetID = ids.ID{'l', 'u', 'x', ' ', 'a', 's', 's', 'e', 't', ' ', 'i', 'd'}
XAsset = lux.Asset{ID: XAssetID}
DefaultValidatorStartTime = upgrade.InitiallyActiveTime
DefaultValidatorStartTimeUnix = uint64(DefaultValidatorStartTime.Unix())
@@ -102,7 +102,7 @@ func New(t testing.TB, c Config) *platformvmgenesis.Genesis {
for i, key := range c.FundedKeys {
genesis.UTXOs[i] = &platformvmgenesis.UTXO{UTXO: lux.UTXO{
UTXOID: lux.UTXOID{
TxID: UTXOAssetID,
TxID: XAssetID,
OutputIndex: uint32(i),
},
Asset: XAsset,
-131
View File
@@ -1,131 +0,0 @@
// Copyright (C) 2019-2026, Lux Industries Inc. All rights reserved.
// See the file LICENSE for licensing terms.
package genesis
import (
"bytes"
"encoding/binary"
"testing"
"github.com/stretchr/testify/require"
"github.com/luxfi/node/vms/platformvm/txs"
)
// TestParseAcceptsV0CachedGenesis is the regression guard for the
// v1.28.0 testnet-canary failure:
//
// unable to load genesis file: resolve X-Chain asset ID from cached
// genesis: parse platform genesis: unknown codec version
//
// Pre-fix, genesis.Codec aliased block.GenesisCodec which registers
// ONLY the v1 tx slot map. A v0-prefixed cached-genesis blob (carried
// over from v1.23.x bootstraps) errored at the very first byte with
// codec.ErrUnknownVersion.
//
// Post-fix, genesis.Codec aliases txs.GenesisCodec which registers
// BOTH v0 and v1 tx slot maps. The 2-byte wire prefix selects the slot
// map; the outer Genesis struct decodes inline regardless.
func TestParseAcceptsV0CachedGenesis(t *testing.T) {
require := require.New(t)
gen := createTestGenesis(t)
// Build a v0-prefixed blob by Marshaling the same Genesis struct
// at CodecVersionV0. The outer struct has no slot ID; embedded
// *txs.Tx fields serialize their v0 slot IDs because the Marshal
// path resolves slot IDs against the v0 slot map (registered on
// txs.GenesisCodec under CodecVersionV0).
v0Bytes, err := Codec.Marshal(txs.CodecVersionV0, gen)
require.NoError(err, "v0 marshal must succeed — proves the v0 slot map is registered")
require.GreaterOrEqual(len(v0Bytes), 2)
prefix := binary.BigEndian.Uint16(v0Bytes[:2])
require.Equal(txs.CodecVersionV0, prefix, "marshaled bytes must carry the v0 wire prefix")
// The bug: Parse used to fail here with codec.ErrUnknownVersion.
parsed, err := Parse(v0Bytes)
require.NoError(err, "v0-prefixed genesis must round-trip through the multi-version dispatcher")
require.NotNil(parsed)
require.Equal(gen.Timestamp, parsed.Timestamp)
require.Equal(gen.InitialSupply, parsed.InitialSupply)
require.Equal(gen.Message, parsed.Message)
require.Len(parsed.UTXOs, len(gen.UTXOs))
require.Len(parsed.Validators, len(gen.Validators))
require.Len(parsed.Chains, len(gen.Chains))
// Embedded validator txs must have been re-initialized at v0 so
// their (re-marshaled) signed bytes — and therefore their TxIDs —
// match what a v1.23.x producer would have committed at genesis.
require.NotEmpty(parsed.Validators[0].Bytes())
require.NotEqual([32]byte{}, parsed.Validators[0].TxID)
}
// TestParseAcceptsV1Genesis is the no-regression guard for the
// canonical write path: every blob produced by Genesis.Bytes() in this
// binary is v1-prefixed and must still parse byte-for-byte.
func TestParseAcceptsV1Genesis(t *testing.T) {
require := require.New(t)
gen := createTestGenesis(t)
v1Bytes, err := gen.Bytes()
require.NoError(err)
require.GreaterOrEqual(len(v1Bytes), 2)
prefix := binary.BigEndian.Uint16(v1Bytes[:2])
require.Equal(txs.CodecVersionV1, prefix, "Genesis.Bytes must emit the v1 wire prefix")
parsed, err := Parse(v1Bytes)
require.NoError(err)
require.Equal(gen.Timestamp, parsed.Timestamp)
require.Equal(gen.InitialSupply, parsed.InitialSupply)
require.Equal(gen.Message, parsed.Message)
}
// TestParseV0RoundtripIsBytePreserving documents the byte-preserving
// guarantee in genesis.go's Parse doc: v0 -> Parse -> re-marshal-at-v0
// must produce the exact original bytes. This is what keeps the
// originally-committed genesis hash stable across the v0->v1 codec
// migration — the BlockID/genesis-hash a downstream block header
// chains back to is hash(v0 genesis bytes), and that hash MUST NOT
// rotate when this node reads v0 bytes off disk.
func TestParseV0RoundtripIsBytePreserving(t *testing.T) {
require := require.New(t)
gen := createTestGenesis(t)
v0Bytes, err := Codec.Marshal(txs.CodecVersionV0, gen)
require.NoError(err)
parsed, err := Parse(v0Bytes)
require.NoError(err)
// Re-marshal at the SAME version. Linearcodec is deterministic,
// so the output must be byte-equal to the input.
roundtripBytes, err := Codec.Marshal(txs.CodecVersionV0, parsed)
require.NoError(err)
require.True(bytes.Equal(v0Bytes, roundtripBytes),
"v0 -> Parse -> re-marshal must be byte-preserving (len in=%d, out=%d)",
len(v0Bytes), len(roundtripBytes))
}
// TestParseRejectsUnknownVersion locks in that we did not accidentally
// open the door to silent acceptance of bogus prefixes. Only v0 and v1
// are registered on Codec; anything else must surface as an error.
func TestParseRejectsUnknownVersion(t *testing.T) {
require := require.New(t)
// Build a syntactically-valid v1 blob, then mutate the prefix.
gen := createTestGenesis(t)
v1Bytes, err := gen.Bytes()
require.NoError(err)
require.GreaterOrEqual(len(v1Bytes), 2)
bogus := make([]byte, len(v1Bytes))
copy(bogus, v1Bytes)
binary.BigEndian.PutUint16(bogus[:2], 0xFFFE)
_, err = Parse(bogus)
require.Error(err, "Parse must reject codec versions outside {v0, v1}")
}
+6 -6
View File
@@ -244,10 +244,10 @@ utxoFor:
response.Unlockeds = newJSONBalanceMap(unlockeds)
response.LockedStakeables = newJSONBalanceMap(lockedStakeables)
response.LockedNotStakeables = newJSONBalanceMap(lockedNotStakeables)
response.Balance = response.Balances[s.vm.utxoAssetID]
response.Unlocked = response.Unlockeds[s.vm.utxoAssetID]
response.LockedStakeable = response.LockedStakeables[s.vm.utxoAssetID]
response.LockedNotStakeable = response.LockedNotStakeables[s.vm.utxoAssetID]
response.Balance = response.Balances[s.vm.xAssetID]
response.Unlocked = response.Unlockeds[s.vm.xAssetID]
response.LockedStakeable = response.LockedStakeables[s.vm.xAssetID]
response.LockedNotStakeable = response.LockedNotStakeables[s.vm.xAssetID]
return nil
}
@@ -676,7 +676,7 @@ func (s *Service) GetStakingAssetID(_ *http.Request, args *GetStakingAssetIDArgs
)
if args.ChainID == constants.PrimaryNetworkID {
response.AssetID = s.vm.utxoAssetID
response.AssetID = s.vm.xAssetID
return nil
}
@@ -1672,7 +1672,7 @@ func (s *Service) GetStake(_ *http.Request, args *GetStakeArgs, response *GetSta
}
response.Stakeds = newJSONBalanceMap(totalAmountStaked)
response.Staked = response.Stakeds[s.vm.utxoAssetID]
response.Staked = response.Stakeds[s.vm.xAssetID]
response.Outputs = make([]string, len(stakedOuts))
for i, output := range stakedOuts {
bytes, err := txs.Codec.Marshal(txs.CodecVersion, output)
+4 -4
View File
@@ -740,14 +740,14 @@ curl -X POST --data '{
"locktime": "0",
"threshold": "1",
"addresses": [
"P-test1ywzvrftfqexh5g6qa9zyrytj6pqdfetza2hqln"
"P-fuji1ywzvrftfqexh5g6qa9zyrytj6pqdfetza2hqln"
]
},
"deactivationOwner": {
"locktime": "0",
"threshold": "1",
"addresses": [
"P-test1ywzvrftfqexh5g6qa9zyrytj6pqdfetza2hqln"
"P-fuji1ywzvrftfqexh5g6qa9zyrytj6pqdfetza2hqln"
]
},
"startTime": "1734034648",
@@ -1286,8 +1286,8 @@ curl -X POST --data '{
"result": {
"isPermissioned": true,
"controlKeys": [
"P-test1ztvstx6naeg6aarfd047fzppdt8v4gsah88e0c",
"P-test193kvt4grqewv6ce2x59wnhydr88xwdgfcedyr3"
"P-fuji1ztvstx6naeg6aarfd047fzppdt8v4gsah88e0c",
"P-fuji193kvt4grqewv6ce2x59wnhydr88xwdgfcedyr3"
],
"threshold": "1",
"locktime": "0",
-62
View File
@@ -1,62 +0,0 @@
// Copyright (C) 2019-2026, Lux Industries Inc. All rights reserved.
// See the file LICENSE for licensing terms.
package state
import (
"sync"
"github.com/luxfi/codec"
"github.com/luxfi/log"
)
// probe is a flat struct chosen so its codec walk is the empty walk
// (size 0) and therefore Marshal cannot fail for any reason other than
// the requested version being absent. This is what makes the probe a
// reliable boolean test of "is version V registered on c".
type probe struct{}
// multiVersionUnmarshal is the canonical state-side codec read entry
// point. It wraps codec.Manager.Unmarshal with a one-shot post-condition
// check: if the codec is missing the v0 read-only slot map, a structured
// warning is logged the FIRST time it is observed, so a canary boot of
// a v0-on-disk database surfaces every missing-version slot in a single
// log scrape rather than failing piecemeal across iterations.
//
// This is a soft guard, not a hard one — successful Unmarshal of a v1
// payload through a v1-only codec still succeeds. The warning fires
// when (a) a single-version codec is observed AND (b) the failure mode
// it implies (v0 prefix → ErrUnknownVersion) would have triggered on a
// pre-codec-v1 database row. The intent is to make the v1.28.x
// codec-migration convergence iteration-light: future patches can grep
// for this log line in canary stderr and see every remaining gap.
//
// Implementation note: we identify a codec as "missing the v0 slot" by
// attempting to Marshal a one-byte probe at CodecVersionV0. codec.Manager
// returns ErrUnknownVersion if and only if version 0 is not registered
// in its map. The probe is cheap (a 10-byte Marshal at most) and only
// happens on the first observation of each distinct codec pointer.
func multiVersionUnmarshal(c codec.Manager, b []byte, dest interface{}) (uint16, error) {
checkMultiVersion(c)
return c.Unmarshal(b, dest)
}
var (
multiVersionProbeOnce sync.Map // codec.Manager -> struct{}
)
func checkMultiVersion(c codec.Manager) {
if _, observed := multiVersionProbeOnce.LoadOrStore(c, struct{}{}); observed {
return
}
// Probe: can this codec Marshal at v0? An empty struct has zero
// codec-walk size, so the only way Marshal can fail is if version 0
// itself is not registered — which is exactly the failure mode we
// want the warning to fire on.
if _, err := c.Marshal(0, probe{}); err != nil {
log.Warn("state-side codec is single-version; reads of v0-prefixed bytes will fail",
"err", err,
"hint", "register the v0 read-only slot map on this codec.Manager",
)
}
}

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