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

add upgrade handler for v1.5.1; fixes #1273; fixes #1274 #1275

Merged
merged 2 commits into from
Mar 14, 2024

Conversation

joe-bowman
Copy link
Contributor

@joe-bowman joe-bowman commented Mar 13, 2024

1. Summary

Fixes #1273
Fixes #1274

2.Type of change

  • Upgrade handler

3. Implementation details

  • Upgrade handler resets all the liquid allow denoms with the correct ibc denoms.
  • Upgrade handler updates all status 0 records on cosmoshub-4 with status 2 (queued).

Summary by CodeRabbit

  • New Features
    • Introduced system upgrade to version v1.5.1, improving the handling and calculation of IBC denominations for assets.
  • Bug Fixes
    • Corrected the parameters order affecting IBC denomination calculations in the upgrade process.
  • Tests
    • Added tests to ensure the upgrade process correctly handles participation rewards and protocol data retrieval.

Copy link

vercel bot commented Mar 13, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
quicksilver ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 13, 2024 2:13pm

Copy link
Contributor

coderabbitai bot commented Mar 13, 2024

Walkthrough

The recent changes introduce a new upgrade to version v1.5.1, addressing two critical issues from the previous version. The upgrade corrects the computation of IBC denoms for qAssets, ensuring accurate representation across chains, and fixes the status of restitution records to allow for proper processing. These adjustments enhance the system's interoperability and reliability, reinforcing the integrity of transactions and asset tracking within the network.

Changes

File Path Change Summary
app/upgrades/types.go Added constant V010501UpgradeName with value "v1.5.1".
app/upgrades/upgrades.go Introduced upgrade entry for version V010501.
app/upgrades/v1_5.go Implemented upgrade logic in V010501UpgradeHandler, including denom corrections and record updates.
app/upgrades_test.go Added TestV010501UpgradeHandler() for testing the new upgrade logic.

Assessment against linked issues

Objective Addressed Explanation
Correct IBC denoms computation for qAssets (#1273)
Fix status of restitution records to allow processing (#1274)

🐇✨
A hop, a skip, in the code we dip,
To fix, to mend, our errors we clip.
Denoms aligned, records refined,
In v1.5.1, solutions you'll find.
Across the chains, with ease, we hop,
With every update, we're at the top!
🌟🐾

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.
    • 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 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 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 f3fb2d9 and 4a1e223.
Files selected for processing (4)
  • app/upgrades/types.go (1 hunks)
  • app/upgrades/upgrades.go (1 hunks)
  • app/upgrades/v1_5.go (2 hunks)
  • app/upgrades_test.go (2 hunks)
Check Runs (1)
lint completed (3)
  • app/upgrades/v1_5.go: 60-60: File is not gofumpt-ed (gofumpt)
  • app/upgrades/v1_5.go: 73-73: File is not gofumpt-ed (gofumpt)
Files skipped from review due to trivial changes (1)
  • app/upgrades/types.go
Additional comments: 4
app/upgrades/upgrades.go (1)
  • 28-28: The addition of the V010501UpgradeName entry with its corresponding V010501UpgradeHandler is consistent with the PR objectives to address the issues Claims IBC Denoms computed incorrectly #1273 and Low RR restitution records created with status 0 #1274. This change integrates well with the existing upgrade pattern in the file. However, ensure that the V010501UpgradeHandler function is implemented correctly elsewhere in the codebase to address the specific issues mentioned. It's also important to verify that all necessary tests have been added to cover the new upgrade logic.
app/upgrades/v1_5.go (2)
  • 133-176: The resetLiquidClaimsDenoms function addresses the issue of incorrect IBC denomination calculations by iterating over zones and updating protocol data. The logic appears to align with the objectives. However, there are a couple of points to consider:
  1. The error handling within the IterateZones callback (line 158) sets a shared err variable and returns true to stop iteration. This approach can lead to partial updates if an error occurs midway. Consider accumulating errors or ensuring atomicity of operations where feasible.
  2. The use of hardcoded channel mappings (lines 139-148) might limit flexibility. If these channels are subject to change, consider fetching them from a more dynamic source or configuration.

Consider reviewing the error handling strategy to ensure consistency and reliability during the upgrade process. Additionally, evaluate the maintainability of hardcoded channel mappings.

  • 60-60: The file formatting hints suggest running gofumpt, a stricter version of gofmt, to ensure consistent formatting according to Go best practices. This includes removing extra lines and ensuring consistent indentation. While the specific lines mentioned might not directly correspond to formatting issues, it's a good practice to run the entire file through gofumpt as part of the final cleanup before merging.

Consider running the file through gofumpt to ensure consistent Go formatting.

Also applies to: 73-73

app/upgrades_test.go (1)
  • 726-746: The implementation of TestV010501UpgradeHandler() appears to be thorough and well-structured. It tests the upgrade handler for version v0.10.501, focusing on the correct handling of protocol data related to liquid token denominations for the osmosis-1 chain. The test validates the presence and correctness of the LiquidAllowedDenomProtocolData after the upgrade handler execution, ensuring the upgrade logic functions as expected.

However, it's important to ensure that the test covers all critical paths and edge cases related to the upgrade process. Consider adding more assertions to verify the state of other affected components or data structures, if any, to ensure comprehensive coverage.

app/upgrades/v1_5.go Outdated Show resolved Hide resolved
Copy link

codecov bot commented Mar 13, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 63.29%. Comparing base (f3fb2d9) to head (cb198fe).

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #1275   +/-   ##
=======================================
  Coverage   63.29%   63.29%           
=======================================
  Files         170      170           
  Lines       11261    11261           
=======================================
  Hits         7128     7128           
  Misses       3409     3409           
  Partials      724      724           
Flag Coverage Δ
unittests 63.29% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

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 4a1e223 and cb198fe.
Files selected for processing (1)
  • app/upgrades/v1_5.go (2 hunks)
Files skipped from review as they are similar to previous changes (1)
  • app/upgrades/v1_5.go

Copy link
Contributor

@minhngoc274 minhngoc274 left a comment

Choose a reason for hiding this comment

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

LGTM

@joe-bowman joe-bowman merged commit 8cb42f6 into main Mar 14, 2024
25 checks passed
@joe-bowman joe-bowman deleted the upgrade-handler-v151 branch March 14, 2024 03:26
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.

Low RR restitution records created with status 0 Claims IBC Denoms computed incorrectly
2 participants