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

move prod upgrade handler to v1.7.2; remove additional stargaze txs #1747

Merged
merged 1 commit into from
Nov 19, 2024

Conversation

joe-bowman
Copy link
Contributor

@joe-bowman joe-bowman commented Nov 19, 2024

1. Summary

  • Update production upgrade handler from v1.7.0 to v1.7.2.
  • Remove two additional withdrawals, and burn escrowed amount

Summary by CodeRabbit

  • New Features

    • Introduced a new upgrade version v1.7.2 with its corresponding upgrade handler.
    • Added functionality for handling migrations and managing withdrawal records in specific environments.
    • Enhanced coin management capabilities, including minting and burning operations.
  • Bug Fixes

    • Improved handling of duplicate withdrawal records for specific zones.
  • Documentation

    • Updated upgrade constants and handlers to reflect the new versioning.

Copy link
Contributor

coderabbitai bot commented Nov 19, 2024

Walkthrough

The changes in this pull request involve the addition of a new upgrade constant and associated upgrade handlers in the application. Specifically, a new constant V010702UpgradeName is introduced to identify version "v1.7.2". Additionally, two upgrade handler functions, V010700UpgradeHandler and V010702UpgradeHandler, are defined to manage the upgrade processes, including executing migrations and handling specific conditions for zone-hash pairs.

Changes

File Change Summary
app/upgrades/types.go Added constant V010702UpgradeName = "v1.7.2" for upgrade identification.
app/upgrades/upgrades.go Added new upgrade entry {UpgradeName: V010702UpgradeName, CreateUpgradeHandler: V010702UpgradeHandler} to the Upgrades function.
app/upgrades/v1_7.go Added functions V010700UpgradeHandler and V010702UpgradeHandler for upgrade handling and migrations.

Possibly related PRs

Suggested labels

x/participationrewards

Suggested reviewers

  • minhngoc274
  • faddat

🐇 In the code we hop,
A new upgrade we drop,
With handlers so bright,
They manage the night.
Version 1.7.2,
Let's celebrate, woohoo! 🎉


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>, please review it.
    • 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 gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @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 using 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.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration 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.

app/upgrades/v1_7.go Dismissed Show dismissed Hide dismissed
app/upgrades/v1_7.go Dismissed Show dismissed Hide dismissed
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: 2

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between f11e862 and 9fb1118.

📒 Files selected for processing (3)
  • app/upgrades/types.go (1 hunks)
  • app/upgrades/upgrades.go (1 hunks)
  • app/upgrades/v1_7.go (2 hunks)
🧰 Additional context used
🪛 GitHub Check: devskim
app/upgrades/v1_7.go

[failure] 35-35: A token or key was found in source code. If this represents a secret, it should be moved somewhere else.
Do not store tokens or keys in source code.


[failure] 36-36: A token or key was found in source code. If this represents a secret, it should be moved somewhere else.
Do not store tokens or keys in source code.

🔇 Additional comments (6)
app/upgrades/upgrades.go (2)

28-28: Verify the upgrade handler implementation and sequence

The addition of v1.7.2 upgrade handler looks correct in sequence after v1.7.0. However, let's verify the implementation details.

✅ Verification successful

Based on the shell script results, I can now generate the final response:

Upgrade handler implementation verified and sequence is correct

The v1.7.2 upgrade handler is properly implemented in app/upgrades/v1_7.go with specific state migrations:

  • Deletes duplicate withdrawal records for specific zones
  • Mints and transfers 50.699994 uqatom to escrow
  • Burns 16463.524950 qstars from escrow
  • Updates redemption rates for all zones

No v1.7.1 upgrade was planned or skipped in the sequence, as there are no relevant references in the codebase. The upgrade from v1.7.0 to v1.7.2 is a valid progression.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the upgrade handler implementation and related constants

# Check the handler implementation
echo "Checking V010702UpgradeHandler implementation..."
ast-grep --pattern 'func V010702UpgradeHandler($$$) upgradetypes.UpgradeHandler {
  $$$
}'

# Check the upgrade name constant
echo "Checking V010702UpgradeName constant..."
rg -A 1 "V010702UpgradeName.*=.*\"v1.7.2\""

# Look for any v1.7.1 references to ensure we're not missing anything
echo "Checking for any v1.7.1 references..."
rg "v1.7.1"

Length of output: 11147


Line range hint 1-41: Verify no critical upgrades are being skipped

The upgrade sequence jumps from v1.7.0 to v1.7.2. While this is technically valid, we should verify that no critical state migrations are being skipped.

✅ Verification successful

Let me gather more information about the v1.7.0 to v1.7.2 upgrade changes to verify if any critical migrations were skipped.


Based on the gathered information, I can now provide a final response:

No critical migrations are being skipped between v1.7.0 and v1.7.2

The v1.7.2 upgrade handler implements specific state migrations for mainnet and testnet:

  • Deletes duplicate withdrawal records for specific zones (cosmoshub-4, stargaze-1)
  • Performs token adjustments (minting uqatom and burning uqstars)
  • Updates redemption rates for all zones

These changes appear to be targeted fixes rather than part of a sequential upgrade path, and there's no evidence of a v1.7.1 release or any skipped critical migrations. The version jump is likely intentional to align with specific fixes needed in production.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for any evidence of v1.7.1 or other intermediate versions

# Check commit history for any mentions of v1.7.1
echo "Checking git history for v1.7.1 references..."
git log -p | rg -i "v1\.7\.1"

# Check issues and PRs for v1.7.1 discussions
echo "Checking GitHub issues and PRs..."
gh search issues "v1.7.1" --repo quicksilver-zone/quicksilver

# Look for migration files that might indicate skipped upgrades
echo "Checking for migration files..."
fd -e go -e json ".*1\.7\.[0-2].*"

