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

chore: use context.Context and appmodule.Environment in 08-wasm #7880

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

Conversation

technicallyty
Copy link
Collaborator

@technicallyty technicallyty commented Jan 24, 2025

Description

stacked PR of #7866

  • removes most usage of sdk.Context. I left some over in the querier file as they seem dependent on wasmd. Feel free to correct me if im wrong here, or if we have room to change this. I'm not sure how its used externally and do not want to catastrophically break things.

supercedes: #7836

Closes: #7712


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.

@technicallyty technicallyty marked this pull request as ready for review January 24, 2025 18:55
@technicallyty technicallyty changed the base branch from main to tyler/core-services January 24, 2025 18:59
@technicallyty technicallyty linked an issue Jan 24, 2025 that may be closed by this pull request
10 tasks
Base automatically changed from tyler/core-services to main January 25, 2025 17:35
Copy link
Contributor

@gjermundgaraba gjermundgaraba 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! This mostly looks good to me. Left a couple of comments and I also think we can safely change the sdk.Context uses in querier as well, as that is just a callback interface for wasmvm, so no wasmd usage there.


func moduleLogger(ctx sdk.Context) log.Logger {
return ctx.Logger().With("module", "x/"+exported.ModuleName+"-"+types.ModuleName)
func (k Keeper) Logger(_ context.Context) log.Logger {
Copy link
Contributor

Choose a reason for hiding this comment

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

Is the context still there due to some interface that needs to be satisifed?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

oops. i should have removed it. done in remove context argument from logger method

@technicallyty
Copy link
Collaborator Author

Thank you! This mostly looks good to me. Left a couple of comments and I also think we can safely change the sdk.Context uses in querier as well, as that is just a callback interface for wasmvm, so no wasmd usage there.

updated the queriers!

Copy link

Copy link
Contributor

@gjermundgaraba gjermundgaraba left a comment

Choose a reason for hiding this comment

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

Looking very good! I was wondering about the functions (BeginBlocker, etc) in Simapp, are they supposed to still be using sdk.Context?

@@ -146,7 +149,7 @@ func AcceptListStargateQuerier(acceptedQueries []string, queryRouter types.Query
return nil, wasmvmtypes.UnsupportedRequest{Kind: fmt.Sprintf("No route to query '%s'", request.Path)}
}

res, err := route(ctx, &abci.QueryRequest{
res, err := route(sdk.UnwrapSDKContext(ctx), &abci.QueryRequest{
Copy link
Contributor

Choose a reason for hiding this comment

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

Out of curiosity, why is GRPCQueryHandler still taking an sdk context?

@@ -99,7 +99,7 @@ func (ws *WasmSnapshotter) RestoreExtension(height uint64, format uint32, payloa
return errorsmod.Wrapf(snapshot.ErrUnknownFormat, "expected %d, got %d", ws.SnapshotFormat(), format)
}

func restoreV1(ctx sdk.Context, k *Keeper, compressedCode []byte) error {
func restoreV1(_ sdk.Context, k *Keeper, compressedCode []byte) error {
Copy link
Contributor

Choose a reason for hiding this comment

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

Could we remove the sdk.Context entierly here?

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.

Migrate to cosmos-sdk appmodule.Environment in ibc
2 participants