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 the bank params migration. #1967

Merged
merged 3 commits into from
May 13, 2024
Merged

Conversation

SpicyLemon
Copy link
Contributor

@SpicyLemon SpicyLemon commented May 8, 2024

Description

This PR fixes the bank params migration. It also makes github require the app unit tests to pass, since they're all fixed now.

The existing one wasn't working because the old key table wasn't being added anymore. But when I added it, the migration would then fail unit tests because the values were nil, which causes the params module to panic when we try to get them. During an actual upgrade, they'd exist, probably, but there's no good/easy way to test for that.

The bank params have two fields: SendEnabled and DefaultSendEnabled. The former is deprecated and now stored directly in state. We migrated those out of the bank params a few upgrades ago. So all we need now is the latter. Both mainnet and testnet have DefaultSendEnabled set to true. So, because of the possible problems with looking it up, this PR instead just sets it to true and stores it in the new place.

Related to:


Before we can merge this PR, please make sure that all the following items have been
checked off. If any of the checklist items are not applicable, please leave them but
write a little note why.

  • Targeted PR against correct branch (see CONTRIBUTING.md)
  • Linked to Github issue with discussion and accepted design OR link to spec that describes this work.
  • Wrote unit and integration tests
  • Updated relevant documentation (docs/) or specification (x/<module>/spec/)
  • Added relevant godoc comments.
  • Added a relevant changelog entry to the Unreleased section in CHANGELOG.md
  • Re-reviewed Files changed in the Github PR explorer
  • Review Codecov Report in the comment section below once CI passes

Summary by CodeRabbit

  • Chores

    • Updated workflow scripts for enhanced performance.
  • Documentation

    • Updated CHANGELOG with details on migrations and command updates for various modules.
  • Refactor

    • Simplified error handling in bank parameter migration function.

SpicyLemon added 2 commits May 8, 2024 12:22
…nd just sets DefaultSendEnabled to true (that's what both mainnet and testnet have). The umber tests were failing because the two bank params keys didn't exist. But if I added the key tables, it'd then blow up because the values are nil for the tests. This way is just easier and safer.
Copy link
Contributor

coderabbitai bot commented May 8, 2024

Walkthrough

The recent updates primarily focus on refining the error handling and parameter migration processes across various modules in a software project. Significant changes include the removal of specific package references in testing configurations, enhancements in bank parameter migrations, and updates to several modules as noted in the change log.

Changes

File Path Change Summary
.github/.../test.yml Removed specific package references in run commands.
CHANGELOG.md Documented migrations and updates in modules like Bank, Msgfees, Name, IbcHooks, and others.
app/upgrades.go Simplified error handling and updated logic in migrateBankParams function.

Poem

🐰 "In the burrows of code, where changes lay,
A hop here, a tweak there, improving the fray.
Modules dance, parameters sway,
In the soft glow of progress, we find our way.
Oh, how the digital meadows sway!" 🌼


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.

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

@SpicyLemon SpicyLemon marked this pull request as ready for review May 8, 2024 18:36
@SpicyLemon SpicyLemon requested a review from a team as a code owner May 8, 2024 18:36
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: 0

Out of diff range and nitpick comments (5)
CHANGELOG.md (5)

Line range hint 79-321: Convert unordered list markers from dashes to asterisks for consistency.

- -
+ *

Line range hint 198-619: Convert bare URLs to Markdown links for better readability and consistency.

- https://github.com/provenance-io/provenance/issues/105
+ [https://github.com/provenance-io/provenance/issues/105](https://github.com/provenance-io/provenance/issues/105)

Line range hint 915-915: Remove spaces inside emphasis markers to correct Markdown formatting.

- * message *
+ *message*

Line range hint 311-311: Remove spaces inside code span elements to correct Markdown formatting.

- ` message `
+ `message`

Line range hint 787-1361: Ensure there is only one consecutive blank line to maintain clean and consistent formatting.

- 

+
Review Details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits Files that changed from the base of the PR and between 6b3638a and 01fc77f.
Files selected for processing (3)
  • .github/workflows/test.yml (2 hunks)
  • CHANGELOG.md (1 hunks)
  • app/upgrades.go (1 hunks)
Files skipped from review due to trivial changes (1)
  • .github/workflows/test.yml
Additional comments not posted (1)
app/upgrades.go (1)

317-328: The modifications to migrateBankParams ensure robustness by setting DefaultSendEnabled to true. This change addresses potential issues with nil values during tests and prevents system panics.

Ensure that all modules interacting with bank parameters are compatible with this change.

@SpicyLemon SpicyLemon enabled auto-merge (squash) May 10, 2024 01:16
@SpicyLemon SpicyLemon merged commit 5495cbf into main May 13, 2024
26 of 37 checks passed
@SpicyLemon SpicyLemon deleted the dwedul/1760-fix-bank-upgrade branch May 13, 2024 14:20
nullpointer0x00 pushed a commit that referenced this pull request May 15, 2024
* [1760]: Fix the bank params migration. It now ignored current state and just sets DefaultSendEnabled to true (that's what both mainnet and testnet have). The umber tests were failing because the two bank params keys didn't exist. But if I added the key tables, it'd then blow up because the values are nil for the tests. This way is just easier and safer.

* [1760]: In the unit test github actions, re-require the app tests to pass since they all pass now.

* [1760]: Add changelog entry.
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.

3 participants