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

Delete the params module and the umber stuff. #2176

Merged
merged 12 commits into from
Oct 11, 2024
Merged

Conversation

SpicyLemon
Copy link
Contributor

@SpicyLemon SpicyLemon commented Oct 10, 2024

Description

This PR does the following:

  1. Removes the params module now that everything has been migrated off of it. There's a couple of tiny remnants left that are needed to allow the state store to be deleted in the migration, though.
  2. Deletes all the umber stuff.

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 relevant changelog entries under .changelog/unreleased (see Adding Changes).
  • Re-reviewed Files changed in the Github PR explorer.
  • Review Codecov Report in the comment section below once CI passes.

Summary by CodeRabbit

Release Notes

  • New Features

    • Enhanced API documentation with new tags for various endpoints.
  • Bug Fixes

    • Removed deprecated endpoints for parameter queries, improving API clarity.
  • Refactor

    • Streamlined parameter management across multiple modules, removing unnecessary functions and variables.
    • Simplified upgrade handling logic, focusing on essential migration processes.
  • Documentation

    • Updated Swagger configuration to reflect recent changes in API structure and endpoint availability.
  • Tests

    • Removed outdated test functions related to deprecated parameters and upgrades, focusing on current functionality.

@SpicyLemon SpicyLemon marked this pull request as ready for review October 10, 2024 22:53
@SpicyLemon SpicyLemon requested a review from a team as a code owner October 10, 2024 22:53
Copy link
Contributor

coderabbitai bot commented Oct 10, 2024

Walkthrough

The pull request involves the removal of the params module and its associated components from the codebase, leading to the elimination of various API endpoints and restructuring of parameter management across multiple modules. Additionally, several configuration files and tests have been updated or deleted to reflect these changes. The modifications aim to simplify the handling of parameters by shifting responsibilities to individual modules and enhancing build processes and linter configurations.

Changes

File Change Summary
.changelog/unreleased/api-breaking/2176-delete-params.md Removed params module and associated endpoints.
.golangci.yml Updated linter settings, added deny rule for deprecated params module.
Makefile Modified Protobuf handling targets and enhanced Go version validation.
app/app.go Removed params module imports and related components; added placeholders for compatibility.
app/embed.go Deleted file for embedding upgrade files.
app/scope_navs_updater.go Deleted file for processing Scope NAV data.
app/scope_navs_updater_test.go Deleted unit tests for Scope NAV functionality.
app/upgrades.go Removed migration functions and simplified upgrade handling logic.
app/upgrades_test.go Removed tests for "umber" upgrade; added tests for "viridian" upgrade.
client/docs/config.json Updated Swagger API configuration with new tags and renamed operation IDs.
client/docs/swagger-ui/swagger.yaml Removed endpoints for querying parameters.
internal/provwasm/simulation.go Updated NewWrapper function signature to remove Subspace parameter.
x/attribute/types/genesis_test.go Deleted unit test for GenesisState.
x/attribute/types/params.go Removed parameter management functions and keys.
x/ibchooks/types/params.go Removed parameter management components and simplified validation logic.
x/marker/types/params.go Removed deprecated parameter management functions and keys.
x/marker/types/params_test.go Deleted test for parameter set pairs.
x/metadata/types/oslocatorparams.go Removed parameter management functions and keys; renamed functions.
x/metadata/types/oslocatorparams_test.go Deleted multiple test functions related to parameter management.
x/metadata/types/params.go Removed parameter management functions and keys.
x/msgfees/types/params.go Removed parameter management functions and keys.
x/msgfees/types/params_test.go Deleted multiple test functions related to parameter management.
x/name/types/params.go Removed parameter management functions and keys.
x/name/types/params_test.go Deleted test for parameter set pairs.

Possibly related PRs

Suggested reviewers

  • iramiller
  • nullpointer0x00
  • Taztingo

Poem

🐰 In the code where params once lay,
A shift has come to change the way.
Modules now stand tall and bright,
Each one managing its own light.
So hop along, let's cheer and play,
For a cleaner path, we pave today! 🌟


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.

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

🧹 Outside diff range and nitpick comments (6)
.changelog/unreleased/api-breaking/2176-delete-params.md (1)

1-2: LGTM! Consider adding a note about potential impact.

The changelog entry accurately summarizes the removal of the params module and its implications. It's concise and informative, which is great for a changelog.

