Skip to content

guardian: fail closed on mainnet without redundant RPCs, peers and limits - #8

Merged
dendisuhubdy merged 3 commits into
mainfrom
fix/audit-v12-br601
Nov 18, 2026
Merged

dendisuhubdy merged 3 commits into
mainfrom
fix/audit-v12-br601

Conversation

@dendisuhubdy

Copy link
Copy Markdown
Member

Two changes:

  • On mainnet chain ids (14 or above, or unset), the guardian refuses to start unless each chain has at least 2 providers with quorum ≥2, a non-empty peer list and a [guardian.limits] section. --unsafe-skip-mainnet-guards (or RAND_GUARDIAN_UNSAFE_SKIP_MAINNET_GUARDS) overrides this.
  • New --check-config, plus ${ENV} substitution for secrets.

The eight mainnet tomls are updated, and docs/guardian-hosts.md has the runbook. Locally, 263 tests pass.

Do not roll before each droplet has its provider URLs and peer tunnels: a guardian with the old config will refuse to start.

🤖 Generated with Claude Code

@codecov

codecov Bot commented Nov 4, 2026

Copy link
Copy Markdown

Welcome to Codecov 🎉

Once you merge this PR into your default branch, you're all set! Codecov will compare coverage reports and display results in all future pull requests.

ℹ️ You can also turn on project coverage checks and project coverage reporting on Pull Request comment

Thanks for integrating Codecov - We've got you covered ☂️

dendisuhubdy and others added 3 commits November 18, 2026 12:14
…s quorum, peers and caps

On a Rand chain id of 14 or higher (the public chains as classified for BRG-901), or with no
chain id configured, rand-guardian now stops at startup unless every watched chain is read
through at least two distinct providers at an rpc_quorum of at least two (BR-4),
guardian.peers is non-empty (BR-502) and [guardian.limits] is present (BRG-1). The error lists
each missing control. Devnet ids below 14 keep the old warnings.

- --check-config runs the same check and exits, without a key.
- --unsafe-skip-mainnet-guards / RAND_GUARDIAN_UNSAFE_SKIP_MAINNET_GUARDS=1 overrides it for an
  emergency or a dev run, logging every gap at error level.
- --pause-signing, --resume-signing and --list-held are not gated.
- RPC URLs and peers accept ${NAME} placeholders filled from the environment at load
  (Config::load_with), so provider API keys stay out of config files. An unfilled one counts
  as a gap and does not count toward a quorum.
- JSON-RPC transport errors drop the URL, naming the host only.

Tests: tests/mainnet_guard.rs (classification, each gap, placeholders) and five binary tests
in tests/daemons.rs (each refusal, the override by flag and env, devnet exemption,
--check-config, operator commands). Removing the guard turns them red.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… and caps; roll runbook

daemons/mainnet/guardian-1..8.toml now pass the mainnet guard once their environment is set:
- rpc_quorum = 2 on every chain, over keyless providers that served the needed calls on
  2026-11-04, plus one ${GUARDIAN_RPC_*} placeholder per chain for a keyed provider (Rand,
  Ethereum, BSC, Tron, Solana).
- guardian.peers: the other guardians through loopback forwards at 127.0.0.1:717<j>.
- The existing published caps.

tests/mainnet_guard.rs loads all eight. With the variables set they have no gaps; without,
they name exactly the five variables. run-guardians-set1.sh passes GUARDIAN_RPC_* from
~/.rand-bridge/mainnet-set1/rpc.env.

docs/guardian-hosts.md describes the guard, the providers, the peer forwards (and that a peer
serves only its own signatures) and the roll to the live guardians. Binary and config roll
together, one host at a time. While guardians 7 and 8 are offline, each restart stops signing,
so the preferred order brings 7 and 8 up first (BR-402).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ter the rebase on audit v14

main now refuses a guardian without rand.genesis_hash (BR-1005), so the two
guard tests that expect a start past the guard stopped at that check instead
of at the Rand node. The test config names a genesis hash whenever it names a
chain. The roll runbook says the host file needs the line too. Three guard
messages lose a run of spaces left by a line break inside the literal.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@dendisuhubdy
dendisuhubdy merged commit 92a7878 into main Nov 18, 2026
2 checks passed
@dendisuhubdy
dendisuhubdy deleted the fix/audit-v12-br601 branch November 18, 2026 05:15
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