-
Notifications
You must be signed in to change notification settings - Fork 646
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
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this 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 { |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
updated the queriers! |
There was a problem hiding this 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{ |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so this uses the baseapp query handler directly, which still takes sdk.Context. I did try to update it to use the Environment
's query handler however,
the Environment query handler returns a transaction.Msg
, (a gogoproto message type) instead of bytes, which would change the custom query return type, unless i marshalled the msg but.... i don't actually know what the encoding is for those bytes returned from the baseapp version. i assume its proto encoded, but im not 100% on that. :C
@@ -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 { |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah yes, removed here remove sdk.Context and height args from WasmSnapshotter functionality.
note this also ended up removing an unused height
argument, changing the RestoreExtension
method signature
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nvm, just removing context 😅, not height arg. restore height arg because thats an iface impl
Quality Gate failed for 'ibc-go'Failed conditions |
Description
stacked PR of #7866
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.
docs/
).godoc
comments.Files changed
in the GitHub PR explorer.SonarCloud Report
in the comment section below once CI passes.