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(simapp): move simapp binary into its own go.mod #6710

Merged

Conversation

gjermundgaraba
Copy link
Contributor

@gjermundgaraba gjermundgaraba commented Jun 26, 2024

Description

closes: #3968


Before we can merge this PR, please make sure that all the following items have been
checked off. If any of the checklist items are not applicable, please leave them but
write a little note why.

  • Targeted PR against the correct branch (see CONTRIBUTING.md).
  • Linked to GitHub issue with discussion and accepted design, OR link to spec that describes this work.
  • Code follows the module structure standards and Go style guide.
  • Wrote unit and integration tests.
  • Updated relevant documentation (docs/).
  • Added relevant godoc comments.
  • Provide a conventional commit message to follow the repository standards.
  • Include a descriptive changelog entry when appropriate. This may be left to the discretion of the PR reviewers. (e.g. chores should be omitted from changelog)
  • Re-reviewed Files changed in the GitHub PR explorer.
  • Review SonarCloud Report in the comment section below once CI passes.

@gjermundgaraba gjermundgaraba linked an issue Jun 26, 2024 that may be closed by this pull request
3 tasks
// SDK module keepers

// add keepers
app.AccountKeeper = authkeeper.NewAccountKeeper(appCodec, runtime.NewKVStoreService(keys[authtypes.StoreKey]), authtypes.ProtoBaseAccount, maccPerms, authcodec.NewBech32Codec(sdk.Bech32MainPrefix), sdk.Bech32MainPrefix, authtypes.NewModuleAddress(govtypes.ModuleName).String())

Check warning

Code scanning / CodeQL

Directly using the bech32 constants Warning

Directly using the bech32 constants instead of the configuration values
// SDK module keepers

// add keepers
app.AccountKeeper = authkeeper.NewAccountKeeper(appCodec, runtime.NewKVStoreService(keys[authtypes.StoreKey]), authtypes.ProtoBaseAccount, maccPerms, authcodec.NewBech32Codec(sdk.Bech32MainPrefix), sdk.Bech32MainPrefix, authtypes.NewModuleAddress(govtypes.ModuleName).String())

Check warning

Code scanning / CodeQL

Directly using the bech32 constants Warning

