Skip to content

Audit v14: checked provider numbers, sealed deferred records, chain identity check - #9

Merged
dendisuhubdy merged 6 commits into
mainfrom
fix/audit-v14
Nov 17, 2026
Merged

dendisuhubdy merged 6 commits into
mainfrom
fix/audit-v14

Conversation

@dendisuhubdy

Copy link
Copy Markdown
Member

Fixes for the audit v14 addendum.

Changes

  • BR-846, BR-761, BR-1008 — provider-supplied numbers use checked arithmetic, and a refused log range never moves a cursor.
  • BR-1004 — a deferred record is re-derived and must carry the guardian's own seal before a retry signs it. This is a seal, not a re-read of the source chain (owner decision, kept until guardians have more than one provider).
  • BR-1005, BR-1006 — a guardian names its Rand chain by id and genesis hash and checks both on every poll; an undecodable PQ key is an error.
  • BR-1002, BR-1007 — cosign prints, verifies and asks before it signs; the rotation quorum rule has its own test.
  • BR-1001 — withdrawFees takes the reentrancy lock (source only, nothing redeployed).
  • BR-1009 — the Tron pauser rule; the two documents that disagree on Tron permissions now say so.

Tests

  • cargo: 269 passed, 2 ignored. forge: 147 passed, 4 skipped.

Before rolling (see daemons/README.md)

  1. Add genesis_hash under [rand] in each guardian's config — the daemon stops at startup without it.
  2. Check each guardian's deferred/ directory.
  3. Keep restarts shorter than the provider's log window.

Not verified

  • Built in debug only; no fork tests ran.
  • Tron permissions on chain are unreconciled.

🤖 Generated with Claude Code

https://claude.ai/code/session_01GFs5h2CVCmdBKerZzH2Xrx

dendisuhubdy and others added 6 commits November 17, 2026 15:15
… what the lock covers

A fee withdrawal paid through _push with no nonReentrant, so a token's
callback could enter lock and release from it, against the contract's own
comment. withdrawFees is now onlyAdmin nonReentrant; three forge tests drive
a re-entering token (into lock, release and a nested withdrawFees).

Source and tests only: the deployed endpoints' bytecode is unchanged.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…log range never moves a cursor

BR-846: the EVM source's payload offset and length, the safe head, the
range end and the sequence count are checked sums; so are the Solana
message length, the Rand guardian_set_index, and the relayer submitter's
gas estimate, base fee and tip. A value that does not fit is an error.
Behind that, each source round and each relay runs under isolate::isolated,
so a panic is an error for that source and round, not the daemon's exit.

BR-1008: a provider that does not serve eth_getLogs for a range is an
error (RangeNotServed) and the cursor stays; sequence() from the same
provider is reported to the operator and decides nothing.

BR-761: under a quorum a refusing provider is not counted for the range;
the cursor moves only when a quorum served it with the same contents, and
short of that the chain halts with an error naming the range.

The authors' test that asserted the skip now asserts the refusal; the
relayer daemon test waits for the log line it reads (it raced on a busy disk).

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GFs5h2CVCmdBKerZzH2Xrx
…s own seal before a retry signs it

retry_deferred signed the digest stored beside a deferred record's body.
It now decodes the body again, derives the digest, requires the record to
sit under the (chain, sequence) its body names, and requires a seal: a MAC
under a key derived from the guardian key, written by limits::defer when
the daemon itself deferred the message it read from its sources. A record
that fails any of these is refused with an error every round and holds
nothing back; what passes still goes through the peer check, the signing
policy and the caps. rand-guardian --vouch-deferred <chain>:<sequence>
seals one record from an earlier build after an operator's review.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GFs5h2CVCmdBKerZzH2Xrx
…ash and checks both on every poll; an undecodable PQ key is an error

BR-1005: rand.genesis_hash joins rand.chain_id in [rand]. rand-guardian
does not start without both (RandConfig::chain_binding); check_startup
reads the genesis hash too; and every RandSource poll asks its node for
rand_chainId and rand_getGenesisHash before it reads a burn and again
before it hands burns on, so a node switched to another chain under a
running daemon yields an error and nothing to sign. The eight mainnet
guardian configs and the relayer's carry chain 21's recorded genesis hash.
No signed body or wire format changes: the body still names no Rand chain.

BR-1006: bridge_state refuses a pq_guardians entry that is not a hex
string, naming its index, as it refuses an undecodable ECDSA guardian; the
authors' fake and assertion that held the silent drop are updated.

README: what an operator must set or check before this build is rolled.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GFs5h2CVCmdBKerZzH2Xrx
…he rotation quorum rule has a test of its own

BR-1002: rand-bridge-gov cosign digested the body of whatever envelope it
was given and signed it with the PQ seeds. It now decodes and prints the
whole attestation (governance::describe), verifies it against the current
guardian set before a seed is read (governance::verify_for_cosign:
verify_rotation for a rotation; for a deposit to Rand a canonical
attestation carrying the current set's quorum, and only with
--allow-transfer), refuses anything else, and needs a confirmation: the
digest's first 8 hex typed at a terminal, or --yes without one. cosign now
takes --current-index and --current-guardians like verify.

BR-1007 (withdrawn as a finding; the test gap stands): four signatures of
a set of six are refused by verify_rotation, on an attestation assembled
by hand so that only the verifier's quorum rule can refuse it. With the
check_indices call removed this test fails and none of the authors' tests in the
governance suites does (the new cosign test, which shares the rule, fails too).

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GFs5h2CVCmdBKerZzH2Xrx
…wo documents that disagree on Tron permissions say so

rand-bridge-audit --governance passed Tron rule 13 for any pauser address
with code: one byte of code and a one-signature account permission was a
PASS. The pauser is now held to the admin multisig's rule, as
docs/governance.md describes it: an account whose owner and active
permissions need at least min_threshold signatures; a contract fails, and
the account's permissions are read whether or not the address has code.
The authors' test that asserted a contract passes now asserts the weak
cases fail.

docs/governance.md says the Tron multi-signature permissions are still to
do; docs/mainnet-deployment.md records them as done on 2026-09-26. Both
places now carry an UNRECONCILED note; neither was changed otherwise,
since only a read of the chain can say which is right.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GFs5h2CVCmdBKerZzH2Xrx
@codecov

codecov Bot commented Nov 17, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@dendisuhubdy
dendisuhubdy merged commit e4735fb into main Nov 17, 2026
2 checks passed
@dendisuhubdy
dendisuhubdy deleted the fix/audit-v14 branch November 17, 2026 09:13
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