Skip to content

Commit

Permalink
feat!: enable standalone consumers to reuse existing clients for ICS (#…
Browse files Browse the repository at this point in the history
…2400)

* add connection_id to init params

* add message validation

* add preCCV and connection_id to ProviderInfo

* move preccv and connId to ConsumerGenesisState

* add provider logic for non-empty connId

* validate consumer genesis

* initiate CCV channel handshake

* fix UT

* add changelog entries

* add TODO

* fix indent

* changeover test

* remove setting preccv in app.go

* add todos for genesis transformation

* interchain test desc added to testing.md

* update genesis transformation

* update changeover procedure docs

* Update docs/docs/consumer-development/changeover-procedure.md

Co-authored-by: MSalopek <matija.salopek994@gmail.com>

* Update docs/docs/consumer-development/changeover-procedure.md

Co-authored-by: MSalopek <matija.salopek994@gmail.com>

* Update docs/docs/consumer-development/changeover-procedure.md

Co-authored-by: MSalopek <matija.salopek994@gmail.com>

* Update docs/docs/consumer-development/changeover-procedure.md

Co-authored-by: MSalopek <matija.salopek994@gmail.com>

* Update docs/docs/consumer-development/changeover-procedure.md

Co-authored-by: MSalopek <matija.salopek994@gmail.com>

* tests: remove unused e2e changeover [replaced by interchaintest]

* apply review suggestions

* do not remove preCCV from consumer genesis state

---------

Co-authored-by: stana-ethernal <stana.miric@ethernal.tech>
Co-authored-by: MSalopek <matija.salopek994@gmail.com>
  • Loading branch information
