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

Problem: x/params is deprecated, need to migrate away from it #735

Merged
merged 5 commits into from
Dec 13, 2022

Conversation

adu-crypto
Copy link
Contributor

@adu-crypto adu-crypto commented Oct 12, 2022

👮🏻👮🏻👮🏻 !!!! REFERENCE THE PROBLEM YOUR ARE SOLVING IN THE PR TITLE AND DESCRIBE YOUR SOLUTION HERE !!!! DO NOT FORGET !!!! 👮🏻👮🏻👮🏻
close #632

According to the recent Cosmos-SDK ADR 046: Module Params , we should migrate x/cronos module away from x/params to enable stateful params changes, as well as more efficient params serialization.

  • store params in x/cronos store instead of subspace
  • create and handle MsgUpdateParams for grpc msgServer
  • support querying params of x/cronos
  • write and register migration plan
  • add migration test

PR Checklist:

  • Have you read the CONTRIBUTING.md?
  • Does your PR follow the C4 patch requirements?
  • Have you rebased your work on top of the latest master?
  • Have you checked your code compiles? (make)
  • Have you included tests for any non-trivial functionality?
  • Have you checked your code passes the unit tests? (make test)
  • Have you checked your code formatting is correct? (go fmt)
  • Have you checked your basic code style is fine? (golangci-lint run)
  • If you added any dependencies, have you checked they do not contain any known vulnerabilities? (go list -json -m all | nancy sleuth)
  • If your changes affect the client infrastructure, have you run the integration test?
  • If your changes affect public APIs, does your PR follow the C4 evolution of public contracts?
  • If your code changes public APIs, have you incremented the crate version numbers and documented your changes in the CHANGELOG.md?
  • If you are contributing for the first time, please read the agreement in CONTRIBUTING.md now and add a comment to this pull request stating that your PR is in accordance with the Developer's Certificate of Origin.

Thank you for your code, it's appreciated! :)

@thomas-nguy
Copy link
Collaborator

does it needs to be handled in other modules as well ? (ibc-go, gravity-bridge, ethermint)

@adu-crypto
Copy link
Contributor Author

adu-crypto commented Oct 17, 2022

does it needs to be handled in other modules as well ? (ibc-go, gravity-bridge, ethermint)

I think so as these modules also use the legacy subspace to get/set params
but the migration plan that I'm writing is restricted to the only cronos module.
do you think we should migrate these modules together

@codecov
Copy link

codecov bot commented Oct 17, 2022

Codecov Report

Merging #735 (8e11a2b) into main (be8d53d) will increase coverage by 0.26%.
The diff coverage is 47.72%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #735      +/-   ##
==========================================
+ Coverage   33.99%   34.26%   +0.26%     
==========================================
  Files          28       30       +2     
  Lines        1506     1582      +76     
==========================================
+ Hits          512      542      +30     
- Misses        941      983      +42     
- Partials       53       57       +4     
Impacted Files Coverage Δ
x/cronos/keeper/grpc_query.go 0.00% <0.00%> (ø)
x/cronos/types/keys.go 0.00% <ø> (ø)
x/cronos/types/messages.go 14.38% <0.00%> (-3.16%) ⬇️
x/cronos/keeper/migrations.go 40.00% <40.00%> (ø)
x/cronos/keeper/keeper.go 76.04% <60.00%> (-1.20%) ⬇️
x/cronos/migrations/v2/migrate.go 72.72% <72.72%> (ø)
x/cronos/module.go 53.16% <75.00%> (+1.10%) ⬆️
x/cronos/keeper/params.go 73.52% <80.00%> (+0.80%) ⬆️
x/cronos/genesis.go 64.28% <100.00%> (ø)
x/cronos/keeper/msg_server.go 16.92% <100.00%> (+13.35%) ⬆️
... and 2 more

@adu-crypto adu-crypto marked this pull request as ready for review October 24, 2022 03:59
@adu-crypto adu-crypto requested a review from a team as a code owner October 24, 2022 03:59
@adu-crypto adu-crypto requested review from mmsqe and leejw51crypto and removed request for a team October 24, 2022 03:59
Copy link
Collaborator

@yihuang yihuang left a comment

Choose a reason for hiding this comment

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

Is this PR ready, can you add an integration test for the gov param message?

@adu-crypto
Copy link
Contributor Author

Is this PR ready, can you add an integration test for the gov param message?

yeah sure. I will add the integration test soon

@yihuang
Copy link
Collaborator

yihuang commented Nov 11, 2022

Is this PR ready, can you add an integration test for the gov param message?

yeah sure. I will add the integration test soon

and ideally check the migration is succesfully in the upgrade integration test.

@adu-crypto
Copy link
Contributor Author

@yihuang all checks has passed except protobuf breakage, how could I escape this check?

Copy link
Collaborator

@yihuang yihuang left a comment

Choose a reason for hiding this comment

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

LGTM overall, can you do a gov proposal to update parameters in integration test?

@adu-crypto
Copy link
Contributor Author

LGTM overall, can you do a gov proposal to update parameters in integration test?

sure, add soon

@yihuang
Copy link
Collaborator

yihuang commented Dec 6, 2022

can you fix the conflicts?

@adu-crypto
Copy link
Contributor Author

can you fix the conflicts?

No problem but test_gov_update_params failed for

AssertionError: (cronosd tx gov submit-proposal /private/tmp/pytest-of-adudu/pytest-2/test_gov_update_params0/proposal.json -y --home /private/tmp/pytest-of-adudu/pytest-2/cronos-gov0/cronos_777-1/node0 --gas-prices 100000000000basetcro --gas auto --gas-adjustment 1.5 --from community)

I'm still trying to fix this

fix rebase error
@adu-crypto
Copy link
Contributor Author

/runsim

Copy link
Collaborator

@yihuang yihuang left a comment

Choose a reason for hiding this comment

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

LGTM

@adu-crypto adu-crypto enabled auto-merge (squash) December 13, 2022 03:16
@adu-crypto adu-crypto merged commit 6da4ce3 into crypto-org-chain:main Dec 13, 2022
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.

Problem: x/params is deprecated, need to migrate away from it
5 participants