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!: migrate x/upgrade to use app wiring #12312

Merged
merged 14 commits into from
Jun 22, 2022
Merged

Conversation

julienrbrt
Copy link
Member

@julienrbrt julienrbrt commented Jun 20, 2022

Description

Closes: #12298


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 API or client breaking change
  • targeted the correct branch (see PR Targeting)
  • provided a link to the relevant issue or specification
  • followed the guidelines for building 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

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 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
  • manually tested (if applicable)

protoiface "google.golang.org/protobuf/runtime/protoiface"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
io "io"
reflect "reflect"

Check notice

Code scanning / CodeQL

Sensitive package import

Certain system packages contain functions which may be a possible source of non-determinism
@julienrbrt julienrbrt marked this pull request as ready for review June 21, 2022 17:03
@julienrbrt julienrbrt requested a review from a team as a code owner June 21, 2022 17:03
Copy link
Member

@aaronc aaronc left a comment

Choose a reason for hiding this comment

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

Generally LGTM. Pre-approving

testutil/sims/app_helpers.go Outdated Show resolved Hide resolved
x/upgrade/module.go Outdated Show resolved Hide resolved

/**** Module Options ****/

// Sets the version setter for the upgrade module
app.UpgradeKeeper.SetVersionSetter(app.BaseApp)
Copy link
Member

Choose a reason for hiding this comment

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

We should find a way to handle this. If we don't do it now, can you add a follow-up in #12298 ?

One way that could work at least for this version of baseapp is:

func provideVersionSetting(k upgrade.Keeper) runtime.BaseAppOption {
 return func(b *BaseApp) { k.SetVersionSetter(b) }
}

In the future, we should probably find a way to inject the App itself into the container and then x/upgrade can try to resolve the ProtocolVersionSetter interface and that will automatically resolve to the App instance. In order for that to work, however, we will need to have the server interacting with depinject and providing a DB instance into the container which in turn constructs BaseApp. Or we have a setter on BaseApp to inject the DB, etc.

Copy link
Member Author

Choose a reason for hiding this comment

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

Alright, I will do that in a next PR. I am reverting as well the integration tests as it is taking too long for me to fix, in order to unblock #12270.

Copy link
Member Author

Choose a reason for hiding this comment

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

See #12400

@codecov
Copy link

codecov bot commented Jun 22, 2022

Codecov Report

Merging #12312 (232a7e5) into main (84a0e71) will increase coverage by 0.02%.
The diff coverage is 82.14%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main   #12312      +/-   ##
==========================================
+ Coverage   66.13%   66.15%   +0.02%     
==========================================
  Files         675      675              
  Lines       71262    71287      +25     
==========================================
+ Hits        47128    47163      +35     
+ Misses      21493    21483      -10     
  Partials     2641     2641              
Impacted Files Coverage Δ
simapp/simd/cmd/root.go 71.18% <0.00%> (-0.61%) ⬇️
simapp/test_helpers.go 14.72% <50.00%> (-0.66%) ⬇️
x/upgrade/keeper/keeper.go 84.73% <50.00%> (-0.54%) ⬇️
x/upgrade/module.go 70.58% <95.45%> (+2.50%) ⬆️
simapp/app.go 76.75% <100.00%> (+0.54%) ⬆️
testutil/network/network.go 56.67% <100.00%> (ø)
x/upgrade/client/testutil/suite.go 100.00% <100.00%> (ø)
x/upgrade/keeper/querier.go 0.00% <0.00%> (-2.95%) ⬇️
... and 2 more

@julienrbrt julienrbrt merged commit 91b1d83 into main Jun 22, 2022
@julienrbrt julienrbrt deleted the julien/upgrade-app-wiring branch June 22, 2022 11:05
larry0x pushed a commit to larry0x/cosmos-sdk that referenced this pull request May 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

migrate x/upgrade to use app wiring
2 participants