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: implement blocked channels #7

Merged
merged 4 commits into from
Jun 26, 2024
Merged

feat: implement blocked channels #7

merged 4 commits into from
Jun 26, 2024

Conversation

johnletey
Copy link
Contributor

@johnletey johnletey commented Jun 26, 2024

This PR implements a blocklist approach to IBC transfers.

A new E2E test has been added to demonstrate this feature:

  • Transferring out of Noble on unblocked channel. ✅
  • Transferring back to Noble on unblocked channel. ✅
  • Transferring out of Noble on blocked channel. ❌
  • Transferring back to Noble on blocked channel. ✅

Summary by CodeRabbit

  • New Features

    • Added commands for managing blocked channels: TxAddBlockedChannel() and TxRemoveBlockedChannel().
    • Introduced IBC transfer restrictions based on blocked channels.
    • Added querying functionality for blocked channels.
    • Introduced new messages for managing blocked channels and corresponding events.
  • Bug Fixes

    • Updated command descriptions for consistency.
  • Tests

    • Added extensive tests for adding/removing blocked channels and IBC transfer scenarios.
    • Included tests for querying blocked channels and validating transfer restrictions due to blocked channels.
  • Documentation

    • Updated documentation to include new blocked channel functionalities and events.

@johnletey johnletey requested a review from fafrd June 26, 2024 09:52
@johnletey johnletey self-assigned this Jun 26, 2024
Copy link

coderabbitai bot commented Jun 26, 2024

Warning

Review failed

The pull request is closed.

Walkthrough

The updates to the Aura module introduce robust functionality for managing blocked IBC channels. New commands, message types, and state management functions allow blocking and unblocking channels, ensuring controlled transfers. Consistent command descriptions, comprehensive tests, and various related updates further stabilize and validate these changes. The enhancements ensure improved transfer restrictions and administrative control over IBC channels.

Changes

Files Change Summary
x/aura/client/cli/tx.go Added commands for blocked channels and updated existing ones for consistency.
x/aura/keeper/... Added logic for sending restrictions based on blocked channels and associated tests.
x/aura/spec/... Added new sections for blocked channels in documentation files.
x/aura/types/... Introduced message types and codec registration for managing blocked channels.
e2e/main_test.go Updated tests to include scenarios for IBC transfers and blocked channels.

Sequence Diagram(s)

sequenceDiagram
    participant User as User
    participant CLI as CLI
    participant MsgServer as MsgServer
    participant Keeper as Keeper
    participant Blockchain as Blockchain
    
    User->>CLI: Execute "block channel" command
    CLI->>MsgServer: Sends blocking request
    MsgServer->>Keeper: Add channel to blocked list
    Keeper->>Blockchain: Update state with blocked channel
    Note right of Keeper: Emit BlockedChannelAdded event
    
    User->>CLI: Execute "unblock channel" command
    CLI->>MsgServer: Sends unblocking request
    MsgServer->>Keeper: Remove channel from blocked list
    Keeper->>Blockchain: Update state removing the blocked channel
    Note right of Keeper: Emit BlockedChannelRemoved event
Loading
sequenceDiagram
    participant User as User
    participant CLI as CLI
    participant MsgServer as MsgServer
    participant Keeper as Keeper
    participant Blockchain as Blockchain
    
    User->>Blockchain: Initiate IBC Transfer
    Blockchain->>Keeper: Check SendRestrictionFn
    Keeper->>Keeper: Validate blocked channels
    Keeper-->>Blockchain: Allow/Deny based on channel status
    Blockchain-->>User: Transfer result
Loading

Poem

In the realm of blockchain's song,
Channels locked and blocked along,
Now commands both bold and bright,
Guard the paths and set things right.
Transfers flow or find their end,
With rules that Keeper doth defend.
🌟✨🐇


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.
    • @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 as 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.

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.

Copy link

codecov bot commented Jun 26, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

📢 Thoughts on this report? Let us know!

@johnletey johnletey added this to the v1.0.0 milestone Jun 26, 2024
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: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between d448568 and 846ff4e.

