Repository navigation
BRG-1: guardian all-token window and large-transfer delay; audit of the chain-side caps - #10
Merged
Merged
Conversation
…rdian, and an audit of the chain-side caps Main already has a per-transfer cap (withheld for an operator), a rolling per-token window (deferred), a manual signing pause, and the endpoints' release caps and pause. It had no delay anywhere, no bound across tokens, and no check that the chain-side caps are set. This adds the three. [guardian.limits] gains two optional bounds, off unless configured: - per_window_total: what the guardian signs across all tokens together, per direction, in the same rolling window. A transfer over it is deferred like one over its token's window. - delay_above + delay_secs: a transfer above the threshold is signed only delay_secs after the guardian first read it, on its own clock. The first-read time is kept in delayed/<chain>/<sequence>.json under the guardian's seal; a record that is backdated, unsealed, from the future or unreadable starts the wait again. A delayed transfer is listed with the deferred ones and holds back no other transfer; if its window is full once the delay has passed it queues like any other. rand-bridge-audit --limits reads each endpoint's per-transfer and daily release cap per approved backing and Rand's daily mint cap, prints them in attested units next to the config's [guardian.limits], and exits non-zero when an enabled backing has an unlimited cap or a bound cannot be read. A config without the new keys behaves as before. A build older than this one refuses a config that has them (the section denies unknown fields), so a rollback removes the keys first. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
rand-bridge-audit keeps both --limits and --headroom. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YGaYNQ4cvFtg2UmokVgrAN
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Tracks randprotocol/monorepo#4
What main already has
--pause-signing). All under[guardian.limits].What was missing, and is added here
per_window_totalcaps what a guardian signs across all tokens together, per direction, in the rolling window. Without it the bound is the per-token cap times the number of listed tokens.delay_above+delay_secs: a transfer above the threshold is signed onlydelay_secsafter the guardian first read it, on its own clock. The first-read time is kept under the guardian's seal (data_dir/delayed/); a record that is backdated, unsealed, from the future or unreadable starts the wait again. A delayed transfer holds back nothing else and is listed with the deferred ones in/v1/health.rand-bridge-audit --config <file> --limitsreads every endpoint's release caps per approved backing and Rand's daily mint cap, prints them in one unit, and exits non-zero when an enabled backing has an unlimited cap (0) or a bound cannot be read. Read-only.Not added: an automatic global pause. Commit
61757beremoved it on purpose (with six of six guardians needed, one guardian's automatic pause stops every transfer); the manual pause stays the only global brake.Files
daemons/src/limits.rs,daemons/src/guardian.rs: the two bounds.daemons/src/bin/guardian.rs: startup lines saying which of the two are on.daemons/src/bin/audit.rs:--limits.daemons/tests/limits.rs(+10 tests),daemons/tests/audit_bin.rs(+4 tests); three other test files only gain the new struct fields.daemons/README.md,daemons/config.example.toml,docs/architecture.md§1.1.Tests
cargo test --releaseindaemons/: every test binary passes (limits 18, audit_bin 21; no failures anywhere).Upgrade and rollback
[guardian.limits]denies unknown fields). To roll back, remove the keys first.delayfield that an older build ignores.Left for the owner
rand-bridge-audit --limitsagainst the live endpoints.🤖 Generated with Claude Code