From f58f7ba57aeee2699d525fde80caafcd39a32941 Mon Sep 17 00:00:00 2001 From: loloicci Date: Mon, 26 Feb 2024 11:51:15 +0900 Subject: [PATCH 1/2] fix: disable custom querier --- x/wasm/keeper/query_plugins.go | 26 +------------------------- x/wasm/types/encoder.go | 22 ---------------------- 2 files changed, 1 insertion(+), 47 deletions(-) delete mode 100644 x/wasm/types/encoder.go diff --git a/x/wasm/keeper/query_plugins.go b/x/wasm/keeper/query_plugins.go index 2bb7f9282a..a30e1162b0 100644 --- a/x/wasm/keeper/query_plugins.go +++ b/x/wasm/keeper/query_plugins.go @@ -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(), @@ -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 { diff --git a/x/wasm/types/encoder.go b/x/wasm/types/encoder.go deleted file mode 100644 index 209cc7c1dc..0000000000 --- a/x/wasm/types/encoder.go +++ /dev/null @@ -1,22 +0,0 @@ -package types - -import ( - "encoding/json" -) - -type EncodingModule string - -const ( - TokenM = EncodingModule("token") - CollectionM = EncodingModule("collection") -) - -type LinkMsgWrapper struct { - Module string `json:"module"` - MsgData json.RawMessage `json:"msg_data"` -} - -type LinkQueryWrapper struct { - Path string `json:"path"` - Data []byte `json:"data"` -} From 7d290199e19b4e611c04f9f40f8752d76fa42e5b Mon Sep 17 00:00:00 2001 From: loloicci Date: Mon, 26 Feb 2024 18:33:08 +0900 Subject: [PATCH 2/2] docs: add this PR to CHANGELOG --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index b7ffb0c1cd..f9123ab7c9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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