Files ignored due to path filters (9)
  • e2e/go.sum is excluded by !**/*.sum
  • go.sum is excluded by !**/*.sum
  • go.work.sum is excluded by !**/*.sum
  • simapp/go.sum is excluded by !**/*.sum
  • x/aura/types/events.pb.go is excluded by !**/*.pb.go
  • x/aura/types/genesis.pb.go is excluded by !**/*.pb.go
  • x/aura/types/query.pb.go is excluded by !**/*.pb.go
  • x/aura/types/query.pb.gw.go is excluded by !**/*.pb.gw.go
  • x/aura/types/tx.pb.go is excluded by !**/*.pb.go
Files selected for processing (26)
  • e2e/go.mod (2 hunks)
  • e2e/main_test.go (5 hunks)
  • e2e/utils.go (5 hunks)
  • go.mod (1 hunks)
  • proto/aura/v1/events.proto (1 hunks)
  • proto/aura/v1/genesis.proto (1 hunks)
  • proto/aura/v1/query.proto (2 hunks)
  • proto/aura/v1/tx.proto (2 hunks)
  • simapp/app.go (9 hunks)
  • simapp/go.mod (2 hunks)
  • x/aura/client/cli/query.go (2 hunks)
  • x/aura/client/cli/tx.go (7 hunks)
  • x/aura/keeper/keeper.go (2 hunks)
  • x/aura/keeper/keeper_test.go (2 hunks)
  • x/aura/keeper/msg_server.go (1 hunks)
  • x/aura/keeper/msg_server_test.go (1 hunks)
  • x/aura/keeper/query_server.go (1 hunks)
  • x/aura/keeper/query_server_test.go (1 hunks)
  • x/aura/keeper/state.go (1 hunks)
  • x/aura/spec/01_state.md (1 hunks)
  • x/aura/spec/02_messages.md (1 hunks)
  • x/aura/spec/03_events.md (1 hunks)
  • x/aura/types/codec.go (2 hunks)
  • x/aura/types/genesis.go (2 hunks)
  • x/aura/types/keys.go (2 hunks)
  • x/aura/types/msgs.go (2 hunks)
Files skipped from review due to trivial changes (1)
  • x/aura/spec/01_state.md
Files skipped from review as they are similar to previous changes (24)
  • e2e/go.mod
  • e2e/main_test.go
  • e2e/utils.go
  • go.mod
  • proto/aura/v1/events.proto
  • proto/aura/v1/genesis.proto
  • proto/aura/v1/query.proto
  • proto/aura/v1/tx.proto
  • simapp/app.go
  • simapp/go.mod
  • x/aura/client/cli/query.go
  • x/aura/client/cli/tx.go
  • x/aura/keeper/keeper.go
  • x/aura/keeper/keeper_test.go
  • x/aura/keeper/msg_server.go
  • x/aura/keeper/msg_server_test.go
  • x/aura/keeper/query_server.go
  • x/aura/keeper/query_server_test.go
  • x/aura/keeper/state.go
  • x/aura/spec/02_messages.md
  • x/aura/types/codec.go
  • x/aura/types/genesis.go
  • x/aura/types/keys.go
  • x/aura/types/msgs.go
Additional context used
LanguageTool
x/aura/spec/03_events.md

[style] ~46-~46: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym. (ENGLISH_WORD_REPEAT_BEGINNING_RULE)
Context: ...0000000000000000ausdy" } ] } ``` This event is emitted by the following trans...

Additional comments not posted (2)
x/aura/spec/03_events.md (2)

323-341: Well-documented new event for adding a blocked channel.

The documentation clearly specifies the event structure and links to the associated message. This maintains consistency with the existing documentation style and provides all necessary details for understanding the event context.


343-361: Well-documented new event for removing a blocked channel.

Like the addition event, this removal event is well-documented, maintaining a consistent format and providing clear linkage to the associated transaction message.

Copy link
Contributor

@boojamya boojamya left a comment

Choose a reason for hiding this comment

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

Very clean. Nice job!

x/aura/types/msgs.go Show resolved Hide resolved
Copy link

@g-luca g-luca left a comment

Choose a reason for hiding this comment

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

lgtm!

e2e/main_test.go Outdated Show resolved Hide resolved
Copy link
Collaborator

@fafrd fafrd left a comment

Choose a reason for hiding this comment

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

Looks great, 1 small suggestion for an incorrect code comment. ty for making an e2e test!

@johnletey johnletey merged commit 58ecd2a into main Jun 26, 2024
8 checks passed
@johnletey johnletey deleted the blocked-channels branch June 26, 2024 18:21
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.

4 participants