cronos
cronos copied to clipboard
Problem: rpc can't query old parameter format after migration
👮🏻👮🏻👮🏻 !!!! 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 Report
Merging #807 (40d3fcf) into main (6365729) will increase coverage by
0.14%. The diff coverage is80.00%.
:exclamation: Current head 40d3fcf differs from pull request most recent head befb56e. Consider uploading reports for the commit befb56e to get more accurate results
@@ 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%) |
:arrow_down: |
| x/cronos/keeper/keeper.go | 76.60% <100.00%> (+0.56%) |
:arrow_up: |
the issue is that we cannot query params after migration for older blocks?
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.
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
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.
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?