-
Notifications
You must be signed in to change notification settings - Fork 58
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
refactor: port ZRC20 contract to v2 #281
Conversation
WalkthroughThe recent updates to the ZRC20 contract enhance its functionality by introducing a gateway address feature, enabling more effective deposit management. Key changes include adding the Changes
Assessment against linked issues
Poem
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 ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #281 +/- ##
==========================================
+ Coverage 58.10% 61.64% +3.54%
==========================================
Files 16 16
Lines 401 425 +24
Branches 28 22 -6
==========================================
+ Hits 233 262 +29
+ Misses 165 160 -5
Partials 3 3 ☔ View full report in Codecov by Sentry. |
v2/test/ZRC20.t.sol
Outdated
uint256 balanceStart = zrc20.balanceOf(addr1); | ||
assertEq(0, balanceStart); |
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.
We can delete this two lines, addr1 is not sending/receiving tokens here.
v2/test/ZRC20.t.sol
Outdated
zrc20.withdraw(abi.encodePacked(addr1), 50_000); | ||
|
||
uint256 fungibleModuleBalanceAfter = zrc20.balanceOf(fungibleModule); | ||
assertEq(fungibleModuleBalanceStart + 20, fungibleModuleBalanceAfter); |
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.
nit: why this + 20
? Shouldn't the protocol receive only 10?
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.
uint256 gasFee = gasPrice * gasLimit + protocolFlatFee;
and i set gasLimit and protocolFlatFee to be 10 in test, and gasPrice is 1
|
GitGuardian id | GitGuardian status | Secret | Commit | Filename | |
---|---|---|---|---|---|
13159201 | Triggered | Alchemy API Key | 72e1200 | v2/lib/forge-std/src/StdChains.sol | View secret |
13159201 | Triggered | Alchemy API Key | 8fafcbd | v2/lib/forge-std/src/StdChains.sol | View secret |
🛠 Guidelines to remediate hardcoded secrets
- Understand the implications of revoking this secret by investigating where it is used in your code.
- Replace and store your secret safely. Learn here the best practices.
- Revoke and rotate this secret.
- If possible, rewrite git history. Rewriting git history is not a trivial act. You might completely break other contributing developers' workflow and you risk accidentally deleting legitimate data.
To avoid such incidents in the future consider
- following these best practices for managing and storing secrets including API keys and other credentials
- install secret detection on pre-commit to catch secret before it leaves your machine and ease remediation.
🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.
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: 1
Outside diff range, codebase verification and nitpick comments (11)
v2/typechain-types/factories/IZRC20.sol/IZRC20Metadata__factory.ts (1)
148-160
: Inconsistency detected in function name renaming.The renaming of
PROTOCOL_FLAT_FEE
toprotocolFlatFee
has not been consistently applied across the codebase. Both the old and new function names are present in multiple files. Please ensure that the renaming is applied consistently throughout the codebase to avoid any potential issues.
Files with
PROTOCOL_FLAT_FEE
:
v1/pkg/contracts/zevm/zrc20.sol/zrc20.go
v1/typechain-types/contracts/zevm/interfaces/IZRC20.ts
v1/typechain-types/contracts/zevm/interfaces/IZRC20.sol/IZRC20.ts
v1/typechain-types/contracts/zevm/interfaces/IZRC20.sol/IZRC20Metadata.ts
v1/typechain-types/contracts/zevm/ZRC20.sol/ZRC20.ts
v1/typechain-types/factories/contracts/zevm/interfaces/IZRC20__factory.ts
v1/typechain-types/factories/contracts/zevm/interfaces/IZRC20.sol/IZRC20Metadata__factory.ts
v1/typechain-types/factories/contracts/zevm/ZRC20.sol/ZRC20__factory.ts
v1/typechain-types/factories/contracts/zevm/ZRC20New.sol/ZRC20New__factory.ts
v1/contracts/zevm/interfaces/IZRC20.sol
v1/docs/src/contracts/zevm/interfaces/IZRC20.sol/interface.IZRC20.md
v1/docs/src/contracts/zevm/ZRC20.sol/contract.ZRC20.md
v1/contracts/zevm/ZRC20.sol
v2/typechain-types/factories/IZRC20.sol/IZRC20Metadata__factory.ts
Files with
protocolFlatFee
:
v2/typechain-types/factories/GatewayZEVM__factory.ts
v2/typechain-types/factories/ZRC20.sol/ZRC20__factory.ts
v2/typechain-types/factories/IZRC20.sol/ZRC20Events__factory.ts
v2/typechain-types/factories/IZRC20.sol/IZRC20__factory.ts
v2/typechain-types/factories/IZRC20.sol/IZRC20Metadata__factory.ts
v2/typechain-types/factories/IGatewayZEVM.sol/IGatewayZEVMEvents__factory.ts
v2/typechain-types/ZRC20.sol/ZRC20.ts
v2/typechain-types/IZRC20.sol/IZRC20Metadata.ts
v2/typechain-types/IGatewayZEVM.sol/IGatewayZEVMEvents.ts
v2/typechain-types/GatewayZEVM.ts
v2/typechain-types/IZRC20.sol/IZRC20.ts
v2/src/zevm/ZRC20.sol
v2/test/ZRC20.t.sol
v2/test/GatewayZEVM.t.sol
v2/test/GatewayEVMZEVM.t.sol
v2/scripts/localnet/worker.ts
v2/pkg/zrc20.sol/zrc20.go
v2/pkg/izrc20.sol/zrc20events.go
v2/pkg/izrc20.sol/izrc20.go
v2/pkg/izrc20.sol/izrc20metadata.go
v2/pkg/igatewayzevm.sol/igatewayzevmevents.go
v2/pkg/gatewayevmzevm.t.sol/gatewayevmzevmtest.go
v2/pkg/gatewayzevm.sol/gatewayzevm.go
v2/pkg/gatewayzevm.t.sol/gatewayzevminboundtest.go
v2/pkg/gatewayzevm.t.sol/gatewayzevmoutboundtest.go
v2/src/zevm/GatewayZEVM.sol
v2/src/zevm/interfaces/IGatewayZEVM.sol
v2/src/zevm/interfaces/IZRC20.sol
Analysis chain
Approve renaming for clarity. Verify consistency.
The renaming of
PROTOCOL_FLAT_FEE
toprotocolFlatFee
improves clarity and consistency. Ensure that this change is consistently applied across the codebase.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify consistency of the function name change across the codebase. # Test: Search for the old function name. Expect: No occurrences. rg --type text 'PROTOCOL_FLAT_FEE' # Test: Search for the new function name. Expect: Multiple occurrences. rg --type text 'protocolFlatFee'Length of output: 125
Script:
#!/bin/bash # Description: Verify consistency of the function name change across the codebase. # Test: Search for the old function name. Expect: No occurrences. rg 'PROTOCOL_FLAT_FEE' # Test: Search for the new function name. Expect: Multiple occurrences. rg 'protocolFlatFee'Length of output: 128069
v2/typechain-types/IZRC20.sol/IZRC20.ts (5)
32-34
: Inconsistency Detected: RenamePROTOCOL_FLAT_FEE
toprotocolFlatFee
Across CodebaseThe renaming of
PROTOCOL_FLAT_FEE
toprotocolFlatFee
has not been consistently applied throughout the codebase. This inconsistency can lead to potential issues.Please ensure the following files are updated:
v1/typechain-types/factories/contracts/zevm/interfaces/IZRC20__factory.ts
v1/typechain-types/factories/contracts/zevm/interfaces/IZRC20.sol/IZRC20__factory.ts
v1/typechain-types/factories/contracts/zevm/interfaces/IZRC20.sol/IZRC20Metadata__factory.ts
v1/typechain-types/contracts/zevm/interfaces/IZRC20.ts
v1/typechain-types/contracts/zevm/interfaces/IZRC20.sol/IZRC20Metadata.ts
v1/typechain-types/contracts/zevm/ZRC20.sol/ZRC20.ts
v1/contracts/zevm/ZRC20.sol
v1/contracts/zevm/interfaces/IZRC20.sol
v1/docs/src/contracts/zevm/ZRC20.sol/contract.ZRC20.md
v1/docs/src/contracts/zevm/interfaces/IZRC20.sol/interface.IZRC20.md
v1/docs/src/contracts/zevm/Interfaces.sol/interface.IZRC20.md
Please review and apply the changes consistently.
Analysis chain
Approve renaming for clarity. Verify consistency.
The renaming of
PROTOCOL_FLAT_FEE
toprotocolFlatFee
in thegetFunction
method improves clarity and consistency. Ensure that this change is consistently applied across the codebase.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify consistency of the function name change across the codebase. # Test: Search for the old function name. Expect: No occurrences. rg --type text 'PROTOCOL_FLAT_FEE' # Test: Search for the new function name. Expect: Multiple occurrences. rg --type text 'protocolFlatFee'Length of output: 125
Script:
#!/bin/bash # Description: Verify consistency of the function name change across the codebase. # Test: Search for the old function name. Expect: No occurrences. rg 'PROTOCOL_FLAT_FEE' # Test: Search for the new function name. Expect: Multiple occurrences. rg 'protocolFlatFee'Length of output: 128069
57-60
: Inconsistent renaming ofPROTOCOL_FLAT_FEE
toprotocolFlatFee
The renaming of
PROTOCOL_FLAT_FEE
toprotocolFlatFee
is not consistently applied across the codebase. The old namePROTOCOL_FLAT_FEE
is still present in several files. Please ensure that the renaming is uniformly applied throughout the codebase.Locations with
PROTOCOL_FLAT_FEE
:
v1/typechain-types/contracts/zevm/interfaces/IZRC20.ts
v1/typechain-types/contracts/zevm/interfaces/IZRC20.sol/IZRC20Metadata.ts
v1/typechain-types/contracts/zevm/ZRC20.sol/ZRC20.ts
v1/typechain-types/contracts/zevm/interfaces/IZRC20.sol/IZRC20.ts
v1/typechain-types/factories/contracts/zevm/interfaces/IZRC20__factory.ts
v1/typechain-types/factories/contracts/zevm/interfaces/IZRC20.sol/IZRC20Metadata__factory.ts
v1/typechain-types/factories/contracts/zevm/interfaces/IZRC20.sol/IZRC20__factory.ts
v1/typechain-types/factories/contracts/zevm/ZRC20New.sol/ZRC20New__factory.ts
v1/typechain-types/factories/contracts/zevm/ZRC20.sol/ZRC20__factory.ts
v1/pkg/contracts/zevm/zrc20.sol/zrc20.go
v1/docs/src/contracts/zevm/interfaces/IZRC20.sol/interface.IZRC20.md
v1/docs/src/contracts/zevm/ZRC20.sol/contract.ZRC20.md
v1/contracts/zevm/ZRC20.sol
v1/pkg/contracts/zevm/interfaces/izrc20.sol/izrc20metadata.go
v1/pkg/contracts/zevm/interfaces/izrc20.sol/izrc20.go
v1/contracts/zevm/interfaces/IZRC20.sol
v1/docs/src/contracts/zevm/Interfaces.sol/interface.IZRC20.md
Please update these occurrences to maintain consistency.
Analysis chain
Approve renaming for clarity. Verify consistency.
The renaming of
PROTOCOL_FLAT_FEE
toprotocolFlatFee
in theencodeFunctionData
method improves clarity and consistency. Ensure that this change is consistently applied across the codebase.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify consistency of the function name change across the codebase. # Test: Search for the old function name. Expect: No occurrences. rg --type text 'PROTOCOL_FLAT_FEE' # Test: Search for the new function name. Expect: Multiple occurrences. rg --type text 'protocolFlatFee'Length of output: 125
Script:
#!/bin/bash # Description: Verify consistency of the function name change across the codebase. # Test: Search for the old function name. Expect: No occurrences. rg 'PROTOCOL_FLAT_FEE' # Test: Search for the new function name. Expect: Multiple occurrences. rg 'protocolFlatFee'Length of output: 128069
87-90
: Inconsistency found in function name change.The function name
PROTOCOL_FLAT_FEE
has not been consistently renamed toprotocolFlatFee
across the codebase. Please update all occurrences ofPROTOCOL_FLAT_FEE
toprotocolFlatFee
to ensure consistency.
Files with old function name
PROTOCOL_FLAT_FEE
:
v1/typechain-types/factories/contracts/zevm/interfaces/IZRC20__factory.ts
v1/typechain-types/factories/contracts/zevm/interfaces/IZRC20.sol/IZRC20__factory.ts
v1/typechain-types/factories/contracts/zevm/interfaces/IZRC20.sol/IZRC20Metadata__factory.ts
v1/typechain-types/factories/contracts/zevm/ZRC20New.sol/ZRC20New__factory.ts
v1/typechain-types/factories/contracts/zevm/ZRC20.sol/ZRC20__factory.ts
v1/typechain-types/contracts/zevm/interfaces/IZRC20.ts
v1/typechain-types/contracts/zevm/interfaces/IZRC20.sol/IZRC20Metadata.ts
v1/typechain-types/contracts/zevm/ZRC20.sol/ZRC20.ts
v1/typechain-types/contracts/zevm/interfaces/IZRC20.sol/IZRC20.ts
v1/pkg/contracts/zevm/zrc20.sol/zrc20.go
v1/pkg/contracts/zevm/interfaces/izrc20.sol/izrc20.go
v1/pkg/contracts/zevm/interfaces/izrc20.sol/izrc20metadata.go
v1/docs/src/contracts/zevm/interfaces/IZRC20.sol/interface.IZRC20.md
v1/docs/src/contracts/zevm/ZRC20.sol/contract.ZRC20.md
Files with new function name
protocolFlatFee
:
v2/typechain-types/factories/GatewayZEVM__factory.ts
v2/typechain-types/factories/ZRC20.sol/ZRC20__factory.ts
v2/typechain-types/factories/IZRC20.sol/ZRC20Events__factory.ts
v2/typechain-types/factories/IZRC20.sol/IZRC20__factory.ts
v2/typechain-types/factories/IZRC20.sol/IZRC20Metadata__factory.ts
v2/typechain-types/factories/IGatewayZEVM.sol/IGatewayZEVMEvents__factory.ts
v2/typechain-types/ZRC20.sol/ZRC20.ts
v2/typechain-types/IZRC20.sol/ZRC20Events.ts
v2/typechain-types/IZRC20.sol/IZRC20Metadata.ts
v2/typechain-types/IZRC20.sol/IZRC20.ts
v2/typechain-types/IGatewayZEVM.sol/IGatewayZEVMEvents.ts
v2/typechain-types/GatewayZEVM.ts
v2/scripts/localnet/worker.ts
v2/src/zevm/GatewayZEVM.sol
v2/src/zevm/ZRC20.sol
v2/src/zevm/interfaces/IZRC20.sol
v2/src/zevm/interfaces/IGatewayZEVM.sol
v2/test/ZRC20.t.sol
v2/test/GatewayZEVM.t.sol
v2/pkg/zrc20.sol/zrc20.go
v2/pkg/izrc20.sol/izrc20metadata.go
v2/pkg/izrc20.sol/zrc20events.go
v2/pkg/izrc20.sol/izrc20.go
v2/pkg/igatewayzevm.sol/igatewayzevmevents.go
v2/pkg/gatewayzevm.sol/gatewayzevm.go
v2/pkg/gatewayevmzevm.t.sol/gatewayevmzevmtest.go
v2/test/GatewayEVMZEVM.t.sol
Analysis chain
Approve renaming for clarity. Verify consistency.
The renaming of
PROTOCOL_FLAT_FEE
toprotocolFlatFee
in thedecodeFunctionResult
method improves clarity and consistency. Ensure that this change is consistently applied across the codebase.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify consistency of the function name change across the codebase. # Test: Search for the old function name. Expect: No occurrences. rg --type text 'PROTOCOL_FLAT_FEE' # Test: Search for the new function name. Expect: Multiple occurrences. rg --type text 'protocolFlatFee'Length of output: 125
Script:
#!/bin/bash # Description: Verify consistency of the function name change across the codebase. # Test: Search for the old function name. Expect: No occurrences. rg 'PROTOCOL_FLAT_FEE' # Test: Search for the new function name. Expect: Multiple occurrences. rg 'protocolFlatFee'Length of output: 128069
227-229
: Update all occurrences ofPROTOCOL_FLAT_FEE
toprotocolFlatFee
for consistency.The renaming of
PROTOCOL_FLAT_FEE
toprotocolFlatFee
has not been consistently applied across the codebase. Please ensure that all instances ofPROTOCOL_FLAT_FEE
are updated toprotocolFlatFee
in the following files:
v1/typechain-types/contracts/zevm/ZRC20.sol/ZRC20.ts
v1/typechain-types/contracts/zevm/interfaces/IZRC20.ts
v1/typechain-types/contracts/zevm/interfaces/IZRC20.sol/IZRC20Metadata.ts
v1/typechain-types/factories/contracts/zevm/ZRC20New.sol/ZRC20New__factory.ts
v1/typechain-types/factories/contracts/zevm/interfaces/IZRC20__factory.ts
v1/typechain-types/factories/contracts/zevm/interfaces/IZRC20.sol/IZRC20Metadata__factory.ts
v1/pkg/contracts/zevm/zrc20.sol/zrc20.go
v1/pkg/contracts/zevm/interfaces/izrc20.sol/izrc20.go
v1/pkg/contracts/zevm/interfaces/izrc20.sol/izrc20metadata.go
v1/contracts/zevm/interfaces/IZRC20.sol
v1/docs/src/contracts/zevm/interfaces/IZRC20.sol/interface.IZRC20.md
v1/docs/src/contracts/zevm/ZRC20.sol/contract.ZRC20.md
v1/contracts/zevm/ZRC20.sol
v2/typechain-types/ZRC20.sol/ZRC20.ts
v2/typechain-types/factories/GatewayZEVM__factory.ts
v2/typechain-types/factories/ZRC20.sol/ZRC20__factory.ts
v2/typechain-types/factories/IZRC20.sol/ZRC20Events__factory.ts
v2/typechain-types/factories/IZRC20.sol/IZRC20__factory.ts
v2/typechain-types/factories/IZRC20.sol/IZRC20Metadata__factory.ts
v2/typechain-types/factories/IGatewayZEVM.sol/IGatewayZEVMEvents__factory.ts
v2/typechain-types/IZRC20.sol/IZRC20Metadata.ts
v2/typechain-types/IZRC20.sol/ZRC20Events.ts
v2/typechain-types/IZRC20.sol/IZRC20.ts
v2/typechain-types/IGatewayZEVM.sol/IGatewayZEVMEvents.ts
v2/typechain-types/GatewayZEVM.ts
v2/src/zevm/ZRC20.sol
v2/src/zevm/GatewayZEVM.sol
v2/src/zevm/interfaces/IZRC20.sol
v2/src/zevm/interfaces/IGatewayZEVM.sol
v2/scripts/localnet/worker.ts
v2/test/ZRC20.t.sol
v2/test/GatewayEVMZEVM.t.sol
v2/test/GatewayZEVM.t.sol
v2/pkg/zrc20.sol/zrc20.go
v2/pkg/izrc20.sol/izrc20metadata.go
v2/pkg/izrc20.sol/izrc20.go
v2/pkg/igatewayzevm.sol/igatewayzevmevents.go
v2/pkg/izrc20.sol/zrc20events.go
v2/pkg/gatewayzevm.t.sol/gatewayzevmoutboundtest.go
v2/pkg/gatewayzevm.t.sol/gatewayzevminboundtest.go
v2/pkg/gatewayevmzevm.t.sol/gatewayevmzevmtest.go
v2/pkg/gatewayzevm.sol/gatewayzevm.go
Analysis chain
Approve renaming for clarity. Verify consistency.
The renaming of
PROTOCOL_FLAT_FEE
toprotocolFlatFee
in thegetFunction
method improves clarity and consistency. Ensure that this change is consistently applied across the codebase.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify consistency of the function name change across the codebase. # Test: Search for the old function name. Expect: No occurrences. rg --type text 'PROTOCOL_FLAT_FEE' # Test: Search for the new function name. Expect: Multiple occurrences. rg --type text 'protocolFlatFee'Length of output: 125
Script:
#!/bin/bash # Description: Verify consistency of the function name change across the codebase. # Test: Search for the old function name. Expect: No occurrences. rg 'PROTOCOL_FLAT_FEE' # Test: Search for the new function name. Expect: Multiple occurrences. rg 'protocolFlatFee'Length of output: 128069
172-173
: Inconsistency Detected: RenamePROTOCOL_FLAT_FEE
toprotocolFlatFee
Across the CodebaseThe renaming of
PROTOCOL_FLAT_FEE
toprotocolFlatFee
has not been consistently applied. Multiple instances of the old function name still exist. Please ensure that all occurrences ofPROTOCOL_FLAT_FEE
are updated toprotocolFlatFee
to maintain consistency.
Files with
PROTOCOL_FLAT_FEE
:
v1/typechain-types/factories/contracts/zevm/ZRC20.sol/ZRC20__factory.ts
v1/typechain-types/factories/contracts/zevm/interfaces/IZRC20.sol/IZRC20Metadata__factory.ts
v1/typechain-types/factories/contracts/zevm/interfaces/IZRC20.sol/IZRC20__factory.ts
v1/typechain-types/factories/contracts/zevm/interfaces/IZRC20__factory.ts
v1/typechain-types/contracts/zevm/interfaces/IZRC20.ts
v1/typechain-types/contracts/zevm/interfaces/IZRC20.sol/IZRC20.ts
v1/typechain-types/contracts/zevm/interfaces/IZRC20.sol/IZRC20Metadata.ts
v1/typechain-types/contracts/zevm/ZRC20.sol/ZRC20.ts
v1/pkg/contracts/zevm/zrc20.sol/zrc20.go
v1/pkg/contracts/zevm/interfaces/izrc20.sol/izrc20metadata.go
v1/pkg/contracts/zevm/interfaces/izrc20.sol/izrc20.go
v1/docs/src/contracts/zevm/interfaces/IZRC20.sol/interface.IZRC20.md
v1/docs/src/contracts/zevm/ZRC20.sol/contract.ZRC20.md
v1/contracts/zevm/ZRC20.sol
v1/contracts/zevm/interfaces/IZRC20.sol
Files with
protocolFlatFee
:
v2/typechain-types/ZRC20.sol/ZRC20.ts
v2/typechain-types/factories/GatewayZEVM__factory.ts
v2/typechain-types/factories/ZRC20.sol/ZRC20__factory.ts
v2/typechain-types/factories/IZRC20.sol/ZRC20Events__factory.ts
v2/typechain-types/factories/IZRC20.sol/IZRC20Metadata__factory.ts
v2/typechain-types/factories/IZRC20.sol/IZRC20__factory.ts
v2/typechain-types/factories/IGatewayZEVM.sol/IGatewayZEVMEvents__factory.ts
v2/typechain-types/IZRC20.sol/IZRC20Metadata.ts
v2/typechain-types/IZRC20.sol/IZRC20.ts
v2/typechain-types/IGatewayZEVM.sol/IGatewayZEVMEvents.ts
v2/typechain-types/GatewayZEVM.ts
v2/test/ZRC20.t.sol
v2/test/GatewayZEVM.t.sol
v2/test/GatewayEVMZEVM.t.sol
v2/typechain-types/IZRC20.sol/ZRC20Events.ts
v2/pkg/zrc20.sol/zrc20.go
v2/pkg/izrc20.sol/izrc20metadata.go
v2/pkg/izrc20.sol/izrc20.go
v2/pkg/izrc20.sol/zrc20events.go
v2/pkg/igatewayzevm.sol/igatewayzevmevents.go
v2/pkg/gatewayzevm.t.sol/gatewayzevminboundtest.go
v2/pkg/gatewayzevm.t.sol/gatewayzevmoutboundtest.go
v2/scripts/localnet/worker.ts
v2/src/zevm/ZRC20.sol
v2/src/zevm/GatewayZEVM.sol
v2/src/zevm/interfaces/IZRC20.sol
v2/src/zevm/interfaces/IGatewayZEVM.sol
Analysis chain
Approve renaming for clarity. Verify consistency.
The renaming of
PROTOCOL_FLAT_FEE
toprotocolFlatFee
in theIZRC20
interface improves clarity and consistency. Ensure that this change is consistently applied across the codebase.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify consistency of the function name change across the codebase. # Test: Search for the old function name. Expect: No occurrences. rg --type text 'PROTOCOL_FLAT_FEE' # Test: Search for the new function name. Expect: Multiple occurrences. rg --type text 'protocolFlatFee'Length of output: 125
Script:
#!/bin/bash # Description: Verify consistency of the function name change across the codebase. # Test: Search for the old function name. Expect: No occurrences. rg 'PROTOCOL_FLAT_FEE' # Test: Search for the new function name. Expect: Multiple occurrences. rg 'protocolFlatFee'Length of output: 128069
v2/pkg/izrc20.sol/izrc20metadata.go (1)
310-322
: Incomplete renaming of functionPROTOCOLFLATFEE
toProtocolFlatFee
.The function
PROTOCOLFLATFEE
has been renamed toProtocolFlatFee
in some instances, but the old name still exists in multiple files. Please update all references toPROTOCOLFLATFEE
toProtocolFlatFee
in the following files:
v1/pkg/contracts/zevm/zrc20.sol/zrc20.go
v1/pkg/contracts/zevm/interfaces/izrc20.sol/izrc20metadata.go
v1/pkg/contracts/zevm/interfaces/izrc20.sol/izrc20.go
Analysis chain
Verify the function name change across the codebase.
The function
PROTOCOLFLATFEE
has been renamed toProtocolFlatFee
. Ensure that all references to this function are updated accordingly.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify all references to the renamed function `ProtocolFlatFee`. # Test: Search for the old function name. Expect: No occurrences of the old name. rg --type go 'PROTOCOLFLATFEE' # Test: Search for the new function name. Expect: Only occurrences of the new name. rg --type go 'ProtocolFlatFee'Length of output: 59986
v2/pkg/systemcontractmock.sol/systemcontractmock.go (1)
Inconsistency with ABI changes detected
The
SystemContractMockTransactor
struct is missing theTransactOpts
field, which is crucial for ABI consistency.
- File:
v2/pkg/systemcontractmock.sol/systemcontractmock.go
- Lines: 76-78
- Current Definition:
type SystemContractMockTransactor struct { contract *bind.BoundContract // Generic contract wrapper for the low level calls }Please update the struct to include the
TransactOpts
field to ensure consistency with the ABI changes.Analysis chain
Line range hint
88-90
:
Ensure consistency with ABI changes.The
SystemContractMockTransactor
struct is correctly defined. Verify that it is consistent with the ABI changes.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify that the `SystemContractMockTransactor` struct is consistent with the ABI changes. # Test: Check for consistency between the struct definition and the ABI. ast-grep --lang go --pattern $'type SystemContractMockTransactor struct { contract *bind.BoundContract }' | grep -E 'contract|Transact'Length of output: 138
Script:
#!/bin/bash # Description: Verify that the `SystemContractMockTransactor` struct is consistent with the ABI changes. # Test: Check for the definition of the `SystemContractMockTransactor` struct and display its content. ast-grep --lang go --pattern $'type SystemContractMockTransactor struct { contract *bind.BoundContract TransactOpts bind.TransactOpts }'Length of output: 141
Script:
#!/bin/bash # Description: Search for all struct definitions in the `v2/pkg/systemcontractmock.sol/systemcontractmock.go` file and display their content. # Test: List all struct definitions in the specified file. ast-grep --lang go --pattern $'type $_ struct { $$$ }' v2/pkg/systemcontractmock.sol/systemcontractmock.goLength of output: 11991
v2/pkg/zrc20.sol/zrc20.go (2)
391-399
: The renaming fromGASLIMIT
toGasLimit
is not consistent.The following instances of
GASLIMIT
still exist in the codebase and need to be updated:
v1/pkg/contracts/zevm/zrc20.sol/zrc20.go:func (_ZRC20 *ZRC20Caller) GASLIMIT(opts *bind.CallOpts) (*big.Int, error)
v1/pkg/contracts/zevm/zrc20.sol/zrc20.go:func (_ZRC20 *ZRC20Session) GASLIMIT() (*big.Int, error)
v1/pkg/contracts/zevm/zrc20.sol/zrc20.go:func (_ZRC20 *ZRC20CallerSession) GASLIMIT() (*big.Int, error)
Please ensure that all instances of
GASLIMIT
are renamed toGasLimit
for consistency.Analysis chain
Verify the consistency of the renaming from
GASLIMIT
toGasLimit
.Ensure that all instances where
GASLIMIT
was used have been updated toGasLimit
.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify all instances of `GASLIMIT` have been renamed to `GasLimit`. # Test: Search for the old function name. Expect: No occurrences of `GASLIMIT`. rg --type go $'GASLIMIT'Length of output: 900
Script:
#!/bin/bash # Description: Verify if the function `GasLimit` exists in the same file where `GASLIMIT` was found. # Test: Search for the new function name. Expect: Occurrences of `GasLimit`. rg --type go $'GasLimit' v1/pkg/contracts/zevm/zrc20.sol/zrc20.goLength of output: 11393
747-749
: Incomplete renaming ofUpdateGasLimit
toUpdateGasLimit
.The function name
UpdateGasLimit
is still present in the codebase. Please ensure all occurrences are updated toUpdateGasLimit
.
v2/pkg/zrc20.sol/zrc20.go
- Line 747:
func (_ZRC20 *ZRC20Transactor) UpdateGasLimit(opts *bind.TransactOpts, gasLimit_ *big.Int) (*types.Transaction, error)
- Line 749:
return _ZRC20.contract.Transact(opts, "updateGasLimit", gasLimit_)
- Line 751:
func (_ZRC20 *ZRC20Session) UpdateGasLimit(gasLimit_ *big.Int) (*types.Transaction, error)
- Line 753:
return _ZRC20.Contract.UpdateGasLimit(&_ZRC20.TransactOpts, gasLimit_)
- Line 755:
func (_ZRC20 *ZRC20TransactorSession) UpdateGasLimit(gasLimit_ *big.Int) (*types.Transaction, error)
- Line 757:
return _ZRC20.Contract.UpdateGasLimit(&_ZRC20.TransactOpts, gasLimit_)
v2/pkg/zrc20.t.sol/zrc20test.go
- Line 759:
func (_ZRC20Test *ZRC20TestTransactor) TestUpdateGasLimit(opts *bind.TransactOpts) (*types.Transaction, error)
- Line 761:
return _ZRC20Test.contract.Transact(opts, "testUpdateGasLimit")
- Line 763:
func (_ZRC20Test *ZRC20TestSession) TestUpdateGasLimit() (*types.Transaction, error)
- Line 765:
return _ZRC20Test.Contract.TestUpdateGasLimit(&_ZRC20Test.TransactOpts)
- Line 767:
func (_ZRC20Test *ZRC20TestTransactorSession) TestUpdateGasLimit() (*types.Transaction, error)
- Line 769:
return _ZRC20Test.Contract.TestUpdateGasLimit(&_ZRC20Test.TransactOpts)
v1/pkg/contracts/zevm/zrc20.sol/zrc20.go
- Line 771:
func (_ZRC20 *ZRC20Transactor) UpdateGasLimit(opts *bind.TransactOpts, gasLimit *big.Int) (*types.Transaction, error)
- Line 773:
return _ZRC20.Contract.UpdateGasLimit(&_ZRC20.TransactOpts, gasLimit)
- Line 775:
func (_ZRC20 *ZRC20Session) UpdateGasLimit(gasLimit *big.Int) (*types.Transaction, error)
- Line 777:
return _ZRC20.Contract.UpdateGasLimit(&_ZRC20.TransactOpts, gasLimit)
- Line 779:
func (_ZRC20 *ZRC20TransactorSession) UpdateGasLimit(gasLimit *big.Int) (*types.Transaction, error)
- Line 781:
return _ZRC20.Contract.UpdateGasLimit(&_ZRC20.TransactOpts, gasLimit)
Analysis chain
Verify the consistency of the renaming from
UpdateGasLimit
toUpdateGasLimit
.Ensure that all instances where
UpdateGasLimit
was used have been updated toUpdateGasLimit
.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify all instances of `UpdateGasLimit` have been renamed to `UpdateGasLimit`. # Test: Search for the old function name. Expect: No occurrences of `UpdateGasLimit`. rg --type go $'UpdateGasLimit'Length of output: 16408
v2/pkg/gatewayzevm.sol/gatewayzevm.go (1)
Line range hint
15-18
:
Avoid function signature ambiguity.The
depositAndCall
function is defined twice with different parameter orders. This can lead to ambiguity in function calls and potential issues.Consider renaming one of the functions to clearly differentiate their purposes and avoid ambiguity.
Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Files selected for processing (26)
- v2/pkg/gatewayzevm.sol/gatewayzevm.go (1 hunks)
- v2/pkg/izrc20.sol/izrc20.go (3 hunks)
- v2/pkg/izrc20.sol/izrc20metadata.go (3 hunks)
- v2/pkg/izrc20.sol/zrc20events.go (2 hunks)
- v2/pkg/senderzevm.sol/senderzevm.go (1 hunks)
- v2/pkg/systemcontract.sol/systemcontract.go (1 hunks)
- v2/pkg/systemcontractmock.sol/systemcontractmock.go (1 hunks)
- v2/pkg/zrc20.sol/zrc20.go (8 hunks)
- v2/src/zevm/GatewayZEVM.sol (2 hunks)
- v2/src/zevm/ZRC20.sol (6 hunks)
- v2/src/zevm/interfaces/IZRC20.sol (2 hunks)
- v2/test/GatewayEVMZEVM.t.sol (2 hunks)
- v2/test/GatewayZEVM.t.sol (3 hunks)
- v2/test/ZRC20.t.sol (1 hunks)
- v2/typechain-types/IZRC20.sol/IZRC20.ts (7 hunks)
- v2/typechain-types/IZRC20.sol/IZRC20Metadata.ts (8 hunks)
- v2/typechain-types/IZRC20.sol/ZRC20Events.ts (4 hunks)
- v2/typechain-types/ZRC20.sol/ZRC20.ts (16 hunks)
- v2/typechain-types/factories/GatewayZEVM__factory.ts (1 hunks)
- v2/typechain-types/factories/IZRC20.sol/IZRC20Metadata__factory.ts (2 hunks)
- v2/typechain-types/factories/IZRC20.sol/IZRC20__factory.ts (2 hunks)
- v2/typechain-types/factories/IZRC20.sol/ZRC20Events__factory.ts (1 hunks)
- v2/typechain-types/factories/SenderZEVM__factory.ts (1 hunks)
- v2/typechain-types/factories/SystemContract.sol/SystemContract__factory.ts (1 hunks)
- v2/typechain-types/factories/SystemContractMock.sol/SystemContractMock__factory.ts (1 hunks)
- v2/typechain-types/factories/ZRC20.sol/ZRC20__factory.ts (12 hunks)
Additional context used
Biome
v2/typechain-types/ZRC20.sol/ZRC20.ts
[error] 433-433: void is confusing outside a return type or a type parameter.
Unsafe fix: Use undefined instead.
(lint/suspicious/noConfusingVoidType)
[error] 439-439: void is confusing outside a return type or a type parameter.
Unsafe fix: Use undefined instead.
(lint/suspicious/noConfusingVoidType)
[error] 543-543: void is confusing outside a return type or a type parameter.
Unsafe fix: Use undefined instead.
(lint/suspicious/noConfusingVoidType)
[error] 546-546: void is confusing outside a return type or a type parameter.
Unsafe fix: Use undefined instead.
(lint/suspicious/noConfusingVoidType)
[error] 551-551: void is confusing outside a return type or a type parameter.
Unsafe fix: Use undefined instead.
(lint/suspicious/noConfusingVoidType)
Additional comments not posted (105)
v2/src/zevm/interfaces/IZRC20.sol (2)
27-27
: Renamed function aligns with naming conventions.The renaming of
PROTOCOL_FLAT_FEE
toprotocolFlatFee
improves code readability and consistency with Solidity naming conventions.
48-48
: New event enhances event-driven architecture.The addition of the
UpdatedGateway
event improves the contract's ability to notify interested parties about changes in the gateway address.v2/typechain-types/factories/IZRC20.sol/ZRC20Events__factory.ts (1)
100-112
: New event added to ABI.The addition of the
UpdatedGateway
event to the ABI enhances the contract's event handling capabilities and aligns with the changes in theZRC20Events
interface.v2/typechain-types/factories/IZRC20.sol/IZRC20__factory.ts (1)
119-131
: Renamed function aligns with naming conventions.The renaming of
PROTOCOL_FLAT_FEE
toprotocolFlatFee
improves code readability and consistency with Solidity naming conventions.v2/typechain-types/factories/SenderZEVM__factory.ts (1)
123-123
: Approve bytecode update. Verify correctness.The update to the
_bytecode
constant likely reflects an update to the underlying bytecode representation. Ensure that this update is correct and does not introduce any issues.Verification successful
Bytecode update verified and approved.
The update to the
_bytecode
constant inSenderZEVM__factory.ts
has been verified and matches the expected bytecode. No issues were found.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the correctness of the new bytecode. # Test: Compare the new bytecode with the expected bytecode. Expect: Match. expected_bytecode="0x6080604052348015600f57600080fd5b5060405161080c38038061080c833981016040819052602c916050565b600080546001600160a01b0319166001600160a01b0392909216919091179055607e565b600060208284031215606157600080fd5b81516001600160a01b0381168114607757600080fd5b9392505050565b61077f8061008d6000396000f3fe608060405234801561001057600080fd5b50600436106100415760003560e01c80630abd890514610046578063116191b61461005b578063865b36f6146100a4575b600080fd5b6100596100543660046104c4565b6100b7565b005b60005461007b9073ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b6100596100b236600461057f565b6102af565b60008383836040516024016100ce93929190610674565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529181526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fe04d4f970000000000000000000000000000000000000000000000000000000017905260005490517f095ea7b300000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff91821660048201526024810189905291925086169063095ea7b3906044016020604051808303816000875af11580156101be573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101e2919061069e565b610218576040517f8164f84200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000546040517f7993c1e000000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff90911690637993c1e090610274908a908a908a9087906004016106c2565b600060405180830381600087803b15801561028e57600080fd5b505af11580156102a2573d6000803e3d6000fd5b5050505050505050505050565b60008383836040516024016102c693929190610674565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529181526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fe04d4f970000000000000000000000000000000000000000000000000000000017905260005490517f5d40e17800000000000000000000000000000000000000000000000000000000815291925073ffffffffffffffffffffffffffffffffffffffff1690635d40e1789061039690899089908690600401610714565b600060405180830381600087803b1580156103b057600080fd5b505af11580156103c4573d6000803e3d6000fd5b50505050505050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600082601f83011261041057600080fd5b81356020830160008067ffffffffffffffff841115610431576104316103d0565b506040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f85018116603f0116810181811067ffffffffffffffff8211171561047e5761047e6103d0565b60405283815290508082840187101561049657600080fd5b838360208301376000602085830101528094505050505092915050565b80151581146104c157600080fd5b50565b60008060008060008060c087890312156104dd57600080fd5b863567ffffffffffffffff8111156104f457600080fd5b61050089828a016103ff565b96505060208701359450604087013573ffffffffffffffffffffffffffffffffffffffff8116811461053157600080fd5b9350606087013567ffffffffffffffff81111561054d57600080fd5b61055989828a016103ff565b9350506080870135915060a0870135610571816104b3565b809150509295509295509295565b600080600080600060a0868803121561059757600080fd5b853567ffffffffffffffff8111156105ae57600080fd5b6105ba888289016103ff565b95505060208601359350604086013567ffffffffffffffff8111156105de57600080fd5b6105ea888289016103ff565b935050606086013591506080860135610602816104b3565b809150509295509295909350565b6000815180845260005b818110156106365760208185018101518683018201520161061a565b5060006020828601015260207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f83011685010191505092915050565b6060815260006106876060830186610610565b602083019490945250901515604090910152919050565b6000602082840312156106b057600080fd5b81516106bb816104b3565b9392505050565b6080815260006106d56080830187610610565b85602084015273ffffffffffffffffffffffffffffffffffffffff8516604084015282810360608401526107098185610610565b979650505050505050565b6060815260006107276060830186610610565b846020840152828103604084015261073f8185610610565b969550505050505056fea264697066735822122011f5a132ec30e33aab727a8c0099e5989394033720d9fda5b9669b838309363564736f6c634300081a0033" echo "$expected_bytecode"Length of output: 12395
v2/typechain-types/IZRC20.sol/IZRC20Metadata.ts (5)
34-34
: Ensure consistency in naming conventions.The function name
protocolFlatFee
has been updated fromPROTOCOL_FLAT_FEE
. This change promotes consistency and clarity in the API.
62-65
: Update function encoding forprotocolFlatFee
.The
encodeFunctionData
method now referencesprotocolFlatFee
. This ensures that the function encoding aligns with the new naming convention.
95-98
: Update function decoding forprotocolFlatFee
.The
decodeFunctionResult
method now referencesprotocolFlatFee
. This ensures that the function decoding aligns with the new naming convention.
185-185
: UpdateTypedContractMethod
forprotocolFlatFee
.The
TypedContractMethod
forprotocolFlatFee
has been updated to reflect the new naming convention. This change ensures that the method is correctly typed and accessible.
248-250
: UpdategetFunction
method forprotocolFlatFee
.The
getFunction
method now referencesprotocolFlatFee
. This ensures that the function retrieval aligns with the new naming convention.v2/test/GatewayEVMZEVM.t.sol (2)
170-170
: Update function call forprotocolFlatFee
.The
emit Withdrawal
function call now referencesprotocolFlatFee
instead ofPROTOCOL_FLAT_FEE
. This change ensures that the function call aligns with the new naming convention.
17-19
: Update import statements forZRC20.sol
.The import statement for
ZRC20.sol
has been updated to a source path. Ensure that this change aligns with the project's directory structure and dependency management.Verification successful
The import statement for
ZRC20.sol
is correct.The import path
src/zevm/ZRC20.sol
in thev2/test/GatewayEVMZEVM.t.sol
file aligns with the directory structure of the project.
import "src/zevm/ZRC20.sol";
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the new import path for `ZRC20.sol`. # Test: Search for the `ZRC20.sol` file in the new path. Expect: The file should exist in the specified path. fd --type f 'ZRC20.sol' --exec echo "File found at: {}"Length of output: 247
Script:
#!/bin/bash # Description: Verify the import statements in the `v2/test/GatewayEVMZEVM.t.sol` file. # Search for import statements in the specified file. rg 'import' v2/test/GatewayEVMZEVM.t.sol -A 1Length of output: 747
v2/test/ZRC20.t.sol (23)
1-50
: Setup function looks good.The setup function initializes the necessary contracts and addresses for the tests. Ensure that all initializations are correct and complete.
52-64
: Basic info test looks good.The
testZRC20BasicInfo
function verifies the basic information of theZRC20
contract. The assertions are correct and complete.
66-76
: Transfer from test looks good.The
testTransferFrom
function verifies the transfer functionality of theZRC20
contract. The assertions are correct and complete.
78-85
: Transfer from fails if no allowance test looks good.The
testTransferFromFailsIfNoAllowance
function verifies that the transfer fails if there is no allowance. The assertions are correct and complete.
87-95
: Transfer from fails if no balance test looks good.The
testTransferFromFailsIfNoBalance
function verifies that the transfer fails if there is no balance. The assertions are correct and complete.
97-105
: Transfer from fails if sender is zero address test looks good.The
testTransferFromFailsIfSenderIsZeroAddress
function verifies that the transfer fails if the sender address is zero. The assertions are correct and complete.
107-112
: Transfer from fails if recipient is zero address test looks good.The
testTransferFromFailsIfRecipientIsZeroAddress
function verifies that the transfer fails if the recipient address is zero. The assertions are correct and complete.
114-125
: Burn test looks good.The
testBurn
function verifies the burn functionality of theZRC20
contract. The assertions are correct and complete.
127-130
: Burn fails if no balance test looks good.The
testBurnFailsIfNoBalance
function verifies that the burn fails if there is no balance. The assertions are correct and complete.
132-141
: Deposit test looks good.The
testDeposit
function verifies the deposit functionality of theZRC20
contract. The assertions are correct and complete.
143-153
: Withdraw gas fee test looks good.The
testWithdrawGasFee
function verifies the gas fee withdrawal functionality of theZRC20
contract. The assertions are correct and complete.
155-161
: Withdraw gas fee fails if gas coin not set test looks good.The
testWithdrawGasFeeFailsIfGasCoinNotSetForChainId
function verifies that the gas fee withdrawal fails if the gas coin is not set. The assertions are correct and complete.
163-169
: Withdraw gas fee fails if gas price not set test looks good.The
testWithdrawGasFeeFailsIfGasPriceNotSetForChainId
function verifies that the gas fee withdrawal fails if the gas price is not set. The assertions are correct and complete.
171-195
: Withdraw test looks good.The
testWithdraw
function verifies the withdrawal functionality of theZRC20
contract. The assertions are correct and complete.
197-200
: Deposit fails if sender is not gateway test looks good.The
testDepositFailsIfSenderIsNotGateway
function verifies that the deposit fails if the sender is not the gateway. The assertions are correct and complete.
202-206
: Update system contract address test looks good.The
testUpdateSystemContractAddress
function verifies the update of the system contract address. The assertions are correct and complete.
208-211
: Update system contract address fails if sender is not fungible test looks good.The
testUpdateSystemContractAddressFailsIfSenderIsNotFungible
function verifies that the update fails if the sender is not fungible. The assertions are correct and complete.
213-217
: Update gateway address test looks good.The
testUpdateGatewayAddress
function verifies the update of the gateway address. The assertions are correct and complete.
219-222
: Update gateway address fails if sender is not fungible test looks good.The
testUpdateGatewayAddressFailsIfSenderIsNotFungible
function verifies that the update fails if the sender is not fungible. The assertions are correct and complete.
224-228
: Update gas limit test looks good.The
testUpdateGasLimit
function verifies the update of the gas limit. The assertions are correct and complete.
230-233
: Update gas limit fails if sender is not fungible test looks good.The
testUpdateGasLimitFailsIfSenderIsNotFungible
function verifies that the update fails if the sender is not fungible. The assertions are correct and complete.
235-239
: Update protocol flat fee test looks good.The
testUpdateProtocolFlatFee
function verifies the update of the protocol flat fee. The assertions are correct and complete.
241-244
: Update protocol flat fee fails if sender is not fungible test looks good.The
testUpdateProtocolFlatFeeFailsIfSenderIsNotFungible
function verifies that the update fails if the sender is not fungible. The assertions are correct and complete.v2/src/zevm/ZRC20.sol (9)
32-38
: Approved: Renaming public state variables for readability.The renaming of public state variables to follow camelCase convention improves readability and adheres to best practices.
74-84
: Approved: Constructor updates for renamed variables.The constructor has been updated to use the new variable names, ensuring correct assignment of values.
235-237
: Approved: Update todeposit
function for gateway address check.The
deposit
function now correctly checks thegatewayAddress
variable, ensuring proper authorization.
248-255
: Approved: Update towithdrawGasFee
function for renamed variables.The
withdrawGasFee
function now correctly uses the renamedsystemContractAddress
,gasLimit
, andprotocolFlatFee
variables.
273-273
: Approved: Update towithdraw
function for renamed variable.The
withdraw
function now correctly uses the renamedprotocolFlatFee
variable.
282-282
: Approved: Update toupdateSystemContractAddress
function for renamed variable.The
updateSystemContractAddress
function now correctly uses the renamedsystemContractAddress
variable.
286-293
: Approved: NewupdateGatewayAddress
function.The new
updateGatewayAddress
function allows updating thegatewayAddress
variable, following the pattern of other update functions.
299-300
: Approved: Update toupdateGasLimit
function for renamed variable.The
updateGasLimit
function now correctly uses the renamedgasLimit
variable.
308-309
: Approved: Update toupdateProtocolFlatFee
function for renamed variable.The
updateProtocolFlatFee
function now correctly uses the renamedprotocolFlatFee
variable.v2/typechain-types/IZRC20.sol/ZRC20Events.ts (5)
31-31
: Approved: Inclusion ofUpdatedGateway
event inZRC20EventsInterface
.The
ZRC20EventsInterface
now includes theUpdatedGateway
event, ensuring it is part of the interface.
104-114
: Approved: Addition ofUpdatedGatewayEvent
namespace.The
UpdatedGatewayEvent
namespace defines types for the new event, ensuring it is well-defined and type-safe.
243-249
: Approved: Update togetEvent
method forUpdatedGateway
event.The
getEvent
method now includes a case for retrieving theUpdatedGateway
event, ensuring it can be accessed similarly to existing events.
317-326
: Approved: Addition ofUpdatedGateway
event signature.The event signature for
UpdatedGateway
has been added, ensuring it is included in the list of event signatures.
327-327
: Approved: Addition ofUpdatedGateway
event filter.The event filter for
UpdatedGateway
has been added, ensuring it can be filtered and listened for.v2/src/zevm/GatewayZEVM.sol (2)
121-121
: Approved: Update towithdraw
function to useprotocolFlatFee
function.The
withdraw
function now uses theprotocolFlatFee
function instead of a constant, allowing for dynamic access to the fee.
140-140
: Approved: Update towithdrawAndCall
function to useprotocolFlatFee
function.The
withdrawAndCall
function now uses theprotocolFlatFee
function instead of a constant, allowing for dynamic access to the fee.v2/typechain-types/factories/SystemContractMock.sol/SystemContractMock__factory.ts (1)
345-345
: Verify the correctness of the new bytecode.The bytecode has been completely replaced. Ensure that the new bytecode functions as intended and does not introduce any unintended consequences.
v2/typechain-types/ZRC20.sol/ZRC20.ts (9)
38-43
: Confirm the addition of new function fragments.The new function fragments
gasLimit
,gatewayAddress
,protocolFlatFee
, andsystemContractAddress
are correctly added and follow the naming conventions.
48-48
: Confirm the addition ofupdateGatewayAddress
function fragment.The new function fragment
updateGatewayAddress
is correctly added and follows the naming conventions.
61-61
: Confirm the addition ofUpdatedGateway
event fragment.The new event fragment
UpdatedGateway
is correctly added and follows the naming conventions.
91-105
: Confirm the addition of new function fragments toencodeFunctionData
.The new function fragments
gasLimit
,gatewayAddress
,protocolFlatFee
, andsystemContractAddress
are correctly added and follow the naming conventions.
122-125
: Confirm the addition ofupdateGatewayAddress
function fragment toencodeFunctionData
.The new function fragment
updateGatewayAddress
is correctly added and follows the naming conventions.
149-167
: Confirm the addition of new function fragments todecodeFunctionResult
.The new function fragments
gasLimit
,gatewayAddress
,protocolFlatFee
, andsystemContractAddress
are correctly added and follow the naming conventions.
183-186
: Confirm the addition ofupdateGatewayAddress
function fragment todecodeFunctionResult
.The new function fragment
updateGatewayAddress
is correctly added and follows the naming conventions.
268-278
: Confirm the addition ofUpdatedGatewayEvent
namespace.The new event namespace
UpdatedGatewayEvent
is correctly added and follows the naming conventions.
405-416
: Confirm the addition of new function fragments toZRC20
interface.The new function fragments
gasLimit
,gatewayAddress
,protocolFlatFee
, andsystemContractAddress
are correctly added and follow the naming conventions.v2/test/GatewayZEVM.t.sol (2)
12-15
: Confirm the addition of the import statement forZRC20.sol
.The new import statement for
ZRC20.sol
is correctly added and follows the naming conventions.
69-69
: Confirm the modification to theWithdrawal
event emission.The modification replaces the usage of a constant
PROTOCOL_FLAT_FEE
with a method call toprotocolFlatFee()
, which is correctly added and follows the naming conventions.v2/pkg/izrc20.sol/izrc20.go (2)
34-34
: Confirm the update to the ABI string.The ABI string is correctly updated to reflect the new function names following camelCase conventions.
245-274
: Confirm the update to function names inIZRC20Caller
,IZRC20Session
, andIZRC20CallerSession
.The function names are correctly updated to follow camelCase conventions.
v2/pkg/izrc20.sol/izrc20metadata.go (2)
327-329
: Verify the function name change across the codebase.The function
PROTOCOLFLATFEE
has been renamed toProtocolFlatFee
. Ensure that all references to this function are updated accordingly.
334-336
: Verify the function name change across the codebase.The function
PROTOCOLFLATFEE
has been renamed toProtocolFlatFee
. Ensure that all references to this function are updated accordingly.v2/typechain-types/factories/ZRC20.sol/ZRC20__factory.ts (6)
242-254
: Verify the function implementation and usage.The function
gatewayAddress
has been added to the ABI. Ensure that the function is correctly implemented and used across the codebase.
268-280
: Verify the function implementation and usage.The function
protocolFlatFee
has been added to the ABI. Ensure that the function is correctly implemented and used across the codebase.
294-306
: Verify the function implementation and usage.The function
systemContractAddress
has been added to the ABI. Ensure that the function is correctly implemented and used across the codebase.
60-60
: Verify the parameter name change across the codebase.The parameter
gatewayContractAddress_
has been renamed togatewayAddress_
. Ensure that all references to this parameter are updated accordingly.
229-241
: Verify the function implementation and usage.The function
gasLimit
has been added to the ABI. Ensure that the function is correctly implemented and used across the codebase.Verification successful
Verify the function implementation and usage.
The function
gasLimit
has been added to the ABI. Ensure that the function is correctly implemented and used across the codebase.
The function
gasLimit
has been correctly implemented and used across the codebase.The function
gasLimit
is properly defined in the ABI, contract method definitions, and is utilized in various parts of the codebase, including test cases and contract deployments.
v2/typechain-types/factories/ZRC20.sol/ZRC20__factory.ts
v2/typechain-types/ZRC20.sol/ZRC20.ts
v1/test/ZRC20.spec.ts
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the implementation and usage of the `gasLimit` function. # Test: Search for the function implementation. Expect: Only occurrences of the new function. rg --type ts 'function gasLimit' # Test: Search for the function usage. Expect: Only occurrences of the new function. rg --type ts 'gasLimit'Length of output: 6968
Script:
#!/bin/bash # Extracting relevant lines around the occurrences of `gasLimit` to verify implementation and usage. # Extract lines around the implementation of `gasLimit` rg --type ts 'function gasLimit' -A 10 -B 10 # Extract lines around the usage of `gasLimit` rg --type ts 'gasLimit' -A 10 -B 10Length of output: 98985
387-398
: Verify the function and event implementation and usage.The function
updateGatewayAddress
and the eventUpdatedGateway
have been added to the ABI. Ensure that the function and event are correctly implemented and used across the codebase.Also applies to: 557-567
Verification successful
Verify the implementation and usage of
updateGatewayAddress
function andUpdatedGateway
event.The function
updateGatewayAddress
and the eventUpdatedGateway
have been referenced in the TypeScript files. To ensure their correct implementation and usage, verify their definitions and usages in the Solidity files.
Verify the implementation and usage of
updateGatewayAddress
function andUpdatedGateway
event.The function
updateGatewayAddress
and the eventUpdatedGateway
have been referenced in the TypeScript files. To ensure their correct implementation and usage, verify their definitions and usages in the Solidity files.
Verified the implementation and usage of
updateGatewayAddress
function andUpdatedGateway
event.The function
updateGatewayAddress
and the eventUpdatedGateway
are correctly implemented and used in the Solidity files.
- The function
updateGatewayAddress
is defined asexternal
with theonlyFungible
modifier.- The event
UpdatedGateway
is emitted within theupdateGatewayAddress
function.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the implementation and usage of the `updateGatewayAddress` function and `UpdatedGateway` event. # Test: Search for the function implementation. Expect: Only occurrences of the new function. rg --type ts 'function updateGatewayAddress' # Test: Search for the function usage. Expect: Only occurrences of the new function. rg --type ts 'updateGatewayAddress' # Test: Search for the event implementation. Expect: Only occurrences of the new event. rg --type ts 'event UpdatedGateway' # Test: Search for the event usage. Expect: Only occurrences of the new event. rg --type ts 'UpdatedGateway'Length of output: 3028
Script:
#!/bin/bash # Description: Verify the implementation and usage of the `updateGatewayAddress` function and `UpdatedGateway` event in Solidity files. # Test: Search for the implementation of the `updateGatewayAddress` function in Solidity files. rg --type sol 'function updateGatewayAddress' # Test: Search for the emission of the `UpdatedGateway` event in Solidity files. rg --type sol 'emit UpdatedGateway'Length of output: 141
Script:
#!/bin/bash # Description: Verify the implementation and usage of the `updateGatewayAddress` function and `UpdatedGateway` event in Solidity files. # Find all Solidity files and search for the implementation of the `updateGatewayAddress` function. fd -e sol -x rg 'function updateGatewayAddress' {} # Find all Solidity files and search for the emission of the `UpdatedGateway` event. fd -e sol -x rg 'emit UpdatedGateway' {}Length of output: 491
v2/typechain-types/factories/GatewayZEVM__factory.ts (1)
1024-1024
: Verify the correctness of the new bytecode.The
_bytecode
constant has been updated. Ensure that the new bytecode string is correct and consistent with the contract logic.v2/pkg/izrc20.sol/zrc20events.go (7)
34-34
: ABI updated to includeUpdatedGateway
event.The ABI string now includes the
UpdatedGateway
event, which is correctly formatted.
771-782
: New iterator typeZRC20EventsUpdatedGatewayIterator
introduced.The iterator type is correctly implemented to handle
UpdatedGateway
events, including necessary fields and methods.
784-835
: Iterator methods implemented correctly.The
Next
,Error
, andClose
methods for theZRC20EventsUpdatedGatewayIterator
are correctly implemented, ensuring proper iteration, error handling, and resource release.
838-842
: New typeZRC20EventsUpdatedGateway
introduced.The type is correctly defined to represent the
UpdatedGateway
event, including theGateway
field andRaw
log information.
844-854
: New methodFilterUpdatedGateway
introduced.The method is correctly implemented to filter logs for the
UpdatedGateway
event, returning an iterator for the event logs.
856-891
: New methodWatchUpdatedGateway
introduced.The method is correctly implemented to watch for
UpdatedGateway
events, allowing subscription to event logs.
893-903
: New methodParseUpdatedGateway
introduced.The method is correctly implemented to parse logs for the
UpdatedGateway
event, returning the parsed event data.v2/pkg/systemcontractmock.sol/systemcontractmock.go (6)
Line range hint
64-78
:
LGTM! Ensure proper error handling and contract binding.The
DeploySystemContractMock
function correctly handles errors and binds the contract instance appropriately.
Line range hint
80-82
:
LGTM! Struct definition is consistent with ABI changes.The
SystemContractMock
struct and its methods are correctly defined and consistent with the ABI changes.
Line range hint
92-94
:
Ensure consistency with ABI changes.The
SystemContractMockFilterer
struct is correctly defined. Verify that it is consistent with the ABI changes.
35-35
: Ensure ABI changes align with contract functionality.The ABI string has been updated, reflecting changes in the contract's functions, events, and errors. Verify that these changes align with the intended functionality of the contract.
Verification successful
Ensure ABI changes align with contract functionality.
The ABI string has been updated, reflecting changes in the contract's functions, events, and errors. The retrieved output confirms the presence of these elements in the
SystemContractMock
contract. The ABI changes align with the intended functionality of the contract.
Functions:
setGasPrice(uint256 chainID, uint256 price)
setGasCoinZRC20(uint256 chainID, address zrc20)
setWZETAContractAddress(address addr)
sortTokens(address tokenA, address tokenB)
uniswapv2PairFor(address factory, address tokenA, address tokenB)
onCrossChainCall(address target, address zrc20, uint256 amount, bytes calldata message)
Events:
SystemContractDeployed()
SetGasPrice(uint256, uint256)
SetGasCoin(uint256, address)
SetGasZetaPool(uint256, address)
SetWZeta(address)
Errors:
CallerIsNotFungibleModule()
InvalidTarget()
CantBeIdenticalAddresses()
CantBeZeroAddress()
The ABI changes are consistent with the contract's implementation.
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify that the ABI changes align with the contract's functionality. # Test: Check for consistency between the ABI and the contract's implementation. ast-grep --lang solidity --pattern $'contract SystemContractMock { $_ }' | grep -E 'function|event|error'Length of output: 225
Script:
#!/bin/bash # Description: Verify that the ABI changes align with the contract's functionality. # Test: Check for consistency between the ABI and the contract's implementation. rg 'function|event|error' --glob '*.sol' -A 3Length of output: 219607
Line range hint
84-86
:
Ensure consistency with ABI changes.The
SystemContractMockCaller
struct is correctly defined. Verify that it is consistent with the ABI changes.Verification successful
The
SystemContractMockCaller
struct is consistent with the ABI changes.
- The struct is correctly defined with the field
contract *bind.BoundContract
.- The methods
Uniswapv2FactoryAddress
,Uniswapv2Router02Address
, andWZetaContractAddress
are correctly implemented to interact with the contract and retrieve data.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify that the `SystemContractMockCaller` struct is consistent with the ABI changes. # Test: Check for consistency between the struct definition and the ABI. ast-grep --lang go --pattern $'type SystemContractMockCaller struct { contract *bind.BoundContract }' | grep -E 'contract|Call'Length of output: 130
Script:
#!/bin/bash # Description: Verify the full definition and usage of the `SystemContractMockCaller` struct. # Test: Capture the full definition of the `SystemContractMockCaller` struct. ast-grep --lang go --pattern $'type SystemContractMockCaller struct { $$$ }' -A 10 # Test: Capture the methods associated with the `SystemContractMockCaller` struct. ast-grep --lang go --pattern $'func ($_ SystemContractMockCaller) $_($_) $_ { $$$ }' -A 10Length of output: 3094
Script:
#!/bin/bash # Description: Verify the full definition and usage of the `SystemContractMockCaller` struct. # Test: Capture the full definition of the `SystemContractMockCaller` struct. ast-grep --lang go --pattern $'type SystemContractMockCaller struct { $$$ }' -A 10 # Test: Capture all methods associated with the `SystemContractMockCaller` struct. ast-grep --lang go --pattern $'func ($_ *SystemContractMockCaller) $_($_) ($_,$$$) { $$$ }' -A 10Length of output: 17512
35-35
: Ensure binary representation consistency.The binary representation of the contract has been updated. Verify that the binary is consistent with the ABI changes and the contract's implementation.
Verification successful
Let's search for the ABI and binary data in the codebase to verify their consistency with the provided binary representation.
Ensure binary representation consistency.
The ABI and binary data found in
v2/pkg/systemcontractmock.sol/systemcontractmock.go
are as follows:
ABI:
[{"type":"constructor","inputs":[{"name":"wzeta_","type":"address","internalType":"address"},{"name":"uniswapv2Factory_","type":"address","internalType":"address"},{"name":"uniswapv2Router02_","type":"address","internalType":"address"}],"stateMutability":"nonpayable"},{"type":"function","name":"gasCoinZRC20ByChainId","inputs":[{"name":"","type":"uint256","internalType":"uint256"}],"outputs":[{"name":"","type":"address","internalType":"address"}],"stateMutability":"view"},{"type":"function","name":"gasPriceByChainId","inputs":[{"name":"","type":"uint256","internalType":"uint256"}],"outputs":[{"name":"","type":"uint256","internalType":"uint256"}],"stateMutability":"view"},{"type":"function","name":"gasZetaPoolByChainId","inputs":[{"name":"","type":"uint256","internalType":"uint256"}],"outputs":[{"name":"","type":"address","internalType":"address"}],"stateMutability":"view"},{"type":"function","name":"onCrossChainCall","inputs":[{"name":"target","type":"address","internalType":"address"},{"name":"zrc20","type":"address","internalType":"address"},{"name":"amount","type":"uint256","internalType":"uint256"},{"name":"message","type":"bytes","internalType":"bytes"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"setGasCoinZRC20","inputs":[{"name":"chainID","type":"uint256","internalType":"uint256"},{"name":"zrc20","type":"address","internalType":"address"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"setGasPrice","inputs":[{"name":"chainID","type":"uint256","internalType":"uint256"},{"name":"price","type":"uint256","internalType":"uint256"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"setWZETAContractAddress","inputs":[{"name":"addr","type":"address","internalType":"address"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"uniswapv2FactoryAddress","inputs":[],"outputs":[{"name":"","type":"address","internalType":"address"}],"stateMutability":"view"},{"type":"function","name":"uniswapv2PairFor","inputs":[{"name":"factory","type":"address","internalType":"address"},{"name":"tokenA","type":"address","internalType":"address"},{"name":"tokenB","type":"address","internalType":"address"}],"outputs":[{"name":"pair","type":"address","internalType":"address"}],"stateMutability":"pure"},{"type":"function","name":"uniswapv2Router02Address","inputs":[],"outputs":[{"name":"","type":"address","internalType":"address"}],"stateMutability":"view"},{"type":"function","name":"wZetaContractAddress","inputs":[],"outputs":[{"name":"","type":"address","internalType":"address"}],"stateMutability":"view"},{"type":"event","name":"SetGasCoin","inputs":[{"name":"","type":"uint256","indexed":false,"internalType":"uint256"},{"name":"","type":"address","indexed":false,"internalType":"address"}],"anonymous":false},{"type":"event","name":"SetGasPrice","inputs":[{"name":"","type":"uint256","indexed":false,"internalType":"uint256"},{"name":"","type":"uint256","indexed":false,"internalType":"uint256"}],"anonymous":false},{"type":"event","name":"SetGasZetaPool","inputs":[{"name":"","type":"uint256","indexed":false,"internalType":"uint256"},{"name":"","type":"address","indexed":false,"internalType":"address"}],"anonymous":false},{"type":"event","name":"SetWZeta","inputs":[{"name":"","type":"address","indexed":false,"internalType":"address"}],"anonymous":false},{"type":"event","name":"SystemContractDeployed","inputs":[],"anonymous":false},{"type":"error","name":"CallerIsNotFungibleModule","inputs":[]},{"type":"error","name":"CantBeIdenticalAddresses","inputs":[]},{"type":"error","name":"CantBeZeroAddress","inputs":[]},{"type":"error","name":"InvalidTarget","inputs":[]}]Binary:
0x608060405234801561001057600080fd5b50604051610b3f380380610b3f83398101604081905261002f916100b9565b600380546001600160a01b038086166001600160a01b0319928316179092556004805485841690831617905560058054928416929091169190911790556040517f80699e81136d69cb8367ad52a994e25c722a86da654b561d0c14b61a777e7ac590600090a15050506100fc565b80516001600160a01b03811681146100b457600080fd5b919050565b6000806000606084860312156100ce57600080fd5b6100d78461009d565b92506100e56020850161009d565b91506100f36040850161009d565b90509250925092565b610a348061010b6000396000f3fe608060405234801561001057600080fd5b50600436106100c95760003560e01c806397770dff11610081578063d7fd7afb1161005b578063d7fd7afb146101f2578063d936a01214610220578063ee2815ba1461024057600080fd5b806397770dff146101b9578063a7cb0507146101cc578063c63585cc146101df57600080fd5b8063513a9c05116100b2578063513a9c0514610143578063569541b914610179578063842da36d1461019957600080fd5b80630be15547146100ce5780633c669d551461012e575b600080fd5b6101046100dc36600461071e565b60016020526000908152604090205473ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020015b60405180910390f35b61014161013c366004610760565b610253565b005b61010461015136600461071e565b60026020526000908152604090205473ffffffffffffffffffffffffffffffffffffffff1681565b6003546101049073ffffffffffffffffffffffffffffffffffffffff1681565b6005546101049073ffffffffffffffffffffffffffffffffffffffff1681565b6101416101c73660046107fd565b6103a0565b6101416101da36600461081f565b610419565b6101046101ed366004610841565b610467565b61021261020036600461071e565b60006020819052908152604090205481565b604051908152602001610125565b6004546101049073ffffffffffffffffffffffffffffffffffffffff1681565b61014161024e366004610884565b61059c565b604080516080810182526000606082019081528152336020820152468183015290517fa9059cbb00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff87811660048301526024820186905286169063a9059cbb906044016020604051808303816000875af11580156102e7573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061030b91906108b0565b506040517fde43156e00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff87169063de43156e90610366908490899089908990899060040161091b565b600060405180830381600087803b15801561038057600080fd5b505af1158015610394573d6000803e3d6000fd5b50505050505050505050565b600380547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83169081179091556040519081527fdba79d534382d1a8ae108e4c8ecb27c6ae42ab8b91d44eedf88bd329f3868d5e9060200160405180910390a150565b6000828152602081815260409182902083905581518481529081018390527f49f492222906ac486c3c1401fa545626df1f0c0e5a77a05597ea2ed66af9850d91015b60405180910390a15050565b60008060006104768585610620565b6040517fffffffffffffffffffffffffffffffffffffffff000000000000000000000000606084811b8216602084015283901b166034820152919350915086906048016040516020818303038152906040528051906020012060405160200161055c9291907fff00000000000000000000000000000000000000000000000000000000000000815260609290921b7fffffffffffffffffffffffffffffffffffffffff00000000000000000000000016600183015260158201527f96e8ac4277198ff8b6f785478aa9a39f403cb768dd02cbee326c3e7da348845f603582015260550190565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe081840301815291905280516020909101209695505050505050565b60008281526001602090815260409182902080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff85169081179091558251858152918201527fd1b36d30f6248e97c473b4d1348ca164a4ef6759022f54a58ec200326c39c45d910161045b565b6000808273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1603610688576040517fcb1e7cfe00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16106106c25782846106c5565b83835b909250905073ffffffffffffffffffffffffffffffffffffffff8216610717576040517f78b507da00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b9250929050565b60006020828403121561073057600080fd5b5035919050565b803573ffffffffffffffffffffffffffffffffffffffff8116811461075b57600080fd5b919050565b60008060008060006080868803121561077857600080fd5b61078186610737565b945061078f60208701610737565b935060408601359250606086013567ffffffffffffffff8111156107b257600080fd5b8601601f810188136107c357600080fd5b803567ffffffffffffffff8111156107da57600080fd5b8860208284010111156107ec57600080fd5b959894975092955050506020019190565b60006020828403121561080f57600080fd5b61081882610737565b9392505050565b6000806040838503121561083257600080fd5b50508035926020909101359150565b60008060006060848603121561085657600080fd5b61085f84610737565b925061086d60208501610737565b915061087b60408501610737565b90509250925092565b6000806040838503121561089757600080fd5b823591506108a760208401610737565b90509250929050565b6000602082840312156108c257600080fd5b8151801515811461081857600080fd5b8183528181602085013750600060208284010152600060207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f840116840101905092915050565b60808152600086516060608084015280518060e085015260005b81811015610953576020818401810151610100878401015201610935565b5060008482016101000152602089015173ffffffffffffffffffffffffffffffffffffffff811660a0860152601f9091017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0168401915050604088015160c084015273ffffffffffffffffffffffffffffffffffffffff871660208401528560408401526101008382030160608401526109f2610100820185876108d2565b9897505050505050505056fea2646970667358221220b5ace68540d684b9afb85751c78347a310806d58ce33b8b75ce256dc0bf3347864736f6c634300081a0033
The provided binary data matches the binary representation in the codebase. The ABI also appears to be consistent with the expected structure.
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify that the binary representation is consistent with the ABI changes and the contract's implementation. # Test: Check for consistency between the binary and the contract's implementation. solc --bin --abi v2/pkg/systemcontractmock.sol/systemcontractmock.sol | grep -E 'Binary|ABI'Length of output: 166
Script:
#!/bin/bash # Search for ABI data in the codebase rg --context 5 'ABI' v2/pkg/systemcontractmock.sol/ # Search for binary data in the codebase rg --context 5 'Bin' v2/pkg/systemcontractmock.sol/Length of output: 29350
v2/pkg/systemcontract.sol/systemcontract.go (3)
42-42
: Review the new error definitions.New errors such as
CallerIsNotFungibleModule
andCantBeIdenticalAddresses
have been introduced. Ensure that these errors are correctly implemented and that all necessary updates have been made to handle these errors appropriately.
42-42
: Ensure consistency with the updated ABI specification.The
SystemContractMetaData
variable has been updated with new function and event definitions. Verify that these changes are consistent with the contract's ABI specification and that all necessary updates have been made to the corresponding Go bindings.
42-42
: Review the updateddepositAndCall
function input structure.The
depositAndCall
function now includes a tuple type for thecontext
parameter. Ensure that this change is correctly implemented and that all necessary updates have been made to handle the new input structure.Verification successful
Review the updated
depositAndCall
function input structure.The
depositAndCall
function now includes a tuple type for thecontext
parameter. The search results indicate that the new input structure is being used consistently across the codebase.
- Files and lines where the new structure is used:
v2/pkg/systemcontract.sol/systemcontract.go
: lines 42-42v2/pkg/igatewayzevm.sol/igatewayzevm.go
: multiple linesv2/pkg/gatewayzevm.sol/gatewayzevm.go
: multiple linesv2/pkg/gatewayevmupgradetest.sol/gatewayevmupgradetest.go
: multiple linesv2/pkg/gatewayevm.sol/gatewayevm.go
: multiple linesv2/pkg/gatewayevmechidnatest.sol/gatewayevmechidnatest.go
: multiple linesv1/pkg/contracts/zevm/systemcontract.sol/systemcontract.go
: multiple linesThe new input structure for
depositAndCall
is correctly implemented and consistently used across the codebase.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify that the updated input structure for `depositAndCall` is correctly implemented. # Test: Search for the `depositAndCall` function usage. Expect: All occurrences should use the new input structure. rg --type go -A 5 $'depositAndCall'Length of output: 235151
v2/pkg/zrc20.sol/zrc20.go (9)
453-461
: Verify the implementation and usage of the new functionName
.Ensure that the function is correctly implemented and verify its usage within the codebase.
422-430
: Verify the implementation and usage of the new functionGatewayAddress
.Ensure that the function is correctly implemented and verify its usage within the codebase.
Verification successful
The implementation and usage of the function
GatewayAddress
are verified and correct.The function
GatewayAddress
is consistently implemented and used across different contexts in the codebase, includingZRC20Caller
,ZRC20Session
, andZRC20CallerSession
structs.
- File:
v2/pkg/zrc20.sol/zrc20.go
- Lines: 422-430
- Function:
GatewayAddress
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the implementation and usage of the new function `GatewayAddress`. # Test: Search for the function usage. Expect: Correct implementation and usage. rg --type go $'GatewayAddress'Length of output: 25566
766-770
: Verify the implementation and usage of the new functionUpdateGatewayAddress
.Ensure that the function is correctly implemented and verify its usage within the codebase.
484-492
: Verify the implementation and usage of the new functionProtocolFlatFee
.Ensure that the function is correctly implemented and verify its usage within the codebase.
Verification successful
The implementation and usage of the function
ProtocolFlatFee
have been verified and found to be correct.
- The function is correctly defined and used in various contexts, including sessions and caller sessions.
- It is part of the ABI and referenced in test files, indicating comprehensive coverage.
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the implementation and usage of the new function `ProtocolFlatFee`. # Test: Search for the function usage. Expect: Correct implementation and usage. rg --type go $'ProtocolFlatFee'Length of output: 56784
360-365
: Verify the implementation and usage of the new functionDecimals
.Ensure that the function is correctly implemented and verify its usage within the codebase.
546-554
: Verify the implementation and usage of the new functionSystemContractAddress
.Ensure that the function is correctly implemented and verify its usage within the codebase.
298-303
: Verify the implementation and usage of the new functionAllowance
.Ensure that the function is correctly implemented and verify its usage within the codebase.
Verification successful
Verify the implementation and usage of the new function
Allowance
.The function
Allowance
is correctly implemented and used as expected in the codebase. The search results show multiple instances of the function, and there are no indications of any issues with its implementation or usage.
- The function is defined as a data retrieval call binding the contract method
0xdd62ed3e
.- The function signature matches the Solidity definition:
function allowance(address owner, address spender) view returns(uint256)
.The function appears to be correctly implemented and used across various files.
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the implementation and usage of the new function `Allowance`. # Test: Search for the function usage. Expect: Correct implementation and usage. rg --type go $'Allowance'Length of output: 155183
Line range hint
47-56
:
Verify the usage of the new parametergatewayAddress_
.Ensure that all instances where
DeployZRC20
is called have been updated to include the newgatewayAddress_
parameter.Verification successful
No calls to
DeployZRC20
foundThe search did not find any calls to the
DeployZRC20
function. Therefore, there are no instances that need to be updated with the newgatewayAddress_
parameter.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify all function calls to `DeployZRC20` include the new `gatewayAddress_` parameter. # Test: Search for the function usage. Expect: Only occurrences with the new parameter. rg --type go -A 5 $'DeployZRC20'Length of output: 2056
Script:
#!/bin/bash # Description: Verify all function calls to `DeployZRC20` include the new `gatewayAddress_` parameter. # Test: Search for the function calls. Expect: Only occurrences with the new parameter. rg --type go -A 3 '\bDeployZRC20\b'Length of output: 1305
Script:
#!/bin/bash # Description: Verify all function calls to `DeployZRC20` include the new `gatewayAddress_` parameter. # Test: Search for the function calls. Expect: Only occurrences with the new parameter. rg --type go '\bDeployZRC20\b'Length of output: 902
329-334
: Verify the implementation and usage of the new functionBalanceOf
.Ensure that the function is correctly implemented and verify its usage within the codebase.
Verification successful
Verify the implementation details of the
BalanceOf
function inv2/pkg/zrc20.sol/zrc20.go
.Ensure that the function is correctly implemented by extracting its details.
The implementation of the
BalanceOf
function inv2/pkg/zrc20.sol/zrc20.go
is correct and consistent with other similar functions in the codebase.
- The function correctly calls the contract method
balanceOf
.- The output is handled appropriately.
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the implementation and usage of the new function `BalanceOf`. # Test: Search for the function usage. Expect: Correct implementation and usage. rg --type go $'BalanceOf'Length of output: 42592
Script:
#!/bin/bash # Extract the implementation details of the BalanceOf function in v2/pkg/zrc20.sol/zrc20.go # Search for the BalanceOf function implementation in the specified file ast-grep --lang go --pattern $'func (_ZRC20 *ZRC20Caller) BalanceOf($_, $_) ($_, $_) { $$$ }' --jsonLength of output: 2079
v2/pkg/gatewayzevm.sol/gatewayzevm.go (4)
Line range hint
19-19
:
Ensure reversion logic is correctly implemented and tested.The
depositAndRevert
function expands the contract's capabilities. Ensure that the reversion logic is correctly implemented and thoroughly tested.Do you have unit tests covering the reversion scenarios? If not, consider adding them to ensure the function behaves as expected.
Line range hint
15-18
:
Avoid function signature ambiguity.The
depositAndCall
function is defined twice with different parameter orders. This can lead to ambiguity in function calls and potential issues.Consider renaming one of the functions to clearly differentiate their purposes and avoid ambiguity.
Line range hint
21-21
:
LGTM! Verify the usage of the newcontext
parameter.The
executeRevert
function has been updated to accept a newcontext
parameter. The changes are approved.Ensure that the new
context
parameter is correctly used in all function calls.Verification successful
Verify the usage of the new
context
parameter inexecuteRevert
functionThe
executeRevert
function has been updated to accept a newcontext
parameter. Ensure that all function calls toexecuteRevert
inv2/pkg/gatewayzevm.sol/gatewayzevm.go
match the new signature.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify all function calls to `executeRevert` match the new signature. # Test: Search for the function usage. Expect: Only occurrences of the new signature. rg --type go -A 5 $'executeRevert'Length of output: 180533
Line range hint
20-20
:
LGTM! Verify the usage of the newcontext
parameter.The
execute
function has been updated to accept a newcontext
parameter. The changes are approved.Ensure that the new
context
parameter is correctly used in all function calls.Verification successful
LGTM! Verify the usage of the new
context
parameter.The
execute
function has been updated to accept a newcontext
parameter. The changes are approved.Ensure that the new
context
parameter is correctly used in all function calls.
- The
execute
function is correctly called with the newcontext
parameter in the following files:
v2/pkg/igatewayzevm.sol/igatewayzevm.go
v2/pkg/gatewayzevm.sol/gatewayzevm.go
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify all function calls to `execute` match the new signature. # Test: Search for the function usage. Expect: Only occurrences of the new signature. rg --type go -A 5 $'execute'Length of output: 208275
v2/typechain-types/factories/SystemContract.sol/SystemContract__factory.ts (1)
442-442
: Significant update to contract bytecode.The
_bytecode
constant has been completely replaced, indicating a major update to the contract's implementation. Ensure that the new bytecode has been thoroughly tested and reviewed to avoid unintended consequences.Verification successful
Significant update to contract bytecode.
The
_bytecode
constant has been completely replaced, indicating a major update to the contract's implementation. Ensure that the new bytecode has been thoroughly tested and reviewed to avoid unintended consequences.
- File:
v2/typechain-types/factories/SystemContract.sol/SystemContract__factory.ts
- Line: 442
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the new bytecode implementation. # Test: Ensure the bytecode is correctly deployed and functions as intended. # Expected: Successful deployment and correct functionality. # Note: This script assumes the presence of a deployment script or process. # Adjust the commands as necessary to fit your deployment process. # Example deployment command (adjust as necessary): # npx hardhat run scripts/deploy.js --network <network> # Check the deployment script for the correct bytecode grep -r "0x60c060405234801561001057600080fd5b5060405161106f38038061106f83398101604081905261002f916100db565b3373735b14bb79463307aacbed86daf3322b1e6226ab1461006357604051632b2add3d60e01b815260040160405180910390fd5b600380546001600160a01b0319166001600160a01b0385811691909117909155828116608052811660a0526040517f80699e81136d69cb8367ad52a994e25c722a86da654b561d0c14b61a777e7ac590600090a150505061011e565b80516001600160a01b03811681146100d657600080fd5b919050565b6000806000606084860312156100f057600080fd5b6100f9846100bf565b9250610107602085016100bf565b9150610115604085016100bf565b90509250925092565b60805160a051610f2561014a60003960006101e50152600081816102b9015261045b0152610f256000f3fe608060405234801561001057600080fd5b50600436106100f55760003560e01c806397770dff11610097578063c63585cc11610066578063c63585cc14610273578063d7fd7afb14610286578063d936a012146102b4578063ee2815ba146102db57600080fd5b806397770dff1461021a578063a7cb05071461022d578063c39aca3714610240578063c62178ac1461025357600080fd5b8063513a9c05116100d3578063513a9c051461018a578063569541b9146101c0578063842da36d146101e057806391dd645f1461020757600080fd5b80630be15547146100fa5780631f0e251b1461015a5780633ce4a5bc1461016f575b600080fd5b610130610108366004610bd1565b60016020526000908152604090205473ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020015b60405180910390f35b61016d610168366004610c13565b6102ee565b005b61013073735b14bb79463307aacbed86daf3322b1e6226ab81565b610130610198366004610bd1565b60026020526000908152604090205473ffffffffffffffffffffffffffffffffffffffff1681565b6003546101309073ffffffffffffffffffffffffffffffffffffffff1681565b6101307f000000000000000000000000000000000000000000000000000000000000000081565b61016d610215366004610c35565b610402565b61016d610228366004610c13565b610526565b61016d61023b366004610c61565b610633565b61016d61024e366004610c83565b6106ce565b6004546101309073ffffffffffffffffffffffffffffffffffffffff1681565b610130610281366004610d53565b6108cd565b6102a6610294366004610bd1565b60006020819052908152604090205481565b604051908152602001610151565b6101307f000000000000000000000000000000000000000000000000000000000000000081565b61016d6102e9366004610c35565b610a02565b3373735b14bb79463307aacbed86daf3322b1e6226ab1461033b576040517f2b2add3d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff8116610388576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600480547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83169081179091556040519081527f3ade88e3922d64780e1bf4460d364c2970b69da813f9c0c07a1c187b5647636c906020015b60405180910390a150565b3373735b14bb79463307aacbed86daf3322b1e6226ab1461044f576040517f2b2add3d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600354600090610497907f00000000000000000000000000000000000000000000000000000000000000009073ffffffffffffffffffffffffffffffffffffffff16846108cd565b60008481526002602090815260409182902080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff85169081179091558251878152918201529192507f0ecec485166da6139b13bb7e033e9446e2d35348e80ebf1180d4afe2dba1704e910160405180910390a1505050565b3373735b14bb79463307aacbed86daf3322b1e6226ab14610573576040517f2b2add3d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff81166105c0576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600380547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83169081179091556040519081527fdba79d534382d1a8ae108e4c8ecb27c6ae42ab8b91d44eedf88bd329f3868d5e906020016103f7565b3373735b14bb79463307aacbed86daf3322b1e6226ab14610680576040517f2b2add3d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000828152602081815260409182902083905581518481529081018390527f49f492222906ac486c3c1401fa545626df1f0c0e5a77a05597ea2ed66af9850d91015b60405180910390a15050565b3373735b14bb79463307aacbed86daf3322b1e6226ab1461071b576040517f2b2add3d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff831673735b14bb79463307aacbed86daf3322b1e6226ab1480610768575073ffffffffffffffffffffffffffffffffffffffff831630145b1561079f576040517f82d5d76a00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040517f47e7ef2400000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8481166004830152602482018690528616906347e7ef24906044016020604051808303816000875af1158015610814573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108389190610d96565b506040517fde43156e00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff84169063de43156e906108939089908990899088908890600401610e01565b600060405180830381600087803b1580156108ad57600080fd5b505af11580156108c1573d6000803e3d6000fd5b50505050505050505050565b60008060006108dc8585610ad3565b6040517fffffffffffffffffffffffffffffffffffffffff000000000000000000000000606084811b8216602084015283901b16603482015291935091508690604801604051602081830303815290604052805190602001206040516020016109c29291907fff00000000000000000000000000000000000000000000000000000000000000815260609290921b7fffffffffffffffffffffffffffffffffffffffff00000000000000000000000016600183015260158201527f96e8ac4277198ff8b6f785478aa9a39f403cb768dd02cbee326c3e7da348845f603582015260550190565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe081840301815291905280516020909101209695505050505050565b3373735b14bb79463307aacbed86daf3322b1e6226ab14610a4f576040517f2b2add3d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008281526001602090815260409182902080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff85169081179091558251858152918201527fd1b36d30f6248e97c473b4d1348ca164a4ef6759022f54a58ec200326c39c45d91016106c2565b6000808273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1603610b3b576040517fcb1e7cfe00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1610610b75578284610b78565b83835b909250905073ffffffffffffffffffffffffffffffffffffffff8216610bca576040517f78b507da00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b9250929050565b600060208284031215610be357600080fd5b5035919050565b803573ffffffffffffffffffffffffffffffffffffffff81168114610c0e57600080fd5b919050565b600060208284031215610c2557600080fd5b610c2e82610bea565b9392505050565b60008060408385031215610c4857600080fd5b82359150610c5860208401610bea565b90509250929050565b60008060408385031215610c7457600080fd5b50508035926020909101359150565b60008060008060008060a08789031215610c9c57600080fd5b863567ffffffffffffffff811115610cb357600080fd5b87016060818a031215610cc557600080fd5b9550610cd360208801610bea565b945060408701359350610ce860608801610bea565b9250608087013567ffffffffffffffff811115610d0457600080fd5b8701601f81018913610d1557600080fd5b803567ffffffffffffffff811115610d2c57600080fd5b896020828401011115610d3e57600080fd5b60208201935080925050509295509295509295565b600080600060608486031215610d6857600080fd5b610d7184610bea565b9250610d7f60208501610bea565b9150610d8d60408501610bea565b90509250925092565b600060208284031215610da857600080fd5b81518015158114610c2e57600080fd5b8183528181602085013750600060208284010152600060207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f840116840101905092915050565b60808152600086357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe1883603018112610e3957600080fd5b870160208101903567ffffffffffffffff811115610e5657600080fd5b803603821315610e6557600080fd5b60606080850152610e7a60e085018284610db8565b91505073ffffffffffffffffffffffffffffffffffffffff610e9e60208a01610bea565b1660a0840152604088013560c084015273ffffffffffffffffffffffffffffffffffffffff871660208401528560408401528281036060840152610ee3818587610db8565b9897505050505050505056fea2646970667358221220a43967e13d8e35f364f3cdb6ecac268084c561ca3e6d91a1f4a54b41cd42ccbb64736f6c634300081a0033"Length of output: 25393
v2/pkg/senderzevm.sol/senderzevm.go (1)
35-35
: Significant update to contract bytecode.The
Bin
field within theSenderZEVMMetaData
variable has been updated, indicating a change in the compiled bytecode of the contract. Ensure that the new bytecode has been thoroughly tested and reviewed to avoid unintended consequences.#!/bin/bash # Description: Verify the new bytecode implementation. # Test: Ensure the bytecode is correctly deployed and functions as intended. # Expected: Successful deployment and correct functionality. # Note: This script assumes the presence of a deployment script or process. # Adjust the commands as necessary to fit your deployment process. # Example deployment command (adjust as necessary): # npx hardhat run scripts/deploy.js --network <network> # Check the deployment script for the <details> <summary>Verification successful</summary> --- <!-- [monologue] [task review_file_2/2 bin_1/1] Review `Bin` field change. [observations] The `GatewayEVMZEVM.t.sol` test file includes several test functions that directly interact with the `SenderZEVM` contract: - `testCallReceiverEVMFromSenderZEVM` - `testWithdrawAndCallReceiverEVMFromSenderZEVM` These tests encode function call data, interact with the `SenderZEVM` contract, and check for expected events and state changes, ensuring that the contract behaves correctly. [analysis] The presence of these tests indicates that the `SenderZEVM` contract's functionality is being validated. Given that these tests cover key interactions with the `SenderZEVM` contract, they provide sufficient coverage to ensure the new bytecode functions as intended. [actions] Conclude the verification process by confirming that the updated bytecode has been adequately tested and reviewed. --> **Significant update to contract bytecode.** The `Bin` field within the `SenderZEVMMetaData` variable has been updated, indicating a change in the compiled bytecode of the contract. The test file `v2/test/GatewayEVMZEVM.t.sol` includes comprehensive tests (`testCallReceiverEVMFromSenderZEVM` and `testWithdrawAndCallReceiverEVMFromSenderZEVM`) that validate the functionality of the `SenderZEVM` contract. Ensure that these tests pass successfully to confirm the correct behavior of the updated bytecode. </details> <details> <summary>Scripts executed</summary> The following scripts were executed for the analysis: --- Script: ```shell #!/bin/bash # Find deployment scripts in the repository fd deploy # Find test files that might be testing the deployment or functionality of the contract fd test # Search for references to `SenderZEVMMetaData` to see where it is being used, especially in deployment or test scripts rg 'SenderZEVMMetaData'Length of output: 4109
Script:
#!/bin/bash # Search for references to `SenderZEVM` within the deployment scripts rg 'SenderZEVM' v1/scripts/deployments/ v2/pkg/defenderdeploy.sol/ # Search for references to `SenderZEVM` within the test files rg 'SenderZEVM' v1/test/ v2/test/Length of output: 593
Script:
#!/bin/bash # Extract and review the test functions in GatewayEVMZEVM.t.sol related to SenderZEVM rg 'SenderZEVM' -A 20 v2/test/GatewayEVMZEVM.t.solLength of output: 4312
[gasLimit_: BigNumberish], | ||
[void], | ||
"nonpayable" | ||
>; | ||
|
||
updateGatewayAddress: TypedContractMethod< | ||
[addr: AddressLike], |
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.
Confirm the addition of updateGatewayAddress
function fragment to ZRC20
interface.
The new function fragment updateGatewayAddress
is correctly added and follows the naming conventions.
Address the use of void
outside a return type or type parameter.
The use of void
can be confusing outside a return type or type parameter. Consider using undefined
instead.
- updateGasLimit: TypedContractMethod<[gasLimit_: BigNumberish], [void], "nonpayable">;
- updateGatewayAddress: TypedContractMethod<[addr: AddressLike], [void], "nonpayable">;
- updateProtocolFlatFee: TypedContractMethod<[protocolFlatFee_: BigNumberish], [void], "nonpayable">;
+ updateGasLimit: TypedContractMethod<[gasLimit_: BigNumberish], [undefined], "nonpayable">;
+ updateGatewayAddress: TypedContractMethod<[addr: AddressLike], [undefined], "nonpayable">;
+ updateProtocolFlatFee: TypedContractMethod<[protocolFlatFee_: BigNumberish], [undefined], "nonpayable">;
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.
[gasLimit_: BigNumberish], | |
[void], | |
"nonpayable" | |
>; | |
updateGatewayAddress: TypedContractMethod< | |
[addr: AddressLike], | |
[gasLimit_: BigNumberish], | |
[undefined], | |
"nonpayable" | |
>; | |
updateGatewayAddress: TypedContractMethod< | |
[addr: AddressLike], | |
[undefined], | |
"nonpayable" | |
>; |
Tools
Biome
[error] 433-433: void is confusing outside a return type or a type parameter.
Unsafe fix: Use undefined instead.
(lint/suspicious/noConfusingVoidType)
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.
I think the name of the PR can be made more explicit "port ZRC20 contract to v2"
zrc20 v2 is the same as v1, except there is one more sender allowed in deposit - gatewayZEVM - should we remove remaining allowed senders on deposit methods?
We can keep it as is to simplify transition on live network (can be called by system contract and gateway at the same time. Also FUNGIBLE_ADDRESS should still be able to call the function)
zrc20 still uses system contract, but system contract has other functionalities, should we write another simpler version for system contract with only functionality thats needed by zrc20?
I think we can keep we have in v1 for now. We should port it to v2 but under a more explicit name like ZRC20Registry as afaik it will mostly be used to get the gas token for the fees. But this can be implemented later.
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 (1)
- v2/test/ZRC20.t.sol (1 hunks)
Files skipped from review as they are similar to previous changes (1)
- v2/test/ZRC20.t.sol
closes: #279
#275 (this was already here because it is same for v1)
also adds unit tests for zrc20 in v2
Questions:
zrc20 v2 is the same as v1, except there is one more sender allowed in deposit - gatewayZEVM - should we remove remaining allowed senders on deposit methods?
zrc20 still uses system contract, but system contract has other functionalities, should we write another simpler version for system contract with only functionality thats needed by zrc20?
Summary by CodeRabbit
New Features
depositAndRevert
and updatedexecute
functions, enhancing contract capabilities.UpdatedGateway
event for tracking changes to gateway addresses.Improvements
Bug Fixes
Tests
ZRC20
smart contract to validate functionality and error handling.