Skip to content

Commit

Permalink
Merge branch 'main' into dependabot/go_modules/e2e/github.com/cometbf…
Browse files Browse the repository at this point in the history
…t/cometbft-0.38.9
  • Loading branch information
crodriguezvega authored Jul 4, 2024
2 parents 9a67de5 + 356e433 commit a9c036d
Show file tree
Hide file tree
Showing 67 changed files with 1,012 additions and 1,415 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
images: ${{ env.REGISTRY }}/cosmos/${{ env.IMAGE_NAME }}

- name: Build Docker image
uses: docker/build-push-action@15560696de535e4014efeff63c48f16952e52dd1
uses: docker/build-push-action@1a162644f9a7e87d8f4b053101d1d9a712edc18c
with:
context: .
tags: ${{ steps.meta.outputs.tags }}
Expand All @@ -46,7 +46,7 @@ jobs:
password: ${{ secrets.GITHUB_TOKEN }}

- name: Push Docker image
uses: docker/build-push-action@15560696de535e4014efeff63c48f16952e52dd1
uses: docker/build-push-action@1a162644f9a7e87d8f4b053101d1d9a712edc18c
with:
context: .
push: true
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/e2e-test-workflow-call.yml
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ jobs:

- name: Build and push Docker image
if: ${{ inputs.build-and-push-docker-image }}
uses: docker/build-push-action@15560696de535e4014efeff63c48f16952e52dd1
uses: docker/build-push-action@1a162644f9a7e87d8f4b053101d1d9a712edc18c
with:
context: .
push: true
Expand Down Expand Up @@ -174,7 +174,7 @@ jobs:

- name: Build and push Docker image
if: ${{ inputs.build-and-push-docker-image-wasm }}
uses: docker/build-push-action@15560696de535e4014efeff63c48f16952e52dd1
uses: docker/build-push-action@1a162644f9a7e87d8f4b053101d1d9a712edc18c
with:
context: .
push: true
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ jobs:
images: ${{ env.REGISTRY }}/cosmos/${{ env.IMAGE_NAME }}

