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

fix: ics20 memo handler denom #2439

Merged
merged 5 commits into from
Feb 27, 2024
Merged

fix: ics20 memo handler denom #2439

merged 5 commits into from
Feb 27, 2024

Conversation

robert-zaremba
Copy link
Member

@robert-zaremba robert-zaremba commented Feb 27, 2024

Description

When receiving an ibc denom, we need to correctly transform the FungibleTokenPacketData.Denom into the IBC Denom, as it is recorded in the x/leverage.

Summary by CodeRabbit

  • New Features
    • Enhanced the handling of ICS20 token packets to automatically extract and manage denominations based on source and destination information.
  • Refactor
    • Simplified the logic for recording IBC inflow by utilizing a new utility function for denomination extraction.
    • Updated method signatures in the ICS20Module and MemoHandler to support enhanced packet processing capabilities.

@robert-zaremba robert-zaremba requested a review from a team as a code owner February 27, 2024 04:55
Copy link
Contributor

coderabbitai bot commented Feb 27, 2024

Walkthrough

The recent updates introduce a new function to streamline the extraction of denominations from ICS20 token packets, enhancing the handling of source and destination data. This function is now utilized in various components to simplify denomination parsing. Additionally, adjustments have been made to method signatures to accommodate these changes, ensuring a more efficient process in managing IBC inflows and memo dispatching.

Changes

Files Summary
x/uibc/ics20.go, x/uibc/uics20/memo_handler.go Added ExtractDenomFromPacketOnRecv function in uibc package for denomination extraction from ICS20 token packets. Updated onRecvPacket method in MemoHandler to include packet ibcexported.PacketI and utilize the new extraction function.

"In the realm of code, where the bits do hop,
🐇 A rabbit worked, with no intent to stop.
With a function new, and changes quite keen,
Streamlining the flow, making it clean.
Through packets and memos, it danced with glee,
'A better way forward,' it said with decree.
🌟 For in every line, and in every byte,
A rabbit's touch, made everything right."

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-tests for this file.
  • 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 tests 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 from git and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit tests.
    • @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.
  • The JSON schema for the configuration file is available here.
  • 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/coderabbit-overrides.v2.json

CodeRabbit Discord Community

Join our Discord Community to get help, request features, and share feedback.

Copy link
Contributor

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

Review Status

Actionable comments generated: 1

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 17691a1 and 6055b2a.
Files selected for processing (4)
  • x/uibc/ics20.go (1 hunks)
  • x/uibc/quota/quota.go (2 hunks)
  • x/uibc/uics20/ibc_module.go (1 hunks)
  • x/uibc/uics20/memo_handler.go (3 hunks)
Additional comments: 3
x/uibc/uics20/ibc_module.go (1)
  • 60-60: The addition of the packet parameter to the mh.onRecvPacket call in the OnRecvPacket method is correctly implemented and aligns with the changes made to accommodate the new denomination extraction functionality. Ensure that all calls to mh.onRecvPacket throughout the codebase have been updated accordingly to include the new parameter.
x/uibc/uics20/memo_handler.go (1)
  • 37-44: > 📝 NOTE

This review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [23-41]

The update to the onRecvPacket method signature to include the packet ibcexported.PacketI parameter is correctly implemented. This change enables the method to extract the denomination using the uibc.MustExtractDenomFromPacketOnRecv function before dispatching memo messages. Ensure that:

  • The uibc.MustExtractDenomFromPacketOnRecv function is used correctly and handles any potential errors gracefully.
  • All calls to onRecvPacket throughout the codebase have been updated to include the new parameter.
x/uibc/quota/quota.go (1)
  • 233-233: The modification to the RecordIBCInflow function to use the MustExtractDenomFromPacketOnRecv function for extracting the denomination is correctly implemented. This change simplifies the logic related to denomination handling and ensures consistency in how denominations are extracted from IBC packets. Ensure that:
  • The MustExtractDenomFromPacketOnRecv function is used correctly and any potential issues are handled appropriately.
  • The extracted denomination is correctly used in the subsequent logic of the RecordIBCInflow function.

x/uibc/ics20.go Outdated Show resolved Hide resolved
Copy link

codecov bot commented Feb 27, 2024

Codecov Report

Attention: Patch coverage is 0% with 17 lines in your changes are missing coverage. Please review.

Project coverage is 69.32%. Comparing base (7f05ad4) to head (c0362bb).
Report is 386 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #2439      +/-   ##
==========================================
- Coverage   75.38%   69.32%   -6.07%     
==========================================
  Files         100      183      +83     
  Lines        8025    10777    +2752     
==========================================
+ Hits         6050     7471    +1421     
- Misses       1589     2696    +1107     
- Partials      386      610     +224     
Files Coverage Δ
x/uibc/quota/quota.go 60.60% <0.00%> (ø)
x/uibc/uics20/ibc_module.go 0.00% <0.00%> (ø)
x/uibc/uics20/memo_handler.go 49.38% <0.00%> (ø)
x/uibc/ics20.go 0.00% <0.00%> (ø)

... and 170 files with indirect coverage changes

Copy link
Contributor

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

Review Status

Actionable comments generated: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 6055b2a and d045b1a.
Files selected for processing (3)
  • x/uibc/ics20.go (1 hunks)
  • x/uibc/quota/quota.go (2 hunks)
  • x/uibc/uics20/memo_handler.go (3 hunks)
Files skipped from review as they are similar to previous changes (3)
  • x/uibc/ics20.go
  • x/uibc/quota/quota.go
  • x/uibc/uics20/memo_handler.go

Copy link
Contributor

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

Review Status

Actionable comments generated: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between d045b1a and ec39af9.
Files selected for processing (2)
  • x/uibc/ics20.go (1 hunks)
  • x/uibc/uics20/memo_handler.go (3 hunks)
Files skipped from review as they are similar to previous changes (2)
  • x/uibc/ics20.go
  • x/uibc/uics20/memo_handler.go

@robert-zaremba robert-zaremba added the skip-e2e-test Skip the e2e tests label Feb 27, 2024
Copy link
Collaborator

@gsk967 gsk967 left a comment

Choose a reason for hiding this comment

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

LGTM

@robert-zaremba robert-zaremba added this pull request to the merge queue Feb 27, 2024
Merged via the queue into main with commit 952cb4b Feb 27, 2024
24 of 26 checks passed
@robert-zaremba robert-zaremba deleted the robert/fix-ibcdenom branch February 27, 2024 09:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
skip-e2e-test Skip the e2e tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants