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

feat!: ics parameter migration #1408

Merged
merged 8 commits into from
Nov 17, 2023

Conversation

bermuell
Copy link
Contributor

Description

Closes: #1378

Migrate legacy params to store parameters directly in the module itself as x/params SDK moduel is deprecated since Cosmos SDK v0.46.


Author Checklist

All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.

I have...

  • Included the correct type prefix in the PR title
  • Added ! to the type prefix if state-machine breaking change (i.e., requires coordinated upgrade)
  • Confirmed this PR does not introduce changes requiring state migrations, OR migration code has been added to consumer and/or provider modules
  • Targeted the correct branch (see PR Targeting)
  • Provided a link to the relevant issue or specification
  • Followed the guidelines for building SDK modules
  • Included the necessary unit and integration tests
  • Added a changelog entry to CHANGELOG.md
  • Included comments for documenting Go code
  • Updated the relevant documentation or specification
  • Reviewed "Files changed" and left comments if necessary
  • Confirmed all CI checks have passed
  • If this PR is library API breaking, bump the go.mod version string of the repo, and follow through on a new major release

Reviewers Checklist

All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.

I have...

  • confirmed the correct type prefix in the PR title
  • confirmed ! in the type prefix if API or client breaking change
  • confirmed this PR does not introduce changes requiring state migrations, OR confirmed migration code has been added to consumer and/or provider modules
  • confirmed all author checklist items have been addressed
  • reviewed state machine logic
  • reviewed API design and naming
  • reviewed documentation is accurate
  • reviewed tests and test coverage

@github-actions github-actions bot added C:Testing Assigned automatically by the PR labeler C:x/consumer Assigned automatically by the PR labeler C:x/provider Assigned automatically by the PR labeler C:x/types Assigned automatically by the PR labeler labels Nov 13, 2023
@bermuell bermuell force-pushed the bernd/1378-ics_params_migration branch 2 times, most recently from 5ec7e3d to 4af7cc0 Compare November 13, 2023 09:55
x/ccv/consumer/keeper/migration.go Outdated Show resolved Hide resolved
x/ccv/provider/keeper/params.go Outdated Show resolved Hide resolved
x/ccv/consumer/keeper/params.go Outdated Show resolved Hide resolved
@bermuell bermuell force-pushed the bernd/1378-ics_params_migration branch from 4af7cc0 to e47868f Compare November 13, 2023 10:42
@bermuell bermuell force-pushed the bernd/1378-ics_params_migration branch from e47868f to 849d913 Compare November 13, 2023 17:30
@github-actions github-actions bot removed C:Testing Assigned automatically by the PR labeler C:x/types Assigned automatically by the PR labeler labels Nov 13, 2023
@bermuell bermuell marked this pull request as ready for review November 15, 2023 09:23
@bermuell bermuell requested a review from a team as a code owner November 15, 2023 09:23
x/ccv/consumer/keeper/params.go Outdated Show resolved Hide resolved
x/ccv/consumer/types/keys.go Show resolved Hide resolved
x/ccv/provider/client/cli/query.go Outdated Show resolved Hide resolved
Copy link
Contributor

@MSalopek MSalopek left a comment

Choose a reason for hiding this comment

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

Looks good!

I don't have any logic comments, just some nitpicks. Please address the nitpicks (around keys and such) so we don't get confuced in the future.

Also, on the consumer we will need to set the consensus version to 3 because there's a migration in main that has to be rebased into feat/v50-upgrade - I'll handle that part.

@@ -106,13 +106,21 @@ const (
// SlashRecordByteKey is the single byte key storing the consumer's slash record.
SlashRecordByteKey

// ParametersKey is the single byte key for storing consumer's parameters.
ParametersByteKey
Copy link
Contributor

Choose a reason for hiding this comment

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

Mark unused keys as deprecated, please.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

For consumer the deprecated ones are in x/ccv/types/params.go#48
Marked them deprecated as discussed

@@ -119,6 +119,12 @@ func (AppModule) RegisterInvariants(ir sdk.InvariantRegistry) {
func (am AppModule) RegisterServices(cfg module.Configurator) {
providertypes.RegisterMsgServer(cfg.MsgServer(), keeper.NewMsgServerImpl(am.keeper))
providertypes.RegisterQueryServer(cfg.QueryServer(), am.keeper)

migrator := keeper.NewMigrator(*am.keeper, am.paramSpace)
err := cfg.RegisterMigration(am.Name(), 2, migrator.MigrateParams)
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe call the migrator.MigrateParams -> migrator.Migrate2to3

@@ -138,13 +138,21 @@ const (
// handled in the current block
VSCMaturedHandledThisBlockBytePrefix

// ParametersKey is the is the single byte key for storing provider's parameters.
Copy link
Contributor

Choose a reason for hiding this comment

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

Comment on the deprecated keys and tag them as deprecated

Copy link
Contributor Author

Choose a reason for hiding this comment

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

depreacted keys for parameter values are located in x/ccv/provider/types/params.go#49
Added deprecation comment on related keys

@github-actions github-actions bot added the C:x/types Assigned automatically by the PR labeler label Nov 16, 2023
@MSalopek MSalopek self-requested a review November 17, 2023 15:40
Copy link
Contributor

@MSalopek MSalopek left a comment

Choose a reason for hiding this comment

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

Approve!

Thanks for the changes

@MSalopek MSalopek merged commit d3f3d9f into feat/v50-upgrade Nov 17, 2023
4 of 12 checks passed
@MSalopek MSalopek deleted the bernd/1378-ics_params_migration branch November 17, 2023 15:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C:x/consumer Assigned automatically by the PR labeler C:x/provider Assigned automatically by the PR labeler C:x/types Assigned automatically by the PR labeler
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants