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

Final v1.5.0 upgrade handler #1260

Merged
merged 7 commits into from
Mar 9, 2024
Merged

Final v1.5.0 upgrade handler #1260

merged 7 commits into from
Mar 9, 2024

Conversation

joe-bowman
Copy link
Contributor

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

1. Summary

  • Builds on Fix low rr withdrawals #1259
  • Fixes edge case panic found in relative tvl calculation
  • Adds claims metadata to QS prod and enables claims parameter

2.Type of change

Summary by CodeRabbit

  • New Features
    • Introduced enhancements to protocol data handling and claims metadata initialization for improved participation rewards management.
  • Bug Fixes
    • Corrected log message formatting in the participation rewards distribution logic.
  • Refactor
    • Updated conditions for rewards distribution to check both ChainID and Denom.
  • Tests
    • Added and modified tests to cover new functionalities and ensure robust handling of token values and channel settings during upgrades.

Copy link
Contributor

coderabbitai bot commented Mar 9, 2024

Walkthrough

The recent update introduces enhancements focused on protocol data management and claims metadata initialization in the application's upgrade logic. It also refines the distribution conditions within the participation rewards module and improves test coverage for these new functionalities. Additionally, adjustments have been made to the handling of IBC channel settings and token valuation tests, alongside modifications to data structures for better efficiency and clarity.

Changes

Files Change Summary
app/upgrades/v1_5.go Introduced addProtocolData and initialiseClaimsMetaData functions.
app/upgrades_test.go Added channeltypes import, modified zones initialization, updated channel settings, and added a token value calculation test.
x/participationrewards/keeper/distribution.go
x/participationrewards/keeper/distribution_test.go
Adjusted loop conditions for distribution, corrected a log message, changed PoolData field type, updated Denoms field, and added new test cases.

🎉🐰✨
To code anew, we hop and leap,
With protocols and claims we sweep.
Through tests and types, our path we weave,
In bytes and bits, our tapestry.
🚀🌌🎈
In cosmic dance, our changes blend,
To bugs and glitches, we say "The End!"


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

vercel bot commented Mar 9, 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 9, 2024 1:53pm

@faddat faddat changed the base branch from fix-low-rr-withdrawals to main March 9, 2024 12:06
faddat
faddat previously approved these changes Mar 9, 2024
@faddat
Copy link
Contributor

faddat commented Mar 9, 2024

Joe, I targeted this to main, because I'd approved the other PR. Do you mind resolving conflicts?

@joe-bowman joe-bowman dismissed faddat’s stale review March 9, 2024 12:40

The merge-base changed after approval.

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: 3

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 37098ea and 7389fce.
Files selected for processing (4)
  • app/upgrades/v1_5.go (3 hunks)
  • app/upgrades_test.go (5 hunks)
  • x/participationrewards/keeper/distribution.go (2 hunks)
  • x/participationrewards/keeper/distribution_test.go (2 hunks)
Additional comments: 8
x/participationrewards/keeper/distribution.go (2)
  • 64-64: The adjustment in the condition within the loop to check for both ChainID and Denom is a crucial improvement for ensuring that the logic accurately identifies base pairs. This change enhances the robustness of the token value calculation by ensuring that only relevant pairs are considered.
  • Correctness: This change ensures that the logic only considers pairs that match both the ChainID and Denom of the base currency, which is essential for accurate calculations.
  • Logic: By adding this additional check, the logic becomes more precise in identifying base pairs, which is critical for the correct calculation of token values.

This adjustment is a significant improvement in ensuring the accuracy of base pair identification.

  • 203-203: Correcting the log message from "distributeto" to "distribute to users from account" improves the clarity of the log output. This change makes it easier for developers and system administrators to understand the actions being performed by the system.
  • Maintainability: Clear and descriptive log messages are crucial for maintaining and debugging the system. This change enhances the readability of the logs.
  • Best Practices: Following best practices for clear and descriptive logging helps in the effective monitoring and troubleshooting of the system.

The correction in the log message enhances clarity and aligns with best practices for logging.

app/upgrades/v1_5.go (1)
  • 87-88: Using panic for error handling within the V010500UpgradeHandler function when initializing claims metadata may not be the best approach, especially in a production environment. Consider handling the error more gracefully to avoid halting the entire upgrade process if this step fails. Logging the error and proceeding with the rest of the upgrade, if possible, might be a safer approach.