Consider adding a brief note about the potential impact on users or developers who might be affected by this change. For example:

* The params module has been removed [PR 2176](https://github.com/provenance-io/provenance/pull/2176).
  All params module endpoints have been removed. All modules now manage their params on their own.
+ Developers using the params module or its endpoints will need to update their code to work with individual module parameters.

This addition would help users quickly understand if and how they might need to adapt their code.

x/msgfees/types/params_test.go (1)

19-19: LGTM: Hardcoded value simplifies the test, but consider adding a comment.

The change from pioconfig.GetProvenanceConfig().FeeDenom to "nhash" simplifies the test and aligns with the PR objectives. However, it might be helpful to add a comment explaining why "nhash" is used as the hardcoded value.

Consider adding a comment like this:

// "nhash" is used as the hardcoded ConversionFeeDenom for simplicity in tests
.golangci.yml (1)

148-150: Approve the new deny rule with a minor suggestion.

The addition of this deny rule for the params module is excellent. It aligns perfectly with the PR objective of removing the params module and will help prevent accidental usage of the deprecated module in the codebase.

Consider adding a link to the deprecation announcement or migration guide in the description. This could provide developers with more context and guidance if they encounter this rule. For example:

deny:
  - pkg: "github.com/cosmos/cosmos-sdk/x/params"
    desc: "The params module is deprecated. See [link to announcement/guide] for migration details."
x/marker/types/params.go (1)

Line range hint 42-47: Reintroduce validation for all Params fields

The Validate method now only validates UnrestrictedDenomRegex but no longer validates EnableGovernance and MaxSupply. Omitting validation for these fields could allow invalid configurations to pass unnoticed, potentially leading to unintended behavior.

To ensure all parameters are correctly validated, consider reintroducing validation checks for EnableGovernance and MaxSupply. Here's a suggested modification:

 func (p Params) Validate() error {
+	if err := validateEnableGovernance(p.EnableGovernance); err != nil {
+		return err
+	}
+	if err := validateBigIntParam(p.MaxSupply); err != nil {
+		return err
+	}
 	exp := p.UnrestrictedDenomRegex
 	if len(exp) > 0 && (exp[0:1] == "^" || exp[len(exp)-1:] == "$") {
 		return fmt.Errorf("invalid parameter, validation regex must not contain anchors ^,$")
 	}
 	_, err := regexp.Compile(fmt.Sprintf(`^%s$`, exp))
 	return err
 }

Ensure that the validation functions are defined as follows:

func validateEnableGovernance(i interface{}) error {
	_, ok := i.(bool)
	if !ok {
		return fmt.Errorf("invalid parameter type for EnableGovernance: %T", i)
	}
	return nil
}

func validateBigIntParam(i interface{}) error {
	_, ok := i.(sdkmath.Int)
	if !ok {
		return fmt.Errorf("invalid parameter type for MaxSupply: %T", i)
	}
	return nil
}
app/upgrades.go (1)

35-38: Consolidate comment blocks for improved clarity

There's an empty comment line at line 35. Consider removing it to make the comment block more concise and enhance readability.

app/upgrades_test.go (1)

Line range hint 610-745: Refactor the long test function into smaller, reusable functions

The TestMetadataMigration function is lengthy and contains multiple nested functions and logic blocks. Breaking it down into smaller, well-named helper functions would improve readability and maintainability.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between ce5e5f2 and f111c69.

⛔ Files ignored due to path filters (3)
  • app/upgrade_files/umber/funding_trading_bridge_smart_contract.wasm is excluded by !**/*.wasm
  • app/upgrade_files/umber/mainnet_scope_navs.csv is excluded by !**/*.csv
  • app/upgrade_files/umber/testnet_scope_navs.csv is excluded by !**/*.csv
📒 Files selected for processing (25)
  • .changelog/unreleased/api-breaking/2176-delete-params.md (1 hunks)
  • .changelog/unreleased/improvements/2176-delete-umber.md (1 hunks)
  • .golangci.yml (1 hunks)
  • Makefile (1 hunks)
  • app/app.go (11 hunks)
  • app/embed.go (0 hunks)
  • app/scope_navs_updater.go (0 hunks)
  • app/scope_navs_updater_test.go (0 hunks)
  • app/upgrades.go (3 hunks)
  • app/upgrades_test.go (1 hunks)
  • client/docs/config.json (1 hunks)
  • client/docs/swagger-ui/swagger.yaml (0 hunks)
  • internal/provwasm/simulation.go (1 hunks)
  • x/attribute/types/genesis_test.go (0 hunks)
  • x/attribute/types/params.go (0 hunks)
  • x/ibchooks/types/params.go (1 hunks)
  • x/marker/types/params.go (1 hunks)
  • x/marker/types/params_test.go (0 hunks)
  • x/metadata/types/oslocatorparams.go (1 hunks)
  • x/metadata/types/oslocatorparams_test.go (0 hunks)
  • x/metadata/types/params.go (0 hunks)
  • x/msgfees/types/params.go (0 hunks)
  • x/msgfees/types/params_test.go (1 hunks)
  • x/name/types/params.go (0 hunks)
  • x/name/types/params_test.go (0 hunks)
💤 Files with no reviewable changes (12)
  • app/embed.go
  • app/scope_navs_updater.go
  • app/scope_navs_updater_test.go
  • client/docs/swagger-ui/swagger.yaml
  • x/attribute/types/genesis_test.go
  • x/attribute/types/params.go
  • x/marker/types/params_test.go
  • x/metadata/types/oslocatorparams_test.go
  • x/metadata/types/params.go
  • x/msgfees/types/params.go
  • x/name/types/params.go
  • x/name/types/params_test.go
✅ Files skipped from review due to trivial changes (1)
  • .changelog/unreleased/improvements/2176-delete-umber.md
🧰 Additional context used
🔇 Additional comments (19)
x/msgfees/types/params_test.go (2)

6-7: LGTM: Import statement changes are consistent with test simplification.

The removal of the require package and retention of the assert package align with the simplified structure of the test file after the removal of several test functions.


Line range hint 1-35: Verify test coverage after removal of several test functions.

The removal of multiple test functions (TestCreateParamSet, TestValidateMinGasPriceParamI, TestValidateUsdConversionRateParamI, TestValidateConversionFeeDenomParamI, and TestMsgFeeParamKeyTable) significantly reduces the test coverage for this package. While this aligns with the PR objectives of removing the params module, it's crucial to ensure that all critical functionality is still being tested, possibly in other parts of the codebase.

Please run the following script to check the test coverage for the msgfees module:

If the coverage has significantly decreased, consider adding new tests to cover critical functionality that may have been lost with the removed tests.

client/docs/config.json (2)

Line range hint 1-268: LGTM! Improved API documentation structure and clarity.

The changes to the API configurations are well-structured and consistent:

  1. Addition of specific tags for each module (e.g., "Attribute", "Exchange", "IBC") improves organization.
  2. Renaming of operation IDs from generic "Params" to more specific names (e.g., "AttributeParams", "ExchangeParams") enhances clarity.

These modifications align with the PR objectives of removing the params module and will make the API documentation more intuitive and easier to navigate.


269-270: Appropriate exclusion of removed params module.

The addition of "cosmos/params/.*" to the excluded paths in the third-party Swagger configuration is correct and necessary:

  1. It aligns with the PR objective of removing the params module.
  2. It ensures that the API documentation won't include endpoints for the removed params module.

This change helps maintain consistency between the codebase and its documentation.

internal/provwasm/simulation.go (1)

Line range hint 54-62: LGTM. Verify impact of nil parameter in wasm.NewAppModule.

The removal of the ss exported.Subspace parameter aligns with the PR objective of removing the params module. However, ensure that passing nil to wasm.NewAppModule doesn't have any negative impacts on the wasm module's configuration or behavior.

To verify the impact, you can run the following script:

✅ Verification successful

Approved: Confirmed that passing nil to wasm.NewAppModule is consistent with existing implementations and does not negatively impact the module's configuration or behavior.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check for any error handling or default behavior when passing nil to NewAppModule
rg -U --multiline --type go 'func NewAppModule.*\n.*\n.*\n.*\n.*\n' x/wasm

Length of output: 76


Script:

#!/bin/bash
# Search for calls to NewAppModule with nil as an argument to identify error handling or default behaviors
rg -U --type go 'NewAppModule\s*\(.*nil.*\)'

Length of output: 1336

Makefile (3)

522-522: LGTM: Improved formatting in proto-format target

The removal of the space before the semicolon in the clang-format command is a minor but welcome improvement. It enhances the consistency of the Makefile without affecting functionality.


Line range hint 1-522: Request: Show changes in proto-gen target

The AI summary mentions updates to the proto-gen target, specifically creating a backup of the go.mod file before generating Protobuf files and restoring it afterward. This is a good practice that improves the reliability of the build process. However, these changes are not visible in the provided code. Could you please show the actual modifications to this target?

If implemented correctly, this change is approved in concept as it helps prevent unintended modifications to go.mod during Protobuf generation.

To locate the proto-gen target and its changes, you can run:

#!/bin/bash
# Find the proto-gen target and show its context
rg -A 15 "proto-gen:" Makefile

Line range hint 1-522: Request: Show changes in validate-go-version target

The AI summary mentions improvements to the validate-go-version target, specifically clearer error messages if the installed Go version doesn't meet the requirements. However, these changes are not visible in the provided code. Could you please show the actual modifications to this target?

To locate the validate-go-version target and its changes, you can run:

x/metadata/types/oslocatorparams.go (1)

12-14: Ensure all references to the renamed function DefaultOSLocatorParams are updated

The function DefaultParams has been renamed to DefaultOSLocatorParams. Please verify that all references to DefaultParams have been updated accordingly.

Run the following script to find any remaining references to DefaultParams:

#!/bin/bash
# Description: Find all references to 'DefaultParams' in Go files.

rg --type go 'DefaultParams\('
x/ibchooks/types/params.go (1)

22-26: Ensure all references to removed parameter methods are updated

With the removal of ParamKeyTable and ParamSetPairs, please verify that all references to these methods in other parts of the codebase have been updated appropriately to prevent build or runtime errors.

Run the following script to check for any remaining references:

app/app.go (9)

385-385: Confirm Usage of paramsTKey in Transient Store Keys

Please verify that the inclusion of paramsTKey in transient store keys is necessary for the application's functionality post-removal of the params module.


686-686: Adjustments to Governance Router Are Appropriate

The update to the governance router by removing references to the params module is correct and aligns with the intended removal.


Line range hint 731-755: Module Initializations Reflect Removal of params Module

The changes in module initializations correctly omit the params module and adjust dependencies accordingly.


933-934: Simulation Manager Overrides Are Correct

The modifications to the simulation manager for auth and wasm modules are appropriate and ensure proper initialization without the params module.


Line range hint 509-612: Middleware and Keeper Configurations Updated Appropriately

The adjustments to various middleware and keeper configurations correctly remove dependencies on the params module and maintain application functionality.


Line range hint 598-612: IBC Module Integrations Remain Consistent

The integration of IBC modules continues to function correctly without the params module.


755-755: WASM Module Initialization Is Correct

The initialization of the WASM module appropriately reflects the removal of the params module.


361-361: Validate Necessity of Including paramsKey in Store Keys

Ensure that including paramsKey in the list of store keys is essential and does not reintroduce unintended dependencies on the removed params module.

Run the following script to check for any residual dependencies:

#!/bin/bash
# Description: Verify there are no remaining dependencies on the params module.

# Expected result: No matches found.

# Search for references to the params module imports.
rg --type go 'import.*params(keeper|client|types)?'

210-218: Ensure Copied Constants Match Original Definitions

To prevent inconsistencies during the transition away from the params module, please verify that the constants paramsName, paramsKey, and paramsTKey exactly match their original definitions in paramstypes.

Run the following script to confirm the constants match:

x/metadata/types/oslocatorparams.go Show resolved Hide resolved
x/ibchooks/types/params.go Show resolved Hide resolved
app/upgrades.go Show resolved Hide resolved
app/upgrades.go Show resolved Hide resolved
app/upgrades.go Show resolved Hide resolved
app/upgrades_test.go Show resolved Hide resolved
Copy link
Member

@iramiller iramiller left a comment

Choose a reason for hiding this comment

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

Bummer that you didn’t say ‘the params module is nevermore’.

@SpicyLemon SpicyLemon added this to the v1.20.0 milestone Oct 11, 2024
@SpicyLemon SpicyLemon enabled auto-merge (squash) October 11, 2024 02:33
@SpicyLemon SpicyLemon merged commit 541635b into main Oct 11, 2024
35 checks passed
@SpicyLemon SpicyLemon deleted the dwedul/delete-umber branch October 11, 2024 13:44
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