Conversation
📝 WalkthroughWalkthroughIntroduces a deposit restriction mechanism to Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ 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 |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@test/GatewayEVM.t.sol`:
- Around line 1291-1295: The failing CI is due to formatting on the block
containing token.approve, gateway.deposit, gateway.depositAndCall, and assertEq;
run forge fmt (or otherwise reformat that statement block) so the line with
gateway.depositAndCall{ value: ADDITIONAL_ACTION_FEE_WEI }(...) conforms to the
project's formatter (wrap arguments/attributes or split into multiple lines) and
then re-run forge fmt --check to ensure token.approve, gateway.deposit,
gateway.depositAndCall, and the final assertEq line match the repo style.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: a0078275-6b33-4334-9b71-09b78cd1a7ad
📒 Files selected for processing (4)
contracts/evm/GatewayEVM.solcontracts/evm/interfaces/IGatewayEVM.soltest/GatewayEVM.t.soltest/utils/upgrades/GatewayEVMUpgradeTest.sol
| token.approve(address(gateway), amount * 2); | ||
| gateway.deposit(destination, amount, address(token), revertOptions); | ||
| gateway.depositAndCall{ value: ADDITIONAL_ACTION_FEE_WEI }(destination, amount, address(token), payload, revertOptions); | ||
|
|
||
| assertEq(amount * 2, token.balanceOf(address(custody))); |
There was a problem hiding this comment.
Apply forge fmt to unblock CI.
Line 1293 exceeds the formatter’s expected layout, and the pipeline already reports forge fmt --check failing here.
Proposed formatting fix
- gateway.depositAndCall{ value: ADDITIONAL_ACTION_FEE_WEI }(destination, amount, address(token), payload, revertOptions);
+ gateway.depositAndCall{ value: ADDITIONAL_ACTION_FEE_WEI }(
+ destination, amount, address(token), payload, revertOptions
+ );📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| token.approve(address(gateway), amount * 2); | |
| gateway.deposit(destination, amount, address(token), revertOptions); | |
| gateway.depositAndCall{ value: ADDITIONAL_ACTION_FEE_WEI }(destination, amount, address(token), payload, revertOptions); | |
| assertEq(amount * 2, token.balanceOf(address(custody))); | |
| token.approve(address(gateway), amount * 2); | |
| gateway.deposit(destination, amount, address(token), revertOptions); | |
| gateway.depositAndCall{ value: ADDITIONAL_ACTION_FEE_WEI }( | |
| destination, amount, address(token), payload, revertOptions | |
| ); | |
| assertEq(amount * 2, token.balanceOf(address(custody))); |
🧰 Tools
🪛 GitHub Actions: Lint TS/JS/Sol
[error] 1293-1295: forge fmt --check failed due to formatting differences in test/GatewayEVM.t.sol. gateway.depositAndCall call formatting should match forge fmt output.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@test/GatewayEVM.t.sol` around lines 1291 - 1295, The failing CI is due to
formatting on the block containing token.approve, gateway.deposit,
gateway.depositAndCall, and assertEq; run forge fmt (or otherwise reformat that
statement block) so the line with gateway.depositAndCall{ value:
ADDITIONAL_ACTION_FEE_WEI }(...) conforms to the project's formatter (wrap
arguments/attributes or split into multiple lines) and then re-run forge fmt
--check to ensure token.approve, gateway.deposit, gateway.depositAndCall, and
the final assertEq line match the repo style.
Add crosschain evm guards
Note
Medium Risk
Introduces new gating logic that can cause previously-valid
deposit/depositAndCallcalls to revert when restriction mode is enabled, impacting cross-chain funding flows if misconfigured.Overview
Adds an optional deposit restriction mode to
GatewayEVMthat blocksdeposit/depositAndCallunless the asset is explicitly allowlisted (including native ETH viaaddress(0)), reverting with the newAssetDepositNotAllowederror.Admins can toggle restrictions via
setDepositsRestrictedand manage the allowlist viasetDepositAllowedAsset; enabling restriction auto-allowlistszetaToken. TheIGatewayEVMinterface, events, upgrade test contract storage layout, and Foundry tests are updated accordingly.Reviewed by Cursor Bugbot for commit f110ea2. Configure here.
Summary by CodeRabbit
Release Notes