Skip to content

Conversation

@unknownunknown1
Copy link
Contributor

@unknownunknown1 unknownunknown1 commented Jan 17, 2025

Beside standard compiler changes the other changes are

  1. Removing CappedMath since 0.8 does its own math check
  2. Removing termsOfService from foreignProxy as not needed. ToS is contained in metadata var of homeProxy
  3. Removing relayRule from Optimism foreignProxy and inlining it within rule function. Optimism bridging doesn't require a separate function for that unlike zk and Arbitrum where any L1-L2 call requires additional fees

Summary by CodeRabbit

  • New Features

    • Added new Solidity contracts for cross-chain arbitration support:
      • RealitioForeignProxyGnosis: Manages arbitration requests and disputes
      • RealitioHomeProxyGnosis: Handles arbitration processes on side-chains
      • RealitioForeignProxyOptimism: Updated with refined arbitration logic
    • Introduced IAMB interface for cross-chain messaging
  • Improvements

    • Enhanced arbitration request handling and status tracking
    • Refined constructor parameters for better clarity
    • Improved error handling and event emissions
    • Simplified status tracking by removing redundant states

@coderabbitai
Copy link

coderabbitai bot commented Jan 17, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

The pull request introduces several new Solidity contracts and an interface for cross-chain arbitration in the Realitio platform. The new contracts RealitioForeignProxyGnosis and RealitioHomeProxyGnosis provide mechanisms for managing arbitration requests across different blockchain networks, specifically targeting Gnosis chain. A new interface IAMB (Arbitrary Message Bridge) is added to facilitate cross-chain communication. The changes enhance the platform's ability to handle dispute resolution across different blockchain environments with improved message passing and arbitration logic.

Changes

File Change Summary
contracts/src/0.8/RealitioForeignProxyGnosis.sol New contract implementing foreign arbitration proxy with methods for arbitration requests, dispute management, appeal funding, and evidence submission.
contracts/src/0.8/RealitioForeignProxyOptimism.sol Updated constructor parameters, changed method visibilities, removed relayRule function, simplified status tracking.
contracts/src/0.8/RealitioHomeProxyGnosis.sol New home proxy contract for managing arbitration requests, handling notifications, rejections, and arbitration answers.
contracts/src/0.8/interfaces/IAMB.sol New interface defining methods for cross-chain message passing, including message sender, source chain ID, and gas limits.

Sequence Diagram

sequenceDiagram
    participant User
    participant HomeProxy
    participant ForeignProxy
    participant Arbitrator
    
    User->>HomeProxy: Request Arbitration
    HomeProxy->>ForeignProxy: Send Arbitration Request
    ForeignProxy->>Arbitrator: Create Dispute
    Arbitrator->>ForeignProxy: Provide Ruling
    ForeignProxy->>HomeProxy: Send Arbitration Answer
    HomeProxy->>User: Resolve Dispute
Loading

Poem

🐰 Across the chains, our proxy hops,
Disputes resolved with coding chops.
Gnosis and Optimism unite,
Arbitration's rabbit takes flight!
Bridging worlds with smart contract might 🌉


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d11ff9b and 69b1b4b.

📒 Files selected for processing (1)
  • contracts/src/0.8/RealitioHomeProxyGnosis.sol (1 hunks)

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 generate docstrings to generate docstrings for this PR. (Beta)
  • @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 or @coderabbitai title 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.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 4

🧹 Nitpick comments (3)
contracts/src/0.8/RealitioHomeProxyGnosis.sol (2)

138-138: Specify a reasonable gas limit instead of using amb.maxGasPerTx()

Using amb.maxGasPerTx() may lead to inefficient gas usage or potential issues if the maximum gas per transaction changes. It's advisable to set an appropriate gas limit based on the expected computational requirements of the message processing on the foreign proxy.

Apply this diff to specify a reasonable gas limit:

    bytes4 selector = IForeignArbitrationProxy.receiveArbitrationAcknowledgement.selector;
    bytes memory data = abi.encodeWithSelector(selector, _questionID, _requester);
