Skip to content
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

Closed
wants to merge 12 commits into from

Conversation

skosito
Copy link
Contributor

@skosito skosito commented Sep 12, 2024

converting to ready for review, without generated files to make review easier

  • on zevm side, in call method added CallContext including old field gasLimit and new field isArbitraryCall which is emitted in Called event (note that msg.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

  • on evm side, add MessageContext for execute method, containing sender and isArbitraryCall so execute method can decide to call any sc, or sc with onCall implemented passing sender to it (currently task suggests whole MessageContext, but just sender is needed, interface can be simplified, not sure what origin and chainID should be?)

questions:

  • zevm side, assume we need CallContext on withdrawAndCall methods?

  • evm side, do we want MessageContext on executeWithERC20/revertWithERC20 and executeRevert functions?

Copy link
Contributor

coderabbitai bot commented Sep 12, 2024

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Base branches to auto review (1)
  • main

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


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?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    -- I pushed a fix in commit <commit_id>, please review it.
    -- Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    -- @coderabbitai generate unit testing code for this file.
    -- @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    -- @coderabbitai generate interesting stats about this repository and render them as a table.
    -- @coderabbitai read src/utils.ts and generate unit testing code.
    -- @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    -- @coderabbitai help me debug CodeRabbit configuration file.

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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@codecov-commenter
Copy link

codecov-commenter commented Sep 12, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 97.55%. Comparing base (bef2648) to head (7319423).

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.
📢 Have feedback on the report? Share it here.

@skosito skosito changed the title On call connected chains feat: add sender when calling connected chain contracts from zetachain Sep 13, 2024
@skosito skosito linked an issue Sep 13, 2024 that may be closed by this pull request
@skosito skosito marked this pull request as ready for review September 13, 2024 13:52
@skosito skosito requested a review from lumtis September 13, 2024 15:41
Copy link
Member

@lumtis lumtis left a 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

v2/contracts/evm/GatewayEVM.sol Outdated Show resolved Hide resolved

/// @notice Interface implemented by contracts receiving authenticated calls.
interface Callable {
function onCall(address sender, bytes calldata message) external returns (bytes memory);
Copy link
Member

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?

Copy link
Contributor Author

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

Copy link
Contributor Author

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

Copy link
Contributor Author

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

@lumtis
Copy link
Member

lumtis commented Sep 19, 2024

@skosito I think we could already prepare the change in the protocol before merging this one: zeta-chain/node#2877

Copy link
Member

@fadeev fadeev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

@skosito
Copy link
Contributor Author

skosito commented Sep 24, 2024

closing for this one, it is the the same, but base branch is correct #350

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Enable calling contracts on connected chains with caller info
4 participants