fix(R-C-01): isolated liquidity + outflow rate limits#76
Merged
sh3ifu merged 6 commits intoJun 30, 2026
Merged
Conversation
crawter
approved these changes
Jun 26, 2026
* test(R-C-01): isolated-liquidity regressions + round-trip fuzz * test(R-C-01): outflow rate-limit regressions + refill fuzz * test(R-C-01): outflow rate-limit regressions + refill fuzz * fix(R-M-01): RgbSettlementModule verifies opId existence + exact amount (#79)
3bd659f
into
script/R-M-03-R-W-16-update-fundsOut-interaction-script
2 checks passed
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.
R-C-01 — on-chain constraints on the enclave money path
Closes the CRITICAL gap where a compromised TEE quorum could drain the whole
Bridge pool in one
fundsOut. Two layered, independent on-chain limits boundevery release; both are applied before any external interaction, so a downstream
revert rolls them back atomically.
Level 1 — isolated per-chain liquidity
lockedLiquidity[chainId]:fundsIncredits the deposit'sdestinationChainIdby
netAmount;fundsOutdebits the release'ssourceChainIdby the grossamount, revertingInsufficientChainLiquidityif it would exceed it. A releasecan never draw more than was actually bridged toward that chain — closing the
cross-route drain (incl.
NullSettlementModuleroutes that had no accounting).Level 2 — per-chain + global outflow rate limit
A continuously-refilling token bucket (
OutflowRateLimiter,src/libraries/)caps how fast a release can drain liquidity:
chainBuckets[sourceChainId](per-chain) +globalBucket(aggregate — acompromised shared TEE could otherwise drain every per-chain cap in one window);
fundsOutspends both; either short → revert + rollback;LimitNotConfigured;setOutflowLimit/setGlobalOutflowLimit(onlyOwner, federation timelock):validate
0 < rate < capacity, prime full on first enable, never gift onreconfiguration, clamp on decrease;
availableOutflow/availableGlobalOutflowpreview the live allowance;min(capacity, tokens + elapsed*rate)is overflow-safe for any valid config.