Consider replacing panic(err) with a more graceful error handling mechanism.

Skipped due to learnings

User: joe-bowman
PR: #1099
File: app/upgrades/upgrades.go:0-0
Timestamp: 2024-01-30T14:36:26.571Z
Learning: Using panic in the context of upgrade handlers is acceptable to ensure the upgrade process is halted in case of critical issues.
User: joe-bowman
PR: #1099
File: app/upgrades/upgrades.go:64-86
Timestamp: 2024-01-30T14:33:25.655Z
Learning: Using panic in the context of upgrade handlers is considered acceptable in the Quicksilver project to ensure the upgrade process halts immediately if an error is encountered.
User: faddat
PR: #1099
File: app/upgrades/upgrades.go:50-114
Timestamp: 2024-02-01T20:18:48.868Z
Learning: Using panic in the context of upgrade handlers is considered acceptable in the Quicksilver project to ensure the upgrade process halts immediately if an error is encountered.
User: joe-bowman
PR: #1099
File: app/upgrades/upgrades.go:108-115
Timestamp: 2024-01-30T14:36:14.773Z
Learning: Using panic in the context of upgrade handlers is an acceptable practice for the project, as it's preferred to halt the upgrade process immediately if an error is encountered.

app/upgrades_test.go (5)
  • 21-21: The addition of channeltypes from github.com/cosmos/ibc-go/v5/modules/core/04-channel/types is appropriate for the changes made in the test file, specifically for setting channel configurations in the InitV150TestZones function. This import is necessary for the correct initialization of IBC channels in the test setup.
  • 277-294: The InitV150TestZones function has been modified to include new zones with updated connection IDs and chain IDs. This change aligns with the PR's objective to enhance claims metadata and protocol data addition. It's crucial to ensure that these new zones and their configurations are accurately represented in the production environment to avoid discrepancies. Additionally, the inclusion of addVestingAccount calls for new accounts indicates an expansion in the test setup to cover more scenarios.
  • 298-306: Updating the channel settings in the InitV150TestZones function to match production is a critical step for ensuring the test environment accurately reflects the production setup. This change is necessary for validating the behavior of the system under the new upgrade and ensuring that the IBC channel configurations are correctly initialized. It's important to verify that these channel IDs and counterparty configurations are consistent with the expected production settings.
  • 657-657: The assertion to check the connection ID of the zone associated with "uqatom" is a good practice to ensure that the zone's configuration matches the expected settings after the upgrade. This check is part of the broader test to validate the upgrade's impact on zone configurations and interchain staking behavior.
  • 710-722: The test CalcTokenValues within TestV010500UpgradeHandler is crucial for verifying the correct calculation of token values post-upgrade. The expected values are defined based on the relative prices between assets as of a specific date. It's important to ensure that these expected values are kept up-to-date with the market conditions to maintain the relevance and accuracy of the test. Additionally, this test highlights the system's ability to handle protocol data and participation rewards calculations, aligning with the PR's objectives.

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

codecov bot commented Mar 9, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 63.29%. Comparing base (884574d) to head (e6e421a).
Report is 1 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #1260   +/-   ##
=======================================
  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% <100.00%> (ø)

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

Files Coverage Δ
x/participationrewards/keeper/distribution.go 69.16% <100.00%> (ø)

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 7389fce and 2f2108d.
Files selected for processing (2)
  • app/upgrades/v1_5.go (3 hunks)
  • x/participationrewards/keeper/distribution_test.go (2 hunks)
Files skipped from review as they are similar to previous changes (2)
  • app/upgrades/v1_5.go
  • x/participationrewards/keeper/distribution_test.go

@faddat faddat enabled auto-merge (squash) March 9, 2024 13:51
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 2f2108d and e6e421a.
Files selected for processing (2)
  • app/upgrades/v1_5.go (3 hunks)
  • app/upgrades_test.go (5 hunks)
Files skipped from review as they are similar to previous changes (2)
  • app/upgrades/v1_5.go
  • app/upgrades_test.go

@faddat faddat merged commit f3fb2d9 into main Mar 9, 2024
24 checks passed
@joe-bowman joe-bowman deleted the final-v150-upgradehandler branch March 9, 2024 14:05
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