-
Notifications
You must be signed in to change notification settings - Fork 59
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: missing receiver in zevm withdraw functions #301
Conversation
WalkthroughThe recent updates introduce significant enhancements to the GatewayEVM and GatewayZEVM contracts, improving transaction handling and security. Key changes include the addition of new parameters in function signatures, enhanced error checks, and new functionalities like ERC20 custody management. Updates to scripts and tests ensure comprehensive validation of these features, promoting better contract interaction and usability. Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant GatewayEVM
participant GatewayZEVM
participant ERC20Custody
User->>GatewayEVM: call(receiver, payload)
GatewayEVM-->>User: Check receiver not zero
GatewayEVM->>GatewayZEVM: withdraw(receiver, amount, chainId)
GatewayZEVM-->>User: Emit withdrawal event
User->>ERC20Custody: whitelist(erc20Address)
ERC20Custody-->>User: Confirm whitelisting
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configuration File (
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #301 +/- ##
==========================================
+ Coverage 83.09% 83.27% +0.17%
==========================================
Files 7 7
Lines 284 287 +3
Branches 92 95 +3
==========================================
+ Hits 236 239 +3
Misses 48 48 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Files selected for processing (18)
- v2/pkg/gatewayevm.sol/gatewayevm.go (1 hunks)
- v2/pkg/gatewayzevm.sol/gatewayzevm.go (3 hunks)
- v2/pkg/igatewayzevm.sol/igatewayzevm.go (3 hunks)
- v2/pkg/senderzevm.sol/senderzevm.go (1 hunks)
- v2/scripts/localnet/EvmDepositAndCall.s.sol (2 hunks)
- v2/scripts/localnet/worker.ts (2 hunks)
- v2/src/evm/GatewayEVM.sol (1 hunks)
- v2/src/zevm/GatewayZEVM.sol (2 hunks)
- v2/src/zevm/interfaces/IGatewayZEVM.sol (2 hunks)
- v2/test/GatewayEVM.t.sol (1 hunks)
- v2/test/GatewayZEVM.t.sol (11 hunks)
- v2/typechain-types/GatewayZEVM.ts (7 hunks)
- v2/typechain-types/IGatewayZEVM.sol/IGatewayZEVM.ts (7 hunks)
- v2/typechain-types/factories/GatewayEVMEchidnaTest__factory.ts (1 hunks)
- v2/typechain-types/factories/GatewayEVM__factory.ts (1 hunks)
- v2/typechain-types/factories/GatewayZEVM__factory.ts (3 hunks)
- v2/typechain-types/factories/IGatewayZEVM.sol/IGatewayZEVM__factory.ts (2 hunks)
- v2/typechain-types/factories/SenderZEVM__factory.ts (1 hunks)
Additional comments not posted (43)
v2/scripts/localnet/EvmDepositAndCall.s.sol (2)
6-6
: Import statement is correct.The addition of the
ERC20Custody
import is necessary for the new functionality.
14-14
: New variable declarations are correct.The
custodyAddress
andcustody
variables are correctly initialized using environment variables.Verify the
whitelist
method usage.Ensure that the
whitelist
method is implemented correctly in theERC20Custody
contract and that theerc20Address
is valid.Also applies to: 26-28
Verification successful
The
whitelist
method implementation is appropriate and correct.The
whitelist
method inv2/src/evm/ERC20Custody.sol
correctly handles the address type and uses role-based access control withWHITELISTER_ROLE
. This aligns with the usage inEvmDepositAndCall.s.sol
.
- Location:
v2/src/evm/ERC20Custody.sol
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the implementation of the `whitelist` method in the `ERC20Custody` contract. # Test: Search for the `whitelist` method in the `ERC20Custody` contract. Expect: Correct implementation. ast-grep --lang solidity --pattern $'contract ERC20Custody { $$$ function whitelist(address $_) public { $$$ } $$$ }'Length of output: 247
Script:
#!/bin/bash # Use rg to search for the `whitelist` method in Solidity files to verify its implementation. rg 'function whitelist\(' --glob '*.sol' -A 5Length of output: 767
v2/src/zevm/interfaces/IGatewayZEVM.sol (2)
85-87
: Function signature change is appropriate.The addition of the
receiver
parameter to thewithdraw
function is a suitable enhancement for cross-chain transactions.
97-101
: Function signature change is appropriate.The addition of the
receiver
parameter to thewithdrawAndCall
function enhances its capability for cross-chain interactions.v2/typechain-types/factories/SenderZEVM__factory.ts (1)
123-123
: Verify the updated bytecode.Ensure that the updated
_bytecode
constant reflects the intended changes in the contract logic and does not introduce any issues.v2/typechain-types/factories/IGatewayZEVM.sol/IGatewayZEVM__factory.ts (2)
330-334
: Verify ABI consistency forwithdraw
.The addition of the
receiver
parameter to thewithdraw
function's ABI is consistent with the intended changes. Ensure that all client code interacting with this function is updated to accommodate the new parameter.
381-385
: Verify ABI consistency forwithdrawAndCall
.The addition of the
receiver
parameter to thewithdrawAndCall
function's ABI is consistent with the intended changes. Ensure that all client code interacting with this function is updated to accommodate the new parameter.v2/scripts/localnet/worker.ts (2)
274-274
: Confirm the change of argument inexecute
call.The change from
0
to1
in theexecute
function call might indicate a shift in operation mode or context. Verify that this change aligns with the intended logic and that all dependent code is adjusted accordingly.
249-249
: Confirm the change of argument inexecute
call.The change from
0
to1
in theexecute
function call might indicate a shift in operation mode or context. Verify that this change aligns with the intended logic and that all dependent code is adjusted accordingly.v2/src/zevm/GatewayZEVM.sol (2)
149-155
: Validatereceiver
parameter inwithdraw
.The addition of the
receiver
parameter enhances the function's capability. Ensure that thereceiver
is correctly validated and integrated into the withdrawal logic. The event emission now includes thereceiver
, which aligns with the intended functionality.
Line range hint
159-177
:
Validatereceiver
parameter inwithdrawAndCall
.The addition of the
receiver
parameter and the zero-length check improve the function's robustness. The event emission now includes thereceiver
, which aligns with the intended functionality. Ensure that all interactions with this function are updated to match the new signature.v2/typechain-types/IGatewayZEVM.sol/IGatewayZEVM.ts (10)
113-114
: LGTM! Encoding method updated forwithdraw
.The
encodeFunctionData
method has been correctly updated to reflect the new function signature with thebytes
parameter.
121-122
: LGTM! Encoding method updated forwithdrawAndCall
.The
encodeFunctionData
method has been correctly updated to reflect the new function signature with thebytes
parameter.
149-149
: LGTM! Decoding method updated forwithdraw
.The
decodeFunctionResult
method has been correctly updated to reflect the new function signature with thebytes
parameter.
157-157
: LGTM! Decoding method updated forwithdrawAndCall
.The
decodeFunctionResult
method has been correctly updated to reflect the new function signature with thebytes
parameter.
344-345
: LGTM! TypedContractMethod updated forwithdraw
.The
TypedContractMethod
has been correctly updated to reflect the new function signature with thebytes
parameter.
361-367
: LGTM! TypedContractMethod updated forwithdrawAndCall
.The
TypedContractMethod
has been correctly updated to reflect the new function signature with thebytes
parameter.
462-464
: LGTM! getFunction method updated forwithdraw
.The
getFunction
method has been correctly updated to reflect the new function signature with thebytes
parameter.
481-488
: LGTM! getFunction method updated forwithdrawAndCall
.The
getFunction
method has been correctly updated to reflect the new function signature with thebytes
parameter.
61-61
: Verify the updatedwithdraw
function usage.The function signature now includes a
bytes
parameter for the receiver. Ensure that all calls to this function in the codebase are updated to match the new signature.Verification successful
The
withdraw
function signature is consistently updated.The
withdraw(bytes,uint256,uint256)
function signature is correctly used across the relevant TypeScript files, indicating that the codebase is aligned with the new function signature. No outdated calls were found.
- Files with updated signature:
v2/typechain-types/GatewayZEVM.ts
v2/typechain-types/IGatewayZEVM.sol/IGatewayZEVM.ts
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify all function calls to `withdraw` match the new signature. # Test: Search for the function usage. Expect: Only occurrences of the new signature. rg --type typescript -A 5 $'withdraw\\(bytes,uint256,uint256\\)'Length of output: 98
Script:
#!/bin/bash # Description: Verify all function calls to `withdraw` match the new signature. # Test: Search for the function usage. Expect: Only occurrences of the new signature. rg --glob '*.ts' -A 5 $'withdraw\\(bytes,uint256,uint256\\)'Length of output: 4776
63-63
: Verify the updatedwithdrawAndCall
function usage.The function signature now includes a
bytes
parameter for the receiver. Ensure that all calls to this function in the codebase are updated to match the new signature.Verification successful
Function usage updated correctly for
withdrawAndCall
.The function signature
withdrawAndCall(bytes,uint256,uint256,bytes)
is consistently used across relevant TypeScript files, includingGatewayZEVM.ts
andIGatewayZEVM.ts
. This indicates that all necessary updates have been made to accommodate the new parameter.
v2/typechain-types/GatewayZEVM.ts
v2/typechain-types/IGatewayZEVM.sol/IGatewayZEVM.ts
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify all function calls to `withdrawAndCall` match the new signature. # Test: Search for the function usage. Expect: Only occurrences of the new signature. rg --type typescript -A 5 $'withdrawAndCall\\(bytes,uint256,uint256,bytes\\)'Length of output: 111
Script:
#!/bin/bash # Description: Verify all function calls to `withdrawAndCall` match the new signature. # Test: Search for the function usage in .ts files. Expect: Only occurrences of the new signature. rg --glob '*.ts' -A 5 $'withdrawAndCall\\(bytes,uint256,uint256,bytes\\)'Length of output: 4607
v2/src/evm/GatewayEVM.sol (1)
272-272
: LGTM! Added zero address check incall
function.The addition of the check to revert if the
receiver
is a zero address is a good security measure, preventing unintended interactions.v2/test/GatewayEVM.t.sol (1)
492-497
: LGTM! Added test for zero address incall
function.The test function correctly validates that the
call
method reverts when a zero address is used, ensuring the robustness of the zero address check.v2/pkg/senderzevm.sol/senderzevm.go (1)
35-35
: Verify the impact of updated binary data.The
Bin
field ofSenderZEVMMetaData
has been updated. Ensure that this change aligns with the intended contract logic and deployment requirements.Verification successful
Impact of Updated Binary Data in
SenderZEVMMetaData
VerifiedThe
SenderZEVMMetaData
is only utilized within thev2/pkg/senderzevm.sol/senderzevm.go
file. The update to theBin
field is consistent with the intended usage, as the code is structured to useSenderZEVMMetaData.Bin
directly. No external dependencies or tests are affected by this change.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the impact of the updated binary data on the contract deployment and functionality. # Test: Search for the usage of `SenderZEVMMetaData` to ensure it is correctly referenced. rg --type go 'SenderZEVMMetaData'Length of output: 719
Script:
#!/bin/bash # Description: Search for additional references to `SenderZEVMMetaData` in the codebase. # Test: Find all references to `SenderZEVMMetaData` to ensure its usage is consistent and verify its impact. rg 'SenderZEVMMetaData'Length of output: 709
v2/typechain-types/GatewayZEVM.ts (1)
77-79
: Verify function signature updates.The
withdraw
andwithdrawAndCall
function signatures have been updated to include abytes
parameter. Ensure that these changes are correctly implemented and used throughout the codebase.Also applies to: 196-197, 204-205, 638-639, 655-661, 830-832, 849-856
Verification successful
Function Signature Updates Verified
The updated function signatures for
withdraw
andwithdrawAndCall
have been correctly implemented and are present in the relevant files, includingGatewayZEVM.ts
andIGatewayZEVM.ts
. The changes are reflected in the function fragments and typed contract methods, ensuring consistency across the codebase.
- Files with updated signatures:
v2/typechain-types/GatewayZEVM.ts
v2/typechain-types/IGatewayZEVM.sol/IGatewayZEVM.ts
These updates confirm that the function signatures have been correctly modified to include the
bytes
parameter.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify that the updated function signatures are correctly implemented and used. # Test: Search for the usage of `withdraw` and `withdrawAndCall` to ensure they match the new signatures. rg --type ts 'withdraw\(' rg --type ts 'withdrawAndCall\('Length of output: 12691
v2/test/GatewayZEVM.t.sol (1)
172-172
: Verify test coverage and correctness.The test functions have been updated to handle zero addresses and amounts. Ensure that these tests adequately cover the edge cases and that the assertions are correct.
Also applies to: 175-179, 181-184, 195-196, 220-220, 239-239, 251-252, 277-277, 449-449, 520-528, 540-540, 550-557, 755-767
v2/pkg/igatewayzevm.sol/igatewayzevm.go (7)
365-369
: UpdateWithdraw0
function signature.The
Withdraw0
function now includes areceiver
parameter. Ensure that all calls to this function are updated to match the new signature.
372-376
: UpdateWithdraw0
function signature in session.The session method for
Withdraw0
now includes areceiver
parameter. Ensure that all session calls are updated accordingly.
379-383
: UpdateWithdraw0
function signature in transactor session.The transactor session method for
Withdraw0
now includes areceiver
parameter. Ensure that all transactor session calls are updated accordingly.
407-411
: UpdateWithdrawAndCall0
function signature.The
WithdrawAndCall0
function now includes areceiver
parameter. Ensure that all calls to this function are updated to match the new signature.
414-418
: UpdateWithdrawAndCall0
function signature in session.The session method for
WithdrawAndCall0
now includes areceiver
parameter. Ensure that all session calls are updated accordingly.
421-425
: UpdateWithdrawAndCall0
function signature in transactor session.The transactor session method for
WithdrawAndCall0
now includes areceiver
parameter. Ensure that all transactor session calls are updated accordingly.
48-48
: Ensure ABI consistency with contract changes.The ABI string has been updated to include the
receiver
parameter in thewithdraw
andwithdrawAndCall
functions. Verify that these changes are consistent with the contract's Solidity code.v2/typechain-types/factories/GatewayEVM__factory.ts (1)
1023-1023
: Review bytecode changes forGatewayEVM
.The bytecode string has been significantly altered. Ensure that this change reflects the intended updates to the contract's logic and verify that it aligns with the contract's functionality.
v2/typechain-types/factories/GatewayZEVM__factory.ts (2)
637-641
: Verify usage of the updatedwithdrawAndCall
function.The
withdrawAndCall
function now includes areceiver
parameter. Ensure all calls to this function are updated to match the new signature and verify that the contract logic correctly handles thereceiver
parameter.
586-590
: Verify usage of the updatedwithdraw
function.The
withdraw
function now includes areceiver
parameter. Ensure all calls to this function are updated to match the new signature and verify that the contract logic correctly handles thereceiver
parameter.v2/typechain-types/factories/GatewayEVMEchidnaTest__factory.ts (2)
1075-1076
: LGTM! The new type declaration enhances flexibility.The introduction of
GatewayEVMEchidnaTestConstructorParams
allows for more versatile constructor configurations, improving usability.
Line range hint
1078-1085
:
LGTM! The constructor logic is well-implemented.The use of
isSuperArgs
as a type guard ensures type safety and flexibility in handling constructor parameters.v2/pkg/gatewayzevm.sol/gatewayzevm.go (2)
847-848
: Verify the handling of thereceiver
parameter.The
receiver
parameter has been added to theWithdraw0
function. Ensure that this parameter is correctly utilized and validated in the function logic.
889-890
: Verify the handling of thereceiver
parameter.The
receiver
parameter has been added to theWithdrawAndCall0
function. Ensure that this parameter is correctly utilized and validated in the function logic.Verification successful
The
receiver
parameter is correctly handled inWithdrawAndCall0
.The
receiver
parameter is consistently passed to the contract method in theWithdrawAndCall0
function implementations across different contexts. This indicates that the parameter is being utilized as intended.
v2/pkg/gatewayzevm.sol/gatewayzevm.go
: The parameter is correctly passed in theWithdrawAndCall0
function for bothGatewayZEVMTransactor
andGatewayZEVMSession
.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the usage and validation of the `receiver` parameter in the `WithdrawAndCall0` function. # Test: Search for the function implementation. Expect: Correct handling of the `receiver` parameter. rg --type go -A 5 $'func (_GatewayZEVM *GatewayZEVMTransactor) WithdrawAndCall0(opts *bind.TransactOpts, receiver []byte, amount *big.Int, chainId *big.Int, message []byte) (*types.Transaction, error)'Length of output: 590
Script:
#!/bin/bash # Description: Verify the usage and validation of the `receiver` parameter in the `WithdrawAndCall0` function. # Test: Search for the function implementation. Expect: Correct handling of the `receiver` parameter. rg --type go -A 5 $'func (_GatewayZEVM *GatewayZEVMTransactor) WithdrawAndCall0(opts *bind.TransactOpts, receiver \\[]byte, amount \\*big.Int, chainId \\*big.Int, message \\[]byte) (\\*types.Transaction, error)'Length of output: 207
Script:
#!/bin/bash # Description: Search for the `WithdrawAndCall0` function by name to locate its definition in the codebase. # Test: Search for the function by name. Expect: Locate the function definition. rg --type go 'func (_GatewayZEVM \*GatewayZEVMTransactor) WithdrawAndCall0'Length of output: 77
Script:
#!/bin/bash # Description: Search for any occurrences of `WithdrawAndCall0` in the entire codebase. # Test: Search for occurrences of `WithdrawAndCall0`. Expect: Find references or definitions. rg 'WithdrawAndCall0'Length of output: 2645
v2/pkg/gatewayevm.sol/gatewayevm.go (3)
35-35
: Check event handling and iterator functions.Ensure that the event handling functions correctly parse logs and manage subscriptions for new events like
ExecutedWithERC20
andRoleGranted
. Verify that the iterator functions handle errors gracefully and efficiently iterate over events.Verification successful
Event handling functions are correctly implemented.
The event handling functions
FilterExecutedWithERC20
andWatchRoleGranted
are present in the codebase and implemented in the filev2/pkg/gatewayevm.sol/gatewayevm.go
. This confirms that the necessary functions for handling these events are included.
FilterExecutedWithERC20
: Line found inv2/pkg/gatewayevm.sol/gatewayevm.go
WatchRoleGranted
: Line found inv2/pkg/gatewayevm.sol/gatewayevm.go
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the correctness of event handling and iterator functions. # Test: Check for the implementation of event handling functions in the Go code. rg --type go $'func (_GatewayEVM *GatewayEVMFilterer) FilterExecutedWithERC20($_, $_, $_) { $$$ }' rg --type go $'func (_GatewayEVM *GatewayEVMFilterer) WatchRoleGranted($_, $_, $_, $_) { $$$ }'Length of output: 674
Script:
#!/bin/bash # Description: Verify the correctness of event handling and iterator functions. # Corrected Test: Check for the implementation of event handling functions in the Go code. rg --type go 'func \(_GatewayEVM \*GatewayEVMFilterer\) FilterExecutedWithERC20\(' rg --type go 'func \(_GatewayEVM \*GatewayEVMFilterer\) WatchRoleGranted\('Length of output: 625
35-35
: Verify ABI consistency and correctness.The ABI changes include new functions and events, such as
setCustody
,setConnector
, andrevertWithERC20
. Ensure these changes are consistent with the contract's intended functionality and are correctly implemented in the contract code.
35-35
: Ensure function bindings match ABI definitions.The Go bindings for new functions like
Deposit0
andDepositAndCall0
should match the ABI definitions. Verify that the parameter handling is correct and consistent with the contract's functionality.Verification successful
Let's correct the regex pattern and rerun the shell script to verify the function bindings.
Let's search for all functions in the Go file to determine if the functions are present under different names.
Functions
Deposit0
andDepositAndCall0
are present and correctly named.The functions
Deposit0
andDepositAndCall0
exist in the Go file with additional parameters as expected. Ensure that their parameter handling aligns with the ABI definitions and contract functionality. Manual verification is recommended to confirm this alignment.
Deposit0
andDepositAndCall0
are implemented with additional parameters.- Verify parameter handling against ABI specifications.
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify that the Go bindings for new functions match the ABI definitions. # Test: Check for the function bindings in the Go code. rg --type go $'func (_GatewayEVM *GatewayEVMTransactor) Deposit0($_, $_, $_, $_) { $$$ }' rg --type go $'func (_GatewayEVM *GatewayEVMTransactor) DepositAndCall0($_, $_, $_, $_, $_) { $$$ }'Length of output: 662
Script:
#!/bin/bash # Description: Verify that the Go bindings for new functions match the ABI definitions. # Test: Check for the function bindings in the Go code. rg --type go 'func (_GatewayEVM \*GatewayEVMTransactor) Deposit0\(' rg --type go 'func (_GatewayEVM \*GatewayEVMTransactor) DepositAndCall0\('Length of output: 146
Script:
#!/bin/bash # Description: List all functions in the Go file to verify the presence of the expected functions. # Test: List all function definitions in the Go file. rg --type go '^func ' v2/pkg/gatewayevm.sol/gatewayevm.goLength of output: 20446
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Files selected for processing (4)
- v2/pkg/gatewayzevm.sol/gatewayzevm.go (3 hunks)
- v2/src/zevm/GatewayZEVM.sol (2 hunks)
- v2/test/GatewayZEVM.t.sol (10 hunks)
- v2/typechain-types/factories/GatewayZEVM__factory.ts (3 hunks)
Files skipped from review as they are similar to previous changes (1)
- v2/typechain-types/factories/GatewayZEVM__factory.ts
Additional comments not posted (14)
v2/src/zevm/GatewayZEVM.sol (2)
149-156
: LGTM! But verify the function usage in the codebase.The addition of the
receiver
parameter and the zero-length check improve robustness. The event emission update ensures accurate logging.However, ensure that all function calls to
withdraw
match the new signature.Verification successful
Let's correct the file type issue and re-run the verification.
Let's broaden the search to find any usage of the
withdraw
function in Solidity files, regardless of the specific encoding pattern.
Function usage verified successfully.
The
withdraw
function calls in the codebase, particularly inv2/test/GatewayZEVM.t.sol
, correctly match the new signature with thereceiver
parameter encoded usingabi.encodePacked
. No discrepancies found.
v2/test/GatewayZEVM.t.sol
: Multiple instances confirm correct usage.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify all function calls to `withdraw` match the new signature. # Test: Search for the function usage. Expect: Only occurrences of the new signature. rg --type solidity -A 5 $'withdraw(abi.encodePacked($_), $_, $_)'Length of output: 99
Script:
#!/bin/bash # Description: Verify all function calls to `withdraw` match the new signature. # Test: Search for the function usage in Solidity files. Expect: Only occurrences of the new signature. rg 'withdraw\(abi.encodePacked\($_\), $_, $_\)' --glob '*.sol' -A 5Length of output: 69
Script:
#!/bin/bash # Description: Search for any usage of the `withdraw` function in Solidity files. # Test: Search for the `withdraw` function calls in Solidity files. rg 'withdraw\(' --glob '*.sol' -A 5Length of output: 25505
Line range hint
160-178
:
LGTM! But verify the function usage in the codebase.The addition of the
receiver
parameter and the zero-length check improve robustness. The event emission update ensures accurate logging.However, ensure that all function calls to
withdrawAndCall
match the new signature.v2/test/GatewayZEVM.t.sol (6)
172-173
: Test for zero amount inwithdraw
is correct.The test correctly checks for the
InsufficientZetaAmount
error when the amount is zero.
175-177
: Test for zero address inwithdraw
is correct.The test correctly checks for the
ZeroAddress
error when the receiver is a zero address.
183-184
: Test for zero amount inwithdrawAndCall
is correct.The test correctly checks for the
InsufficientZetaAmount
error when the amount is zero.
186-189
: Test for zero address inwithdrawAndCall
is correct.The test correctly checks for the
ZeroAddress
error when the receiver is a zero address.
525-533
: Test for zero address inexecuteRevert
is correct.The test correctly checks for the
ZeroAddress
error when the target is a zero address.
760-771
: Test for zero address indepositAndCall
is correct.The test correctly checks for the
ZeroAddress
error when the target is a zero address.v2/pkg/gatewayzevm.sol/gatewayzevm.go (6)
847-848
: LGTM: UpdatedWithdraw0
function signature.The addition of the
receiver
parameter inWithdraw0
aligns with the updated ABI and enhances flexibility in specifying the receiver.
854-855
: LGTM: UpdatedWithdraw0
function signature.The addition of the
receiver
parameter inWithdraw0
aligns with the updated ABI and enhances flexibility in specifying the receiver.
861-862
: LGTM: UpdatedWithdraw0
function signature.The addition of the
receiver
parameter inWithdraw0
aligns with the updated ABI and enhances flexibility in specifying the receiver.
889-890
: LGTM: UpdatedWithdrawAndCall0
function signature.The addition of the
receiver
parameter inWithdrawAndCall0
aligns with the updated ABI and enhances flexibility in specifying the receiver.
896-897
: LGTM: UpdatedWithdrawAndCall0
function signature.The addition of the
receiver
parameter inWithdrawAndCall0
aligns with the updated ABI and enhances flexibility in specifying the receiver.
903-904
: LGTM: UpdatedWithdrawAndCall0
function signature.The addition of the
receiver
parameter inWithdrawAndCall0
aligns with the updated ABI and enhances flexibility in specifying the receiver.
closes: #300
Summary by CodeRabbit
New Features
GatewayEVM
andGatewayZEVM
contracts with new functions for improved withdrawal and custody management.EvmDepositAndCallScript
for managing ERC20 tokens with custody operations.Bug Fixes
Tests
Documentation