Skip to content

Conversation

@fadeev
Copy link
Member

@fadeev fadeev commented Oct 7, 2024

No description provided.

@fadeev fadeev requested a review from andresaiello as a code owner October 7, 2024 10:57
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 7, 2024

Important

Review skipped

Draft detected.

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 gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @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.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

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.

@fadeev fadeev marked this pull request as draft October 7, 2024 10:58
@fadeev
Copy link
Member Author

fadeev commented Oct 7, 2024

@skosito @fbac I'm trying to get a Ping Pong going between contracts on localnet: calling Hello's withdrawAndCall on ZetaChain, which calls gateway with an instruction to call Echo's pingPong on EVM, which should be calling gateway to send a message back to Hello.

When I call pingPong directly, it works:

cast send 0xE6E340D132b5f46d1e472DebcD681B2aBc16e57E "pingPong(string)" 0x --value 10000000 --private-key 0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80

But when I'm making a cross-chain call from Hello, it fails:

npx hardhat hello-withdraw-and-call --contract 0xE6E340D132b5f46d1e472DebcD681B2aBc16e57E --receiver 0xc3e53F4d16Ae77Db1c982e75a937B9f60FE63690 --zrc20 0x2ca7d64A7EFE2D62A725E2B35Cf7230D6677FfEe --function "pingPong(string)" --amount 1 --network localhost --types '["string"]' hello

I thought maybe the problem was that Echo didn't have tokens for gas to call the gateway, but I've sent tokens to it manually, still failed.

I also tried sending the ETH transferred from Hello directly to Echo, still failing:

    function pingPong(string memory message) external payable {
        payable(0xc3e53F4d16Ae77Db1c982e75a937B9f60FE63690).transfer(msg.value);
        gateway.call(
            0x67d269191c92Caf3cD7723F116c85e6E9bf55933,
            abi.encode("hello"),
            RevertOptions({
                revertAddress: address(0),
                callOnRevert: false,
                abortAddress: address(0),
                revertMessage: "",
                onRevertGasLimit: 0
            })
        );
    }

Using the latest localnet from this PR: zeta-chain/localnet#45

Any pointers are appreciated.

Comment on lines +7 to +36
contract Echo {
GatewayEVM public immutable gateway;

event RevertEvent(string, RevertContext);
event HelloEvent(string, string);

constructor(address payable gatewayAddress) {
gateway = GatewayEVM(gatewayAddress);
}

function hello(string memory message) external payable {
emit HelloEvent("Hello on EVM", message);
}

function onRevert(RevertContext calldata revertContext) external {
emit RevertEvent("Revert on EVM", revertContext);
}

function call(
address receiver,
bytes calldata message,
RevertOptions memory revertOptions
) external {
gateway.call(receiver, message, revertOptions);
}

receive() external payable {}

fallback() external payable {}
}

Check warning

Code scanning / Slither

Contracts that lock Ether

Contract locking ether found: Contract Echo (contracts/Echo.sol#7-36) has payable functions: - Echo.hello(string) (contracts/Echo.sol#17-19) - Echo.receive() (contracts/Echo.sol#33) - Echo.fallback() (contracts/Echo.sol#35) But does not have a function to withdraw the ether
Comment on lines +45 to +69

Check warning

Code scanning / Slither

Unused return

Hello.withdrawAndCall(bytes,uint256,address,bytes,uint256,RevertOptions) (contracts/Hello.sol#45-69) ignores return value by IZRC20(gasZRC20).approve(address(gateway),gasFee) (contracts/Hello.sol#59)
Comment on lines +45 to +69

Check warning

Code scanning / Slither

Unused return

Hello.withdrawAndCall(bytes,uint256,address,bytes,uint256,RevertOptions) (contracts/Hello.sol#45-69) ignores return value by IZRC20(zrc20).approve(address(gateway),amount + gasFee) (contracts/Hello.sol#56)
Comment on lines +45 to +69

Check warning

Code scanning / Slither

Unused return

Hello.withdrawAndCall(bytes,uint256,address,bytes,uint256,RevertOptions) (contracts/Hello.sol#45-69) ignores return value by IZRC20(zrc20).approve(address(gateway),amount) (contracts/Hello.sol#58)
@fadeev
Copy link
Member Author

fadeev commented Oct 16, 2024

Replaced with #204

@fadeev fadeev closed this Oct 16, 2024
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.

2 participants