Merge pull request #213 from CosmWasm/fix-recursive-queries

fixed recursive queries losing context
This commit is contained in:
Ethan Frey 2020-07-22 17:22:51 +02:00 committed by GitHub
commit 04cfcdc1da
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 3 deletions

View File

@ -82,7 +82,7 @@ func NewKeeper(cdc *codec.Codec, storeKey sdk.StoreKey, paramSpace params.Subspa
authZPolicy: DefaultAuthorizationPolicy{}, authZPolicy: DefaultAuthorizationPolicy{},
paramSpace: paramSpace, paramSpace: paramSpace,
} }
keeper.queryPlugins = DefaultQueryPlugins(bankKeeper, stakingKeeper, keeper).Merge(customPlugins) keeper.queryPlugins = DefaultQueryPlugins(bankKeeper, stakingKeeper, &keeper).Merge(customPlugins)
return keeper return keeper
} }

View File

@ -46,7 +46,7 @@ type QueryPlugins struct {
Wasm func(ctx sdk.Context, request *wasmTypes.WasmQuery) ([]byte, error) Wasm func(ctx sdk.Context, request *wasmTypes.WasmQuery) ([]byte, error)
} }
func DefaultQueryPlugins(bank bank.ViewKeeper, staking staking.Keeper, wasm Keeper) QueryPlugins { func DefaultQueryPlugins(bank bank.ViewKeeper, staking staking.Keeper, wasm *Keeper) QueryPlugins {
return QueryPlugins{ return QueryPlugins{
Bank: BankQuerier(bank), Bank: BankQuerier(bank),
Custom: NoCustomQuerier, Custom: NoCustomQuerier,
@ -225,7 +225,7 @@ func sdkToFullDelegation(ctx sdk.Context, keeper staking.Keeper, delegation stak
}, nil }, nil
} }
func WasmQuerier(wasm Keeper) func(ctx sdk.Context, request *wasmTypes.WasmQuery) ([]byte, error) { func WasmQuerier(wasm *Keeper) func(ctx sdk.Context, request *wasmTypes.WasmQuery) ([]byte, error) {
return func(ctx sdk.Context, request *wasmTypes.WasmQuery) ([]byte, error) { return func(ctx sdk.Context, request *wasmTypes.WasmQuery) ([]byte, error) {
if request.Smart != nil { if request.Smart != nil {
addr, err := sdk.AccAddressFromBech32(request.Smart.ContractAddr) addr, err := sdk.AccAddressFromBech32(request.Smart.ContractAddr)