3 people authored Jan 7, 2025
1 parent d1072eb commit d56af59
Show file tree
Hide file tree
Showing 60 changed files with 1,992 additions and 3,004 deletions.
12 changes: 12 additions & 0 deletions .changelog/unreleased/api-breaking/2400-preccv.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
- Enable existing (standalone) chains to use the existing client (and connection)
to the provider chain when becoming a consumer chain. This feature introduces
the following API-breaking changes.
([\#2400](https://github.com/cosmos/interchain-security/pull/2400))

- Add `connection_id` and `preCCV` to `ConsumerGenesisState`, the consumer
genesis state created by the provider chain. If the `connection_id` is not empty,
`preCCV` is set to true and both `provider.client_state` and `provider.consensus_state`
are set to nil (as the consumer doesn't need to create a new provider client).
As a result, for older versions of consumers, the `connection_id` in
`ConsumerInitializationParameters` must be empty and the resulting `ConsumerGenesisState`
needs to be adapted, i.e., both `connection_id` and `preCCV` need to be removed.
13 changes: 13 additions & 0 deletions .changelog/unreleased/features/2400-preccv.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
- Enable existing (standalone) chains to use the existing client (and connection)
to the provider chain when becoming a consumer chain. This feature introduces
the following changes.
([\#2400](https://github.com/cosmos/interchain-security/pull/2400))

- Add `connection_id` to `ConsumerInitializationParameters`, the ID of
the connection end _on the provider chain_ on top of which the CCV channel will
be established. Consumer chain owners can set `connection_id` to a valid ID in
order to reuse the underlying clients.
- Add `connection_id` to the consumer genesis state, the ID of the connection
end _on the consumer chain_ on top of which the CCV channel will be established.
If `connection_id` is a valid ID, then the consumer chain will use the underlying
client as the provider client and it will initiate the channel handshake.
3 changes: 3 additions & 0 deletions .changelog/unreleased/state-breaking/2400-preccv.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
- Enable existing (standalone) chains to use the existing client (and connection)
to the provider chain when becoming a consumer chain.
([\#2400](https://github.com/cosmos/interchain-security/pull/2400))
37 changes: 19 additions & 18 deletions FEATURES.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,23 @@

The following table indicates the major ICS features available in the [currently active releases](./RELEASES.md#version-matrix):

| Feature | `v4.0.0` | `v4.4.0` | `v4.5.0` | `v5.0.0` | `v5.2.0` | `v6.1.0` | `v6.3.0` |
|---------|---------:|---------:|---------:|---------:|----------:|---------:|---------:|
| Feature | `v4.0.0` | `v4.4.0` | `v4.5.0` | `v5.0.0` | `v5.2.0` | `v6.1.0` | `v6.3.0` | `v6.4.0` |
|---------|---------:|---------:|---------:|---------:|----------:|---------:|---------:|---------:|
| [Channel initialization: new chains](https://github.com/cosmos/ibc/blob/main/spec/app/ics-028-cross-chain-validation/overview_and_basic_concepts.md#channel-initialization-new-chains) ||||||||
| [Validator set update](https://github.com/cosmos/ibc/blob/main/spec/app/ics-028-cross-chain-validation/overview_and_basic_concepts.md#validator-set-update) ||||||||
| [Completion of unbonding operations](https://github.com/cosmos/ibc/blob/main/spec/app/ics-028-cross-chain-validation/overview_and_basic_concepts.md#completion-of-unbonding-operations) ||||||||
| [Consumer initiated slashing](https://github.com/cosmos/ibc/blob/main/spec/app/ics-028-cross-chain-validation/overview_and_basic_concepts.md#consumer-initiated-slashing) ||||||||
| [Reward distribution](https://github.com/cosmos/ibc/blob/main/spec/app/ics-028-cross-chain-validation/overview_and_basic_concepts.md#reward-distribution) ||||||||
| [Consumer chain removal](https://github.com/cosmos/ibc/blob/main/spec/app/ics-028-cross-chain-validation/methods.md#consumer-chain-removal) ||||||||
| [Key assignment](https://github.com/cosmos/interchain-security/issues/26) ||||||||
| [Jail throttling](https://github.com/cosmos/interchain-security/issues/404) ||||||||
| [Soft opt-out](https://github.com/cosmos/interchain-security/issues/851) ||||||||
| [Channel initialization: existing chains](https://github.com/cosmos/ibc/blob/main/spec/app/ics-028-cross-chain-validation/overview_and_basic_concepts.md#channel-initialization-existing-chains) (aka [Standalone to consumer changeover](https://github.com/cosmos/interchain-security/issues/756)) ||||||||
| [Cryptographic verification of equivocation](https://github.com/cosmos/interchain-security/issues/732) ||||||||
| [Jail throttling with retries](https://github.com/cosmos/interchain-security/issues/713) ||||||||
| [ICS epochs](https://cosmos.github.io/interchain-security/adrs/adr-014-epochs) ||||||||
| [Partial Set Security](https://cosmos.github.io/interchain-security/adrs/adr-015-partial-set-security) ||||||||
| [Inactive Provider Validators](https://cosmos.github.io/interchain-security/adrs/adr-017-allowing-inactive-validators) ||||||||
| [Permissionless](https://cosmos.github.io/interchain-security/adrs/adr-019-permissionless-ics) ||||||||
| [ICS Rewards in non-native denoms](https://github.com/cosmos/interchain-security/issues/1634) ||||||||
| [Validator set update](https://github.com/cosmos/ibc/blob/main/spec/app/ics-028-cross-chain-validation/overview_and_basic_concepts.md#validator-set-update) |||||||||
| [Completion of unbonding operations](https://github.com/cosmos/ibc/blob/main/spec/app/ics-028-cross-chain-validation/overview_and_basic_concepts.md#completion-of-unbonding-operations) |||||||||
| [Consumer initiated slashing](https://github.com/cosmos/ibc/blob/main/spec/app/ics-028-cross-chain-validation/overview_and_basic_concepts.md#consumer-initiated-slashing) |||||||||
| [Reward distribution](https://github.com/cosmos/ibc/blob/main/spec/app/ics-028-cross-chain-validation/overview_and_basic_concepts.md#reward-distribution) |||||||||
| [Consumer chain removal](https://github.com/cosmos/ibc/blob/main/spec/app/ics-028-cross-chain-validation/methods.md#consumer-chain-removal) |||||||||
| [Key assignment](https://github.com/cosmos/interchain-security/issues/26) |||||||||
| [Jail throttling](https://github.com/cosmos/interchain-security/issues/404) |||||||||
| [Soft opt-out](https://github.com/cosmos/interchain-security/issues/851) |||||||||
| [Channel initialization: existing chains](https://github.com/cosmos/ibc/blob/main/spec/app/ics-028-cross-chain-validation/overview_and_basic_concepts.md#channel-initialization-existing-chains) (aka [Standalone to consumer changeover](https://github.com/cosmos/interchain-security/issues/756)) |||||||||
| [Cryptographic verification of equivocation](https://github.com/cosmos/interchain-security/issues/732) |||||||||
| [Jail throttling with retries](https://github.com/cosmos/interchain-security/issues/713) |||||||||
| [ICS epochs](https://cosmos.github.io/interchain-security/adrs/adr-014-epochs) |||||||||
| [Partial Set Security](https://cosmos.github.io/interchain-security/adrs/adr-015-partial-set-security) |||||||||
| [Inactive Provider Validators](https://cosmos.github.io/interchain-security/adrs/adr-017-allowing-inactive-validators) |||||||||
| [Permissionless](https://cosmos.github.io/interchain-security/adrs/adr-019-permissionless-ics) |||||||||
| [ICS Rewards in non-native denoms](https://github.com/cosmos/interchain-security/issues/1634) |||||||||
| [Customizable Slashing and Jailing](https://cosmos.github.io/interchain-security/adrs/adr-020-cutomizable_slashing_and_jailing) |||||||||
14 changes: 10 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,17 @@ test-integration-cov:
go test ./tests/integration/... -timeout 30m -coverpkg=./... -coverprofile=integration-profile.out -covermode=atomic

# run interchain tests
# we can use PROVIDER_IMAGE_TAG and PROVIDER_IMAGE_NAME to run tests with a desired docker image,
# including a locally built one that, for example, contains some of our changes that are not yet on the main branch.
# if not provided, default value for PROVIDER_IMAGE_TAG is "latest" and for PROVIDER_IMAGE_NAME "ghcr.io/cosmos/interchain-security"
# we can use PROVIDER_IMAGE_TAG, PROVIDER_IMAGE_NAME, SOUVEREIGN_IMAGE_TAG, and SOUVEREIGN_IMAGE_NAME to run tests with desired docker images,
# including locally built ones that, for example, contain some of our changes that are not yet on the main branch.
# if not provided, default value for PROVIDER_IMAGE_TAG and SOUVEREIGN_IMAGE_TAG is "latest" and for PROVIDER_IMAGE_NAME
# and SOUVEREIGN_IMAGE_NAME is "ghcr.io/cosmos/interchain-security"
test-interchain:
cd tests/interchain && PROVIDER_IMAGE_NAME=$(PROVIDER_IMAGE_NAME) PROVIDER_IMAGE_TAG=$(PROVIDER_IMAGE_TAG) go test ./... -timeout 30m
cd tests/interchain && \
PROVIDER_IMAGE_NAME=$(PROVIDER_IMAGE_NAME) \
PROVIDER_IMAGE_TAG=$(PROVIDER_IMAGE_TAG) \
SOUVEREIGN_IMAGE_NAME=$(SOUVEREIGN_IMAGE_NAME) \
SOUVEREIGN_IMAGE_TAG=$(SOUVEREIGN_IMAGE_TAG) \
go test ./... -timeout 30m

# run mbt tests
test-mbt:
Expand Down
19 changes: 11 additions & 8 deletions RELEASES.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ All missing minor release versions have been discontinued.
| `v5.2.x` | May 9, 2025 |
| `v6.1.x` | Sep 13, 2025 |
| `v6.3.x` | Sep 13, 2025 |
| `v6.4.x` | Sep 13, 2025 |

## Version Matrix

Expand All @@ -80,6 +81,7 @@ Versions of Golang, IBC, Cosmos SDK and CometBFT used by ICS in the currently ac
| [v5.2.0](https://github.com/cosmos/interchain-security/releases/tag/v5.2.0) | 1.22 | v8.3.2 | v0.50.8 | v0.38.9 | |
| [v6.1.0](https://github.com/cosmos/interchain-security/releases/tag/v6.1.0) | 1.22 | v8.5.0 | v0.50.9 | v0.38.11 | |
| [v6.3.0](https://github.com/cosmos/interchain-security/releases/tag/v6.3.0) | 1.22 | v8.5.1 | v0.50.9 | v0.38.11 | |
| [v6.4.0](https://github.com/cosmos/interchain-security/releases/tag/v6.4.0) | 1.22 | v8.5.2 | v0.50.11 | v0.38.15 | |

**Note:** For a list of major ICS features available in the currently active releases, see [FEATURES.md](./FEATURES.md).

Expand All @@ -89,14 +91,15 @@ A MAJOR version of ICS will always be backwards compatible with the previous MAJ

The following table indicates the compatibility of currently active releases:

| Consumer | Provider | `v5.2.0` | `v6.1.0` | `v6.3.0` |
| -------- | -------- | -------- | -------- | -------- |
| `v4.0.0` | ||| ✅ (1) |
| `v4.4.0` | ||| ✅ (1) |
| `v4.5.0` | ||||
| `v5.0.0` | ||| ✅ (1) |
| `v5.2.0` | ||| ✅ (1) |
| `v6.3.0` | ||||
| Consumer | Provider | `v5.2.0` | `v6.1.0` | `v6.3.0` | `v6.4.0` |
| ------------------- | -------- | -------- | -------- | -------- | -------- |
| `v4.0.0` | ||| ✅ (1) | ✅ (1) |
| `v4.4.0` | ||| ✅ (1) | ✅ (1) |
| `v4.5.0` | |||| ✅ (1) |
| `v5.0.0` | ||| ✅ (1) | ✅ (1) |
| `v5.2.0` | ||| ✅ (1) | ✅ (1) |
| `v6.2.0` / `v6.3.0` | |||| ✅ (1) |
| `v6.4.0` | |||||

#### Notes
The following adjustments must be made to the CCV consumer genesis state that is obtained from the provider chain after the spawn time is reached in order for the consumer chain to start without errors.
Expand Down
12 changes: 12 additions & 0 deletions TESTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,13 @@ Notably, as-of-now simulation tests do not include any multi-chain testing, so c
To test compatibility between different provider and consumer versions the [E2E tests](tests/e2e/) were extended by compatibility tests. The test cases perform basic sanity tests against the selected provider and consumer versions. A selected combination of provider and consumer versions are tested on a nightly bases and can be run locally with the
related make command listed below.

## Interchain Tests
The interchain tests evaluate the fundamental functionalities of both the provider and provider-consumer chains. This includes testing the transition of a sovereign chain to a consumer chain. These tests leverage the interchain framework, where each chain node operates within its own Docker container.To execute these tests, you can use the default ics image built from the latest code on the main branch. Alternatively, tests can be run with a specific image and version, whether published or locally built. The tests are triggered using the make test-interchain command. For more details, see the [Running Tests](#running-tests) section.
- If you wish to build the docker image from the code on your desired branch, run this command:
```bash
docker build -t test-image:local .
```

## Running Tests
Tests can be run using `make`:

Expand Down Expand Up @@ -80,6 +87,11 @@ make sim-full

#run simulation tests where providerModule.max_provider_consensus_validators=stakingModule.max_validators=100
make sim-full-no-inactive-vals

#run interchain tests (running with the latest image ghcr.io/cosmos/interchain-security:latest)
make test-interchain
# run interchain tests with specific image(e.g. test-image:local)
make test-interchain PROVIDER_IMAGE_NAME=test-image PROVIDER_IMAGE_TAG=local SOUVEREIGN_IMAGE_NAME=test-image SOUVEREIGN_IMAGE_TAG=local
```

Alternatively you can run tests using `go test`:
Expand Down
2 changes: 0 additions & 2 deletions app/consumer-democracy/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -689,8 +689,6 @@ func New(

consumerGenesis := consumertypes.GenesisState{}
appCodec.MustUnmarshalJSON(appState[consumertypes.ModuleName], &consumerGenesis)

consumerGenesis.PreCCV = true
app.ConsumerKeeper.InitGenesis(sdkCtx, &consumerGenesis)

app.Logger().Info("start to run module migrations...")
Expand Down
Loading

0 comments on commit d56af59

Please sign in to comment.