mirror of
https://github.com/luxfi/node.git
synced 2026-07-29 08:36:26 +00:00
Compare commits
133
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a33eec4872 | ||
|
|
0a394ef5be | ||
|
|
99ae438be4 | ||
|
|
bd2edc135f | ||
|
|
bdd7179164 | ||
|
|
50fe597bf7 | ||
|
|
8873e231e8 | ||
|
|
2a724fb090 | ||
|
|
23d93bf60b | ||
|
|
8a797f4805 | ||
|
|
9f4819cf77 | ||
|
|
84a08c2b9c | ||
|
|
011e9bf99d | ||
|
|
c39a85522d | ||
|
|
1c92026c7e | ||
|
|
f7e501d021 | ||
|
|
a57251c318 | ||
|
|
2f6ef061ab | ||
|
|
7d2f01eb0c | ||
|
|
c76fcda71d | ||
|
|
e1e3917772 | ||
|
|
e7137ed28d | ||
|
|
3398024a19 | ||
|
|
e77b696662 | ||
|
|
eb82872612 | ||
|
|
4fce5875c5 | ||
|
|
304717c199 | ||
|
|
ad76f2e709 | ||
|
|
26d419c3ad | ||
|
|
6c39b7d391 | ||
|
|
dada5a3169 | ||
|
|
3a44f0dcd3 | ||
|
|
d5eff75934 | ||
|
|
66d5940f88 | ||
|
|
e22009db91 | ||
|
|
011c3df6bd | ||
|
|
52de39485d | ||
|
|
e70f687c10 | ||
|
|
88bb914cd6 | ||
|
|
4a3a131757 | ||
|
|
45a3dcfff1 | ||
|
|
c3d6105804 | ||
|
|
d83191e286 | ||
|
|
13b6e80a78 | ||
|
|
57792ee625 | ||
|
|
cf8e4c6f51 | ||
|
|
6ca0508608 | ||
|
|
35cbdfb0ee | ||
|
|
e266345e69 | ||
|
|
45bbe13637 | ||
|
|
fe23efd1f2 | ||
|
|
b34dcd1558 | ||
|
|
375dadde31 | ||
|
|
4d712c3798 | ||
|
|
3f65eb486d | ||
|
|
4002a59aa6 | ||
|
|
97e0a0b704 | ||
|
|
24b67abdd0 | ||
|
|
7ee56895d9 | ||
|
|
bbce8e6e13 | ||
|
|
9930e98d26 | ||
|
|
64a770b4cc | ||
|
|
6b25706366 | ||
|
|
ddb3fbca93 | ||
|
|
b113618e5e | ||
|
|
3f890bc98e | ||
|
|
44d7651d16 | ||
|
|
dcde2167a8 | ||
|
|
5a2035adb5 | ||
|
|
b4992860f6 | ||
|
|
0ba5d05bd8 | ||
|
|
926ddaafa4 | ||
|
|
eda299d30d | ||
|
|
6a766516b1 | ||
|
|
2d227dd3aa | ||
|
|
a78aa07e6f | ||
|
|
dd04027476 | ||
|
|
28e34ba003 | ||
|
|
f2dcc91cd3 | ||
|
|
7123b7399e | ||
|
|
43cbbac511 | ||
|
|
7ea0c0383f | ||
|
|
6b599d29e1 | ||
|
|
c5e999487c | ||
|
|
9626ca6c2f | ||
|
|
87a57925f3 | ||
|
|
3b4d16bbc5 | ||
|
|
511a804016 | ||
|
|
c44cc2289f | ||
|
|
c73eba739f | ||
|
|
f1a3e85b8e | ||
|
|
d008eba286 | ||
|
|
b6143b5d53 | ||
|
|
20d36b36aa | ||
|
|
4610978bcc | ||
|
|
e869b7bcd1 | ||
|
|
bbba24bad6 | ||
|
|
34cb5c1684 | ||
|
|
e288b67008 | ||
|
|
f0a00167e9 | ||
|
|
33e005c869 | ||
|
|
949210730d | ||
|
|
8d2fb750b6 | ||
|
|
1bc07cb1ca | ||
|
|
1dede2e3d2 | ||
|
|
636944a63a | ||
|
|
9c2468671e | ||
|
|
7750ca1829 | ||
|
|
c526c0aaa4 | ||
|
|
7354ce84b9 | ||
|
|
8e7253a3c5 | ||
|
|
67ec31a344 | ||
|
|
77389092c2 | ||
|
|
13cca30a71 | ||
|
|
a93e5cdd9d | ||
|
|
ae3e3a45f5 | ||
|
|
83c1a83765 | ||
|
|
be18fce176 | ||
|
|
74be89840c | ||
|
|
9a0800065f | ||
|
|
4e71814e58 | ||
|
|
c13681108f | ||
|
|
a02611413e | ||
|
|
7720d00baa | ||
|
|
439f2768e0 | ||
|
|
2dc15620e4 | ||
|
|
2bbe067f60 | ||
|
|
ae15850e1a | ||
|
|
092ed0459e | ||
|
|
aa884628a0 | ||
|
|
3d65b1c0c2 | ||
|
|
a8971630b5 | ||
|
|
09ab817ee5 |
@@ -1 +0,0 @@
|
||||
# CI Status Check - 2025-09-23 23:30:58
|
||||
@@ -1 +0,0 @@
|
||||
# Triggering CI - Version 1.13.5 Ready
|
||||
@@ -17,6 +17,6 @@ runs:
|
||||
- name: Set GOPRIVATE for luxfi packages
|
||||
# Some luxfi packages have large zip files that exceed Go proxy limits
|
||||
run: |
|
||||
echo "GOPRIVATE=github.com/luxfi/*" >> $GITHUB_ENV
|
||||
echo "GONOSUMDB=github.com/luxfi/*" >> $GITHUB_ENV
|
||||
echo "GOPRIVATE=github.com/lux-private/*" >> $GITHUB_ENV
|
||||
echo "GONOSUMDB=github.com/lux-private/*" >> $GITHUB_ENV
|
||||
shell: bash
|
||||
|
||||
@@ -27,8 +27,8 @@ runs:
|
||||
- name: Set GOPRIVATE and GONOSUMDB for luxfi packages
|
||||
shell: bash
|
||||
run: |
|
||||
echo "GOPRIVATE=github.com/luxfi/*" >> $GITHUB_ENV
|
||||
echo "GONOSUMDB=github.com/luxfi/*" >> $GITHUB_ENV
|
||||
echo "GOPRIVATE=github.com/lux-private/*" >> $GITHUB_ENV
|
||||
echo "GONOSUMDB=github.com/lux-private/*" >> $GITHUB_ENV
|
||||
- name: Configure git for private repo access
|
||||
if: inputs.github-token != ''
|
||||
shell: bash
|
||||
|
||||
@@ -1,34 +0,0 @@
|
||||
name: Lint proto files
|
||||
|
||||
on:
|
||||
push:
|
||||
paths:
|
||||
- 'proto/**/*.proto'
|
||||
- '.github/workflows/buf-lint.yml'
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
buf-lint:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Check for .proto files
|
||||
id: proto-check
|
||||
run: |
|
||||
if find proto -name '*.proto' -type f 2>/dev/null | grep -q .; then
|
||||
echo "has_proto=true" >> $GITHUB_OUTPUT
|
||||
else
|
||||
echo "has_proto=false" >> $GITHUB_OUTPUT
|
||||
echo "No .proto files found — skipping buf-lint (node is ZAP-native by default; protobuf is opt-in)."
|
||||
fi
|
||||
- uses: bufbuild/buf-setup-action@v1
|
||||
if: steps.proto-check.outputs.has_proto == 'true'
|
||||
with:
|
||||
github_token: ${{ github.token }}
|
||||
version: "1.47.2"
|
||||
- uses: bufbuild/buf-lint-action@v1
|
||||
if: steps.proto-check.outputs.has_proto == 'true'
|
||||
with:
|
||||
input: "proto"
|
||||
@@ -9,7 +9,7 @@ on:
|
||||
|
||||
jobs:
|
||||
push:
|
||||
runs-on: ubuntu-latest
|
||||
runs-on: lux-build-amd64
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: bufbuild/buf-setup-action@v1.31.0
|
||||
|
||||
@@ -50,7 +50,7 @@ jobs:
|
||||
TIMEOUT: ${{ env.TIMEOUT }}
|
||||
CGO_ENABLED: '0'
|
||||
Fuzz:
|
||||
runs-on: ubuntu-latest
|
||||
runs-on: lux-build-amd64
|
||||
env:
|
||||
GOPRIVATE: github.com/luxfi/*
|
||||
GONOSUMDB: github.com/luxfi/*
|
||||
@@ -71,7 +71,7 @@ jobs:
|
||||
# e2e_pre_etna, e2e_post_etna, e2e_existing_network, Upgrade
|
||||
# These will be re-enabled once tmpnet is properly configured
|
||||
Lint:
|
||||
runs-on: ubuntu-latest
|
||||
runs-on: lux-build-amd64
|
||||
env:
|
||||
GOPRIVATE: github.com/luxfi/*
|
||||
GONOSUMDB: github.com/luxfi/*
|
||||
@@ -94,56 +94,9 @@ jobs:
|
||||
- name: Run actionlint
|
||||
shell: bash
|
||||
run: scripts/actionlint.sh
|
||||
buf-lint:
|
||||
name: Protobuf Lint
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Install buf
|
||||
shell: bash
|
||||
run: |
|
||||
BUF_VERSION="1.47.2"
|
||||
curl -sSL "https://github.com/bufbuild/buf/releases/download/v${BUF_VERSION}/buf-Linux-x86_64" -o /usr/local/bin/buf
|
||||
chmod +x /usr/local/bin/buf
|
||||
buf --version
|
||||
- name: Lint protobuf
|
||||
shell: bash
|
||||
run: buf lint proto
|
||||
check_generated_protobuf:
|
||||
name: Up-to-date protobuf
|
||||
runs-on: ubuntu-latest
|
||||
continue-on-error: true
|
||||
env:
|
||||
GOPRIVATE: github.com/luxfi/*
|
||||
GONOSUMDB: github.com/luxfi/*
|
||||
GOWORK: off
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: ./.github/actions/setup-go-for-project
|
||||
- name: Configure Git for private modules
|
||||
shell: bash
|
||||
run: git config --global url."https://${{ github.token }}@github.com/".insteadOf "https://github.com/"
|
||||
- name: Install buf
|
||||
shell: bash
|
||||
run: |
|
||||
BUF_VERSION="1.47.2"
|
||||
curl -sSL "https://github.com/bufbuild/buf/releases/download/v${BUF_VERSION}/buf-Linux-x86_64" -o /usr/local/bin/buf
|
||||
chmod +x /usr/local/bin/buf
|
||||
- name: Install protoc-gen-go tools
|
||||
shell: bash
|
||||
run: |
|
||||
go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.35.1
|
||||
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@v1.3.0
|
||||
go install connectrpc.com/connect/cmd/protoc-gen-connect-go@latest
|
||||
- shell: bash
|
||||
run: scripts/protobuf_codegen.sh
|
||||
env:
|
||||
CGO_ENABLED: '0'
|
||||
- shell: bash
|
||||
run: .github/workflows/check-clean-branch.sh
|
||||
check_mockgen:
|
||||
name: Up-to-date mocks
|
||||
runs-on: ubuntu-latest
|
||||
runs-on: lux-build-amd64
|
||||
continue-on-error: true
|
||||
env:
|
||||
GOPRIVATE: github.com/luxfi/*
|
||||
@@ -163,7 +116,7 @@ jobs:
|
||||
run: .github/workflows/check-clean-branch.sh
|
||||
go_mod_tidy:
|
||||
name: Up-to-date go.mod and go.sum
|
||||
runs-on: ubuntu-latest
|
||||
runs-on: lux-build-amd64
|
||||
env:
|
||||
GOPRIVATE: github.com/luxfi/*
|
||||
GONOSUMDB: github.com/luxfi/*
|
||||
@@ -180,7 +133,7 @@ jobs:
|
||||
run: .github/workflows/check-clean-branch.sh
|
||||
test_build_image:
|
||||
name: Image build
|
||||
runs-on: ubuntu-latest
|
||||
runs-on: lux-build-amd64
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Set up Docker Buildx
|
||||
|
||||
@@ -24,7 +24,7 @@ on:
|
||||
jobs:
|
||||
analyze:
|
||||
name: Analyze
|
||||
runs-on: ubuntu-latest
|
||||
runs-on: lux-build-amd64
|
||||
permissions:
|
||||
actions: read
|
||||
contents: read
|
||||
|
||||
@@ -9,7 +9,7 @@ permissions:
|
||||
|
||||
jobs:
|
||||
fuzz:
|
||||
runs-on: ubuntu-latest
|
||||
runs-on: lux-build-amd64
|
||||
env:
|
||||
GOPRIVATE: github.com/luxfi/*
|
||||
GONOSUMDB: github.com/luxfi/*
|
||||
|
||||
@@ -11,7 +11,7 @@ permissions:
|
||||
|
||||
jobs:
|
||||
MerkleDB:
|
||||
runs-on: ubuntu-latest
|
||||
runs-on: lux-build-amd64
|
||||
env:
|
||||
GOPRIVATE: github.com/luxfi/*
|
||||
GONOSUMDB: github.com/luxfi/*
|
||||
|
||||
@@ -16,7 +16,7 @@ jobs:
|
||||
permissions:
|
||||
contents: read
|
||||
issues: write
|
||||
runs-on: ubuntu-latest
|
||||
runs-on: lux-build-amd64
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: crazy-max/ghaction-github-labeler@548a7c3603594ec17c819e1239f281a3b801ab4d #v6.0.0
|
||||
|
||||
@@ -4,7 +4,7 @@ on:
|
||||
- cron: '0 0 * * 0' # Run every day at midnight UTC on Sunday
|
||||
jobs:
|
||||
stale:
|
||||
runs-on: ubuntu-latest
|
||||
runs-on: lux-build-amd64
|
||||
steps:
|
||||
- uses: actions/stale@v10
|
||||
with:
|
||||
|
||||
@@ -15,7 +15,7 @@ env:
|
||||
|
||||
jobs:
|
||||
test-zapdb-replay:
|
||||
runs-on: ubuntu-latest
|
||||
runs-on: lux-build-amd64
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
@@ -87,7 +87,7 @@ jobs:
|
||||
--api-admin-enabled=true 2>&1 | grep -E "(genesis-db|Genesis)" || true
|
||||
|
||||
test-database-factory:
|
||||
runs-on: ubuntu-latest
|
||||
runs-on: lux-build-amd64
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
@@ -5,6 +5,22 @@ 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.36.31]
|
||||
|
||||
### Fixed
|
||||
- **`/v1/health` reported a chain the node denies exists.** The `bootstrapped` check publishes `chains.Nets.Bootstrapping()` verbatim as its message, but `Nets.chains` is keyed by **net** ID and the aggregate appended the map **key**, not the chain. Every primary-network chain that failed to converge therefore surfaced as the single ID `11111111111111111111111111111111LpoYY` — `constants.PrimaryNetworkID` (`ids.Empty`) — so an operator resolving it got "there is no chain with alias/ID", and N stuck chains collapsed into one indistinguishable entry (measured on devnet/testnet: `"message":["11111111111111111111111111111111LpoYY"],"contiguousFailures":3213`). The net owns the bootstrapping set, so the net now names its own chains: new `nets.Net.Bootstrapping() []ids.ID` (`nets/net.go`), and `chains/chains.go` aggregates those instead of the keys. `TestNetsBootstrappingReportsChainsNotNets` asserts `ids.Empty` never appears and that two stuck chains are individually named; `TestNetsBootstrapping` no longer asserts the bug (it demanded the net ID).
|
||||
- Ships the GET `/v1/health` encoder fix from `dada5a31` (`{"healthy":…,"error":"health reply encode failed"}` on every node — jsonv2 has no representation for `apihealth.Result.Duration`), which was on `main` but had never been tagged.
|
||||
|
||||
## [1.36.13]
|
||||
|
||||
### Fixed
|
||||
- **The durable rejoin fix (#66/#74) shipped INERT for the C-Chain — the exact chain whose 40h mainnet freeze motivated it.** `chains/manager.go` gated `expectsStakedBeacons` on `ids.IsNativeChain(chainParams.ID)` — the *blockchain* ID. But `ids.IsNativeChain` only matches the symbolic `111…C` alias form, and every deployed C/X/Q carries a **hash** blockchain ID (devnet C `21HieZng…`, mainnet C `2wRdZG…`); only the P-chain has a symbolic blockchain ID (`111…P`), and it is excluded as the platform chain. So `isNativeChain` was **always false** for the real C-Chain → `expectsStakedBeacons=false` → under the production `--skip-bootstrap=true` the beacon set was emptied → a behind C-Chain named its STALE local tip the frontier and never caught up (verified on devnet v1.36.12: C-Chain wedged at height 0 with "using empty beacons for single-node mode"). Fix: discriminate on the **validating Net** (`chainParams.ChainID == constants.PrimaryNetworkID`) via new `chainValidatesOnPrimaryNetwork`, which is `PrimaryNetworkID` for C/X/Q and each sovereign L1's own net ID for an L2 — so C/X/Q now keep their staked beacons under `--skip-bootstrap` (peer-sync a behind validator) while L2s keep the empty-beacon single-node path. Regression test `TestChainValidatesOnPrimaryNetwork_RealHashChainID` exercises the real discriminator with hash chain IDs (the prior hardcoded-bool tests could not catch this); `TestRED_EmptyStakedSetFailsSafe` still passes (forged-frontier gate intact).
|
||||
|
||||
## [1.36.12]
|
||||
|
||||
### Fixed
|
||||
- **EVM chains (C/D/L2) failed to initialize on v1.36.11 — bundled VM plugins were built against a stale `luxfi/api`.** The node pins `luxfi/api v1.0.16`, whose `InitializeResponse` carries the appended `Capabilities uint64` field (Quasar-export handshake, api commit `1f2dc5a`). The image baked the C-Chain EVM plugin from `luxfi/evm@v1.104.8` and the D-Chain dexvm plugin from `luxfi/dex@v1.5.15`, both of which resolve `luxfi/api v1.0.15` (no `Capabilities`). Their `InitializeResponse.Encode` writes a shorter payload than the node's strict `InitializeResponse.Decode` expects, so `vms/rpcchainvm/zap/client.go` fails every EVM VM handshake with `zap decode initialize response: unexpected EOF`. Native VMs (P/X/Q) were unaffected. Fix: bump `EVM_VERSION` `v1.104.8 → v1.104.9` (api v1.0.16) and force `luxfi/api@v1.0.16` in the dexvm build stage. The api bump is code-free for plugins (`luxfi/chains v1.7.4 → v1.7.5` adopted it with a go.mod-only diff; `CHAINS_REF=v1.7.6` already carries v1.0.16). No node source change beyond the version bump — this is v1.36.11's node binary (durable rejoin fix, commit `63f61429d1`) rebuilt with plugin↔node ZAP-wire alignment.
|
||||
|
||||
## [1.28.0]
|
||||
|
||||
### Added
|
||||
|
||||
+60
-22
@@ -42,11 +42,11 @@ WORKDIR /build
|
||||
# deps not registered in the public sum.golang.org / proxy (reading e.g.
|
||||
# hanzoai/vfs@v0.4.1's go.mod via the public sumdb 404s and fails the build).
|
||||
ENV GONOSUMCHECK=github.com/luxfi/*,github.com/hanzoai/*
|
||||
ENV GONOSUMDB=github.com/luxfi/*,github.com/hanzoai/*
|
||||
ENV GONOSUMDB=github.com/lux-private/*,github.com/hanzoai/*
|
||||
# Use Go proxy for most deps (gonum.org is flaky via direct), direct only for
|
||||
# the cross-org private modules.
|
||||
ENV GOPROXY=https://proxy.golang.org,direct
|
||||
ENV GONOPROXY=github.com/luxfi/*,github.com/hanzoai/*
|
||||
ENV GONOPROXY=github.com/lux-private/*,github.com/hanzoai/*
|
||||
ENV GOFLAGS="-mod=mod"
|
||||
|
||||
# Copy and download lux dependencies using go mod.
|
||||
@@ -124,22 +124,27 @@ RUN --mount=type=secret,id=ghtok,required=false \
|
||||
# linked into the C-Chain plugin via github.com/luxfi/chains/evm/cevm
|
||||
# and become the default execution backend (parallel + GPU EVM).
|
||||
#
|
||||
# CI/RELEASE GAP: the luxcpp/cevm release artifacts MUST publish per-arch
|
||||
# tarballs at the URL below for both linux-x86_64 and linux-arm64. Until
|
||||
# those tarballs exist, builds with CGO_ENABLED=1 will fail at this step and
|
||||
# operators must build with CGO_ENABLED=0 (pure-Go fallback).
|
||||
# The release assets live in the PRIVATE lux-private/cevm repo, so the fetch is
|
||||
# authenticated with the same `ghtok` secret as the private go modules and
|
||||
# lux-accel above. Best-effort, like lux-accel: only a build that asks for the
|
||||
# cevm backend (EVM_CGO=1 below) actually needs these.
|
||||
ARG CGO_ENABLED=1
|
||||
ARG CEVM_VERSION=v0.19.0
|
||||
RUN if [ "${CGO_ENABLED}" = "1" ]; then \
|
||||
ARG CEVM_VERSION=v0.51.10
|
||||
ARG CEVM_REPO=lux-private/cevm
|
||||
RUN --mount=type=secret,id=ghtok,required=false \
|
||||
if [ "${CGO_ENABLED}" = "1" ]; then \
|
||||
ARCH=$(echo ${TARGETPLATFORM} | cut -d / -f2) && \
|
||||
if [ "$ARCH" = "amd64" ]; then CEVM_ARCH="linux-x86_64"; else CEVM_ARCH="linux-arm64"; fi && \
|
||||
wget -q "https://github.com/luxcpp/cevm/releases/download/${CEVM_VERSION}/luxcpp-cevm-${CEVM_ARCH}.tar.gz" \
|
||||
-O /tmp/cevm.tar.gz && \
|
||||
tar -xzf /tmp/cevm.tar.gz -C /usr/local && \
|
||||
rm /tmp/cevm.tar.gz && \
|
||||
ldconfig 2>/dev/null || true ; \
|
||||
AUTH=""; [ -s /run/secrets/ghtok ] && AUTH="--header=Authorization: Bearer $(cat /run/secrets/ghtok)"; \
|
||||
( wget -q ${AUTH:+"$AUTH"} \
|
||||
"https://github.com/${CEVM_REPO}/releases/download/${CEVM_VERSION}/luxcpp-cevm-${CEVM_ARCH}.tar.gz" \
|
||||
-O /tmp/cevm.tar.gz \
|
||||
&& tar -xzf /tmp/cevm.tar.gz -C /usr/local \
|
||||
&& rm /tmp/cevm.tar.gz \
|
||||
&& ldconfig 2>/dev/null \
|
||||
) || echo "WARN: cevm ${CEVM_VERSION} fetch skipped (unreachable; needed only when EVM_CGO=1)" ; \
|
||||
else \
|
||||
echo "CGO_ENABLED=0: skipping luxcpp/cevm fetch (pure-Go fallback build)" ; \
|
||||
echo "CGO_ENABLED=0: skipping cevm fetch (pure-Go fallback build)" ; \
|
||||
fi
|
||||
|
||||
# Build node. CGO_ENABLED=1 (default) links luxcpp/cevm for parallel + GPU EVM.
|
||||
@@ -257,7 +262,35 @@ RUN . ./build_env.sh && \
|
||||
# failed ValidateState, and BRICKED the node. Proven on-node: real swap → kill -9 →
|
||||
# clean reboot, state intact. v1.99.40 = v1.99.39 + deps to latest. consensus v1.25.21 =
|
||||
# stake-weighted alpha-of-K quorum finality + per-height single-finalize + epoch-bound certs.
|
||||
ARG EVM_VERSION=v1.104.3
|
||||
# v1.104.9 bumps luxfi/api v1.0.15 -> v1.0.16 (indirect via luxfi/vm). v1.0.16
|
||||
# APPENDED InitializeResponse.Capabilities (uint64) for the Quasar-export
|
||||
# handshake (api commit 1f2dc5a). The node pins api v1.0.16 and DECODES that
|
||||
# field; an EVM plugin built at v1.104.8 (api v1.0.15) omits it, so the node's
|
||||
# strict struct decode hits "zap decode initialize response: unexpected EOF"
|
||||
# and EVERY EVM chain (C + L2s hanzo/zoo/pars/spc, all mgj786) fails to
|
||||
# initialize. The api bump is code-free for plugins (chains v1.7.4->v1.7.5
|
||||
# adopted it with a go.mod-only diff), so v1.104.9 = v1.104.8 + api alignment.
|
||||
# C-Chain execution backend. The default is the pure-Go EVM, which is what
|
||||
# every image has shipped so far. EVM_CGO=1 EVM_TAGS=cevm links luxcpp/cevm
|
||||
# instead — that pair is what makes AutoEVM resolve to CppEVM. The libraries
|
||||
# come from the cevm fetch in this same stage above.
|
||||
ARG EVM_CGO=0
|
||||
ARG EVM_TAGS=""
|
||||
|
||||
# v1.104.22 realigns the plugin with THIS node's own go.mod: api v1.0.16 ->
|
||||
# v1.1.1, vm v1.2.6 -> v1.3.1, geth v1.17.12 -> v1.20.1. Node main pins api
|
||||
# v1.1.1, so pinning an evm at api v1.0.16 reintroduces the exact
|
||||
# InitializeResponse decode mismatch described above, just in the opposite
|
||||
# direction — keep this ARG and node's go.mod on the same api/vm/geth line.
|
||||
#
|
||||
# v1.104.14 is also the FIRST evm tag carrying the C-Chain fee-split seam
|
||||
# (core/fee_split.go creditTxFee + extras.FeeSplitTimestamp/FeeRewardVault).
|
||||
# Below it, encoding/json silently DISCARDS the genesis "feeSplitTimestamp"
|
||||
# key: a chain configured for the 50/50 split instead routes 100% of every fee
|
||||
# to the block coinbase and the reward vault 0x0100..0002 stays 0 forever, with
|
||||
# nothing burned. The split stays dormant wherever feeSplitTimestamp is absent
|
||||
# (mainnet), so this bump is behaviour-preserving there.
|
||||
ARG EVM_VERSION=v1.104.23
|
||||
ARG EVM_VM_ID=mgj786NP7uDwBCcq6YwThhaN8FLyybkCa4zBWTQbNgmK6k9A6
|
||||
# the pinned evm go.mod may pin a dead luxfi/upgrade pseudo-version
|
||||
# (v1.0.1-0.20260603055252-f51810805436 — commit pruned from origin). Heal it to
|
||||
@@ -284,8 +317,8 @@ RUN --mount=type=cache,target=/root/.cache/go-build \
|
||||
go mod edit -require=github.com/luxfi/chains@v1.7.0 && \
|
||||
find /tmp/evm -name go.sum -exec sed -i -E '/^github.com\/(luxfi|hanzoai)\//d' {} + && \
|
||||
GOARCH=$(echo ${TARGETPLATFORM} | cut -d / -f2) \
|
||||
CGO_ENABLED=0 GOFLAGS=-mod=mod \
|
||||
go build -ldflags="-s -w" -o /luxd/build/plugins/${EVM_VM_ID} ./plugin && \
|
||||
CGO_ENABLED=${EVM_CGO} GOFLAGS=-mod=mod \
|
||||
go build -ldflags="-s -w" -tags "${EVM_TAGS}" -o /luxd/build/plugins/${EVM_VM_ID} ./plugin && \
|
||||
chmod +x /luxd/build/plugins/${EVM_VM_ID} && \
|
||||
rm -rf /tmp/evm
|
||||
|
||||
@@ -302,7 +335,7 @@ RUN --mount=type=cache,target=/root/.cache/go-build \
|
||||
# oraclevm -> r5m1ujrmXxVcQetG3CQfuDLHp2RHKh6vCDaFgBRQfUcTZh7eS
|
||||
# quantumvm -> ry9Sg8rZdT26iEKvJDmC2wkESs4SDKgZEhk5BgLSwg1EpcNug
|
||||
# relayvm -> sP6dLqrrBR9w3soP18fbJ3YzZecZdD7DDdfH2cFhhLq7Hy9bz
|
||||
# mpcvm -> tGVBwRxpmD2aFdg3iYjgRvrCe8Jcmq9UNKxyHMus2NZ8WcD8t
|
||||
# mpcvm -> qCURact1n41FcoNBch8iMVBwc9AWie48D118ZNJ5tBdWrvryS
|
||||
# zkvm -> vv3qPfyTVXZ5ArRZA9Jh4hbYDTBe43f7sgQg4CHfNg1rnnvX9
|
||||
|
||||
# MUST track node's go.mod luxfi/chains (the D-Chain dexvm + 10 VM plugins).
|
||||
@@ -311,7 +344,7 @@ RUN --mount=type=cache,target=/root/.cache/go-build \
|
||||
# helper (bridgevm/zkvm/mpcvm), graphvm genesis-last-accepted fix, built on
|
||||
# evm v1.99.48 + precompile v0.16.0 (enable-everything builder surface). Keeps the
|
||||
# baked VM plugins in lockstep with the host node.
|
||||
ARG CHAINS_REF=v1.7.2
|
||||
ARG CHAINS_REF=v1.7.6
|
||||
RUN --mount=type=cache,target=/root/.cache/go-build \
|
||||
git clone --depth 1 --branch ${CHAINS_REF} https://github.com/luxfi/chains.git /tmp/chains && \
|
||||
find /tmp/chains -name go.sum -exec sed -i -E '/^github.com\/(luxfi|hanzoai)\//d' {} +
|
||||
@@ -346,7 +379,7 @@ RUN --mount=type=cache,target=/root/.cache/go-build \
|
||||
( cd /tmp/chains/relayvm && CGO_ENABLED=0 GOFLAGS=-mod=mod go build -ldflags="-s -w" \
|
||||
-o /luxd/build/plugins/sP6dLqrrBR9w3soP18fbJ3YzZecZdD7DDdfH2cFhhLq7Hy9bz ./cmd/plugin ) || echo "WARN: relayvm plugin build skipped" ; \
|
||||
( cd /tmp/chains/mpcvm && CGO_ENABLED=0 GOFLAGS=-mod=mod go build -ldflags="-s -w" \
|
||||
-o /luxd/build/plugins/tGVBwRxpmD2aFdg3iYjgRvrCe8Jcmq9UNKxyHMus2NZ8WcD8t ./cmd/plugin ) || echo "WARN: mpcvm plugin build skipped" ; \
|
||||
-o /luxd/build/plugins/qCURact1n41FcoNBch8iMVBwc9AWie48D118ZNJ5tBdWrvryS ./cmd/plugin ) || echo "WARN: mpcvm plugin build skipped" ; \
|
||||
( cd /tmp/chains/zkvm && CGO_ENABLED=0 GOFLAGS=-mod=mod go build -ldflags="-s -w" \
|
||||
-o /luxd/build/plugins/vv3qPfyTVXZ5ArRZA9Jh4hbYDTBe43f7sgQg4CHfNg1rnnvX9 ./cmd/plugin ) || echo "WARN: zkvm plugin build skipped" ; \
|
||||
( chmod +x /luxd/build/plugins/* 2>/dev/null || true ) && \
|
||||
@@ -359,7 +392,7 @@ RUN --mount=type=cache,target=/root/.cache/go-build \
|
||||
r5m1ujrmXxVcQetG3CQfuDLHp2RHKh6vCDaFgBRQfUcTZh7eS \
|
||||
ry9Sg8rZdT26iEKvJDmC2wkESs4SDKgZEhk5BgLSwg1EpcNug \
|
||||
sP6dLqrrBR9w3soP18fbJ3YzZecZdD7DDdfH2cFhhLq7Hy9bz \
|
||||
tGVBwRxpmD2aFdg3iYjgRvrCe8Jcmq9UNKxyHMus2NZ8WcD8t \
|
||||
qCURact1n41FcoNBch8iMVBwc9AWie48D118ZNJ5tBdWrvryS \
|
||||
vv3qPfyTVXZ5ArRZA9Jh4hbYDTBe43f7sgQg4CHfNg1rnnvX9 ; do \
|
||||
test -s /luxd/build/plugins/$p \
|
||||
|| { echo "FATAL: required chain-VM plugin $p missing/empty — its build failed above (see the matching WARN line); the runtime-stage hard COPY would otherwise fail cryptically. Surface & fix the real Go build error, or remove the plugin from BOTH the build list and the runtime COPY."; exit 1; } ; \
|
||||
@@ -402,6 +435,11 @@ RUN --mount=type=cache,target=/root/.cache/go-build \
|
||||
git clone --depth 1 --branch ${DEX_REF} https://github.com/luxfi/dex.git /tmp/dex && \
|
||||
find /tmp/dex -name go.sum -exec sed -i -E '/^github.com\/(luxfi|hanzoai)\//d' {} + && \
|
||||
cd /tmp/dex && \
|
||||
# Align the dexvm plugin's ZAP wire (luxfi/api) with the node. No dex release
|
||||
# pins api v1.0.16 yet (all <=v1.5.20 carry v1.0.15), so force it here; the
|
||||
# bump is code-free (adds InitializeResponse.Capabilities, capability-gated),
|
||||
# so dexvm emits the field the node decodes -> no "unexpected EOF" on D-Chain.
|
||||
go mod edit -require=github.com/luxfi/api@v1.0.16 && \
|
||||
. /build/build_env.sh && \
|
||||
GOARCH=$(echo ${TARGETPLATFORM} | cut -d / -f2) \
|
||||
CGO_ENABLED=0 GOFLAGS=-mod=mod \
|
||||
@@ -464,7 +502,7 @@ COPY --from=builder \
|
||||
/luxd/build/plugins/r5m1ujrmXxVcQetG3CQfuDLHp2RHKh6vCDaFgBRQfUcTZh7eS \
|
||||
/luxd/build/plugins/ry9Sg8rZdT26iEKvJDmC2wkESs4SDKgZEhk5BgLSwg1EpcNug \
|
||||
/luxd/build/plugins/sP6dLqrrBR9w3soP18fbJ3YzZecZdD7DDdfH2cFhhLq7Hy9bz \
|
||||
/luxd/build/plugins/tGVBwRxpmD2aFdg3iYjgRvrCe8Jcmq9UNKxyHMus2NZ8WcD8t \
|
||||
/luxd/build/plugins/qCURact1n41FcoNBch8iMVBwc9AWie48D118ZNJ5tBdWrvryS \
|
||||
/luxd/build/plugins/vv3qPfyTVXZ5ArRZA9Jh4hbYDTBe43f7sgQg4CHfNg1rnnvX9 \
|
||||
/luxd/build/plugins/
|
||||
WORKDIR /luxd/build
|
||||
|
||||
@@ -1,324 +0,0 @@
|
||||
# Lux Mainnet Launch Checklist
|
||||
|
||||
Node: luxfi/node v1.24.11
|
||||
Consensus: Quasar (BLS+Corona, slashing, stake-weighted sampling)
|
||||
EVM: GPU ecrecover, 18 precompiles
|
||||
Genesis: networkID=1, startTime=2025-12-12T21:06:51Z (mainnet), networkID=2, startTime=2026-02-10T16:00:00Z (testnet)
|
||||
Precompile constraint: all activations MUST be after 2025-12-25
|
||||
|
||||
---
|
||||
|
||||
## Infrastructure
|
||||
|
||||
| Environment | Cluster | DOKS ID | K8s Version | Namespace | Validators |
|
||||
|-------------|---------|---------|-------------|-----------|------------|
|
||||
| Testnet | do-sfo3-lux-test-k8s | `005ec3c4` | 1.35.1-do.0 | lux-testnet | 11 (target) |
|
||||
| Rehearsal | do-sfo3-lux-dev-k8s | `0ff340e1` | 1.35.1-do.0 | lux-devnet | 21 (target) |
|
||||
| Mainnet | do-sfo3-lux-k8s | `04c46df5` | 1.34.1-do.4 | lux-mainnet | 21 (target) |
|
||||
|
||||
Current state: lux-k8s runs 5 validators (v1.23.31) via LuxNetwork CRD. Testnet cluster (lux-test-k8s) has a 3-replica StatefulSet (v1.23.40).
|
||||
|
||||
Image: `ghcr.io/luxfi/node:v1.24.11` (built via CI/CD, linux/amd64+arm64)
|
||||
Staking keys: KMS at `kms.lux.network`, project `lux-infra`, synced via KMSSecret CRD
|
||||
Secrets: never in manifests, never in env files, never committed
|
||||
Genesis configs: `/Users/z/work/lux/genesis/configs/{testnet,mainnet,devnet}/`
|
||||
K8s manifests: `/Users/z/work/lux/universe/k8s/`
|
||||
Profiles: `standard.json` (~100MB/node), `max.json` (~512MB/node)
|
||||
|
||||
Bootstrappers:
|
||||
- Mainnet: 5 seeds (ports 9631) -- `209.38.118.46`, `209.38.174.69`, `24.144.69.101`, `134.199.187.56`, `143.198.246.173`
|
||||
- Testnet: 2 seeds (ports 9641) -- `134.199.187.16`, `209.38.174.84`
|
||||
|
||||
Consensus parameters (mainnet): K=20, AlphaPreference=15, AlphaConfidence=15, Beta=20, ConcurrentPolls=4
|
||||
|
||||
Tokenomics: 10B total supply (9 decimals), min validator stake 1M LUX, min delegator stake 25K LUX, combined staking allowed (NFT+delegation), 80% uptime threshold
|
||||
|
||||
C-Chain: chainId=96369 (mainnet), 96368 (testnet), gasLimit=12M, targetBlockRate=2s, minBaseFee=25gwei
|
||||
|
||||
---
|
||||
|
||||
## Phase 1: Testnet (lux-test-k8s, networkID=2)
|
||||
|
||||
Target: validate all consensus, EVM, and staking behavior with K=11 validators.
|
||||
|
||||
### 1.1 Deployment
|
||||
|
||||
- [ ] Update LuxNetwork CRD in `universe/k8s/lux-k8s/validators/statefulset.yaml` (testnet section): `validators: 11`, `image.tag: v1.24.11`
|
||||
- [ ] Update lux-test-k8s StatefulSet in `universe/k8s/lux-test-k8s/testnet/statefulset.yaml`: replicas=11, image=v1.24.11
|
||||
- [ ] Generate 11 staking key pairs via `lux cli` and store in KMS (`lux-infra/testnet/staking/`)
|
||||
- [ ] Add 9 new bootstrapper entries to `genesis/configs/testnet/bootstrappers.json` (currently 2)
|
||||
- [ ] Apply `max.json` profile for testnet validators (512MB/node for stress testing headroom)
|
||||
- [ ] Regenerate testnet genesis with 11 initial validators via `genesis` tool
|
||||
- [ ] Verify all precompile activation timestamps are after 2025-12-25
|
||||
- [ ] Deploy via PaaS (platform.hanzo.ai), not manual kubectl
|
||||
- [ ] Verify all 11 pods reach Running state
|
||||
- [ ] Verify all 11 nodes report healthy via `/v1/health/liveness`
|
||||
|
||||
### 1.2 Bootstrap and Connectivity
|
||||
|
||||
- [ ] Verify all 11 validators discover each other via P2P (check `info.peers` RPC, expect 10 peers per node)
|
||||
- [ ] Verify staking port 9641 reachable between all pods (`luxd-{0..10}.luxd-headless.testnet.svc.cluster.local:9641`)
|
||||
- [ ] Verify P-chain bootstraps and all validators appear in `platform.getCurrentValidators`
|
||||
- [ ] Verify C-chain bootstraps and produces blocks
|
||||
- [ ] Verify X-chain bootstraps and processes UTXO transactions
|
||||
|
||||
### 1.3 Quasar Consensus Verification
|
||||
|
||||
- [ ] Submit transactions, verify Quasar finalization with K=11
|
||||
- [ ] Verify BLS aggregate signatures in block headers
|
||||
- [ ] Verify Corona optimistic fast path activates when all 11 validators are online
|
||||
- [ ] Measure finality latency (target: sub-second with Corona)
|
||||
- [ ] Verify stake-weighted sampling: validators with more stake get polled proportionally
|
||||
|
||||
### 1.4 EVM Execution
|
||||
|
||||
- [ ] Deploy a test contract, call all standard opcodes
|
||||
- [ ] Submit 100 sequential transactions, verify correct nonce ordering
|
||||
- [ ] Verify `eth_call` and `eth_estimateGas` return correct results
|
||||
- [ ] Verify block gas limit is 12M (from cchain.json config)
|
||||
- [ ] Verify minBaseFee=25gwei is enforced
|
||||
|
||||
### 1.5 GPU ecrecover
|
||||
|
||||
- [ ] Verify GPU backend auto-detection: CUDA on Linux DOKS nodes, Metal on macOS
|
||||
- [ ] Run ecrecover-heavy workload (1000 signature verifications per block)
|
||||
- [ ] Compare ecrecover throughput: GPU vs CPU fallback
|
||||
- [ ] Verify graceful fallback to CPU when GPU unavailable (set `--gpu-backend=cpu`)
|
||||
|
||||
### 1.6 Precompiles (all 18)
|
||||
|
||||
- [ ] Test each precompile individually via contract calls
|
||||
- [ ] Verify DEX precompile (LP-9010 PoolManager): pool creation, swaps, flash loans
|
||||
- [ ] Verify DEX router precompile (LP-9012): multi-hop routing
|
||||
- [ ] Verify all precompile addresses are deterministic and match spec
|
||||
- [ ] Verify precompile gas metering is correct (no underpriced or overpriced ops)
|
||||
- [ ] Verify precompiles revert correctly on invalid input
|
||||
|
||||
### 1.7 Slashing
|
||||
|
||||
- [ ] Craft equivocation evidence: have a validator sign two different blocks at same height
|
||||
- [ ] Submit equivocation proof to P-chain slashing precompile
|
||||
- [ ] Verify slashed validator's stake is burned
|
||||
- [ ] Verify slashed validator is removed from active set
|
||||
- [ ] Verify honest validators are unaffected
|
||||
|
||||
### 1.8 Uptime and Rewards
|
||||
|
||||
- [ ] Stop 1 validator (scale pod to 0)
|
||||
- [ ] Wait for reward period to elapse
|
||||
- [ ] Verify stopped validator's uptime drops below 80%
|
||||
- [ ] Verify rewards are withheld for the stopped validator
|
||||
- [ ] Restart the validator, verify it re-bootstraps and resumes
|
||||
- [ ] Verify validators with >80% uptime receive expected rewards
|
||||
|
||||
### 1.9 Stress Test
|
||||
|
||||
- [ ] Run stress test: maximum TPS with 1B gas blocks (increase gas limit temporarily)
|
||||
- [ ] Measure sustained TPS over 1 hour (target: verify consensus is the bottleneck, not EVM)
|
||||
- [ ] Monitor memory usage per node (should stay within `max.json` profile ~512MB)
|
||||
- [ ] Monitor disk I/O and database growth rate
|
||||
- [ ] Verify no consensus stalls under load
|
||||
- [ ] Verify block production rate stays at targetBlockRate=2s
|
||||
|
||||
### 1.10 Validator Join/Leave
|
||||
|
||||
- [ ] Add a 12th validator via `platform.addPermissionlessValidator` (permissionless staking)
|
||||
- [ ] Verify new validator bootstraps from existing state
|
||||
- [ ] Verify new validator begins participating in consensus
|
||||
- [ ] Remove a validator via unstaking (wait for stake period to end or use testnet short periods)
|
||||
- [ ] Verify removed validator exits gracefully
|
||||
- [ ] Verify remaining validators continue producing blocks
|
||||
|
||||
### 1.11 Formal Verification
|
||||
|
||||
- [ ] Run Lean proofs for Quasar consensus safety and liveness
|
||||
- [ ] Run TLA+ model checker for consensus state machine
|
||||
- [ ] Run Tamarin prover for BLS+Corona security properties
|
||||
- [ ] Run Halmos for EVM precompile correctness (symbolic execution)
|
||||
- [ ] All proofs pass with zero counterexamples
|
||||
|
||||
---
|
||||
|
||||
## Phase 2: Mainnet Rehearsal (lux-dev-k8s, networkID=3)
|
||||
|
||||
Target: full mainnet simulation with real parameters for 72 hours.
|
||||
|
||||
### 2.1 Deployment
|
||||
|
||||
- [ ] Update LuxNetwork CRD (devnet section): `validators: 21`, `image.tag: v1.24.11`
|
||||
- [ ] Generate 21 staking key pairs, store in KMS (`lux-infra/devnet/staking/`)
|
||||
- [ ] Use mainnet genesis parameters (networkID=3, but same tokenomics, same stake amounts)
|
||||
- [ ] Apply `max.json` profile
|
||||
- [ ] Deploy via PaaS
|
||||
- [ ] Verify all 21 pods healthy
|
||||
|
||||
### 2.2 Real Staking Parameters
|
||||
|
||||
- [ ] Configure minimum validator stake: 1M LUX
|
||||
- [ ] Configure minimum delegator stake: 25K LUX
|
||||
- [ ] Configure max delegation ratio: 10x
|
||||
- [ ] Configure NFT staking tiers (Genesis 500K/2x, Pioneer 750K/1.5x, Standard 1M/1x)
|
||||
- [ ] Verify combined staking logic: NFT value + delegation + staked >= 1M
|
||||
- [ ] Verify B-chain validators require 100M LUX + KYC
|
||||
|
||||
### 2.3 72-Hour Soak Test
|
||||
|
||||
- [ ] Start clock. Record block height and timestamp.
|
||||
- [ ] Continuous transaction load: 50 TPS sustained
|
||||
- [ ] Monitor: CPU, memory, disk, network per node (Prometheus + Grafana via PaaS)
|
||||
- [ ] Monitor: consensus latency p50/p95/p99
|
||||
- [ ] Monitor: block production rate (target: 1 block per 2s)
|
||||
- [ ] Monitor: peer count stability (all 21 connected)
|
||||
- [ ] Monitor: no OOMKills, no pod restarts, no crashloops
|
||||
- [ ] At hour 24: rolling restart of 5 validators (verify zero downtime)
|
||||
- [ ] At hour 48: simulate network partition (isolate 7 nodes), verify chain halts (< 2/3 online)
|
||||
- [ ] Restore partition, verify chain resumes within 30s
|
||||
- [ ] At hour 72: record final block height, calculate actual vs expected blocks
|
||||
- [ ] Pass criteria: zero consensus faults, zero data loss, <1% block time variance
|
||||
|
||||
### 2.4 Security Audit
|
||||
|
||||
- [ ] External security audit firm engaged (Red team)
|
||||
- [ ] Audit scope: consensus, EVM, precompiles, staking, slashing, P2P networking
|
||||
- [ ] Audit result: 0 critical findings, 0 high findings
|
||||
- [ ] All medium findings remediated or accepted with documented risk
|
||||
- [ ] Audit report signed and archived
|
||||
|
||||
### 2.5 Bridge / Teleport (B-Chain + T-Chain)
|
||||
|
||||
- [ ] Deploy MPC threshold signing (5 nodes, threshold 3) in `lux-mpc` namespace
|
||||
- [ ] Deploy bridge UI and API in `lux-bridge` namespace
|
||||
- [ ] Verify CGGMP21 keygen: 5 parties generate shared key
|
||||
- [ ] Verify threshold signing: 3-of-5 produces valid signature
|
||||
- [ ] Test cross-chain transfer: lock on source chain, mint on Lux
|
||||
- [ ] Test reverse: burn on Lux, unlock on source chain
|
||||
- [ ] Verify MPC API at `mpc-api.lux.network` responds
|
||||
- [ ] Verify bridge handles partial MPC node failure (2 down, 3 still sign)
|
||||
|
||||
### 2.6 DEX (D-Chain + Precompiles)
|
||||
|
||||
- [ ] Deploy DEX precompile PoolManager (LP-9010) -- already active from genesis
|
||||
- [ ] Deploy DEX Router precompile (LP-9012) -- already active from genesis
|
||||
- [ ] Deploy off-chain CLOB matching engine
|
||||
- [ ] Create liquidity pool via precompile
|
||||
- [ ] Execute swap via router precompile
|
||||
- [ ] Verify AMM pricing matches expected curve
|
||||
- [ ] Verify flash loan execution and repayment
|
||||
- [ ] Test CLOB: place limit order, verify fill
|
||||
- [ ] Verify DEX on lux.exchange frontend connects to devnet
|
||||
|
||||
---
|
||||
|
||||
## Phase 3: Mainnet Launch (lux-k8s, networkID=1)
|
||||
|
||||
Target: production network with real value.
|
||||
|
||||
### 3.1 Pre-launch
|
||||
|
||||
- [ ] All Phase 1 items passed
|
||||
- [ ] All Phase 2 items passed
|
||||
- [ ] Security audit sign-off received
|
||||
- [ ] Formal verification suite green
|
||||
- [ ] Legal review complete (terms of service, validator agreements)
|
||||
- [ ] Incident response runbook written and tested
|
||||
|
||||
### 3.2 Genesis Ceremony
|
||||
|
||||
- [ ] Final genesis config reviewed: `genesis/configs/mainnet/genesis.json` (networkID=1)
|
||||
- [ ] Genesis startTime confirmed: 2025-12-12T21:06:51Z
|
||||
- [ ] Initial allocations verified (500M initial + unlock schedule)
|
||||
- [ ] All 5 bootstrapper IPs confirmed reachable on port 9631
|
||||
- [ ] Genesis hash computed and published to lux.network
|
||||
- [ ] Genesis block signed by founding validators
|
||||
|
||||
### 3.3 Validator Onboarding
|
||||
|
||||
- [ ] Update LuxNetwork CRD (mainnet section): `validators: 21`, `image.tag: v1.24.11`
|
||||
- [ ] Scale from 5 current validators to 21
|
||||
- [ ] Generate 16 new staking key pairs in KMS (`lux-infra/mainnet/staking/`)
|
||||
- [ ] Update bootstrappers.json with all 21 validator endpoints
|
||||
- [ ] Deploy via PaaS with rolling update strategy
|
||||
- [ ] Verify all 21 validators healthy and in consensus
|
||||
- [ ] Publish validator onboarding guide for external operators
|
||||
- [ ] Open permissionless staking after initial stabilization period
|
||||
|
||||
### 3.4 Public RPC Endpoints
|
||||
|
||||
- [ ] Deploy KrakenD API gateway in `lux-gateway` namespace
|
||||
- [ ] Configure rate limiting per IP and per API key
|
||||
- [ ] Configure Cloudflare DNS (proxied, full SSL):
|
||||
- `api.lux.network` -> gateway (C-chain + P-chain + X-chain RPC)
|
||||
- `ws.lux.network` -> gateway (WebSocket subscriptions)
|
||||
- [ ] Verify `eth_chainId` returns `0x17871` (96369)
|
||||
- [ ] Verify `net_version` returns `96369`
|
||||
- [ ] Verify RPC endpoints handle 10K req/s without degradation
|
||||
- [ ] Verify WebSocket subscriptions for `newHeads`, `logs`, `pendingTransactions`
|
||||
|
||||
### 3.5 Explorer Deployment
|
||||
|
||||
- [ ] Deploy explorer (luxfi/explorer) in `lux-explorer` namespace (already has manifests for 5 chains)
|
||||
- [ ] Configure for C-chain (chainId 96369)
|
||||
- [ ] Configure indexers for all active chains
|
||||
- [ ] Configure Cloudflare DNS: `explore.lux.network`
|
||||
- [ ] Verify block display, transaction search, contract verification
|
||||
- [ ] Deploy exchange frontend: `lux.exchange`
|
||||
|
||||
### 3.6 Bridge Activation
|
||||
|
||||
- [ ] Deploy MPC production cluster (5 nodes, threshold 3)
|
||||
- [ ] Generate production MPC keys (CGGMP21 keygen ceremony)
|
||||
- [ ] Store MPC key shares in KMS (`lux-infra/mainnet/mpc/`)
|
||||
- [ ] Deploy bridge contracts on supported chains (ETH, BNB, Polygon, Arbitrum, Base, Optimism)
|
||||
- [ ] Deploy bridge UI at bridge domain
|
||||
- [ ] Configure Cloudflare DNS
|
||||
- [ ] Enable deposits (one chain at a time, small limits first)
|
||||
- [ ] Monitor for 24h, then raise limits
|
||||
|
||||
### 3.7 Post-Launch Monitoring
|
||||
|
||||
- [ ] Prometheus + Grafana dashboards live (via PaaS o11y stack)
|
||||
- [ ] Alerts configured:
|
||||
- Validator down (any pod not Ready for >5min)
|
||||
- Consensus stall (no new block for >30s)
|
||||
- Peer count drop (any node <15 peers)
|
||||
- Memory usage >80% of limit
|
||||
- Disk usage >70%
|
||||
- Error rate >1% on RPC endpoints
|
||||
- [ ] On-call rotation established
|
||||
- [ ] Runbook covers: validator restart, chain halt recovery, emergency upgrade, key rotation
|
||||
|
||||
---
|
||||
|
||||
## Port Reference
|
||||
|
||||
| Network | HTTP | Staking | Metrics |
|
||||
|---------|------|---------|---------|
|
||||
| Mainnet | 9630 | 9631 | 9090 |
|
||||
| Testnet | 9640 | 9641 | 9090 |
|
||||
| Devnet | 9650 | 9651 | 9090 |
|
||||
|
||||
## Chain IDs
|
||||
|
||||
| Chain | Mainnet | Testnet | Devnet |
|
||||
|-------|---------|---------|--------|
|
||||
| C-Chain | 96369 | 96368 | 96370 |
|
||||
| Zoo EVM | 200200 | 200201 | 200202 |
|
||||
| Hanzo EVM | 36963 | 36964 | 36964 |
|
||||
| SPC EVM | 36911 | 36910 | 36912 |
|
||||
| Pars EVM | 494949 | 7071 | 494951 |
|
||||
|
||||
## File References
|
||||
|
||||
| What | Path |
|
||||
|------|------|
|
||||
| Node source | `~/work/lux/node/` |
|
||||
| Genesis configs | `~/work/lux/genesis/configs/{mainnet,testnet,devnet}/` |
|
||||
| Chain configs | `~/work/lux/genesis/configs/chain-configs/` |
|
||||
| K8s manifests | `~/work/lux/universe/k8s/` |
|
||||
| Validator CRD | `~/work/lux/universe/k8s/lux-k8s/validators/statefulset.yaml` |
|
||||
| Testnet StatefulSet | `~/work/lux/universe/k8s/lux-test-k8s/testnet/statefulset.yaml` |
|
||||
| Node profiles | `~/work/lux/node/config/profiles/{standard,max}.json` |
|
||||
| Tokenomics config | `~/work/lux/node/config/tokenomics.go` |
|
||||
| GPU config | `~/work/lux/node/config/gpu.go` |
|
||||
| Health/consensus params | `~/work/lux/node/config/health.go` |
|
||||
| Network registry | `~/work/lux/universe/NETWORKS.yaml` |
|
||||
@@ -158,6 +158,370 @@ charge less.
|
||||
- Relay (R-Chain): `~/work/lux/relay/vm/feegate.go` (re-exported by `~/work/lux/chains/relayvm/`)
|
||||
- Graph (G-Chain): `~/work/lux/chains/graphvm/feegate.go` (read-only; NoUserTxPolicy)
|
||||
|
||||
## C-Chain tx-fee routing — RewardManager to DAO Safe (P-Chain: NO CHANGE)
|
||||
|
||||
Owner tokenomics pivoted: **100% of C-Chain tx fees accrue to the chain's DAO Gov
|
||||
Safe** via the existing `rewardmanager` precompile (C-Chain only). This needs **no
|
||||
P-Chain change** — routing is `GetCoinbaseAt` → reward address on the C-Chain. See
|
||||
`~/work/lux/evm/LLM.md` → "C-Chain Tx-Fee Routing — RewardManager". The P-Chain
|
||||
`feeRewardPool` fold-in below is **NOT built** (design-only, superseded); no
|
||||
`vms/platformvm/state` change was made.
|
||||
|
||||
<details><summary>Superseded design — 50/50 burn + P-Chain staking-reward fold (dormant option)</summary>
|
||||
|
||||
If the DAO ever chooses an in-protocol 50/50 split, the C-Chain half exists (dormant,
|
||||
`FeeSplitTimestamp` gated off) and the P-Chain fold-in would be: system-triggered epoch
|
||||
export of the C-Chain vault C→P → persisted `feeRewardPool` in `vms/platformvm/state`
|
||||
(mirror the `accruedFees` singleton, upgrade-safe) → pro-rata payout at
|
||||
`vms/platformvm/txs/executor/proposal_tx_executor.go` `rewardValidatorTx` (~line 285),
|
||||
unified into `PotentialReward`, NO second mint → decrement `currentSupply` by the epoch
|
||||
burn. Model R1 (move-not-mint), conservation-exact; R2 (burn+re-mint) rejected.
|
||||
</details>
|
||||
|
||||
## v1.36.12 fleet rollout — durable rejoin fix + RewardManager→DAO Safe (IN PROGRESS 2026-07-15)
|
||||
|
||||
Rolling the durable rejoin fix (node `63f61429d1`) across all Lux nets, gated
|
||||
devnet→testnet→mainnet, + activating RewardManager fees. Two hard facts were found
|
||||
on the devnet canary that change the naive "swap image" plan:
|
||||
|
||||
**BLOCKER (fixed in v1.36.12): published `node:v1.36.11` (digest `c3cf92a6`) cannot
|
||||
run ANY EVM chain.** Its baked VM plugins were built against a stale `luxfi/api`:
|
||||
C-Chain EVM from `luxfi/evm@v1.104.8` and D-Chain dexvm from `luxfi/dex@v1.5.15`
|
||||
both resolve `api v1.0.15`; the node pins `api v1.0.16`, which APPENDED
|
||||
`InitializeResponse.Capabilities` (Quasar-export handshake, api `1f2dc5a`). Node
|
||||
decodes the field, stale plugins never encode it → `vms/rpcchainvm/zap/client.go`
|
||||
fails every EVM `Initialize` with `zap decode initialize response: unexpected EOF`.
|
||||
Native VMs (P/X/Q) unaffected. **Fix = v1.36.12** (this repo, tag pushed, ARC docker
|
||||
build run 29381442539): `EVM_VERSION v1.104.8→v1.104.9`, force `api@v1.0.16` in the
|
||||
dexvm build stage; `CHAINS_REF=v1.7.6` was already v1.0.16. Node binary unchanged
|
||||
(still the durable fix). api bump is code-free for plugins (`chains v1.7.4→v1.7.5`
|
||||
adopted it go.mod-only). **Roll v1.36.12, NOT v1.36.11.** (Also: `api 1f2dc5a` added
|
||||
`Capabilities` WITHOUT bumping `version.RPCChainVMProtocol` (42) → skew is invisible
|
||||
at handshake, only fails at Initialize decode. Consider bumping the protocol next
|
||||
api-wire change so skews fail fast.)
|
||||
|
||||
**MIGRATION: v1.36.2→v1.36.x is a P-Chain codec change (linearcodec→ZAP-native),
|
||||
one-time DB wipe + re-bootstrap.** v1.36.11/12 cannot read a v1.36.2 P-Chain zapdb
|
||||
(`loadMetadata: feeState: zap: invalid magic bytes`; `state_commit.go:116` "database
|
||||
must be wiped"). Recovery = wipe `/data/db`+`/data/chainData`, re-bootstrap from
|
||||
peers. **Cross-version bootstrap (v1.36.11 node ← v1.36.2 peers) is PROVEN working**
|
||||
(devnet luxd-1: P/X re-bootstrapped from the 4 v1.36.2 peers). Devnet startup got a
|
||||
marker-gated one-time wipe (`/data/.zap-native-migrated`): absent→wipe+set marker,
|
||||
present→NO wipe (the durable-fix no-wipe restart path). mainnet/testnet/zoo use
|
||||
`startup.sh` which already has `.wipe-cchain` (C-Chain only) + `.allow-bootstrap`
|
||||
(flips skip-bootstrap=false + EVM state-sync); for the codec migration the P-Chain
|
||||
zapdb (`/data/db`) must also be cleared. **Mainnet C-Chain is 1.08M blocks → MUST
|
||||
enable EVM state-sync for the re-sync (full replay is too slow); native VMs are tiny.**
|
||||
|
||||
**Durable fix (`63f61429d1`):** discriminator for keeping the staked beacon set is
|
||||
SYBIL-PROTECTION, not `--skip-bootstrap`. So a behind validator on a sybil-protected
|
||||
net catches up from peers even with `--skip-bootstrap=true` (which prod hardcodes),
|
||||
no wipe. Devnet added `--skip-bootstrap=true` to the inline cmd to exercise this.
|
||||
|
||||
**RewardManager (C-Chain precompile, per-net `cchain-upgrade.json` → append one
|
||||
`precompileUpgrades` entry, dated `blockTimestamp`):** proven testnet shape is
|
||||
`{"rewardManagerConfig":{"blockTimestamp":<ts>,"adminAddresses":["<admin>"],
|
||||
"initialRewardConfig":{"rewardAddress":"<reward>"}}}`. Reward addr = coinbase; 100%
|
||||
fees land there, blackhole `0x0100…00` goes flat. Addresses: **testnet ALREADY LIVE**
|
||||
(reward `0xEAbCC110fAcBfebabC66Ad6f9E7B67288e720B59`, admin `0x9011…94714`); **mainnet**
|
||||
reward+admin = DAO Gov Safe `0x8E29b816c6C35b13cE1ff68D33E245C2bda8ac3D`; **zoo**
|
||||
reward `0x229599f227231d8C90fcF1a78589F5DC4b7A6962`; **devnet** reward
|
||||
`0x8d5081153aE1cfb41f5c932fe0b6Beb7E159cF84` (idx2), admin `0x9011…94714` (idx0).
|
||||
Source ConfigMaps: devnet `luxd-chain-upgrades/cchain-upgrade.json`; mainnet+testnet
|
||||
`luxd-startup/cchain-upgrade.json`; zoo `zood-mv-genesis/upgrade.json` (`--upgrade-file`).
|
||||
|
||||
**Rollout levers (lux-operator is scaled 0/0 — sts/cm are the live source of truth;
|
||||
CRs are STALE, do not scale operator up mid-roll):** ports devnet 9650 / testnet 9640
|
||||
/ mainnet 9630 / zoo 9630; RPC path `/v1/bc/C/rpc`; container `luxd` (`zood` on zoo).
|
||||
Devnet uses an inline generated cmd; testnet/mainnet/zoo use `/scripts/startup.sh`.
|
||||
**Zoo `zood-mv` trap: RollingUpdate + hardcoded `--skip-bootstrap=true` with NO
|
||||
`.allow-bootstrap` gate → switch to OnDelete BEFORE rolling.** Lux sts are OnDelete.
|
||||
Master funded key = LUX_MNEMONIC (secret `lux-deployer`) idx0 `0x9011…94714`;
|
||||
`genesis/cmd/derivekey -mnemonic "$M"` (path m/44'/9000'/0'/0/i, `CGO_ENABLED=0`).
|
||||
|
||||
**Per-node roll protocol (ALL nets, one at a time, NEVER 2 mainnet down — quorum
|
||||
4/5):** set sts image v1.36.12 (+ rewardManager cm edit) → delete ONE pod → WAIT
|
||||
until it is back at **TIP HEIGHT matching the others** (NOT pod-Ready; a wedged node
|
||||
false-reports Ready) AND C-Chain serves RPC → only then the next. If any node fails
|
||||
to return to tip, STOP that net and report.
|
||||
|
||||
**State at pause:** v1.36.12 tag pushed + ARC build dispatched (run 29381442539).
|
||||
Devnet sts = v1.36.11 + skip-bootstrap + wipe-marker; luxd-1 migrated (P/X up on
|
||||
v1.36.11, C-Chain down = the plugin bug → will heal on v1.36.12); luxd-0/2/3/4 still
|
||||
v1.36.2 healthy (devnet C-Chain 4/5). Nothing rolled on testnet/mainnet/zoo. NEXT:
|
||||
when v1.36.12 image is ready → set devnet sts image v1.36.12, delete luxd-1, confirm
|
||||
C-Chain inits + reaches tip; then finish devnet (durable-fix proof + RewardManager),
|
||||
then gated testnet→mainnet→zoo.
|
||||
|
||||
## Crash-boot recovery armor + upstream delta verdict (vms/proposervm, test-only, 2026-07-28)
|
||||
|
||||
**Upstream review (avalanchego master `bcc851822d..c5d3c8aafe`, 6 commits): ZERO code
|
||||
ports.** grpc bump (no named bug; would cascade through luxfi/vm), README typo, typed
|
||||
sync-client scaffolding (client-side only, no serving handlers even upstream; our sync
|
||||
direction is ZAP-native — reference for task #66 only), a Firewood `debug_intermediateRoots`
|
||||
enabler (our tracers API is `.disabled`, twice N/A), and two streaming-VM-only mempool
|
||||
guards whose failure modes we already bracket (`miner/worker.go:62 targetTxsSize=1800KiB`
|
||||
build cap + txpool `ErrGasLimit`/128KB caps under the 2MiB wire cap). **Nothing in the
|
||||
delta touches proposervm — the open `vm.go:380` preferred-fetch failure gets no upstream
|
||||
help.** One upstream BRANCH does touch proposervm — `containerman17/proposervm-dedup-capability`
|
||||
(+72 vm.go): inner-bytes dedup in the block store plus an extra boot-repair arm for the
|
||||
unclean-shutdown window where the outer index lands above the inner survivor (the very
|
||||
window `OuterCommittedInnerNot` below pins) — storage-layer work, not the build-path
|
||||
preferred fetch, so it changes nothing about `vm.go:380` either. What WAS worth taking is
|
||||
their recovery-test discipline, ported as:
|
||||
|
||||
**`vm_crashboot_test.go`** — copy the COMMITTED bytes out from under a RUNNING proposervm
|
||||
(no Shutdown), boot a SECOND, cold VM over the copy (repair + metadata, Initialize order),
|
||||
assert source-equality (finality pointer, fork height, every height's envelope openable
|
||||
cold) and then BUILD on the recovered tip (outer parent == recovered envelope, inner
|
||||
parent == its inner block — the errInnerParentMismatch invariant from a cold boot).
|
||||
Matrix: nothing-accepted / first-accept / longer run / copy-while-source-runs-on, plus
|
||||
`OuterCommittedInnerNot`: the one crash window the accept path leaves open
|
||||
(`acceptPostForkBlock` commits BEFORE the inner accept) must boot via the roll-back arm
|
||||
and re-propose. Harness seams added in height_lag_repro_test.go (`testVMOnBase`,
|
||||
`acceptRangeThroughProposervm`). **Negative control executed**: deleting the
|
||||
`vm.db.Commit()` from `acceptPostForkBlock` fails every persistence-bearing scenario
|
||||
(4 of 6) — the armor bites on flush-order regressions, not just on green paths.
|
||||
|
||||
## v1.36.35 — the certified-descendant false halt + the plugin-killing map fatal (devnet 96367, 2026-07-28)
|
||||
|
||||
> Shipped as v1.36.35, not v1.36.34: the v1.36.34 tag inherited a build break that
|
||||
> `011e9bf99d` ("deps: drop go.sum lines that disagree with the checksum log") had
|
||||
> already pushed to main — it bumped `zap-proto/http` from a pseudo-version to v0.3.0,
|
||||
> whose `Server.Handler` is a `fasthttp.RequestHandler` and whose `NewTransport` is now
|
||||
> `Dial(network, addr)`, so `server/http/zap_listener.go` no longer compiled. **main was
|
||||
> unbuildable from that commit until this one.** Repaired here by bridging the one
|
||||
> net/http handler chain with `fasthttpadaptor.NewFastHTTPHandler` (the two transports
|
||||
> stay behaviourally identical — only the wire encoding differs) and moving the
|
||||
> round-trip test onto the fasthttp request/response pair. v1.36.34 produced no image
|
||||
> and its tag was deleted.
|
||||
|
||||
Rolling devnet to v1.36.33 fixed the build→verify-fail→drop loop and unmasked two
|
||||
DIFFERENT failures. Both are fixed here; each has a regression test that fails before
|
||||
and passes after.
|
||||
|
||||
**P0-1 — five validators `os.Exit(1)` on a benign state.** Each devnet node hit, once:
|
||||
|
||||
```
|
||||
error VM accepted head is CONSENSUS-CERTIFIED and conflicts with the newly finalized
|
||||
block — refusing to orphan it orphanedHeight=1364
|
||||
fatal SetPreference would orphan a CONSENSUS-CERTIFIED block — refusing (fail-closed)
|
||||
error="cannot orphan finalized block at height: 1364 to common block at height: 1363"
|
||||
```
|
||||
|
||||
at three distinct height pairs (1258/1259, 1363/1364, 1364/1365), ALWAYS with
|
||||
`certified = head − 1`, with every surviving node holding byte-identical blocks at all
|
||||
five heights — no fork anywhere. (The "1168/1169" pair in the original report never
|
||||
appears in any fatal line; those two blocks are a normal parent/child present on all
|
||||
live nodes.)
|
||||
|
||||
Two defects in `luxfi/consensus`, one crash — fixed in **consensus v1.36.12**:
|
||||
|
||||
- *Producer.* `acceptWithCertCore` releases `t.mu` across every VM call-out, then steers
|
||||
the VM with its STALE local `blockID`. A finalize that completed in that window has
|
||||
already advanced the ledger AND the EVM to `blockID+1`, so the steer is BACKWARDS and
|
||||
the EVM's accepted-irreversibility guard (`evm/core/blockchain.go:1987`,
|
||||
`commonBlock < lastAccepted`) correctly refuses it. **That guard is right and is
|
||||
untouched.** Now steers at the live build anchor (`PreferredBuildTip` →
|
||||
`ledger.BuildAnchor`), which the accept ordering (ApplyCert BEFORE VM.Accept) keeps at
|
||||
or above the VM's own accepted head. Same value the build path already uses.
|
||||
- *Classifier.* `reconcileVMToCertified` asked only "is the head the ledger's certified
|
||||
canonical at ITS OWN height?" — trivially true for every healthy node whose head is
|
||||
certified — and called that a two-blocks-at-one-height double-finalization. It never
|
||||
established that `certified` was at that same height. The ledger holds one canonical
|
||||
per height along one contiguous chain, so when both are certified at their own heights
|
||||
they lie on that one chain and the head merely DESCENDS from the target: nothing is
|
||||
orphaned. **The fail-closed halt is not weakened** — it now fires on the state that is
|
||||
actually unsafe (steering off a certified head onto a block our own ledger does not
|
||||
certify at its height).
|
||||
|
||||
Direction: NEITHER roll the head back NOR certify forward. The VM head is legitimately
|
||||
ahead and already CONTAINS the certified block; `FinalityLedger.BuildAnchor` already
|
||||
documents `head > certified` as the designed state, and rolling back is exactly what
|
||||
`blockchain.go:1987` exists to refuse. The correct action is no action — plus not issuing
|
||||
the backwards steer at all.
|
||||
|
||||
**P0-2 — the EVM plugin process dies and never comes back.** devnet luxd-1:
|
||||
|
||||
```
|
||||
fatal error: concurrent map read and map write
|
||||
vm/components/chain.(*State).getCachedBlock state.go:216
|
||||
vm/components/chain.(*State).ParseBlock state.go:267
|
||||
evm/plugin/evm.(*VM).ParseBlock vm.go:340
|
||||
vm/rpc.(*zapVMServer).handleParseBlock vm_server_zap.go:477
|
||||
```
|
||||
|
||||
`chain.State` was written against avalanchego's contract that the consensus engine holds
|
||||
the chain lock across every VM call. The ZAP VM server does NOT reinstate it — it
|
||||
dispatches ParseBlock/GetBlock and the Verify/Accept/Reject wrappers concurrently.
|
||||
`verifiedBlocks` (plain map) and `lastAcceptedBlock` (pointer) are the only State that is
|
||||
not self-synchronising; every `cache.Cacher` carries its own mutex. Fixed in **vm v1.3.3**
|
||||
by giving State one RWMutex for exactly those two, never held across a call into the
|
||||
inner VM. A Go map fatal is unrecoverable: it kills the plugin, **luxd survives and keeps
|
||||
answering `info.getNodeVersion` while its chain is gone** — pod-Ready and `/v1/health`
|
||||
both stay green — and there is no self-heal.
|
||||
|
||||
**Devnet roll result (10:23–10:45Z).** All five pods on v1.36.35, `restarts=0` on every one
|
||||
for 20+ minutes. Both fixed defects are GONE fleet-wide: `CONSENSUS-CERTIFIED` fatal = 0
|
||||
(previously all five died within minutes), `concurrent map` = 0. luxd-1, whose C-Chain had
|
||||
been dead ~45 min with no self-heal, came back at tip parity on first boot; luxd-3, stuck at
|
||||
1524, caught up immediately. A transaction of ours got a receipt with identical status,
|
||||
blockHash and resulting balance on all five nodes (`0xcb5e9a06…`, block 1636, status 0x1).
|
||||
|
||||
**NOT accepted — a THIRD, pre-existing defect blocks five-way parity.** Two nodes (luxd-2 at
|
||||
1789, luxd-4 at 1825) freeze their tip while 0/1/3 advance in lockstep, emitting
|
||||
|
||||
```
|
||||
error unexpected build block failure error="not found"
|
||||
reason="failed to fetch preferred block; no distinct last-accepted fallback"
|
||||
```
|
||||
|
||||
from `vms/proposervm/vm.go:380`. That branch is reached when the preferred block is
|
||||
unfetchable AND last-accepted is either unreadable or the same id — a local storage/index
|
||||
condition, not a steering choice. It is **NOT a regression from this release**: the identical
|
||||
line appears on binaries built long before it — mainnet luxd-1 on **v1.36.2** (2,223
|
||||
occurrences, and that is the one mainnet node still producing) and testnet luxd-3 on
|
||||
**v1.36.24** (35,693). It is also survivable: the stalled node keeps VOTING, so quorum holds
|
||||
and the chain keeps finalizing (devnet reached 1913 with two nodes frozen), and devnet luxd-1
|
||||
self-recovered from it once (1609 → 1634). Left unfixed and unchained-to — it needs its own
|
||||
diagnosis at the proposervm layer.
|
||||
|
||||
**Quorum arithmetic (reported, not changed).** Devnet and testnet both run
|
||||
`--consensus-sample-size=5 --consensus-quorum-size=4`. With only 3 live C-Chains the
|
||||
quorum is arithmetically unreachable; devnet demonstrated both directions in one session
|
||||
(pinned at 1378 on 3 live, 1378→1395→1396 the moment luxd-4 restored a 4th). This is a
|
||||
config value, not a code defect, and lowering it lowers the safety margin — left as is.
|
||||
|
||||
### Testnet 96368 roll (15:32–16:00Z) — accepted, after two blockers the devnet roll never hit
|
||||
|
||||
Testnet was frozen at **1779** with only three live C-Chains, below `--consensus-quorum-size=4`
|
||||
(`ceil(2·5/3)+1`), so no block could be accepted. luxd-1 and luxd-4 had no C-Chain at all —
|
||||
`/v1/bc/C/rpc` 404 — on `failed to repair accepted chain by height: proposervm finality index
|
||||
(height 1453 / 1463) is BEHIND the inner VM tip (height 1491)`. v1.36.35 turns that fatal into
|
||||
a repair, and it worked on the first boot of each: `proposervm finality index REBUILT from the
|
||||
local block store — index and inner tip agree fromHeight=1453 toHeight=1491`. The freeze broke
|
||||
the instant a **fourth** C-Chain came up. Final: five nodes on v1.36.35, every binary
|
||||
self-reporting `luxd/1.36.35`, `1779 → 1888` and climbing, tips in exact agreement, and one
|
||||
real transaction (`0x333d5bbd…`, block `0x728`) returning `status=0x1` with **identical
|
||||
blockHash `0x07fd0c68…` and `gasUsed=0x5208` on all five nodes**. α was NOT lowered.
|
||||
|
||||
Two defects had to be fixed first. Both are invisible on devnet and both apply to any fleet.
|
||||
|
||||
**1. The RLP startup import is fatal on re-run — it kills the C-Chain on EVERY boot.**
|
||||
Testnet's startup script passes `--import-chain-data` on every boot, relying on
|
||||
`isNothingToImportError` to make re-importing an already-imported chain a no-op. That guard
|
||||
only ever existed on `luxfi/evm` `hotfix/v1.104.9` (commit `c58d307e`, tags
|
||||
`v1.104.9-hotfix.2/3/4`); `git merge-base --is-ancestor c58d307e main` = **false**. Only the
|
||||
*other* half of that commit was forward-ported. So images built from evm main die with
|
||||
`startup import failed: no blocks imported (parsed=0)`. Proven from the two plugin binaries
|
||||
in-cluster, with a positive control:
|
||||
|
||||
| string in `plugins/mgj786NP7…` | v1.36.24 | v1.36.35 |
|
||||
|---|---|---|
|
||||
| `ImportChain: resuming from current head` | 1 | 1 ← control |
|
||||
| `nothing to import` | 1 | **0** ← the guard |
|
||||
| `no blocks imported (parsed=` | 1 | 1 |
|
||||
|
||||
Fixed **twice, on purpose**: the guard is restored in `luxfi/evm` main (with
|
||||
`startup_import_idempotency_test.go` locking the contract), and the flag is now gated on a
|
||||
per-PVC sentinel in `universe/k8s/lux-testnet/luxd-startup.yaml` — a completed one-time
|
||||
migration must not re-run forever. Sentinel pre-seeded on all five PVCs before the ConfigMap
|
||||
was patched. **Mainnet is NOT exposed**: its `luxd-startup` ConfigMap (39,719 bytes, contains
|
||||
`consensus-quorum-size` twice as a control) has zero `--import-chain-data` and no `.rlp` on disk.
|
||||
|
||||
**2. 🚨 The `luxfi/vm` map-race fix never reached the C-Chain.** node v1.36.35 bumped
|
||||
`luxfi/vm` to v1.3.3 for it, but the C-Chain is a **plugin built from `luxfi/evm`**, which
|
||||
still pinned **v1.3.1**. Read off the two binaries inside one v1.36.35 pod:
|
||||
|
||||
```
|
||||
/luxd/build/luxd github.com/luxfi/vm@v1.3.3
|
||||
/luxd/build/plugins/mgj786NP7… github.com/luxfi/vm@v1.3.1 ← verifies the blocks
|
||||
```
|
||||
|
||||
It fired on testnet luxd-0 five minutes after the roll: `fatal error: concurrent map writes`
|
||||
in `luxfi/vm@v1.3.1/components/chain/block.go:44 (*BlockWrapper).Verify` via
|
||||
`rpc/vm_server_zap.go:580 handleBlockVerify`. v1.3.3 is precisely the fix for that line — it
|
||||
takes `state.blocksLock` around `verifiedBlocks[blkID] = bw`, which v1.3.1 wrote unlocked from
|
||||
every concurrent ZAP RPC handler. `luxfi/evm` main is now on v1.3.3; **the next node image
|
||||
must be built after that bump, or this race ships again.**
|
||||
|
||||
⚠️ **The readiness probe cannot see this.** The plugin dies while luxd survives, so the pod
|
||||
stays `ready=true`, `restarts=0`, and `info.isBootstrapped(C)` keeps answering `true` while
|
||||
`eth_blockNumber` times out — a dead C-Chain still in the Service, the exact failure the probe
|
||||
was redesigned to catch. Only a per-node **tip** probe sees it. Recovery is a pod delete.
|
||||
|
||||
## v1.36.33 — the build→self-verify-fail→drop loop (devnet 96367 / testnet 96368, 2026-07-28)
|
||||
|
||||
**Symptom.** Every proposer built a block and then rejected the block it had just
|
||||
built, forever: `built block … height=1047` immediately followed by
|
||||
`built block failed verification — dropping error="inner parentID didn't match
|
||||
expected parent"`, 83–456 drops/min per node, accepted tip frozen two heights BELOW
|
||||
what the builder kept proposing (devnet tip 1045, builds 1047).
|
||||
|
||||
**Root cause (one line).** `buildChild` asked the inner VM for a block without first
|
||||
pointing the inner VM at the parent's inner block. The inner VM builds on ITS OWN
|
||||
head (`luxfi/evm` miner reads `bc.CurrentBlock()`); the verify path requires
|
||||
`child.innerBlk.Parent() == parent.innerBlk.ID()`. Two different pointers, one
|
||||
required equal to the other, nothing asserting it. The head drifts on its own:
|
||||
verifying a GOSSIPED block whose parent is the current head optimistically sets the
|
||||
head (`core/blockchain.go writeBlockAndSetHead → newTip → writeCanonicalBlockWithLogs`),
|
||||
and `VM.SetPreference` short-circuits on an unchanged outer preference so it never
|
||||
re-pushes the inner preference to drag the head back. Non-self-correcting by
|
||||
construction.
|
||||
|
||||
**Fix.** `VM.anchorInnerBuildParent` (vms/proposervm/vm.go) — one inner
|
||||
`SetPreference` at the point of use, called from BOTH build delegations
|
||||
(`postForkCommonComponents.buildChild`, `preForkBlock.buildChild`). On a healthy node
|
||||
the inner `setPreference` early-returns on `current.Hash() == block.Hash()`, so it is
|
||||
a lookup and no state change; when it fails, the head is provably not the parent's
|
||||
inner block, so refusing to build beats emitting a block we would drop.
|
||||
Regression proof: `vms/proposervm/build_inner_parent_test.go` (models the three evm
|
||||
head semantics — build-on-head, verify-advances-head, SetPreference-reorgs-head).
|
||||
|
||||
**NOT the cause, measured:** the P-Chain. `info.isBootstrapped{"chain":"P"}` = true on
|
||||
15/15 nodes and `platform.getHeight` = 0 on 15/15 **including mainnet**, whose built
|
||||
blocks also carry `pChainHeight=0`. `bootstrapped.message:["111…LpoYY"]` is the
|
||||
primary-network NET id (`chains/chains.go Nets.Bootstrapping` keys by net), not the
|
||||
P-Chain — the P-Chain's chain id prints `111…P` (`constants.PlatformChainID =
|
||||
ids.PChainID`, while `PrimaryNetworkID = ids.Empty`). The verify path DOES read
|
||||
pChainHeight before the parent check, but only as monotonicity
|
||||
(`childPChainHeight < parentPChainHeight`, and 0 < 0 is false, so it passes); every
|
||||
P-Chain-DEPENDENT validation — epoch, `GetCurrentHeight`, proposer window — is gated
|
||||
behind `consensusState == Ready` and sits AFTER the parent check. So `pChainHeight=0`
|
||||
cannot produce `errInnerParentMismatch`.
|
||||
|
||||
**Sibling failure modes on the same fleets (already fixed in 1.36.32, needs the roll):**
|
||||
outer index BEHIND the inner tip ⇒ `refusing to build`/boot repair
|
||||
(`height_backfill.go`, 7d2f01eb), and preferred-absent-locally ⇒ last-accepted
|
||||
fallback (`vm.go BuildBlock`). All three are the same invariant seen from three sides.
|
||||
|
||||
**Roll surface — measured 2026-07-28T07:5xZ, do not use the LuxNetwork CR.**
|
||||
`lux-operator` and `lux-operator-devnet` are **0/0** in `lux-system`, so nothing
|
||||
reconciles `luxnetworks.lux.cloud/luxd`; its tags are stale garbage (mainnet
|
||||
`v1.34.0`, testnet `v1.32.12` — v1.34.0 exists in no registry). The live image is on
|
||||
the **StatefulSet**, hand-maintained: mainnet `ghcr.io/luxfi/node:v1.36.2`
|
||||
(`kubectl-patch` 07-25T00:27:04Z), devnet `v1.36.25@sha256:ca497eff…`, testnet
|
||||
`v1.36.24@sha256:91e2542b…`, all three `updateStrategy: OnDelete`. Change the image in
|
||||
the universe manifest and apply, then delete one pod. Editing the CR and deleting a pod
|
||||
reboots it on the OLD image.
|
||||
|
||||
**Mainnet 96369 is NOT a clean control — 3 of 5 nodes have Mode B, invisibly.**
|
||||
luxd-0/3/4 `eth_blockNumber` = `0x10c1cf` (1098191, block ts 2026-07-24T15:46:19Z) and
|
||||
have not moved in 3+ days while luxd-1 mines (1098341, tx status 0x1, 07:58Z); luxd-2
|
||||
serves 404 (no C-Chain). Not a fork — 1098191 hashes identically on luxd-0 and luxd-1.
|
||||
3998 of luxd-0's last 4000 log lines are the same `built block … height=1098196`. The
|
||||
drop line is absent because the **binary** lacks it: `grep -c "built block failed
|
||||
verification" /luxd/build/luxd` = **0** on mainnet v1.36.2, **1** on devnet v1.36.25.
|
||||
`/v1/health` says `{"healthy":true,"error":"health reply encode failed"}` on the frozen
|
||||
node and the mining node alike — never gate on it, use tip parity.
|
||||
Two hazards for the roll: the 4 broken mainnet pods are exactly the ones on
|
||||
ControllerRevision `luxd-596857c9d6` (rev 147, kubectl-patch 07-25: GOMEMLIMIT=6GiB,
|
||||
mem limit 16Gi→12Gi, request 4Gi→7Gi) and the one mining node, luxd-1, is the only pod
|
||||
still on rev 144 — **deleting luxd-1 recreates it on the revision every other node
|
||||
broke on**. And `ghcr.io/luxfi/node:v1.36.2` has no git tag at all
|
||||
(`git ls-remote origin refs/tags/v1.36.2` → empty; v1.36.24/25 → present), so what
|
||||
mainnet runs is not reproducible from this repo.
|
||||
|
||||
## Essential Commands
|
||||
|
||||
### Release & build (canonical) — via platform.hanzo.ai, NOT GitHub Actions
|
||||
@@ -840,4 +1204,42 @@ v2 semantic differences worth knowing (these change wire shape):
|
||||
|
||||
---
|
||||
|
||||
## Housekeeping
|
||||
|
||||
Removed 6 generated write-ups / stale root artifacts (`LAUNCH_CHECKLIST.md`,
|
||||
`rename_app.sh`, `replace_imports.sh`, `gen_zoo_addr` binary, `.ci-status-check.md`,
|
||||
`.ci-trigger`) plus the 73MB `.claude/worktrees/` agent scratch tree. Release and
|
||||
launch state live in this file, `CHANGELOG.md`, `RELEASE.md`; chain IDs/ports in
|
||||
`~/work/lux/universe/NETWORKS.yaml` and `~/work/lux/genesis/configs/`.
|
||||
|
||||
---
|
||||
|
||||
*Last Updated*: 2026-06-06
|
||||
|
||||
## ⛔ v1.36.38 — DO NOT DEPLOY (superseded by v1.36.39)
|
||||
|
||||
`v1.36.38` (commit `bd2edc135f`, chunked ancestry descent) is **tagged but must not be
|
||||
deployed**. The tag is retained for provenance — do not delete it.
|
||||
|
||||
Defects, found in owner review after tagging:
|
||||
|
||||
1. **Bootstrap ancestry responses are not trust-boundary validated.** `nameFrontier`'s chunk
|
||||
loop adds every returned `BlockRef` to the global index before checking that the response
|
||||
contains the requested cursor, forms exactly one contiguous parent path, decreases in height
|
||||
by exactly one, is cycle-free, and carries no duplicate ID with differing metadata. Fix:
|
||||
a `VerifiedAncestryChunk{Root, Blocks, Next, Complete}` validated as a unit *before* any ref
|
||||
reaches the index.
|
||||
|
||||
2. **The traversal deadline is internally inconsistent.** A single `Ancestry` request may take
|
||||
up to 12s while the entire multi-anchor walk is bounded to `bootstrapNamingTimeout = 3s`.
|
||||
A child request must never outlive its parent operation (e.g. 3s per request / 30s per
|
||||
attempt).
|
||||
|
||||
3. **Recovery still has a permanent maximum gap.** `bootstrapMaxNamingDepth = 32768` is a
|
||||
recoverability ceiling, not a per-attempt budget. Replace with `MaxBlocksPerAttempt` /
|
||||
`MaxBytesPerAttempt` / `MaxRequestsPerAttempt` / `AttemptTimeout` plus persisted
|
||||
`NamingProgress{Anchor, Cursor, Traversed, VerifiedRefs}`. On exhaustion: save the cursor and
|
||||
return incomplete, then resume from it. **Never translate "attempt budget exhausted" into
|
||||
`ErrNoBootstrapQuorum`.**
|
||||
|
||||
No image was ever built for this tag, so nothing is running it. Ship the above as `v1.36.39`.
|
||||
|
||||
@@ -7,8 +7,15 @@ CGO_ENABLED ?= 1
|
||||
FIPS_STRICT ?= 0
|
||||
|
||||
# Go 1.26 experimental features:
|
||||
# runtimesecret - zeroes stack/register state after secret.Do() for forward secrecy
|
||||
# runtimesecret - zeroes stack/register state after secret.Do() for forward secrecy.
|
||||
# It SIGSEGVs at startup under the WSL2 kernel (confirmed on go1.26.3 and go1.26.4), so enable
|
||||
# it only off-WSL; forward secrecy stays on for real Linux/macOS/production builds.
|
||||
WSL := $(shell grep -qiE 'microsoft|WSL' /proc/sys/kernel/osrelease 2>/dev/null && echo 1)
|
||||
ifeq ($(WSL),1)
|
||||
GOEXPERIMENT ?= none
|
||||
else
|
||||
GOEXPERIMENT ?= runtimesecret
|
||||
endif
|
||||
export GOEXPERIMENT
|
||||
|
||||
# FIPS 140-3 always enabled (required for blockchain/financial systems)
|
||||
|
||||
@@ -73,12 +73,6 @@ tasks:
|
||||
- task: generate-mocks
|
||||
- task: check-clean-branch
|
||||
|
||||
check-generate-protobuf:
|
||||
desc: Checks that generated protobuf is up-to-date (requires a clean git working tree)
|
||||
cmds:
|
||||
- task: generate-protobuf
|
||||
- task: check-clean-branch
|
||||
|
||||
check-go-mod-tidy:
|
||||
desc: Checks that go.mod and go.sum are up-to-date (requires a clean git working tree)
|
||||
cmds:
|
||||
@@ -101,10 +95,6 @@ tasks:
|
||||
- cmd: grep -lr -E '^// Code generated - DO NOT EDIT\.$' tests/load/c | xargs -r rm
|
||||
- cmd: go generate ./tests/load/c/...
|
||||
|
||||
generate-protobuf:
|
||||
desc: Generates protobuf
|
||||
cmd: ./scripts/protobuf_codegen.sh
|
||||
|
||||
ginkgo-build:
|
||||
desc: Runs ginkgo against the current working directory
|
||||
cmd: ./bin/ginkgo build {{.USER_WORKING_DIR}}
|
||||
|
||||
@@ -0,0 +1,107 @@
|
||||
// Copyright (C) 2019-2025, Lux Industries Inc. All rights reserved.
|
||||
// See the file LICENSE for licensing terms.
|
||||
|
||||
package chains
|
||||
|
||||
import (
|
||||
"context"
|
||||
"sync"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/luxfi/ids"
|
||||
"github.com/luxfi/log"
|
||||
version "github.com/luxfi/version"
|
||||
"github.com/luxfi/vm/chain"
|
||||
)
|
||||
|
||||
// recordingConnector is a chain.ChainVM that records the version it is handed on
|
||||
// Connected. Every other method comes from the embedded (nil) interface and is
|
||||
// never invoked by the connect path.
|
||||
type recordingConnector struct {
|
||||
chain.ChainVM
|
||||
|
||||
mu sync.Mutex
|
||||
called bool
|
||||
gotVersion *version.Application
|
||||
}
|
||||
|
||||
func (c *recordingConnector) Connected(_ context.Context, _ ids.NodeID, nodeVersion *chain.VersionInfo) error {
|
||||
c.mu.Lock()
|
||||
defer c.mu.Unlock()
|
||||
c.called = true
|
||||
c.gotVersion = nodeVersion
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *recordingConnector) Disconnected(context.Context, ids.NodeID) error { return nil }
|
||||
|
||||
// TestBlockHandlerConnectedWithVersionDeliversRealVersion is the regression
|
||||
// guard for RED CRITICAL #1 (C-Chain nil-version panic).
|
||||
//
|
||||
// Before the fix blockHandler.Connected forwarded connector.Connected(ctx,
|
||||
// nodeID, nil) — a hardcoded nil version. proposervm promotes Connected to the
|
||||
// inner C-Chain VM (coreth), whose state-sync peer tracker compares peer
|
||||
// versions; a nil version there dereferences nil (version.Application.Compare)
|
||||
// and PANICS a state-syncing node (a fresh join, or a validator rejoining after
|
||||
// falling behind — the launch's core invariant).
|
||||
//
|
||||
// The fix plumbs the REAL peer version through ConnectedWithVersion to the
|
||||
// connector. This test drives the real blockHandler with a real version and
|
||||
// asserts the connector receives that non-nil version — never nil.
|
||||
func TestBlockHandlerConnectedWithVersionDeliversRealVersion(t *testing.T) {
|
||||
require := require.New(t)
|
||||
|
||||
rc := &recordingConnector{}
|
||||
bh := newBlockHandler(
|
||||
nil, // BlockBuilder — unused by the connect path
|
||||
rc, // connector under test
|
||||
log.Noop(), // logger
|
||||
nil, // engine
|
||||
nil, // net
|
||||
nil, // msgCreator
|
||||
ids.Empty, // chainID
|
||||
ids.Empty, // networkID
|
||||
nil, // beacons
|
||||
ids.NodeID{}, // selfNodeID
|
||||
false, // expectsStakedBeacons
|
||||
)
|
||||
|
||||
nodeID := ids.GenerateTestNodeID()
|
||||
peerVersion := &version.Application{Name: "lux", Major: 1, Minor: 36, Patch: 27}
|
||||
|
||||
require.NoError(bh.ConnectedWithVersion(context.Background(), nodeID, peerVersion))
|
||||
|
||||
rc.mu.Lock()
|
||||
defer rc.mu.Unlock()
|
||||
require.True(rc.called, "connector.Connected must be invoked")
|
||||
require.NotNil(rc.gotVersion, "connector must receive a NON-nil version (coreth dereferences it in state-sync)")
|
||||
require.Equal("lux", rc.gotVersion.Name)
|
||||
require.Equal(1, rc.gotVersion.Major)
|
||||
require.Equal(36, rc.gotVersion.Minor)
|
||||
require.Equal(27, rc.gotVersion.Patch)
|
||||
}
|
||||
|
||||
// TestBlockHandlerConnectedDedupsButStillCarriesVersion confirms the version
|
||||
// survives the once-only dedup: the first (versioned) dispatch reaches the
|
||||
// connector; a duplicate is a no-op (not a nil-version overwrite).
|
||||
func TestBlockHandlerConnectedDedupsButStillCarriesVersion(t *testing.T) {
|
||||
require := require.New(t)
|
||||
|
||||
rc := &recordingConnector{}
|
||||
bh := newBlockHandler(nil, rc, log.Noop(), nil, nil, nil, ids.Empty, ids.Empty, nil, ids.NodeID{}, false)
|
||||
|
||||
nodeID := ids.GenerateTestNodeID()
|
||||
peerVersion := &version.Application{Name: "lux", Major: 1, Minor: 36, Patch: 27}
|
||||
|
||||
require.NoError(bh.ConnectedWithVersion(context.Background(), nodeID, peerVersion))
|
||||
// A duplicate connect (e.g. dispatched again per tracked network) must be a
|
||||
// no-op — never a second call that could clobber the stored version with nil.
|
||||
require.NoError(bh.ConnectedWithVersion(context.Background(), nodeID, nil))
|
||||
|
||||
rc.mu.Lock()
|
||||
defer rc.mu.Unlock()
|
||||
require.NotNil(rc.gotVersion, "the deduped duplicate must not overwrite the real version with nil")
|
||||
require.Equal(27, rc.gotVersion.Patch)
|
||||
}
|
||||
@@ -57,14 +57,28 @@ const (
|
||||
// tip, so a single (even >⅔-stake) validator cannot alone determine the frontier.
|
||||
// Capped at the beacon-set size for tiny networks.
|
||||
bootstrapMinAgreeingBeacons = 2
|
||||
// bootstrapNamingWindow bounds the ancestry the ANCESTOR-TOLERANT frontier tally fetches
|
||||
// per candidate anchor to resolve the bleeding-edge skew between honest beacons. On a live
|
||||
// chain that skew is tiny (the canary was ONE block: 2 producers at N, 1 at N+1), so a
|
||||
// single 256-block window covers it with enormous margin. A ⅔-common height more than this
|
||||
// far below the highest tip is not a healthy bleeding-edge split — the tally names nothing
|
||||
// (the loop then retries / fails safe), never a wrong block. Matches the consensus descent's
|
||||
// per-round fetch size.
|
||||
// bootstrapNamingWindow is the PER-FETCH ancestry chunk of the ANCESTOR-TOLERANT frontier
|
||||
// tally. Ancestry returns FULL BLOCKS, so one fetch must stay inside a network message —
|
||||
// this is a TRANSPORT bound, matching the consensus descent's per-round fetch size.
|
||||
//
|
||||
// It was previously ALSO doing two other jobs: the total ancestry budget, and a HEALTH
|
||||
// HEURISTIC ("a ⅔-common height more than this far below the highest tip is not a healthy
|
||||
// bleeding-edge split"). That heuristic is true for a LIVE chain and FALSE for a HALTED
|
||||
// one, where the skew between a straggler and a node that ran on alone is arbitrarily large
|
||||
// and perfectly healthy — no fork, just a stopped chain. Conflating the three WEDGED
|
||||
// mainnet 96369: responders were split 1098726 (1 node) / 1098191 (2 nodes), 1098191 IS an
|
||||
// ancestor of 1098726, and the ⅔-of-responder floor would have named it — but the gap was
|
||||
// 535 blocks, the single 256-block fetch never reached down far enough for the high tip to
|
||||
// vouch for it, and the tally named nothing on every retry, forever. Recovery from a halt
|
||||
// is exactly when this path matters most, and it was disabled precisely then.
|
||||
// The total budget is now maxNamingDepth; the health heuristic is gone.
|
||||
bootstrapNamingWindow = 256
|
||||
// bootstrapMaxNamingDepth is the TOTAL ancestry one anchor may be walked down, in
|
||||
// bootstrapNamingWindow-sized chunks. Purely a resource bound (with maxNamingAnchors and
|
||||
// bootstrapNamingTimeout): 32768 covers ~9h of 1s blocks of halt-skew, and the common
|
||||
// healthy case never fetches at all — a single tip clearing the floor takes the exact fast
|
||||
// path with zero fetches. Safety does NOT come from this number; see maxNamingDepth().
|
||||
bootstrapMaxNamingDepth = 32768
|
||||
// maxNamingAnchors bounds how many DISTINCT reported tips the ancestor-tolerant tally will
|
||||
// fetch ancestry for in one round. Honest beacons cluster on a handful of adjacent tips, so
|
||||
// this is never reached in practice; it caps the work a Byzantine swarm reporting many
|
||||
@@ -201,6 +215,19 @@ func (b *blockHandler) fullyConnectedBeacons(weights map[ids.NodeID]uint64, conn
|
||||
return external > 0 && len(connected) >= external
|
||||
}
|
||||
|
||||
// hasExternalBeacons reports whether the staked beacon set contains any validator OTHER than this
|
||||
// node. False for a self-only (single-validator) set — there is then no peer to sync from, so the
|
||||
// node's own tip IS the frontier (FrontierTip returns FrontierNoBeacons). The set is read from
|
||||
// P-chain STATE, not connectivity, so this is a TOPOLOGY fact (a genuine single-validator net),
|
||||
// never an eclipse artifact (an eclipse drops peers from `connected`, never from `weights`).
|
||||
func (b *blockHandler) hasExternalBeacons(weights map[ids.NodeID]uint64) bool {
|
||||
external := len(weights)
|
||||
if _, selfIsBeacon := weights[b.selfNodeID]; selfIsBeacon {
|
||||
external--
|
||||
}
|
||||
return external > 0
|
||||
}
|
||||
|
||||
// withSelfVote returns `replies` plus the node's OWN accepted frontier as a beacon reply — the
|
||||
// SELF-VOTE. The node is itself a beacon (selfNodeID in `weights`, the trust anchor) and knows its
|
||||
// own accepted tip (lastID) with certainty, so it vouches for it exactly as a connected peer's reply
|
||||
@@ -311,6 +338,21 @@ func (b *blockHandler) FrontierTip(ctx context.Context) (ids.ID, chainbootstrap.
|
||||
return ids.Empty, chainbootstrap.FrontierConnecting
|
||||
}
|
||||
|
||||
// SELF-ONLY staked set: the configured validator set is exactly THIS node — a genuine
|
||||
// single-validator network (a sybil-protected devnet, or the sole validator of an L1). There
|
||||
// is no OTHER beacon to sync from, so the node's own accepted tip IS the network frontier →
|
||||
// immediate start (FrontierNoBeacons). This is NOT an eclipse: the staked set is read from
|
||||
// P-chain STATE, not connectivity, so a hidden peer would still appear in `weights`; only a
|
||||
// genuine single-validator topology reaches here. Placed AFTER the P-ready gate so a boot-race
|
||||
// partial set (transiently self-only mid-P-replay) WAITS above rather than false-completing here.
|
||||
// This is the sybil-protected single-validator counterpart to the empty-set FrontierNoBeacons
|
||||
// path: a multi-validator staked set (the ≥2 case) still runs the ⅔-by-stake quorum below.
|
||||
if !b.hasExternalBeacons(weights) {
|
||||
b.logger.Debug("bootstrap frontier: self-only staked set (single validator) — NoBeacons, nothing to sync to",
|
||||
log.Stringer("chainID", b.chainID))
|
||||
return ids.Empty, chainbootstrap.FrontierNoBeacons
|
||||
}
|
||||
|
||||
// THE MASS-RECOVERY FIX. The acceptance decision is the BootstrapPolicy (a SEPARATE object
|
||||
// with a SEPARATE threat model — bootstrap_trust.go), NOT the ⅔-of-CURRENT-total-stake
|
||||
// consensus floor. The prior code required a ⅔-by-stake quorum of the WHOLE validator set to
|
||||
|
||||
@@ -25,6 +25,7 @@ import (
|
||||
consensuschain "github.com/luxfi/consensus/engine/chain"
|
||||
cblock "github.com/luxfi/consensus/engine/chain/block"
|
||||
chainbootstrap "github.com/luxfi/consensus/engine/chain/bootstrap"
|
||||
"github.com/luxfi/constants"
|
||||
"github.com/luxfi/ids"
|
||||
"github.com/luxfi/log"
|
||||
"github.com/luxfi/math/set"
|
||||
@@ -2032,3 +2033,129 @@ func TestRED_BehindNode_PeerConnectDelay_NeverFalseCompletesAtStale(t *testing.T
|
||||
require.Greater(t, net.peerInfoCalls, net.connectAfterCalls,
|
||||
"the loop must have WAITED through the connecting passes before naming the frontier")
|
||||
}
|
||||
|
||||
// TestChainExpectsStakedBeacons_SybilDrivesNotSkipBootstrap pins the ROOT-CAUSE decision of the
|
||||
// rejoin wedge (tasks #66/#74): whether a chain syncs its bootstrap frontier against the STAKED
|
||||
// primary-network set is driven by SYBIL PROTECTION, NOT --skip-bootstrap. Production validators
|
||||
// set --skip-bootstrap (to skip the initial bootstrap WAIT); the prior `!m.SkipBootstrap && ...`
|
||||
// made that flag also EMPTY the beacon set, so a behind native chain (C/X/Q) reported
|
||||
// FrontierNoBeacons, named its STALE local tip the network frontier, went live there, and never
|
||||
// caught up across restarts until a manual chaindata wipe. skip-bootstrap is not even an input to
|
||||
// the fixed decision — that is the point.
|
||||
func TestChainExpectsStakedBeacons_SybilDrivesNotSkipBootstrap(t *testing.T) {
|
||||
require.True(t, chainExpectsStakedBeacons(true, true, false),
|
||||
"sybil-protected native non-platform chain (C/X/Q) MUST expect staked beacons → peer-sync a behind validator (regardless of skip-bootstrap)")
|
||||
require.False(t, chainExpectsStakedBeacons(false, true, false),
|
||||
"non-sybil (dev / single-node) native chain → NO staked beacons: the empty-beacon immediate-start path")
|
||||
require.False(t, chainExpectsStakedBeacons(true, false, false),
|
||||
"a non-native chain does not sync against the primary staked set here")
|
||||
require.False(t, chainExpectsStakedBeacons(true, true, true),
|
||||
"the platform chain anchors to its OWN CustomBeacons, never the staked-set frontier quorum")
|
||||
}
|
||||
|
||||
// TestChainValidatesOnPrimaryNetwork_RealHashChainID is the regression the hardcoded-bool test
|
||||
// above could NOT catch: it exercises the ACTUAL discriminator buildChain feeds into
|
||||
// chainExpectsStakedBeacons. The durable rejoin fix (#66/#74) shipped INERT in production because
|
||||
// the discriminator keyed off the blockchain ID via ids.IsNativeChain — false for every deployed
|
||||
// C/X/Q (they carry HASH blockchain IDs; ids.IsNativeChain only matches the symbolic 111...C alias
|
||||
// form, which no deployed chain uses). So a real behind C-Chain still got empty beacons under
|
||||
// --skip-bootstrap and wedged. The fix keys off the validating Net (chainParams.ChainID) instead.
|
||||
func TestChainValidatesOnPrimaryNetwork_RealHashChainID(t *testing.T) {
|
||||
// Real deployed C-Chain blockchain IDs (devnet + mainnet) are HASHES, and ids.IsNativeChain
|
||||
// is false for them — the exact trap that disabled the fix.
|
||||
for _, s := range []string{
|
||||
"21HieZngQW8unBnSTbdQ9PcPAz6hhPLGrPzZhTvjC8KgjE95Bg", // devnet C-Chain
|
||||
"2wRdZGeca1qkxzNCq88NWDF5nJ5A9o623vRJKd3FsjRYvuVvvt", // mainnet C-Chain
|
||||
} {
|
||||
id, err := ids.FromString(s)
|
||||
require.NoError(t, err)
|
||||
require.False(t, ids.IsNativeChain(id),
|
||||
"trap: ids.IsNativeChain is false for real hash C-Chain ID %s — do NOT discriminate on the blockchain ID", s)
|
||||
}
|
||||
|
||||
// C/X/Q validate on the PRIMARY NETWORK: chainParams.ChainID == PrimaryNetworkID. That is the
|
||||
// signal buildChain now passes, so the durable fix fires for the real (hash-ID) C-Chain.
|
||||
require.True(t, chainValidatesOnPrimaryNetwork(constants.PrimaryNetworkID))
|
||||
require.True(t, chainExpectsStakedBeacons(true, chainValidatesOnPrimaryNetwork(constants.PrimaryNetworkID), false),
|
||||
"a sybil-protected primary-network non-platform chain (C/X/Q) MUST expect staked beacons regardless of its hash blockchain ID")
|
||||
|
||||
// An L2 validates on its OWN sovereign net, not the primary network → stays on the
|
||||
// empty-beacon single-node path (behavior unchanged for L2s).
|
||||
l2Net := ids.GenerateTestID()
|
||||
require.False(t, chainValidatesOnPrimaryNetwork(l2Net))
|
||||
require.False(t, chainExpectsStakedBeacons(true, chainValidatesOnPrimaryNetwork(l2Net), false))
|
||||
}
|
||||
|
||||
// TestNodeBootstrap_SelfOnlyStakedSet_ReportsNoBeacons covers the single-VALIDATOR counterpart of
|
||||
// the fix: a sybil-protected chain whose staked set is EXACTLY this node (a single-validator
|
||||
// devnet, or the sole validator of an L1) has no OTHER beacon to sync from, so FrontierTip reports
|
||||
// FrontierNoBeacons (immediate start at the node's own tip) rather than hanging in FrontierConnecting.
|
||||
// This is what lets skip-bootstrap stop emptying native beacons WITHOUT bricking a single-validator
|
||||
// net. It is NOT an eclipse: the staked set is read from P-chain STATE (hasExternalBeacons), so a
|
||||
// hidden peer would still appear in `weights`.
|
||||
func TestNodeBootstrap_SelfOnlyStakedSet_ReportsNoBeacons(t *testing.T) {
|
||||
const N = 10
|
||||
chain, byID := buildBSChain(N, -1)
|
||||
vm := newBSVMAt(chain, N) // the sole validator IS at the frontier
|
||||
self := ids.GenerateTestNodeID()
|
||||
bh, chainID := newBSHandlerWeighted(t, vm, map[ids.NodeID]uint64{self: 100})
|
||||
bh.selfNodeID = self // the staked set is EXACTLY this node — a genuine single-validator net
|
||||
bh.net = &bsBeaconNet{bh: bh, chainID: chainID, byID: byID, tip: chain[N]}
|
||||
bh.msgCreator = bsMsgBuilder{}
|
||||
|
||||
bh.bsActive.Store(true)
|
||||
tip, status := bh.FrontierTip(context.Background())
|
||||
bh.bsActive.Store(false)
|
||||
require.Equal(t, chainbootstrap.FrontierNoBeacons, status,
|
||||
"self-only staked set (single validator) → NoBeacons (nothing to sync to), never a FrontierConnecting hang")
|
||||
require.Equal(t, ids.Empty, tip)
|
||||
|
||||
// Discriminator: add ONE other validator and the SAME node must now run the quorum (has a peer
|
||||
// to sync from) — proving the self-only shortcut fires ONLY for a genuinely alone validator.
|
||||
require.True(t, bh.hasExternalBeacons(map[ids.NodeID]uint64{self: 100, ids.GenerateTestNodeID(): 100}),
|
||||
"a ≥2-validator staked set has an external beacon → runs the ⅔-by-stake quorum, not the self-only shortcut")
|
||||
}
|
||||
|
||||
// TestNodeBootstrap_BehindValidator_StakedSet_CatchesUpNoWipe is THE REJOIN INVARIANT (tasks
|
||||
// #66/#74), the code reproduction of the mainnet luxd-0 wedge: a staked validator that fell behind
|
||||
// must sync from its peers on restart and reach the network frontier WITHOUT a chaindata wipe.
|
||||
//
|
||||
// The node reloads its STALE on-disk tip at height M (the "restart" — no wipe) and holds a
|
||||
// sybil-protected native-chain staked beacon set (expectsStakedBeacons=true — exactly what
|
||||
// buildChain now leaves in place under --skip-bootstrap, instead of emptying it). The 4 healthy
|
||||
// producers name+serve the frontier N over the real GetAcceptedFrontier/GetAncestors transport, so
|
||||
// the behind node fetch+executes M+1..N and ends ACCEPTED at N — never stuck at the stale M.
|
||||
func TestNodeBootstrap_BehindValidator_StakedSet_CatchesUpNoWipe(t *testing.T) {
|
||||
const N = 60 // network frontier (the healthy producers)
|
||||
const M = 42 // our STALE local height after a restart — behind by N-M, NO wipe
|
||||
chain, byID := buildBSChain(N, -1)
|
||||
vm := newBSVMAt(chain, M) // reload the stale on-disk tip (the restart)
|
||||
|
||||
// A 5-validator staked set (equal stake): this node is one, the other 4 are the connected,
|
||||
// serving producers at the frontier N. This mirrors lux-mainnet's 5-validator C-Chain.
|
||||
weights := map[ids.NodeID]uint64{}
|
||||
producers := make([]ids.NodeID, 4)
|
||||
for i := range producers {
|
||||
producers[i] = ids.GenerateTestNodeID()
|
||||
weights[producers[i]] = 100
|
||||
}
|
||||
self := ids.GenerateTestNodeID()
|
||||
weights[self] = 100
|
||||
bh, chainID := newBSHandlerWeighted(t, vm, weights)
|
||||
bh.selfNodeID = self
|
||||
require.True(t, bh.expectsStakedBeacons,
|
||||
"a native sybil chain expects staked beacons even under skip-bootstrap — the fix that keeps peer-sync alive")
|
||||
|
||||
bh.net = &bsBeaconNet{bh: bh, chainID: chainID, connected: producers, byID: byID, tip: chain[N], serveAncestors: true}
|
||||
bh.msgCreator = bsMsgBuilder{}
|
||||
|
||||
ctx := context.Background()
|
||||
require.NoError(t, runBS(t, bh),
|
||||
"behind validator must converge to the frontier from its peers — no wipe, chain keeps finalizing")
|
||||
|
||||
last, _ := vm.LastAccepted(ctx)
|
||||
require.Equal(t, chain[N].id, last,
|
||||
"REJOIN: behind validator caught up from peers to frontier N=%d (was stuck at stale M=%d, no wipe)", N, M)
|
||||
require.True(t, bh.Accepted(ctx, chain[N].id),
|
||||
"node holds + ACCEPTED the frontier tip after the rejoin (genuine catch-up, not a stale false-complete)")
|
||||
}
|
||||
|
||||
+52
-11
@@ -243,10 +243,13 @@ type BootstrapPolicy struct {
|
||||
// CheckpointVerifier authenticates the Checkpoint's authority signature (INVARIANT 4). nil ⇒ a
|
||||
// configured Checkpoint is NOT trusted (fail closed) — a bare (id,height) is never enough.
|
||||
CheckpointVerifier CheckpointVerifier
|
||||
// NamingWindow bounds the ancestry fetched per anchor; MaxAnchors bounds how many distinct
|
||||
// reported tips are resolved. Both default to the package constants when zero.
|
||||
NamingWindow int
|
||||
MaxAnchors int
|
||||
// NamingWindow is the per-FETCH ancestry chunk (Ancestry returns FULL blocks, so one fetch
|
||||
// must stay inside a network message); MaxNamingDepth is the TOTAL ancestry a single anchor
|
||||
// may be walked down in NamingWindow-sized chunks; MaxAnchors bounds how many distinct
|
||||
// reported tips are resolved. All default to the package constants when zero.
|
||||
NamingWindow int
|
||||
MaxNamingDepth int
|
||||
MaxAnchors int
|
||||
// NamingTimeout TOTAL-bounds the ancestor-tolerant resolution (all anchor fetches combined) so
|
||||
// a partition that ANSWERS the frontier query but WITHHOLDS ancestry cannot make the decision
|
||||
// hang — it returns what it found (or nothing → ErrNoBootstrapQuorum) and the caller's bounded
|
||||
@@ -299,6 +302,17 @@ func (p *BootstrapPolicy) namingWindow() int {
|
||||
return bootstrapNamingWindow
|
||||
}
|
||||
|
||||
// maxNamingDepth is the TOTAL ancestry one anchor may be walked down, in namingWindow-sized
|
||||
// chunks. It is a RESOURCE bound and nothing else. Safety comes from hash-verified ancestry
|
||||
// (a forged chain cannot link), MinResponders distinct voters, the ⅔-of-RESPONDER-stake floor,
|
||||
// and the full re-Verify every block gets on the descent — none of which depend on this number.
|
||||
func (p *BootstrapPolicy) maxNamingDepth() int {
|
||||
if p.MaxNamingDepth > 0 {
|
||||
return p.MaxNamingDepth
|
||||
}
|
||||
return bootstrapMaxNamingDepth
|
||||
}
|
||||
|
||||
func (p *BootstrapPolicy) maxAnchors() int {
|
||||
if p.MaxAnchors > 0 {
|
||||
return p.MaxAnchors
|
||||
@@ -505,14 +519,41 @@ func (p *BootstrapPolicy) nameFrontier(ctx context.Context, stakeOnTip map[ids.I
|
||||
break
|
||||
}
|
||||
fetches++
|
||||
refs, err := p.Source.Ancestry(ctx, tip, p.namingWindow())
|
||||
if err != nil {
|
||||
continue
|
||||
}
|
||||
for _, ref := range refs {
|
||||
if _, ok := index[ref.ID]; !ok {
|
||||
index[ref.ID] = ref
|
||||
// CHUNKED DESCENT. namingWindow is the per-FETCH size (Ancestry returns FULL blocks, so
|
||||
// one fetch must fit a network message) — NOT the total ancestry worth walking. Keep
|
||||
// following the parent chain in window-sized chunks up to maxNamingDepth, so a fleet
|
||||
// that HALTED with a straggler far below the highest tip still resolves its ⅔-backed
|
||||
// common ancestor. A single un-chunked window silently capped this at 256 and wedged
|
||||
// mainnet at a 535-block gap. ctx already TOTAL-bounds every fetch (namingTimeout).
|
||||
cur := tip
|
||||
for depth := 0; depth < p.maxNamingDepth(); {
|
||||
// The deadline must bind the WALK, not just each fetch: a Byzantine peer serving a
|
||||
// long fabricated chain cheaply (or an in-process Source) would otherwise run the
|
||||
// full depth budget before anyone checked the clock.
|
||||
if ctx.Err() != nil {
|
||||
break
|
||||
}
|
||||
refs, err := p.Source.Ancestry(ctx, cur, p.namingWindow())
|
||||
if err != nil || len(refs) == 0 {
|
||||
break
|
||||
}
|
||||
deepest, first := BlockRef{}, true
|
||||
for _, ref := range refs {
|
||||
if _, ok := index[ref.ID]; !ok {
|
||||
index[ref.ID] = ref
|
||||
}
|
||||
if first || ref.Height < deepest.Height {
|
||||
deepest, first = ref, false
|
||||
}
|
||||
}
|
||||
depth += len(refs) // len(refs) >= 1 here, so depth strictly advances -> terminates
|
||||
if deepest.Parent == ids.Empty {
|
||||
break // reached genesis
|
||||
}
|
||||
if _, covered := index[deepest.Parent]; covered {
|
||||
break // an earlier anchor's chain already covers everything below
|
||||
}
|
||||
cur = deepest.Parent
|
||||
}
|
||||
}
|
||||
if len(index) == 0 {
|
||||
|
||||
@@ -916,3 +916,175 @@ func TestBootstrapTrust_EclipseOwnHeightNotNamedRoutesToCaughtUp(t *testing.T) {
|
||||
require.Equal(t, refs[N].ID, f.ID, "boundary: N is named iff its height is STRICTLY ABOVE MinFrontierHeight")
|
||||
require.Equal(t, uint64(N), f.Height)
|
||||
}
|
||||
|
||||
// ----- H: HALT-SKEW RECOVERY (mainnet 96369 wedge) ---------------------------
|
||||
|
||||
// TestBootstrapTrust_H_HaltSkewDeeperThanOneWindow reproduces the live mainnet 96369 wedge and
|
||||
// proves the chunked descent fixes it.
|
||||
//
|
||||
// SHAPE (measured per-node, in-pod, 2026-07-28): the fleet HALTED below its α=4-of-5 threshold.
|
||||
// One node ran on alone to 1098726 while two stayed at 1098191; 1098191 IS an ancestor of
|
||||
// 1098726 (no fork — luxd-3/luxd-4's `latest` IS 1098191, they hold nothing competing), so the
|
||||
// ⅔-of-RESPONDER floor is satisfied at 1098191 by all three responders and it MUST be named.
|
||||
//
|
||||
// It was not. nameFrontier fetched one bootstrapNamingWindow (256) of ancestry per anchor, and
|
||||
// the gap is 535 — so the high tip's ancestry never reached down far enough to vouch for the
|
||||
// common block. 1098191 held only its 2 direct responders (2 of 3 = below the ⅔ floor of 2,
|
||||
// which the strict `>` rejects), the tally named NOTHING, and every retry did the same. The
|
||||
// node sat at height 0 forever and mainnet could not regain quorum.
|
||||
//
|
||||
// The gap here (535) is deliberately > one window (256) and < maxNamingDepth. With the
|
||||
// single-fetch window this FAILS (frontier is nil → ErrNoBootstrapQuorum); with the chunked
|
||||
// descent the walk continues past the first chunk and names the common ancestor.
|
||||
func TestBootstrapTrust_H_HaltSkewDeeperThanOneWindow(t *testing.T) {
|
||||
const w uint64 = 100
|
||||
const gap = 535 // luxd-1 1098726 - luxd-3/luxd-4 1098191, the measured mainnet skew
|
||||
|
||||
// common is the last block the whole fleet accepted; `ahead` extends it by `gap`.
|
||||
refs, byID := refChain(1000)
|
||||
common := refs[1000]
|
||||
prev := common
|
||||
for i := 0; i < gap; i++ {
|
||||
c := childRef(prev)
|
||||
byID[c.ID] = c
|
||||
prev = c
|
||||
}
|
||||
ahead := prev
|
||||
require.Equal(t, common.Height+gap, ahead.Height)
|
||||
require.Greater(t, gap, bootstrapNamingWindow, "gap MUST exceed one fetch window or this proves nothing")
|
||||
require.Less(t, gap, bootstrapMaxNamingDepth, "gap must stay inside the total depth budget")
|
||||
|
||||
beacons := nodeIDs(3) // the three responders with a live C-Chain
|
||||
policy := &BootstrapPolicy{
|
||||
TrustedBeacons: equalBeacons(beacons, w),
|
||||
MinResponses: 3,
|
||||
Source: &stubAncestry{byID: byID},
|
||||
}
|
||||
replies := []BeaconReply{
|
||||
reply(beacons[0], ahead.ID, w), // luxd-1, ran on alone
|
||||
reply(beacons[1], common.ID, w), // luxd-3
|
||||
reply(beacons[2], common.ID, w), // luxd-4
|
||||
}
|
||||
|
||||
f, err := policy.AcceptsFrontier(context.Background(), replies)
|
||||
require.NoError(t, err, "a fleet split across ONE chain must name a frontier, not wedge")
|
||||
require.NotNil(t, f)
|
||||
require.Equal(t, common.ID, f.ID,
|
||||
"must name the ⅔-backed COMMON ancestor: the high tip vouches for it via ancestry")
|
||||
require.Equal(t, common.Height, f.Height)
|
||||
}
|
||||
|
||||
// TestBootstrapTrust_H_HaltSkewBeyondDepthStillFailsSafe pins the resource bound's edge: a skew
|
||||
// DEEPER than maxNamingDepth still names nothing rather than guessing. Depth is a work bound, so
|
||||
// exhausting it must degrade to the SAME fail-safe as before, never to a wrong block.
|
||||
func TestBootstrapTrust_H_HaltSkewBeyondDepthStillFailsSafe(t *testing.T) {
|
||||
const w uint64 = 100
|
||||
refs, byID := refChain(10)
|
||||
common := refs[10]
|
||||
prev := common
|
||||
for i := 0; i < 64; i++ {
|
||||
c := childRef(prev)
|
||||
byID[c.ID] = c
|
||||
prev = c
|
||||
}
|
||||
ahead := prev
|
||||
|
||||
beacons := nodeIDs(3)
|
||||
policy := &BootstrapPolicy{
|
||||
TrustedBeacons: equalBeacons(beacons, w),
|
||||
MinResponses: 3,
|
||||
NamingWindow: 4, // tiny chunk...
|
||||
MaxNamingDepth: 8, // ...and a depth budget far shallower than the 64-block skew
|
||||
Source: &stubAncestry{byID: byID},
|
||||
}
|
||||
_, err := policy.AcceptsFrontier(context.Background(), []BeaconReply{
|
||||
reply(beacons[0], ahead.ID, w),
|
||||
reply(beacons[1], common.ID, w),
|
||||
reply(beacons[2], common.ID, w),
|
||||
})
|
||||
require.Error(t, err, "a skew beyond the depth budget must fail SAFE, never name a guess")
|
||||
}
|
||||
|
||||
// TestBootstrapTrust_H_AcceptanceMatrix pins the owner-specified recovery matrix at the policy
|
||||
// layer. Each case is the SAME five-validator mainnet shape with a different responder pattern.
|
||||
//
|
||||
// The rule being pinned is "highest verifiably-vouched descendant wins", NOT "numerically highest
|
||||
// tip advertised". A tip whose ancestry does not link into the fleet's chain earns NO credit no
|
||||
// matter how high it claims to be, so a Byzantine node cannot pull the fleet onto a fabricated
|
||||
// chain by advertising a tall one.
|
||||
func TestBootstrapTrust_H_AcceptanceMatrix(t *testing.T) {
|
||||
const w uint64 = 100
|
||||
mk := func() (BlockRef, BlockRef, map[ids.ID]BlockRef) {
|
||||
refs, byID := refChain(600)
|
||||
common := refs[600]
|
||||
prev := common
|
||||
for i := 0; i < 535; i++ { // the measured mainnet skew, > one 256 window
|
||||
c := childRef(prev)
|
||||
byID[c.ID] = c
|
||||
prev = c
|
||||
}
|
||||
return common, prev, byID
|
||||
}
|
||||
|
||||
t.Run("1_high_2_low_2_unavailable__names_common_ancestor", func(t *testing.T) {
|
||||
common, ahead, byID := mk()
|
||||
b := nodeIDs(3)
|
||||
p := &BootstrapPolicy{TrustedBeacons: equalBeacons(b, w), MinResponses: 3, Source: &stubAncestry{byID: byID}}
|
||||
f, err := p.AcceptsFrontier(context.Background(), []BeaconReply{
|
||||
reply(b[0], ahead.ID, w), reply(b[1], common.ID, w), reply(b[2], common.ID, w)})
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, common.ID, f.ID)
|
||||
})
|
||||
|
||||
t.Run("3_high_2_unavailable__names_high_tip", func(t *testing.T) {
|
||||
_, ahead, byID := mk()
|
||||
b := nodeIDs(3)
|
||||
p := &BootstrapPolicy{TrustedBeacons: equalBeacons(b, w), MinResponses: 3, Source: &stubAncestry{byID: byID}}
|
||||
f, err := p.AcceptsFrontier(context.Background(), []BeaconReply{
|
||||
reply(b[0], ahead.ID, w), reply(b[1], ahead.ID, w), reply(b[2], ahead.ID, w)})
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, ahead.ID, f.ID, "unanimous high tip must be named, not an ancestor")
|
||||
})
|
||||
|
||||
t.Run("fabricated_tall_tip_2_low__rejects_fake_names_common", func(t *testing.T) {
|
||||
common, _, byID := mk()
|
||||
// A Byzantine node advertises a tip on a chain of its own that never links into the
|
||||
// fleet's history. Its ancestry earns credit only for ITS OWN blocks, never for the
|
||||
// fleet's — so it cannot outvote the two honest low responders.
|
||||
fakeRefs, fakeByID := refChain(9_000_000)
|
||||
fake := fakeRefs[9_000_000]
|
||||
for id, r := range fakeByID {
|
||||
byID[id] = r
|
||||
}
|
||||
b := nodeIDs(3)
|
||||
p := &BootstrapPolicy{TrustedBeacons: equalBeacons(b, w), MinResponses: 3, Source: &stubAncestry{byID: byID}}
|
||||
f, err := p.AcceptsFrontier(context.Background(), []BeaconReply{
|
||||
reply(b[0], fake.ID, w), reply(b[1], common.ID, w), reply(b[2], common.ID, w)})
|
||||
// The fake tip earns credit ONLY on its own disjoint chain (100), far below the ⅔ floor
|
||||
// of 200, so it can never be named however tall it claims to be. `common` earns exactly
|
||||
// 200 from its two honest backers — and the floor is STRICT (`> floor`), so 200 is not
|
||||
// enough either: the Byzantine node withheld the third vouch by sitting on a chain that
|
||||
// does not link. Correct outcome is a SAFE HALT, not "fall back to the low tip".
|
||||
// This is the honest BFT trade: 1 of 3 responders can cost LIVENESS, never SAFETY.
|
||||
require.Error(t, err, "must halt safely; must NOT follow a taller unvouched chain")
|
||||
require.Nil(t, f)
|
||||
})
|
||||
|
||||
t.Run("two_conflicting_branches_same_height__halts_safely", func(t *testing.T) {
|
||||
refs, byID := refChain(600)
|
||||
common := refs[600]
|
||||
// Two disjoint branches of equal height off the common block, each backed by one node,
|
||||
// and NO responder majority on either. Nothing may be named by height tiebreak.
|
||||
l, r := childRef(common), childRef(common)
|
||||
byID[l.ID], byID[r.ID] = l, r
|
||||
b := nodeIDs(3)
|
||||
p := &BootstrapPolicy{
|
||||
TrustedBeacons: equalBeacons(b, w), MinResponses: 3,
|
||||
MinFrontierHeight: common.Height, // node already holds `common`; only a tip AHEAD may be named
|
||||
Source: &stubAncestry{byID: byID},
|
||||
}
|
||||
_, err := p.AcceptsFrontier(context.Background(), []BeaconReply{
|
||||
reply(b[0], l.ID, w), reply(b[1], r.ID, w), reply(b[2], common.ID, w)})
|
||||
require.Error(t, err, "conflicting equal-height branches must halt safely, never pick by height")
|
||||
})
|
||||
}
|
||||
|
||||
+11
-4
@@ -72,15 +72,22 @@ func (s *Nets) IsChainBootstrapped(chainID ids.ID) bool {
|
||||
|
||||
// Bootstrapping returns the chainIDs of any chains that are still
|
||||
// bootstrapping.
|
||||
//
|
||||
// s.chains is keyed by NET id, not chain id. Reporting the key named the net
|
||||
// instead of the chain: every primary-network chain that failed to converge
|
||||
// surfaced in /v1/health as the single ID
|
||||
// "11111111111111111111111111111111LpoYY" — constants.PrimaryNetworkID, i.e.
|
||||
// ids.Empty — a "chain" the chain manager has never heard of, so the operator
|
||||
// chasing it got "there is no chain with alias/ID". Worse, N stuck chains
|
||||
// collapsed into one indistinguishable entry. Ask each net which of ITS chains
|
||||
// are still bootstrapping; the net owns that set.
|
||||
func (s *Nets) Bootstrapping() []ids.ID {
|
||||
s.lock.RLock()
|
||||
defer s.lock.RUnlock()
|
||||
|
||||
chainsBootstrapping := make([]ids.ID, 0, len(s.chains))
|
||||
for chainID, chain := range s.chains {
|
||||
if !chain.IsBootstrapped() {
|
||||
chainsBootstrapping = append(chainsBootstrapping, chainID)
|
||||
}
|
||||
for _, chain := range s.chains {
|
||||
chainsBootstrapping = append(chainsBootstrapping, chain.Bootstrapping()...)
|
||||
}
|
||||
|
||||
return chainsBootstrapping
|
||||
|
||||
+44
-2
@@ -158,12 +158,54 @@ func TestNetsBootstrapping(t *testing.T) {
|
||||
chain, ok := chains.GetOrCreate(netID)
|
||||
require.True(ok)
|
||||
|
||||
// Start bootstrapping
|
||||
// Start bootstrapping. What comes back is the CHAIN that is syncing, never
|
||||
// the net that holds it — this assertion used to demand netID, which is
|
||||
// how the phantom "11111111111111111111111111111111LpoYY" survived review.
|
||||
chain.AddChain(chainID)
|
||||
bootstrapping := chains.Bootstrapping()
|
||||
require.Contains(bootstrapping, netID)
|
||||
require.Equal([]ids.ID{chainID}, bootstrapping)
|
||||
require.NotContains(bootstrapping, netID)
|
||||
|
||||
// Finish bootstrapping
|
||||
chain.Bootstrapped(chainID)
|
||||
require.Empty(chains.Bootstrapping())
|
||||
}
|
||||
|
||||
// The "bootstrapped" health check publishes Nets.Bootstrapping() verbatim as
|
||||
// its message. s.chains is keyed by NET id, so returning the key reported
|
||||
// constants.PrimaryNetworkID (ids.Empty, cb58
|
||||
// "11111111111111111111111111111111LpoYY") as though it were an unbootstrapped
|
||||
// CHAIN. Operators saw a chain ID the chain manager denies exists, and every
|
||||
// stuck chain on the net collapsed into that one phantom entry.
|
||||
func TestNetsBootstrappingReportsChainsNotNets(t *testing.T) {
|
||||
require := require.New(t)
|
||||
|
||||
chains, err := NewNets(ids.EmptyNodeID, map[ids.ID]nets.Config{
|
||||
constants.PrimaryNetworkID: {},
|
||||
})
|
||||
require.NoError(err)
|
||||
|
||||
primary, _ := chains.GetOrCreate(constants.PrimaryNetworkID)
|
||||
cChainID := ids.GenerateTestID()
|
||||
dChainID := ids.GenerateTestID()
|
||||
primary.AddChain(cChainID)
|
||||
primary.AddChain(dChainID)
|
||||
|
||||
bootstrapping := chains.Bootstrapping()
|
||||
|
||||
// The phantom: never the net's own ID.
|
||||
require.NotContains(bootstrapping, constants.PrimaryNetworkID)
|
||||
require.NotContains(
|
||||
bootstrapping,
|
||||
ids.Empty,
|
||||
"health check reported the primary NET id as an unbootstrapped chain",
|
||||
)
|
||||
// Both stuck chains must be individually nameable.
|
||||
require.ElementsMatch([]ids.ID{cChainID, dChainID}, bootstrapping)
|
||||
|
||||
primary.Bootstrapped(cChainID)
|
||||
require.Equal([]ids.ID{dChainID}, chains.Bootstrapping())
|
||||
|
||||
primary.Bootstrapped(dChainID)
|
||||
require.Empty(chains.Bootstrapping())
|
||||
}
|
||||
|
||||
@@ -0,0 +1,139 @@
|
||||
// Copyright (C) 2019-2026, Lux Industries, Inc. All rights reserved.
|
||||
// See the file LICENSE for licensing terms.
|
||||
|
||||
// context_chunk_test.go — the heavy-block self-heal fix: GetContext must bound its Ancestors
|
||||
// response by SERIALIZED SIZE (not just block COUNT) so it stays under the peer message cap.
|
||||
//
|
||||
// Benchmark-proven live bug: under 250-trader DEX load, heavy blocks made a 256-block context
|
||||
// response sum to 3.4-5.7 MB > the 2 MB compressor cap; msgCreator.Ancestors FAILED to build,
|
||||
// so a behind validator received NOTHING and could never resync (permanently stuck while the tip
|
||||
// advanced). This pins the fix: the response is chunked to fit the budget, always serving at
|
||||
// least one block so the behind node makes progress every round.
|
||||
|
||||
package chains
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
consensuschain "github.com/luxfi/consensus/engine/chain"
|
||||
consensusblock "github.com/luxfi/consensus/engine/chain/block"
|
||||
"github.com/luxfi/constants"
|
||||
"github.com/luxfi/ids"
|
||||
"github.com/luxfi/log"
|
||||
"github.com/luxfi/node/message"
|
||||
)
|
||||
|
||||
// heavyBlock is a consensuschain.Block of a controlled byte size; only the methods GetContext
|
||||
// touches (ID/Parent/Bytes) are overridden — the rest of the interface is embedded and unused.
|
||||
type heavyBlock struct {
|
||||
consensusblock.Block
|
||||
id, parent ids.ID
|
||||
bytes []byte
|
||||
}
|
||||
|
||||
func (b *heavyBlock) ID() ids.ID { return b.id }
|
||||
func (b *heavyBlock) Parent() ids.ID { return b.parent }
|
||||
func (b *heavyBlock) Bytes() []byte { return b.bytes }
|
||||
|
||||
// sizeStubVM serves heavyBlocks by id (only GetBlock is called by GetContext).
|
||||
type sizeStubVM struct {
|
||||
consensuschain.BlockBuilder
|
||||
blocks map[ids.ID]consensusblock.Block
|
||||
}
|
||||
|
||||
func (v *sizeStubVM) GetBlock(_ context.Context, id ids.ID) (consensusblock.Block, error) {
|
||||
b, ok := v.blocks[id]
|
||||
if !ok {
|
||||
return nil, errors.New("not found")
|
||||
}
|
||||
return b, nil
|
||||
}
|
||||
|
||||
// sizeRecMsg records the containers GetContext hands to Ancestors, so the test can measure the
|
||||
// assembled response size (the input the real zstd compressor would reject above the cap).
|
||||
type sizeRecMsg struct {
|
||||
message.OutboundMsgBuilder
|
||||
containers [][]byte
|
||||
}
|
||||
|
||||
func (m *sizeRecMsg) Ancestors(_ ids.ID, _ uint32, containers [][]byte) (message.OutboundMessage, error) {
|
||||
m.containers = containers
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func TestGetContext_ChunksBySize_FitsUnderCap(t *testing.T) {
|
||||
// A 100-block chain of ~150 KiB blocks. Packed by COUNT alone (up to maxContextBlocks=256,
|
||||
// i.e. all 100), the response is ~15 MB — 7x over the 2 MB cap, so the old handler's message
|
||||
// failed to build. Bounded by SIZE, it serves only as many as fit.
|
||||
const nBlocks = 100
|
||||
const blkSize = 150 * 1024
|
||||
|
||||
vm := &sizeStubVM{blocks: map[ids.ID]consensusblock.Block{}}
|
||||
parent := ids.Empty
|
||||
var tip ids.ID
|
||||
for i := 0; i < nBlocks; i++ {
|
||||
id := ids.GenerateTestID()
|
||||
vm.blocks[id] = &heavyBlock{id: id, parent: parent, bytes: make([]byte, blkSize)}
|
||||
parent = id
|
||||
tip = id
|
||||
}
|
||||
|
||||
msg := &sizeRecMsg{}
|
||||
bh := &blockHandler{
|
||||
logger: log.NewNoOpLogger(),
|
||||
vm: vm,
|
||||
msgCreator: msg,
|
||||
net: &redStubNet{},
|
||||
chainID: ids.GenerateTestID(),
|
||||
networkID: ids.GenerateTestID(),
|
||||
maxContextBlocks: 256,
|
||||
}
|
||||
|
||||
if err := bh.GetContext(context.Background(), ids.GenerateTestNodeID(), 1, time.Now().Add(time.Second), tip); err != nil {
|
||||
t.Fatalf("GetContext: %v", err)
|
||||
}
|
||||
|
||||
total := 0
|
||||
for _, c := range msg.containers {
|
||||
total += len(c)
|
||||
}
|
||||
budget := constants.DefaultMaxMessageSize - 128*1024 // the handler's byteBudget
|
||||
|
||||
if len(msg.containers) == 0 {
|
||||
t.Fatal("must serve at least one block (a behind node must always make progress)")
|
||||
}
|
||||
if total > budget {
|
||||
t.Fatalf("context response %d bytes exceeds budget %d — the real Ancestors compressor would REJECT it "+
|
||||
"(cap %d), stranding a behind validator (the live bug)", total, budget, constants.DefaultMaxMessageSize)
|
||||
}
|
||||
if len(msg.containers) >= nBlocks {
|
||||
t.Fatalf("expected SIZE truncation (fewer than %d blocks), got %d — response not chunked", nBlocks, len(msg.containers))
|
||||
}
|
||||
t.Logf("size-chunked: %d blocks, %d payload bytes (budget %d, cap %d) — fits, so the compressor accepts it",
|
||||
len(msg.containers), total, budget, constants.DefaultMaxMessageSize)
|
||||
}
|
||||
|
||||
// A single heavy block is ALWAYS served even if it alone exceeds the budget — the walk must never
|
||||
// deadlock (the trust-tiered validator cap gives such a block the send headroom; a stranger's
|
||||
// tight cap correctly rejects it downstream).
|
||||
func TestGetContext_SingleOversizeBlock_StillServed(t *testing.T) {
|
||||
oversize := constants.DefaultMaxMessageSize + 1<<20 // > the cap on its own
|
||||
id := ids.GenerateTestID()
|
||||
vm := &sizeStubVM{blocks: map[ids.ID]consensusblock.Block{
|
||||
id: &heavyBlock{id: id, parent: ids.Empty, bytes: make([]byte, oversize)},
|
||||
}}
|
||||
msg := &sizeRecMsg{}
|
||||
bh := &blockHandler{
|
||||
logger: log.NewNoOpLogger(), vm: vm, msgCreator: msg, net: &redStubNet{},
|
||||
chainID: ids.GenerateTestID(), networkID: ids.GenerateTestID(), maxContextBlocks: 256,
|
||||
}
|
||||
if err := bh.GetContext(context.Background(), ids.GenerateTestNodeID(), 1, time.Now().Add(time.Second), id); err != nil {
|
||||
t.Fatalf("GetContext: %v", err)
|
||||
}
|
||||
if len(msg.containers) != 1 {
|
||||
t.Fatalf("a single (even oversize) block must be served so the walk never deadlocks, got %d blocks", len(msg.containers))
|
||||
}
|
||||
}
|
||||
+333
-157
@@ -15,7 +15,6 @@ import (
|
||||
"net/http"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strconv"
|
||||
"strings"
|
||||
"sync"
|
||||
gatomic "sync/atomic"
|
||||
@@ -59,6 +58,7 @@ import (
|
||||
"github.com/luxfi/constants"
|
||||
"github.com/luxfi/container/buffer"
|
||||
"github.com/luxfi/crypto/bls"
|
||||
"github.com/luxfi/crypto/mldsa"
|
||||
"github.com/luxfi/filesystem/perms"
|
||||
"github.com/luxfi/log"
|
||||
"github.com/luxfi/math/set"
|
||||
@@ -69,6 +69,7 @@ import (
|
||||
"github.com/luxfi/node/upgrade"
|
||||
"github.com/luxfi/node/vms"
|
||||
validators "github.com/luxfi/validators"
|
||||
version "github.com/luxfi/version"
|
||||
"github.com/luxfi/vm/fx"
|
||||
|
||||
// "github.com/luxfi/node/vms/metervm" // Temporarily disabled - needs consensus package updates
|
||||
@@ -102,6 +103,16 @@ const (
|
||||
defaultChannelSize = 1
|
||||
initialQueueSize = 3
|
||||
|
||||
// vmStartupTimeout bounds each VM startup/lifecycle operation (Initialize,
|
||||
// Linearize, SetState, CreateHandlers, router AddChain, state-sync). It must
|
||||
// be generous enough to cover a cold coreth "Regenerate historical state"
|
||||
// pass after an unclean shutdown (observed 67-134s on mainnet C-Chain),
|
||||
// which the previous hardcoded 30s budget blew — the context was cancelled
|
||||
// mid-init, so the VM was marked failed and its C-Chain route never
|
||||
// registered (the recurring post-restart 404 that needed a second restart).
|
||||
// Bounded so a genuinely hung VM still surfaces rather than hanging forever.
|
||||
vmStartupTimeout = 10 * time.Minute
|
||||
|
||||
luxNamespace = constants.PlatformName + utilmetric.NamespaceSeparator + "lux"
|
||||
handlerNamespace = constants.PlatformName + utilmetric.NamespaceSeparator + "handler"
|
||||
meterchainvmNamespace = constants.PlatformName + utilmetric.NamespaceSeparator + "meterchainvm"
|
||||
@@ -161,6 +172,20 @@ var (
|
||||
_ Manager = (*manager)(nil)
|
||||
)
|
||||
|
||||
// quasarExportVM is the OPTIONAL two-tier-consensus (v1.36) export sink a VM may
|
||||
// expose: the consensus engine pushes each Quasar (⅔-by-stake) EXPORT-FINAL
|
||||
// frontier advance in, and re-seeds from the VM's durable height on boot, so the
|
||||
// VM's `finalized`/`safe` tags and cross-chain export gate track ⅔-stake
|
||||
// finality instead of the reorgable Nova accept tip. NOT part of chain.ChainVM —
|
||||
// generic VMs never implement it and run Nova-only. For a plugin VM the concrete
|
||||
// implementation is in another process; the rpcchainvm client carries these
|
||||
// across the boundary and reports whether the plugin advertised the capability
|
||||
// via SupportsQuasarExport (see the wiring in createChain).
|
||||
type quasarExportVM interface {
|
||||
SetLastQuasarFinalized(uint64)
|
||||
LastQuasarHeight() uint64
|
||||
}
|
||||
|
||||
// Manager manages the chains running on this node.
|
||||
// It can:
|
||||
// - Create a chain
|
||||
@@ -340,8 +365,19 @@ type ManagerConfig struct {
|
||||
SybilProtectionEnabled bool
|
||||
StakingTLSSigner crypto.Signer
|
||||
StakingTLSCert *staking.Certificate
|
||||
StakingBLSKey bls.Signer
|
||||
TracingEnabled bool
|
||||
// Strict-PQ proposer identity. When StakingMLDSASigner is non-nil, chains wrap
|
||||
// their proposervm with ML-DSA-65 block signing so the signed block's
|
||||
// Proposer() matches the ML-DSA-keyed validator set. Nil ⇒ classical TLS-leaf.
|
||||
StakingMLDSASigner *mldsa.PrivateKey
|
||||
StakingMLDSAPub []byte
|
||||
// ProposerWindowDuration overrides the proposervm proposer-slot spacing (0 ⇒
|
||||
// the 5s mainnet default). Small local/dev nets set it low for fast cadence.
|
||||
ProposerWindowDuration time.Duration
|
||||
// ProposerMinBlockDelay overrides the proposervm minimum block delay (0 ⇒ the
|
||||
// 1s default). High-throughput / DEX nets set it low (e.g. 1ms).
|
||||
ProposerMinBlockDelay time.Duration
|
||||
StakingBLSKey bls.Signer
|
||||
TracingEnabled bool
|
||||
// Must not be used unless [TracingEnabled] is true as this may be nil.
|
||||
Tracer trace.Tracer
|
||||
Log log.Logger
|
||||
@@ -829,7 +865,7 @@ func (m *manager) createChain(chainParams ChainParameters) {
|
||||
m.Log.Info("VM implements CreateHandlers, calling it",
|
||||
log.Stringer("chainID", chainParams.ID),
|
||||
)
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
|
||||
ctx, cancel := context.WithTimeout(context.Background(), vmStartupTimeout)
|
||||
defer cancel()
|
||||
handlers, err := vm.CreateHandlers(ctx)
|
||||
if err != nil {
|
||||
@@ -850,7 +886,7 @@ func (m *manager) createChain(chainParams ChainParameters) {
|
||||
chainBase := fmt.Sprintf("bc/%s", chainAlias)
|
||||
chainIDBase := fmt.Sprintf("bc/%s", chainParams.ID.String())
|
||||
|
||||
// AddRoute will build the full path as /ext/<base><endpoint>
|
||||
// AddRoute will build the full path as /v1/<base><endpoint>
|
||||
m.Server.AddRoute(handler, chainBase, endpoint)
|
||||
if chainAlias != chainParams.ID.String() {
|
||||
m.Server.AddRoute(handler, chainIDBase, endpoint)
|
||||
@@ -896,7 +932,7 @@ func (m *manager) createChain(chainParams ChainParameters) {
|
||||
|
||||
// Register chain with the router for message routing
|
||||
if m.ManagerConfig.Router != nil {
|
||||
routeCtx, routeCancel := context.WithTimeout(context.Background(), 30*time.Second)
|
||||
routeCtx, routeCancel := context.WithTimeout(context.Background(), vmStartupTimeout)
|
||||
defer routeCancel()
|
||||
m.ManagerConfig.Router.AddChain(routeCtx, chainParams.ID, chain.Handler)
|
||||
}
|
||||
@@ -938,7 +974,7 @@ func (m *manager) createChain(chainParams ChainParameters) {
|
||||
// Tell the chain to start processing messages.
|
||||
// If the X, P, or C Chain panics, do not attempt to recover
|
||||
if chain.Engine != nil {
|
||||
startCtx, startCancel := context.WithTimeout(context.Background(), 30*time.Second)
|
||||
startCtx, startCancel := context.WithTimeout(context.Background(), vmStartupTimeout)
|
||||
defer startCancel()
|
||||
chain.Engine.Start(startCtx, !m.CriticalChains.Contains(chainParams.ID))
|
||||
|
||||
@@ -1096,18 +1132,27 @@ func (m *manager) buildChain(chainParams ChainParameters, sb nets.Net) (*chainIn
|
||||
}
|
||||
|
||||
// expectsStakedBeacons gates the EMPTY-beacon-set behavior of the bootstrap frontier
|
||||
// quorum (see blockHandler.expectsStakedBeacons). True ONLY for a native NON-platform
|
||||
// chain (C/X/Q/...) on a sybil-protected network — those sync against the STAKED
|
||||
// quorum (see blockHandler.expectsStakedBeacons). True for a native NON-platform chain
|
||||
// (C/X/Q/...) on a SYBIL-PROTECTED (real staked) network — those sync against the STAKED
|
||||
// primary-network validator set (m.Validators, populated by the already-bootstrapped
|
||||
// P-chain), so an empty set means "not yet loaded / misconfig → wait then fail safe",
|
||||
// NOT "single-node → done". The P-chain (CustomBeacons may be empty under endpoint-only
|
||||
// --bootstrap-nodes) and skip-bootstrap keep the "empty ⇒ nothing to sync to" behavior.
|
||||
// Computed BEFORE the skip-bootstrap override so it is false in single-node mode.
|
||||
expectsStakedBeacons := !m.SkipBootstrap && ids.IsNativeChain(chainParams.ID) && !isPlatformChain
|
||||
// NOT "single-node → done". Driven by sybil-protection, NOT --skip-bootstrap: a production
|
||||
// validator sets skip-bootstrap and that must NOT make it masquerade as single-node and
|
||||
// wedge behind at its stale local tip (tasks #66/#74). See chainExpectsStakedBeacons.
|
||||
// Discriminate on the validating Net (chainParams.ChainID), NOT the blockchain ID:
|
||||
// deployed C/X/Q carry HASH blockchain IDs, and ids.IsNativeChain only matches the
|
||||
// symbolic 111...C alias form (no deployed chain has it). Keying off the blockchain ID
|
||||
// (the prior ids.IsNativeChain(chainParams.ID)) was therefore ALWAYS false for the real
|
||||
// C-Chain, leaving this fix inert — the exact wedge #66/#74 set out to kill fired anyway.
|
||||
isPrimaryNetworkChain := chainValidatesOnPrimaryNetwork(chainParams.ChainID)
|
||||
expectsStakedBeacons := chainExpectsStakedBeacons(m.SybilProtectionEnabled, isPrimaryNetworkChain, isPlatformChain)
|
||||
|
||||
// In skip-bootstrap mode, use empty beacons for all chains
|
||||
// This enables single-node development mode
|
||||
if m.SkipBootstrap {
|
||||
// skip-bootstrap forces empty beacons (single-node immediate-start) for every chain EXCEPT
|
||||
// one that syncs against the staked set — those MUST always catch a behind validator up from
|
||||
// its peers, so emptying their beacons (the prior UNCONDITIONAL override) is precisely the
|
||||
// rejoin wedge this fixes. A genuine single-node / dev net runs sybil-protection OFF, so its
|
||||
// native chains still fall here and get the empty-beacon immediate-start path.
|
||||
if m.SkipBootstrap && !expectsStakedBeacons {
|
||||
beacons = &emptyValidatorManager{}
|
||||
m.Log.Info("skip-bootstrap enabled - using empty beacons for single-node mode")
|
||||
}
|
||||
@@ -1163,7 +1208,7 @@ func (m *manager) buildChain(chainParams ChainParameters, sb nets.Net) (*chainIn
|
||||
vmConfigBytes := m.injectAutominingConfig(chainParams.VMID, chainConfig.Config)
|
||||
vmConfigBytes = m.injectSecurityProfileConfig(chainParams.VMID, vmConfigBytes)
|
||||
// CONSENSUS-SAFETY (single-proposer-per-height): re-wrap multi-validator
|
||||
// linear chains in proposervm so block production follows the Snowman++
|
||||
// linear chains in proposervm so block production follows the proposervm's
|
||||
// proposer schedule — exactly ONE validator builds height H, the rest wait
|
||||
// and vote. Without it every validator's engine calls BuildBlock
|
||||
// UNCONDITIONALLY at every height off a slightly-different mempool, so two
|
||||
@@ -1200,19 +1245,10 @@ func (m *manager) buildChain(chainParams ChainParameters, sb nets.Net) (*chainIn
|
||||
return nil, fmt.Errorf("refusing to start multi-node chain %s with non-BFT consensus params: %w", chainParams.ID, err)
|
||||
}
|
||||
}
|
||||
// Round-scoped view-change (restores liveness under competing siblings + a zero-margin
|
||||
// quorum — the 415→416 freeze). OPT-IN per deployment via LUX_CONSENSUS_VIEW_CHANGE=true
|
||||
// so devnet/testnet can enable it without a mainnet default (mainnet is owner-gated). Only
|
||||
// meaningful on a multi-validator (K>1) chain; K==1 has no competing proposers. The engine
|
||||
// itself fail-secure HALTS the view-change if the committee fails the 2α−n>f bound, so
|
||||
// enabling it can never weaken safety — at worst it halts (never forks).
|
||||
if consensusParams.K > 1 && strings.EqualFold(os.Getenv("LUX_CONSENSUS_VIEW_CHANGE"), "true") {
|
||||
consensusParams.ViewChange = true
|
||||
m.Log.Info("round-scoped view-change ENABLED for chain",
|
||||
log.Stringer("chainID", chainParams.ID),
|
||||
log.Int("K", consensusParams.K),
|
||||
log.Int("alpha", consensusParams.AlphaConfidence))
|
||||
}
|
||||
// v1.36 "Nova": the round-scoped VIEW-CHANGE (prevote/POL/lock) was DELETED from the
|
||||
// consensus engine (174af3c31). Nova metastable sampling is the sole decider and the ⅔
|
||||
// Quasar attestation trails it — there is no view-change to opt into, so the former
|
||||
// LUX_CONSENSUS_VIEW_CHANGE env gate is gone. Keep the braid dead.
|
||||
_, innerIsDAGNative := vmTyped.(interface {
|
||||
Linearize(context.Context, ids.ID, chan<- vm.Message) error
|
||||
})
|
||||
@@ -1257,24 +1293,31 @@ func (m *manager) buildChain(chainParams ChainParameters, sb nets.Net) (*chainIn
|
||||
if regErr != nil {
|
||||
return nil, fmt.Errorf("failed to register proposervm metrics for chain %s: %w", chainParams.ID, regErr)
|
||||
}
|
||||
minBlkDelay := proposervm.DefaultMinBlockDelay
|
||||
if m.ProposerMinBlockDelay > 0 {
|
||||
minBlkDelay = m.ProposerMinBlockDelay
|
||||
}
|
||||
engineVM = proposervm.New(vmTyped, proposervm.Config{
|
||||
Upgrades: m.Upgrades,
|
||||
NetworkID: networkID, // CRITICAL-3: windower uses the SAME set ID as the cert side
|
||||
MinBlkDelay: proposervm.DefaultMinBlockDelay,
|
||||
NumHistoricalBlocks: proposervm.DefaultNumHistoricalBlocks,
|
||||
StakingLeafSigner: m.StakingTLSSigner,
|
||||
StakingCertLeaf: m.StakingTLSCert,
|
||||
Registerer: proposervmReg,
|
||||
Upgrades: m.Upgrades,
|
||||
NetworkID: networkID, // CRITICAL-3: windower uses the SAME set ID as the cert side
|
||||
MinBlkDelay: minBlkDelay,
|
||||
NumHistoricalBlocks: proposervm.DefaultNumHistoricalBlocks,
|
||||
StakingLeafSigner: m.StakingTLSSigner,
|
||||
StakingCertLeaf: m.StakingTLSCert,
|
||||
StakingMLDSASigner: m.StakingMLDSASigner,
|
||||
StakingMLDSAPub: m.StakingMLDSAPub,
|
||||
ProposerWindowDuration: m.ProposerWindowDuration,
|
||||
Registerer: proposervmReg,
|
||||
})
|
||||
m.Log.Info("wrapping chain VM in proposervm for single-proposer-per-height block production",
|
||||
log.Stringer("chainID", chainParams.ID),
|
||||
log.Int("K", consensusParams.K),
|
||||
log.Stringer("windowerNetworkID", networkID),
|
||||
log.Duration("minBlockDelay", proposervm.DefaultMinBlockDelay))
|
||||
log.Duration("minBlockDelay", minBlkDelay))
|
||||
}
|
||||
|
||||
m.Log.Info("initializing VM", log.Stringer("chainID", chainParams.ID))
|
||||
initCtx, initCancel := context.WithTimeout(context.Background(), 30*time.Second)
|
||||
initCtx, initCancel := context.WithTimeout(context.Background(), vmStartupTimeout)
|
||||
defer initCancel()
|
||||
// Initialize THROUGH engineVM. proposervm.Initialize builds its windower
|
||||
// from chainRuntime.ValidatorState, then initializes the inner VM with the
|
||||
@@ -1342,7 +1385,7 @@ func (m *manager) buildChain(chainParams ChainParameters, sb nets.Net) (*chainIn
|
||||
}); ok {
|
||||
m.Log.Info("linearizing DAG-native VM into linear block mode",
|
||||
log.Stringer("chainID", chainParams.ID))
|
||||
linCtx, linCancel := context.WithTimeout(context.Background(), 30*time.Second)
|
||||
linCtx, linCancel := context.WithTimeout(context.Background(), vmStartupTimeout)
|
||||
if err := linearVM.Linearize(linCtx, ids.Empty, toEngine); err != nil {
|
||||
linCancel()
|
||||
m.Log.Error("failed to linearize VM",
|
||||
@@ -1375,7 +1418,7 @@ func (m *manager) buildChain(chainParams ChainParameters, sb nets.Net) (*chainIn
|
||||
}); ok {
|
||||
m.Log.Info("transitioning VM to bootstrapping (initial sync gates normal operation)",
|
||||
log.Stringer("chainID", chainParams.ID))
|
||||
stateCtx, stateCancel := context.WithTimeout(context.Background(), 30*time.Second)
|
||||
stateCtx, stateCancel := context.WithTimeout(context.Background(), vmStartupTimeout)
|
||||
if err := stateVM.SetState(stateCtx, uint32(vm.Bootstrapping)); err != nil {
|
||||
stateCancel()
|
||||
m.Log.Error("failed to transition VM to bootstrapping",
|
||||
@@ -1519,7 +1562,7 @@ func (m *manager) buildChain(chainParams ChainParameters, sb nets.Net) (*chainIn
|
||||
// the proposervm, whose SignedBlock carries the real P-chain height
|
||||
// (selectChildPChainHeight = max(GetCurrentHeight, parentH)) and exposes
|
||||
// PChainHeight() — the SAME value the engine's pChainHeightOf reads. That
|
||||
// is precisely the Snowman++ mechanism newPChainHeightVM was a stand-in
|
||||
// is precisely the proposervm mechanism newPChainHeightVM was a stand-in
|
||||
// for, so stacking both would double-stamp the height. We keep
|
||||
// newPChainHeightVM only for the unwrapped K>1 chains (P-Chain, X-Chain).
|
||||
if blockBuilder != nil && !wrapInProposerVM {
|
||||
@@ -1530,64 +1573,53 @@ func (m *manager) buildChain(chainParams ChainParameters, sb nets.Net) (*chainIn
|
||||
log.Stringer("networkID", networkID))
|
||||
}
|
||||
}
|
||||
// DEFENSIVE (view-change hygiene): a view-change chain that cannot BROADCAST its
|
||||
// prevotes/precommits (its gossiper is not a QuorumGossiper) or cannot SIGN them (no
|
||||
// VoteSigner) would emit votes into the void — every node tallies only its OWN vote, no
|
||||
// peer ever receives one, α is never reached, and finality silently stalls. Refuse to
|
||||
// start such a chain LOUDLY rather than freeze in production.
|
||||
if consensusParams.ViewChange {
|
||||
if _, ok := netCfg.Gossiper.(consensuschain.QuorumGossiper); !ok {
|
||||
return nil, fmt.Errorf("refusing to start view-change chain %s: gossiper %T does not implement "+
|
||||
"QuorumGossiper — prevotes/precommits could not be broadcast and finality would silently stall",
|
||||
chainParams.ID, netCfg.Gossiper)
|
||||
// EXPORT-FRONTIER BRIDGE (two-tier consensus, v1.36). VM.Accept now advances the
|
||||
// local NOVA (bare-majority) accept tip, which is reorgable and MUST NOT be exported.
|
||||
// Push each EXPORT (Quasar, ⅔-by-stake) frontier advance into the VM so the EVM
|
||||
// `finalized`/`safe` block tags and the warp cross-chain export gate resolve to the
|
||||
// Quasar tip, NEVER the Nova tip (the "semantic collapse" the split exists to prevent).
|
||||
//
|
||||
// Capability-gated, not just interface-gated: the C-Chain EVM runs as a SEPARATE
|
||||
// rpcchainvm plugin process, so vmTyped here is the rpcchainvm *Client, which carries
|
||||
// SetLastQuasarFinalized/LastQuasarHeight for EVERY plugin (they cross the ZAP
|
||||
// boundary). The client learns from the plugin's Initialize handshake whether the
|
||||
// concrete VM actually implements the export capability and reports it via
|
||||
// SupportsQuasarExport — false → the observer stays unwired and this chain is Nova-only
|
||||
// with no per-finalization cross-process no-op. A VM WITHOUT the probe (an in-process
|
||||
// VM whose concrete export methods we hold directly) is treated as capable, preserving
|
||||
// the direct-wire path. Push into the RAW inner VM (vmTyped) — the eth/warp backends
|
||||
// live there, not on the proposervm wrapper.
|
||||
//
|
||||
// Ordering: the observer MUST be set on netCfg BEFORE NewRuntime captures it; the boot
|
||||
// re-seed needs the constructed engine and so runs after. exportVM (nil unless capable)
|
||||
// carries the wired/not-wired decision across that split — a value, not a re-derived
|
||||
// predicate.
|
||||
var exportVM quasarExportVM
|
||||
if qvm, ok := vmTyped.(quasarExportVM); ok {
|
||||
capable := true
|
||||
if probe, hasProbe := vmTyped.(interface{ SupportsQuasarExport() bool }); hasProbe {
|
||||
capable = probe.SupportsQuasarExport()
|
||||
}
|
||||
if netCfg.VoteSigner == nil {
|
||||
return nil, fmt.Errorf("refusing to start view-change chain %s: no VoteSigner wired — this node "+
|
||||
"could not sign its prevotes/precommits and finality would silently stall", chainParams.ID)
|
||||
if capable {
|
||||
exportVM = qvm
|
||||
netCfg.QuasarObserver = func(_ ids.ID, height uint64) {
|
||||
qvm.SetLastQuasarFinalized(height)
|
||||
}
|
||||
m.Log.Info("wired EXPORT-frontier (quasar) bridge into the VM (finalized/safe + warp gate track ⅔-stake finality)",
|
||||
log.Stringer("chainID", chainParams.ID))
|
||||
}
|
||||
}
|
||||
consensusEngine := consensuschain.NewRuntime(netCfg)
|
||||
|
||||
// STALE-LOCK MIGRATION (one-shot, operator-gated). AFTER NewRuntime seeds the durable
|
||||
// view-change locks and BEFORE Start drives any view, optionally CANONICALIZE (or prune)
|
||||
// pre-fix OUTER-wrapper view-change lock metadata ABOVE the decided floor — the block-1082880
|
||||
// durable split-lock: locks stored by the proposervm outer id that the canonical=inner roll
|
||||
// never re-canonicalized, so honest nodes stay locked on stale aliases, split below α, and
|
||||
// never form a POL. All finalized + vote-guard state AT OR BELOW the floor is preserved
|
||||
// verbatim and the floor is never lowered — a narrow metadata migration, not a state reset.
|
||||
// LUX_CONSENSUS_MIGRATE_STALE_LOCKS: "inspect" prints the plan and mutates NOTHING (the
|
||||
// per-pod audit gate); "apply:<floor>" performs the idempotent, safety-gated repair, where
|
||||
// <floor> is the decided floor the operator OBSERVED via inspect (1082879 for the mainnet
|
||||
// one-shot). The explicit target makes the apply SELF-DISARMING: once the chain recovers
|
||||
// and the floor advances past the target, a lingering env no-ops instead of degrading into
|
||||
// an every-boot prune of genuine crash locks (the HIGH-1 regression). A bare "apply" is
|
||||
// REFUSED. Only for a K>1 view-change chain (the only chains that carry these locks).
|
||||
if consensusParams.K > 1 && consensusParams.ViewChange {
|
||||
env := strings.ToLower(os.Getenv("LUX_CONSENSUS_MIGRATE_STALE_LOCKS"))
|
||||
switch {
|
||||
case env == "inspect":
|
||||
logStaleLockReport(m.Log, chainParams.ID, "inspect (no write)", consensusEngine.InspectLocks(context.Background()))
|
||||
case env == "apply" || strings.HasPrefix(env, "apply:"):
|
||||
target, tErr := strconv.ParseUint(strings.TrimPrefix(env, "apply:"), 10, 64)
|
||||
if env == "apply" || tErr != nil {
|
||||
m.Log.Error("stale-lock migration REFUSED: apply requires an explicit floor target — "+
|
||||
"run inspect, read decidedFloor, then set LUX_CONSENSUS_MIGRATE_STALE_LOCKS=apply:<decidedFloor>",
|
||||
log.Stringer("chainID", chainParams.ID), log.String("env", env))
|
||||
break
|
||||
}
|
||||
rep, mErr := consensusEngine.MigrateStaleLocks(context.Background(), target)
|
||||
logStaleLockReport(m.Log, chainParams.ID, "apply", rep)
|
||||
if mErr != nil {
|
||||
return nil, fmt.Errorf("stale-lock migration for chain %s failed (fail-closed, nothing changed): %w", chainParams.ID, mErr)
|
||||
}
|
||||
if rep.Stop {
|
||||
m.Log.Error("stale-lock migration STOPPED — manual recovery required (no write performed)",
|
||||
log.Stringer("chainID", chainParams.ID), log.String("reason", rep.StopReason))
|
||||
}
|
||||
if rep.Skipped {
|
||||
m.Log.Warn("stale-lock migration self-disarmed (no write) — unset LUX_CONSENSUS_MIGRATE_STALE_LOCKS",
|
||||
log.Stringer("chainID", chainParams.ID), log.String("reason", rep.SkipReason))
|
||||
}
|
||||
// Re-seed the consensus EXPORT frontier from the VM's DURABLE Quasar height so
|
||||
// GetQuasarTip / QuasarHeight do not regress on restart (the in-memory frontier resets
|
||||
// to (Empty,0) until a fresh ⅔-stake cert re-forms; the VM persisted the export height).
|
||||
// Advance-only; the observer above refines it as new certs land this session.
|
||||
if exportVM != nil {
|
||||
if h := exportVM.LastQuasarHeight(); h > 0 {
|
||||
consensusEngine.SyncQuasarFrontier(ids.Empty, h)
|
||||
m.Log.Info("re-seeded consensus export (quasar) frontier from the VM's durable height on boot",
|
||||
log.Stringer("chainID", chainParams.ID), log.Uint64("quasarHeight", h))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1605,7 +1637,7 @@ func (m *manager) buildChain(chainParams ChainParameters, sb nets.Net) (*chainIn
|
||||
m.Log.Info("consensus engine started with Lux consensus (Photon → Wave → Focus)",
|
||||
log.Stringer("chainID", chainParams.ID))
|
||||
if blockBuilder != nil {
|
||||
syncCtx, syncCancel := context.WithTimeout(context.Background(), 30*time.Second)
|
||||
syncCtx, syncCancel := context.WithTimeout(context.Background(), vmStartupTimeout)
|
||||
defer syncCancel()
|
||||
lastAcceptedID, height, err := consensuschain.SyncStateFromVM(syncCtx, blockBuilder, consensusEngine.Transitive)
|
||||
if err != nil {
|
||||
@@ -1673,7 +1705,10 @@ func (m *manager) buildChain(chainParams ChainParameters, sb nets.Net) (*chainIn
|
||||
// through (blockBuilder == the P-chain-height wrapper on K>1, the inner VM
|
||||
// on K==1), so the container bytes it parses match the bytes the engine
|
||||
// framed — one codec, no raw-vs-wrapped split.
|
||||
bh := newBlockHandler(blockBuilder, m.Log, consensusEngine, m.Net, m.MsgCreator, chainParams.ID, networkID, beacons, m.NodeID, expectsStakedBeacons)
|
||||
// engineVM is the connectable VM (the proposervm on a wrapped chain, the
|
||||
// inner VM otherwise); it carries Connected/Disconnected, which the router
|
||||
// dispatches so the P-chain uptime tracker observes validator connectivity.
|
||||
bh := newBlockHandler(blockBuilder, engineVM, m.Log, consensusEngine, m.Net, m.MsgCreator, chainParams.ID, networkID, beacons, m.NodeID, expectsStakedBeacons)
|
||||
// Gate this native chain's bootstrap frontier-TRUST on the P-chain having finished its
|
||||
// initial sync, so the staked beacon set (and thus the stake-majority floor denominator)
|
||||
// is the TRUE full validator set, not a partial mid-replay set. Wired ONLY for native
|
||||
@@ -1874,7 +1909,7 @@ func (m *manager) createDAG(
|
||||
}
|
||||
|
||||
// Create a context for VM initialization with timeout
|
||||
initCtx, cancelInit := context.WithTimeout(context.Background(), 30*time.Second)
|
||||
initCtx, cancelInit := context.WithTimeout(context.Background(), vmStartupTimeout)
|
||||
defer cancelInit() // Ensure cleanup on function exit
|
||||
|
||||
// Initialize VM if it supports Initialize
|
||||
@@ -2042,7 +2077,7 @@ func (m *manager) createDAG(
|
||||
|
||||
// Register HTTP handlers for DAG VMs (exchangevm, qvm, etc.)
|
||||
adapter := &dagVMAdapter{underlying: vmImpl}
|
||||
dagHandlerCtx, dagHandlerCancel := context.WithTimeout(context.Background(), 30*time.Second)
|
||||
dagHandlerCtx, dagHandlerCancel := context.WithTimeout(context.Background(), vmStartupTimeout)
|
||||
defer dagHandlerCancel()
|
||||
handlers, err := adapter.CreateHandlers(dagHandlerCtx)
|
||||
if err != nil {
|
||||
@@ -2661,6 +2696,43 @@ func (m *manager) getOrMakeVMGatherer(vmID ids.ID) (metrics.MultiGatherer, error
|
||||
return vmGatherer, nil
|
||||
}
|
||||
|
||||
// chainExpectsStakedBeacons reports whether a chain must sync its bootstrap frontier against the
|
||||
// STAKED primary-network validator set — the ⅔-by-stake quorum that names the network frontier
|
||||
// (blockHandler.expectsStakedBeacons, the C1 forged-chain gate). When true, --skip-bootstrap does
|
||||
// NOT empty the chain's beacon set (buildChain below), so a behind validator always catches up
|
||||
// from its peers.
|
||||
//
|
||||
// It is driven by SYBIL PROTECTION — the true "this is a real staked network" signal — and NOT by
|
||||
// --skip-bootstrap. Production validators set --skip-bootstrap to skip the initial bootstrap WAIT,
|
||||
// but that flag must NEVER disable peer-sync on a staked network. Keying this decision off
|
||||
// --skip-bootstrap (the prior `!m.SkipBootstrap && ...`) is exactly what wedged a behind native
|
||||
// chain (C/X/Q...): with skip-bootstrap set, the chain got expectsStakedBeacons=false + empty
|
||||
// beacons, so FrontierTip reported FrontierNoBeacons ("nothing to sync to"), the node named its
|
||||
// STALE local last-accepted the network frontier, went live there, and never caught up across
|
||||
// restarts until a manual chaindata wipe (tasks #66/#74). A genuine single-node / dev network runs
|
||||
// sybil-protection OFF, so it still takes the empty-beacon immediate-start path. The platform chain
|
||||
// anchors to its own CustomBeacons (not the staked set), so it is excluded here as before; a
|
||||
// single-VALIDATOR staked net (self-only set) is handled downstream by FrontierTip's
|
||||
// hasExternalBeacons rule, which reads the LOADED set.
|
||||
func chainExpectsStakedBeacons(sybilProtectionEnabled, isPrimaryNetworkChain, isPlatformChain bool) bool {
|
||||
return sybilProtectionEnabled && isPrimaryNetworkChain && !isPlatformChain
|
||||
}
|
||||
|
||||
// chainValidatesOnPrimaryNetwork reports whether a chain's validating Net IS the primary
|
||||
// network — the correct discriminator for the "native" C/X/Q/... set that syncs its bootstrap
|
||||
// frontier against the primary-network STAKED validator set. It keys off the validating Net
|
||||
// (subnet) ID, NOT the blockchain ID: deployed C/X/Q carry HASH blockchain IDs, whereas
|
||||
// ids.IsNativeChain only ever matches the symbolic 111...C alias form that NO deployed chain
|
||||
// uses (only the P-chain, at PlatformChainID=111...P, has a symbolic blockchain ID — and it is
|
||||
// excluded as the platform chain anyway). Keying the durable-rejoin discriminator off the
|
||||
// blockchain ID (the prior ids.IsNativeChain(chainParams.ID)) therefore silently excluded every
|
||||
// real C/X/Q and left the fix inert across restarts (#66/#74). The validating Net is
|
||||
// PrimaryNetworkID for C/X/Q and each sovereign L1's own net ID for an L2, so this correctly
|
||||
// keeps the empty-beacon single-node path for L2s while re-enabling peer-sync for C/X/Q.
|
||||
func chainValidatesOnPrimaryNetwork(validatingNetID ids.ID) bool {
|
||||
return validatingNetID == constants.PrimaryNetworkID
|
||||
}
|
||||
|
||||
// emptyValidatorManager implements validators.Manager with no validators
|
||||
type emptyValidatorManager struct{}
|
||||
|
||||
@@ -2776,6 +2848,15 @@ type blockHandler struct {
|
||||
chainID ids.ID // Chain ID for message routing
|
||||
networkID ids.ID // Network ID for validator routing
|
||||
|
||||
// connector receives peer connect/disconnect notifications routed from the
|
||||
// node's chainRouter and forwards them to this chain's VM (e.g. the P-chain
|
||||
// uptime tracker; other VMs use them for their own peer sets). connectedNodes
|
||||
// dedups delivery so a peer the router dispatches once per tracked network is
|
||||
// forwarded to the VM exactly once. A nil connector makes forwarding a no-op.
|
||||
connector chain.ChainVM
|
||||
connMu sync.Mutex
|
||||
connectedNodes set.Set[ids.NodeID]
|
||||
|
||||
// Context sync support - when a block fails verification due to missing context,
|
||||
// we request the prerequisite blocks from the peer to catch up
|
||||
pendingContext map[ids.ID]contextRequest // Map from blockID to pending context request
|
||||
@@ -2950,9 +3031,10 @@ type contextRequest struct {
|
||||
timestamp time.Time
|
||||
}
|
||||
|
||||
func newBlockHandler(vm consensuschain.BlockBuilder, logger log.Logger, engine *consensuschain.Runtime, net network.Network, msgCreator message.OutboundMsgBuilder, chainID ids.ID, networkID ids.ID, beacons validators.Manager, selfNodeID ids.NodeID, expectsStakedBeacons bool) *blockHandler {
|
||||
func newBlockHandler(vm consensuschain.BlockBuilder, connector chain.ChainVM, logger log.Logger, engine *consensuschain.Runtime, net network.Network, msgCreator message.OutboundMsgBuilder, chainID ids.ID, networkID ids.ID, beacons validators.Manager, selfNodeID ids.NodeID, expectsStakedBeacons bool) *blockHandler {
|
||||
return &blockHandler{
|
||||
vm: vm,
|
||||
connector: connector,
|
||||
logger: logger,
|
||||
engine: engine,
|
||||
net: net,
|
||||
@@ -2965,6 +3047,7 @@ func newBlockHandler(vm consensuschain.BlockBuilder, logger log.Logger, engine *
|
||||
pendingContext: make(map[ids.ID]contextRequest),
|
||||
maxContextBlocks: 256, // Default max context blocks to request/serve
|
||||
pendingQbits: make(map[ids.ID][]QbitEvent),
|
||||
connectedNodes: set.NewSet[ids.NodeID](16),
|
||||
bsAncestorCh: make(map[uint32]chan [][]byte),
|
||||
}
|
||||
}
|
||||
@@ -3186,14 +3269,45 @@ func (b *blockHandler) requestContext(ctx context.Context, nodeID ids.NodeID, bl
|
||||
return
|
||||
}
|
||||
|
||||
nodeSet := set.NewSet[ids.NodeID](1)
|
||||
nodeSet.Add(nodeID)
|
||||
// PEER SELECTION (defect #3). The consensus layer signals "I hold a VERIFIED cert
|
||||
// for a block I don't track — fetch it" by passing ids.EmptyNodeID (topology.go:
|
||||
// requestCatchup(cert.Position.BlockID, ids.EmptyNodeID)); picking a real peer is
|
||||
// the node layer's job. The prior code blindly Add(EmptyNodeID) + Send, so
|
||||
// GetAncestors went to ZERO peers (the "sentTo=0" spam on the frozen fleet) and the
|
||||
// certified-but-untracked block was NEVER fetched — the node saw the cert, could not
|
||||
// finalize, and never recovered. When nodeID is Empty, sample real connected peers
|
||||
// that track this chain's network (the SAME selection pollFrontierOnce uses); a valid
|
||||
// cert already gated this request, so asking any network peer is sound (the served
|
||||
// gap is cert-verified on accept).
|
||||
nodeSet := set.NewSet[ids.NodeID](frontierPollSample)
|
||||
if nodeID == ids.EmptyNodeID {
|
||||
for _, p := range b.net.PeerInfo(nil) {
|
||||
if p.TrackedChains.Contains(b.networkID) {
|
||||
nodeSet.Add(p.ID)
|
||||
if nodeSet.Len() >= frontierPollSample {
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
nodeSet.Add(nodeID)
|
||||
}
|
||||
if nodeSet.Len() == 0 {
|
||||
// No reachable peer to serve the block. Release the pending slot so a later tick
|
||||
// (frontier poll → AcceptedFrontier, or a re-gossiped cert) can retry — otherwise
|
||||
// the block stays pinned unrequestable until the TTL reap.
|
||||
b.contextRequestMu.Lock()
|
||||
delete(b.pendingContext, blockID)
|
||||
b.contextRequestMu.Unlock()
|
||||
return
|
||||
}
|
||||
|
||||
sentTo := b.net.Send(msg, nodeSet, b.networkID, 0)
|
||||
b.logger.Info("requested context for missing prerequisites",
|
||||
log.Stringer("from", nodeID),
|
||||
log.Stringer("blockID", blockID),
|
||||
log.Uint32("requestID", requestID),
|
||||
log.Int("asked", nodeSet.Len()),
|
||||
log.Int("sentTo", sentTo.Len()))
|
||||
}
|
||||
|
||||
@@ -3283,10 +3397,31 @@ func (b *blockHandler) GetContext(ctx context.Context, nodeID ids.NodeID, reques
|
||||
log.Stringer("containerID", containerID),
|
||||
log.Uint32("requestID", requestID))
|
||||
|
||||
// Collect context blocks (walk parent chain)
|
||||
// Collect context blocks (walk parent chain).
|
||||
//
|
||||
// SIZE-CHUNKING (the heavy-DEX-block self-heal fix). The response is the Ancestors
|
||||
// wire message, whose UNCOMPRESSED size the peer compressor refuses above the message
|
||||
// cap (constants.DefaultMaxMessageSize; the zstd compressor bounds its input to prevent a
|
||||
// decompression bomb). The old loop bounded ONLY by COUNT (maxContextBlocks=256), so under
|
||||
// heavy DEX load 256 blocks summed to 3.4-5.7 MB > the 2 MB cap, msgCreator.Ancestors FAILED
|
||||
// to build, and the behind validator got NOTHING — it could never resync and fell
|
||||
// permanently behind (the benchmark-proven stall). We now ALSO bound by serialized size:
|
||||
// stop before the accumulated payload would exceed the budget, but ALWAYS include at least
|
||||
// one block so a behind node makes progress every round; the requester re-requests for the
|
||||
// remaining gap (GetAncestors/context is already a multi-round, oldest-first fill). A single
|
||||
// block that alone exceeds the budget is still served (best-effort) so the walk never
|
||||
// deadlocks — the trust-tiered validator cap (peer layer) gives such a block the headroom to
|
||||
// actually send; for a stranger it will be refused by the tight cap, which is correct.
|
||||
var containers [][]byte
|
||||
currentID := containerID
|
||||
|
||||
// Leave margin under the cap for the p2p envelope (chainID, requestID, per-container length
|
||||
// prefixes, compression framing) so the assembled message stays comfortably below the limit.
|
||||
const contextResponseMargin = 128 * 1024 // 128 KiB
|
||||
byteBudget := constants.DefaultMaxMessageSize - contextResponseMargin
|
||||
accumulated := 0
|
||||
truncatedForSize := false
|
||||
|
||||
for i := 0; i < b.maxContextBlocks; i++ {
|
||||
// First check pending blocks (for recently proposed but not yet accepted blocks)
|
||||
// This is critical: when we propose a block and send PullQuery, other validators
|
||||
@@ -3317,6 +3452,14 @@ func (b *blockHandler) GetContext(ctx context.Context, nodeID ids.NodeID, reques
|
||||
certBytes, _ = b.engine.CertForBlock(blk.ID())
|
||||
}
|
||||
entry := encodeCatchupEntry(blk.Bytes(), certBytes)
|
||||
|
||||
// SIZE GATE: stop before exceeding the budget — but never drop the FIRST block, so a
|
||||
// behind node always receives at least one block per request and cannot deadlock.
|
||||
if len(containers) > 0 && accumulated+len(entry) > byteBudget {
|
||||
truncatedForSize = true
|
||||
break
|
||||
}
|
||||
accumulated += len(entry)
|
||||
containers = append([][]byte{entry}, containers...)
|
||||
|
||||
// Get parent ID for next iteration
|
||||
@@ -3352,6 +3495,8 @@ func (b *blockHandler) GetContext(ctx context.Context, nodeID ids.NodeID, reques
|
||||
log.Stringer("to", nodeID),
|
||||
log.Stringer("containerID", containerID),
|
||||
log.Int("numBlocks", len(containers)),
|
||||
log.Int("payloadBytes", accumulated),
|
||||
log.Bool("truncatedForSize", truncatedForSize),
|
||||
log.Int("sentTo", sentTo.Len()))
|
||||
|
||||
return nil
|
||||
@@ -3489,15 +3634,28 @@ func (b *blockHandler) AcceptedFrontier(ctx context.Context, nodeID ids.NodeID,
|
||||
if b.deliverBootstrapFrontier(nodeID, containerID) {
|
||||
return nil
|
||||
}
|
||||
if _, err := b.vm.GetBlock(ctx, containerID); err == nil {
|
||||
return nil // we already have the peer's tip — not behind
|
||||
}
|
||||
if b.engine != nil {
|
||||
if blk, err := b.vm.GetBlock(ctx, containerID); err == nil {
|
||||
// HAVE-BLOCK, LACK-FINALIZATION (defect #5). Holding the peer's tip block does NOT
|
||||
// mean we are caught up. A verified-but-unfinalized block (we voted for it, but the
|
||||
// α-of-K cert never reached us) leaves us behind on the CERT, not the block bytes.
|
||||
// The prior check returned "not behind" on GetBlock success, so such a node NEVER
|
||||
// fetched the missing cert and sat stuck at its unfinalized height forever (the exact
|
||||
// "verified 288 but no cert" condition). Only "have the block AND it is finalized
|
||||
// here" is truly not-behind; otherwise fall through to fetch the cert-carrying gap so
|
||||
// AcceptCatchupBlock can finalize it on its verified cert (no re-vote).
|
||||
if b.engine == nil {
|
||||
return nil
|
||||
}
|
||||
if fin, ok := b.engine.FinalizedBlockAtHeight(blk.Height()); ok && fin == containerID {
|
||||
return nil // have the block AND finalized it — truly not behind
|
||||
}
|
||||
// have the block but not finalized here → behind on the cert → fetch below
|
||||
} else if b.engine != nil {
|
||||
if _, found := b.engine.GetPendingBlock(containerID); found {
|
||||
return nil // already tracked
|
||||
return nil // already tracked (pending) — the live path is handling it
|
||||
}
|
||||
}
|
||||
b.requestContext(ctx, nodeID, containerID) // behind → fetch the gap
|
||||
b.requestContext(ctx, nodeID, containerID) // behind (missing block OR its cert) → fetch the gap
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -3883,10 +4041,6 @@ func (b *blockHandler) Gossip(ctx context.Context, nodeID ids.NodeID, msg []byte
|
||||
b.engine.HandleIncomingVote(blockID, payload)
|
||||
case quorumKindCert:
|
||||
b.engine.HandleIncomingCert(payload)
|
||||
case quorumKindPrevote:
|
||||
// Round-scoped view-change prevote: the engine decodes+verifies
|
||||
// (height,round,canonical,sig) from the payload and tallies it toward a POL.
|
||||
b.engine.HandleIncomingPrevote(payload)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@@ -3912,9 +4066,69 @@ func (b *blockHandler) GetStateSummary(ctx context.Context, nodeID ids.NodeID, r
|
||||
func (b *blockHandler) StateSummary(ctx context.Context, nodeID ids.NodeID, requestID uint32, summary []byte) error {
|
||||
return nil
|
||||
}
|
||||
func (b *blockHandler) Connected(ctx context.Context, nodeID ids.NodeID) error { return nil }
|
||||
func (b *blockHandler) Disconnected(ctx context.Context, nodeID ids.NodeID) error { return nil }
|
||||
func (b *blockHandler) HealthCheck(ctx context.Context) (interface{}, error) { return nil, nil }
|
||||
|
||||
// Connected satisfies handler.Handler, whose interface carries no peer version.
|
||||
// The real delivery path is ConnectedWithVersion (chainRouter uses it via the
|
||||
// versionedConnector capability); this nil-version entry exists only for the
|
||||
// interface contract and any non-router caller.
|
||||
func (b *blockHandler) Connected(ctx context.Context, nodeID ids.NodeID) error {
|
||||
return b.connect(ctx, nodeID, nil)
|
||||
}
|
||||
|
||||
// ConnectedWithVersion forwards a peer connection WITH its real application
|
||||
// version to this chain's VM. chainRouter invokes this (detecting the
|
||||
// versionedConnector capability) so the version survives to the inner VM:
|
||||
// proposervm promotes Connected to the C-Chain (coreth), whose state-sync peer
|
||||
// tracker compares peer versions — a nil version there dereferences nil and
|
||||
// panics a state-syncing node (a fresh join OR a validator rejoining after
|
||||
// falling behind). This mirrors avalanchego, which delivers msg.NodeVersion to
|
||||
// engine.Connected.
|
||||
func (b *blockHandler) ConnectedWithVersion(ctx context.Context, nodeID ids.NodeID, nodeVersion *version.Application) error {
|
||||
return b.connect(ctx, nodeID, nodeVersion)
|
||||
}
|
||||
|
||||
// connect forwards a peer connection to this chain's VM exactly once, carrying
|
||||
// nodeVersion (nil only on the interface path). The P-chain VM records it in its
|
||||
// uptime tracker; the C-Chain/X-Chain VMs store the version for their peer sets.
|
||||
// A nil connector makes this a no-op. On a forwarding error the dedup entry is
|
||||
// rolled back so a subsequent dispatch of the same connection retries.
|
||||
func (b *blockHandler) connect(ctx context.Context, nodeID ids.NodeID, nodeVersion *version.Application) error {
|
||||
if b.connector == nil {
|
||||
return nil
|
||||
}
|
||||
b.connMu.Lock()
|
||||
if b.connectedNodes.Contains(nodeID) {
|
||||
b.connMu.Unlock()
|
||||
return nil
|
||||
}
|
||||
b.connectedNodes.Add(nodeID)
|
||||
b.connMu.Unlock()
|
||||
|
||||
if err := b.connector.Connected(ctx, nodeID, nodeVersion); err != nil {
|
||||
b.connMu.Lock()
|
||||
b.connectedNodes.Remove(nodeID)
|
||||
b.connMu.Unlock()
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Disconnected forwards a peer disconnection to this chain's VM exactly once.
|
||||
func (b *blockHandler) Disconnected(ctx context.Context, nodeID ids.NodeID) error {
|
||||
if b.connector == nil {
|
||||
return nil
|
||||
}
|
||||
b.connMu.Lock()
|
||||
if !b.connectedNodes.Contains(nodeID) {
|
||||
b.connMu.Unlock()
|
||||
return nil
|
||||
}
|
||||
b.connectedNodes.Remove(nodeID)
|
||||
b.connMu.Unlock()
|
||||
|
||||
return b.connector.Disconnected(ctx, nodeID)
|
||||
}
|
||||
func (b *blockHandler) HealthCheck(ctx context.Context) (interface{}, error) { return nil, nil }
|
||||
func (b *blockHandler) Stop(ctx context.Context) {
|
||||
if b.pollerCancel != nil {
|
||||
b.pollerCancel()
|
||||
@@ -4132,30 +4346,6 @@ func (n *noopWarpSender) SendGossip(ctx context.Context, config warp.SendConfig,
|
||||
return nil
|
||||
}
|
||||
|
||||
// logStaleLockReport renders a stale-lock migration plan as an auditable per-height trace table in
|
||||
// the node log (one line per lock above the decided floor: the persisted outer id, the inner
|
||||
// canonical it resolves to, the lock round, whether a cert binds the height, and the planned
|
||||
// disposition in the Reason). Used by both the read-only inspect mode and the apply mode so the
|
||||
// operator sees the identical plan before and after a write.
|
||||
func logStaleLockReport(logger log.Logger, chainID ids.ID, mode string, rep consensuschain.LockMigrationReport) {
|
||||
logger.Warn("stale-lock migration report",
|
||||
log.Stringer("chainID", chainID), log.String("mode", mode),
|
||||
log.Uint64("decidedFloor", rep.DecidedFloor), log.Uint64("finalizedThrough", rep.FinalizedThrough),
|
||||
log.Int("locksAboveFloor", len(rep.Entries)), log.Bool("changed", rep.Changed),
|
||||
log.Bool("stop", rep.Stop), log.String("stopReason", rep.StopReason))
|
||||
for _, e := range rep.Entries {
|
||||
logger.Warn("stale-lock entry",
|
||||
log.Stringer("chainID", chainID),
|
||||
log.Uint64("height", e.Height),
|
||||
log.Stringer("lockOuter", e.LockOuter),
|
||||
log.Stringer("lockInner", e.LockCanon),
|
||||
log.Uint32("lockRound", e.LockRound),
|
||||
log.Bool("hasRound", e.HasRound),
|
||||
log.Bool("certAt", e.CertAt),
|
||||
log.String("plan", e.Reason))
|
||||
}
|
||||
}
|
||||
|
||||
// networkGossiper implements consensuschain.Gossiper for Lux consensus integration.
|
||||
// It adapts the node's network layer to the minimal Gossiper interface used by
|
||||
// the integrated consensus engine.
|
||||
@@ -4225,23 +4415,9 @@ func (g *networkGossiper) BroadcastVote(chainID ids.ID, networkID ids.ID, blockI
|
||||
return g.net.Gossip(msg, nil, g.networkID, -1, 0, 0).Len()
|
||||
}
|
||||
|
||||
// BroadcastPrevote sends this node's signed ROUND-SCOPED view-change prevote (the
|
||||
// non-binding preference signal) for `canonical` at (height, round) to ALL validators,
|
||||
// framed in a quorum envelope (kind 3) and decoded by blockHandler.Gossip into
|
||||
// engine.HandleIncomingPrevote. Prevotes never finalize anything — they drive the POL +
|
||||
// the lock/unlock rule that lets a competing-sibling split RE-CONVERGE (liveness under a
|
||||
// down proposer + zero-margin quorum). Only emitted when the chain runs params.ViewChange.
|
||||
func (g *networkGossiper) BroadcastPrevote(chainID ids.ID, networkID ids.ID, height uint64, round uint32, canonical ids.ID, voteBytes []byte) int {
|
||||
if g.net == nil || g.msgCreator == nil {
|
||||
return 0
|
||||
}
|
||||
envelope := encodeQuorumGossip(quorumKindPrevote, canonical, voteBytes)
|
||||
msg, err := g.msgCreator.Gossip(chainID, envelope)
|
||||
if err != nil {
|
||||
return 0
|
||||
}
|
||||
return g.net.Gossip(msg, nil, g.networkID, -1, 0, 0).Len()
|
||||
}
|
||||
// v1.36 "Nova": BroadcastPrevote was DELETED — the round-scoped view-change (prevote/POL/lock)
|
||||
// it fed no longer exists in the consensus engine (174af3c31). Nova sampling decides; the ⅔
|
||||
// Quasar attestation (a plain accept-vote, gossiped via BroadcastVote) trails it. Keep the braid dead.
|
||||
|
||||
// GossipCert broadcasts an assembled α-of-K finality cert to ALL validators so
|
||||
// followers finalize blockID on a verifiable proof (HandleIncomingCert), not a
|
||||
|
||||
+18
-10
@@ -89,7 +89,7 @@ func selectConsensusParams(sybilProtection bool, networkID uint32) consensusconf
|
||||
|
||||
// shouldWrapInProposerVM decides whether a linear chain.ChainVM is wrapped in
|
||||
// proposervm to enforce single-proposer-per-height block production (the
|
||||
// Snowman++ window). It is the SINGLE policy gate (the manager calls it once);
|
||||
// proposer window). It is the SINGLE policy gate (the manager calls it once);
|
||||
// keeping it a pure function makes the policy unit-testable without standing up
|
||||
// a whole chain. All three conditions must hold:
|
||||
//
|
||||
@@ -267,6 +267,16 @@ func (s *validatorStakeSource) TotalStake(height uint64) uint64 {
|
||||
return total
|
||||
}
|
||||
|
||||
// ValidatorCount implements consensuschain.StakeSource. The number of DISTINCT
|
||||
// validators in the set IN FORCE AT height — the round-scoped view-change's BFT
|
||||
// committee size (it sizes its POL/precommit quorum to bftAlpha over this count,
|
||||
// NOT the oversized sample K). Read from the SAME height-indexed set as
|
||||
// Weight/TotalStake so every node computes the identical committee and the
|
||||
// count-quorum matches the ⅔-by-stake set exactly.
|
||||
func (s *validatorStakeSource) ValidatorCount(height uint64) int {
|
||||
return len(validatorSetAtHeight(s.state, s.networkID, height))
|
||||
}
|
||||
|
||||
var _ consensuschain.StakeSource = (*validatorStakeSource)(nil)
|
||||
|
||||
// --- validator-set-root source (MEDIUM: epoch binding) -----------------------
|
||||
@@ -364,17 +374,15 @@ func hashValidatorSet(set map[ids.NodeID]*validators.GetValidatorOutput) ids.ID
|
||||
//
|
||||
// kind 1 = signed vote (payload = engine encodeSignedVote: nodeID+sig)
|
||||
// kind 2 = finality cert (payload = engine cert MarshalBinary)
|
||||
// kind 3 = round-scoped view-change PREVOTE (payload = engine encodeSignedPrevote:
|
||||
// nodeID+height+round+canonical+sig, domain "LUX/chain/prevote/v1"). The
|
||||
// envelope blockID field carries the canonical for routing but is advisory —
|
||||
// HandleIncomingPrevote decodes the authoritative (height,round,canonical) from
|
||||
// the payload and verifies the signature over the reconstructed message.
|
||||
// (round-scoped view-change prevotes are engine-INTERNAL since consensus v1.36 —
|
||||
// the node no longer frames or routes a prevote kind)
|
||||
var quorumGossipMagic = [4]byte{'L', 'X', 'Q', 0x01}
|
||||
|
||||
const (
|
||||
quorumKindVote byte = 1
|
||||
quorumKindCert byte = 2
|
||||
quorumKindPrevote byte = 3
|
||||
quorumKindVote byte = 1
|
||||
quorumKindCert byte = 2
|
||||
// kind 3 (prevote) was DELETED with the v1.36 view-change rip-out (174af3c31); Nova sampling
|
||||
// decides and the ⅔ Quasar attestation rides quorumKindVote. Do not reuse 3 — keep the braid dead.
|
||||
)
|
||||
|
||||
// ErrNotQuorumGossip signals a payload is not a quorum envelope (so the caller
|
||||
@@ -400,7 +408,7 @@ func decodeQuorumGossip(data []byte) (kind byte, blockID ids.ID, payload []byte,
|
||||
kind = data[4]
|
||||
copy(blockID[:], data[5:5+32])
|
||||
payload = data[5+32:]
|
||||
if kind != quorumKindVote && kind != quorumKindCert && kind != quorumKindPrevote {
|
||||
if kind != quorumKindVote && kind != quorumKindCert {
|
||||
return 0, ids.Empty, nil, ErrNotQuorumGossip
|
||||
}
|
||||
return kind, blockID, payload, nil
|
||||
|
||||
@@ -1,244 +0,0 @@
|
||||
# Robust RPC Handler Registration System
|
||||
|
||||
## Overview
|
||||
|
||||
This package provides a bulletproof RPC handler registration system for the Lux node, designed to handle the complexities of local development where nodes are frequently restarted. It replaces the fragile inline registration logic with a robust, maintainable solution.
|
||||
|
||||
## Key Features
|
||||
|
||||
### 🔄 Automatic Retry Logic
|
||||
- Exponential backoff for transient failures
|
||||
- Configurable retry count and wait times
|
||||
- Context-aware cancellation support
|
||||
|
||||
### ✅ Built-in Health Checks
|
||||
- Automatic validation after registration
|
||||
- Batch health checking for all chains
|
||||
- Detailed diagnostics for failures
|
||||
|
||||
### 🎯 Single Source of Truth
|
||||
- Centralized route construction logic
|
||||
- Consistent path formatting
|
||||
- No duplicate code or magic strings
|
||||
|
||||
### 🛡️ Defensive Programming
|
||||
- Nil checks on all inputs
|
||||
- Handler validation before registration
|
||||
- Graceful degradation on failures
|
||||
|
||||
### 📊 Developer-Friendly Debugging
|
||||
- Clear, actionable error messages
|
||||
- Comprehensive logging at appropriate levels
|
||||
- Built-in diagnostic tools
|
||||
|
||||
## Architecture
|
||||
|
||||
```
|
||||
┌─────────────────────┐
|
||||
│ Chain Manager │
|
||||
└──────────┬──────────┘
|
||||
│ Creates Chain
|
||||
▼
|
||||
┌─────────────────────┐
|
||||
│ ChainHandlerRegistrar│
|
||||
└──────────┬──────────┘
|
||||
│ Extracts Handlers
|
||||
▼
|
||||
┌─────────────────────┐
|
||||
│ Handler Manager │
|
||||
└──────────┬──────────┘
|
||||
│ Registers with Retries
|
||||
▼
|
||||
┌─────────────────────┐
|
||||
│ API Server │
|
||||
└─────────────────────┘
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
### Basic Integration
|
||||
|
||||
Replace the handler registration code in `chains/manager.go` (lines 941-990) with:
|
||||
|
||||
```go
|
||||
// Create robust registrar
|
||||
registrar := rpc.NewChainHandlerRegistrar(
|
||||
m.Server,
|
||||
m.Log,
|
||||
m.CChainID,
|
||||
m.PChainID,
|
||||
)
|
||||
|
||||
// Register handlers
|
||||
if err := registrar.RegisterChainHandlers(ctx, chainParams.ID, chain.VM); err != nil {
|
||||
m.Log.Error("Failed to register handlers", log.Err(err))
|
||||
// Decide if this should be fatal or not
|
||||
}
|
||||
```
|
||||
|
||||
### Configuration
|
||||
|
||||
```go
|
||||
// Development environment - fail fast
|
||||
registrar.SetRetryConfig(2, 50*time.Millisecond)
|
||||
|
||||
// Production environment - more robust
|
||||
registrar.SetRetryConfig(5, 200*time.Millisecond)
|
||||
```
|
||||
|
||||
### Debugging
|
||||
|
||||
```go
|
||||
// Get route information
|
||||
info, exists := registrar.GetRouteInfo(chainID)
|
||||
if exists {
|
||||
fmt.Printf("Chain %s routes: %v\n", chainID, info.Endpoints)
|
||||
}
|
||||
|
||||
// Run health checks
|
||||
results := registrar.HealthCheckAll()
|
||||
for chainID, healthy := range results {
|
||||
fmt.Printf("Chain %s: %v\n", chainID, healthy)
|
||||
}
|
||||
|
||||
// Validate specific endpoint
|
||||
err := registrar.ValidateEndpoint(chainID, "/rpc")
|
||||
```
|
||||
|
||||
### Using the Debug Tool
|
||||
|
||||
```go
|
||||
// Quick diagnosis from CLI
|
||||
rpc.QuickDiagnose("localhost:9650", chainID, "C")
|
||||
|
||||
// Programmatic diagnosis
|
||||
tool := rpc.NewDebugTool("localhost:9650", logger)
|
||||
report := tool.DiagnoseEndpoint(chainID, "C")
|
||||
fmt.Println(report.String())
|
||||
```
|
||||
|
||||
## Components
|
||||
|
||||
### HandlerManager (`handler_manager.go`)
|
||||
Core registration logic with retry mechanism and health checks.
|
||||
|
||||
**Key Methods:**
|
||||
- `RegisterChainHandlers()` - Main registration entry point
|
||||
- `HealthCheckRoute()` - Validates handler responsiveness
|
||||
- `GetRouteInfo()` - Retrieves registration details
|
||||
|
||||
### ChainHandlerRegistrar (`chain_integration.go`)
|
||||
Bridge between chain manager and handler manager.
|
||||
|
||||
**Key Methods:**
|
||||
- `RegisterChainHandlers()` - Extracts and registers handlers
|
||||
- `ValidateEndpoint()` - Tests specific endpoints
|
||||
- `GetAllRoutes()` - Returns all registered routes
|
||||
|
||||
### DebugTool (`debug_tool.go`)
|
||||
Comprehensive endpoint diagnostics for developers.
|
||||
|
||||
**Key Methods:**
|
||||
- `DiagnoseEndpoint()` - Full endpoint analysis
|
||||
- `QuickDiagnose()` - CLI-friendly diagnosis
|
||||
|
||||
## Error Handling
|
||||
|
||||
The system uses clear, actionable errors:
|
||||
|
||||
```go
|
||||
errNilHandler = errors.New("handler is nil")
|
||||
errNilServer = errors.New("server is nil")
|
||||
errEmptyEndpoint = errors.New("endpoint is empty")
|
||||
errRegistrationFailed = errors.New("handler registration failed")
|
||||
errHealthCheckFailed = errors.New("health check failed")
|
||||
```
|
||||
|
||||
Each error includes context about what failed and why.
|
||||
|
||||
## Testing
|
||||
|
||||
Comprehensive test coverage including:
|
||||
- Successful registration scenarios
|
||||
- Validation failure cases
|
||||
- Retry logic verification
|
||||
- Health check validation
|
||||
- Context cancellation
|
||||
- Performance benchmarks
|
||||
|
||||
Run tests:
|
||||
```bash
|
||||
go test ./chains/rpc/... -v
|
||||
```
|
||||
|
||||
## Common Issues and Solutions
|
||||
|
||||
### Issue: Handlers not accessible after registration
|
||||
**Solution:** Check health status with `HealthCheckAll()` and review debug output.
|
||||
|
||||
### Issue: Registration fails with "already exists"
|
||||
**Solution:** The retry logic handles this. If persistent, check for duplicate registration attempts.
|
||||
|
||||
### Issue: Slow registration during development
|
||||
**Solution:** Reduce retry count and wait time using `SetRetryConfig()`.
|
||||
|
||||
### Issue: Can't find the correct endpoint URL
|
||||
**Solution:** Use `DebugTool.DiagnoseEndpoint()` to test all URL patterns.
|
||||
|
||||
## Migration Guide
|
||||
|
||||
1. **Update imports:**
|
||||
```go
|
||||
import "github.com/luxfi/node/chains/rpc"
|
||||
```
|
||||
|
||||
2. **Replace inline registration (lines 941-990 in manager.go):**
|
||||
```go
|
||||
// Old code: complex type checking and manual registration
|
||||
// New code: single function call
|
||||
registrar := rpc.NewChainHandlerRegistrar(...)
|
||||
registrar.RegisterChainHandlers(...)
|
||||
```
|
||||
|
||||
3. **Add health monitoring (optional):**
|
||||
```go
|
||||
go func() {
|
||||
time.Sleep(5 * time.Second)
|
||||
registrar.HealthCheckAll()
|
||||
}()
|
||||
```
|
||||
|
||||
4. **Add debugging endpoints (optional):**
|
||||
```go
|
||||
http.HandleFunc("/debug/handlers", func(w http.ResponseWriter, r *http.Request) {
|
||||
routes := registrar.GetAllRoutes()
|
||||
json.NewEncoder(w).Encode(routes)
|
||||
})
|
||||
```
|
||||
|
||||
## Performance
|
||||
|
||||
- Registration: ~1ms per handler (without retries)
|
||||
- Health check: ~10ms per chain
|
||||
- Memory overhead: ~1KB per registered chain
|
||||
- No goroutine leaks or resource issues
|
||||
|
||||
## Future Improvements
|
||||
|
||||
Potential enhancements:
|
||||
- Metrics integration for registration success/failure rates
|
||||
- Automatic re-registration on failure
|
||||
- WebSocket-specific health checks
|
||||
- gRPC handler support
|
||||
- Handler versioning for upgrades
|
||||
|
||||
## Philosophy
|
||||
|
||||
This implementation follows core Go principles:
|
||||
- **Explicit over implicit** - Clear registration flow
|
||||
- **Errors are values** - Proper error handling throughout
|
||||
- **Simple over clever** - Straightforward retry logic
|
||||
- **Composition over inheritance** - Small, focused components
|
||||
- **Documentation is code** - Self-documenting with clear names
|
||||
|
||||
The system is designed to be bulletproof for development while remaining simple to understand and maintain.
|
||||
@@ -1,168 +0,0 @@
|
||||
// Copyright (C) 2019-2025, Lux Industries Inc. All rights reserved.
|
||||
// See the file LICENSE for licensing terms.
|
||||
|
||||
package rpc
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"github.com/luxfi/ids"
|
||||
"github.com/luxfi/log"
|
||||
"github.com/luxfi/node/server/http"
|
||||
"github.com/luxfi/node/vms"
|
||||
)
|
||||
|
||||
// ChainHandlerRegistrar provides a clean interface for chain manager to register handlers.
|
||||
// This replaces the inline registration logic with a more robust, testable solution.
|
||||
type ChainHandlerRegistrar struct {
|
||||
manager *HandlerManager
|
||||
server server.Server
|
||||
log log.Logger
|
||||
cChainID ids.ID // Special handling for C-Chain
|
||||
pChainID ids.ID // Platform chain ID for validation
|
||||
}
|
||||
|
||||
// NewChainHandlerRegistrar creates a registrar for chain handler registration.
|
||||
// Encapsulates all the registration logic in one place.
|
||||
func NewChainHandlerRegistrar(
|
||||
server server.Server,
|
||||
logger log.Logger,
|
||||
cChainID ids.ID,
|
||||
pChainID ids.ID,
|
||||
) *ChainHandlerRegistrar {
|
||||
return &ChainHandlerRegistrar{
|
||||
manager: NewHandlerManager(server, logger),
|
||||
server: server,
|
||||
log: logger,
|
||||
cChainID: cChainID,
|
||||
pChainID: pChainID,
|
||||
}
|
||||
}
|
||||
|
||||
// RegisterChainHandlers is the main entry point from chain manager.
|
||||
// Handles all the complexity of VM type checking and handler extraction.
|
||||
func (r *ChainHandlerRegistrar) RegisterChainHandlers(
|
||||
ctx context.Context,
|
||||
chainID ids.ID,
|
||||
vm interface{},
|
||||
) error {
|
||||
r.log.Info("Attempting to register chain handlers",
|
||||
log.Stringer("chainID", chainID),
|
||||
log.String("vmType", fmt.Sprintf("%T", vm)))
|
||||
|
||||
// Don't register handlers for Platform VM
|
||||
if chainID == r.pChainID {
|
||||
r.log.Debug("Skipping handler registration for Platform VM")
|
||||
return nil
|
||||
}
|
||||
|
||||
// Extract handlers from VM
|
||||
handlers, err := r.extractHandlers(ctx, vm)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to extract handlers: %w", err)
|
||||
}
|
||||
|
||||
if len(handlers) == 0 {
|
||||
r.log.Info("VM does not provide any handlers",
|
||||
log.Stringer("chainID", chainID))
|
||||
return nil
|
||||
}
|
||||
|
||||
// Determine chain alias (special case for C-Chain)
|
||||
alias := r.getChainAlias(chainID)
|
||||
|
||||
// Register with robust handler manager
|
||||
return r.manager.RegisterChainHandlers(ctx, chainID, alias, handlers)
|
||||
}
|
||||
|
||||
// extractHandlers attempts to get handlers from the VM using multiple strategies.
|
||||
// Handles different VM wrapper types gracefully.
|
||||
func (r *ChainHandlerRegistrar) extractHandlers(
|
||||
ctx context.Context,
|
||||
vm interface{},
|
||||
) (map[string]http.Handler, error) {
|
||||
// First try direct interface check
|
||||
if provider, ok := vm.(vms.HandlerProvider); ok {
|
||||
r.log.Debug("VM directly implements HandlerProvider")
|
||||
return provider.CreateHandlers(ctx)
|
||||
}
|
||||
|
||||
// Try using the delegate helper (handles wrapped VMs)
|
||||
handlers, err := vms.DelegateHandlers(ctx, vm)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("handler delegation failed: %w", err)
|
||||
}
|
||||
|
||||
if len(handlers) > 0 {
|
||||
r.log.Debug("Successfully extracted handlers via delegation",
|
||||
log.Int("count", len(handlers)))
|
||||
}
|
||||
|
||||
return handlers, nil
|
||||
}
|
||||
|
||||
// getChainAlias returns the appropriate alias for a chain.
|
||||
// C-Chain gets special treatment, others use their ID.
|
||||
func (r *ChainHandlerRegistrar) getChainAlias(chainID ids.ID) string {
|
||||
if chainID == r.cChainID {
|
||||
return "C"
|
||||
}
|
||||
// Could extend this for X-Chain and P-Chain if needed
|
||||
return ""
|
||||
}
|
||||
|
||||
// GetRouteInfo returns information about a specific chain's registered routes.
|
||||
// Useful for debugging and operational visibility.
|
||||
func (r *ChainHandlerRegistrar) GetRouteInfo(chainID ids.ID) (*RouteInfo, bool) {
|
||||
return r.manager.GetRouteInfo(chainID)
|
||||
}
|
||||
|
||||
// GetAllRoutes returns all registered routes across all chains.
|
||||
// Complete visibility for monitoring and debugging.
|
||||
func (r *ChainHandlerRegistrar) GetAllRoutes() map[string]*RouteInfo {
|
||||
return r.manager.GetAllRoutes()
|
||||
}
|
||||
|
||||
// HealthCheckAll performs health checks on all registered routes.
|
||||
// Returns a map of chainID -> healthy status.
|
||||
func (r *ChainHandlerRegistrar) HealthCheckAll() map[string]bool {
|
||||
return r.manager.HealthCheckAll()
|
||||
}
|
||||
|
||||
// SetRetryConfig allows tuning of retry behavior for different environments.
|
||||
// Production might want more retries, dev might want faster failures.
|
||||
func (r *ChainHandlerRegistrar) SetRetryConfig(maxRetries int, initialWait time.Duration) {
|
||||
r.manager.SetRetryConfig(maxRetries, initialWait)
|
||||
}
|
||||
|
||||
// ValidateEndpoint performs a test request against a specific endpoint.
|
||||
// Useful for debugging specific handler issues.
|
||||
func (r *ChainHandlerRegistrar) ValidateEndpoint(
|
||||
chainID ids.ID,
|
||||
endpoint string,
|
||||
) error {
|
||||
info, exists := r.manager.GetRouteInfo(chainID)
|
||||
if !exists {
|
||||
return fmt.Errorf("no routes registered for chain %s", chainID)
|
||||
}
|
||||
|
||||
// Build the full URL
|
||||
fullURL := fmt.Sprintf("/ext/%s%s", info.Base, endpoint)
|
||||
|
||||
r.log.Info("Validating endpoint",
|
||||
log.Stringer("chainID", chainID),
|
||||
log.String("url", fullURL))
|
||||
|
||||
// Validates endpoint registration
|
||||
for _, registered := range info.Endpoints {
|
||||
if registered == endpoint {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
return fmt.Errorf("endpoint %s not found in registered endpoints: %v",
|
||||
endpoint, info.Endpoints)
|
||||
}
|
||||
@@ -1,302 +0,0 @@
|
||||
// Copyright (C) 2019-2025, Lux Industries Inc. All rights reserved.
|
||||
// See the file LICENSE for licensing terms.
|
||||
|
||||
package rpc
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"github.com/go-json-experiment/json"
|
||||
"fmt"
|
||||
"io"
|
||||
"net/http"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/luxfi/ids"
|
||||
"github.com/luxfi/log"
|
||||
)
|
||||
|
||||
// DebugTool provides utilities for debugging RPC handler issues.
|
||||
// Developer-friendly diagnostics with clear, actionable output.
|
||||
type DebugTool struct {
|
||||
baseURL string
|
||||
client *http.Client
|
||||
log log.Logger
|
||||
}
|
||||
|
||||
// NewDebugTool creates a debug tool for RPC endpoint testing.
|
||||
func NewDebugTool(baseURL string, logger log.Logger) *DebugTool {
|
||||
if !strings.HasPrefix(baseURL, "http") {
|
||||
baseURL = "http://" + baseURL
|
||||
}
|
||||
|
||||
return &DebugTool{
|
||||
baseURL: strings.TrimSuffix(baseURL, "/"),
|
||||
client: &http.Client{
|
||||
Timeout: 10 * time.Second,
|
||||
},
|
||||
log: logger,
|
||||
}
|
||||
}
|
||||
|
||||
// DiagnoseEndpoint performs comprehensive diagnostics on an RPC endpoint.
|
||||
// Returns detailed information about what's working and what's not.
|
||||
func (d *DebugTool) DiagnoseEndpoint(chainID ids.ID, alias string) *DiagnosticReport {
|
||||
report := &DiagnosticReport{
|
||||
ChainID: chainID,
|
||||
Alias: alias,
|
||||
Timestamp: time.Now(),
|
||||
Tests: make([]TestResult, 0),
|
||||
}
|
||||
|
||||
// Test different URL patterns
|
||||
urlPatterns := d.getURLPatterns(chainID, alias)
|
||||
|
||||
for _, pattern := range urlPatterns {
|
||||
result := d.testEndpoint(pattern)
|
||||
report.Tests = append(report.Tests, result)
|
||||
}
|
||||
|
||||
// Test common RPC methods
|
||||
if bestURL := report.GetBestURL(); bestURL != "" {
|
||||
report.RPCTests = d.testRPCMethods(bestURL)
|
||||
}
|
||||
|
||||
return report
|
||||
}
|
||||
|
||||
// getURLPatterns returns all possible URL patterns to test.
|
||||
func (d *DebugTool) getURLPatterns(chainID ids.ID, alias string) []string {
|
||||
patterns := []string{
|
||||
fmt.Sprintf("%s/v1/bc/%s/rpc", d.baseURL, chainID.String()),
|
||||
fmt.Sprintf("%s/v1/bc/%s/ws", d.baseURL, chainID.String()),
|
||||
fmt.Sprintf("%s/v1/bc/%s", d.baseURL, chainID.String()),
|
||||
}
|
||||
|
||||
if alias != "" && alias != chainID.String() {
|
||||
patterns = append(patterns,
|
||||
fmt.Sprintf("%s/v1/bc/%s/rpc", d.baseURL, alias),
|
||||
fmt.Sprintf("%s/v1/bc/%s/ws", d.baseURL, alias),
|
||||
fmt.Sprintf("%s/v1/bc/%s", d.baseURL, alias),
|
||||
)
|
||||
}
|
||||
|
||||
// Also test without /v1 prefix (some setups might differ)
|
||||
patterns = append(patterns,
|
||||
fmt.Sprintf("%s/bc/%s/rpc", d.baseURL, chainID.String()),
|
||||
)
|
||||
|
||||
return patterns
|
||||
}
|
||||
|
||||
// testEndpoint tests a single endpoint URL.
|
||||
func (d *DebugTool) testEndpoint(url string) TestResult {
|
||||
result := TestResult{
|
||||
URL: url,
|
||||
Timestamp: time.Now(),
|
||||
}
|
||||
|
||||
// First try a simple GET
|
||||
resp, err := d.client.Get(url)
|
||||
if err != nil {
|
||||
result.Error = fmt.Sprintf("GET failed: %v", err)
|
||||
result.Success = false
|
||||
return result
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
|
||||
result.StatusCode = resp.StatusCode
|
||||
|
||||
// Read body for debugging
|
||||
bodyBytes, _ := io.ReadAll(resp.Body)
|
||||
result.Response = string(bodyBytes)
|
||||
|
||||
// Now try a POST with JSON-RPC
|
||||
rpcReq := map[string]interface{}{
|
||||
"jsonrpc": "2.0",
|
||||
"method": "web3_clientVersion",
|
||||
"params": []interface{}{},
|
||||
"id": 1,
|
||||
}
|
||||
|
||||
jsonBytes, _ := json.Marshal(rpcReq)
|
||||
postResp, err := d.client.Post(url, "application/json", bytes.NewReader(jsonBytes))
|
||||
if err != nil {
|
||||
result.Error = fmt.Sprintf("POST failed: %v", err)
|
||||
result.Success = false
|
||||
return result
|
||||
}
|
||||
defer postResp.Body.Close()
|
||||
|
||||
result.StatusCode = postResp.StatusCode
|
||||
|
||||
// Check if we got a valid JSON-RPC response
|
||||
var rpcResp map[string]interface{}
|
||||
if err := json.UnmarshalRead(postResp.Body, &rpcResp); err == nil {
|
||||
if _, hasResult := rpcResp["result"]; hasResult {
|
||||
result.Success = true
|
||||
result.Response = fmt.Sprintf("Valid JSON-RPC response: %v", rpcResp["result"])
|
||||
} else if errObj, hasError := rpcResp["error"]; hasError {
|
||||
result.Success = false
|
||||
result.Response = fmt.Sprintf("JSON-RPC error: %v", errObj)
|
||||
}
|
||||
}
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
// testRPCMethods tests common RPC methods against an endpoint.
|
||||
func (d *DebugTool) testRPCMethods(url string) []RPCTest {
|
||||
methods := []string{
|
||||
"web3_clientVersion",
|
||||
"eth_blockNumber",
|
||||
"eth_chainId",
|
||||
"net_version",
|
||||
"eth_syncing",
|
||||
}
|
||||
|
||||
tests := make([]RPCTest, 0, len(methods))
|
||||
|
||||
for _, method := range methods {
|
||||
test := RPCTest{
|
||||
Method: method,
|
||||
URL: url,
|
||||
}
|
||||
|
||||
req := map[string]interface{}{
|
||||
"jsonrpc": "2.0",
|
||||
"method": method,
|
||||
"params": []interface{}{},
|
||||
"id": 1,
|
||||
}
|
||||
|
||||
jsonBytes, _ := json.Marshal(req)
|
||||
resp, err := d.client.Post(url, "application/json", bytes.NewReader(jsonBytes))
|
||||
if err != nil {
|
||||
test.Error = err.Error()
|
||||
test.Success = false
|
||||
} else {
|
||||
defer resp.Body.Close()
|
||||
|
||||
var result map[string]interface{}
|
||||
if err := json.UnmarshalRead(resp.Body, &result); err == nil {
|
||||
if res, ok := result["result"]; ok {
|
||||
test.Success = true
|
||||
test.Result = fmt.Sprintf("%v", res)
|
||||
} else if errObj, ok := result["error"]; ok {
|
||||
test.Error = fmt.Sprintf("%v", errObj)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
tests = append(tests, test)
|
||||
}
|
||||
|
||||
return tests
|
||||
}
|
||||
|
||||
// DiagnosticReport contains comprehensive endpoint diagnostic information.
|
||||
type DiagnosticReport struct {
|
||||
ChainID ids.ID
|
||||
Alias string
|
||||
Timestamp time.Time
|
||||
Tests []TestResult
|
||||
RPCTests []RPCTest
|
||||
}
|
||||
|
||||
// TestResult represents a single endpoint test result.
|
||||
type TestResult struct {
|
||||
URL string
|
||||
Success bool
|
||||
StatusCode int
|
||||
Response string
|
||||
Error string
|
||||
Timestamp time.Time
|
||||
}
|
||||
|
||||
// RPCTest represents a test of a specific RPC method.
|
||||
type RPCTest struct {
|
||||
Method string
|
||||
URL string
|
||||
Success bool
|
||||
Result string
|
||||
Error string
|
||||
}
|
||||
|
||||
// GetBestURL returns the first working URL from the tests.
|
||||
func (r *DiagnosticReport) GetBestURL() string {
|
||||
for _, test := range r.Tests {
|
||||
if test.Success {
|
||||
return test.URL
|
||||
}
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
// String returns a human-readable report.
|
||||
func (r *DiagnosticReport) String() string {
|
||||
var b strings.Builder
|
||||
|
||||
b.WriteString(fmt.Sprintf("=== RPC Endpoint Diagnostic Report ===\n"))
|
||||
b.WriteString(fmt.Sprintf("Chain ID: %s\n", r.ChainID))
|
||||
if r.Alias != "" {
|
||||
b.WriteString(fmt.Sprintf("Alias: %s\n", r.Alias))
|
||||
}
|
||||
b.WriteString(fmt.Sprintf("Timestamp: %s\n\n", r.Timestamp.Format(time.RFC3339)))
|
||||
|
||||
b.WriteString("=== Endpoint Tests ===\n")
|
||||
for _, test := range r.Tests {
|
||||
status := "❌ FAILED"
|
||||
if test.Success {
|
||||
status = "✅ SUCCESS"
|
||||
}
|
||||
b.WriteString(fmt.Sprintf("\n%s %s\n", status, test.URL))
|
||||
b.WriteString(fmt.Sprintf(" Status Code: %d\n", test.StatusCode))
|
||||
if test.Error != "" {
|
||||
b.WriteString(fmt.Sprintf(" Error: %s\n", test.Error))
|
||||
}
|
||||
if test.Response != "" && len(test.Response) < 200 {
|
||||
b.WriteString(fmt.Sprintf(" Response: %s\n", test.Response))
|
||||
}
|
||||
}
|
||||
|
||||
if len(r.RPCTests) > 0 {
|
||||
b.WriteString("\n=== RPC Method Tests ===\n")
|
||||
for _, test := range r.RPCTests {
|
||||
status := "❌"
|
||||
if test.Success {
|
||||
status = "✅"
|
||||
}
|
||||
b.WriteString(fmt.Sprintf("%s %s: ", status, test.Method))
|
||||
if test.Success {
|
||||
b.WriteString(test.Result)
|
||||
} else {
|
||||
b.WriteString(test.Error)
|
||||
}
|
||||
b.WriteString("\n")
|
||||
}
|
||||
}
|
||||
|
||||
b.WriteString("\n=== Recommendations ===\n")
|
||||
if bestURL := r.GetBestURL(); bestURL != "" {
|
||||
b.WriteString(fmt.Sprintf("✅ Use this endpoint: %s\n", bestURL))
|
||||
} else {
|
||||
b.WriteString("❌ No working endpoints found. Check:\n")
|
||||
b.WriteString(" 1. Is the node running?\n")
|
||||
b.WriteString(" 2. Is the chain bootstrapped?\n")
|
||||
b.WriteString(" 3. Are handlers properly registered?\n")
|
||||
b.WriteString(" 4. Check node logs for handler registration errors\n")
|
||||
b.WriteString(" 5. Try restarting the node\n")
|
||||
}
|
||||
|
||||
return b.String()
|
||||
}
|
||||
|
||||
// QuickDiagnose performs a quick endpoint check and prints results.
|
||||
// Convenience function for CLI tools.
|
||||
func QuickDiagnose(nodeURL string, chainID ids.ID, alias string) {
|
||||
logger := log.NewNoOpLogger()
|
||||
tool := NewDebugTool(nodeURL, logger)
|
||||
report := tool.DiagnoseEndpoint(chainID, alias)
|
||||
fmt.Println(report.String())
|
||||
}
|
||||
@@ -1,324 +0,0 @@
|
||||
// Copyright (C) 2019-2025, Lux Industries Inc. All rights reserved.
|
||||
// See the file LICENSE for licensing terms.
|
||||
|
||||
// Package rpc provides robust RPC handler registration with retries, health checks, and clear debugging.
|
||||
// Follows Go principles: fail fast with clear errors, single responsibility, minimal dependencies.
|
||||
package rpc
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/luxfi/ids"
|
||||
"github.com/luxfi/log"
|
||||
"github.com/luxfi/node/server/http"
|
||||
)
|
||||
|
||||
var (
|
||||
// Errors follow Go convention: lowercase, descriptive, actionable
|
||||
errNilHandler = errors.New("handler is nil")
|
||||
errNilServer = errors.New("server is nil")
|
||||
errEmptyEndpoint = errors.New("endpoint is empty")
|
||||
errRegistrationFailed = errors.New("handler registration failed")
|
||||
errHealthCheckFailed = errors.New("health check failed")
|
||||
)
|
||||
|
||||
// HandlerManager manages RPC handler registration with robust error handling and health checks.
|
||||
// Single responsibility: reliable handler registration with observability.
|
||||
type HandlerManager struct {
|
||||
server server.Server
|
||||
log log.Logger
|
||||
mu sync.RWMutex
|
||||
routes map[string]*RouteInfo // chainID -> route info
|
||||
retries int // max registration retries
|
||||
retryWait time.Duration // initial retry wait time
|
||||
}
|
||||
|
||||
// RouteInfo contains complete information about a registered route.
|
||||
// Everything needed for debugging in one place.
|
||||
type RouteInfo struct {
|
||||
ChainID ids.ID
|
||||
ChainAlias string
|
||||
Base string // e.g., "bc/C" or "bc/<chainID>"
|
||||
Endpoints []string // e.g., ["/rpc", "/ws"]
|
||||
Handler http.Handler
|
||||
Healthy bool
|
||||
LastCheck time.Time
|
||||
}
|
||||
|
||||
// NewHandlerManager creates a handler manager with sensible defaults.
|
||||
// Simple factory, no magic.
|
||||
func NewHandlerManager(server server.Server, logger log.Logger) *HandlerManager {
|
||||
return &HandlerManager{
|
||||
server: server,
|
||||
log: logger,
|
||||
routes: make(map[string]*RouteInfo),
|
||||
retries: 3,
|
||||
retryWait: 100 * time.Millisecond,
|
||||
}
|
||||
}
|
||||
|
||||
// RegisterChainHandlers registers all handlers for a chain with retry logic and health checks.
|
||||
// This is the main entry point - handles everything needed for robust registration.
|
||||
func (m *HandlerManager) RegisterChainHandlers(
|
||||
ctx context.Context,
|
||||
chainID ids.ID,
|
||||
chainAlias string,
|
||||
handlers map[string]http.Handler,
|
||||
) error {
|
||||
if m.server == nil {
|
||||
return errNilServer
|
||||
}
|
||||
|
||||
m.log.Info("Starting chain handler registration",
|
||||
log.Stringer("chainID", chainID),
|
||||
log.String("alias", chainAlias),
|
||||
log.Int("handlerCount", len(handlers)))
|
||||
|
||||
// Validate handlers first - fail fast
|
||||
if err := m.validateHandlers(handlers); err != nil {
|
||||
return fmt.Errorf("handler validation failed: %w", err)
|
||||
}
|
||||
|
||||
// Build route info
|
||||
info := &RouteInfo{
|
||||
ChainID: chainID,
|
||||
ChainAlias: chainAlias,
|
||||
Endpoints: make([]string, 0, len(handlers)),
|
||||
}
|
||||
|
||||
// Determine base paths
|
||||
bases := m.getBasePaths(chainID, chainAlias)
|
||||
|
||||
// Register each handler with retries
|
||||
var registrationErrors []error
|
||||
for endpoint, handler := range handlers {
|
||||
info.Endpoints = append(info.Endpoints, endpoint)
|
||||
|
||||
for _, base := range bases {
|
||||
if err := m.registerWithRetry(ctx, base, endpoint, handler); err != nil {
|
||||
registrationErrors = append(registrationErrors,
|
||||
fmt.Errorf("failed to register %s%s: %w", base, endpoint, err))
|
||||
m.log.Error("Handler registration failed",
|
||||
log.String("base", base),
|
||||
log.String("endpoint", endpoint),
|
||||
log.Err(err))
|
||||
} else {
|
||||
m.log.Info("Handler registered successfully",
|
||||
log.String("route", fmt.Sprintf("/ext/%s%s", base, endpoint)),
|
||||
log.Stringer("chainID", chainID))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Store route info for monitoring
|
||||
m.mu.Lock()
|
||||
info.Base = bases[0] // Primary base
|
||||
info.Handler = handlers["/rpc"] // Store primary handler for health checks
|
||||
m.routes[chainID.String()] = info
|
||||
m.mu.Unlock()
|
||||
|
||||
// Run health checks
|
||||
if err := m.healthCheckRoute(info); err != nil {
|
||||
m.log.Warn("Health check failed for newly registered chain",
|
||||
log.Stringer("chainID", chainID),
|
||||
log.Err(err))
|
||||
}
|
||||
|
||||
// Return aggregate error if any registrations failed
|
||||
if len(registrationErrors) > 0 {
|
||||
return fmt.Errorf("%w: %v", errRegistrationFailed, registrationErrors)
|
||||
}
|
||||
|
||||
m.log.Info("Chain handler registration completed",
|
||||
log.Stringer("chainID", chainID),
|
||||
log.String("routes", strings.Join(m.getFullRoutes(bases, info.Endpoints), ", ")))
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// validateHandlers ensures all handlers are valid before attempting registration.
|
||||
// Fail fast with clear errors - no silent failures.
|
||||
func (m *HandlerManager) validateHandlers(handlers map[string]http.Handler) error {
|
||||
if len(handlers) == 0 {
|
||||
return errors.New("no handlers provided")
|
||||
}
|
||||
|
||||
for endpoint, handler := range handlers {
|
||||
if handler == nil {
|
||||
return fmt.Errorf("%w for endpoint %s", errNilHandler, endpoint)
|
||||
}
|
||||
if endpoint == "" {
|
||||
return errEmptyEndpoint
|
||||
}
|
||||
// Ensure endpoint starts with /
|
||||
if !strings.HasPrefix(endpoint, "/") {
|
||||
return fmt.Errorf("endpoint %s must start with /", endpoint)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// getBasePaths returns all base paths for a chain (with and without alias).
|
||||
// Single source of truth for path construction.
|
||||
func (m *HandlerManager) getBasePaths(chainID ids.ID, chainAlias string) []string {
|
||||
bases := []string{}
|
||||
|
||||
// If we have an alias (like "C" for C-Chain), use it as primary
|
||||
if chainAlias != "" && chainAlias != chainID.String() {
|
||||
bases = append(bases, fmt.Sprintf("bc/%s", chainAlias))
|
||||
}
|
||||
|
||||
// Always include the full chain ID path
|
||||
bases = append(bases, fmt.Sprintf("bc/%s", chainID.String()))
|
||||
|
||||
return bases
|
||||
}
|
||||
|
||||
// getFullRoutes constructs full route paths for logging.
|
||||
// Clear, complete information for operators.
|
||||
func (m *HandlerManager) getFullRoutes(bases []string, endpoints []string) []string {
|
||||
routes := []string{}
|
||||
for _, base := range bases {
|
||||
for _, endpoint := range endpoints {
|
||||
routes = append(routes, fmt.Sprintf("/ext/%s%s", base, endpoint))
|
||||
}
|
||||
}
|
||||
return routes
|
||||
}
|
||||
|
||||
// registerWithRetry attempts registration with exponential backoff.
|
||||
// Handles transient failures gracefully.
|
||||
func (m *HandlerManager) registerWithRetry(
|
||||
ctx context.Context,
|
||||
base string,
|
||||
endpoint string,
|
||||
handler http.Handler,
|
||||
) error {
|
||||
wait := m.retryWait
|
||||
var lastErr error
|
||||
|
||||
for attempt := 0; attempt < m.retries; attempt++ {
|
||||
// Check context cancellation
|
||||
select {
|
||||
case <-ctx.Done():
|
||||
return ctx.Err()
|
||||
default:
|
||||
}
|
||||
|
||||
// Try registration
|
||||
if err := m.server.AddRoute(handler, base, endpoint); err == nil {
|
||||
return nil // Success!
|
||||
} else {
|
||||
lastErr = err
|
||||
m.log.Debug("Registration attempt failed, retrying",
|
||||
log.Int("attempt", attempt+1),
|
||||
log.String("base", base),
|
||||
log.String("endpoint", endpoint),
|
||||
log.Err(err))
|
||||
}
|
||||
|
||||
// Don't wait after last attempt
|
||||
if attempt < m.retries-1 {
|
||||
select {
|
||||
case <-time.After(wait):
|
||||
wait *= 2 // Exponential backoff
|
||||
case <-ctx.Done():
|
||||
return ctx.Err()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return fmt.Errorf("failed after %d attempts: %w", m.retries, lastErr)
|
||||
}
|
||||
|
||||
// healthCheckRoute performs a basic health check on a registered route.
|
||||
// Validates that handlers are actually responding.
|
||||
func (m *HandlerManager) healthCheckRoute(info *RouteInfo) error {
|
||||
if info.Handler == nil {
|
||||
return fmt.Errorf("no handler to check for chain %s", info.ChainID)
|
||||
}
|
||||
|
||||
// Create a test request
|
||||
req := httptest.NewRequest("POST", "/", strings.NewReader(`{"jsonrpc":"2.0","method":"web3_clientVersion","params":[],"id":1}`))
|
||||
req.Header.Set("Content-Type", "application/json")
|
||||
|
||||
// Record the response
|
||||
recorder := httptest.NewRecorder()
|
||||
|
||||
// Call the handler
|
||||
info.Handler.ServeHTTP(recorder, req)
|
||||
|
||||
// Check response
|
||||
info.LastCheck = time.Now()
|
||||
if recorder.Code == http.StatusOK || recorder.Code == http.StatusMethodNotAllowed {
|
||||
info.Healthy = true
|
||||
m.log.Debug("Health check passed",
|
||||
log.Stringer("chainID", info.ChainID),
|
||||
log.Int("status", recorder.Code))
|
||||
return nil
|
||||
}
|
||||
|
||||
info.Healthy = false
|
||||
return fmt.Errorf("%w: status %d", errHealthCheckFailed, recorder.Code)
|
||||
}
|
||||
|
||||
// GetRouteInfo returns information about a registered chain's routes.
|
||||
// Useful for debugging and monitoring.
|
||||
func (m *HandlerManager) GetRouteInfo(chainID ids.ID) (*RouteInfo, bool) {
|
||||
m.mu.RLock()
|
||||
defer m.mu.RUnlock()
|
||||
|
||||
info, exists := m.routes[chainID.String()]
|
||||
return info, exists
|
||||
}
|
||||
|
||||
// GetAllRoutes returns all registered route information.
|
||||
// Complete visibility for operators.
|
||||
func (m *HandlerManager) GetAllRoutes() map[string]*RouteInfo {
|
||||
m.mu.RLock()
|
||||
defer m.mu.RUnlock()
|
||||
|
||||
// Return a copy to prevent external modification
|
||||
routes := make(map[string]*RouteInfo, len(m.routes))
|
||||
for k, v := range m.routes {
|
||||
routes[k] = v
|
||||
}
|
||||
return routes
|
||||
}
|
||||
|
||||
// HealthCheckAll performs health checks on all registered routes.
|
||||
// Batch operation for monitoring systems.
|
||||
func (m *HandlerManager) HealthCheckAll() map[string]bool {
|
||||
m.mu.RLock()
|
||||
routes := make([]*RouteInfo, 0, len(m.routes))
|
||||
for _, info := range m.routes {
|
||||
routes = append(routes, info)
|
||||
}
|
||||
m.mu.RUnlock()
|
||||
|
||||
results := make(map[string]bool)
|
||||
for _, info := range routes {
|
||||
err := m.healthCheckRoute(info)
|
||||
results[info.ChainID.String()] = err == nil
|
||||
}
|
||||
|
||||
return results
|
||||
}
|
||||
|
||||
// SetRetryConfig allows customization of retry behavior.
|
||||
// Flexibility for different deployment scenarios.
|
||||
func (m *HandlerManager) SetRetryConfig(maxRetries int, initialWait time.Duration) {
|
||||
if maxRetries > 0 {
|
||||
m.retries = maxRetries
|
||||
}
|
||||
if initialWait > 0 {
|
||||
m.retryWait = initialWait
|
||||
}
|
||||
}
|
||||
@@ -1,291 +0,0 @@
|
||||
// Copyright (C) 2019-2025, Lux Industries Inc. All rights reserved.
|
||||
// See the file LICENSE for licensing terms.
|
||||
|
||||
package rpc
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"net/http"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/luxfi/ids"
|
||||
"github.com/luxfi/log"
|
||||
"github.com/luxfi/node/server/http"
|
||||
"github.com/luxfi/runtime"
|
||||
"github.com/luxfi/vm"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
// mockServer implements a test server for handler registration
|
||||
type mockServer struct {
|
||||
routes map[string]http.Handler
|
||||
failCount int
|
||||
maxFailures int
|
||||
returnError error
|
||||
aliases map[string][]string
|
||||
}
|
||||
|
||||
func newMockServer() *mockServer {
|
||||
return &mockServer{
|
||||
routes: make(map[string]http.Handler),
|
||||
maxFailures: 0,
|
||||
aliases: make(map[string][]string),
|
||||
}
|
||||
}
|
||||
|
||||
func (s *mockServer) AddRoute(handler http.Handler, base, endpoint string) error {
|
||||
// Simulate transient failures for retry testing
|
||||
if s.failCount < s.maxFailures {
|
||||
s.failCount++
|
||||
return errors.New("transient failure")
|
||||
}
|
||||
|
||||
// Return configured error if any
|
||||
if s.returnError != nil {
|
||||
return s.returnError
|
||||
}
|
||||
|
||||
// Store the route
|
||||
key := base + endpoint
|
||||
s.routes[key] = handler
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *mockServer) AddAliases(endpoint string, aliases ...string) error {
|
||||
s.aliases[endpoint] = aliases
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *mockServer) AddRouteWithReadLock(handler http.Handler, base, endpoint string) error {
|
||||
return s.AddRoute(handler, base, endpoint)
|
||||
}
|
||||
|
||||
func (s *mockServer) AddAliasesWithReadLock(endpoint string, aliases ...string) error {
|
||||
return s.AddAliases(endpoint, aliases...)
|
||||
}
|
||||
|
||||
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) SetRootInfoProvider(_ server.RootInfoProvider) {}
|
||||
|
||||
func TestHandlerManager_RegisterChainHandlers(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
chainID ids.ID
|
||||
chainAlias string
|
||||
handlers map[string]http.Handler
|
||||
serverError error
|
||||
expectError bool
|
||||
expectRoutes int
|
||||
}{
|
||||
{
|
||||
name: "successful registration with alias",
|
||||
chainID: ids.GenerateTestID(),
|
||||
chainAlias: "C",
|
||||
handlers: map[string]http.Handler{
|
||||
"/rpc": http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
w.WriteHeader(http.StatusOK)
|
||||
}),
|
||||
"/ws": http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
w.WriteHeader(http.StatusOK)
|
||||
}),
|
||||
},
|
||||
expectError: false,
|
||||
expectRoutes: 4, // 2 endpoints × 2 bases (alias + ID)
|
||||
},
|
||||
{
|
||||
name: "successful registration without alias",
|
||||
chainID: ids.GenerateTestID(),
|
||||
handlers: map[string]http.Handler{
|
||||
"/rpc": http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
w.WriteHeader(http.StatusOK)
|
||||
}),
|
||||
},
|
||||
expectError: false,
|
||||
expectRoutes: 1,
|
||||
},
|
||||
{
|
||||
name: "nil handler validation",
|
||||
chainID: ids.GenerateTestID(),
|
||||
chainAlias: "X",
|
||||
handlers: map[string]http.Handler{"/rpc": nil},
|
||||
expectError: true,
|
||||
},
|
||||
{
|
||||
name: "empty endpoint validation",
|
||||
chainID: ids.GenerateTestID(),
|
||||
handlers: map[string]http.Handler{"": http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {})},
|
||||
expectError: true,
|
||||
},
|
||||
{
|
||||
name: "no handlers provided",
|
||||
chainID: ids.GenerateTestID(),
|
||||
handlers: map[string]http.Handler{},
|
||||
expectError: true,
|
||||
},
|
||||
{
|
||||
name: "invalid endpoint format",
|
||||
chainID: ids.GenerateTestID(),
|
||||
handlers: map[string]http.Handler{"rpc": http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {})},
|
||||
expectError: true,
|
||||
},
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
// Setup
|
||||
server := newMockServer()
|
||||
server.returnError = tt.serverError
|
||||
logger := log.NewNoOpLogger()
|
||||
manager := NewHandlerManager(server, logger)
|
||||
|
||||
// Execute
|
||||
ctx := context.Background()
|
||||
err := manager.RegisterChainHandlers(ctx, tt.chainID, tt.chainAlias, tt.handlers)
|
||||
|
||||
// Verify
|
||||
if tt.expectError {
|
||||
require.Error(t, err)
|
||||
} else {
|
||||
require.NoError(t, err)
|
||||
require.Len(t, server.routes, tt.expectRoutes)
|
||||
|
||||
// Verify route info was stored
|
||||
info, exists := manager.GetRouteInfo(tt.chainID)
|
||||
require.True(t, exists)
|
||||
require.Equal(t, tt.chainID, info.ChainID)
|
||||
require.Equal(t, tt.chainAlias, info.ChainAlias)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestHandlerManager_RetryLogic(t *testing.T) {
|
||||
// Setup server that fails twice then succeeds
|
||||
server := newMockServer()
|
||||
server.maxFailures = 2
|
||||
|
||||
logger := log.NewNoOpLogger()
|
||||
manager := NewHandlerManager(server, logger)
|
||||
manager.SetRetryConfig(3, 10*time.Millisecond)
|
||||
|
||||
// Create test handler
|
||||
handler := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
w.WriteHeader(http.StatusOK)
|
||||
})
|
||||
|
||||
// Register with retries
|
||||
ctx := context.Background()
|
||||
chainID := ids.GenerateTestID()
|
||||
require.NoError(t, manager.RegisterChainHandlers(ctx, chainID, "TEST", map[string]http.Handler{
|
||||
"/rpc": handler,
|
||||
}))
|
||||
require.Equal(t, 2, server.failCount) // Failed twice, succeeded on third try
|
||||
require.Len(t, server.routes, 2) // Both alias and ID routes
|
||||
}
|
||||
|
||||
func TestHandlerManager_HealthCheck(t *testing.T) {
|
||||
server := newMockServer()
|
||||
logger := log.NewNoOpLogger()
|
||||
manager := NewHandlerManager(server, logger)
|
||||
|
||||
// Register a healthy handler
|
||||
healthyHandler := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
w.WriteHeader(http.StatusOK)
|
||||
w.Write([]byte(`{"jsonrpc":"2.0","result":"test","id":1}`))
|
||||
})
|
||||
|
||||
// Register an unhealthy handler
|
||||
unhealthyHandler := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
w.WriteHeader(http.StatusInternalServerError)
|
||||
})
|
||||
|
||||
ctx := context.Background()
|
||||
chainID1 := ids.GenerateTestID()
|
||||
chainID2 := ids.GenerateTestID()
|
||||
|
||||
// Register healthy chain
|
||||
require.NoError(t, manager.RegisterChainHandlers(ctx, chainID1, "", map[string]http.Handler{
|
||||
"/rpc": healthyHandler,
|
||||
}))
|
||||
|
||||
// Register unhealthy chain
|
||||
// Registration succeeds even if health check fails
|
||||
require.NoError(t, manager.RegisterChainHandlers(ctx, chainID2, "", map[string]http.Handler{
|
||||
"/rpc": unhealthyHandler,
|
||||
})) // Registration should succeed regardless of handler health
|
||||
|
||||
// Check health status
|
||||
results := manager.HealthCheckAll()
|
||||
require.True(t, results[chainID1.String()])
|
||||
require.False(t, results[chainID2.String()])
|
||||
}
|
||||
|
||||
func TestHandlerManager_GetBasePaths(t *testing.T) {
|
||||
manager := &HandlerManager{}
|
||||
chainID := ids.GenerateTestID()
|
||||
|
||||
// Test with alias
|
||||
bases := manager.getBasePaths(chainID, "C")
|
||||
require.Equal(t, []string{"bc/C", "bc/" + chainID.String()}, bases)
|
||||
|
||||
// Test without alias
|
||||
bases = manager.getBasePaths(chainID, "")
|
||||
require.Equal(t, []string{"bc/" + chainID.String()}, bases)
|
||||
|
||||
// Test when alias equals chain ID (shouldn't duplicate)
|
||||
bases = manager.getBasePaths(chainID, chainID.String())
|
||||
require.Equal(t, []string{"bc/" + chainID.String()}, bases)
|
||||
}
|
||||
|
||||
func TestHandlerManager_ContextCancellation(t *testing.T) {
|
||||
// Create a server that delays to test cancellation
|
||||
server := &mockServer{
|
||||
routes: make(map[string]http.Handler),
|
||||
returnError: errors.New("slow server"),
|
||||
}
|
||||
|
||||
logger := log.NewNoOpLogger()
|
||||
manager := NewHandlerManager(server, logger)
|
||||
manager.SetRetryConfig(10, 100*time.Millisecond) // Many retries with delays
|
||||
|
||||
// Create cancelled context
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
cancel() // Cancel immediately
|
||||
|
||||
// Try to register - should fail with context error
|
||||
chainID := ids.GenerateTestID()
|
||||
err := manager.RegisterChainHandlers(ctx, chainID, "", map[string]http.Handler{
|
||||
"/rpc": http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {}),
|
||||
})
|
||||
|
||||
require.Error(t, err)
|
||||
require.Contains(t, err.Error(), "context canceled")
|
||||
}
|
||||
|
||||
// Benchmark to ensure performance doesn't degrade
|
||||
func BenchmarkHandlerRegistration(b *testing.B) {
|
||||
server := newMockServer()
|
||||
logger := log.NewNoOpLogger()
|
||||
manager := NewHandlerManager(server, logger)
|
||||
|
||||
handler := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
w.WriteHeader(http.StatusOK)
|
||||
})
|
||||
|
||||
ctx := context.Background()
|
||||
|
||||
b.ResetTimer()
|
||||
for i := 0; i < b.N; i++ {
|
||||
chainID := ids.GenerateTestID()
|
||||
manager.RegisterChainHandlers(ctx, chainID, "TEST", map[string]http.Handler{
|
||||
"/rpc": handler,
|
||||
"/ws": handler,
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -1,165 +0,0 @@
|
||||
// Copyright (C) 2019-2025, Lux Industries Inc. All rights reserved.
|
||||
// See the file LICENSE for licensing terms.
|
||||
|
||||
package rpc
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"github.com/luxfi/ids"
|
||||
"github.com/luxfi/log"
|
||||
"github.com/luxfi/node/server/http"
|
||||
)
|
||||
|
||||
// IntegrationExample shows how to modify the existing createChain function in manager.go.
|
||||
// This replaces lines 941-990 with cleaner, more robust code.
|
||||
func IntegrationExample(
|
||||
ctx context.Context,
|
||||
chainID ids.ID,
|
||||
vm interface{},
|
||||
server server.Server,
|
||||
logger log.Logger,
|
||||
cChainID ids.ID,
|
||||
pChainID ids.ID,
|
||||
isDevMode bool,
|
||||
) error {
|
||||
// BEFORE: 50+ lines of complex type checking and error-prone registration
|
||||
// AFTER: Clean, robust registration with proper error handling
|
||||
|
||||
// Step 1: Create the registrar
|
||||
registrar := NewChainHandlerRegistrar(server, logger, cChainID, pChainID)
|
||||
|
||||
// Step 2: Configure based on environment
|
||||
if isDevMode {
|
||||
// Development: Fast failures for quick iteration
|
||||
registrar.SetRetryConfig(2, 50*time.Millisecond)
|
||||
logger.Info("Using development handler registration settings")
|
||||
} else {
|
||||
// Production: More robust with retries
|
||||
registrar.SetRetryConfig(5, 200*time.Millisecond)
|
||||
logger.Info("Using production handler registration settings")
|
||||
}
|
||||
|
||||
// Step 3: Register handlers (replaces all the complex VM type checking)
|
||||
startTime := time.Now()
|
||||
err := registrar.RegisterChainHandlers(ctx, chainID, vm)
|
||||
duration := time.Since(startTime)
|
||||
|
||||
// Step 4: Handle registration result
|
||||
if err != nil {
|
||||
// Log error but don't fail chain creation
|
||||
// Handlers are not critical for chain operation
|
||||
logger.Error("RPC handler registration failed",
|
||||
log.Stringer("chainID", chainID),
|
||||
log.Err(err),
|
||||
log.Duration("duration", duration),
|
||||
log.String("action", "Chain will operate without HTTP/RPC access"))
|
||||
|
||||
// Could emit metrics here if available
|
||||
// metric.HandlerRegistrationFailed.Inc()
|
||||
|
||||
// Non-fatal: return nil to allow chain to continue
|
||||
// Change to 'return err' if you want this to be fatal
|
||||
return nil
|
||||
}
|
||||
|
||||
// Step 5: Log success with useful information
|
||||
if info, exists := registrar.GetRouteInfo(chainID); exists {
|
||||
logger.Info("RPC handlers registered successfully",
|
||||
log.Stringer("chainID", chainID),
|
||||
log.String("alias", info.ChainAlias),
|
||||
log.Strings("endpoints", info.Endpoints),
|
||||
log.Duration("duration", duration),
|
||||
log.Bool("healthCheckPassed", info.Healthy))
|
||||
|
||||
// Print developer-friendly message
|
||||
if isDevMode && len(info.Endpoints) > 0 {
|
||||
baseURL := "http://localhost:9630"
|
||||
fmt.Printf("\n✅ Chain %s RPC endpoints ready:\n", chainID)
|
||||
for _, endpoint := range info.Endpoints {
|
||||
if info.ChainAlias != "" {
|
||||
fmt.Printf(" %s/v1/bc/%s%s\n", baseURL, info.ChainAlias, endpoint)
|
||||
}
|
||||
fmt.Printf(" %s/v1/bc/%s%s\n", baseURL, chainID, endpoint)
|
||||
}
|
||||
fmt.Println()
|
||||
}
|
||||
}
|
||||
|
||||
// Step 6: Schedule async health monitoring (optional)
|
||||
if !isDevMode {
|
||||
go monitorHandlerHealth(ctx, registrar, chainID, logger)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// monitorHandlerHealth runs periodic health checks in the background.
|
||||
// This helps detect and log handler issues early.
|
||||
func monitorHandlerHealth(
|
||||
ctx context.Context,
|
||||
registrar *ChainHandlerRegistrar,
|
||||
chainID ids.ID,
|
||||
logger log.Logger,
|
||||
) {
|
||||
// Initial delay to let chain fully initialize
|
||||
select {
|
||||
case <-time.After(10 * time.Second):
|
||||
case <-ctx.Done():
|
||||
return
|
||||
}
|
||||
|
||||
// Run initial health check
|
||||
checkHealth(registrar, chainID, logger)
|
||||
|
||||
// Periodic health checks
|
||||
ticker := time.NewTicker(5 * time.Minute)
|
||||
defer ticker.Stop()
|
||||
|
||||
for {
|
||||
select {
|
||||
case <-ticker.C:
|
||||
checkHealth(registrar, chainID, logger)
|
||||
case <-ctx.Done():
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// checkHealth performs a health check and logs results.
|
||||
func checkHealth(registrar *ChainHandlerRegistrar, chainID ids.ID, logger log.Logger) {
|
||||
results := registrar.HealthCheckAll()
|
||||
|
||||
for chainIDStr, healthy := range results {
|
||||
if chainIDStr == chainID.String() {
|
||||
if healthy {
|
||||
logger.Debug("Handler health check passed",
|
||||
log.String("chainID", chainIDStr))
|
||||
} else {
|
||||
logger.Warn("Handler health check failed",
|
||||
log.String("chainID", chainIDStr),
|
||||
log.String("action", "Will continue monitoring"))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// MinimalIntegration shows the absolute minimum code needed.
|
||||
// This is what you'd actually put in manager.go.
|
||||
func MinimalIntegration(
|
||||
ctx context.Context,
|
||||
chainID ids.ID,
|
||||
vm interface{},
|
||||
server server.Server,
|
||||
logger log.Logger,
|
||||
cChainID ids.ID,
|
||||
) error {
|
||||
// Just three lines to replace 50+ lines of complex code!
|
||||
registrar := NewChainHandlerRegistrar(server, logger, cChainID, ids.Empty)
|
||||
if err := registrar.RegisterChainHandlers(ctx, chainID, vm); err != nil {
|
||||
logger.Error("Handler registration failed", log.Err(err))
|
||||
}
|
||||
return nil // Non-fatal
|
||||
}
|
||||
@@ -1762,6 +1762,14 @@ func GetNodeConfig(v *viper.Viper) (node.Config, error) {
|
||||
if nodeConfig.HealthCheckFreq < 0 {
|
||||
return node.Config{}, fmt.Errorf("%s must be positive", HealthCheckFreqKey)
|
||||
}
|
||||
nodeConfig.ProposerWindowDuration = v.GetDuration(ProposerVMWindowDurationKey)
|
||||
if nodeConfig.ProposerWindowDuration < 0 {
|
||||
return node.Config{}, fmt.Errorf("%s must not be negative", ProposerVMWindowDurationKey)
|
||||
}
|
||||
nodeConfig.ProposerMinBlockDelay = v.GetDuration(ProposerVMMinBlockDelayKey)
|
||||
if nodeConfig.ProposerMinBlockDelay < 0 {
|
||||
return node.Config{}, fmt.Errorf("%s must not be negative", ProposerVMMinBlockDelayKey)
|
||||
}
|
||||
// Halflife of continuous averager used in health checks
|
||||
healthCheckAveragerHalflife := v.GetDuration(HealthCheckAveragerHalflifeKey)
|
||||
if healthCheckAveragerHalflife <= 0 {
|
||||
|
||||
@@ -24,7 +24,6 @@ import (
|
||||
"github.com/luxfi/node/genesis/builder"
|
||||
"github.com/luxfi/node/nets"
|
||||
pchaingenesis "github.com/luxfi/node/vms/platformvm/genesis"
|
||||
pchaintxs "github.com/luxfi/node/vms/platformvm/txs"
|
||||
)
|
||||
|
||||
const chainConfigFilenameExtension = ".ex"
|
||||
@@ -536,8 +535,8 @@ func TestGetNetConfigsFromFlags(t *testing.T) {
|
||||
"2Ctt6eGAeo4MLqTmGa7AdRecuVMPGWEX9wSsCLBYrLhX4a394i": {
|
||||
"consensusParameters": {
|
||||
"k": 30,
|
||||
"alphaPreference": 16,
|
||||
"alphaConfidence": 20
|
||||
"alphaPreference": 20,
|
||||
"alphaConfidence": 25
|
||||
},
|
||||
"validatorOnly": true
|
||||
}
|
||||
@@ -547,8 +546,8 @@ func TestGetNetConfigsFromFlags(t *testing.T) {
|
||||
config, ok := given[id]
|
||||
require.True(ok)
|
||||
require.True(config.ValidatorOnly)
|
||||
require.Equal(16, config.ConsensusParameters.AlphaPreference)
|
||||
require.Equal(20, config.ConsensusParameters.AlphaConfidence)
|
||||
require.Equal(20, config.ConsensusParameters.AlphaPreference)
|
||||
require.Equal(25, config.ConsensusParameters.AlphaConfidence)
|
||||
require.Equal(30, config.ConsensusParameters.K)
|
||||
// must still respect defaults (MainnetParameters.MaxOutstandingItems = 1024)
|
||||
require.Equal(1024, config.ConsensusParameters.MaxOutstandingItems)
|
||||
@@ -733,7 +732,7 @@ func TestResolveUTXOAssetID_POnlyFallback(t *testing.T) {
|
||||
require := require.New(t)
|
||||
|
||||
pOnly := &pchaingenesis.Genesis{Chains: nil}
|
||||
pOnlyBytes, err := pchaingenesis.Codec.Marshal(pchaintxs.CodecVersion, pOnly)
|
||||
pOnlyBytes, err := pOnly.Bytes()
|
||||
require.NoError(err)
|
||||
|
||||
gotID, err := resolveUTXOAssetID(42, pOnlyBytes)
|
||||
|
||||
@@ -369,6 +369,7 @@ func addNodeFlags(fs *pflag.FlagSet) {
|
||||
// ProposerVM
|
||||
fs.Bool(ProposerVMUseCurrentHeightKey, false, "Have the ProposerVM always report the last accepted P-chain block height")
|
||||
fs.Duration(ProposerVMMinBlockDelayKey, proposervm.DefaultMinBlockDelay, "Minimum delay to enforce when building a chain++ block for the primary network chains and the default minimum delay for chains")
|
||||
fs.Duration(ProposerVMWindowDurationKey, 0, "Proposer-slot spacing for block production (0 uses the 5s mainnet default); shrink for fast cadence on small/local networks")
|
||||
|
||||
// Metrics
|
||||
fs.Bool(MeterVMsEnabledKey, true, "Enable Meter VMs to track VM performance with more granularity")
|
||||
|
||||
@@ -187,6 +187,7 @@ const (
|
||||
ConsensusFrontierPollFrequencyKey = "consensus-frontier-poll-frequency"
|
||||
ProposerVMUseCurrentHeightKey = "proposervm-use-current-height"
|
||||
ProposerVMMinBlockDelayKey = "proposervm-min-block-delay"
|
||||
ProposerVMWindowDurationKey = "proposervm-window-duration"
|
||||
FdLimitKey = "fd-limit"
|
||||
IndexEnabledKey = "index-enabled"
|
||||
IndexAllowIncompleteKey = "index-allow-incomplete"
|
||||
|
||||
@@ -177,6 +177,16 @@ type Config struct {
|
||||
// Health
|
||||
HealthCheckFreq time.Duration `json:"healthCheckFreq"`
|
||||
|
||||
// ProposerWindowDuration overrides the proposervm proposer-slot spacing.
|
||||
// Zero keeps the 5s mainnet default; small local/dev nets set it low (e.g.
|
||||
// 1s) so block cadence is not floored at 5s per proposer slot.
|
||||
ProposerWindowDuration time.Duration `json:"proposerWindowDuration"`
|
||||
|
||||
// ProposerMinBlockDelay is the proposervm minimum delay between consecutive
|
||||
// blocks (the hard cadence floor). Zero keeps the 1s default; high-throughput
|
||||
// / DEX nets set it low (e.g. 1ms) to approach the consensus-finality floor.
|
||||
ProposerMinBlockDelay time.Duration `json:"proposerMinBlockDelay"`
|
||||
|
||||
// Network configuration
|
||||
NetworkConfig network.Config `json:"networkConfig"`
|
||||
|
||||
|
||||
@@ -0,0 +1,163 @@
|
||||
# Postmortem: C-Chain accepted-head state GC eviction (mainnet freeze)
|
||||
|
||||
**Status:** Resolved. Mainnet recovered and accepted at 5/5 validators, C-Chain
|
||||
height 1085412, hash `0xd957eae6cb0bbef37174…`, all validators in agreement,
|
||||
explorer at tip, treasury and Genesis NFT state verified.
|
||||
|
||||
**Severity:** Critical (mainnet C-Chain unable to build blocks; no state loss).
|
||||
|
||||
## Accepted permanent invariant
|
||||
|
||||
> The accepted C-Chain head's state root must never be GC/pruning eligible —
|
||||
> across idle windows, duplicate empty-block state roots, cold snapshot/cache
|
||||
> layers, small state history, and restarts.
|
||||
>
|
||||
> accepted head ⇒ accepted head state root is pinned ⇒ GC/pruning cannot evict
|
||||
> the execution base for H+1.
|
||||
|
||||
The specific accepted-head GC eviction failure is **structurally prevented** by
|
||||
the head-state pin, and production evidence confirms the fleet no longer
|
||||
exhibits the prior failure signature. (A formal long-idle ritual was not
|
||||
completed to termination during the incident window; the sign-off rests on the
|
||||
structural invariant plus production evidence: a head idle for 3h04m was built
|
||||
on cleanly, multiple 5–15 minute zero-traffic windows passed with tip state
|
||||
readable, and zero eviction/materialize canaries appeared fleet-wide after the
|
||||
fix.)
|
||||
|
||||
## Failure mode (exact)
|
||||
|
||||
The C-Chain EVM (coreth-lineage, `luxfi/evm`) in pruning mode manages trie
|
||||
memory with `cappedMemoryTrieWriter` (`core/state_manager.go`):
|
||||
|
||||
- Accepted state roots are held in a `tipBuffer` (`BoundedBuffer`) of depth
|
||||
`state-history` (default **32**); as roots age out of the buffer they are
|
||||
`Dereference`d.
|
||||
- Dirty trie nodes are only committed to disk at `commit-interval` boundaries
|
||||
(default **4096** blocks), with optimistic `Cap` flushes near the boundary.
|
||||
- The insert-time `triedb.Reference(root, {})` in `writeBlockAndSetHead` is
|
||||
**refcount-balanced**: it is consumed as the block ages through the
|
||||
tipBuffer (or via `RejectTrie`). It therefore does not protect an idle head.
|
||||
|
||||
On an idle chain, consecutive empty blocks share identical state roots. The
|
||||
tipBuffer's aging `Dereference` for an old entry then lands on the *live head
|
||||
root* (duplicate key), dropping its reference count to zero. At any height that
|
||||
is not a commit boundary the head root has never been persisted, so the next
|
||||
`Cap`/flush evicts it from the dirty cache. The subsequent `BuildBlock` cannot
|
||||
open the parent (head) state:
|
||||
|
||||
```
|
||||
failed to materialize parent state for build: … StateAt: missing trie node
|
||||
<head state root> … is not available, not found
|
||||
```
|
||||
|
||||
and the chain wedges. RPC reads at `latest` fail with the same error (any
|
||||
`StateAt(root)` caller). Consensus is unaffected — all validators agree on the
|
||||
head *block*; only the local execution base for H+1 is gone. State is always
|
||||
deterministically re-derivable from durable blocks, so a restart re-executes
|
||||
and recovers — **restart is recovery evidence, not a fix**: the head could
|
||||
still be evicted again in the next idle window.
|
||||
|
||||
### Preconditions (all defaults on affected mainnet validators)
|
||||
|
||||
- `pruning-enabled: true`
|
||||
- `state-history: 32`
|
||||
- `commit-interval: 4096`
|
||||
- idle or bursty-then-idle traffic (heartbeat pause, low organic flow)
|
||||
- duplicate empty-block state roots at the tip
|
||||
- current height not at a commit boundary
|
||||
|
||||
Any C-Chain deployment matching these preconditions is exposed on affected
|
||||
versions — this bug class will recur wherever the EVM runs with pruning, small
|
||||
state history, long commit intervals, and idle traffic.
|
||||
|
||||
### Observed occurrences
|
||||
|
||||
1. Mainnet froze at height 1085200 after a ~10 minute heartbeat pause
|
||||
(2026-07-07). All five validators had the block, none could serve or build
|
||||
on its state.
|
||||
2. An earlier fleet-wide variant contributed to the 1082879→1085012 incident
|
||||
window (mixed with a separate proposervm/consensus issue documented in the
|
||||
consensus fault-recovery audit).
|
||||
|
||||
## Affected / fixed versions
|
||||
|
||||
| Component | Affected | Fixed |
|
||||
|---|---|---|
|
||||
| `luxfi/evm` (C-Chain plugin) | ≤ v1.104.6 (all pruning-mode deployments; the balanced insert-time Reference in v1.104.3-hotfix was insufficient) | **v1.104.7** |
|
||||
| `luxfi/node` image | v1.34.14 – v1.34.23 (carry affected EVM plugins) | **v1.34.24** (interim), **v1.34.25** (canonical: identical fix, proper semver, clean go.mod) |
|
||||
|
||||
Fix commits (`luxfi/evm`, branch `evm-main-bugb`): `9bab20f7a` (pin),
|
||||
`58b90490c` (non-fatal degradation), `e3781c35c` (vm v1.2.6 parity).
|
||||
|
||||
## The fix (structural)
|
||||
|
||||
`core/blockchain.go`: a dedicated **unbalanced** GC reference held on the
|
||||
accepted head's state root — `headStatePinRoot` + `pinAcceptedHead(root)`:
|
||||
|
||||
- Transferred head-to-head: `Reference` the new head root first, then
|
||||
`Dereference` the previous pinned root; exactly one live head pin exists at
|
||||
all times, on `lastAccepted.Root()`.
|
||||
- Established in `Accept`, in `SetLastAcceptedBlockDirect`, and on the loaded
|
||||
head at startup (`loadLastState`), so the invariant holds across restarts
|
||||
and the restart-then-idle path.
|
||||
- Skips when the root is unchanged (duplicate empty-block roots keep exactly
|
||||
one reference) and when state is not yet materialized (bootstrapping /
|
||||
state-sync; the first `Accept` then establishes it).
|
||||
- Deliberately **not** balanced against `InsertTrie`/`AcceptTrie`/`RejectTrie`
|
||||
— its lifetime is "is the accepted head", nothing else.
|
||||
- Non-fatal on backend error (pathdb `Reference`/`Dereference` are no-ops /
|
||||
"not supported"): a failed pin degrades to pre-fix behavior with a WARN
|
||||
rather than wedging Accept or startup.
|
||||
|
||||
No archive-mode workaround and no state-sync hack. Disk growth is unchanged
|
||||
(one extra referenced root).
|
||||
|
||||
## Recovery recipe (what actually worked)
|
||||
|
||||
1. **Wedged-at-tip (state evicted, DB otherwise consistent):** restart the
|
||||
node. Boot re-executes from the last committed root and re-materializes the
|
||||
head state deterministically. Valid as *recovery*; deploy the fixed version
|
||||
so it cannot recur.
|
||||
2. **proposervm/EVM height split** (`proposervm finality index … is BEHIND the
|
||||
inner VM tip`; produced here by crash-churn on affected versions — the
|
||||
fail-closed guard then correctly refuses to mount): restarts cannot heal a
|
||||
split. Restore the node's PVC from a `VolumeSnapshot` of a currently
|
||||
healthy peer. Per-ordinal staking keys are installed by `startup.sh` from
|
||||
the `luxd-staking` secret, so cross-node volume clones are safe (distinct
|
||||
NodeIDs).
|
||||
3. **PVC swaps must happen at StatefulSet `replicas=0`.** A live single-pod
|
||||
PVC delete/recreate always loses the race to the StatefulSet controller,
|
||||
which recreates a blank PVC first.
|
||||
4. If a fleet-consistent EVM rewind is needed instead (no healthy peer):
|
||||
`evm/cmd/repair-cchain` rewinds the standalone EVM `lastAccepted` to the
|
||||
proposervm floor; on boot the heightAhead branch self-heals (used in the
|
||||
1084996 recovery). Zero re-execution; never a re-genesis.
|
||||
5. Retain evidence snapshots before every destructive step.
|
||||
|
||||
## Residual follow-ups (non-blocking; restart/churn liveness, not consensus or state-loss)
|
||||
|
||||
1. **Proposer-preference restart loop:** after heavy sibling churn, a node's
|
||||
proposervm preference can reference a never-persisted outer block; every
|
||||
`BuildBlock` then fails `not found` in a tight loop and the node's voter
|
||||
goes mute (observed ~170 err/s). Restart clears it. Fix: fall back to
|
||||
last-accepted when the preferred parent is not fetchable.
|
||||
**FIXED (commit `8001bc5179`, branch `ship/node-v1.34.24`, ships in
|
||||
v1.34.26):** `vms/proposervm/vm.go` `BuildBlock` now builds the child on
|
||||
last-accepted (always held — committed state) when `vm.preferred` is
|
||||
unfetchable, instead of hard-erroring; it surfaces the original error only
|
||||
when last-accepted is itself the unfetchable id. Build-side companion to the
|
||||
already-shipped defect #1 `SetPreference` validate-before-assign hardening.
|
||||
Tests: `vms/proposervm/vm_buildblock_fallback_test.go`.
|
||||
2. **Ancestor-fetch liveness:** the finality guard refuses certs with
|
||||
"ancestor … is not tracked (behind; fetch and retry)" but the fetch never
|
||||
fires, so the node loops instead of catching up. Restart clears it. Fix:
|
||||
actually schedule the ancestor fetch on this path.
|
||||
|
||||
## Monitoring (keep active)
|
||||
|
||||
- Eviction/materialize canaries: `STATE-MATERIALIZE`, `missing trie node`,
|
||||
`ACCEPT-BACKSTOP` log lines — expect zero.
|
||||
- Accepted height/hash equality across all validators.
|
||||
- Explorer tip parity with chain head.
|
||||
- `is BEHIND the inner` (heightBehind) occurrences — expect zero.
|
||||
- Do not treat the heartbeat as a safety mechanism; it is a liveness nicety.
|
||||
@@ -75,9 +75,9 @@ func NewMultiNetworkNode() *MultiNetworkNode {
|
||||
|
||||
// StartRPCServer starts the unified RPC server
|
||||
func (n *MultiNetworkNode) StartRPCServer(port int) {
|
||||
http.HandleFunc("/ext/crossnet/status", n.handleCrossNetStatus)
|
||||
http.HandleFunc("/ext/crossnet/validators", n.handleCrossNetValidators)
|
||||
http.HandleFunc("/ext/network/", n.handleNetworkSpecific)
|
||||
http.HandleFunc("/v1/crossnet/status", n.handleCrossNetStatus)
|
||||
http.HandleFunc("/v1/crossnet/validators", n.handleCrossNetValidators)
|
||||
http.HandleFunc("/v1/network/", n.handleNetworkSpecific)
|
||||
|
||||
fmt.Printf("🌐 Multi-Network RPC Server starting on port %d\n", port)
|
||||
log.Fatal(http.ListenAndServe(fmt.Sprintf(":%d", port), nil))
|
||||
@@ -172,7 +172,7 @@ func (n *MultiNetworkNode) handleCrossNetValidators(w http.ResponseWriter, r *ht
|
||||
|
||||
// handleNetworkSpecific routes to network-specific handlers
|
||||
func (n *MultiNetworkNode) handleNetworkSpecific(w http.ResponseWriter, r *http.Request) {
|
||||
// Parse network ID from path: /ext/network/{networkID}/...
|
||||
// Parse network ID from path: /v1/network/{networkID}/...
|
||||
// This would route to the appropriate network's chain manager
|
||||
|
||||
response := fmt.Sprintf(`{
|
||||
@@ -251,9 +251,9 @@ func main() {
|
||||
}
|
||||
|
||||
fmt.Println("\n🌐 Starting Multi-Network RPC Server...")
|
||||
fmt.Println(" • Cross-network status: http://localhost:9650/ext/crossnet/status")
|
||||
fmt.Println(" • Cross-network validators: http://localhost:9650/ext/crossnet/validators")
|
||||
fmt.Println(" • Network-specific: http://localhost:9650/ext/network/{networkID}/...")
|
||||
fmt.Println(" • Cross-network status: http://localhost:9650/v1/crossnet/status")
|
||||
fmt.Println(" • Cross-network validators: http://localhost:9650/v1/crossnet/validators")
|
||||
fmt.Println(" • Network-specific: http://localhost:9650/v1/network/{networkID}/...")
|
||||
|
||||
// This would be replaced with actual RPC server
|
||||
node.StartRPCServer(9650)
|
||||
|
||||
Binary file not shown.
@@ -728,10 +728,10 @@ func UTXOAssetIDFromGenesisBytes(genesisBytes []byte) (ids.ID, bool, error) {
|
||||
if !ok {
|
||||
continue
|
||||
}
|
||||
if uChain.VMID != constants.XVMID {
|
||||
if uChain.VMID() != constants.XVMID {
|
||||
continue
|
||||
}
|
||||
id, err := xvmgenesis.AssetIDFromBytes(uChain.GenesisData)
|
||||
id, err := xvmgenesis.AssetIDFromBytes(uChain.GenesisData())
|
||||
if err != nil {
|
||||
return ids.Empty, false, fmt.Errorf("derive X-Chain asset ID from genesis data: %w", err)
|
||||
}
|
||||
@@ -749,7 +749,7 @@ func VMGenesis(genesisBytes []byte, vmID ids.ID) (*pchaintxs.Tx, error) {
|
||||
}
|
||||
for _, chain := range gen.Chains {
|
||||
uChain := chain.Unsigned.(*pchaintxs.CreateChainTx)
|
||||
if uChain.VMID == vmID {
|
||||
if uChain.VMID() == vmID {
|
||||
return chain, nil
|
||||
}
|
||||
}
|
||||
@@ -778,7 +778,7 @@ func Aliases(genesisBytes []byte) (map[string][]string, map[ids.ID][]string, err
|
||||
uChain := chain.Unsigned.(*pchaintxs.CreateChainTx)
|
||||
chainID := chain.ID()
|
||||
endpoint := path.Join(constants.ChainAliasPrefix, chainID.String())
|
||||
switch uChain.VMID {
|
||||
switch uChain.VMID() {
|
||||
case constants.XVMID:
|
||||
apiAliases[endpoint] = []string{
|
||||
"X",
|
||||
|
||||
@@ -11,7 +11,6 @@ import (
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/luxfi/node/vms/platformvm/genesis"
|
||||
pchaintxs "github.com/luxfi/node/vms/platformvm/txs"
|
||||
)
|
||||
|
||||
// TestUTXOAssetIDFromGenesisBytes_Sovereign asserts the canonical
|
||||
@@ -63,7 +62,7 @@ func TestUTXOAssetIDFromGenesisBytes_POnly(t *testing.T) {
|
||||
require := require.New(t)
|
||||
|
||||
pOnly := &genesis.Genesis{Chains: nil}
|
||||
pOnlyBytes, err := genesis.Codec.Marshal(pchaintxs.CodecVersion, pOnly)
|
||||
pOnlyBytes, err := pOnly.Bytes()
|
||||
require.NoError(err)
|
||||
|
||||
id, ok, err := UTXOAssetIDFromGenesisBytes(pOnlyBytes)
|
||||
@@ -93,7 +92,7 @@ func TestVMGenesisOptInChains(t *testing.T) {
|
||||
pOnly := &genesis.Genesis{
|
||||
Chains: nil,
|
||||
}
|
||||
pOnlyBytes, err := genesis.Codec.Marshal(pchaintxs.CodecVersion, pOnly)
|
||||
pOnlyBytes, err := pOnly.Bytes()
|
||||
require.NoError(err)
|
||||
|
||||
for name, vmID := range map[string]ids.ID{
|
||||
|
||||
@@ -314,15 +314,15 @@ func TestFromConfigExplicitStakers(t *testing.T) {
|
||||
for i, vdrTx := range parsed.Validators {
|
||||
switch ut := vdrTx.Unsigned.(type) {
|
||||
case *txs.AddValidatorTx:
|
||||
require.Equal(stakers[i].Weight, ut.Wght,
|
||||
require.Equal(stakers[i].Weight, ut.Weight(),
|
||||
"validator %d weight mismatch", i)
|
||||
t.Logf("Validator %d: NodeID=%s Weight=%d StakeOuts=%d",
|
||||
i, ut.Validator.NodeID, ut.Wght, len(ut.StakeOuts))
|
||||
i, ut.Validator().NodeID, ut.Weight(), len(ut.StakeOuts()))
|
||||
case *txs.AddPermissionlessValidatorTx:
|
||||
require.Equal(stakers[i].Weight, ut.Wght,
|
||||
require.Equal(stakers[i].Weight, ut.Weight(),
|
||||
"validator %d weight mismatch", i)
|
||||
t.Logf("Validator %d: NodeID=%s Weight=%d StakeOuts=%d",
|
||||
i, ut.Validator.NodeID, ut.Wght, len(ut.StakeOuts))
|
||||
i, ut.Validator().NodeID, ut.Weight(), len(ut.StakeOuts()))
|
||||
default:
|
||||
t.Fatalf("unexpected validator tx type: %T", ut)
|
||||
}
|
||||
@@ -396,15 +396,15 @@ func TestFromConfigExplicitStakersNoStakedFunds(t *testing.T) {
|
||||
for i, vdrTx := range parsed.Validators {
|
||||
switch ut := vdrTx.Unsigned.(type) {
|
||||
case *txs.AddValidatorTx:
|
||||
require.Greater(ut.Wght, uint64(0), "validator %d weight must be non-zero", i)
|
||||
require.Greater(len(ut.StakeOuts), 0, "validator %d must have stake outputs", i)
|
||||
require.Greater(ut.Weight(), uint64(0), "validator %d weight must be non-zero", i)
|
||||
require.Greater(len(ut.StakeOuts()), 0, "validator %d must have stake outputs", i)
|
||||
t.Logf("Validator %d: NodeID=%s Weight=%d StakeOuts=%d",
|
||||
i, ut.Validator.NodeID, ut.Wght, len(ut.StakeOuts))
|
||||
i, ut.Validator().NodeID, ut.Weight(), len(ut.StakeOuts()))
|
||||
case *txs.AddPermissionlessValidatorTx:
|
||||
require.Greater(ut.Wght, uint64(0), "validator %d weight must be non-zero", i)
|
||||
require.Greater(len(ut.StakeOuts), 0, "validator %d must have stake outputs", i)
|
||||
require.Greater(ut.Weight(), uint64(0), "validator %d weight must be non-zero", i)
|
||||
require.Greater(len(ut.StakeOuts()), 0, "validator %d must have stake outputs", i)
|
||||
t.Logf("Validator %d: NodeID=%s Weight=%d StakeOuts=%d",
|
||||
i, ut.Validator.NodeID, ut.Wght, len(ut.StakeOuts))
|
||||
i, ut.Validator().NodeID, ut.Weight(), len(ut.StakeOuts()))
|
||||
default:
|
||||
t.Fatalf("unexpected validator tx type: %T", ut)
|
||||
}
|
||||
|
||||
@@ -0,0 +1,173 @@
|
||||
// Copyright (C) 2019-2026, Lux Industries Inc. All rights reserved.
|
||||
// See the file LICENSE for licensing terms.
|
||||
|
||||
package builder
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/luxfi/constants"
|
||||
"github.com/luxfi/node/vms/platformvm/genesis"
|
||||
pchaintxs "github.com/luxfi/node/vms/platformvm/txs"
|
||||
)
|
||||
|
||||
// parsePolicy reads the operator form "3-of-5" into (K, N).
|
||||
//
|
||||
// The canonical parser is luxfi/threshold/pkg/quorum, but the node's genesis
|
||||
// builder is a boot-critical path and does not take a dependency on a
|
||||
// threshold-crypto library to read three integers. What this test pins is the
|
||||
// FORM — that the genesis blob states a quorum in a spelling that cannot be
|
||||
// confused with a polynomial degree — and the form is checkable here.
|
||||
func parsePolicy(t *testing.T, s string) (k, n int) {
|
||||
t.Helper()
|
||||
_, err := fmt.Sscanf(s, "%d-of-%d", &k, &n)
|
||||
require.NoErrorf(t, err, "policy %q is not in the operator form \"3-of-5\"", s)
|
||||
require.Greaterf(t, k, 1, "policy %q: k=1 is not a threshold policy", s)
|
||||
require.LessOrEqualf(t, k, n, "policy %q can never be satisfied", s)
|
||||
return k, n
|
||||
}
|
||||
|
||||
// canonicalMPCVMID is M-Chain's vmID in the encoding the node's plugin registry
|
||||
// resolves against. Pinned literally: the plugin binary's FILENAME must equal
|
||||
// it, and a change that leaves the two out of step produces a chain that is
|
||||
// declared in genesis but that no node can start.
|
||||
//
|
||||
// The predecessor value, tGVBwRxpmD2aFdg3iYjgRvrCe8Jcmq9UNKxyHMus2NZ8WcD8t, is
|
||||
// the retired `thresholdvm` identifier. It was what the Dockerfile installed
|
||||
// the plugin under while genesis declared MPCVMID, so the two never met.
|
||||
const canonicalMPCVMID = "qCURact1n41FcoNBch8iMVBwc9AWie48D118ZNJ5tBdWrvryS"
|
||||
|
||||
// M-Chain must be a GENESIS chain — in the P-Chain's chain set at height 0,
|
||||
// tracked by every validator from boot — not a chain created later by a
|
||||
// CreateChainTx someone has to remember to submit.
|
||||
//
|
||||
// The difference matters for custody specifically. A post-genesis chain exists
|
||||
// only from the height its tx landed, so a node syncing from genesis has a
|
||||
// window with no custody state, and the chain's very existence depends on an
|
||||
// operator action that can be forgotten or fumbled. Bridged funds should not
|
||||
// depend on that.
|
||||
func TestMChainIsAGenesisChain(t *testing.T) {
|
||||
for _, networkID := range []uint32{
|
||||
constants.MainnetID,
|
||||
constants.TestnetID,
|
||||
constants.LocalID,
|
||||
} {
|
||||
cfg := GetConfig(networkID)
|
||||
require.NotNilf(t, cfg, "network %d has no genesis config", networkID)
|
||||
require.NotEmptyf(t, cfg.MChainGenesis,
|
||||
"network %d carries no mchain.json, so the builder skips M-Chain entirely", networkID)
|
||||
|
||||
raw, _, err := FromConfig(cfg)
|
||||
require.NoErrorf(t, err, "network %d genesis build", networkID)
|
||||
|
||||
parsed, err := genesis.Parse(raw)
|
||||
require.NoErrorf(t, err, "network %d genesis parse", networkID)
|
||||
|
||||
// Genesis chains are CreateChainTx entries executed at height 0 — the
|
||||
// chain exists from the first block, without anyone submitting a tx.
|
||||
var found *pchaintxs.CreateChainTx
|
||||
for _, c := range parsed.Chains {
|
||||
u, ok := c.Unsigned.(*pchaintxs.CreateChainTx)
|
||||
require.True(t, ok, "a genesis chain entry must be a CreateChainTx")
|
||||
if u.VMID() == constants.MPCVMID {
|
||||
found = u
|
||||
break
|
||||
}
|
||||
}
|
||||
require.NotNilf(t, found,
|
||||
"network %d: no genesis chain with vmID %s (M-Chain)", networkID, constants.MPCVMID)
|
||||
require.Equal(t, "M-Chain", found.BlockchainName())
|
||||
require.Equalf(t, []byte(cfg.MChainGenesis), found.GenesisData(),
|
||||
"network %d: the VM must receive exactly the mchain.json bytes", networkID)
|
||||
require.Equalf(t, canonicalMPCVMID, found.VMID().String(),
|
||||
"network %d: genesis declares a vmID the plugin registry will look up by filename", networkID)
|
||||
}
|
||||
}
|
||||
|
||||
// The genesis blob decides how many custodians must cooperate to move bridged
|
||||
// funds, so it must state that in a form nothing can misread as a polynomial
|
||||
// degree. A bare `"threshold": 3` reads as the signer count to an operator and
|
||||
// as the degree to every threshold library, and those differ by one.
|
||||
func TestMChainGenesisPolicyIsUnambiguousAndDeployable(t *testing.T) {
|
||||
for _, tc := range []struct {
|
||||
networkID uint32
|
||||
want string
|
||||
}{
|
||||
{constants.MainnetID, "3-of-5"},
|
||||
{constants.TestnetID, "3-of-5"},
|
||||
{constants.LocalID, "2-of-3"},
|
||||
} {
|
||||
cfg := GetConfig(tc.networkID)
|
||||
require.NotNil(t, cfg)
|
||||
|
||||
var blob struct {
|
||||
Policy string `json:"policy"`
|
||||
VM string `json:"vm"`
|
||||
}
|
||||
require.NoErrorf(t, json.Unmarshal([]byte(cfg.MChainGenesis), &blob),
|
||||
"network %d mchain.json must decode, policy included", tc.networkID)
|
||||
|
||||
require.Equalf(t, tc.want, blob.Policy, "network %d policy", tc.networkID)
|
||||
k, n := parsePolicy(t, blob.Policy)
|
||||
require.Greaterf(t, 2*k, n,
|
||||
"network %d: %s admits two disjoint quorums, so two halves of the committee could authorise contradictory releases",
|
||||
tc.networkID, blob.Policy)
|
||||
require.Equalf(t, "mpcvm", blob.VM,
|
||||
"network %d must name the current VM, not the retired ThresholdVM", tc.networkID)
|
||||
}
|
||||
}
|
||||
|
||||
// The ambiguous fields must be gone, not merely ignored. Leaving them in place
|
||||
// means the next reader has two numbers to choose between, and the whole point
|
||||
// of the policy field is that there is exactly one.
|
||||
func TestMChainGenesisHasNoAmbiguousThresholdFields(t *testing.T) {
|
||||
for _, networkID := range []uint32{constants.MainnetID, constants.TestnetID, constants.LocalID} {
|
||||
cfg := GetConfig(networkID)
|
||||
require.NotNil(t, cfg)
|
||||
|
||||
var blob map[string]any
|
||||
require.NoError(t, json.Unmarshal([]byte(cfg.MChainGenesis), &blob))
|
||||
for _, dead := range []string{"mpcThreshold", "mpcParties", "threshold", "totalParties"} {
|
||||
require.NotContainsf(t, blob, dead,
|
||||
"network %d mchain.json still carries %q; the policy field is the only quorum statement",
|
||||
networkID, dead)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// A policy is only real if the network has enough validators to hold its
|
||||
// shares. M-Chain draws its committee from the validator set, and RunKeygen
|
||||
// refuses a policy needing more parties than the committee has — so a genesis
|
||||
// declaring 7-of-10 on a five-validator network fails closed forever: no
|
||||
// custody key can ever be generated, and the failure only shows up the first
|
||||
// time someone tries to bridge.
|
||||
//
|
||||
// mainnet's mchain.json shipped exactly that mismatch for as long as the field
|
||||
// existed, harmlessly, because nothing read it. This test is what keeps it
|
||||
// harmless now that the policy is authoritative.
|
||||
func TestMChainPolicyIsSatisfiableByTheGenesisValidatorSet(t *testing.T) {
|
||||
for _, networkID := range []uint32{constants.MainnetID, constants.TestnetID, constants.LocalID} {
|
||||
cfg := GetConfig(networkID)
|
||||
require.NotNil(t, cfg)
|
||||
|
||||
raw, _, err := FromConfig(cfg)
|
||||
require.NoError(t, err)
|
||||
parsed, err := genesis.Parse(raw)
|
||||
require.NoError(t, err)
|
||||
|
||||
var blob struct {
|
||||
Policy string `json:"policy"`
|
||||
}
|
||||
require.NoError(t, json.Unmarshal([]byte(cfg.MChainGenesis), &blob))
|
||||
_, n := parsePolicy(t, blob.Policy)
|
||||
|
||||
require.LessOrEqualf(t, n, len(parsed.Validators),
|
||||
"network %d: M-Chain policy %s needs %d parties but genesis declares %d validators; "+
|
||||
"keygen would fail closed and no custody key could ever exist",
|
||||
networkID, blob.Policy, n, len(parsed.Validators))
|
||||
}
|
||||
}
|
||||
@@ -54,10 +54,10 @@ func TestZZZ_GateProbe_PerChainDigest(t *testing.T) {
|
||||
rows := make([]row, 0, len(gen.Chains))
|
||||
for _, c := range gen.Chains {
|
||||
u := c.Unsigned.(*pchaintxs.CreateChainTx)
|
||||
sum := sha256.Sum256(u.GenesisData)
|
||||
sum := sha256.Sum256(u.GenesisData())
|
||||
rows = append(rows, row{
|
||||
name: u.BlockchainName,
|
||||
vmid: u.VMID.String(),
|
||||
name: u.BlockchainName(),
|
||||
vmid: u.VMID().String(),
|
||||
dataSum: hex.EncodeToString(sum[:]),
|
||||
chainID: c.ID().String(),
|
||||
})
|
||||
|
||||
@@ -26,21 +26,21 @@ 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.35.27
|
||||
github.com/luxfi/crypto v1.19.26
|
||||
github.com/luxfi/database v1.20.4
|
||||
github.com/luxfi/ids v1.3.1
|
||||
github.com/luxfi/keychain v1.0.2
|
||||
github.com/luxfi/consensus v1.36.12
|
||||
github.com/luxfi/crypto v1.20.2
|
||||
github.com/luxfi/database v1.21.1
|
||||
github.com/luxfi/ids v1.3.2
|
||||
github.com/luxfi/keychain v1.1.1
|
||||
github.com/luxfi/log v1.4.3
|
||||
github.com/luxfi/math v1.4.1
|
||||
github.com/luxfi/metric v1.5.9
|
||||
github.com/luxfi/math v1.5.1
|
||||
github.com/luxfi/metric v1.8.1
|
||||
github.com/luxfi/mock v0.1.1
|
||||
github.com/mr-tron/base58 v1.3.0
|
||||
github.com/onsi/ginkgo/v2 v2.28.1
|
||||
github.com/pires/go-proxyproto v0.11.0
|
||||
github.com/prometheus/client_golang v1.23.2 // indirect
|
||||
github.com/prometheus/client_model v0.6.2 // indirect
|
||||
github.com/prometheus/common v0.67.5 // indirect
|
||||
github.com/prometheus/common v0.68.0 // indirect
|
||||
github.com/rs/cors v1.11.1
|
||||
github.com/shirou/gopsutil v3.21.11+incompatible
|
||||
github.com/spf13/cast v1.10.0 // indirect
|
||||
@@ -56,13 +56,13 @@ require (
|
||||
go.opentelemetry.io/otel/trace v1.44.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.54.0
|
||||
golang.org/x/exp v0.0.0-20260529124908-c761662dc8c9 // indirect
|
||||
golang.org/x/mod v0.36.0
|
||||
golang.org/x/net v0.55.0
|
||||
golang.org/x/sync v0.20.0
|
||||
golang.org/x/mod v0.37.0
|
||||
golang.org/x/net v0.57.0
|
||||
golang.org/x/sync v0.22.0
|
||||
golang.org/x/time v0.15.0
|
||||
golang.org/x/tools v0.45.0
|
||||
golang.org/x/tools v0.47.0
|
||||
gonum.org/v1/gonum v0.17.0
|
||||
google.golang.org/protobuf v1.36.12-0.20260120151049-f2248ac996af // indirect
|
||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||
@@ -73,7 +73,7 @@ require (
|
||||
github.com/beorn7/perks v1.0.1 // indirect
|
||||
github.com/bits-and-blooms/bitset v1.24.4 // indirect
|
||||
github.com/cespare/xxhash/v2 v2.3.0
|
||||
github.com/cockroachdb/errors v1.12.0 // indirect
|
||||
github.com/cockroachdb/errors v1.13.0 // indirect
|
||||
github.com/cockroachdb/logtags v0.0.0-20241215232642-bb51bb14a506 // indirect
|
||||
github.com/cockroachdb/redact v1.1.8 // indirect
|
||||
github.com/cockroachdb/tokenbucket v0.0.0-20250429170803-42689b6311bb // indirect
|
||||
@@ -81,7 +81,7 @@ require (
|
||||
github.com/deckarep/golang-set/v2 v2.9.0 // indirect
|
||||
github.com/fatih/structtag v1.2.0 // indirect
|
||||
github.com/fsnotify/fsnotify v1.9.0 // indirect
|
||||
github.com/getsentry/sentry-go v0.44.1 // indirect
|
||||
github.com/getsentry/sentry-go v0.46.2 // indirect
|
||||
github.com/go-logr/logr v1.4.3 // indirect
|
||||
github.com/go-logr/stdr v1.2.2 // indirect
|
||||
github.com/go-ole/go-ole v1.3.0 // indirect
|
||||
@@ -90,7 +90,7 @@ require (
|
||||
github.com/gorilla/websocket v1.5.4-0.20250319132907-e064f32e3674
|
||||
github.com/hashicorp/golang-lru v1.0.2 // indirect
|
||||
github.com/inconshreveable/mousetrap v1.1.0 // indirect
|
||||
github.com/klauspost/compress v1.18.6
|
||||
github.com/klauspost/compress v1.19.1
|
||||
github.com/kr/pretty v0.3.1 // indirect
|
||||
github.com/kr/text v0.2.0 // indirect
|
||||
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
|
||||
@@ -98,7 +98,7 @@ require (
|
||||
github.com/pkg/errors v0.9.1 // indirect
|
||||
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
|
||||
github.com/prometheus/procfs v0.20.1 // indirect
|
||||
github.com/rogpeppe/go-internal v1.14.1 // indirect
|
||||
github.com/rogpeppe/go-internal v1.15.0 // indirect
|
||||
github.com/sanity-io/litter v1.5.5 // indirect
|
||||
github.com/spf13/afero v1.15.0 // indirect
|
||||
github.com/subosito/gotenv v1.6.0 // indirect
|
||||
@@ -107,8 +107,8 @@ require (
|
||||
github.com/yusufpapurcu/wmi v1.2.4 // indirect
|
||||
go.opentelemetry.io/otel/metric v1.44.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.47.0 // indirect
|
||||
golang.org/x/text v0.40.0 // indirect
|
||||
)
|
||||
|
||||
require (
|
||||
@@ -118,70 +118,69 @@ require (
|
||||
github.com/golang-jwt/jwt/v4 v4.5.2
|
||||
github.com/golang/mock v1.7.0-rc.1
|
||||
github.com/luxfi/accel v1.2.4
|
||||
github.com/luxfi/api v1.0.15
|
||||
github.com/luxfi/api v1.1.1
|
||||
github.com/luxfi/atomic v1.0.0
|
||||
github.com/luxfi/chains v1.7.2
|
||||
github.com/luxfi/codec v1.1.5
|
||||
github.com/luxfi/compress v0.0.5
|
||||
github.com/luxfi/constants v1.6.1
|
||||
github.com/luxfi/container v0.0.4
|
||||
github.com/luxfi/chains v1.7.9
|
||||
github.com/luxfi/codec v1.2.1
|
||||
github.com/luxfi/compress v0.1.1
|
||||
github.com/luxfi/constants v1.6.2
|
||||
github.com/luxfi/container v0.2.1
|
||||
github.com/luxfi/filesystem v0.0.1
|
||||
github.com/luxfi/genesis v1.16.1
|
||||
github.com/luxfi/genesis v1.16.4
|
||||
github.com/luxfi/genesis/pkg/genesis/security v1.13.8
|
||||
github.com/luxfi/geth v1.17.12
|
||||
github.com/luxfi/go-bip39 v1.1.2
|
||||
github.com/luxfi/keys v1.2.0
|
||||
github.com/luxfi/geth v1.20.1
|
||||
github.com/luxfi/go-bip39 v1.2.0
|
||||
github.com/luxfi/kms v1.12.10
|
||||
github.com/luxfi/math/safe v0.0.1
|
||||
github.com/luxfi/net v0.0.5
|
||||
github.com/luxfi/p2p v1.21.1
|
||||
github.com/luxfi/resource v0.0.1
|
||||
github.com/luxfi/net v0.1.1
|
||||
github.com/luxfi/p2p v1.22.1
|
||||
github.com/luxfi/resource v0.1.1
|
||||
github.com/luxfi/rpc v1.1.0
|
||||
github.com/luxfi/runtime v1.1.3
|
||||
github.com/luxfi/sdk v1.17.9
|
||||
github.com/luxfi/runtime v1.3.1
|
||||
github.com/luxfi/sdk v1.18.1
|
||||
github.com/luxfi/sys v0.1.0
|
||||
github.com/luxfi/threshold v1.12.1
|
||||
github.com/luxfi/timer v1.0.2
|
||||
github.com/luxfi/threshold v1.12.3
|
||||
github.com/luxfi/timer v1.1.1
|
||||
github.com/luxfi/units v1.0.0
|
||||
github.com/luxfi/utils v1.2.0
|
||||
github.com/luxfi/utxo v0.3.7
|
||||
github.com/luxfi/validators v1.2.0
|
||||
github.com/luxfi/vm v1.2.5
|
||||
github.com/luxfi/warp v1.24.0
|
||||
github.com/luxfi/zap v0.8.11
|
||||
github.com/luxfi/zwing v0.5.2
|
||||
github.com/luxfi/utils v1.3.1
|
||||
github.com/luxfi/utxo v0.5.8
|
||||
github.com/luxfi/validators v1.3.1
|
||||
github.com/luxfi/vm v1.3.3
|
||||
github.com/luxfi/warp v1.24.1
|
||||
github.com/luxfi/zap v1.2.6
|
||||
github.com/luxfi/zwing v0.6.1
|
||||
github.com/nbutton23/zxcvbn-go v0.0.0-20210217022336-fa2cb2858354
|
||||
github.com/zap-proto/http v0.0.0-20260506200741-fd6047874433
|
||||
github.com/valyala/fasthttp v1.73.0
|
||||
github.com/zap-proto/http v0.3.0
|
||||
go.uber.org/zap v1.27.1
|
||||
)
|
||||
|
||||
require (
|
||||
capnproto.org/go/capnp/v3 v3.0.1-alpha.2 // indirect
|
||||
filippo.io/edwards25519 v1.2.0 // indirect
|
||||
filippo.io/hpke v0.4.0 // indirect
|
||||
github.com/andybalholm/brotli v1.2.2 // indirect
|
||||
github.com/aws/aws-sdk-go-v2 v1.41.5 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.7.5 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.7.8 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/config v1.32.13 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/credentials v1.19.13 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.18.21 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.21 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.21 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/internal/ini v1.8.6 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/internal/v4a v1.4.18 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/internal/v4a v1.4.22 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.13.7 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.9.10 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.9.13 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.13.21 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.19.18 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/service/s3 v1.96.2 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.19.21 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/service/s3 v1.97.3 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/service/signin v1.0.9 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/service/sso v1.30.14 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.35.18 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/service/sts v1.41.10 // indirect
|
||||
github.com/aws/smithy-go v1.24.2 // indirect
|
||||
github.com/btcsuite/btcd/btcec/v2 v2.5.0 // indirect
|
||||
github.com/btcsuite/btcd/chaincfg/chainhash v1.1.0 // indirect
|
||||
github.com/btcsuite/btcd/chainhash/v2 v2.0.0 // indirect
|
||||
github.com/cenkalti/backoff v2.2.1+incompatible // indirect
|
||||
github.com/colega/zeropool v0.0.0-20230505084239-6fb4a4f75381 // 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
|
||||
@@ -191,23 +190,24 @@ require (
|
||||
github.com/hanzoai/vfs v0.4.3 // indirect
|
||||
github.com/hanzos3/go-sdk v1.0.2 // indirect
|
||||
github.com/klauspost/crc32 v1.3.0 // indirect
|
||||
github.com/luxfi/age v1.5.0 // indirect
|
||||
github.com/luxfi/age v1.6.0 // indirect
|
||||
github.com/luxfi/bft v0.1.5 // indirect
|
||||
github.com/luxfi/corona v0.10.3 // indirect
|
||||
github.com/luxfi/corona v0.10.4 // indirect
|
||||
github.com/luxfi/crypto/ipa v1.2.4 // indirect
|
||||
github.com/luxfi/dkg v0.3.5 // indirect
|
||||
github.com/luxfi/kms v1.11.7 // indirect
|
||||
github.com/luxfi/keys v1.4.1 // indirect
|
||||
github.com/luxfi/lattice/v7 v7.1.4 // indirect
|
||||
github.com/luxfi/lens v0.1.4 // indirect
|
||||
github.com/luxfi/lens v0.2.1 // indirect
|
||||
github.com/luxfi/light v1.0.0 // indirect
|
||||
github.com/luxfi/magnetar v1.2.3 // indirect
|
||||
github.com/luxfi/mdns v0.1.1 // indirect
|
||||
github.com/luxfi/mlwe v0.2.1 // indirect
|
||||
github.com/luxfi/pq v1.0.3 // indirect
|
||||
github.com/luxfi/precompile v0.19.0 // indirect
|
||||
github.com/luxfi/pulsar v1.9.0 // indirect
|
||||
github.com/luxfi/staking v1.5.1 // indirect
|
||||
github.com/luxfi/trace v1.1.0 // indirect
|
||||
github.com/luxfi/zapcodec v1.0.1 // indirect
|
||||
github.com/luxfi/mlwe v0.3.0 // indirect
|
||||
github.com/luxfi/pq v1.1.0 // indirect
|
||||
github.com/luxfi/precompile v0.19.3 // indirect
|
||||
github.com/luxfi/protocol v0.0.2 // indirect
|
||||
github.com/luxfi/pulsar v1.9.2 // indirect
|
||||
github.com/luxfi/staking v1.6.1 // indirect
|
||||
github.com/luxfi/trace v1.2.1 // indirect
|
||||
github.com/luxfi/zapdb v1.10.1 // indirect
|
||||
github.com/miekg/dns v1.1.72 // indirect
|
||||
github.com/mimoo/StrobeGo v0.0.0-20220103164710-9a04d6ca976b // indirect
|
||||
@@ -216,13 +216,16 @@ require (
|
||||
github.com/philhofer/fwd v1.2.0 // indirect
|
||||
github.com/rs/xid v1.6.0 // indirect
|
||||
github.com/tinylib/msgp v1.6.4 // indirect
|
||||
github.com/valyala/bytebufferpool v1.0.0 // indirect
|
||||
github.com/zap-proto/go v1.1.0 // indirect
|
||||
go.mongodb.org/mongo-driver v1.17.9 // indirect
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20260526163538-3dc84a4a5aaa // indirect
|
||||
)
|
||||
|
||||
require (
|
||||
github.com/luxfi/concurrent v0.0.3
|
||||
github.com/luxfi/proto v1.3.5
|
||||
github.com/luxfi/upgrade v1.0.1 // indirect
|
||||
github.com/luxfi/concurrent v0.1.1
|
||||
github.com/luxfi/proto v1.4.2
|
||||
github.com/luxfi/upgrade v1.0.3 // indirect
|
||||
github.com/luxfi/version v1.0.1
|
||||
gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect
|
||||
)
|
||||
@@ -243,13 +246,13 @@ require (
|
||||
github.com/google/go-cmp v0.7.0 // indirect
|
||||
github.com/google/pprof v0.0.0-20260302011040-a15ffb7f9dcc // indirect
|
||||
github.com/klauspost/cpuid/v2 v2.3.0 // indirect
|
||||
github.com/luxfi/address v1.0.1
|
||||
github.com/luxfi/cache v1.2.1 // indirect
|
||||
github.com/luxfi/formatting v1.0.1
|
||||
github.com/luxfi/go-bip32 v1.0.2
|
||||
github.com/luxfi/address v1.1.1
|
||||
github.com/luxfi/cache v1.3.1 // indirect
|
||||
github.com/luxfi/formatting v1.1.1
|
||||
github.com/luxfi/go-bip32 v1.1.0
|
||||
github.com/luxfi/math/big v0.1.0 // indirect
|
||||
github.com/luxfi/sampler v1.1.0 // indirect
|
||||
github.com/luxfi/tls v1.0.3 // indirect
|
||||
github.com/luxfi/tls v1.1.1 // indirect
|
||||
github.com/mattn/go-colorable v0.1.15 // indirect
|
||||
github.com/mattn/go-isatty v0.0.22 // indirect
|
||||
github.com/montanaflynn/stats v0.9.0 // indirect
|
||||
@@ -258,15 +261,7 @@ require (
|
||||
github.com/x448/float16 v0.8.4 // indirect
|
||||
github.com/zeebo/blake3 v0.2.4 // indirect
|
||||
go.opentelemetry.io/auto/sdk v1.2.1 // indirect
|
||||
go.yaml.in/yaml/v2 v2.4.4 // indirect
|
||||
go.yaml.in/yaml/v3 v3.0.4 // indirect
|
||||
)
|
||||
|
||||
exclude github.com/ethereum/go-ethereum v1.10.26
|
||||
|
||||
// TEMPORARY — local-dev build aid for the bootstrap frozen-cache convergence fix.
|
||||
// FINAL CASCADE (publish step, NOT done here): tag consensus v1.25.36 (the uncommitted
|
||||
// engine/chain/integration.go FinalizedLedger + FinalizedBlockAtHeight accessors and the
|
||||
// engine/chain/bootstrap Has→Accepted change), bump the require above v1.25.35 → v1.25.36,
|
||||
// then DELETE this replace. The zap client (option b) is node-only and does NOT widen the
|
||||
// consensus bump.
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
c2sp.org/CCTV/age v0.0.0-20251208015420-e9274a7bdbfd h1:ZLsPO6WdZ5zatV4UfVpr7oAwLGRZ+sebTUruuM4Ra3M=
|
||||
c2sp.org/CCTV/age v0.0.0-20251208015420-e9274a7bdbfd/go.mod h1:SrHC2C7r5GkDk8R+NFVzYy/sdj0Ypg9htaPXQq5Cqeo=
|
||||
capnproto.org/go/capnp/v3 v3.0.1-alpha.2 h1:W/cf+XEArUSwcBBE/9wS2NpWDkM5NLQOjmzEiHZpYi0=
|
||||
capnproto.org/go/capnp/v3 v3.0.1-alpha.2/go.mod h1:2vT5D2dtG8sJGEoEKU17e+j7shdaYp1Myl8X03B3hmc=
|
||||
filippo.io/edwards25519 v1.2.0 h1:crnVqOiS4jqYleHd9vaKZ+HKtHfllngJIiOpNpoJsjo=
|
||||
filippo.io/edwards25519 v1.2.0/go.mod h1:xzAOLCNug/yB62zG1bQ8uziwrIqIuxhctzJT18Q77mc=
|
||||
filippo.io/hpke v0.4.0 h1:p575VVQ6ted4pL+it6M00V/f2qTZITO0zgmdKCkd5+A=
|
||||
@@ -19,10 +17,14 @@ github.com/Microsoft/go-winio v0.6.2/go.mod h1:yd8OoFMLzJbo9gZq8j5qaps8bJ9aShtEA
|
||||
github.com/StephenButtolph/canoto v0.17.3 h1:lvsnYD4b96vD1knnmp1xCmZqfYpY/jSeRozGdOfdvGI=
|
||||
github.com/StephenButtolph/canoto v0.17.3/go.mod h1:IcnAHC6nJUfQFVR9y60ko2ecUqqHHSB6UwI9NnBFZnE=
|
||||
github.com/aead/siphash v1.0.1/go.mod h1:Nywa3cDsYNNK3gaciGTWPwHt0wlpNV15vwmswBAUSII=
|
||||
github.com/andybalholm/brotli v1.2.2 h1:HzTuoo2ErYQqf5qvcJInB8uvqSVxRttzkFexPWtnceM=
|
||||
github.com/andybalholm/brotli v1.2.2/go.mod h1:rzTDkvFWvIrjDXZHkuS16NPggd91W3kUSvPlQ1pLaKY=
|
||||
github.com/aws/aws-sdk-go-v2 v1.41.5 h1:dj5kopbwUsVUVFgO4Fi5BIT3t4WyqIDjGKCangnV/yY=
|
||||
github.com/aws/aws-sdk-go-v2 v1.41.5/go.mod h1:mwsPRE8ceUUpiTgF7QmQIJ7lgsKUPQOUl3o72QBrE1o=
|
||||
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.7.5 h1:zWFmPmgw4sveAYi1mRqG+E/g0461cJ5M4bJ8/nc6d3Q=
|
||||
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.7.5/go.mod h1:nVUlMLVV8ycXSb7mSkcNu9e3v/1TJq2RTlrPwhYWr5c=
|
||||
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.7.8 h1:eBMB84YGghSocM7PsjmmPffTa+1FBUeNvGvFou6V/4o=
|
||||
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.7.8/go.mod h1:lyw7GFp3qENLh7kwzf7iMzAxDn+NzjXEAGjKS2UOKqI=
|
||||
github.com/aws/aws-sdk-go-v2/config v1.32.13 h1:5KgbxMaS2coSWRrx9TX/QtWbqzgQkOdEa3sZPhBhCSg=
|
||||
github.com/aws/aws-sdk-go-v2/config v1.32.13/go.mod h1:8zz7wedqtCbw5e9Mi2doEwDyEgHcEE9YOJp6a8jdSMY=
|
||||
github.com/aws/aws-sdk-go-v2/credentials v1.19.13 h1:mA59E3fokBvyEGHKFdnpNNrvaR351cqiHgRg+JzOSRI=
|
||||
@@ -37,16 +39,24 @@ github.com/aws/aws-sdk-go-v2/internal/ini v1.8.6 h1:qYQ4pzQ2Oz6WpQ8T3HvGHnZydA72
|
||||
github.com/aws/aws-sdk-go-v2/internal/ini v1.8.6/go.mod h1:O3h0IK87yXci+kg6flUKzJnWeziQUKciKrLjcatSNcY=
|
||||
github.com/aws/aws-sdk-go-v2/internal/v4a v1.4.18 h1:eZioDaZGJ0tMM4gzmkNIO2aAoQd+je7Ug7TkvAzlmkU=
|
||||
github.com/aws/aws-sdk-go-v2/internal/v4a v1.4.18/go.mod h1:CCXwUKAJdoWr6/NcxZ+zsiPr6oH/Q5aTooRGYieAyj4=
|
||||
github.com/aws/aws-sdk-go-v2/internal/v4a v1.4.22 h1:rWyie/PxDRIdhNf4DzRk0lvjVOqFJuNnO8WwaIRVxzQ=
|
||||
github.com/aws/aws-sdk-go-v2/internal/v4a v1.4.22/go.mod h1:zd/JsJ4P7oGfUhXn1VyLqaRZwPmZwg44Jf2dS84Dm3Y=
|
||||
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.13.7 h1:5EniKhLZe4xzL7a+fU3C2tfUN4nWIqlLesfrjkuPFTY=
|
||||
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.13.7/go.mod h1:x0nZssQ3qZSnIcePWLvcoFisRXJzcTVvYpAAdYX8+GI=
|
||||
github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.9.10 h1:fJvQ5mIBVfKtiyx0AHY6HeWcRX5LGANLpq8SVR+Uazs=
|
||||
github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.9.10/go.mod h1:Kzm5e6OmNH8VMkgK9t+ry5jEih4Y8whqs+1hrkxim1I=
|
||||
github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.9.13 h1:JRaIgADQS/U6uXDqlPiefP32yXTda7Kqfx+LgspooZM=
|
||||
github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.9.13/go.mod h1:CEuVn5WqOMilYl+tbccq8+N2ieCy0gVn3OtRb0vBNNM=
|
||||
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.13.21 h1:c31//R3xgIJMSC8S6hEVq+38DcvUlgFY0FM6mSI5oto=
|
||||
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.13.21/go.mod h1:r6+pf23ouCB718FUxaqzZdbpYFyDtehyZcmP5KL9FkA=
|
||||
github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.19.18 h1:/A/xDuZAVD2BpsS2fftFRo/NoEKQJ8YTnJDEHBy2Gtg=
|
||||
github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.19.18/go.mod h1:hWe9b4f+djUQGmyiGEeOnZv69dtMSgpDRIvNMvuvzvY=
|
||||
github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.19.21 h1:ZlvrNcHSFFWURB8avufQq9gFsheUgjVD9536obIknfM=
|
||||
github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.19.21/go.mod h1:cv3TNhVrssKR0O/xxLJVRfd2oazSnZnkUeTf6ctUwfQ=
|
||||
github.com/aws/aws-sdk-go-v2/service/s3 v1.96.2 h1:M1A9AjcFwlxTLuf0Faj88L8Iqw0n/AJHjpZTQzMMsSc=
|
||||
github.com/aws/aws-sdk-go-v2/service/s3 v1.96.2/go.mod h1:KsdTV6Q9WKUZm2mNJnUFmIoXfZux91M3sr/a4REX8e0=
|
||||
github.com/aws/aws-sdk-go-v2/service/s3 v1.97.3 h1:HwxWTbTrIHm5qY+CAEur0s/figc3qwvLWsNkF4RPToo=
|
||||
github.com/aws/aws-sdk-go-v2/service/s3 v1.97.3/go.mod h1:uoA43SdFwacedBfSgfFSjjCvYe8aYBS7EnU5GZ/YKMM=
|
||||
github.com/aws/aws-sdk-go-v2/service/signin v1.0.9 h1:QKZH0S178gCmFEgst8hN0mCX1KxLgHBKKY/CLqwP8lg=
|
||||
github.com/aws/aws-sdk-go-v2/service/signin v1.0.9/go.mod h1:7yuQJoT+OoH8aqIxw9vwF+8KpvLZ8AWmvmUWHsGQZvI=
|
||||
github.com/aws/aws-sdk-go-v2/service/sso v1.30.14 h1:GcLE9ba5ehAQma6wlopUesYg/hbcOhFNWTjELkiWkh4=
|
||||
@@ -64,12 +74,9 @@ github.com/bits-and-blooms/bitset v1.24.4/go.mod h1:7hO7Gc7Pp1vODcmWvKMRA9BNmbv6
|
||||
github.com/btcsuite/btcd v0.20.1-beta/go.mod h1:wVuoA8VJLEcwgqHBwHmzLRazpKxTv13Px/pDuV7OomQ=
|
||||
github.com/btcsuite/btcd v0.22.0-beta.0.20220111032746-97732e52810c/go.mod h1:tjmYdS6MLJ5/s0Fj4DbLgSbDHbEqLJrtnHecBFkdz5M=
|
||||
github.com/btcsuite/btcd v0.23.5-0.20231215221805-96c9fd8078fd/go.mod h1:nm3Bko6zh6bWP60UxwoT5LzdGJsQJaPo6HjduXq9p6A=
|
||||
github.com/btcsuite/btcd v0.24.2 h1:aLmxPguqxza+4ag8R1I2nnJjSu2iFn/kqtHTIImswcY=
|
||||
github.com/btcsuite/btcd v0.24.2/go.mod h1:5C8ChTkl5ejr3WHj8tkQSCmydiMEPB0ZhQhehpq7Dgg=
|
||||
github.com/btcsuite/btcd/btcec/v2 v2.1.0/go.mod h1:2VzYrv4Gm4apmbVVsSq5bqf1Ec8v56E48Vt0Y/umPgA=
|
||||
github.com/btcsuite/btcd/btcec/v2 v2.1.3/go.mod h1:ctjw4H1kknNJmRN4iP1R7bTQ+v3GJkZBd6mui8ZsAZE=
|
||||
github.com/btcsuite/btcd/btcec/v2 v2.3.6 h1:IzlsEr9olcSRKB/n7c4351F3xHKxS2lma+1UFGCYd4E=
|
||||
github.com/btcsuite/btcd/btcec/v2 v2.3.6/go.mod h1:m22FrOAiuxl/tht9wIqAoGHcbnCCaPWyauO8y2LGGtQ=
|
||||
github.com/btcsuite/btcd/btcec/v2 v2.5.0 h1:KioMXOWa76b86sTZZOmbzv/ldaQCmB8KFAyn5PbB8E8=
|
||||
github.com/btcsuite/btcd/btcec/v2 v2.5.0/go.mod h1:+K/MYXcLBtHEQjRbjHuJChuybk4LCgjdjgRwil+e+Kk=
|
||||
github.com/btcsuite/btcd/btcutil v1.0.0/go.mod h1:Uoxwv0pqYWhD//tfTiipkxNfdhG9UrLwaeswfjfdF0A=
|
||||
@@ -79,7 +86,6 @@ github.com/btcsuite/btcd/btcutil v1.1.6 h1:zFL2+c3Lb9gEgqKNzowKUPQNb8jV7v5Oaodi/
|
||||
github.com/btcsuite/btcd/btcutil v1.1.6/go.mod h1:9dFymx8HpuLqBnsPELrImQeTQfKBQqzqGbbV3jK55aE=
|
||||
github.com/btcsuite/btcd/chaincfg/chainhash v1.0.0/go.mod h1:7SFka0XMvUgj3hfZtydOrQY2mwhPclbT2snogU7SQQc=
|
||||
github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1/go.mod h1:7SFka0XMvUgj3hfZtydOrQY2mwhPclbT2snogU7SQQc=
|
||||
github.com/btcsuite/btcd/chaincfg/chainhash v1.1.0 h1:59Kx4K6lzOW5w6nFlA0v5+lk/6sjybR934QNHSJZPTQ=
|
||||
github.com/btcsuite/btcd/chaincfg/chainhash v1.1.0/go.mod h1:7SFka0XMvUgj3hfZtydOrQY2mwhPclbT2snogU7SQQc=
|
||||
github.com/btcsuite/btcd/chainhash/v2 v2.0.0 h1:PMLlSloHJuEeB80XG9EjpXWNEKAZAMLl6YHZ6YsEuoA=
|
||||
github.com/btcsuite/btcd/chainhash/v2 v2.0.0/go.mod h1:mKxcZ7oGTXE7IRV+sS9hP4EVBwc/SzfNR+52IsOP9j8=
|
||||
@@ -103,8 +109,8 @@ github.com/cloudflare/circl v1.6.3 h1:9GPOhQGF9MCYUeXyMYlqTR6a5gTrgR/fBLXvUgtVcg
|
||||
github.com/cloudflare/circl v1.6.3/go.mod h1:2eXP6Qfat4O/Yhh8BznvKnJ+uzEoTQ6jVKJRn81BiS4=
|
||||
github.com/cockroachdb/datadriven v1.0.3-0.20230413201302-be42291fc80f h1:otljaYPt5hWxV3MUfO5dFPFiOXg9CyG5/kCfayTqsJ4=
|
||||
github.com/cockroachdb/datadriven v1.0.3-0.20230413201302-be42291fc80f/go.mod h1:a9RdTaap04u637JoCzcUoIcDmvwSUtcUFtT/C3kJlTU=
|
||||
github.com/cockroachdb/errors v1.12.0 h1:d7oCs6vuIMUQRVbi6jWWWEJZahLCfJpnJSVobd1/sUo=
|
||||
github.com/cockroachdb/errors v1.12.0/go.mod h1:SvzfYNNBshAVbZ8wzNc/UPK3w1vf0dKDUP41ucAIf7g=
|
||||
github.com/cockroachdb/errors v1.13.0 h1:BoCcJeiP9hpBJDETkX19qi8Tb8So37srSsp3stTaDMQ=
|
||||
github.com/cockroachdb/errors v1.13.0/go.mod h1:bjxt/4E5+OyuAnacpTIU9rn2mzPu1VlthvHP+xpROq0=
|
||||
github.com/cockroachdb/fifo v0.0.0-20240816210425-c5d0cb0b6fc0 h1:pU88SPhIFid6/k0egdR5V6eALQYq2qbSmukrkgIh/0A=
|
||||
github.com/cockroachdb/fifo v0.0.0-20240816210425-c5d0cb0b6fc0/go.mod h1:9/y3cnZ5GKakj/H4y9r9GTjCvAFta7KLgSHPJJYc52M=
|
||||
github.com/cockroachdb/logtags v0.0.0-20241215232642-bb51bb14a506 h1:ASDL+UJcILMqgNeV5jiqR4j+sTuvQNHdf2chuKj1M5k=
|
||||
@@ -115,8 +121,6 @@ github.com/cockroachdb/redact v1.1.8 h1:8eVLLj6juKxiKrAEw2b8cJvNqWq++U8WOfQFuL7K
|
||||
github.com/cockroachdb/redact v1.1.8/go.mod h1:GceHHpJ0rMDpYARL5In88Alq/xMBUtVlz7Qxix6ZVkw=
|
||||
github.com/cockroachdb/tokenbucket v0.0.0-20250429170803-42689b6311bb h1:3bCgBvB8PbJVMX1ouCcSIxvsqKPYM7gs72o0zC76n9g=
|
||||
github.com/cockroachdb/tokenbucket v0.0.0-20250429170803-42689b6311bb/go.mod h1:7nc4anLGjupUW/PeY5qiNYsdNXj7zopG+eqsS7To5IQ=
|
||||
github.com/colega/zeropool v0.0.0-20230505084239-6fb4a4f75381 h1:d5EKgQfRQvO97jnISfR89AiCCCJMwMFoSxUiU0OGCRU=
|
||||
github.com/colega/zeropool v0.0.0-20230505084239-6fb4a4f75381/go.mod h1:OU76gHeRo8xrzGJU3F3I1CqX1ekM8dfJw0+wPeMwnp0=
|
||||
github.com/consensys/gnark-crypto v0.20.1 h1:PXDUBvk8AzhvWowHLWBEAfUQcV1/aZgWIqD6eMpXmDg=
|
||||
github.com/consensys/gnark-crypto v0.20.1/go.mod h1:RBWrSgy+IDbGR69RRV313th3M/aZU1ubk2om+qHuTSc=
|
||||
github.com/cosmos/go-bip39 v1.0.0 h1:pcomnQdrdH22njcAatO0yWojsUnCO3y2tNoV1cb6hHY=
|
||||
@@ -171,8 +175,8 @@ github.com/fsnotify/fsnotify v1.9.0 h1:2Ml+OJNzbYCTzsxtv8vKSFD9PbJjmhYF14k/jKC7S
|
||||
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/getsentry/sentry-go v0.44.1 h1:/cPtrA5qB7uMRrhgSn9TYtcEF36auGP3Y6+ThvD/yaI=
|
||||
github.com/getsentry/sentry-go v0.44.1/go.mod h1:XDotiNZbgf5U8bPDUAfvcFmOnMQQceESxyKaObSssW0=
|
||||
github.com/getsentry/sentry-go v0.46.2 h1:1jhYwrKGa3sIpo/y5iDNXS5wDoT7I1KNzMHrnK6ojns=
|
||||
github.com/getsentry/sentry-go v0.46.2/go.mod h1:evVbw2qotNUdYG8KxXbAdjOQWWvWIwKxpjdZZIvcIPw=
|
||||
github.com/gkampitakis/ciinfo v0.3.2 h1:JcuOPk8ZU7nZQjdUhctuhQofk7BGHuIy0c9Ez8BNhXs=
|
||||
github.com/gkampitakis/ciinfo v0.3.2/go.mod h1:1NIwaOcFChN4fa/B0hEBdAb6npDlFL8Bwx4dfRLRqAo=
|
||||
github.com/gkampitakis/go-diff v1.3.2 h1:Qyn0J9XJSDTgnsgHRdz9Zp24RaJeKMUHg2+PDZZdC4M=
|
||||
@@ -284,8 +288,8 @@ github.com/jrick/logrotate v1.0.0/go.mod h1:LNinyqDIJnpAur+b8yyulnQw/wDuN1+BYKlT
|
||||
github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8=
|
||||
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
|
||||
github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23/go.mod h1:J+Gs4SYgM6CZQHDETBtE9HaSEkGmuNXF86RwHhHUvq4=
|
||||
github.com/klauspost/compress v1.18.6 h1:2jupLlAwFm95+YDR+NwD2MEfFO9d4z4Prjl1XXDjuao=
|
||||
github.com/klauspost/compress v1.18.6/go.mod h1:cwPg85FWrGar70rWktvGQj8/hthj3wpl0PGDogxkrSQ=
|
||||
github.com/klauspost/compress v1.19.1 h1:VsB4HPswih7mmZ8WleSFQ75c/Ui1M4trX5oAsJnhSlk=
|
||||
github.com/klauspost/compress v1.19.1/go.mod h1:cwPg85FWrGar70rWktvGQj8/hthj3wpl0PGDogxkrSQ=
|
||||
github.com/klauspost/cpuid/v2 v2.0.1/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg=
|
||||
github.com/klauspost/cpuid/v2 v2.3.0 h1:S4CRMLnYUhGeDFDqkGriYKdfoFlDnMtqTiI/sFzhA9Y=
|
||||
github.com/klauspost/cpuid/v2 v2.3.0/go.mod h1:hqwkgyIinND0mEev00jJYCxPNVRVXFQeu1XKlok6oO0=
|
||||
@@ -301,192 +305,152 @@ github.com/leanovate/gopter v0.2.11 h1:vRjThO1EKPb/1NsDXuDrzldR28RLkBflWYcU9CvzW
|
||||
github.com/leanovate/gopter v0.2.11/go.mod h1:aK3tzZP/C+p1m3SPRE4SYZFGP7jjkuSI4f7Xvpt0S9c=
|
||||
github.com/luxfi/accel v1.2.4 h1:5VbIHyEvvfobn2zBiTFODxDw1CeqxCepZOLlvkuf9yQ=
|
||||
github.com/luxfi/accel v1.2.4/go.mod h1:ISIwAX+ZfsL/S5nsP2JvfldXN6Nc+QzoWf6Jtaq+xsQ=
|
||||
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:zC/Fw/ptZwAXr9nqrxmrcf8752EIl1Lq9RECp9OmCO0=
|
||||
github.com/luxfi/age v1.5.0/go.mod h1:iAYAxgvrXxcy746+Ovh/eWWDuF9teJLNcCSSOX9RYW0=
|
||||
github.com/luxfi/api v1.0.15 h1:Q5ox3Ompw/AZNMfB9wpHZosrj9C+ZldAEHKtHEotFdY=
|
||||
github.com/luxfi/api v1.0.15/go.mod h1:Eer59msIXMnOlFncG0XjEGH3TZML0Dd1bUu4GtB7f4Q=
|
||||
github.com/luxfi/address v1.1.1 h1:4afWzyBWzTiZN7RenBtdMC9LIvP9L4CSBzSquwKEAgI=
|
||||
github.com/luxfi/address v1.1.1/go.mod h1:KG0jUBcgoJYeieKP5jboCq9UewwDBIOus8ZCqUMVlw8=
|
||||
github.com/luxfi/age v1.6.0 h1:KMD8gSOP4NVCb7NWSlRcgBZNV2xm2a+qQWPyPmiX6f4=
|
||||
github.com/luxfi/age v1.6.0/go.mod h1:7cu9CIyikgyAvr5MlXFapEDQ15yBaHOSdKkK5lG04WE=
|
||||
github.com/luxfi/api v1.1.1 h1:CXD7m0quPmUm+Qw35TrF+E7b0Fq4qz9gHfrZ5gyrjHU=
|
||||
github.com/luxfi/api v1.1.1/go.mod h1:g6J0iohVqaIj2aO1u/ZJPqjiX2tog0NM3/SBf7wJ4cA=
|
||||
github.com/luxfi/atomic v1.0.0 h1:xUV60MuzRvXngaQ1sM0yVC2v4TRoLlUGkkH7M9PS4yw=
|
||||
github.com/luxfi/atomic v1.0.0/go.mod h1:0G2mTlQ6TXWHICUHrUUPu1/qAiIyR4gSZ2tva9ci/bI=
|
||||
github.com/luxfi/bft v0.1.5 h1:5xVLPkog4e5LTgaVlb9pgxA0EWE6tkrKwHPZVRz+RZw=
|
||||
github.com/luxfi/bft v0.1.5/go.mod h1:5I8Ft8yA69xZlDe3RB0i4MgbqFKLZe65o/sha8JuKvU=
|
||||
github.com/luxfi/cache v1.2.1 h1:kAzOS55/hmYeNKR+0HAKv4ma48Y6JjkI8UQeqdZ8bfI=
|
||||
github.com/luxfi/cache v1.2.1/go.mod h1:co7JTxZZHpKT31Yh01LFp5aZOxmoUg157FhBLQdQHVU=
|
||||
github.com/luxfi/chains v1.4.8 h1:i5QxDfGR922oPGYrBbUo2Qn3tFMpJD9BilNTLFaQscE=
|
||||
github.com/luxfi/chains v1.4.8/go.mod h1:F/jT9YbC8/yD4WxJu4AvRFbi4NyKY+FHBWrE8M08dgE=
|
||||
github.com/luxfi/chains v1.7.0 h1:rAPWEChbMNbK4NYkvHGN6HOK6H+U4XrydsekvxLJTfo=
|
||||
github.com/luxfi/chains v1.7.0/go.mod h1:zDd+CsyZAkrbbEXuMUzrLpuSBRDb2yautoyOjQMhJR8=
|
||||
github.com/luxfi/chains v1.7.1 h1:ljd7WEngYJGoTO88fXbPRJdpid/AU9X7s0RC6O4SbgE=
|
||||
github.com/luxfi/chains v1.7.1/go.mod h1:hEJOkAW7vbgDcyZwL1ZenDj3K6k2b8/p9GS/4uNYAVg=
|
||||
github.com/luxfi/chains v1.7.2 h1:ttpePo7cJ0R2ptA0WvQkumXulvZMW7GFzcAasyurDBQ=
|
||||
github.com/luxfi/chains v1.7.2/go.mod h1:5YzO/dMsTKHePn7Vu1Bf+MT2hbx3drscjvm6QssUvjg=
|
||||
github.com/luxfi/codec v1.1.5 h1:KBq8uvYm5Dy+E1heG8WBmqbqu8kstlFyE5ASBBB+C8I=
|
||||
github.com/luxfi/codec v1.1.5/go.mod h1:/ugIv5iEgI+VAuPIetzxNT0eJaEjOID/mrIsgIjJh8g=
|
||||
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.35.5 h1:q6RkE8nOmmWgOS7ePnnLR5wOOlzNMZatr+9drHfOa/I=
|
||||
github.com/luxfi/consensus v1.35.5/go.mod h1:2ON+tN8hsAqd13DmsGk1Epfz6EQ0s4lv/rmOUsh7Gpk=
|
||||
github.com/luxfi/consensus v1.35.6 h1:G4KEzlElk6V7Gtc8kK/eKyYqOBDb6jzhQpMSZuBSYl8=
|
||||
github.com/luxfi/consensus v1.35.6/go.mod h1:2ON+tN8hsAqd13DmsGk1Epfz6EQ0s4lv/rmOUsh7Gpk=
|
||||
github.com/luxfi/consensus v1.35.7 h1:vB5Pk6uNrniwE6T5xBYFHG3w8UR9dmHaTW4THtcBEt4=
|
||||
github.com/luxfi/consensus v1.35.7/go.mod h1:2ON+tN8hsAqd13DmsGk1Epfz6EQ0s4lv/rmOUsh7Gpk=
|
||||
github.com/luxfi/consensus v1.35.8 h1:kYLfs8TjHbJ+YluhKJxZridnrTAqzUskV75IvDdvrlI=
|
||||
github.com/luxfi/consensus v1.35.8/go.mod h1:2ON+tN8hsAqd13DmsGk1Epfz6EQ0s4lv/rmOUsh7Gpk=
|
||||
github.com/luxfi/consensus v1.35.11 h1:a1mf9XbdthjIO00tsl/hXnISiD6e2851s3DdsTXjXqs=
|
||||
github.com/luxfi/consensus v1.35.11/go.mod h1:2ON+tN8hsAqd13DmsGk1Epfz6EQ0s4lv/rmOUsh7Gpk=
|
||||
github.com/luxfi/consensus v1.35.13 h1:o3Zm9qaCCs1vhvZ75TSLnsLEaqxH72meyAOTqbjURxw=
|
||||
github.com/luxfi/consensus v1.35.13/go.mod h1:2ON+tN8hsAqd13DmsGk1Epfz6EQ0s4lv/rmOUsh7Gpk=
|
||||
github.com/luxfi/consensus v1.35.14 h1:HvaQLanNlC1bUwk6xun32pwz/qZ0Ia44lO36DFrrdS0=
|
||||
github.com/luxfi/consensus v1.35.14/go.mod h1:2ON+tN8hsAqd13DmsGk1Epfz6EQ0s4lv/rmOUsh7Gpk=
|
||||
github.com/luxfi/consensus v1.35.15 h1:iy10lEjMHhul6f4ioSZ05XbHOOU8pilteuvZu7jMefs=
|
||||
github.com/luxfi/consensus v1.35.15/go.mod h1:2ON+tN8hsAqd13DmsGk1Epfz6EQ0s4lv/rmOUsh7Gpk=
|
||||
github.com/luxfi/consensus v1.35.16 h1:5hRLqVy9RQH7ZRApO6kiLwLs+9HACGNNZ4wkjt0XM4I=
|
||||
github.com/luxfi/consensus v1.35.16/go.mod h1:2ON+tN8hsAqd13DmsGk1Epfz6EQ0s4lv/rmOUsh7Gpk=
|
||||
github.com/luxfi/consensus v1.35.17 h1:LfR1sVVcA2/DVSjy/5K7zhm+h2vZ/4Kf38JKdunMfLA=
|
||||
github.com/luxfi/consensus v1.35.17/go.mod h1:2ON+tN8hsAqd13DmsGk1Epfz6EQ0s4lv/rmOUsh7Gpk=
|
||||
github.com/luxfi/consensus v1.35.20 h1:58N8K4BiOTeaFuwVQCgAFJxvrWdIMOIDG7j+RoFdWMM=
|
||||
github.com/luxfi/consensus v1.35.20/go.mod h1:hmsGz3CcTrKxvw7/YSmfu8qAtzgyL5zQ3ajpUNcub/4=
|
||||
github.com/luxfi/consensus v1.35.21 h1:xNN2NbsGEIxJ9ZMNvr70TqXop9bqRvvDWSpPhvRWXm4=
|
||||
github.com/luxfi/consensus v1.35.21/go.mod h1:hmsGz3CcTrKxvw7/YSmfu8qAtzgyL5zQ3ajpUNcub/4=
|
||||
github.com/luxfi/consensus v1.35.22 h1:/9Cnbl8LEGEJ1VLu7IDgMoU8mNtbuFkNOEiBHYsvWbk=
|
||||
github.com/luxfi/consensus v1.35.22/go.mod h1:hmsGz3CcTrKxvw7/YSmfu8qAtzgyL5zQ3ajpUNcub/4=
|
||||
github.com/luxfi/consensus v1.35.25 h1:scQ+oSEQ5Rvv+7kImnFNDHjRGGPlMVVrSc8s3Rsa/eg=
|
||||
github.com/luxfi/consensus v1.35.25/go.mod h1:hmsGz3CcTrKxvw7/YSmfu8qAtzgyL5zQ3ajpUNcub/4=
|
||||
github.com/luxfi/consensus v1.35.26 h1:d51M+XDE2nYS+d3dmDDQK/2OROg8UMHvquISguB3w7Y=
|
||||
github.com/luxfi/consensus v1.35.26/go.mod h1:hmsGz3CcTrKxvw7/YSmfu8qAtzgyL5zQ3ajpUNcub/4=
|
||||
github.com/luxfi/consensus v1.35.27 h1:/LotkK3TBFRaspoGwbeLagIVu4/kJsqx9VviU5+fXrE=
|
||||
github.com/luxfi/consensus v1.35.27/go.mod h1:hmsGz3CcTrKxvw7/YSmfu8qAtzgyL5zQ3ajpUNcub/4=
|
||||
github.com/luxfi/constants v1.5.8 h1:iNP9AWNUcM4Tps7jYnx49CwtCWAC9mYRxJfGou2za0g=
|
||||
github.com/luxfi/constants v1.5.8/go.mod h1:Pu5jWHdnUtQRbWC43yTUjU/pbIIKMDOd2a2yroSfo48=
|
||||
github.com/luxfi/constants v1.6.1 h1:4AfBh1YxDgnQjWPLqLpjiBaLAjPBw5naTTzRWWM19ms=
|
||||
github.com/luxfi/constants v1.6.1/go.mod h1:Pu5jWHdnUtQRbWC43yTUjU/pbIIKMDOd2a2yroSfo48=
|
||||
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.10.3 h1:Yi1oAkW0HEsf5fvst/tUN0AjRVg6DoNHB/IC0qrFWZE=
|
||||
github.com/luxfi/corona v0.10.3/go.mod h1:xe5qRir0p+FA6eETpyGDv4LjYySg1zVB13kmHpy9x94=
|
||||
github.com/luxfi/crypto v1.19.26 h1:+aHn/L479ak2ih7s/DkBZojjuhcyHBLqu3nYT81vcrU=
|
||||
github.com/luxfi/crypto v1.19.26/go.mod h1:0DCU62kX8+zhYU2qeM07A4pifJyPkPujnUOfgc8TOFQ=
|
||||
github.com/luxfi/cache v1.3.1 h1:grQhi/B5GKypG7avDMeY143QTgFbfEvQICKNIh1Cw6U=
|
||||
github.com/luxfi/cache v1.3.1/go.mod h1:2MokdbeNUy/9O3mdREWkE6BiN7tRvePkXiKkcb+4M7g=
|
||||
github.com/luxfi/chains v1.7.9 h1:sDF/WQn56o/4i1/uCS8i5ENDMuyWi8+iVcnYGAstMDM=
|
||||
github.com/luxfi/chains v1.7.9/go.mod h1:Qtx9JNLOWYyhnvq434YSjPINT6we9nfViUIIuGD/2bc=
|
||||
github.com/luxfi/codec v1.2.1 h1:NA/O3dWm9QejQPdjLEIVx42ddVqAXsy6Y6igL/V1+aU=
|
||||
github.com/luxfi/codec v1.2.1/go.mod h1:xjWOTEbw9gxY/N8nZwQPvRCfPnK/ugJHBWsb3BZ0HHs=
|
||||
github.com/luxfi/compress v0.1.1 h1:cQjRYQFRrw8HinjW1T8FmKgqdRwrFYDCdecc1t0i+uQ=
|
||||
github.com/luxfi/compress v0.1.1/go.mod h1:d4CkRRmwPzafIp57Jxra3RmAmNwNwU8Oc0QBBRlTqGo=
|
||||
github.com/luxfi/concurrent v0.1.1 h1:LkAmNXybOsAm97nFILqMDBp/YLgleuLmyGomFT7YNxU=
|
||||
github.com/luxfi/concurrent v0.1.1/go.mod h1:GlkfiJtPBpatNxvROf7hkPi4gsnmdHGmqhDnVWFrkZE=
|
||||
github.com/luxfi/consensus v1.36.10 h1:LJPvHc2zL7VFhbqfYu11rA50yvxzTK17Z4mRN04HQhU=
|
||||
github.com/luxfi/consensus v1.36.10/go.mod h1:iwlx11D7BRdEaUqyUvueAe2Fit1K1k26avBK2eLYdnc=
|
||||
github.com/luxfi/consensus v1.36.12 h1:MJKq6j9+04Y2NC+NArGQgv5QNcjprYCk+gppCz1PdSg=
|
||||
github.com/luxfi/consensus v1.36.12/go.mod h1:mCtA6k31FVW/H6rsYQ7V8VvS198WsFS8oFo/z3IMI+A=
|
||||
github.com/luxfi/constants v1.6.2 h1:pXHdKIFbfE9qX4xOjq2LxYvagNhhNvspUVEbPcIEKfA=
|
||||
github.com/luxfi/constants v1.6.2/go.mod h1:r0oH8C/+r/XFYBq1AJxt6zWRKKRKgDzrEMop/CCs9rI=
|
||||
github.com/luxfi/container v0.2.1 h1:MTnfKXzS5+oxV5jKZerdOxSA6iMPaQI9/FWGufizzaw=
|
||||
github.com/luxfi/container v0.2.1/go.mod h1:B+uM0wP0lGvt/SSK7QOEn/qBcsHzILVHlKikdCyzSgM=
|
||||
github.com/luxfi/corona v0.10.4 h1:/+Uy5iOWBMkr+XACnRRiyrbb5ebsZLsUXjHfJW3sFyw=
|
||||
github.com/luxfi/corona v0.10.4/go.mod h1:44Tjnm2uRG22kmmLfCzR8QEO8OXZ3jR/OnUKLsnjVJ8=
|
||||
github.com/luxfi/crypto v1.20.2 h1:L81WEsU/hs2A76F5PWBusG0yU74QqkDdUqqgexWUxh4=
|
||||
github.com/luxfi/crypto v1.20.2/go.mod h1:qYHOM0lO4PRh7LEaObxFQUIMjmT1/paVm/WgZkobT1k=
|
||||
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.20.4 h1:WOt2GIGJxf8AFpg49odMz8DZ8RFSLDrozGhZtmorN70=
|
||||
github.com/luxfi/database v1.20.4/go.mod h1:S/LvmfzNYWVNslcEcZwDrntqUO2ksaL8ql1nRmLUA/Q=
|
||||
github.com/luxfi/database v1.21.1 h1:GNnoWVa82l+n2dK7x2aG8LR2NEToq6ZCRX0sQjmK0OM=
|
||||
github.com/luxfi/database v1.21.1/go.mod h1:Gc7Z2OPrrcYLnAL8B1trOnguXauOlSDV5tkviLN6Xec=
|
||||
github.com/luxfi/dkg v0.3.5 h1:s2L2mMQaz+n9m0b0ghvoV5VZNxiwb2z4WrGugvK0udY=
|
||||
github.com/luxfi/dkg v0.3.5/go.mod h1:M+WH7GFRN+YUD851Rlnumdp0Md98kplNN8pVx65U8I8=
|
||||
github.com/luxfi/evm v1.99.51 h1:Ai/++j0hK95YOrBGH/4ZWznO5C6yL9aRqwnaZ83BrbQ=
|
||||
github.com/luxfi/evm v1.99.51/go.mod h1:WTIEne/um59AU9m37Hm2aj8mfd8UfOpB8zFQmr6utZ0=
|
||||
github.com/luxfi/filesystem v0.0.1 h1:VZ6xMFKaAPBW/ddlMsDnI2G0VU1lV5rYaVcW5d+KwEY=
|
||||
github.com/luxfi/filesystem v0.0.1/go.mod h1:OQVSU6XNwqrr1AI+MqkID2taHUclx7NYmmr3svgttec=
|
||||
github.com/luxfi/formatting v1.0.1 h1:ZnE1rAdEUds9yAegdVdGDOBGN6hLMPOv6E03Fp8IEYo=
|
||||
github.com/luxfi/formatting v1.0.1/go.mod h1:mYzNf5DJOiqSSKUPzNj5dKy4tstFbN3pZlkI5716eKc=
|
||||
github.com/luxfi/genesis v1.13.16 h1:suwWPwUu2nv1fxvx9vwHgcgJCzkCpiVMxBrJIh4S3BQ=
|
||||
github.com/luxfi/genesis v1.13.16/go.mod h1:qUa+AcTWwxv0x+CJochBsRNOMbmEBjw07HJKZLhs5c0=
|
||||
github.com/luxfi/genesis v1.16.1 h1:t8zFIeFg9hwl39HpYKshpB2hlHjVVBpd8va4d+FZ8T0=
|
||||
github.com/luxfi/genesis v1.16.1/go.mod h1:vpnyQ/YcGINhUekrCiZWFryvP3qgYzTgFkfWoExlUdE=
|
||||
github.com/luxfi/formatting v1.1.1 h1:MJhVXIPh1dbysvYEjtaEA/Z0FUTiI7n0DwOF54FS08c=
|
||||
github.com/luxfi/formatting v1.1.1/go.mod h1:zhBWp6fLZduhpiAdPgVDdPVOyhw4FvwRUksF6+xKQCE=
|
||||
github.com/luxfi/genesis v1.16.4 h1:8ZtqvgPnICgGpjBzAjYAPrI3qwr1g1DPbum+hgjc4bg=
|
||||
github.com/luxfi/genesis v1.16.4/go.mod h1:0F6hV6GfwDSmIWsueB7/vqPZFxyS7A4Jo3p1QU87fFc=
|
||||
github.com/luxfi/genesis/pkg/genesis/security v1.13.8 h1:9ier0p55ErSpoXHRJpZ04WV5HwwMB1uDrU7PHGBKG2U=
|
||||
github.com/luxfi/genesis/pkg/genesis/security v1.13.8/go.mod h1:DzU+GYUFv12ja4Vc46bWKNBBmNYbcow3u/DASx4wpfI=
|
||||
github.com/luxfi/geth v1.17.12 h1:UP/fhpcfbGPTrkOCwX3d88Oc3jVm5gTOgfjgq+lek6s=
|
||||
github.com/luxfi/geth v1.17.12/go.mod h1:3vQfQJd9JC+AVBjxNXa9PYQOqpbE2dKu8E3jqhPZ3LU=
|
||||
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.3.0 h1:11xnwRDm6zQzbqcRnkFujOYkvhK4Fs/+g+sKRlRUNsU=
|
||||
github.com/luxfi/ids v1.3.0/go.mod h1:6vpdcdZW0qxeade+3xby8aLTutbcJ7O0r8+fNQrksGI=
|
||||
github.com/luxfi/ids v1.3.1 h1:CGE3QvYzdwfDpfODAVNjMygSaueVPWXSB9yaeyCEd+k=
|
||||
github.com/luxfi/ids v1.3.1/go.mod h1:6vpdcdZW0qxeade+3xby8aLTutbcJ7O0r8+fNQrksGI=
|
||||
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.2.0 h1:3TAcr4twyMpwQp7J29ZRtIa5vzAoDrnXnLcPKVHJWmw=
|
||||
github.com/luxfi/keys v1.2.0/go.mod h1:SjsAaxo6sGmSp9OaHXUiVCqsknO8iPspN6jMOoEAMb8=
|
||||
github.com/luxfi/kms v1.11.7 h1:E25z8SCNTGOVvzzg5tj6pwJQ2K3FrE/nuy0KAfF+0zs=
|
||||
github.com/luxfi/kms v1.11.7/go.mod h1:XhLUVqN4RBv6j4Bj3MNgTZmHCnm74jH7RqqK0b9xbzw=
|
||||
github.com/luxfi/geth v1.20.1 h1:QUGQr4AKvADjwMi7t8a0OfoyxShgEcI9pwie1jFYfm0=
|
||||
github.com/luxfi/geth v1.20.1/go.mod h1:GV5bIMEgWviRN+jPXERyVpI16H3iHqPcdIokDoZdrvU=
|
||||
github.com/luxfi/go-bip32 v1.1.0 h1:zjy19WKa1KJnGamRNyOZM3l/MPtV/sax7M4NMPwLHZQ=
|
||||
github.com/luxfi/go-bip32 v1.1.0/go.mod h1:QyDXlzWL3xRiCbMUi4Z3J52Q/SMoCvdRLXXlYvSZor8=
|
||||
github.com/luxfi/go-bip39 v1.2.0 h1:fx3pFuSGawCG4In6pA4OLLStqbgIqD1j8EygFskoHzY=
|
||||
github.com/luxfi/go-bip39 v1.2.0/go.mod h1:if+2OVbG4k4jKIuBt/Rse1KV1kgWQM5j5xFbUtwbNtc=
|
||||
github.com/luxfi/ids v1.3.2 h1:c6Rft5kZB4XqiCtWaGH47bfhaNFm3FGRfhEzI01GVeI=
|
||||
github.com/luxfi/ids v1.3.2/go.mod h1:+5l8cYMbKpORJbQ2r98CYJo9TQATgUdnmzpYFZWMwwc=
|
||||
github.com/luxfi/keychain v1.1.1 h1:dTYEPy6CGVC1sogMci4iJogUvW6VdTmemplQdzRqnAs=
|
||||
github.com/luxfi/keychain v1.1.1/go.mod h1:hAzBcwxGumtoYrM5hfhwdt8wE0p7r2JCd5AxswqfkoY=
|
||||
github.com/luxfi/keys v1.4.1 h1:2Zcoovaz9OLPz7m7VGXfRrGnrlqt0GeUpJclsPBi4EU=
|
||||
github.com/luxfi/keys v1.4.1/go.mod h1:P8EUP5DKrR1SUZBGZjDT3rWcp2P1miUlVh7IBRNBphU=
|
||||
github.com/luxfi/kms v1.12.10 h1:fXgisnBkixFSrqhOFbZVRQkf8cX4q4vS3Gix1qjL3PQ=
|
||||
github.com/luxfi/kms v1.12.10/go.mod h1:CCcWDXIlDT2TwfYAUxedLyzShFRJAlVlp15zQ2L3CrU=
|
||||
github.com/luxfi/lattice/v7 v7.1.4 h1:hQR02M6cHTAV5+joOPi9gb9Gm+z/hKJnhJF4IlciIJs=
|
||||
github.com/luxfi/lattice/v7 v7.1.4/go.mod h1:DmIQFi3mJiehVsR235l1NKYEU0JhU649OX5p7gMEW2c=
|
||||
github.com/luxfi/lens v0.1.4 h1:goGjGDXx2BNdjzXDunL5QT8elK2ZyCcc0z8TAbtWYrg=
|
||||
github.com/luxfi/lens v0.1.4/go.mod h1:mL+G8IK+9L41d78/2FYRgfhEzAjcr5+VEXB8SGuHbus=
|
||||
github.com/luxfi/lens v0.2.1 h1:5Qd0GdjbM+XUVgwDbZ452tKkR7yeE8QnBTHHaH8fJNY=
|
||||
github.com/luxfi/lens v0.2.1/go.mod h1:6FIhC8weEE5RbNMF3SaE+XPSB9cr6FmjypYBoHkz4JQ=
|
||||
github.com/luxfi/light v1.0.0 h1:zTJgp5M0xX8rIwRjYDQgOGhLas3rgXyhkszrTX+ne3s=
|
||||
github.com/luxfi/light v1.0.0/go.mod h1:1G0kgjEe/srlBMCIrFq4IvhnrMuHKFG18CRUWfw1z30=
|
||||
github.com/luxfi/log v1.4.3 h1:xkUKRWvQ4ZwvlUC2e0/RTtHYZOYSMvSQ9W9lbjwBmiI=
|
||||
github.com/luxfi/log v1.4.3/go.mod h1:myIkufyiQomSQH34K981kbz6cG4WUoerRUh7F4XhlQI=
|
||||
github.com/luxfi/magnetar v1.2.3 h1:n4UrJZLK+mhDDZr1HLl2H/KgA6o6v62r5oiC61R7awE=
|
||||
github.com/luxfi/magnetar v1.2.3/go.mod h1:z9PLkqzzYiaFGT/qFBQSnNoHmZrg8y7JlYGiNnHAAdk=
|
||||
github.com/luxfi/math v1.4.1 h1:1t9bCCsEqnl9yIKrShlbs80DBKyYTWdnzkVfBqEeO7Q=
|
||||
github.com/luxfi/math v1.4.1/go.mod h1:QvbRxauQyE1w4lvbcLSe6c8yeJz2Zj1Bq1rayGgs2tA=
|
||||
github.com/luxfi/math v1.5.1 h1:FDOY75e4vn/Xra1ij99xOS/9XdxQGCPP6HONHRkCwfg=
|
||||
github.com/luxfi/math v1.5.1/go.mod h1:3j9R24hVfPhrbvs45YSJP7jAyVNfwx/cj/+lAO8IGro=
|
||||
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.1 h1:g2eRr9AXcziPkkcd24M+Qu9ApEpoKKjfI79QSNqv0rQ=
|
||||
github.com/luxfi/mdns v0.1.1/go.mod h1:dbp5f3h3aE7CGzwbaWzBM9cwdcekhmSrWhQevgYhhNA=
|
||||
github.com/luxfi/metric v1.5.9 h1:UAgXMNZf5oN/XJwwuKorf8iMaCj3nyP6thHPCwkUwY4=
|
||||
github.com/luxfi/metric v1.5.9/go.mod h1:ux+w3RZQCfF1zM8MO0wAWyNj/CsDlPd2mwTGshB9vY0=
|
||||
github.com/luxfi/mlwe v0.2.1 h1:pRwTjNUUtzUxRIlMbUPpeh9DE2/NdqfS17hfdogazp4=
|
||||
github.com/luxfi/mlwe v0.2.1/go.mod h1:DD9EHTeiyh/y0KGGeqL+q9S4n8raeGiGdaG/BQPAvT0=
|
||||
github.com/luxfi/metric v1.8.1 h1:v58GgPFAOLPVxSa/JiNLwqJQNEFHdWbXZV28piMXX4s=
|
||||
github.com/luxfi/metric v1.8.1/go.mod h1:R1OPAIeW4UBW3osK7j2r3/XPmczfNRFTXg4bnlemTuE=
|
||||
github.com/luxfi/mlwe v0.3.0 h1:5mtXLbO2RxaE45r75sj43c6UdpjDKQ5nTQcOGuoRQT8=
|
||||
github.com/luxfi/mlwe v0.3.0/go.mod h1:DD9EHTeiyh/y0KGGeqL+q9S4n8raeGiGdaG/BQPAvT0=
|
||||
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.5 h1:F1lD3NsIioV0wr2V5jWc4TtMyiE/Ffo1LoeblFv3TrI=
|
||||
github.com/luxfi/net v0.0.5/go.mod h1:BEQR1HEVmkjii/F1R6vJrNUVE7wr55b4eMq9Iz5wjUw=
|
||||
github.com/luxfi/p2p v1.21.1 h1:gmz1JMDhzHIL3dQlhwIDvR4OlFuhNVfnWUl/ipYhAIo=
|
||||
github.com/luxfi/p2p v1.21.1/go.mod h1:SsNPR5fPGWWNem9plGWhSmRqyDoysJ3kPAN0zG0g3iw=
|
||||
github.com/luxfi/pq v1.0.3 h1:ksw1dmfTR0dqqNMRS7BjGcprCO2Fhc+3Iiq2/NMuONw=
|
||||
github.com/luxfi/pq v1.0.3/go.mod h1:8bppZcRElfrVt0n3nYCZW3iX1TvhvzNbdjNdK1irgIE=
|
||||
github.com/luxfi/precompile v0.16.0 h1:lMdKapbApcbehtAc0mkRqkHFdTTITRTo3e3ivdI63RY=
|
||||
github.com/luxfi/precompile v0.16.0/go.mod h1:nIO7c4arFTqCl3nR0BoumPn1etYY32EYExJxqwu23VA=
|
||||
github.com/luxfi/precompile v0.19.0 h1:/Rqp17MvIWaDSnQwXMVYYVqbbU2t+DA8eoDx9ZWcTvU=
|
||||
github.com/luxfi/precompile v0.19.0/go.mod h1:AOMGWGFXHtnGVYjel/mP/7Dt60e2u7ef0SswY4j8F+k=
|
||||
github.com/luxfi/proto v1.3.5 h1:AW11rnu5xyvB7beyowoiY9uIffLOF3+eMR/a3EkK2c8=
|
||||
github.com/luxfi/proto v1.3.5/go.mod h1:ixTofGpdW1rTYr+wgTuBhAsgBv8GnWYHMLWbPNEdm7M=
|
||||
github.com/luxfi/pulsar v1.9.0 h1:c0JnatYF79aN87aof9VlYjIoCzmixxrgNPeUUuh8ScU=
|
||||
github.com/luxfi/pulsar v1.9.0/go.mod h1:1+/atAiiiOm9RnXM3c66eHF3garjAa3C+sn4rAU7JUU=
|
||||
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/net v0.1.1 h1:jIQCb8ulBGEvHIcorzDDNCeWzutFzLVtRWodutrQE24=
|
||||
github.com/luxfi/net v0.1.1/go.mod h1:SwxbUQ538u4QAcgC/N61uahDk1TDHL6Ku89CX/WV2lk=
|
||||
github.com/luxfi/p2p v1.22.1 h1:M59Iy+FIJta99aFfTpG6EE70jm9uqIX+iHrGBYPHDhg=
|
||||
github.com/luxfi/p2p v1.22.1/go.mod h1:FHOSavVcq8JS1ZQtfddd9Jj1gaPstz1cjvNgczAQRyg=
|
||||
github.com/luxfi/pq v1.1.0 h1:ADplfUSyirLymSxs3Ix0HeDTyl5oswCNUpXJt/5vLY8=
|
||||
github.com/luxfi/pq v1.1.0/go.mod h1:KT5rG9ztpzIkT9QSnXK4WFqBBLzKCLjY7l1c/unBi8I=
|
||||
github.com/luxfi/precompile v0.19.3 h1:ljJholS+9mlR8EjbfM96BLYvIni7xCt7KkX06YzAIJU=
|
||||
github.com/luxfi/precompile v0.19.3/go.mod h1:c+dh+FWfpKr3FNfI4LhIdnn0naQmmS5Yz0KKTt4LknY=
|
||||
github.com/luxfi/proto v1.4.2 h1:dEGTE7xOWVPTXRZNDBJfwh2Q19vE7MQBhyXXmWenw+8=
|
||||
github.com/luxfi/proto v1.4.2/go.mod h1:vwVkrC9ghhuCL8bluA59+G5jaD6WuqiDyd1iKh7yzOE=
|
||||
github.com/luxfi/protocol v0.0.2 h1:TAuXMm1K4VDpG3B3brq1EE9Lb7XlbhQmVBObskgNhmc=
|
||||
github.com/luxfi/protocol v0.0.2/go.mod h1:Yjn2VRwn5PXim0+JTalAyrVG6YbmuSnYOfeUXSbAsqA=
|
||||
github.com/luxfi/pulsar v1.9.2 h1:pFLoAfBlCwFZfchqHn78J6yMe29AhaoKGRa/KTUP8CE=
|
||||
github.com/luxfi/pulsar v1.9.2/go.mod h1:uTOtribcUvTTwAOy0Ztg0S2AUiNAsVqFfopTrKW+zjM=
|
||||
github.com/luxfi/resource v0.1.1 h1:k11s5xLGX85UWq/iLZyWLhnqeLTlp3FHEt8u/8AHdkY=
|
||||
github.com/luxfi/resource v0.1.1/go.mod h1:s7SbZOSVbgj9bWFOcLCcXgnMlHxbqtqhAeJ3f0Xuy/Y=
|
||||
github.com/luxfi/rpc v1.1.0 h1:B/PJbK399th1mHRDSufhCpVbAciZqId3LsaWhIGNWH4=
|
||||
github.com/luxfi/rpc v1.1.0/go.mod h1:s0bI7/Wg1ZdFdG/cQK+4pZNdEmUsXNBA3HeZRZ+XLeM=
|
||||
github.com/luxfi/runtime v1.1.3 h1:6Yp/PKwQCohjXmBR9GA+gamdSAp+xA2rdN6J/74Y4aw=
|
||||
github.com/luxfi/runtime v1.1.3/go.mod h1:r1uonDnxRCnPz6N6WYwaC72HW95KbFIAyChnJyxePGs=
|
||||
github.com/luxfi/runtime v1.3.1 h1:vsQZ3sl6XMeyHuNGCMM86d0whrE/lhMre4CCJaClPdE=
|
||||
github.com/luxfi/runtime v1.3.1/go.mod h1:Tct998uUcmCQbUC1WLEeGLDH2IaVgMb+SkKcHKZpHV0=
|
||||
github.com/luxfi/sampler v1.1.0 h1:u3iRDl7V06ARh0e85h3HT+aZ1saCFo2yMMsh+dCJbqk=
|
||||
github.com/luxfi/sampler v1.1.0/go.mod h1:kJa53S3tC9+VSbuV3RFu68MmbCCBlr2UM39LOClQ/Hs=
|
||||
github.com/luxfi/sdk v1.17.9 h1:MfExzWNym7IicO2egiHg6N0WnImLtAUpjCpiD/zc2ZE=
|
||||
github.com/luxfi/sdk v1.17.9/go.mod h1:XvZuopyltjR4SvHvA1c6wtNcnO+FzLyjfm0v+FyN9sI=
|
||||
github.com/luxfi/staking v1.5.1 h1:f9MaGnRm0xc02crDm5Qs1T2r88d3KzNkHZypAvsmAlU=
|
||||
github.com/luxfi/staking v1.5.1/go.mod h1:lT7KLaiTpdq3lg78H0gp2qSEfX9LaK1vs7w73XV/9nw=
|
||||
github.com/luxfi/sdk v1.18.1 h1:KnqkL6bNATtQXHbnTMsue5pLz9tn74YFAoux2ek+k90=
|
||||
github.com/luxfi/sdk v1.18.1/go.mod h1:8BE1iF2ewkDbsV31TPE0/HT7RGJILR1ZALbKE1GgHMc=
|
||||
github.com/luxfi/staking v1.6.1 h1:be023mY88AnFgF9P+MMvILX21I2CaqVAVkGcc+a20so=
|
||||
github.com/luxfi/staking v1.6.1/go.mod h1:X8i/uCLc009mlIUnFMErrQMCwfGaOVCAVf+GbDN5nn4=
|
||||
github.com/luxfi/sys v0.1.0 h1:M7RYOt8W4Wws7cxxsyOHe50UKMYTzIu7HYknqW4xt0Y=
|
||||
github.com/luxfi/sys v0.1.0/go.mod h1:GT8vGdYTfoqRy9/11blmRuqPPypzwrudCTHZXT+ru9M=
|
||||
github.com/luxfi/threshold v1.12.0 h1:JJ369xC/YyDvrqXj+xFoK98nP2rUM099qFs03hBvq/M=
|
||||
github.com/luxfi/threshold v1.12.0/go.mod h1:iuRQGDAy8ZKjQhZjkSKg7NtbP75/8Up9zj52y7IuyZo=
|
||||
github.com/luxfi/threshold v1.12.1 h1:pA6ZB8Qv6BStprSemfoCY3fD7P5PEod36Nj6FmJR1jQ=
|
||||
github.com/luxfi/threshold v1.12.1/go.mod h1:iuRQGDAy8ZKjQhZjkSKg7NtbP75/8Up9zj52y7IuyZo=
|
||||
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=
|
||||
github.com/luxfi/tls v1.0.3/go.mod h1:dQqSiGE7YxXUxOwICoReUuIitBms9DYOaCeteBwmIWw=
|
||||
github.com/luxfi/trace v1.1.0 h1:eQoObwStrdQN879zfJWJeN1l0FJnfOKQHQHyEJOYjCI=
|
||||
github.com/luxfi/trace v1.1.0/go.mod h1:Sgtpj8ZE5GBSi4ZyQOL3rL9enl59sSWswWWKw3BUdpk=
|
||||
github.com/luxfi/threshold v1.12.3 h1:CYqcPfzVUs0M/+e/ja1q7aLBZZUi6Rv/XIXR5lrZ7aE=
|
||||
github.com/luxfi/threshold v1.12.3/go.mod h1:xQT8xzmh9pQ1CdBgpl7P3ezXQZcqTPv3tqpIytvuiTA=
|
||||
github.com/luxfi/timer v1.1.1 h1:54GiNBKydQ0VF5/EwVc/mCsbqe0yJNfZV7Ae8qJhCwk=
|
||||
github.com/luxfi/timer v1.1.1/go.mod h1:OXY/8ZFKCdEsimpfnUG1MQWvzjjFbsmBOiW/m6KSrC0=
|
||||
github.com/luxfi/tls v1.1.1 h1:BSZ0gHSp7U8vzlmzx7WSSCz+b7Ky4JtD9HDDhn7vrDg=
|
||||
github.com/luxfi/tls v1.1.1/go.mod h1:+5TDy8UtLL+tz124brZzpUDBRj+sKrq0JFqdmpMUHgw=
|
||||
github.com/luxfi/trace v1.2.1 h1:MPV079P2eTijB7F06AyJU1HJwpQVxRx1qYXhva9YsvM=
|
||||
github.com/luxfi/trace v1.2.1/go.mod h1:/bX8g0RRHPHUq7kX8of/Aaq6C7rD0JuNH57vVbw7ZG8=
|
||||
github.com/luxfi/units v1.0.0 h1:2aNVB+WsP1XeDob71IsO0w3jJqP3FtZdYnFsmORkJZg=
|
||||
github.com/luxfi/units v1.0.0/go.mod h1:tma28v4ed1tupdS0kpSeyO+u1wWK/g1NqODPbN1YzmA=
|
||||
github.com/luxfi/upgrade v1.0.1 h1:7+ygYeUf/MuLeGL7pjIu6ckQimxctCp+Swybhpy64go=
|
||||
github.com/luxfi/upgrade v1.0.1/go.mod h1:Re7g9Y+SYf/LvkHFpN0vbtlVH/Rr5ZpHQdPeVFEo3Jw=
|
||||
github.com/luxfi/utils v1.2.0 h1:gtEiI7/NM6PQ/OasEpH0PvB+e5hIS/tpum9r64pYjMc=
|
||||
github.com/luxfi/utils v1.2.0/go.mod h1:T2OCKT1xG9jtKR/gyJQoSkticzrE9WFQ8eohJHGu9Fg=
|
||||
github.com/luxfi/utxo v0.3.7 h1:JlQ0F0u/QazHcgRK8CRu1mdJOyA+oGAlRMNoAu0/HpU=
|
||||
github.com/luxfi/utxo v0.3.7/go.mod h1:dbJ7RHU8qj5ttobGYK/A2PsZIQpCsHAIay6xKwc8YQ8=
|
||||
github.com/luxfi/validators v1.2.0 h1:VygpiBqBAdGrfkb7xzE2yrVmnXaqE+hm8FLWdGXO7G8=
|
||||
github.com/luxfi/validators v1.2.0/go.mod h1:GYLulrNXAan23ZlX7sgWVbVnLpUexeB/m2qr2ymsXok=
|
||||
github.com/luxfi/upgrade v1.0.3 h1:mFMfIb88HzoL4fp7I6w1g+VnxlAWj6UQdZOdf4AkCLk=
|
||||
github.com/luxfi/upgrade v1.0.3/go.mod h1:3c/u4T/n7EsODofkWg5VigSt9BATQM8EmaNttfHMCrU=
|
||||
github.com/luxfi/utils v1.3.1 h1:Us02ag60kGu94B41XIelExa7c+K6zPKwDJyq+eB+hc0=
|
||||
github.com/luxfi/utils v1.3.1/go.mod h1:ROZrzpt6Kx8ttS1mo12oqsOzRB088GQ1h9jXEoDDpNA=
|
||||
github.com/luxfi/utxo v0.5.8 h1:HydTOKERb8vY0Z39Dvg/V3qg7My3N/eXOY4nLv3iezg=
|
||||
github.com/luxfi/utxo v0.5.8/go.mod h1:kqkwMm99NbWwGZrOzuRzF0vck+lCJwrlejmmCwj5pZc=
|
||||
github.com/luxfi/validators v1.3.1 h1:+/7j0CTXlMKyaSLFM+gd6Fq64/edORJfrD/xGnf7Xcg=
|
||||
github.com/luxfi/validators v1.3.1/go.mod h1:sIQyUZOvXoJ/9/RCOhHSzjumZIoxiqacNOn5mQWVozU=
|
||||
github.com/luxfi/version v1.0.1 h1:T/1KYWEMmsrNQk7pN7PFPAwh/7XbeX7cFAKLBqI37Sk=
|
||||
github.com/luxfi/version v1.0.1/go.mod h1:Y5fPkQ2DB0XRBCxgSPXp4ISzL1/jptKnmFknShRJCyg=
|
||||
github.com/luxfi/vm v1.2.5 h1:L1etY/gh68f9tns1BtyDUpZcBVqc3Ng1mqU3n38GyLo=
|
||||
github.com/luxfi/vm v1.2.5/go.mod h1:TCCg4lDcQFCjxaxfXnxPIrpRSVAyyf2ucT4A4w654Hg=
|
||||
github.com/luxfi/warp v1.24.0 h1:jrcJNlbOiZsAEopJMy9bSaCwI5NDZ8qgp/6sNoXqepg=
|
||||
github.com/luxfi/warp v1.24.0/go.mod h1:bKvTi24JHlANsl7qkWZAVr/DsMfvwy42f+Cc9x4+Sq8=
|
||||
github.com/luxfi/zap v0.8.11 h1:jT+ol9rj557MRdmnzxrVUCR3CDFaE+8OpzUsLIn92og=
|
||||
github.com/luxfi/zap v0.8.11/go.mod h1:JfqII8VtVQYLLTX6obU1DP9sjGqf9L24vfug5ifh0b8=
|
||||
github.com/luxfi/zapcodec v1.0.1 h1:pRxLxCOi6uihQMg8A8riDjNjefU2cXZxfRVZ+obeuL8=
|
||||
github.com/luxfi/zapcodec v1.0.1/go.mod h1:txrRt2JK4O76ssTxlXIwoNVsgzyZVL0ES4mlXqGNogs=
|
||||
github.com/luxfi/vm v1.3.1 h1:U2Bv7IDRFv8JtjUARfY53ZnOPRB2iPrPHSMDCQ+T0Js=
|
||||
github.com/luxfi/vm v1.3.1/go.mod h1:6YR/uFV2FoofmogQShv+HM7V8alz5rbrQYjp5w0bNVA=
|
||||
github.com/luxfi/vm v1.3.3 h1:BEBamD9VUcPG8mtL2Ga0Us1lTQ+ubaZqng/PZjNqzPc=
|
||||
github.com/luxfi/vm v1.3.3/go.mod h1:v2XjW0yymxHwy1xPsSz338s0J8nRqOIb6RiDf0wUEgk=
|
||||
github.com/luxfi/warp v1.24.1 h1:9F+z6fy4sxmXp+3LlR9m3TiZ8Dfthh+s5KOeewSJL30=
|
||||
github.com/luxfi/warp v1.24.1/go.mod h1:kRGQDt6EB3oRLYo71aXqnmJuCBVfND3oQ5/2miaLoyg=
|
||||
github.com/luxfi/zap v1.2.6 h1:NBpbm9Gib41Oi/XAkAZKQ3hb+xCafo7JsrUjw+bKiAc=
|
||||
github.com/luxfi/zap v1.2.6/go.mod h1:sTAe/AMMamoE85cVoe81+NbqHJkgvqS0LhY9ByHEmr0=
|
||||
github.com/luxfi/zapcodec v1.1.1 h1:SdYexj7oWdks/wfF9s+8m/9PAYt3S8QjORxURutvIs0=
|
||||
github.com/luxfi/zapcodec v1.1.1/go.mod h1:fmmgd8C/JrQdh3b1OzBkrvPN4TYs5uRfVV3sVtbiLbQ=
|
||||
github.com/luxfi/zapdb v1.10.1 h1:XV3k4UTTKKxUMgbfC7woPXgUEIJd3P5nj2lGTQ88xeE=
|
||||
github.com/luxfi/zapdb v1.10.1/go.mod h1:3Y0hH2A9kvjR+Bp9N2yEbtHnhXGHhqCQOLvBRkHrrM0=
|
||||
github.com/luxfi/zwing v0.5.2 h1:2+nDKHVIdT8GvaKO79GuO3x/3DgJvX0gI32h4P+P6RU=
|
||||
github.com/luxfi/zwing v0.5.2/go.mod h1:8nixkEL3bhO2LrqVqhJ8WgT+QGUtnCPIQIhFQh9gQio=
|
||||
github.com/luxfi/zwing v0.6.1 h1:Ve7RvYVBXx4JWe8TZhLfpez1N1G685hl/PSMDsR4RI4=
|
||||
github.com/luxfi/zwing v0.6.1/go.mod h1:Eal4hnjmdFXc6rxciA6cxeCfV1BKs8le03v83W5oiKg=
|
||||
github.com/maruel/natural v1.1.1 h1:Hja7XhhmvEFhcByqDoHz9QZbkWey+COd9xWfCfn1ioo=
|
||||
github.com/maruel/natural v1.1.1/go.mod h1:v+Rfd79xlw1AgVBjbO0BEQmptqb5HvL/k9GRHB7ZKEg=
|
||||
github.com/mattn/go-colorable v0.1.15 h1:+u9SLTRGnXv73cEsnsmoZBom+dMU88B2M0aDcWy0/jY=
|
||||
@@ -569,15 +533,15 @@ github.com/prometheus/client_golang v1.23.2 h1:Je96obch5RDVy3FDMndoUsjAhG5Edi49h
|
||||
github.com/prometheus/client_golang v1.23.2/go.mod h1:Tb1a6LWHB3/SPIzCoaDXI4I8UHKeFTEQ1YCr+0Gyqmg=
|
||||
github.com/prometheus/client_model v0.6.2 h1:oBsgwpGs7iVziMvrGhE53c/GrLUsZdHnqNwqPLxwZyk=
|
||||
github.com/prometheus/client_model v0.6.2/go.mod h1:y3m2F6Gdpfy6Ut/GBsUqTWZqCUvMVzSfMLjcu6wAwpE=
|
||||
github.com/prometheus/common v0.67.5 h1:pIgK94WWlQt1WLwAC5j2ynLaBRDiinoAb86HZHTUGI4=
|
||||
github.com/prometheus/common v0.67.5/go.mod h1:SjE/0MzDEEAyrdr5Gqc6G+sXI67maCxzaT3A2+HqjUw=
|
||||
github.com/prometheus/common v0.68.0 h1:8rQJvQmYltsR2L7h8Zw0Iyj8WYNNmpwikoQTZXwfVeA=
|
||||
github.com/prometheus/common v0.68.0/go.mod h1:4soH+U8yJSROk7OJ//hmTiWKsxapv6zRGgTt3keN8gQ=
|
||||
github.com/prometheus/procfs v0.20.1 h1:XwbrGOIplXW/AU3YhIhLODXMJYyC1isLFfYCsTEycfc=
|
||||
github.com/prometheus/procfs v0.20.1/go.mod h1:o9EMBZGRyvDrSPH1RqdxhojkuXstoe4UlK79eF5TGGo=
|
||||
github.com/quic-go/quic-go v0.59.1 h1:0Gmua0HW1Tv7ANR7hUYwRyD0MG5OJfgvYSZasGZzBic=
|
||||
github.com/quic-go/quic-go v0.59.1/go.mod h1:upnsH4Ju1YkqpLXC305eW3yDZ4NfnNbmQRCMWS58IKU=
|
||||
github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs=
|
||||
github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ=
|
||||
github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc=
|
||||
github.com/rogpeppe/go-internal v1.15.0 h1:D0RCU5rMAp+SpgkiNdrjfJ+LX4J1M32V2NeCY7EJ6hc=
|
||||
github.com/rogpeppe/go-internal v1.15.0/go.mod h1:DrUVZyrJU+txYW5/1kwtXQSMFio52ZOxX7yM1VHvnxs=
|
||||
github.com/rs/cors v1.11.1 h1:eU3gRzXLRK57F5rKMGMZURNdIG4EoAmX8k94r9wXWHA=
|
||||
github.com/rs/cors v1.11.1/go.mod h1:XyqrcTp5zjWr1wsJ8PIRZssZ8b/WMcMf71DJnit4EMU=
|
||||
github.com/rs/xid v1.6.0 h1:fV591PaemRlL6JfRxGDEPl69wICngIQ3shQtzfy2gxU=
|
||||
@@ -635,27 +599,33 @@ github.com/tidwall/sjson v1.2.5 h1:kLy8mja+1c9jlljvWTlSazM7cKDRfJuR/bOJhcY5NcY=
|
||||
github.com/tidwall/sjson v1.2.5/go.mod h1:Fvgq9kS/6ociJEDnK0Fk1cpYF4FIW6ZF7LAe+6jwd28=
|
||||
github.com/tinylib/msgp v1.6.4 h1:mOwYbyYDLPj35mkA2BjjYejgJk9BuHxDdvRnb6v2ZcQ=
|
||||
github.com/tinylib/msgp v1.6.4/go.mod h1:RSp0LW9oSxFut3KzESt5Voq4GVWyS+PSulT77roAqEA=
|
||||
github.com/tj/assert v0.0.3 h1:Df/BlaZ20mq6kuai7f5z2TvPFiwC3xaWJSDQNiIS3Rk=
|
||||
github.com/tj/assert v0.0.3/go.mod h1:Ne6X72Q+TB1AteidzQncjw9PabbMp4PBMZ1k+vd1Pvk=
|
||||
github.com/tklauser/go-sysconf v0.4.0 h1:7H0uAN+7RkwWRaxhYXDLqa5V3LPrJeV8wmD9dRUgPQU=
|
||||
github.com/tklauser/go-sysconf v0.4.0/go.mod h1:8mTNWyog7H+MpKijp4VmKJAd2bbYQ2zuUwkYRbUArPI=
|
||||
github.com/tklauser/numcpus v0.12.0 h1:NR85qdvHA9pFse3x3weVZ0r0ST8R6l5RHbZrlRaqob4=
|
||||
github.com/tklauser/numcpus v0.12.0/go.mod h1:ABHeXzJnr/qqwguhClkZKT1/8VABcYrsyUiUGobwWJg=
|
||||
github.com/urfave/cli/v2 v2.27.7 h1:bH59vdhbjLv3LAvIu6gd0usJHgoTTPhCFib8qqOwXYU=
|
||||
github.com/urfave/cli/v2 v2.27.7/go.mod h1:CyNAG/xg+iAOg0N4MPGZqVmv2rCoP267496AOXUZjA4=
|
||||
github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw=
|
||||
github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc=
|
||||
github.com/valyala/fasthttp v1.73.0 h1:ocTOORnBWtJ+P8t/6wAjdkchMzdfHmWx2VD/DPbgZ7s=
|
||||
github.com/valyala/fasthttp v1.73.0/go.mod h1:EtXQDHaR+5P18p8wqDRFpUhxr108Ga9mXvVJXHRrN2k=
|
||||
github.com/wlynxg/anet v0.0.5 h1:J3VJGi1gvo0JwZ/P1/Yc/8p63SoW98B5dHkYDmpgvvU=
|
||||
github.com/wlynxg/anet v0.0.5/go.mod h1:eay5PRQr7fIVAMbTbchTnO9gG65Hg/uYGdc7mguHxoA=
|
||||
github.com/x448/float16 v0.8.4 h1:qLwI1I70+NjRFUR3zs1JPUCgaCXSh3SW62uAKT1mSBM=
|
||||
github.com/x448/float16 v0.8.4/go.mod h1:14CWIYCyZA/cWjXOioeEpHeN/83MdbZDRQHoFcYsOfg=
|
||||
github.com/xrash/smetrics v0.0.0-20250705151800-55b8f293f342 h1:FnBeRrxr7OU4VvAzt5X7s6266i6cSVkkFPS0TuXWbIg=
|
||||
github.com/xrash/smetrics v0.0.0-20250705151800-55b8f293f342/go.mod h1:Ohn+xnUBiLI6FVj/9LpzZWtj1/D6lUovWYBkxHVV3aM=
|
||||
github.com/xyproto/randomstring v1.0.5 h1:YtlWPoRdgMu3NZtP45drfy1GKoojuR7hmRcnhZqKjWU=
|
||||
github.com/xyproto/randomstring v1.0.5/go.mod h1:rgmS5DeNXLivK7YprL0pY+lTuhNQW3iGxZ18UQApw/E=
|
||||
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
|
||||
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
|
||||
github.com/yuin/goldmark v1.4.1/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
|
||||
github.com/yusufpapurcu/wmi v1.2.4 h1:zFUKzehAFReQwLys1b/iSMl+JQGSCSjtVqQn9bBrPo0=
|
||||
github.com/yusufpapurcu/wmi v1.2.4/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0=
|
||||
github.com/zap-proto/http v0.0.0-20260506200741-fd6047874433 h1:7WsCr/pZvWozimdYNffL3B9K6gLr8w0Z7WAi1+eZWtc=
|
||||
github.com/zap-proto/http v0.0.0-20260506200741-fd6047874433/go.mod h1:xySyVTIwjknmVE+p+6rukkX86rFZtXeAu/QY7KXMYqw=
|
||||
github.com/zap-proto/go v1.1.0 h1:DDGhuTBNqkmNax7QV/VvkInJR7hiOcybwUjN3YBt8fg=
|
||||
github.com/zap-proto/go v1.1.0/go.mod h1:914SNGTH6Rv3Yu1MweWJBPEN8FZlo5C39QyhaB0C7Q0=
|
||||
github.com/zap-proto/http v0.3.0 h1:l7DvlngiYqmzNY6fzyRYw2ZIAhF35FqwOe6mvAOqpMg=
|
||||
github.com/zap-proto/http v0.3.0/go.mod h1:UYfGhDDCetgxs65XSev8Lpf65COg5vKQK+cWwZGh4zQ=
|
||||
github.com/zeebo/assert v1.3.0 h1:g7C04CbJuIDKNPFHmsk4hwZDO5O+kntRxzaUoNXj+IQ=
|
||||
github.com/zeebo/assert v1.3.0/go.mod h1:Pq9JiuJQpG8JLJdtkwrJESF0Foym2/D9XMU5ciN/wJ0=
|
||||
github.com/zeebo/blake3 v0.2.4 h1:KYQPkhpRtcqh0ssGYcKLG1JYvddkEA8QwCM/yBqhaZI=
|
||||
@@ -694,16 +664,16 @@ golang.org/x/crypto v0.0.0-20170930174604-9419663f5a44/go.mod h1:6SG95UA2DQfeDnf
|
||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
||||
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
||||
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/crypto v0.54.0 h1:YLIA59K4fiNzHzjnZt2tUJQjQtUWfWbeHBqKtk3eScw=
|
||||
golang.org/x/crypto v0.54.0/go.mod h1:KWL8ny2AZdGR2cWmzeHrp2azQPGogOv+HeQaVEXC2dk=
|
||||
golang.org/x/exp v0.0.0-20260529124908-c761662dc8c9 h1:4d4PbuBNwaxMXkXI8yiIYjydtMU+04RHeuSxJdgKftM=
|
||||
golang.org/x/exp v0.0.0-20260529124908-c761662dc8c9/go.mod h1:d2fgXJLVs4dYDHUk5lwMIfzRzSrWCfGZb0ZqeLa/Vcw=
|
||||
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.36.0 h1:JJjpVx6myfUsUdAzZuOSTTmRE0PfZeNWzzvKrP7amb4=
|
||||
golang.org/x/mod v0.36.0/go.mod h1:moc6ELqsWcOw5Ef3xVprK5ul/MvtVvkIXLziUOICjUQ=
|
||||
golang.org/x/mod v0.37.0 h1:vF1DjpVEshcIqoEaauuHebaLk1O1forxjxBaVn884JQ=
|
||||
golang.org/x/mod v0.37.0/go.mod h1:m8S8VeM9r4dzDwjrKO0a1sZP3YjeMamRRlD+fmR2Q/0=
|
||||
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=
|
||||
@@ -718,15 +688,15 @@ golang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT
|
||||
golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
|
||||
golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk=
|
||||
golang.org/x/net v0.0.0-20220607020251-c690dde0001d/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
|
||||
golang.org/x/net v0.55.0 h1:bcvxaJn3e1U6InsFWt1JUq1aSjnRxLzT2rtD2KfkDF8=
|
||||
golang.org/x/net v0.55.0/go.mod h1:L5U2KuzuOe1lY7Z+aWVIKK6qEeJXnXV9yzGA+WCHJww=
|
||||
golang.org/x/net v0.57.0 h1:K5+3DljvIuDG9/Jv9rvyMywYNFCQ9RSUY6OOTTkT+tE=
|
||||
golang.org/x/net v0.57.0/go.mod h1:KpXc8iv+r3XplLAG/f7Jsf9RPszJzdR0f58q9vGOuEU=
|
||||
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=
|
||||
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.20.0 h1:e0PTpb7pjO8GAtTs2dQ6jYa5BWYlMuX047Dco/pItO4=
|
||||
golang.org/x/sync v0.20.0/go.mod h1:9xrNwdLfx4jkKbNva9FpL6vEN7evnE43NNNJQ2LF3+0=
|
||||
golang.org/x/sync v0.22.0 h1:SZjpbeLmrCk4xhRSZFNZW5gFUeCeFgjekvI/+gfScek=
|
||||
golang.org/x/sync v0.22.0/go.mod h1:9xrNwdLfx4jkKbNva9FpL6vEN7evnE43NNNJQ2LF3+0=
|
||||
golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
@@ -749,8 +719,8 @@ golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBc
|
||||
golang.org/x/sys v0.0.0-20220412211240-33da011f77ad/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.45.0 h1:dO4czNzziLiiXplLQgBCEpCvXQ3dnkn0SdaZSYdQ+FY=
|
||||
golang.org/x/sys v0.45.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw=
|
||||
golang.org/x/sys v0.47.0 h1:o7XGOvZQCADBQQ4Y7VNq2dRWQR7JmOUW8Kxx4ZsNgWs=
|
||||
golang.org/x/sys v0.47.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=
|
||||
@@ -758,8 +728,8 @@ golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
|
||||
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
|
||||
golang.org/x/text v0.37.0 h1:Cqjiwd9eSg8e0QAkyCaQTNHFIIzWtidPahFWR83rTrc=
|
||||
golang.org/x/text v0.37.0/go.mod h1:a5sjxXGs9hsn/AJVwuElvCAo9v8QYLzvavO5z2PiM38=
|
||||
golang.org/x/text v0.40.0 h1:Ub2Z6/xjgF1WrYQz2nuITOEegKFtiIy+rieRJ5lHZKs=
|
||||
golang.org/x/text v0.40.0/go.mod h1:hpnzDAfGV753zIKo+wk3u1bVKCGPbrnF7+7LBF/UHVY=
|
||||
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=
|
||||
@@ -769,8 +739,8 @@ golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roY
|
||||
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.45.0 h1:18qN3FAooORvApf5XjCXgsuayZOEtXf6JK18I3+ONa8=
|
||||
golang.org/x/tools v0.45.0/go.mod h1:LuUGqqaXcXMEFEruIVJVm5mgDD8vww/z/SR1gQ4uE/0=
|
||||
golang.org/x/tools v0.47.0 h1:7Kn5x/d1svx/PzryTsqeoZN4TZwqeH5pGWjefhLi/1Q=
|
||||
golang.org/x/tools v0.47.0/go.mod h1:dFHnyTvFWY212G+h7ZY4Vsp/K3U4/7W9TyVaAul8uCA=
|
||||
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=
|
||||
@@ -778,6 +748,10 @@ golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8T
|
||||
golang.org/x/xerrors v0.0.0-20220517211312-f3a8303e98df/go.mod h1:K8+ghG5WaK9qNqU5K3HdILfMLy1f3aNYFI/wnl100a8=
|
||||
gonum.org/v1/gonum v0.17.0 h1:VbpOemQlsSMrYmn7T2OUvQ4dqxQXU+ouZFQsZOx50z4=
|
||||
gonum.org/v1/gonum v0.17.0/go.mod h1:El3tOrEuMpv2UdMrbNlKEh9vd86bmQ6vqIcDwxEOc1E=
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20260526163538-3dc84a4a5aaa h1:mZHHdPZl0dbGHCflZgAq/Q468DWVFcU2whhB2KAo8fk=
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20260526163538-3dc84a4a5aaa/go.mod h1:4Hqkh8ycfw05ld/3BWL7rJOSfebL2Q+DVDeRgYgxUU8=
|
||||
google.golang.org/grpc v1.81.1 h1:VnnIIZ88UzOOKLukQi+ImGz8O1Wdp8nAGGnvOfEIWQQ=
|
||||
google.golang.org/grpc v1.81.1/go.mod h1:xGH9GfzOyMTGIOXBJmXt+BX/V0kcdQbdcuwQ/zNw42I=
|
||||
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
|
||||
google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=
|
||||
google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM=
|
||||
|
||||
@@ -39,7 +39,7 @@ func main() {
|
||||
platformvmBlockBytes = proposerVMBlock.Block()
|
||||
}
|
||||
|
||||
platformvmBlock, err := platformvmblock.Parse(platformvmblock.Codec, platformvmBlockBytes)
|
||||
platformvmBlock, err := platformvmblock.Parse(platformvmBlockBytes)
|
||||
if err != nil {
|
||||
log.Fatalf("failed to parse platformvm block: %s\n", err)
|
||||
}
|
||||
|
||||
+12
@@ -34,6 +34,11 @@ type Net interface {
|
||||
// IsBootstrapped returns true if the chains in this chain are done bootstrapping
|
||||
IsBootstrapped() bool
|
||||
|
||||
// Bootstrapping returns the IDs of the chains in this net that have NOT yet
|
||||
// finished initial sync. The net owns the bootstrapping set, so it is the
|
||||
// net — not its caller — that can name those chains.
|
||||
Bootstrapping() []ids.ID
|
||||
|
||||
// IsChainBootstrapped reports whether a SPECIFIC chain in this net has finished
|
||||
// initial sync — i.e. Bootstrapped(chainID) was called for it (the chain reached
|
||||
// the network frontier and its VM went to normal operation). This is the per-chain
|
||||
@@ -75,6 +80,13 @@ func (s *chain) IsBootstrapped() bool {
|
||||
return s.bootstrapping.Len() == 0
|
||||
}
|
||||
|
||||
func (s *chain) Bootstrapping() []ids.ID {
|
||||
s.lock.RLock()
|
||||
defer s.lock.RUnlock()
|
||||
|
||||
return s.bootstrapping.List()
|
||||
}
|
||||
|
||||
// IsChainBootstrapped assumes MONOTONIC per-process bootstrapped state: a chain
|
||||
// only ever moves bootstrapping→bootstrapped (Bootstrapped is forward-only and
|
||||
// AddChain refuses to re-add a chain already in either set), so this signal — and
|
||||
|
||||
@@ -68,3 +68,26 @@ func TestIsAllowed(t *testing.T) {
|
||||
require.False(s.IsAllowed(ids.GenerateTestNodeID(), false), "Non-validator should not be allowed with validator only rules and allowed nodes")
|
||||
require.True(s.IsAllowed(allowedNodeID, true), "Non-validator allowed node should be allowed with validator only rules and allowed nodes")
|
||||
}
|
||||
|
||||
// Bootstrapping must name the CHAINS still syncing. The net-level aggregate
|
||||
// IsBootstrapped() only says "something here is unconverged"; only the chain
|
||||
// IDs say what.
|
||||
func TestNetBootstrappingNamesTheChains(t *testing.T) {
|
||||
require := require.New(t)
|
||||
|
||||
chainID0 := ids.GenerateTestID()
|
||||
chainID1 := ids.GenerateTestID()
|
||||
|
||||
s := New(ids.GenerateTestNodeID(), Config{})
|
||||
require.Empty(s.Bootstrapping())
|
||||
|
||||
s.AddChain(chainID0)
|
||||
s.AddChain(chainID1)
|
||||
require.ElementsMatch([]ids.ID{chainID0, chainID1}, s.Bootstrapping())
|
||||
|
||||
s.Bootstrapped(chainID0)
|
||||
require.Equal([]ids.ID{chainID1}, s.Bootstrapping())
|
||||
|
||||
s.Bootstrapped(chainID1)
|
||||
require.Empty(s.Bootstrapping())
|
||||
}
|
||||
|
||||
+8
-6
@@ -340,15 +340,16 @@ func NewNetwork(
|
||||
// AddPermissionlessValidatorTx (modern). Handle both.
|
||||
switch tx := validatorTx.Unsigned.(type) {
|
||||
case *txs.AddPermissionlessValidatorTx:
|
||||
nodeID := tx.Validator.NodeID
|
||||
weight := tx.Validator.Wght
|
||||
validator := tx.Validator()
|
||||
nodeID := validator.NodeID
|
||||
weight := validator.Wght
|
||||
if weight == 0 {
|
||||
weight = 1
|
||||
}
|
||||
|
||||
var blsKey []byte
|
||||
if tx.Signer != nil {
|
||||
if pubKey := tx.Signer.Key(); pubKey != nil {
|
||||
if s := tx.Signer(); s != nil {
|
||||
if pubKey := s.Key(); pubKey != nil {
|
||||
blsKey = bls.PublicKeyToCompressedBytes(pubKey)
|
||||
}
|
||||
}
|
||||
@@ -368,8 +369,9 @@ func NewNetwork(
|
||||
zap.Int("blsKeyLen", len(blsKey)),
|
||||
)
|
||||
case *txs.AddValidatorTx:
|
||||
nodeID := tx.Validator.NodeID
|
||||
weight := tx.Validator.Wght
|
||||
validator := tx.Validator()
|
||||
nodeID := validator.NodeID
|
||||
weight := validator.Wght
|
||||
if weight == 0 {
|
||||
weight = 1
|
||||
}
|
||||
|
||||
+74
-5
@@ -14,9 +14,10 @@ import (
|
||||
"github.com/luxfi/math/set"
|
||||
"github.com/luxfi/node/message"
|
||||
"github.com/luxfi/node/proto/p2p"
|
||||
"github.com/luxfi/node/trace"
|
||||
"github.com/luxfi/node/version"
|
||||
"github.com/luxfi/timer"
|
||||
"github.com/luxfi/node/trace"
|
||||
luxversion "github.com/luxfi/version"
|
||||
)
|
||||
|
||||
// router implements Router interface for routing messages to chain handlers
|
||||
@@ -193,26 +194,94 @@ func (r *chainRouter) AddChain(ctx context.Context, chainID ids.ID, h handler.Ha
|
||||
)
|
||||
}
|
||||
|
||||
// versionedConnector is the capability a chain handler advertises when it can
|
||||
// forward a peer's REAL application version to its VM. The consensus
|
||||
// handler.Handler.Connected signature carries only the nodeID (the version was
|
||||
// dropped at that boundary); a handler that implements this receives the real
|
||||
// version instead. blockHandler implements it. The version must survive to the
|
||||
// inner VM: the C-Chain (coreth) state-sync peer tracker compares peer versions
|
||||
// and dereferences a nil version, panicking a state-syncing node.
|
||||
type versionedConnector interface {
|
||||
ConnectedWithVersion(ctx context.Context, nodeID ids.NodeID, nodeVersion *luxversion.Application) error
|
||||
}
|
||||
|
||||
// toAppVersion converts the node's peer version (github.com/luxfi/node/version)
|
||||
// to the github.com/luxfi/version.Application the VM Connected boundary
|
||||
// (chain.VersionInfo) expects. nil-safe: a nil peer version maps to nil.
|
||||
func toAppVersion(v *version.Application) *luxversion.Application {
|
||||
if v == nil {
|
||||
return nil
|
||||
}
|
||||
return &luxversion.Application{
|
||||
Name: v.Name,
|
||||
Major: v.Major,
|
||||
Minor: v.Minor,
|
||||
Patch: v.Patch,
|
||||
}
|
||||
}
|
||||
|
||||
func (r *chainRouter) Connected(nodeID ids.NodeID, nodeVersion *version.Application, netID ids.ID) {
|
||||
r.lock.Lock()
|
||||
defer r.lock.Unlock()
|
||||
|
||||
r.connectedPeers.Add(nodeID)
|
||||
handlers := make([]handler.Handler, 0, len(r.chains))
|
||||
for _, h := range r.chains {
|
||||
handlers = append(handlers, h)
|
||||
}
|
||||
r.lock.Unlock()
|
||||
|
||||
r.log.Debug("peer connected",
|
||||
log.Stringer("nodeID", nodeID),
|
||||
log.Any("version", nodeVersion),
|
||||
log.Stringer("netID", netID),
|
||||
)
|
||||
|
||||
// Deliver the connection to every chain handler so VMs observe peer
|
||||
// connectivity — the P-chain uptime tracker in particular. Handlers dedup, so
|
||||
// repeated dispatch of the same connection (once per tracked network) is
|
||||
// safe. Dispatch OUTSIDE the router lock: a handler must never re-enter the
|
||||
// router while we hold it.
|
||||
//
|
||||
// Deliver the REAL peer version through the versionedConnector capability so
|
||||
// it reaches the inner VM (proposervm → coreth state-sync). Only handlers
|
||||
// that cannot carry a version fall back to the plain nodeID-only Connected.
|
||||
appVersion := toAppVersion(nodeVersion)
|
||||
for _, h := range handlers {
|
||||
var err error
|
||||
if vc, ok := h.(versionedConnector); ok {
|
||||
err = vc.ConnectedWithVersion(context.Background(), nodeID, appVersion)
|
||||
} else {
|
||||
err = h.Connected(context.Background(), nodeID)
|
||||
}
|
||||
if err != nil {
|
||||
r.log.Debug("chain handler Connected failed",
|
||||
log.Stringer("nodeID", nodeID),
|
||||
log.Err(err),
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (r *chainRouter) Disconnected(nodeID ids.NodeID) {
|
||||
r.lock.Lock()
|
||||
defer r.lock.Unlock()
|
||||
|
||||
r.connectedPeers.Remove(nodeID)
|
||||
handlers := make([]handler.Handler, 0, len(r.chains))
|
||||
for _, h := range r.chains {
|
||||
handlers = append(handlers, h)
|
||||
}
|
||||
r.lock.Unlock()
|
||||
|
||||
r.log.Debug("peer disconnected",
|
||||
log.Stringer("nodeID", nodeID),
|
||||
)
|
||||
|
||||
for _, h := range handlers {
|
||||
if err := h.Disconnected(context.Background(), nodeID); err != nil {
|
||||
r.log.Debug("chain handler Disconnected failed",
|
||||
log.Stringer("nodeID", nodeID),
|
||||
log.Err(err),
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (r *chainRouter) Benched(chainID ids.ID, nodeID ids.NodeID) {
|
||||
|
||||
@@ -0,0 +1,90 @@
|
||||
// Copyright (C) 2019-2025, Lux Industries Inc. All rights reserved.
|
||||
// See the file LICENSE for licensing terms.
|
||||
|
||||
package node
|
||||
|
||||
import (
|
||||
"context"
|
||||
"sync"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/luxfi/consensus/networking/handler"
|
||||
"github.com/luxfi/constants"
|
||||
"github.com/luxfi/ids"
|
||||
"github.com/luxfi/log"
|
||||
"github.com/luxfi/math/set"
|
||||
"github.com/luxfi/node/version"
|
||||
luxversion "github.com/luxfi/version"
|
||||
)
|
||||
|
||||
// fakeVersionedHandler implements handler.Handler AND the versionedConnector
|
||||
// capability, recording which path the router used and the version delivered.
|
||||
type fakeVersionedHandler struct {
|
||||
mu sync.Mutex
|
||||
versionedHit bool
|
||||
plainHit bool
|
||||
gotAppVersion *luxversion.Application
|
||||
}
|
||||
|
||||
func (h *fakeVersionedHandler) HandleInbound(context.Context, handler.Message) error { return nil }
|
||||
func (h *fakeVersionedHandler) HandleOutbound(context.Context, handler.Message) error { return nil }
|
||||
|
||||
func (h *fakeVersionedHandler) Connected(context.Context, ids.NodeID) error {
|
||||
h.mu.Lock()
|
||||
defer h.mu.Unlock()
|
||||
h.plainHit = true
|
||||
return nil
|
||||
}
|
||||
|
||||
func (h *fakeVersionedHandler) Disconnected(context.Context, ids.NodeID) error { return nil }
|
||||
|
||||
func (h *fakeVersionedHandler) ConnectedWithVersion(_ context.Context, _ ids.NodeID, v *luxversion.Application) error {
|
||||
h.mu.Lock()
|
||||
defer h.mu.Unlock()
|
||||
h.versionedHit = true
|
||||
h.gotAppVersion = v
|
||||
return nil
|
||||
}
|
||||
|
||||
// TestChainRouterConnectedDeliversConvertedVersion is the router half of the
|
||||
// RED CRITICAL #1 fix: chainRouter.Connected must deliver the REAL peer version
|
||||
// to a version-capable handler, converting it from the node's peer version type
|
||||
// (github.com/luxfi/node/version) to the VM boundary type
|
||||
// (github.com/luxfi/version, aka chain.VersionInfo). The old code dropped the
|
||||
// version at dispatch (h.Connected(ctx, nodeID)); the fix routes through the
|
||||
// versionedConnector capability so the real, converted version survives.
|
||||
func TestChainRouterConnectedDeliversConvertedVersion(t *testing.T) {
|
||||
require := require.New(t)
|
||||
|
||||
h := &fakeVersionedHandler{}
|
||||
chainID := ids.GenerateTestID()
|
||||
|
||||
r := &chainRouter{
|
||||
log: log.Noop(),
|
||||
chains: map[ids.ID]handler.Handler{chainID: h},
|
||||
connectedPeers: set.NewSet[ids.NodeID](1),
|
||||
}
|
||||
|
||||
nodeID := ids.GenerateTestNodeID()
|
||||
peerVersion := &version.Application{Name: "lux", Major: 1, Minor: 36, Patch: 27}
|
||||
|
||||
r.Connected(nodeID, peerVersion, constants.PrimaryNetworkID)
|
||||
|
||||
h.mu.Lock()
|
||||
defer h.mu.Unlock()
|
||||
require.True(h.versionedHit, "router must use the versioned capability path for a version-capable handler")
|
||||
require.False(h.plainHit, "router must NOT fall back to the nil-version plain Connected")
|
||||
require.NotNil(h.gotAppVersion, "handler must receive a non-nil converted version")
|
||||
require.Equal("lux", h.gotAppVersion.Name)
|
||||
require.Equal(1, h.gotAppVersion.Major)
|
||||
require.Equal(36, h.gotAppVersion.Minor)
|
||||
require.Equal(27, h.gotAppVersion.Patch)
|
||||
}
|
||||
|
||||
// TestToAppVersionNilSafe documents that a nil peer version converts to nil
|
||||
// (never a panic) — the conversion is defensive at the boundary.
|
||||
func TestToAppVersionNilSafe(t *testing.T) {
|
||||
require.Nil(t, toAppVersion(nil))
|
||||
}
|
||||
-265
@@ -1,265 +0,0 @@
|
||||
// Copyright (C) 2019-2025, Lux Industries Inc. All rights reserved.
|
||||
// See the file LICENSE for licensing terms.
|
||||
|
||||
package node
|
||||
|
||||
import (
|
||||
"crypto/tls"
|
||||
"net/netip"
|
||||
"time"
|
||||
|
||||
"github.com/luxfi/crypto/bls"
|
||||
"github.com/luxfi/genesis/pkg/genesis"
|
||||
"github.com/luxfi/ids"
|
||||
"github.com/luxfi/log"
|
||||
"github.com/luxfi/math/set"
|
||||
"github.com/luxfi/node/server/http"
|
||||
"github.com/luxfi/node/benchlist"
|
||||
"github.com/luxfi/node/chains"
|
||||
"github.com/luxfi/node/nets"
|
||||
"github.com/luxfi/node/network"
|
||||
"github.com/luxfi/node/trace"
|
||||
"github.com/luxfi/node/upgrade"
|
||||
"github.com/luxfi/node/vms/platformvm/txs/fee"
|
||||
"github.com/luxfi/timer"
|
||||
"github.com/luxfi/node/utils/profiler"
|
||||
)
|
||||
|
||||
type APIIndexerConfig struct {
|
||||
IndexAPIEnabled bool `json:"indexAPIEnabled"`
|
||||
IndexAllowIncomplete bool `json:"indexAllowIncomplete"`
|
||||
}
|
||||
|
||||
type TargeterConfig struct {
|
||||
// VdrAlloc is the percentage of resource usage that is attributed to validators
|
||||
// The range is [0, 1], defaults to 1 (100%)
|
||||
VdrAlloc float64 `json:"vdrAlloc"`
|
||||
// MaxNonVdrUsage is the maximum amount of resources that non-validators can use
|
||||
// The range is [0, 1], defaults to 0
|
||||
MaxNonVdrUsage float64 `json:"maxNonVdrUsage"`
|
||||
// MaxNonVdrNodeUsage is the maximum amount of resources that a non-validator node can use
|
||||
// The range is [0, 1], defaults to 0
|
||||
MaxNonVdrNodeUsage float64 `json:"maxNonVdrNodeUsage"`
|
||||
}
|
||||
|
||||
type HTTPConfig struct {
|
||||
server.HTTPConfig
|
||||
APIConfig `json:"apiConfig"`
|
||||
HTTPHost string `json:"httpHost"`
|
||||
HTTPPort uint16 `json:"httpPort"`
|
||||
|
||||
HTTPSEnabled bool `json:"httpsEnabled"`
|
||||
HTTPSKey []byte `json:"-"`
|
||||
HTTPSCert []byte `json:"-"`
|
||||
|
||||
HTTPAllowedOrigins []string `json:"httpAllowedOrigins"`
|
||||
HTTPAllowedHosts []string `json:"httpAllowedHosts"`
|
||||
|
||||
ShutdownTimeout time.Duration `json:"shutdownTimeout"`
|
||||
ShutdownWait time.Duration `json:"shutdownWait"`
|
||||
}
|
||||
|
||||
type APIConfig struct {
|
||||
APIIndexerConfig `json:"indexerConfig"`
|
||||
|
||||
// Enable/Disable APIs
|
||||
AdminAPIEnabled bool `json:"adminAPIEnabled"`
|
||||
InfoAPIEnabled bool `json:"infoAPIEnabled"`
|
||||
KeystoreAPIEnabled bool `json:"keystoreAPIEnabled"`
|
||||
MetricsAPIEnabled bool `json:"metricsAPIEnabled"`
|
||||
HealthAPIEnabled bool `json:"healthAPIEnabled"`
|
||||
}
|
||||
|
||||
type IPConfig struct {
|
||||
PublicIP string `json:"publicIP"`
|
||||
PublicIPResolutionService string `json:"publicIPResolutionService"`
|
||||
PublicIPResolutionFreq time.Duration `json:"publicIPResolutionFreq"`
|
||||
// The host portion of the address to listen on. The port to
|
||||
// listen on will be sourced from IPPort.
|
||||
//
|
||||
// - If empty, listen on all interfaces (both ipv4 and ipv6).
|
||||
// - If populated, listen only on the specified address.
|
||||
ListenHost string `json:"listenHost"`
|
||||
ListenPort uint16 `json:"listenPort"`
|
||||
}
|
||||
|
||||
type StakingConfig struct {
|
||||
genesis.StakingConfig
|
||||
SybilProtectionEnabled bool `json:"sybilProtectionEnabled"`
|
||||
PartialSyncPrimaryNetwork bool `json:"partialSyncPrimaryNetwork"`
|
||||
StakingTLSCert tls.Certificate `json:"-"`
|
||||
StakingSigningKey *bls.SecretKey `json:"-"`
|
||||
SybilProtectionDisabledWeight uint64 `json:"sybilProtectionDisabledWeight"`
|
||||
StakingKeyPath string `json:"stakingKeyPath"`
|
||||
StakingCertPath string `json:"stakingCertPath"`
|
||||
StakingSignerPath string `json:"stakingSignerPath"`
|
||||
}
|
||||
|
||||
type StateSyncConfig struct {
|
||||
StateSyncIDs []ids.NodeID `json:"stateSyncIDs"`
|
||||
StateSyncIPs []netip.AddrPort `json:"stateSyncIPs"`
|
||||
}
|
||||
|
||||
type BootstrapConfig struct {
|
||||
// Timeout before emitting a warn log when connecting to bootstrapping beacons
|
||||
BootstrapBeaconConnectionTimeout time.Duration `json:"bootstrapBeaconConnectionTimeout"`
|
||||
|
||||
// Max number of containers in an ancestors message sent by this node.
|
||||
BootstrapAncestorsMaxContainersSent int `json:"bootstrapAncestorsMaxContainersSent"`
|
||||
|
||||
// This node will only consider the first [AncestorsMaxContainersReceived]
|
||||
// containers in an ancestors message it receives.
|
||||
BootstrapAncestorsMaxContainersReceived int `json:"bootstrapAncestorsMaxContainersReceived"`
|
||||
|
||||
// Max time to spend fetching a container and its
|
||||
// ancestors while responding to a GetAncestors message
|
||||
BootstrapMaxTimeGetAncestors time.Duration `json:"bootstrapMaxTimeGetAncestors"`
|
||||
|
||||
Bootstrappers []genesis.Bootstrapper `json:"bootstrappers"`
|
||||
|
||||
// Skip bootstrapping and start processing immediately
|
||||
SkipBootstrap bool `json:"skipBootstrap"`
|
||||
|
||||
// Enable automining in POA mode
|
||||
EnableAutomining bool `json:"enableAutomining"`
|
||||
}
|
||||
|
||||
type DatabaseConfig struct {
|
||||
// If true, all writes are to memory and are discarded at node shutdown.
|
||||
ReadOnly bool `json:"readOnly"`
|
||||
|
||||
// Path to database
|
||||
Path string `json:"path"`
|
||||
|
||||
// Name of the database type to use
|
||||
Name string `json:"name"`
|
||||
|
||||
// Path to config file
|
||||
Config []byte `json:"-"`
|
||||
}
|
||||
|
||||
// Config contains all of the configurations of a Lux node.
|
||||
type Config struct {
|
||||
HTTPConfig `json:"httpConfig"`
|
||||
IPConfig `json:"ipConfig"`
|
||||
StakingConfig `json:"stakingConfig"`
|
||||
fee.StaticConfig `json:"txFeeConfig"`
|
||||
StateSyncConfig `json:"stateSyncConfig"`
|
||||
BootstrapConfig `json:"bootstrapConfig"`
|
||||
DatabaseConfig `json:"databaseConfig"`
|
||||
|
||||
UpgradeConfig upgrade.Config `json:"upgradeConfig"`
|
||||
|
||||
// Genesis information
|
||||
GenesisBytes []byte `json:"-"`
|
||||
UTXOAssetID ids.ID `json:"utxoAssetID"`
|
||||
|
||||
// ID of the network this node should connect to
|
||||
NetworkID uint32 `json:"networkID"`
|
||||
|
||||
// Health
|
||||
HealthCheckFreq time.Duration `json:"healthCheckFreq"`
|
||||
|
||||
// Network configuration
|
||||
NetworkConfig network.Config `json:"networkConfig"`
|
||||
|
||||
AdaptiveTimeoutConfig timer.AdaptiveTimeoutConfig `json:"adaptiveTimeoutConfig"`
|
||||
|
||||
BenchlistConfig benchlist.Config `json:"benchlistConfig"`
|
||||
|
||||
ProfilerConfig profiler.Config `json:"profilerConfig"`
|
||||
|
||||
// LoggingConfig log.Config `json:"loggingConfig"` // log.Config doesn't exist
|
||||
|
||||
PluginDir string `json:"pluginDir"`
|
||||
// DevMode enables local PoA + auto-mine mode (network-id=local, sybil-protection disabled)
|
||||
DevMode bool `json:"devMode"`
|
||||
|
||||
// File Descriptor Limit
|
||||
FdLimit uint64 `json:"fdLimit"`
|
||||
|
||||
// Metrics
|
||||
MeterVMEnabled bool `json:"meterVMEnabled"`
|
||||
// Delay between automatic block proposals when DevMode is set
|
||||
DevBlockDelay time.Duration `json:"devBlockDelay"`
|
||||
|
||||
RouterHealthConfig HealthConfig `json:"routerHealthConfig"`
|
||||
ConsensusShutdownTimeout time.Duration `json:"consensusShutdownTimeout"`
|
||||
// Poll for new frontiers every [FrontierPollFrequency]
|
||||
FrontierPollFrequency time.Duration `json:"consensusGossipFreq"`
|
||||
// ConsensusAppConcurrency defines the maximum number of goroutines to
|
||||
// handle App messages per chain.
|
||||
ConsensusAppConcurrency int `json:"consensusAppConcurrency"`
|
||||
|
||||
TrackedChains set.Set[ids.ID] `json:"trackedChains"`
|
||||
TrackAllChains bool `json:"trackAllChains"`
|
||||
|
||||
NetConfigs map[ids.ID]nets.Config `json:"chainConfigs"`
|
||||
|
||||
ChainConfigs map[string]chains.ChainConfig `json:"-"`
|
||||
ChainAliases map[ids.ID][]string `json:"chainAliases"`
|
||||
|
||||
VMAliases map[ids.ID][]string `json:"vmAliases"`
|
||||
|
||||
// Halflife to use for the processing requests tracker.
|
||||
// Larger halflife --> usage metrics change more slowly.
|
||||
SystemTrackerProcessingHalflife time.Duration `json:"systemTrackerProcessingHalflife"`
|
||||
|
||||
// Frequency to check the real resource usage of tracked processes.
|
||||
// More frequent checks --> usage metrics are more accurate, but more
|
||||
// expensive to track
|
||||
SystemTrackerFrequency time.Duration `json:"systemTrackerFrequency"`
|
||||
|
||||
// Halflife to use for the cpu tracker.
|
||||
// Larger halflife --> cpu usage metrics change more slowly.
|
||||
SystemTrackerCPUHalflife time.Duration `json:"systemTrackerCPUHalflife"`
|
||||
|
||||
// Halflife to use for the disk tracker.
|
||||
// Larger halflife --> disk usage metrics change more slowly.
|
||||
SystemTrackerDiskHalflife time.Duration `json:"systemTrackerDiskHalflife"`
|
||||
|
||||
CPUTargeterConfig TargeterConfig `json:"cpuTargeterConfig"`
|
||||
|
||||
DiskTargeterConfig TargeterConfig `json:"diskTargeterConfig"`
|
||||
|
||||
RequiredAvailableDiskSpace uint64 `json:"requiredAvailableDiskSpace"`
|
||||
WarningThresholdAvailableDiskSpace uint64 `json:"warningThresholdAvailableDiskSpace"`
|
||||
|
||||
TraceConfig trace.Config `json:"traceConfig"`
|
||||
|
||||
// See comment on [UseCurrentHeight] in platformvm.Config
|
||||
UseCurrentHeight bool `json:"useCurrentHeight"`
|
||||
|
||||
// ProvidedFlags contains all the flags set by the user
|
||||
ProvidedFlags map[string]interface{} `json:"-"`
|
||||
|
||||
// ChainDataDir is the root path for per-chain directories where VMs can
|
||||
// write arbitrary data.
|
||||
ChainDataDir string `json:"chainDataDir"`
|
||||
|
||||
// ImportChainData is the path to import blockchain data from another chain
|
||||
ImportChainData string `json:"importChainData"`
|
||||
|
||||
// Path to write process context to (including PID, API URI, and
|
||||
// staking address).
|
||||
ProcessContextFilePath string `json:"processContextFilePath"`
|
||||
|
||||
// POA Mode Configuration
|
||||
POAModeEnabled bool `json:"poaModeEnabled"`
|
||||
POASingleNodeMode bool `json:"poaSingleNodeMode"`
|
||||
POAMinBlockTime time.Duration `json:"poaMinBlockTime"`
|
||||
POAAuthorizedNodes []string `json:"poaAuthorizedNodes"`
|
||||
|
||||
// Low Memory Configuration
|
||||
LowMemoryEnabled bool `json:"lowMemoryEnabled"`
|
||||
DBCacheSize uint64 `json:"dbCacheSize"`
|
||||
DBMemtableSize uint64 `json:"dbMemtableSize"`
|
||||
StateCacheSize uint64 `json:"stateCacheSize"`
|
||||
BlockCacheSize uint64 `json:"blockCacheSize"`
|
||||
DisableBloomFilters bool `json:"disableBloomFilters"`
|
||||
LazyChainLoading bool `json:"lazyChainLoading"`
|
||||
SingleValidatorMode bool `json:"singleValidatorMode"`
|
||||
|
||||
// Logging
|
||||
Log log.Logger `json:"-"`
|
||||
}
|
||||
@@ -1354,6 +1354,10 @@ func (n *Node) initChainManager(utxoAssetID ids.ID) error {
|
||||
SybilProtectionEnabled: n.Config.SybilProtectionEnabled,
|
||||
StakingTLSSigner: n.StakingTLSSigner,
|
||||
StakingTLSCert: n.StakingTLSCert,
|
||||
StakingMLDSASigner: n.Config.StakingConfig.StakingMLDSA,
|
||||
StakingMLDSAPub: n.Config.StakingConfig.StakingMLDSAPub,
|
||||
ProposerWindowDuration: n.Config.ProposerWindowDuration,
|
||||
ProposerMinBlockDelay: n.Config.ProposerMinBlockDelay,
|
||||
StakingBLSKey: n.Config.StakingSigningKey,
|
||||
Log: n.Log,
|
||||
LogFactory: n.LogFactory,
|
||||
|
||||
+24
-12
@@ -114,18 +114,29 @@ var CoreVMs = map[ids.ID]CoreVM{
|
||||
// today's opt-in-flag behavior) while the gate itself remains fail-closed.
|
||||
//
|
||||
// C (evm) and the remaining app VMs are plugin-loaded but ungated today.
|
||||
//
|
||||
// Declaring a VM here is a statement of intent, not a guarantee that a binary
|
||||
// exists: the registry scan simply finds nothing and the chain cannot start.
|
||||
// fhevm (F-Chain) is exactly that case today — see its entry below.
|
||||
var OptionalVMs = map[ids.ID]PluginSpec{
|
||||
constants.DexVMID: {Name: "dexvm", RequiredNFT: &NFTRequirement{Collection: "dex-operator", GroupID: 0}},
|
||||
constants.BridgeVMID: {Name: "bridgevm", RequiredNFT: &NFTRequirement{Collection: "bridge-operator", GroupID: 0}},
|
||||
constants.EVMID: {Name: "evm"},
|
||||
constants.AIVMID: {Name: "aivm"},
|
||||
constants.GraphVMID: {Name: "graphvm"},
|
||||
constants.IdentityVMID: {Name: "identityvm"},
|
||||
constants.KeyVMID: {Name: "keyvm"},
|
||||
constants.OracleVMID: {Name: "oraclevm"},
|
||||
constants.RelayVMID: {Name: "relayvm"},
|
||||
constants.MPCVMID: {Name: "mpcvm"},
|
||||
constants.FHEVMID: {Name: "fhevm"},
|
||||
constants.DexVMID: {Name: "dexvm", RequiredNFT: &NFTRequirement{Collection: "dex-operator", GroupID: 0}},
|
||||
constants.BridgeVMID: {Name: "bridgevm", RequiredNFT: &NFTRequirement{Collection: "bridge-operator", GroupID: 0}},
|
||||
constants.EVMID: {Name: "evm"},
|
||||
constants.AIVMID: {Name: "aivm"},
|
||||
constants.GraphVMID: {Name: "graphvm"},
|
||||
constants.IdentityVMID: {Name: "identityvm"},
|
||||
constants.KeyVMID: {Name: "keyvm"},
|
||||
constants.OracleVMID: {Name: "oraclevm"},
|
||||
constants.RelayVMID: {Name: "relayvm"},
|
||||
constants.MPCVMID: {Name: "mpcvm"},
|
||||
// F-Chain. Reserved ID, no shipping VM: luxfi/chains has no fhevm/
|
||||
// directory, so `make` produces no fhevm binary and this scan always comes
|
||||
// up empty. The FHE runtime library lives at luxfi/chains/mpcvm/fhe as a
|
||||
// package inside mpcvm, not as a standalone chain. F-Chain is a spec
|
||||
// (LP-8200, LP-167). Kept declared so the intent stays visible and the ID
|
||||
// stays reserved — remove it only when F-Chain is cancelled, not merely
|
||||
// because it is unbuilt.
|
||||
constants.FHEVMID: {Name: "fhevm"},
|
||||
}
|
||||
|
||||
func init() {
|
||||
@@ -155,7 +166,8 @@ func assertRegistriesDisjoint() error {
|
||||
// registerCoreVMs registers the in-process core VMs that carry a concrete
|
||||
// factory (Q, Z). P and X are registered separately in node.go because their
|
||||
// factories require live node dependencies (RegisteredInNodeGo=true in
|
||||
// CoreVMs). The optional chain VMs (A/B/C/D/G/I/K/O/R/T) are NEVER registered
|
||||
// CoreVMs). The optional chain VMs (A/B/C/D/F/G/I/K/M/O/R — the keys of
|
||||
// OptionalVMs; there is no T, LP-134 dissolved it) are NEVER registered
|
||||
// here — they load from PluginDir via the VMRegistry scan, exactly like any
|
||||
// other plugin. Registering an optional VM in-process would shadow its plugin
|
||||
// (the registry skips any VMID the manager already has — vms/registry/
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
FROM bufbuild/buf:1.26.1 AS builder
|
||||
|
||||
FROM ubuntu:20.04
|
||||
|
||||
RUN apt-get update && apt -y install bash curl unzip git
|
||||
WORKDIR /opt
|
||||
|
||||
RUN \
|
||||
curl -L https://golang.org/dl/go1.24.5.linux-amd64.tar.gz > golang.tar.gz && \
|
||||
mkdir golang && \
|
||||
tar -zxvf golang.tar.gz -C golang/
|
||||
|
||||
ENV PATH="${PATH}:/opt/golang/go/bin"
|
||||
|
||||
COPY --from=builder /usr/local/bin/buf /usr/local/bin/
|
||||
|
||||
# any version changes here should also be bumped in scripts/protobuf_codegen.sh
|
||||
RUN \
|
||||
go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.30.0 && \
|
||||
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@v1.3.0
|
||||
|
||||
ENV PATH="${PATH}:/root/go/bin/"
|
||||
@@ -1,36 +0,0 @@
|
||||
# Lux gRPC
|
||||
|
||||
Now Serving: **Protocol Version 42**
|
||||
|
||||
Protobuf files are hosted at
|
||||
[https://buf.build/luxfi/lux](https://buf.build/luxfi/lux) and
|
||||
can be used as dependencies in other projects.
|
||||
|
||||
Protobuf linting and generation for this project is managed by
|
||||
[buf](https://github.com/bufbuild/buf).
|
||||
|
||||
Please find installation instructions on
|
||||
[https://docs.buf.build/installation/](https://docs.buf.build/installation/).
|
||||
|
||||
Any changes made to proto definition can be updated by running
|
||||
`protobuf_codegen.sh` located in the `scripts/` directory of Lux Node.
|
||||
|
||||
`buf` Quickstart
|
||||
[https://buf.build/docs/cli/quickstart](https://buf.build/docs/cli/quickstart)
|
||||
|
||||
## Protocol Version Compatibility
|
||||
|
||||
The protobuf definitions and generated code are versioned based on the
|
||||
[RPCChainVMProtocol](../version/version.go#L13) defined for the RPCChainVM.
|
||||
Many versions of a Lux client can use the same
|
||||
[RPCChainVMProtocol](../version/version.go#L13). But each Lux client and
|
||||
chain VM must use the same protocol version to be compatible.
|
||||
|
||||
## Publishing to Buf Schema Registry
|
||||
|
||||
- Checkout appropriate tag in Lux Node `git checkout v1.10.1`
|
||||
- Change to proto/ directory `cd proto`.
|
||||
- Publish new tag to buf registry. `buf push -t v26`
|
||||
|
||||
Note: Publishing requires auth to the luxfi org in buf
|
||||
https://buf.build/luxfi/repositories
|
||||
@@ -1,8 +0,0 @@
|
||||
version: v1
|
||||
plugins:
|
||||
- name: go
|
||||
out: pb
|
||||
opt: paths=source_relative
|
||||
- name: go-grpc
|
||||
out: pb
|
||||
opt: paths=source_relative
|
||||
@@ -1,36 +0,0 @@
|
||||
# Lux gRPC
|
||||
|
||||
Now Serving: **Protocol Version 42**
|
||||
|
||||
Protobuf files are hosted at
|
||||
[https://buf.build/luxfi/lux](https://buf.build/luxfi/lux) and
|
||||
can be used as dependencies in other projects.
|
||||
|
||||
Protobuf linting and generation for this project is managed by
|
||||
[buf](https://github.com/bufbuild/buf).
|
||||
|
||||
Please find installation instructions on
|
||||
[https://docs.buf.build/installation/](https://docs.buf.build/installation/).
|
||||
|
||||
Any changes made to proto definition can be updated by running
|
||||
`protobuf_codegen.sh` located in the `scripts/` directory of Lux Node.
|
||||
|
||||
`buf` Quickstart
|
||||
[https://buf.build/docs/cli/quickstart](https://buf.build/docs/cli/quickstart)
|
||||
|
||||
## Protocol Version Compatibility
|
||||
|
||||
The protobuf definitions and generated code are versioned based on the
|
||||
[RPCChainVMProtocol](../version/version.go#L13) defined for the RPCChainVM.
|
||||
Many versions of a Lux client can use the same
|
||||
[RPCChainVMProtocol](../version/version.go#L13). But each Lux client and
|
||||
chain VM must use the same protocol version to be compatible.
|
||||
|
||||
## Publishing to Buf Schema Registry
|
||||
|
||||
- Checkout appropriate tag in Lux Node `git checkout v1.10.1`
|
||||
- Change to proto/ directory `cd proto`.
|
||||
- Publish new tag to buf registry. `buf push -t v26`
|
||||
|
||||
Note: Publishing requires auth to the luxfi org in buf
|
||||
https://buf.build/luxfi/repositories
|
||||
@@ -1,30 +0,0 @@
|
||||
version: v1
|
||||
name: buf.build/luxfi/lux
|
||||
build:
|
||||
excludes: []
|
||||
breaking:
|
||||
use:
|
||||
- FILE
|
||||
# deps removed - now using local io/metric/client/metrics.proto
|
||||
lint:
|
||||
use:
|
||||
- STANDARD
|
||||
except:
|
||||
- SERVICE_SUFFIX # service requirement of <name>+Service
|
||||
- RPC_REQUEST_STANDARD_NAME # explicit <rpc>+Request naming
|
||||
- RPC_RESPONSE_STANDARD_NAME # explicit <rpc>+Response naming
|
||||
- PACKAGE_VERSION_SUFFIX # versioned naming <service>.v1beta
|
||||
ignore:
|
||||
# TODO: how will fixing this affect functionality. Multiple fields are used as the request
|
||||
# or response type for multiple RPCs
|
||||
- aliasreader/aliasreader.proto
|
||||
- net/conn/conn.proto
|
||||
# Third-party proto from prometheus/client_model - don't lint
|
||||
- io/metric/client/metrics.proto
|
||||
# allows RPC requests or responses to be google.protobuf.Empty messages. This can be set if you
|
||||
# want to allow messages to be void forever, that is they will never take any parameters.
|
||||
rpc_allow_google_protobuf_empty_requests: true
|
||||
rpc_allow_google_protobuf_empty_responses: true
|
||||
# allows the same message type to be used for a single RPC's request and response type.
|
||||
# TODO: this should not be tolerated and if it is only perscriptivly.
|
||||
rpc_allow_same_request_response: true
|
||||
@@ -1,25 +0,0 @@
|
||||
#!/bin/bash
|
||||
# Rename types, methods, and functions to remove "App" prefix
|
||||
# Targeted at p2p message types and builder functions
|
||||
|
||||
# 1. Rename Message Types and Fields (Getters)
|
||||
find . -name "*.go" -type f -print0 | xargs -0 sed -i '' \
|
||||
-e 's/AppRequest/Request/g' \
|
||||
-e 's/AppResponse/Response/g' \
|
||||
-e 's/AppGossip/Gossip/g' \
|
||||
-e 's/AppError/Error/g' \
|
||||
-e 's/GetAppRequest/GetRequest/g' \
|
||||
-e 's/GetAppResponse/GetResponse/g' \
|
||||
-e 's/GetAppGossip/GetGossip/g' \
|
||||
-e 's/GetAppError/GetError/g'
|
||||
|
||||
# 2. Rename Builder Functions (Inbound/Outbound)
|
||||
# Note: s/AppRequest/Request/g above already handled the suffix.
|
||||
# Now we need to handle prefixes if they still exist.
|
||||
# e.g. InboundAppRequest -> InboundRequest (if AppRequest matched first, it became InboundRequest)
|
||||
# Check: InboundAppRequest -> InboundRequest.
|
||||
# So IsInboundAppRequest -> IsInboundRequest?
|
||||
# We should just ensure "InboundApp" -> "Inbound" (for any other patterns)
|
||||
find . -name "*.go" -type f -print0 | xargs -0 sed -i '' \
|
||||
-e 's/InboundApp/Inbound/g' \
|
||||
-e 's/OutboundApp/Outbound/g'
|
||||
@@ -1,30 +0,0 @@
|
||||
#!/bin/bash
|
||||
# Replace package declarations in moved files
|
||||
# Ensure we are fixing package names for moved files
|
||||
# vm/manager was 'package manager', so it fits node/vms/manager
|
||||
# vm/rpc was 'package rpc' (likely), needs to be 'package rpcchainvm'
|
||||
|
||||
if [ -d "vms/manager" ]; then
|
||||
sed -i '' 's/^package.*/package manager/' vms/manager/*.go
|
||||
fi
|
||||
if [ -d "vms/rpcchainvm" ]; then
|
||||
sed -i '' 's/^package.*/package rpcchainvm/' vms/rpcchainvm/*.go
|
||||
fi
|
||||
|
||||
# Global replacements
|
||||
DIRS=". ../precompile ../coreth ../evm ../rpc ../wallet ../staking"
|
||||
|
||||
for dir in $DIRS; do
|
||||
if [ -d "$dir" ]; then
|
||||
echo "Processing $dir..."
|
||||
find "$dir" -name "*.go" -type f -print0 | xargs -0 sed -i '' \
|
||||
-e 's|github.com/luxfi/consensus/runtime|github.com/luxfi/runtime|g' \
|
||||
-e 's|github.com/luxfi/consensus/validator|github.com/luxfi/validators|g' \
|
||||
-e 's|github.com/luxfi/consensus/version|github.com/luxfi/version|g' \
|
||||
-e 's|github.com/luxfi/vm/manager|github.com/luxfi/node/vms/manager|g' \
|
||||
-e 's|github.com/luxfi/vm/rpc|github.com/luxfi/node/vms/rpcchainvm|g' \
|
||||
-e 's|github.com/luxfi/vm/chains|github.com/luxfi/node/chains|g' \
|
||||
-e 's|version\.Current()|version.CurrentApp|g' \
|
||||
-e 's|consensusversion\.Current()|version.CurrentApp|g'
|
||||
fi
|
||||
done
|
||||
+13
-5
@@ -54,8 +54,16 @@ source "${REPO_ROOT}"/scripts/constants.sh
|
||||
# Determine the git commit hash to use for the build
|
||||
source "${REPO_ROOT}"/scripts/git_commit.sh
|
||||
|
||||
# Configure build based on profile
|
||||
tags=""
|
||||
# Configure build based on profile.
|
||||
#
|
||||
# `metrics` is a base tag, not a profile choice: without it luxfi/metric's
|
||||
# NewRegistry() resolves to the no-op registry (registry_noop.go, //go:build
|
||||
# !metrics), every metric registers into a black hole, and /v1/metrics answers
|
||||
# 200 with a zero-byte body — while --api-metrics-enabled=true still reports
|
||||
# metrics as on. Whether metrics are served is the runtime flag's decision
|
||||
# alone; the build must not silently overrule it.
|
||||
base_tags="metrics"
|
||||
tags="${base_tags}"
|
||||
ldflags="-X github.com/luxfi/node/version.GitCommit=$git_commit \
|
||||
-X github.com/luxfi/node/version.VersionMajor=$version_major \
|
||||
-X github.com/luxfi/node/version.VersionMinor=$version_minor \
|
||||
@@ -67,7 +75,7 @@ upx_compress=false
|
||||
case "${profile}" in
|
||||
minimal)
|
||||
echo "Profile: minimal (ZAP, all VMs, NAT, stripped)"
|
||||
tags="nattraversal"
|
||||
tags="${base_tags},nattraversal"
|
||||
strip_flags="-s -w"
|
||||
;;
|
||||
core)
|
||||
@@ -77,7 +85,7 @@ case "${profile}" in
|
||||
;;
|
||||
full)
|
||||
echo "Profile: full (gRPC+ZAP, all VMs, all features, stripped)"
|
||||
tags="grpc,nattraversal,zxcvbn,metrics"
|
||||
tags="${base_tags},grpc,nattraversal,zxcvbn"
|
||||
strip_flags="-s -w"
|
||||
;;
|
||||
dev)
|
||||
@@ -86,7 +94,7 @@ case "${profile}" in
|
||||
;;
|
||||
tiny)
|
||||
echo "Profile: tiny (all VMs, NAT + UPX compressed)"
|
||||
tags="nattraversal"
|
||||
tags="${base_tags},nattraversal"
|
||||
strip_flags="-s -w"
|
||||
upx_compress=true
|
||||
;;
|
||||
|
||||
@@ -36,9 +36,11 @@ export CGO_ENABLED="${CGO_ENABLED:-1}"
|
||||
# Disable version control fallbacks
|
||||
export GOPROXY="${GOPROXY:-https://proxy.golang.org}"
|
||||
|
||||
# Use GOPRIVATE to bypass Go proxy for luxfi packages (zip too large for proxy)
|
||||
export GOPRIVATE="${GOPRIVATE:-github.com/luxfi/*}"
|
||||
export GONOSUMDB="${GONOSUMDB:-github.com/luxfi/*}"
|
||||
# Only genuinely-private modules bypass the proxy. Everything else in luxfi is
|
||||
# public: GOPRIVATE would disable checksum verification for it, which is how
|
||||
# moved tags got captured into module caches unverified.
|
||||
export GOPRIVATE="${GOPRIVATE:-github.com/lux-private/*}"
|
||||
export GONOSUMDB="${GONOSUMDB:-github.com/lux-private/*}"
|
||||
|
||||
# Configure pkg-config path for C++ libraries (luxcpp)
|
||||
# Searches for installed libraries in common locations
|
||||
|
||||
@@ -1,60 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
if ! [[ "$0" =~ scripts/protobuf_codegen.sh ]]; then
|
||||
echo "must be run from repository root"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# the versions here should match those of the binaries installed in the nix dev shell
|
||||
|
||||
## ensure the correct version of "buf" is installed
|
||||
BUF_VERSION='1.47.2'
|
||||
if [[ $(buf --version | cut -f2 -d' ') != "${BUF_VERSION}" ]]; then
|
||||
echo "could not find buf ${BUF_VERSION}, is it installed + in PATH?"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
## ensure the correct version of "protoc-gen-go" is installed
|
||||
PROTOC_GEN_GO_VERSION='v1.35.1'
|
||||
if [[ $(protoc-gen-go --version | cut -f2 -d' ') != "${PROTOC_GEN_GO_VERSION}" ]]; then
|
||||
echo "could not find protoc-gen-go ${PROTOC_GEN_GO_VERSION}, is it installed + in PATH?"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
## ensure the correct version of "protoc-gen-go-grpc" is installed
|
||||
PROTOC_GEN_GO_GRPC_VERSION='1.3.0'
|
||||
if [[ $(protoc-gen-go-grpc --version | cut -f2 -d' ') != "${PROTOC_GEN_GO_GRPC_VERSION}" ]]; then
|
||||
echo "could not find protoc-gen-go-grpc ${PROTOC_GEN_GO_GRPC_VERSION}, is it installed + in PATH?"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
BUF_MODULES=("proto" "connectproto")
|
||||
|
||||
REPO_ROOT=$PWD
|
||||
for BUF_MODULE in "${BUF_MODULES[@]}"; do
|
||||
TARGET=$REPO_ROOT/$BUF_MODULE
|
||||
if [ -n "${1:-}" ]; then
|
||||
TARGET="$1"
|
||||
fi
|
||||
|
||||
# move to buf module directory
|
||||
cd "$TARGET"
|
||||
|
||||
echo "Generating for buf module $BUF_MODULE"
|
||||
echo "Running protobuf fmt for..."
|
||||
buf format -w
|
||||
|
||||
echo "Running protobuf lint check..."
|
||||
if ! buf lint; then
|
||||
echo "ERROR: protobuf linter failed"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Re-generating protobuf..."
|
||||
if ! buf generate; then
|
||||
echo "ERROR: protobuf generation failed"
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
@@ -60,7 +60,7 @@ PLUGINS=(
|
||||
r5m1ujrmXxVcQetG3CQfuDLHp2RHKh6vCDaFgBRQfUcTZh7eS # oraclevm
|
||||
ry9Sg8rZdT26iEKvJDmC2wkESs4SDKgZEhk5BgLSwg1EpcNug # quantumvm
|
||||
sP6dLqrrBR9w3soP18fbJ3YzZecZdD7DDdfH2cFhhLq7Hy9bz # relayvm
|
||||
tGVBwRxpmD2aFdg3iYjgRvrCe8Jcmq9UNKxyHMus2NZ8WcD8t # mpcvm
|
||||
qCURact1n41FcoNBch8iMVBwc9AWie48D118ZNJ5tBdWrvryS # mpcvm
|
||||
vv3qPfyTVXZ5ArRZA9Jh4hbYDTBe43f7sgQg4CHfNg1rnnvX9 # zkvm
|
||||
)
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@ import (
|
||||
"net/http"
|
||||
"os"
|
||||
|
||||
"github.com/valyala/fasthttp/fasthttpadaptor"
|
||||
zaphttp "github.com/zap-proto/http"
|
||||
|
||||
log "github.com/luxfi/log"
|
||||
@@ -53,7 +54,10 @@ func startZapRPCListener(logger log.Logger, handler http.Handler, addr string) *
|
||||
if addr == "" {
|
||||
return nil
|
||||
}
|
||||
srv := &zaphttp.Server{Addr: addr, Handler: handler}
|
||||
// zap-proto/http >= v0.2.0 takes a fasthttp.RequestHandler. Adapt the very
|
||||
// same net/http handler chain the HTTP listener serves, so the two
|
||||
// transports stay behaviourally identical — only the wire encoding differs.
|
||||
srv := &zaphttp.Server{Addr: addr, Handler: fasthttpadaptor.NewFastHTTPHandler(handler)}
|
||||
go func() {
|
||||
logger.Info("ZAP-RPC API listening", log.UserString("addr", addr))
|
||||
if err := srv.ListenAndServe(); err != nil {
|
||||
|
||||
@@ -9,6 +9,7 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/valyala/fasthttp"
|
||||
zaphttp "github.com/zap-proto/http"
|
||||
|
||||
log "github.com/luxfi/log"
|
||||
@@ -22,8 +23,8 @@ func TestZapRPCListenAddr(t *testing.T) {
|
||||
val string
|
||||
want string
|
||||
}{
|
||||
{set: false, want: ""}, // unset → disabled (default)
|
||||
{set: true, val: "", want: ""}, // empty → disabled
|
||||
{set: false, want: ""}, // unset → disabled (default)
|
||||
{set: true, val: "", want: ""}, // empty → disabled
|
||||
{set: true, val: "off", want: ""},
|
||||
{set: true, val: "OFF", want: ""},
|
||||
{set: true, val: "0", want: ""},
|
||||
@@ -74,18 +75,32 @@ func TestStartZapRPCListener_RoundTrip(t *testing.T) {
|
||||
// Give the goroutine a beat to bind.
|
||||
time.Sleep(150 * time.Millisecond)
|
||||
|
||||
client := &http.Client{Transport: zaphttp.NewTransport(addr)}
|
||||
resp, err := client.Post("http://"+addr+"/v1/bc/C/rpc", "application/json", nil)
|
||||
if err != nil {
|
||||
// zap-proto/http >= v0.2.0 speaks fasthttp on both ends: Transport.Do takes
|
||||
// a fasthttp request/response pair rather than implementing
|
||||
// http.RoundTripper. The round trip being asserted is unchanged — a real
|
||||
// ZAP request over the wire must reach the net/http handler the listener
|
||||
// was given, through the fasthttpadaptor bridge in startZapRPCListener.
|
||||
// v0.3.0 replaced NewTransport with Dial, mirroring net.Dial: the network is
|
||||
// a VALUE ("tcp", "unix") rather than a family of constructors.
|
||||
transport := zaphttp.Dial("tcp", addr)
|
||||
defer transport.CloseIdleConnections()
|
||||
|
||||
req, resp := fasthttp.AcquireRequest(), fasthttp.AcquireResponse()
|
||||
defer fasthttp.ReleaseRequest(req)
|
||||
defer fasthttp.ReleaseResponse(resp)
|
||||
|
||||
req.SetRequestURI("http://" + addr + "/v1/bc/C/rpc")
|
||||
req.Header.SetMethod(http.MethodPost)
|
||||
req.Header.SetContentType("application/json")
|
||||
|
||||
if err := transport.Do(req, resp); err != nil {
|
||||
t.Fatalf("ZAP round-trip POST failed: %v", err)
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
|
||||
got, _ := io.ReadAll(resp.Body)
|
||||
if string(got) != body {
|
||||
if got := string(resp.Body()); got != body {
|
||||
t.Fatalf("ZAP round-trip body = %q, want %q", got, body)
|
||||
}
|
||||
if ct := resp.Header.Get("Content-Type"); ct != "application/json" {
|
||||
if ct := string(resp.Header.ContentType()); ct != "application/json" {
|
||||
t.Fatalf("ZAP round-trip Content-Type = %q, want application/json", ct)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,126 @@
|
||||
// Copyright (C) 2019-2026, Lux Industries Inc. All rights reserved.
|
||||
// See the file LICENSE for licensing terms.
|
||||
|
||||
// logger_level_test.go — admin.setLoggerLevel / admin.getLoggerLevel must actually
|
||||
// move a live logger's level.
|
||||
//
|
||||
// They did not. SetLoggerLevel computed the logger names and threw them away
|
||||
// (`loggerNames := a.getLoggerNames(...); _ = loggerNames`) and getLogLevels returned
|
||||
// an empty map unconditionally, so BOTH endpoints answered 200 OK having done nothing.
|
||||
// That is why the 2026-07-28 devnet/testnet build-loop diagnosis had to be run off boot
|
||||
// logs: raising a running node's log level was impossible.
|
||||
//
|
||||
// The tests drive the REAL log.Factory (the same one the node builds), not a double,
|
||||
// so a passing SetLoggerLevel means the level the logger actually filters on moved.
|
||||
package admin
|
||||
|
||||
import (
|
||||
"context"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
apiadmin "github.com/luxfi/api/admin"
|
||||
"github.com/luxfi/log"
|
||||
)
|
||||
|
||||
// newLevelTestService returns an admin service over a real log.Factory that already
|
||||
// holds one registered logger — the shape the node runs in.
|
||||
func newLevelTestService(t *testing.T, loggerName string) *Service {
|
||||
t.Helper()
|
||||
|
||||
factory := log.NewFactory()
|
||||
t.Cleanup(factory.Close)
|
||||
|
||||
_, err := factory.Make(loggerName)
|
||||
require.NoError(t, err)
|
||||
|
||||
return &Service{Config: Config{Log: log.Noop(), LogFactory: factory}}
|
||||
}
|
||||
|
||||
// TestSetLoggerLevel_MovesTheLevelAndGetReportsIt is the regression: set, then read
|
||||
// back through the API. Before the fix the set was discarded and the get returned an
|
||||
// empty map, so both halves silently lied.
|
||||
func TestSetLoggerLevel_MovesTheLevelAndGetReportsIt(t *testing.T) {
|
||||
require := require.New(t)
|
||||
ctx := context.Background()
|
||||
|
||||
svc := newLevelTestService(t, "C")
|
||||
|
||||
_, err := svc.SetLoggerLevel(ctx, &apiadmin.SetLoggerLevelArgs{
|
||||
LoggerName: "C",
|
||||
LogLevel: "debug",
|
||||
DisplayLevel: "error",
|
||||
})
|
||||
require.NoError(err)
|
||||
|
||||
reply, err := svc.GetLoggerLevel(ctx, &apiadmin.GetLoggerLevelArgs{LoggerName: "C"})
|
||||
require.NoError(err)
|
||||
require.Equal(
|
||||
map[string]apiadmin.LogAndDisplayLevels{"C": {
|
||||
LogLevel: log.DebugLevel.String(),
|
||||
DisplayLevel: log.ErrorLevel.String(),
|
||||
}},
|
||||
reply.LoggerLevels,
|
||||
"setLoggerLevel must move the live logger's level and getLoggerLevel must report it",
|
||||
)
|
||||
|
||||
// The factory is the single source of truth — assert against it directly too, so a
|
||||
// getLoggerLevel that merely echoed the request back could not pass this test.
|
||||
logLevel, err := svc.LogFactory.GetLogLevel("C")
|
||||
require.NoError(err)
|
||||
require.Equal(log.DebugLevel, logLevel)
|
||||
}
|
||||
|
||||
// TestSetLoggerLevel_OneLevelAtATime pins that omitting a level leaves it alone rather
|
||||
// than resetting it to the zero Level.
|
||||
func TestSetLoggerLevel_OneLevelAtATime(t *testing.T) {
|
||||
require := require.New(t)
|
||||
ctx := context.Background()
|
||||
|
||||
svc := newLevelTestService(t, "node")
|
||||
|
||||
_, err := svc.SetLoggerLevel(ctx, &apiadmin.SetLoggerLevelArgs{
|
||||
LoggerName: "node", LogLevel: "trace", DisplayLevel: "warn",
|
||||
})
|
||||
require.NoError(err)
|
||||
|
||||
// Only displayLevel this time — logLevel must survive.
|
||||
_, err = svc.SetLoggerLevel(ctx, &apiadmin.SetLoggerLevelArgs{
|
||||
LoggerName: "node", DisplayLevel: "fatal",
|
||||
})
|
||||
require.NoError(err)
|
||||
|
||||
reply, err := svc.GetLoggerLevel(ctx, &apiadmin.GetLoggerLevelArgs{LoggerName: "node"})
|
||||
require.NoError(err)
|
||||
require.Equal(log.TraceLevel.String(), reply.LoggerLevels["node"].LogLevel)
|
||||
require.Equal(log.FatalLevel.String(), reply.LoggerLevels["node"].DisplayLevel)
|
||||
}
|
||||
|
||||
// TestLoggerLevel_RejectsUnservableAndInvalidArgs — every refusal is explicit. log.Factory
|
||||
// addresses loggers BY NAME and exposes no enumeration, so an empty name cannot be served;
|
||||
// returning 200 OK for it is the bug, not the contract.
|
||||
func TestLoggerLevel_RejectsUnservableAndInvalidArgs(t *testing.T) {
|
||||
require := require.New(t)
|
||||
ctx := context.Background()
|
||||
|
||||
svc := newLevelTestService(t, "C")
|
||||
|
||||
_, err := svc.SetLoggerLevel(ctx, &apiadmin.SetLoggerLevelArgs{LogLevel: "debug"})
|
||||
require.ErrorIs(err, errNoLoggerName)
|
||||
|
||||
_, err = svc.GetLoggerLevel(ctx, &apiadmin.GetLoggerLevelArgs{})
|
||||
require.ErrorIs(err, errNoLoggerName)
|
||||
|
||||
_, err = svc.SetLoggerLevel(ctx, &apiadmin.SetLoggerLevelArgs{LoggerName: "C"})
|
||||
require.ErrorIs(err, errNoLogLevel)
|
||||
|
||||
// An unparseable level must be refused BEFORE anything is mutated.
|
||||
before, err := svc.LogFactory.GetLogLevel("C")
|
||||
require.NoError(err)
|
||||
_, err = svc.SetLoggerLevel(ctx, &apiadmin.SetLoggerLevelArgs{LoggerName: "C", LogLevel: "loud"})
|
||||
require.Error(err)
|
||||
after, err := svc.LogFactory.GetLogLevel("C")
|
||||
require.NoError(err)
|
||||
require.Equal(before, after, "a rejected level must leave the logger untouched")
|
||||
}
|
||||
@@ -40,6 +40,7 @@ const (
|
||||
var (
|
||||
errAliasTooLong = errors.New("alias length is too long")
|
||||
errNoLogLevel = errors.New("need to specify either displayLevel or logLevel")
|
||||
errNoLoggerName = errors.New("need to specify loggerName: loggers are addressed by name and cannot be enumerated")
|
||||
)
|
||||
|
||||
// ChainTracker is the interface for tracking chains at runtime.
|
||||
@@ -209,11 +210,39 @@ func (a *Service) SetLoggerLevel(ctx context.Context, args *apiadmin.SetLoggerLe
|
||||
return nil, errNoLogLevel
|
||||
}
|
||||
|
||||
// Parse before mutating: a rejected level must leave every logger untouched.
|
||||
var logLevel, displayLevel log.Level
|
||||
if args.LogLevel != "" {
|
||||
var err error
|
||||
if logLevel, err = log.ToLevel(args.LogLevel); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
if args.DisplayLevel != "" {
|
||||
var err error
|
||||
if displayLevel, err = log.ToLevel(args.DisplayLevel); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
loggerNames, err := a.getLoggerNames(args.LoggerName)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
a.lock.Lock()
|
||||
defer a.lock.Unlock()
|
||||
|
||||
loggerNames := a.getLoggerNames(args.LoggerName)
|
||||
_ = loggerNames
|
||||
for _, name := range loggerNames {
|
||||
// Only the levels the caller supplied — an omitted level keeps its value
|
||||
// instead of being reset to the zero Level.
|
||||
if args.LogLevel != "" {
|
||||
a.LogFactory.SetLogLevel(name, logLevel)
|
||||
}
|
||||
if args.DisplayLevel != "" {
|
||||
a.LogFactory.SetDisplayLevel(name, displayLevel)
|
||||
}
|
||||
}
|
||||
return &apiadmin.EmptyReply{}, nil
|
||||
}
|
||||
|
||||
@@ -225,10 +254,14 @@ func (a *Service) GetLoggerLevel(ctx context.Context, args *apiadmin.GetLoggerLe
|
||||
log.String("loggerName", args.LoggerName),
|
||||
)
|
||||
|
||||
loggerNames, err := a.getLoggerNames(args.LoggerName)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
a.lock.RLock()
|
||||
defer a.lock.RUnlock()
|
||||
|
||||
loggerNames := a.getLoggerNames(args.LoggerName)
|
||||
loggerLevels, err := a.getLogLevels(loggerNames)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -401,15 +434,35 @@ func (a *Service) GetTrackedChains(ctx context.Context) (*apiadmin.GetTrackedCha
|
||||
return &apiadmin.GetTrackedChainsReply{TrackedChains: trackedChains}, nil
|
||||
}
|
||||
|
||||
func (a *Service) getLoggerNames(loggerName string) []string {
|
||||
if len(loggerName) == 0 {
|
||||
return []string{}
|
||||
// getLoggerNames resolves the loggerName argument to the loggers to act on — the one
|
||||
// place either logger-level endpoint decides what it is addressing.
|
||||
//
|
||||
// log.Factory addresses loggers BY NAME and exposes no enumeration, so the "every
|
||||
// logger" form (an empty name) cannot be served. Refuse it explicitly: answering 200 OK
|
||||
// while doing nothing is what made these endpoints unusable.
|
||||
func (a *Service) getLoggerNames(loggerName string) ([]string, error) {
|
||||
if loggerName == "" {
|
||||
return nil, errNoLoggerName
|
||||
}
|
||||
return []string{loggerName}
|
||||
return []string{loggerName}, nil
|
||||
}
|
||||
|
||||
func (a *Service) getLogLevels(loggerNames []string) (map[string]apiadmin.LogAndDisplayLevels, error) {
|
||||
loggerLevels := make(map[string]apiadmin.LogAndDisplayLevels)
|
||||
loggerLevels := make(map[string]apiadmin.LogAndDisplayLevels, len(loggerNames))
|
||||
for _, name := range loggerNames {
|
||||
logLevel, err := a.LogFactory.GetLogLevel(name)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
displayLevel, err := a.LogFactory.GetDisplayLevel(name)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
loggerLevels[name] = apiadmin.LogAndDisplayLevels{
|
||||
LogLevel: logLevel.String(),
|
||||
DisplayLevel: displayLevel.String(),
|
||||
}
|
||||
}
|
||||
return loggerLevels, nil
|
||||
}
|
||||
|
||||
|
||||
+16
-10
@@ -5,11 +5,10 @@ package health
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"net/http"
|
||||
|
||||
"github.com/go-json-experiment/json"
|
||||
"github.com/go-json-experiment/json/jsontext"
|
||||
"github.com/gorilla/rpc/v2"
|
||||
|
||||
apihealth "github.com/luxfi/api/health"
|
||||
@@ -56,17 +55,24 @@ func NewGetHandler(reporter func(tags ...string) (map[string]apihealth.Result, b
|
||||
// If a health check has failed, we should return a 503.
|
||||
w.WriteHeader(http.StatusServiceUnavailable)
|
||||
}
|
||||
// Buffer the reply — a streaming encoder that errors part-way
|
||||
// (jsonv2 rejects invalid UTF-8, and check Details may embed raw
|
||||
// chain-ID bytes) leaves the client a torn body whose
|
||||
// Content-Length matches the truncation. Buffering makes the
|
||||
// reply atomic; AllowInvalidUTF8 turns binary detail bytes into
|
||||
// replacement runes instead of an encode error.
|
||||
// One encoder for one wire type: apihealth.APIReply is defined with
|
||||
// encoding/json tags and carries a time.Duration per check, so it is
|
||||
// encoding/json that defines its representation. The POST (jsonrpc)
|
||||
// path already encodes it through that codec; encoding it here the
|
||||
// same way is what makes GET and POST agree. jsonv2 cannot encode
|
||||
// this type at all — time.Duration has no default representation
|
||||
// there — so every GET reply used to degrade to the error fallback
|
||||
// below. encoding/json also replaces invalid UTF-8 (check Details
|
||||
// may embed raw chain-ID bytes) with U+FFFD rather than failing.
|
||||
//
|
||||
// Buffer first: a streaming encoder that errors part-way would leave
|
||||
// the client a torn body whose Content-Length matches the
|
||||
// truncation. Buffering makes the reply atomic.
|
||||
var buf bytes.Buffer
|
||||
err := json.MarshalWrite(&buf, apihealth.APIReply{
|
||||
err := json.NewEncoder(&buf).Encode(apihealth.APIReply{
|
||||
Checks: checks,
|
||||
Healthy: healthy,
|
||||
}, jsontext.AllowInvalidUTF8(true))
|
||||
})
|
||||
if err != nil {
|
||||
buf.Reset()
|
||||
fmt.Fprintf(&buf, `{"healthy":%t,"error":"health reply encode failed"}`, healthy)
|
||||
|
||||
@@ -0,0 +1,103 @@
|
||||
// Copyright (C) 2019-2025, Lux Industries Inc. All rights reserved.
|
||||
// See the file LICENSE for licensing terms.
|
||||
|
||||
package health
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
apihealth "github.com/luxfi/api/health"
|
||||
)
|
||||
|
||||
// The GET handler must emit the real check set. It previously encoded through
|
||||
// jsonv2, which cannot represent apihealth.Result.Duration (a time.Duration),
|
||||
// so every reply on every node degraded to {"healthy":…,"error":"health reply
|
||||
// encode failed"} while the status code still looked correct — k8s probes
|
||||
// passed and operators saw nothing.
|
||||
func TestGetHandlerEncodesDurationBearingChecks(t *testing.T) {
|
||||
require := require.New(t)
|
||||
|
||||
checks := map[string]apihealth.Result{
|
||||
"bls": {
|
||||
Details: "node has the correct BLS key",
|
||||
Duration: 134597 * time.Nanosecond,
|
||||
Timestamp: time.Unix(1753479996, 0).UTC(),
|
||||
},
|
||||
}
|
||||
h := NewGetHandler(func(...string) (map[string]apihealth.Result, bool) {
|
||||
return checks, true
|
||||
})
|
||||
|
||||
rec := httptest.NewRecorder()
|
||||
h.ServeHTTP(rec, httptest.NewRequest(http.MethodGet, "/v1/health", nil))
|
||||
|
||||
require.Equal(http.StatusOK, rec.Code)
|
||||
|
||||
var reply apihealth.APIReply
|
||||
require.NoError(json.Unmarshal(rec.Body.Bytes(), &reply))
|
||||
require.True(reply.Healthy)
|
||||
require.Len(reply.Checks, 1)
|
||||
require.Equal(134597*time.Nanosecond, reply.Checks["bls"].Duration)
|
||||
require.NotContains(rec.Body.String(), "health reply encode failed")
|
||||
}
|
||||
|
||||
// An unhealthy node must still return the full diagnostic body alongside the
|
||||
// 503 — the body is the only thing that says *why*.
|
||||
func TestGetHandlerUnhealthyStillCarriesChecks(t *testing.T) {
|
||||
require := require.New(t)
|
||||
|
||||
errMsg := "network layer is unhealthy reason: primary network validator has no inbound connections"
|
||||
checks := map[string]apihealth.Result{
|
||||
"network": {
|
||||
Details: map[string]any{"connectedPeers": 4},
|
||||
Error: &errMsg,
|
||||
Duration: 40357 * time.Nanosecond,
|
||||
ContiguousFailures: 31997,
|
||||
},
|
||||
}
|
||||
h := NewGetHandler(func(...string) (map[string]apihealth.Result, bool) {
|
||||
return checks, false
|
||||
})
|
||||
|
||||
rec := httptest.NewRecorder()
|
||||
h.ServeHTTP(rec, httptest.NewRequest(http.MethodGet, "/v1/health", nil))
|
||||
|
||||
require.Equal(http.StatusServiceUnavailable, rec.Code)
|
||||
|
||||
var reply apihealth.APIReply
|
||||
require.NoError(json.Unmarshal(rec.Body.Bytes(), &reply))
|
||||
require.False(reply.Healthy)
|
||||
require.Equal(&errMsg, reply.Checks["network"].Error)
|
||||
require.Equal(int64(31997), reply.Checks["network"].ContiguousFailures)
|
||||
}
|
||||
|
||||
// Check Details may embed raw chain-ID bytes. Invalid UTF-8 must degrade to
|
||||
// replacement runes, never to an encode failure that drops the whole reply.
|
||||
func TestGetHandlerInvalidUTF8InDetailsDoesNotDropReply(t *testing.T) {
|
||||
require := require.New(t)
|
||||
|
||||
checks := map[string]apihealth.Result{
|
||||
"database": {
|
||||
Details: string([]byte{0xff, 0xfe, 0x00}),
|
||||
Duration: 19137 * time.Nanosecond,
|
||||
},
|
||||
}
|
||||
h := NewGetHandler(func(...string) (map[string]apihealth.Result, bool) {
|
||||
return checks, true
|
||||
})
|
||||
|
||||
rec := httptest.NewRecorder()
|
||||
h.ServeHTTP(rec, httptest.NewRequest(http.MethodGet, "/v1/health", nil))
|
||||
|
||||
require.Equal(http.StatusOK, rec.Code)
|
||||
var reply apihealth.APIReply
|
||||
require.NoError(json.Unmarshal(rec.Body.Bytes(), &reply))
|
||||
require.Len(reply.Checks, 1)
|
||||
require.NotContains(rec.Body.String(), "health reply encode failed")
|
||||
}
|
||||
@@ -12,6 +12,7 @@ github.com/Ladicle/tabwriter v1.0.0 h1:DZQqPvMumBDwVNElso13afjYLNp0Z7pHqHnu0r4t9
|
||||
github.com/Masterminds/semver/v3 v3.4.0 h1:Zog+i5UMtVoCU8oKka5P7i9q9HgrJeGzI9SA1Xbatp0=
|
||||
github.com/OpenPeeDeeP/depguard/v2 v2.2.1 h1:vckeWVESWp6Qog7UZSARNqfu/cZqvki8zsuj3piCMx4=
|
||||
github.com/StephenButtolph/canoto v0.17.3 h1:lvsnYD4b96vD1knnmp1xCmZqfYpY/jSeRozGdOfdvGI=
|
||||
github.com/StephenButtolph/canoto v0.17.3/go.mod h1:IcnAHC6nJUfQFVR9y60ko2ecUqqHHSB6UwI9NnBFZnE=
|
||||
github.com/alecthomas/assert/v2 v2.11.0 h1:2Q9r3ki8+JYXvGsDyBXwH3LcJ+WK5D0gc5E8vS6K3D0=
|
||||
github.com/alecthomas/chroma/v2 v2.17.2 h1:Rm81SCZ2mPoH+Q8ZCc/9YvzPUN/E7HgPiPJD8SLV6GI=
|
||||
github.com/alecthomas/go-check-sumtype v0.3.1 h1:u9aUvbGINJxLVXiFvHUlPEaD7VDULsrxJb4Aq31NLkU=
|
||||
@@ -56,6 +57,7 @@ github.com/dominikbraun/graph v0.23.0 h1:TdZB4pPqCLFxYhdyMFb1TBdFxp8XLcJfTTBQucV
|
||||
github.com/ettle/strcase v0.2.0 h1:fGNiVF21fHXpX1niBgk0aROov1LagYsOwV/xqKDKR/Q=
|
||||
github.com/fatih/color v1.18.0 h1:S8gINlzdQ840/4pfAwic/ZE0djQEH3wM94VfqLTZcOM=
|
||||
github.com/fatih/structtag v1.2.0 h1:/OdNE99OxoI/PqaW/SuSK9uxxT3f/tcSZgon/ssNSx4=
|
||||
github.com/fatih/structtag v1.2.0/go.mod h1:mBJUNpUnHmRKrKlQQlmCrh5PuhftFbNv8Ys4/aAZl94=
|
||||
github.com/firefart/nonamedreturns v1.0.6 h1:vmiBcKV/3EqKY3ZiPxCINmpS431OcE1S47AQUwhrg8E=
|
||||
github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8=
|
||||
github.com/fsnotify/fsnotify v1.9.0 h1:2Ml+OJNzbYCTzsxtv8vKSFD9PbJjmhYF14k/jKC7S9k=
|
||||
@@ -247,6 +249,7 @@ go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc=
|
||||
golang.org/x/exp v0.0.0-20251219203646-944ab1f22d93 h1:fQsdNF2N+/YewlRZiricy4P1iimyPKZ/xwniHj8Q2a0=
|
||||
golang.org/x/exp/typeparams v0.0.0-20250210185358-939b2ce775ac h1:TSSpLIG4v+p0rPv1pNOQtl1I8knsO4S9trOxNMOLVP4=
|
||||
golang.org/x/mod v0.31.0 h1:HaW9xtz0+kOcWKwli0ZXy79Ix+UW/vOfmWI5QVd2tgI=
|
||||
golang.org/x/mod v0.31.0/go.mod h1:43JraMp9cGx1Rx3AqioxrbrhNsLl2l/iNAvuBkrezpg=
|
||||
golang.org/x/net v0.48.0 h1:zyQRTTrjc33Lhh0fBgT/H3oZq9WuvRR5gPC70xpDiQU=
|
||||
golang.org/x/sync v0.19.0 h1:vV+1eWNmZ5geRlYjzm2adRgW2/mcpevXNg50YZtPCE4=
|
||||
golang.org/x/sys v0.39.0 h1:CvCKL8MeisomCi6qNZ+wbb0DN9E5AATixKsvNtMoMFk=
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
1.32.11
|
||||
1.36.36
|
||||
|
||||
@@ -63,7 +63,38 @@
|
||||
"v1.30.3",
|
||||
"v1.30.4",
|
||||
"v1.30.5",
|
||||
"v1.30.6"
|
||||
"v1.30.6",
|
||||
"v1.32.11",
|
||||
"v1.36.3",
|
||||
"v1.36.4",
|
||||
"v1.36.5",
|
||||
"v1.36.6",
|
||||
"v1.36.7",
|
||||
"v1.36.8",
|
||||
"v1.36.9",
|
||||
"v1.36.10",
|
||||
"v1.36.11",
|
||||
"v1.36.12",
|
||||
"v1.36.13",
|
||||
"v1.36.14",
|
||||
"v1.36.15",
|
||||
"v1.36.16",
|
||||
"v1.36.17",
|
||||
"v1.36.18",
|
||||
"v1.36.19",
|
||||
"v1.36.20",
|
||||
"v1.36.21",
|
||||
"v1.36.22",
|
||||
"v1.36.23",
|
||||
"v1.36.24",
|
||||
"v1.36.25",
|
||||
"v1.36.26",
|
||||
"v1.36.27",
|
||||
"v1.36.28",
|
||||
"v1.36.30",
|
||||
"v1.36.31",
|
||||
"v1.36.32",
|
||||
"v1.36.33"
|
||||
],
|
||||
"41": [
|
||||
"v1.13.2"
|
||||
@@ -178,4 +209,4 @@
|
||||
"v1.8.5",
|
||||
"v1.8.6"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -76,8 +76,8 @@ var (
|
||||
// These should match the latest git tag
|
||||
const (
|
||||
defaultMajor = 1
|
||||
defaultMinor = 32
|
||||
defaultPatch = 11
|
||||
defaultMinor = 36
|
||||
defaultPatch = 35
|
||||
)
|
||||
|
||||
func init() {
|
||||
|
||||
@@ -71,16 +71,16 @@ const (
|
||||
// holding the POST-transition field values. Its fields are hashed, in this exact
|
||||
// order, into the leaf preimage:
|
||||
//
|
||||
// SignerID ‖ LuxAddress[20] ‖ 0u32 ‖ BondLo ‖ BondHi ‖ OptInHeight ‖
|
||||
// SignerID ‖ UTXOAddr[20] ‖ 0u32 ‖ BondLo ‖ BondHi ‖ OptInHeight ‖
|
||||
// ExitEpoch ‖ SignCount ‖ BLSPubkey[48] ‖ CoronaPubkey[32] ‖ MLDSAPubkey[32] ‖
|
||||
// Status ‖ JailUntilEpoch ‖ SlashCount ‖ index (integers little-endian)
|
||||
//
|
||||
// A signer with Occupied == 0 is skipped (not folded), exactly as the kernel
|
||||
// skips unoccupied slots. The 0u32 after LuxAddress is the GPU struct's
|
||||
// skips unoccupied slots. The 0u32 after UTXOAddr is the GPU struct's
|
||||
// _pad_addr, committed as four zero bytes.
|
||||
type SignerLeaf struct {
|
||||
SignerID uint64
|
||||
LuxAddress [20]byte
|
||||
UTXOAddr [20]byte
|
||||
BondLo uint64
|
||||
BondHi uint64
|
||||
OptInHeight uint64
|
||||
@@ -175,7 +175,7 @@ func le64(b []byte, v uint64) []byte {
|
||||
func signerLeafDigest(s SignerLeaf, i uint32) [Size]byte {
|
||||
b := make([]byte, 0, 8+20+4+8+8+8+8+8+48+32+32+4+4+4+4)
|
||||
b = le64(b, s.SignerID)
|
||||
b = append(b, s.LuxAddress[:]...)
|
||||
b = append(b, s.UTXOAddr[:]...)
|
||||
b = le32(b, 0) // _pad_addr
|
||||
b = le64(b, s.BondLo)
|
||||
b = le64(b, s.BondHi)
|
||||
|
||||
@@ -106,7 +106,7 @@ func katMixedSigners() []SignerLeaf {
|
||||
s.Occupied = 1
|
||||
s.SignerID = uint64(i + 1)
|
||||
for k := 0; k < 20; k++ {
|
||||
s.LuxAddress[k] = byte(i + k)
|
||||
s.UTXOAddr[k] = byte(i + k)
|
||||
}
|
||||
for k := 0; k < 48; k++ {
|
||||
s.BLSPubkey[k] = byte(0x10 + k)
|
||||
@@ -281,7 +281,7 @@ func katDenseSigners(n uint32) []SignerLeaf {
|
||||
s.Occupied = 1
|
||||
s.SignerID = uint64(i + 1)
|
||||
for k := 0; k < 20; k++ {
|
||||
s.LuxAddress[k] = byte(0x40 + int(i) + k)
|
||||
s.UTXOAddr[k] = byte(0x40 + int(i) + k)
|
||||
}
|
||||
for k := 0; k < 48; k++ {
|
||||
s.BLSPubkey[k] = byte(0x11 + int(i) + k)
|
||||
|
||||
@@ -16,7 +16,7 @@ import (
|
||||
"github.com/luxfi/database/prefixdb"
|
||||
"github.com/luxfi/ids"
|
||||
"github.com/luxfi/math/set"
|
||||
"github.com/luxfi/node/vms/pcodecs"
|
||||
"github.com/luxfi/utils/wrappers"
|
||||
lux "github.com/luxfi/utxo"
|
||||
)
|
||||
|
||||
@@ -143,7 +143,7 @@ func (i *indexer) Accept(txID ids.ID, inputUTXOs []*lux.UTXO, outputUTXOs []*lux
|
||||
idx = binary.BigEndian.Uint64(idxBytes)
|
||||
case database.ErrNotFound:
|
||||
// idx not found; this must be the first entry.
|
||||
idxBytes = make([]byte, pcodecs.LongLen)
|
||||
idxBytes = make([]byte, wrappers.LongLen)
|
||||
default:
|
||||
// Unexpected error
|
||||
return fmt.Errorf("unexpected error when indexing txID %s: %w", txID, err)
|
||||
@@ -184,7 +184,7 @@ func (i *indexer) Read(address []byte, assetID ids.ID, cursor, pageSize uint64)
|
||||
assetPrefixDB := prefixdb.New(assetID[:], addressTxDB)
|
||||
|
||||
// get cursor in bytes
|
||||
cursorBytes := make([]byte, pcodecs.LongLen)
|
||||
cursorBytes := make([]byte, wrappers.LongLen)
|
||||
binary.BigEndian.PutUint64(cursorBytes, cursor)
|
||||
|
||||
// start reading from the cursor bytes, numeric keys maintain the order (see Accept)
|
||||
|
||||
@@ -1,32 +0,0 @@
|
||||
// Copyright (C) 2019-2025, Lux Industries Inc. All rights reserved.
|
||||
// See the file LICENSE for licensing terms.
|
||||
|
||||
package keystore
|
||||
|
||||
import (
|
||||
"errors"
|
||||
|
||||
"github.com/luxfi/node/vms/pcodecs"
|
||||
)
|
||||
|
||||
const CodecVersion = 0
|
||||
|
||||
var (
|
||||
Codec pcodecs.Manager
|
||||
LegacyCodec pcodecs.Manager
|
||||
)
|
||||
|
||||
func init() {
|
||||
c := pcodecs.NewLinearCodec()
|
||||
Codec = pcodecs.NewDefaultManager()
|
||||
lc := pcodecs.NewLinearCodec()
|
||||
LegacyCodec = pcodecs.NewMaxInt32Manager()
|
||||
|
||||
err := errors.Join(
|
||||
Codec.RegisterCodec(CodecVersion, c),
|
||||
LegacyCodec.RegisterCodec(CodecVersion, lc),
|
||||
)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
@@ -71,9 +71,34 @@ func (u *user) GetAddresses() ([]ids.ShortID, error) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var addresses []ids.ShortID
|
||||
_, err = LegacyCodec.Unmarshal(addressBytes, &addresses)
|
||||
return addresses, err
|
||||
return parseAddresses(addressBytes)
|
||||
}
|
||||
|
||||
// marshalAddresses encodes the user's controlled addresses as the flat
|
||||
// concatenation of their 20-byte values. ids.ShortID is fixed-width, so the
|
||||
// count is implied by len/ShortIDLen — no length prefix or codec is needed.
|
||||
func marshalAddresses(addresses []ids.ShortID) []byte {
|
||||
b := make([]byte, 0, len(addresses)*ids.ShortIDLen)
|
||||
for i := range addresses {
|
||||
b = append(b, addresses[i][:]...)
|
||||
}
|
||||
return b
|
||||
}
|
||||
|
||||
// parseAddresses is the inverse of marshalAddresses.
|
||||
func parseAddresses(b []byte) ([]ids.ShortID, error) {
|
||||
if len(b)%ids.ShortIDLen != 0 {
|
||||
return nil, fmt.Errorf("keystore: address blob length %d is not a multiple of %d", len(b), ids.ShortIDLen)
|
||||
}
|
||||
n := len(b) / ids.ShortIDLen
|
||||
if n == 0 {
|
||||
return nil, nil
|
||||
}
|
||||
addresses := make([]ids.ShortID, n)
|
||||
for i := 0; i < n; i++ {
|
||||
copy(addresses[i][:], b[i*ids.ShortIDLen:])
|
||||
}
|
||||
return addresses, nil
|
||||
}
|
||||
|
||||
func (u *user) PutKeys(privKeys ...*secp256k1.PrivateKey) error {
|
||||
@@ -119,11 +144,7 @@ func (u *user) PutKeys(privKeys ...*secp256k1.PrivateKey) error {
|
||||
addresses = append(addresses, address)
|
||||
}
|
||||
|
||||
addressBytes, err := Codec.Marshal(CodecVersion, addresses)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return u.db.Put(addressesKey, addressBytes)
|
||||
return u.db.Put(addressesKey, marshalAddresses(addresses))
|
||||
}
|
||||
|
||||
func (u *user) GetKey(address ids.ShortID) (*secp256k1.PrivateKey, error) {
|
||||
|
||||
@@ -8,22 +8,20 @@ import (
|
||||
|
||||
"github.com/luxfi/ids"
|
||||
"github.com/luxfi/math/set"
|
||||
"github.com/luxfi/node/vms/pcodecs"
|
||||
"github.com/luxfi/vm/chains/atomic"
|
||||
)
|
||||
|
||||
var _ AtomicUTXOManager = (*atomicUTXOManager)(nil)
|
||||
|
||||
type atomicUTXOManager struct {
|
||||
sm atomic.SharedMemory
|
||||
codec pcodecs.Manager
|
||||
sm atomic.SharedMemory
|
||||
}
|
||||
|
||||
func NewAtomicUTXOManager(sm atomic.SharedMemory, codec pcodecs.Manager) AtomicUTXOManager {
|
||||
return &atomicUTXOManager{
|
||||
sm: sm,
|
||||
codec: codec,
|
||||
}
|
||||
// NewAtomicUTXOManager returns an AtomicUTXOManager backed by ZAP-native
|
||||
// wire bytes in cross-chain shared memory (no codec.Manager). Callers rely
|
||||
// on this package's init() fx-aware UTXO.Unmarshal dispatch.
|
||||
func NewAtomicUTXOManager(sm atomic.SharedMemory) AtomicUTXOManager {
|
||||
return &atomicUTXOManager{sm: sm}
|
||||
}
|
||||
|
||||
func (a *atomicUTXOManager) GetAtomicUTXOs(
|
||||
@@ -64,7 +62,7 @@ func (a *atomicUTXOManager) GetAtomicUTXOs(
|
||||
utxos := make([]*UTXO, len(allUTXOBytes))
|
||||
for i, utxoBytes := range allUTXOBytes {
|
||||
utxo := &UTXO{}
|
||||
if _, err := a.codec.Unmarshal(utxoBytes, utxo); err != nil {
|
||||
if err := utxo.Unmarshal(utxoBytes); err != nil {
|
||||
return nil, ids.ShortID{}, ids.Empty, fmt.Errorf("error parsing UTXO: %w", err)
|
||||
}
|
||||
utxos[i] = utxo
|
||||
@@ -84,13 +82,12 @@ func (a *atomicUTXOManager) GetAtomicUTXOs(
|
||||
// * Any error that may have occurred upstream.
|
||||
func GetAtomicUTXOs(
|
||||
sharedMemory atomic.SharedMemory,
|
||||
codec pcodecs.Manager,
|
||||
chainID ids.ID,
|
||||
addrs set.Set[ids.ShortID],
|
||||
startAddr ids.ShortID,
|
||||
startUTXOID ids.ID,
|
||||
limit int,
|
||||
) ([]*UTXO, ids.ShortID, ids.ID, error) {
|
||||
manager := NewAtomicUTXOManager(sharedMemory, codec)
|
||||
manager := NewAtomicUTXOManager(sharedMemory)
|
||||
return manager.GetAtomicUTXOs(chainID, addrs, startAddr, startUTXOID, limit)
|
||||
}
|
||||
|
||||
@@ -8,14 +8,13 @@ import (
|
||||
|
||||
"github.com/luxfi/ids"
|
||||
"github.com/luxfi/math"
|
||||
"github.com/luxfi/node/vms/pcodecs"
|
||||
)
|
||||
|
||||
var ErrInsufficientFunds = errors.New("insufficient funds")
|
||||
|
||||
type FlowChecker struct {
|
||||
consumed, produced map[ids.ID]uint64
|
||||
errs pcodecs.Errs
|
||||
errs []error
|
||||
}
|
||||
|
||||
func NewFlowChecker() *FlowChecker {
|
||||
@@ -36,18 +35,20 @@ func (fc *FlowChecker) Produce(assetID ids.ID, amount uint64) {
|
||||
func (fc *FlowChecker) add(value map[ids.ID]uint64, assetID ids.ID, amount uint64) {
|
||||
var err error
|
||||
value[assetID], err = math.Add64(value[assetID], amount)
|
||||
fc.errs.Add(err)
|
||||
if err != nil {
|
||||
fc.errs = append(fc.errs, err)
|
||||
}
|
||||
}
|
||||
|
||||
func (fc *FlowChecker) Verify() error {
|
||||
if !fc.errs.Errored() {
|
||||
if len(fc.errs) == 0 {
|
||||
for assetID, producedAssetAmount := range fc.produced {
|
||||
consumedAssetAmount := fc.consumed[assetID]
|
||||
if producedAssetAmount > consumedAssetAmount {
|
||||
fc.errs.Add(ErrInsufficientFunds)
|
||||
fc.errs = append(fc.errs, ErrInsufficientFunds)
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
return fc.errs.Err
|
||||
return errors.Join(fc.errs...)
|
||||
}
|
||||
|
||||
@@ -0,0 +1,421 @@
|
||||
// Copyright (C) 2019-2026, Lux Industries Inc. All rights reserved.
|
||||
// See the file LICENSE for licensing terms.
|
||||
|
||||
package lux
|
||||
|
||||
// Native ZAP wire for the shared UTXO value tree: the struct IS the wire.
|
||||
// Each type Marshal()s to a single zap object (StartObject / Set* /
|
||||
// FinishAsRoot) and Unmarshal()s via offset accessors — no codec, no
|
||||
// pcodecs.Manager, no serialize-tag reflection, no codec-version prefix.
|
||||
//
|
||||
// The polymorphic inner Out/In (fx feature-extension outputs/inputs) is
|
||||
// composed, not re-encoded here: each fx primitive already owns a native
|
||||
// ZAP wire envelope via its Bytes() method (and the WrapOutputBytes /
|
||||
// wrapInputBytes fx-aware dispatchers reconstruct it). components/lux
|
||||
// stays fx-agnostic — it hand-rolls only the outer node envelope and
|
||||
// stores the fx child as an opaque bytes field. This is the same
|
||||
// (TypeKind, ShapeKind, ZAP-message) envelope the fx packages hit on the
|
||||
// P/X data path, so components/lux wire bytes stay consistent with the
|
||||
// canonical luxfi/utxo tree without collapsing the two type trees (#58).
|
||||
//
|
||||
// Object fixed sections (all offsets object-relative, little-endian):
|
||||
//
|
||||
// Asset assetID 32B @0 size 32
|
||||
// UTXOID txID 32B @0, index u32 @32 size 36
|
||||
// TransferableOutput assetID 32B @0, outBytes ptr @32 size 40
|
||||
// TransferableInput txID 32B @0, index u32 @32, assetID 32B @36, inBytes ptr @68 size 76
|
||||
// UTXO txID 32B @0, index u32 @32, assetID 32B @36, outBytes ptr @68 size 76
|
||||
// BaseTx networkID u32 @0, blockchainID 32B @4, outsLen ptr @36,
|
||||
// outsBlob ptr @44, insLen ptr @52, insBlob ptr @60, memo ptr @68 size 76
|
||||
// Metadata unsignedBytes ptr @0, signedBytes ptr @8 size 16
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
|
||||
"github.com/luxfi/utxo/secp256k1fx"
|
||||
"github.com/luxfi/zap"
|
||||
)
|
||||
|
||||
// ErrOutNotWireSerializable is returned when an in-memory Out/In is not a
|
||||
// known fx primitive carrying a native ZAP Bytes() adapter.
|
||||
var ErrOutNotWireSerializable = errors.New("lux: fx output/input type does not implement wire-serializable Bytes() []byte")
|
||||
|
||||
// wireSerializable is the minimal contract every fx primitive's wire.go
|
||||
// adapter satisfies for the polymorphic child payload.
|
||||
type wireSerializable interface{ Bytes() []byte }
|
||||
|
||||
func childBytes(v any) ([]byte, error) {
|
||||
ws, ok := v.(wireSerializable)
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("%w: %T", ErrOutNotWireSerializable, v)
|
||||
}
|
||||
return ws.Bytes(), nil
|
||||
}
|
||||
|
||||
// ---- fixed offsets / sizes ----
|
||||
|
||||
const (
|
||||
offAssetOnly = 0
|
||||
sizeAsset = 32
|
||||
|
||||
offUTXOIDTxID = 0
|
||||
offUTXOIDIndex = 32
|
||||
sizeUTXOID = 36
|
||||
|
||||
offTOAsset = 0
|
||||
offTOOut = 32
|
||||
sizeTO = 40
|
||||
|
||||
offTITxID = 0
|
||||
offTIIndex = 32
|
||||
offTIAsset = 36
|
||||
offTIIn = 68
|
||||
sizeTI = 76
|
||||
|
||||
offUTXOTxID = 0
|
||||
offUTXOIndex = 32
|
||||
offUTXOAsset = 36
|
||||
offUTXOOut = 68
|
||||
sizeUTXOObj = 76
|
||||
|
||||
offBTNetworkID = 0
|
||||
offBTBlockchainID = 4
|
||||
offBTOutsLen = 36
|
||||
offBTOutsBlob = 44
|
||||
offBTInsLen = 52
|
||||
offBTInsBlob = 60
|
||||
offBTMemo = 68
|
||||
sizeBT = 76
|
||||
|
||||
offMDUnsigned = 0
|
||||
offMDSigned = 8
|
||||
sizeMD = 16
|
||||
|
||||
idLen = 32
|
||||
itemLenStrid = 4 // uint32 element for the per-item length lists
|
||||
)
|
||||
|
||||
// ---- Asset ----
|
||||
|
||||
func (a *Asset) Marshal() ([]byte, error) {
|
||||
b := zap.NewBuilder(zap.HeaderSize + sizeAsset)
|
||||
ob := b.StartObject(sizeAsset)
|
||||
ob.SetBytesFixed(offAssetOnly, a.ID[:])
|
||||
ob.FinishAsRoot()
|
||||
return b.Finish(), nil
|
||||
}
|
||||
|
||||
func (a *Asset) Unmarshal(bytes []byte) error {
|
||||
msg, err := zap.Parse(bytes)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
copy(a.ID[:], msg.Root().BytesFixedSlice(offAssetOnly, idLen))
|
||||
return nil
|
||||
}
|
||||
|
||||
// ---- UTXOID ----
|
||||
|
||||
func (u *UTXOID) Marshal() ([]byte, error) {
|
||||
b := zap.NewBuilder(zap.HeaderSize + sizeUTXOID)
|
||||
ob := b.StartObject(sizeUTXOID)
|
||||
ob.SetBytesFixed(offUTXOIDTxID, u.TxID[:])
|
||||
ob.SetUint32(offUTXOIDIndex, u.OutputIndex)
|
||||
ob.FinishAsRoot()
|
||||
return b.Finish(), nil
|
||||
}
|
||||
|
||||
func (u *UTXOID) Unmarshal(bytes []byte) error {
|
||||
msg, err := zap.Parse(bytes)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
obj := msg.Root()
|
||||
copy(u.TxID[:], obj.BytesFixedSlice(offUTXOIDTxID, idLen))
|
||||
u.OutputIndex = obj.Uint32(offUTXOIDIndex)
|
||||
return nil
|
||||
}
|
||||
|
||||
// ---- TransferableOutput ----
|
||||
|
||||
func (out *TransferableOutput) Marshal() ([]byte, error) {
|
||||
if out == nil || out.Out == nil {
|
||||
return nil, ErrNilTransferableFxOutput
|
||||
}
|
||||
child, err := childBytes(out.Out)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
b := zap.NewBuilder(zap.HeaderSize + sizeTO + len(child) + 32)
|
||||
ob := b.StartObject(sizeTO)
|
||||
ob.SetBytesFixed(offTOAsset, out.Asset.ID[:])
|
||||
ob.SetBytes(offTOOut, child)
|
||||
ob.FinishAsRoot()
|
||||
return b.Finish(), nil
|
||||
}
|
||||
|
||||
func (out *TransferableOutput) Unmarshal(bytes []byte) error {
|
||||
msg, err := zap.Parse(bytes)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
obj := msg.Root()
|
||||
copy(out.Asset.ID[:], obj.BytesFixedSlice(offTOAsset, idLen))
|
||||
fxOut, err := WrapOutputBytes(obj.Bytes(offTOOut))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
to, ok := fxOut.(TransferableOut)
|
||||
if !ok {
|
||||
return fmt.Errorf("lux: decoded output %T is not a TransferableOut", fxOut)
|
||||
}
|
||||
out.Out = to
|
||||
return nil
|
||||
}
|
||||
|
||||
// ---- TransferableInput ----
|
||||
|
||||
func (in *TransferableInput) Marshal() ([]byte, error) {
|
||||
if in == nil || in.In == nil {
|
||||
return nil, ErrNilTransferableFxInput
|
||||
}
|
||||
child, err := childBytes(in.In)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
b := zap.NewBuilder(zap.HeaderSize + sizeTI + len(child) + 32)
|
||||
ob := b.StartObject(sizeTI)
|
||||
ob.SetBytesFixed(offTITxID, in.UTXOID.TxID[:])
|
||||
ob.SetUint32(offTIIndex, in.UTXOID.OutputIndex)
|
||||
ob.SetBytesFixed(offTIAsset, in.Asset.ID[:])
|
||||
ob.SetBytes(offTIIn, child)
|
||||
ob.FinishAsRoot()
|
||||
return b.Finish(), nil
|
||||
}
|
||||
|
||||
func (in *TransferableInput) Unmarshal(bytes []byte) error {
|
||||
msg, err := zap.Parse(bytes)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
obj := msg.Root()
|
||||
copy(in.UTXOID.TxID[:], obj.BytesFixedSlice(offTITxID, idLen))
|
||||
in.UTXOID.OutputIndex = obj.Uint32(offTIIndex)
|
||||
copy(in.Asset.ID[:], obj.BytesFixedSlice(offTIAsset, idLen))
|
||||
fxIn, err := wrapInputBytes(obj.Bytes(offTIIn))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
in.In = fxIn
|
||||
return nil
|
||||
}
|
||||
|
||||
// ---- UTXO ----
|
||||
|
||||
func (utxo *UTXO) Marshal() ([]byte, error) {
|
||||
if utxo == nil || utxo.Out == nil {
|
||||
return nil, errEmptyUTXO
|
||||
}
|
||||
child, err := childBytes(utxo.Out)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
b := zap.NewBuilder(zap.HeaderSize + sizeUTXOObj + len(child) + 32)
|
||||
ob := b.StartObject(sizeUTXOObj)
|
||||
ob.SetBytesFixed(offUTXOTxID, utxo.UTXOID.TxID[:])
|
||||
ob.SetUint32(offUTXOIndex, utxo.UTXOID.OutputIndex)
|
||||
ob.SetBytesFixed(offUTXOAsset, utxo.Asset.ID[:])
|
||||
ob.SetBytes(offUTXOOut, child)
|
||||
ob.FinishAsRoot()
|
||||
return b.Finish(), nil
|
||||
}
|
||||
|
||||
func (utxo *UTXO) Unmarshal(bytes []byte) error {
|
||||
msg, err := zap.Parse(bytes)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
obj := msg.Root()
|
||||
copy(utxo.UTXOID.TxID[:], obj.BytesFixedSlice(offUTXOTxID, idLen))
|
||||
utxo.UTXOID.OutputIndex = obj.Uint32(offUTXOIndex)
|
||||
copy(utxo.Asset.ID[:], obj.BytesFixedSlice(offUTXOAsset, idLen))
|
||||
fxOut, err := WrapOutputBytes(obj.Bytes(offUTXOOut))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
utxo.Out = fxOut
|
||||
return nil
|
||||
}
|
||||
|
||||
// ---- BaseTx ----
|
||||
|
||||
func (t *BaseTx) Marshal() ([]byte, error) {
|
||||
b := zap.NewBuilder(zap.HeaderSize + sizeBT + 256)
|
||||
|
||||
outsLenOff, outsLenCount, outsBlob, err := writeOutList(b, t.Outs)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
insLenOff, insLenCount, insBlob, err := writeInList(b, t.Ins)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
ob := b.StartObject(sizeBT)
|
||||
ob.SetUint32(offBTNetworkID, t.NetworkID)
|
||||
ob.SetBytesFixed(offBTBlockchainID, t.BlockchainID[:])
|
||||
ob.SetList(offBTOutsLen, outsLenOff, outsLenCount)
|
||||
ob.SetBytes(offBTOutsBlob, outsBlob)
|
||||
ob.SetList(offBTInsLen, insLenOff, insLenCount)
|
||||
ob.SetBytes(offBTInsBlob, insBlob)
|
||||
ob.SetBytes(offBTMemo, t.Memo)
|
||||
ob.FinishAsRoot()
|
||||
return b.Finish(), nil
|
||||
}
|
||||
|
||||
func (t *BaseTx) Unmarshal(bytes []byte) error {
|
||||
msg, err := zap.Parse(bytes)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
obj := msg.Root()
|
||||
t.NetworkID = obj.Uint32(offBTNetworkID)
|
||||
copy(t.BlockchainID[:], obj.BytesFixedSlice(offBTBlockchainID, idLen))
|
||||
if t.Outs, err = readOutList(obj, offBTOutsLen, offBTOutsBlob); err != nil {
|
||||
return err
|
||||
}
|
||||
if t.Ins, err = readInList(obj, offBTInsLen, offBTInsBlob); err != nil {
|
||||
return err
|
||||
}
|
||||
if m := obj.Bytes(offBTMemo); len(m) > 0 {
|
||||
t.Memo = append([]byte(nil), m...)
|
||||
} else {
|
||||
t.Memo = nil
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// writeOutList marshals each output and packs (per-item u32 length list,
|
||||
// concatenated blob). AddUint32 counts elements, so the list length is the
|
||||
// item count directly (unlike an AddBytes list, which counts bytes).
|
||||
func writeOutList(b *zap.Builder, outs []*TransferableOutput) (lenOff, lenCount int, blob []byte, err error) {
|
||||
if len(outs) == 0 {
|
||||
return 0, 0, nil, nil
|
||||
}
|
||||
lb := b.StartList(itemLenStrid)
|
||||
for i, o := range outs {
|
||||
raw, err := o.Marshal()
|
||||
if err != nil {
|
||||
return 0, 0, nil, fmt.Errorf("output %d: %w", i, err)
|
||||
}
|
||||
lb.AddUint32(uint32(len(raw)))
|
||||
blob = append(blob, raw...)
|
||||
}
|
||||
lenOff, lenCount = lb.Finish()
|
||||
return lenOff, lenCount, blob, nil
|
||||
}
|
||||
|
||||
func writeInList(b *zap.Builder, ins []*TransferableInput) (lenOff, lenCount int, blob []byte, err error) {
|
||||
if len(ins) == 0 {
|
||||
return 0, 0, nil, nil
|
||||
}
|
||||
lb := b.StartList(itemLenStrid)
|
||||
for i, in := range ins {
|
||||
raw, err := in.Marshal()
|
||||
if err != nil {
|
||||
return 0, 0, nil, fmt.Errorf("input %d: %w", i, err)
|
||||
}
|
||||
lb.AddUint32(uint32(len(raw)))
|
||||
blob = append(blob, raw...)
|
||||
}
|
||||
lenOff, lenCount = lb.Finish()
|
||||
return lenOff, lenCount, blob, nil
|
||||
}
|
||||
|
||||
func readOutList(obj zap.Object, lenPtrOff, blobPtrOff int) ([]*TransferableOutput, error) {
|
||||
lengths := obj.ListStride(lenPtrOff, itemLenStrid)
|
||||
n := lengths.Len()
|
||||
if n == 0 {
|
||||
return nil, nil
|
||||
}
|
||||
blob := obj.Bytes(blobPtrOff)
|
||||
out := make([]*TransferableOutput, n)
|
||||
cursor := 0
|
||||
for i := 0; i < n; i++ {
|
||||
size := int(lengths.Uint32(i))
|
||||
if size < 0 || cursor+size > len(blob) {
|
||||
return nil, fmt.Errorf("lux: output %d length %d overruns blob (%d)", i, size, len(blob))
|
||||
}
|
||||
o := &TransferableOutput{}
|
||||
if err := o.Unmarshal(blob[cursor : cursor+size]); err != nil {
|
||||
return nil, fmt.Errorf("lux: unmarshal output %d: %w", i, err)
|
||||
}
|
||||
out[i] = o
|
||||
cursor += size
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func readInList(obj zap.Object, lenPtrOff, blobPtrOff int) ([]*TransferableInput, error) {
|
||||
lengths := obj.ListStride(lenPtrOff, itemLenStrid)
|
||||
n := lengths.Len()
|
||||
if n == 0 {
|
||||
return nil, nil
|
||||
}
|
||||
blob := obj.Bytes(blobPtrOff)
|
||||
ins := make([]*TransferableInput, n)
|
||||
cursor := 0
|
||||
for i := 0; i < n; i++ {
|
||||
size := int(lengths.Uint32(i))
|
||||
if size < 0 || cursor+size > len(blob) {
|
||||
return nil, fmt.Errorf("lux: input %d length %d overruns blob (%d)", i, size, len(blob))
|
||||
}
|
||||
in := &TransferableInput{}
|
||||
if err := in.Unmarshal(blob[cursor : cursor+size]); err != nil {
|
||||
return nil, fmt.Errorf("lux: unmarshal input %d: %w", i, err)
|
||||
}
|
||||
ins[i] = in
|
||||
cursor += size
|
||||
}
|
||||
return ins, nil
|
||||
}
|
||||
|
||||
// ---- Metadata ----
|
||||
|
||||
func (md *Metadata) Marshal() ([]byte, error) {
|
||||
b := zap.NewBuilder(zap.HeaderSize + sizeMD + len(md.unsignedBytes) + len(md.bytes) + 32)
|
||||
ob := b.StartObject(sizeMD)
|
||||
ob.SetBytes(offMDUnsigned, md.unsignedBytes)
|
||||
ob.SetBytes(offMDSigned, md.bytes)
|
||||
ob.FinishAsRoot()
|
||||
return b.Finish(), nil
|
||||
}
|
||||
|
||||
func (md *Metadata) Unmarshal(bytes []byte) error {
|
||||
msg, err := zap.Parse(bytes)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
obj := msg.Root()
|
||||
unsigned := append([]byte(nil), obj.Bytes(offMDUnsigned)...)
|
||||
signed := append([]byte(nil), obj.Bytes(offMDSigned)...)
|
||||
md.Initialize(unsigned, signed)
|
||||
return nil
|
||||
}
|
||||
|
||||
// ---- OutputOwners path ----
|
||||
|
||||
// MarshalOwner is the ONE canonical byte encoding of an owner: the fx's
|
||||
// own native ZAP OutputOwners envelope (TypeKindReserved,
|
||||
// ShapeKindOutputOwners). Takes `any` to match the fx.Owned.Owners()
|
||||
// surface. Same wire the fx TransferOutput embeds — no second encoding.
|
||||
func MarshalOwner(o any) ([]byte, error) {
|
||||
return childBytes(o)
|
||||
}
|
||||
|
||||
// UnmarshalOwner is the exact inverse of MarshalOwner: parses the
|
||||
// canonical OutputOwners envelope back into *secp256k1fx.OutputOwners.
|
||||
func UnmarshalOwner(b []byte) (*secp256k1fx.OutputOwners, error) {
|
||||
return secp256k1fx.WrapOutputOwners(b)
|
||||
}
|
||||
@@ -0,0 +1,199 @@
|
||||
// Copyright (C) 2019-2026, Lux Industries Inc. All rights reserved.
|
||||
// See the file LICENSE for licensing terms.
|
||||
|
||||
package lux
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/luxfi/ids"
|
||||
"github.com/luxfi/utils"
|
||||
"github.com/luxfi/utxo/secp256k1fx"
|
||||
)
|
||||
|
||||
func testTransferOutput() *secp256k1fx.TransferOutput {
|
||||
// OutputOwners.Verify() requires sorted+unique addresses — the wire
|
||||
// encoding preserves order faithfully, so seed canonical (sorted) data.
|
||||
addrs := []ids.ShortID{ids.GenerateTestShortID(), ids.GenerateTestShortID()}
|
||||
utils.Sort(addrs)
|
||||
return &secp256k1fx.TransferOutput{
|
||||
Amt: 12345,
|
||||
OutputOwners: secp256k1fx.OutputOwners{
|
||||
Locktime: 67,
|
||||
Threshold: 1,
|
||||
Addrs: addrs,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func testTransferInput() *secp256k1fx.TransferInput {
|
||||
return &secp256k1fx.TransferInput{
|
||||
Amt: 99,
|
||||
Input: secp256k1fx.Input{SigIndices: []uint32{0, 2, 5}},
|
||||
}
|
||||
}
|
||||
|
||||
func TestAssetRoundTrip(t *testing.T) {
|
||||
require := require.New(t)
|
||||
a := &Asset{ID: ids.GenerateTestID()}
|
||||
|
||||
b, err := a.Marshal()
|
||||
require.NoError(err)
|
||||
|
||||
got := &Asset{}
|
||||
require.NoError(got.Unmarshal(b))
|
||||
require.Equal(a.ID, got.ID)
|
||||
}
|
||||
|
||||
func TestUTXOIDRoundTrip(t *testing.T) {
|
||||
require := require.New(t)
|
||||
u := &UTXOID{TxID: ids.GenerateTestID(), OutputIndex: 7}
|
||||
|
||||
b, err := u.Marshal()
|
||||
require.NoError(err)
|
||||
|
||||
got := &UTXOID{}
|
||||
require.NoError(got.Unmarshal(b))
|
||||
require.Equal(u.TxID, got.TxID)
|
||||
require.Equal(u.OutputIndex, got.OutputIndex)
|
||||
}
|
||||
|
||||
func TestTransferableOutputRoundTrip(t *testing.T) {
|
||||
require := require.New(t)
|
||||
out := &TransferableOutput{
|
||||
Asset: Asset{ID: ids.GenerateTestID()},
|
||||
Out: testTransferOutput(),
|
||||
}
|
||||
|
||||
b, err := out.Marshal()
|
||||
require.NoError(err)
|
||||
|
||||
got := &TransferableOutput{}
|
||||
require.NoError(got.Unmarshal(b))
|
||||
require.Equal(out.Asset.ID, got.Asset.ID)
|
||||
require.Equal(out.Out, got.Out)
|
||||
require.NoError(got.Verify())
|
||||
|
||||
// Wire bytes are stable across a re-marshal of the decoded value.
|
||||
b2, err := got.Marshal()
|
||||
require.NoError(err)
|
||||
require.Equal(b, b2)
|
||||
}
|
||||
|
||||
func TestTransferableInputRoundTrip(t *testing.T) {
|
||||
require := require.New(t)
|
||||
in := &TransferableInput{
|
||||
UTXOID: UTXOID{TxID: ids.GenerateTestID(), OutputIndex: 3},
|
||||
Asset: Asset{ID: ids.GenerateTestID()},
|
||||
In: testTransferInput(),
|
||||
}
|
||||
|
||||
b, err := in.Marshal()
|
||||
require.NoError(err)
|
||||
|
||||
got := &TransferableInput{}
|
||||
require.NoError(got.Unmarshal(b))
|
||||
require.Equal(in.UTXOID.TxID, got.UTXOID.TxID)
|
||||
require.Equal(in.UTXOID.OutputIndex, got.UTXOID.OutputIndex)
|
||||
require.Equal(in.Asset.ID, got.Asset.ID)
|
||||
require.Equal(in.In, got.In)
|
||||
require.NoError(got.Verify())
|
||||
}
|
||||
|
||||
func TestUTXORoundTrip(t *testing.T) {
|
||||
require := require.New(t)
|
||||
utxo := &UTXO{
|
||||
UTXOID: UTXOID{TxID: ids.GenerateTestID(), OutputIndex: 4},
|
||||
Asset: Asset{ID: ids.GenerateTestID()},
|
||||
Out: testTransferOutput(),
|
||||
}
|
||||
|
||||
b, err := utxo.Marshal()
|
||||
require.NoError(err)
|
||||
|
||||
got := &UTXO{}
|
||||
require.NoError(got.Unmarshal(b))
|
||||
require.Equal(utxo.UTXOID.TxID, got.UTXOID.TxID)
|
||||
require.Equal(utxo.UTXOID.OutputIndex, got.UTXOID.OutputIndex)
|
||||
require.Equal(utxo.Asset.ID, got.Asset.ID)
|
||||
require.Equal(utxo.Out, got.Out)
|
||||
require.NoError(got.Verify())
|
||||
|
||||
// InputID (TxID.Prefix(index)) is preserved end-to-end.
|
||||
require.Equal(utxo.InputID(), got.InputID())
|
||||
|
||||
b2, err := got.Marshal()
|
||||
require.NoError(err)
|
||||
require.Equal(b, b2)
|
||||
}
|
||||
|
||||
func TestBaseTxRoundTrip(t *testing.T) {
|
||||
require := require.New(t)
|
||||
tx := &BaseTx{
|
||||
NetworkID: 96369,
|
||||
BlockchainID: ids.GenerateTestID(),
|
||||
Outs: []*TransferableOutput{
|
||||
{Asset: Asset{ID: ids.GenerateTestID()}, Out: testTransferOutput()},
|
||||
},
|
||||
Ins: []*TransferableInput{
|
||||
{
|
||||
UTXOID: UTXOID{TxID: ids.GenerateTestID(), OutputIndex: 1},
|
||||
Asset: Asset{ID: ids.GenerateTestID()},
|
||||
In: testTransferInput(),
|
||||
},
|
||||
},
|
||||
Memo: []byte("round-trip"),
|
||||
}
|
||||
|
||||
b, err := tx.Marshal()
|
||||
require.NoError(err)
|
||||
|
||||
got := &BaseTx{}
|
||||
require.NoError(got.Unmarshal(b))
|
||||
require.Equal(tx.NetworkID, got.NetworkID)
|
||||
require.Equal(tx.BlockchainID, got.BlockchainID)
|
||||
require.Len(got.Outs, 1)
|
||||
require.Len(got.Ins, 1)
|
||||
require.Equal(tx.Outs[0].Asset.ID, got.Outs[0].Asset.ID)
|
||||
require.Equal(tx.Outs[0].Out, got.Outs[0].Out)
|
||||
require.Equal(tx.Ins[0].In, got.Ins[0].In)
|
||||
require.Equal(tx.Memo, got.Memo)
|
||||
}
|
||||
|
||||
func TestMetadataRoundTrip(t *testing.T) {
|
||||
require := require.New(t)
|
||||
md := &Metadata{}
|
||||
md.Initialize([]byte("unsigned-bytes"), []byte("signed-bytes"))
|
||||
|
||||
b, err := md.Marshal()
|
||||
require.NoError(err)
|
||||
|
||||
got := &Metadata{}
|
||||
require.NoError(got.Unmarshal(b))
|
||||
require.Equal(md.Bytes(), got.Bytes())
|
||||
require.Equal(md.SignedBytes(), got.SignedBytes())
|
||||
require.Equal(md.ID(), got.ID())
|
||||
require.NoError(got.Verify())
|
||||
}
|
||||
|
||||
// TestOutputOwnersRoundTrip exercises the standalone OutputOwners path
|
||||
// (MarshalOwner / UnmarshalOwner) shared with off-tx owner identity keys.
|
||||
func TestOutputOwnersRoundTrip(t *testing.T) {
|
||||
require := require.New(t)
|
||||
owners := &secp256k1fx.OutputOwners{
|
||||
Locktime: 5,
|
||||
Threshold: 1,
|
||||
Addrs: []ids.ShortID{ids.GenerateTestShortID()},
|
||||
}
|
||||
|
||||
b, err := MarshalOwner(owners)
|
||||
require.NoError(err)
|
||||
|
||||
got, err := UnmarshalOwner(b)
|
||||
require.NoError(err)
|
||||
require.Equal(owners.Locktime, got.Locktime)
|
||||
require.Equal(owners.Threshold, got.Threshold)
|
||||
require.Equal(owners.Addrs, got.Addrs)
|
||||
}
|
||||
@@ -6,9 +6,9 @@ package lux
|
||||
import (
|
||||
"errors"
|
||||
|
||||
"github.com/luxfi/crypto/hash"
|
||||
"github.com/luxfi/ids"
|
||||
"github.com/luxfi/node/vms/components/verify"
|
||||
"github.com/luxfi/crypto/hash"
|
||||
)
|
||||
|
||||
var (
|
||||
|
||||
@@ -3,10 +3,6 @@
|
||||
|
||||
package lux
|
||||
|
||||
const (
|
||||
codecVersion = 0
|
||||
)
|
||||
|
||||
// Addressable is the interface a feature extension must provide to be able to
|
||||
// be tracked as a part of the utxo set for a set of addresses
|
||||
type Addressable interface {
|
||||
|
||||
@@ -11,7 +11,6 @@ import (
|
||||
"github.com/luxfi/crypto/secp256k1"
|
||||
"github.com/luxfi/ids"
|
||||
"github.com/luxfi/node/vms/components/verify"
|
||||
"github.com/luxfi/node/vms/pcodecs"
|
||||
"github.com/luxfi/runtime"
|
||||
"github.com/luxfi/utils"
|
||||
)
|
||||
@@ -87,9 +86,19 @@ func (out *TransferableOutput) Verify() error {
|
||||
}
|
||||
}
|
||||
|
||||
// wireBytesOrNil returns the native ZAP wire envelope of a TransferableOut
|
||||
// when the inner fx primitive carries a Bytes() adapter (every production
|
||||
// fx does). This is the single source of truth for canonical ordering —
|
||||
// the same bytes that hit disk and the wire, no separate codec marshal.
|
||||
func wireBytesOrNil(out TransferableOut) []byte {
|
||||
if ws, ok := out.(interface{ Bytes() []byte }); ok {
|
||||
return ws.Bytes()
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type innerSortTransferableOutputs struct {
|
||||
outs []*TransferableOutput
|
||||
codec pcodecs.Manager
|
||||
outs []*TransferableOutput
|
||||
}
|
||||
|
||||
func (outs *innerSortTransferableOutputs) Less(i, j int) bool {
|
||||
@@ -106,15 +115,7 @@ func (outs *innerSortTransferableOutputs) Less(i, j int) bool {
|
||||
return false
|
||||
}
|
||||
|
||||
iBytes, err := outs.codec.Marshal(codecVersion, &iOut.Out)
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
jBytes, err := outs.codec.Marshal(codecVersion, &jOut.Out)
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
return bytes.Compare(iBytes, jBytes) == -1
|
||||
return bytes.Compare(wireBytesOrNil(iOut.Out), wireBytesOrNil(jOut.Out)) == -1
|
||||
}
|
||||
|
||||
func (outs *innerSortTransferableOutputs) Len() int {
|
||||
@@ -126,14 +127,15 @@ func (outs *innerSortTransferableOutputs) Swap(i, j int) {
|
||||
o[j], o[i] = o[i], o[j]
|
||||
}
|
||||
|
||||
// SortTransferableOutputs sorts output objects
|
||||
func SortTransferableOutputs(outs []*TransferableOutput, c pcodecs.Manager) {
|
||||
sort.Sort(&innerSortTransferableOutputs{outs: outs, codec: c})
|
||||
// SortTransferableOutputs sorts output objects by (AssetID, inner-output
|
||||
// ZAP wire bytes). ZAP-native — no codec.Manager needed.
|
||||
func SortTransferableOutputs(outs []*TransferableOutput) {
|
||||
sort.Sort(&innerSortTransferableOutputs{outs: outs})
|
||||
}
|
||||
|
||||
// IsSortedTransferableOutputs returns true if output objects are sorted
|
||||
func IsSortedTransferableOutputs(outs []*TransferableOutput, c pcodecs.Manager) bool {
|
||||
return sort.IsSorted(&innerSortTransferableOutputs{outs: outs, codec: c})
|
||||
func IsSortedTransferableOutputs(outs []*TransferableOutput) bool {
|
||||
return sort.IsSorted(&innerSortTransferableOutputs{outs: outs})
|
||||
}
|
||||
|
||||
type TransferableInput struct {
|
||||
@@ -211,7 +213,6 @@ func VerifyTx(
|
||||
feeAssetID ids.ID,
|
||||
allIns [][]*TransferableInput,
|
||||
allOuts [][]*TransferableOutput,
|
||||
c pcodecs.Manager,
|
||||
) error {
|
||||
fc := NewFlowChecker()
|
||||
|
||||
@@ -225,7 +226,7 @@ func VerifyTx(
|
||||
}
|
||||
fc.Produce(out.AssetID(), out.Output().Amount())
|
||||
}
|
||||
if !IsSortedTransferableOutputs(outs, c) {
|
||||
if !IsSortedTransferableOutputs(outs) {
|
||||
return ErrOutputsNotSorted
|
||||
}
|
||||
}
|
||||
|
||||
@@ -176,3 +176,54 @@ func wrapOutput(b []byte, tk wire.TypeKind, sk wire.ShapeKind) (verify.State, er
|
||||
}
|
||||
return nil, fmt.Errorf("zap utxo dispatch: unknown (TypeKind=0x%02x, ShapeKind=0x%02x)", tk, sk)
|
||||
}
|
||||
|
||||
// WrapInputBytes is the public entry to the fx-aware input dispatcher — the
|
||||
// input-side counterpart of WrapOutputBytes. It reconstructs the polymorphic
|
||||
// fx Input from its wire envelope; the concrete type (e.g.
|
||||
// *secp256k1fx.TransferInput) also satisfies luxfi/utxo's TransferableIn, so
|
||||
// consumers holding the utxo type tree (xvm/txs) can type-assert across.
|
||||
func WrapInputBytes(b []byte) (TransferableIn, error) {
|
||||
return wrapInputBytes(b)
|
||||
}
|
||||
|
||||
// wrapInputBytes is the input-side counterpart of wrapOutput: it
|
||||
// reconstructs a TransferableIn from its fx wire envelope, dispatching on
|
||||
// the (TypeKind, ShapeKind) discriminator. Each branch calls exactly one
|
||||
// fx-package WrapTransferInput / WrapAttestationInput — the fx primitive
|
||||
// owns its own wire; components/lux stays fx-agnostic. Used by
|
||||
// TransferableInput.Unmarshal.
|
||||
func wrapInputBytes(b []byte) (TransferableIn, error) {
|
||||
tk, sk, err := wire.PeekDiscriminator(b)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("peek input discriminator: %w", err)
|
||||
}
|
||||
switch tk {
|
||||
case wire.TypeKindSecp256k1:
|
||||
if sk == wire.ShapeKindTransferInput {
|
||||
return secp256k1fx.WrapTransferInput(b)
|
||||
}
|
||||
case wire.TypeKindMLDSA:
|
||||
if sk == wire.ShapeKindTransferInput {
|
||||
return mldsafx.WrapTransferInput(b)
|
||||
}
|
||||
case wire.TypeKindSLHDSA:
|
||||
if sk == wire.ShapeKindTransferInput {
|
||||
return slhdsafx.WrapTransferInput(b)
|
||||
}
|
||||
case wire.TypeKindEd25519:
|
||||
if sk == wire.ShapeKindTransferInput {
|
||||
return ed25519fx.WrapTransferInput(b)
|
||||
}
|
||||
case wire.TypeKindSecp256r1:
|
||||
if sk == wire.ShapeKindTransferInput {
|
||||
return secp256r1fx.WrapTransferInput(b)
|
||||
}
|
||||
case wire.TypeKindSchnorr:
|
||||
if sk == wire.ShapeKindTransferInput {
|
||||
return schnorrfx.WrapTransferInput(b)
|
||||
}
|
||||
}
|
||||
// bls12381fx attestations are not value-transfer inputs (no Amount),
|
||||
// so they never appear as a TransferableIn.
|
||||
return nil, fmt.Errorf("zap input dispatch: unknown (TypeKind=0x%02x, ShapeKind=0x%02x)", tk, sk)
|
||||
}
|
||||
|
||||
@@ -13,7 +13,6 @@ import (
|
||||
"github.com/luxfi/metric"
|
||||
"github.com/luxfi/node/cache"
|
||||
"github.com/luxfi/node/cache/metercacher"
|
||||
"github.com/luxfi/node/vms/pcodecs"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -72,8 +71,6 @@ type UTXOWriter interface {
|
||||
}
|
||||
|
||||
type utxoState struct {
|
||||
codec pcodecs.Manager
|
||||
|
||||
// UTXO ID -> *UTXO. If the *UTXO is nil the UTXO doesn't exist
|
||||
utxoCache cache.Cacher[ids.ID, *UTXO]
|
||||
utxoDB database.Database
|
||||
@@ -85,14 +82,16 @@ type utxoState struct {
|
||||
checksum ids.ID
|
||||
}
|
||||
|
||||
// NewUTXOState returns a UTXOState backed by ZAP-native wire bytes (no
|
||||
// codec.Manager): UTXO.Marshal on write, UTXO.Unmarshal on read. The
|
||||
// fx-aware output dispatch that reconstructs the polymorphic Out is wired
|
||||
// via this package's init() (utxo_parser.go) plus the stakeable
|
||||
// LockedOutputHandler registration.
|
||||
func NewUTXOState(
|
||||
db database.Database,
|
||||
codec pcodecs.Manager,
|
||||
trackChecksum bool,
|
||||
) (UTXOState, error) {
|
||||
s := &utxoState{
|
||||
codec: codec,
|
||||
|
||||
utxoCache: &cache.LRU[ids.ID, *UTXO]{Size: utxoCacheSize},
|
||||
utxoDB: prefixdb.New(utxoPrefix, db),
|
||||
|
||||
@@ -106,7 +105,6 @@ func NewUTXOState(
|
||||
|
||||
func NewMeteredUTXOState(
|
||||
db database.Database,
|
||||
codec pcodecs.Manager,
|
||||
metrics metric.Registerer,
|
||||
trackChecksum bool,
|
||||
) (UTXOState, error) {
|
||||
@@ -135,8 +133,6 @@ func NewMeteredUTXOState(
|
||||
}
|
||||
|
||||
s := &utxoState{
|
||||
codec: codec,
|
||||
|
||||
utxoCache: utxoCache,
|
||||
utxoDB: prefixdb.New(utxoPrefix, db),
|
||||
|
||||
@@ -165,9 +161,9 @@ func (s *utxoState) GetUTXO(utxoID ids.ID) (*UTXO, error) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// The key was in the database
|
||||
// The key was in the database — ZAP-native decode (fx-aware Out dispatch).
|
||||
utxo := &UTXO{}
|
||||
if _, err := s.codec.Unmarshal(bytes, utxo); err != nil {
|
||||
if err := utxo.Unmarshal(bytes); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@@ -176,7 +172,9 @@ func (s *utxoState) GetUTXO(utxoID ids.ID) (*UTXO, error) {
|
||||
}
|
||||
|
||||
func (s *utxoState) PutUTXO(utxo *UTXO) error {
|
||||
utxoBytes, err := s.codec.Marshal(codecVersion, utxo)
|
||||
// ZAP-native: the same wire bytes flow to disk and across chains. No
|
||||
// separate codec.Marshal step.
|
||||
utxoBytes, err := utxo.Marshal()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -1,32 +0,0 @@
|
||||
// Copyright (C) 2019-2025, Lux Industries Inc. All rights reserved.
|
||||
// See the file LICENSE for licensing terms.
|
||||
|
||||
package message
|
||||
|
||||
import (
|
||||
"github.com/luxfi/constants"
|
||||
"github.com/luxfi/node/vms/pcodecs"
|
||||
"github.com/luxfi/utils"
|
||||
)
|
||||
|
||||
const (
|
||||
codecVersion = 0
|
||||
maxMessageSize = 512 * constants.KiB
|
||||
maxSliceLen = maxMessageSize
|
||||
)
|
||||
|
||||
// Codec does serialization and deserialization
|
||||
var c pcodecs.Manager
|
||||
|
||||
func init() {
|
||||
c = pcodecs.NewManager(maxMessageSize)
|
||||
lc := pcodecs.NewLinearCodec()
|
||||
|
||||
err := utils.Err(
|
||||
lc.RegisterType(&Tx{}),
|
||||
c.RegisterCodec(codecVersion, lc),
|
||||
)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
@@ -3,16 +3,45 @@
|
||||
|
||||
package message
|
||||
|
||||
// Native ZAP wire for gossip messages: the struct IS the wire. Each message
|
||||
// is one zap object keyed by a 1-byte kind discriminator at object offset 0 —
|
||||
// the whole dispatch. Parse reads it and returns the typed message. There is
|
||||
// no codec, no version prefix, no slot map.
|
||||
//
|
||||
// Object fixed section (offsets object-relative, little-endian):
|
||||
//
|
||||
// kind u8 @ 0 tx=1
|
||||
// Tx bytes @ 1 ptr to the gossiped tx bytes (Tx only)
|
||||
|
||||
import (
|
||||
"errors"
|
||||
|
||||
"github.com/luxfi/ids"
|
||||
"github.com/luxfi/zap"
|
||||
)
|
||||
|
||||
var (
|
||||
_ Message = (*Tx)(nil)
|
||||
|
||||
ErrUnexpectedCodecVersion = errors.New("unexpected codec version")
|
||||
// ErrUnknownMessageKind is returned when the 1-byte kind discriminator at
|
||||
// object offset 0 does not correspond to a known message type.
|
||||
ErrUnknownMessageKind = errors.New("unknown message kind")
|
||||
)
|
||||
|
||||
// msgKind is the 1-byte discriminator at object offset 0 of every message
|
||||
// buffer. Parse reads it and dispatches to the typed message.
|
||||
type msgKind uint8
|
||||
|
||||
const (
|
||||
msgKindReserved msgKind = iota
|
||||
msgKindTx
|
||||
)
|
||||
|
||||
// Fixed wire offsets (object-relative) and object size for a Tx message.
|
||||
const (
|
||||
offMsgKind = 0
|
||||
offMsgTx = 1
|
||||
sizeMsgTx = 9 // kind(1) + bytes ptr(8)
|
||||
)
|
||||
|
||||
type Message interface {
|
||||
@@ -26,6 +55,11 @@ type Message interface {
|
||||
//
|
||||
// Bytes should only be called after being initialized
|
||||
Bytes() []byte
|
||||
|
||||
// marshal encodes the message to its native ZAP wire form (kind byte at
|
||||
// object offset 0). Each concrete type writes its own kind — this is the
|
||||
// whole dispatch, no codec.
|
||||
marshal() ([]byte, error)
|
||||
}
|
||||
|
||||
type message []byte
|
||||
@@ -39,20 +73,26 @@ func (m *message) Bytes() []byte {
|
||||
}
|
||||
|
||||
func Parse(bytes []byte) (Message, error) {
|
||||
var msg Message
|
||||
version, err := c.Unmarshal(bytes, &msg)
|
||||
zmsg, err := zap.Parse(bytes)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if version != codecVersion {
|
||||
return nil, ErrUnexpectedCodecVersion
|
||||
obj := zmsg.Root()
|
||||
switch msgKind(obj.Uint8(offMsgKind)) {
|
||||
case msgKindTx:
|
||||
msg := &Tx{Tx: append([]byte(nil), obj.Bytes(offMsgTx)...)}
|
||||
msg.initialize(bytes)
|
||||
return msg, nil
|
||||
default:
|
||||
return nil, ErrUnknownMessageKind
|
||||
}
|
||||
msg.initialize(bytes)
|
||||
return msg, nil
|
||||
}
|
||||
|
||||
func Build(msg Message) ([]byte, error) {
|
||||
bytes, err := c.Marshal(codecVersion, &msg)
|
||||
bytes, err := msg.marshal()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
msg.initialize(bytes)
|
||||
return bytes, err
|
||||
return bytes, nil
|
||||
}
|
||||
|
||||
@@ -3,16 +3,30 @@
|
||||
|
||||
package message
|
||||
|
||||
import "github.com/luxfi/ids"
|
||||
import (
|
||||
"github.com/luxfi/ids"
|
||||
"github.com/luxfi/zap"
|
||||
)
|
||||
|
||||
var _ Message = (*Tx)(nil)
|
||||
|
||||
type Tx struct {
|
||||
message
|
||||
|
||||
Tx []byte `serialize:"true"`
|
||||
Tx []byte
|
||||
}
|
||||
|
||||
func (msg *Tx) Handle(handler Handler, nodeID ids.NodeID, requestID uint32) error {
|
||||
return handler.HandleTx(nodeID, requestID, msg)
|
||||
}
|
||||
|
||||
// marshal writes the Tx message as one native ZAP object: kind byte at
|
||||
// offset 0, gossiped tx bytes at offset 1.
|
||||
func (msg *Tx) marshal() ([]byte, error) {
|
||||
b := zap.NewBuilder(zap.HeaderSize + sizeMsgTx + len(msg.Tx))
|
||||
ob := b.StartObject(sizeMsgTx)
|
||||
ob.SetUint8(offMsgKind, uint8(msgKindTx))
|
||||
ob.SetBytes(offMsgTx, msg.Tx)
|
||||
ob.FinishAsRoot()
|
||||
return b.Finish(), nil
|
||||
}
|
||||
|
||||
+1
-1
@@ -347,7 +347,7 @@ func decodeSignatures(data []byte) ([][]byte, error) {
|
||||
|
||||
// ---------------- Helpers ----------------
|
||||
|
||||
func writeIDInto(ob *zap.ObjectBuilder, off int, id ids.ID) {
|
||||
func writeIDInto(ob zap.ObjectBuilder, off int, id ids.ID) {
|
||||
for i := 0; i < 32; i++ {
|
||||
ob.SetUint8(off+i, id[i])
|
||||
}
|
||||
|
||||
@@ -1,40 +0,0 @@
|
||||
// Copyright (C) 2019-2025, Lux Industries Inc. All rights reserved.
|
||||
// See the file LICENSE for licensing terms.
|
||||
|
||||
// Package dexvm re-exports the canonical DEX VM from
|
||||
// github.com/luxfi/chains/dexvm so existing callers that imported
|
||||
// github.com/luxfi/node/vms/dexvm pre-extraction keep working
|
||||
// without source-level changes.
|
||||
//
|
||||
// New code should import the canonical path:
|
||||
// "github.com/luxfi/chains/dexvm"
|
||||
//
|
||||
// This package is a thin backward-compatibility alias. The underlying
|
||||
// chains/dexvm is the pure-Go stateless atomic proxy (zero private deps).
|
||||
// Unlike the always-on genesis VMs, dexvm is registered in OptionalVMs and is
|
||||
// NFT-gated (see node/vms.go:118, RequiredNFT "dex-operator"): a node only
|
||||
// tracks/validates the D-Chain when the network has configured that operator
|
||||
// collection, so it is plugin-loaded on demand, not linked unconditionally.
|
||||
package dexvm
|
||||
|
||||
import (
|
||||
"github.com/luxfi/chains/dexvm"
|
||||
)
|
||||
|
||||
// Re-export the public surface.
|
||||
type (
|
||||
Block = dexvm.Block
|
||||
ChainVM = dexvm.ChainVM
|
||||
Factory = dexvm.Factory
|
||||
OrderKey = dexvm.OrderKey
|
||||
DexVertex = dexvm.DexVertex
|
||||
Status = dexvm.Status
|
||||
)
|
||||
|
||||
var (
|
||||
// VMID identifies the canonical primary-network D-Chain VM.
|
||||
VMID = dexvm.VMID
|
||||
|
||||
// NewChainVM constructs a fresh DEX chain VM.
|
||||
NewChainVM = dexvm.NewChainVM
|
||||
)
|
||||
@@ -17,7 +17,7 @@ import (
|
||||
|
||||
safemath "github.com/luxfi/math"
|
||||
"github.com/luxfi/node/vms/components/gas"
|
||||
"github.com/luxfi/node/vms/pcodecs"
|
||||
"github.com/luxfi/utils/wrappers"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -35,7 +35,7 @@ const (
|
||||
MinMaxPerSecond = MinTargetPerSecond * TargetToMax
|
||||
MinMaxCapacity = MinMaxPerSecond * TimeToFillCapacity
|
||||
|
||||
StateSize = 3 * pcodecs.LongLen
|
||||
StateSize = 3 * wrappers.LongLen
|
||||
|
||||
maxTargetExcess = 1_024_950_627 // TargetConversion * ln(MaxUint64 / MinTargetPerSecond) + 1
|
||||
)
|
||||
@@ -63,9 +63,9 @@ func ParseState(bytes []byte) (State, error) {
|
||||
return State{
|
||||
Gas: gas.State{
|
||||
Capacity: gas.Gas(binary.BigEndian.Uint64(bytes)),
|
||||
Excess: gas.Gas(binary.BigEndian.Uint64(bytes[pcodecs.LongLen:])),
|
||||
Excess: gas.Gas(binary.BigEndian.Uint64(bytes[wrappers.LongLen:])),
|
||||
},
|
||||
TargetExcess: gas.Gas(binary.BigEndian.Uint64(bytes[2*pcodecs.LongLen:])),
|
||||
TargetExcess: gas.Gas(binary.BigEndian.Uint64(bytes[2*wrappers.LongLen:])),
|
||||
}, nil
|
||||
}
|
||||
|
||||
@@ -172,8 +172,8 @@ func (s *State) UpdateTargetExcess(desiredTargetExcess gas.Gas) {
|
||||
func (s *State) Bytes() []byte {
|
||||
bytes := make([]byte, StateSize)
|
||||
binary.BigEndian.PutUint64(bytes, uint64(s.Gas.Capacity))
|
||||
binary.BigEndian.PutUint64(bytes[pcodecs.LongLen:], uint64(s.Gas.Excess))
|
||||
binary.BigEndian.PutUint64(bytes[2*pcodecs.LongLen:], uint64(s.TargetExcess))
|
||||
binary.BigEndian.PutUint64(bytes[wrappers.LongLen:], uint64(s.Gas.Excess))
|
||||
binary.BigEndian.PutUint64(bytes[2*wrappers.LongLen:], uint64(s.TargetExcess))
|
||||
return bytes
|
||||
}
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user