diff --git a/baseapp/baseapp.go b/baseapp/baseapp.go index c4f326b08..5ac7be1b5 100644 --- a/baseapp/baseapp.go +++ b/baseapp/baseapp.go @@ -201,12 +201,12 @@ func (app *BaseApp) InitChain(req abci.RequestInitChain) (res abci.ResponseInitC // Implements ABCI. // Delegates to CommitMultiStore if it implements Queryable func (app *BaseApp) Query(req abci.RequestQuery) (res abci.ResponseQuery) { - query, ok := app.cms.(sdk.Queryable) + queryable, ok := app.cms.(sdk.Queryable) if !ok { msg := "application doesn't support queries" return sdk.ErrUnknownRequest(msg).Result().ToQuery() } - return query.Query(req) + return queryable.Query(req) } // Implements ABCI. diff --git a/store/rootmultistore.go b/store/rootmultistore.go index 4b0ad4375..dd6361ea1 100644 --- a/store/rootmultistore.go +++ b/store/rootmultistore.go @@ -191,6 +191,10 @@ func (rs *rootMultiStore) getStoreByName(name string) Store { //---------------------- Query ------------------ +// Query calls substore.Query with the same `req` where `req.Path` is +// modified to remove the substore prefix. +// Ie. `req.Path` here is `//`, and trimmed to `/` for the substore. +// TODO: add proof for `multistore -> substore`. func (rs *rootMultiStore) Query(req abci.RequestQuery) abci.ResponseQuery { // Query just routes this to a substore. path := req.Path @@ -204,7 +208,7 @@ func (rs *rootMultiStore) Query(req abci.RequestQuery) abci.ResponseQuery { msg := fmt.Sprintf("no such store: %s", storeName) return sdk.ErrUnknownRequest(msg).Result().ToQuery() } - query, ok := store.(Queryable) + queryable, ok := store.(Queryable) if !ok { msg := fmt.Sprintf("store %s doesn't support queries", storeName) return sdk.ErrUnknownRequest(msg).Result().ToQuery() @@ -212,10 +216,7 @@ func (rs *rootMultiStore) Query(req abci.RequestQuery) abci.ResponseQuery { // trim the path and make the query req.Path = subpath - res := query.Query(req) - - // Note: later we have to think about adding information about - // the multistore -> store path to the proof + res := queryable.Query(req) return res }