-   amb.requireToPassMessage(foreignProxy, data, amb.maxGasPerTx());
+   uint256 gasLimit = 200000; // Set an appropriate gas limit
+   amb.requireToPassMessage(foreignProxy, data, gasLimit);

163-163: Specify a reasonable gas limit instead of using amb.maxGasPerTx()

Consistent with best practices, specify an appropriate gas limit instead of amb.maxGasPerTx() to ensure efficient gas usage and prevent potential issues if the max gas per transaction changes.

Apply this diff:

    bytes4 selector = IForeignArbitrationProxy.receiveArbitrationCancelation.selector;
    bytes memory data = abi.encodeWithSelector(selector, _questionID, _requester);
-   amb.requireToPassMessage(foreignProxy, data, amb.maxGasPerTx());
+   uint256 gasLimit = 200000; // Set an appropriate gas limit
+   amb.requireToPassMessage(foreignProxy, data, gasLimit);
contracts/src/0.8/RealitioForeignProxyGnosis.sol (1)

412-412: Specify a reasonable gas limit instead of using amb.maxGasPerTx()

Using amb.maxGasPerTx() might lead to inefficient gas consumption or potential issues if the maximum gas per transaction changes. It's better to set an appropriate gas limit based on the expected computational requirements.

Apply this diff to specify an appropriate gas limit:

    bytes memory data = abi.encodeWithSelector(methodSelector, bytes32(arbitrationID), bytes32(realitioRuling));
-   amb.requireToPassMessage(homeProxy, data, amb.maxGasPerTx());
+   uint256 gasLimit = 200000; // Set an appropriate gas limit
+   amb.requireToPassMessage(homeProxy, data, gasLimit);
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 71f1ea4 and d11ff9b.

📒 Files selected for processing (4)
  • contracts/src/0.8/RealitioForeignProxyGnosis.sol (1 hunks)
  • contracts/src/0.8/RealitioForeignProxyOptimism.sol (4 hunks)
  • contracts/src/0.8/RealitioHomeProxyGnosis.sol (1 hunks)
  • contracts/src/0.8/interfaces/IAMB.sol (1 hunks)
🔇 Additional comments (4)
contracts/src/0.8/interfaces/IAMB.sol (1)

1-18: Interface definition looks good

The IAMB interface is well-defined and includes the necessary functions for cross-chain message passing and communication. It accurately reflects the required methods for interaction with the Arbitrary Message Bridge.

contracts/src/0.8/RealitioForeignProxyOptimism.sol (3)

93-95: LGTM! Constructor changes improve parameter clarity and gas efficiency.

The separation of multiplier parameters and use of immutable storage is a good improvement over using an array.

Also applies to: 103-105, 111-113


151-151: LGTM! Function visibility optimizations.

Changing from public to external is more gas efficient for functions that are only called externally.

Also applies to: 201-201


405-407: 🛠️ Refactor suggestion

Add return value check for messenger.sendMessage.

The return value of messenger.sendMessage should be checked to ensure the message was sent successfully.

Let's verify the return type:

If the function returns a boolean, apply this diff:

        bytes memory data = abi.encodeWithSelector(methodSelector, bytes32(arbitrationID), bytes32(realitioRuling));
        emit Ruling(IArbitrator(msg.sender), _disputeID, finalRuling);
-       messenger.sendMessage(homeProxy, data, minGasLimit);
+       require(messenger.sendMessage(homeProxy, data, minGasLimit), "Message sending failed");

@jaybuidl jaybuidl merged commit d1cc1fc into feat/all-proxies Jan 17, 2025
1 check was pending
@jaybuidl jaybuidl deleted the feat/gnosis-proxy-compiler-bump branch January 17, 2025 12:10
@coderabbitai coderabbitai bot mentioned this pull request Mar 18, 2025
@coderabbitai coderabbitai bot mentioned this pull request Mar 26, 2025
@coderabbitai coderabbitai bot mentioned this pull request May 6, 2025
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.

3 participants