-
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
feat: add sender when calling connected chain contracts from zetachain #350
Conversation
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Base branches to auto review (1)
Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the 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 using PR comments)
Other keywords and placeholders
Documentation and Community
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## rename-on-crosschain-call #350 +/- ##
=============================================================
+ Coverage 97.37% 97.55% +0.17%
=============================================================
Files 7 7
Lines 305 327 +22
Branches 98 105 +7
=============================================================
+ Hits 297 319 +22
Misses 8 8 ☔ 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.
Looks good to me generally on the tests
Will need @fadeev review for the interface
|
||
/// @notice Interface implemented by contracts receiving authenticated calls. | ||
interface Callable { | ||
function onCall(address sender, bytes calldata message) external returns (bytes memory); |
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.
Can we maybe pass the entire context object to keep some consistency with the version on ZetaChain?
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.
yea but currently messageContext contains sender and flag to indicate if its arb or auth call, so passing that flag here doesnt make much sense
let's see if we need to extend this context further, maybe we can define new context struct for this, waiting from @fadeev for more input on interface, but can easily be extended
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.
maybe this is bad design to have this flag in messageContext, execute method that contains message context is immediately authenticated call, method without context is arbitrary call
lets then see what to put in message context beside sender and i will change it
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.
fixed, lets see what else to put in message context apart from sender
@skosito I think we could already prepare the change in the protocol before merging this one: zeta-chain/node#2877 |
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.
Looks good!
closing for this one, it is the the same, but base branch is correct #350 |
converting to ready for review, without generated files to make review easier
CallContext
including old fieldgasLimit
and new fieldisArbitraryCall
which is emitted inCalled
event (note thatmsg.sender
is already emitted) - this is added for withdrawAndCall methods as well^ all these methods are overloaded to keep compatibility with current protocol offchain implementation, but imo it introduces not needed overhead - should we just keep them until next release? or just use 1 method only now, this will be used on localnet only anyways
MessageContext
forexecute
method, containingsender
andisArbitraryCall
soexecute
method can decide to call any sc, or sc withonCall
implemented passing sender to it (currently task suggests wholeMessageContext
, but just sender is needed, interface can be simplified, not sure whatorigin
andchainID
should be?)questions:
zevm side, assume we need
CallContext
onwithdrawAndCall
methods?evm side, do we want
MessageContext
onexecuteWithERC20
/revertWithERC20
andexecuteRevert
functions?