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: fix ibc transfer msg recv length check #2550

Merged
merged 7 commits into from
Jun 17, 2024

Conversation

gsk967
Copy link
Collaborator

@gsk967 gsk967 commented Jun 17, 2024

Description

closes: #XXXX


Author Checklist

All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.

I have...

  • included the correct type prefix in the PR title
  • added ! to the type prefix if API or client breaking change
  • added appropriate labels to the PR
  • targeted the correct branch (see PR Targeting)
  • provided a link to the relevant issue or specification
  • added a changelog entry to CHANGELOG.md
  • included comments for documenting Go code
  • updated the relevant documentation or specification
  • reviewed "Files changed" and left comments if necessary
  • confirmed all CI checks have passed

Reviewers Checklist

All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.

I have...

  • confirmed the correct type prefix in the PR title
  • confirmed all author checklist items have been addressed
  • reviewed state machine logic
  • reviewed API design and naming
  • reviewed documentation is accurate
  • reviewed tests and test coverage
  • manually tested (if applicable)

Summary by CodeRabbit

  • Documentation

    • Updated list formatting in testnet public endpoints documentation.
  • Tests

    • Enhanced end-to-end tests to check for invalid receiver addresses and memos in token transfers.
    • Added utility function for generating random strings for testing purposes.
  • Chores

    • Updated dependencies to include github.com/onsi/gomega version v1.31.1.

@gsk967 gsk967 requested a review from a team as a code owner June 17, 2024 10:26
Copy link
Contributor

coderabbitai bot commented Jun 17, 2024

Walkthrough

This update primarily focuses on improving error handling and validation within the IBC (Inter-Blockchain Communication) module through additional functions and dependencies. It also enhances documentation formatting and introduces tests for newly added functionality. No exported or public entity declarations were altered.

Changes

Files Change Summary
CHANGELOG.md, docs/VALIDATOR.md Dependency update to version 6.4.1 and list formatting updates
go.mod Added an indirect dependency on github.com/onsi/gomega at version v1.31.1
tests/e2e/e2e_ibc_test.go Added imports and operations for validating receiver address length
tests/e2e/setup/utils.go Modified error handling logic
util/ibc/ibc.go Added constants, new functions for validation, and updated error handling
util/ibc/ibc_test.go Added tests for invalid addresses and memos
util/sdkutil/string.go Added a function to generate random strings

Sequence Diagram(s)

Diagrams are not applicable for this update since the changes primarily involve validation and dependency updates.

Poem

In the land of code, a rabbit did find,
Errors to catch, and strings to bind.
With functions crisp, and tests anew,
The blockchain's pulse, strong and true.
Dependencies updated, formats just right,
A realm of code, now shines bright.

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
Member

@robert-zaremba robert-zaremba left a comment

Choose a reason for hiding this comment

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

Pre approving.

  • update Release Notes
  • Update Changelog
  • merge into main and then cherry pick into new branch: release/v6.5

@gsk967 gsk967 changed the base branch from release/v6.4 to main June 17, 2024 11:48
@gsk967 gsk967 changed the base branch from main to release/v6.4 June 17, 2024 12:09
@gsk967 gsk967 requested a review from a team as a code owner June 17, 2024 13:19
@gsk967 gsk967 changed the base branch from release/v6.4 to main June 17, 2024 13:32
Copy link

codecov bot commented Jun 17, 2024

Codecov Report

Attention: Patch coverage is 63.15789% with 7 lines in your changes missing coverage. Please review.

Project coverage is 62.76%. Comparing base (7f05ad4) to head (aa8f583).
Report is 500 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##             main    #2550       +/-   ##
===========================================
- Coverage   75.38%   62.76%   -12.63%     
===========================================
  Files         100      275      +175     
  Lines        8025    15968     +7943     
===========================================
+ Hits         6050    10023     +3973     
- Misses       1589     5171     +3582     
- Partials      386      774      +388     
Files Coverage Δ
util/ibc/ibc.go 80.76% <92.30%> (+21.94%) ⬆️
util/sdkutil/string.go 55.55% <0.00%> (ø)

... and 237 files with indirect coverage changes

@gsk967 gsk967 enabled auto-merge June 17, 2024 13:42
@gsk967 gsk967 disabled auto-merge June 17, 2024 13:42
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.

Actionable comments posted: 3

Outside diff range and nitpick comments (1)
docs/VALIDATOR.md (1)

Line range hint 46-46: Consider adding the preposition "on" after "Depending" for grammatical correctness.

- Depending where you run your validator node, certain locations may block some endpoints.
+ Depending on where you run your validator node, certain locations may block some endpoints.
Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 503e148 and aa8f583.

Files selected for processing (8)
  • CHANGELOG.md (1 hunks)
  • docs/VALIDATOR.md (1 hunks)
  • go.mod (1 hunks)
  • tests/e2e/e2e_ibc_test.go (2 hunks)
  • tests/e2e/setup/utils.go (1 hunks)
  • util/ibc/ibc.go (2 hunks)
  • util/ibc/ibc_test.go (2 hunks)
  • util/sdkutil/string.go (2 hunks)
Files skipped from review due to trivial changes (2)
  • go.mod
  • tests/e2e/setup/utils.go
