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

Raunak/channel handler fixes #86

Merged
merged 2 commits into from
Apr 15, 2024
Merged

Raunak/channel handler fixes #86

merged 2 commits into from
Apr 15, 2024

Conversation

RnkSngh
Copy link
Collaborator

@RnkSngh RnkSngh commented Apr 15, 2024

PR to update channel handlers to be more in line with Ibc spec.

I've neglected adding information which stays constant for an integrating dapp (mainly it's portprefix); but have added most other arguments in these callbacks

Summary by CodeRabbit

  • New Features

    • Added a new function to enhance packet timeout handling in the Dispatcher contract.
    • Introduced changes to channel opening and connection handling functions across various contracts to improve process accuracy and compatibility.
  • Bug Fixes

    • Implemented argument encoding in Dispatcher functions to resolve the stack-too-deep error.
    • Added validation checks in VirtualChain to ensure channel existence before proceeding.
  • Refactor

    • Renamed identifiers and updated parameter types in multiple contracts for better clarity and uniformity.
    • Refactored connection functions to use updated identifiers, improving code maintainability.
  • Tests

    • Added new test functions to verify the prevention of packet spoofing and enhanced existing tests with specific contract deployment and error messages.

@RnkSngh RnkSngh requested a review from nicopernas April 15, 2024 11:25
Copy link

coderabbitai bot commented Apr 15, 2024

Walkthrough

The updates across various smart contracts focus on refining function parameters, enhancing method encoding to prevent errors, and introducing new functionalities like writeTimeoutPacket. These changes aim to improve the efficiency and clarity of contract interactions and packet handling in blockchain channels.

Changes

Files Changes
contracts/core/Dispatcher.sol
contracts/core/UniversalChannelHandler.sol
contracts/examples/Mars.sol
contracts/interfaces/IDispatcher.sol
contracts/interfaces/IbcReceiver.sol
Updated function parameters and added new functionalities across multiple core contracts and interfaces.
test/Dispatcher.proof.t.sol
test/Dispatcher.t.sol
test/Ibc.t.sol
test/VirtualChain.sol
test/universal.channel.t.sol
test/upgradeableProxy/upgrades/DispatcherV2.sol
Enhanced test suites and deployment scripts to align with the updated contract functionalities and ensure robustness against potential vulnerabilities.

Possibly related issues

🐇🎉
Oh hooray, oh joy, let's cheer,
For changes grand, far and near.
Code refined, with bugs outcast,
In blockchain's web, anchors cast.
Hop and skip, the rabbit's way,
Celebrate the code today! 🥕🌟
🐇🎉


Recent Review Details

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between c5ed417 and 6e480ba.
Files selected for processing (3)
  • contracts/core/UniversalChannelHandler.sol (3 hunks)
  • contracts/examples/Mars.sol (4 hunks)
  • contracts/interfaces/IbcReceiver.sol (1 hunks)
Additional comments not posted (13)
contracts/interfaces/IbcReceiver.sol (5)

15-20: Updated function signature aligns with IBC standards.


22-29: Updated function signature aligns with IBC standards.


31-31: Updated function signature aligns with IBC standards.


34-34: Function addition aligns with IBC standards.


35-39: Updated function signature aligns with IBC standards.

contracts/examples/Mars.sol (4)

83-83: Updated function signature aligns with IBC standards.


94-101: Updated function signature aligns with IBC standards.


105-105: Updated function signature aligns with IBC standards.


113-113: Function addition aligns with IBC standards.

contracts/core/UniversalChannelHandler.sol (4)

154-154: Updated function signature aligns with IBC standards.


164-171: Updated function signature aligns with IBC standards.


176-176: Updated function signature aligns with IBC standards.


183-183: Function addition aligns with IBC standards.


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>.
    • 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 show all the console.log statements in this repository.
    • @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.

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 as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration 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.

@RnkSngh RnkSngh requested a review from tmsdkeys April 15, 2024 11:26
@RnkSngh RnkSngh force-pushed the raunak/channelHandlerFixes branch from f560289 to 46c575f Compare April 15, 2024 13:13
@RnkSngh RnkSngh force-pushed the raunak/channelHandlerFixes branch from 46c575f to c5ed417 Compare April 15, 2024 15:17
@RnkSngh RnkSngh force-pushed the raunak/channelHandlerFixes branch from 7865479 to 6e480ba Compare April 15, 2024 15:55
@nicopernas nicopernas merged commit 8938907 into main Apr 15, 2024
2 checks passed
@nicopernas nicopernas deleted the raunak/channelHandlerFixes branch April 15, 2024 16:18
@RnkSngh RnkSngh linked an issue Apr 17, 2024 that may be closed by this pull request
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.

Add Counterparty information in channel callbacks
3 participants