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: rpc can't query old parameter format after migration #807

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

adu-crypto
Copy link
Contributor

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

close: #806
By querying params from x/params if we get nil from x/cronos store, we could return correct params even if the context is in old blocks before the params migratiion

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! :)

@codecov
Copy link

codecov bot commented Jan 9, 2023

Codecov Report

Merging #807 (40d3fcf) into main (6365729) will increase coverage by 0.14%.
The diff coverage is 80.00%.

❗ Current head 40d3fcf differs from pull request most recent head befb56e. Consider uploading reports for the commit befb56e to get more accurate results

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #807      +/-   ##
==========================================
+ Coverage   34.26%   34.40%   +0.14%     
==========================================
  Files          30       30              
  Lines        1582     1587       +5     
==========================================
+ Hits          542      546       +4     
- Misses        983      984       +1     
  Partials       57       57              
Impacted Files Coverage Δ
x/cronos/keeper/params.go 71.42% <0.00%> (-2.11%) ⬇️
x/cronos/keeper/keeper.go 76.60% <100.00%> (+0.56%) ⬆️

@adu-crypto adu-crypto marked this pull request as ready for review January 9, 2023 08:43
@adu-crypto adu-crypto requested a review from a team as a code owner January 9, 2023 08:43
@adu-crypto adu-crypto requested review from yihuang and thomas-nguy and removed request for a team January 9, 2023 08:43
@thomas-nguy
Copy link
Collaborator

the issue is that we cannot query params after migration for older blocks?

@adu-crypto
Copy link
Contributor Author

adu-crypto commented Jan 11, 2023

yes, the issue is that we can query params for blocks after the migration, but if we switched context to older blocks, we can not get params because params are not stored in x/cronos store at that time.

Copy link
Collaborator

@thomas-nguy thomas-nguy left a comment

Choose a reason for hiding this comment

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

lgtm, maybe you could add a test in the python integration tests "test_upgrade.py" (just query params with older ctx after the upgrade)

@adu-crypto
Copy link
Contributor Author

lgtm, maybe you could add a test in the python integration tests "test_upgrade.py" (just query params with older ctx after the upgrade)

good idea, I'll add it

@yihuang
Copy link
Collaborator

yihuang commented Jan 11, 2023

But in this way we have to stick with x/params, not sure what to do when that is finally removed.
it's really a tricky issue that to support query old blocks when this kind of migration happens, don't have a good idea yet.

@adu-crypto
Copy link
Contributor Author

yes, given we support querying params for old blocks for the params migration, maybe we should consider making other code changes in the future compatible with the old blocks data?

Comment on lines +169 to +184
assert cli.query_params(0) == {
"cronos_admin": "crc12luku6uxehhak02py4rcz65zu0swh7wjsrw0pp",
"enable_auto_deployment": True,
"ibc_cro_denom": "ibc/6411AE2ADA1E73DB59DB151"
"A8988F9B7D5E7E233D8414DB6817F8F1A01611F86",
"ibc_timeout": "86400000000000",
}

assert cli.query_params(target_height-5) == {
"cronos_admin": "crc12luku6uxehhak02py4rcz65zu0swh7wjsrw0pp",
"enable_auto_deployment": True,
"ibc_cro_denom": "ibc/6411AE2ADA1E73DB59DB151"
"A8988F9B7D5E7E233D8414DB6817F8F1A01611F86",
"ibc_timeout": "86400000000000",
}

Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
assert cli.query_params(0) == {
"cronos_admin": "crc12luku6uxehhak02py4rcz65zu0swh7wjsrw0pp",
"enable_auto_deployment": True,
"ibc_cro_denom": "ibc/6411AE2ADA1E73DB59DB151"
"A8988F9B7D5E7E233D8414DB6817F8F1A01611F86",
"ibc_timeout": "86400000000000",
}
assert cli.query_params(target_height-5) == {
"cronos_admin": "crc12luku6uxehhak02py4rcz65zu0swh7wjsrw0pp",
"enable_auto_deployment": True,
"ibc_cro_denom": "ibc/6411AE2ADA1E73DB59DB151"
"A8988F9B7D5E7E233D8414DB6817F8F1A01611F86",
"ibc_timeout": "86400000000000",
}
expected_param = {
"cronos_admin": "crc12luku6uxehhak02py4rcz65zu0swh7wjsrw0pp",
"enable_auto_deployment": True,
"ibc_cro_denom": "ibc/6411AE2ADA1E73DB59DB151"
"A8988F9B7D5E7E233D8414DB6817F8F1A01611F86",
"ibc_timeout": "86400000000000",
}
assert cli.query_params(0) == expected_param
assert cli.query_params(target_height-5) == expected_param

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: rpc can't query old parameter format after migration
4 participants