Skip to content

Commit

Permalink
docs: some improvements to v9 migration docs (#7258)
Browse files Browse the repository at this point in the history
* some improvements

* alignment

* more alignment
  • Loading branch information
Carlos Rodriguez authored Sep 10, 2024
1 parent 2ddd5cf commit 502105d
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 16 deletions.
79 changes: 66 additions & 13 deletions docs/docs/05-migrations/13-v8-to-v9.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,8 @@ func NewKeeper(

### 03-connection

- The [functions `GetState()`, `GetClientID()`, `GetCounterparty()`, `GetVersions()`, and `GetDelayPeriod()`](https://github.com/cosmos/ibc-go/blob/v8.0.0/modules/core/03-connection/types/connection.go#L25-L48) of the `Connection` type have been removed.
- The [functions `GetClientID()`, `GetConnectionID()`, and `GetPrefix()`](https://github.com/cosmos/ibc-go/blob/v8.0.0/modules/core/03-connection/types/connection.go#L79-L92) of the `Counterparty` type have been removed.
- The [functions `GetState()`, `GetClientID()`, `GetCounterparty()`, `GetVersions()`, and `GetDelayPeriod()`](https://github.com/cosmos/ibc-go/blob/v8.0.0/modules/core/03-connection/types/connection.go#L25-L48) of the `Connection` type have been removed. Please access the fields directly.
- The [functions `GetClientID()`, `GetConnectionID()`, and `GetPrefix()`](https://github.com/cosmos/ibc-go/blob/v8.0.0/modules/core/03-connection/types/connection.go#L79-L92) of the `Counterparty` type have been removed. Please access the fields directly.

#### Removal of self client and consensus state from connection handshake

Expand Down Expand Up @@ -133,7 +133,7 @@ func NewMsgConnectionOpenAck(
### 04-channel

- The utility function [`QueryLatestConsensusState`](https://github.com/cosmos/ibc-go/blob/v8.0.0/modules/core/04-channel/client/utils/utils.go#L130) of the CLI has been removed.
- The [functions `GetState()`, `GetOrdering()`, `GetCounterparty()`, `GetConnectionHops()`, `GetVersion()`](https://github.com/cosmos/ibc-go/blob/v8.0.0/modules/core/04-channel/types/channel.go#L29-L52) of the `Channel` type have been removed.
- The [functions `GetState()`, `GetOrdering()`, `GetCounterparty()`, `GetConnectionHops()`, `GetVersion()`](https://github.com/cosmos/ibc-go/blob/v8.0.0/modules/core/04-channel/types/channel.go#L29-L52) of the `Channel` type have been removed. Please access the fields directly.
- The [functions `IsOpen()` and `IsClosed()`](https://github.com/cosmos/ibc-go/blob/v8.0.0/modules/core/04-channel/types/channel.go#L54-L62) of the `Channel` type have been removed.
- The [functions `GetPortID()`, `GetChannelID()`](https://github.com/cosmos/ibc-go/blob/v8.0.0/modules/core/04-channel/types/channel.go#L92-L100) of the `CounterpartyChannel` type have been removed.
- Functions [`ChanCloseConfirmWithCounterpartyUpgradeSequence`](https://github.com/cosmos/ibc-go/blob/v8.1.0/modules/core/04-channel/keeper/handshake.go#L446) and [`TimeoutOnCloseWithCounterpartyUpgradeSequence`](https://github.com/cosmos/ibc-go/blob/v8.1.0/modules/core/04-channel/keeper/timeout.go#L226) have been removed. Please use `ChanCloseConfirm` and `TimeoutOnClose` with the updated signature that takes the counterparty upgrade sequence as extra argument:
Expand All @@ -146,7 +146,7 @@ func (k *Keeper) ChanCloseConfirm(
chanCap *capabilitytypes.Capability,
initProof []byte,
proofHeight exported.Height,
+ counterpartyUpgradeSequence uint64,
+ counterpartyUpgradeSequence uint64,
)

func (k *Keeper) TimeoutOnClose(
Expand All @@ -157,7 +157,7 @@ func (k *Keeper) TimeoutOnClose(
closedProof []byte,
proofHeight exported.Height,
nextSequenceRecv uint64,
+ counterpartyUpgradeSequence uint64,
+ counterpartyUpgradeSequence uint64,
)
```

Expand Down Expand Up @@ -392,6 +392,51 @@ type ContractKeeper interface {

### IBC testing package

- In the `TestChain` struct the field [`LastHeader`](https://github.com/cosmos/ibc-go/blob/v8.0.0/testing/chain.go#L59) has been renamed to `LatestCommittedHeader`, the field [`CurrentHeader`](https://github.com/cosmos/ibc-go/blob/v8.0.0/testing/chain.go#L60) has been renamed to `ProposedHeader` and the [`QueryServer` interface](https://github.com/cosmos/ibc-go/blob/v8.0.0/testing/chain.go#L61) has been removed.

```diff
type TestChain struct {
testing.TB

Coordinator *Coordinator
App TestingApp
ChainID string
- LastHeader *ibctm.Header // header for last block height committed
+ LatestCommittedHeader *ibctm.Header // header for last block height committed
- CurrentHeader cmtproto.Header // header for current block height
+ ProposedHeader cmtproto.Header // proposed (uncommitted) header for current block height
- QueryServer types.QueryServer
TxConfig client.TxConfig
Codec codec.Codec

Vals *cmttypes.ValidatorSet
NextVals *cmttypes.ValidatorSet

// Signers is a map from validator address to the PrivValidator
// The map is converted into an array that is the same order as the validators right before signing commit
// This ensures that signers will always be in correct order even as validator powers change.
// If a test adds a new validator after chain creation, then the signer map must be updated to include
// the new PrivValidator entry.
Signers map[string]cmttypes.PrivValidator

// autogenerated sender private key
SenderPrivKey cryptotypes.PrivKey
SenderAccount sdk.AccountI

SenderAccounts []SenderAccount

// Short-term solution to override the logic of the standard SendMsgs function.
// See issue https://github.com/cosmos/ibc-go/issues/3123 for more information.
SendMsgsOverride func(msgs ...sdk.Msg) (*abci.ExecTxResult, error)
}
```

Submodule query servers can be constructed directly by passing their associated keeper to the appropriate constructor function. For example:

```golang
clientQueryServer := clientkeeper.NewQueryServer(app.IBCKeeper.ClientKeeper)
```

- The `mock.PV` type has been removed in favour of [`cmttypes.MockPV`](https://github.com/cometbft/cometbft/blob/v0.38.5/types/priv_validator.go#L50) in [#5709](https://github.com/cosmos/ibc-go/pull/5709).
- [Functions `ConstructUpdateTMClientHeader` and `ConstructUpdateTMClientHeaderWithTrustedHeight`](https://github.com/cosmos/ibc-go/blob/v8.0.0/testing/chain.go#L446-L481) of `TestChain` type have been replaced with `IBCClientHeader` function. This function will construct a 07-tendermint header to update the light client on the counterparty chain. The trusted height must be passed in as a non-zero height.
- [`GetValsAtHeight`](https://github.com/cosmos/ibc-go/blob/v8.0.0/testing/chain.go#L401) has been renamed to [`GetTrustedValidators`](https://github.com/cosmos/ibc-go/blob/release/v9.0.x/testing/chain.go#L403).
Expand All @@ -412,12 +457,6 @@ func AssertEvents(
)
```

- The [`QueryServer` interface has been removed from the `TestChain` struct](https://github.com/cosmos/ibc-go/blob/v8.0.0/testing/chain.go#L61). Submodule query servers can be constructed directly by passing their associated keeper to the appropriate constructor function. For example:

```golang
clientQueryServer := clientkeeper.NewQueryServer(app.IBCKeeper.ClientKeeper)
```

- The signature of the function `QueryConnectionHandshakeProof` has changed, since the validation of self client and consensus state has been remove from the connection handshake:

```diff
Expand All @@ -431,16 +470,30 @@ func (endpoint *Endpoint) QueryConnectionHandshakeProof() (
- The functions [`GenerateClientStateProof` and `GenerateConsensusStateProof`](https://github.com/cosmos/ibc-go/blob/v8.0.0/testing/solomachine.go#L513-L547)
have been removed.

### API deprecation notice
#### API deprecation notice

- The testing package functions `Setup`, `SetupClients`, `SetupConnections`, `CreateConnections`, and `CreateChannels` of the `Coordinator` type have been deprecated and will be removed in v10. Please use the new functions `Setup`, `SetupClients`, `SetupConnections`, `CreateConnections`, `CreateChannels` of the `Path` type.
- The functions `Setup`, `SetupClients`, `SetupConnections`, `CreateConnections`, and `CreateChannels` of the `Coordinator` type have been deprecated and will be removed in v11. Please use the new functions `Setup`, `SetupClients`, `SetupConnections`, `CreateConnections`, `CreateChannels` of the `Path` type.
- The function `SetChannelState` of the `Path` type has been deprecated and will be removed in v11. Please use the new function `UpdateChannel` of the `Path` type.

## Relayers

### Events

#### 02-client

- The function `CreateClient` of the keeper expects now a string for the client type (e.g. `07-tendermint`) and two `[]byte` for the Protobuf-serialized client and consensus states:

```diff
func (k *Keeper) CreateClient(
ctx sdk.Context,
+ clientType string,
- clientState exported.ClientState,
- consensusState exported.ConsensusState,
+ clientState []byte,
+ consensusState []byte,
) (string, error)
```

- The [`header` attribute](https://github.com/cosmos/ibc-go/blob/v8.0.0/modules/core/02-client/keeper/events.go#L60) has been removed from the `update_client` event in [\#5110](https://github.com/cosmos/ibc-go/pull/5110).

#### 04-channel
Expand Down
3 changes: 1 addition & 2 deletions modules/core/04-channel/keeper/handshake_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -572,8 +572,7 @@ func (suite *KeeperTestSuite) TestChanCloseConfirm() {
{"success with upgrade info", func() {
path.Setup()

err := path.EndpointA.SetChannelState(types.CLOSED)
suite.Require().NoError(err)
path.EndpointA.UpdateChannel(func(channel *types.Channel) { channel.State = types.CLOSED })

// add mock upgrade info to simulate that the channel is closing during
// an upgrade and verify that the upgrade information is deleted
Expand Down
2 changes: 1 addition & 1 deletion testing/endpoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -776,7 +776,7 @@ func (endpoint *Endpoint) ChanUpgradeCancel() error {
return endpoint.Chain.sendMsgs(msg)
}

// Deprecated: usage of this function should be replaced by `UpdateChannelState`
// Deprecated: usage of this function should be replaced by `UpdateChannel`
// SetChannelState sets a channel state
func (endpoint *Endpoint) SetChannelState(state channeltypes.State) error {
channel := endpoint.GetChannel()
Expand Down

0 comments on commit 502105d

Please sign in to comment.