Skip to content

fix: cleaner install output + more reliable first-try quorum#124

Merged
Reiers merged 1 commit into
mainfrom
fix/bootstrap-ux-gateway-and-settle
Jul 12, 2026
Merged

fix: cleaner install output + more reliable first-try quorum#124
Reiers merged 1 commit into
mainfrom
fix/bootstrap-ux-gateway-and-settle

Conversation

@Reiers

@Reiers Reiers commented Jul 12, 2026

Copy link
Copy Markdown
Owner

Three small changes to the bootstrap-quorum path (init, doctor, repair) that take calibration first-try success from ~2 of 3 attempts to ~4 of 5 without adding infrastructure. Motivated by the 2026-07-11 smoke run where the gateway probe printed a scary red ✗ on every install and one in three cold boots on calibration needed a manual re-run.

What changes

1. Elide the Lantern gateway from the F3-cert probe by default.

gateway.lantern.reiers.io serves /state/root and /block/<cid>, not the Filecoin JSON-RPC surface, so probing it as an rpcSource always returned HTTP 404. Every install printed:

✗ [lantern-gateway] lantern-gateway:https://gateway.lantern.reiers.io — rpc https://gateway.lantern.reiers.io: HTTP 404: 404 page not found

even when the quorum succeeded on other sources. Made the installer look broken; the gateway was non-counting by default anyway (KindLanternGateway is excluded from the quorum tally unless --count-gateway), so the math is unaffected. --count-gateway now also gates inclusion in the source list, not just counting.

The gateway keeps its real job at runtime: cold-block + state-root fallback via net/hsync. When a future gateway release proxies Filecoin.F3GetLatestCertificate, operators can flip --count-gateway back on.

2. Raise --libp2p-settle default from 8s to 15s.

libp2p bootstrap connections often needed >8s to finish dialing before F3 cert-exchange could stream. The probe was firing against peers that weren't reachable yet and counting them as failures. 15s is a small install-time cost that meaningfully improves first-try reliability, especially on calibration where the peer set is small and any single flake matters.

3. Auto-retry the probe once after a 6s backoff.

runBootstrapQuorum now retries when the first attempt fails with ErrQuorumNotReached or ErrInsufficientSources. Second failure remains fatal. Only quorum-shape errors trigger the retry; context cancellation and arg errors bail immediately. Log line: retry 2/2: transient peer flake on first pass, probing again.... Applies to init, doctor, and repair via the shared runner.

Evidence

5 fresh lantern init attempts on darwin/arm64 against calibration, HEAD of this branch:

Attempt First pass After retry
1 3/3 ✓
2 3/3 ✓
3 2/3 ✗ 2/3 ✗ (rare double-flake, same 2 peers agreed both passes)
4 3/3 ✓
5 2/3 ✗ 3/3 ✓ (retry recovered)

Baseline before this PR: ~2 of 3 attempts pass first try. After: ~4 of 5 pass without operator intervention. Attempt 3 is a genuine ecosystem limit (calibration exposes only 1 public forest + ~4 libp2p peers, and when >2 peers flake and Glif hiccups on both passes we genuinely can't reach 3/3 — the right long-term fix is more calibration sources, not more retries).

Output diff:

▸ Bootstrap quorum — establishing chain head from independent sources
    Required agreement: 3 sources, timeout 2m0s
    libp2p host: peer=12D3KooWMSJfN1SE... (3 connections)
-   6 sources assembled (libp2p=4, forest=1, user=0, gateway=1)
+   5 sources assembled (libp2p=4, forest=1, user=0, gateway=0)
  ✓ [libp2p] ...
- ✗ [lantern-gateway] lantern-gateway:https://gateway.lantern.reiers.io — rpc ...: HTTP 404: 404 page not found
  ✓ [forest] ...

  ✓ Quorum reached (3/3 agree): instance=... epoch=... state=...

Not in scope

  • Adding more calibration public sources (right long-term move, needs research on independent forest archives).
  • Rebuilding the gateway server to proxy Filecoin.F3GetLatestCertificate (would let --count-gateway actually work; separate PR + gateway redeploy).
  • Bootstrap peer list culling (2 mainnet peers observed non-responsive in the 2026-07-11 smoke; needs independent verification before pruning canonical lists).

Tests

  • go test ./chain/bootstrap/... ./cmd/lantern/... green.
  • No test files reference LanternGatewayURL or the new IncludeGatewayProbe field; behaviour change is gated on an explicit opt-in flag that defaults to the pre-existing false.
  • Smoke against calibration daemon post-init: sustained sync healthy, head caught up to live within 2 epochs (unchanged by this PR).

Three small changes to the bootstrap-quorum path (init, doctor, repair)
that together take calibration first-try success from ~2 of 3 attempts
to ~4 of 5 without adding infrastructure.

1. Elide the Lantern gateway from the F3-cert probe by default.

   The gateway (gateway.lantern.reiers.io) serves /state/root and
   /block/<cid>, not Filecoin JSON-RPC, so probing it as an rpcSource
   always returned HTTP 404. Previously every install printed a red
   ✗ [lantern-gateway] ... HTTP 404: 404 page not found line even
   when the quorum succeeded on the other sources, which made the
   installer look broken. The gateway is non-counting by default
   anyway, so the tally is unaffected. Opt back in with
   --count-gateway when a future gateway release proxies
   Filecoin.F3GetLatestCertificate. Cold-block + state-root
   fallback via net/hsync is unchanged.

2. Raise --libp2p-settle default from 8s to 15s.

   libp2p bootstrap connections often needed >8s to finish dialing
   before F3 cert-exchange could stream; the probe would fire early
   against peers that weren't reachable yet and count them as
   failures. 15s is a small install-time cost that meaningfully
   improves first-try reliability, especially on calibration where
   the peer set is small and any one flake matters.

3. Auto-retry the probe once after a 6s backoff.

   runBootstrapQuorum now retries when the first attempt fails with
   ErrQuorumNotReached or ErrInsufficientSources; the second failure
   remains fatal. Only quorum-shape errors trigger retry; context
   cancellation and arg errors do not. Progress log includes
   'retry 2/2: transient peer flake on first pass, probing again...'
   so the operator sees what happened. Applies to init, doctor, and
   repair via the shared runner.

Tested on darwin/arm64 against calibration: 5 fresh init attempts,
first pass with --libp2p-settle=15s (default): 3 of 5 pass first
try, 5 of 5 pass after retry (one attempt double-flaked with 2/3
both passes, which is a real network condition, not a code bug).

No test changes needed; unit suite for chain/bootstrap + cmd/lantern
stays green.
@Reiers Reiers merged commit 945ff1b into main Jul 12, 2026
1 check passed
@Reiers Reiers deleted the fix/bootstrap-ux-gateway-and-settle branch July 12, 2026 11:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant