Skip to content

Commit

Permalink
refactor!: decouple client routing from encoding (#5806)
Browse files Browse the repository at this point in the history
* refactor: add initial light client module interface

* wip: add boiler plate light client module for tendermint client

* feat: adding initial light client module impl for 06-solomachine

* chore: adding LightClientModule interface assertion for 06-solomachine

* chore: adding initial boiilerplate for 08-wasm mod

* refactor: add boilerplate tendermint light client module

* refactor: add localhost boilerplate code

* imp: add basic 02-client router

* refactor: use light client module for client status

* chore: move solomachine keeper to internal

* chore: adding GetTimestampAtHeight to clientkeeper using 02-client router

* refactor: rm GetTimestampAtHeight from 03-connection and adapt api calls in 04-channel

* chore: wire up solomachine module with clientRouter in app.go

* chore: move commented out test to client keeper - still has todo to uncomment and fix

* chore: add solomachine client module to AppModule constructor and wire up in app.go

* fix: use correct route for client status lookup

* chore: add clientRouter to 08-wasm simapp and wire up

* fix: solo machine unmarshal bug and 02-client keeper tests

* test: fix GetTimestampAtHeight test in clientkeeper

* refactor(solomachine): add getClientState helper and unmarhsal interface

* refactor: align 08-wasm, add GetClientState helper and unmarshal interface

* fix(temp): temporarily add WithStoreKey opt to wasmkeeper to fix failing tests

* fix: wire up callbacks simapp to fix failing tests

* refactor: modify UpdateClient handler to use light client module api

* feat: add ClientStoreProvider interface for isolated prefix stores (#5781)

* refactor: rm internal/keeper from solomachine

* refactor: begin removing stale client state interfaces

* feat: wire up localhost

* fix: tests in 06-solomachine and 07-tendermint

* fix: rest of tests

* refactor: use light client module APIs in 03-connection state verify

* chore: adapt remaining handlers to use light client module api in 03-connection

* fix: locahost verify membership and non membership in light client module

* refactor: remove VerifyMembership and VerifyNonMembership from client state interface

* fix: rm getters for clientID from connection (conflict)

* 02-client routing: fix linter warnings (#5818)

* 02-client routing: fix linter warnings

* fix variable name

* return error

* 02-client routing: pass client ID to get route instead of client type (#5817)

* pass client ID to get route instead of client type

* rename variable

* Update modules/core/02-client/keeper/keeper.go

---------

Co-authored-by: Damian Nolan <[email protected]>

* use localhost client ID

* 02-client routing: function in store provider to return client store (#5824)

* add function to return 02-client module store

* review comment

* 02-client routing: implement `RecoverClient` in light client modules (#5822)

* implement recover client in light client modules

* add tests for wasm light client module recover client function

* missing file

* add tests for tendermint light client module recover client

* add tests for solomachine light client module recover client

* clean up 02-client recover client test cases

* fix test

* fix linter warning

* format client IDs

* fixes from merge of main

* 02-client routing: remove client ID validation (#5897)

* chore: remove client ID validation in light client module functions

* add contract documentation

* Update light_client_module.go

* 02-client routing: add godoc to `LightClientModule` functions (#5900)

* add godoc for light client module functions

* linter

* fix localhost client ID in godoc

* docs: add removal of `ClientState` interface functions to migration docs (#5943)

* docs: add removal of client state functions to migration docs

* test formating

* add comment about tendermint light client module implementation

* Apply suggestions from code review

Co-authored-by: colin axnér <[email protected]>

* mention removal of ZeroCustomFields

* Update docs/docs/05-migrations/13-v8-to-v9.md

Co-authored-by: DimitrisJim <[email protected]>

---------

Co-authored-by: colin axnér <[email protected]>
Co-authored-by: DimitrisJim <[email protected]>

* 02-client routing: remove `GetLatestHeight` from `ClientState` interface and add it to `LightClientModule` (#5866)

* wip: remove GetLatestHeight from ClientState interface and add it to light client module

* chore: add godoc for GetLatestHeight in 02-client keeper

* chore: add args to event emission funcs in 02-client

* chore: add args to usage in 02-client event emissions

* chore: put back logging in upgrade client

* chore: deprecate and refactor 04-channel client utils QueryLatestConsensusState func

* chore: rename lightClientModule to clientModule in core

* chore: undo faulty renames

* fix: godoc for LatestHeight

* chore: add godocs

* chore: readding sequence checking in solomachine RecoverClient

* fix: testing chain helper to use keeper getter for latest height

* chore: fix compilation errors in tests

* fix: import ordering waaah

* imp: adding GetClientLatestHeight to testing endpoint/chain

* test: cleanup test funcs with path.Endpoint.GetClientLatestHeight

* test: cleanup tests in 04-channel to use path.Endpoint.GetClientLatestHeight

* test: cleanup ante_test

* chore: add godocs for light client modules LatestHeight method

* chore: update endpoint.go to use the new GetClientLatestHeight helper fn

* test: usage of path.Endpoint.GetClientLatestHeight in core/keeper and 07-tendermint tests

* test: another one

* chore: rm GetLatestHeight from solomachine ClientState

* test: update QueryConsensusStateProof in testing lib to use test helper

* Update testing/chain.go

* fix typo in variable name

* chore: consolidate two calls to LatestHeight to initialHeight var on createClient

* chore: extract to latestHeight var in VerifyUpgradeAndUpdateState to reduce disk reads

* chore: rm greater than or equal height check in solomachine as already done in 02-client

* chore: address todo on GetLatestHeight in 02-client keeper

---------

Co-authored-by: Damian Nolan <[email protected]>
Co-authored-by: chatton <[email protected]>

* docs: refactor light client developer guide

* imp: cleanup godoc on router type

* 02-client routing: implement `VerifyUpgradeAndUpdateState` in light client modules (#5827)

* wip: implementation and tests for verify upgrade and update state function in light client modules

* add test case

* fix un-marshaling in tendermint light client module

* add tests for verify upgrade and update state of 08-wasm light client module

* fix linter warnings

* check client state post upgrade

* fix: encoding issue: unmarshal to concrete types and not interfaces in 07-tendermint

* fix import

* cast type before calling zero custom fields

* test: marshal concrete types using chain codec for upgrade tests which bypass msg server entrypoint

* chore: remove basic validation of lc types in tm VerifyUpgradeAndUpdateState

* marshal to concrete type in tests

* keep client/consensus state as interface marshalled

* Apply suggestions from code review

Co-authored-by: colin axnér <[email protected]>

* chore: make lint-fix

* chore: rm redundant test, tested in lightclient module

* fix: remove marshalling of anys to bytes for verify upgrade (#5967)

* fix: remove marshalling of anys to bytes for verify upgrade

* test: refactor 02-client tests for verify upgrade

* test: fix tests in 07-tenderint client module

* chore: rm backwards compatability notice and marshalling of anys in core msg server

* test: cleanup happy path assertions in 07-tendermint verify upgrade test

* nit: update inline code commentin test

* doc: update godoc of UpgradeClient handler in core ibc

* lint: make lint-fix

* nit: inline comments in tests last Height -> upgrade height

* fix: address 08-wasm upgrade client and tests

---------

Co-authored-by: Damian Nolan <[email protected]>
Co-authored-by: colin axnér <[email protected]>

* nit: lcm -> l for all light client modules

* remove unnecessary comment

* chore: remove unnecessary todo's

* chore: lint fix docs

* Apply suggestions from code review

* chore: 02-client handler godoc

* Update modules/core/02-client/keeper/client.go

* Update modules/light-clients/06-solomachine/light_client_module_test.go

* remove commented out code in msg server

* chore: update godoc, remove todo's

* chore: remove unnecessary func from localhost + cleanup

* Apply suggestions from code review

* Update docs/docs/03-light-clients/01-developer-guide/01-overview.md

Co-authored-by: DimitrisJim <[email protected]>

* chore: remove todo + deprecation notice

* chore: fix broken link

* chore: godoc for exported client.go file

* chore: test update

* chore: godoc

* chore: update godoc in 06-solomachine light client module

* chore: update 07-tendermint light client module godoc

* chore: update localhost client module godocs

* chore: update 08-wasm light client module godoc

* fix: broken link

* fix(e2e): correctly assign trusted height and latest height vars to be scoped correctly for later usage in misbehaviour test

* address my self-review comments and some of rabbit's comments

* Update e2e/tests/transfer/localhost_test.go

* chore: godocs, rm ClientStore from expected keeper, rename events arg to initialHeight

---------

Co-authored-by: Colin Axnér <[email protected]>
Co-authored-by: Carlos Rodriguez <[email protected]>
Co-authored-by: DimitrisJim <[email protected]>
Co-authored-by: chatton <[email protected]>
  • Loading branch information
5 people authored Mar 14, 2024
1 parent 661088d commit 56b8170
Show file tree
Hide file tree
Showing 104 changed files with 3,402 additions and 1,261 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ Ref: https://keepachangelog.com/en/1.0.0/

### API Breaking

* (core/02-client, light-clients) [\#5806](https://github.com/cosmos/ibc-go/pull/5806) Decouple light client routing from their encoding structure.

### State Machine Breaking

### Improvements
Expand Down
2 changes: 1 addition & 1 deletion docs/docs/01-ibc/05-upgrades/02-developer-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ slug: /ibc/upgrades/developer-guide
Learn how to implement upgrade functionality for your custom IBC client.
:::

Please see the section [Handling upgrades](../../03-light-clients/01-developer-guide/05-upgrades.md) from the light client developer guide for more information.
Please see the section [Handling upgrades](../../03-light-clients/01-developer-guide/06-upgrades.md) from the light client developer guide for more information.
22 changes: 19 additions & 3 deletions docs/docs/03-light-clients/01-developer-guide/01-overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ The following aims to provide a high level IBC light client module developer gui

A light client module developer should be concerned with three main interfaces:

- [`LightClientModule`](#lightclientmodule) a module which manages many light client instances of a certain type.
- [`ClientState`](#clientstate) encapsulates the light client implementation and its semantics.
- [`ConsensusState`](#consensusstate) tracks consensus data used for verification of client updates, misbehaviour detection and proof verification of counterparty state.
- [`ClientMessage`](#clientmessage) used for submitting block headers for client updates and submission of misbehaviour evidence using conflicting headers.
Expand All @@ -35,6 +36,21 @@ Throughout this guide the `07-tendermint` light client module may be referred to

## Concepts and vocabulary

### `LightClientModule`

`LightClientModule` is an interface defined by core IBC which allows for modular light client implementations. All light client implementations *must* implement the [`LightClientModule` interface](https://github.com/cosmos/ibc-go/blob/501a8462345da099144efe91d495bfcfa18d760d/modules/core/exported/client.go#L51) so that core IBC may redirect calls to the light client module.

For example a light client module may need to:

- create clients
- update clients
- recover and upgrade clients
- verify membership and non-membership

The methods which make up this interface are detailed at a more granular level in the [`LightClientModule` section of this guide](02-light-client-module.md).

Please refer to the `07-tendermint`'s [`LightClientModule` definition](https://github.com/cosmos/ibc-go/blob/501a8462345da099144efe91d495bfcfa18d760d/modules/light-clients/07-tendermint/light_client_module.go#L17) for more information.

### `ClientState`

`ClientState` is a term used to define the data structure which encapsulates opaque light client state. The `ClientState` contains all the information needed to verify a `ClientMessage` and perform membership and non-membership proof verification of counterparty state. This includes properties that refer to the remote state machine, the light client type and the specific light client instance.
Expand All @@ -47,7 +63,7 @@ For example:
- Constraints used for client upgrades.

The `ClientState` type maintained within the light client module *must* implement the [`ClientState`](https://github.com/cosmos/ibc-go/tree/02-client-refactor-beta1/modules/core/exported/client.go#L36) interface defined in `core/modules/exported/client.go`.
The methods which make up this interface are detailed at a more granular level in the [ClientState section of this guide](02-client-state.md).
The methods which make up this interface are detailed at a more granular level in the [`ClientState` section of this guide](03-client-state.md).

Please refer to the `07-tendermint` light client module's [`ClientState` definition](https://github.com/cosmos/ibc-go/tree/02-client-refactor-beta1/proto/ibc/lightclients/tendermint/v1/tendermint.proto#L18) containing information such as chain ID, status, latest height, unbonding period and proof specifications.

Expand All @@ -58,7 +74,7 @@ Please refer to the `07-tendermint` light client module's [`ClientState` definit
For example, the `ConsensusState` of the `07-tendermint` light client module defines a trusted root which is used by the `ClientState` to perform verification of membership and non-membership commitment proofs, as well as the next validator set hash used for verifying headers can be trusted in client updates.

The `ConsensusState` type maintained within the light client module *must* implement the [`ConsensusState`](https://github.com/cosmos/ibc-go/tree/02-client-refactor-beta1/modules/core/exported/client.go#L134) interface defined in `modules/core/exported/client.go`.
The methods which make up this interface are detailed at a more granular level in the [`ConsensusState` section of this guide](03-consensus-state.md).
The methods which make up this interface are detailed at a more granular level in the [`ConsensusState` section of this guide](04-consensus-state.md).

### `Height`

Expand All @@ -76,4 +92,4 @@ The following are considered as valid update scenarios:
- A batch of block headers which when verified inserts `N` `ConsensusState` instances for `N` unique heights.
- Evidence of misbehaviour provided by two conflicting block headers.

Learn more in the [Handling update and misbehaviour](04-updates-and-misbehaviour.md) section.
Learn more in the [Handling update and misbehaviour](05-updates-and-misbehaviour.md) section.
Original file line number Diff line number Diff line change
@@ -1,28 +1,12 @@
---
title: Client State interface
sidebar_label: Client State interface
title: Light Client Module interface
sidebar_label: Light Client Module interface
sidebar_position: 2
slug: /ibc/light-clients/client-state
slug: /ibc/light-clients/light-client-module
---


# Implementing the `ClientState` interface

Learn how to implement the [`ClientState`](https://github.com/cosmos/ibc-go/blob/v7.0.0/modules/core/exported/client.go#L36) interface. This list of methods described here does not include all methods of the interface. Some methods are explained in detail in the relevant sections of the guide.

## `ClientType` method

`ClientType` should return a unique string identifier of the light client. This will be used when generating a client identifier.
The format is created as follows: `ClientType-{N}` where `{N}` is the unique global nonce associated with a specific client.

## `GetLatestHeight` method

`GetLatestHeight` should return the latest block height that the client state represents.

## `Validate` method

`Validate` should validate every client state field and should return an error if any value is invalid. The light client
implementer is in charge of determining which checks are required. See the [Tendermint light client implementation](https://github.com/cosmos/ibc-go/blob/v7.0.0/modules/light-clients/07-tendermint/client_state.go#L111) as a reference.
# Implementing the `LightClientModule` interface

## `Status` method

Expand All @@ -37,9 +21,9 @@ All possible `Status` types can be found [here](https://github.com/cosmos/ibc-go

This field is returned in the response of the gRPC [`ibc.core.client.v1.Query/ClientStatus`](https://github.com/cosmos/ibc-go/blob/v7.0.0/modules/core/02-client/types/query.pb.go#L665) endpoint.

## `GetTimestampAtHeight` method
## `TimestampAtHeight` method

`GetTimestampAtHeight` must return the timestamp for the consensus state associated with the provided height.
`TimestampAtHeight` must return the timestamp for the consensus state associated with the provided height.
This value is used to facilitate timeouts by checking the packet timeout timestamp against the returned value.

## `Initialize` method
Expand All @@ -52,12 +36,12 @@ Clients may also store any necessary client-specific metadata.
## `VerifyMembership` method

`VerifyMembership` must verify the existence of a value at a given commitment path at the specified height. For more information about membership proofs
see the [Existence and non-existence proofs section](06-proofs.md).
see the [Existence and non-existence proofs section](07-proofs.md).

## `VerifyNonMembership` method

`VerifyNonMembership` must verify the absence of a value at a given commitment path at a specified height. For more information about non-membership proofs
see the [Existence and non-existence proofs section](06-proofs.md).
see the [Existence and non-existence proofs section](07-proofs.md).

## `VerifyClientMessage` method

Expand Down
21 changes: 21 additions & 0 deletions docs/docs/03-light-clients/01-developer-guide/03-client-state.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
title: Client State interface
sidebar_label: Client State interface
sidebar_position: 3
slug: /ibc/light-clients/client-state
---


# Implementing the `ClientState` interface

Learn how to implement the [`ClientState`](https://github.com/cosmos/ibc-go/blob/v7.0.0/modules/core/exported/client.go#L36) interface.

## `ClientType` method

`ClientType` should return a unique string identifier of the light client. This will be used when generating a client identifier.
The format is created as follows: `{client-type}-{N}` where `{N}` is the unique global nonce associated with a specific client (e.g `07-tendermint-0`).

## `Validate` method

`Validate` should validate every client state field and should return an error if any value is invalid. The light client
implementer is in charge of determining which checks are required. See the [Tendermint light client implementation](https://github.com/cosmos/ibc-go/blob/v7.0.0/modules/light-clients/07-tendermint/client_state.go#L111) as a reference.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: Consensus State interface
sidebar_label: Consensus State interface
sidebar_position: 3
sidebar_position: 4
slug: /ibc/light-clients/consensus-state
---

Expand All @@ -16,13 +16,11 @@ The below [`ConsensusState`](https://github.com/cosmos/ibc-go/blob/v7.0.0/module

## `ClientType` method

This is the type of client consensus. It should be the same as the `ClientType` return value for the [corresponding `ClientState` implementation](02-client-state.md).
This is the type of client consensus. It should be the same as the `ClientType` return value for the [corresponding `ClientState` implementation](03-client-state.md).

## `GetTimestamp` method

*Deprecated*: soon to be removed from interface

`GetTimestamp` should return the timestamp (in nanoseconds) of the consensus state snapshot.
`GetTimestamp` should return the timestamp (in nanoseconds) of the consensus state snapshot. This function has been deprecated and will be removed in a future release.

## `ValidateBasic` method

Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
---
title: Handling Updates and Misbehaviour
sidebar_label: Handling Updates and Misbehaviour
sidebar_position: 4
sidebar_position: 5
slug: /ibc/light-clients/updates-and-misbehaviour
---


# Handling `ClientMessage`s: updates and misbehaviour

As mentioned before in the documentation about [implementing the `ConsensusState` interface](03-consensus-state.md), [`ClientMessage`](https://github.com/cosmos/ibc-go/blob/v7.0.0/modules/core/exported/client.go#L147) is an interface used to update an IBC client. This update may be performed by:
As mentioned before in the documentation about [implementing the `ConsensusState` interface](04-consensus-state.md), [`ClientMessage`](https://github.com/cosmos/ibc-go/blob/v7.0.0/modules/core/exported/client.go#L147) is an interface used to update an IBC client. This update may be performed by:

- a single header
- a batch of headers
Expand All @@ -30,7 +30,7 @@ type ClientMessage interface {
}
```

The `ClientMessage` will be passed to the client to be used in [`UpdateClient`](https://github.com/cosmos/ibc-go/blob/v7.0.0/modules/core/02-client/keeper/client.go#L48), which retrieves the `ClientState` by client ID (available in `MsgUpdateClient`). This `ClientState` implements the [`ClientState` interface](02-client-state.md) for its specific consenus type (e.g. Tendermint).
The `ClientMessage` will be passed to the client to be used in [`UpdateClient`](https://github.com/cosmos/ibc-go/blob/v7.0.0/modules/core/02-client/keeper/client.go#L48), which retrieves the `ClientState` by client ID (available in `MsgUpdateClient`). This `ClientState` implements the [`ClientState` interface](03-client-state.md) for its specific consenus type (e.g. Tendermint).

`UpdateClient` will then handle a number of cases including misbehaviour and/or updating the consensus state, utilizing the specific methods defined in the relevant `ClientState`.

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: Handling Upgrades
sidebar_label: Handling Upgrades
sidebar_position: 5
sidebar_position: 6
slug: /ibc/light-clients/upgrades
---

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: Existence/Non-Existence Proofs
sidebar_label: Existence/Non-Existence Proofs
sidebar_position: 6
sidebar_position: 7
slug: /ibc/light-clients/proofs
---

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: Handling Proposals
sidebar_label: Handling Proposals
sidebar_position: 7
sidebar_position: 8
slug: /ibc/light-clients/proposals
---

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: Setup
sidebar_label: Setup
sidebar_position: 8
sidebar_position: 9
slug: /ibc/light-clients/setup
---

Expand Down
2 changes: 1 addition & 1 deletion docs/docs/03-light-clients/04-wasm/03-integration.md
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ func CreateWasmUpgradeHandler(
}
```

Or alternatively the parameter can be updated via a governance proposal (see at the bottom of section [`Creating clients`](../01-developer-guide/08-setup.md#creating-clients) for an example of how to do this).
Or alternatively the parameter can be updated via a governance proposal (see at the bottom of section [`Creating clients`](../01-developer-guide/09-setup.md#creating-clients) for an example of how to do this).

## Adding the module to the store

Expand Down
20 changes: 10 additions & 10 deletions docs/docs/03-light-clients/04-wasm/07-contracts.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,10 @@ pub enum QueryMsg {
To learn what it is expected from the Wasm light client contract when processing each message, please read the corresponding section of the [Light client developer guide](../01-developer-guide/01-overview.md):
- For `StatusMsg`, see the section [`Status` method](../01-developer-guide/02-client-state.md#status-method).
- For `TimestampAtHeightMsg`, see the section [`GetTimestampAtHeight` method](../01-developer-guide/02-client-state.md#gettimestampatheight-method).
- For `VerifyClientMessageMsg`, see the section [`VerifyClientMessage`](../01-developer-guide/04-updates-and-misbehaviour.md#verifyclientmessage).
- For `CheckForMisbehaviourMsg`, see the section [`CheckForMisbehaviour` method](../01-developer-guide/02-client-state.md#checkformisbehaviour-method).
- For `StatusMsg`, see the section [`Status` method](../01-developer-guide/03-client-state.md#status-method).
- For `TimestampAtHeightMsg`, see the section [`GetTimestampAtHeight` method](../01-developer-guide/03-client-state.md#gettimestampatheight-method).
- For `VerifyClientMessageMsg`, see the section [`VerifyClientMessage`](../01-developer-guide/05-updates-and-misbehaviour.md#verifyclientmessage).
- For `CheckForMisbehaviourMsg`, see the section [`CheckForMisbehaviour` method](../01-developer-guide/03-client-state.md#checkformisbehaviour-method).
## `SudoMsg`
Expand Down Expand Up @@ -88,12 +88,12 @@ pub enum SudoMsg {

To learn what it is expected from the Wasm light client contract when processing each message, please read the corresponding section of the [Light client developer guide](../01-developer-guide/01-overview.md):

- For `UpdateStateMsg`, see the section [`UpdateState`](../01-developer-guide/04-updates-and-misbehaviour.md#updatestate).
- For `UpdateStateOnMisbehaviourMsg`, see the section [`UpdateStateOnMisbehaviour`](../01-developer-guide/04-updates-and-misbehaviour.md#updatestateonmisbehaviour).
- For `VerifyUpgradeAndUpdateStateMsg`, see the section [`GetTimestampAtHeight` method](../01-developer-guide/05-upgrades.md#implementing-verifyupgradeandupdatestate).
- For `VerifyMembershipMsg`, see the section [`VerifyMembership` method](../01-developer-guide/02-client-state.md#verifymembership-method).
- For `VerifyNonMembershipMsg`, see the section [`VerifyNonMembership` method](../01-developer-guide/02-client-state.md#verifynonmembership-method).
- For `MigrateClientStoreMsg`, see the section [Implementing `CheckSubstituteAndUpdateState`](../01-developer-guide/07-proposals.md#implementing-checksubstituteandupdatestate).
- For `UpdateStateMsg`, see the section [`UpdateState`](../01-developer-guide/05-updates-and-misbehaviour.md#updatestate).
- For `UpdateStateOnMisbehaviourMsg`, see the section [`UpdateStateOnMisbehaviour`](../01-developer-guide/05-updates-and-misbehaviour.md#updatestateonmisbehaviour).
- For `VerifyUpgradeAndUpdateStateMsg`, see the section [`GetTimestampAtHeight` method](../01-developer-guide/06-upgrades.md#implementing-verifyupgradeandupdatestate).
- For `VerifyMembershipMsg`, see the section [`VerifyMembership` method](../01-developer-guide/03-client-state.md#verifymembership-method).
- For `VerifyNonMembershipMsg`, see the section [`VerifyNonMembership` method](../01-developer-guide/03-client-state.md#verifynonmembership-method).
- For `MigrateClientStoreMsg`, see the section [Implementing `CheckSubstituteAndUpdateState`](../01-developer-guide/08-proposals.md#implementing-checksubstituteandupdatestate).

### Migration

Expand Down
23 changes: 23 additions & 0 deletions docs/docs/05-migrations/13-v8-to-v9.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,29 @@ Please use the new functions `path.Setup`, `path.SetupClients`, `path.SetupConne

The `ExportMetadata` interface function has been removed from the `ClientState` interface. Core IBC will export all key/value's within the 02-client store.

The `ZeroCustomFields` interface function has been removed from the `ClientState` interface.

The following functions have also been removed from the `ClientState` interface: `Initialize`, `Status`, `GetLatestHeight`, `GetTimestampAtHeight`, `VerifyClientMessage`, `VerifyMembership`, `VerifyNonMembership`, `CheckForMisbehaviour`, `UpdateState`, `UpdateStateOnMisbehaviour`, `CheckSubstituteAndUpdateState` and `VerifyUpgradeAndUpdateState`. ibc-go v9 decouples routing at the `02-client` layer from the light clients' encoding structure (i.e. every light client implementation of the `ClientState` interface is not used anymore to route the requests to the right light client at the `02-client` layer, instead a *light client module* is registered for every light client type and `02-client` routes the requests to the right light client module based on the client ID). Light client developers must implement the newly introduced `LightClientModule` interface and are encouraged to move the logic implemented in the functions of their light client's implementation of the `ClientState` interface to the equivalent function in the `LightClientModule` interface. The table below shows the equivalence between the `ClientState` interface functions that have been removed and the functions in the `LightClientModule` interface:

|`ClientState` interface|`LightClientModule` interface|
|-----------------------|-----------------------------|
|`Initialize` |`Initialize` |
|`Status` |`Status` |
|`GetLatestHeight` |`LatestHeight` |
|`GetTimestampAtHeight` |`TimestampAtHeight` |
|`VerifyClientMessage` |`VerifyClientMessage` |
|`VerifyMembership` |`VerifyMembership` |
|`VerifyNonMembership` |`VerifyNonMembership` |
|`CheckForMisbehaviour` |`CheckForMisbehaviour` |
|`UpdateState` |`UpdateState` |
|`UpdateStateOnMisbehaviour` |`UpdateStateOnMisbehaviour` |
|`CheckSubstituteAndUpdateState`|`RecoverClient` |
|`VerifyUpgradeAndUpdateState` |`VerifyUpgradeAndUpdateState`|
|`ExportMetadata` | |
|`ZeroCustomFields` | |

Please check also the [Light client developer guide](../03-light-clients/01-developer-guide/01-overview.md) for more information. The light client module implementation for `07-tendermint` may also be useful as reference.

### 07-tendermint

The `IterateConsensusMetadata` function has been removed.
Expand Down
Loading

0 comments on commit 56b8170

Please sign in to comment.