Skip to content

Commit

Permalink
docs: add documentation on default accept list in stargate wasm queri…
Browse files Browse the repository at this point in the history
…er (cosmos#5921)

* docs: add documentation on default accept list in stargate wasm querier

* fix: typos

* indentation and split lightclient in 2 words

---------

Co-authored-by: Carlos Rodriguez <[email protected]>
Co-authored-by: srdtrk <[email protected]>
  • Loading branch information
3 people authored Mar 5, 2024
1 parent deebc06 commit 3e42db3
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion docs/docs/03-light-clients/04-wasm/03-integration.md
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ Currently the only option available is the `WithQueryPlugins` option, which allo

#### `WithQueryPlugins`

By default, the `08-wasm` module does not support any queries. However, it is possible to register custom query plugins for [`QueryRequest::Custom`](https://github.com/CosmWasm/cosmwasm/blob/v1.5.0/packages/std/src/query/mod.rs#L45) and [`QueryRequest::Stargate`](https://github.com/CosmWasm/cosmwasm/blob/v1.5.0/packages/std/src/query/mod.rs#L54-L61).
By default, the `08-wasm` module does not configure any querier options for light client contracts. However, it is possible to register custom query plugins for [`QueryRequest::Custom`](https://github.com/CosmWasm/cosmwasm/blob/v1.5.0/packages/std/src/query/mod.rs#L45) and [`QueryRequest::Stargate`](https://github.com/CosmWasm/cosmwasm/blob/v1.5.0/packages/std/src/query/mod.rs#L54-L61).

Assuming that the keeper is not yet instantiated, the following sample code shows how to register query plugins for the `08-wasm` module.

Expand All @@ -279,6 +279,16 @@ queryPlugins := ibcwasmtypes.QueryPlugins {
}
```

Note that the `Stargate` querier appends the user defined accept list of query routes to a default list defined by the `08-wasm` module.
The `defaultAcceptList` defines a single query route: `"/ibc.core.client.v1.Query/VerifyMembership"`. This allows for light client smart contracts to delegate parts of their workflow to other light clients for auxiliary proof verification. For example, proof of inclusion of block and tx data by a data availability provider.

```go
// defaultAcceptList defines a set of default allowed queries made available to the Querier.
var defaultAcceptList = []string{
"/ibc.core.client.v1.Query/VerifyMembership",
}
```

You may leave any of the fields in the `QueryPlugins` object as `nil` if you do not want to register a query plugin for that query type.

Then, we pass the `QueryPlugins` object to the `WithQueryPlugins` option:
Expand Down

0 comments on commit 3e42db3

Please sign in to comment.