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

Move fork and upgrade logic into sub-directory structure #680

Merged
merged 4 commits into from
Dec 26, 2021

Conversation

ValarDragon
Copy link
Member

@ValarDragon ValarDragon commented Dec 20, 2021

Cref: #671

Description

Pull request for trying to re-arranging around the fork and migration code. This moves them, to their own sub-directory.

I mainly did this to play around with some of the code structure here. The main bottleneck was import cycles due to app.go, and having to pass around keepers instead of the app.

I suggest we keep this structure, and then make a second "AppKeepers" struct, which actually stores all of the keepers. Then OsmosisApp stores a reference to an AppKeepers struct that we pass to all of these migration logics.

I think these sub-folders for each upgrade will make it easier to track old upgrade code, and keep a reasonable location to have it be commented out, without cluttering an important file like app.go.

Thoughts?


For contributor use:

  • Targeted PR against correct branch (see CONTRIBUTING.md)
  • Updated relevant documentation (docs/) or specification (x/<module>/spec/)
  • Added a relevant changelog entry to the Unreleased section in CHANGELOG.md
  • Re-reviewed Files changed in the Github PR explorer

@codecov-commenter
Copy link

codecov-commenter commented Dec 20, 2021

Codecov Report

Merging #680 (1243268) into main (b03cc8c) will increase coverage by 0.30%.
The diff coverage is 87.50%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #680      +/-   ##
==========================================
+ Coverage   18.39%   18.69%   +0.30%     
==========================================
  Files         173      171       -2     
  Lines       24321    23814     -507     
==========================================
- Hits         4473     4452      -21     
+ Misses      19086    18600     -486     
  Partials      762      762              
Impacted Files Coverage Δ
app/upgrades/v4/prop12_data.go 60.00% <ø> (ø)
app/upgrades/v4/prop12.go 60.00% <66.66%> (ø)
app/upgrades/v4/upgrades.go 100.00% <100.00%> (ø)
x/gamm/types/pool.go 0.00% <0.00%> (-69.32%) ⬇️
x/gamm/types/pool_asset.go 0.00% <0.00%> (-68.52%) ⬇️
x/gamm/types/msgs.go 71.42% <0.00%> (-10.66%) ⬇️
x/incentives/keeper/gauge.go 54.68% <0.00%> (-9.94%) ⬇️
x/gamm/types/codec.go 40.74% <0.00%> (-1.20%) ⬇️
x/gamm/keeper/pool.go 81.08% <0.00%> (ø)
x/gamm/client/cli/tx.go 65.53% <0.00%> (ø)
... and 28 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b03cc8c...1243268. Read the comment docs.

@ValarDragon ValarDragon marked this pull request as ready for review December 20, 2021 03:34
@ValarDragon ValarDragon changed the title Move fork logic into sub-directory structure Move fork and upgrade logic into sub-directory structure Dec 20, 2021
@daniel-farina daniel-farina added this to the 2021 - December Milestone milestone Dec 20, 2021
Copy link
Member

@UnityChaos UnityChaos left a comment

Choose a reason for hiding this comment

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

Full support on the idea, utAck on the implementation. Looks good to me, but we should probably try to test it somehow?
I think the idea of separating out each upgrade and then eventually commenting them out once the code is no longer logically reachable makes sense.

Also interesting that the v6 upgrade has essentially no contact with this refactor, because it does no actual state migrations.

@ValarDragon
Copy link
Member Author

Good point, this should have tests before we go through it. I'll write a test for v3 and v5 upgrades. (I'll do this by checking the parameters set during the upgrade)

@daniel-farina daniel-farina removed this from the 2021-12 Milestone milestone Dec 24, 2021
@ValarDragon
Copy link
Member Author

ValarDragon commented Dec 26, 2021

Committed a test that updates the v4 upgrade keeper. (It reinstates an old test with mild adjustments, that got deleted in #538 ) This shows that the keeper reference setup is generally working here.

Used v4 since it tests migration & param changes.

The thing thats not tested is adding new stores during an upgrade, but thats really essentially the same as what exists right now

@ValarDragon
Copy link
Member Author

ValarDragon commented Dec 26, 2021

Proceeding with merge, since Unity approved, and test added. (and want to try out other app.go simplifications)

@ValarDragon ValarDragon merged commit 8dcbaf5 into main Dec 26, 2021
@ValarDragon ValarDragon deleted the dev/move_fork_code branch December 26, 2021 04:53
ValarDragon added a commit that referenced this pull request Jan 9, 2022
* Move fork logic into sub-directory structure

* Move upgrade handlers into sub-directories

* Move upgrade logic to end of keeper initialization

* Add v4 migration test
@github-actions github-actions bot mentioned this pull request Jan 15, 2024
@github-actions github-actions bot mentioned this pull request Apr 1, 2024
@github-actions github-actions bot mentioned this pull request Apr 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

4 participants