Skip to content

Commit

Permalink
fix: disable custom querier (#118)
Browse files Browse the repository at this point in the history
* fix: disable custom querier

* docs: add this PR to CHANGELOG
  • Loading branch information
loloicci authored Feb 26, 2024
1 parent 0b88522 commit bf97dea
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 47 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
### Bug Fixes

### Breaking Changes
* [\#118](https://github.com/Finschia/wasmd/pull/118) disable custom query
* [\#117](https://github.com/Finschia/wasmd/pull/117) version-up depending wasmvm to v1.1.1-0.12.0

### Build, CI
Expand Down
26 changes: 1 addition & 25 deletions x/wasm/keeper/query_plugins.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ func DefaultQueryPlugins(
) QueryPlugins {
return QueryPlugins{
Bank: BankQuerier(bank),
Custom: CustomQuerierImpl(queryRouter),
Custom: NoCustomQuerier,
IBC: IBCQuerier(wasm, channelKeeper),
Staking: StakingQuerier(staking, distKeeper),
Stargate: RejectStargateQuerier(),
Expand Down Expand Up @@ -209,30 +209,6 @@ func NoCustomQuerier(sdk.Context, json.RawMessage) ([]byte, error) {
return nil, wasmvmtypes.UnsupportedRequest{Kind: "custom"}
}

func CustomQuerierImpl(queryRouter GRPCQueryRouter) func(ctx sdk.Context, querierJson json.RawMessage) ([]byte, error) {
return func(ctx sdk.Context, querierJson json.RawMessage) ([]byte, error) {
var linkQueryWrapper types.LinkQueryWrapper
err := json.Unmarshal(querierJson, &linkQueryWrapper)
if err != nil {
return nil, err
}
route := queryRouter.Route(linkQueryWrapper.Path)
if route == nil {
return nil, wasmvmtypes.UnsupportedRequest{Kind: "Unknown encode module"}
}
req := abci.RequestQuery{
Data: linkQueryWrapper.Data,
Path: linkQueryWrapper.Path,
}
res, err := route(ctx, req)
if err != nil {
return nil, err
}

return res.Value, nil
}
}

func IBCQuerier(wasm contractMetaDataSource, channelKeeper types.ChannelKeeper) func(ctx sdk.Context, caller sdk.AccAddress, request *wasmvmtypes.IBCQuery) ([]byte, error) {
return func(ctx sdk.Context, caller sdk.AccAddress, request *wasmvmtypes.IBCQuery) ([]byte, error) {
if request.PortID != nil {
Expand Down
22 changes: 0 additions & 22 deletions x/wasm/types/encoder.go

This file was deleted.

0 comments on commit bf97dea

Please sign in to comment.