- name: Build and push Docker image
uses: docker/build-push-action@15560696de535e4014efeff63c48f16952e52dd1
uses: docker/build-push-action@1a162644f9a7e87d8f4b053101d1d9a712edc18c
with:
context: .
push: true
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,9 @@ Ref: https://keepachangelog.com/en/1.0.0/
* (apps/transfer) [\#6440](https://github.com/cosmos/ibc-go/pull/6440) Remove `GetPrefixedDenom`.
* (apps/transfer) [\#6508](https://github.com/cosmos/ibc-go/pull/6508) Remove the `DenomTrace` type.
* (apps/27-interchain-accounts) [\#6598](https://github.com/cosmos/ibc-go/pull/6598) Mark the `requests` repeated field of `MsgModuleQuerySafe` non-nullable.
* (23-commmitment) [\#6644](https://github.com/cosmos/ibc-go/pull/6644) Introduce commitment/v2 `MerklePath` to include `repeated bytes` in favour of `repeated string`. This supports using merkle path keys which include non UTF-8 encoded runes.
* (23-commmitment) [\#6633](https://github.com/cosmos/ibc-go/pull/6633) MerklePath has been changed to use `repeated bytes` in favour of `repeated strings`.
* (apps/27-interchain-accounts) [\#6749](https://github.com/cosmos/ibc-go/pull/6749) The ICA controller `NewIBCMiddleware` constructor function sets by default the auth module to nil.

### State Machine Breaking

Expand Down
4 changes: 2 additions & 2 deletions docs/docs/02-apps/02-interchain-accounts/04-integration.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ app.ICAAuthKeeper = icaauthkeeper.NewKeeper(appCodec, keys[icaauthtypes.StoreKey
icaAuthModule := icaauth.NewAppModule(appCodec, app.ICAAuthKeeper)

// Create controller IBC application stack and host IBC module as desired
icaControllerStack := icacontroller.NewIBCMiddleware(nil, app.ICAControllerKeeper)
icaControllerStack := icacontroller.NewIBCMiddleware(app.ICAControllerKeeper)
icaHostIBCModule := icahost.NewIBCModule(app.ICAHostKeeper)

// Register host and authentication routes
Expand Down Expand Up @@ -194,7 +194,7 @@ icaModule := ica.NewAppModule(&app.ICAControllerKeeper, nil)
...

// Create controller IBC application stack
icaControllerStack := icacontroller.NewIBCMiddleware(nil, app.ICAControllerKeeper)
icaControllerStack := icacontroller.NewIBCMiddleware(app.ICAControllerKeeper)

// Register controller route
ibcRouter.AddRoute(icacontrollertypes.SubModuleName, icaControllerStack)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ icaAuthModule := icaauth.NewAppModule(appCodec, app.ICAAuthKeeper)
icaAuthIBCModule := icaauth.NewIBCModule(app.ICAAuthKeeper)

// Create controller IBC application stack and host IBC module as desired
icaControllerStack := icacontroller.NewIBCMiddleware(icaAuthIBCModule, app.ICAControllerKeeper)
icaControllerStack := icacontroller.NewIBCMiddlewareWithAuth(icaAuthIBCModule, app.ICAControllerKeeper)
icaHostIBCModule := icahost.NewIBCModule(app.ICAHostKeeper)

// Register host and authentication routes
Expand Down Expand Up @@ -192,7 +192,7 @@ icaAuthModule := icaauth.NewAppModule(appCodec, app.ICAAuthKeeper)
icaAuthIBCModule := icaauth.NewIBCModule(app.ICAAuthKeeper)

// Create controller IBC application stack
icaControllerStack := icacontroller.NewIBCMiddleware(icaAuthIBCModule, app.ICAControllerKeeper)
icaControllerStack := icacontroller.NewIBCMiddlewareWithAuth(icaAuthIBCModule, app.ICAControllerKeeper)

// Register controller and authentication routes
ibcRouter.
Expand Down
42 changes: 26 additions & 16 deletions docs/docs/03-light-clients/02-localhost/01-overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,33 +14,43 @@ slug: /ibc/light-clients/localhost/overview
Learn about the 09-localhost light client module.
:::

The 09-localhost light client module implements a localhost loopback client with the ability to send and receive IBC packets to and from the same state machine.
The 09-localhost light client module implements a stateless localhost loopback client with the ability to send and
receive IBC packets to and from the same state machine.

### Context

In a multichain environment, application developers will be used to developing cross-chain applications through IBC. From their point of view, whether or not they are interacting with multiple modules on the same chain or on different chains should not matter. The localhost client module enables a unified interface to interact with different applications on a single chain, using the familiar IBC application layer semantics.
In a multichain environment, application developers will be used to developing cross-chain applications through IBC.
From their point of view, whether or not they are interacting with multiple modules on the same chain or on different
chains should not matter. The localhost client module enables a unified interface to interact with different
applications on a single chain, using the familiar IBC application layer semantics.

### Implementation

There exists a [single sentinel `ClientState`](03-client-state.md) instance with the client identifier `09-localhost`.
There exists a localhost light client module which can be invoked with the client identifier `09-localhost`. The light
client is stateless, so the `ClientState` is constructed on demand when required.

To supplement this, a [sentinel `ConnectionEnd` is stored in core IBC](04-connection.md) state with the connection identifier `connection-localhost`. This enables IBC applications to create channels directly on top of the sentinel connection which leverage the 09-localhost loopback functionality.
To supplement this, a [sentinel `ConnectionEnd` is stored in core IBC](04-connection.md) state with the connection
identifier `connection-localhost`. This enables IBC applications to create channels directly on top of the sentinel
connection which leverage the 09-localhost loopback functionality.

[State verification](05-state-verification.md) for channel state in handshakes or processing packets is reduced in complexity, the `09-localhost` client can simply compare bytes stored under the standardized key paths.
[State verification](05-state-verification.md) for channel state in handshakes or processing packets is reduced in
complexity, the `09-localhost` client can simply compare bytes stored under the standardized key paths.

### Localhost vs *regular* client

The localhost client aims to provide a unified approach to interacting with applications on a single chain, as the IBC application layer provides for cross-chain interactions. To achieve this unified interface though, there are a number of differences under the hood compared to a 'regular' IBC client (excluding `06-solomachine` and `09-localhost` itself).
The localhost client aims to provide a unified approach to interacting with applications on a single chain, as the IBC
application layer provides for cross-chain interactions. To achieve this unified interface though, there are a number of
differences under the hood compared to a 'regular' IBC client (excluding `06-solomachine` and `09-localhost` itself).

The table below lists some important differences:

| | Regular client | Localhost |
| -------------------------------------------- | --------------------------------------------------------------------------- | --------- |
| Number of clients | Many instances of a client *type* corresponding to different counterparties | A single sentinel client with the client identifier `09-localhost`|
| Client creation | Relayer (permissionless) | `ClientState` is instantiated in the `InitGenesis` handler of the 02-client submodule in core IBC |
| Client updates | Relayer submits headers using `MsgUpdateClient` | Latest height is updated periodically through the ABCI [`BeginBlock`](https://docs.cosmos.network/v0.47/building-modules/beginblock-endblock) interface of the 02-client submodule in core IBC |
| Number of connections | Many connections, 1 (or more) per client | A single sentinel connection with the connection identifier `connection-localhost` |
| Connection creation | Connection handshake, provided underlying client | Sentinel `ConnectionEnd` is created and set in store in the `InitGenesis` handler of the 03-connection submodule in core IBC |
| Counterparty | Underlying client, representing another chain | Client with identifier `09-localhost` in same chain |
| `VerifyMembership` and `VerifyNonMembership` | Performs proof verification using consensus state roots | Performs state verification using key-value lookups in the core IBC store |
| Integration | Expected to register codec types using the `AppModuleBasic` interface | Registers codec types within the core IBC module |
| | Regular client | Localhost |
|----------------------------------------------|-----------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------|
| Number of clients | Many instances of a client *type* corresponding to different counterparties | A single sentinel client with the client identifier `09-localhost` |
| Client creation | Relayer (permissionless) | Implicitly made available by the 02-client submodule in core IBC |
| Client updates | Relayer submits headers using `MsgUpdateClient` | No client updates are required as the localhost implementation is stateless |
| Number of connections | Many connections, 1 (or more) per client | A single sentinel connection with the connection identifier `connection-localhost` |
| Connection creation | Connection handshake, provided underlying client | Sentinel `ConnectionEnd` is created and set in store in the `InitGenesis` handler of the 03-connection submodule in core IBC |
| Counterparty | Underlying client, representing another chain | Client with identifier `09-localhost` in same chain |
| `VerifyMembership` and `VerifyNonMembership` | Performs proof verification using consensus state roots | Performs state verification using key-value lookups in the core IBC store |
| `ClientState` storage | `ClientState` stored and directly provable with `VerifyMembership` | Stateless, so `ClientState` is not provable directly with `VerifyMembership` |
60 changes: 1 addition & 59 deletions docs/docs/03-light-clients/02-localhost/03-client-state.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,64 +5,6 @@ sidebar_position: 3
slug: /ibc/light-clients/localhost/client-state
---


# `ClientState`

The 09-localhost `ClientState` maintains a single field used to track the latest sequence of the state machine i.e. the height of the blockchain.

```go
type ClientState struct {
// the latest height of the blockchain
LatestHeight clienttypes.Height
}
```

The 09-localhost `ClientState` is instantiated in the `InitGenesis` handler of the 02-client submodule in core IBC.
It calls `CreateLocalhostClient`, declaring a new `ClientState` and initializing it with its own client prefixed store.

```go
func (k Keeper) CreateLocalhostClient(ctx sdk.Context) error {
clientModule, found := k.router.GetRoute(exported.LocalhostClientID)
if !found {
return errorsmod.Wrap(types.ErrRouteNotFound, exported.LocalhostClientID)
}

return clientModule.Initialize(ctx, exported.LocalhostClientID, nil, nil)
}
```

It is possible to disable the localhost client by removing the `09-localhost` entry from the `allowed_clients` list through governance.

## Client updates

The latest height is updated periodically through the ABCI [`BeginBlock`](https://docs.cosmos.network/v0.47/building-modules/beginblock-endblock) interface of the 02-client submodule in core IBC.

[See `BeginBlocker` in abci.go.](https://github.com/cosmos/ibc-go/blob/v8.1.1/modules/core/02-client/abci.go#L12)

```go
func BeginBlocker(ctx sdk.Context, k keeper.Keeper) {
// ...

if clientState, found := k.GetClientState(ctx, exported.Localhost); found {
if k.GetClientStatus(ctx, clientState, exported.Localhost) == exported.Active {
k.UpdateLocalhostClient(ctx, clientState)
}
}
}
```

The above calls into the 09-localhost `UpdateState` method of the `ClientState` .
It retrieves the current block height from the application context and sets the `LatestHeight` of the 09-localhost client.

```go
func (cs ClientState) UpdateState(ctx sdk.Context, cdc codec.BinaryCodec, clientStore sdk.KVStore, clientMsg exported.ClientMessage) []exported.Height {
height := clienttypes.GetSelfHeight(ctx)
cs.LatestHeight = height

clientStore.Set(host.ClientStateKey(), clienttypes.MustMarshalClientState(cdc, &cs))

return []exported.Height{height}
}
```

Note that the 09-localhost `ClientState` is not updated through the 02-client interface leveraged by conventional IBC light clients.
The 09-localhost client is stateless and has no types.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ sidebar_position: 5
slug: /ibc/light-clients/localhost/state-verification
---


# State verification

The localhost client handles state verification through the `LightClientModule` interface methods `VerifyMembership` and `VerifyNonMembership` by performing read-only operations directly on the core IBC store.
Expand All @@ -20,3 +19,5 @@ The 09-localhost light client module defines a `SentinelProof` as a single byte.
```go
var SentinelProof = []byte{0x01}
```

The `ClientState` of `09-localhost` is stateless, so it is not directly provable with `VerifyMembership` or `VerifyNonMembership`.
19 changes: 19 additions & 0 deletions docs/docs/05-migrations/13-v8-to-v9.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,17 @@ func NewMsgModuleQuerySafe(
) *MsgModuleQuerySafe {
```

The signature of the [`NewIBCMiddleware` constructor function](https://github.com/cosmos/ibc-go/blob/v8.0.0/modules/apps/27-interchain-accounts/controller/ibc_middleware.go#L35) in the controller submodule now only takes the controller keeper as an argument:

```diff
func NewIBCMiddleware(
- app porttypes.IBCModule,
k keeper.Keeper,
) IBCMiddleware {
```

The base application is then set by default to nil and thus authentication is assumed to be done by a Cosmos SDK module, such as the `x/gov`, `x/group` or `x/auth`, that sends messages to the controller submodule's message server. An authentication module can be set using the newly added [`NewIBCMiddlewareWithAuth` constructor function](https://github.com/cosmos/ibc-go/blob/82b5fb668b6f1c918023fb7be72a8606d2329d81/modules/apps/27-interchain-accounts/controller/ibc_middleware.go#L46).

### IBC core

### API removals
Expand All @@ -102,6 +113,7 @@ func NewMsgModuleQuerySafe(
- The utility function `QueryLatestConsensusState` of `04-channel` CLI has been removed.
- `UnmarshalPacketData` now takes in the context, portID, and channelID. This allows the packet data to be unmarshaled based on the channel version.
- `Router` reference has been removed from IBC core keeper: [#6138](https://github.com/cosmos/ibc-go/pull/6138). Please use `PortKeeper.Router` instead.
- The function `CreateLocalhostClient` has been removed. The localhost client is now stateless.

### 02-client

Expand Down Expand Up @@ -185,3 +197,10 @@ The `IterateConsensusMetadata` function has been removed.
- The `VerifyMembershipMsg` and `VerifyNonMembershipMsg` payloads for `SudoMsg` have been extended to include a new field, `MerklePath`. The existing `Path` field will remain the same. The new `MerklePath` field is used if and only if the provided key path contains non-utf8 encoded symbols, and as a result will encode the JSON field `merkle_path` as a base64 encoded bytestring. See [23-commitment](#23-commitment).
- The `ExportMetadataMsg` struct has been removed and is no longer required for contracts to implement. Core IBC will handle exporting all key/value's written to the store by a light client contract.
- The `ZeroCustomFields` interface function has been removed from the `ClientState` interface. Core IBC only used this function to set tendermint client states when scheduling an IBC software upgrade. The interface function has been replaced by a type assertion.

### 09-localhost

The `09-localhost` light client has been made stateless and will no longer update the client on every block. The `ClientState` is constructed on demand when required.
The `ClientState` itself is therefore no longer provable direcly with `VerifyMembership` or `VerifyNonMembership`.

Previously stored client state data is pruned automatically on IBC module store migration from `ConsensusVersion` 6 to 7.
4 changes: 4 additions & 0 deletions e2e/tests/core/02-client/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -487,6 +487,10 @@ func (s *ClientTestSuite) TestAllowedClientsParam() {
status, err := query.ClientStatus(ctx, chainA, ibctesting.FirstClientID)
s.Require().NoError(err)
s.Require().Equal(ibcexported.Unauthorized.String(), status)

status, err = query.ClientStatus(ctx, chainA, ibcexported.Localhost)
s.Require().NoError(err)
s.Require().Equal(ibcexported.Unauthorized.String(), status)
})
}

Expand Down
15 changes: 0 additions & 15 deletions e2e/tests/transfer/localhost_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,21 +53,6 @@ func (s *LocalhostTransferTestSuite) TestMsgTransfer_Localhost() {

s.Require().NoError(test.WaitForBlocks(ctx, 1, chainA), "failed to wait for blocks")

t.Run("verify begin blocker was executed", func(t *testing.T) {
cs, err := query.ClientState(ctx, chainA, exported.LocalhostClientID)
s.Require().NoError(err)

localhostClientState, ok := cs.(*localhost.ClientState)
s.Require().True(ok)
originalHeight := localhostClientState.LatestHeight

s.Require().NoError(test.WaitForBlocks(ctx, 1, chainA), "failed to wait for blocks")

cs, err = query.ClientState(ctx, chainA, exported.LocalhostClientID)
s.Require().NoError(err)
s.Require().True(cs.(*localhost.ClientState).LatestHeight.GT(originalHeight), "client state height was not incremented")
})

t.Run("channel open init localhost", func(t *testing.T) {
msgChanOpenInit := channeltypes.NewMsgChannelOpenInit(
transfertypes.PortID, channelA.Version,
Expand Down
Loading

0 comments on commit a9c036d

Please sign in to comment.