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

02-client refactor #1871

Merged
merged 76 commits into from
Aug 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
76 commits
Select commit Hold shift + click to select a range
a4b5b8f
chore: Remove GetClientID() From Misbehaviour Interface (#897)
notbdu Mar 9, 2022
841d21d
chore: add 668 functions to localhost client (#908)
notbdu Mar 9, 2022
18abb79
chore: rename 06-solomachine type Misbehaviour to DuplicateSignatures…
damiannolan Mar 10, 2022
a333a73
chore: reverting renaming of Misbehaviour (#1099)
damiannolan Mar 11, 2022
daa01db
remove GetClientID from 07-tendermint misbehaviour (#1097)
colin-axner Mar 11, 2022
2de5f1d
chore: remove GetClientID from 06-solomachine type Misbehaviour (#1100)
damiannolan Mar 11, 2022
12f4ed2
client-02 update to latest from main (#1106)
seantking Mar 11, 2022
ebf40bb
02-client: merge misbehavior & header interfaces (#1107)
seantking Mar 15, 2022
b0fa240
chore: 06-solomachine rename checkHeader to VerifyClientMessage (#1109)
damiannolan Mar 16, 2022
5e9785e
refactor: modify VerifyUpgradeAndUpdateState to set upgraded client a…
colin-axner Mar 16, 2022
4c8b7c5
chore: 06-solomachine rename update to UpdateState (#1110)
damiannolan Mar 16, 2022
bdbaa91
chore: 06-solomachine adding CheckForMisbehaviour and UpdateStateOnMi…
damiannolan Mar 16, 2022
f4480fb
chore: 02-client-refactor: merge main into feature branch (#1149)
seantking Mar 21, 2022
5e3bac0
02-client-refactor: rename update to UpdateState for 07-tendermint (#…
colin-axner Mar 24, 2022
efbc5a1
chore: adding UpdateStateOnMisbehaviour to 07-tendermint (#1168)
damiannolan Mar 24, 2022
b0dd49d
chore: add solomachine client storage (#1144)
damiannolan Mar 28, 2022
17209f7
refactor: adding CheckForMisbehaviour to 07-tendermint client (#1163)
damiannolan Mar 28, 2022
fadd9d0
02-client refactor: Adding VerifyClientMessage helper fn (#1119)
seantking Mar 28, 2022
c2602a5
refactor: removing GetRoot from ConsensusState interface (#1186)
seantking Mar 30, 2022
40183b4
Adding VerifyClientMessage to ClientState interface (#1196)
seantking Mar 30, 2022
a4b3d09
chore: CheckSubstituteAndUpdateState stores client state in lightclie…
damiannolan Mar 30, 2022
2e2bfab
chore: 07-tendermint set client/consensus states in UpdateState (#1199)
damiannolan Mar 30, 2022
18f1382
chore: update 07-tendermint GetConsensusState to return bool over err…
damiannolan Mar 30, 2022
3c7358b
feat: adding UpdateStateOnMisbehaviour to ClientState interface (#1198)
seantking Mar 31, 2022
5cf6528
refactor: remove localhost client implementation (#1187)
seantking Mar 31, 2022
eb48e54
chore: adding UpdateState to ClientState interface (#1206)
damiannolan Mar 31, 2022
d2be6d5
feat: adding CheckForMisbehaviour to ClientState interface (#1197)
seantking Mar 31, 2022
e2f37b8
Replace CheckHeaderAndUpdateState with new ClientState functions (#1208)
colin-axner Apr 1, 2022
8a9978c
refactor: removing CheckHeaderAndUpdateState from ClientState (#1210)
seantking Apr 4, 2022
c43af66
refactor: routing MsgSubmitMisbehaviour to UpdateClient keeper fn (#1…
seantking Apr 4, 2022
e249518
refactor: removing CheckMisbehaviourAndUpdateState from ClientState i…
seantking Apr 4, 2022
e91ee68
fix: rm AllowUpdateAfter... check (#1118)
charleenfei Apr 25, 2022
e1ec9f4
chore: update 02-client-refactor branch with latest main (#1286)
damiannolan Apr 26, 2022
cf893c2
chore: remove GetHeight from ClientMessage interface (#1285)
damiannolan Apr 27, 2022
55b115a
update godoc for VerifyClientMessage (#1281)
colin-axner Apr 27, 2022
48882a9
Add VerifyMembership to 07-tendermint (#1297)
colin-axner Apr 28, 2022
8f46821
chore: MsgUpdateClient rename header to client_message (#1316)
damiannolan May 9, 2022
e1f2103
Add migration docs for 02-client refactor (#1287)
catShaark May 10, 2022
31b6ead
Add revision number tests for 07-tendermint (#1302)
colin-axner May 10, 2022
d120044
ADR 005: update client consensus height events (#1315)
damiannolan May 10, 2022
e2bdd1f
feat: VerifyNonMembership 07-tendermint implementation (#1611)
seantking Jun 30, 2022
aab9ca2
chore: making changes based on nits from 02-client refactor audit (#1…
chatton Jun 30, 2022
4def196
chore: add generic proof verification methods to ClientState interfac…
damiannolan Jul 4, 2022
32c4827
chore: add GetTimestampAtHeight to client state #888 (#1659)
charleenfei Jul 6, 2022
1617de7
chore: modify connection keeper GetTimestampAtHeight to use the clien…
charleenfei Jul 7, 2022
3987a5b
refactor: replace usage of verification funcs in 03-connection (#1647)
damiannolan Jul 7, 2022
81a7cae
Check that client state is zeroed out for ibc client upgrade proposal…
chatton Jul 11, 2022
60e5305
Zero out client state before upgrading client proof (#1674)
chatton Jul 11, 2022
549c181
chore: restructuring 07-tendermint lightclient directory layout (#1677)
damiannolan Jul 12, 2022
04df7cd
chore: adding upgrade handler for 09-localhost removal (#1671)
damiannolan Jul 15, 2022
d8ac28a
Emit event upon setting upgrade consensus state (#1741)
chatton Jul 27, 2022
d3d91ed
chore: removing GetHeight legacy method from 06-solomachine (#1810)
damiannolan Jul 29, 2022
b0a58a8
refactor: solomachine generic verification methods and signbytes simp…
damiannolan Aug 2, 2022
7237c43
bump version from 3 to 5
colin-axner Aug 2, 2022
6cdcc63
merge main
colin-axner Aug 2, 2022
0d8f408
fix merge conflicts
colin-axner Aug 2, 2022
a7d23fd
fix build
colin-axner Aug 3, 2022
f861e0e
go imports
colin-axner Aug 3, 2022
607458a
make format
colin-axner Aug 3, 2022
e9a7fac
fix linter
colin-axner Aug 3, 2022
18eee1a
apply review suggestions
colin-axner Aug 3, 2022
197c2bd
Merge branch 'main' into updated-02-client-refactor
colin-axner Aug 3, 2022
2da9e65
fix: import changes for 02-client-refactor (#1875)
colin-axner Aug 4, 2022
68e8e79
apply suggested changes (#1877)
colin-axner Aug 4, 2022
3d33e8b
documentation fixes (#1876)
colin-axner Aug 4, 2022
163b706
fix: complete changes for CheckSubstituteAndUpdateState (#1878)
colin-axner Aug 4, 2022
3cb1ba8
Merge branch 'main' of github.com:cosmos/ibc-go into updated-02-clien…
colin-axner Aug 4, 2022
81f2d09
02-client refactor: fix changelog (#1873)
seantking Aug 4, 2022
311a563
fix: revert unnecessary change in 02-client-refactor branch (#1883)
colin-axner Aug 5, 2022
173c1fb
updating solomachine to use setClientState helper in update funcs (#1…
damiannolan Aug 8, 2022
f8debd7
Merge branch 'main' of github.com:cosmos/ibc-go into updated-02-clien…
colin-axner Aug 8, 2022
a7407cc
Update CHANGELOG.md
colin-axner Aug 8, 2022
fc4bfaf
Update docs/migrations/v5-to-v6.md
colin-axner Aug 8, 2022
9a4ed68
chore: remove error return in IterateConsensusStateAscending (#1896)
damiannolan Aug 8, 2022
87bae33
removing solomachine consensus state nil check and test cases (#1895)
damiannolan Aug 8, 2022
88936be
Merge branch 'main' into updated-02-client-refactor
colin-axner Aug 8, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 34 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ Ref: https://keepachangelog.com/en/1.0.0/

### API Breaking

* (core/03-connection) [\#1797](https://github.com/cosmos/ibc-go/pull/1797) Remove `PreviousConnectionID` from `NewMsgConnectionOpenTry` arguments. `MsgConnectionOpenTry.ValidateBasic()` returns error if the deprecated `PreviousConnectionID` is not empty.
* (core/03-connection) [\#1797](https://github.com/cosmos/ibc-go/pull/1797) Remove `PreviousConnectionID` from `NewMsgConnectionOpenTry` arguments. `MsgConnectionOpenTry.ValidateBasic()` returns error if the deprecated `PreviousConnectionID` is not empty
* (core/04-channel) [\#1792](https://github.com/cosmos/ibc-go/pull/1792) Remove `PreviousChannelID` from `NewMsgChannelOpenTry` arguments. `MsgChannelOpenTry.ValidateBasic()` returns error if the deprecated `PreviousChannelID` is not empty.
* (core/04-channel) [\#1418](https://github.com/cosmos/ibc-go/pull/1418) `NewPacketId` has been renamed to `NewPacketID` to comply with go linting rules.
* (core/ante) [\#1418](https://github.com/cosmos/ibc-go/pull/1418) `AnteDecorator` has been renamed to `RedundancyDecorator` to comply with go linting rules and to give more clarity to the purpose of the Decorator.
Expand All @@ -61,6 +61,18 @@ Ref: https://keepachangelog.com/en/1.0.0/
* (transfer)[\#1565](https://github.com/cosmos/ibc-go/pull/1565) Removing `NewErrorAcknowledgement` in favour of `channeltypes.NewErrorAcknowledgement`.
* (channel)[\#1565](https://github.com/cosmos/ibc-go/pull/1565) Updating `NewErrorAcknowledgement` to accept an error instead of a string and removing the possibility of non-deterministic writes to application state.
* (core/04-channel)[\#1636](https://github.com/cosmos/ibc-go/pull/1636) Removing `SplitChannelVersion` and `MergeChannelVersions` functions since they are not used.
-
* (06-solomachine) [\#1679](https://github.com/cosmos/ibc-go/pull/1679) Remove `types` sub-package from `06-solomachine` lightclient directory.
* (07-tendermint) [\#1677](https://github.com/cosmos/ibc-go/pull/1677) Remove `types` sub-package from `07-tendermint` lightclient directory.
* (06-solomachine) [\#1687](https://github.com/cosmos/ibc-go/pull/1687) Bump `06-solomachine` protobuf version from `v2` to `v3`.
* (06-solomachine) [\#1687](https://github.com/cosmos/ibc-go/pull/1687) Removed `DataType` enum and associated message types from `06-solomachine`. `DataType` has been removed from `SignBytes` and `SignatureAndData` in favour of `path`.
* (02-client) [\#598](https://github.com/cosmos/ibc-go/pull/598) The client state and consensus state return value has been removed from `VerifyUpgradeAndUpdateState`. Light client implementations must update the client state and consensus state after verifying a valid client upgrade.
* (06-solomachine) [\#1100](https://github.com/cosmos/ibc-go/pull/1100) Remove `GetClientID` function from 06-solomachine `Misbehaviour` type.
* (06-solomachine) [\#1100](https://github.com/cosmos/ibc-go/pull/1100) Deprecate `ClientId` field in 06-solomachine `Misbehaviour` type.
* (07-tendermint) [\#1097](https://github.com/cosmos/ibc-go/pull/1097) Remove `GetClientID` function from 07-tendermint `Misbehaviour` type.
* (07-tendermint) [\#1097](https://github.com/cosmos/ibc-go/pull/1097) Deprecate `ClientId` field in 07-tendermint `Misbehaviour` type.
* (modules/core/exported) [\#1107](https://github.com/cosmos/ibc-go/pull/1107) Merging the `Header` and `Misbehaviour` interfaces into a single `ClientMessage` type.
* (07-tendermint) [\#1896](https://github.com/cosmos/ibc-go/pull/1896) Remove error return from `IterateConsensusStateAscending` in `07-tendermint`.

### State Machine Breaking

Expand All @@ -79,7 +91,22 @@ Ref: https://keepachangelog.com/en/1.0.0/
* (app/29-fee) [\#1341](https://github.com/cosmos/ibc-go/pull/1341) Check if the fee module is locked and if the fee module is enabled before refunding all fees
* (transfer) [\#1414](https://github.com/cosmos/ibc-go/pull/1414) Emitting Sender address from `fungible_token_packet` events in `OnRecvPacket` and `OnAcknowledgementPacket`.
* (testing/simapp) [\#1397](https://github.com/cosmos/ibc-go/pull/1397) Adding mock module to maccperms and adding check to ensure mock module is not a blocked account address.
-
* (modules/light-clients/07-tendermint) [\#1713](https://github.com/cosmos/ibc-go/pull/1713) Allow client upgrade proposals to update `TrustingPeriod`. See ADR-026 for context.
* (modules/core/02-client) [\#1188](https://github.com/cosmos/ibc-go/pull/1188/files) Routing `MsgSubmitMisbehaviour` to `UpdateClient` keeper function. Deprecating `SubmitMisbehaviour` endpoint.
* (modules/core/02-client) [\#1208](https://github.com/cosmos/ibc-go/pull/1208) Replace `CheckHeaderAndUpdateState` usage in 02-client with calls to `VerifyClientMessage`, `CheckForMisbehaviour`, `UpdateStateOnMisbehaviour` and `UpdateState`.
* (modules/light-clients/09-localhost) [\#1187](https://github.com/cosmos/ibc-go/pull/1187/) Removing localhost light client implementation as it is not functional. An upgrade handler is provided in `modules/migrations/v5` to prune `09-localhost` clients and consensus states from the store.
* [\#1186](https://github.com/cosmos/ibc-go/pull/1186/files) Removing `GetRoot` function from ConsensusState interface in `02-client`. `GetRoot` is unused by core IBC.
* (modules/core/02-client) [\#1196](https://github.com/cosmos/ibc-go/pull/1196) Adding VerifyClientMessage to ClientState interface.
* (modules/core/02-client) [\#1198](https://github.com/cosmos/ibc-go/pull/1198) Adding UpdateStateOnMisbehaviour to ClientState interface.
* (modules/core/02-client) [\#1170](https://github.com/cosmos/ibc-go/pull/1170) Updating `ClientUpdateProposal` to set client state in lightclient implementations `CheckSubstituteAndUpdateState` methods.
* (modules/core/02-client) [\#1197](https://github.com/cosmos/ibc-go/pull/1197) Adding `CheckForMisbehaviour` to `ClientState` interface.
* (modules/core/02-client) [\#1195](https://github.com/cosmos/ibc-go/pull/1210) Removing `CheckHeaderAndUpdateState` from `ClientState` interface & associated light client implementations.
* (modules/core/02-client) [\#1189](https://github.com/cosmos/ibc-go/pull/1212) Removing `CheckMisbehaviourAndUpdateState` from `ClientState` interface & associated light client implementations.
* (modules/core/exported) [\#1206](https://github.com/cosmos/ibc-go/pull/1206) Adding new method `UpdateState` to `ClientState` interface.
* (modules/core/02-client) [\#1741](https://github.com/cosmos/ibc-go/pull/1741) Emitting a new `upgrade_chain` event upon setting upgrade consensus state.
* (client) [\#724](https://github.com/cosmos/ibc-go/pull/724) `IsRevisionFormat` and `IsClientIDFormat` have been updated to disallow newlines before the dash used to separate the chainID and revision number, and the client type and client sequence.
* (02-client/cli) [\#897](https://github.com/cosmos/ibc-go/pull/897) Remove `GetClientID()` from `Misbehaviour` interface. Submit client misbehaviour cli command requires an explicit client id now.

### Features

Expand All @@ -94,6 +121,10 @@ Ref: https://keepachangelog.com/en/1.0.0/
* (apps/29-fee) [\#1774](https://github.com/cosmos/ibc-go/pull/1774) Change non nil relayer assertion to non empty to avoid import/export issues for genesis upgrades.
* (makefile) [\#1785](https://github.com/cosmos/ibc-go/pull/1785) Fetch the correct versions of protocol buffers dependencies from tendermint, cosmos-sdk, and ics23.
* (apps/29-fee) [\#1278](https://github.com/cosmos/ibc-go/pull/1278) The URI path for the query to get all incentivized packets for a specific channel did not follow the same format as the rest of queries.
-
* (light-clients/solomachine) [#1839](https://github.com/cosmos/ibc-go/issues/1839) Fixed usage of the new diversifier in validation of changing diversifiers for the solo machine. The current diversifier must sign over the new diversifier.
* (light-clients/07-tendermint) [\#1674](https://github.com/cosmos/ibc-go/pull/1674) Submitted ClientState is zeroed out before checking the proof in order to prevent the proposal from containing information governance is not actually voting on.
* (modules/core/02-client)[\#1676](https://github.com/cosmos/ibc-go/pull/1676) ClientState must be zeroed out for `UpgradeProposals` to pass validation. This prevents a proposal containing information governance is not actually voting on.

## [v3.1.1](https://github.com/cosmos/ibc-go/releases/tag/v3.1.1) - 2022-08-02

Expand Down Expand Up @@ -191,6 +222,7 @@ Ref: https://keepachangelog.com/en/1.0.0/

### Improvements

* (client) [\#888](https://github.com/cosmos/ibc-go/pull/888) Add `GetTimestampAtHeight` to `ClientState`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also in v3.0.0.

* (interchain-accounts) [\#1037](https://github.com/cosmos/ibc-go/pull/1037) Add a function `InitModule` to the interchain accounts `AppModule`. This function should be called within the upgrade handler when adding the interchain accounts module to a chain. It should be called in place of InitGenesis (set the consensus version in the version map).
* (testing) [\#942](https://github.com/cosmos/ibc-go/pull/942) `NewTestChain` will create 4 validators in validator set by default. A new constructor function `NewTestChainWithValSet` is provided for test writers who want custom control over the validator set of test chains.
* (testing) [\#904](https://github.com/cosmos/ibc-go/pull/904) Add `ParsePacketFromEvents` function to the testing package. Useful when sending/relaying packets via the testing package.
Expand All @@ -200,9 +232,9 @@ Ref: https://keepachangelog.com/en/1.0.0/
* (channel) [\#692](https://github.com/cosmos/ibc-go/pull/692) Minimize channel logging by only emitting the packet sequence, source port/channel, destination port/channel upon packet receives, acknowledgements and timeouts.
* [\#383](https://github.com/cosmos/ibc-go/pull/383) Adds helper functions for merging and splitting middleware versions from the underlying app version.
* (modules/core/05-port) [\#288](https://github.com/cosmos/ibc-go/issues/288) Making the 05-port keeper function IsBound public. The IsBound function checks if the provided portID is already binded to a module.
* (client) [\#724](https://github.com/cosmos/ibc-go/pull/724) `IsRevisionFormat` and `IsClientIDFormat` have been updated to disallow newlines before the dash used to separate the chainID and revision number, and the client type and client sequence.
* (channel) [\#644](https://github.com/cosmos/ibc-go/pull/644) Adds `GetChannelConnection` to the ChannelKeeper. This function returns the connectionID and connection state associated with a channel.
* (channel) [\647](https://github.com/cosmos/ibc-go/pull/647) Reorganizes channel handshake handling to set channel state after IBC application callbacks.
* (client) [\#724](https://github.com/cosmos/ibc-go/pull/724) `IsRevisionFormat` and `IsClientIDFormat` have been updated to disallow newlines before the dash used to separate the chainID and revision number, and the client type and client sequence.
* (interchain-accounts) [\#1466](https://github.com/cosmos/ibc-go/pull/1466) Emit event when there is an acknowledgement during `OnRecvPacket`.

### Features
Expand Down
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,6 @@ The Inter-Blockchain Communication protocol (IBC) allows blockchains to talk to

3.2 [ICS 06 Solo Machine](https://github.com/cosmos/ibc-go/tree/main/modules/light-clients/06-solomachine)

Note: The localhost client is currently non-functional.

## Roadmap

For an overview of upcoming changes to ibc-go take a look at the [roadmap](./docs/roadmap/roadmap.md).
Expand Down
4 changes: 1 addition & 3 deletions docs/OLD_README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ For the general specification please refer to the [Interchain Standards](https:/

3.2 [Tendermint Client](./../light-clients/07-tendermint/spec/README.md)

3.3 [Localhost Client](./../light-clients/09-localhost/spec/README.md)

## Implementation Details

As stated above, the IBC implementation on the Cosmos SDK introduces some changes
Expand Down Expand Up @@ -114,4 +112,4 @@ x/ibc
│   └── 09-localhost/
└── testing/
```
<!-- markdown-link-check-enable-->
<!-- markdown-link-check-enable-->
88 changes: 88 additions & 0 deletions docs/architecture/adr-005-consensus-height-events.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
# ADR 005: UpdateClient Events - ClientState Consensus Heights

## Changelog
* 25/04/2022: initial draft

## Status

Accepted

## Context

The `ibc-go` implementation leverages the [Cosmos-SDK's EventManager](https://github.com/cosmos/cosmos-sdk/blob/v0.45.4/docs/core/events.md#EventManager) to provide subscribers a method of reacting to application specific events.
Some IBC relayers depend on the [`consensus_height`](https://github.com/cosmos/ibc-go/blob/v3.0.0/modules/core/02-client/keeper/events.go#L33) attribute emitted as part of `UpdateClient` events in order to run `07-tendermint` misbehaviour detection by cross-checking the details of the *Header* emitted at a given consensus height against those of the *Header* from the originating chain. This includes such details as:

- The `SignedHeader` containing the commitment root.
- The `ValidatorSet` that signed the *Header*.
- The `TrustedHeight` seen by the client at less than or equal to the height of *Header*.
- The last `TrustedValidatorSet` at the trusted height.

Following the refactor of the `02-client` submodule and associated `ClientState` interfaces, it will now be possible for
light client implementations to perform such actions as batch updates, inserting `N` number of `ConsensusState`s into the application state tree with a single `UpdateClient` message. This flexibility is provided in `ibc-go` by the usage of the [Protobuf `Any`](https://developers.google.com/protocol-buffers/docs/proto3#any) field contained within the [`UpdateClient`](https://github.com/cosmos/ibc-go/blob/v3.0.0/proto/ibc/core/client/v1/tx.proto#L44) message.
For example, a batched client update message serialized as a Protobuf `Any` type for the `07-tendermint` lightclient implementation could be defined as follows:

```protobuf
message BatchedHeaders {
repeated Header headers = 1;
}
```

To complement this flexibility, the `UpdateClient` handler will now support the submission of [client misbehaviour](https://github.com/cosmos/ibc/tree/master/spec/core/ics-002-client-semantics#misbehaviour) by consolidating the `Header` and `Misbehaviour` interfaces into a single `ClientMessage` interface type:

```go
// ClientMessage is an interface used to update an IBC client.
// The update may be done by a single header, a batch of headers, misbehaviour, or any type which when verified produces
// a change to state of the IBC client
type ClientMessage interface {
proto.Message

ClientType() string
ValidateBasic() error
}
```

To support this functionality the `GetHeight()` method has been omitted from the new `ClientMessage` interface.
Emission of standardised events from the `02-client` submodule now becomes problematic and is two-fold:

1. The `02-client` submodule previously depended upon the `GetHeight()` method of `Header` types in order to [retrieve the updated consensus height](https://github.com/cosmos/ibc-go/blob/v3.0.0/modules/core/02-client/keeper/client.go#L90).
2. Emitting a single `consensus_height` event attribute is not sufficient in the case of a batched client update containing multiple *Headers*.

## Decision

The following decisions have been made in order to provide flexibility to consumers of `UpdateClient` events in a non-breaking fashion:

1. Return a list of updated consensus heights `[]exported.Height` from the new `UpdateState` method of the `ClientState` interface.

```go
// UpdateState updates and stores as necessary any associated information for an IBC client, such as the ClientState and corresponding ConsensusState.
// Upon successful update, a list of consensus heights is returned. It assumes the ClientMessage has already been verified.
UpdateState(sdk.Context, codec.BinaryCodec, sdk.KVStore, ClientMessage) []Height
```

2. Maintain the `consensus_height` event attribute emitted from the `02-client` update handler, but mark as deprecated for future removal. For example, with tendermint lightclients this will simply be `consensusHeights[0]` following a successful update using a single *Header*.

3. Add an additional `consensus_heights` event attribute, containing a comma separated list of updated heights. This provides flexibility for emitting a single consensus height or multiple consensus heights in the example use-case of batched header updates.

## Consequences

### Positive

- Subscribers of IBC core events can act upon `UpdateClient` events containing one or more consensus heights.
- Deprecation of the existing `consensus_height` attribute allows consumers to continue to process `UpdateClient` events as normal, with a path to upgrade to using the `consensus_heights` attribute moving forward.

### Negative

- Consumers of IBC core `UpdateClient` events are forced to make future code changes.

### Neutral

## References

Discussions:
- [#1208](https://github.com/cosmos/ibc-go/pull/1208#discussion_r839691927)

Issues:
- [#594](https://github.com/cosmos/ibc-go/issues/594)

PRs:
- [#1285](https://github.com/cosmos/ibc-go/pull/1285)
2 changes: 1 addition & 1 deletion docs/architecture/adr-027-ibc-wasm.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ packaged inside a payload which is json serialized and passed to `callContract`
array of bytes returned by the smart contract. This data is deserialized and passed as return argument.

```go
func (c *ClientState) CheckProposedHeaderAndUpdateState(context sdk.Context, marshaler codec.BinaryMarshaler, store sdk.KVStore, header exported.Header) (exported.ClientState, exported.ConsensusState, error) {
func (c *ClientState) CheckProposedHeaderAndUpdateState(context sdk.Context, marshaler codec.BinaryMarshaler, store sdk.KVStore, header exported.ClientMessage) (exported.ClientState, exported.ConsensusState, error) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this be split up into two functions or we will allow the ADR authors to update?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should change the status of the ADR to "needs update"

// get consensus state corresponding to client state to check if the client is expired
consensusState, err := GetConsensusState(store, marshaler, c.LatestHeight)
if err != nil {
Expand Down
11 changes: 0 additions & 11 deletions docs/ibc/integration.md
Original file line number Diff line number Diff line change
Expand Up @@ -175,17 +175,6 @@ at each height during the `BeginBlock` call. The historical info is required to
past historical info at any given height in order to verify the light client `ConsensusState` during the
connection handhake.

The IBC module also has
[`BeginBlock`](https://github.com/cosmos/ibc-go/blob/main/modules/core/02-client/abci.go) logic as
well. This is optional as it is only required if your application uses the [localhost
client](https://github.com/cosmos/ibc/blob/master/spec/client/ics-009-loopback-client) to connect two
different modules from the same chain.

::: tip
Only register the ibc module to the `SetOrderBeginBlockers` if your application will use the
localhost (_aka_ loopback) client.
:::

```go
// app.go
func NewApp(...args) *App {
Expand Down
20 changes: 20 additions & 0 deletions docs/ibc/middleware/develop.md
Original file line number Diff line number Diff line change
Expand Up @@ -408,6 +408,26 @@ func GetAppVersion(

return metadata.AppVersion, true
}

// middleware must return the underlying application version
func GetAppVersion(ctx sdk.Context, portID, channelID string) (string, bool) {
version, found := ics4Keeper.GetAppVersion(ctx, portID, channelID)
if !found {
return "", false
}

if !MiddlewareEnabled {
return version, true
}

// unwrap channel version
metadata, err := Unmarshal(version)
if err != nil {
panic(fmt.Errof("unable to unmarshal version: %w", err))
}

return metadata.AppVersion, true
}
```

See [here](https://github.com/cosmos/ibc-go/blob/48a6ae512b4ea42c29fdf6c6f5363f50645591a2/modules/apps/29-fee/ibc_middleware.go#L355-L358) an example implementation of this function for the ICS29 Fee Middleware module.
Loading