Additional context used
LanguageTool
docs/VALIDATOR.md

[uncategorized] ~45-~45: Possible missing comma found. (AI_HYDRA_LEO_MISSING_COMMA)
Context: ...eeder.example.toml). - For the provider config you can use our latest [umee-provider-c...


[grammar] ~46-~46: The verb ‘depend’ requires the preposition ‘on’ (or ‘upon’). (DEPEND_ON)
Context: ...e/umee/umee-provider-config) as is. - Depending where you run your validator node, cert...


[uncategorized] ~60-~60: Possible missing comma found. (AI_HYDRA_LEO_MISSING_COMMA)
Context: ...Joining the network Before joining the mainnet you should join a testnet! ### Testnet...

CHANGELOG.md

[grammar] ~123-~123: Using ‘plenty’ without ‘of’ is considered to be informal. (PLENTY_OF_NOUNS)
Context: .../pull/2368) Fix inflow amount calculation. Previously, the inflow amount of the t...


[uncategorized] ~124-~124: Possible missing preposition found. (AI_HYDRA_LEO_MISSING_TO)
Context: ...nd SDK account sequence setting changes the calling client. ### API Breaking - [2...


[grammar] ~225-~225: Did you mean “limiting”? Or maybe you should add a pronoun? In active voice, ‘allow’ + ‘to’ takes an object, usually a pronoun. (ALLOW_TO)
Context: ...veragedLiquidate.MaxRepay` which allows to limit the liquidation size using the leverage...


[uncategorized] ~268-~268: Possible missing comma found. (AI_HYDRA_LEO_MISSING_COMMA)
Context: ...ub.com//pull/2148) Fix MsgBeginUnbonding counting existing unbondings against ma...


[grammar] ~358-~358: The singular proper name ‘Bridge’ must be used with a third-person or a past tense verb. (HE_VERB_AGR)
Context: ...-network/umee/pull/1967) Gravity Bridge phase out phase-2: disable Umee -> Ethereum t...


[grammar] ~359-~359: The singular proper name ‘Bridge’ must be used with a third-person or a past tense verb. (HE_VERB_AGR)
Context: ...-network/umee/pull/1967) Gravity Bridge phase out phase-2: disable Umee -> Ethereum t...


[grammar] ~409-~409: Make sure that the singular noun after the number ‘4.1’ is correct. (CD_POINT_CD_NN)
Context: ...e/pull/1807) Fixes BNB ibc denom in 4.1 migration - [1812](https://github.com/umee-networ...


[style] ~427-~427: In contexts where ‘if’ is followed by ‘or’, using ‘whether’ may be more appropriate (and formal). (IF_WHETHER)
Context: ...rowandMsgRepay` won't return errors if there is nothing to withdraw, borrow or...


[uncategorized] ~474-~474: Possible missing article found. (AI_HYDRA_LEO_MISSING_THE)
Context: ...of the build process (you must build on same host as you run the binary, or copy the...


[duplication] ~478-~478: Possible typo: you repeated a word (ENGLISH_WORD_REPEAT_RULE)
Context: ...e/pull/1555) Updates IBC to v5.1.0 that adds adds optional memo field to `FungibleTokenPa...


[uncategorized] ~535-~535: A comma may be missing after the conjunctive/linking adverb ‘Also’. (SENT_START_CONJUNCTIVE_LINKING_ADVERB_COMMA)
Context: ...ableLend, docs, and internal functions. Also QueryLoaned similar queries to QuerySup...


[misspelling] ~539-~539: This word is normally spelled as one. (EN_COMPOUNDS_PROTO_TYPES)
Context: ...roto getters in x/leverage and x/oracle proto types. - [1126](https://github.com/umee-netwo...


[uncategorized] ~560-~560: Possible missing comma found. (AI_HYDRA_LEO_MISSING_COMMA)
Context: ...umee/pull/1157) Added PrintOrErr util function optimizing the CLI code flow. - [1118](...


[duplication] ~658-~658: Possible typo: you repeated a word (ENGLISH_WORD_REPEAT_RULE)
Context: ...k/umee/pull/1358/files) Disable Gravity Bridge bridge messages. ### Improvements - [#1355](...

Additional comments not posted (4)
util/ibc/ibc_test.go (1)

36-46: The new test cases for validating receiver and memo fields are well-implemented and cover the expected error scenarios.

util/ibc/ibc.go (2)

13-30: The constants and validation functions for receiver and memo fields are well-defined. Ensure the arbitrary length limits are justified with domain-specific requirements.


40-50: The integration of the new validation logic in GetFundsFromPacket is correctly implemented. This enhances the robustness of packet processing.

tests/e2e/e2e_ibc_test.go (1)

15-16: Imports for ibcutil and sdkutil have been added to support new test scenarios.

CHANGELOG.md Show resolved Hide resolved
tests/e2e/e2e_ibc_test.go Show resolved Hide resolved
util/sdkutil/string.go Show resolved Hide resolved
@gsk967 gsk967 added this pull request to the merge queue Jun 17, 2024
Merged via the queue into main with commit b058282 Jun 17, 2024
23 of 28 checks passed
@gsk967 gsk967 deleted the sai/fix_ibc_transfer_msg_recv_length_check branch June 17, 2024 14:54
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