-
Notifications
You must be signed in to change notification settings - Fork 64
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: renaming origin
and sender
in MessageContext
#474
Conversation
📝 WalkthroughWalkthroughThe changes update the cross-chain interaction interface by replacing the old Changes
Possibly related issues
Possibly related PRs
Suggested reviewers
Tip ⚡🧪 Multi-step agentic review comment chat (experimental)
📜 Recent review detailsConfiguration used: .coderabbit.yaml ⛔ Files ignored due to path filters (13)
📒 Files selected for processing (2)
🧰 Additional context used📓 Path-based instructions (1)`test/**`: Review the test files for proper coverage, edge cases, and best practices.
🔇 Additional comments (4)
✨ Finishing Touches
🪧 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 using PR comments)
Other keywords and placeholders
Documentation and Community
|
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
🧹 Nitpick comments (1)
test/utils/TestUniversalContract.sol (1)
48-48
: Rename event parameter and doc references.You're now passing
context.sender
as the first event argument, yet the event parameter remains namedorigin
, and the documentation refers to it as "The origin address on the external chain." This may cause confusion since it's now a chain-agnosticbytes sender
. Consider renaming the parameter and updating the related doc comments for clarity.Here is a possible diff to illustrate the rename:
- event ContextData(bytes origin, address sender, uint256 chainID, address msgSender, string message); + event ContextData(bytes sender, address senderEVM, uint256 chainID, address msgSender, string message);
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (27)
docs/src/contracts/zevm/interfaces/UniversalContract.sol/interface.UniversalContract.md
is excluded by!docs/**
docs/src/contracts/zevm/interfaces/UniversalContract.sol/struct.MessageContext.md
is excluded by!docs/**
pkg/gatewayevmzevm.t.sol/gatewayevmzevmtest.go
is excluded by!pkg/**
pkg/gatewayzevm.sol/gatewayzevm.go
is excluded by!pkg/**
pkg/gatewayzevm.t.sol/gatewayzevminboundtest.go
is excluded by!pkg/**
pkg/gatewayzevm.t.sol/gatewayzevmoutboundtest.go
is excluded by!pkg/**
pkg/gatewayzevmupgradetest.sol/gatewayzevmupgradetest.go
is excluded by!pkg/**
pkg/igatewayzevm.sol/igatewayzevm.go
is excluded by!pkg/**
pkg/senderzevm.sol/senderzevm.go
is excluded by!pkg/**
pkg/systemcontract.sol/systemcontract.go
is excluded by!pkg/**
pkg/systemcontractmock.sol/systemcontractmock.go
is excluded by!pkg/**
pkg/testuniversalcontract.sol/testuniversalcontract.go
is excluded by!pkg/**
pkg/universalcontract.sol/universalcontract.go
is excluded by!pkg/**
pkg/zrc20.t.sol/zrc20test.go
is excluded by!pkg/**
types/GatewayZEVM.ts
is excluded by!types/**
types/GatewayZEVMUpgradeTest.ts
is excluded by!types/**
types/IGatewayZEVM.sol/IGatewayZEVM.ts
is excluded by!types/**
types/TestUniversalContract.ts
is excluded by!types/**
types/UniversalContract.sol/UniversalContract.ts
is excluded by!types/**
types/factories/GatewayZEVMUpgradeTest__factory.ts
is excluded by!types/**
types/factories/GatewayZEVM__factory.ts
is excluded by!types/**
types/factories/IGatewayZEVM.sol/IGatewayZEVM__factory.ts
is excluded by!types/**
types/factories/SenderZEVM__factory.ts
is excluded by!types/**
types/factories/SystemContract.sol/SystemContract__factory.ts
is excluded by!types/**
types/factories/SystemContractMock.sol/SystemContractMock__factory.ts
is excluded by!types/**
types/factories/TestUniversalContract__factory.ts
is excluded by!types/**
types/factories/UniversalContract.sol/UniversalContract__factory.ts
is excluded by!types/**
📒 Files selected for processing (3)
contracts/zevm/interfaces/UniversalContract.sol
(1 hunks)test/GatewayZEVM.t.sol
(20 hunks)test/utils/TestUniversalContract.sol
(1 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
`test/**`: Review the test files for proper coverage, edge c...
test/**
: Review the test files for proper coverage, edge cases, and best practices.
test/utils/TestUniversalContract.sol
test/GatewayZEVM.t.sol
`contracts/**`: Review the Solidity contracts for security v...
contracts/**
: Review the Solidity contracts for security vulnerabilities and best practices.
contracts/zevm/interfaces/UniversalContract.sol
⏰ Context from checks skipped due to timeout of 90000ms (3)
- GitHub Check: generate
- GitHub Check: slither
- GitHub Check: test
🔇 Additional comments (22)
contracts/zevm/interfaces/UniversalContract.sol (2)
26-27
: Documentation looks clear.These docstrings accurately convey the purpose of the struct and highlight its chain-agnostic design.
40-46
: New interface and doc block are well-structured.The reworked
onCall
method with the revisedMessageContext
parameter is consistent with the described functionality and documentation. No immediate concerns.test/GatewayZEVM.t.sol (20)
799-800
: Same concern as above.
809-810
: Same concern as above.
819-820
: Same concern as above.
829-830
: Same concern as above.
859-860
: Same concern as above.
869-870
: Same concern as above.
879-880
: Same concern as above.
892-893
: Same concern as above.
906-907
: Same concern as above.
916-917
: Same concern as above.
926-927
: Same concern as above.
985-986
: Same concern as above.
995-996
: Same concern as above.
1005-1006
: Same concern as above.
1015-1016
: Same concern as above.
1029-1030
: Same concern as above.
1050-1051
: Same concern as above.
1061-1062
: Same concern as above.
1072-1073
: Same concern as above.
789-790
:✅ Verification successful
Potential mismatch in
sender
vs.senderEVM
.Here,
MessageContext.sender
is set toabi.encodePacked(address(gateway))
, whileMessageContext.senderEVM
is set toprotocolAddress
. Verify that this difference is intentional. If this chain is EVM-based, you might want both to represent the same address or document the reason for using distinct addresses.
🏁 Script executed:
#!/bin/bash # Searching the codebase for all test context initializations to ensure consistency rg -A 5 "MessageContext({ sender:"Length of output: 151
Below is a revised next step to verify the intended behavior:
It appears the first run failed due to unescaped curly braces in the regex. To continue gathering context on the initialization pattern for
MessageContext
—especially the assignments forsender
andsenderEVM
—please run the following script using a fixed-string search so that the curly braces are treated literally:The output from this search should help confirm whether:
- The use of
abi.encodePacked(address(gateway))
forsender
andprotocolAddress
forsenderEVM
is unique to this test case.- There exists a consistent pattern elsewhere in the codebase that supports using different addresses.
Once you have validated that the discrepancy is intentional (or identified a mistake if similar initializations are meant to use the same value), please update the test code accordingly or add documentation that clarifies the difference.
🏁 Script executed:
#!/bin/bash # Search for the MessageContext initialization in the specific file with correct escaping rg --fixed-strings -A 5 "MessageContext({ sender:" test/GatewayZEVM.t.solLength of output: 6331
Attention: Confirm Intentional Use of Distinct Values for sender and senderEVM
We verified that every instantiation of
MessageContext
intest/GatewayZEVM.t.sol
consistently assigns:
sender
asabi.encodePacked(address(gateway))
senderEVM
asprotocolAddress
Since the same pattern is used throughout the test cases, it appears the distinction is intentional. However, to avoid any future confusion, please confirm that this design choice is deliberate. If so, consider adding a brief comment/documentation that explains why the gateway’s address is encoded for
sender
while a different address (i.e.protocolAddress
) is used forsenderEVM
.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #474 +/- ##
=======================================
Coverage 86.22% 86.22%
=======================================
Files 9 9
Lines 559 559
Branches 129 129
=======================================
Hits 482 482
Misses 77 77 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Changes in smart contract discussed from zeta-chain/node#3689
These changes are aimed to be backward compatible, keep same signature, but rename the field for refactoring in the chain.
origin
was initially intended to be set fromtx.origin
and represent the signer address on each non-EVM chains but the field has never been used.Summary by CodeRabbit