-
Notifications
You must be signed in to change notification settings - Fork 59
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor: maintain storage layout compability between ZRC20 v1 and v2 #289
Conversation
WalkthroughThe updates to the Changes
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 (
|
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/src/zevm/ZRC20.sol (2 hunks)
Additional comments not posted (1)
v2/src/zevm/ZRC20.sol (1)
45-47
: Approved: Repositioning ofgatewayAddress
for storage layout compatibility.The
gatewayAddress
variable has been moved to the last position of the state variable declarations to maintain storage layout compatibility with ZRC20 v1. This change is crucial for ensuring seamless operation and upgradeability of the smart contracts.
@skosito any idea why unit test failing?
Seems not related to this change |
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
Outside diff range, codebase verification and nitpick comments (2)
v2/src/zevm/ZRC20.sol (1)
32-33
: Inconsistent variable renamingThe variable
systemContractAddress
has not been consistently renamed toSYSTEM_CONTRACT_ADDRESS
throughout the codebase. The following files still contain references to the old variable name and need to be updated:
v1/test/ZRC20.spec.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
v2/typechain-types/ZRC20.sol/ZRC20.ts
v1/docs/src/contracts/zevm/ZRC20.sol/contract.ZRC20.md
v2/typechain-types/factories/ZRC20.sol/ZRC20__factory.ts
v1/contracts/zevm/ZRC20.sol
v2/src/zevm/ZRC20.sol
v2/pkg/zrc20.sol/zrc20.go
Please update these files to ensure consistency.
Analysis chain
LGTM! Ensure consistency of the variable name change.
The variable
systemContractAddress
has been correctly renamed toSYSTEM_CONTRACT_ADDRESS
for compatibility with ZRC20 v1.Verify that all references to
systemContractAddress
have been updated toSYSTEM_CONTRACT_ADDRESS
.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify all references to `systemContractAddress` have been updated to `SYSTEM_CONTRACT_ADDRESS`. # Test: Search for the old variable name. Expect: No occurrences. rg --type solidity -A 5 $'systemContractAddress' # Test: Search for the new variable name. Expect: Multiple occurrences. rg --type solidity -A 5 $'SYSTEM_CONTRACT_ADDRESS'Length of output: 163
Script:
#!/bin/bash # Description: Verify all references to `systemContractAddress` have been updated to `SYSTEM_CONTRACT_ADDRESS`. # Test: Search for the old variable name. Expect: No occurrences. rg -A 5 $'systemContractAddress' # Test: Search for the new variable name. Expect: Multiple occurrences. rg -A 5 $'SYSTEM_CONTRACT_ADDRESS'Length of output: 111062
v2/test/GatewayZEVM.t.sol (1)
69-69
: Inconsistencies Found: Update All References toPROTOCOL_FLAT_FEE
The verification process revealed that there are still references to
protocolFlatFee()
in the codebase. Please ensure that all instances ofprotocolFlatFee()
are updated to use the constantPROTOCOL_FLAT_FEE
for consistency.
- Files with
protocolFlatFee()
references:
- Multiple occurrences in various files including
v1/typechain-types/factories
,v1/typechain-types/contracts
, andv1/pkg/contracts
.Please review and update these references accordingly.
Analysis chain
LGTM! Ensure consistency of the variable usage.
The
Withdrawal
event emission in thetestWithdrawZRC20
function has been correctly updated to use the constant variablePROTOCOL_FLAT_FEE
instead of the methodprotocolFlatFee()
.Verify that all references to
protocolFlatFee()
have been updated toPROTOCOL_FLAT_FEE
.
Let's re-run the verification with adjusted commands to ensure we get the correct results.
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify all references to `protocolFlatFee()` have been updated to `PROTOCOL_FLAT_FEE`. # Test: Search for the old method call. Expect: No occurrences. rg --type solidity -A 5 $'protocolFlatFee()' # Test: Search for the new variable usage. Expect: Multiple occurrences. rg --type solidity -A 5 $'PROTOCOL_FLAT_FEE'Length of output: 155
Script:
#!/bin/bash # Description: Verify all references to `protocolFlatFee()` have been updated to `PROTOCOL_FLAT_FEE`. # Find all Solidity files solidity_files=$(fd --extension sol) # Test: Search for the old method call. Expect: No occurrences. rg 'protocolFlatFee()' $solidity_files # Test: Search for the new variable usage. Expect: Multiple occurrences. rg 'PROTOCOL_FLAT_FEE' $solidity_filesLength of output: 179884
Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Files selected for processing (6)
- v2/src/zevm/GatewayZEVM.sol (2 hunks)
- v2/src/zevm/ZRC20.sol (8 hunks)
- v2/src/zevm/interfaces/IZRC20.sol (1 hunks)
- v2/test/GatewayEVMZEVM.t.sol (1 hunks)
- v2/test/GatewayZEVM.t.sol (2 hunks)
- v2/test/ZRC20.t.sol (3 hunks)
Additional comments not posted (13)
v2/src/zevm/interfaces/IZRC20.sol (1)
27-28
: LGTM!The function name change to uppercase and the added documentation comment are appropriate for maintaining compatibility with the previous version.
v2/test/ZRC20.t.sol (3)
211-211
: LGTM!The assertion update to use
SYSTEM_CONTRACT_ADDRESS
instead ofsystemContractAddress
is appropriate.
233-233
: LGTM!The assertion update to use
GAS_LIMIT
instead ofgasLimit
is appropriate.
244-244
: LGTM!The assertion update to use
PROTOCOL_FLAT_FEE
instead ofprotocolFlatFee
is appropriate.v2/test/GatewayEVMZEVM.t.sol (1)
170-170
: LGTM!The update to use
PROTOCOL_FLAT_FEE
in the withdrawal functionality is appropriate.v2/src/zevm/ZRC20.sol (5)
253-260
: LGTM! Ensure correct usage of renamed variables.The
withdrawGasFee
function has been correctly updated to use the renamed variablesSYSTEM_CONTRACT_ADDRESS
,GAS_LIMIT
, andPROTOCOL_FLAT_FEE
.Verify that the updates are consistent with the previous version.
Verification successful
LGTM! Ensure correct usage of renamed variables.
The
withdrawGasFee
function has been correctly updated to use the renamed variablesSYSTEM_CONTRACT_ADDRESS
,GAS_LIMIT
, andPROTOCOL_FLAT_FEE
. The occurrences of these variables are consistent with their intended usage in the codebase.
SYSTEM_CONTRACT_ADDRESS
is used in thewithdrawGasFee
function and other relevant parts of the code.GAS_LIMIT
is utilized correctly for calculating the gas fee.PROTOCOL_FLAT_FEE
is also used appropriately in the gas fee calculation.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the usage of renamed variables in the `withdrawGasFee` function. # Test: Search for the usage of `SYSTEM_CONTRACT_ADDRESS`. Expect: One occurrence. rg --type solidity -A 5 $'SYSTEM_CONTRACT_ADDRESS' # Test: Search for the usage of `GAS_LIMIT`. Expect: One occurrence. rg --type solidity -A 5 $'GAS_LIMIT' # Test: Search for the usage of `PROTOCOL_FLAT_FEE`. Expect: One occurrence. rg --type solidity -A 5 $'PROTOCOL_FLAT_FEE'Length of output: 228
Script:
#!/bin/bash # Description: Verify the usage of renamed variables in the `withdrawGasFee` function. # Test: Search for the usage of `SYSTEM_CONTRACT_ADDRESS`. Expect: One occurrence. rg -A 5 'SYSTEM_CONTRACT_ADDRESS' # Test: Search for the usage of `GAS_LIMIT`. Expect: One occurrence. rg -A 5 'GAS_LIMIT' # Test: Search for the usage of `PROTOCOL_FLAT_FEE`. Expect: One occurrence. rg -A 5 'PROTOCOL_FLAT_FEE'Length of output: 156581
38-39
: LGTM! Ensure consistency of the variable name change.The variable
protocolFlatFee
has been correctly renamed toPROTOCOL_FLAT_FEE
for compatibility with ZRC20 v1.Verify that all references to
protocolFlatFee
have been updated toPROTOCOL_FLAT_FEE
.
87-88
: LGTM! Ensure correct initialization of renamed variables.The constructor has been correctly updated to initialize the renamed variables
SYSTEM_CONTRACT_ADDRESS
,GAS_LIMIT
, andPROTOCOL_FLAT_FEE
.Verify that the initialization is consistent with the previous version.
Verification successful
Initialization of renamed variables is correct and consistent.
The constructor and other methods have been correctly updated to initialize the renamed variables
SYSTEM_CONTRACT_ADDRESS
,GAS_LIMIT
, andPROTOCOL_FLAT_FEE
.
SYSTEM_CONTRACT_ADDRESS
is initialized in the constructor and other methods.GAS_LIMIT
is initialized in the constructor and other methods.PROTOCOL_FLAT_FEE
is initialized in the constructor and other methods.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the initialization of renamed variables in the constructor. # Test: Search for the initialization of `SYSTEM_CONTRACT_ADDRESS`. Expect: One occurrence. rg --type solidity -A 5 $'SYSTEM_CONTRACT_ADDRESS =' # Test: Search for the initialization of `GAS_LIMIT`. Expect: One occurrence. rg --type solidity -A 5 $'GAS_LIMIT =' # Test: Search for the initialization of `PROTOCOL_FLAT_FEE`. Expect: One occurrence. rg --type solidity -A 5 $'PROTOCOL_FLAT_FEE ='Length of output: 240
Script:
#!/bin/bash # Description: Verify the initialization of renamed variables in the constructor. # Locate all .sol files and search for the initialization of the renamed variables. fd -e sol -x rg 'SYSTEM_CONTRACT_ADDRESS =' -A 5 {} fd -e sol -x rg 'GAS_LIMIT =' -A 5 {} fd -e sol -x rg 'PROTOCOL_FLAT_FEE =' -A 5 {}Length of output: 1610
48-50
: LGTM! Ensure correct initialization and usage.The variable
gatewayAddress
has been correctly added at the end of the state variable declarations to maintain storage layout compatibility with ZRC20 v1.Verify that the variable is correctly initialized and used in the contract.
Verification successful
Initialization and usage of
gatewayAddress
verifiedThe variable
gatewayAddress
has been correctly initialized in the constructor and is used in multiple places within the contract. This confirms that it is properly integrated into the contract's functionality.
gatewayAddress
initialization found in the constructor.gatewayAddress
used in various functions inv2/src/zevm/ZRC20.sol
.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the initialization and usage of `gatewayAddress`. # Test: Search for the variable initialization. Expect: One occurrence in the constructor. rg --type solidity -A 5 $'gatewayAddress =' # Test: Search for the variable usage. Expect: Multiple occurrences. rg --type solidity -A 5 $'gatewayAddress'Length of output: 151
Script:
#!/bin/bash # Description: Verify the initialization and usage of `gatewayAddress`. # Test: Search for the variable initialization. Expect: One occurrence in the constructor. rg 'gatewayAddress =' --glob '*.sol' -A 5 # Test: Search for the variable usage. Expect: Multiple occurrences. rg 'gatewayAddress' --glob '*.sol' -A 5Length of output: 2566
35-36
: LGTM! Ensure consistency of the variable name change.The variable
gasLimit
has been correctly renamed toGAS_LIMIT
for compatibility with ZRC20 v1.Verify that all references to
gasLimit
have been updated toGAS_LIMIT
.v2/src/zevm/GatewayZEVM.sol (2)
121-121
: LGTM! Ensure consistency of the variable usage.The
Withdrawal
event emission in thewithdraw
function has been correctly updated to use the constant variablePROTOCOL_FLAT_FEE
instead of the methodprotocolFlatFee()
.Verify that all references to
protocolFlatFee()
have been updated toPROTOCOL_FLAT_FEE
.Verification successful
LGTM! The change is consistent and correct.
The
Withdrawal
event emission in thewithdraw
function has been correctly updated to use the constant variablePROTOCOL_FLAT_FEE
instead of the methodprotocolFlatFee()
. The remaining occurrences ofprotocolFlatFee()
are in the context of updating the protocol flat fee, which is expected.
- File:
v2/src/zevm/GatewayZEVM.sol
- Lines: 121-121
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify all references to `protocolFlatFee()` have been updated to `PROTOCOL_FLAT_FEE`. # Test: Search for the old method call. Expect: No occurrences. rg --type solidity -A 5 $'protocolFlatFee()' # Test: Search for the new variable usage. Expect: Multiple occurrences. rg --type solidity -A 5 $'PROTOCOL_FLAT_FEE'Length of output: 155
Script:
#!/bin/bash # Description: Verify all references to `protocolFlatFee()` have been updated to `PROTOCOL_FLAT_FEE`. # Test: Search for the old method call. Expect: No occurrences. rg 'protocolFlatFee()' --glob '*.sol' -A 5 # Test: Search for the new variable usage. Expect: Multiple occurrences. rg 'PROTOCOL_FLAT_FEE' --glob '*.sol' -A 5Length of output: 11418
140-140
: LGTM! Ensure consistency of the variable usage.The
Withdrawal
event emission in thewithdrawAndCall
function has been correctly updated to use the constant variablePROTOCOL_FLAT_FEE
instead of the methodprotocolFlatFee()
.Verify that all references to
protocolFlatFee()
have been updated toPROTOCOL_FLAT_FEE
.v2/test/GatewayZEVM.t.sol (1)
115-115
: LGTM! Ensure consistency of the variable usage.The
Withdrawal
event emission in thetestWithdrawZRC20WithMessage
function has been correctly updated to use the constant variablePROTOCOL_FLAT_FEE
instead of the methodprotocolFlatFee()
.Verify that all references to
protocolFlatFee()
have been updated toPROTOCOL_FLAT_FEE
.Verification successful
LGTM! Ensure consistency of the variable usage.
The
Withdrawal
event emission in thetestWithdrawZRC20WithMessage
function has been correctly updated to use the constant variablePROTOCOL_FLAT_FEE
instead of the methodprotocolFlatFee()
. The verification confirms that all references in the Solidity files have been updated appropriately.
- No further action needed.
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify all references to `protocolFlatFee()` have been updated to `PROTOCOL_FLAT_FEE`. # Test: Search for the old method call. Expect: No occurrences. rg --type solidity -A 5 $'protocolFlatFee()' # Test: Search for the new variable usage. Expect: Multiple occurrences. rg --type solidity -A 5 $'PROTOCOL_FLAT_FEE'Length of output: 155
Script:
#!/bin/bash # Description: Verify all references to `protocolFlatFee()` have been updated to `PROTOCOL_FLAT_FEE`. # Test: Search for the old method call. Expect: No occurrences. rg 'protocolFlatFee()' # Test: Search for the new variable usage. Expect: Multiple occurrences. rg 'PROTOCOL_FLAT_FEE'Length of output: 128642
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 (3)
- v2/src/zevm/ZRC20.sol (8 hunks)
- v2/test/GatewayEVMZEVM.t.sol (1 hunks)
- v2/test/GatewayZEVM.t.sol (2 hunks)
Files skipped from review due to trivial changes (1)
- v2/test/GatewayZEVM.t.sol
Files skipped from review as they are similar to previous changes (2)
- v2/src/zevm/ZRC20.sol
- v2/test/GatewayEVMZEVM.t.sol
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #289 +/- ##
==========================================
- Coverage 61.64% 54.56% -7.09%
==========================================
Files 16 16
Lines 425 427 +2
Branches 22 102 +80
==========================================
- Hits 262 233 -29
- Misses 160 191 +31
Partials 3 3 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Outside diff range, codebase verification and nitpick comments (3)
v2/typechain-types/factories/IZRC20.sol/IZRC20__factory.ts (1)
9-21
: Verify and update all references toprotocolFlatFee
in the codebase.The search results indicate multiple occurrences of
protocolFlatFee
across various files. Ensure that all references are correctly updated or removed to maintain consistency with the new functionPROTOCOL_FLAT_FEE
.
v2/typechain-types/factories/GatewayZEVM__factory.ts
v2/typechain-types/factories/ZRC20.sol/ZRC20__factory.ts
v2/typechain-types/ZRC20.sol/ZRC20.ts
v2/typechain-types/factories/IZRC20.sol/ZRC20Events__factory.ts
v2/typechain-types/factories/IGatewayZEVM.sol/IGatewayZEVMEvents__factory.ts
v2/typechain-types/IZRC20.sol/ZRC20Events.ts
v2/typechain-types/IGatewayZEVM.sol/IGatewayZEVMEvents.ts
v2/typechain-types/GatewayZEVM.ts
v1/typechain-types/factories/contracts/zevm/interfaces/IZRC20__factory.ts
v1/typechain-types/factories/contracts/zevm/interfaces/IZRC20.sol/ZRC20Events__factory.ts
v1/typechain-types/factories/contracts/zevm/Interfaces.sol/IZRC20__factory.ts
v1/typechain-types/factories/contracts/zevm/Interfaces.sol/IZRC20Metadata__factory.ts
v1/typechain-types/factories/contracts/zevm/ZRC20.sol/ZRC20__factory.ts
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/ZRC20Events.ts
v1/typechain-types/contracts/zevm/Interfaces.sol/IZRC20Metadata.ts
v1/typechain-types/factories/contracts/zevm/ZRC20New.sol/ZRC20New__factory.ts
v1/docs/src/contracts/zevm/interfaces/IZRC20.sol/interface.IZRC20.md
v1/docs/src/contracts/zevm/ZRC20.sol/contract.ZRC20.md
v1/docs/src/contracts/zevm/Interfaces.sol/interface.IZRC20.md
v1/pkg/contracts/zevm/interfaces/izrc20.sol/zrc20events.go
v1/pkg/contracts/zevm/zrc20.sol/zrc20.go
v1/contracts/zevm/interfaces/IZRC20.sol
v1/contracts/zevm/ZRC20.sol
v2/test/ZRC20.t.sol
v2/src/zevm/ZRC20.sol
v2/scripts/localnet/worker.ts
v2/src/zevm/interfaces/IZRC20.sol
v2/pkg/zrc20.sol/zrc20.go
v2/pkg/izrc20.sol/zrc20events.go
v2/pkg/gatewayevmzevm.t.sol/gatewayevmzevmtest.go
v2/pkg/igatewayzevm.sol/igatewayzevmevents.go
v2/pkg/gatewayzevm.t.sol/gatewayzevminboundtest.go
v2/pkg/gatewayzevm.sol/gatewayzevm.go
v2/pkg/gatewayzevm.t.sol/gatewayzevmoutboundtest.go
Analysis chain
LGTM! But verify the removal of
protocolFlatFee
in the codebase.The addition of the
PROTOCOL_FLAT_FEE
function is correctly formatted.However, ensure that all references to
protocolFlatFee
are updated or removed in the codebase.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify removal of `protocolFlatFee` in the codebase. # Test: Search for the function usage. Expect: No occurrences of `protocolFlatFee`. rg --type python -A 5 $'protocolFlatFee'Length of output: 70
Script:
#!/bin/bash # Description: Verify removal of `protocolFlatFee` in the codebase. # Test: Search for the function usage. Expect: No occurrences of `protocolFlatFee`. rg 'protocolFlatFee'Length of output: 96103
v2/typechain-types/factories/IZRC20.sol/IZRC20Metadata__factory.ts (1)
12-24
: Issues Found:protocolFlatFee
still present in the codebaseThe following files contain references to
protocolFlatFee
, indicating that it has not been fully removed or updated:
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/IGatewayZEVM.sol/IGatewayZEVMEvents__factory.ts
v2/typechain-types/ZRC20.sol/ZRC20.ts
v2/typechain-types/IZRC20.sol/ZRC20Events.ts
v2/typechain-types/IGatewayZEVM.sol/IGatewayZEVMEvents.ts
v1/typechain-types/contracts/zevm/interfaces/IZRC20.ts
v1/typechain-types/factories/contracts/zevm/ZRC20.sol/ZRC20__factory.ts
v1/typechain-types/contracts/zevm/Interfaces.sol/IZRC20__factory.ts
v1/typechain-types/contracts/zevm/Interfaces.sol/IZRC20Events__factory.ts
v1/typechain-types/contracts/zevm/ZRC20.sol/ZRC20.ts
v1/typechain-types/contracts/zevm/Interfaces.sol/IZRC20Metadata__factory.ts
v2/scripts/localnet/worker.ts
Please ensure that all occurrences of
protocolFlatFee
are removed or updated to maintain consistency in the codebase.Analysis chain
LGTM! But verify the removal of
protocolFlatFee
in the codebase.The addition of the
PROTOCOL_FLAT_FEE
function is correctly formatted.However, ensure that all references to
protocolFlatFee
are updated or removed in the codebase.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify removal of `protocolFlatFee` in the codebase. # Test: Search for the function usage. Expect: No occurrences of `protocolFlatFee`. rg --type python -A 5 $'protocolFlatFee'Length of output: 70
Script:
#!/bin/bash # Description: Verify removal of `protocolFlatFee` in the codebase. # Test: Search for the function usage. Expect: No occurrences of `protocolFlatFee`. rg --type typescript -A 5 $'protocolFlatFee'Length of output: 78
Script:
#!/bin/bash # Description: Verify removal of `protocolFlatFee` in the codebase. # Test: Search for the function usage. Expect: No occurrences of `protocolFlatFee`. rg --type ts -A 5 $'protocolFlatFee'Length of output: 37093
v2/typechain-types/IZRC20.sol/IZRC20.ts (1)
27-29
: Ensure complete removal or update ofprotocolFlatFee
in the codebase.The search results indicate that
protocolFlatFee
is still present in multiple files. Please review and update the following files accordingly:
v1/docs/src/contracts/zevm/interfaces/IZRC20.sol/interface.IZRC20.md
v1/typechain-types/contracts/zevm/interfaces/IZRC20.sol/ZRC20Events.ts
v1/typechain-types/contracts/zevm/interfaces/IZRC20.ts
v1/typechain-types/factories/contracts/zevm/interfaces/IZRC20__factory.ts
v1/typechain-types/contracts/zevm/ZRC20.sol/ZRC20.ts
v1/typechain-types/factories/contracts/zevm/ZRC20.sol/ZRC20__factory.ts
v1/typechain-types/contracts/zevm/Interfaces.sol/IZRC20Metadata.ts
v1/pkg/contracts/zevm/zrc20.sol/zrc20.go
v2/typechain-types/GatewayZEVM.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/IGatewayZEVM.sol/IGatewayZEVMEvents__factory.ts
v2/typechain-types/ZRC20.sol/ZRC20.ts
v2/typechain-types/IZRC20.sol/ZRC20Events.ts
v2/typechain-types/IGatewayZEVM.sol/IGatewayZEVMEvents.ts
v2/test/ZRC20.t.sol
v2/src/zevm/ZRC20.sol
v2/src/zevm/interfaces/IGatewayZEVM.sol
v2/src/zevm/interfaces/IZRC20.sol
v2/pkg/contracts/zevm/interfaces/izrc20.sol/zrc20events.go
v2/pkg/gatewayzevm.t.sol/gatewayzevmoutboundtest.go
v2/pkg/gatewayzevm.t.sol/gatewayzevminboundtest.go
v2/pkg/gatewayzevm.sol/gatewayzevm.go
v2/pkg/gatewayevmzevm.t.sol/gatewayevmzevmtest.go
v2/scripts/localnet/worker.ts
Analysis chain
LGTM! But verify the removal of
protocolFlatFee
in the codebase.The addition of the
PROTOCOL_FLAT_FEE
function is correctly formatted.However, ensure that all references to
protocolFlatFee
are updated or removed in the codebase.Also applies to: 40-43, 82-85, 150-151, 200-202
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify removal of `protocolFlatFee` in the codebase. # Test: Search for the function usage. Expect: No occurrences of `protocolFlatFee`. rg --type python -A 5 $'protocolFlatFee'Length of output: 70
Script:
#!/bin/bash # Description: Verify removal of `protocolFlatFee` in the codebase. # Test: Search for the function usage. Expect: No occurrences of `protocolFlatFee`. rg 'protocolFlatFee'Length of output: 96103
Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Files ignored due to path filters (1)
go.sum
is excluded by!**/*.sum
Files selected for processing (17)
- 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/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 (5 hunks)
- v2/typechain-types/IZRC20.sol/IZRC20.ts (7 hunks)
- v2/typechain-types/IZRC20.sol/IZRC20Metadata.ts (8 hunks)
- v2/typechain-types/ZRC20.sol/ZRC20.ts (8 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/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 (5 hunks)
Additional comments not posted (56)
v2/typechain-types/factories/SenderZEVM__factory.ts (2)
Line range hint
125-127
: Verify the correctness of the new type definition.Ensure that the new type definition for
SenderZEVMConstructorParams
accurately reflects the intended functionality and enhances the flexibility of the factory's constructor.Verification successful
The new type definition for
SenderZEVMConstructorParams
is correct and enhances the flexibility of the factory's constructor.
- The type definition allows for either a
signer
parameter or the parameters ofContractFactory
.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the correctness of the new type definition. # Test: Check the type definition in the smart contract file. Expect: The new type definition should match the intended functionality. rg --type typescript --context 5 'type SenderZEVMConstructorParams = \| \[signer\?: Signer\]'Length of output: 130
Script:
#!/bin/bash # Description: Verify the correctness of the new type definition. # Find all TypeScript files and search for the type definition within those files fd --extension ts --exec rg --context 5 'type SenderZEVMConstructorParams = \| \[signer\?: Signer\]'Length of output: 102
Script:
#!/bin/bash # Description: Verify the correctness of the new type definition. # Find all TypeScript files and search for the type definition within those files with a refined pattern fd --extension ts --exec rg --context 5 'type SenderZEVMConstructorParams'Length of output: 4401
123-123
: Verify the correctness of the new bytecode.Ensure that the new bytecode accurately reflects the intended changes to the smart contract logic or structure.
Verification successful
The new bytecode has been correctly updated and is consistent across the relevant files.
v2/typechain-types/factories/SenderZEVM__factory.ts
v2/pkg/senderzevm.sol/senderzevm.go
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the correctness of the new bytecode. # Test: Check the bytecode in the smart contract file. Expect: The new bytecode should match the intended changes. rg --type solidity --context 5 '0x6080604052348015600f57600080fd5b5060405161080c38038061080c833981016040819052602c916050565b600080546001600160a01b0319166001600160a01b0392909216919091179055607e565b600060208284031215606157600080fd5b81516001600160a01b0381168114607757600080fd5b9392505050565b61077f8061008d6000396000f3fe608060405234801561001057600080fd5b50600436106100415760003560e01c80630abd890514610046578063116191b61461005b578063865b36f6146100a4575b600080fd5b6100596100543660046104c4565b6100b7565b005b60005461007b9073ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b6100596100b236600461057f565b6102af565b60008383836040516024016100ce93929190610674565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529181526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fe04d4f970000000000000000000000000000000000000000000000000000000017905260005490517f095ea7b300000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff91821660048201526024810189905291925086169063095ea7b3906044016020604051808303816000875af11580156101be573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101e2919061069e565b610218576040517f8164f84200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000546040517f7993c1e000000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff90911690637993c1e090610274908a908a908a9087906004016106c2565b600060405180830381600087803b15801561028e57600080fd5b505af11580156102a2573d6000803e3d6000fd5b5050505050505050505050565b60008383836040516024016102c693929190610674565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529181526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fe04d4f970000000000000000000000000000000000000000000000000000000017905260005490517f5d40e17800000000000000000000000000000000000000000000000000000000815291925073ffffffffffffffffffffffffffffffffffffffff1690635d40e1789061039690899089908690600401610714565b600060405180830381600087803b1580156103b057600080fd5b505af11580156103c4573d6000803e3d6000fd5b50505050505050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600082601f83011261041057600080fd5b81356020830160008067ffffffffffffffff841115610431576104316103d0565b506040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f85018116603f0116810181811067ffffffffffffffff8211171561047e5761047e6103d0565b60405283815290508082840187101561049657600080fd5b838360208301376000602085830101528094505050505092915050565b80151581146104c157600080fd5b50565b60008060008060008060c087890312156104dd57600080fd5b863567ffffffffffffffff8111156104f457600080fd5b61050089828a016103ff565b96505060208701359450604087013573ffffffffffffffffffffffffffffffffffffffff8116811461053157600080fd5b9350606087013567ffffffffffffffff81111561054d57600080fd5b61055989828a016103ff565b9350506080870135915060a0870135610571816104b3565b809150509295509295509295565b600080600080600060a0868803121561059757600080fd5b853567ffffffffffffffff8111156105ae57600080fd5b6105ba888289016103ff565b95505060208601359350604086013567ffffffffffffffff8111156105de57600080fd5b6105ea888289016103ff565b935050606086013591506080860135610602816104b3565b809150509295509295909350565b6000815180845260005b818110156106365760208185018101518683018201520161061a565b5060006020828601015260207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f83011685010191505092915050565b6060815260006106876060830186610610565b602083019490945250901515604090910152919050565b6000602082840312156106b057600080fd5b81516106bb816104b3565b9392505050565b6080815260006106d56080830187610610565b85602084015273ffffffffffffffffffffffffffffffffffffffff8516604084015282810360608401526107098185610610565b979650505050505050565b6060815260006107276060830186610610565b846020840152828103604084015261073f8185610610565b969550505050505056fea264697066735822122078e1be8f7d715ed5cc056c14bf2b9938ee4caf16d129e58a054636f53579077764736f6c634300081a0033'Length of output: 4188
Script:
#!/bin/bash # Description: Verify the correctness of the new bytecode by searching all files. # Test: Search for the bytecode in all files. Expect: The new bytecode should be found in the relevant file. rg --context 5 '0x6080604052348015600f57600080fd5b5060405161080c38038061080c833981016040819052602c916050565b600080546001600160a01b0319166001600160a01b0392909216919091179055607e565b600060208284031215606157600080fd5b81516001600160a01b0381168114607757600080fd5b9392505050565b61077f8061008d6000396000f3fe608060405234801561001057600080fd5b50600436106100415760003560e01c80630abd890514610046578063116191b61461005b578063865b36f6146100a4575b600080fd5b6100596100543660046104c4565b6100b7565b005b60005461007b9073ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b6100596100b236600461057f565b6102af565b60008383836040516024016100ce93929190610674565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529181526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fe04d4f970000000000000000000000000000000000000000000000000000000017905260005490517f095ea7b300000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff91821660048201526024810189905291925086169063095ea7b3906044016020604051808303816000875af11580156101be573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101e2919061069e565b610218576040517f8164f84200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000546040517f7993c1e000000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff90911690637993c1e090610274908a908a908a9087906004016106c2565b600060405180830381600087803b15801561028e57600080fd5b505af11580156102a2573d6000803e3d6000fd5b5050505050505050505050565b60008383836040516024016102c693929190610674565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529181526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fe04d4f970000000000000000000000000000000000000000000000000000000017905260005490517f5d40e17800000000000000000000000000000000000000000000000000000000815291925073ffffffffffffffffffffffffffffffffffffffff1690635d40e1789061039690899089908690600401610714565b600060405180830381600087803b1580156103b057600080fd5b505af11580156103c4573d6000803e3d6000fd5b50505050505050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600082601f83011261041057600080fd5b81356020830160008067ffffffffffffffff841115610431576104316103d0565b506040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f85018116603f0116810181811067ffffffffffffffff8211171561047e5761047e6103d0565b60405283815290508082840187101561049657600080fd5b838360208301376000602085830101528094505050505092915050565b80151581146104c157600080fd5b50565b60008060008060008060c087890312156104dd57600080fd5b863567ffffffffffffffff8111156104f457600080fd5b61050089828a016103ff565b96505060208701359450604087013573ffffffffffffffffffffffffffffffffffffffff8116811461053157600080fd5b9350606087013567ffffffffffffffff81111561054d57600080fd5b61055989828a016103ff565b9350506080870135915060a0870135610571816104b3565b809150509295509295509295565b600080600080600060a0868803121561059757600080fd5b853567ffffffffffffffff8111156105ae57600080fd5b6105ba888289016103ff565b95505060208601359350604086013567ffffffffffffffff8111156105de57600080fd5b6105ea888289016103ff565b935050606086013591506080860135610602816104b3565b809150509295509295909350565b6000815180845260005b818110156106365760208185018101518683018201520161061a565b5060006020828601015260207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f83011685010191505092915050565b6060815260006106876060830186610610565b602083019490945250901515604090910152919050565b6000602082840312156106b057600080fd5b81516106bb816104b3565b9392505050565b6080815260006106d56080830187610610565b85602084015273ffffffffffffffffffffffffffffffffffffffff8516604084015282810360608401526107098185610610565b979650505050505050565b6060815260006107276060830186610610565b846020840152828103604084015261073f8185610610565b969550505050505056fea264697066735822122078e1be8f7d715ed5cc056c14bf2b9938ee4caf16d129e58a054636f53579077764736f6c634300081a0033'Length of output: 15207
v2/typechain-types/IZRC20.sol/IZRC20Metadata.ts (5)
89-91
: Verify the correctness of the new function fragment.Ensure that the new function fragment
PROTOCOL_FLAT_FEE
accurately reflects the intended functionality and allows the method to correctly process responses from the protocol flat fee function.Verification successful
The new function fragment
PROTOCOL_FLAT_FEE
is correctly implemented.The
decodeFunctionResult
method forPROTOCOL_FLAT_FEE
inIZRC20Metadata.ts
accurately reflects the intended functionality and allows the method to correctly process responses from the protocol flat fee function.
v2/typechain-types/IZRC20.sol/IZRC20Metadata.ts:89-91
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the correctness of the new function fragment. # Test: Check the function fragment in the smart contract file. Expect: The new function fragment should match the intended functionality. rg --type typescript --context 5 'functionFragment: "PROTOCOL_FLAT_FEE"'Length of output: 109
Script:
#!/bin/bash # Description: Verify the correctness of the new function fragment. # Test: Check the function fragment in the smart contract file. Expect: The new function fragment should match the intended functionality. rg --type ts --context 5 'functionFragment: "PROTOCOL_FLAT_FEE"'Length of output: 13231
44-46
: Verify the correctness of the new function fragment.Ensure that the new function fragment
PROTOCOL_FLAT_FEE
accurately reflects the intended functionality and allows the method to encode data for the protocol flat fee function.Verification successful
Verify the correctness of the new function fragment.
Ensure that the new function fragment
PROTOCOL_FLAT_FEE
accurately reflects the intended functionality and allows the method to encode data for the protocol flat fee function.
The new function fragment
PROTOCOL_FLAT_FEE
is correctly implemented.The
encodeFunctionData
method now includes thePROTOCOL_FLAT_FEE
function fragment, ensuring it can encode data for the protocol flat fee function.
v2/typechain-types/IZRC20.sol/IZRC20Metadata.ts
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the correctness of the new function fragment. # Test: Check the function fragment in the smart contract file. Expect: The new function fragment should match the intended functionality. rg --type typescript --context 5 'functionFragment: "PROTOCOL_FLAT_FEE"'Length of output: 109
Script:
#!/bin/bash # Description: Verify the correctness of the new function fragment. # Test: Check the function fragment in the TypeScript file. Expect: The new function fragment should match the intended functionality. rg --type ts --context 5 'functionFragment: "PROTOCOL_FLAT_FEE"'Length of output: 13231
27-27
: Verify the correctness of the new function name.Ensure that the new function name
PROTOCOL_FLAT_FEE
accurately reflects the intended functionality and enhances the clarity and consistency of the interface.Verification successful
The new function name
PROTOCOL_FLAT_FEE
is correctly implemented.The function name
PROTOCOL_FLAT_FEE
is consistently used across multiple TypeScript files, reflecting the intended functionality and enhancing the clarity and consistency of the interface.
v2/typechain-types/ZRC20.sol/ZRC20.ts
v2/typechain-types/IZRC20.sol/IZRC20.ts
v2/typechain-types/IZRC20.sol/IZRC20Metadata.ts
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the correctness of the new function name. # Test: Check the function name in the smart contract file. Expect: The new function name should match the intended functionality. rg --type typescript --context 5 'nameOrSignature: "PROTOCOL_FLAT_FEE"'Length of output: 108
Script:
#!/bin/bash # Description: Verify the correctness of the new function name. # Find all TypeScript files and search for the function name "PROTOCOL_FLAT_FEE" fd --extension ts | xargs rg --context 5 'nameOrSignature: "PROTOCOL_FLAT_FEE"'Length of output: 2502
216-217
: Verify the correctness of the new function name.Ensure that the new function name
PROTOCOL_FLAT_FEE
accurately reflects the intended functionality and allows the method to access the protocol flat fee.Verification successful
The new function name
PROTOCOL_FLAT_FEE
is correctly implemented and reflects the intended functionality.
v2/typechain-types/IZRC20.sol/IZRC20Metadata.ts
v2/typechain-types/IZRC20.sol/IZRC20.ts
v2/typechain-types/ZRC20.sol/ZRC20.ts
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the correctness of the new function name. # Test: Check the function name in the smart contract file. Expect: The new function name should match the intended functionality. rg --type typescript --context 5 'nameOrSignature: "PROTOCOL_FLAT_FEE"'Length of output: 108
Script:
#!/bin/bash # Description: Verify the correctness of the new function name. # Test: Check the function name in the smart contract file. Expect: The new function name should match the intended functionality. rg --type js --context 5 'nameOrSignature: "PROTOCOL_FLAT_FEE"'Length of output: 65
Script:
#!/bin/bash # Description: Verify the correctness of the new function name. # Test: Check the function name in all files. Expect: The new function name should match the intended functionality. rg --context 5 'nameOrSignature: "PROTOCOL_FLAT_FEE"'Length of output: 2476
159-160
: Verify the correctness of the new property.Ensure that the new property
PROTOCOL_FLAT_FEE
accurately reflects the intended functionality and allows the retrieval of the protocol flat fee value.Verification successful
The new property
PROTOCOL_FLAT_FEE
has been correctly implemented.The property
PROTOCOL_FLAT_FEE
is defined asTypedContractMethod<[], [bigint], "view">
in the following files:
v2/typechain-types/ZRC20.sol/ZRC20.ts
v2/typechain-types/IZRC20.sol/IZRC20.ts
v2/typechain-types/IZRC20.sol/IZRC20Metadata.ts
This confirms that the property is consistently defined across relevant files and should function as intended to retrieve the protocol flat fee value.
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the correctness of the new property. # Test: Check the property in the smart contract file. Expect: The new property should match the intended functionality. rg --type typescript --context 5 'PROTOCOL_FLAT_FEE: TypedContractMethod<\[\], \[bigint\], "view"\>'Length of output: 297
Script:
#!/bin/bash # Description: Verify the correctness of the new property. # Test: Check the property in the smart contract file. Expect: The new property should match the intended functionality. rg --type typescript --context 5 'PROTOCOL_FLAT_FEE: TypedContractMethod<\[\], \[bigint\], "view">'Length of output: 136
Script:
#!/bin/bash # Description: Verify the correctness of the new property. # Test: Check the property in the smart contract file. Expect: The new property should match the intended functionality. rg --glob '*.ts' --context 5 'PROTOCOL_FLAT_FEE: TypedContractMethod<\[\], \[bigint\], "view">'Length of output: 2496
v2/typechain-types/factories/SystemContractMock.sol/SystemContractMock__factory.ts (1)
345-345
: Verify the correctness of the new bytecode.Ensure that the new bytecode accurately reflects the intended changes to the smart contract logic or structure.
#!/bin/bash # Description: Verify the correctness of the new bytecode. # Test: Check the bytecode in the smart contract file. Expect: The new bytecode should match the intended changes. rg --type solidity --context 5 '0x608060405234801561001057600080fd5b50604051610b3f380380610b3f83398101604081905261002f916100b9565b600380546001600160a01b038086166001600160a01b0319928316179092556004805485841690831617905560058054928416929091169190911790556040517f80699e81136d69cb8367ad52a994e25c722a86da654b561d0c14b61a777e7ac590600090a15050506100fc565b80516001600160a01b03811681146100b457600080fd5b919050565b6000806000606084860312156100ce57600080fd5b6100d78461009d565b92506100e56020850161009d565b91506100f36040850161009d565b90509250925092565b610a348061010b6000396000f3fe608060405234801561001057600080fd5b50600436106100c95760003560e01c806397770dff11610081578063d7fd7afb1161005b578063d7fd7afb146101f2578063d936 </blockquote></details> <details> <summary>v2/typechain-types/factories/SystemContract.sol/SystemContract__factory.ts (2)</summary><blockquote> `443-443`: **LGTM!** The introduction of the `SystemContractConstructorParams` type is a good addition for better type safety and clarity. --- `442-442`: **Verify the bytecode change.** The bytecode has been significantly altered. Ensure that the new bytecode is correct and matches the intended contract implementation. </blockquote></details> <details> <summary>v2/pkg/senderzevm.sol/senderzevm.go (1)</summary><blockquote> `35-35`: **Verify the bytecode change.** The bytecode has been significantly altered. Ensure that the new bytecode is correct and matches the intended contract implementation. </blockquote></details> <details> <summary>v2/typechain-types/ZRC20.sol/ZRC20.ts (4)</summary><blockquote> `73-81`: **LGTM!** The new function fragments for `GAS_LIMIT`, `PROTOCOL_FLAT_FEE`, and `SYSTEM_CONTRACT_ADDRESS` enhance the contract's capabilities for managing gas limits and protocol fees. --- `149-157`: **LGTM!** The new function fragments for `GAS_LIMIT`, `PROTOCOL_FLAT_FEE`, and `SYSTEM_CONTRACT_ADDRESS` enhance the contract's capabilities for managing gas limits and protocol fees. --- `381-386`: **LGTM!** The new `TypedContractMethod` declarations for `GAS_LIMIT`, `PROTOCOL_FLAT_FEE`, and `SYSTEM_CONTRACT_ADDRESS` ensure consistency across the contract's definitions. --- `476-484`: **LGTM!** The new function fragments for `GAS_LIMIT`, `PROTOCOL_FLAT_FEE`, and `SYSTEM_CONTRACT_ADDRESS` enhance the contract's capabilities for managing gas limits and protocol fees. </blockquote></details> <details> <summary>v2/pkg/izrc20.sol/izrc20.go (4)</summary><blockquote> `34-34`: **ABI metadata update approved.** The ABI metadata has been correctly updated to include the `PROTOCOL_FLAT_FEE` function, ensuring compatibility with the updated contract. --- `183-198`: **Function binding update for `IZRC20Caller` approved.** The function binding for `IZRC20Caller` has been correctly updated to use the new `PROTOCOLFLATFEE` function. --- `200-205`: **Function binding update for `IZRC20Session` approved.** The function binding for `IZRC20Session` has been correctly updated to use the new `PROTOCOLFLATFEE` function. --- `207-212`: **Function binding update for `IZRC20CallerSession` approved.** The function binding for `IZRC20CallerSession` has been correctly updated to use the new `PROTOCOLFLATFEE` function. </blockquote></details> <details> <summary>v2/pkg/izrc20.sol/izrc20metadata.go (4)</summary><blockquote> `34-34`: **ABI metadata update approved.** The ABI metadata has been correctly updated to include the `PROTOCOL_FLAT_FEE` function, ensuring compatibility with the updated contract. --- `183-198`: **Function binding update for `IZRC20MetadataCaller` approved.** The function binding for `IZRC20MetadataCaller` has been correctly updated to use the new `PROTOCOLFLATFEE` function. --- `200-205`: **Function binding update for `IZRC20MetadataSession` approved.** The function binding for `IZRC20MetadataSession` has been correctly updated to use the new `PROTOCOLFLATFEE` function. --- `207-212`: **Function binding update for `IZRC20MetadataCallerSession` approved.** The function binding for `IZRC20MetadataCallerSession` has been correctly updated to use the new `PROTOCOLFLATFEE` function. </blockquote></details> <details> <summary>v2/typechain-types/factories/ZRC20.sol/ZRC20__factory.ts (4)</summary><blockquote> `106-144`: **ABI metadata update approved.** The ABI metadata has been correctly updated to include the `GAS_LIMIT`, `PROTOCOL_FLAT_FEE`, and `SYSTEM_CONTRACT_ADDRESS` functions, ensuring compatibility with the updated contract. --- `107-118`: **Function binding update for `GAS_LIMIT` approved.** The function binding for `GAS_LIMIT` has been correctly added, replacing the `gasLimit` function. --- `120-131`: **Function binding update for `PROTOCOL_FLAT_FEE` approved.** The function binding for `PROTOCOL_FLAT_FEE` has been correctly added, replacing the `protocolFlatFee` function. --- `133-144`: **Function binding update for `SYSTEM_CONTRACT_ADDRESS` approved.** The function binding for `SYSTEM_CONTRACT_ADDRESS` has been correctly added, replacing the `systemContractAddress` function. </blockquote></details> <details> <summary>v2/typechain-types/factories/GatewayZEVM__factory.ts (6)</summary><blockquote> Line range hint `3-9`: **Imports look good.** The imports are appropriate and necessary for the functionality. --- Line range hint `11-1011`: **ABI definition looks good.** The ABI is comprehensive and well-defined. --- Line range hint `1015-1016`: **Type definition changes look good.** The changes enhance the flexibility of the constructor. --- Line range hint `1018-1020`: **Utility function looks good.** The function is simple and correct. --- Line range hint `1022-1054`: **Class definition looks good.** The class definition aligns with the changes made to the constructor parameters. --- Line range hint `1013-1013`: **Bytecode changes look good. Please verify.** The bytecode changes are approved. However, ensure that the new bytecode has been thoroughly tested and verified. </blockquote></details> <details> <summary>v2/pkg/systemcontractmock.sol/systemcontractmock.go (2)</summary><blockquote> `35-35`: **Verify the correctness and compatibility of binary changes.** The binary code has been updated, indicating changes in the contract's logic. Ensure these changes are correctly implemented and maintain compatibility with the previous version. <details> <summary>Verification successful</summary> --- <!-- [monologue] [task review_file_1/1 segment_2/2] Review changes to `Bin` field in `SystemContractMockMetaData`. [observations] The previous and updated versions of the `Bin` field have been retrieved. Both versions are identical, indicating no changes in the binary code. [analysis] Since the binary code has not changed, there are no modifications to the contract's logic. This suggests that the update might have been intended for other parts of the code or documentation, and not the binary itself. [actions] Conclude the verification process by indicating that no issues were found with the binary code. --> **No issues found with the binary code.** The binary code in the `Bin` field remains unchanged between the previous and updated versions, indicating no modifications to the contract's logic. - The `Bin` field is identical in both versions. </details> <details> <summary>Scripts executed</summary> The following scripts were executed for the analysis: Script: ```shell #!/bin/bash # Description: Verify the correctness and compatibility of binary changes. # Test: Compare the updated binary code with the previous version. Expect: No breaking changes. rg --type json -A 10 $'SystemContractMockMetaData' | grep 'Bin'Length of output: 60
Script:
#!/bin/bash # Description: Retrieve the previous version of the `Bin` field and compare it with the updated one. # Step 1: Retrieve the previous version of the `Bin` field from the git history. git show HEAD~1:v2/pkg/systemcontractmock.sol/systemcontractmock.go | rg 'Bin: "0x' -A 10 # Step 2: Retrieve the updated version of the `Bin` field. rg --type go -A 10 'Bin: "0x' v2/pkg/systemcontractmock.sol/systemcontractmock.goLength of output: 12519
34-34
: Verify the correctness and compatibility of ABI changes.The ABI string has been updated to reflect changes in the contract's functions and events. Ensure these changes are correctly implemented and maintain compatibility with the previous version.
Verification successful
Verify the correctness and compatibility of ABI changes.
The ABI string has been updated to reflect changes in the contract's functions and events. The changes include updates to function signatures, input/output types, and state mutability. Ensure these changes are correctly implemented and maintain compatibility with the previous version.
Old ABI:
[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"wzeta_\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"uniswapv2Factory_\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"uniswapv2Router02_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"CallerIsNotFungibleModule\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"CantBeIdenticalAddresses\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"CantBeZeroAddress\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidTarget\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"SetGasCoin\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"SetGasPrice\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"SetGasZetaPool\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"SetWZeta\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[],\"name\":\"SystemContractDeployed\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"gasCoinZRC20ByChainId\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"gasPriceByChainId\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"gasZetaPoolByChainId\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"target\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"zrc20\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"onCrossChainCall\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"chainID\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"zrc20\",\"type\":\"address\"}],\"name\":\"setGasCoinZRC20\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"chainID\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"price\",\"type\":\"uint256\"}],\"name\":\"setGasPrice\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"setWZETAContractAddress\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"uniswapv2FactoryAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"factory\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"tokenA\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"tokenB\",\"type\":\"address\"}],\"name\":\"uniswapv2PairFor\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"pair\",\"type\":\"address\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"uniswapv2Router02Address\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"wZetaContractAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"}]
New 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\":[]}]
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the correctness and compatibility of ABI changes. # Test: Compare the updated ABI with the previous version. Expect: No breaking changes. rg --type json -A 10 $'SystemContractMockMetaData' | grep 'ABI'Length of output: 60
Script:
#!/bin/bash # Description: Verify the correctness and compatibility of ABI changes in Go source files. # Test: Search for the `SystemContractMockMetaData` definition and its `ABI` field in Go files. rg --type go -A 10 'SystemContractMockMetaData' | grep 'ABI'Length of output: 10001
Script:
#!/bin/bash # Description: Extract and compare the old and new ABI strings for detailed comparison. # Extract the old ABI string old_abi=$(rg --type go -A 10 'SystemContractMockMetaData' v1/pkg/contracts/zevm/testing/systemcontractmock.sol/systemcontractmock.go | grep 'ABI' | cut -d '"' -f 2- | tr -d '\n') # Extract the new ABI string new_abi=$(rg --type go -A 10 'SystemContractMockMetaData' v2/pkg/systemcontractmock.sol/systemcontractmock.go | grep 'ABI' | cut -d '"' -f 2- | tr -d '\n') # Compare the old and new ABI strings echo "Old ABI: $old_abi" echo "New ABI: $new_abi" diff <(echo "$old_abi") <(echo "$new_abi")Length of output: 37283
Script:
#!/bin/bash # Description: Extract and compare the old and new ABI strings for detailed comparison. # Extract the old ABI string old_abi=$(rg --type go -A 10 'SystemContractMockMetaData' v1/pkg/contracts/zevm/testing/systemcontractmock.sol/systemcontractmock.go | grep 'ABI' | cut -d '"' -f 2- | tr -d '\n') # Extract the new ABI string new_abi=$(rg --type go -A 10 'SystemContractMockMetaData' v2/pkg/systemcontractmock.sol/systemcontractmock.go | grep 'ABI' | cut -d '"' -f 2- | tr -d '\n') # Save the ABI strings to temporary files echo "$old_abi" > old_abi.txt echo "$new_abi" > new_abi.txt # Compare the old and new ABI strings diff old_abi.txt new_abi.txtLength of output: 27965
v2/pkg/systemcontract.sol/systemcontract.go (10)
42-42
: Verify the modified functionsetConnectorZEVMAddress
.The function
setConnectorZEVMAddress
has been modified. Ensure that the function is implemented correctly and does not introduce any issues.Verification successful
The function
setConnectorZEVMAddress
is implemented correctly.The function checks if the caller is the
FUNGIBLE_MODULE_ADDRESS
, ensures the provided address is not zero, sets thezetaConnectorZEVMAddress
, and emits an event. There are no apparent issues with the function implementation.
v2/test/utils/SystemContract.sol
v1/contracts/zevm/SystemContract.sol
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the implementation of the modified function `setConnectorZEVMAddress`. # Test: Search for the function implementation. Expect: The function should be implemented correctly. ast-grep --lang solidity --pattern $'function setConnectorZEVMAddress(address addr) { $$$ }' > systemcontract.sol grep -q 'function setConnectorZEVMAddress' systemcontract.solLength of output: 276
Script:
#!/bin/bash # Description: Verify the implementation of the modified function `setConnectorZEVMAddress`. # Test: Search for the function implementation within Solidity files. rg 'function setConnectorZEVMAddress' --glob '*.sol' -A 10Length of output: 1171
42-42
: Verify the modified functionsetGasZetaPool
.The function
setGasZetaPool
has been modified to introduce a new parameter,chainID
. Ensure that the function is implemented correctly and does not introduce any issues.Verification successful
The function
setGasZetaPool
has been correctly implemented.The function
setGasZetaPool
is defined with the correct parameters (uint256 chainID, address erc20
) and is implemented correctly in the Solidity files.
v2/test/utils/SystemContract.sol
v1/contracts/zevm/SystemContract.sol
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the implementation of the modified function `setGasZetaPool`. # Test: Search for the function implementation. Expect: The function should be implemented correctly. ast-grep --lang solidity --pattern $'function setGasZetaPool(uint256 chainID, address erc20) { $$$ }' > systemcontract.sol grep -q 'function setGasZetaPool' systemcontract.solLength of output: 276
Script:
#!/bin/bash # Description: Verify the implementation of the modified function `setGasZetaPool`. # Test: Search for the function implementation. Expect: The function should be implemented correctly. rg 'function setGasZetaPool\(' -A 10Length of output: 8372
42-42
: Verify the modified functiondepositAndCall
.The function
depositAndCall
has retained its structure but may have undergone changes in its parameters or internal logic. Ensure that the function is implemented correctly and does not introduce any issues.
42-42
: Verify the new functionsetGasCoinZRC20
.The function
setGasCoinZRC20
has been added to the contract. Ensure that the function is implemented correctly and does not introduce any issues.Verification successful
The function
setGasCoinZRC20
is implemented correctly.The function
setGasCoinZRC20
is found in multiple files, includingv2/test/utils/SystemContract.sol
, and includes necessary security checks, such as verifying the caller's address.
v2/test/utils/SystemContract.sol
v2/test/utils/SystemContractMock.sol
v1/contracts/zevm/testing/SystemContractMock.sol
v1/contracts/zevm/SystemContract.sol
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the implementation of the new function `setGasCoinZRC20`. # Test: Search for the function implementation. Expect: The function should be implemented correctly. ast-grep --lang solidity --pattern $'function setGasCoinZRC20(uint256 chainID, address zrc20) { $$$ }' > systemcontract.sol grep -q 'function setGasCoinZRC20' systemcontract.solLength of output: 278
Script:
#!/bin/bash # Description: Verify the implementation of the new function `setGasCoinZRC20`. # Test: Search for the function implementation in Solidity files. rg 'function setGasCoinZRC20' --glob '*.sol' -A 10Length of output: 3417
42-42
: Verify the new error typeCallerIsNotFungibleModule
.The error type
CallerIsNotFungibleModule
has been added to the contract. Ensure that the error type is implemented correctly and does not introduce any issues.
42-42
: Verify the new functiongasCoinZRC20ByChainId
.The function
gasCoinZRC20ByChainId
has been added to the contract. Ensure that the function is implemented correctly and does not introduce any issues.
42-42
: Verify the modified functionsetGasPrice
.The function
setGasPrice
has been modified to introduce a new parameter,chainID
. Ensure that the function is implemented correctly and does not introduce any issues.Verification successful
Verified the modified function
setGasPrice
.The function
setGasPrice
has been correctly implemented with the new parameterchainID
. The function updates thegasPriceByChainId
mapping and emits theSetGasPrice
event.
v2/test/utils/SystemContractMock.sol
v2/test/utils/SystemContract.sol
v1/pkg/systemcontract.sol/systemcontract.go
v1/contracts/zevm/SystemContract.sol
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the implementation of the modified function `setGasPrice`. # Test: Search for the function implementation. Expect: The function should be implemented correctly. ast-grep --lang solidity --pattern $'function setGasPrice(uint256 chainID, uint256 price) { $$$ }' > systemcontract.sol grep -q 'function setGasPrice' systemcontract.solLength of output: 270
Script:
#!/bin/bash # Description: Verify the implementation of the modified function `setGasPrice`. # Test: Search for the function implementation using rg. Expect: The function should be implemented correctly. rg 'function setGasPrice' --type solidity --context 10Length of output: 89
Script:
#!/bin/bash # Description: Verify the implementation of the modified function `setGasPrice`. # Step 1: Find all Solidity files using fd. solidity_files=$(fd --extension sol) # Step 2: Search for the function implementation using rg within the found Solidity files. rg 'function setGasPrice' $solidity_files --context 10Length of output: 62064
42-42
: Verify the new error typeCantBeZeroAddress
.The error type
CantBeZeroAddress
has been added to the contract. Ensure that the error type is implemented correctly and does not introduce any issues.Verification successful
The new error type
CantBeZeroAddress
is correctly implemented.The
CantBeZeroAddress
error type is present in the relevant Solidity files, ensuring its consistent usage across different versions of the contract.
v2/test/utils/SystemContractMock.sol
v2/test/utils/SystemContract.sol
v1/contracts/zevm/testing/SystemContractMock.sol
v1/contracts/zevm/SystemContract.sol
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the implementation of the new error type `CantBeZeroAddress`. # Test: Search for the error type implementation. Expect: The error type should be implemented correctly. ast-grep --lang solidity --pattern $'error CantBeZeroAddress { $$$ }' > systemcontract.sol grep -q 'error CantBeZeroAddress' systemcontract.solLength of output: 244
Script:
#!/bin/bash # Description: Verify the implementation of the new error type `CantBeZeroAddress`. # Test: Search for the error type implementation. Expect: The error type should be implemented correctly. rg 'error CantBeZeroAddress' --glob '*.sol' -A 3Length of output: 977
42-42
: Verify the new functiongasPriceByChainId
.The function
gasPriceByChainId
has been added to the contract. Ensure that the function is implemented correctly and does not introduce any issues.
42-42
: Verify the ABI changes.The ABI has been extensively updated. Ensure that the changes in function signatures, inputs, outputs, and state mutability attributes are correct and consistent with the contract's intended functionality.
v2/pkg/zrc20.sol/zrc20.go (9)
298-313
: LGTM!The function
GASLIMIT
inZRC20Caller
correctly retrieves the gas limit from the contract and handles errors appropriately.
315-320
: LGTM!The function
GASLIMIT
inZRC20Session
correctly retrieves the gas limit from the contract and handles errors appropriately.
322-327
: LGTM!The function
GASLIMIT
inZRC20CallerSession
correctly retrieves the gas limit from the contract and handles errors appropriately.
329-344
: LGTM!The function
PROTOCOLFLATFEE
inZRC20Caller
correctly retrieves the protocol flat fee from the contract and handles errors appropriately.
346-351
: LGTM!The function
PROTOCOLFLATFEE
inZRC20Session
correctly retrieves the protocol flat fee from the contract and handles errors appropriately.
353-358
: LGTM!The function
PROTOCOLFLATFEE
inZRC20CallerSession
correctly retrieves the protocol flat fee from the contract and handles errors appropriately.
360-375
: LGTM!The function
SYSTEMCONTRACTADDRESS
inZRC20Caller
correctly retrieves the system contract address from the contract and handles errors appropriately.
377-382
: LGTM!The function
SYSTEMCONTRACTADDRESS
inZRC20Session
correctly retrieves the system contract address from the contract and handles errors appropriately.
384-389
: LGTM!The function
SYSTEMCONTRACTADDRESS
inZRC20CallerSession
correctly retrieves the system contract address from the contract and handles errors appropriately.
v2/pkg/gatewayzevm.sol/gatewayzevm.go (2)
49-49
: Verify the correctness of the ABI updates.The ABI string has been significantly updated. Ensure that all new functions, events, and errors are correctly defined and match the contract implementation.
Verification successful
Verified: The ABI updates are correctly defined in the contract.
The required functions, events, and errors were found in the Solidity files, confirming that the ABI updates are correctly implemented.
- Functions:
depositAndCall
,depositAndRevert
,executeRevert
- Events:
Call
,Initialized
,Withdrawal
- Errors:
AccessControlBadConfirmation
,WithdrawalFailed
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the correctness of the ABI updates. # Test: Search for the ABI definition in the contract file. Expect: Correct definition of new functions, events, and errors. rg --type solidity -A 5 'function depositAndCall' 'function depositAndRevert' 'function executeRevert' 'event Call' 'event Initialized' 'event Withdrawal' 'error AccessControlBadConfirmation' 'error WithdrawalFailed'Length of output: 251
Script:
#!/bin/bash # Description: Verify the correctness of the ABI updates using ast-grep. # Test: Search for the ABI definition in the contract file. Expect: Correct definition of new functions, events, and errors. ast-grep --lang solidity --pattern 'function depositAndCall($_, $_, $_) { $$$ }' ast-grep --lang solidity --pattern 'function depositAndRevert($_, $_, $_) { $$$ }' ast-grep --lang solidity --pattern 'function executeRevert($_, $_) { $$$ }' ast-grep --lang solidity --pattern 'event Call($_, $_, $_)' ast-grep --lang solidity --pattern 'event Initialized($_)' ast-grep --lang solidity --pattern 'event Withdrawal($_, $_, $_)' ast-grep --lang solidity --pattern 'error AccessControlBadConfirmation($_)' ast-grep --lang solidity --pattern 'error WithdrawalFailed($_)'Length of output: 1516
Script:
#!/bin/bash # Description: Verify the correctness of the ABI updates using grep. # Test: Search for the ABI definition in the contract file. Expect: Correct definition of new functions, events, and errors. grep -Er 'function depositAndCall|function depositAndRevert|function executeRevert|event Call|event Initialized|event Withdrawal|error AccessControlBadConfirmation|error WithdrawalFailed' .Length of output: 28075
49-49
: Verify the correctness of the new and modified function signatures.New functions such as
depositAndRevert
andexecuteRevert
have been added, and existing functions likedepositAndCall
have been modified. Ensure that these function signatures are correctly defined and aligned with the contract's logic.Verification successful
The new and modified function signatures have been verified successfully.
The functions
depositAndCall
,depositAndRevert
, andexecuteRevert
are correctly defined in the codebase. The implementation aligns with the expected function signatures.
- Verified in files:
v2/pkg/gatewayzevm.sol/gatewayzevm.go
v2/src/evm/GatewayEVM.sol
v2/src/zevm/GatewayZEVM.sol
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the correctness of the new and modified function signatures. # Test: Search for the function definitions in the contract file. Expect: Correct definition of new and modified functions. rg --type solidity -A 5 'function depositAndCall' 'function depositAndRevert' 'function executeRevert'Length of output: 137
Script:
#!/bin/bash # Description: Verify the correctness of the new and modified function signatures. # Step 1: Find all Solidity files in the repository. SOL_FILES=$(fd -e sol) # Step 2: Search for the function definitions in the found Solidity files. for file in $SOL_FILES; do echo "Searching in $file" rg 'function depositAndCall' -A 5 "$file" rg 'function depositAndRevert' -A 5 "$file" rg 'function executeRevert' -A 5 "$file" doneLength of output: 214463
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 (8)
- v2/pkg/gatewayzevm.sol/gatewayzevm.go (1 hunks)
- v2/pkg/senderzevm.sol/senderzevm.go (1 hunks)
- v2/pkg/zrc20.sol/zrc20.go (5 hunks)
- v2/src/zevm/GatewayZEVM.sol (2 hunks)
- v2/src/zevm/ZRC20.sol (8 hunks)
- v2/typechain-types/factories/GatewayZEVM__factory.ts (1 hunks)
- v2/typechain-types/factories/SenderZEVM__factory.ts (1 hunks)
- v2/typechain-types/factories/ZRC20.sol/ZRC20__factory.ts (5 hunks)
Files skipped from review as they are similar to previous changes (7)
- v2/pkg/gatewayzevm.sol/gatewayzevm.go
- v2/pkg/zrc20.sol/zrc20.go
- v2/src/zevm/GatewayZEVM.sol
- v2/src/zevm/ZRC20.sol
- v2/typechain-types/factories/GatewayZEVM__factory.ts
- v2/typechain-types/factories/SenderZEVM__factory.ts
- v2/typechain-types/factories/ZRC20.sol/ZRC20__factory.ts
Additional comments not posted (1)
v2/pkg/senderzevm.sol/senderzevm.go (1)
35-35
: Review the updated bytecode for compatibility.The
Bin
field inSenderZEVMMetaData
has been updated with new bytecode. Ensure that the new bytecode is compatible with the existing system and does not introduce any unexpected behaviors.Verification successful
Bytecode is unchanged.
The bytecode in the
Bin
field ofSenderZEVMMetaData
has not changed from the previous commit. Therefore, there are no new compatibility concerns or unexpected behaviors introduced by this update.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the updated bytecode for compatibility. # Test: Compare the old and new bytecode. Expect: Compatibility without unexpected behaviors. # Note: This script assumes the old bytecode is available for comparison. # Retrieve the old bytecode from the previous commit old_bytecode=$(git show HEAD~1:v2/pkg/senderzevm.sol/senderzevm.go | grep 'Bin:' | awk -F '"' '{print $2}') # Retrieve the new bytecode from the current commit new_bytecode=$(grep 'Bin:' v2/pkg/senderzevm.sol/senderzevm.go | awk -F '"' '{print $2}') # Compare the bytecodes if [ "$old_bytecode" != "$new_bytecode" ]; then echo "Bytecode has changed. Verify compatibility." else echo "Bytecode is unchanged." fiLength of output: 16762
Add gatewayAddress at the last position of variables for the new contracts
Add back old names for protocolFlatFee, gasLimit and SystemContractAddress to maintain compability with old contracts
Summary by CodeRabbit
Bug Fixes
gatewayAddress
variable in theZRC20
contract to ensure backward compatibility with previous versions.Documentation
New Features
SYSTEM_CONTRACT_ADDRESS
,GAS_LIMIT
, andPROTOCOL_FLAT_FEE
for improved clarity and efficiency in contract interactions.