Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wasm based light clients #208

Closed
wants to merge 11 commits into from
119 changes: 20 additions & 99 deletions docs/ibc/proto-docs.md
Original file line number Diff line number Diff line change
Expand Up @@ -192,20 +192,15 @@
- [ibc/core/types/v1/genesis.proto](#ibc/core/types/v1/genesis.proto)
- [GenesisState](#ibc.core.types.v1.GenesisState)

- [ibc/core/wasm/v1/wasm.proto](#ibc/core/wasm/v1/wasm.proto)
- [WasmCodeEntry](#ibc.core.wasm.v1.WasmCodeEntry)

- [ibc/core/wasm/v1/query.proto](#ibc/core/wasm/v1/query.proto)
- [LatestWASMCodeEntryQuery](#ibc.core.wasm.v1.LatestWASMCodeEntryQuery)
- [LatestWASMCodeEntryResponse](#ibc.core.wasm.v1.LatestWASMCodeEntryResponse)
- [LatestWASMCodeQuery](#ibc.core.wasm.v1.LatestWASMCodeQuery)
- [LatestWASMCodeResponse](#ibc.core.wasm.v1.LatestWASMCodeResponse)
- [WasmCodeQuery](#ibc.core.wasm.v1.WasmCodeQuery)
- [WasmCodeResponse](#ibc.core.wasm.v1.WasmCodeResponse)

- [Query](#ibc.core.wasm.v1.Query)

- [ibc/core/wasm/v1/tx.proto](#ibc/core/wasm/v1/tx.proto)
- [MsgPushNewWASMCode](#ibc.core.wasm.v1.MsgPushNewWASMCode)
- [MsgPushNewWASMCodeResponse](#ibc.core.wasm.v1.MsgPushNewWASMCodeResponse)
- [MsgPushNewWasmCode](#ibc.core.wasm.v1.MsgPushNewWasmCode)
- [MsgPushNewWasmCodeResponse](#ibc.core.wasm.v1.MsgPushNewWasmCodeResponse)

- [Msg](#ibc.core.wasm.v1.Msg)

Expand Down Expand Up @@ -2903,40 +2898,6 @@ GenesisState defines the ibc module's genesis state.



<!-- end messages -->

<!-- end enums -->

<!-- end HasExtensions -->

<!-- end services -->



<a name="ibc/core/wasm/v1/wasm.proto"></a>
<p align="right"><a href="#top">Top</a></p>

## ibc/core/wasm/v1/wasm.proto



<a name="ibc.core.wasm.v1.WasmCodeEntry"></a>

### WasmCodeEntry
WASM code entry that allows keeper to traverse
the doubly linked list


| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `code_id` | [bytes](#bytes) | | |
| `previous_code_hash` | [string](#string) | | |
| `next_code_hash` | [string](#string) | | |





<!-- end messages -->

<!-- end enums -->
Expand All @@ -2954,56 +2915,25 @@ the doubly linked list



<a name="ibc.core.wasm.v1.LatestWASMCodeEntryQuery"></a>

### LatestWASMCodeEntryQuery
Latest wasm code entry query


| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `client_type` | [string](#string) | | |






<a name="ibc.core.wasm.v1.LatestWASMCodeEntryResponse"></a>
<a name="ibc.core.wasm.v1.WasmCodeQuery"></a>

### LatestWASMCodeEntryResponse
Latest wasm code entry response
### WasmCodeQuery
WasmCode query


| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `code_id` | [string](#string) | | |
| `entry` | [WasmCodeEntry](#ibc.core.wasm.v1.WasmCodeEntry) | | |






<a name="ibc.core.wasm.v1.LatestWASMCodeQuery"></a>
<a name="ibc.core.wasm.v1.WasmCodeResponse"></a>

### LatestWASMCodeQuery
Latest wasm code query


| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `client_type` | [string](#string) | | |






<a name="ibc.core.wasm.v1.LatestWASMCodeResponse"></a>

### LatestWASMCodeResponse
Latest wasm code response
### WasmCodeResponse
WasmCode response


| Field | Type | Label | Description |
Expand All @@ -3028,8 +2958,7 @@ Query service for wasm module

| Method Name | Request Type | Response Type | Description | HTTP Verb | Endpoint |
| ----------- | ------------ | ------------- | ------------| ------- | -------- |
| `LatestWASMCode` | [LatestWASMCodeQuery](#ibc.core.wasm.v1.LatestWASMCodeQuery) | [LatestWASMCodeResponse](#ibc.core.wasm.v1.LatestWASMCodeResponse) | Query to get latest wasm code for particular client type. | GET|/ibc/core/wasm/v1beta1/latest_wasm_code/{client_type}|
| `LatestWASMCodeEntry` | [LatestWASMCodeEntryQuery](#ibc.core.wasm.v1.LatestWASMCodeEntryQuery) | [LatestWASMCodeEntryResponse](#ibc.core.wasm.v1.LatestWASMCodeEntryResponse) | Query for get latest wasm code entry for particular client type | GET|/ibc/core/wasm/v1beta1/latest_wasm_code_entry/{client_type}|
| `WasmCode` | [WasmCodeQuery](#ibc.core.wasm.v1.WasmCodeQuery) | [WasmCodeResponse](#ibc.core.wasm.v1.WasmCodeResponse) | Get Wasm code for given code id | GET|/ibc/core/wasm/v1beta1/code/{code_id}|

<!-- end services -->

Expand All @@ -3042,33 +2971,31 @@ Query service for wasm module



<a name="ibc.core.wasm.v1.MsgPushNewWASMCode"></a>
<a name="ibc.core.wasm.v1.MsgPushNewWasmCode"></a>

### MsgPushNewWASMCode
### MsgPushNewWasmCode
Message type to push new wasm code


| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `signer` | [string](#string) | | |
| `client_type` | [string](#string) | | |
| `code` | [bytes](#bytes) | | |






<a name="ibc.core.wasm.v1.MsgPushNewWASMCodeResponse"></a>
<a name="ibc.core.wasm.v1.MsgPushNewWasmCodeResponse"></a>

### MsgPushNewWASMCodeResponse
### MsgPushNewWasmCodeResponse
Response in case of successful handling


| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `code_id` | [bytes](#bytes) | | |
| `code_hash` | [string](#string) | | |



Expand All @@ -3088,7 +3015,7 @@ Msg defines the ibc/wasm Msg service.

| Method Name | Request Type | Response Type | Description | HTTP Verb | Endpoint |
| ----------- | ------------ | ------------- | ------------| ------- | -------- |
| `PushNewWASMCode` | [MsgPushNewWASMCode](#ibc.core.wasm.v1.MsgPushNewWASMCode) | [MsgPushNewWASMCodeResponse](#ibc.core.wasm.v1.MsgPushNewWASMCodeResponse) | PushNewWASMCode defines a rpc handler method for PushNewWASMCode. | |
| `PushNewWasmCode` | [MsgPushNewWasmCode](#ibc.core.wasm.v1.MsgPushNewWasmCode) | [MsgPushNewWasmCodeResponse](#ibc.core.wasm.v1.MsgPushNewWasmCodeResponse) | PushNewWasmCode defines a rpc handler method for PushNewWasmCode. | |

<!-- end services -->

Expand Down Expand Up @@ -3578,17 +3505,14 @@ that implements Misbehaviour interface expected by ICS-02
<a name="ibc.lightclients.wasm.v1.ClientState"></a>

### ClientState
WASM light client's Client state
Wasm light client's Client state


| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `data` | [bytes](#bytes) | | |
| `code_id` | [bytes](#bytes) | | |
| `frozen` | [bool](#bool) | | |
| `frozen_height` | [ibc.core.client.v1.Height](#ibc.core.client.v1.Height) | | |
| `latest_height` | [ibc.core.client.v1.Height](#ibc.core.client.v1.Height) | | |
| `type` | [string](#string) | | |
| `proof_specs` | [ics23.ProofSpec](#ics23.ProofSpec) | repeated | |


Expand All @@ -3599,7 +3523,7 @@ WASM light client's Client state
<a name="ibc.lightclients.wasm.v1.ConsensusState"></a>

### ConsensusState
WASM light client's ConsensusState
Wasm light client's ConsensusState


| Field | Type | Label | Description |
Expand All @@ -3608,7 +3532,6 @@ WASM light client's ConsensusState
| `code_id` | [bytes](#bytes) | | |
| `timestamp` | [uint64](#uint64) | | timestamp that corresponds to the block height in which the ConsensusState was stored. |
| `root` | [ibc.core.commitment.v1.MerkleRoot](#ibc.core.commitment.v1.MerkleRoot) | | commitment root (i.e app hash) |
| `type` | [string](#string) | | |



Expand All @@ -3618,14 +3541,13 @@ WASM light client's ConsensusState
<a name="ibc.lightclients.wasm.v1.Header"></a>

### Header
WASM light client Header
Wasm light client Header


| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `data` | [bytes](#bytes) | | |
| `height` | [ibc.core.client.v1.Height](#ibc.core.client.v1.Height) | | |
| `type` | [string](#string) | | |



Expand All @@ -3635,12 +3557,11 @@ WASM light client Header
<a name="ibc.lightclients.wasm.v1.Misbehaviour"></a>

### Misbehaviour
WASM light client Misbehaviour
Wasm light client Misbehaviour


| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `code_id` | [bytes](#bytes) | | |
| `client_id` | [string](#string) | | |
| `header_1` | [Header](#ibc.lightclients.wasm.v1.Header) | | |
| `header_2` | [Header](#ibc.lightclients.wasm.v1.Header) | | |
Expand Down
9 changes: 1 addition & 8 deletions modules/core/02-client/keeper/params.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,9 @@ func (k Keeper) GetAllowedClients(ctx sdk.Context) []string {
return res
}

// GetParams returns the total set of ibc-client parameters.
func (k Keeper) GetWasmClientsEnabled(ctx sdk.Context) bool {
var res bool
k.paramSpace.Get(ctx, types.KeyWasmClientsEnabled, &res)
return res
}

// GetParams returns the total set of ibc-client parameters.
func (k Keeper) GetParams(ctx sdk.Context) types.Params {
return types.NewParams(k.GetWasmClientsEnabled(ctx), k.GetAllowedClients(ctx)...)
return types.NewParams(k.GetAllowedClients(ctx)...)
}

// SetParams sets the total set of ibc-client parameters.
Expand Down
2 changes: 2 additions & 0 deletions modules/core/02-client/types/events.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ const (
AttributeKeyClientType = "client_type"
AttributeKeyConsensusHeight = "consensus_height"
AttributeKeyHeader = "header"
AttributeKeyWasmCodeID = "wasm_code_id"
)

// IBC client events vars
Expand All @@ -22,6 +23,7 @@ var (
EventTypeUpgradeClient = "upgrade_client"
EventTypeSubmitMisbehaviour = "client_misbehaviour"
EventTypeUpdateClientProposal = "update_client_proposal"
EventTypePushWasmCode = "push_wasm_code"

AttributeValueCategory = fmt.Sprintf("%s_%s", host.ModuleName, SubModuleName)
)
Loading