Repository navigation
feat: add patch for the refund logic - #639
Conversation
|
Warning Review limit reached
Next review available in: 45 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (6)
📝 WalkthroughWalkthroughAdds a ChangesStranded Funds Refund
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
This reverts commit 03ae39f.
skosito
left a comment
There was a problem hiding this comment.
Checked on chain:
- All 6 mainnet custodies (ETH, BSC, Polygon, Base, Arbitrum, Avalanche) point at
0x245a2e9a284F9C8c04ECdAf90908B54a05e34232, matching the checksum. - The broadcast files show it was deployed from 858be59, whose
ERC20Custody.solis the code in this PR. - On each chain the admin is a 5/7 Safe that holds
DEFAULT_ADMIN_ROLE, and none of the custodies are paused.
Non-blocking, since it's already deployed:
-
DEFAULT_ADMIN_ROLEas the gate.- Every refund batch needs 5/7 signatures on the protocol admin Safe.
- Only that Safe can refund, short of granting
DEFAULT_ADMIN_ROLEelsewhere, which also gives upgrade and role-grant power. - A dedicated
REFUNDER_ROLEwould let the admin hand refunds to a separate Safe or service and revoke it after the program.
If the admin Safe signing every batch is the plan, no change is needed. Changing it later means another impl deploy and 6 upgrades, so it's better decided now.
-
whenNotPaused. If shutdown pauses custody to stop TSS withdrawals, refunds stop too. RevokingWITHDRAWER_ROLEfrom TSS instead keeps refunds working while blocking withdrawals. -
Scope. The
foundry.tomlisolate = falseandGatewayEVM.t.solchanges are test-only and unrelated to refunds. Worth a line in the description. -
generatefailure. It's on the coreregistry bindings, and main has failed "Generated Files are Updated" since May (b184c3b), so it's not from this PR. -
develop. Once this merges, develop needs the same code. #638 carries it.
Mainnet patch for the refund logic
Note
High Risk
Introduces a new custody outflow path controlled by DEFAULT_ADMIN_ROLE on a mainnet-facing token vault; incorrect off-chain validation or compromised admin could misdirect user funds.
Overview
Adds
refundStrandedFundsonERC20Custodyso default admins (not TSS/WITHDRAWER_ROLE) can send whitelisted ERC20 from custody to a recipient after off-chain validation—intended as a mainnet patch for stranded balances.The call mirrors
withdraw’s transfer mechanics (safeTransfer, whitelist check) but is gated byDEFAULT_ADMIN_ROLE, respects pause and reentrancy guards, rejects zeroto, and emitsStrandedFundsRefunded. The interface and upgrade test double are updated; Foundry tests cover success, ACL, pause, whitelist, and insufficient balance, plus post-UUPS upgrade behavior.Reviewed by Cursor Bugbot for commit 858be59. Configure here.
Summary by CodeRabbit
New Features
Bug Fixes
Tests