Directly using the bech32 constants instead of the configuration values
logger,
)
app.StakingKeeper = stakingkeeper.NewKeeper(
appCodec, runtime.NewKVStoreService(keys[stakingtypes.StoreKey]), app.AccountKeeper, app.BankKeeper, authtypes.NewModuleAddress(govtypes.ModuleName).String(), authcodec.NewBech32Codec(sdk.Bech32PrefixValAddr), authcodec.NewBech32Codec(sdk.Bech32PrefixConsAddr),

Check warning

Code scanning / CodeQL

Directly using the bech32 constants Warning

Directly using the bech32 constants instead of the configuration values
logger,
)
app.StakingKeeper = stakingkeeper.NewKeeper(
appCodec, runtime.NewKVStoreService(keys[stakingtypes.StoreKey]), app.AccountKeeper, app.BankKeeper, authtypes.NewModuleAddress(govtypes.ModuleName).String(), authcodec.NewBech32Codec(sdk.Bech32PrefixValAddr), authcodec.NewBech32Codec(sdk.Bech32PrefixConsAddr),

Check warning

Code scanning / CodeQL

Directly using the bech32 constants Warning

Directly using the bech32 constants instead of the configuration values
@colin-axner colin-axner self-assigned this Jul 1, 2024
Comment on lines -15 to -18
cosmossdk.io/tools/confix v0.1.1
cosmossdk.io/x/circuit v0.1.1
cosmossdk.io/x/evidence v0.1.1
cosmossdk.io/x/feegrant v0.1.1
Copy link
Contributor

Choose a reason for hiding this comment

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

wahooo!!! 🎉

simapp/test_helpers.go Outdated Show resolved Hide resolved
simapp/upgrades/upgrades.go Outdated Show resolved Hide resolved
testing/simapp/upgrades.go Outdated Show resolved Hide resolved
@colin-axner
Copy link
Contributor

I will push some changes

@colin-axner colin-axner marked this pull request as draft July 3, 2024 09:47
mockModule,

// IBC light clients
ibctm.NewAppModule(tmLightClientModule),
Copy link
Contributor

@colin-axner colin-axner Jul 3, 2024

Choose a reason for hiding this comment

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

we should add wasm/callbacks to this go.mod? Maybe we can do in a followup?

Copy link
Member

Choose a reason for hiding this comment

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

sounds fine to me!

Copy link
Contributor

Choose a reason for hiding this comment

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

removed any files which had unused logic. We can add back as necessary

@colin-axner colin-axner marked this pull request as ready for review July 3, 2024 14:36
@colin-axner
Copy link
Contributor

I pruned anything that stood out as unused. Now, ibc-go/simapp is where we should built our binaries, and we can import any of our go modules. The ibc-go/testing/simapp should only be used for unit tests and cannot import any go modules not in ibc-go.

In a followup, it would be great if we could add wasm/callbacks into the ibc-go/simapp and then we can remove the redundant files related to binary creation in those modules (would also drop deps in those modules)

@colin-axner colin-axner added the priority PRs that need prompt reviews label Jul 3, 2024
Comment on lines -19 to -38
app.UpgradeKeeper.SetUpgradeHandler(
upgrades.V5,
upgrades.CreateDefaultUpgradeHandler(app.ModuleManager, app.configurator),
)

// NOTE: The moduleName arg of v6.CreateUpgradeHandler refers to the auth module ScopedKeeper name to which the channel capability should be migrated from.
// This should be the same string value provided upon instantiation of the ScopedKeeper with app.CapabilityKeeper.ScopeToModule()
// See: https://github.com/cosmos/ibc-go/blob/v6.1.0/testing/simapp/app.go#L310
app.UpgradeKeeper.SetUpgradeHandler(
upgrades.V6,
upgrades.CreateV6UpgradeHandler(
app.ModuleManager,
app.configurator,
app.appCodec,
app.keys[capabilitytypes.ModuleName],
app.CapabilityKeeper,
ibcmock.ModuleName+icacontrollertypes.SubModuleName,
),
)

Copy link
Contributor

Choose a reason for hiding this comment

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

removed as we don't run these in e2e's any longer

Copy link
Contributor Author

@gjermundgaraba gjermundgaraba Jul 8, 2024

Choose a reason for hiding this comment

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

Oh nice! It is much neater now with all the pruning you've done 🙏

Copy link
Member

@damiannolan damiannolan left a comment

Choose a reason for hiding this comment

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

Happy to move forward with this and see how we can work things out.

My main concern is around building "release" images and dealing with pinned go modules in the new simapp mod.

mockModule,

// IBC light clients
ibctm.NewAppModule(tmLightClientModule),
Copy link
Member

Choose a reason for hiding this comment

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

sounds fine to me!

Comment on lines +7 to +10
replace (
github.com/cosmos/ibc-go/modules/capability => ../modules/capability
github.com/cosmos/ibc-go/v8 => ../
)
Copy link
Member

@damiannolan damiannolan Jul 8, 2024

Choose a reason for hiding this comment

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

I'm not sure how this is going to work with compatibility tests. I think this is fine for PR e2e tests etc.

It could become messy if we are building images with the latest of each library etc..
Is the plan to pin these to specific releases when building an actual simapp version image?
e.g. ibc-go-simd:v9.0.0

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I just assumed that was what we were already doing?

Copy link
Contributor

Choose a reason for hiding this comment

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

with the compatibility tests we are basically just using the regular simd image I believe. Not using the wasm/callbacks binaries.

I think this is what we are actually already doing, it's not ideal but I think until it becomes an actual problem it is okay to leave as is

Copy link
Contributor

Choose a reason for hiding this comment

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

So they idea will be that we tag a new release of this module with every ibc-go major (and minor?) release?

Copy link
Member

Choose a reason for hiding this comment

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

I don't think we need to tag or release the simapp go mod via github, but having a docker image built and pushed would be a good idea!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Don't we already do that (we tag the image on release, no)? Maybe I am missing something, but since we use replace in go.mod, I am not sure why this would be any different from what we have today?

Copy link
Contributor

Choose a reason for hiding this comment

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

we build and push an image for every tag of ibc-go

publish-docker-image:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Log in to the Container registry
uses: docker/login-action@e92390c5fb421da1463c202d546fed0ec5c39f20
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@8e5442c4ef9f78752691e2d8f8d19755c6f78e81
with:
images: ${{ env.REGISTRY }}/cosmos/${{ env.IMAGE_NAME }}
- name: Build and push Docker image
uses: docker/build-push-action@2cdde995de11925a030ce8070c3d77a52ffcf1c0
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
build-args: |
IBC_GO_VERSION=${{ github.ref_name }}

It should be no different, but I think the changes have flagged some concerns about possible compatibility issues (nothing new though you're right)

Copy link
Contributor

@chatton chatton left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks for doing this cleanup.

I also noticed that the e2e go mod changes with a go mod tidy on this PR, guess some indirect dependencies are no longer required there. I think we can run go mod tidy in the e2e dir and commit the changes.

Comment on lines +7 to +10
replace (
github.com/cosmos/ibc-go/modules/capability => ../modules/capability
github.com/cosmos/ibc-go/v8 => ../
)
Copy link
Contributor

Choose a reason for hiding this comment

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

with the compatibility tests we are basically just using the regular simd image I believe. Not using the wasm/callbacks binaries.

I think this is what we are actually already doing, it's not ideal but I think until it becomes an actual problem it is okay to leave as is

@@ -9,7 +9,7 @@ COMMIT := $(shell git log -1 --format='%H')
LEDGER_ENABLED ?= true
BINDIR ?= $(GOPATH)/bin
BUILDDIR ?= $(CURDIR)/build
SIMAPP = ./testing/simapp
SIMAPP = ./simapp
Copy link
Contributor

Choose a reason for hiding this comment

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

love how few changes are needed here!

@@ -17,15 +17,6 @@ import (
"cosmossdk.io/core/appmodule"
Copy link
Contributor

Choose a reason for hiding this comment

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

can we delete this app now?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We still use it for the integration tests, I guess?

Copy link
Contributor

Choose a reason for hiding this comment

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

ah, I guess this means we will need to keep it around so we don't have ibc-go importing from the simapp 🤔 ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, I think so. It has been trimmed down, but need this still.

Copy link
Contributor

@crodriguezvega crodriguezvega left a comment

Choose a reason for hiding this comment

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

Thank you @gjermundgaraba and @colin-axner!

@@ -0,0 +1,47 @@
# simapp
Copy link
Contributor

Choose a reason for hiding this comment

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

I will go through this document and open a PR if it needs to be updated.

Comment on lines +7 to +10
replace (
github.com/cosmos/ibc-go/modules/capability => ../modules/capability
github.com/cosmos/ibc-go/v8 => ../
)
Copy link
Contributor

Choose a reason for hiding this comment

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

So they idea will be that we tag a new release of this module with every ibc-go major (and minor?) release?

@chatton
Copy link
Contributor

chatton commented Jul 8, 2024

LGTM! Thanks for doing this cleanup.

I also noticed that the e2e go mod changes with a go mod tidy on this PR, guess some indirect dependencies are no longer required there. I think we can run go mod tidy in the e2e dir and commit the changes.

might be the reason from some e2e build failures also

Copy link

sonarcloud bot commented Jul 9, 2024

@gjermundgaraba gjermundgaraba added this pull request to the merge queue Jul 9, 2024
Merged via the queue into main with commit 6bc5e8f Jul 9, 2024
32 checks passed
@gjermundgaraba gjermundgaraba deleted the gjermund/3968-move-simapp-binary-into-own-gomod-or-e2e branch July 9, 2024 12:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority PRs that need prompt reviews
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Move simapp binary into own go.mod or e2e
6 participants