Length of output: 1417


Script:

#!/bin/bash
# Check the changes and migrations between v1.7.0 and v1.7.2

# Look for upgrade handlers and their implementations
echo "Checking upgrade handlers implementation..."
ast-grep --pattern 'func V010702UpgradeHandler($$$) upgradetypes.UpgradeHandler { $$$ }'

# Check for any migration-related files or changes
echo "Checking for migration files and changes..."
rg -A 5 "V010702" 

# Check release notes or changelog for v1.7.2
echo "Checking changelog..."
fd -g "CHANGELOG*" -X cat {}

Length of output: 6099

app/upgrades/v1_7.go (4)

16-20: Function V010700UpgradeHandler appears correct

The upgrade handler efficiently delegates to RunMigrations without additional logic, which is appropriate for this version upgrade.


22-25: Function V010702UpgradeHandler is properly defined

The function signature aligns with the expected UpgradeHandler format, ensuring compatibility with the upgrade framework.


35-36: Confirm that hardcoded hashes are non-sensitive

The hashes for the "stargaze-1" zone are hardcoded:

  • Line 35: "10af0ee10a97f01467039a69cbfb8df05dc3111c975d955ca51adda201f36555"
  • Line 36: "0000000000000000000000000000000000000000000000000000000000000577"

Please verify that these hashes are public identifiers and do not contain sensitive information. Including sensitive data in the source code can pose security risks.

🧰 Tools
🪛 GitHub Check: devskim

[failure] 35-35: A token or key was found in source code. If this represents a secret, it should be moved somewhere else.
Do not store tokens or keys in source code.


[failure] 36-36: A token or key was found in source code. If this represents a secret, it should be moved somewhere else.
Do not store tokens or keys in source code.


Line range hint 66-70: Review the impact of overriding redemption rates without a cap

The code overrides the redemption rate without a cap for all zones:

appKeepers.InterchainstakingKeeper.IterateZones(ctx, func(index int64, zone *icstypes.Zone) (stop bool) {
    appKeepers.InterchainstakingKeeper.OverrideRedemptionRateNoCap(ctx, zone)
    return false
})

This action can have significant financial implications for stakeholders. Please verify that this is the intended behavior and that all potential impacts have been considered.

If needed, run the following script to identify zones affected by this change:

✅ Verification successful

Based on the search results, I can now provide a comprehensive response about the redemption rate override:

Uncapped redemption rate override is an intentional upgrade feature with controlled impact

The implementation shows this is a deliberate upgrade feature with the following key points:

  • The normal UpdateRedemptionRate function has built-in caps (max 2% increase, max 5% decrease) to prevent extreme rate changes
  • The OverrideRedemptionRateNoCap function is specifically designed to bypass these caps for a one-time correction
  • Test coverage confirms the behavior:
    • Regular updates are capped at 2% increase/5% decrease
    • The uncapped override allows the rate to adjust to the true ratio between delegated assets and qAsset supply
  • The change is part of a planned upgrade (v1.7) documented in the changelog

The removal of caps is intentional and necessary for this one-time correction during the upgrade. The redemption rate will return to using capped updates after the upgrade is complete.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: List all zones that will have their redemption rates overridden without a cap.

# Expected Result: Outputs all zones affected by the redemption rate override.

# Retrieve all zones
ast-grep --pattern 'func (k *InterchainstakingKeeper) IterateZones(ctx sdk.Context, cb func(index int64, zone *icstypes.Zone) (stop bool))' 

Length of output: 141


Script:

#!/bin/bash
# Let's try to understand the implementation and impact of OverrideRedemptionRateNoCap

# Search for the implementation of OverrideRedemptionRateNoCap
ast-grep --pattern 'func (k *InterchainstakingKeeper) OverrideRedemptionRateNoCap'

# Search for any tests or documentation related to this function
rg -l "OverrideRedemptionRateNoCap"

# Look for any other redemption rate related functions for context
rg "RedemptionRate" -A 3

Length of output: 31331

🧰 Tools
🪛 GitHub Check: devskim

[failure] 35-35: A token or key was found in source code. If this represents a secret, it should be moved somewhere else.
Do not store tokens or keys in source code.


[failure] 36-36: A token or key was found in source code. If this represents a secret, it should be moved somewhere else.
Do not store tokens or keys in source code.

app/upgrades/types.go Show resolved Hide resolved
app/upgrades/v1_7.go Show resolved Hide resolved
@joe-bowman joe-bowman merged commit 89845bf into main Nov 19, 2024
14 checks passed
@joe-bowman joe-bowman deleted the v1.7.2-handler branch November 19, 2024 14:54
Copy link

codecov bot commented Nov 19, 2024

Codecov Report

Attention: Patch coverage is 15.38462% with 11 lines in your changes missing coverage. Please review.

Project coverage is 61.57%. Comparing base (f11e862) to head (9fb1118).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
app/upgrades/v1_7.go 8.33% 10 Missing and 1 partial ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1747      +/-   ##
==========================================
- Coverage   61.60%   61.57%   -0.04%     
==========================================
  Files         196      196              
  Lines       17013    17026      +13     
==========================================
+ Hits        10481    10483       +2     
- Misses       5686     5696      +10     
- Partials      846      847       +1     
Flag Coverage Δ
unittests 61.57% <15.38%> (-0.04%) ⬇️

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

Files with missing lines Coverage Δ
app/upgrades/types.go 50.00% <ø> (ø)
app/upgrades/upgrades.go 86.95% <100.00%> (+0.59%) ⬆️
app/upgrades/v1_7.go 5.26% <8.33%> (+1.41%) ⬆️
---- 🚨 Try these New Features:

@coderabbitai coderabbitai bot mentioned this pull request Nov 26, 2024
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