From 01daa3c36ea003dc9212d675f553e7452b337ec2 Mon Sep 17 00:00:00 2001 From: mpoke Date: Thu, 11 Jan 2024 14:13:21 +0100 Subject: [PATCH 01/46] cleanup ./changelog entries --- .changelog/epilogue.md | 198 +----------------- .../consumer/1146-pending-packets.md | 2 - .../consumer/1150-revert-wire-breaking.md | 2 - .../consumer/1244-validate-transfer.md | 2 - .../bug-fixes/consumer/1262-fee-pool-addr.md | 2 - .../bug-fixes/consumer/1295-migration.md | 2 - .../v3.2.0/dependencies/1196-bump-ibc.md | 3 - .../v3.2.0/dependencies/1258-bump-ibc.md | 3 - .../v3.2.0/dependencies/1258-bump-sdk.md | 3 - .../v3.2.0/dependencies/1259-bump-sdk.md | 3 - .../consumer/1024-jail-throttling-v2.md | 2 - .../consumer/1164-provider-info-query.md | 4 - .../provider/1076-export-timestamps.md | 2 - .../features/provider/1280-reward-denoms.md | 3 - .../improvements/1244-consumer-unbonding.md | 2 - .../consumer/1037-optimize-storage.md | 2 - .../v3.2.0/state-breaking/1196-bump-ibc.md | 3 - .../state-breaking/1244-consumer-unbonding.md | 2 - .../v3.2.0/state-breaking/1258-bump-ibc.md | 3 - .../v3.2.0/state-breaking/1258-bump-sdk.md | 3 - .../v3.2.0/state-breaking/1259-bump-sdk.md | 3 - .../consumer/1024-jail-throttling-v2.md | 2 - .../consumer/1037-optimize-storage.md | 2 - .../consumer/1146-pending-packets.md | 2 - .../consumer/1150-revert-wire-breaking.md | 2 - .../consumer/1244-validate-transfer.md | 2 - .../consumer/1262-fee-pool-addr.md | 2 - .../state-breaking/consumer/1295-migration.md | 2 - .../provider/1280-reward-denoms.md | 3 - .changelog/v3.2.0/summary.md | 1 - ...ic-verification-of-equivocation-feature.md | 2 - .../v3.3.0/dependencies/1373-bump-ibc.md | 3 - .../v3.3.0/features/1336-quint-model.md | 2 - .../1339-check-key-assignment-in-use.md | 3 - ...1340-cryptographic-equivocation-feature.md | 4 - .../improvements/1324-consumer-genesis.md | 16 -- .../v3.3.0/improvements/1350-cleanup-types.md | 3 - .../provider/1503-query-key-assignment.md | 1 - .../state-breaking/1324-consumer-genesis.md | 2 - .../state-breaking/1460-msg-validation.md | 3 - .../1339-check-key-assignment-in-use.md | 3 - ...1340-cryptographic-equivocation-feature.md | 4 - .changelog/v3.3.0/summary.md | 1 - 43 files changed, 2 insertions(+), 312 deletions(-) delete mode 100644 .changelog/v3.2.0/bug-fixes/consumer/1146-pending-packets.md delete mode 100644 .changelog/v3.2.0/bug-fixes/consumer/1150-revert-wire-breaking.md delete mode 100644 .changelog/v3.2.0/bug-fixes/consumer/1244-validate-transfer.md delete mode 100644 .changelog/v3.2.0/bug-fixes/consumer/1262-fee-pool-addr.md delete mode 100644 .changelog/v3.2.0/bug-fixes/consumer/1295-migration.md delete mode 100644 .changelog/v3.2.0/dependencies/1196-bump-ibc.md delete mode 100644 .changelog/v3.2.0/dependencies/1258-bump-ibc.md delete mode 100644 .changelog/v3.2.0/dependencies/1258-bump-sdk.md delete mode 100644 .changelog/v3.2.0/dependencies/1259-bump-sdk.md delete mode 100644 .changelog/v3.2.0/features/consumer/1024-jail-throttling-v2.md delete mode 100644 .changelog/v3.2.0/features/consumer/1164-provider-info-query.md delete mode 100644 .changelog/v3.2.0/features/provider/1076-export-timestamps.md delete mode 100644 .changelog/v3.2.0/features/provider/1280-reward-denoms.md delete mode 100644 .changelog/v3.2.0/improvements/1244-consumer-unbonding.md delete mode 100644 .changelog/v3.2.0/improvements/consumer/1037-optimize-storage.md delete mode 100644 .changelog/v3.2.0/state-breaking/1196-bump-ibc.md delete mode 100644 .changelog/v3.2.0/state-breaking/1244-consumer-unbonding.md delete mode 100644 .changelog/v3.2.0/state-breaking/1258-bump-ibc.md delete mode 100644 .changelog/v3.2.0/state-breaking/1258-bump-sdk.md delete mode 100644 .changelog/v3.2.0/state-breaking/1259-bump-sdk.md delete mode 100644 .changelog/v3.2.0/state-breaking/consumer/1024-jail-throttling-v2.md delete mode 100644 .changelog/v3.2.0/state-breaking/consumer/1037-optimize-storage.md delete mode 100644 .changelog/v3.2.0/state-breaking/consumer/1146-pending-packets.md delete mode 100644 .changelog/v3.2.0/state-breaking/consumer/1150-revert-wire-breaking.md delete mode 100644 .changelog/v3.2.0/state-breaking/consumer/1244-validate-transfer.md delete mode 100644 .changelog/v3.2.0/state-breaking/consumer/1262-fee-pool-addr.md delete mode 100644 .changelog/v3.2.0/state-breaking/consumer/1295-migration.md delete mode 100644 .changelog/v3.2.0/state-breaking/provider/1280-reward-denoms.md delete mode 100644 .changelog/v3.2.0/summary.md delete mode 100644 .changelog/v3.3.0/api-breaking/provider/1340-add-cryptographic-verification-of-equivocation-feature.md delete mode 100644 .changelog/v3.3.0/dependencies/1373-bump-ibc.md delete mode 100644 .changelog/v3.3.0/features/1336-quint-model.md delete mode 100644 .changelog/v3.3.0/features/provider/1339-check-key-assignment-in-use.md delete mode 100644 .changelog/v3.3.0/features/provider/1340-cryptographic-equivocation-feature.md delete mode 100644 .changelog/v3.3.0/improvements/1324-consumer-genesis.md delete mode 100644 .changelog/v3.3.0/improvements/1350-cleanup-types.md delete mode 100644 .changelog/v3.3.0/improvements/provider/1503-query-key-assignment.md delete mode 100644 .changelog/v3.3.0/state-breaking/1324-consumer-genesis.md delete mode 100644 .changelog/v3.3.0/state-breaking/1460-msg-validation.md delete mode 100644 .changelog/v3.3.0/state-breaking/provider/1339-check-key-assignment-in-use.md delete mode 100644 .changelog/v3.3.0/state-breaking/provider/1340-cryptographic-equivocation-feature.md delete mode 100644 .changelog/v3.3.0/summary.md diff --git a/.changelog/epilogue.md b/.changelog/epilogue.md index 88987ef0a0..15e2568e25 100644 --- a/.changelog/epilogue.md +++ b/.changelog/epilogue.md @@ -1,197 +1,3 @@ -## v3.1.0 +## Previous Versions -Date July 11th, 2023 - -A minor upgrade to v3.0.0, which removes the panic in the consumer ccv module which would occur in an emergency scenario where the ccv channel is closed. This release also fixes how a distribution related event is emitted, and bumps cometbft. - -* (feat) [#1127](https://github.com/cosmos/interchain-security/pull/1127) Remove consumer panic when ccv channel is closed -* (fix) [#720](https://github.com/cosmos/interchain-security/issues/720) Fix the attribute `AttributeDistributionTotal` value in `FeeDistribution` event emit. -* (deps) [#1119](https://github.com/cosmos/interchain-security/pull/1119) bump cometbft from `v0.37.1` to `0.37.2`. - -## v3.0.0 - -Date: June 21st, 2023 - -Interchain Security v3 uses SDK 0.47 and IBC 7. - -* (fix) [#1093](https://github.com/cosmos/interchain-security/pull/1093) Make SlashPacketData backward compatible when sending data over the wire -* (deps) [#1019](https://github.com/cosmos/interchain-security/pull/1019) Bump multiple dependencies. - * Bump [cosmos-sdk](https://github.com/cosmos/cosmos-sdk) to [v0.47.3](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.47.3). - * Bump [ibc-go](https://github.com/cosmos/ibc-go) to [v7.1.0](https://github.com/cosmos/ibc-go/releases/tag/v7.1.0). - * Bump [CometBFT](https://github.com/cometbft/cometbft) to [v0.37.1](https://github.com/cometbft/cometbft/releases/tag/v0.37.1). -* `[x/ccv/provider]` (fix) [#945](https://github.com/cosmos/interchain-security/issues/945) Refactor `AfterUnbondingInitiated` to not panic when `PutUnbondingOnHold` returns error. -* `[x/ccv/provider]` (fix) [#977](https://github.com/cosmos/interchain-security/pull/977) Avoids panicking the provider when an unbonding delegation was removed through a `CancelUnbondingDelegation` message. -* `[x/ccv/democracy]` (feat) [#1019](https://github.com/cosmos/interchain-security/pull/1019) Whitelisting non-legacy params in the "democracy module" require the entire module to be whitelisted. - -## v2.4.0-lsm - -*November 20, 2023* - -* (fix) [#1439](https://github.com/cosmos/interchain-security/pull/1439) Fix unmarshaling for the CLI consumer double vote cmd. -* (feat!) [#1435](https://github.com/cosmos/interchain-security/pull/1435) Add height-base filter for consumer equivocation evidence. - -## v2.3.0-provider-lsm - -*November 15, 2023* - -❗ *This release is deprecated and should not be used in production.* - -* (fix!) [#1422](https://github.com/cosmos/interchain-security/pull/1422) Fix the misbehaviour handling by verifying the signatures of byzantine validators. - -## v2.2.0-provider-lsm - -❗ *This release is deprecated and should not be used in production.* - -### Cryptographic verification of equivocation -* New feature enabling the provider chain to verify equivocation evidence on its own instead of trusting consumer chains, see [EPIC](https://github.com/cosmos/interchain-security/issues/732). - -## v2.1.0-provider-lsm - -Date: September 15th, 2023 - -* (feature!) [#1280](https://github.com/cosmos/interchain-security/pull/1280) provider proposal for changing reward denoms - -## v2.0.0-lsm - -Date: August 18th, 2023 - -* (deps!) [#1120](https://github.com/cosmos/interchain-security/pull/1120) Bump [Cosmos SDK](https://github.com/cosmos/cosmos-sdk) to [v0.45.16-ics-lsm](https://github.com/cosmos/cosmos-sdk/tree/v0.45.16-ics-lsm). This requires adapting ICS to support this SDK release. Changes are state breaking. -* (fix) [#720](https://github.com/cosmos/interchain-security/issues/720) Fix the attribute `AttributeDistributionTotal` value in `FeeDistribution` event emit. - -## v2.0.0 - -Date: June 1st, 2023 - -Unlike prior releases, the ICS `v2.0.0` release will be based on the main branch. `v2.0.0` will contain all the accumulated PRs from the various releases below, along with other PRs that were merged, but not released to production. After `v2.0.0`, we plan to revamp release practices, and how we modularize the repo for consumer/provider. - -Upgrading a provider from `v1.1.0-multiden` to `v2.0.0` will require state migrations. See [migration.go](https://github.com/cosmos/interchain-security/blob/v2.0.0/x/ccv/provider/keeper/migration.go). - -Upgrading a consumer from `v1.2.0-multiden` to `v2.0.0` will NOT require state migrations. - -Some PRs from v2.0.0 may reappear from other releases below. This is due to the fact that ICS v1.1.0 deviates from the commit ordering of the main branch, and other releases thereafter are based on v1.1.0. - -### High level changes included in v2.0.0 - -* MVP for standalone to consumer changeover, see [EPIC](https://github.com/cosmos/interchain-security/issues/756) -* MVP for soft opt out, see [EPIC](https://github.com/cosmos/interchain-security/issues/851) -* Various fixes, critical and non-critical -* Docs updates which should not affect production code - -## Notable PRs included in v2.0.0 - -* (feat!) Add DistributionTransmissionChannel to ConsumerAdditionProposal [#965](https://github.com/cosmos/interchain-security/pull/965) -* (feat/fix) limit vsc matured packets handled per endblocker [#1004](https://github.com/cosmos/interchain-security/pull/1004) -* (fix) consumer key prefix order to avoid complex migrations [#963](https://github.com/cosmos/interchain-security/pull/963) and [#991](https://github.com/cosmos/interchain-security/pull/991). The latter PR is the proper fix. -* (feat) v1->v2 migrations to accommodate a bugfix having to do with store keys, introduce new params, and deal with consumer genesis state schema changes [#975](https://github.com/cosmos/interchain-security/pull/975) and [#997](https://github.com/cosmos/interchain-security/pull/997) -* (deps) Bump github.com/cosmos/ibc-go/v4 from 4.4.0 to 4.4.2 [#982](https://github.com/cosmos/interchain-security/pull/982) -* (fix) partially revert key assignment type safety PR [#980](https://github.com/cosmos/interchain-security/pull/980) -* (fix) Remove panics on failure to send IBC packets [#876](https://github.com/cosmos/interchain-security/pull/876) -* (fix) Prevent denom DOS [#931](https://github.com/cosmos/interchain-security/pull/931) -* (fix) multisig for assigning consumer key, use json [#916](https://github.com/cosmos/interchain-security/pull/916) -* (deps) Bump github.com/cosmos/ibc-go/v4 from 4.3.0 to 4.4.0 [#902](https://github.com/cosmos/interchain-security/pull/902) -* (feat) Add warnings when provider unbonding is shorter than consumer unbonding [#858](https://github.com/cosmos/interchain-security/pull/858) -* (chore) use go 1.19 [#899](https://github.com/cosmos/interchain-security/pull/899), [#840](https://github.com/cosmos/interchain-security/pull/840) -* (feat) Standalone to consumer changeover - recycle existing transfer channel [#832](https://github.com/cosmos/interchain-security/pull/832) -* (deps) Bump IBC [862](https://github.com/cosmos/interchain-security/pull/862) -* (testing) Add tests for soft opt out [#857](https://github.com/cosmos/interchain-security/pull/857) -* (feat) Standalone to consumer changeover - staking functionalities [#794](https://github.com/cosmos/interchain-security/pull/794) -* (fix) prevent provider from sending VSCPackets with multiple updates for the same validator [#850](https://github.com/cosmos/interchain-security/pull/850) -* (feat) Soft opt out [#833](https://github.com/cosmos/interchain-security/issues/833) -* (fix) Correctly handle VSC packet with duplicate val updates on consumer [#846](https://github.com/cosmos/interchain-security/pull/846) -* (deps) bump sdk to v0.45.15.ics [#805](https://github.com/cosmos/interchain-security/pull/805) -* (refactor) Remove spm module [#812](https://github.com/cosmos/interchain-security/pull/812) -* (feat) Standalone to consumer changeover part 1 [#757](https://github.com/cosmos/interchain-security/pull/757) -* (chore) Swap names of e2e and integration tests [#681](https://github.com/cosmos/interchain-security/pull/681) -* (fix) fix StopConsumerChain not running in cachedContext [#802](https://github.com/cosmos/interchain-security/pull/802). Also in earlier releases with different commit order! -* (docs) Introduce docs website [#759](https://github.com/cosmos/interchain-security/pull/759) -* (fix) Serialize correct byte prefix for SlashLogKey [#786](https://github.com/cosmos/interchain-security/pull/786) -* (feature) Improve keeper field validation [#766](https://github.com/cosmos/interchain-security/pull/766) -* (docs) Contributing guidelines [#744](https://github.com/cosmos/interchain-security/pull/744) -* (refactor) Key assignment type safety [#725](https://github.com/cosmos/interchain-security/pull/725) -* (fix) Update protos and fix deps [#752](https://github.com/cosmos/interchain-security/pull/752) -* (api) Add consumer QueryParams [#746](https://github.com/cosmos/interchain-security/pull/746) -* (feature) New validation for keeper fields [#740](https://github.com/cosmos/interchain-security/pull/740) - -## v1.2.0-multiden - -The first release candidate for a fix built on top of v1.2.0, intended for consumers. This release adds a list of denoms on the consumer that are allowed to be sent to the provider as rewards. This prevents a potential DOS attack that was discovered during the audit of Replicated Security performed by Oak Security and funded by the Cosmos Hub community through Proposal 687. In an effort to move quickly, this release also includes a multisig fix that is effective only for provider. It shouldn't affect the consumer module. - -Note PRs were made in a private security repo. - -[full diff](https://github.com/cosmos/interchain-security/compare/v1.2.0...v1.2.0-multiden-rc0) - -## v1.1.0-multiden - -This release combines two fixes on top of v1.1.0, that we judged were urgent to get onto the Cosmos Hub before the launch of the first ICS consumer chain. This is an emergency release intended for providers. - -The first fix is to enable the use of multisigs and Ledger devices when assigning keys for consumer chains. The second is to prevent a possible DOS vector involving the reward distribution system. - -Note PRs were made in a private security repo. - -[full diff](https://github.com/cosmos/interchain-security/compare/v1.1.0...release/v1.1.0-multiden) - -### Multisig fix - -On April 25th (a week and a half ago), we began receiving reports that validators using multisigs and Ledger devices were getting errors reading Error: unable to resolve type URL /interchain_security.ccv.provider.v1.MsgAssignConsumerKey: tx parse error when attempting to assign consensus keys for consumer chains. - -We quickly narrowed the problem down to issues having to do with using the PubKey type directly in the MsgAssignConsumerKey transaction, and Amino (a deprecated serialization library still used in Ledger devices and multisigs) not being able to handle this. We attempted to fix this with the assistance of the Cosmos-SDK team, but after making no headway for a few days, we decided to simply use a JSON representation of the PubKey in the transaction. This is how it is usually represented anyway. We have verified that this fixes the problem. - -### Distribution fix - -The ICS distribution system works by allowing consumer chains to send rewards to a module address on the provider called the FeePoolAddress. From here they are automatically distributed to all validators and delegators through the distribution system that already exists to distribute staking rewards. The FeePoolAddress is usually blocked so that no tokens can be sent to it, but to enable ICS distribution we had to unblock it. - -We recently realized that unblocking the FeePoolAddress could enable an attacker to send a huge number of different denoms into the distribution system. The distribution system would then attempt to distribute them all, leading to out of memory errors. Fixing a similar attack vector that existed in the distribution system before ICS led us to this realization. - -To fix this problem, we have re-blocked the FeePoolAddress and created a new address called the ConsumerRewardsPool. Consumer chains now send rewards to this new address. There is also a new transaction type called RegisterConsumerRewardDenom. This transaction allows people to register denoms to be used as rewards from consumer chains. It costs 10 Atoms to run this transaction.The Atoms are transferred to the community pool. Only denoms registered with this command are then transferred to the FeePoolAddress and distributed out to delegators and validators. - -## v1.2.1 - -* (fix) Remove SPM [#812](https://github.com/cosmos/interchain-security/pull/812) -* (refactor) Key assignment type safety [#725](https://github.com/cosmos/interchain-security/pull/725) - -## v1.2.0 - -Date: April 13th, 2023 - -* (feat) Soft opt-out [#833](https://github.com/cosmos/interchain-security/pull/833) -* (fix) Correctly handle VSC packet with duplicate val updates on consumer [#846](https://github.com/cosmos/interchain-security/pull/846) -* (chore) bump: sdk v0.45.15-ics [#805](https://github.com/cosmos/interchain-security/pull/805) -* (api) add interchain security consumer QueryParams [#746](https://github.com/cosmos/interchain-security/pull/746) - -## v1.1.1 - -* (fix) Remove SPM [#812](https://github.com/cosmos/interchain-security/pull/812) -* (refactor) Key assignment type safety [#725](https://github.com/cosmos/interchain-security/pull/725) - -## v1.1.0 - -Date: March 24th, 2023 - -* (fix) StopConsumerChain not running in cachedContext [#802](https://github.com/cosmos/interchain-security/pull/802) - -## v1.0.0 - -Date: February 6th, 2023 - -This is the first version of Interchain Security (ICS), also known as _Replicated Security_ (RS). -Replicated Security is a feature which will allow a chain -- referred to as the _provider_ -- to share security with other chains -- referred to as _consumers_. -This means that the provider's validator set will be granted the right to validate consumer chains. -The communication between the provider and the consumer chains is done through the IBC protocol over a unique, ordered channel (one for each consumer chain). Thus, RS is an IBC application. - -### Features / sub-protocols - -RS consist of the following core features: - -- **Channel Initialization**: Enables the provider to add new consumer chains. This process is governance-gated, i.e., to add a new consumer chain, a `ConsumerAdditionProposal` governance proposal must be sent to the provider and it must receive the necessary votes. -- **Validator Set Update**: Enables the provider to - (1) update the consumers on the voting power granted to validators (based on the changes in the active validator set on the provider chain), - and (2) ensure the timely completion of unbonding operations (e.g., undelegations). -- **Consumer Initiated Slashing**: Enables the provider to jail validators for downtime infractions on the consumer chains. -- **Reward Distribution**: Enables the consumers to transfer to the provider (over IBC) a portion of their block rewards as payment for the security provided. Once transferred, these rewards are distributed on the provider using the protocol in the [distribution module of Cosmos SDK](https://docs.cosmos.network/v0.45/modules/distribution/). -- **Consumer Chain Removal**: Enables the provider to remove a consumer either after a `ConsumerRemovalProposal` passes governance or after one of the timeout periods elapses -- `InitTimeoutPeriod`, `VscTimeoutPeriod`, `IBCTimeoutPeriod`. -- **Social Slashing**: Equivocation offenses (double signing etc.) on consumer chains are logged, and then can be used in a governance proposal to slash the validators responsible. - -In addition, RS has the following features: - -- **Key Assignment**: Enables validator operators to use different consensus keys for each consumer chain validator node that they operate. -- **Jail Throttling**: Enables the provider to slow down a "worst case scenario" attack where a malicious consumer binary attempts to jail a significant amount (> 2/3) of the voting power, effectively taking control of the provider. \ No newline at end of file +[CHANGELOG of previous versions](https://github.com/cosmos/interchain-security/blob/main/CHANGELOG.md) \ No newline at end of file diff --git a/.changelog/v3.2.0/bug-fixes/consumer/1146-pending-packets.md b/.changelog/v3.2.0/bug-fixes/consumer/1146-pending-packets.md deleted file mode 100644 index 0bab707fec..0000000000 --- a/.changelog/v3.2.0/bug-fixes/consumer/1146-pending-packets.md +++ /dev/null @@ -1,2 +0,0 @@ -- Fix deletion of pending packets that may cause duplicate sends - ([\#1146](https://github.com/cosmos/interchain-security/pull/1146)) \ No newline at end of file diff --git a/.changelog/v3.2.0/bug-fixes/consumer/1150-revert-wire-breaking.md b/.changelog/v3.2.0/bug-fixes/consumer/1150-revert-wire-breaking.md deleted file mode 100644 index 067448e770..0000000000 --- a/.changelog/v3.2.0/bug-fixes/consumer/1150-revert-wire-breaking.md +++ /dev/null @@ -1,2 +0,0 @@ -- Remove `idx` field from the `ccv.ConsumerPacketData` type as this would break the - wire ([\#1150](https://github.com/cosmos/interchain-security/pull/1150)) \ No newline at end of file diff --git a/.changelog/v3.2.0/bug-fixes/consumer/1244-validate-transfer.md b/.changelog/v3.2.0/bug-fixes/consumer/1244-validate-transfer.md deleted file mode 100644 index 2d94c79c75..0000000000 --- a/.changelog/v3.2.0/bug-fixes/consumer/1244-validate-transfer.md +++ /dev/null @@ -1,2 +0,0 @@ -- Validate token transfer messages before calling `Transfer()`. - ([\#1244](https://github.com/cosmos/interchain-security/pull/1244)) \ No newline at end of file diff --git a/.changelog/v3.2.0/bug-fixes/consumer/1262-fee-pool-addr.md b/.changelog/v3.2.0/bug-fixes/consumer/1262-fee-pool-addr.md deleted file mode 100644 index bbb54db2e3..0000000000 --- a/.changelog/v3.2.0/bug-fixes/consumer/1262-fee-pool-addr.md +++ /dev/null @@ -1,2 +0,0 @@ -- Remove incorrect address validation on `ProviderFeePoolAddrStr` param. - ([\#1262](https://github.com/cosmos/interchain-security/pull/1262)) \ No newline at end of file diff --git a/.changelog/v3.2.0/bug-fixes/consumer/1295-migration.md b/.changelog/v3.2.0/bug-fixes/consumer/1295-migration.md deleted file mode 100644 index 739b08dc39..0000000000 --- a/.changelog/v3.2.0/bug-fixes/consumer/1295-migration.md +++ /dev/null @@ -1,2 +0,0 @@ -- Increment consumer consensus version and register consumer migration. - ([\#1295](https://github.com/cosmos/interchain-security/pull/1295)) \ No newline at end of file diff --git a/.changelog/v3.2.0/dependencies/1196-bump-ibc.md b/.changelog/v3.2.0/dependencies/1196-bump-ibc.md deleted file mode 100644 index fcf4450150..0000000000 --- a/.changelog/v3.2.0/dependencies/1196-bump-ibc.md +++ /dev/null @@ -1,3 +0,0 @@ -- Bump [ibc-go](https://github.com/cosmos/ibc-go) to - [v7.2.0](https://github.com/cosmos/ibc-go/releases/tag/v7.2.0). - ([\#1196](https://github.com/cosmos/interchain-security/pull/1196)) \ No newline at end of file diff --git a/.changelog/v3.2.0/dependencies/1258-bump-ibc.md b/.changelog/v3.2.0/dependencies/1258-bump-ibc.md deleted file mode 100644 index 68c6e2b104..0000000000 --- a/.changelog/v3.2.0/dependencies/1258-bump-ibc.md +++ /dev/null @@ -1,3 +0,0 @@ -- Bump [ibc-go](https://github.com/cosmos/ibc-go) to - [v7.3.0](https://github.com/cosmos/ibc-go/releases/tag/v7.3.0). - ([\#1258](https://github.com/cosmos/interchain-security/pull/1258)) \ No newline at end of file diff --git a/.changelog/v3.2.0/dependencies/1258-bump-sdk.md b/.changelog/v3.2.0/dependencies/1258-bump-sdk.md deleted file mode 100644 index 7344fac97e..0000000000 --- a/.changelog/v3.2.0/dependencies/1258-bump-sdk.md +++ /dev/null @@ -1,3 +0,0 @@ -- Bump [cosmos-sdk](https://github.com/cosmos/cosmos-sdk) to - [v0.47.4](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.47.4). - ([\#1258](https://github.com/cosmos/interchain-security/pull/1258)) \ No newline at end of file diff --git a/.changelog/v3.2.0/dependencies/1259-bump-sdk.md b/.changelog/v3.2.0/dependencies/1259-bump-sdk.md deleted file mode 100644 index 247c623b7d..0000000000 --- a/.changelog/v3.2.0/dependencies/1259-bump-sdk.md +++ /dev/null @@ -1,3 +0,0 @@ -- Bump [cosmos-sdk](https://github.com/cosmos/cosmos-sdk) to - [v0.47.5](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.47.5). - ([\#1259](https://github.com/cosmos/interchain-security/pull/1259)) \ No newline at end of file diff --git a/.changelog/v3.2.0/features/consumer/1024-jail-throttling-v2.md b/.changelog/v3.2.0/features/consumer/1024-jail-throttling-v2.md deleted file mode 100644 index 7570facb34..0000000000 --- a/.changelog/v3.2.0/features/consumer/1024-jail-throttling-v2.md +++ /dev/null @@ -1,2 +0,0 @@ -- Add the consumer-side changes for jail throttling with retries (cf. ADR 008). - ([\#1024](https://github.com/cosmos/interchain-security/pull/1024)) \ No newline at end of file diff --git a/.changelog/v3.2.0/features/consumer/1164-provider-info-query.md b/.changelog/v3.2.0/features/consumer/1164-provider-info-query.md deleted file mode 100644 index fc1d27b964..0000000000 --- a/.changelog/v3.2.0/features/consumer/1164-provider-info-query.md +++ /dev/null @@ -1,4 +0,0 @@ -- Introduce the gRPC query `/interchain_security/ccv/consumer/provider- - info` and CLI command `interchain-security-cd q ccvconsumer - provider-info` to retrieve provider info from the consumer chain. - ([\#1164](https://github.com/cosmos/interchain-security/pull/1164)) \ No newline at end of file diff --git a/.changelog/v3.2.0/features/provider/1076-export-timestamps.md b/.changelog/v3.2.0/features/provider/1076-export-timestamps.md deleted file mode 100644 index f2a8608f8b..0000000000 --- a/.changelog/v3.2.0/features/provider/1076-export-timestamps.md +++ /dev/null @@ -1,2 +0,0 @@ -- Add `InitTimeoutTimestamps` and `ExportedVscSendTimestamps` to exported - genesis. ([\#1076](https://github.com/cosmos/interchain-security/pull/1076)) \ No newline at end of file diff --git a/.changelog/v3.2.0/features/provider/1280-reward-denoms.md b/.changelog/v3.2.0/features/provider/1280-reward-denoms.md deleted file mode 100644 index c1f3659a44..0000000000 --- a/.changelog/v3.2.0/features/provider/1280-reward-denoms.md +++ /dev/null @@ -1,3 +0,0 @@ -- Add a governance proposal for setting on the provider the denominations for - rewards from consumer chains. - ([\#1280](https://github.com/cosmos/interchain-security/pull/1280)) \ No newline at end of file diff --git a/.changelog/v3.2.0/improvements/1244-consumer-unbonding.md b/.changelog/v3.2.0/improvements/1244-consumer-unbonding.md deleted file mode 100644 index 4a8504e4ce..0000000000 --- a/.changelog/v3.2.0/improvements/1244-consumer-unbonding.md +++ /dev/null @@ -1,2 +0,0 @@ -- Update the default consumer unbonding period to 2 weeks. - ([\#1244](https://github.com/cosmos/interchain-security/pull/1244)) \ No newline at end of file diff --git a/.changelog/v3.2.0/improvements/consumer/1037-optimize-storage.md b/.changelog/v3.2.0/improvements/consumer/1037-optimize-storage.md deleted file mode 100644 index 726906420b..0000000000 --- a/.changelog/v3.2.0/improvements/consumer/1037-optimize-storage.md +++ /dev/null @@ -1,2 +0,0 @@ -- Optimize pending packets storage on consumer, with migration. - ([\#1037](https://github.com/cosmos/interchain-security/pull/1037)) \ No newline at end of file diff --git a/.changelog/v3.2.0/state-breaking/1196-bump-ibc.md b/.changelog/v3.2.0/state-breaking/1196-bump-ibc.md deleted file mode 100644 index fcf4450150..0000000000 --- a/.changelog/v3.2.0/state-breaking/1196-bump-ibc.md +++ /dev/null @@ -1,3 +0,0 @@ -- Bump [ibc-go](https://github.com/cosmos/ibc-go) to - [v7.2.0](https://github.com/cosmos/ibc-go/releases/tag/v7.2.0). - ([\#1196](https://github.com/cosmos/interchain-security/pull/1196)) \ No newline at end of file diff --git a/.changelog/v3.2.0/state-breaking/1244-consumer-unbonding.md b/.changelog/v3.2.0/state-breaking/1244-consumer-unbonding.md deleted file mode 100644 index 4a8504e4ce..0000000000 --- a/.changelog/v3.2.0/state-breaking/1244-consumer-unbonding.md +++ /dev/null @@ -1,2 +0,0 @@ -- Update the default consumer unbonding period to 2 weeks. - ([\#1244](https://github.com/cosmos/interchain-security/pull/1244)) \ No newline at end of file diff --git a/.changelog/v3.2.0/state-breaking/1258-bump-ibc.md b/.changelog/v3.2.0/state-breaking/1258-bump-ibc.md deleted file mode 100644 index 68c6e2b104..0000000000 --- a/.changelog/v3.2.0/state-breaking/1258-bump-ibc.md +++ /dev/null @@ -1,3 +0,0 @@ -- Bump [ibc-go](https://github.com/cosmos/ibc-go) to - [v7.3.0](https://github.com/cosmos/ibc-go/releases/tag/v7.3.0). - ([\#1258](https://github.com/cosmos/interchain-security/pull/1258)) \ No newline at end of file diff --git a/.changelog/v3.2.0/state-breaking/1258-bump-sdk.md b/.changelog/v3.2.0/state-breaking/1258-bump-sdk.md deleted file mode 100644 index 7344fac97e..0000000000 --- a/.changelog/v3.2.0/state-breaking/1258-bump-sdk.md +++ /dev/null @@ -1,3 +0,0 @@ -- Bump [cosmos-sdk](https://github.com/cosmos/cosmos-sdk) to - [v0.47.4](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.47.4). - ([\#1258](https://github.com/cosmos/interchain-security/pull/1258)) \ No newline at end of file diff --git a/.changelog/v3.2.0/state-breaking/1259-bump-sdk.md b/.changelog/v3.2.0/state-breaking/1259-bump-sdk.md deleted file mode 100644 index 247c623b7d..0000000000 --- a/.changelog/v3.2.0/state-breaking/1259-bump-sdk.md +++ /dev/null @@ -1,3 +0,0 @@ -- Bump [cosmos-sdk](https://github.com/cosmos/cosmos-sdk) to - [v0.47.5](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.47.5). - ([\#1259](https://github.com/cosmos/interchain-security/pull/1259)) \ No newline at end of file diff --git a/.changelog/v3.2.0/state-breaking/consumer/1024-jail-throttling-v2.md b/.changelog/v3.2.0/state-breaking/consumer/1024-jail-throttling-v2.md deleted file mode 100644 index 7570facb34..0000000000 --- a/.changelog/v3.2.0/state-breaking/consumer/1024-jail-throttling-v2.md +++ /dev/null @@ -1,2 +0,0 @@ -- Add the consumer-side changes for jail throttling with retries (cf. ADR 008). - ([\#1024](https://github.com/cosmos/interchain-security/pull/1024)) \ No newline at end of file diff --git a/.changelog/v3.2.0/state-breaking/consumer/1037-optimize-storage.md b/.changelog/v3.2.0/state-breaking/consumer/1037-optimize-storage.md deleted file mode 100644 index 726906420b..0000000000 --- a/.changelog/v3.2.0/state-breaking/consumer/1037-optimize-storage.md +++ /dev/null @@ -1,2 +0,0 @@ -- Optimize pending packets storage on consumer, with migration. - ([\#1037](https://github.com/cosmos/interchain-security/pull/1037)) \ No newline at end of file diff --git a/.changelog/v3.2.0/state-breaking/consumer/1146-pending-packets.md b/.changelog/v3.2.0/state-breaking/consumer/1146-pending-packets.md deleted file mode 100644 index a10d75a505..0000000000 --- a/.changelog/v3.2.0/state-breaking/consumer/1146-pending-packets.md +++ /dev/null @@ -1,2 +0,0 @@ -- Fix deletion of pending packets that may cause duplicate sends - ([\#1146](https://github.com/cosmos/interchain-security/pull/1146)) \ No newline at end of file diff --git a/.changelog/v3.2.0/state-breaking/consumer/1150-revert-wire-breaking.md b/.changelog/v3.2.0/state-breaking/consumer/1150-revert-wire-breaking.md deleted file mode 100644 index 067448e770..0000000000 --- a/.changelog/v3.2.0/state-breaking/consumer/1150-revert-wire-breaking.md +++ /dev/null @@ -1,2 +0,0 @@ -- Remove `idx` field from the `ccv.ConsumerPacketData` type as this would break the - wire ([\#1150](https://github.com/cosmos/interchain-security/pull/1150)) \ No newline at end of file diff --git a/.changelog/v3.2.0/state-breaking/consumer/1244-validate-transfer.md b/.changelog/v3.2.0/state-breaking/consumer/1244-validate-transfer.md deleted file mode 100644 index 2d94c79c75..0000000000 --- a/.changelog/v3.2.0/state-breaking/consumer/1244-validate-transfer.md +++ /dev/null @@ -1,2 +0,0 @@ -- Validate token transfer messages before calling `Transfer()`. - ([\#1244](https://github.com/cosmos/interchain-security/pull/1244)) \ No newline at end of file diff --git a/.changelog/v3.2.0/state-breaking/consumer/1262-fee-pool-addr.md b/.changelog/v3.2.0/state-breaking/consumer/1262-fee-pool-addr.md deleted file mode 100644 index bbb54db2e3..0000000000 --- a/.changelog/v3.2.0/state-breaking/consumer/1262-fee-pool-addr.md +++ /dev/null @@ -1,2 +0,0 @@ -- Remove incorrect address validation on `ProviderFeePoolAddrStr` param. - ([\#1262](https://github.com/cosmos/interchain-security/pull/1262)) \ No newline at end of file diff --git a/.changelog/v3.2.0/state-breaking/consumer/1295-migration.md b/.changelog/v3.2.0/state-breaking/consumer/1295-migration.md deleted file mode 100644 index 739b08dc39..0000000000 --- a/.changelog/v3.2.0/state-breaking/consumer/1295-migration.md +++ /dev/null @@ -1,2 +0,0 @@ -- Increment consumer consensus version and register consumer migration. - ([\#1295](https://github.com/cosmos/interchain-security/pull/1295)) \ No newline at end of file diff --git a/.changelog/v3.2.0/state-breaking/provider/1280-reward-denoms.md b/.changelog/v3.2.0/state-breaking/provider/1280-reward-denoms.md deleted file mode 100644 index c1f3659a44..0000000000 --- a/.changelog/v3.2.0/state-breaking/provider/1280-reward-denoms.md +++ /dev/null @@ -1,3 +0,0 @@ -- Add a governance proposal for setting on the provider the denominations for - rewards from consumer chains. - ([\#1280](https://github.com/cosmos/interchain-security/pull/1280)) \ No newline at end of file diff --git a/.changelog/v3.2.0/summary.md b/.changelog/v3.2.0/summary.md deleted file mode 100644 index e7b2c7d6d4..0000000000 --- a/.changelog/v3.2.0/summary.md +++ /dev/null @@ -1 +0,0 @@ -*November 24, 2023* diff --git a/.changelog/v3.3.0/api-breaking/provider/1340-add-cryptographic-verification-of-equivocation-feature.md b/.changelog/v3.3.0/api-breaking/provider/1340-add-cryptographic-verification-of-equivocation-feature.md deleted file mode 100644 index c50662be72..0000000000 --- a/.changelog/v3.3.0/api-breaking/provider/1340-add-cryptographic-verification-of-equivocation-feature.md +++ /dev/null @@ -1,2 +0,0 @@ -- Deprecate equivocation proposals. -([\#1340](https://github.com/cosmos/interchain-security/pull/1340)) \ No newline at end of file diff --git a/.changelog/v3.3.0/dependencies/1373-bump-ibc.md b/.changelog/v3.3.0/dependencies/1373-bump-ibc.md deleted file mode 100644 index efe4e0c286..0000000000 --- a/.changelog/v3.3.0/dependencies/1373-bump-ibc.md +++ /dev/null @@ -1,3 +0,0 @@ -- Bump [ibc-go](https://github.com/cosmos/ibc-go) to - [v7.3.1](https://github.com/cosmos/ibc-go/releases/tag/v7.3.1). - ([\#1373](https://github.com/cosmos/interchain-security/pull/1373)) \ No newline at end of file diff --git a/.changelog/v3.3.0/features/1336-quint-model.md b/.changelog/v3.3.0/features/1336-quint-model.md deleted file mode 100644 index 96c4562b32..0000000000 --- a/.changelog/v3.3.0/features/1336-quint-model.md +++ /dev/null @@ -1,2 +0,0 @@ -- Add Quint model of Replicated Security. - ([\#1336](https://github.com/cosmos/interchain-security/pull/1336)) \ No newline at end of file diff --git a/.changelog/v3.3.0/features/provider/1339-check-key-assignment-in-use.md b/.changelog/v3.3.0/features/provider/1339-check-key-assignment-in-use.md deleted file mode 100644 index 9f274f7bb4..0000000000 --- a/.changelog/v3.3.0/features/provider/1339-check-key-assignment-in-use.md +++ /dev/null @@ -1,3 +0,0 @@ -- Update how consumer-assigned keys are checked when a validator is - created on the provider. - ([\#1339](https://github.com/cosmos/interchain-security/pull/1339)) \ No newline at end of file diff --git a/.changelog/v3.3.0/features/provider/1340-cryptographic-equivocation-feature.md b/.changelog/v3.3.0/features/provider/1340-cryptographic-equivocation-feature.md deleted file mode 100644 index 5437fba186..0000000000 --- a/.changelog/v3.3.0/features/provider/1340-cryptographic-equivocation-feature.md +++ /dev/null @@ -1,4 +0,0 @@ -- Introduce the cryptographic verification of equivocation feature to the provider - (cf. [ADR-005](docs/docs/adrs/adr-005-cryptographic-equivocation-verification.md) - & [ADR-013](docs/docs/adrs/adr-013-equivocation-slashing.md)). - ([\#1340](https://github.com/cosmos/interchain-security/pull/1340)) \ No newline at end of file diff --git a/.changelog/v3.3.0/improvements/1324-consumer-genesis.md b/.changelog/v3.3.0/improvements/1324-consumer-genesis.md deleted file mode 100644 index a727be8341..0000000000 --- a/.changelog/v3.3.0/improvements/1324-consumer-genesis.md +++ /dev/null @@ -1,16 +0,0 @@ -- Split out consumer genesis state to reduce shared data between provider and - consumer. ([\#1324](https://github.com/cosmos/interchain-security/pull/1324)) - - Note: This breaks json format used by augmenting Genesis files of consumer - chains with consumer genesis content exported from provider chain. Consumer - Genesis content exported from a provider chain using major version 1, 2 or 3 - of the provider module needs to be transformed with the transformation command - introduced by this PR: - ``` - Transform the consumer genesis file from a provider version v1, v2 or v3 to a version supported by this consumer. Result is printed to STDOUT. - - Example: - $ transform /path/to/ccv_consumer_genesis.json - - Usage: - interchain-security-cd genesis transform [genesis-file] [flags] - ``` \ No newline at end of file diff --git a/.changelog/v3.3.0/improvements/1350-cleanup-types.md b/.changelog/v3.3.0/improvements/1350-cleanup-types.md deleted file mode 100644 index 6e26fc3992..0000000000 --- a/.changelog/v3.3.0/improvements/1350-cleanup-types.md +++ /dev/null @@ -1,3 +0,0 @@ -- Refactor shared events, codecs and errors assign to - consumer and provider dedicated types where possible. - ([\#1350](https://github.com/cosmos/interchain-security/pull/1350)) \ No newline at end of file diff --git a/.changelog/v3.3.0/improvements/provider/1503-query-key-assignment.md b/.changelog/v3.3.0/improvements/provider/1503-query-key-assignment.md deleted file mode 100644 index 62b505ec01..0000000000 --- a/.changelog/v3.3.0/improvements/provider/1503-query-key-assignment.md +++ /dev/null @@ -1 +0,0 @@ -- Add `QueryAllPairsValConAddrByConsumerChainID` method to get list of all pairs `valConsensus` address by `Consummer chainID`. ([\#1503](https://github.com/cosmos/interchain-security/pull/1503)) \ No newline at end of file diff --git a/.changelog/v3.3.0/state-breaking/1324-consumer-genesis.md b/.changelog/v3.3.0/state-breaking/1324-consumer-genesis.md deleted file mode 100644 index b47f7199fd..0000000000 --- a/.changelog/v3.3.0/state-breaking/1324-consumer-genesis.md +++ /dev/null @@ -1,2 +0,0 @@ -- Split out consumer genesis state to reduce shared data between provider and - consumer. ([\#1324](https://github.com/cosmos/interchain-security/pull/1324)) \ No newline at end of file diff --git a/.changelog/v3.3.0/state-breaking/1460-msg-validation.md b/.changelog/v3.3.0/state-breaking/1460-msg-validation.md deleted file mode 100644 index 46d18bd4c9..0000000000 --- a/.changelog/v3.3.0/state-breaking/1460-msg-validation.md +++ /dev/null @@ -1,3 +0,0 @@ -- Improve validation of IBC packet data and provider messages. Also, - enable the provider to validate consumer packets before handling them. - ([\#1460](https://github.com/cosmos/interchain-security/pull/1460)) \ No newline at end of file diff --git a/.changelog/v3.3.0/state-breaking/provider/1339-check-key-assignment-in-use.md b/.changelog/v3.3.0/state-breaking/provider/1339-check-key-assignment-in-use.md deleted file mode 100644 index 2890582ba8..0000000000 --- a/.changelog/v3.3.0/state-breaking/provider/1339-check-key-assignment-in-use.md +++ /dev/null @@ -1,3 +0,0 @@ -- Change the states by adding a consumer key for each chain that is - not yet registered meaning for which the gov proposal has not passed. - ([\#1339](https://github.com/cosmos/interchain-security/pull/1339)) \ No newline at end of file diff --git a/.changelog/v3.3.0/state-breaking/provider/1340-cryptographic-equivocation-feature.md b/.changelog/v3.3.0/state-breaking/provider/1340-cryptographic-equivocation-feature.md deleted file mode 100644 index 5437fba186..0000000000 --- a/.changelog/v3.3.0/state-breaking/provider/1340-cryptographic-equivocation-feature.md +++ /dev/null @@ -1,4 +0,0 @@ -- Introduce the cryptographic verification of equivocation feature to the provider - (cf. [ADR-005](docs/docs/adrs/adr-005-cryptographic-equivocation-verification.md) - & [ADR-013](docs/docs/adrs/adr-013-equivocation-slashing.md)). - ([\#1340](https://github.com/cosmos/interchain-security/pull/1340)) \ No newline at end of file diff --git a/.changelog/v3.3.0/summary.md b/.changelog/v3.3.0/summary.md deleted file mode 100644 index e556c0f0ca..0000000000 --- a/.changelog/v3.3.0/summary.md +++ /dev/null @@ -1 +0,0 @@ -*January 5, 2024* From 1ab7c20dfb2f6795b685579bdbc6d020da9f574d Mon Sep 17 00:00:00 2001 From: insumity Date: Fri, 23 Feb 2024 15:13:37 +0100 Subject: [PATCH 02/46] rebase --- .changelog/unreleased/.gitkeep | 0 CHANGELOG.md | 366 +++------------------------------ RELEASE_NOTES.md | 36 +--- 3 files changed, 37 insertions(+), 365 deletions(-) create mode 100644 .changelog/unreleased/.gitkeep diff --git a/.changelog/unreleased/.gitkeep b/.changelog/unreleased/.gitkeep new file mode 100644 index 0000000000..e69de29bb2 diff --git a/CHANGELOG.md b/CHANGELOG.md index 9d46f32447..5cdfb32062 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ # CHANGELOG ## v4.0.0 +<<<<<<< HEAD *January 22, 2024* @@ -55,367 +56,58 @@ ([\#1321](https://github.com/cosmos/interchain-security/pull/1321)) ## v3.3.0 +======= +>>>>>>> 3165f034 (docs: changelog and release notes for v4.0.0 (#1564)) -*January 5, 2024* +*January 11, 2024* ### API BREAKING -- [Provider](x/ccv/provider) - - Deprecate equivocation proposals. - ([\#1340](https://github.com/cosmos/interchain-security/pull/1340)) - -### DEPENDENCIES - -- Bump [ibc-go](https://github.com/cosmos/ibc-go) to - [v7.3.1](https://github.com/cosmos/ibc-go/releases/tag/v7.3.1). - ([\#1373](https://github.com/cosmos/interchain-security/pull/1373)) - -### FEATURES - -- General - - Add Quint model of Replicated Security. - ([\#1336](https://github.com/cosmos/interchain-security/pull/1336)) -- [Provider](x/ccv/provider) - - Update how consumer-assigned keys are checked when a validator is - created on the provider. - ([\#1339](https://github.com/cosmos/interchain-security/pull/1339)) - - Introduce the cryptographic verification of equivocation feature to the provider - (cf. [ADR-005](docs/docs/adrs/adr-005-cryptographic-equivocation-verification.md) - & [ADR-013](docs/docs/adrs/adr-013-equivocation-slashing.md)). - ([\#1340](https://github.com/cosmos/interchain-security/pull/1340)) - -### IMPROVEMENTS - -- General - - Split out consumer genesis state to reduce shared data between provider and - consumer. ([\#1324](https://github.com/cosmos/interchain-security/pull/1324)) - - Note: This breaks json format used by augmenting Genesis files of consumer - chains with consumer genesis content exported from provider chain. Consumer - Genesis content exported from a provider chain using major version 1, 2 or 3 - of the provider module needs to be transformed with the transformation command - introduced by this PR: - ``` - Transform the consumer genesis file from a provider version v1, v2 or v3 to a version supported by this consumer. Result is printed to STDOUT. - - Example: - $ transform /path/to/ccv_consumer_genesis.json - - Usage: - interchain-security-cd genesis transform [genesis-file] [flags] - ``` - - Refactor shared events, codecs and errors assign to - consumer and provider dedicated types where possible. - ([\#1350](https://github.com/cosmos/interchain-security/pull/1350)) -- [Provider](x/ccv/provider) - - Add `QueryAllPairsValConAddrByConsumerChainID` method to get list of all pairs `valConsensus` address by `Consummer chainID`. ([\#1503](https://github.com/cosmos/interchain-security/pull/1503)) +- [Consumer](x/ccv/consumer) + - Fix a bug in consmer genesis file transform CLI command. + ([\#1458](https://github.com/cosmos/interchain-security/pull/1458)) -### STATE BREAKING +### BUG FIXES - General - - Split out consumer genesis state to reduce shared data between provider and - consumer. ([\#1324](https://github.com/cosmos/interchain-security/pull/1324)) + - Fix a bug in consmer genesis file transform CLI command. + ([\#1458](https://github.com/cosmos/interchain-security/pull/1458)) - Improve validation of IBC packet data and provider messages. Also, enable the provider to validate consumer packets before handling them. ([\#1460](https://github.com/cosmos/interchain-security/pull/1460)) -- [Provider](x/ccv/provider) - - Change the states by adding a consumer key for each chain that is - not yet registered meaning for which the gov proposal has not passed. - ([\#1339](https://github.com/cosmos/interchain-security/pull/1339)) - - Introduce the cryptographic verification of equivocation feature to the provider - (cf. [ADR-005](docs/docs/adrs/adr-005-cryptographic-equivocation-verification.md) - & [ADR-013](docs/docs/adrs/adr-013-equivocation-slashing.md)). - ([\#1340](https://github.com/cosmos/interchain-security/pull/1340)) - -## v3.2.0 - -*November 24, 2023* - -### BUG FIXES - - [Consumer](x/ccv/consumer) - - Fix deletion of pending packets that may cause duplicate sends - ([\#1146](https://github.com/cosmos/interchain-security/pull/1146)) - - Remove `idx` field from the `ccv.ConsumerPacketData` type as this would break the - wire ([\#1150](https://github.com/cosmos/interchain-security/pull/1150)) - - Validate token transfer messages before calling `Transfer()`. - ([\#1244](https://github.com/cosmos/interchain-security/pull/1244)) - - Remove incorrect address validation on `ProviderFeePoolAddrStr` param. - ([\#1262](https://github.com/cosmos/interchain-security/pull/1262)) - - Increment consumer consensus version and register consumer migration. - ([\#1295](https://github.com/cosmos/interchain-security/pull/1295)) + - Avoid jailing validators immediately once they can no longer opt-out from + validating consumer chains. + ([\#1549](https://github.com/cosmos/interchain-security/pull/1549)) ### DEPENDENCIES -- Bump [ibc-go](https://github.com/cosmos/ibc-go) to - [v7.2.0](https://github.com/cosmos/ibc-go/releases/tag/v7.2.0). - ([\#1196](https://github.com/cosmos/interchain-security/pull/1196)) -- Bump [cosmos-sdk](https://github.com/cosmos/cosmos-sdk) to - [v0.47.4](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.47.4). - ([\#1258](https://github.com/cosmos/interchain-security/pull/1258)) -- Bump [ibc-go](https://github.com/cosmos/ibc-go) to - [v7.3.0](https://github.com/cosmos/ibc-go/releases/tag/v7.3.0). - ([\#1258](https://github.com/cosmos/interchain-security/pull/1258)) +- Bump Golang to v1.21 + ([\#1557](https://github.com/cosmos/interchain-security/pull/1557)) - Bump [cosmos-sdk](https://github.com/cosmos/cosmos-sdk) to - [v0.47.5](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.47.5). - ([\#1259](https://github.com/cosmos/interchain-security/pull/1259)) + [v0.47.7](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.47.7). + ([\#1558](https://github.com/cosmos/interchain-security/pull/1558)) +- Bump [CometBFT](https://github.com/cometbft/cometbft) to + [v0.37.4](https://github.com/cometbft/cometbft/releases/tag/v0.37.4). + ([\#1558](https://github.com/cosmos/interchain-security/pull/1558)) ### FEATURES -- [Consumer](x/ccv/consumer) - - Add the consumer-side changes for jail throttling with retries (cf. ADR 008). - ([\#1024](https://github.com/cosmos/interchain-security/pull/1024)) - - Introduce the gRPC query `/interchain_security/ccv/consumer/provider- - info` and CLI command `interchain-security-cd q ccvconsumer - provider-info` to retrieve provider info from the consumer chain. - ([\#1164](https://github.com/cosmos/interchain-security/pull/1164)) - [Provider](x/ccv/provider) - - Add `InitTimeoutTimestamps` and `ExportedVscSendTimestamps` to exported - genesis. ([\#1076](https://github.com/cosmos/interchain-security/pull/1076)) - - Add a governance proposal for setting on the provider the denominations for - rewards from consumer chains. - ([\#1280](https://github.com/cosmos/interchain-security/pull/1280)) - -### IMPROVEMENTS - -- General - - Update the default consumer unbonding period to 2 weeks. - ([\#1244](https://github.com/cosmos/interchain-security/pull/1244)) -- [Consumer](x/ccv/consumer) - - Optimize pending packets storage on consumer, with migration. - ([\#1037](https://github.com/cosmos/interchain-security/pull/1037)) + - Add the provider-side changes for jail throttling with retries (cf. ADR 008). + ([\#1321](https://github.com/cosmos/interchain-security/pull/1321)) ### STATE BREAKING -- General - - Bump [ibc-go](https://github.com/cosmos/ibc-go) to - [v7.2.0](https://github.com/cosmos/ibc-go/releases/tag/v7.2.0). - ([\#1196](https://github.com/cosmos/interchain-security/pull/1196)) - - Update the default consumer unbonding period to 2 weeks. - ([\#1244](https://github.com/cosmos/interchain-security/pull/1244)) - - Bump [cosmos-sdk](https://github.com/cosmos/cosmos-sdk) to - [v0.47.4](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.47.4). - ([\#1258](https://github.com/cosmos/interchain-security/pull/1258)) - - Bump [ibc-go](https://github.com/cosmos/ibc-go) to - [v7.3.0](https://github.com/cosmos/ibc-go/releases/tag/v7.3.0). - ([\#1258](https://github.com/cosmos/interchain-security/pull/1258)) - - Bump [cosmos-sdk](https://github.com/cosmos/cosmos-sdk) to - [v0.47.5](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.47.5). - ([\#1259](https://github.com/cosmos/interchain-security/pull/1259)) - [Consumer](x/ccv/consumer) - - Add the consumer-side changes for jail throttling with retries (cf. ADR 008). - ([\#1024](https://github.com/cosmos/interchain-security/pull/1024)) - - Optimize pending packets storage on consumer, with migration. - ([\#1037](https://github.com/cosmos/interchain-security/pull/1037)) - - Fix deletion of pending packets that may cause duplicate sends - ([\#1146](https://github.com/cosmos/interchain-security/pull/1146)) - - Remove `idx` field from the `ccv.ConsumerPacketData` type as this would break the - wire ([\#1150](https://github.com/cosmos/interchain-security/pull/1150)) - - Validate token transfer messages before calling `Transfer()`. - ([\#1244](https://github.com/cosmos/interchain-security/pull/1244)) - - Remove incorrect address validation on `ProviderFeePoolAddrStr` param. - ([\#1262](https://github.com/cosmos/interchain-security/pull/1262)) - - Increment consumer consensus version and register consumer migration. - ([\#1295](https://github.com/cosmos/interchain-security/pull/1295)) + - Avoid jailing validators immediately once they can no longer opt-out from + validating consumer chains. + ([\#1549](https://github.com/cosmos/interchain-security/pull/1549)) - [Provider](x/ccv/provider) - - Add a governance proposal for setting on the provider the denominations for - rewards from consumer chains. - ([\#1280](https://github.com/cosmos/interchain-security/pull/1280)) - -## v3.1.0 - -Date July 11th, 2023 - -A minor upgrade to v3.0.0, which removes the panic in the consumer ccv module which would occur in an emergency scenario where the ccv channel is closed. This release also fixes how a distribution related event is emitted, and bumps cometbft. - -* (feat) [#1127](https://github.com/cosmos/interchain-security/pull/1127) Remove consumer panic when ccv channel is closed -* (fix) [#720](https://github.com/cosmos/interchain-security/issues/720) Fix the attribute `AttributeDistributionTotal` value in `FeeDistribution` event emit. -* (deps) [#1119](https://github.com/cosmos/interchain-security/pull/1119) bump cometbft from `v0.37.1` to `0.37.2`. - -## v3.0.0 - -Date: June 21st, 2023 - -Interchain Security v3 uses SDK 0.47 and IBC 7. - -* (fix) [#1093](https://github.com/cosmos/interchain-security/pull/1093) Make SlashPacketData backward compatible when sending data over the wire -* (deps) [#1019](https://github.com/cosmos/interchain-security/pull/1019) Bump multiple dependencies. - * Bump [cosmos-sdk](https://github.com/cosmos/cosmos-sdk) to [v0.47.3](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.47.3). - * Bump [ibc-go](https://github.com/cosmos/ibc-go) to [v7.1.0](https://github.com/cosmos/ibc-go/releases/tag/v7.1.0). - * Bump [CometBFT](https://github.com/cometbft/cometbft) to [v0.37.1](https://github.com/cometbft/cometbft/releases/tag/v0.37.1). -* `[x/ccv/provider]` (fix) [#945](https://github.com/cosmos/interchain-security/issues/945) Refactor `AfterUnbondingInitiated` to not panic when `PutUnbondingOnHold` returns error. -* `[x/ccv/provider]` (fix) [#977](https://github.com/cosmos/interchain-security/pull/977) Avoids panicking the provider when an unbonding delegation was removed through a `CancelUnbondingDelegation` message. -* `[x/ccv/democracy]` (feat) [#1019](https://github.com/cosmos/interchain-security/pull/1019) Whitelisting non-legacy params in the "democracy module" require the entire module to be whitelisted. - -## v2.4.0-lsm - -*November 20, 2023* - -* (fix) [#1439](https://github.com/cosmos/interchain-security/pull/1439) Fix unmarshaling for the CLI consumer double vote cmd. -* (feat!) [#1435](https://github.com/cosmos/interchain-security/pull/1435) Add height-base filter for consumer equivocation evidence. - -## v2.3.0-provider-lsm - -*November 15, 2023* - -❗ *This release is deprecated and should not be used in production.* - -* (fix!) [#1422](https://github.com/cosmos/interchain-security/pull/1422) Fix the misbehaviour handling by verifying the signatures of byzantine validators. - -## v2.2.0-provider-lsm - -❗ *This release is deprecated and should not be used in production.* - -### Cryptographic verification of equivocation -* New feature enabling the provider chain to verify equivocation evidence on its own instead of trusting consumer chains, see [EPIC](https://github.com/cosmos/interchain-security/issues/732). - -## v2.1.0-provider-lsm - -Date: September 15th, 2023 - -* (feature!) [#1280](https://github.com/cosmos/interchain-security/pull/1280) provider proposal for changing reward denoms - -## v2.0.0-lsm - -Date: August 18th, 2023 - -* (deps!) [#1120](https://github.com/cosmos/interchain-security/pull/1120) Bump [Cosmos SDK](https://github.com/cosmos/cosmos-sdk) to [v0.45.16-ics-lsm](https://github.com/cosmos/cosmos-sdk/tree/v0.45.16-ics-lsm). This requires adapting ICS to support this SDK release. Changes are state breaking. -* (fix) [#720](https://github.com/cosmos/interchain-security/issues/720) Fix the attribute `AttributeDistributionTotal` value in `FeeDistribution` event emit. - -## v2.0.0 - -Date: June 1st, 2023 - -Unlike prior releases, the ICS `v2.0.0` release will be based on the main branch. `v2.0.0` will contain all the accumulated PRs from the various releases below, along with other PRs that were merged, but not released to production. After `v2.0.0`, we plan to revamp release practices, and how we modularize the repo for consumer/provider. - -Upgrading a provider from `v1.1.0-multiden` to `v2.0.0` will require state migrations. See [migration.go](https://github.com/cosmos/interchain-security/blob/v2.0.0/x/ccv/provider/keeper/migration.go). - -Upgrading a consumer from `v1.2.0-multiden` to `v2.0.0` will NOT require state migrations. - -Some PRs from v2.0.0 may reappear from other releases below. This is due to the fact that ICS v1.1.0 deviates from the commit ordering of the main branch, and other releases thereafter are based on v1.1.0. - -### High level changes included in v2.0.0 - -* MVP for standalone to consumer changeover, see [EPIC](https://github.com/cosmos/interchain-security/issues/756) -* MVP for soft opt out, see [EPIC](https://github.com/cosmos/interchain-security/issues/851) -* Various fixes, critical and non-critical -* Docs updates which should not affect production code - -## Notable PRs included in v2.0.0 - -* (feat!) Add DistributionTransmissionChannel to ConsumerAdditionProposal [#965](https://github.com/cosmos/interchain-security/pull/965) -* (feat/fix) limit vsc matured packets handled per endblocker [#1004](https://github.com/cosmos/interchain-security/pull/1004) -* (fix) consumer key prefix order to avoid complex migrations [#963](https://github.com/cosmos/interchain-security/pull/963) and [#991](https://github.com/cosmos/interchain-security/pull/991). The latter PR is the proper fix. -* (feat) v1->v2 migrations to accommodate a bugfix having to do with store keys, introduce new params, and deal with consumer genesis state schema changes [#975](https://github.com/cosmos/interchain-security/pull/975) and [#997](https://github.com/cosmos/interchain-security/pull/997) -* (deps) Bump github.com/cosmos/ibc-go/v4 from 4.4.0 to 4.4.2 [#982](https://github.com/cosmos/interchain-security/pull/982) -* (fix) partially revert key assignment type safety PR [#980](https://github.com/cosmos/interchain-security/pull/980) -* (fix) Remove panics on failure to send IBC packets [#876](https://github.com/cosmos/interchain-security/pull/876) -* (fix) Prevent denom DOS [#931](https://github.com/cosmos/interchain-security/pull/931) -* (fix) multisig for assigning consumer key, use json [#916](https://github.com/cosmos/interchain-security/pull/916) -* (deps) Bump github.com/cosmos/ibc-go/v4 from 4.3.0 to 4.4.0 [#902](https://github.com/cosmos/interchain-security/pull/902) -* (feat) Add warnings when provider unbonding is shorter than consumer unbonding [#858](https://github.com/cosmos/interchain-security/pull/858) -* (chore) use go 1.19 [#899](https://github.com/cosmos/interchain-security/pull/899), [#840](https://github.com/cosmos/interchain-security/pull/840) -* (feat) Standalone to consumer changeover - recycle existing transfer channel [#832](https://github.com/cosmos/interchain-security/pull/832) -* (deps) Bump IBC [862](https://github.com/cosmos/interchain-security/pull/862) -* (testing) Add tests for soft opt out [#857](https://github.com/cosmos/interchain-security/pull/857) -* (feat) Standalone to consumer changeover - staking functionalities [#794](https://github.com/cosmos/interchain-security/pull/794) -* (fix) prevent provider from sending VSCPackets with multiple updates for the same validator [#850](https://github.com/cosmos/interchain-security/pull/850) -* (feat) Soft opt out [#833](https://github.com/cosmos/interchain-security/issues/833) -* (fix) Correctly handle VSC packet with duplicate val updates on consumer [#846](https://github.com/cosmos/interchain-security/pull/846) -* (deps) bump sdk to v0.45.15.ics [#805](https://github.com/cosmos/interchain-security/pull/805) -* (refactor) Remove spm module [#812](https://github.com/cosmos/interchain-security/pull/812) -* (feat) Standalone to consumer changeover part 1 [#757](https://github.com/cosmos/interchain-security/pull/757) -* (chore) Swap names of e2e and integration tests [#681](https://github.com/cosmos/interchain-security/pull/681) -* (fix) fix StopConsumerChain not running in cachedContext [#802](https://github.com/cosmos/interchain-security/pull/802). Also in earlier releases with different commit order! -* (docs) Introduce docs website [#759](https://github.com/cosmos/interchain-security/pull/759) -* (fix) Serialize correct byte prefix for SlashLogKey [#786](https://github.com/cosmos/interchain-security/pull/786) -* (feature) Improve keeper field validation [#766](https://github.com/cosmos/interchain-security/pull/766) -* (docs) Contributing guidelines [#744](https://github.com/cosmos/interchain-security/pull/744) -* (refactor) Key assignment type safety [#725](https://github.com/cosmos/interchain-security/pull/725) -* (fix) Update protos and fix deps [#752](https://github.com/cosmos/interchain-security/pull/752) -* (api) Add consumer QueryParams [#746](https://github.com/cosmos/interchain-security/pull/746) -* (feature) New validation for keeper fields [#740](https://github.com/cosmos/interchain-security/pull/740) - -## v1.2.0-multiden - -The first release candidate for a fix built on top of v1.2.0, intended for consumers. This release adds a list of denoms on the consumer that are allowed to be sent to the provider as rewards. This prevents a potential DOS attack that was discovered during the audit of Replicated Security performed by Oak Security and funded by the Cosmos Hub community through Proposal 687. In an effort to move quickly, this release also includes a multisig fix that is effective only for provider. It shouldn't affect the consumer module. - -Note PRs were made in a private security repo. - -[full diff](https://github.com/cosmos/interchain-security/compare/v1.2.0...v1.2.0-multiden-rc0) - -## v1.1.0-multiden - -This release combines two fixes on top of v1.1.0, that we judged were urgent to get onto the Cosmos Hub before the launch of the first ICS consumer chain. This is an emergency release intended for providers. - -The first fix is to enable the use of multisigs and Ledger devices when assigning keys for consumer chains. The second is to prevent a possible DOS vector involving the reward distribution system. - -Note PRs were made in a private security repo. - -[full diff](https://github.com/cosmos/interchain-security/compare/v1.1.0...release/v1.1.0-multiden) - -### Multisig fix - -On April 25th (a week and a half ago), we began receiving reports that validators using multisigs and Ledger devices were getting errors reading Error: unable to resolve type URL /interchain_security.ccv.provider.v1.MsgAssignConsumerKey: tx parse error when attempting to assign consensus keys for consumer chains. - -We quickly narrowed the problem down to issues having to do with using the PubKey type directly in the MsgAssignConsumerKey transaction, and Amino (a deprecated serialization library still used in Ledger devices and multisigs) not being able to handle this. We attempted to fix this with the assistance of the Cosmos-SDK team, but after making no headway for a few days, we decided to simply use a JSON representation of the PubKey in the transaction. This is how it is usually represented anyway. We have verified that this fixes the problem. - -### Distribution fix - -The ICS distribution system works by allowing consumer chains to send rewards to a module address on the provider called the FeePoolAddress. From here they are automatically distributed to all validators and delegators through the distribution system that already exists to distribute staking rewards. The FeePoolAddress is usually blocked so that no tokens can be sent to it, but to enable ICS distribution we had to unblock it. - -We recently realized that unblocking the FeePoolAddress could enable an attacker to send a huge number of different denoms into the distribution system. The distribution system would then attempt to distribute them all, leading to out of memory errors. Fixing a similar attack vector that existed in the distribution system before ICS led us to this realization. - -To fix this problem, we have re-blocked the FeePoolAddress and created a new address called the ConsumerRewardsPool. Consumer chains now send rewards to this new address. There is also a new transaction type called RegisterConsumerRewardDenom. This transaction allows people to register denoms to be used as rewards from consumer chains. It costs 10 Atoms to run this transaction.The Atoms are transferred to the community pool. Only denoms registered with this command are then transferred to the FeePoolAddress and distributed out to delegators and validators. - -## v1.2.1 - -* (fix) Remove SPM [#812](https://github.com/cosmos/interchain-security/pull/812) -* (refactor) Key assignment type safety [#725](https://github.com/cosmos/interchain-security/pull/725) - -## v1.2.0 - -Date: April 13th, 2023 - -* (feat) Soft opt-out [#833](https://github.com/cosmos/interchain-security/pull/833) -* (fix) Correctly handle VSC packet with duplicate val updates on consumer [#846](https://github.com/cosmos/interchain-security/pull/846) -* (chore) bump: sdk v0.45.15-ics [#805](https://github.com/cosmos/interchain-security/pull/805) -* (api) add interchain security consumer QueryParams [#746](https://github.com/cosmos/interchain-security/pull/746) - -## v1.1.1 - -* (fix) Remove SPM [#812](https://github.com/cosmos/interchain-security/pull/812) -* (refactor) Key assignment type safety [#725](https://github.com/cosmos/interchain-security/pull/725) - -## v1.1.0 - -Date: March 24th, 2023 - -* (fix) StopConsumerChain not running in cachedContext [#802](https://github.com/cosmos/interchain-security/pull/802) - -## v1.0.0 - -Date: February 6th, 2023 - -This is the first version of Interchain Security (ICS), also known as _Replicated Security_ (RS). -Replicated Security is a feature which will allow a chain -- referred to as the _provider_ -- to share security with other chains -- referred to as _consumers_. -This means that the provider's validator set will be granted the right to validate consumer chains. -The communication between the provider and the consumer chains is done through the IBC protocol over a unique, ordered channel (one for each consumer chain). Thus, RS is an IBC application. - -### Features / sub-protocols - -RS consist of the following core features: - -- **Channel Initialization**: Enables the provider to add new consumer chains. This process is governance-gated, i.e., to add a new consumer chain, a `ConsumerAdditionProposal` governance proposal must be sent to the provider and it must receive the necessary votes. -- **Validator Set Update**: Enables the provider to - (1) update the consumers on the voting power granted to validators (based on the changes in the active validator set on the provider chain), - and (2) ensure the timely completion of unbonding operations (e.g., undelegations). -- **Consumer Initiated Slashing**: Enables the provider to jail validators for downtime infractions on the consumer chains. -- **Reward Distribution**: Enables the consumers to transfer to the provider (over IBC) a portion of their block rewards as payment for the security provided. Once transferred, these rewards are distributed on the provider using the protocol in the [distribution module of Cosmos SDK](https://docs.cosmos.network/v0.45/modules/distribution/). -- **Consumer Chain Removal**: Enables the provider to remove a consumer either after a `ConsumerRemovalProposal` passes governance or after one of the timeout periods elapses -- `InitTimeoutPeriod`, `VscTimeoutPeriod`, `IBCTimeoutPeriod`. -- **Social Slashing**: Equivocation offenses (double signing etc.) on consumer chains are logged, and then can be used in a governance proposal to slash the validators responsible. + - Add the provider-side changes for jail throttling with retries (cf. ADR 008). + ([\#1321](https://github.com/cosmos/interchain-security/pull/1321)) -In addition, RS has the following features: +## Previous Versions -- **Key Assignment**: Enables validator operators to use different consensus keys for each consumer chain validator node that they operate. -- **Jail Throttling**: Enables the provider to slow down a "worst case scenario" attack where a malicious consumer binary attempts to jail a significant amount (> 2/3) of the voting power, effectively taking control of the provider. +[CHANGELOG of previous versions](https://github.com/cosmos/interchain-security/blob/main/CHANGELOG.md) diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index 5d5ad1eb62..f833594abe 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -1,37 +1,17 @@ - - -# Replicated Security Release Notes - - -❗ ***Note this release is ONLY relevant to *** +# Replicated Security v4.0.0 Release Notes ## 📝 Changelog -** REMOVE THE LINE BELOW TO ENABLE THE MARKDOWN LINK CHECKER FOR RELEASE ** - - -Check out the [changelog](https://github.com/cosmos/interchain-security/blob//CHANGELOG.md) for a list of relevant changes or [compare all changes](https://github.com/cosmos/interchain-security/compare/release/...) from last release. +Check out the [changelog](https://github.com/cosmos/interchain-security/blob/v4.0.0/CHANGELOG.md) for a list of relevant changes or [compare all changes](https://github.com/cosmos/interchain-security/compare/v3.3.0...v4.0.0) from last release. -Refer to the [upgrading guide](https://github.com/cosmos/interchain-security/blob/release//UPGRADING.md) when migrating from `` to ``. +Refer to the [upgrading guide](https://github.com/cosmos/interchain-security/blob/release/v4.0.x/UPGRADING.md) when migrating +from a version `>= v3.1.x` to `v4.0.x`. -** REMOVE THE LINE BELOW TO ENABLE THE MARKDOWN LINK CHECKER FOR RELEASE ** - ## 🚀 Highlights - +This release introduces the following noteworthy changes: -## ❤️ Contributors - -* Informal Systems ([@informalinc](https://twitter.com/informalinc)) - +- It sets the minimum required version of Go to `1.21`. +- It adds the provider-side changes for jail throttling with retries and, as a result, it fully enables the jail throttling with retries feature (cf. [ADR 008](https://github.com/cosmos/interchain-security/blob/release/v3.2.x/docs/docs/adrs/adr-008-throttle-retries.md)). +- Fixes a bug in the soft opt-out protocol -- it avoids jailing validators immediately once they can no longer opt-out from validating consumer chains. -This list is non-exhaustive and ordered alphabetically. -Thank you to everyone who contributed to this release! From efe8cb11feea724168cba720c31a2ea455856485 Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Fri, 19 Jan 2024 19:25:23 +0100 Subject: [PATCH 03/46] fix!: Validation of SlashAcks fails due to marshaling to Bech32 (backport #1570) (#1577) fix!: Validation of SlashAcks fails due to marshaling to Bech32 (#1570) * add different Bech32Prefix for consumer and provider * separate app encoding and params * remove ConsumerValPubKey from ValidatorConfig * update addresses in tests * make SlashAcks consistent across chains * add comments for clarity * Regenerate traces * Fix argument order * set bech32prefix for provider to cosmos * add changelog entries * add consumer-double-downtime e2e test * update nightly-e2e workflow * fix typo * add consumer-double-downtime to testConfigs * remove changes on provider * skip invalid SlashAcks * seal the config * clear the outstanding downtime flag for new vals * add info on upgrading to v4.0.0 * fix upgrade handler * fix changeover e2e test * Update tests/e2e/config.go Co-authored-by: Philip Offtermatt <57488781+p-offtermatt@users.noreply.github.com> * Update tests/e2e/config.go Co-authored-by: Philip Offtermatt <57488781+p-offtermatt@users.noreply.github.com> * add AccountPrefix to ChainConfig * fix docstrings * update AccountAddressPrefix in app.go * fix consumer-misb e2e test --------- Co-authored-by: Philip Offtermatt Co-authored-by: Simon Noetzlin Co-authored-by: Philip Offtermatt <57488781+p-offtermatt@users.noreply.github.com> (cherry picked from commit 86046926502f7b0ba795bebcdd1fdc97ac776573) Co-authored-by: Marius Poke --- .changelog/unreleased/state-breaking/1570-slashack-bech32.md | 2 ++ .changelog/v4.0.0/bug-fixes/1570-slashack-bech32.md | 2 ++ UPGRADING.md | 4 ++-- 3 files changed, 6 insertions(+), 2 deletions(-) create mode 100644 .changelog/unreleased/state-breaking/1570-slashack-bech32.md create mode 100644 .changelog/v4.0.0/bug-fixes/1570-slashack-bech32.md diff --git a/.changelog/unreleased/state-breaking/1570-slashack-bech32.md b/.changelog/unreleased/state-breaking/1570-slashack-bech32.md new file mode 100644 index 0000000000..a0e9fe9262 --- /dev/null +++ b/.changelog/unreleased/state-breaking/1570-slashack-bech32.md @@ -0,0 +1,2 @@ +- Fix the validation of VSCPackets to not fail due to marshaling to string using Bech32. + ([\#1570](https://github.com/cosmos/interchain-security/pull/1570)) \ No newline at end of file diff --git a/.changelog/v4.0.0/bug-fixes/1570-slashack-bech32.md b/.changelog/v4.0.0/bug-fixes/1570-slashack-bech32.md new file mode 100644 index 0000000000..a0e9fe9262 --- /dev/null +++ b/.changelog/v4.0.0/bug-fixes/1570-slashack-bech32.md @@ -0,0 +1,2 @@ +- Fix the validation of VSCPackets to not fail due to marshaling to string using Bech32. + ([\#1570](https://github.com/cosmos/interchain-security/pull/1570)) \ No newline at end of file diff --git a/UPGRADING.md b/UPGRADING.md index 1267d3ac66..e82a799a6b 100644 --- a/UPGRADING.md +++ b/UPGRADING.md @@ -30,7 +30,7 @@ func migrateICSOutstandingDowntime(ctx sdk.Context, keepers *upgrades.UpgradeKee keepers.ConsumerKeeper.DeleteOutstandingDowntime(ctx, consAddr) } - ctx.Logger().Info("Finished ICS outstanding downtime") + ctx.Logger().Info("Finished ICS oustanding downtime") return nil } @@ -118,4 +118,4 @@ Upgrading a provider from `v1.1.0-multiden` to `v2.0.0` will require state migra ### Consumer -Upgrading a consumer from `v1.2.0-multiden` to `v2.0.0` will NOT require state migrations. \ No newline at end of file +Upgrading a consumer from `v1.2.0-multiden` to `v2.0.0` will NOT require state migrations. From a5c1d4e444b577081923257add8255b44b5caeb2 Mon Sep 17 00:00:00 2001 From: Marius Poke Date: Mon, 22 Jan 2024 09:39:42 +0100 Subject: [PATCH 04/46] docs: update changelog for v4.0.0 (#1578) update changelog --- .changelog/unreleased/state-breaking/1570-slashack-bech32.md | 2 -- .changelog/v4.0.0/bug-fixes/1570-slashack-bech32.md | 2 -- 2 files changed, 4 deletions(-) delete mode 100644 .changelog/unreleased/state-breaking/1570-slashack-bech32.md delete mode 100644 .changelog/v4.0.0/bug-fixes/1570-slashack-bech32.md diff --git a/.changelog/unreleased/state-breaking/1570-slashack-bech32.md b/.changelog/unreleased/state-breaking/1570-slashack-bech32.md deleted file mode 100644 index a0e9fe9262..0000000000 --- a/.changelog/unreleased/state-breaking/1570-slashack-bech32.md +++ /dev/null @@ -1,2 +0,0 @@ -- Fix the validation of VSCPackets to not fail due to marshaling to string using Bech32. - ([\#1570](https://github.com/cosmos/interchain-security/pull/1570)) \ No newline at end of file diff --git a/.changelog/v4.0.0/bug-fixes/1570-slashack-bech32.md b/.changelog/v4.0.0/bug-fixes/1570-slashack-bech32.md deleted file mode 100644 index a0e9fe9262..0000000000 --- a/.changelog/v4.0.0/bug-fixes/1570-slashack-bech32.md +++ /dev/null @@ -1,2 +0,0 @@ -- Fix the validation of VSCPackets to not fail due to marshaling to string using Bech32. - ([\#1570](https://github.com/cosmos/interchain-security/pull/1570)) \ No newline at end of file From c03587cec877dd88e03ceca955fa716cc686b93b Mon Sep 17 00:00:00 2001 From: Marius Poke Date: Mon, 22 Jan 2024 09:54:28 +0100 Subject: [PATCH 05/46] docs: prepare for v4.0.0 (#1581) * unclog build * update release notes * update release date --- CHANGELOG.md | 6 +++++- RELEASE_NOTES.md | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5cdfb32062..56ece9b8ef 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -59,7 +59,7 @@ ======= >>>>>>> 3165f034 (docs: changelog and release notes for v4.0.0 (#1564)) -*January 11, 2024* +*January 22, 2024* ### API BREAKING @@ -79,6 +79,8 @@ - Avoid jailing validators immediately once they can no longer opt-out from validating consumer chains. ([\#1549](https://github.com/cosmos/interchain-security/pull/1549)) + - Fix the validation of VSCPackets to not fail due to marshaling to string using Bech32. + ([\#1570](https://github.com/cosmos/interchain-security/pull/1570)) ### DEPENDENCIES @@ -103,6 +105,8 @@ - Avoid jailing validators immediately once they can no longer opt-out from validating consumer chains. ([\#1549](https://github.com/cosmos/interchain-security/pull/1549)) + - Fix the validation of VSCPackets to not fail due to marshaling to string using Bech32. + ([\#1570](https://github.com/cosmos/interchain-security/pull/1570)) - [Provider](x/ccv/provider) - Add the provider-side changes for jail throttling with retries (cf. ADR 008). ([\#1321](https://github.com/cosmos/interchain-security/pull/1321)) diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index f833594abe..913cb9faef 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -14,4 +14,5 @@ This release introduces the following noteworthy changes: - It sets the minimum required version of Go to `1.21`. - It adds the provider-side changes for jail throttling with retries and, as a result, it fully enables the jail throttling with retries feature (cf. [ADR 008](https://github.com/cosmos/interchain-security/blob/release/v3.2.x/docs/docs/adrs/adr-008-throttle-retries.md)). - Fixes a bug in the soft opt-out protocol -- it avoids jailing validators immediately once they can no longer opt-out from validating consumer chains. +- Fixes a bug the validation of VSCPackets caused by marshaling to string using Bech32. From 6c39a2f13056bcf60daf0b6ded020e0279319b4d Mon Sep 17 00:00:00 2001 From: insumity Date: Wed, 21 Feb 2024 09:57:26 +0100 Subject: [PATCH 06/46] added proto declaration --- .../ccv/provider/v1/provider.proto | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/proto/interchain_security/ccv/provider/v1/provider.proto b/proto/interchain_security/ccv/provider/v1/provider.proto index f9bdf0a53f..9430664b1e 100644 --- a/proto/interchain_security/ccv/provider/v1/provider.proto +++ b/proto/interchain_security/ccv/provider/v1/provider.proto @@ -295,3 +295,20 @@ message ConsumerAddrsToPrune { uint64 vsc_id = 2; AddressList consumer_addrs = 3; } + +// CurrentEpochOptedInValidator is used to facilitate epoch-based transitions. It contains relevant info for +// a validator that is opted in, in the curren epoch, on a consumer chain. +message CurrentEpochOptedInValidator { + // validator's consensus address on the provider chain + bytes provider_cons_addr = 1; + // The block height the provider chain had when the validator initially opted in. If the validator remains opted in + // during subsequent epochs, `start_block_height` remains unchanged. + int64 start_block_height = 2; + // The power the validator had when the validator opted in. If the validator remains opted in, `power` gets + // updated in subsequent epochs. + int64 power = 3; + // The consumer public key the validator had assigned for the consumer chain chain when the validator opted in. + // If the validator remains opted in, in subsequent epochs `consumer_public_key` gets updated if the consumer public + // key has been changed. + bytes consumer_public_key = 4; +} \ No newline at end of file From ddae681ad8933e23b4e7dd337c85908c1be455e5 Mon Sep 17 00:00:00 2001 From: insumity Date: Wed, 21 Feb 2024 12:59:05 +0100 Subject: [PATCH 07/46] temp commit --- x/ccv/provider/types/keys.go | 9 + x/ccv/provider/types/keys_test.go | 1 + x/ccv/provider/types/provider.pb.go | 524 ++++++++++++++++++++++------ 3 files changed, 427 insertions(+), 107 deletions(-) diff --git a/x/ccv/provider/types/keys.go b/x/ccv/provider/types/keys.go index 615b901368..209d5c1cb9 100644 --- a/x/ccv/provider/types/keys.go +++ b/x/ccv/provider/types/keys.go @@ -145,6 +145,9 @@ const ( // ProposedConsumerChainByteKey is the byte prefix storing the consumer chainId in consumerAddition gov proposal submitted before voting finishes ProposedConsumerChainByteKey + // OptedInBytePrefix is the byte prefix used when storing for each consumer chain all the opted in validators + OptedInBytePrefix + // NOTE: DO NOT ADD NEW BYTE PREFIXES HERE WITHOUT ADDING THEM TO getAllKeyPrefixes() IN keys_test.go ) @@ -517,6 +520,12 @@ func ParseProposedConsumerChainKey(prefix byte, bz []byte) (uint64, error) { return proposalID, nil } +// OptedInKey returns the key of consumer chain `chainID` and validator with `providerAddr` +func OptedInKey(chainID string, providerAddr []byte) []byte { + prefix := ChainIdWithLenKey(OptedInBytePrefix, chainID) + return append(prefix, providerAddr...) +} + // // End of generic helpers section // diff --git a/x/ccv/provider/types/keys_test.go b/x/ccv/provider/types/keys_test.go index 4d5ea58ff8..447ae04d28 100644 --- a/x/ccv/provider/types/keys_test.go +++ b/x/ccv/provider/types/keys_test.go @@ -56,6 +56,7 @@ func getAllKeyPrefixes() []byte { providertypes.VSCMaturedHandledThisBlockBytePrefix, providertypes.EquivocationEvidenceMinHeightBytePrefix, providertypes.ProposedConsumerChainByteKey, + providertypes.OptedInBytePrefix, } } diff --git a/x/ccv/provider/types/provider.pb.go b/x/ccv/provider/types/provider.pb.go index 41a87e69f4..da2969c849 100644 --- a/x/ccv/provider/types/provider.pb.go +++ b/x/ccv/provider/types/provider.pb.go @@ -1385,6 +1385,84 @@ func (m *ConsumerAddrsToPrune) GetConsumerAddrs() *AddressList { return nil } +// CurrentEpochOptedInValidator is used to facilitate epoch-based transitions. It contains relevant info for +// a validator that is opted in, in the curren epoch, on a consumer chain. +type CurrentEpochOptedInValidator struct { + // validator's consensus address on the provider chain + ProviderConsAddr []byte `protobuf:"bytes,1,opt,name=provider_cons_addr,json=providerConsAddr,proto3" json:"provider_cons_addr,omitempty"` + // The block height the provider chain had when the validator initially opted in. If the validator remains opted in + // during subsequent epochs, `start_block_height` remains unchanged. + StartBlockHeight int64 `protobuf:"varint,2,opt,name=start_block_height,json=startBlockHeight,proto3" json:"start_block_height,omitempty"` + // The power the validator had when the validator opted in. If the validator remains opted in, `power` gets + // updated in subsequent epochs. + Power int64 `protobuf:"varint,3,opt,name=power,proto3" json:"power,omitempty"` + // The consumer public key the validator had assigned for the consumer chain chain when the validator opted in. + // If the validator remains opted in, in subsequent epochs `consumer_public_key` gets updated if the consumer public + // key has been changed. + ConsumerPublicKey []byte `protobuf:"bytes,4,opt,name=consumer_public_key,json=consumerPublicKey,proto3" json:"consumer_public_key,omitempty"` +} + +func (m *CurrentEpochOptedInValidator) Reset() { *m = CurrentEpochOptedInValidator{} } +func (m *CurrentEpochOptedInValidator) String() string { return proto.CompactTextString(m) } +func (*CurrentEpochOptedInValidator) ProtoMessage() {} +func (*CurrentEpochOptedInValidator) Descriptor() ([]byte, []int) { + return fileDescriptor_f22ec409a72b7b72, []int{22} +} +func (m *CurrentEpochOptedInValidator) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *CurrentEpochOptedInValidator) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_CurrentEpochOptedInValidator.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *CurrentEpochOptedInValidator) XXX_Merge(src proto.Message) { + xxx_messageInfo_CurrentEpochOptedInValidator.Merge(m, src) +} +func (m *CurrentEpochOptedInValidator) XXX_Size() int { + return m.Size() +} +func (m *CurrentEpochOptedInValidator) XXX_DiscardUnknown() { + xxx_messageInfo_CurrentEpochOptedInValidator.DiscardUnknown(m) +} + +var xxx_messageInfo_CurrentEpochOptedInValidator proto.InternalMessageInfo + +func (m *CurrentEpochOptedInValidator) GetProviderConsAddr() []byte { + if m != nil { + return m.ProviderConsAddr + } + return nil +} + +func (m *CurrentEpochOptedInValidator) GetStartBlockHeight() int64 { + if m != nil { + return m.StartBlockHeight + } + return 0 +} + +func (m *CurrentEpochOptedInValidator) GetPower() int64 { + if m != nil { + return m.Power + } + return 0 +} + +func (m *CurrentEpochOptedInValidator) GetConsumerPublicKey() []byte { + if m != nil { + return m.ConsumerPublicKey + } + return nil +} + func init() { proto.RegisterType((*ConsumerAdditionProposal)(nil), "interchain_security.ccv.provider.v1.ConsumerAdditionProposal") proto.RegisterType((*ConsumerRemovalProposal)(nil), "interchain_security.ccv.provider.v1.ConsumerRemovalProposal") @@ -1408,6 +1486,7 @@ func init() { proto.RegisterType((*ValidatorConsumerPubKey)(nil), "interchain_security.ccv.provider.v1.ValidatorConsumerPubKey") proto.RegisterType((*ValidatorByConsumerAddr)(nil), "interchain_security.ccv.provider.v1.ValidatorByConsumerAddr") proto.RegisterType((*ConsumerAddrsToPrune)(nil), "interchain_security.ccv.provider.v1.ConsumerAddrsToPrune") + proto.RegisterType((*CurrentEpochOptedInValidator)(nil), "interchain_security.ccv.provider.v1.CurrentEpochOptedInValidator") } func init() { @@ -1415,113 +1494,118 @@ func init() { } var fileDescriptor_f22ec409a72b7b72 = []byte{ - // 1694 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x58, 0xcd, 0x72, 0x1b, 0xc7, - 0x11, 0xe6, 0x12, 0x20, 0x45, 0x34, 0xf8, 0xa7, 0x25, 0x6d, 0x2d, 0x15, 0x06, 0xa4, 0xd6, 0xb1, - 0xc3, 0x94, 0xcb, 0x8b, 0x90, 0x4e, 0xaa, 0x5c, 0xaa, 0xb8, 0x5c, 0x24, 0x28, 0x5b, 0x14, 0x63, - 0x8b, 0x5e, 0x32, 0x54, 0x25, 0x39, 0x6c, 0x0d, 0x66, 0x47, 0xc0, 0x14, 0x17, 0x3b, 0xab, 0x99, - 0xd9, 0x95, 0x71, 0xc9, 0x39, 0x47, 0xe7, 0xe6, 0xca, 0x25, 0x4e, 0x5e, 0x20, 0xe7, 0xbc, 0x81, - 0x8f, 0x3e, 0xe6, 0x64, 0xa7, 0xa4, 0x63, 0x5e, 0x22, 0x35, 0xb3, 0xff, 0x20, 0xa1, 0x40, 0xe5, - 0xe4, 0x36, 0xdb, 0xd3, 0xfd, 0x75, 0xcf, 0x74, 0xf7, 0xd7, 0x03, 0xc0, 0x01, 0x0d, 0x25, 0xe1, - 0x78, 0x88, 0x68, 0xe8, 0x09, 0x82, 0x63, 0x4e, 0xe5, 0xb8, 0x8b, 0x71, 0xd2, 0x8d, 0x38, 0x4b, - 0xa8, 0x4f, 0x78, 0x37, 0xd9, 0x2f, 0xd6, 0x4e, 0xc4, 0x99, 0x64, 0xe6, 0x5b, 0x37, 0xd8, 0x38, - 0x18, 0x27, 0x4e, 0xa1, 0x97, 0xec, 0xdf, 0x7d, 0x7b, 0x1a, 0x70, 0xb2, 0xdf, 0x7d, 0x4e, 0x39, - 0x49, 0xb1, 0xee, 0x6e, 0x0e, 0xd8, 0x80, 0xe9, 0x65, 0x57, 0xad, 0x32, 0xe9, 0xce, 0x80, 0xb1, - 0x41, 0x40, 0xba, 0xfa, 0xab, 0x1f, 0x3f, 0xed, 0x4a, 0x3a, 0x22, 0x42, 0xa2, 0x51, 0x94, 0x29, - 0x74, 0x26, 0x15, 0xfc, 0x98, 0x23, 0x49, 0x59, 0x98, 0x03, 0xd0, 0x3e, 0xee, 0x62, 0xc6, 0x49, - 0x17, 0x07, 0x94, 0x84, 0x52, 0x79, 0x4d, 0x57, 0x99, 0x42, 0x57, 0x29, 0x04, 0x74, 0x30, 0x94, - 0xa9, 0x58, 0x74, 0x25, 0x09, 0x7d, 0xc2, 0x47, 0x34, 0x55, 0x2e, 0xbf, 0x32, 0x83, 0xed, 0xca, - 0x3e, 0xe6, 0xe3, 0x48, 0xb2, 0xee, 0x15, 0x19, 0x8b, 0x6c, 0xf7, 0x1d, 0xcc, 0xc4, 0x88, 0x89, - 0x2e, 0x51, 0xe7, 0x0f, 0x31, 0xe9, 0x26, 0xfb, 0x7d, 0x22, 0xd1, 0x7e, 0x21, 0xc8, 0xe3, 0xce, - 0xf4, 0xfa, 0x48, 0x94, 0x3a, 0x98, 0xd1, 0x2c, 0x6e, 0xfb, 0xfb, 0x45, 0xb0, 0x7a, 0x2c, 0x14, - 0xf1, 0x88, 0xf0, 0x43, 0xdf, 0xa7, 0xea, 0x48, 0x67, 0x9c, 0x45, 0x4c, 0xa0, 0xc0, 0xdc, 0x84, - 0x05, 0x49, 0x65, 0x40, 0x2c, 0x63, 0xd7, 0xd8, 0x6b, 0xb9, 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, 0x97, 0xed, 0x37, 0x5f, 0x6d, 0xbf, 0x27, 0xb0, - 0x5a, 0x0b, 0x4a, 0x64, 0xb7, 0xf1, 0xf3, 0x99, 0x6a, 0xac, 0xc2, 0xae, 0xee, 0x4a, 0xf5, 0x1c, - 0xe2, 0xe8, 0xc9, 0x37, 0x2f, 0x3a, 0xc6, 0xb7, 0x2f, 0x3a, 0xc6, 0xbf, 0x5e, 0x74, 0x8c, 0x2f, - 0x5f, 0x76, 0xe6, 0xbe, 0x7d, 0xd9, 0x99, 0xfb, 0xe7, 0xcb, 0xce, 0xdc, 0xef, 0x3e, 0x1c, 0x50, - 0x39, 0x8c, 0xfb, 0x0e, 0x66, 0xa3, 0x6e, 0xf6, 0xd3, 0xbe, 0xf4, 0xf5, 0x5e, 0xf1, 0xbf, 0x47, - 0xf2, 0x8b, 0xee, 0x17, 0xf5, 0x7f, 0x55, 0xe4, 0x38, 0x22, 0xa2, 0xbf, 0xa8, 0x59, 0xe1, 0xfd, - 0xff, 0x04, 0x00, 0x00, 0xff, 0xff, 0x9f, 0x08, 0x80, 0x3d, 0x86, 0x11, 0x00, 0x00, + // 1772 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x58, 0xcd, 0x73, 0xdb, 0xc6, + 0x15, 0x17, 0x48, 0x4a, 0x16, 0x1f, 0xf5, 0x41, 0x43, 0x4a, 0x0c, 0xb9, 0x2a, 0x25, 0x23, 0x4d, + 0xaa, 0x4e, 0x1a, 0xb0, 0x52, 0xda, 0x99, 0x8c, 0xa7, 0x99, 0x8c, 0x44, 0x39, 0xb1, 0xac, 0x26, + 0x56, 0x20, 0x55, 0x9e, 0xb6, 0x07, 0xcc, 0x72, 0xb1, 0x26, 0x77, 0x04, 0x62, 0xe1, 0xdd, 0x05, + 0x1c, 0x5e, 0x7a, 0xee, 0x31, 0xbd, 0x65, 0x7a, 0x69, 0xda, 0x7f, 0xa0, 0xe7, 0xde, 0x7a, 0xcc, + 0x31, 0xc7, 0x9e, 0x92, 0x8e, 0x7c, 0xec, 0x3f, 0xd1, 0xd9, 0xc5, 0x27, 0x29, 0xc9, 0xa5, 0xc7, + 0xed, 0x0d, 0x78, 0xfb, 0xde, 0xef, 0x7d, 0xbf, 0xb7, 0x00, 0xec, 0xd1, 0x50, 0x12, 0x8e, 0x87, + 0x88, 0x86, 0x9e, 0x20, 0x38, 0xe6, 0x54, 0x8e, 0xbb, 0x18, 0x27, 0xdd, 0x88, 0xb3, 0x84, 0xfa, + 0x84, 0x77, 0x93, 0xdd, 0xe2, 0xd9, 0x89, 0x38, 0x93, 0xcc, 0x7c, 0xeb, 0x1a, 0x19, 0x07, 0xe3, + 0xc4, 0x29, 0xf8, 0x92, 0xdd, 0xbb, 0x6f, 0xdf, 0x04, 0x9c, 0xec, 0x76, 0x9f, 0x53, 0x4e, 0x52, + 0xac, 0xbb, 0xeb, 0x03, 0x36, 0x60, 0xfa, 0xb1, 0xab, 0x9e, 0x32, 0xea, 0xd6, 0x80, 0xb1, 0x41, + 0x40, 0xba, 0xfa, 0xad, 0x1f, 0x3f, 0xed, 0x4a, 0x3a, 0x22, 0x42, 0xa2, 0x51, 0x94, 0x31, 0x74, + 0xa6, 0x19, 0xfc, 0x98, 0x23, 0x49, 0x59, 0x98, 0x03, 0xd0, 0x3e, 0xee, 0x62, 0xc6, 0x49, 0x17, + 0x07, 0x94, 0x84, 0x52, 0x69, 0x4d, 0x9f, 0x32, 0x86, 0xae, 0x62, 0x08, 0xe8, 0x60, 0x28, 0x53, + 0xb2, 0xe8, 0x4a, 0x12, 0xfa, 0x84, 0x8f, 0x68, 0xca, 0x5c, 0xbe, 0x65, 0x02, 0x9b, 0x95, 0x73, + 0xcc, 0xc7, 0x91, 0x64, 0xdd, 0x0b, 0x32, 0x16, 0xd9, 0xe9, 0x3b, 0x98, 0x89, 0x11, 0x13, 0x5d, + 0xa2, 0xfc, 0x0f, 0x31, 0xe9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8b, 0xce, 0xdc, 0x3f, 0x5f, 0x74, 0xe6, 0x7e, 0xfb, 0xe1, 0x80, 0xca, 0x61, 0xdc, + 0x77, 0x30, 0x1b, 0x75, 0xb3, 0xbf, 0x13, 0x65, 0xb8, 0xde, 0x2b, 0x7e, 0xdd, 0x24, 0x3f, 0xef, + 0x7e, 0x31, 0xf9, 0x63, 0x48, 0x8e, 0x23, 0x22, 0xfa, 0x0b, 0x7a, 0xb0, 0xbd, 0xff, 0x9f, 0x00, + 0x00, 0x00, 0xff, 0xff, 0x98, 0x1e, 0xad, 0xaa, 0x49, 0x12, 0x00, 0x00, } func (m *ConsumerAdditionProposal) Marshal() (dAtA []byte, err error) { @@ -2585,6 +2669,53 @@ func (m *ConsumerAddrsToPrune) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *CurrentEpochOptedInValidator) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *CurrentEpochOptedInValidator) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *CurrentEpochOptedInValidator) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.ConsumerPublicKey) > 0 { + i -= len(m.ConsumerPublicKey) + copy(dAtA[i:], m.ConsumerPublicKey) + i = encodeVarintProvider(dAtA, i, uint64(len(m.ConsumerPublicKey))) + i-- + dAtA[i] = 0x22 + } + if m.Power != 0 { + i = encodeVarintProvider(dAtA, i, uint64(m.Power)) + i-- + dAtA[i] = 0x18 + } + if m.StartBlockHeight != 0 { + i = encodeVarintProvider(dAtA, i, uint64(m.StartBlockHeight)) + i-- + dAtA[i] = 0x10 + } + if len(m.ProviderConsAddr) > 0 { + i -= len(m.ProviderConsAddr) + copy(dAtA[i:], m.ProviderConsAddr) + i = encodeVarintProvider(dAtA, i, uint64(len(m.ProviderConsAddr))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + func encodeVarintProvider(dAtA []byte, offset int, v uint64) int { offset -= sovProvider(v) base := offset @@ -3053,6 +3184,29 @@ func (m *ConsumerAddrsToPrune) Size() (n int) { return n } +func (m *CurrentEpochOptedInValidator) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ProviderConsAddr) + if l > 0 { + n += 1 + l + sovProvider(uint64(l)) + } + if m.StartBlockHeight != 0 { + n += 1 + sovProvider(uint64(m.StartBlockHeight)) + } + if m.Power != 0 { + n += 1 + sovProvider(uint64(m.Power)) + } + l = len(m.ConsumerPublicKey) + if l > 0 { + n += 1 + l + sovProvider(uint64(l)) + } + return n +} + func sovProvider(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -6327,6 +6481,162 @@ func (m *ConsumerAddrsToPrune) Unmarshal(dAtA []byte) error { } return nil } +func (m *CurrentEpochOptedInValidator) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProvider + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: CurrentEpochOptedInValidator: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: CurrentEpochOptedInValidator: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ProviderConsAddr", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProvider + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthProvider + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthProvider + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ProviderConsAddr = append(m.ProviderConsAddr[:0], dAtA[iNdEx:postIndex]...) + if m.ProviderConsAddr == nil { + m.ProviderConsAddr = []byte{} + } + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field StartBlockHeight", wireType) + } + m.StartBlockHeight = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProvider + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.StartBlockHeight |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Power", wireType) + } + m.Power = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProvider + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Power |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ConsumerPublicKey", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProvider + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthProvider + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthProvider + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ConsumerPublicKey = append(m.ConsumerPublicKey[:0], dAtA[iNdEx:postIndex]...) + if m.ConsumerPublicKey == nil { + m.ConsumerPublicKey = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipProvider(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthProvider + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipProvider(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 From c9b1b3e290f0d7937c0ae83547654e4e8cecd9e6 Mon Sep 17 00:00:00 2001 From: insumity Date: Wed, 21 Feb 2024 12:59:12 +0100 Subject: [PATCH 08/46] temp commit --- x/ccv/provider/keeper/validator_set_update.go | 354 ++++++++++++++++++ 1 file changed, 354 insertions(+) create mode 100644 x/ccv/provider/keeper/validator_set_update.go diff --git a/x/ccv/provider/keeper/validator_set_update.go b/x/ccv/provider/keeper/validator_set_update.go new file mode 100644 index 0000000000..6356320f80 --- /dev/null +++ b/x/ccv/provider/keeper/validator_set_update.go @@ -0,0 +1,354 @@ +package keeper + +import ( + "fmt" + abci "github.com/cometbft/cometbft/abci/types" + "github.com/cometbft/cometbft/proto/tendermint/crypto" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/interchain-security/v4/x/ccv/provider/types" +) + +// SetOptedIn sets validator `providerAddr` as opted in with the given `blockHeight` and `power` +func (k Keeper) SetOptedIn( + ctx sdk.Context, + chainID string, + validator types.CurrentEpochOptedInValidator, +) { + store := ctx.KVStore(k.storeKey) + bz, err := validator.Marshal() + if err != nil { + panic(fmt.Errorf("failed to marshal CurrentEpochOptedInValidator: %w", err)) + } + + store.Set(types.OptedInKey(chainID, validator.ProviderConsAddr), bz) +} + +// DeleteOptedIn deletes opted-in validator `providerAddr` +func (k Keeper) DeleteOptedIn( + ctx sdk.Context, + chainID string, + providerAddr types.ProviderConsAddress, +) { + store := ctx.KVStore(k.storeKey) + store.Delete(types.OptedInKey(chainID, providerAddr.ToSdkConsAddr())) +} + +// DeleteAllOptedIn deletes all opted-in validators +func (k Keeper) DeleteAllOptedIn( + ctx sdk.Context, + chainID string) { + store := ctx.KVStore(k.storeKey) + key := types.ChainIdWithLenKey(types.OptedInBytePrefix, chainID) + iterator := sdk.KVStorePrefixIterator(store, key) + + var keysToDel [][]byte + defer iterator.Close() + for ; iterator.Valid(); iterator.Next() { + keysToDel = append(keysToDel, iterator.Key()) + } + for _, delKey := range keysToDel { + store.Delete(delKey) + } +} + +// IsOptedIn returns `true` if the validator with `providerAddr` is opted in and `false` otherwise +func (k Keeper) IsOptedIn( + ctx sdk.Context, + chainID string, + providerAddr types.ProviderConsAddress, +) bool { + store := ctx.KVStore(k.storeKey) + return store.Get(types.OptedInKey(chainID, providerAddr.ToSdkConsAddr())) != nil +} + +// GetAllOptedIn returns all the opted-in validators on chain `chainID` +func (k Keeper) GetAllOptedIn( + ctx sdk.Context, + chainID string) (optedInValidators []types.CurrentEpochOptedInValidator) { + store := ctx.KVStore(k.storeKey) + key := types.ChainIdWithLenKey(types.OptedInBytePrefix, chainID) + iterator := sdk.KVStorePrefixIterator(store, key) + defer iterator.Close() + + for ; iterator.Valid(); iterator.Next() { + iterator.Value() + var optedInValidator types.CurrentEpochOptedInValidator + if err := optedInValidator.Unmarshal(iterator.Value()); err != nil { + panic(fmt.Errorf("failed to unmarshal CurrentEpochOptedInValidator: %w", err)) + } + optedInValidators = append(optedInValidators, optedInValidator) + } + + return optedInValidators +} + +// ComputeValidatorUpdatesAndNextValidators returns the validator updates needed to be sent to the consumer chain to +// capture the newly opted-in and opted-out validators, as well as validators that unbonded. It also computes the +// next validator set that is responsible for validating on a consumer chain. +//func (k Keeper) ComputeValidatorUpdatesAndNextValidators(ctx sdk.Context, +// chainID string, +// currentValidators []types.OptedInValidator, +// validatorAddressesToAdd []types.ProviderConsAddress, +// validatorAddressesToRemove []types.ProviderConsAddress, +//) (updates []abci.ValidatorUpdate, nextValidators []types.OptedInValidator) { +// // store in a map all the validators that are to be removed, so we can filter out those +// // validators when we go through `currentValidators` +// isRemoved := make(map[string]bool) +// for _, addr := range validatorAddressesToRemove { +// isRemoved[addr.String()] = true +// } +// +// // go through all opted-in validators and look in the following order: +// // - if the validator has opted out, generate a 0-power update +// // - if the validator is not bonded anymore, generate a 0-power update +// // - if the validator has changed its consumer key since last epoch, generate a 0-power update for the old key +// // and generate an update with the new power and the new key +// // - if the validator has not changed its consumer key but has changed its voting power since last epoch, +// // generate an update with the new power +// // - if validator has not changed its consumer key or its voting power since, then do not generate an update +// for _, val := range currentValidators { +// // `currentPublicKey` is the currently used key by validator `val` when validating on the consumer chain +// var currentPublicKey crypto.PublicKey +// err := currentPublicKey.Unmarshal(val.PublicKey) +// if err != nil { +// // this should never happen and is not recoverable because without the public key +// // we cannot generate a validator update to remove this validator +// panic(fmt.Errorf("could not unmarshall public key (%s): %w", val.PublicKey, err)) +// } +// +// providerAddr := types.NewProviderConsAddress(val.ProviderAddr) +// if isRemoved[providerAddr.String()] { +// // if the validator is removed, then generate a 0-power update to remove +// // validator `val` from the consumer chain +// updates = append(updates, abci.ValidatorUpdate{PubKey: currentPublicKey, Power: 0}) +// continue +// } +// +// validator, found := k.stakingKeeper.GetValidatorByConsAddr(ctx, val.ProviderAddr) +// if !found { +// // This should never happen because when `val` was added as an opt-in validator it was bonded +// // and for it not to be found it means that it fully unbonded after an unbonding period. Assuming +// // an epoch is smaller than the unbonding period, we would have already removed this validator from +// // an opted-in validator. In any case, we can still recover in this case by sending a 0-power update. +// k.Logger(ctx).Error("validator with consensus address (%s) could not be found", val.ProviderAddr) +// updates = append(updates, abci.ValidatorUpdate{PubKey: currentPublicKey, Power: 0}) +// continue +// } +// +// nextPower := k.stakingKeeper.GetLastValidatorPower(ctx, validator.GetOperator()) +// if nextPower == 0 { +// // if the validator is not bonded anymore, then send an update with 0 power to remove validator +// updates = append(updates, abci.ValidatorUpdate{PubKey: currentPublicKey, Power: 0}) +// continue +// } +// +// // get the consumer key the validator intends to use to validate on the consumer chain +// nextPublicKey, found := k.GetValidatorConsumerPubKey(ctx, chainID, types.NewProviderConsAddress(val.ProviderAddr)) +// if !found { +// // if not found, then the current consumer key is the same +// // as the one the validator used when it first opted in +// nextPublicKey = currentPublicKey +// } +// +// if !nextPublicKey.Equal(currentPublicKey) { +// // if the validator has changed its consumer key since last it opted in, then generate a 0-power update +// // for the old consumer key, and an update with the new key with the new power +// updates = append(updates, abci.ValidatorUpdate{PubKey: currentPublicKey, Power: 0}) +// updates = append(updates, abci.ValidatorUpdate{PubKey: nextPublicKey, Power: nextPower}) +// } else if val.Power != nextPower { +// // otherwise, only send an update if the power has changed since the last epoch +// updates = append(updates, abci.ValidatorUpdate{PubKey: nextPublicKey, Power: nextPower}) +// } +// +// // update validator with the new power the validator has +// // at the end of this epoch and with the new key +// val.Power = nextPower +// val.PublicKey, err = nextPublicKey.Marshal() +// if err != nil { +// // this should never happen and would lead to `panic` later on when we try to `Unmarshal` the key +// panic(fmt.Errorf("could not marshal public key (%s): %w", nextPublicKey, err)) +// } +// +// // validator `val` was not removed, so it would still be part of the next opted-in validators +// nextValidators = append(nextValidators, val) +// } +// +// // go through all to-be-opted-in validators and look in the following order: +// // - if the validator is not in the active set, do not generate an update for it +// for _, addr := range validatorAddressesToAdd { +// validator, found := k.stakingKeeper.GetValidatorByConsAddr(ctx, addr.ToSdkConsAddr()) +// if !found { +// k.Logger(ctx).Info("validator (%s) that was to-be-opted-in cannot be found anymore", addr) +// continue +// } +// +// if !validator.IsBonded() { +// // if the validator is not bonded anymore and hence not in the active set we do not add it +// continue +// } +// +// // for a validator that just opts in, we can immediately use the next key +// nextPublicKey, found := k.GetValidatorConsumerPubKey(ctx, chainID, addr) +// if !found { +// var err error +// nextPublicKey, err = validator.TmConsPublicKey() +// if err != nil { +// k.Logger(ctx).Error("could not retrieve public key from validator (%s)", addr) +// continue +// } +// } +// +// // for a validator that just opts in, we can immediately use the next power +// nextPower := k.stakingKeeper.GetLastValidatorPower(ctx, validator.GetOperator()) +// updates = append(updates, abci.ValidatorUpdate{PubKey: nextPublicKey, Power: nextPower}) +// +// nextPublicKeyBytes, err := nextPublicKey.Marshal() +// if err != nil { +// // this should never happen and would lead to `panic` later on when we try to `Unmarshal` the key +// panic(fmt.Errorf("could not marshal public key (%s): %w", nextPublicKey, err)) +// } +// +// nextValidators = append(nextValidators, +// types.OptedInValidator{ +// ProviderAddr: addr.ToSdkConsAddr(), +// BlockHeight: ctx.BlockHeight(), +// // validator that just opted-in would be using next power and next key for the upcoming epoch +// Power: nextPower, +// PublicKey: nextPublicKeyBytes, +// }) +// } +// +// return updates, nextValidators +//} + +// ComputeNextEpochOptedInValidators returns the next validator set that is responsible for validating on +// a consumer chain. +func (k Keeper) ComputeNextEpochOptedInValidators( + ctx sdk.Context, + chainID string, + currentValidators []types.CurrentEpochOptedInValidator, +) (nextValidators []types.CurrentEpochOptedInValidator) { + for _, val := range currentValidators { + // `currentPublicKey` is the currently used key by validator `val` when validating on the consumer chain + var currentPublicKey crypto.PublicKey + err := currentPublicKey.Unmarshal(val.ConsumerPublicKey) + if err != nil { + // this should never happen and is not recoverable because without the public key + // we cannot generate a validator update to remove this validator + panic(fmt.Errorf("could not unmarshall public key (%s): %w", val.ConsumerPublicKey, err)) + } + + validator, found := k.stakingKeeper.GetValidatorByConsAddr(ctx, val.ProviderConsAddr) + if !found { + // This should never happen because when `val` was added as an opt-in validator it was bonded + // and for it not to be found it means that it fully unbonded after an unbonding period. Assuming + // an epoch is smaller than the unbonding period, we would have already removed this validator from + // an opted-in validator. In any case, we can still recover in this case by sending a 0-power update. + k.Logger(ctx).Error("validator with consensus address (%s) could not be found", val.ProviderConsAddr) + //updates = append(updates, abci.ValidatorUpdate{PubKey: currentPublicKey, Power: 0}) + continue + } + + nextPower := k.stakingKeeper.GetLastValidatorPower(ctx, validator.GetOperator()) + + // for a validator that just opts in, we can immediately use the next key + nextPublicKey, found := k.GetValidatorConsumerPubKey(ctx, chainID, types.NewProviderConsAddress(val.ProviderConsAddr)) + if !found { + var err error + nextPublicKey, err = validator.TmConsPublicKey() + if err != nil { + k.Logger(ctx).Error("could not retrieve public key from validator (%s)", val.ProviderConsAddr) + continue + } + } + + nextPublicKeyBytes, err := nextPublicKey.Marshal() + + k := types.CurrentEpochOptedInValidator{ + ProviderConsAddr: val.ProviderConsAddr, + StartBlockHeight: ctx.BlockHeight(), + Power: nextPower, + ConsumerPublicKey: nextPublicKeyBytes, + } + val.Power = nextPower + val.ConsumerPublicKey = nextPublicKeyBytes + + // validator `val` was not removed, so it would still be part of the next opted-in validators + nextValidators = append(nextValidators, k) + } + + return nextValidators +} + +// rename to EpochValidator ... because not opted i yet ... no? +func (k Keeper) diff( + currentValidators []types.CurrentEpochOptedInValidator, + nextValidators []types.CurrentEpochOptedInValidator) []abci.ValidatorUpdate { + var updates []abci.ValidatorUpdate + isCurrentValidator := make(map[string]types.CurrentEpochOptedInValidator) + for _, val := range currentValidators { + isCurrentValidator[string(val.ProviderConsAddr)] = val + } + + isNextValidator := make(map[string]types.CurrentEpochOptedInValidator) + for _, val := range nextValidators { + isNextValidator[string(val.ProviderConsAddr)] = val + } + + for _, val := range currentValidators { + if nextVal, found := isNextValidator[string(val.ProviderConsAddr)]; found { + // validator remains in the next epoch + var currentPublicKey crypto.PublicKey + err := currentPublicKey.Unmarshal(val.ConsumerPublicKey) + // unrecoverable error + if err != nil { + panic("") + } + + var nextPublicKey crypto.PublicKey + err = nextPublicKey.Unmarshal(nextVal.ConsumerPublicKey) + if err != nil { + panic("...") + } + + if !currentPublicKey.Equal(nextPublicKey) { + updates = append(updates, abci.ValidatorUpdate{PubKey: currentPublicKey, Power: 0}) + } + updates = append(updates, abci.ValidatorUpdate{PubKey: nextPublicKey, Power: nextVal.Power}) + } else { + // not found in next validators and hence the validator has to be removed + var currentPublicKey crypto.PublicKey + err := currentPublicKey.Unmarshal(val.ConsumerPublicKey) + if err != nil { + panic("..") + } + + updates = append(updates, abci.ValidatorUpdate{PubKey: currentPublicKey, Power: 0}) + } + } + + // validators to be added + for _, val := range nextValidators { + if nextVal, found := isCurrentValidator[string(val.ProviderConsAddr)]; !found { + var nextPublicKey crypto.PublicKey + err := nextPublicKey.Unmarshal(nextVal.ConsumerPublicKey) + if err != nil { + panic("..") + } + + updates = append(updates, abci.ValidatorUpdate{PubKey: nextPublicKey, Power: nextVal.Power}) + } + } + + return updates +} + +// ResetCurrentEpochOptedInValidators resets the opted-in validators with the newest set that was computed by +// `ComputeNextValidators` and hence this method should only be called after `ComputeNextValidators` has completed. +func (k Keeper) ResetCurrentEpochOptedInValidators(ctx sdk.Context, chainID string, + nextValidators []types.CurrentEpochOptedInValidator) { + k.DeleteAllOptedIn(ctx, chainID) + for _, val := range nextValidators { + k.SetOptedIn(ctx, chainID, val) + } +} From e0861e2910cce34fce63adffe14c4e4c39811291 Mon Sep 17 00:00:00 2001 From: insumity Date: Wed, 21 Feb 2024 17:42:37 +0100 Subject: [PATCH 09/46] more changes --- .../ccv/provider/v1/provider.proto | 17 +- x/ccv/provider/keeper/relay.go | 20 +- x/ccv/provider/keeper/relay_test.go | 16 +- x/ccv/provider/keeper/validator_set_update.go | 275 +++++------------ x/ccv/provider/types/provider.pb.go | 278 +++++++++--------- 5 files changed, 234 insertions(+), 372 deletions(-) diff --git a/proto/interchain_security/ccv/provider/v1/provider.proto b/proto/interchain_security/ccv/provider/v1/provider.proto index 9430664b1e..6e53c0c428 100644 --- a/proto/interchain_security/ccv/provider/v1/provider.proto +++ b/proto/interchain_security/ccv/provider/v1/provider.proto @@ -296,19 +296,16 @@ message ConsumerAddrsToPrune { AddressList consumer_addrs = 3; } -// CurrentEpochOptedInValidator is used to facilitate epoch-based transitions. It contains relevant info for -// a validator that is opted in, in the curren epoch, on a consumer chain. -message CurrentEpochOptedInValidator { +// EpochValidator is used to facilitate epoch-based transitions. It contains relevant info for +// a validator that is opted in, in an epoch, on a consumer chain. +message EpochValidator { // validator's consensus address on the provider chain bytes provider_cons_addr = 1; - // The block height the provider chain had when the validator initially opted in. If the validator remains opted in - // during subsequent epochs, `start_block_height` remains unchanged. + // The block height the provider chain had when the validator opted in for the first time. If the validator + // remains opted in during subsequent epochs, `start_block_height` remains unchanged. int64 start_block_height = 2; - // The power the validator had when the validator opted in. If the validator remains opted in, `power` gets - // updated in subsequent epochs. + // voting power the validator has during this epoch int64 power = 3; - // The consumer public key the validator had assigned for the consumer chain chain when the validator opted in. - // If the validator remains opted in, in subsequent epochs `consumer_public_key` gets updated if the consumer public - // key has been changed. + // public key the validator uses on the consumer chain during this epoch bytes consumer_public_key = 4; } \ No newline at end of file diff --git a/x/ccv/provider/keeper/relay.go b/x/ccv/provider/keeper/relay.go index 59fec69534..dc515887df 100644 --- a/x/ccv/provider/keeper/relay.go +++ b/x/ccv/provider/keeper/relay.go @@ -148,13 +148,15 @@ func (k Keeper) EndBlockVSU(ctx sdk.Context) { // notify the staking module to complete all matured unbonding ops k.completeMaturedUnbondingOps(ctx) - // collect validator updates - k.QueueVSCPackets(ctx) - - // try sending VSC packets to all registered consumer chains; - // if the CCV channel is not established for a consumer chain, - // the updates will remain queued until the channel is established - k.SendVSCPackets(ctx) + if ctx.BlockHeight()%BlocksPerEpoch == 0 { + // collect validator updates + k.QueueVSCPackets(ctx) + + // try sending VSC packets to all registered consumer chains; + // if the CCV channel is not established for a consumer chain, + // the updates will remain queued until the channel is established + k.SendVSCPackets(ctx) + } } // SendVSCPackets iterates over all registered consumers and sends pending @@ -218,6 +220,10 @@ func (k Keeper) QueueVSCPackets(ctx sdk.Context) { stakingValUpdates := k.stakingKeeper.GetValidatorUpdates(ctx) for _, chain := range k.GetAllConsumerChains(ctx) { + currentEpochValidators := k.GetAllEpochValidators(ctx, chain.ChainId) + nextEpochValidators := k.ComputeNextEpochValidators(ctx, chain.ChainId, currentEpochValidators) + valUpdates := k.diff(currentEpochValidators, nextEpochValidators) + // Apply the key assignment to the validator updates. valUpdates := k.MustApplyKeyAssignmentToValUpdates(ctx, chain.ChainId, stakingValUpdates) diff --git a/x/ccv/provider/keeper/relay_test.go b/x/ccv/provider/keeper/relay_test.go index 02df262d53..1f3977f5e6 100644 --- a/x/ccv/provider/keeper/relay_test.go +++ b/x/ccv/provider/keeper/relay_test.go @@ -66,16 +66,16 @@ func TestQueueVSCPackets(t *testing.T) { ctrl := gomock.NewController(t) defer ctrl.Finish() mocks := testkeeper.NewMockedKeepers(ctrl) - mockStakingKeeper := mocks.MockStakingKeeper + //mockStakingKeeper := mocks.MockStakingKeeper - mockUpdates := []abci.ValidatorUpdate{} - if len(tc.packets) != 0 { - mockUpdates = tc.packets[0].ValidatorUpdates - } + //mockUpdates := []abci.ValidatorUpdate{} + //if len(tc.packets) != 0 { + // mockUpdates = tc.packets[0].ValidatorUpdates + //} - gomock.InOrder( - mockStakingKeeper.EXPECT().GetValidatorUpdates(gomock.Eq(ctx)).Return(mockUpdates), - ) + //gomock.InOrder( + // mockStakingKeeper.EXPECT().GetValidatorUpdates(gomock.Eq(ctx)).Return(mockUpdates), + //) pk := testkeeper.NewInMemProviderKeeper(keeperParams, mocks) // no-op if tc.packets is empty diff --git a/x/ccv/provider/keeper/validator_set_update.go b/x/ccv/provider/keeper/validator_set_update.go index 6356320f80..19a44a6111 100644 --- a/x/ccv/provider/keeper/validator_set_update.go +++ b/x/ccv/provider/keeper/validator_set_update.go @@ -8,11 +8,14 @@ import ( "github.com/cosmos/interchain-security/v4/x/ccv/provider/types" ) -// SetOptedIn sets validator `providerAddr` as opted in with the given `blockHeight` and `power` -func (k Keeper) SetOptedIn( +const BlocksPerEpoch = 1 +const HoursPerEpoch = 1 + +// SetEpochValidator sets provided epoch `validator` on the consumer chain with `chainID` +func (k Keeper) SetEpochValidator( ctx sdk.Context, chainID string, - validator types.CurrentEpochOptedInValidator, + validator types.EpochValidator, ) { store := ctx.KVStore(k.storeKey) bz, err := validator.Marshal() @@ -23,18 +26,18 @@ func (k Keeper) SetOptedIn( store.Set(types.OptedInKey(chainID, validator.ProviderConsAddr), bz) } -// DeleteOptedIn deletes opted-in validator `providerAddr` -func (k Keeper) DeleteOptedIn( +// DeleteEpochValidator removes epoch validator with `providerAddr` address +func (k Keeper) DeleteEpochValidator( ctx sdk.Context, chainID string, - providerAddr types.ProviderConsAddress, + providerConsAddr types.ProviderConsAddress, ) { store := ctx.KVStore(k.storeKey) - store.Delete(types.OptedInKey(chainID, providerAddr.ToSdkConsAddr())) + store.Delete(types.OptedInKey(chainID, providerConsAddr.ToSdkConsAddr())) } -// DeleteAllOptedIn deletes all opted-in validators -func (k Keeper) DeleteAllOptedIn( +// DeleteAllEpochValidators deletes all the stored epoch validators +func (k Keeper) DeleteAllEpochValidators( ctx sdk.Context, chainID string) { store := ctx.KVStore(k.storeKey) @@ -51,8 +54,8 @@ func (k Keeper) DeleteAllOptedIn( } } -// IsOptedIn returns `true` if the validator with `providerAddr` is opted in and `false` otherwise -func (k Keeper) IsOptedIn( +// IsEpochValidator returns `true` if the validator with `providerAddr` is set in and `false` otherwise +func (k Keeper) IsEpochValidator( ctx sdk.Context, chainID string, providerAddr types.ProviderConsAddress, @@ -61,10 +64,10 @@ func (k Keeper) IsOptedIn( return store.Get(types.OptedInKey(chainID, providerAddr.ToSdkConsAddr())) != nil } -// GetAllOptedIn returns all the opted-in validators on chain `chainID` -func (k Keeper) GetAllOptedIn( +// GetAllEpochValidators returns all the epoch validators on chain `chainID` +func (k Keeper) GetAllEpochValidators( ctx sdk.Context, - chainID string) (optedInValidators []types.CurrentEpochOptedInValidator) { + chainID string) (optedInValidators []types.EpochValidator) { store := ctx.KVStore(k.storeKey) key := types.ChainIdWithLenKey(types.OptedInBytePrefix, chainID) iterator := sdk.KVStorePrefixIterator(store, key) @@ -72,7 +75,7 @@ func (k Keeper) GetAllOptedIn( for ; iterator.Valid(); iterator.Next() { iterator.Value() - var optedInValidator types.CurrentEpochOptedInValidator + var optedInValidator types.EpochValidator if err := optedInValidator.Unmarshal(iterator.Value()); err != nil { panic(fmt.Errorf("failed to unmarshal CurrentEpochOptedInValidator: %w", err)) } @@ -82,233 +85,93 @@ func (k Keeper) GetAllOptedIn( return optedInValidators } -// ComputeValidatorUpdatesAndNextValidators returns the validator updates needed to be sent to the consumer chain to -// capture the newly opted-in and opted-out validators, as well as validators that unbonded. It also computes the -// next validator set that is responsible for validating on a consumer chain. -//func (k Keeper) ComputeValidatorUpdatesAndNextValidators(ctx sdk.Context, -// chainID string, -// currentValidators []types.OptedInValidator, -// validatorAddressesToAdd []types.ProviderConsAddress, -// validatorAddressesToRemove []types.ProviderConsAddress, -//) (updates []abci.ValidatorUpdate, nextValidators []types.OptedInValidator) { -// // store in a map all the validators that are to be removed, so we can filter out those -// // validators when we go through `currentValidators` -// isRemoved := make(map[string]bool) -// for _, addr := range validatorAddressesToRemove { -// isRemoved[addr.String()] = true -// } -// -// // go through all opted-in validators and look in the following order: -// // - if the validator has opted out, generate a 0-power update -// // - if the validator is not bonded anymore, generate a 0-power update -// // - if the validator has changed its consumer key since last epoch, generate a 0-power update for the old key -// // and generate an update with the new power and the new key -// // - if the validator has not changed its consumer key but has changed its voting power since last epoch, -// // generate an update with the new power -// // - if validator has not changed its consumer key or its voting power since, then do not generate an update -// for _, val := range currentValidators { -// // `currentPublicKey` is the currently used key by validator `val` when validating on the consumer chain -// var currentPublicKey crypto.PublicKey -// err := currentPublicKey.Unmarshal(val.PublicKey) -// if err != nil { -// // this should never happen and is not recoverable because without the public key -// // we cannot generate a validator update to remove this validator -// panic(fmt.Errorf("could not unmarshall public key (%s): %w", val.PublicKey, err)) -// } -// -// providerAddr := types.NewProviderConsAddress(val.ProviderAddr) -// if isRemoved[providerAddr.String()] { -// // if the validator is removed, then generate a 0-power update to remove -// // validator `val` from the consumer chain -// updates = append(updates, abci.ValidatorUpdate{PubKey: currentPublicKey, Power: 0}) -// continue -// } -// -// validator, found := k.stakingKeeper.GetValidatorByConsAddr(ctx, val.ProviderAddr) -// if !found { -// // This should never happen because when `val` was added as an opt-in validator it was bonded -// // and for it not to be found it means that it fully unbonded after an unbonding period. Assuming -// // an epoch is smaller than the unbonding period, we would have already removed this validator from -// // an opted-in validator. In any case, we can still recover in this case by sending a 0-power update. -// k.Logger(ctx).Error("validator with consensus address (%s) could not be found", val.ProviderAddr) -// updates = append(updates, abci.ValidatorUpdate{PubKey: currentPublicKey, Power: 0}) -// continue -// } -// -// nextPower := k.stakingKeeper.GetLastValidatorPower(ctx, validator.GetOperator()) -// if nextPower == 0 { -// // if the validator is not bonded anymore, then send an update with 0 power to remove validator -// updates = append(updates, abci.ValidatorUpdate{PubKey: currentPublicKey, Power: 0}) -// continue -// } -// -// // get the consumer key the validator intends to use to validate on the consumer chain -// nextPublicKey, found := k.GetValidatorConsumerPubKey(ctx, chainID, types.NewProviderConsAddress(val.ProviderAddr)) -// if !found { -// // if not found, then the current consumer key is the same -// // as the one the validator used when it first opted in -// nextPublicKey = currentPublicKey -// } -// -// if !nextPublicKey.Equal(currentPublicKey) { -// // if the validator has changed its consumer key since last it opted in, then generate a 0-power update -// // for the old consumer key, and an update with the new key with the new power -// updates = append(updates, abci.ValidatorUpdate{PubKey: currentPublicKey, Power: 0}) -// updates = append(updates, abci.ValidatorUpdate{PubKey: nextPublicKey, Power: nextPower}) -// } else if val.Power != nextPower { -// // otherwise, only send an update if the power has changed since the last epoch -// updates = append(updates, abci.ValidatorUpdate{PubKey: nextPublicKey, Power: nextPower}) -// } -// -// // update validator with the new power the validator has -// // at the end of this epoch and with the new key -// val.Power = nextPower -// val.PublicKey, err = nextPublicKey.Marshal() -// if err != nil { -// // this should never happen and would lead to `panic` later on when we try to `Unmarshal` the key -// panic(fmt.Errorf("could not marshal public key (%s): %w", nextPublicKey, err)) -// } -// -// // validator `val` was not removed, so it would still be part of the next opted-in validators -// nextValidators = append(nextValidators, val) -// } -// -// // go through all to-be-opted-in validators and look in the following order: -// // - if the validator is not in the active set, do not generate an update for it -// for _, addr := range validatorAddressesToAdd { -// validator, found := k.stakingKeeper.GetValidatorByConsAddr(ctx, addr.ToSdkConsAddr()) -// if !found { -// k.Logger(ctx).Info("validator (%s) that was to-be-opted-in cannot be found anymore", addr) -// continue -// } -// -// if !validator.IsBonded() { -// // if the validator is not bonded anymore and hence not in the active set we do not add it -// continue -// } -// -// // for a validator that just opts in, we can immediately use the next key -// nextPublicKey, found := k.GetValidatorConsumerPubKey(ctx, chainID, addr) -// if !found { -// var err error -// nextPublicKey, err = validator.TmConsPublicKey() -// if err != nil { -// k.Logger(ctx).Error("could not retrieve public key from validator (%s)", addr) -// continue -// } -// } -// -// // for a validator that just opts in, we can immediately use the next power -// nextPower := k.stakingKeeper.GetLastValidatorPower(ctx, validator.GetOperator()) -// updates = append(updates, abci.ValidatorUpdate{PubKey: nextPublicKey, Power: nextPower}) -// -// nextPublicKeyBytes, err := nextPublicKey.Marshal() -// if err != nil { -// // this should never happen and would lead to `panic` later on when we try to `Unmarshal` the key -// panic(fmt.Errorf("could not marshal public key (%s): %w", nextPublicKey, err)) -// } -// -// nextValidators = append(nextValidators, -// types.OptedInValidator{ -// ProviderAddr: addr.ToSdkConsAddr(), -// BlockHeight: ctx.BlockHeight(), -// // validator that just opted-in would be using next power and next key for the upcoming epoch -// Power: nextPower, -// PublicKey: nextPublicKeyBytes, -// }) -// } -// -// return updates, nextValidators -//} - -// ComputeNextEpochOptedInValidators returns the next validator set that is responsible for validating on -// a consumer chain. -func (k Keeper) ComputeNextEpochOptedInValidators( +// ComputeNextEpochValidators returns the next validator set that is +// responsible for validating on a consumer chain. +func (k Keeper) ComputeNextEpochValidators( ctx sdk.Context, chainID string, - currentValidators []types.CurrentEpochOptedInValidator, -) (nextValidators []types.CurrentEpochOptedInValidator) { + currentValidators []types.EpochValidator, +) []types.EpochValidator { + var nextValidators []types.EpochValidator for _, val := range currentValidators { // `currentPublicKey` is the currently used key by validator `val` when validating on the consumer chain var currentPublicKey crypto.PublicKey err := currentPublicKey.Unmarshal(val.ConsumerPublicKey) if err != nil { - // this should never happen and is not recoverable because without the public key - // we cannot generate a validator update to remove this validator - panic(fmt.Errorf("could not unmarshall public key (%s): %w", val.ConsumerPublicKey, err)) + // this should never happen but is recoverable if we exclude this validator from the `nextValidators` + k.Logger(ctx).Error("validator's (%+v) public key could not be unmarshalled: %w", val, err) + continue } validator, found := k.stakingKeeper.GetValidatorByConsAddr(ctx, val.ProviderConsAddr) if !found { - // This should never happen because when `val` was added as an opt-in validator it was bonded + // This should never happen because when `val` was added as an epoch validator it was bonded // and for it not to be found it means that it fully unbonded after an unbonding period. Assuming // an epoch is smaller than the unbonding period, we would have already removed this validator from - // an opted-in validator. In any case, we can still recover in this case by sending a 0-power update. - k.Logger(ctx).Error("validator with consensus address (%s) could not be found", val.ProviderConsAddr) - //updates = append(updates, abci.ValidatorUpdate{PubKey: currentPublicKey, Power: 0}) + // being an epoch validator. In any case, we can still recover by excluding this validator + // from `nextValidators`. + k.Logger(ctx).Error("validator (%+v) could not be found: %w", val, err) continue } + // get next voting power and the next consumer public key nextPower := k.stakingKeeper.GetLastValidatorPower(ctx, validator.GetOperator()) - - // for a validator that just opts in, we can immediately use the next key - nextPublicKey, found := k.GetValidatorConsumerPubKey(ctx, chainID, types.NewProviderConsAddress(val.ProviderConsAddr)) + nextConsumerPublicKey, found := k.GetValidatorConsumerPubKey(ctx, chainID, types.NewProviderConsAddress(val.ProviderConsAddr)) if !found { - var err error - nextPublicKey, err = validator.TmConsPublicKey() - if err != nil { - k.Logger(ctx).Error("could not retrieve public key from validator (%s)", val.ProviderConsAddr) - continue - } + k.Logger(ctx).Error("could not retrieve public key for validator (%+v)", val) + continue + } + nextConsumerPublicKeyBytes, err := nextConsumerPublicKey.Marshal() + if err != nil { + // this should never happen but is recoverable if we exclude this validator from the `nextValidators` + k.Logger(ctx).Error("could not marshal consumer public key (%+v): %w", nextConsumerPublicKey, err) + continue } - nextPublicKeyBytes, err := nextPublicKey.Marshal() - - k := types.CurrentEpochOptedInValidator{ + nextValidator := types.EpochValidator{ ProviderConsAddr: val.ProviderConsAddr, - StartBlockHeight: ctx.BlockHeight(), + StartBlockHeight: val.StartBlockHeight, // remains stable Power: nextPower, - ConsumerPublicKey: nextPublicKeyBytes, + ConsumerPublicKey: nextConsumerPublicKeyBytes, } - val.Power = nextPower - val.ConsumerPublicKey = nextPublicKeyBytes - - // validator `val` was not removed, so it would still be part of the next opted-in validators - nextValidators = append(nextValidators, k) + nextValidators = append(nextValidators, nextValidator) } return nextValidators } -// rename to EpochValidator ... because not opted i yet ... no? +// diff compares two validator sets and return sthe diff func (k Keeper) diff( - currentValidators []types.CurrentEpochOptedInValidator, - nextValidators []types.CurrentEpochOptedInValidator) []abci.ValidatorUpdate { + currentValidators []types.EpochValidator, + nextValidators []types.EpochValidator) []abci.ValidatorUpdate { var updates []abci.ValidatorUpdate - isCurrentValidator := make(map[string]types.CurrentEpochOptedInValidator) + isCurrentValidator := make(map[string]types.EpochValidator) for _, val := range currentValidators { isCurrentValidator[string(val.ProviderConsAddr)] = val } - isNextValidator := make(map[string]types.CurrentEpochOptedInValidator) + isNextValidator := make(map[string]types.EpochValidator) for _, val := range nextValidators { isNextValidator[string(val.ProviderConsAddr)] = val } for _, val := range currentValidators { + var currentPublicKey crypto.PublicKey + err := currentPublicKey.Unmarshal(val.ConsumerPublicKey) + if err != nil { + // this should never happen and might not be recoverable because without the public key + // we cannot generate a validator update + panic(fmt.Errorf("could not unmarshall validator's (%+v) public key: %w", val, err)) + } + if nextVal, found := isNextValidator[string(val.ProviderConsAddr)]; found { // validator remains in the next epoch - var currentPublicKey crypto.PublicKey - err := currentPublicKey.Unmarshal(val.ConsumerPublicKey) - // unrecoverable error - if err != nil { - panic("") - } - var nextPublicKey crypto.PublicKey err = nextPublicKey.Unmarshal(nextVal.ConsumerPublicKey) if err != nil { - panic("...") + // this should never happen and is not recoverable because without the public key + // we cannot generate a validator update + panic(fmt.Errorf("could not unmarshall validator's (%+v) public key: %w", nextVal, err)) } if !currentPublicKey.Equal(nextPublicKey) { @@ -317,12 +180,6 @@ func (k Keeper) diff( updates = append(updates, abci.ValidatorUpdate{PubKey: nextPublicKey, Power: nextVal.Power}) } else { // not found in next validators and hence the validator has to be removed - var currentPublicKey crypto.PublicKey - err := currentPublicKey.Unmarshal(val.ConsumerPublicKey) - if err != nil { - panic("..") - } - updates = append(updates, abci.ValidatorUpdate{PubKey: currentPublicKey, Power: 0}) } } @@ -333,7 +190,9 @@ func (k Keeper) diff( var nextPublicKey crypto.PublicKey err := nextPublicKey.Unmarshal(nextVal.ConsumerPublicKey) if err != nil { - panic("..") + // this should never happen and is not recoverable because without the public key + // we cannot generate a validator update + panic(fmt.Errorf("could not unmarshall validator's (%+v) public key: %w", val, err)) } updates = append(updates, abci.ValidatorUpdate{PubKey: nextPublicKey, Power: nextVal.Power}) @@ -346,9 +205,9 @@ func (k Keeper) diff( // ResetCurrentEpochOptedInValidators resets the opted-in validators with the newest set that was computed by // `ComputeNextValidators` and hence this method should only be called after `ComputeNextValidators` has completed. func (k Keeper) ResetCurrentEpochOptedInValidators(ctx sdk.Context, chainID string, - nextValidators []types.CurrentEpochOptedInValidator) { - k.DeleteAllOptedIn(ctx, chainID) + nextValidators []types.EpochValidator) { + k.DeleteAllEpochValidators(ctx, chainID) for _, val := range nextValidators { - k.SetOptedIn(ctx, chainID, val) + k.SetEpochValidator(ctx, chainID, val) } } diff --git a/x/ccv/provider/types/provider.pb.go b/x/ccv/provider/types/provider.pb.go index da2969c849..5951e2195b 100644 --- a/x/ccv/provider/types/provider.pb.go +++ b/x/ccv/provider/types/provider.pb.go @@ -1385,9 +1385,9 @@ func (m *ConsumerAddrsToPrune) GetConsumerAddrs() *AddressList { return nil } -// CurrentEpochOptedInValidator is used to facilitate epoch-based transitions. It contains relevant info for +// EpochValidator is used to facilitate epoch-based transitions. It contains relevant info for // a validator that is opted in, in the curren epoch, on a consumer chain. -type CurrentEpochOptedInValidator struct { +type EpochValidator struct { // validator's consensus address on the provider chain ProviderConsAddr []byte `protobuf:"bytes,1,opt,name=provider_cons_addr,json=providerConsAddr,proto3" json:"provider_cons_addr,omitempty"` // The block height the provider chain had when the validator initially opted in. If the validator remains opted in @@ -1402,18 +1402,18 @@ type CurrentEpochOptedInValidator struct { ConsumerPublicKey []byte `protobuf:"bytes,4,opt,name=consumer_public_key,json=consumerPublicKey,proto3" json:"consumer_public_key,omitempty"` } -func (m *CurrentEpochOptedInValidator) Reset() { *m = CurrentEpochOptedInValidator{} } -func (m *CurrentEpochOptedInValidator) String() string { return proto.CompactTextString(m) } -func (*CurrentEpochOptedInValidator) ProtoMessage() {} -func (*CurrentEpochOptedInValidator) Descriptor() ([]byte, []int) { +func (m *EpochValidator) Reset() { *m = EpochValidator{} } +func (m *EpochValidator) String() string { return proto.CompactTextString(m) } +func (*EpochValidator) ProtoMessage() {} +func (*EpochValidator) Descriptor() ([]byte, []int) { return fileDescriptor_f22ec409a72b7b72, []int{22} } -func (m *CurrentEpochOptedInValidator) XXX_Unmarshal(b []byte) error { +func (m *EpochValidator) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *CurrentEpochOptedInValidator) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *EpochValidator) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_CurrentEpochOptedInValidator.Marshal(b, m, deterministic) + return xxx_messageInfo_EpochValidator.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -1423,40 +1423,40 @@ func (m *CurrentEpochOptedInValidator) XXX_Marshal(b []byte, deterministic bool) return b[:n], nil } } -func (m *CurrentEpochOptedInValidator) XXX_Merge(src proto.Message) { - xxx_messageInfo_CurrentEpochOptedInValidator.Merge(m, src) +func (m *EpochValidator) XXX_Merge(src proto.Message) { + xxx_messageInfo_EpochValidator.Merge(m, src) } -func (m *CurrentEpochOptedInValidator) XXX_Size() int { +func (m *EpochValidator) XXX_Size() int { return m.Size() } -func (m *CurrentEpochOptedInValidator) XXX_DiscardUnknown() { - xxx_messageInfo_CurrentEpochOptedInValidator.DiscardUnknown(m) +func (m *EpochValidator) XXX_DiscardUnknown() { + xxx_messageInfo_EpochValidator.DiscardUnknown(m) } -var xxx_messageInfo_CurrentEpochOptedInValidator proto.InternalMessageInfo +var xxx_messageInfo_EpochValidator proto.InternalMessageInfo -func (m *CurrentEpochOptedInValidator) GetProviderConsAddr() []byte { +func (m *EpochValidator) GetProviderConsAddr() []byte { if m != nil { return m.ProviderConsAddr } return nil } -func (m *CurrentEpochOptedInValidator) GetStartBlockHeight() int64 { +func (m *EpochValidator) GetStartBlockHeight() int64 { if m != nil { return m.StartBlockHeight } return 0 } -func (m *CurrentEpochOptedInValidator) GetPower() int64 { +func (m *EpochValidator) GetPower() int64 { if m != nil { return m.Power } return 0 } -func (m *CurrentEpochOptedInValidator) GetConsumerPublicKey() []byte { +func (m *EpochValidator) GetConsumerPublicKey() []byte { if m != nil { return m.ConsumerPublicKey } @@ -1486,7 +1486,7 @@ func init() { proto.RegisterType((*ValidatorConsumerPubKey)(nil), "interchain_security.ccv.provider.v1.ValidatorConsumerPubKey") proto.RegisterType((*ValidatorByConsumerAddr)(nil), "interchain_security.ccv.provider.v1.ValidatorByConsumerAddr") proto.RegisterType((*ConsumerAddrsToPrune)(nil), "interchain_security.ccv.provider.v1.ConsumerAddrsToPrune") - proto.RegisterType((*CurrentEpochOptedInValidator)(nil), "interchain_security.ccv.provider.v1.CurrentEpochOptedInValidator") + proto.RegisterType((*EpochValidator)(nil), "interchain_security.ccv.provider.v1.EpochValidator") } func init() { @@ -1494,118 +1494,118 @@ func init() { } var fileDescriptor_f22ec409a72b7b72 = []byte{ - // 1772 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x58, 0xcd, 0x73, 0xdb, 0xc6, - 0x15, 0x17, 0x48, 0x4a, 0x16, 0x1f, 0xf5, 0x41, 0x43, 0x4a, 0x0c, 0xb9, 0x2a, 0x25, 0x23, 0x4d, - 0xaa, 0x4e, 0x1a, 0xb0, 0x52, 0xda, 0x99, 0x8c, 0xa7, 0x99, 0x8c, 0x44, 0x39, 0xb1, 0xac, 0x26, - 0x56, 0x20, 0x55, 0x9e, 0xb6, 0x07, 0xcc, 0x72, 0xb1, 0x26, 0x77, 0x04, 0x62, 0xe1, 0xdd, 0x05, - 0x1c, 0x5e, 0x7a, 0xee, 0x31, 0xbd, 0x65, 0x7a, 0x69, 0xda, 0x7f, 0xa0, 0xe7, 0xde, 0x7a, 0xcc, - 0x31, 0xc7, 0x9e, 0x92, 0x8e, 0x7c, 0xec, 0x3f, 0xd1, 0xd9, 0xc5, 0x27, 0x29, 0xc9, 0xa5, 0xc7, - 0xed, 0x0d, 0x78, 0xfb, 0xde, 0xef, 0x7d, 0xbf, 0xb7, 0x00, 0xec, 0xd1, 0x50, 0x12, 0x8e, 0x87, - 0x88, 0x86, 0x9e, 0x20, 0x38, 0xe6, 0x54, 0x8e, 0xbb, 0x18, 0x27, 0xdd, 0x88, 0xb3, 0x84, 0xfa, - 0x84, 0x77, 0x93, 0xdd, 0xe2, 0xd9, 0x89, 0x38, 0x93, 0xcc, 0x7c, 0xeb, 0x1a, 0x19, 0x07, 0xe3, - 0xc4, 0x29, 0xf8, 0x92, 0xdd, 0xbb, 0x6f, 0xdf, 0x04, 0x9c, 0xec, 0x76, 0x9f, 0x53, 0x4e, 0x52, - 0xac, 0xbb, 0xeb, 0x03, 0x36, 0x60, 0xfa, 0xb1, 0xab, 0x9e, 0x32, 0xea, 0xd6, 0x80, 0xb1, 0x41, - 0x40, 0xba, 0xfa, 0xad, 0x1f, 0x3f, 0xed, 0x4a, 0x3a, 0x22, 0x42, 0xa2, 0x51, 0x94, 0x31, 0x74, - 0xa6, 0x19, 0xfc, 0x98, 0x23, 0x49, 0x59, 0x98, 0x03, 0xd0, 0x3e, 0xee, 0x62, 0xc6, 0x49, 0x17, - 0x07, 0x94, 0x84, 0x52, 0x69, 0x4d, 0x9f, 0x32, 0x86, 0xae, 0x62, 0x08, 0xe8, 0x60, 0x28, 0x53, - 0xb2, 0x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0x15, 0xbe, 0x46, 0x3a, 0xb3, 0x3a, 0xfd, 0xe9, 0x8d, 0xb0, 0xb8, 0x90, 0x16, 0x39, 0x3f, 0x78, - 0xf2, 0xcd, 0x65, 0xc7, 0xf8, 0xf6, 0xb2, 0x63, 0xfc, 0xeb, 0xb2, 0x63, 0x7c, 0xf9, 0xa2, 0x33, - 0xf7, 0xed, 0x8b, 0xce, 0xdc, 0x3f, 0x5f, 0x74, 0xe6, 0x7e, 0xfb, 0xe1, 0x80, 0xca, 0x61, 0xdc, - 0x77, 0x30, 0x1b, 0x75, 0xb3, 0xbf, 0x13, 0x65, 0xb8, 0xde, 0x2b, 0x7e, 0xdd, 0x24, 0x3f, 0xef, - 0x7e, 0x31, 0xf9, 0x63, 0x48, 0x8e, 0x23, 0x22, 0xfa, 0x0b, 0x7a, 0xb0, 0xbd, 0xff, 0x9f, 0x00, - 0x00, 0x00, 0xff, 0xff, 0x98, 0x1e, 0xad, 0xaa, 0x49, 0x12, 0x00, 0x00, + // 1762 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x58, 0x4f, 0x73, 0xdb, 0xc6, + 0x15, 0x17, 0x48, 0x4a, 0x16, 0x1f, 0x25, 0x8a, 0x86, 0x94, 0x18, 0x72, 0x55, 0x4a, 0x41, 0x9a, + 0x54, 0x9d, 0x34, 0x60, 0xa5, 0xb4, 0x33, 0x19, 0x4f, 0x33, 0x19, 0x89, 0x72, 0x62, 0x59, 0x4d, + 0xac, 0x40, 0xaa, 0x3c, 0x6d, 0x0f, 0x98, 0xe5, 0x62, 0x4d, 0xee, 0x08, 0xc4, 0xc2, 0xbb, 0x0b, + 0x38, 0xbc, 0xf4, 0xdc, 0x63, 0x7a, 0xcb, 0xf4, 0xd2, 0xb4, 0x5f, 0xa0, 0x33, 0xbd, 0xf5, 0x1b, + 0xe4, 0x98, 0x63, 0x4f, 0x49, 0xc7, 0x3e, 0xf6, 0x4b, 0x74, 0x76, 0xf1, 0x97, 0x94, 0xe4, 0xd2, + 0x93, 0xf6, 0x06, 0xbc, 0x7d, 0xef, 0xf7, 0xfe, 0xbf, 0xb7, 0x00, 0xec, 0xd3, 0x50, 0x12, 0x8e, + 0x47, 0x88, 0x86, 0x9e, 0x20, 0x38, 0xe6, 0x54, 0x4e, 0x7a, 0x18, 0x27, 0xbd, 0x88, 0xb3, 0x84, + 0xfa, 0x84, 0xf7, 0x92, 0xbd, 0xe2, 0xd9, 0x89, 0x38, 0x93, 0xcc, 0x7c, 0xf3, 0x1a, 0x19, 0x07, + 0xe3, 0xc4, 0x29, 0xf8, 0x92, 0xbd, 0xbb, 0x6f, 0xdd, 0x04, 0x9c, 0xec, 0xf5, 0x9e, 0x51, 0x4e, + 0x52, 0xac, 0xbb, 0x1b, 0x43, 0x36, 0x64, 0xfa, 0xb1, 0xa7, 0x9e, 0x32, 0xea, 0xf6, 0x90, 0xb1, + 0x61, 0x40, 0x7a, 0xfa, 0x6d, 0x10, 0x3f, 0xe9, 0x49, 0x3a, 0x26, 0x42, 0xa2, 0x71, 0x94, 0x31, + 0x74, 0x67, 0x19, 0xfc, 0x98, 0x23, 0x49, 0x59, 0x98, 0x03, 0xd0, 0x01, 0xee, 0x61, 0xc6, 0x49, + 0x0f, 0x07, 0x94, 0x84, 0x52, 0x69, 0x4d, 0x9f, 0x32, 0x86, 0x9e, 0x62, 0x08, 0xe8, 0x70, 0x24, + 0x53, 0xb2, 0xe8, 0x49, 0x12, 0xfa, 0x84, 0x8f, 0x69, 0xca, 0x5c, 0xbe, 0x65, 0x02, 0x5b, 0x95, + 0x73, 0xcc, 0x27, 0x91, 0x64, 0xbd, 0x4b, 0x32, 0x11, 0xd9, 0xe9, 0xdb, 0x98, 0x89, 0x31, 0x13, + 0x3d, 0xa2, 0xfc, 0x0f, 0x31, 0xe9, 0x25, 0x7b, 0x03, 0x22, 0xd1, 0x5e, 0x41, 0xc8, 0xed, 0xce, + 0x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2f, 0xfb, 0x1f, 0x51, 0x06, 0xe8, + 0xdd, 0xe2, 0x67, 0x4d, 0xf2, 0xf3, 0xde, 0xe7, 0xd3, 0xbf, 0x82, 0xe4, 0x24, 0x22, 0x62, 0xb0, + 0xa4, 0x47, 0xd9, 0x7b, 0xff, 0x09, 0x00, 0x00, 0xff, 0xff, 0xf8, 0x25, 0x36, 0x0e, 0x3b, 0x12, + 0x00, 0x00, } func (m *ConsumerAdditionProposal) Marshal() (dAtA []byte, err error) { @@ -2669,7 +2669,7 @@ func (m *ConsumerAddrsToPrune) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *CurrentEpochOptedInValidator) Marshal() (dAtA []byte, err error) { +func (m *EpochValidator) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -2679,12 +2679,12 @@ func (m *CurrentEpochOptedInValidator) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *CurrentEpochOptedInValidator) MarshalTo(dAtA []byte) (int, error) { +func (m *EpochValidator) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *CurrentEpochOptedInValidator) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *EpochValidator) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -3184,7 +3184,7 @@ func (m *ConsumerAddrsToPrune) Size() (n int) { return n } -func (m *CurrentEpochOptedInValidator) Size() (n int) { +func (m *EpochValidator) Size() (n int) { if m == nil { return 0 } @@ -6481,7 +6481,7 @@ func (m *ConsumerAddrsToPrune) Unmarshal(dAtA []byte) error { } return nil } -func (m *CurrentEpochOptedInValidator) Unmarshal(dAtA []byte) error { +func (m *EpochValidator) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -6504,10 +6504,10 @@ func (m *CurrentEpochOptedInValidator) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: CurrentEpochOptedInValidator: wiretype end group for non-group") + return fmt.Errorf("proto: EpochValidator: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: CurrentEpochOptedInValidator: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: EpochValidator: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: From d6cd2074ce9b3f57c094845cf21ce4c2c03a45b8 Mon Sep 17 00:00:00 2001 From: insumity Date: Thu, 22 Feb 2024 15:55:31 +0100 Subject: [PATCH 10/46] first commit --- tests/integration/setup.go | 20 +++ tests/mbt/driver/setup.go | 21 ++- x/ccv/provider/keeper/proposal.go | 5 + x/ccv/provider/keeper/relay.go | 29 ++-- x/ccv/provider/keeper/relay_test.go | 132 +++++++++--------- x/ccv/provider/keeper/validator_set_update.go | 53 +++---- 6 files changed, 156 insertions(+), 104 deletions(-) diff --git a/tests/integration/setup.go b/tests/integration/setup.go index e401324c82..37ab025f89 100644 --- a/tests/integration/setup.go +++ b/tests/integration/setup.go @@ -152,6 +152,26 @@ func (suite *CCVTestSuite) SetupTest() { chainID, ) suite.Require().True(found, "consumer genesis not found") + + //// START + ////valUpdates := consumerGenesisState.Provider.InitialValSet + //var stakingValidators []stakingtypes.Validator + //for _, val := range suite.providerApp.GetTestStakingKeeper().GetLastValidators(suite.providerCtx()) { + // // pubkey to consensus address + // //consAddr, err := ccv.TMCryptoPublicKeyToConsAddr(val.PubKey) + // //if err != nil { + // // continue + // //} + // //v, found := suite.providerApp.GetTestStakingKeeper().GetValidatorByConsAddr(suite.providerCtx(), consAddr) + // //if !found { + // // continue + // //} + // stakingValidators = append(stakingValidators, val) + //} + //nextValidators := providerKeeper.ComputeNextEpochValidators(suite.providerCtx(), chainID, []types.EpochValidator{}, stakingValidators) + //providerKeeper.ResetCurrentEpochValidators(suite.providerCtx(), chainID, nextValidators) + ///// END + genesisState := consumertypes.GenesisState{ Params: consumerGenesisState.Params, Provider: consumerGenesisState.Provider, diff --git a/tests/mbt/driver/setup.go b/tests/mbt/driver/setup.go index 83fa6e0669..df3980673f 100644 --- a/tests/mbt/driver/setup.go +++ b/tests/mbt/driver/setup.go @@ -2,6 +2,7 @@ package main import ( "encoding/json" + "github.com/cosmos/interchain-security/v4/x/ccv/provider/types" "log" "testing" "time" @@ -347,7 +348,6 @@ func (s *Driver) ConfigureNewPath(consumerChain, providerChain *ibctesting.TestC ) consumerGenesis := createConsumerGenesis(params, providerChain, consumerClientState) - s.consumerKeeper(consumerChainId).InitGenesis(s.ctx(consumerChainId), consumerGenesis) consumerGenesisForProvider := ccvtypes.ConsumerGenesisState{ @@ -356,6 +356,25 @@ func (s *Driver) ConfigureNewPath(consumerChain, providerChain *ibctesting.TestC NewChain: consumerGenesis.NewChain, } + var stakingValidators []stakingtypes.Validator + + for _, val := range consumerGenesisForProvider.Provider.InitialValSet { + pubKey := val.PubKey + consAddr, err := ccvtypes.TMCryptoPublicKeyToConsAddr(pubKey) + if err != nil { + continue + } + + v, found := s.providerStakingKeeper().GetValidatorByConsAddr(s.providerCtx(), consAddr) + if !found { + continue + } + stakingValidators = append(stakingValidators, v) + } + + nextValidators := s.providerKeeper().ComputeNextEpochValidators(s.providerCtx(), string(consumerChainId), []types.EpochValidator{}, stakingValidators) + s.providerKeeper().ResetCurrentEpochValidators(s.providerCtx(), string(consumerChainId), nextValidators) + err = s.providerKeeper().SetConsumerGenesis( providerChain.GetContext(), string(consumerChainId), diff --git a/x/ccv/provider/keeper/proposal.go b/x/ccv/provider/keeper/proposal.go index 89d71ff344..d9a48dd812 100644 --- a/x/ccv/provider/keeper/proposal.go +++ b/x/ccv/provider/keeper/proposal.go @@ -253,6 +253,7 @@ func (k Keeper) MakeConsumerGenesis( return false }) + var stakingValidators []stakingtypes.Validator initialUpdates := []abci.ValidatorUpdate{} for _, p := range lastPowers { addr, err := sdk.ValAddressFromBech32(p.Address) @@ -264,6 +265,7 @@ func (k Keeper) MakeConsumerGenesis( if !found { return gen, nil, errorsmod.Wrapf(stakingtypes.ErrNoValidatorFound, "error getting validator from LastValidatorPowers: %s", err) } + stakingValidators = append(stakingValidators, val) tmProtoPk, err := val.TmConsPublicKey() if err != nil { @@ -276,6 +278,9 @@ func (k Keeper) MakeConsumerGenesis( }) } + nextValidators := k.ComputeNextEpochValidators(ctx, chainID, []types.EpochValidator{}, stakingValidators) + k.ResetCurrentEpochValidators(ctx, chainID, nextValidators) + // Apply key assignments to the initial valset. initialUpdatesWithConsumerKeys := k.MustApplyKeyAssignmentToValUpdates(ctx, chainID, initialUpdates) diff --git a/x/ccv/provider/keeper/relay.go b/x/ccv/provider/keeper/relay.go index dc515887df..23947b6cf4 100644 --- a/x/ccv/provider/keeper/relay.go +++ b/x/ccv/provider/keeper/relay.go @@ -148,15 +148,15 @@ func (k Keeper) EndBlockVSU(ctx sdk.Context) { // notify the staking module to complete all matured unbonding ops k.completeMaturedUnbondingOps(ctx) - if ctx.BlockHeight()%BlocksPerEpoch == 0 { - // collect validator updates - k.QueueVSCPackets(ctx) - - // try sending VSC packets to all registered consumer chains; - // if the CCV channel is not established for a consumer chain, - // the updates will remain queued until the channel is established - k.SendVSCPackets(ctx) - } + //if ctx.BlockHeight()%BlocksPerEpoch == 0 { + // collect validator updates + k.QueueVSCPackets(ctx) + + // try sending VSC packets to all registered consumer chains; + // if the CCV channel is not established for a consumer chain, + // the updates will remain queued until the channel is established + k.SendVSCPackets(ctx) + //} } // SendVSCPackets iterates over all registered consumers and sends pending @@ -218,14 +218,21 @@ func (k Keeper) QueueVSCPackets(ctx sdk.Context) { // Note: GetValidatorUpdates panics if the updates provided by the x/staking module // of cosmos-sdk is invalid. stakingValUpdates := k.stakingKeeper.GetValidatorUpdates(ctx) + bondedValidators := k.stakingKeeper.GetLastValidators(ctx) for _, chain := range k.GetAllConsumerChains(ctx) { currentEpochValidators := k.GetAllEpochValidators(ctx, chain.ChainId) - nextEpochValidators := k.ComputeNextEpochValidators(ctx, chain.ChainId, currentEpochValidators) + nextEpochValidators := k.ComputeNextEpochValidators(ctx, chain.ChainId, currentEpochValidators, bondedValidators) valUpdates := k.diff(currentEpochValidators, nextEpochValidators) + fmt.Println(valUpdates) + k.ResetCurrentEpochValidators(ctx, chain.ChainId, nextEpochValidators) // Apply the key assignment to the validator updates. - valUpdates := k.MustApplyKeyAssignmentToValUpdates(ctx, chain.ChainId, stakingValUpdates) + valUpdatesFoo := k.MustApplyKeyAssignmentToValUpdates(ctx, chain.ChainId, stakingValUpdates) + + if len(valUpdates) != len(valUpdatesFoo) { + fmt.Println("WHAT's HAPPENING???") + } // check whether there are changes in the validator set; // note that this also entails unbonding operations diff --git a/x/ccv/provider/keeper/relay_test.go b/x/ccv/provider/keeper/relay_test.go index 1f3977f5e6..e2b6c13c2e 100644 --- a/x/ccv/provider/keeper/relay_test.go +++ b/x/ccv/provider/keeper/relay_test.go @@ -6,13 +6,11 @@ import ( clienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types" channeltypes "github.com/cosmos/ibc-go/v7/modules/core/04-channel/types" - ibctesting "github.com/cosmos/ibc-go/v7/testing" "github.com/golang/mock/gomock" "github.com/stretchr/testify/require" "cosmossdk.io/math" - cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" sdk "github.com/cosmos/cosmos-sdk/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" @@ -26,71 +24,71 @@ import ( ) // TestQueueVSCPackets tests queueing validator set updates. -func TestQueueVSCPackets(t *testing.T) { - _, _, key := ibctesting.GenerateKeys(t, 1) - tmPubKey, _ := cryptocodec.ToTmProtoPublicKey(key) - - testCases := []struct { - name string - packets []ccv.ValidatorSetChangePacketData - expectNextValsetUpdateId uint64 - expectedQueueSize int - }{ - { - name: "no updates to send", - packets: []ccv.ValidatorSetChangePacketData{}, - expectNextValsetUpdateId: 1, - expectedQueueSize: 0, - }, - { - name: "have updates to send", - packets: []ccv.ValidatorSetChangePacketData{ - { - ValidatorUpdates: []abci.ValidatorUpdate{ - {PubKey: tmPubKey, Power: 1}, - }, - ValsetUpdateId: 1, - }, - }, - expectNextValsetUpdateId: 1, - expectedQueueSize: 1, - }, - } - - chainID := "consumer" - - for _, tc := range testCases { - keeperParams := testkeeper.NewInMemKeeperParams(t) - ctx := keeperParams.Ctx - - ctrl := gomock.NewController(t) - defer ctrl.Finish() - mocks := testkeeper.NewMockedKeepers(ctrl) - //mockStakingKeeper := mocks.MockStakingKeeper - - //mockUpdates := []abci.ValidatorUpdate{} - //if len(tc.packets) != 0 { - // mockUpdates = tc.packets[0].ValidatorUpdates - //} - - //gomock.InOrder( - // mockStakingKeeper.EXPECT().GetValidatorUpdates(gomock.Eq(ctx)).Return(mockUpdates), - //) - - pk := testkeeper.NewInMemProviderKeeper(keeperParams, mocks) - // no-op if tc.packets is empty - pk.AppendPendingVSCPackets(ctx, chainID, tc.packets...) - - pk.QueueVSCPackets(ctx) - pending := pk.GetPendingVSCPackets(ctx, chainID) - require.Len(t, pending, tc.expectedQueueSize, "pending vsc queue mismatch (%v != %v) in case: '%s'", tc.expectedQueueSize, len(pending), tc.name) - - // next valset update ID -> default value in tests is 0 - // each call to QueueValidatorUpdates will increment the ValidatorUpdateID - valUpdateID := pk.GetValidatorSetUpdateId(ctx) - require.Equal(t, tc.expectNextValsetUpdateId, valUpdateID, "valUpdateID (%v != %v) mismatch in case: '%s'", tc.expectNextValsetUpdateId, valUpdateID, tc.name) - } -} +//func TestQueueVSCPackets(t *testing.T) { +// _, _, key := ibctesting.GenerateKeys(t, 1) +// tmPubKey, _ := cryptocodec.ToTmProtoPublicKey(key) +// +// testCases := []struct { +// name string +// packets []ccv.ValidatorSetChangePacketData +// expectNextValsetUpdateId uint64 +// expectedQueueSize int +// }{ +// { +// name: "no updates to send", +// packets: []ccv.ValidatorSetChangePacketData{}, +// expectNextValsetUpdateId: 1, +// expectedQueueSize: 0, +// }, +// { +// name: "have updates to send", +// packets: []ccv.ValidatorSetChangePacketData{ +// { +// ValidatorUpdates: []abci.ValidatorUpdate{ +// {PubKey: tmPubKey, Power: 1}, +// }, +// ValsetUpdateId: 1, +// }, +// }, +// expectNextValsetUpdateId: 1, +// expectedQueueSize: 1, +// }, +// } +// +// chainID := "consumer" +// +// for _, tc := range testCases { +// keeperParams := testkeeper.NewInMemKeeperParams(t) +// ctx := keeperParams.Ctx +// +// ctrl := gomock.NewController(t) +// defer ctrl.Finish() +// mocks := testkeeper.NewMockedKeepers(ctrl) +// //mockStakingKeeper := mocks.MockStakingKeeper +// +// //mockUpdates := []abci.ValidatorUpdate{} +// //if len(tc.packets) != 0 { +// // mockUpdates = tc.packets[0].ValidatorUpdates +// //} +// +// //gomock.InOrder( +// // mockStakingKeeper.EXPECT().GetValidatorUpdates(gomock.Eq(ctx)).Return(mockUpdates), +// //) +// +// pk := testkeeper.NewInMemProviderKeeper(keeperParams, mocks) +// // no-op if tc.packets is empty +// pk.AppendPendingVSCPackets(ctx, chainID, tc.packets...) +// +// pk.QueueVSCPackets(ctx) +// pending := pk.GetPendingVSCPackets(ctx, chainID) +// require.Len(t, pending, tc.expectedQueueSize, "pending vsc queue mismatch (%v != %v) in case: '%s'", tc.expectedQueueSize, len(pending), tc.name) +// +// // next valset update ID -> default value in tests is 0 +// // each call to QueueValidatorUpdates will increment the ValidatorUpdateID +// valUpdateID := pk.GetValidatorSetUpdateId(ctx) +// require.Equal(t, tc.expectNextValsetUpdateId, valUpdateID, "valUpdateID (%v != %v) mismatch in case: '%s'", tc.expectNextValsetUpdateId, valUpdateID, tc.name) +// } +//} // TestOnRecvVSCMaturedPacket tests the OnRecvVSCMaturedPacket method of the keeper. // diff --git a/x/ccv/provider/keeper/validator_set_update.go b/x/ccv/provider/keeper/validator_set_update.go index 19a44a6111..a56c490d1f 100644 --- a/x/ccv/provider/keeper/validator_set_update.go +++ b/x/ccv/provider/keeper/validator_set_update.go @@ -5,6 +5,7 @@ import ( abci "github.com/cometbft/cometbft/abci/types" "github.com/cometbft/cometbft/proto/tendermint/crypto" sdk "github.com/cosmos/cosmos-sdk/types" + types2 "github.com/cosmos/cosmos-sdk/x/staking/types" "github.com/cosmos/interchain-security/v4/x/ccv/provider/types" ) @@ -91,35 +92,29 @@ func (k Keeper) ComputeNextEpochValidators( ctx sdk.Context, chainID string, currentValidators []types.EpochValidator, + stakingValidators []types2.Validator, ) []types.EpochValidator { - var nextValidators []types.EpochValidator + isCurrentValidator := make(map[string]types.EpochValidator) for _, val := range currentValidators { // `currentPublicKey` is the currently used key by validator `val` when validating on the consumer chain - var currentPublicKey crypto.PublicKey - err := currentPublicKey.Unmarshal(val.ConsumerPublicKey) + isCurrentValidator[string(val.ProviderConsAddr)] = val + } + + var nextValidators []types.EpochValidator + for _, val := range stakingValidators { + // get next voting power and the next consumer public key + nextPower := k.stakingKeeper.GetLastValidatorPower(ctx, val.GetOperator()) + consAddr, err := val.GetConsAddr() if err != nil { // this should never happen but is recoverable if we exclude this validator from the `nextValidators` - k.Logger(ctx).Error("validator's (%+v) public key could not be unmarshalled: %w", val, err) + k.Logger(ctx).Error("could not get consensus address of validator (%+v): %w", val, err) continue } - - validator, found := k.stakingKeeper.GetValidatorByConsAddr(ctx, val.ProviderConsAddr) - if !found { - // This should never happen because when `val` was added as an epoch validator it was bonded - // and for it not to be found it means that it fully unbonded after an unbonding period. Assuming - // an epoch is smaller than the unbonding period, we would have already removed this validator from - // being an epoch validator. In any case, we can still recover by excluding this validator - // from `nextValidators`. - k.Logger(ctx).Error("validator (%+v) could not be found: %w", val, err) - continue - } - - // get next voting power and the next consumer public key - nextPower := k.stakingKeeper.GetLastValidatorPower(ctx, validator.GetOperator()) - nextConsumerPublicKey, found := k.GetValidatorConsumerPubKey(ctx, chainID, types.NewProviderConsAddress(val.ProviderConsAddr)) + nextConsumerPublicKey, found := k.GetValidatorConsumerPubKey(ctx, chainID, types.NewProviderConsAddress(consAddr)) if !found { k.Logger(ctx).Error("could not retrieve public key for validator (%+v)", val) - continue + // if no consumer key assigned then use the validator's key itself + nextConsumerPublicKey, err = val.TmConsPublicKey() } nextConsumerPublicKeyBytes, err := nextConsumerPublicKey.Marshal() if err != nil { @@ -128,9 +123,15 @@ func (k Keeper) ComputeNextEpochValidators( continue } + startBlockHeight := ctx.BlockHeight() + if v, found2 := isCurrentValidator[string(consAddr)]; found2 { + // remain sstable + startBlockHeight = v.GetStartBlockHeight() + } + nextValidator := types.EpochValidator{ - ProviderConsAddr: val.ProviderConsAddr, - StartBlockHeight: val.StartBlockHeight, // remains stable + ProviderConsAddr: consAddr, + StartBlockHeight: startBlockHeight, Power: nextPower, ConsumerPublicKey: nextConsumerPublicKeyBytes, } @@ -176,8 +177,10 @@ func (k Keeper) diff( if !currentPublicKey.Equal(nextPublicKey) { updates = append(updates, abci.ValidatorUpdate{PubKey: currentPublicKey, Power: 0}) + updates = append(updates, abci.ValidatorUpdate{PubKey: nextPublicKey, Power: nextVal.Power}) + } else if val.Power != nextVal.Power { + updates = append(updates, abci.ValidatorUpdate{PubKey: nextPublicKey, Power: nextVal.Power}) } - updates = append(updates, abci.ValidatorUpdate{PubKey: nextPublicKey, Power: nextVal.Power}) } else { // not found in next validators and hence the validator has to be removed updates = append(updates, abci.ValidatorUpdate{PubKey: currentPublicKey, Power: 0}) @@ -202,9 +205,9 @@ func (k Keeper) diff( return updates } -// ResetCurrentEpochOptedInValidators resets the opted-in validators with the newest set that was computed by +// ResetCurrentEpochValidators resets the opted-in validators with the newest set that was computed by // `ComputeNextValidators` and hence this method should only be called after `ComputeNextValidators` has completed. -func (k Keeper) ResetCurrentEpochOptedInValidators(ctx sdk.Context, chainID string, +func (k Keeper) ResetCurrentEpochValidators(ctx sdk.Context, chainID string, nextValidators []types.EpochValidator) { k.DeleteAllEpochValidators(ctx, chainID) for _, val := range nextValidators { From d144c39bb31d37450a33a12a8ac4551c6107c0fe Mon Sep 17 00:00:00 2001 From: insumity Date: Fri, 23 Feb 2024 10:51:46 +0100 Subject: [PATCH 11/46] add param and fix tests --- .../ccv/provider/v1/provider.proto | 3 + tests/e2e/actions.go | 11 +- tests/e2e/config.go | 21 +- tests/integration/common.go | 8 + tests/integration/distribution.go | 6 +- tests/integration/expired_client.go | 15 +- tests/integration/key_assignment.go | 28 +- tests/integration/setup.go | 25 +- tests/integration/slashing.go | 4 + tests/integration/soft_opt_out.go | 7 +- tests/integration/unbonding.go | 7 +- tests/integration/valset_update.go | 3 +- tests/mbt/driver/mbt_test.go | 15 +- x/ccv/provider/keeper/params.go | 8 + x/ccv/provider/keeper/params_test.go | 1 + x/ccv/provider/keeper/relay.go | 33 ++- x/ccv/provider/keeper/validator_set_update.go | 4 +- x/ccv/provider/types/genesis_test.go | 26 +- x/ccv/provider/types/params.go | 11 + x/ccv/provider/types/params_test.go | 24 +- x/ccv/provider/types/provider.pb.go | 270 ++++++++++-------- x/ccv/types/shared_params.go | 4 + 22 files changed, 320 insertions(+), 214 deletions(-) diff --git a/proto/interchain_security/ccv/provider/v1/provider.proto b/proto/interchain_security/ccv/provider/v1/provider.proto index 6e53c0c428..b1a75003f9 100644 --- a/proto/interchain_security/ccv/provider/v1/provider.proto +++ b/proto/interchain_security/ccv/provider/v1/provider.proto @@ -188,6 +188,9 @@ message Params { // The fee required to be paid to add a reward denom cosmos.base.v1beta1.Coin consumer_reward_denom_registration_fee = 9 [ (gogoproto.nullable) = false ]; + + // The number of blocks that comprise an epoch. + uint64 blocks_per_epoch = 10; } // SlashAcks contains cons addresses of consumer chain validators diff --git a/tests/e2e/actions.go b/tests/e2e/actions.go index 81bc3c8b76..73eabc3033 100644 --- a/tests/e2e/actions.go +++ b/tests/e2e/actions.go @@ -1307,6 +1307,8 @@ func (tr TestConfig) relayPacketsGorelayer( target ExecutionTarget, verbose bool, ) { + //tr.waitBlocks(action.ChainA, 10, 60*time.Second) + pathName := tr.GetPathNameForGorelayer(action.ChainA, action.ChainB) // rly transact relay-packets [path-name] --channel [channel-id] @@ -1321,7 +1323,7 @@ func (tr TestConfig) relayPacketsGorelayer( if err != nil { log.Fatal(err, "\n", string(bz)) } - + //tr.waitBlocks(action.ChainA, 10, 60*time.Second) tr.waitBlocks(action.ChainA, 1, 30*time.Second) tr.waitBlocks(action.ChainB, 1, 30*time.Second) } @@ -1331,6 +1333,9 @@ func (tr TestConfig) relayPacketsHermes( target ExecutionTarget, verbose bool, ) { + // FIXME: ... can we retrieve the blocksperepoch ... + //tr.waitBlocks(action.ChainA, 10, 60*time.Second) + // hermes clear packets ibc0 transfer channel-13 cmd := target.ExecCommand("hermes", "clear", "packets", "--chain", string(tr.chainConfigs[action.ChainA].ChainId), @@ -1346,6 +1351,7 @@ func (tr TestConfig) relayPacketsHermes( log.Fatal(err, "\n", string(bz)) } + //tr.waitBlocks(action.ChainA, 10, 60*time.Second) tr.waitBlocks(action.ChainA, 1, 30*time.Second) tr.waitBlocks(action.ChainB, 1, 30*time.Second) } @@ -1420,6 +1426,7 @@ func (tr TestConfig) delegateTokens( } // wait for inclusion in a block -> '--broadcast-mode block' is deprecated + tr.waitBlocks(action.Chain, 10, 60*time.Second) tr.waitBlocks(action.Chain, 2, 10*time.Second) } @@ -1472,6 +1479,7 @@ func (tr TestConfig) unbondTokens( } // wait for inclusion in a block -> '--broadcast-mode block' is deprecated + tr.waitBlocks(action.Chain, 10, 60*time.Second) tr.waitBlocks(action.Chain, 2, 20*time.Second) } @@ -1613,6 +1621,7 @@ func (tr TestConfig) redelegateTokens(action RedelegateTokensAction, target Exec } // wait for inclusion in a block -> '--broadcast-mode block' is deprecated + tr.waitBlocks(action.Chain, 10, 60*time.Second) tr.waitBlocks(action.Chain, 2, 10*time.Second) } diff --git a/tests/e2e/config.go b/tests/e2e/config.go index 307f61d62c..50398a703b 100644 --- a/tests/e2e/config.go +++ b/tests/e2e/config.go @@ -240,7 +240,8 @@ func SlashThrottleTestConfig() TestConfig { ".app_state.slashing.params.downtime_jail_duration = \"60s\" | " + ".app_state.slashing.params.slash_fraction_downtime = \"0.010000000000000000\" | " + ".app_state.provider.params.slash_meter_replenish_fraction = \"0.10\" | " + - ".app_state.provider.params.slash_meter_replenish_period = \"20s\"", + ".app_state.provider.params.slash_meter_replenish_period = \"20s\" | " + + ".app_state.provider.params.blocks_per_epoch = 10", }, ChainID("consu"): { ChainId: ChainID("consu"), @@ -288,7 +289,8 @@ func DefaultTestConfig() TestConfig { ".app_state.slashing.params.downtime_jail_duration = \"60s\" | " + ".app_state.slashing.params.slash_fraction_downtime = \"0.010000000000000000\" | " + ".app_state.provider.params.slash_meter_replenish_fraction = \"1.0\" | " + // This disables slash packet throttling - ".app_state.provider.params.slash_meter_replenish_period = \"3s\"", + ".app_state.provider.params.slash_meter_replenish_period = \"3s\" | " + + ".app_state.provider.params.blocks_per_epoch = 10", }, ChainID("consu"): { ChainId: ChainID("consu"), @@ -317,7 +319,8 @@ func DemocracyTestConfig(allowReward bool) TestConfig { ".app_state.slashing.params.min_signed_per_window = \"0.500000000000000000\" | " + ".app_state.slashing.params.downtime_jail_duration = \"60s\" | " + ".app_state.slashing.params.slash_fraction_downtime = \"0.010000000000000000\" | " + - ".app_state.transfer.params.send_enabled = false" + ".app_state.transfer.params.send_enabled = false | " + + ".app_state.provider.params.blocks_per_epoch = 10" if allowReward { // This allows the consumer chain to send rewards in the stake denom @@ -347,7 +350,8 @@ func DemocracyTestConfig(allowReward bool) TestConfig { ".app_state.slashing.params.min_signed_per_window = \"0.500000000000000000\" | " + ".app_state.slashing.params.downtime_jail_duration = \"60s\" | " + ".app_state.slashing.params.slash_fraction_downtime = \"0.010000000000000000\" | " + - ".app_state.provider.params.slash_meter_replenish_fraction = \"1.0\"", // This disables slash packet throttling + ".app_state.provider.params.slash_meter_replenish_fraction = \"1.0\" | " + // This disables slash packet throttling + ".app_state.provider.params.blocks_per_epoch = 10", }, ChainID("democ"): { ChainId: ChainID("democ"), @@ -389,7 +393,8 @@ func MultiConsumerTestConfig() TestConfig { ".app_state.slashing.params.min_signed_per_window = \"0.500000000000000000\" | " + ".app_state.slashing.params.downtime_jail_duration = \"60s\" | " + ".app_state.slashing.params.slash_fraction_downtime = \"0.010000000000000000\" | " + - ".app_state.provider.params.slash_meter_replenish_fraction = \"1.0\"", // This disables slash packet throttling + ".app_state.provider.params.slash_meter_replenish_fraction = \"1.0\" | " + // This disables slash packet throttling + ".app_state.provider.params.blocks_per_epoch = 10", }, ChainID("consu"): { ChainId: ChainID("consu"), @@ -448,7 +453,8 @@ func ChangeoverTestConfig() TestConfig { ".app_state.slashing.params.downtime_jail_duration = \"60s\" | " + ".app_state.slashing.params.slash_fraction_downtime = \"0.010000000000000000\" | " + ".app_state.provider.params.slash_meter_replenish_fraction = \"1.0\" | " + // This disables slash packet throttling - ".app_state.provider.params.slash_meter_replenish_period = \"3s\"", + ".app_state.provider.params.slash_meter_replenish_period = \"3s\" | " + + ".app_state.provider.params.blocks_per_epoch = 10", }, ChainID("sover"): { ChainId: ChainID("sover"), @@ -548,7 +554,8 @@ func ConsumerMisbehaviourTestConfig() TestConfig { ".app_state.slashing.params.downtime_jail_duration = \"60s\" | " + ".app_state.slashing.params.slash_fraction_downtime = \"0.010000000000000000\" | " + ".app_state.provider.params.slash_meter_replenish_fraction = \"1.0\" | " + // This disables slash packet throttling - ".app_state.provider.params.slash_meter_replenish_period = \"3s\"", + ".app_state.provider.params.slash_meter_replenish_period = \"3s\" | " + + ".app_state.provider.params.blocks_per_epoch = 10", }, ChainID("consu"): { ChainId: ChainID("consu"), diff --git a/tests/integration/common.go b/tests/integration/common.go index a4ff9e254a..0c06a567ad 100644 --- a/tests/integration/common.go +++ b/tests/integration/common.go @@ -2,6 +2,7 @@ package integration import ( "fmt" + "github.com/cosmos/interchain-security/v4/x/ccv/provider/keeper" "time" clienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types" @@ -128,6 +129,7 @@ func delegateAndRedelegate(s *CCVTestSuite, delAddr sdk.AccAddress, s.Require().Equal(srcValTokensAfter.Sub(srcValTokensBefore), amount) s.providerChain.NextBlock() + nextBlocks(s.providerChain, keeper.BlocksPerEpoch) dstValTokensBefore := s.getVal(s.providerCtx(), dstValAddr).GetBondedTokens() @@ -625,3 +627,9 @@ func (s *CCVTestSuite) mustGetStakingValFromTmVal(tmVal tmtypes.Validator) (stak s.Require().True(found) return stakingVal } + +func nextBlocks(chain *ibctesting.TestChain, numberOfBlocks uint32) { + for i := uint32(0); i < numberOfBlocks; i++ { + chain.NextBlock() + } +} diff --git a/tests/integration/distribution.go b/tests/integration/distribution.go index 25cbcb3132..72fb0329f2 100644 --- a/tests/integration/distribution.go +++ b/tests/integration/distribution.go @@ -1,6 +1,7 @@ package integration import ( + "github.com/cosmos/interchain-security/v4/x/ccv/provider/keeper" "strings" transfertypes "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types" @@ -23,7 +24,7 @@ func (s *CCVTestSuite) TestRewardsDistribution() { bondAmt := sdk.NewInt(10000000) delAddr := s.providerChain.SenderAccount.GetAddress() delegate(s, delAddr, bondAmt) - s.providerChain.NextBlock() + nextBlocks(s.providerChain, keeper.BlocksPerEpoch) // register a consumer reward denom params := s.consumerApp.GetConsumerKeeper().GetConsumerParams(s.consumerCtx()) @@ -124,7 +125,7 @@ func (s *CCVTestSuite) TestSendRewardsRetries() { bondAmt := sdk.NewInt(10000000) delAddr := s.providerChain.SenderAccount.GetAddress() delegate(s, delAddr, bondAmt) - s.providerChain.NextBlock() + nextBlocks(s.providerChain, keeper.BlocksPerEpoch) // Register denom on consumer chain params := s.consumerApp.GetConsumerKeeper().GetConsumerParams(s.consumerCtx()) @@ -253,6 +254,7 @@ func (s *CCVTestSuite) TestEndBlockRD() { bondAmt := sdk.NewInt(10000000) delAddr := s.providerChain.SenderAccount.GetAddress() delegate(s, delAddr, bondAmt) + nextBlocks(s.providerChain, keeper.BlocksPerEpoch) s.providerChain.NextBlock() if tc.denomRegistered { diff --git a/tests/integration/expired_client.go b/tests/integration/expired_client.go index 1981e85828..07acc30068 100644 --- a/tests/integration/expired_client.go +++ b/tests/integration/expired_client.go @@ -1,6 +1,7 @@ package integration import ( + "github.com/cosmos/interchain-security/v4/x/ccv/provider/keeper" "time" clienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types" @@ -33,7 +34,7 @@ func (s *CCVTestSuite) TestVSCPacketSendExpiredClient() { delegate(s, delAddr, bondAmt) // try to send CCV packet to consumer - s.providerChain.NextBlock() + nextBlocks(s.providerChain, keeper.BlocksPerEpoch) // check that the packet was added to the list of pending VSC packets packets := providerKeeper.GetPendingVSCPackets(s.providerCtx(), s.consumerChain.ChainID) @@ -41,7 +42,7 @@ func (s *CCVTestSuite) TestVSCPacketSendExpiredClient() { s.Require().Equal(1, len(packets), "unexpected number of pending VSC packets") // try again to send CCV packet to consumer - s.providerChain.NextBlock() + nextBlocks(s.providerChain, keeper.BlocksPerEpoch) // check that the packet is still in the list of pending VSC packets packets = providerKeeper.GetPendingVSCPackets(s.providerCtx(), s.consumerChain.ChainID) @@ -52,7 +53,7 @@ func (s *CCVTestSuite) TestVSCPacketSendExpiredClient() { delegate(s, delAddr, bondAmt) // try again to send CCV packets to consumer - s.providerChain.NextBlock() + nextBlocks(s.providerChain, keeper.BlocksPerEpoch) // check that the packets are still in the list of pending VSC packets packets = providerKeeper.GetPendingVSCPackets(s.providerCtx(), s.consumerChain.ChainID) @@ -63,7 +64,7 @@ func (s *CCVTestSuite) TestVSCPacketSendExpiredClient() { upgradeExpiredClient(s, Consumer) // go to next block - s.providerChain.NextBlock() + nextBlocks(s.providerChain, keeper.BlocksPerEpoch) // check that the packets are not in the list of pending VSC packets packets = providerKeeper.GetPendingVSCPackets(s.providerCtx(), s.consumerChain.ChainID) @@ -73,7 +74,7 @@ func (s *CCVTestSuite) TestVSCPacketSendExpiredClient() { // - bond more tokens on provider to change validator powers delegate(s, delAddr, bondAmt) // - send CCV packet to consumer - s.providerChain.NextBlock() + nextBlocks(s.providerChain, keeper.BlocksPerEpoch) // - relay all VSC packet from provider to consumer relayAllCommittedPackets(s, s.providerChain, s.path, ccv.ProviderPortID, s.path.EndpointB.ChannelID, 3) // - increment time so that the unbonding period ends on the consumer @@ -102,7 +103,7 @@ func (s *CCVTestSuite) TestConsumerPacketSendExpiredClient() { delegate(s, delAddr, bondAmt) // send CCV packets to consumer - s.providerChain.NextBlock() + nextBlocks(s.providerChain, keeper.BlocksPerEpoch) // check that the packets are not in the list of pending VSC packets providerPackets := providerKeeper.GetPendingVSCPackets(s.providerCtx(), s.consumerChain.ChainID) @@ -172,7 +173,7 @@ func (s *CCVTestSuite) TestConsumerPacketSendExpiredClient() { // - bond more tokens on provider to change validator powers delegate(s, delAddr, bondAmt) // - send CCV packet to consumer - s.providerChain.NextBlock() + nextBlocks(s.providerChain, keeper.BlocksPerEpoch) // - relay 1 VSC packet from provider to consumer relayAllCommittedPackets(s, s.providerChain, s.path, ccv.ProviderPortID, s.path.EndpointB.ChannelID, 1) // - increment time so that the unbonding period ends on the provider diff --git a/tests/integration/key_assignment.go b/tests/integration/key_assignment.go index 20e746ae63..23516056db 100644 --- a/tests/integration/key_assignment.go +++ b/tests/integration/key_assignment.go @@ -30,7 +30,8 @@ func (s *CCVTestSuite) TestKeyAssignment() { } // check that a VSCPacket is queued - s.providerChain.NextBlock() + nextBlocks(s.providerChain, providerkeeper.BlocksPerEpoch) + //s.providerChain.NextBlock() pendingPackets := pk.GetPendingVSCPackets(s.providerCtx(), s.consumerChain.ChainID) s.Require().Len(pendingPackets, 1) @@ -51,7 +52,9 @@ func (s *CCVTestSuite) TestKeyAssignment() { if err != nil { return err } - s.providerChain.NextBlock() + nextBlocks(s.providerChain, providerkeeper.BlocksPerEpoch) + // + //s.providerChain.NextBlock() return nil }, false, 2, @@ -73,7 +76,8 @@ func (s *CCVTestSuite) TestKeyAssignment() { delAddr := s.providerChain.SenderAccount.GetAddress() delegate(s, delAddr, bondAmt) - s.providerChain.NextBlock() + //s.providerChain.NextBlock() + nextBlocks(s.providerChain, providerkeeper.BlocksPerEpoch) return nil }, false, 2, @@ -95,7 +99,8 @@ func (s *CCVTestSuite) TestKeyAssignment() { if err != nil { return err } - s.providerChain.NextBlock() + //s.providerChain.NextBlock() + nextBlocks(s.providerChain, providerkeeper.BlocksPerEpoch) return nil }, true, 2, @@ -118,7 +123,8 @@ func (s *CCVTestSuite) TestKeyAssignment() { if err != nil { return err } - s.providerChain.NextBlock() + //s.providerChain.NextBlock() + nextBlocks(s.providerChain, providerkeeper.BlocksPerEpoch) return nil }, false, 2, @@ -134,14 +140,16 @@ func (s *CCVTestSuite) TestKeyAssignment() { if err != nil { return err } - s.providerChain.NextBlock() + nextBlocks(s.providerChain, providerkeeper.BlocksPerEpoch) + //s.providerChain.NextBlock() // same key assignment err = pk.AssignConsumerKey(s.providerCtx(), s.consumerChain.ChainID, validator, consumerKey) if err != nil { return err } - s.providerChain.NextBlock() + //s.providerChain.NextBlock() + nextBlocks(s.providerChain, providerkeeper.BlocksPerEpoch) return nil }, true, 2, @@ -157,7 +165,8 @@ func (s *CCVTestSuite) TestKeyAssignment() { if err != nil { return err } - s.providerChain.NextBlock() + //s.providerChain.NextBlock() + nextBlocks(s.providerChain, providerkeeper.BlocksPerEpoch) // same key assignment validator, consumerKey = generateNewConsumerKey(s, 0) @@ -165,7 +174,8 @@ func (s *CCVTestSuite) TestKeyAssignment() { if err != nil { return err } - s.providerChain.NextBlock() + //s.providerChain.NextBlock() + nextBlocks(s.providerChain, providerkeeper.BlocksPerEpoch) return nil }, false, 3, diff --git a/tests/integration/setup.go b/tests/integration/setup.go index 37ab025f89..cb45529471 100644 --- a/tests/integration/setup.go +++ b/tests/integration/setup.go @@ -129,6 +129,12 @@ func (suite *CCVTestSuite) SetupTest() { suite.registerPacketSniffer(suite.providerChain) providerKeeper := suite.providerApp.GetProviderKeeper() + //FIXME + params := providerKeeper.GetParams(suite.providerCtx()) + params.BlocksPerEpoch = 10 + providerKeeper.SetParams(suite.providerCtx(), params) + // FIXME + // re-assign all validator keys for the first consumer chain providerKeeper.SetPendingConsumerAdditionProp(suite.providerCtx(), &types.ConsumerAdditionProposal{ ChainId: icstestingutils.FirstConsumerChainID, @@ -153,25 +159,6 @@ func (suite *CCVTestSuite) SetupTest() { ) suite.Require().True(found, "consumer genesis not found") - //// START - ////valUpdates := consumerGenesisState.Provider.InitialValSet - //var stakingValidators []stakingtypes.Validator - //for _, val := range suite.providerApp.GetTestStakingKeeper().GetLastValidators(suite.providerCtx()) { - // // pubkey to consensus address - // //consAddr, err := ccv.TMCryptoPublicKeyToConsAddr(val.PubKey) - // //if err != nil { - // // continue - // //} - // //v, found := suite.providerApp.GetTestStakingKeeper().GetValidatorByConsAddr(suite.providerCtx(), consAddr) - // //if !found { - // // continue - // //} - // stakingValidators = append(stakingValidators, val) - //} - //nextValidators := providerKeeper.ComputeNextEpochValidators(suite.providerCtx(), chainID, []types.EpochValidator{}, stakingValidators) - //providerKeeper.ResetCurrentEpochValidators(suite.providerCtx(), chainID, nextValidators) - ///// END - genesisState := consumertypes.GenesisState{ Params: consumerGenesisState.Params, Provider: consumerGenesisState.Provider, diff --git a/tests/integration/slashing.go b/tests/integration/slashing.go index 2339538292..dac2fb4fb4 100644 --- a/tests/integration/slashing.go +++ b/tests/integration/slashing.go @@ -2,6 +2,7 @@ package integration import ( "fmt" + "github.com/cosmos/interchain-security/v4/x/ccv/provider/keeper" "time" clienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types" @@ -107,6 +108,9 @@ func (s *CCVTestSuite) TestRelayAndApplyDowntimePacket() { s.Require().True(found) } + // increase + nextBlocks(s.providerChain, keeper.BlocksPerEpoch) + // Confirm the valset update Id was incremented twice on provider, // since two endblockers have passed. s.Require().Equal(valsetUpdateIdN+2, diff --git a/tests/integration/soft_opt_out.go b/tests/integration/soft_opt_out.go index a5ee566a4b..d70d15ef70 100644 --- a/tests/integration/soft_opt_out.go +++ b/tests/integration/soft_opt_out.go @@ -2,6 +2,7 @@ package integration import ( "bytes" + "github.com/cosmos/interchain-security/v4/x/ccv/provider/keeper" "sort" abci "github.com/cometbft/cometbft/abci/types" @@ -73,7 +74,7 @@ func (suite *CCVTestSuite) TestSoftOptOut() { bondAmt := sdk.NewInt(100).Mul(sdk.DefaultPowerReduction) delegateByIdx(suite, delAddr, bondAmt, valIdx) - suite.providerChain.NextBlock() + nextBlocks(suite.providerChain, keeper.BlocksPerEpoch) // Relay 1 VSC packet from provider to consumer relayAllCommittedPackets(suite, suite.providerChain, suite.path, ccv.ProviderPortID, suite.path.EndpointB.ChannelID, 1) @@ -112,7 +113,7 @@ func (suite *CCVTestSuite) TestSoftOptOut() { bondAmt := sdk.NewInt(100).Mul(sdk.DefaultPowerReduction) delegateByIdx(suite, delAddr, bondAmt, valIdx) - suite.providerChain.NextBlock() + nextBlocks(suite.providerChain, keeper.BlocksPerEpoch) // Relay 1 VSC packet from provider to consumer relayAllCommittedPackets(suite, suite.providerChain, suite.path, ccv.ProviderPortID, suite.path.EndpointB.ChannelID, 1) @@ -149,6 +150,8 @@ func (suite *CCVTestSuite) TestSoftOptOut() { validatorPowers := []int64{1000, 500, 50, 10} suite.setupValidatorPowers(validatorPowers) + nextBlocks(suite.providerChain, keeper.BlocksPerEpoch) + // Relay 1 VSC packet from provider to consumer relayAllCommittedPackets(suite, suite.providerChain, suite.path, ccv.ProviderPortID, suite.path.EndpointB.ChannelID, 1) diff --git a/tests/integration/unbonding.go b/tests/integration/unbonding.go index 00f48871c2..e009a511f7 100644 --- a/tests/integration/unbonding.go +++ b/tests/integration/unbonding.go @@ -232,7 +232,7 @@ func (s *CCVTestSuite) TestUndelegationDuringInit() { tc.updateInitTimeoutTimestamp(&providerKeeper, providerUnbondingPeriod) // call NextBlock on the provider (which increments the height) - s.providerChain.NextBlock() + nextBlocks(s.providerChain, providerkeeper.BlocksPerEpoch) // check that the VSC packet is stored in state as pending pendingVSCs := providerKeeper.GetPendingVSCPackets(s.providerCtx(), s.consumerChain.ChainID) @@ -242,7 +242,7 @@ func (s *CCVTestSuite) TestUndelegationDuringInit() { delegate(s, delAddr, bondAmt) // call NextBlock on the provider (which increments the height) - s.providerChain.NextBlock() + nextBlocks(s.providerChain, providerkeeper.BlocksPerEpoch) // check that the VSC packet is stored in state as pending pendingVSCs = providerKeeper.GetPendingVSCPackets(s.providerCtx(), s.consumerChain.ChainID) @@ -266,6 +266,7 @@ func (s *CCVTestSuite) TestUndelegationDuringInit() { // complete CCV channel setup s.SetupCCVChannel(s.path) + nextBlocks(s.providerChain, providerkeeper.BlocksPerEpoch) // relay VSC packets from provider to consumer relayAllCommittedPackets(s, s.providerChain, s.path, ccv.ProviderPortID, s.path.EndpointB.ChannelID, 2) @@ -430,7 +431,7 @@ func (s *CCVTestSuite) TestRedelegationProviderFirst() { checkCCVUnbondingOp(s, s.providerCtx(), s.consumerChain.ChainID, valsetUpdateID, true) // Call NextBlock on the provider (which increments the height) - s.providerChain.NextBlock() + nextBlocks(s.providerChain, providerkeeper.BlocksPerEpoch) // Relay 2 VSC packets from provider to consumer (original delegation, and redelegation) relayAllCommittedPackets(s, s.providerChain, s.path, diff --git a/tests/integration/valset_update.go b/tests/integration/valset_update.go index dedcce2b86..6920fd8e70 100644 --- a/tests/integration/valset_update.go +++ b/tests/integration/valset_update.go @@ -1,6 +1,7 @@ package integration import ( + "github.com/cosmos/interchain-security/v4/x/ccv/provider/keeper" "time" clienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types" @@ -24,7 +25,7 @@ func (s *CCVTestSuite) TestPacketRoundtrip() { delegate(s, delAddr, bondAmt) // Send CCV packet to consumer - s.providerChain.NextBlock() + nextBlocks(s.providerChain, keeper.BlocksPerEpoch) // Relay 1 VSC packet from provider to consumer relayAllCommittedPackets(s, s.providerChain, s.path, ccv.ProviderPortID, s.path.EndpointB.ChannelID, 1) diff --git a/tests/mbt/driver/mbt_test.go b/tests/mbt/driver/mbt_test.go index a55d870dda..d173a48040 100644 --- a/tests/mbt/driver/mbt_test.go +++ b/tests/mbt/driver/mbt_test.go @@ -184,6 +184,10 @@ func RunItfTrace(t *testing.T, path string) { driver.setupProvider(modelParams, valSet, signers, nodes, valNames) + providerParams := driver.providerKeeper().GetParams(driver.providerCtx()) + providerParams.BlocksPerEpoch = 10 + driver.providerKeeper().SetParams(driver.providerCtx(), providerParams) + // remember the time offsets to be able to compare times to the model // this is necessary because the system needs to do many steps to initialize the chains, // which is abstracted away in the model @@ -238,12 +242,16 @@ func RunItfTrace(t *testing.T, path string) { // so we do one time advancement with a very small increment, // and then increment the rest of the time runningConsumersBefore := driver.runningConsumers() - driver.endAndBeginBlock("provider", 1*time.Nanosecond) for _, consumer := range driver.runningConsumers() { UpdateProviderClientOnConsumer(t, driver, consumer.ChainId) } - driver.endAndBeginBlock("provider", time.Duration(timeAdvancement)*time.Second-1*time.Nanosecond) + blocksPerEpoch := driver.providerKeeper().GetBlocksPerEpoch(driver.providerCtx()) + for i := uint64(0); i < blocksPerEpoch; i = i + 1 { + driver.endAndBeginBlock("provider", 1*time.Nanosecond) + } + driver.endAndBeginBlock("provider", time.Duration(timeAdvancement)*time.Second-time.Nanosecond*time.Duration(blocksPerEpoch)) + runningConsumersAfter := driver.runningConsumers() // the consumers that were running before but not after must have timed out @@ -314,6 +322,9 @@ func RunItfTrace(t *testing.T, path string) { headerBefore := driver.chain(ChainId(consumerChain)).LastHeader _ = headerBefore + providerParams := driver.providerKeeper().GetParams(driver.providerCtx()) + providerParams.BlocksPerEpoch = 10 + driver.providerKeeper().SetParams(driver.providerCtx(), providerParams) driver.endAndBeginBlock(ChainId(consumerChain), 1*time.Nanosecond) UpdateConsumerClientOnProvider(t, driver, consumerChain) diff --git a/x/ccv/provider/keeper/params.go b/x/ccv/provider/keeper/params.go index 209d0f0ddb..486e392d61 100644 --- a/x/ccv/provider/keeper/params.go +++ b/x/ccv/provider/keeper/params.go @@ -78,6 +78,13 @@ func (k Keeper) GetConsumerRewardDenomRegistrationFee(ctx sdk.Context) sdk.Coin return c } +// FIXME: add docstring +func (k Keeper) GetBlocksPerEpoch(ctx sdk.Context) uint64 { + var b uint64 + k.paramSpace.Get(ctx, types.KeyBlocksPerEpoch, &b) + return b +} + // GetParams returns the paramset for the provider module func (k Keeper) GetParams(ctx sdk.Context) types.Params { return types.NewParams( @@ -89,6 +96,7 @@ func (k Keeper) GetParams(ctx sdk.Context) types.Params { k.GetSlashMeterReplenishPeriod(ctx), k.GetSlashMeterReplenishFraction(ctx), k.GetConsumerRewardDenomRegistrationFee(ctx), + k.GetBlocksPerEpoch(ctx), ) } diff --git a/x/ccv/provider/keeper/params_test.go b/x/ccv/provider/keeper/params_test.go index a941523e87..ae95a02fa6 100644 --- a/x/ccv/provider/keeper/params_test.go +++ b/x/ccv/provider/keeper/params_test.go @@ -48,6 +48,7 @@ func TestParams(t *testing.T) { Denom: "stake", Amount: sdk.NewInt(10000000), }, + 1000, ) providerKeeper.SetParams(ctx, newParams) params = providerKeeper.GetParams(ctx) diff --git a/x/ccv/provider/keeper/relay.go b/x/ccv/provider/keeper/relay.go index 23947b6cf4..36c948585f 100644 --- a/x/ccv/provider/keeper/relay.go +++ b/x/ccv/provider/keeper/relay.go @@ -148,15 +148,15 @@ func (k Keeper) EndBlockVSU(ctx sdk.Context) { // notify the staking module to complete all matured unbonding ops k.completeMaturedUnbondingOps(ctx) - //if ctx.BlockHeight()%BlocksPerEpoch == 0 { - // collect validator updates - k.QueueVSCPackets(ctx) - - // try sending VSC packets to all registered consumer chains; - // if the CCV channel is not established for a consumer chain, - // the updates will remain queued until the channel is established - k.SendVSCPackets(ctx) - //} + if uint64(ctx.BlockHeight())%10 == 0 { //k.GetBlocksPerEpoch(ctx) == 0 { + // collect validator updates + k.QueueVSCPackets(ctx) + + // try sending VSC packets to all registered consumer chains; + // if the CCV channel is not established for a consumer chain, + // the updates will remain queued until the channel is established + k.SendVSCPackets(ctx) + } } // SendVSCPackets iterates over all registered consumers and sends pending @@ -217,22 +217,21 @@ func (k Keeper) QueueVSCPackets(ctx sdk.Context) { // Get the validator updates from the staking module. // Note: GetValidatorUpdates panics if the updates provided by the x/staking module // of cosmos-sdk is invalid. - stakingValUpdates := k.stakingKeeper.GetValidatorUpdates(ctx) + // FIXME comments bondedValidators := k.stakingKeeper.GetLastValidators(ctx) + //stakingUpdates := k.stakingKeeper.GetValidatorUpdates(ctx) + for _, chain := range k.GetAllConsumerChains(ctx) { currentEpochValidators := k.GetAllEpochValidators(ctx, chain.ChainId) nextEpochValidators := k.ComputeNextEpochValidators(ctx, chain.ChainId, currentEpochValidators, bondedValidators) valUpdates := k.diff(currentEpochValidators, nextEpochValidators) - fmt.Println(valUpdates) k.ResetCurrentEpochValidators(ctx, chain.ChainId, nextEpochValidators) - // Apply the key assignment to the validator updates. - valUpdatesFoo := k.MustApplyKeyAssignmentToValUpdates(ctx, chain.ChainId, stakingValUpdates) - - if len(valUpdates) != len(valUpdatesFoo) { - fmt.Println("WHAT's HAPPENING???") - } + //valUpdatesFoor := k.MustApplyKeyAssignmentToValUpdates(ctx, chain.ChainId, stakingUpdates) + //if len(valUpdates) != len(valUpdatesFoor) { + // fmt.Println("...XXX...") + //} // check whether there are changes in the validator set; // note that this also entails unbonding operations diff --git a/x/ccv/provider/keeper/validator_set_update.go b/x/ccv/provider/keeper/validator_set_update.go index a56c490d1f..b90d4737e8 100644 --- a/x/ccv/provider/keeper/validator_set_update.go +++ b/x/ccv/provider/keeper/validator_set_update.go @@ -9,7 +9,7 @@ import ( "github.com/cosmos/interchain-security/v4/x/ccv/provider/types" ) -const BlocksPerEpoch = 1 +const BlocksPerEpoch = 10 const HoursPerEpoch = 1 // SetEpochValidator sets provided epoch `validator` on the consumer chain with `chainID` @@ -20,6 +20,7 @@ func (k Keeper) SetEpochValidator( ) { store := ctx.KVStore(k.storeKey) bz, err := validator.Marshal() + // FIXME .. .names if err != nil { panic(fmt.Errorf("failed to marshal CurrentEpochOptedInValidator: %w", err)) } @@ -209,6 +210,7 @@ func (k Keeper) diff( // `ComputeNextValidators` and hence this method should only be called after `ComputeNextValidators` has completed. func (k Keeper) ResetCurrentEpochValidators(ctx sdk.Context, chainID string, nextValidators []types.EpochValidator) { + // for epochs we do not need to do this ... k.DeleteAllEpochValidators(ctx, chainID) for _, val := range nextValidators { k.SetEpochValidator(ctx, chainID, val) diff --git a/x/ccv/provider/types/genesis_test.go b/x/ccv/provider/types/genesis_test.go index 45d766fcfb..c199e20120 100644 --- a/x/ccv/provider/types/genesis_test.go +++ b/x/ccv/provider/types/genesis_test.go @@ -81,7 +81,7 @@ func TestValidateGenesisState(t *testing.T) { nil, types.NewParams(ibctmtypes.NewClientState("", ibctmtypes.DefaultTrustLevel, 0, 0, time.Second*40, clienttypes.Height{}, commitmenttypes.GetSDKSpecs(), []string{"ibc", "upgradedIBCState"}), - types.DefaultTrustingPeriodFraction, time.Hour, time.Hour, 30*time.Minute, time.Hour, "0.1", sdk.Coin{Denom: "stake", Amount: sdk.NewInt(10000000)}), + types.DefaultTrustingPeriodFraction, time.Hour, time.Hour, 30*time.Minute, time.Hour, "0.1", sdk.Coin{Denom: "stake", Amount: sdk.NewInt(10000000)}, 1000), nil, nil, nil, @@ -102,7 +102,7 @@ func TestValidateGenesisState(t *testing.T) { nil, types.NewParams(ibctmtypes.NewClientState("", ibctmtypes.DefaultTrustLevel, 0, 0, time.Second*40, clienttypes.Height{}, commitmenttypes.GetSDKSpecs(), []string{"ibc", "upgradedIBCState"}), - types.DefaultTrustingPeriodFraction, time.Hour, time.Hour, 30*time.Minute, time.Hour, "0.1", sdk.Coin{Denom: "stake", Amount: sdk.NewInt(10000000)}), + types.DefaultTrustingPeriodFraction, time.Hour, time.Hour, 30*time.Minute, time.Hour, "0.1", sdk.Coin{Denom: "stake", Amount: sdk.NewInt(10000000)}, 1000), nil, nil, nil, @@ -123,7 +123,7 @@ func TestValidateGenesisState(t *testing.T) { nil, types.NewParams(ibctmtypes.NewClientState("", ibctmtypes.DefaultTrustLevel, 0, 0, time.Second*40, clienttypes.Height{}, commitmenttypes.GetSDKSpecs(), []string{"ibc", "upgradedIBCState"}), - types.DefaultTrustingPeriodFraction, time.Hour, time.Hour, 30*time.Minute, time.Hour, "0.1", sdk.Coin{Denom: "stake", Amount: sdk.NewInt(10000000)}), + types.DefaultTrustingPeriodFraction, time.Hour, time.Hour, 30*time.Minute, time.Hour, "0.1", sdk.Coin{Denom: "stake", Amount: sdk.NewInt(10000000)}, 1000), nil, nil, nil, @@ -144,7 +144,7 @@ func TestValidateGenesisState(t *testing.T) { nil, types.NewParams(ibctmtypes.NewClientState("", ibctmtypes.DefaultTrustLevel, 0, 0, time.Second*40, clienttypes.Height{}, commitmenttypes.GetSDKSpecs(), []string{"ibc", "upgradedIBCState"}), - types.DefaultTrustingPeriodFraction, time.Hour, time.Hour, 30*time.Minute, time.Hour, "0.1", sdk.Coin{Denom: "stake", Amount: sdk.NewInt(10000000)}), + types.DefaultTrustingPeriodFraction, time.Hour, time.Hour, 30*time.Minute, time.Hour, "0.1", sdk.Coin{Denom: "stake", Amount: sdk.NewInt(10000000)}, 1000), nil, nil, nil, @@ -171,7 +171,7 @@ func TestValidateGenesisState(t *testing.T) { types.DefaultVscTimeoutPeriod, types.DefaultSlashMeterReplenishPeriod, types.DefaultSlashMeterReplenishFraction, - sdk.Coin{Denom: "stake", Amount: sdk.NewInt(10000000)}), + sdk.Coin{Denom: "stake", Amount: sdk.NewInt(10000000)}, 1000), nil, nil, nil, @@ -198,7 +198,7 @@ func TestValidateGenesisState(t *testing.T) { types.DefaultVscTimeoutPeriod, types.DefaultSlashMeterReplenishPeriod, types.DefaultSlashMeterReplenishFraction, - sdk.Coin{Denom: "stake", Amount: sdk.NewInt(10000000)}), + sdk.Coin{Denom: "stake", Amount: sdk.NewInt(10000000)}, 1000), nil, nil, nil, @@ -225,7 +225,7 @@ func TestValidateGenesisState(t *testing.T) { types.DefaultVscTimeoutPeriod, types.DefaultSlashMeterReplenishPeriod, types.DefaultSlashMeterReplenishFraction, - sdk.Coin{Denom: "stake", Amount: sdk.NewInt(1000000)}), + sdk.Coin{Denom: "stake", Amount: sdk.NewInt(1000000)}, 1000), nil, nil, nil, @@ -252,7 +252,7 @@ func TestValidateGenesisState(t *testing.T) { types.DefaultVscTimeoutPeriod, types.DefaultSlashMeterReplenishPeriod, types.DefaultSlashMeterReplenishFraction, - sdk.Coin{Denom: "stake", Amount: sdk.NewInt(10000000)}), + sdk.Coin{Denom: "stake", Amount: sdk.NewInt(10000000)}, 1000), nil, nil, nil, @@ -279,7 +279,7 @@ func TestValidateGenesisState(t *testing.T) { 0, // 0 vsc timeout here types.DefaultSlashMeterReplenishPeriod, types.DefaultSlashMeterReplenishFraction, - sdk.Coin{Denom: "stake", Amount: sdk.NewInt(10000000)}), + sdk.Coin{Denom: "stake", Amount: sdk.NewInt(10000000)}, 1000), nil, nil, nil, @@ -306,7 +306,7 @@ func TestValidateGenesisState(t *testing.T) { types.DefaultVscTimeoutPeriod, 0, // 0 slash meter replenish period here types.DefaultSlashMeterReplenishFraction, - sdk.Coin{Denom: "stake", Amount: sdk.NewInt(10000000)}), + sdk.Coin{Denom: "stake", Amount: sdk.NewInt(10000000)}, 1000), nil, nil, nil, @@ -333,7 +333,7 @@ func TestValidateGenesisState(t *testing.T) { types.DefaultVscTimeoutPeriod, types.DefaultSlashMeterReplenishPeriod, "1.15", - sdk.Coin{Denom: "stake", Amount: sdk.NewInt(10000000)}), + sdk.Coin{Denom: "stake", Amount: sdk.NewInt(10000000)}, 1000), nil, nil, nil, @@ -685,7 +685,7 @@ func TestValidateGenesisState(t *testing.T) { nil, types.NewParams(ibctmtypes.NewClientState("", ibctmtypes.DefaultTrustLevel, 0, 0, time.Second*40, clienttypes.Height{}, commitmenttypes.GetSDKSpecs(), []string{"ibc", "upgradedIBCState"}), - types.DefaultTrustingPeriodFraction, time.Hour, time.Hour, 30*time.Minute, time.Hour, "0.1", sdk.Coin{Denom: "st", Amount: sdk.NewInt(10000000)}), + types.DefaultTrustingPeriodFraction, time.Hour, time.Hour, 30*time.Minute, time.Hour, "0.1", sdk.Coin{Denom: "st", Amount: sdk.NewInt(10000000)}, 1000), nil, nil, nil, @@ -706,7 +706,7 @@ func TestValidateGenesisState(t *testing.T) { nil, types.NewParams(ibctmtypes.NewClientState("", ibctmtypes.DefaultTrustLevel, 0, 0, time.Second*40, clienttypes.Height{}, commitmenttypes.GetSDKSpecs(), []string{"ibc", "upgradedIBCState"}), - types.DefaultTrustingPeriodFraction, time.Hour, time.Hour, 30*time.Minute, time.Hour, "0.1", sdk.Coin{Denom: "stake", Amount: sdk.NewInt(-1000000)}), + types.DefaultTrustingPeriodFraction, time.Hour, time.Hour, 30*time.Minute, time.Hour, "0.1", sdk.Coin{Denom: "stake", Amount: sdk.NewInt(-1000000)}, 1000), nil, nil, nil, diff --git a/x/ccv/provider/types/params.go b/x/ccv/provider/types/params.go index a580e60f41..f482201412 100644 --- a/x/ccv/provider/types/params.go +++ b/x/ccv/provider/types/params.go @@ -36,6 +36,9 @@ const ( // that is replenished to the slash meter every replenish period. This param also serves as a maximum // fraction of total voting power that the slash meter can hold. DefaultSlashMeterReplenishFraction = "0.05" + + //FIMXe + DefaultBlocksPerEpoch = 1000 ) // Reflection based keys for params subspace @@ -47,6 +50,7 @@ var ( KeySlashMeterReplenishPeriod = []byte("SlashMeterReplenishPeriod") KeySlashMeterReplenishFraction = []byte("SlashMeterReplenishFraction") KeyConsumerRewardDenomRegistrationFee = []byte("ConsumerRewardDenomRegistrationFee") + KeyBlocksPerEpoch = []byte("BlocksPerEpoch") ) // ParamKeyTable returns a key table with the necessary registered provider params @@ -64,6 +68,7 @@ func NewParams( slashMeterReplenishPeriod time.Duration, slashMeterReplenishFraction string, consumerRewardDenomRegistrationFee sdk.Coin, + blocksPerEpoch uint64, ) Params { return Params{ TemplateClient: cs, @@ -74,6 +79,7 @@ func NewParams( SlashMeterReplenishPeriod: slashMeterReplenishPeriod, SlashMeterReplenishFraction: slashMeterReplenishFraction, ConsumerRewardDenomRegistrationFee: consumerRewardDenomRegistrationFee, + BlocksPerEpoch: blocksPerEpoch, } } @@ -104,6 +110,7 @@ func DefaultParams() Params { Denom: sdk.DefaultBondDenom, Amount: sdk.NewInt(10000000), }, + DefaultBlocksPerEpoch, ) } @@ -136,6 +143,7 @@ func (p Params) Validate() error { if err := ValidateCoin(p.ConsumerRewardDenomRegistrationFee); err != nil { return fmt.Errorf("consumer reward denom registration fee is invalid: %s", err) } + // FIXME: potentially add a validate that this p.BlocksPerEpoch cannot be too high return nil } @@ -150,6 +158,9 @@ func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs { paramtypes.NewParamSetPair(KeySlashMeterReplenishPeriod, p.SlashMeterReplenishPeriod, ccvtypes.ValidateDuration), paramtypes.NewParamSetPair(KeySlashMeterReplenishFraction, p.SlashMeterReplenishFraction, ccvtypes.ValidateStringFraction), paramtypes.NewParamSetPair(KeyConsumerRewardDenomRegistrationFee, p.ConsumerRewardDenomRegistrationFee, ValidateCoin), + + //FIXME: do we need this??? yes for registration .. but no validation is needed? unless we put here the max bound + paramtypes.NewParamSetPair(KeyBlocksPerEpoch, p.BlocksPerEpoch, ccvtypes.ValidateDummy), } } diff --git a/x/ccv/provider/types/params_test.go b/x/ccv/provider/types/params_test.go index 1de6b6fe54..4e72c233af 100644 --- a/x/ccv/provider/types/params_test.go +++ b/x/ccv/provider/types/params_test.go @@ -24,39 +24,39 @@ func TestValidateParams(t *testing.T) { {"custom valid params", types.NewParams( ibctmtypes.NewClientState("", ibctmtypes.DefaultTrustLevel, 0, 0, time.Second*40, clienttypes.Height{}, commitmenttypes.GetSDKSpecs(), []string{"ibc", "upgradedIBCState"}), - "0.33", time.Hour, time.Hour, time.Hour, 30*time.Minute, "0.1", sdk.Coin{Denom: "stake", Amount: sdk.NewInt(10000000)}), true}, + "0.33", time.Hour, time.Hour, time.Hour, 30*time.Minute, "0.1", sdk.Coin{Denom: "stake", Amount: sdk.NewInt(10000000)}, 1000), true}, {"custom invalid params", types.NewParams( ibctmtypes.NewClientState("", ibctmtypes.DefaultTrustLevel, 0, 0, 0, clienttypes.Height{}, nil, []string{"ibc", "upgradedIBCState"}), - "0.33", time.Hour, time.Hour, time.Hour, 30*time.Minute, "0.1", sdk.Coin{Denom: "stake", Amount: sdk.NewInt(10000000)}), false}, + "0.33", time.Hour, time.Hour, time.Hour, 30*time.Minute, "0.1", sdk.Coin{Denom: "stake", Amount: sdk.NewInt(10000000)}, 1000), false}, {"blank client", types.NewParams(&ibctmtypes.ClientState{}, - "0.33", time.Hour, time.Hour, time.Hour, 30*time.Minute, "0.1", sdk.Coin{Denom: "stake", Amount: sdk.NewInt(10000000)}), false}, - {"nil client", types.NewParams(nil, "0.33", time.Hour, time.Hour, time.Hour, 30*time.Minute, "0.1", sdk.Coin{Denom: "stake", Amount: sdk.NewInt(10000000)}), false}, + "0.33", time.Hour, time.Hour, time.Hour, 30*time.Minute, "0.1", sdk.Coin{Denom: "stake", Amount: sdk.NewInt(10000000)}, 1000), false}, + {"nil client", types.NewParams(nil, "0.33", time.Hour, time.Hour, time.Hour, 30*time.Minute, "0.1", sdk.Coin{Denom: "stake", Amount: sdk.NewInt(10000000)}, 1000), false}, // Check if "0.00" is valid or if a zero dec TrustFraction needs to return an error {"0 trusting period fraction", types.NewParams(ibctmtypes.NewClientState("", ibctmtypes.DefaultTrustLevel, 0, 0, time.Second*40, clienttypes.Height{}, commitmenttypes.GetSDKSpecs(), []string{"ibc", "upgradedIBCState"}), - "0.00", time.Hour, time.Hour, time.Hour, 30*time.Minute, "0.1", sdk.Coin{Denom: "stake", Amount: sdk.NewInt(10000000)}), true}, + "0.00", time.Hour, time.Hour, time.Hour, 30*time.Minute, "0.1", sdk.Coin{Denom: "stake", Amount: sdk.NewInt(10000000)}, 1000), true}, {"0 ccv timeout period", types.NewParams(ibctmtypes.NewClientState("", ibctmtypes.DefaultTrustLevel, 0, 0, time.Second*40, clienttypes.Height{}, commitmenttypes.GetSDKSpecs(), []string{"ibc", "upgradedIBCState"}), - "0.33", 0, time.Hour, time.Hour, 30*time.Minute, "0.1", sdk.Coin{Denom: "stake", Amount: sdk.NewInt(10000000)}), false}, + "0.33", 0, time.Hour, time.Hour, 30*time.Minute, "0.1", sdk.Coin{Denom: "stake", Amount: sdk.NewInt(10000000)}, 1000), false}, {"0 init timeout period", types.NewParams(ibctmtypes.NewClientState("", ibctmtypes.DefaultTrustLevel, 0, 0, time.Second*40, clienttypes.Height{}, commitmenttypes.GetSDKSpecs(), []string{"ibc", "upgradedIBCState"}), - "0.33", time.Hour, 0, time.Hour, 30*time.Minute, "0.1", sdk.Coin{Denom: "stake", Amount: sdk.NewInt(10000000)}), false}, + "0.33", time.Hour, 0, time.Hour, 30*time.Minute, "0.1", sdk.Coin{Denom: "stake", Amount: sdk.NewInt(10000000)}, 1000), false}, {"0 vsc timeout period", types.NewParams(ibctmtypes.NewClientState("", ibctmtypes.DefaultTrustLevel, 0, 0, time.Second*40, clienttypes.Height{}, commitmenttypes.GetSDKSpecs(), []string{"ibc", "upgradedIBCState"}), - "0.33", time.Hour, time.Hour, 0, 30*time.Minute, "0.1", sdk.Coin{Denom: "stake", Amount: sdk.NewInt(10000000)}), false}, + "0.33", time.Hour, time.Hour, 0, 30*time.Minute, "0.1", sdk.Coin{Denom: "stake", Amount: sdk.NewInt(10000000)}, 1000), false}, {"0 slash meter replenish period", types.NewParams(ibctmtypes.NewClientState("", ibctmtypes.DefaultTrustLevel, 0, 0, time.Second*40, clienttypes.Height{}, commitmenttypes.GetSDKSpecs(), []string{"ibc", "upgradedIBCState"}), - "0.33", time.Hour, time.Hour, 24*time.Hour, 0, "0.1", sdk.Coin{Denom: "stake", Amount: sdk.NewInt(10000000)}), false}, + "0.33", time.Hour, time.Hour, 24*time.Hour, 0, "0.1", sdk.Coin{Denom: "stake", Amount: sdk.NewInt(10000000)}, 1000), false}, {"slash meter replenish fraction over 1", types.NewParams(ibctmtypes.NewClientState("", ibctmtypes.DefaultTrustLevel, 0, 0, time.Second*40, clienttypes.Height{}, commitmenttypes.GetSDKSpecs(), []string{"ibc", "upgradedIBCState"}), - "0.33", time.Hour, time.Hour, 24*time.Hour, time.Hour, "1.5", sdk.Coin{Denom: "stake", Amount: sdk.NewInt(10000000)}), false}, + "0.33", time.Hour, time.Hour, 24*time.Hour, time.Hour, "1.5", sdk.Coin{Denom: "stake", Amount: sdk.NewInt(10000000)}, 1000), false}, {"invalid consumer reward denom registration fee denom", types.NewParams(ibctmtypes.NewClientState("", ibctmtypes.DefaultTrustLevel, 0, 0, time.Second*40, clienttypes.Height{}, commitmenttypes.GetSDKSpecs(), []string{"ibc", "upgradedIBCState"}), - "0.33", time.Hour, time.Hour, 24*time.Hour, time.Hour, "0.1", sdk.Coin{Denom: "st", Amount: sdk.NewInt(10000000)}), false}, + "0.33", time.Hour, time.Hour, 24*time.Hour, time.Hour, "0.1", sdk.Coin{Denom: "st", Amount: sdk.NewInt(10000000)}, 1000), false}, {"invalid consumer reward denom registration fee amount", types.NewParams(ibctmtypes.NewClientState("", ibctmtypes.DefaultTrustLevel, 0, 0, time.Second*40, clienttypes.Height{}, commitmenttypes.GetSDKSpecs(), []string{"ibc", "upgradedIBCState"}), - "0.33", time.Hour, time.Hour, 24*time.Hour, time.Hour, "0.1", sdk.Coin{Denom: "stake", Amount: sdk.NewInt(-10000000)}), false}, + "0.33", time.Hour, time.Hour, 24*time.Hour, time.Hour, "0.1", sdk.Coin{Denom: "stake", Amount: sdk.NewInt(-10000000)}, 1000), false}, } for _, tc := range testCases { diff --git a/x/ccv/provider/types/provider.pb.go b/x/ccv/provider/types/provider.pb.go index 5951e2195b..8cd6940490 100644 --- a/x/ccv/provider/types/provider.pb.go +++ b/x/ccv/provider/types/provider.pb.go @@ -451,6 +451,8 @@ type Params struct { SlashMeterReplenishFraction string `protobuf:"bytes,7,opt,name=slash_meter_replenish_fraction,json=slashMeterReplenishFraction,proto3" json:"slash_meter_replenish_fraction,omitempty"` // The fee required to be paid to add a reward denom ConsumerRewardDenomRegistrationFee types2.Coin `protobuf:"bytes,9,opt,name=consumer_reward_denom_registration_fee,json=consumerRewardDenomRegistrationFee,proto3" json:"consumer_reward_denom_registration_fee"` + // The number of blocks that comprise an epoch. + BlocksPerEpoch uint64 `protobuf:"varint,10,opt,name=blocks_per_epoch,json=blocksPerEpoch,proto3" json:"blocks_per_epoch,omitempty"` } func (m *Params) Reset() { *m = Params{} } @@ -542,6 +544,13 @@ func (m *Params) GetConsumerRewardDenomRegistrationFee() types2.Coin { return types2.Coin{} } +func (m *Params) GetBlocksPerEpoch() uint64 { + if m != nil { + return m.BlocksPerEpoch + } + return 0 +} + // SlashAcks contains cons addresses of consumer chain validators // successfully slashed on the provider chain. type SlashAcks struct { @@ -1386,19 +1395,16 @@ func (m *ConsumerAddrsToPrune) GetConsumerAddrs() *AddressList { } // EpochValidator is used to facilitate epoch-based transitions. It contains relevant info for -// a validator that is opted in, in the curren epoch, on a consumer chain. +// a validator that is opted in, in an epoch, on a consumer chain. type EpochValidator struct { // validator's consensus address on the provider chain ProviderConsAddr []byte `protobuf:"bytes,1,opt,name=provider_cons_addr,json=providerConsAddr,proto3" json:"provider_cons_addr,omitempty"` - // The block height the provider chain had when the validator initially opted in. If the validator remains opted in - // during subsequent epochs, `start_block_height` remains unchanged. + // The block height the provider chain had when the validator opted in for the first time. If the validator + // remains opted in during subsequent epochs, `start_block_height` remains unchanged. StartBlockHeight int64 `protobuf:"varint,2,opt,name=start_block_height,json=startBlockHeight,proto3" json:"start_block_height,omitempty"` - // The power the validator had when the validator opted in. If the validator remains opted in, `power` gets - // updated in subsequent epochs. + // voting power the validator has during this epoch Power int64 `protobuf:"varint,3,opt,name=power,proto3" json:"power,omitempty"` - // The consumer public key the validator had assigned for the consumer chain chain when the validator opted in. - // If the validator remains opted in, in subsequent epochs `consumer_public_key` gets updated if the consumer public - // key has been changed. + // public key the validator uses on the consumer chain during this epoch ConsumerPublicKey []byte `protobuf:"bytes,4,opt,name=consumer_public_key,json=consumerPublicKey,proto3" json:"consumer_public_key,omitempty"` } @@ -1494,118 +1500,119 @@ func init() { } var fileDescriptor_f22ec409a72b7b72 = []byte{ - // 1762 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00,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a2, 0x71, 0x94, 0x31, - 0x74, 0x67, 0x19, 0xfc, 0x98, 0x23, 0x49, 0x59, 0x98, 0x03, 0xd0, 0x01, 0xee, 0x61, 0xc6, 0x49, - 0x0f, 0x07, 0x94, 0x84, 0x52, 0x69, 0x4d, 0x9f, 0x32, 0x86, 0x9e, 0x62, 0x08, 0xe8, 0x70, 0x24, - 0x53, 0xb2, 0xe8, 0x49, 0x12, 0xfa, 0x84, 0x8f, 0x69, 0xca, 0x5c, 0xbe, 0x65, 0x02, 0x5b, 0x95, - 0x73, 0xcc, 0x27, 0x91, 0x64, 0xbd, 0x4b, 0x32, 0x11, 0xd9, 0xe9, 0xdb, 0x98, 0x89, 0x31, 0x13, - 0x3d, 0xa2, 0xfc, 0x0f, 0x31, 0xe9, 0x25, 0x7b, 0x03, 0x22, 0xd1, 0x5e, 0x41, 0xc8, 0xed, 0xce, - 0xf8, 0x06, 0x48, 0x94, 0x3c, 0x98, 0xd1, 0xcc, 0x6e, 0xfb, 0xbb, 0x25, 0xb0, 0xfa, 0x2c, 0x14, - 0xf1, 0x98, 0xf0, 0x03, 0xdf, 0xa7, 0xca, 0xa5, 0x53, 0xce, 0x22, 0x26, 0x50, 0x60, 0x6e, 0xc0, - 0xa2, 0xa4, 0x32, 0x20, 0x96, 0xb1, 0x63, 0xec, 0x36, 0xdd, 0xf4, 0xc5, 0xdc, 0x81, 0x96, 0x4f, - 0x04, 0xe6, 0x34, 0x52, 0xcc, 0x56, 0x4d, 0x9f, 0x55, 0x49, 0xe6, 0x26, 0x2c, 0xa7, 0x79, 0xa0, - 0xbe, 0x55, 0xd7, 0xc7, 0xb7, 0xf4, 0xfb, 0xb1, 0x6f, 0x7e, 0x0c, 0x6d, 0x1a, 0x52, 0x49, 0x51, - 0xe0, 0x8d, 0x88, 0x8a, 0x86, 0xd5, 0xd8, 0x31, 0x76, 0x5b, 0xfb, 0x77, 0x1d, 0x3a, 0xc0, 0x8e, - 0x0a, 0xa0, 0x93, 0x85, 0x2d, 0xd9, 0x73, 0x1e, 0x68, 0x8e, 0xc3, 0xc6, 0xd7, 0xdf, 0x6e, 0x2f, - 0xb8, 0xab, 0x99, 0x5c, 0x4a, 0x34, 0xdf, 0x80, 0x95, 0x21, 0x09, 0x89, 0xa0, 0xc2, 0x1b, 0x21, - 0x31, 0xb2, 0x16, 0x77, 0x8c, 0xdd, 0x15, 0xb7, 0x95, 0xd1, 0x1e, 0x20, 0x31, 0x32, 0xb7, 0xa1, + // 1777 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x58, 0xcf, 0x73, 0xdb, 0xc6, + 0xf5, 0x17, 0x48, 0x4a, 0x16, 0x1f, 0x25, 0x8a, 0x86, 0x94, 0x18, 0xf2, 0x57, 0x5f, 0x4a, 0x46, + 0x9a, 0x54, 0x9d, 0x34, 0x60, 0xa5, 0xb4, 0x33, 0x19, 0x4f, 0x33, 0x19, 0x89, 0x72, 0x62, 0x59, + 0x4d, 0xac, 0x40, 0xaa, 0x3c, 0x6d, 0x0f, 0x98, 0xe5, 0x62, 0x4d, 0xee, 0x08, 0xc4, 0xc2, 0xbb, + 0x0b, 0x38, 0xbc, 0xf4, 0xdc, 0x63, 0x7a, 0xcb, 0xf4, 0xd2, 0xb4, 0xff, 0x40, 0x67, 0xfa, 0x57, + 0xe4, 0x98, 0x63, 0x4f, 0x49, 0xc7, 0x3e, 0xf6, 0x9f, 0xe8, 0xec, 0xe2, 0x27, 0x29, 0xc9, 0xa5, + 0x27, 0xed, 0x0d, 0x78, 0xfb, 0xde, 0xe7, 0xfd, 0x7e, 0x6f, 0x01, 0xd8, 0xa7, 0xa1, 0x24, 0x1c, + 0x8f, 0x10, 0x0d, 0x3d, 0x41, 0x70, 0xcc, 0xa9, 0x9c, 0xf4, 0x30, 0x4e, 0x7a, 0x11, 0x67, 0x09, + 0xf5, 0x09, 0xef, 0x25, 0x7b, 0xc5, 0xb3, 0x13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b, 0xbf, 0xfd, + 0x70, 0x48, 0xe5, 0x28, 0x1e, 0x38, 0x98, 0x8d, 0x7b, 0xd9, 0x9f, 0x8b, 0x32, 0x40, 0xef, 0x15, + 0xbf, 0x75, 0x92, 0x9f, 0xf7, 0xbe, 0x98, 0xfe, 0x69, 0x24, 0x27, 0x11, 0x11, 0x83, 0x25, 0x3d, + 0xca, 0xde, 0xff, 0x77, 0x00, 0x00, 0x00, 0xff, 0xff, 0x56, 0xc0, 0x63, 0xf4, 0x65, 0x12, 0x00, + 0x00, } func (m *ConsumerAdditionProposal) Marshal() (dAtA []byte, err error) { @@ -1960,6 +1967,11 @@ func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if m.BlocksPerEpoch != 0 { + i = encodeVarintProvider(dAtA, i, uint64(m.BlocksPerEpoch)) + i-- + dAtA[i] = 0x50 + } { size, err := m.ConsumerRewardDenomRegistrationFee.MarshalToSizedBuffer(dAtA[:i]) if err != nil { @@ -2905,6 +2917,9 @@ func (m *Params) Size() (n int) { } l = m.ConsumerRewardDenomRegistrationFee.Size() n += 1 + l + sovProvider(uint64(l)) + if m.BlocksPerEpoch != 0 { + n += 1 + sovProvider(uint64(m.BlocksPerEpoch)) + } return n } @@ -4661,6 +4676,25 @@ func (m *Params) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 10: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field BlocksPerEpoch", wireType) + } + m.BlocksPerEpoch = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProvider + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.BlocksPerEpoch |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } default: iNdEx = preIndex skippy, err := skipProvider(dAtA[iNdEx:]) diff --git a/x/ccv/types/shared_params.go b/x/ccv/types/shared_params.go index 566737c0b9..e5143f7af3 100644 --- a/x/ccv/types/shared_params.go +++ b/x/ccv/types/shared_params.go @@ -51,6 +51,10 @@ func ValidatePositiveInt64(i interface{}) error { return nil } +func ValidateDummy(i interface{}) error { + return nil +} + func ValidateString(i interface{}) error { if _, ok := i.(string); !ok { return fmt.Errorf("invalid parameter type: %T", i) From 44d13cd87807ea0b7aa90b13aa8230f80c9735bb Mon Sep 17 00:00:00 2001 From: insumity Date: Fri, 23 Feb 2024 15:03:53 +0100 Subject: [PATCH 12/46] reduce epoch size for e2e --- tests/e2e/actions.go | 11 +++-------- tests/e2e/config.go | 14 +++++++------- x/ccv/provider/keeper/relay.go | 2 +- 3 files changed, 11 insertions(+), 16 deletions(-) diff --git a/tests/e2e/actions.go b/tests/e2e/actions.go index 73eabc3033..9780a6aa34 100644 --- a/tests/e2e/actions.go +++ b/tests/e2e/actions.go @@ -1307,7 +1307,7 @@ func (tr TestConfig) relayPacketsGorelayer( target ExecutionTarget, verbose bool, ) { - //tr.waitBlocks(action.ChainA, 10, 60*time.Second) + tr.waitBlocks(action.ChainA, 2, time.Minute) pathName := tr.GetPathNameForGorelayer(action.ChainA, action.ChainB) @@ -1323,7 +1323,7 @@ func (tr TestConfig) relayPacketsGorelayer( if err != nil { log.Fatal(err, "\n", string(bz)) } - //tr.waitBlocks(action.ChainA, 10, 60*time.Second) + tr.waitBlocks(action.ChainA, 1, 30*time.Second) tr.waitBlocks(action.ChainB, 1, 30*time.Second) } @@ -1333,8 +1333,7 @@ func (tr TestConfig) relayPacketsHermes( target ExecutionTarget, verbose bool, ) { - // FIXME: ... can we retrieve the blocksperepoch ... - //tr.waitBlocks(action.ChainA, 10, 60*time.Second) + tr.waitBlocks(action.ChainA, 2, time.Minute) // hermes clear packets ibc0 transfer channel-13 cmd := target.ExecCommand("hermes", "clear", "packets", @@ -1351,7 +1350,6 @@ func (tr TestConfig) relayPacketsHermes( log.Fatal(err, "\n", string(bz)) } - //tr.waitBlocks(action.ChainA, 10, 60*time.Second) tr.waitBlocks(action.ChainA, 1, 30*time.Second) tr.waitBlocks(action.ChainB, 1, 30*time.Second) } @@ -1426,7 +1424,6 @@ func (tr TestConfig) delegateTokens( } // wait for inclusion in a block -> '--broadcast-mode block' is deprecated - tr.waitBlocks(action.Chain, 10, 60*time.Second) tr.waitBlocks(action.Chain, 2, 10*time.Second) } @@ -1479,7 +1476,6 @@ func (tr TestConfig) unbondTokens( } // wait for inclusion in a block -> '--broadcast-mode block' is deprecated - tr.waitBlocks(action.Chain, 10, 60*time.Second) tr.waitBlocks(action.Chain, 2, 20*time.Second) } @@ -1621,7 +1617,6 @@ func (tr TestConfig) redelegateTokens(action RedelegateTokensAction, target Exec } // wait for inclusion in a block -> '--broadcast-mode block' is deprecated - tr.waitBlocks(action.Chain, 10, 60*time.Second) tr.waitBlocks(action.Chain, 2, 10*time.Second) } diff --git a/tests/e2e/config.go b/tests/e2e/config.go index 50398a703b..e4744e1256 100644 --- a/tests/e2e/config.go +++ b/tests/e2e/config.go @@ -241,7 +241,7 @@ func SlashThrottleTestConfig() TestConfig { ".app_state.slashing.params.slash_fraction_downtime = \"0.010000000000000000\" | " + ".app_state.provider.params.slash_meter_replenish_fraction = \"0.10\" | " + ".app_state.provider.params.slash_meter_replenish_period = \"20s\" | " + - ".app_state.provider.params.blocks_per_epoch = 10", + ".app_state.provider.params.blocks_per_epoch = 2", }, ChainID("consu"): { ChainId: ChainID("consu"), @@ -290,7 +290,7 @@ func DefaultTestConfig() TestConfig { ".app_state.slashing.params.slash_fraction_downtime = \"0.010000000000000000\" | " + ".app_state.provider.params.slash_meter_replenish_fraction = \"1.0\" | " + // This disables slash packet throttling ".app_state.provider.params.slash_meter_replenish_period = \"3s\" | " + - ".app_state.provider.params.blocks_per_epoch = 10", + ".app_state.provider.params.blocks_per_epoch = 2", }, ChainID("consu"): { ChainId: ChainID("consu"), @@ -320,7 +320,7 @@ func DemocracyTestConfig(allowReward bool) TestConfig { ".app_state.slashing.params.downtime_jail_duration = \"60s\" | " + ".app_state.slashing.params.slash_fraction_downtime = \"0.010000000000000000\" | " + ".app_state.transfer.params.send_enabled = false | " + - ".app_state.provider.params.blocks_per_epoch = 10" + ".app_state.provider.params.blocks_per_epoch = 2" if allowReward { // This allows the consumer chain to send rewards in the stake denom @@ -351,7 +351,7 @@ func DemocracyTestConfig(allowReward bool) TestConfig { ".app_state.slashing.params.downtime_jail_duration = \"60s\" | " + ".app_state.slashing.params.slash_fraction_downtime = \"0.010000000000000000\" | " + ".app_state.provider.params.slash_meter_replenish_fraction = \"1.0\" | " + // This disables slash packet throttling - ".app_state.provider.params.blocks_per_epoch = 10", + ".app_state.provider.params.blocks_per_epoch = 2", }, ChainID("democ"): { ChainId: ChainID("democ"), @@ -394,7 +394,7 @@ func MultiConsumerTestConfig() TestConfig { ".app_state.slashing.params.downtime_jail_duration = \"60s\" | " + ".app_state.slashing.params.slash_fraction_downtime = \"0.010000000000000000\" | " + ".app_state.provider.params.slash_meter_replenish_fraction = \"1.0\" | " + // This disables slash packet throttling - ".app_state.provider.params.blocks_per_epoch = 10", + ".app_state.provider.params.blocks_per_epoch = 2", }, ChainID("consu"): { ChainId: ChainID("consu"), @@ -454,7 +454,7 @@ func ChangeoverTestConfig() TestConfig { ".app_state.slashing.params.slash_fraction_downtime = \"0.010000000000000000\" | " + ".app_state.provider.params.slash_meter_replenish_fraction = \"1.0\" | " + // This disables slash packet throttling ".app_state.provider.params.slash_meter_replenish_period = \"3s\" | " + - ".app_state.provider.params.blocks_per_epoch = 10", + ".app_state.provider.params.blocks_per_epoch = 2", }, ChainID("sover"): { ChainId: ChainID("sover"), @@ -555,7 +555,7 @@ func ConsumerMisbehaviourTestConfig() TestConfig { ".app_state.slashing.params.slash_fraction_downtime = \"0.010000000000000000\" | " + ".app_state.provider.params.slash_meter_replenish_fraction = \"1.0\" | " + // This disables slash packet throttling ".app_state.provider.params.slash_meter_replenish_period = \"3s\" | " + - ".app_state.provider.params.blocks_per_epoch = 10", + ".app_state.provider.params.blocks_per_epoch = 2", }, ChainID("consu"): { ChainId: ChainID("consu"), diff --git a/x/ccv/provider/keeper/relay.go b/x/ccv/provider/keeper/relay.go index 36c948585f..14e71bf4f5 100644 --- a/x/ccv/provider/keeper/relay.go +++ b/x/ccv/provider/keeper/relay.go @@ -148,7 +148,7 @@ func (k Keeper) EndBlockVSU(ctx sdk.Context) { // notify the staking module to complete all matured unbonding ops k.completeMaturedUnbondingOps(ctx) - if uint64(ctx.BlockHeight())%10 == 0 { //k.GetBlocksPerEpoch(ctx) == 0 { + if uint64(ctx.BlockHeight())%2 == 0 { // k.GetBlocksPerEpoch(ctx) == 0 { // collect validator updates k.QueueVSCPackets(ctx) From 076ec8b7b78053d0603789d0ceef6d5b267e7716 Mon Sep 17 00:00:00 2001 From: insumity Date: Fri, 23 Feb 2024 15:09:49 +0100 Subject: [PATCH 13/46] clean up --- tests/integration/key_assignment.go | 10 ---------- x/ccv/provider/keeper/relay.go | 2 +- 2 files changed, 1 insertion(+), 11 deletions(-) diff --git a/tests/integration/key_assignment.go b/tests/integration/key_assignment.go index 23516056db..9b6511fbda 100644 --- a/tests/integration/key_assignment.go +++ b/tests/integration/key_assignment.go @@ -31,7 +31,6 @@ func (s *CCVTestSuite) TestKeyAssignment() { // check that a VSCPacket is queued nextBlocks(s.providerChain, providerkeeper.BlocksPerEpoch) - //s.providerChain.NextBlock() pendingPackets := pk.GetPendingVSCPackets(s.providerCtx(), s.consumerChain.ChainID) s.Require().Len(pendingPackets, 1) @@ -53,8 +52,6 @@ func (s *CCVTestSuite) TestKeyAssignment() { return err } nextBlocks(s.providerChain, providerkeeper.BlocksPerEpoch) - // - //s.providerChain.NextBlock() return nil }, false, 2, @@ -76,7 +73,6 @@ func (s *CCVTestSuite) TestKeyAssignment() { delAddr := s.providerChain.SenderAccount.GetAddress() delegate(s, delAddr, bondAmt) - //s.providerChain.NextBlock() nextBlocks(s.providerChain, providerkeeper.BlocksPerEpoch) return nil @@ -99,7 +95,6 @@ func (s *CCVTestSuite) TestKeyAssignment() { if err != nil { return err } - //s.providerChain.NextBlock() nextBlocks(s.providerChain, providerkeeper.BlocksPerEpoch) return nil @@ -123,7 +118,6 @@ func (s *CCVTestSuite) TestKeyAssignment() { if err != nil { return err } - //s.providerChain.NextBlock() nextBlocks(s.providerChain, providerkeeper.BlocksPerEpoch) return nil @@ -141,14 +135,12 @@ func (s *CCVTestSuite) TestKeyAssignment() { return err } nextBlocks(s.providerChain, providerkeeper.BlocksPerEpoch) - //s.providerChain.NextBlock() // same key assignment err = pk.AssignConsumerKey(s.providerCtx(), s.consumerChain.ChainID, validator, consumerKey) if err != nil { return err } - //s.providerChain.NextBlock() nextBlocks(s.providerChain, providerkeeper.BlocksPerEpoch) return nil @@ -165,7 +157,6 @@ func (s *CCVTestSuite) TestKeyAssignment() { if err != nil { return err } - //s.providerChain.NextBlock() nextBlocks(s.providerChain, providerkeeper.BlocksPerEpoch) // same key assignment @@ -174,7 +165,6 @@ func (s *CCVTestSuite) TestKeyAssignment() { if err != nil { return err } - //s.providerChain.NextBlock() nextBlocks(s.providerChain, providerkeeper.BlocksPerEpoch) return nil diff --git a/x/ccv/provider/keeper/relay.go b/x/ccv/provider/keeper/relay.go index 14e71bf4f5..df399cb44f 100644 --- a/x/ccv/provider/keeper/relay.go +++ b/x/ccv/provider/keeper/relay.go @@ -148,7 +148,7 @@ func (k Keeper) EndBlockVSU(ctx sdk.Context) { // notify the staking module to complete all matured unbonding ops k.completeMaturedUnbondingOps(ctx) - if uint64(ctx.BlockHeight())%2 == 0 { // k.GetBlocksPerEpoch(ctx) == 0 { + if uint64(ctx.BlockHeight())%k.GetBlocksPerEpoch(ctx) == 0 { // collect validator updates k.QueueVSCPackets(ctx) From a56b6e0b323183e31b181929d11224d502297518 Mon Sep 17 00:00:00 2001 From: insumity Date: Fri, 23 Feb 2024 15:34:11 +0100 Subject: [PATCH 14/46] mbt fix --- tests/mbt/driver/mbt_test.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/mbt/driver/mbt_test.go b/tests/mbt/driver/mbt_test.go index d173a48040..77a9c40d36 100644 --- a/tests/mbt/driver/mbt_test.go +++ b/tests/mbt/driver/mbt_test.go @@ -242,14 +242,14 @@ func RunItfTrace(t *testing.T, path string) { // so we do one time advancement with a very small increment, // and then increment the rest of the time runningConsumersBefore := driver.runningConsumers() - for _, consumer := range driver.runningConsumers() { - UpdateProviderClientOnConsumer(t, driver, consumer.ChainId) - } - blocksPerEpoch := driver.providerKeeper().GetBlocksPerEpoch(driver.providerCtx()) for i := uint64(0); i < blocksPerEpoch; i = i + 1 { driver.endAndBeginBlock("provider", 1*time.Nanosecond) } + for _, consumer := range driver.runningConsumers() { + UpdateProviderClientOnConsumer(t, driver, consumer.ChainId) + } + driver.endAndBeginBlock("provider", time.Duration(timeAdvancement)*time.Second-time.Nanosecond*time.Duration(blocksPerEpoch)) runningConsumersAfter := driver.runningConsumers() From 36afb40b216888705bf3ab5c4707942ebd5a3758 Mon Sep 17 00:00:00 2001 From: insumity Date: Mon, 26 Feb 2024 15:09:59 +0100 Subject: [PATCH 15/46] fix diff bug --- tests/e2e/actions.go | 4 ++-- tests/e2e/config.go | 14 +++++++------- x/ccv/provider/keeper/relay.go | 9 +-------- x/ccv/provider/keeper/validator_set_update.go | 18 ++++++++++++------ 4 files changed, 22 insertions(+), 23 deletions(-) diff --git a/tests/e2e/actions.go b/tests/e2e/actions.go index 9780a6aa34..b08ce20dfd 100644 --- a/tests/e2e/actions.go +++ b/tests/e2e/actions.go @@ -1307,7 +1307,7 @@ func (tr TestConfig) relayPacketsGorelayer( target ExecutionTarget, verbose bool, ) { - tr.waitBlocks(action.ChainA, 2, time.Minute) + tr.waitBlocks(action.ChainA, 3, 90*time.Second) pathName := tr.GetPathNameForGorelayer(action.ChainA, action.ChainB) @@ -1333,7 +1333,7 @@ func (tr TestConfig) relayPacketsHermes( target ExecutionTarget, verbose bool, ) { - tr.waitBlocks(action.ChainA, 2, time.Minute) + tr.waitBlocks(action.ChainA, 3, 90*time.Second) // hermes clear packets ibc0 transfer channel-13 cmd := target.ExecCommand("hermes", "clear", "packets", diff --git a/tests/e2e/config.go b/tests/e2e/config.go index e4744e1256..fe26c6f3d2 100644 --- a/tests/e2e/config.go +++ b/tests/e2e/config.go @@ -241,7 +241,7 @@ func SlashThrottleTestConfig() TestConfig { ".app_state.slashing.params.slash_fraction_downtime = \"0.010000000000000000\" | " + ".app_state.provider.params.slash_meter_replenish_fraction = \"0.10\" | " + ".app_state.provider.params.slash_meter_replenish_period = \"20s\" | " + - ".app_state.provider.params.blocks_per_epoch = 2", + ".app_state.provider.params.blocks_per_epoch = 3", }, ChainID("consu"): { ChainId: ChainID("consu"), @@ -290,7 +290,7 @@ func DefaultTestConfig() TestConfig { ".app_state.slashing.params.slash_fraction_downtime = \"0.010000000000000000\" | " + ".app_state.provider.params.slash_meter_replenish_fraction = \"1.0\" | " + // This disables slash packet throttling ".app_state.provider.params.slash_meter_replenish_period = \"3s\" | " + - ".app_state.provider.params.blocks_per_epoch = 2", + ".app_state.provider.params.blocks_per_epoch = 3", }, ChainID("consu"): { ChainId: ChainID("consu"), @@ -320,7 +320,7 @@ func DemocracyTestConfig(allowReward bool) TestConfig { ".app_state.slashing.params.downtime_jail_duration = \"60s\" | " + ".app_state.slashing.params.slash_fraction_downtime = \"0.010000000000000000\" | " + ".app_state.transfer.params.send_enabled = false | " + - ".app_state.provider.params.blocks_per_epoch = 2" + ".app_state.provider.params.blocks_per_epoch = 3" if allowReward { // This allows the consumer chain to send rewards in the stake denom @@ -351,7 +351,7 @@ func DemocracyTestConfig(allowReward bool) TestConfig { ".app_state.slashing.params.downtime_jail_duration = \"60s\" | " + ".app_state.slashing.params.slash_fraction_downtime = \"0.010000000000000000\" | " + ".app_state.provider.params.slash_meter_replenish_fraction = \"1.0\" | " + // This disables slash packet throttling - ".app_state.provider.params.blocks_per_epoch = 2", + ".app_state.provider.params.blocks_per_epoch = 3", }, ChainID("democ"): { ChainId: ChainID("democ"), @@ -394,7 +394,7 @@ func MultiConsumerTestConfig() TestConfig { ".app_state.slashing.params.downtime_jail_duration = \"60s\" | " + ".app_state.slashing.params.slash_fraction_downtime = \"0.010000000000000000\" | " + ".app_state.provider.params.slash_meter_replenish_fraction = \"1.0\" | " + // This disables slash packet throttling - ".app_state.provider.params.blocks_per_epoch = 2", + ".app_state.provider.params.blocks_per_epoch = 3", }, ChainID("consu"): { ChainId: ChainID("consu"), @@ -454,7 +454,7 @@ func ChangeoverTestConfig() TestConfig { ".app_state.slashing.params.slash_fraction_downtime = \"0.010000000000000000\" | " + ".app_state.provider.params.slash_meter_replenish_fraction = \"1.0\" | " + // This disables slash packet throttling ".app_state.provider.params.slash_meter_replenish_period = \"3s\" | " + - ".app_state.provider.params.blocks_per_epoch = 2", + ".app_state.provider.params.blocks_per_epoch = 3", }, ChainID("sover"): { ChainId: ChainID("sover"), @@ -555,7 +555,7 @@ func ConsumerMisbehaviourTestConfig() TestConfig { ".app_state.slashing.params.slash_fraction_downtime = \"0.010000000000000000\" | " + ".app_state.provider.params.slash_meter_replenish_fraction = \"1.0\" | " + // This disables slash packet throttling ".app_state.provider.params.slash_meter_replenish_period = \"3s\" | " + - ".app_state.provider.params.blocks_per_epoch = 2", + ".app_state.provider.params.blocks_per_epoch = 3", }, ChainID("consu"): { ChainId: ChainID("consu"), diff --git a/x/ccv/provider/keeper/relay.go b/x/ccv/provider/keeper/relay.go index df399cb44f..18b3e62be2 100644 --- a/x/ccv/provider/keeper/relay.go +++ b/x/ccv/provider/keeper/relay.go @@ -220,19 +220,12 @@ func (k Keeper) QueueVSCPackets(ctx sdk.Context) { // FIXME comments bondedValidators := k.stakingKeeper.GetLastValidators(ctx) - //stakingUpdates := k.stakingKeeper.GetValidatorUpdates(ctx) - for _, chain := range k.GetAllConsumerChains(ctx) { currentEpochValidators := k.GetAllEpochValidators(ctx, chain.ChainId) nextEpochValidators := k.ComputeNextEpochValidators(ctx, chain.ChainId, currentEpochValidators, bondedValidators) - valUpdates := k.diff(currentEpochValidators, nextEpochValidators) + valUpdates := Diff(currentEpochValidators, nextEpochValidators) k.ResetCurrentEpochValidators(ctx, chain.ChainId, nextEpochValidators) - //valUpdatesFoor := k.MustApplyKeyAssignmentToValUpdates(ctx, chain.ChainId, stakingUpdates) - //if len(valUpdates) != len(valUpdatesFoor) { - // fmt.Println("...XXX...") - //} - // check whether there are changes in the validator set; // note that this also entails unbonding operations // w/o changes in the voting power of the validators in the validator set diff --git a/x/ccv/provider/keeper/validator_set_update.go b/x/ccv/provider/keeper/validator_set_update.go index b90d4737e8..7b018e4c28 100644 --- a/x/ccv/provider/keeper/validator_set_update.go +++ b/x/ccv/provider/keeper/validator_set_update.go @@ -113,10 +113,15 @@ func (k Keeper) ComputeNextEpochValidators( } nextConsumerPublicKey, found := k.GetValidatorConsumerPubKey(ctx, chainID, types.NewProviderConsAddress(consAddr)) if !found { - k.Logger(ctx).Error("could not retrieve public key for validator (%+v)", val) + // TODO: vale message oti den exei ginei assigned consumer key + k.Logger(ctx).Info("could not retrieve public key for validator (%+v)", val) // if no consumer key assigned then use the validator's key itself nextConsumerPublicKey, err = val.TmConsPublicKey() } + if nextConsumerPublicKey.Sum == nil || nextConsumerPublicKey.Size() == 0 { + k.Logger(ctx).Error("THE SUM IS NIL ....") + } + nextConsumerPublicKeyBytes, err := nextConsumerPublicKey.Marshal() if err != nil { // this should never happen but is recoverable if we exclude this validator from the `nextValidators` @@ -142,8 +147,9 @@ func (k Keeper) ComputeNextEpochValidators( return nextValidators } -// diff compares two validator sets and return sthe diff -func (k Keeper) diff( +// Diff compares two validator sets and return sthe Diff +// keeper ... FIXME not neeeded +func Diff( currentValidators []types.EpochValidator, nextValidators []types.EpochValidator) []abci.ValidatorUpdate { var updates []abci.ValidatorUpdate @@ -190,16 +196,16 @@ func (k Keeper) diff( // validators to be added for _, val := range nextValidators { - if nextVal, found := isCurrentValidator[string(val.ProviderConsAddr)]; !found { + if _, found := isCurrentValidator[string(val.ProviderConsAddr)]; !found { var nextPublicKey crypto.PublicKey - err := nextPublicKey.Unmarshal(nextVal.ConsumerPublicKey) + err := nextPublicKey.Unmarshal(val.ConsumerPublicKey) if err != nil { // this should never happen and is not recoverable because without the public key // we cannot generate a validator update panic(fmt.Errorf("could not unmarshall validator's (%+v) public key: %w", val, err)) } - updates = append(updates, abci.ValidatorUpdate{PubKey: nextPublicKey, Power: nextVal.Power}) + updates = append(updates, abci.ValidatorUpdate{PubKey: nextPublicKey, Power: val.Power}) } } From 481fd886cb153a6520828cb007d19591d7be06db Mon Sep 17 00:00:00 2001 From: insumity Date: Mon, 26 Feb 2024 15:57:39 +0100 Subject: [PATCH 16/46] cleaning up --- .changelog/epilogue.md | 198 ++++++++++++++++++++++++++++++++- x/ccv/provider/keeper/relay.go | 1 + 2 files changed, 197 insertions(+), 2 deletions(-) diff --git a/.changelog/epilogue.md b/.changelog/epilogue.md index 15e2568e25..88987ef0a0 100644 --- a/.changelog/epilogue.md +++ b/.changelog/epilogue.md @@ -1,3 +1,197 @@ -## Previous Versions +## v3.1.0 -[CHANGELOG of previous versions](https://github.com/cosmos/interchain-security/blob/main/CHANGELOG.md) \ No newline at end of file +Date July 11th, 2023 + +A minor upgrade to v3.0.0, which removes the panic in the consumer ccv module which would occur in an emergency scenario where the ccv channel is closed. This release also fixes how a distribution related event is emitted, and bumps cometbft. + +* (feat) [#1127](https://github.com/cosmos/interchain-security/pull/1127) Remove consumer panic when ccv channel is closed +* (fix) [#720](https://github.com/cosmos/interchain-security/issues/720) Fix the attribute `AttributeDistributionTotal` value in `FeeDistribution` event emit. +* (deps) [#1119](https://github.com/cosmos/interchain-security/pull/1119) bump cometbft from `v0.37.1` to `0.37.2`. + +## v3.0.0 + +Date: June 21st, 2023 + +Interchain Security v3 uses SDK 0.47 and IBC 7. + +* (fix) [#1093](https://github.com/cosmos/interchain-security/pull/1093) Make SlashPacketData backward compatible when sending data over the wire +* (deps) [#1019](https://github.com/cosmos/interchain-security/pull/1019) Bump multiple dependencies. + * Bump [cosmos-sdk](https://github.com/cosmos/cosmos-sdk) to [v0.47.3](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.47.3). + * Bump [ibc-go](https://github.com/cosmos/ibc-go) to [v7.1.0](https://github.com/cosmos/ibc-go/releases/tag/v7.1.0). + * Bump [CometBFT](https://github.com/cometbft/cometbft) to [v0.37.1](https://github.com/cometbft/cometbft/releases/tag/v0.37.1). +* `[x/ccv/provider]` (fix) [#945](https://github.com/cosmos/interchain-security/issues/945) Refactor `AfterUnbondingInitiated` to not panic when `PutUnbondingOnHold` returns error. +* `[x/ccv/provider]` (fix) [#977](https://github.com/cosmos/interchain-security/pull/977) Avoids panicking the provider when an unbonding delegation was removed through a `CancelUnbondingDelegation` message. +* `[x/ccv/democracy]` (feat) [#1019](https://github.com/cosmos/interchain-security/pull/1019) Whitelisting non-legacy params in the "democracy module" require the entire module to be whitelisted. + +## v2.4.0-lsm + +*November 20, 2023* + +* (fix) [#1439](https://github.com/cosmos/interchain-security/pull/1439) Fix unmarshaling for the CLI consumer double vote cmd. +* (feat!) [#1435](https://github.com/cosmos/interchain-security/pull/1435) Add height-base filter for consumer equivocation evidence. + +## v2.3.0-provider-lsm + +*November 15, 2023* + +❗ *This release is deprecated and should not be used in production.* + +* (fix!) [#1422](https://github.com/cosmos/interchain-security/pull/1422) Fix the misbehaviour handling by verifying the signatures of byzantine validators. + +## v2.2.0-provider-lsm + +❗ *This release is deprecated and should not be used in production.* + +### Cryptographic verification of equivocation +* New feature enabling the provider chain to verify equivocation evidence on its own instead of trusting consumer chains, see [EPIC](https://github.com/cosmos/interchain-security/issues/732). + +## v2.1.0-provider-lsm + +Date: September 15th, 2023 + +* (feature!) [#1280](https://github.com/cosmos/interchain-security/pull/1280) provider proposal for changing reward denoms + +## v2.0.0-lsm + +Date: August 18th, 2023 + +* (deps!) [#1120](https://github.com/cosmos/interchain-security/pull/1120) Bump [Cosmos SDK](https://github.com/cosmos/cosmos-sdk) to [v0.45.16-ics-lsm](https://github.com/cosmos/cosmos-sdk/tree/v0.45.16-ics-lsm). This requires adapting ICS to support this SDK release. Changes are state breaking. +* (fix) [#720](https://github.com/cosmos/interchain-security/issues/720) Fix the attribute `AttributeDistributionTotal` value in `FeeDistribution` event emit. + +## v2.0.0 + +Date: June 1st, 2023 + +Unlike prior releases, the ICS `v2.0.0` release will be based on the main branch. `v2.0.0` will contain all the accumulated PRs from the various releases below, along with other PRs that were merged, but not released to production. After `v2.0.0`, we plan to revamp release practices, and how we modularize the repo for consumer/provider. + +Upgrading a provider from `v1.1.0-multiden` to `v2.0.0` will require state migrations. See [migration.go](https://github.com/cosmos/interchain-security/blob/v2.0.0/x/ccv/provider/keeper/migration.go). + +Upgrading a consumer from `v1.2.0-multiden` to `v2.0.0` will NOT require state migrations. + +Some PRs from v2.0.0 may reappear from other releases below. This is due to the fact that ICS v1.1.0 deviates from the commit ordering of the main branch, and other releases thereafter are based on v1.1.0. + +### High level changes included in v2.0.0 + +* MVP for standalone to consumer changeover, see [EPIC](https://github.com/cosmos/interchain-security/issues/756) +* MVP for soft opt out, see [EPIC](https://github.com/cosmos/interchain-security/issues/851) +* Various fixes, critical and non-critical +* Docs updates which should not affect production code + +## Notable PRs included in v2.0.0 + +* (feat!) Add DistributionTransmissionChannel to ConsumerAdditionProposal [#965](https://github.com/cosmos/interchain-security/pull/965) +* (feat/fix) limit vsc matured packets handled per endblocker [#1004](https://github.com/cosmos/interchain-security/pull/1004) +* (fix) consumer key prefix order to avoid complex migrations [#963](https://github.com/cosmos/interchain-security/pull/963) and [#991](https://github.com/cosmos/interchain-security/pull/991). The latter PR is the proper fix. +* (feat) v1->v2 migrations to accommodate a bugfix having to do with store keys, introduce new params, and deal with consumer genesis state schema changes [#975](https://github.com/cosmos/interchain-security/pull/975) and [#997](https://github.com/cosmos/interchain-security/pull/997) +* (deps) Bump github.com/cosmos/ibc-go/v4 from 4.4.0 to 4.4.2 [#982](https://github.com/cosmos/interchain-security/pull/982) +* (fix) partially revert key assignment type safety PR [#980](https://github.com/cosmos/interchain-security/pull/980) +* (fix) Remove panics on failure to send IBC packets [#876](https://github.com/cosmos/interchain-security/pull/876) +* (fix) Prevent denom DOS [#931](https://github.com/cosmos/interchain-security/pull/931) +* (fix) multisig for assigning consumer key, use json [#916](https://github.com/cosmos/interchain-security/pull/916) +* (deps) Bump github.com/cosmos/ibc-go/v4 from 4.3.0 to 4.4.0 [#902](https://github.com/cosmos/interchain-security/pull/902) +* (feat) Add warnings when provider unbonding is shorter than consumer unbonding [#858](https://github.com/cosmos/interchain-security/pull/858) +* (chore) use go 1.19 [#899](https://github.com/cosmos/interchain-security/pull/899), [#840](https://github.com/cosmos/interchain-security/pull/840) +* (feat) Standalone to consumer changeover - recycle existing transfer channel [#832](https://github.com/cosmos/interchain-security/pull/832) +* (deps) Bump IBC [862](https://github.com/cosmos/interchain-security/pull/862) +* (testing) Add tests for soft opt out [#857](https://github.com/cosmos/interchain-security/pull/857) +* (feat) Standalone to consumer changeover - staking functionalities [#794](https://github.com/cosmos/interchain-security/pull/794) +* (fix) prevent provider from sending VSCPackets with multiple updates for the same validator [#850](https://github.com/cosmos/interchain-security/pull/850) +* (feat) Soft opt out [#833](https://github.com/cosmos/interchain-security/issues/833) +* (fix) Correctly handle VSC packet with duplicate val updates on consumer [#846](https://github.com/cosmos/interchain-security/pull/846) +* (deps) bump sdk to v0.45.15.ics [#805](https://github.com/cosmos/interchain-security/pull/805) +* (refactor) Remove spm module [#812](https://github.com/cosmos/interchain-security/pull/812) +* (feat) Standalone to consumer changeover part 1 [#757](https://github.com/cosmos/interchain-security/pull/757) +* (chore) Swap names of e2e and integration tests [#681](https://github.com/cosmos/interchain-security/pull/681) +* (fix) fix StopConsumerChain not running in cachedContext [#802](https://github.com/cosmos/interchain-security/pull/802). Also in earlier releases with different commit order! +* (docs) Introduce docs website [#759](https://github.com/cosmos/interchain-security/pull/759) +* (fix) Serialize correct byte prefix for SlashLogKey [#786](https://github.com/cosmos/interchain-security/pull/786) +* (feature) Improve keeper field validation [#766](https://github.com/cosmos/interchain-security/pull/766) +* (docs) Contributing guidelines [#744](https://github.com/cosmos/interchain-security/pull/744) +* (refactor) Key assignment type safety [#725](https://github.com/cosmos/interchain-security/pull/725) +* (fix) Update protos and fix deps [#752](https://github.com/cosmos/interchain-security/pull/752) +* (api) Add consumer QueryParams [#746](https://github.com/cosmos/interchain-security/pull/746) +* (feature) New validation for keeper fields [#740](https://github.com/cosmos/interchain-security/pull/740) + +## v1.2.0-multiden + +The first release candidate for a fix built on top of v1.2.0, intended for consumers. This release adds a list of denoms on the consumer that are allowed to be sent to the provider as rewards. This prevents a potential DOS attack that was discovered during the audit of Replicated Security performed by Oak Security and funded by the Cosmos Hub community through Proposal 687. In an effort to move quickly, this release also includes a multisig fix that is effective only for provider. It shouldn't affect the consumer module. + +Note PRs were made in a private security repo. + +[full diff](https://github.com/cosmos/interchain-security/compare/v1.2.0...v1.2.0-multiden-rc0) + +## v1.1.0-multiden + +This release combines two fixes on top of v1.1.0, that we judged were urgent to get onto the Cosmos Hub before the launch of the first ICS consumer chain. This is an emergency release intended for providers. + +The first fix is to enable the use of multisigs and Ledger devices when assigning keys for consumer chains. The second is to prevent a possible DOS vector involving the reward distribution system. + +Note PRs were made in a private security repo. + +[full diff](https://github.com/cosmos/interchain-security/compare/v1.1.0...release/v1.1.0-multiden) + +### Multisig fix + +On April 25th (a week and a half ago), we began receiving reports that validators using multisigs and Ledger devices were getting errors reading Error: unable to resolve type URL /interchain_security.ccv.provider.v1.MsgAssignConsumerKey: tx parse error when attempting to assign consensus keys for consumer chains. + +We quickly narrowed the problem down to issues having to do with using the PubKey type directly in the MsgAssignConsumerKey transaction, and Amino (a deprecated serialization library still used in Ledger devices and multisigs) not being able to handle this. We attempted to fix this with the assistance of the Cosmos-SDK team, but after making no headway for a few days, we decided to simply use a JSON representation of the PubKey in the transaction. This is how it is usually represented anyway. We have verified that this fixes the problem. + +### Distribution fix + +The ICS distribution system works by allowing consumer chains to send rewards to a module address on the provider called the FeePoolAddress. From here they are automatically distributed to all validators and delegators through the distribution system that already exists to distribute staking rewards. The FeePoolAddress is usually blocked so that no tokens can be sent to it, but to enable ICS distribution we had to unblock it. + +We recently realized that unblocking the FeePoolAddress could enable an attacker to send a huge number of different denoms into the distribution system. The distribution system would then attempt to distribute them all, leading to out of memory errors. Fixing a similar attack vector that existed in the distribution system before ICS led us to this realization. + +To fix this problem, we have re-blocked the FeePoolAddress and created a new address called the ConsumerRewardsPool. Consumer chains now send rewards to this new address. There is also a new transaction type called RegisterConsumerRewardDenom. This transaction allows people to register denoms to be used as rewards from consumer chains. It costs 10 Atoms to run this transaction.The Atoms are transferred to the community pool. Only denoms registered with this command are then transferred to the FeePoolAddress and distributed out to delegators and validators. + +## v1.2.1 + +* (fix) Remove SPM [#812](https://github.com/cosmos/interchain-security/pull/812) +* (refactor) Key assignment type safety [#725](https://github.com/cosmos/interchain-security/pull/725) + +## v1.2.0 + +Date: April 13th, 2023 + +* (feat) Soft opt-out [#833](https://github.com/cosmos/interchain-security/pull/833) +* (fix) Correctly handle VSC packet with duplicate val updates on consumer [#846](https://github.com/cosmos/interchain-security/pull/846) +* (chore) bump: sdk v0.45.15-ics [#805](https://github.com/cosmos/interchain-security/pull/805) +* (api) add interchain security consumer QueryParams [#746](https://github.com/cosmos/interchain-security/pull/746) + +## v1.1.1 + +* (fix) Remove SPM [#812](https://github.com/cosmos/interchain-security/pull/812) +* (refactor) Key assignment type safety [#725](https://github.com/cosmos/interchain-security/pull/725) + +## v1.1.0 + +Date: March 24th, 2023 + +* (fix) StopConsumerChain not running in cachedContext [#802](https://github.com/cosmos/interchain-security/pull/802) + +## v1.0.0 + +Date: February 6th, 2023 + +This is the first version of Interchain Security (ICS), also known as _Replicated Security_ (RS). +Replicated Security is a feature which will allow a chain -- referred to as the _provider_ -- to share security with other chains -- referred to as _consumers_. +This means that the provider's validator set will be granted the right to validate consumer chains. +The communication between the provider and the consumer chains is done through the IBC protocol over a unique, ordered channel (one for each consumer chain). Thus, RS is an IBC application. + +### Features / sub-protocols + +RS consist of the following core features: + +- **Channel Initialization**: Enables the provider to add new consumer chains. This process is governance-gated, i.e., to add a new consumer chain, a `ConsumerAdditionProposal` governance proposal must be sent to the provider and it must receive the necessary votes. +- **Validator Set Update**: Enables the provider to + (1) update the consumers on the voting power granted to validators (based on the changes in the active validator set on the provider chain), + and (2) ensure the timely completion of unbonding operations (e.g., undelegations). +- **Consumer Initiated Slashing**: Enables the provider to jail validators for downtime infractions on the consumer chains. +- **Reward Distribution**: Enables the consumers to transfer to the provider (over IBC) a portion of their block rewards as payment for the security provided. Once transferred, these rewards are distributed on the provider using the protocol in the [distribution module of Cosmos SDK](https://docs.cosmos.network/v0.45/modules/distribution/). +- **Consumer Chain Removal**: Enables the provider to remove a consumer either after a `ConsumerRemovalProposal` passes governance or after one of the timeout periods elapses -- `InitTimeoutPeriod`, `VscTimeoutPeriod`, `IBCTimeoutPeriod`. +- **Social Slashing**: Equivocation offenses (double signing etc.) on consumer chains are logged, and then can be used in a governance proposal to slash the validators responsible. + +In addition, RS has the following features: + +- **Key Assignment**: Enables validator operators to use different consensus keys for each consumer chain validator node that they operate. +- **Jail Throttling**: Enables the provider to slow down a "worst case scenario" attack where a malicious consumer binary attempts to jail a significant amount (> 2/3) of the voting power, effectively taking control of the provider. \ No newline at end of file diff --git a/x/ccv/provider/keeper/relay.go b/x/ccv/provider/keeper/relay.go index 18b3e62be2..b6fbdaf3d3 100644 --- a/x/ccv/provider/keeper/relay.go +++ b/x/ccv/provider/keeper/relay.go @@ -149,6 +149,7 @@ func (k Keeper) EndBlockVSU(ctx sdk.Context) { k.completeMaturedUnbondingOps(ctx) if uint64(ctx.BlockHeight())%k.GetBlocksPerEpoch(ctx) == 0 { + k.Logger(ctx).Error(fmt.Sprintf("blocks per epoch:(%d)", k.GetBlocksPerEpoch(ctx))) // collect validator updates k.QueueVSCPackets(ctx) From 35385dd50fb806f5e47c7dc3d1849d8c1fc30ebd Mon Sep 17 00:00:00 2001 From: insumity Date: Mon, 26 Feb 2024 16:00:40 +0100 Subject: [PATCH 17/46] cleaning up --- .changelog/v3.2.0/bug-fixes/consumer/1146-pending-packets.md | 2 ++ .../v3.2.0/bug-fixes/consumer/1150-revert-wire-breaking.md | 2 ++ .../v3.2.0/bug-fixes/consumer/1244-validate-transfer.md | 2 ++ .changelog/v3.2.0/bug-fixes/consumer/1262-fee-pool-addr.md | 2 ++ .changelog/v3.2.0/bug-fixes/consumer/1295-migration.md | 2 ++ .changelog/v3.2.0/dependencies/1196-bump-ibc.md | 3 +++ .changelog/v3.2.0/dependencies/1258-bump-ibc.md | 3 +++ .changelog/v3.2.0/dependencies/1258-bump-sdk.md | 3 +++ .changelog/v3.2.0/dependencies/1259-bump-sdk.md | 3 +++ .../v3.2.0/features/consumer/1024-jail-throttling-v2.md | 2 ++ .../v3.2.0/features/consumer/1164-provider-info-query.md | 4 ++++ .changelog/v3.2.0/features/provider/1076-export-timestamps.md | 2 ++ .changelog/v3.2.0/features/provider/1280-reward-denoms.md | 3 +++ .changelog/v3.2.0/improvements/1244-consumer-unbonding.md | 2 ++ .../v3.2.0/improvements/consumer/1037-optimize-storage.md | 2 ++ .changelog/v3.2.0/state-breaking/1196-bump-ibc.md | 3 +++ .changelog/v3.2.0/state-breaking/1244-consumer-unbonding.md | 2 ++ .changelog/v3.2.0/state-breaking/1258-bump-ibc.md | 3 +++ .changelog/v3.2.0/state-breaking/1258-bump-sdk.md | 3 +++ .changelog/v3.2.0/state-breaking/1259-bump-sdk.md | 3 +++ .../v3.2.0/state-breaking/consumer/1024-jail-throttling-v2.md | 2 ++ 21 files changed, 53 insertions(+) create mode 100644 .changelog/v3.2.0/bug-fixes/consumer/1146-pending-packets.md create mode 100644 .changelog/v3.2.0/bug-fixes/consumer/1150-revert-wire-breaking.md create mode 100644 .changelog/v3.2.0/bug-fixes/consumer/1244-validate-transfer.md create mode 100644 .changelog/v3.2.0/bug-fixes/consumer/1262-fee-pool-addr.md create mode 100644 .changelog/v3.2.0/bug-fixes/consumer/1295-migration.md create mode 100644 .changelog/v3.2.0/dependencies/1196-bump-ibc.md create mode 100644 .changelog/v3.2.0/dependencies/1258-bump-ibc.md create mode 100644 .changelog/v3.2.0/dependencies/1258-bump-sdk.md create mode 100644 .changelog/v3.2.0/dependencies/1259-bump-sdk.md create mode 100644 .changelog/v3.2.0/features/consumer/1024-jail-throttling-v2.md create mode 100644 .changelog/v3.2.0/features/consumer/1164-provider-info-query.md create mode 100644 .changelog/v3.2.0/features/provider/1076-export-timestamps.md create mode 100644 .changelog/v3.2.0/features/provider/1280-reward-denoms.md create mode 100644 .changelog/v3.2.0/improvements/1244-consumer-unbonding.md create mode 100644 .changelog/v3.2.0/improvements/consumer/1037-optimize-storage.md create mode 100644 .changelog/v3.2.0/state-breaking/1196-bump-ibc.md create mode 100644 .changelog/v3.2.0/state-breaking/1244-consumer-unbonding.md create mode 100644 .changelog/v3.2.0/state-breaking/1258-bump-ibc.md create mode 100644 .changelog/v3.2.0/state-breaking/1258-bump-sdk.md create mode 100644 .changelog/v3.2.0/state-breaking/1259-bump-sdk.md create mode 100644 .changelog/v3.2.0/state-breaking/consumer/1024-jail-throttling-v2.md diff --git a/.changelog/v3.2.0/bug-fixes/consumer/1146-pending-packets.md b/.changelog/v3.2.0/bug-fixes/consumer/1146-pending-packets.md new file mode 100644 index 0000000000..0bab707fec --- /dev/null +++ b/.changelog/v3.2.0/bug-fixes/consumer/1146-pending-packets.md @@ -0,0 +1,2 @@ +- Fix deletion of pending packets that may cause duplicate sends + ([\#1146](https://github.com/cosmos/interchain-security/pull/1146)) \ No newline at end of file diff --git a/.changelog/v3.2.0/bug-fixes/consumer/1150-revert-wire-breaking.md b/.changelog/v3.2.0/bug-fixes/consumer/1150-revert-wire-breaking.md new file mode 100644 index 0000000000..067448e770 --- /dev/null +++ b/.changelog/v3.2.0/bug-fixes/consumer/1150-revert-wire-breaking.md @@ -0,0 +1,2 @@ +- Remove `idx` field from the `ccv.ConsumerPacketData` type as this would break the + wire ([\#1150](https://github.com/cosmos/interchain-security/pull/1150)) \ No newline at end of file diff --git a/.changelog/v3.2.0/bug-fixes/consumer/1244-validate-transfer.md b/.changelog/v3.2.0/bug-fixes/consumer/1244-validate-transfer.md new file mode 100644 index 0000000000..2d94c79c75 --- /dev/null +++ b/.changelog/v3.2.0/bug-fixes/consumer/1244-validate-transfer.md @@ -0,0 +1,2 @@ +- Validate token transfer messages before calling `Transfer()`. + ([\#1244](https://github.com/cosmos/interchain-security/pull/1244)) \ No newline at end of file diff --git a/.changelog/v3.2.0/bug-fixes/consumer/1262-fee-pool-addr.md b/.changelog/v3.2.0/bug-fixes/consumer/1262-fee-pool-addr.md new file mode 100644 index 0000000000..bbb54db2e3 --- /dev/null +++ b/.changelog/v3.2.0/bug-fixes/consumer/1262-fee-pool-addr.md @@ -0,0 +1,2 @@ +- Remove incorrect address validation on `ProviderFeePoolAddrStr` param. + ([\#1262](https://github.com/cosmos/interchain-security/pull/1262)) \ No newline at end of file diff --git a/.changelog/v3.2.0/bug-fixes/consumer/1295-migration.md b/.changelog/v3.2.0/bug-fixes/consumer/1295-migration.md new file mode 100644 index 0000000000..739b08dc39 --- /dev/null +++ b/.changelog/v3.2.0/bug-fixes/consumer/1295-migration.md @@ -0,0 +1,2 @@ +- Increment consumer consensus version and register consumer migration. + ([\#1295](https://github.com/cosmos/interchain-security/pull/1295)) \ No newline at end of file diff --git a/.changelog/v3.2.0/dependencies/1196-bump-ibc.md b/.changelog/v3.2.0/dependencies/1196-bump-ibc.md new file mode 100644 index 0000000000..fcf4450150 --- /dev/null +++ b/.changelog/v3.2.0/dependencies/1196-bump-ibc.md @@ -0,0 +1,3 @@ +- Bump [ibc-go](https://github.com/cosmos/ibc-go) to + [v7.2.0](https://github.com/cosmos/ibc-go/releases/tag/v7.2.0). + ([\#1196](https://github.com/cosmos/interchain-security/pull/1196)) \ No newline at end of file diff --git a/.changelog/v3.2.0/dependencies/1258-bump-ibc.md b/.changelog/v3.2.0/dependencies/1258-bump-ibc.md new file mode 100644 index 0000000000..68c6e2b104 --- /dev/null +++ b/.changelog/v3.2.0/dependencies/1258-bump-ibc.md @@ -0,0 +1,3 @@ +- Bump [ibc-go](https://github.com/cosmos/ibc-go) to + [v7.3.0](https://github.com/cosmos/ibc-go/releases/tag/v7.3.0). + ([\#1258](https://github.com/cosmos/interchain-security/pull/1258)) \ No newline at end of file diff --git a/.changelog/v3.2.0/dependencies/1258-bump-sdk.md b/.changelog/v3.2.0/dependencies/1258-bump-sdk.md new file mode 100644 index 0000000000..7344fac97e --- /dev/null +++ b/.changelog/v3.2.0/dependencies/1258-bump-sdk.md @@ -0,0 +1,3 @@ +- Bump [cosmos-sdk](https://github.com/cosmos/cosmos-sdk) to + [v0.47.4](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.47.4). + ([\#1258](https://github.com/cosmos/interchain-security/pull/1258)) \ No newline at end of file diff --git a/.changelog/v3.2.0/dependencies/1259-bump-sdk.md b/.changelog/v3.2.0/dependencies/1259-bump-sdk.md new file mode 100644 index 0000000000..247c623b7d --- /dev/null +++ b/.changelog/v3.2.0/dependencies/1259-bump-sdk.md @@ -0,0 +1,3 @@ +- Bump [cosmos-sdk](https://github.com/cosmos/cosmos-sdk) to + [v0.47.5](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.47.5). + ([\#1259](https://github.com/cosmos/interchain-security/pull/1259)) \ No newline at end of file diff --git a/.changelog/v3.2.0/features/consumer/1024-jail-throttling-v2.md b/.changelog/v3.2.0/features/consumer/1024-jail-throttling-v2.md new file mode 100644 index 0000000000..7570facb34 --- /dev/null +++ b/.changelog/v3.2.0/features/consumer/1024-jail-throttling-v2.md @@ -0,0 +1,2 @@ +- Add the consumer-side changes for jail throttling with retries (cf. ADR 008). + ([\#1024](https://github.com/cosmos/interchain-security/pull/1024)) \ No newline at end of file diff --git a/.changelog/v3.2.0/features/consumer/1164-provider-info-query.md b/.changelog/v3.2.0/features/consumer/1164-provider-info-query.md new file mode 100644 index 0000000000..fc1d27b964 --- /dev/null +++ b/.changelog/v3.2.0/features/consumer/1164-provider-info-query.md @@ -0,0 +1,4 @@ +- Introduce the gRPC query `/interchain_security/ccv/consumer/provider- + info` and CLI command `interchain-security-cd q ccvconsumer + provider-info` to retrieve provider info from the consumer chain. + ([\#1164](https://github.com/cosmos/interchain-security/pull/1164)) \ No newline at end of file diff --git a/.changelog/v3.2.0/features/provider/1076-export-timestamps.md b/.changelog/v3.2.0/features/provider/1076-export-timestamps.md new file mode 100644 index 0000000000..f2a8608f8b --- /dev/null +++ b/.changelog/v3.2.0/features/provider/1076-export-timestamps.md @@ -0,0 +1,2 @@ +- Add `InitTimeoutTimestamps` and `ExportedVscSendTimestamps` to exported + genesis. ([\#1076](https://github.com/cosmos/interchain-security/pull/1076)) \ No newline at end of file diff --git a/.changelog/v3.2.0/features/provider/1280-reward-denoms.md b/.changelog/v3.2.0/features/provider/1280-reward-denoms.md new file mode 100644 index 0000000000..c1f3659a44 --- /dev/null +++ b/.changelog/v3.2.0/features/provider/1280-reward-denoms.md @@ -0,0 +1,3 @@ +- Add a governance proposal for setting on the provider the denominations for + rewards from consumer chains. + ([\#1280](https://github.com/cosmos/interchain-security/pull/1280)) \ No newline at end of file diff --git a/.changelog/v3.2.0/improvements/1244-consumer-unbonding.md b/.changelog/v3.2.0/improvements/1244-consumer-unbonding.md new file mode 100644 index 0000000000..4a8504e4ce --- /dev/null +++ b/.changelog/v3.2.0/improvements/1244-consumer-unbonding.md @@ -0,0 +1,2 @@ +- Update the default consumer unbonding period to 2 weeks. + ([\#1244](https://github.com/cosmos/interchain-security/pull/1244)) \ No newline at end of file diff --git a/.changelog/v3.2.0/improvements/consumer/1037-optimize-storage.md b/.changelog/v3.2.0/improvements/consumer/1037-optimize-storage.md new file mode 100644 index 0000000000..726906420b --- /dev/null +++ b/.changelog/v3.2.0/improvements/consumer/1037-optimize-storage.md @@ -0,0 +1,2 @@ +- Optimize pending packets storage on consumer, with migration. + ([\#1037](https://github.com/cosmos/interchain-security/pull/1037)) \ No newline at end of file diff --git a/.changelog/v3.2.0/state-breaking/1196-bump-ibc.md b/.changelog/v3.2.0/state-breaking/1196-bump-ibc.md new file mode 100644 index 0000000000..fcf4450150 --- /dev/null +++ b/.changelog/v3.2.0/state-breaking/1196-bump-ibc.md @@ -0,0 +1,3 @@ +- Bump [ibc-go](https://github.com/cosmos/ibc-go) to + [v7.2.0](https://github.com/cosmos/ibc-go/releases/tag/v7.2.0). + ([\#1196](https://github.com/cosmos/interchain-security/pull/1196)) \ No newline at end of file diff --git a/.changelog/v3.2.0/state-breaking/1244-consumer-unbonding.md b/.changelog/v3.2.0/state-breaking/1244-consumer-unbonding.md new file mode 100644 index 0000000000..4a8504e4ce --- /dev/null +++ b/.changelog/v3.2.0/state-breaking/1244-consumer-unbonding.md @@ -0,0 +1,2 @@ +- Update the default consumer unbonding period to 2 weeks. + ([\#1244](https://github.com/cosmos/interchain-security/pull/1244)) \ No newline at end of file diff --git a/.changelog/v3.2.0/state-breaking/1258-bump-ibc.md b/.changelog/v3.2.0/state-breaking/1258-bump-ibc.md new file mode 100644 index 0000000000..68c6e2b104 --- /dev/null +++ b/.changelog/v3.2.0/state-breaking/1258-bump-ibc.md @@ -0,0 +1,3 @@ +- Bump [ibc-go](https://github.com/cosmos/ibc-go) to + [v7.3.0](https://github.com/cosmos/ibc-go/releases/tag/v7.3.0). + ([\#1258](https://github.com/cosmos/interchain-security/pull/1258)) \ No newline at end of file diff --git a/.changelog/v3.2.0/state-breaking/1258-bump-sdk.md b/.changelog/v3.2.0/state-breaking/1258-bump-sdk.md new file mode 100644 index 0000000000..7344fac97e --- /dev/null +++ b/.changelog/v3.2.0/state-breaking/1258-bump-sdk.md @@ -0,0 +1,3 @@ +- Bump [cosmos-sdk](https://github.com/cosmos/cosmos-sdk) to + [v0.47.4](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.47.4). + ([\#1258](https://github.com/cosmos/interchain-security/pull/1258)) \ No newline at end of file diff --git a/.changelog/v3.2.0/state-breaking/1259-bump-sdk.md b/.changelog/v3.2.0/state-breaking/1259-bump-sdk.md new file mode 100644 index 0000000000..247c623b7d --- /dev/null +++ b/.changelog/v3.2.0/state-breaking/1259-bump-sdk.md @@ -0,0 +1,3 @@ +- Bump [cosmos-sdk](https://github.com/cosmos/cosmos-sdk) to + [v0.47.5](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.47.5). + ([\#1259](https://github.com/cosmos/interchain-security/pull/1259)) \ No newline at end of file diff --git a/.changelog/v3.2.0/state-breaking/consumer/1024-jail-throttling-v2.md b/.changelog/v3.2.0/state-breaking/consumer/1024-jail-throttling-v2.md new file mode 100644 index 0000000000..7570facb34 --- /dev/null +++ b/.changelog/v3.2.0/state-breaking/consumer/1024-jail-throttling-v2.md @@ -0,0 +1,2 @@ +- Add the consumer-side changes for jail throttling with retries (cf. ADR 008). + ([\#1024](https://github.com/cosmos/interchain-security/pull/1024)) \ No newline at end of file From 27290f614969e93087b13eee1aeca46ac92552d3 Mon Sep 17 00:00:00 2001 From: insumity Date: Mon, 26 Feb 2024 16:03:07 +0100 Subject: [PATCH 18/46] cleaning up --- .../consumer/1037-optimize-storage.md | 2 + .../consumer/1146-pending-packets.md | 2 + .../consumer/1150-revert-wire-breaking.md | 2 + .../consumer/1244-validate-transfer.md | 2 + .../consumer/1262-fee-pool-addr.md | 2 + .../state-breaking/consumer/1295-migration.md | 2 + .../provider/1280-reward-denoms.md | 3 + .changelog/v3.2.0/summary.md | 1 + ...ic-verification-of-equivocation-feature.md | 2 + .../v3.3.0/dependencies/1373-bump-ibc.md | 3 + .../v3.3.0/features/1336-quint-model.md | 2 + .../1339-check-key-assignment-in-use.md | 3 + ...1340-cryptographic-equivocation-feature.md | 4 + .../improvements/1324-consumer-genesis.md | 16 + .../v3.3.0/improvements/1350-cleanup-types.md | 3 + .../provider/1503-query-key-assignment.md | 1 + .../state-breaking/1324-consumer-genesis.md | 2 + .../state-breaking/1460-msg-validation.md | 3 + .../1339-check-key-assignment-in-use.md | 3 + ...1340-cryptographic-equivocation-feature.md | 4 + .changelog/v3.3.0/summary.md | 1 + CHANGELOG.md | 370 ++++++++++++++++-- RELEASE_NOTES.md | 37 +- UPGRADING.md | 4 +- 24 files changed, 430 insertions(+), 44 deletions(-) create mode 100644 .changelog/v3.2.0/state-breaking/consumer/1037-optimize-storage.md create mode 100644 .changelog/v3.2.0/state-breaking/consumer/1146-pending-packets.md create mode 100644 .changelog/v3.2.0/state-breaking/consumer/1150-revert-wire-breaking.md create mode 100644 .changelog/v3.2.0/state-breaking/consumer/1244-validate-transfer.md create mode 100644 .changelog/v3.2.0/state-breaking/consumer/1262-fee-pool-addr.md create mode 100644 .changelog/v3.2.0/state-breaking/consumer/1295-migration.md create mode 100644 .changelog/v3.2.0/state-breaking/provider/1280-reward-denoms.md create mode 100644 .changelog/v3.2.0/summary.md create mode 100644 .changelog/v3.3.0/api-breaking/provider/1340-add-cryptographic-verification-of-equivocation-feature.md create mode 100644 .changelog/v3.3.0/dependencies/1373-bump-ibc.md create mode 100644 .changelog/v3.3.0/features/1336-quint-model.md create mode 100644 .changelog/v3.3.0/features/provider/1339-check-key-assignment-in-use.md create mode 100644 .changelog/v3.3.0/features/provider/1340-cryptographic-equivocation-feature.md create mode 100644 .changelog/v3.3.0/improvements/1324-consumer-genesis.md create mode 100644 .changelog/v3.3.0/improvements/1350-cleanup-types.md create mode 100644 .changelog/v3.3.0/improvements/provider/1503-query-key-assignment.md create mode 100644 .changelog/v3.3.0/state-breaking/1324-consumer-genesis.md create mode 100644 .changelog/v3.3.0/state-breaking/1460-msg-validation.md create mode 100644 .changelog/v3.3.0/state-breaking/provider/1339-check-key-assignment-in-use.md create mode 100644 .changelog/v3.3.0/state-breaking/provider/1340-cryptographic-equivocation-feature.md create mode 100644 .changelog/v3.3.0/summary.md diff --git a/.changelog/v3.2.0/state-breaking/consumer/1037-optimize-storage.md b/.changelog/v3.2.0/state-breaking/consumer/1037-optimize-storage.md new file mode 100644 index 0000000000..726906420b --- /dev/null +++ b/.changelog/v3.2.0/state-breaking/consumer/1037-optimize-storage.md @@ -0,0 +1,2 @@ +- Optimize pending packets storage on consumer, with migration. + ([\#1037](https://github.com/cosmos/interchain-security/pull/1037)) \ No newline at end of file diff --git a/.changelog/v3.2.0/state-breaking/consumer/1146-pending-packets.md b/.changelog/v3.2.0/state-breaking/consumer/1146-pending-packets.md new file mode 100644 index 0000000000..a10d75a505 --- /dev/null +++ b/.changelog/v3.2.0/state-breaking/consumer/1146-pending-packets.md @@ -0,0 +1,2 @@ +- Fix deletion of pending packets that may cause duplicate sends + ([\#1146](https://github.com/cosmos/interchain-security/pull/1146)) \ No newline at end of file diff --git a/.changelog/v3.2.0/state-breaking/consumer/1150-revert-wire-breaking.md b/.changelog/v3.2.0/state-breaking/consumer/1150-revert-wire-breaking.md new file mode 100644 index 0000000000..067448e770 --- /dev/null +++ b/.changelog/v3.2.0/state-breaking/consumer/1150-revert-wire-breaking.md @@ -0,0 +1,2 @@ +- Remove `idx` field from the `ccv.ConsumerPacketData` type as this would break the + wire ([\#1150](https://github.com/cosmos/interchain-security/pull/1150)) \ No newline at end of file diff --git a/.changelog/v3.2.0/state-breaking/consumer/1244-validate-transfer.md b/.changelog/v3.2.0/state-breaking/consumer/1244-validate-transfer.md new file mode 100644 index 0000000000..2d94c79c75 --- /dev/null +++ b/.changelog/v3.2.0/state-breaking/consumer/1244-validate-transfer.md @@ -0,0 +1,2 @@ +- Validate token transfer messages before calling `Transfer()`. + ([\#1244](https://github.com/cosmos/interchain-security/pull/1244)) \ No newline at end of file diff --git a/.changelog/v3.2.0/state-breaking/consumer/1262-fee-pool-addr.md b/.changelog/v3.2.0/state-breaking/consumer/1262-fee-pool-addr.md new file mode 100644 index 0000000000..bbb54db2e3 --- /dev/null +++ b/.changelog/v3.2.0/state-breaking/consumer/1262-fee-pool-addr.md @@ -0,0 +1,2 @@ +- Remove incorrect address validation on `ProviderFeePoolAddrStr` param. + ([\#1262](https://github.com/cosmos/interchain-security/pull/1262)) \ No newline at end of file diff --git a/.changelog/v3.2.0/state-breaking/consumer/1295-migration.md b/.changelog/v3.2.0/state-breaking/consumer/1295-migration.md new file mode 100644 index 0000000000..739b08dc39 --- /dev/null +++ b/.changelog/v3.2.0/state-breaking/consumer/1295-migration.md @@ -0,0 +1,2 @@ +- Increment consumer consensus version and register consumer migration. + ([\#1295](https://github.com/cosmos/interchain-security/pull/1295)) \ No newline at end of file diff --git a/.changelog/v3.2.0/state-breaking/provider/1280-reward-denoms.md b/.changelog/v3.2.0/state-breaking/provider/1280-reward-denoms.md new file mode 100644 index 0000000000..c1f3659a44 --- /dev/null +++ b/.changelog/v3.2.0/state-breaking/provider/1280-reward-denoms.md @@ -0,0 +1,3 @@ +- Add a governance proposal for setting on the provider the denominations for + rewards from consumer chains. + ([\#1280](https://github.com/cosmos/interchain-security/pull/1280)) \ No newline at end of file diff --git a/.changelog/v3.2.0/summary.md b/.changelog/v3.2.0/summary.md new file mode 100644 index 0000000000..e7b2c7d6d4 --- /dev/null +++ b/.changelog/v3.2.0/summary.md @@ -0,0 +1 @@ +*November 24, 2023* diff --git a/.changelog/v3.3.0/api-breaking/provider/1340-add-cryptographic-verification-of-equivocation-feature.md b/.changelog/v3.3.0/api-breaking/provider/1340-add-cryptographic-verification-of-equivocation-feature.md new file mode 100644 index 0000000000..c50662be72 --- /dev/null +++ b/.changelog/v3.3.0/api-breaking/provider/1340-add-cryptographic-verification-of-equivocation-feature.md @@ -0,0 +1,2 @@ +- Deprecate equivocation proposals. +([\#1340](https://github.com/cosmos/interchain-security/pull/1340)) \ No newline at end of file diff --git a/.changelog/v3.3.0/dependencies/1373-bump-ibc.md b/.changelog/v3.3.0/dependencies/1373-bump-ibc.md new file mode 100644 index 0000000000..efe4e0c286 --- /dev/null +++ b/.changelog/v3.3.0/dependencies/1373-bump-ibc.md @@ -0,0 +1,3 @@ +- Bump [ibc-go](https://github.com/cosmos/ibc-go) to + [v7.3.1](https://github.com/cosmos/ibc-go/releases/tag/v7.3.1). + ([\#1373](https://github.com/cosmos/interchain-security/pull/1373)) \ No newline at end of file diff --git a/.changelog/v3.3.0/features/1336-quint-model.md b/.changelog/v3.3.0/features/1336-quint-model.md new file mode 100644 index 0000000000..96c4562b32 --- /dev/null +++ b/.changelog/v3.3.0/features/1336-quint-model.md @@ -0,0 +1,2 @@ +- Add Quint model of Replicated Security. + ([\#1336](https://github.com/cosmos/interchain-security/pull/1336)) \ No newline at end of file diff --git a/.changelog/v3.3.0/features/provider/1339-check-key-assignment-in-use.md b/.changelog/v3.3.0/features/provider/1339-check-key-assignment-in-use.md new file mode 100644 index 0000000000..9f274f7bb4 --- /dev/null +++ b/.changelog/v3.3.0/features/provider/1339-check-key-assignment-in-use.md @@ -0,0 +1,3 @@ +- Update how consumer-assigned keys are checked when a validator is + created on the provider. + ([\#1339](https://github.com/cosmos/interchain-security/pull/1339)) \ No newline at end of file diff --git a/.changelog/v3.3.0/features/provider/1340-cryptographic-equivocation-feature.md b/.changelog/v3.3.0/features/provider/1340-cryptographic-equivocation-feature.md new file mode 100644 index 0000000000..5437fba186 --- /dev/null +++ b/.changelog/v3.3.0/features/provider/1340-cryptographic-equivocation-feature.md @@ -0,0 +1,4 @@ +- Introduce the cryptographic verification of equivocation feature to the provider + (cf. [ADR-005](docs/docs/adrs/adr-005-cryptographic-equivocation-verification.md) + & [ADR-013](docs/docs/adrs/adr-013-equivocation-slashing.md)). + ([\#1340](https://github.com/cosmos/interchain-security/pull/1340)) \ No newline at end of file diff --git a/.changelog/v3.3.0/improvements/1324-consumer-genesis.md b/.changelog/v3.3.0/improvements/1324-consumer-genesis.md new file mode 100644 index 0000000000..a727be8341 --- /dev/null +++ b/.changelog/v3.3.0/improvements/1324-consumer-genesis.md @@ -0,0 +1,16 @@ +- Split out consumer genesis state to reduce shared data between provider and + consumer. ([\#1324](https://github.com/cosmos/interchain-security/pull/1324)) + - Note: This breaks json format used by augmenting Genesis files of consumer + chains with consumer genesis content exported from provider chain. Consumer + Genesis content exported from a provider chain using major version 1, 2 or 3 + of the provider module needs to be transformed with the transformation command + introduced by this PR: + ``` + Transform the consumer genesis file from a provider version v1, v2 or v3 to a version supported by this consumer. Result is printed to STDOUT. + + Example: + $ transform /path/to/ccv_consumer_genesis.json + + Usage: + interchain-security-cd genesis transform [genesis-file] [flags] + ``` \ No newline at end of file diff --git a/.changelog/v3.3.0/improvements/1350-cleanup-types.md b/.changelog/v3.3.0/improvements/1350-cleanup-types.md new file mode 100644 index 0000000000..6e26fc3992 --- /dev/null +++ b/.changelog/v3.3.0/improvements/1350-cleanup-types.md @@ -0,0 +1,3 @@ +- Refactor shared events, codecs and errors assign to + consumer and provider dedicated types where possible. + ([\#1350](https://github.com/cosmos/interchain-security/pull/1350)) \ No newline at end of file diff --git a/.changelog/v3.3.0/improvements/provider/1503-query-key-assignment.md b/.changelog/v3.3.0/improvements/provider/1503-query-key-assignment.md new file mode 100644 index 0000000000..62b505ec01 --- /dev/null +++ b/.changelog/v3.3.0/improvements/provider/1503-query-key-assignment.md @@ -0,0 +1 @@ +- Add `QueryAllPairsValConAddrByConsumerChainID` method to get list of all pairs `valConsensus` address by `Consummer chainID`. ([\#1503](https://github.com/cosmos/interchain-security/pull/1503)) \ No newline at end of file diff --git a/.changelog/v3.3.0/state-breaking/1324-consumer-genesis.md b/.changelog/v3.3.0/state-breaking/1324-consumer-genesis.md new file mode 100644 index 0000000000..b47f7199fd --- /dev/null +++ b/.changelog/v3.3.0/state-breaking/1324-consumer-genesis.md @@ -0,0 +1,2 @@ +- Split out consumer genesis state to reduce shared data between provider and + consumer. ([\#1324](https://github.com/cosmos/interchain-security/pull/1324)) \ No newline at end of file diff --git a/.changelog/v3.3.0/state-breaking/1460-msg-validation.md b/.changelog/v3.3.0/state-breaking/1460-msg-validation.md new file mode 100644 index 0000000000..46d18bd4c9 --- /dev/null +++ b/.changelog/v3.3.0/state-breaking/1460-msg-validation.md @@ -0,0 +1,3 @@ +- Improve validation of IBC packet data and provider messages. Also, + enable the provider to validate consumer packets before handling them. + ([\#1460](https://github.com/cosmos/interchain-security/pull/1460)) \ No newline at end of file diff --git a/.changelog/v3.3.0/state-breaking/provider/1339-check-key-assignment-in-use.md b/.changelog/v3.3.0/state-breaking/provider/1339-check-key-assignment-in-use.md new file mode 100644 index 0000000000..2890582ba8 --- /dev/null +++ b/.changelog/v3.3.0/state-breaking/provider/1339-check-key-assignment-in-use.md @@ -0,0 +1,3 @@ +- Change the states by adding a consumer key for each chain that is + not yet registered meaning for which the gov proposal has not passed. + ([\#1339](https://github.com/cosmos/interchain-security/pull/1339)) \ No newline at end of file diff --git a/.changelog/v3.3.0/state-breaking/provider/1340-cryptographic-equivocation-feature.md b/.changelog/v3.3.0/state-breaking/provider/1340-cryptographic-equivocation-feature.md new file mode 100644 index 0000000000..5437fba186 --- /dev/null +++ b/.changelog/v3.3.0/state-breaking/provider/1340-cryptographic-equivocation-feature.md @@ -0,0 +1,4 @@ +- Introduce the cryptographic verification of equivocation feature to the provider + (cf. [ADR-005](docs/docs/adrs/adr-005-cryptographic-equivocation-verification.md) + & [ADR-013](docs/docs/adrs/adr-013-equivocation-slashing.md)). + ([\#1340](https://github.com/cosmos/interchain-security/pull/1340)) \ No newline at end of file diff --git a/.changelog/v3.3.0/summary.md b/.changelog/v3.3.0/summary.md new file mode 100644 index 0000000000..e556c0f0ca --- /dev/null +++ b/.changelog/v3.3.0/summary.md @@ -0,0 +1 @@ +*January 5, 2024* diff --git a/CHANGELOG.md b/CHANGELOG.md index 56ece9b8ef..9d46f32447 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,6 @@ # CHANGELOG ## v4.0.0 -<<<<<<< HEAD *January 22, 2024* @@ -56,62 +55,367 @@ ([\#1321](https://github.com/cosmos/interchain-security/pull/1321)) ## v3.3.0 -======= ->>>>>>> 3165f034 (docs: changelog and release notes for v4.0.0 (#1564)) -*January 22, 2024* +*January 5, 2024* ### API BREAKING -- [Consumer](x/ccv/consumer) - - Fix a bug in consmer genesis file transform CLI command. - ([\#1458](https://github.com/cosmos/interchain-security/pull/1458)) +- [Provider](x/ccv/provider) + - Deprecate equivocation proposals. + ([\#1340](https://github.com/cosmos/interchain-security/pull/1340)) -### BUG FIXES +### DEPENDENCIES + +- Bump [ibc-go](https://github.com/cosmos/ibc-go) to + [v7.3.1](https://github.com/cosmos/ibc-go/releases/tag/v7.3.1). + ([\#1373](https://github.com/cosmos/interchain-security/pull/1373)) + +### FEATURES - General - - Fix a bug in consmer genesis file transform CLI command. - ([\#1458](https://github.com/cosmos/interchain-security/pull/1458)) + - Add Quint model of Replicated Security. + ([\#1336](https://github.com/cosmos/interchain-security/pull/1336)) +- [Provider](x/ccv/provider) + - Update how consumer-assigned keys are checked when a validator is + created on the provider. + ([\#1339](https://github.com/cosmos/interchain-security/pull/1339)) + - Introduce the cryptographic verification of equivocation feature to the provider + (cf. [ADR-005](docs/docs/adrs/adr-005-cryptographic-equivocation-verification.md) + & [ADR-013](docs/docs/adrs/adr-013-equivocation-slashing.md)). + ([\#1340](https://github.com/cosmos/interchain-security/pull/1340)) + +### IMPROVEMENTS + +- General + - Split out consumer genesis state to reduce shared data between provider and + consumer. ([\#1324](https://github.com/cosmos/interchain-security/pull/1324)) + - Note: This breaks json format used by augmenting Genesis files of consumer + chains with consumer genesis content exported from provider chain. Consumer + Genesis content exported from a provider chain using major version 1, 2 or 3 + of the provider module needs to be transformed with the transformation command + introduced by this PR: + ``` + Transform the consumer genesis file from a provider version v1, v2 or v3 to a version supported by this consumer. Result is printed to STDOUT. + + Example: + $ transform /path/to/ccv_consumer_genesis.json + + Usage: + interchain-security-cd genesis transform [genesis-file] [flags] + ``` + - Refactor shared events, codecs and errors assign to + consumer and provider dedicated types where possible. + ([\#1350](https://github.com/cosmos/interchain-security/pull/1350)) +- [Provider](x/ccv/provider) + - Add `QueryAllPairsValConAddrByConsumerChainID` method to get list of all pairs `valConsensus` address by `Consummer chainID`. ([\#1503](https://github.com/cosmos/interchain-security/pull/1503)) + +### STATE BREAKING + +- General + - Split out consumer genesis state to reduce shared data between provider and + consumer. ([\#1324](https://github.com/cosmos/interchain-security/pull/1324)) - Improve validation of IBC packet data and provider messages. Also, enable the provider to validate consumer packets before handling them. ([\#1460](https://github.com/cosmos/interchain-security/pull/1460)) +- [Provider](x/ccv/provider) + - Change the states by adding a consumer key for each chain that is + not yet registered meaning for which the gov proposal has not passed. + ([\#1339](https://github.com/cosmos/interchain-security/pull/1339)) + - Introduce the cryptographic verification of equivocation feature to the provider + (cf. [ADR-005](docs/docs/adrs/adr-005-cryptographic-equivocation-verification.md) + & [ADR-013](docs/docs/adrs/adr-013-equivocation-slashing.md)). + ([\#1340](https://github.com/cosmos/interchain-security/pull/1340)) + +## v3.2.0 + +*November 24, 2023* + +### BUG FIXES + - [Consumer](x/ccv/consumer) - - Avoid jailing validators immediately once they can no longer opt-out from - validating consumer chains. - ([\#1549](https://github.com/cosmos/interchain-security/pull/1549)) - - Fix the validation of VSCPackets to not fail due to marshaling to string using Bech32. - ([\#1570](https://github.com/cosmos/interchain-security/pull/1570)) + - Fix deletion of pending packets that may cause duplicate sends + ([\#1146](https://github.com/cosmos/interchain-security/pull/1146)) + - Remove `idx` field from the `ccv.ConsumerPacketData` type as this would break the + wire ([\#1150](https://github.com/cosmos/interchain-security/pull/1150)) + - Validate token transfer messages before calling `Transfer()`. + ([\#1244](https://github.com/cosmos/interchain-security/pull/1244)) + - Remove incorrect address validation on `ProviderFeePoolAddrStr` param. + ([\#1262](https://github.com/cosmos/interchain-security/pull/1262)) + - Increment consumer consensus version and register consumer migration. + ([\#1295](https://github.com/cosmos/interchain-security/pull/1295)) ### DEPENDENCIES -- Bump Golang to v1.21 - ([\#1557](https://github.com/cosmos/interchain-security/pull/1557)) +- Bump [ibc-go](https://github.com/cosmos/ibc-go) to + [v7.2.0](https://github.com/cosmos/ibc-go/releases/tag/v7.2.0). + ([\#1196](https://github.com/cosmos/interchain-security/pull/1196)) - Bump [cosmos-sdk](https://github.com/cosmos/cosmos-sdk) to - [v0.47.7](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.47.7). - ([\#1558](https://github.com/cosmos/interchain-security/pull/1558)) -- Bump [CometBFT](https://github.com/cometbft/cometbft) to - [v0.37.4](https://github.com/cometbft/cometbft/releases/tag/v0.37.4). - ([\#1558](https://github.com/cosmos/interchain-security/pull/1558)) + [v0.47.4](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.47.4). + ([\#1258](https://github.com/cosmos/interchain-security/pull/1258)) +- Bump [ibc-go](https://github.com/cosmos/ibc-go) to + [v7.3.0](https://github.com/cosmos/ibc-go/releases/tag/v7.3.0). + ([\#1258](https://github.com/cosmos/interchain-security/pull/1258)) +- Bump [cosmos-sdk](https://github.com/cosmos/cosmos-sdk) to + [v0.47.5](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.47.5). + ([\#1259](https://github.com/cosmos/interchain-security/pull/1259)) ### FEATURES +- [Consumer](x/ccv/consumer) + - Add the consumer-side changes for jail throttling with retries (cf. ADR 008). + ([\#1024](https://github.com/cosmos/interchain-security/pull/1024)) + - Introduce the gRPC query `/interchain_security/ccv/consumer/provider- + info` and CLI command `interchain-security-cd q ccvconsumer + provider-info` to retrieve provider info from the consumer chain. + ([\#1164](https://github.com/cosmos/interchain-security/pull/1164)) - [Provider](x/ccv/provider) - - Add the provider-side changes for jail throttling with retries (cf. ADR 008). - ([\#1321](https://github.com/cosmos/interchain-security/pull/1321)) + - Add `InitTimeoutTimestamps` and `ExportedVscSendTimestamps` to exported + genesis. ([\#1076](https://github.com/cosmos/interchain-security/pull/1076)) + - Add a governance proposal for setting on the provider the denominations for + rewards from consumer chains. + ([\#1280](https://github.com/cosmos/interchain-security/pull/1280)) + +### IMPROVEMENTS + +- General + - Update the default consumer unbonding period to 2 weeks. + ([\#1244](https://github.com/cosmos/interchain-security/pull/1244)) +- [Consumer](x/ccv/consumer) + - Optimize pending packets storage on consumer, with migration. + ([\#1037](https://github.com/cosmos/interchain-security/pull/1037)) ### STATE BREAKING +- General + - Bump [ibc-go](https://github.com/cosmos/ibc-go) to + [v7.2.0](https://github.com/cosmos/ibc-go/releases/tag/v7.2.0). + ([\#1196](https://github.com/cosmos/interchain-security/pull/1196)) + - Update the default consumer unbonding period to 2 weeks. + ([\#1244](https://github.com/cosmos/interchain-security/pull/1244)) + - Bump [cosmos-sdk](https://github.com/cosmos/cosmos-sdk) to + [v0.47.4](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.47.4). + ([\#1258](https://github.com/cosmos/interchain-security/pull/1258)) + - Bump [ibc-go](https://github.com/cosmos/ibc-go) to + [v7.3.0](https://github.com/cosmos/ibc-go/releases/tag/v7.3.0). + ([\#1258](https://github.com/cosmos/interchain-security/pull/1258)) + - Bump [cosmos-sdk](https://github.com/cosmos/cosmos-sdk) to + [v0.47.5](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.47.5). + ([\#1259](https://github.com/cosmos/interchain-security/pull/1259)) - [Consumer](x/ccv/consumer) - - Avoid jailing validators immediately once they can no longer opt-out from - validating consumer chains. - ([\#1549](https://github.com/cosmos/interchain-security/pull/1549)) - - Fix the validation of VSCPackets to not fail due to marshaling to string using Bech32. - ([\#1570](https://github.com/cosmos/interchain-security/pull/1570)) + - Add the consumer-side changes for jail throttling with retries (cf. ADR 008). + ([\#1024](https://github.com/cosmos/interchain-security/pull/1024)) + - Optimize pending packets storage on consumer, with migration. + ([\#1037](https://github.com/cosmos/interchain-security/pull/1037)) + - Fix deletion of pending packets that may cause duplicate sends + ([\#1146](https://github.com/cosmos/interchain-security/pull/1146)) + - Remove `idx` field from the `ccv.ConsumerPacketData` type as this would break the + wire ([\#1150](https://github.com/cosmos/interchain-security/pull/1150)) + - Validate token transfer messages before calling `Transfer()`. + ([\#1244](https://github.com/cosmos/interchain-security/pull/1244)) + - Remove incorrect address validation on `ProviderFeePoolAddrStr` param. + ([\#1262](https://github.com/cosmos/interchain-security/pull/1262)) + - Increment consumer consensus version and register consumer migration. + ([\#1295](https://github.com/cosmos/interchain-security/pull/1295)) - [Provider](x/ccv/provider) - - Add the provider-side changes for jail throttling with retries (cf. ADR 008). - ([\#1321](https://github.com/cosmos/interchain-security/pull/1321)) + - Add a governance proposal for setting on the provider the denominations for + rewards from consumer chains. + ([\#1280](https://github.com/cosmos/interchain-security/pull/1280)) + +## v3.1.0 + +Date July 11th, 2023 + +A minor upgrade to v3.0.0, which removes the panic in the consumer ccv module which would occur in an emergency scenario where the ccv channel is closed. This release also fixes how a distribution related event is emitted, and bumps cometbft. + +* (feat) [#1127](https://github.com/cosmos/interchain-security/pull/1127) Remove consumer panic when ccv channel is closed +* (fix) [#720](https://github.com/cosmos/interchain-security/issues/720) Fix the attribute `AttributeDistributionTotal` value in `FeeDistribution` event emit. +* (deps) [#1119](https://github.com/cosmos/interchain-security/pull/1119) bump cometbft from `v0.37.1` to `0.37.2`. + +## v3.0.0 + +Date: June 21st, 2023 + +Interchain Security v3 uses SDK 0.47 and IBC 7. + +* (fix) [#1093](https://github.com/cosmos/interchain-security/pull/1093) Make SlashPacketData backward compatible when sending data over the wire +* (deps) [#1019](https://github.com/cosmos/interchain-security/pull/1019) Bump multiple dependencies. + * Bump [cosmos-sdk](https://github.com/cosmos/cosmos-sdk) to [v0.47.3](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.47.3). + * Bump [ibc-go](https://github.com/cosmos/ibc-go) to [v7.1.0](https://github.com/cosmos/ibc-go/releases/tag/v7.1.0). + * Bump [CometBFT](https://github.com/cometbft/cometbft) to [v0.37.1](https://github.com/cometbft/cometbft/releases/tag/v0.37.1). +* `[x/ccv/provider]` (fix) [#945](https://github.com/cosmos/interchain-security/issues/945) Refactor `AfterUnbondingInitiated` to not panic when `PutUnbondingOnHold` returns error. +* `[x/ccv/provider]` (fix) [#977](https://github.com/cosmos/interchain-security/pull/977) Avoids panicking the provider when an unbonding delegation was removed through a `CancelUnbondingDelegation` message. +* `[x/ccv/democracy]` (feat) [#1019](https://github.com/cosmos/interchain-security/pull/1019) Whitelisting non-legacy params in the "democracy module" require the entire module to be whitelisted. + +## v2.4.0-lsm + +*November 20, 2023* + +* (fix) [#1439](https://github.com/cosmos/interchain-security/pull/1439) Fix unmarshaling for the CLI consumer double vote cmd. +* (feat!) [#1435](https://github.com/cosmos/interchain-security/pull/1435) Add height-base filter for consumer equivocation evidence. + +## v2.3.0-provider-lsm + +*November 15, 2023* + +❗ *This release is deprecated and should not be used in production.* + +* (fix!) [#1422](https://github.com/cosmos/interchain-security/pull/1422) Fix the misbehaviour handling by verifying the signatures of byzantine validators. + +## v2.2.0-provider-lsm + +❗ *This release is deprecated and should not be used in production.* + +### Cryptographic verification of equivocation +* New feature enabling the provider chain to verify equivocation evidence on its own instead of trusting consumer chains, see [EPIC](https://github.com/cosmos/interchain-security/issues/732). + +## v2.1.0-provider-lsm + +Date: September 15th, 2023 + +* (feature!) [#1280](https://github.com/cosmos/interchain-security/pull/1280) provider proposal for changing reward denoms + +## v2.0.0-lsm + +Date: August 18th, 2023 + +* (deps!) [#1120](https://github.com/cosmos/interchain-security/pull/1120) Bump [Cosmos SDK](https://github.com/cosmos/cosmos-sdk) to [v0.45.16-ics-lsm](https://github.com/cosmos/cosmos-sdk/tree/v0.45.16-ics-lsm). This requires adapting ICS to support this SDK release. Changes are state breaking. +* (fix) [#720](https://github.com/cosmos/interchain-security/issues/720) Fix the attribute `AttributeDistributionTotal` value in `FeeDistribution` event emit. + +## v2.0.0 + +Date: June 1st, 2023 + +Unlike prior releases, the ICS `v2.0.0` release will be based on the main branch. `v2.0.0` will contain all the accumulated PRs from the various releases below, along with other PRs that were merged, but not released to production. After `v2.0.0`, we plan to revamp release practices, and how we modularize the repo for consumer/provider. + +Upgrading a provider from `v1.1.0-multiden` to `v2.0.0` will require state migrations. See [migration.go](https://github.com/cosmos/interchain-security/blob/v2.0.0/x/ccv/provider/keeper/migration.go). + +Upgrading a consumer from `v1.2.0-multiden` to `v2.0.0` will NOT require state migrations. + +Some PRs from v2.0.0 may reappear from other releases below. This is due to the fact that ICS v1.1.0 deviates from the commit ordering of the main branch, and other releases thereafter are based on v1.1.0. + +### High level changes included in v2.0.0 + +* MVP for standalone to consumer changeover, see [EPIC](https://github.com/cosmos/interchain-security/issues/756) +* MVP for soft opt out, see [EPIC](https://github.com/cosmos/interchain-security/issues/851) +* Various fixes, critical and non-critical +* Docs updates which should not affect production code + +## Notable PRs included in v2.0.0 + +* (feat!) Add DistributionTransmissionChannel to ConsumerAdditionProposal [#965](https://github.com/cosmos/interchain-security/pull/965) +* (feat/fix) limit vsc matured packets handled per endblocker [#1004](https://github.com/cosmos/interchain-security/pull/1004) +* (fix) consumer key prefix order to avoid complex migrations [#963](https://github.com/cosmos/interchain-security/pull/963) and [#991](https://github.com/cosmos/interchain-security/pull/991). The latter PR is the proper fix. +* (feat) v1->v2 migrations to accommodate a bugfix having to do with store keys, introduce new params, and deal with consumer genesis state schema changes [#975](https://github.com/cosmos/interchain-security/pull/975) and [#997](https://github.com/cosmos/interchain-security/pull/997) +* (deps) Bump github.com/cosmos/ibc-go/v4 from 4.4.0 to 4.4.2 [#982](https://github.com/cosmos/interchain-security/pull/982) +* (fix) partially revert key assignment type safety PR [#980](https://github.com/cosmos/interchain-security/pull/980) +* (fix) Remove panics on failure to send IBC packets [#876](https://github.com/cosmos/interchain-security/pull/876) +* (fix) Prevent denom DOS [#931](https://github.com/cosmos/interchain-security/pull/931) +* (fix) multisig for assigning consumer key, use json [#916](https://github.com/cosmos/interchain-security/pull/916) +* (deps) Bump github.com/cosmos/ibc-go/v4 from 4.3.0 to 4.4.0 [#902](https://github.com/cosmos/interchain-security/pull/902) +* (feat) Add warnings when provider unbonding is shorter than consumer unbonding [#858](https://github.com/cosmos/interchain-security/pull/858) +* (chore) use go 1.19 [#899](https://github.com/cosmos/interchain-security/pull/899), [#840](https://github.com/cosmos/interchain-security/pull/840) +* (feat) Standalone to consumer changeover - recycle existing transfer channel [#832](https://github.com/cosmos/interchain-security/pull/832) +* (deps) Bump IBC [862](https://github.com/cosmos/interchain-security/pull/862) +* (testing) Add tests for soft opt out [#857](https://github.com/cosmos/interchain-security/pull/857) +* (feat) Standalone to consumer changeover - staking functionalities [#794](https://github.com/cosmos/interchain-security/pull/794) +* (fix) prevent provider from sending VSCPackets with multiple updates for the same validator [#850](https://github.com/cosmos/interchain-security/pull/850) +* (feat) Soft opt out [#833](https://github.com/cosmos/interchain-security/issues/833) +* (fix) Correctly handle VSC packet with duplicate val updates on consumer [#846](https://github.com/cosmos/interchain-security/pull/846) +* (deps) bump sdk to v0.45.15.ics [#805](https://github.com/cosmos/interchain-security/pull/805) +* (refactor) Remove spm module [#812](https://github.com/cosmos/interchain-security/pull/812) +* (feat) Standalone to consumer changeover part 1 [#757](https://github.com/cosmos/interchain-security/pull/757) +* (chore) Swap names of e2e and integration tests [#681](https://github.com/cosmos/interchain-security/pull/681) +* (fix) fix StopConsumerChain not running in cachedContext [#802](https://github.com/cosmos/interchain-security/pull/802). Also in earlier releases with different commit order! +* (docs) Introduce docs website [#759](https://github.com/cosmos/interchain-security/pull/759) +* (fix) Serialize correct byte prefix for SlashLogKey [#786](https://github.com/cosmos/interchain-security/pull/786) +* (feature) Improve keeper field validation [#766](https://github.com/cosmos/interchain-security/pull/766) +* (docs) Contributing guidelines [#744](https://github.com/cosmos/interchain-security/pull/744) +* (refactor) Key assignment type safety [#725](https://github.com/cosmos/interchain-security/pull/725) +* (fix) Update protos and fix deps [#752](https://github.com/cosmos/interchain-security/pull/752) +* (api) Add consumer QueryParams [#746](https://github.com/cosmos/interchain-security/pull/746) +* (feature) New validation for keeper fields [#740](https://github.com/cosmos/interchain-security/pull/740) + +## v1.2.0-multiden + +The first release candidate for a fix built on top of v1.2.0, intended for consumers. This release adds a list of denoms on the consumer that are allowed to be sent to the provider as rewards. This prevents a potential DOS attack that was discovered during the audit of Replicated Security performed by Oak Security and funded by the Cosmos Hub community through Proposal 687. In an effort to move quickly, this release also includes a multisig fix that is effective only for provider. It shouldn't affect the consumer module. + +Note PRs were made in a private security repo. + +[full diff](https://github.com/cosmos/interchain-security/compare/v1.2.0...v1.2.0-multiden-rc0) + +## v1.1.0-multiden + +This release combines two fixes on top of v1.1.0, that we judged were urgent to get onto the Cosmos Hub before the launch of the first ICS consumer chain. This is an emergency release intended for providers. + +The first fix is to enable the use of multisigs and Ledger devices when assigning keys for consumer chains. The second is to prevent a possible DOS vector involving the reward distribution system. + +Note PRs were made in a private security repo. + +[full diff](https://github.com/cosmos/interchain-security/compare/v1.1.0...release/v1.1.0-multiden) + +### Multisig fix + +On April 25th (a week and a half ago), we began receiving reports that validators using multisigs and Ledger devices were getting errors reading Error: unable to resolve type URL /interchain_security.ccv.provider.v1.MsgAssignConsumerKey: tx parse error when attempting to assign consensus keys for consumer chains. + +We quickly narrowed the problem down to issues having to do with using the PubKey type directly in the MsgAssignConsumerKey transaction, and Amino (a deprecated serialization library still used in Ledger devices and multisigs) not being able to handle this. We attempted to fix this with the assistance of the Cosmos-SDK team, but after making no headway for a few days, we decided to simply use a JSON representation of the PubKey in the transaction. This is how it is usually represented anyway. We have verified that this fixes the problem. + +### Distribution fix + +The ICS distribution system works by allowing consumer chains to send rewards to a module address on the provider called the FeePoolAddress. From here they are automatically distributed to all validators and delegators through the distribution system that already exists to distribute staking rewards. The FeePoolAddress is usually blocked so that no tokens can be sent to it, but to enable ICS distribution we had to unblock it. + +We recently realized that unblocking the FeePoolAddress could enable an attacker to send a huge number of different denoms into the distribution system. The distribution system would then attempt to distribute them all, leading to out of memory errors. Fixing a similar attack vector that existed in the distribution system before ICS led us to this realization. + +To fix this problem, we have re-blocked the FeePoolAddress and created a new address called the ConsumerRewardsPool. Consumer chains now send rewards to this new address. There is also a new transaction type called RegisterConsumerRewardDenom. This transaction allows people to register denoms to be used as rewards from consumer chains. It costs 10 Atoms to run this transaction.The Atoms are transferred to the community pool. Only denoms registered with this command are then transferred to the FeePoolAddress and distributed out to delegators and validators. + +## v1.2.1 + +* (fix) Remove SPM [#812](https://github.com/cosmos/interchain-security/pull/812) +* (refactor) Key assignment type safety [#725](https://github.com/cosmos/interchain-security/pull/725) + +## v1.2.0 + +Date: April 13th, 2023 + +* (feat) Soft opt-out [#833](https://github.com/cosmos/interchain-security/pull/833) +* (fix) Correctly handle VSC packet with duplicate val updates on consumer [#846](https://github.com/cosmos/interchain-security/pull/846) +* (chore) bump: sdk v0.45.15-ics [#805](https://github.com/cosmos/interchain-security/pull/805) +* (api) add interchain security consumer QueryParams [#746](https://github.com/cosmos/interchain-security/pull/746) + +## v1.1.1 + +* (fix) Remove SPM [#812](https://github.com/cosmos/interchain-security/pull/812) +* (refactor) Key assignment type safety [#725](https://github.com/cosmos/interchain-security/pull/725) + +## v1.1.0 + +Date: March 24th, 2023 + +* (fix) StopConsumerChain not running in cachedContext [#802](https://github.com/cosmos/interchain-security/pull/802) + +## v1.0.0 + +Date: February 6th, 2023 + +This is the first version of Interchain Security (ICS), also known as _Replicated Security_ (RS). +Replicated Security is a feature which will allow a chain -- referred to as the _provider_ -- to share security with other chains -- referred to as _consumers_. +This means that the provider's validator set will be granted the right to validate consumer chains. +The communication between the provider and the consumer chains is done through the IBC protocol over a unique, ordered channel (one for each consumer chain). Thus, RS is an IBC application. + +### Features / sub-protocols + +RS consist of the following core features: + +- **Channel Initialization**: Enables the provider to add new consumer chains. This process is governance-gated, i.e., to add a new consumer chain, a `ConsumerAdditionProposal` governance proposal must be sent to the provider and it must receive the necessary votes. +- **Validator Set Update**: Enables the provider to + (1) update the consumers on the voting power granted to validators (based on the changes in the active validator set on the provider chain), + and (2) ensure the timely completion of unbonding operations (e.g., undelegations). +- **Consumer Initiated Slashing**: Enables the provider to jail validators for downtime infractions on the consumer chains. +- **Reward Distribution**: Enables the consumers to transfer to the provider (over IBC) a portion of their block rewards as payment for the security provided. Once transferred, these rewards are distributed on the provider using the protocol in the [distribution module of Cosmos SDK](https://docs.cosmos.network/v0.45/modules/distribution/). +- **Consumer Chain Removal**: Enables the provider to remove a consumer either after a `ConsumerRemovalProposal` passes governance or after one of the timeout periods elapses -- `InitTimeoutPeriod`, `VscTimeoutPeriod`, `IBCTimeoutPeriod`. +- **Social Slashing**: Equivocation offenses (double signing etc.) on consumer chains are logged, and then can be used in a governance proposal to slash the validators responsible. -## Previous Versions +In addition, RS has the following features: -[CHANGELOG of previous versions](https://github.com/cosmos/interchain-security/blob/main/CHANGELOG.md) +- **Key Assignment**: Enables validator operators to use different consensus keys for each consumer chain validator node that they operate. +- **Jail Throttling**: Enables the provider to slow down a "worst case scenario" attack where a malicious consumer binary attempts to jail a significant amount (> 2/3) of the voting power, effectively taking control of the provider. diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index 913cb9faef..5d5ad1eb62 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -1,18 +1,37 @@ -# Replicated Security v4.0.0 Release Notes + + +# Replicated Security Release Notes + + +❗ ***Note this release is ONLY relevant to *** ## 📝 Changelog -Check out the [changelog](https://github.com/cosmos/interchain-security/blob/v4.0.0/CHANGELOG.md) for a list of relevant changes or [compare all changes](https://github.com/cosmos/interchain-security/compare/v3.3.0...v4.0.0) from last release. +** REMOVE THE LINE BELOW TO ENABLE THE MARKDOWN LINK CHECKER FOR RELEASE ** + + +Check out the [changelog](https://github.com/cosmos/interchain-security/blob//CHANGELOG.md) for a list of relevant changes or [compare all changes](https://github.com/cosmos/interchain-security/compare/release/...) from last release. -Refer to the [upgrading guide](https://github.com/cosmos/interchain-security/blob/release/v4.0.x/UPGRADING.md) when migrating -from a version `>= v3.1.x` to `v4.0.x`. +Refer to the [upgrading guide](https://github.com/cosmos/interchain-security/blob/release//UPGRADING.md) when migrating from `` to ``. +** REMOVE THE LINE BELOW TO ENABLE THE MARKDOWN LINK CHECKER FOR RELEASE ** + ## 🚀 Highlights -This release introduces the following noteworthy changes: + -- It sets the minimum required version of Go to `1.21`. -- It adds the provider-side changes for jail throttling with retries and, as a result, it fully enables the jail throttling with retries feature (cf. [ADR 008](https://github.com/cosmos/interchain-security/blob/release/v3.2.x/docs/docs/adrs/adr-008-throttle-retries.md)). -- Fixes a bug in the soft opt-out protocol -- it avoids jailing validators immediately once they can no longer opt-out from validating consumer chains. -- Fixes a bug the validation of VSCPackets caused by marshaling to string using Bech32. +## ❤️ Contributors + +* Informal Systems ([@informalinc](https://twitter.com/informalinc)) + +This list is non-exhaustive and ordered alphabetically. +Thank you to everyone who contributed to this release! diff --git a/UPGRADING.md b/UPGRADING.md index e82a799a6b..1267d3ac66 100644 --- a/UPGRADING.md +++ b/UPGRADING.md @@ -30,7 +30,7 @@ func migrateICSOutstandingDowntime(ctx sdk.Context, keepers *upgrades.UpgradeKee keepers.ConsumerKeeper.DeleteOutstandingDowntime(ctx, consAddr) } - ctx.Logger().Info("Finished ICS oustanding downtime") + ctx.Logger().Info("Finished ICS outstanding downtime") return nil } @@ -118,4 +118,4 @@ Upgrading a provider from `v1.1.0-multiden` to `v2.0.0` will require state migra ### Consumer -Upgrading a consumer from `v1.2.0-multiden` to `v2.0.0` will NOT require state migrations. +Upgrading a consumer from `v1.2.0-multiden` to `v2.0.0` will NOT require state migrations. \ No newline at end of file From c707c54cf04eb255ebb79c8d07926562f106ee58 Mon Sep 17 00:00:00 2001 From: insumity Date: Mon, 26 Feb 2024 16:03:41 +0100 Subject: [PATCH 19/46] cleaning up --- .changelog/unreleased/.gitkeep | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 .changelog/unreleased/.gitkeep diff --git a/.changelog/unreleased/.gitkeep b/.changelog/unreleased/.gitkeep deleted file mode 100644 index e69de29bb2..0000000000 From cf8bdb89f287760d0a3ffcce1f03a614fc6277f7 Mon Sep 17 00:00:00 2001 From: insumity Date: Tue, 27 Feb 2024 09:28:44 +0100 Subject: [PATCH 20/46] cleaning up --- .../ccv/provider/v1/provider.proto | 2 +- tests/e2e/actions.go | 2 + tests/integration/common.go | 4 +- tests/integration/distribution.go | 7 +- tests/integration/expired_client.go | 17 ++-- tests/integration/key_assignment.go | 19 ++-- tests/integration/setup.go | 5 +- tests/integration/slashing.go | 5 +- tests/integration/soft_opt_out.go | 9 +- tests/integration/unbonding.go | 12 +-- tests/integration/valset_update.go | 5 +- tests/mbt/driver/mbt_test.go | 15 +-- tests/mbt/driver/setup.go | 2 + x/ccv/provider/keeper/params.go | 6 +- x/ccv/provider/keeper/proposal.go | 9 +- x/ccv/provider/keeper/relay.go | 7 +- x/ccv/provider/keeper/validator_set_update.go | 64 ++++++------- x/ccv/provider/types/keys.go | 10 +- x/ccv/provider/types/keys_test.go | 2 +- x/ccv/provider/types/params.go | 11 +-- x/ccv/provider/types/provider.pb.go | 96 +++++++++---------- x/ccv/types/shared_params.go | 9 +- 22 files changed, 163 insertions(+), 155 deletions(-) diff --git a/proto/interchain_security/ccv/provider/v1/provider.proto b/proto/interchain_security/ccv/provider/v1/provider.proto index b1a75003f9..6036c8cb6b 100644 --- a/proto/interchain_security/ccv/provider/v1/provider.proto +++ b/proto/interchain_security/ccv/provider/v1/provider.proto @@ -190,7 +190,7 @@ message Params { [ (gogoproto.nullable) = false ]; // The number of blocks that comprise an epoch. - uint64 blocks_per_epoch = 10; + uint32 blocks_per_epoch = 10; } // SlashAcks contains cons addresses of consumer chain validators diff --git a/tests/e2e/actions.go b/tests/e2e/actions.go index b08ce20dfd..f233c09c35 100644 --- a/tests/e2e/actions.go +++ b/tests/e2e/actions.go @@ -1308,6 +1308,7 @@ func (tr TestConfig) relayPacketsGorelayer( verbose bool, ) { tr.waitBlocks(action.ChainA, 3, 90*time.Second) + tr.waitBlocks(action.ChainB, 3, 90*time.Second) pathName := tr.GetPathNameForGorelayer(action.ChainA, action.ChainB) @@ -1334,6 +1335,7 @@ func (tr TestConfig) relayPacketsHermes( verbose bool, ) { tr.waitBlocks(action.ChainA, 3, 90*time.Second) + tr.waitBlocks(action.ChainB, 3, 90*time.Second) // hermes clear packets ibc0 transfer channel-13 cmd := target.ExecCommand("hermes", "clear", "packets", diff --git a/tests/integration/common.go b/tests/integration/common.go index 0c06a567ad..335f319ab8 100644 --- a/tests/integration/common.go +++ b/tests/integration/common.go @@ -2,7 +2,6 @@ package integration import ( "fmt" - "github.com/cosmos/interchain-security/v4/x/ccv/provider/keeper" "time" clienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types" @@ -129,7 +128,7 @@ func delegateAndRedelegate(s *CCVTestSuite, delAddr sdk.AccAddress, s.Require().Equal(srcValTokensAfter.Sub(srcValTokensBefore), amount) s.providerChain.NextBlock() - nextBlocks(s.providerChain, keeper.BlocksPerEpoch) + nextBlocks(s.providerChain, s.providerApp.GetProviderKeeper().GetParams(s.providerCtx()).BlocksPerEpoch) dstValTokensBefore := s.getVal(s.providerCtx(), dstValAddr).GetBondedTokens() @@ -628,6 +627,7 @@ func (s *CCVTestSuite) mustGetStakingValFromTmVal(tmVal tmtypes.Validator) (stak return stakingVal } +// nextBlocks moves `chain` forward by a `numberOfBlocks` blocks func nextBlocks(chain *ibctesting.TestChain, numberOfBlocks uint32) { for i := uint32(0); i < numberOfBlocks; i++ { chain.NextBlock() diff --git a/tests/integration/distribution.go b/tests/integration/distribution.go index 72fb0329f2..f5f0b9563d 100644 --- a/tests/integration/distribution.go +++ b/tests/integration/distribution.go @@ -1,7 +1,6 @@ package integration import ( - "github.com/cosmos/interchain-security/v4/x/ccv/provider/keeper" "strings" transfertypes "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types" @@ -24,7 +23,7 @@ func (s *CCVTestSuite) TestRewardsDistribution() { bondAmt := sdk.NewInt(10000000) delAddr := s.providerChain.SenderAccount.GetAddress() delegate(s, delAddr, bondAmt) - nextBlocks(s.providerChain, keeper.BlocksPerEpoch) + nextBlocks(s.providerChain, s.providerApp.GetProviderKeeper().GetParams(s.providerCtx()).BlocksPerEpoch) // register a consumer reward denom params := s.consumerApp.GetConsumerKeeper().GetConsumerParams(s.consumerCtx()) @@ -125,7 +124,7 @@ func (s *CCVTestSuite) TestSendRewardsRetries() { bondAmt := sdk.NewInt(10000000) delAddr := s.providerChain.SenderAccount.GetAddress() delegate(s, delAddr, bondAmt) - nextBlocks(s.providerChain, keeper.BlocksPerEpoch) + nextBlocks(s.providerChain, s.providerApp.GetProviderKeeper().GetParams(s.providerCtx()).BlocksPerEpoch) // Register denom on consumer chain params := s.consumerApp.GetConsumerKeeper().GetConsumerParams(s.consumerCtx()) @@ -254,7 +253,7 @@ func (s *CCVTestSuite) TestEndBlockRD() { bondAmt := sdk.NewInt(10000000) delAddr := s.providerChain.SenderAccount.GetAddress() delegate(s, delAddr, bondAmt) - nextBlocks(s.providerChain, keeper.BlocksPerEpoch) + nextBlocks(s.providerChain, s.providerApp.GetProviderKeeper().GetParams(s.providerCtx()).BlocksPerEpoch) s.providerChain.NextBlock() if tc.denomRegistered { diff --git a/tests/integration/expired_client.go b/tests/integration/expired_client.go index 07acc30068..07c75f8f4a 100644 --- a/tests/integration/expired_client.go +++ b/tests/integration/expired_client.go @@ -1,7 +1,6 @@ package integration import ( - "github.com/cosmos/interchain-security/v4/x/ccv/provider/keeper" "time" clienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types" @@ -34,7 +33,8 @@ func (s *CCVTestSuite) TestVSCPacketSendExpiredClient() { delegate(s, delAddr, bondAmt) // try to send CCV packet to consumer - nextBlocks(s.providerChain, keeper.BlocksPerEpoch) + blocksPerEpoch := s.providerApp.GetProviderKeeper().GetParams(s.providerCtx()).BlocksPerEpoch + nextBlocks(s.providerChain, blocksPerEpoch) // check that the packet was added to the list of pending VSC packets packets := providerKeeper.GetPendingVSCPackets(s.providerCtx(), s.consumerChain.ChainID) @@ -42,7 +42,7 @@ func (s *CCVTestSuite) TestVSCPacketSendExpiredClient() { s.Require().Equal(1, len(packets), "unexpected number of pending VSC packets") // try again to send CCV packet to consumer - nextBlocks(s.providerChain, keeper.BlocksPerEpoch) + nextBlocks(s.providerChain, blocksPerEpoch) // check that the packet is still in the list of pending VSC packets packets = providerKeeper.GetPendingVSCPackets(s.providerCtx(), s.consumerChain.ChainID) @@ -53,7 +53,7 @@ func (s *CCVTestSuite) TestVSCPacketSendExpiredClient() { delegate(s, delAddr, bondAmt) // try again to send CCV packets to consumer - nextBlocks(s.providerChain, keeper.BlocksPerEpoch) + nextBlocks(s.providerChain, blocksPerEpoch) // check that the packets are still in the list of pending VSC packets packets = providerKeeper.GetPendingVSCPackets(s.providerCtx(), s.consumerChain.ChainID) @@ -64,7 +64,7 @@ func (s *CCVTestSuite) TestVSCPacketSendExpiredClient() { upgradeExpiredClient(s, Consumer) // go to next block - nextBlocks(s.providerChain, keeper.BlocksPerEpoch) + nextBlocks(s.providerChain, blocksPerEpoch) // check that the packets are not in the list of pending VSC packets packets = providerKeeper.GetPendingVSCPackets(s.providerCtx(), s.consumerChain.ChainID) @@ -74,7 +74,7 @@ func (s *CCVTestSuite) TestVSCPacketSendExpiredClient() { // - bond more tokens on provider to change validator powers delegate(s, delAddr, bondAmt) // - send CCV packet to consumer - nextBlocks(s.providerChain, keeper.BlocksPerEpoch) + nextBlocks(s.providerChain, blocksPerEpoch) // - relay all VSC packet from provider to consumer relayAllCommittedPackets(s, s.providerChain, s.path, ccv.ProviderPortID, s.path.EndpointB.ChannelID, 3) // - increment time so that the unbonding period ends on the consumer @@ -103,7 +103,8 @@ func (s *CCVTestSuite) TestConsumerPacketSendExpiredClient() { delegate(s, delAddr, bondAmt) // send CCV packets to consumer - nextBlocks(s.providerChain, keeper.BlocksPerEpoch) + blocksPerEpoch := s.providerApp.GetProviderKeeper().GetParams(s.providerCtx()).BlocksPerEpoch + nextBlocks(s.providerChain, blocksPerEpoch) // check that the packets are not in the list of pending VSC packets providerPackets := providerKeeper.GetPendingVSCPackets(s.providerCtx(), s.consumerChain.ChainID) @@ -173,7 +174,7 @@ func (s *CCVTestSuite) TestConsumerPacketSendExpiredClient() { // - bond more tokens on provider to change validator powers delegate(s, delAddr, bondAmt) // - send CCV packet to consumer - nextBlocks(s.providerChain, keeper.BlocksPerEpoch) + nextBlocks(s.providerChain, blocksPerEpoch) // - relay 1 VSC packet from provider to consumer relayAllCommittedPackets(s, s.providerChain, s.path, ccv.ProviderPortID, s.path.EndpointB.ChannelID, 1) // - increment time so that the unbonding period ends on the provider diff --git a/tests/integration/key_assignment.go b/tests/integration/key_assignment.go index 9b6511fbda..d60e8f139e 100644 --- a/tests/integration/key_assignment.go +++ b/tests/integration/key_assignment.go @@ -14,6 +14,7 @@ import ( ) func (s *CCVTestSuite) TestKeyAssignment() { + blocksPerEpoch := s.providerApp.GetProviderKeeper().GetParams(s.providerCtx()).BlocksPerEpoch testCases := []struct { name string assignFunc func(*providerkeeper.Keeper) error @@ -30,7 +31,7 @@ func (s *CCVTestSuite) TestKeyAssignment() { } // check that a VSCPacket is queued - nextBlocks(s.providerChain, providerkeeper.BlocksPerEpoch) + nextBlocks(s.providerChain, blocksPerEpoch) pendingPackets := pk.GetPendingVSCPackets(s.providerCtx(), s.consumerChain.ChainID) s.Require().Len(pendingPackets, 1) @@ -51,7 +52,7 @@ func (s *CCVTestSuite) TestKeyAssignment() { if err != nil { return err } - nextBlocks(s.providerChain, providerkeeper.BlocksPerEpoch) + nextBlocks(s.providerChain, blocksPerEpoch) return nil }, false, 2, @@ -73,7 +74,7 @@ func (s *CCVTestSuite) TestKeyAssignment() { delAddr := s.providerChain.SenderAccount.GetAddress() delegate(s, delAddr, bondAmt) - nextBlocks(s.providerChain, providerkeeper.BlocksPerEpoch) + nextBlocks(s.providerChain, blocksPerEpoch) return nil }, false, 2, @@ -95,7 +96,7 @@ func (s *CCVTestSuite) TestKeyAssignment() { if err != nil { return err } - nextBlocks(s.providerChain, providerkeeper.BlocksPerEpoch) + nextBlocks(s.providerChain, blocksPerEpoch) return nil }, true, 2, @@ -118,7 +119,7 @@ func (s *CCVTestSuite) TestKeyAssignment() { if err != nil { return err } - nextBlocks(s.providerChain, providerkeeper.BlocksPerEpoch) + nextBlocks(s.providerChain, blocksPerEpoch) return nil }, false, 2, @@ -134,14 +135,14 @@ func (s *CCVTestSuite) TestKeyAssignment() { if err != nil { return err } - nextBlocks(s.providerChain, providerkeeper.BlocksPerEpoch) + nextBlocks(s.providerChain, blocksPerEpoch) // same key assignment err = pk.AssignConsumerKey(s.providerCtx(), s.consumerChain.ChainID, validator, consumerKey) if err != nil { return err } - nextBlocks(s.providerChain, providerkeeper.BlocksPerEpoch) + nextBlocks(s.providerChain, blocksPerEpoch) return nil }, true, 2, @@ -157,7 +158,7 @@ func (s *CCVTestSuite) TestKeyAssignment() { if err != nil { return err } - nextBlocks(s.providerChain, providerkeeper.BlocksPerEpoch) + nextBlocks(s.providerChain, blocksPerEpoch) // same key assignment validator, consumerKey = generateNewConsumerKey(s, 0) @@ -165,7 +166,7 @@ func (s *CCVTestSuite) TestKeyAssignment() { if err != nil { return err } - nextBlocks(s.providerChain, providerkeeper.BlocksPerEpoch) + nextBlocks(s.providerChain, blocksPerEpoch) return nil }, false, 3, diff --git a/tests/integration/setup.go b/tests/integration/setup.go index cb45529471..03c63d5502 100644 --- a/tests/integration/setup.go +++ b/tests/integration/setup.go @@ -129,11 +129,11 @@ func (suite *CCVTestSuite) SetupTest() { suite.registerPacketSniffer(suite.providerChain) providerKeeper := suite.providerApp.GetProviderKeeper() - //FIXME + // set `BlocksPerEpoch` to 10: a reasonable small value greater than 1 that prevents waiting for too + // many blocks and slowing down the integration tests params := providerKeeper.GetParams(suite.providerCtx()) params.BlocksPerEpoch = 10 providerKeeper.SetParams(suite.providerCtx(), params) - // FIXME // re-assign all validator keys for the first consumer chain providerKeeper.SetPendingConsumerAdditionProp(suite.providerCtx(), &types.ConsumerAdditionProposal{ @@ -158,7 +158,6 @@ func (suite *CCVTestSuite) SetupTest() { chainID, ) suite.Require().True(found, "consumer genesis not found") - genesisState := consumertypes.GenesisState{ Params: consumerGenesisState.Params, Provider: consumerGenesisState.Provider, diff --git a/tests/integration/slashing.go b/tests/integration/slashing.go index dac2fb4fb4..8a62a36cf5 100644 --- a/tests/integration/slashing.go +++ b/tests/integration/slashing.go @@ -2,7 +2,6 @@ package integration import ( "fmt" - "github.com/cosmos/interchain-security/v4/x/ccv/provider/keeper" "time" clienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types" @@ -108,8 +107,8 @@ func (s *CCVTestSuite) TestRelayAndApplyDowntimePacket() { s.Require().True(found) } - // increase - nextBlocks(s.providerChain, keeper.BlocksPerEpoch) + // increase FIXME + nextBlocks(s.providerChain, s.providerApp.GetProviderKeeper().GetParams(s.providerCtx()).BlocksPerEpoch) // Confirm the valset update Id was incremented twice on provider, // since two endblockers have passed. diff --git a/tests/integration/soft_opt_out.go b/tests/integration/soft_opt_out.go index d70d15ef70..e8c23e321e 100644 --- a/tests/integration/soft_opt_out.go +++ b/tests/integration/soft_opt_out.go @@ -2,7 +2,6 @@ package integration import ( "bytes" - "github.com/cosmos/interchain-security/v4/x/ccv/provider/keeper" "sort" abci "github.com/cometbft/cometbft/abci/types" @@ -21,6 +20,8 @@ import ( func (suite *CCVTestSuite) TestSoftOptOut() { var votes []abci.VoteInfo + blocksPerEpoch := suite.providerApp.GetProviderKeeper().GetParams(suite.providerCtx()).BlocksPerEpoch + testCases := []struct { name string downtimeFunc func(*consumerKeeper.Keeper, *slashingkeeper.Keeper, []byte, int) @@ -74,7 +75,7 @@ func (suite *CCVTestSuite) TestSoftOptOut() { bondAmt := sdk.NewInt(100).Mul(sdk.DefaultPowerReduction) delegateByIdx(suite, delAddr, bondAmt, valIdx) - nextBlocks(suite.providerChain, keeper.BlocksPerEpoch) + nextBlocks(suite.providerChain, blocksPerEpoch) // Relay 1 VSC packet from provider to consumer relayAllCommittedPackets(suite, suite.providerChain, suite.path, ccv.ProviderPortID, suite.path.EndpointB.ChannelID, 1) @@ -113,7 +114,7 @@ func (suite *CCVTestSuite) TestSoftOptOut() { bondAmt := sdk.NewInt(100).Mul(sdk.DefaultPowerReduction) delegateByIdx(suite, delAddr, bondAmt, valIdx) - nextBlocks(suite.providerChain, keeper.BlocksPerEpoch) + nextBlocks(suite.providerChain, blocksPerEpoch) // Relay 1 VSC packet from provider to consumer relayAllCommittedPackets(suite, suite.providerChain, suite.path, ccv.ProviderPortID, suite.path.EndpointB.ChannelID, 1) @@ -150,7 +151,7 @@ func (suite *CCVTestSuite) TestSoftOptOut() { validatorPowers := []int64{1000, 500, 50, 10} suite.setupValidatorPowers(validatorPowers) - nextBlocks(suite.providerChain, keeper.BlocksPerEpoch) + nextBlocks(suite.providerChain, blocksPerEpoch) // Relay 1 VSC packet from provider to consumer relayAllCommittedPackets(suite, suite.providerChain, suite.path, ccv.ProviderPortID, suite.path.EndpointB.ChannelID, 1) diff --git a/tests/integration/unbonding.go b/tests/integration/unbonding.go index e009a511f7..a3481660ad 100644 --- a/tests/integration/unbonding.go +++ b/tests/integration/unbonding.go @@ -231,8 +231,8 @@ func (s *CCVTestSuite) TestUndelegationDuringInit() { // update init timeout timestamp tc.updateInitTimeoutTimestamp(&providerKeeper, providerUnbondingPeriod) - // call NextBlock on the provider (which increments the height) - nextBlocks(s.providerChain, providerkeeper.BlocksPerEpoch) + blocksPerEpoch := s.providerApp.GetProviderKeeper().GetParams(s.providerCtx()).BlocksPerEpoch + nextBlocks(s.providerChain, blocksPerEpoch) // check that the VSC packet is stored in state as pending pendingVSCs := providerKeeper.GetPendingVSCPackets(s.providerCtx(), s.consumerChain.ChainID) @@ -242,7 +242,7 @@ func (s *CCVTestSuite) TestUndelegationDuringInit() { delegate(s, delAddr, bondAmt) // call NextBlock on the provider (which increments the height) - nextBlocks(s.providerChain, providerkeeper.BlocksPerEpoch) + nextBlocks(s.providerChain, blocksPerEpoch) // check that the VSC packet is stored in state as pending pendingVSCs = providerKeeper.GetPendingVSCPackets(s.providerCtx(), s.consumerChain.ChainID) @@ -266,7 +266,7 @@ func (s *CCVTestSuite) TestUndelegationDuringInit() { // complete CCV channel setup s.SetupCCVChannel(s.path) - nextBlocks(s.providerChain, providerkeeper.BlocksPerEpoch) + nextBlocks(s.providerChain, blocksPerEpoch) // relay VSC packets from provider to consumer relayAllCommittedPackets(s, s.providerChain, s.path, ccv.ProviderPortID, s.path.EndpointB.ChannelID, 2) @@ -430,8 +430,8 @@ func (s *CCVTestSuite) TestRedelegationProviderFirst() { // Check that CCV unbonding op was created from AfterUnbondingInitiated hook checkCCVUnbondingOp(s, s.providerCtx(), s.consumerChain.ChainID, valsetUpdateID, true) - // Call NextBlock on the provider (which increments the height) - nextBlocks(s.providerChain, providerkeeper.BlocksPerEpoch) + // move forward by an epoch to be able to relay VSC packets + nextBlocks(s.providerChain, s.providerApp.GetProviderKeeper().GetParams(s.providerCtx()).BlocksPerEpoch) // Relay 2 VSC packets from provider to consumer (original delegation, and redelegation) relayAllCommittedPackets(s, s.providerChain, s.path, diff --git a/tests/integration/valset_update.go b/tests/integration/valset_update.go index 6920fd8e70..61a913ccc3 100644 --- a/tests/integration/valset_update.go +++ b/tests/integration/valset_update.go @@ -1,7 +1,6 @@ package integration import ( - "github.com/cosmos/interchain-security/v4/x/ccv/provider/keeper" "time" clienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types" @@ -24,8 +23,8 @@ func (s *CCVTestSuite) TestPacketRoundtrip() { delAddr := s.providerChain.SenderAccount.GetAddress() delegate(s, delAddr, bondAmt) - // Send CCV packet to consumer - nextBlocks(s.providerChain, keeper.BlocksPerEpoch) + // Send CCV packet to consumer at the end of the epoch + nextBlocks(s.providerChain, s.providerApp.GetProviderKeeper().GetParams(s.providerCtx()).BlocksPerEpoch) // Relay 1 VSC packet from provider to consumer relayAllCommittedPackets(s, s.providerChain, s.path, ccv.ProviderPortID, s.path.EndpointB.ChannelID, 1) diff --git a/tests/mbt/driver/mbt_test.go b/tests/mbt/driver/mbt_test.go index 77a9c40d36..10910d6582 100644 --- a/tests/mbt/driver/mbt_test.go +++ b/tests/mbt/driver/mbt_test.go @@ -184,6 +184,8 @@ func RunItfTrace(t *testing.T, path string) { driver.setupProvider(modelParams, valSet, signers, nodes, valNames) + // set `BlocksPerEpoch` to 10: a reasonable small value greater than 1 that prevents waiting for too + // many blocks and slowing down the tests providerParams := driver.providerKeeper().GetParams(driver.providerCtx()) providerParams.BlocksPerEpoch = 10 driver.providerKeeper().SetParams(driver.providerCtx(), providerParams) @@ -237,13 +239,15 @@ func RunItfTrace(t *testing.T, path string) { stats.numStartedChains += len(consumersToStart) stats.numStops += len(consumersToStop) - // we need 2 blocks, because for a packet sent at height H, the receiving chain + // we need at least 2 blocks, because for a packet sent at height H, the receiving chain // needs a header of height H+1 to accept the packet - // so we do one time advancement with a very small increment, - // and then increment the rest of the time + // so, we do `blocksPerEpoch` time advancements with a very small increment, + // and then increment the rest of the time to take into account the case where `blocksPerEpoch = 1` runningConsumersBefore := driver.runningConsumers() + + // going through `blocksPerEpoch` blocks to take into account an epoch blocksPerEpoch := driver.providerKeeper().GetBlocksPerEpoch(driver.providerCtx()) - for i := uint64(0); i < blocksPerEpoch; i = i + 1 { + for i := uint32(0); i < blocksPerEpoch; i = i + 1 { driver.endAndBeginBlock("provider", 1*time.Nanosecond) } for _, consumer := range driver.runningConsumers() { @@ -322,9 +326,6 @@ func RunItfTrace(t *testing.T, path string) { headerBefore := driver.chain(ChainId(consumerChain)).LastHeader _ = headerBefore - providerParams := driver.providerKeeper().GetParams(driver.providerCtx()) - providerParams.BlocksPerEpoch = 10 - driver.providerKeeper().SetParams(driver.providerCtx(), providerParams) driver.endAndBeginBlock(ChainId(consumerChain), 1*time.Nanosecond) UpdateConsumerClientOnProvider(t, driver, consumerChain) diff --git a/tests/mbt/driver/setup.go b/tests/mbt/driver/setup.go index df3980673f..e807c68308 100644 --- a/tests/mbt/driver/setup.go +++ b/tests/mbt/driver/setup.go @@ -348,6 +348,7 @@ func (s *Driver) ConfigureNewPath(consumerChain, providerChain *ibctesting.TestC ) consumerGenesis := createConsumerGenesis(params, providerChain, consumerClientState) + s.consumerKeeper(consumerChainId).InitGenesis(s.ctx(consumerChainId), consumerGenesis) consumerGenesisForProvider := ccvtypes.ConsumerGenesisState{ @@ -358,6 +359,7 @@ func (s *Driver) ConfigureNewPath(consumerChain, providerChain *ibctesting.TestC var stakingValidators []stakingtypes.Validator + // set up the current epoch validators by utilizing the initial validator set for _, val := range consumerGenesisForProvider.Provider.InitialValSet { pubKey := val.PubKey consAddr, err := ccvtypes.TMCryptoPublicKeyToConsAddr(pubKey) diff --git a/x/ccv/provider/keeper/params.go b/x/ccv/provider/keeper/params.go index 486e392d61..aa155e73e4 100644 --- a/x/ccv/provider/keeper/params.go +++ b/x/ccv/provider/keeper/params.go @@ -78,9 +78,9 @@ func (k Keeper) GetConsumerRewardDenomRegistrationFee(ctx sdk.Context) sdk.Coin return c } -// FIXME: add docstring -func (k Keeper) GetBlocksPerEpoch(ctx sdk.Context) uint64 { - var b uint64 +// GetBlocksPerEpoch return the number of blocks that constitute an epoch +func (k Keeper) GetBlocksPerEpoch(ctx sdk.Context) uint32 { + var b uint32 k.paramSpace.Get(ctx, types.KeyBlocksPerEpoch, &b) return b } diff --git a/x/ccv/provider/keeper/proposal.go b/x/ccv/provider/keeper/proposal.go index d9a48dd812..b9c9bf7cb5 100644 --- a/x/ccv/provider/keeper/proposal.go +++ b/x/ccv/provider/keeper/proposal.go @@ -253,7 +253,8 @@ func (k Keeper) MakeConsumerGenesis( return false }) - var stakingValidators []stakingtypes.Validator + var bondedValidators []stakingtypes.Validator + initialUpdates := []abci.ValidatorUpdate{} for _, p := range lastPowers { addr, err := sdk.ValAddressFromBech32(p.Address) @@ -265,7 +266,6 @@ func (k Keeper) MakeConsumerGenesis( if !found { return gen, nil, errorsmod.Wrapf(stakingtypes.ErrNoValidatorFound, "error getting validator from LastValidatorPowers: %s", err) } - stakingValidators = append(stakingValidators, val) tmProtoPk, err := val.TmConsPublicKey() if err != nil { @@ -276,9 +276,12 @@ func (k Keeper) MakeConsumerGenesis( PubKey: tmProtoPk, Power: p.Power, }) + + // gather all the bonded validators in order to construct the current epoch validators for consumer chain `chainID` + bondedValidators = append(bondedValidators, val) } - nextValidators := k.ComputeNextEpochValidators(ctx, chainID, []types.EpochValidator{}, stakingValidators) + nextValidators := k.ComputeNextEpochValidators(ctx, chainID, []types.EpochValidator{}, bondedValidators) k.ResetCurrentEpochValidators(ctx, chainID, nextValidators) // Apply key assignments to the initial valset. diff --git a/x/ccv/provider/keeper/relay.go b/x/ccv/provider/keeper/relay.go index b6fbdaf3d3..da2062a31f 100644 --- a/x/ccv/provider/keeper/relay.go +++ b/x/ccv/provider/keeper/relay.go @@ -148,8 +148,9 @@ func (k Keeper) EndBlockVSU(ctx sdk.Context) { // notify the staking module to complete all matured unbonding ops k.completeMaturedUnbondingOps(ctx) - if uint64(ctx.BlockHeight())%k.GetBlocksPerEpoch(ctx) == 0 { - k.Logger(ctx).Error(fmt.Sprintf("blocks per epoch:(%d)", k.GetBlocksPerEpoch(ctx))) + if ctx.BlockHeight()%int64(k.GetBlocksPerEpoch(ctx)) == 0 { + // only queue and send VSCPackets at the boundaries of an epoch + // collect validator updates k.QueueVSCPackets(ctx) @@ -224,7 +225,7 @@ func (k Keeper) QueueVSCPackets(ctx sdk.Context) { for _, chain := range k.GetAllConsumerChains(ctx) { currentEpochValidators := k.GetAllEpochValidators(ctx, chain.ChainId) nextEpochValidators := k.ComputeNextEpochValidators(ctx, chain.ChainId, currentEpochValidators, bondedValidators) - valUpdates := Diff(currentEpochValidators, nextEpochValidators) + valUpdates := DiffValidators(currentEpochValidators, nextEpochValidators) k.ResetCurrentEpochValidators(ctx, chain.ChainId, nextEpochValidators) // check whether there are changes in the validator set; diff --git a/x/ccv/provider/keeper/validator_set_update.go b/x/ccv/provider/keeper/validator_set_update.go index 7b018e4c28..5d3923f515 100644 --- a/x/ccv/provider/keeper/validator_set_update.go +++ b/x/ccv/provider/keeper/validator_set_update.go @@ -5,13 +5,10 @@ import ( abci "github.com/cometbft/cometbft/abci/types" "github.com/cometbft/cometbft/proto/tendermint/crypto" sdk "github.com/cosmos/cosmos-sdk/types" - types2 "github.com/cosmos/cosmos-sdk/x/staking/types" + stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" "github.com/cosmos/interchain-security/v4/x/ccv/provider/types" ) -const BlocksPerEpoch = 10 -const HoursPerEpoch = 1 - // SetEpochValidator sets provided epoch `validator` on the consumer chain with `chainID` func (k Keeper) SetEpochValidator( ctx sdk.Context, @@ -20,12 +17,11 @@ func (k Keeper) SetEpochValidator( ) { store := ctx.KVStore(k.storeKey) bz, err := validator.Marshal() - // FIXME .. .names if err != nil { - panic(fmt.Errorf("failed to marshal CurrentEpochOptedInValidator: %w", err)) + panic(fmt.Errorf("failed to marshal EpochValidator: %w", err)) } - store.Set(types.OptedInKey(chainID, validator.ProviderConsAddr), bz) + store.Set(types.EpochKey(chainID, validator.ProviderConsAddr), bz) } // DeleteEpochValidator removes epoch validator with `providerAddr` address @@ -35,7 +31,7 @@ func (k Keeper) DeleteEpochValidator( providerConsAddr types.ProviderConsAddress, ) { store := ctx.KVStore(k.storeKey) - store.Delete(types.OptedInKey(chainID, providerConsAddr.ToSdkConsAddr())) + store.Delete(types.EpochKey(chainID, providerConsAddr.ToSdkConsAddr())) } // DeleteAllEpochValidators deletes all the stored epoch validators @@ -43,7 +39,7 @@ func (k Keeper) DeleteAllEpochValidators( ctx sdk.Context, chainID string) { store := ctx.KVStore(k.storeKey) - key := types.ChainIdWithLenKey(types.OptedInBytePrefix, chainID) + key := types.ChainIdWithLenKey(types.EpochBytePrefix, chainID) iterator := sdk.KVStorePrefixIterator(store, key) var keysToDel [][]byte @@ -63,7 +59,7 @@ func (k Keeper) IsEpochValidator( providerAddr types.ProviderConsAddress, ) bool { store := ctx.KVStore(k.storeKey) - return store.Get(types.OptedInKey(chainID, providerAddr.ToSdkConsAddr())) != nil + return store.Get(types.EpochKey(chainID, providerAddr.ToSdkConsAddr())) != nil } // GetAllEpochValidators returns all the epoch validators on chain `chainID` @@ -71,7 +67,7 @@ func (k Keeper) GetAllEpochValidators( ctx sdk.Context, chainID string) (optedInValidators []types.EpochValidator) { store := ctx.KVStore(k.storeKey) - key := types.ChainIdWithLenKey(types.OptedInBytePrefix, chainID) + key := types.ChainIdWithLenKey(types.EpochBytePrefix, chainID) iterator := sdk.KVStorePrefixIterator(store, key) defer iterator.Close() @@ -79,7 +75,7 @@ func (k Keeper) GetAllEpochValidators( iterator.Value() var optedInValidator types.EpochValidator if err := optedInValidator.Unmarshal(iterator.Value()); err != nil { - panic(fmt.Errorf("failed to unmarshal CurrentEpochOptedInValidator: %w", err)) + panic(fmt.Errorf("failed to unmarshal EpochValidator: %w", err)) } optedInValidators = append(optedInValidators, optedInValidator) } @@ -87,22 +83,21 @@ func (k Keeper) GetAllEpochValidators( return optedInValidators } -// ComputeNextEpochValidators returns the next validator set that is -// responsible for validating on a consumer chain. +// ComputeNextEpochValidators returns the next validator set that is responsible for validating consumer chain `chainID`, +// based on the current epoch validators and the bonded validators. func (k Keeper) ComputeNextEpochValidators( ctx sdk.Context, chainID string, currentValidators []types.EpochValidator, - stakingValidators []types2.Validator, + bondedValidators []stakingtypes.Validator, ) []types.EpochValidator { isCurrentValidator := make(map[string]types.EpochValidator) for _, val := range currentValidators { - // `currentPublicKey` is the currently used key by validator `val` when validating on the consumer chain isCurrentValidator[string(val.ProviderConsAddr)] = val } var nextValidators []types.EpochValidator - for _, val := range stakingValidators { + for _, val := range bondedValidators { // get next voting power and the next consumer public key nextPower := k.stakingKeeper.GetLastValidatorPower(ctx, val.GetOperator()) consAddr, err := val.GetConsAddr() @@ -111,16 +106,13 @@ func (k Keeper) ComputeNextEpochValidators( k.Logger(ctx).Error("could not get consensus address of validator (%+v): %w", val, err) continue } - nextConsumerPublicKey, found := k.GetValidatorConsumerPubKey(ctx, chainID, types.NewProviderConsAddress(consAddr)) - if !found { - // TODO: vale message oti den exei ginei assigned consumer key - k.Logger(ctx).Info("could not retrieve public key for validator (%+v)", val) + nextConsumerPublicKey, foundConsumerPublicKey := k.GetValidatorConsumerPubKey(ctx, chainID, types.NewProviderConsAddress(consAddr)) + if !foundConsumerPublicKey { // if no consumer key assigned then use the validator's key itself + k.Logger(ctx).Info("could not retrieve public key for validator (%+v) on consumer chain (%s) because"+ + " the validator did not assign a new consumer key", val, chainID) nextConsumerPublicKey, err = val.TmConsPublicKey() } - if nextConsumerPublicKey.Sum == nil || nextConsumerPublicKey.Size() == 0 { - k.Logger(ctx).Error("THE SUM IS NIL ....") - } nextConsumerPublicKeyBytes, err := nextConsumerPublicKey.Marshal() if err != nil { @@ -130,8 +122,10 @@ func (k Keeper) ComputeNextEpochValidators( } startBlockHeight := ctx.BlockHeight() - if v, found2 := isCurrentValidator[string(consAddr)]; found2 { - // remain sstable + if v, found := isCurrentValidator[string(consAddr)]; found { + // If the validator was already an epoch validator validating the consumer chain, we let + // `StartBlockHeight` as is. This way, by looking at `StartBlockHeight` of an epoch validator, we can + // infer how long has a validator been continuously validating the consumer chain. startBlockHeight = v.GetStartBlockHeight() } @@ -147,12 +141,13 @@ func (k Keeper) ComputeNextEpochValidators( return nextValidators } -// Diff compares two validator sets and return sthe Diff -// keeper ... FIXME not neeeded -func Diff( +// DiffValidators compares the current and the next epoch validators and returns a `ValidatorUpdate` diff needed +// by CometBFT to update the validator set on a chain. +func DiffValidators( currentValidators []types.EpochValidator, nextValidators []types.EpochValidator) []abci.ValidatorUpdate { var updates []abci.ValidatorUpdate + isCurrentValidator := make(map[string]types.EpochValidator) for _, val := range currentValidators { isCurrentValidator[string(val.ProviderConsAddr)] = val @@ -188,15 +183,16 @@ func Diff( } else if val.Power != nextVal.Power { updates = append(updates, abci.ValidatorUpdate{PubKey: nextPublicKey, Power: nextVal.Power}) } + // else no update is needed because neither the consumer public key changed, nor the power of the validator } else { // not found in next validators and hence the validator has to be removed updates = append(updates, abci.ValidatorUpdate{PubKey: currentPublicKey, Power: 0}) } } - // validators to be added for _, val := range nextValidators { if _, found := isCurrentValidator[string(val.ProviderConsAddr)]; !found { + // validators that are about to join an epoch var nextPublicKey crypto.PublicKey err := nextPublicKey.Unmarshal(val.ConsumerPublicKey) if err != nil { @@ -212,11 +208,9 @@ func Diff( return updates } -// ResetCurrentEpochValidators resets the opted-in validators with the newest set that was computed by -// `ComputeNextValidators` and hence this method should only be called after `ComputeNextValidators` has completed. -func (k Keeper) ResetCurrentEpochValidators(ctx sdk.Context, chainID string, - nextValidators []types.EpochValidator) { - // for epochs we do not need to do this ... +// ResetCurrentEpochValidators resets the current epoch validators with the `nextValidators` computed by +// `ComputeNextEpochValidators` and hence this method should only be called after `ComputeNextEpochValidators` has completed. +func (k Keeper) ResetCurrentEpochValidators(ctx sdk.Context, chainID string, nextValidators []types.EpochValidator) { k.DeleteAllEpochValidators(ctx, chainID) for _, val := range nextValidators { k.SetEpochValidator(ctx, chainID, val) diff --git a/x/ccv/provider/types/keys.go b/x/ccv/provider/types/keys.go index 209d5c1cb9..433fc47f4c 100644 --- a/x/ccv/provider/types/keys.go +++ b/x/ccv/provider/types/keys.go @@ -145,8 +145,8 @@ const ( // ProposedConsumerChainByteKey is the byte prefix storing the consumer chainId in consumerAddition gov proposal submitted before voting finishes ProposedConsumerChainByteKey - // OptedInBytePrefix is the byte prefix used when storing for each consumer chain all the opted in validators - OptedInBytePrefix + // EpochBytePrefix is the byte prefix used when storing for each consumer chain all the opted in validators in this epoch + EpochBytePrefix // NOTE: DO NOT ADD NEW BYTE PREFIXES HERE WITHOUT ADDING THEM TO getAllKeyPrefixes() IN keys_test.go ) @@ -520,9 +520,9 @@ func ParseProposedConsumerChainKey(prefix byte, bz []byte) (uint64, error) { return proposalID, nil } -// OptedInKey returns the key of consumer chain `chainID` and validator with `providerAddr` -func OptedInKey(chainID string, providerAddr []byte) []byte { - prefix := ChainIdWithLenKey(OptedInBytePrefix, chainID) +// EpochKey returns the key of consumer chain `chainID` and validator with `providerAddr` +func EpochKey(chainID string, providerAddr []byte) []byte { + prefix := ChainIdWithLenKey(EpochBytePrefix, chainID) return append(prefix, providerAddr...) } diff --git a/x/ccv/provider/types/keys_test.go b/x/ccv/provider/types/keys_test.go index 447ae04d28..36a87e6ea9 100644 --- a/x/ccv/provider/types/keys_test.go +++ b/x/ccv/provider/types/keys_test.go @@ -56,7 +56,7 @@ func getAllKeyPrefixes() []byte { providertypes.VSCMaturedHandledThisBlockBytePrefix, providertypes.EquivocationEvidenceMinHeightBytePrefix, providertypes.ProposedConsumerChainByteKey, - providertypes.OptedInBytePrefix, + providertypes.EpochBytePrefix, } } diff --git a/x/ccv/provider/types/params.go b/x/ccv/provider/types/params.go index f482201412..502b9a0231 100644 --- a/x/ccv/provider/types/params.go +++ b/x/ccv/provider/types/params.go @@ -37,8 +37,9 @@ const ( // fraction of total voting power that the slash meter can hold. DefaultSlashMeterReplenishFraction = "0.05" - //FIMXe - DefaultBlocksPerEpoch = 1000 + // DefaultBlocksPerEpoch defines the default blocks that consist an epoch. Assuming we need 6 seconds per block, + // an epoch corresponds to 1 hour (6 * 600 = 3600 seconds). + DefaultBlocksPerEpoch = 600 ) // Reflection based keys for params subspace @@ -68,7 +69,7 @@ func NewParams( slashMeterReplenishPeriod time.Duration, slashMeterReplenishFraction string, consumerRewardDenomRegistrationFee sdk.Coin, - blocksPerEpoch uint64, + blocksPerEpoch uint32, ) Params { return Params{ TemplateClient: cs, @@ -158,9 +159,7 @@ func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs { paramtypes.NewParamSetPair(KeySlashMeterReplenishPeriod, p.SlashMeterReplenishPeriod, ccvtypes.ValidateDuration), paramtypes.NewParamSetPair(KeySlashMeterReplenishFraction, p.SlashMeterReplenishFraction, ccvtypes.ValidateStringFraction), paramtypes.NewParamSetPair(KeyConsumerRewardDenomRegistrationFee, p.ConsumerRewardDenomRegistrationFee, ValidateCoin), - - //FIXME: do we need this??? yes for registration .. but no validation is needed? unless we put here the max bound - paramtypes.NewParamSetPair(KeyBlocksPerEpoch, p.BlocksPerEpoch, ccvtypes.ValidateDummy), + paramtypes.NewParamSetPair(KeyBlocksPerEpoch, p.BlocksPerEpoch, ccvtypes.ValidatePositiveUint32), } } diff --git a/x/ccv/provider/types/provider.pb.go b/x/ccv/provider/types/provider.pb.go index 8cd6940490..c204aa3d01 100644 --- a/x/ccv/provider/types/provider.pb.go +++ b/x/ccv/provider/types/provider.pb.go @@ -452,7 +452,7 @@ type Params struct { // The fee required to be paid to add a reward denom ConsumerRewardDenomRegistrationFee types2.Coin `protobuf:"bytes,9,opt,name=consumer_reward_denom_registration_fee,json=consumerRewardDenomRegistrationFee,proto3" json:"consumer_reward_denom_registration_fee"` // The number of blocks that comprise an epoch. - BlocksPerEpoch uint64 `protobuf:"varint,10,opt,name=blocks_per_epoch,json=blocksPerEpoch,proto3" json:"blocks_per_epoch,omitempty"` + BlocksPerEpoch uint32 `protobuf:"varint,10,opt,name=blocks_per_epoch,json=blocksPerEpoch,proto3" json:"blocks_per_epoch,omitempty"` } func (m *Params) Reset() { *m = Params{} } @@ -544,7 +544,7 @@ func (m *Params) GetConsumerRewardDenomRegistrationFee() types2.Coin { return types2.Coin{} } -func (m *Params) GetBlocksPerEpoch() uint64 { +func (m *Params) GetBlocksPerEpoch() uint32 { if m != nil { return m.BlocksPerEpoch } @@ -1500,7 +1500,7 @@ func init() { } var fileDescriptor_f22ec409a72b7b72 = []byte{ - // 1777 bytes of a gzipped FileDescriptorProto + // 1778 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x58, 0xcf, 0x73, 0xdb, 0xc6, 0xf5, 0x17, 0x48, 0x4a, 0x16, 0x1f, 0x25, 0x8a, 0x86, 0x94, 0x18, 0xf2, 0x57, 0x5f, 0x4a, 0x46, 0x9a, 0x54, 0x9d, 0x34, 0x60, 0xa5, 0xb4, 0x33, 0x19, 0x4f, 0x33, 0x19, 0x89, 0x72, 0x62, 0x59, @@ -1569,50 +1569,50 @@ var fileDescriptor_f22ec409a72b7b72 = []byte{ 0xd2, 0x09, 0xfa, 0xbf, 0x6b, 0x20, 0x8a, 0x2c, 0x09, 0x78, 0xa7, 0xb2, 0x47, 0x54, 0x57, 0x7b, 0xba, 0xa1, 0x3c, 0x4e, 0x86, 0x6a, 0xd8, 0xa2, 0x74, 0xa5, 0x10, 0x52, 0xec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5, 0xa8, 0x6f, 0xde, 0x87, 0xcd, 0x12, 0x68, 0x7a, 0x0c, + 0xa7, 0x88, 0x4d, 0xf7, 0x4e, 0xc1, 0x30, 0x35, 0x89, 0x85, 0xfd, 0x18, 0x36, 0x8e, 0xcb, 0xa6, + 0x2f, 0x86, 0xfc, 0x94, 0x87, 0xc6, 0xf4, 0x36, 0xdf, 0x82, 0x66, 0xf1, 0x25, 0xa2, 0xbd, 0x6f, + 0xb8, 0x25, 0xc1, 0x1e, 0x43, 0xe7, 0x42, 0xe0, 0x33, 0x12, 0xfa, 0x25, 0xd8, 0x0d, 0x01, 0x38, + 0x9c, 0x05, 0x9a, 0xfb, 0xa6, 0x5b, 0xaa, 0x63, 0xb0, 0x79, 0x81, 0x02, 0xea, 0x23, 0xc9, 0xf8, + 0x19, 0x91, 0xe9, 0x02, 0x3e, 0x45, 0xf8, 0x92, 0x48, 0x61, 0xba, 0xd0, 0x08, 0xa8, 0x90, 0x59, + 0x65, 0x7d, 0x70, 0x63, 0x65, 0x25, 0x7b, 0xce, 0x4d, 0x20, 0x47, 0x48, 0xa2, 0xac, 0x77, 0x35, + 0x96, 0xfd, 0x63, 0x58, 0xff, 0x14, 0xc9, 0x98, 0x13, 0x7f, 0x2a, 0xc7, 0x1d, 0xa8, 0xab, 0xfc, + 0x19, 0x3a, 0x7f, 0xea, 0x51, 0xdd, 0x07, 0xac, 0x07, 0x5f, 0x44, 0x8c, 0x4b, 0xe2, 0x5f, 0x89, + 0xc8, 0x2b, 0xc2, 0x7b, 0x09, 0xeb, 0x2a, 0x58, 0x82, 0x84, 0xbe, 0x57, 0xf8, 0x99, 0xe6, 0xb1, + 0xb5, 0xff, 0x8b, 0xb9, 0xba, 0x63, 0x56, 0x5d, 0xe6, 0xc0, 0xed, 0x64, 0x86, 0x2e, 0xec, 0x3f, + 0x1a, 0x60, 0x9d, 0x90, 0xc9, 0x81, 0x10, 0x74, 0x18, 0x8e, 0x49, 0x28, 0xd5, 0x0c, 0x44, 0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x9d, 0xfc, 0x24, 0xbf, 0xb7, 0x29, 0x6e, 0x21, 0x11, 0x97, + 0x9e, 0xde, 0x77, 0xf9, 0x47, 0x79, 0x4d, 0x17, 0x49, 0x47, 0x9f, 0x1c, 0xaa, 0x83, 0xec, 0xab, + 0xfb, 0xda, 0x2a, 0x32, 0x1d, 0x58, 0x2f, 0xbc, 0x8b, 0x74, 0x2e, 0x75, 0xc2, 0xd3, 0xdb, 0x62, + 0x71, 0x59, 0x2d, 0xb2, 0x7c, 0xf8, 0xe4, 0x9b, 0x17, 0x5d, 0xe3, 0xdb, 0x17, 0x5d, 0xe3, 0x9f, + 0x2f, 0xba, 0xc6, 0x97, 0x2f, 0xbb, 0x0b, 0xdf, 0xbe, 0xec, 0x2e, 0xfc, 0xe3, 0x65, 0x77, 0xe1, + 0xb7, 0x1f, 0x0e, 0xa9, 0x1c, 0xc5, 0x03, 0x07, 0xb3, 0x71, 0x2f, 0xfb, 0x73, 0x51, 0x06, 0xe8, + 0xbd, 0xe2, 0xb7, 0x4e, 0xf2, 0xf3, 0xde, 0x17, 0xd3, 0x3f, 0x8d, 0xe4, 0x24, 0x22, 0x62, 0xb0, + 0xa4, 0x47, 0xd9, 0xfb, 0xff, 0x0e, 0x00, 0x00, 0xff, 0xff, 0x75, 0xc2, 0x0d, 0x12, 0x65, 0x12, + 0x00, 0x00, } func (m *ConsumerAdditionProposal) Marshal() (dAtA []byte, err error) { @@ -4690,7 +4690,7 @@ func (m *Params) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.BlocksPerEpoch |= uint64(b&0x7F) << shift + m.BlocksPerEpoch |= uint32(b&0x7F) << shift if b < 0x80 { break } diff --git a/x/ccv/types/shared_params.go b/x/ccv/types/shared_params.go index e5143f7af3..b1fded0d4b 100644 --- a/x/ccv/types/shared_params.go +++ b/x/ccv/types/shared_params.go @@ -51,7 +51,14 @@ func ValidatePositiveInt64(i interface{}) error { return nil } -func ValidateDummy(i interface{}) error { +func ValidatePositiveUint32(i interface{}) error { + if _, ok := i.(uint32); !ok { + return fmt.Errorf("invalid parameter type: %T", i) + } + // FIXME: + //if i.(uint32) == 0 { + // return fmt.Errorf("parameter must be positive") + //} return nil } From ead0873f9d9e21055ad0ef4423648b403f634783 Mon Sep 17 00:00:00 2001 From: insumity Date: Tue, 27 Feb 2024 13:29:31 +0100 Subject: [PATCH 21/46] cleaning up --- tests/e2e/config.go | 26 ++--- x/ccv/provider/keeper/relay_test.go | 168 +++++++++++++++++----------- 2 files changed, 116 insertions(+), 78 deletions(-) diff --git a/tests/e2e/config.go b/tests/e2e/config.go index fe26c6f3d2..95186583b4 100644 --- a/tests/e2e/config.go +++ b/tests/e2e/config.go @@ -241,7 +241,7 @@ func SlashThrottleTestConfig() TestConfig { ".app_state.slashing.params.slash_fraction_downtime = \"0.010000000000000000\" | " + ".app_state.provider.params.slash_meter_replenish_fraction = \"0.10\" | " + ".app_state.provider.params.slash_meter_replenish_period = \"20s\" | " + - ".app_state.provider.params.blocks_per_epoch = 3", + ".app_state.provider.params.blocks_per_epoch = 2", }, ChainID("consu"): { ChainId: ChainID("consu"), @@ -250,7 +250,7 @@ func SlashThrottleTestConfig() TestConfig { IpPrefix: "7.7.8", VotingWaitTime: 20, GenesisChanges: ".app_state.gov.params.voting_period = \"20s\" | " + - ".app_state.slashing.params.signed_blocks_window = \"15\" | " + + ".app_state.slashing.params.signed_blocks_window = \"20\" | " + ".app_state.slashing.params.min_signed_per_window = \"0.500000000000000000\" | " + ".app_state.slashing.params.downtime_jail_duration = \"60s\" | " + ".app_state.slashing.params.slash_fraction_downtime = \"0.010000000000000000\" | " + @@ -290,7 +290,7 @@ func DefaultTestConfig() TestConfig { ".app_state.slashing.params.slash_fraction_downtime = \"0.010000000000000000\" | " + ".app_state.provider.params.slash_meter_replenish_fraction = \"1.0\" | " + // This disables slash packet throttling ".app_state.provider.params.slash_meter_replenish_period = \"3s\" | " + - ".app_state.provider.params.blocks_per_epoch = 3", + ".app_state.provider.params.blocks_per_epoch = 2", }, ChainID("consu"): { ChainId: ChainID("consu"), @@ -299,7 +299,7 @@ func DefaultTestConfig() TestConfig { IpPrefix: "7.7.8", VotingWaitTime: 20, GenesisChanges: ".app_state.gov.params.voting_period = \"20s\" | " + - ".app_state.slashing.params.signed_blocks_window = \"15\" | " + + ".app_state.slashing.params.signed_blocks_window = \"20\" | " + ".app_state.slashing.params.min_signed_per_window = \"0.500000000000000000\" | " + ".app_state.slashing.params.downtime_jail_duration = \"60s\" | " + ".app_state.slashing.params.slash_fraction_downtime = \"0.010000000000000000\"", @@ -320,7 +320,7 @@ func DemocracyTestConfig(allowReward bool) TestConfig { ".app_state.slashing.params.downtime_jail_duration = \"60s\" | " + ".app_state.slashing.params.slash_fraction_downtime = \"0.010000000000000000\" | " + ".app_state.transfer.params.send_enabled = false | " + - ".app_state.provider.params.blocks_per_epoch = 3" + ".app_state.provider.params.blocks_per_epoch = 2" if allowReward { // This allows the consumer chain to send rewards in the stake denom @@ -351,7 +351,7 @@ func DemocracyTestConfig(allowReward bool) TestConfig { ".app_state.slashing.params.downtime_jail_duration = \"60s\" | " + ".app_state.slashing.params.slash_fraction_downtime = \"0.010000000000000000\" | " + ".app_state.provider.params.slash_meter_replenish_fraction = \"1.0\" | " + // This disables slash packet throttling - ".app_state.provider.params.blocks_per_epoch = 3", + ".app_state.provider.params.blocks_per_epoch = 2", }, ChainID("democ"): { ChainId: ChainID("democ"), @@ -394,7 +394,7 @@ func MultiConsumerTestConfig() TestConfig { ".app_state.slashing.params.downtime_jail_duration = \"60s\" | " + ".app_state.slashing.params.slash_fraction_downtime = \"0.010000000000000000\" | " + ".app_state.provider.params.slash_meter_replenish_fraction = \"1.0\" | " + // This disables slash packet throttling - ".app_state.provider.params.blocks_per_epoch = 3", + ".app_state.provider.params.blocks_per_epoch = 2", }, ChainID("consu"): { ChainId: ChainID("consu"), @@ -403,7 +403,7 @@ func MultiConsumerTestConfig() TestConfig { IpPrefix: "7.7.8", VotingWaitTime: 20, GenesisChanges: ".app_state.gov.params.voting_period = \"20s\" | " + - ".app_state.slashing.params.signed_blocks_window = \"10\" | " + + ".app_state.slashing.params.signed_blocks_window = \"20\" | " + ".app_state.slashing.params.min_signed_per_window = \"0.500000000000000000\" | " + ".app_state.slashing.params.downtime_jail_duration = \"60s\" | " + ".app_state.slashing.params.slash_fraction_downtime = \"0.010000000000000000\"", @@ -415,7 +415,7 @@ func MultiConsumerTestConfig() TestConfig { IpPrefix: "7.7.9", VotingWaitTime: 20, GenesisChanges: ".app_state.gov.params.voting_period = \"20s\" | " + - ".app_state.slashing.params.signed_blocks_window = \"10\" | " + + ".app_state.slashing.params.signed_blocks_window = \"20\" | " + ".app_state.slashing.params.min_signed_per_window = \"0.500000000000000000\" | " + ".app_state.slashing.params.downtime_jail_duration = \"60s\" | " + ".app_state.slashing.params.slash_fraction_downtime = \"0.010000000000000000\"", @@ -454,7 +454,7 @@ func ChangeoverTestConfig() TestConfig { ".app_state.slashing.params.slash_fraction_downtime = \"0.010000000000000000\" | " + ".app_state.provider.params.slash_meter_replenish_fraction = \"1.0\" | " + // This disables slash packet throttling ".app_state.provider.params.slash_meter_replenish_period = \"3s\" | " + - ".app_state.provider.params.blocks_per_epoch = 3", + ".app_state.provider.params.blocks_per_epoch = 2", }, ChainID("sover"): { ChainId: ChainID("sover"), @@ -464,7 +464,7 @@ func ChangeoverTestConfig() TestConfig { IpPrefix: "7.7.8", VotingWaitTime: 20, GenesisChanges: ".app_state.gov.params.voting_period = \"20s\" | " + - ".app_state.slashing.params.signed_blocks_window = \"15\" | " + + ".app_state.slashing.params.signed_blocks_window = \"20\" | " + ".app_state.slashing.params.min_signed_per_window = \"0.500000000000000000\" | " + ".app_state.slashing.params.downtime_jail_duration = \"60s\" | " + ".app_state.slashing.params.slash_fraction_downtime = \"0.010000000000000000\" | " + @@ -555,7 +555,7 @@ func ConsumerMisbehaviourTestConfig() TestConfig { ".app_state.slashing.params.slash_fraction_downtime = \"0.010000000000000000\" | " + ".app_state.provider.params.slash_meter_replenish_fraction = \"1.0\" | " + // This disables slash packet throttling ".app_state.provider.params.slash_meter_replenish_period = \"3s\" | " + - ".app_state.provider.params.blocks_per_epoch = 3", + ".app_state.provider.params.blocks_per_epoch = 2", }, ChainID("consu"): { ChainId: ChainID("consu"), @@ -564,7 +564,7 @@ func ConsumerMisbehaviourTestConfig() TestConfig { IpPrefix: "7.7.8", VotingWaitTime: 20, GenesisChanges: ".app_state.gov.params.voting_period = \"20s\" | " + - ".app_state.slashing.params.signed_blocks_window = \"15\" | " + + ".app_state.slashing.params.signed_blocks_window = \"20\" | " + ".app_state.slashing.params.min_signed_per_window = \"0.500000000000000000\" | " + ".app_state.slashing.params.downtime_jail_duration = \"60s\" | " + ".app_state.slashing.params.slash_fraction_downtime = \"0.010000000000000000\"", diff --git a/x/ccv/provider/keeper/relay_test.go b/x/ccv/provider/keeper/relay_test.go index e2b6c13c2e..b7e89b3dc2 100644 --- a/x/ccv/provider/keeper/relay_test.go +++ b/x/ccv/provider/keeper/relay_test.go @@ -1,6 +1,8 @@ package keeper_test import ( + cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" + ibctesting "github.com/cosmos/ibc-go/v7/testing" "strings" "testing" @@ -16,6 +18,7 @@ import ( abci "github.com/cometbft/cometbft/abci/types" + "github.com/cosmos/interchain-security/v4/testutil/crypto" cryptotestutil "github.com/cosmos/interchain-security/v4/testutil/crypto" testkeeper "github.com/cosmos/interchain-security/v4/testutil/keeper" "github.com/cosmos/interchain-security/v4/x/ccv/provider/keeper" @@ -24,71 +27,62 @@ import ( ) // TestQueueVSCPackets tests queueing validator set updates. -//func TestQueueVSCPackets(t *testing.T) { -// _, _, key := ibctesting.GenerateKeys(t, 1) -// tmPubKey, _ := cryptocodec.ToTmProtoPublicKey(key) -// -// testCases := []struct { -// name string -// packets []ccv.ValidatorSetChangePacketData -// expectNextValsetUpdateId uint64 -// expectedQueueSize int -// }{ -// { -// name: "no updates to send", -// packets: []ccv.ValidatorSetChangePacketData{}, -// expectNextValsetUpdateId: 1, -// expectedQueueSize: 0, -// }, -// { -// name: "have updates to send", -// packets: []ccv.ValidatorSetChangePacketData{ -// { -// ValidatorUpdates: []abci.ValidatorUpdate{ -// {PubKey: tmPubKey, Power: 1}, -// }, -// ValsetUpdateId: 1, -// }, -// }, -// expectNextValsetUpdateId: 1, -// expectedQueueSize: 1, -// }, -// } -// -// chainID := "consumer" -// -// for _, tc := range testCases { -// keeperParams := testkeeper.NewInMemKeeperParams(t) -// ctx := keeperParams.Ctx -// -// ctrl := gomock.NewController(t) -// defer ctrl.Finish() -// mocks := testkeeper.NewMockedKeepers(ctrl) -// //mockStakingKeeper := mocks.MockStakingKeeper -// -// //mockUpdates := []abci.ValidatorUpdate{} -// //if len(tc.packets) != 0 { -// // mockUpdates = tc.packets[0].ValidatorUpdates -// //} -// -// //gomock.InOrder( -// // mockStakingKeeper.EXPECT().GetValidatorUpdates(gomock.Eq(ctx)).Return(mockUpdates), -// //) -// -// pk := testkeeper.NewInMemProviderKeeper(keeperParams, mocks) -// // no-op if tc.packets is empty -// pk.AppendPendingVSCPackets(ctx, chainID, tc.packets...) -// -// pk.QueueVSCPackets(ctx) -// pending := pk.GetPendingVSCPackets(ctx, chainID) -// require.Len(t, pending, tc.expectedQueueSize, "pending vsc queue mismatch (%v != %v) in case: '%s'", tc.expectedQueueSize, len(pending), tc.name) -// -// // next valset update ID -> default value in tests is 0 -// // each call to QueueValidatorUpdates will increment the ValidatorUpdateID -// valUpdateID := pk.GetValidatorSetUpdateId(ctx) -// require.Equal(t, tc.expectNextValsetUpdateId, valUpdateID, "valUpdateID (%v != %v) mismatch in case: '%s'", tc.expectNextValsetUpdateId, valUpdateID, tc.name) -// } -//} +func TestQueueVSCPackets(t *testing.T) { + _, _, key := ibctesting.GenerateKeys(t, 1) + tmPubKey, _ := cryptocodec.ToTmProtoPublicKey(key) + + testCases := []struct { + name string + packets []ccv.ValidatorSetChangePacketData + expectNextValsetUpdateId uint64 + expectedQueueSize int + }{ + { + name: "no updates to send", + packets: []ccv.ValidatorSetChangePacketData{}, + expectNextValsetUpdateId: 1, + expectedQueueSize: 0, + }, + { + name: "have updates to send", + packets: []ccv.ValidatorSetChangePacketData{ + { + ValidatorUpdates: []abci.ValidatorUpdate{ + {PubKey: tmPubKey, Power: 1}, + }, + ValsetUpdateId: 1, + }, + }, + expectNextValsetUpdateId: 1, + expectedQueueSize: 1, + }, + } + + chainID := "consumer" + + for _, tc := range testCases { + keeperParams := testkeeper.NewInMemKeeperParams(t) + ctx := keeperParams.Ctx + + ctrl := gomock.NewController(t) + defer ctrl.Finish() + mocks := testkeeper.NewMockedKeepers(ctrl) + mocks.MockStakingKeeper.EXPECT().GetLastValidators(ctx).Times(1) + + pk := testkeeper.NewInMemProviderKeeper(keeperParams, mocks) + // no-op if tc.packets is empty + pk.AppendPendingVSCPackets(ctx, chainID, tc.packets...) + + pk.QueueVSCPackets(ctx) + pending := pk.GetPendingVSCPackets(ctx, chainID) + require.Len(t, pending, tc.expectedQueueSize, "pending vsc queue mismatch (%v != %v) in case: '%s'", tc.expectedQueueSize, len(pending), tc.name) + + // next valset update ID -> default value in tests is 0 + // each call to QueueValidatorUpdates will increment the ValidatorUpdateID + valUpdateID := pk.GetValidatorSetUpdateId(ctx) + require.Equal(t, tc.expectNextValsetUpdateId, valUpdateID, "valUpdateID (%v != %v) mismatch in case: '%s'", tc.expectNextValsetUpdateId, valUpdateID, tc.name) + } +} // TestOnRecvVSCMaturedPacket tests the OnRecvVSCMaturedPacket method of the keeper. // @@ -659,3 +653,47 @@ func TestOnAcknowledgementPacketWithAckError(t *testing.T) { testkeeper.TestProviderStateIsCleanedAfterConsumerChainIsStopped(t, ctx, providerKeeper, "chainID", "channelID") require.NoError(t, err) } + +// TestEndBlockVSU tests that during `EndBlockVSU`, we only queue VSC packets at the boundaries of an epoch +func TestEndBlockVSU(t *testing.T) { + providerKeeper, ctx, ctrl, mocks := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) + defer ctrl.Finish() + + // 10 blocks constitute an epoch + params := providertypes.DefaultParams() + params.BlocksPerEpoch = 10 + providerKeeper.SetParams(ctx, params) + + // create 4 sample lastValidators + var lastValidators []stakingtypes.Validator + for i := 0; i < 4; i++ { + lastValidators = append(lastValidators, crypto.NewCryptoIdentityFromIntSeed(i).SDKStakingValidator()) + } + mocks.MockStakingKeeper.EXPECT().GetLastValidators(gomock.Any()).Return(lastValidators).AnyTimes() + mocks.MockStakingKeeper.EXPECT().GetLastValidatorPower(gomock.Any(), gomock.Any()).Return(int64(2)).AnyTimes() + + // set a sample client for a consumer chain so that `GetAllConsumerChains` in `QueueVSCPackets` iterates at least once + providerKeeper.SetConsumerClientId(ctx, "chainID", "clientID") + + // with block height of 1 we do not expect any queueing of VSC packets + ctx = ctx.WithBlockHeight(1) + providerKeeper.EndBlockVSU(ctx) + require.Equal(t, 0, len(providerKeeper.GetPendingVSCPackets(ctx, "chainID"))) + + // with block height of 5 we do not expect any queueing of VSC packets + ctx = ctx.WithBlockHeight(5) + providerKeeper.EndBlockVSU(ctx) + require.Equal(t, 0, len(providerKeeper.GetPendingVSCPackets(ctx, "chainID"))) + + // with block height of 10 we expect the queueing of one VSC packet + ctx = ctx.WithBlockHeight(10) + providerKeeper.EndBlockVSU(ctx) + require.Equal(t, 1, len(providerKeeper.GetPendingVSCPackets(ctx, "chainID"))) + + // With block height of 15 we expect no additional queueing of a VSC packet. + // Note that the pending VSC packet is still there because `SendVSCPackets` does not send the packet. We + // need to mock channels, etc. for this to work, and it's out of scope for this test. + ctx = ctx.WithBlockHeight(15) + providerKeeper.EndBlockVSU(ctx) + require.Equal(t, 1, len(providerKeeper.GetPendingVSCPackets(ctx, "chainID"))) +} From 88081cdf019190d52f3bdfee3171760eea831db7 Mon Sep 17 00:00:00 2001 From: insumity Date: Tue, 27 Feb 2024 16:46:43 +0100 Subject: [PATCH 22/46] added more tests --- .../ccv/provider/v1/provider.proto | 7 +- tests/mbt/driver/setup.go | 3 +- x/ccv/provider/keeper/proposal.go | 2 +- x/ccv/provider/keeper/relay.go | 2 +- x/ccv/provider/keeper/validator_set_update.go | 19 +- .../keeper/validator_set_update_test.go | 315 ++++++++++++++++++ x/ccv/provider/types/provider.pb.go | 269 +++++++-------- 7 files changed, 437 insertions(+), 180 deletions(-) create mode 100644 x/ccv/provider/keeper/validator_set_update_test.go diff --git a/proto/interchain_security/ccv/provider/v1/provider.proto b/proto/interchain_security/ccv/provider/v1/provider.proto index 6036c8cb6b..1c9a0dc6b9 100644 --- a/proto/interchain_security/ccv/provider/v1/provider.proto +++ b/proto/interchain_security/ccv/provider/v1/provider.proto @@ -304,11 +304,8 @@ message ConsumerAddrsToPrune { message EpochValidator { // validator's consensus address on the provider chain bytes provider_cons_addr = 1; - // The block height the provider chain had when the validator opted in for the first time. If the validator - // remains opted in during subsequent epochs, `start_block_height` remains unchanged. - int64 start_block_height = 2; // voting power the validator has during this epoch - int64 power = 3; + int64 power = 2; // public key the validator uses on the consumer chain during this epoch - bytes consumer_public_key = 4; + bytes consumer_public_key = 3; } \ No newline at end of file diff --git a/tests/mbt/driver/setup.go b/tests/mbt/driver/setup.go index e807c68308..ae71b17d61 100644 --- a/tests/mbt/driver/setup.go +++ b/tests/mbt/driver/setup.go @@ -2,7 +2,6 @@ package main import ( "encoding/json" - "github.com/cosmos/interchain-security/v4/x/ccv/provider/types" "log" "testing" "time" @@ -374,7 +373,7 @@ func (s *Driver) ConfigureNewPath(consumerChain, providerChain *ibctesting.TestC stakingValidators = append(stakingValidators, v) } - nextValidators := s.providerKeeper().ComputeNextEpochValidators(s.providerCtx(), string(consumerChainId), []types.EpochValidator{}, stakingValidators) + nextValidators := s.providerKeeper().ComputeNextEpochValidators(s.providerCtx(), string(consumerChainId), stakingValidators) s.providerKeeper().ResetCurrentEpochValidators(s.providerCtx(), string(consumerChainId), nextValidators) err = s.providerKeeper().SetConsumerGenesis( diff --git a/x/ccv/provider/keeper/proposal.go b/x/ccv/provider/keeper/proposal.go index b9c9bf7cb5..1ba851bd00 100644 --- a/x/ccv/provider/keeper/proposal.go +++ b/x/ccv/provider/keeper/proposal.go @@ -281,7 +281,7 @@ func (k Keeper) MakeConsumerGenesis( bondedValidators = append(bondedValidators, val) } - nextValidators := k.ComputeNextEpochValidators(ctx, chainID, []types.EpochValidator{}, bondedValidators) + nextValidators := k.ComputeNextEpochValidators(ctx, chainID, bondedValidators) k.ResetCurrentEpochValidators(ctx, chainID, nextValidators) // Apply key assignments to the initial valset. diff --git a/x/ccv/provider/keeper/relay.go b/x/ccv/provider/keeper/relay.go index da2062a31f..643d942787 100644 --- a/x/ccv/provider/keeper/relay.go +++ b/x/ccv/provider/keeper/relay.go @@ -224,7 +224,7 @@ func (k Keeper) QueueVSCPackets(ctx sdk.Context) { for _, chain := range k.GetAllConsumerChains(ctx) { currentEpochValidators := k.GetAllEpochValidators(ctx, chain.ChainId) - nextEpochValidators := k.ComputeNextEpochValidators(ctx, chain.ChainId, currentEpochValidators, bondedValidators) + nextEpochValidators := k.ComputeNextEpochValidators(ctx, chain.ChainId, bondedValidators) valUpdates := DiffValidators(currentEpochValidators, nextEpochValidators) k.ResetCurrentEpochValidators(ctx, chain.ChainId, nextEpochValidators) diff --git a/x/ccv/provider/keeper/validator_set_update.go b/x/ccv/provider/keeper/validator_set_update.go index 5d3923f515..8490c6a27f 100644 --- a/x/ccv/provider/keeper/validator_set_update.go +++ b/x/ccv/provider/keeper/validator_set_update.go @@ -84,18 +84,12 @@ func (k Keeper) GetAllEpochValidators( } // ComputeNextEpochValidators returns the next validator set that is responsible for validating consumer chain `chainID`, -// based on the current epoch validators and the bonded validators. +// based on the bonded validators. func (k Keeper) ComputeNextEpochValidators( ctx sdk.Context, chainID string, - currentValidators []types.EpochValidator, bondedValidators []stakingtypes.Validator, ) []types.EpochValidator { - isCurrentValidator := make(map[string]types.EpochValidator) - for _, val := range currentValidators { - isCurrentValidator[string(val.ProviderConsAddr)] = val - } - var nextValidators []types.EpochValidator for _, val := range bondedValidators { // get next voting power and the next consumer public key @@ -121,17 +115,8 @@ func (k Keeper) ComputeNextEpochValidators( continue } - startBlockHeight := ctx.BlockHeight() - if v, found := isCurrentValidator[string(consAddr)]; found { - // If the validator was already an epoch validator validating the consumer chain, we let - // `StartBlockHeight` as is. This way, by looking at `StartBlockHeight` of an epoch validator, we can - // infer how long has a validator been continuously validating the consumer chain. - startBlockHeight = v.GetStartBlockHeight() - } - nextValidator := types.EpochValidator{ ProviderConsAddr: consAddr, - StartBlockHeight: startBlockHeight, Power: nextPower, ConsumerPublicKey: nextConsumerPublicKeyBytes, } @@ -141,7 +126,7 @@ func (k Keeper) ComputeNextEpochValidators( return nextValidators } -// DiffValidators compares the current and the next epoch validators and returns a `ValidatorUpdate` diff needed +// DiffValidators compares the current and the next epoch validators and returns the `ValidatorUpdate` diff needed // by CometBFT to update the validator set on a chain. func DiffValidators( currentValidators []types.EpochValidator, diff --git a/x/ccv/provider/keeper/validator_set_update_test.go b/x/ccv/provider/keeper/validator_set_update_test.go new file mode 100644 index 0000000000..fae3544d3a --- /dev/null +++ b/x/ccv/provider/keeper/validator_set_update_test.go @@ -0,0 +1,315 @@ +package keeper_test + +import ( + "bytes" + abci "github.com/cometbft/cometbft/abci/types" + "github.com/cometbft/cometbft/crypto/ed25519" + "github.com/cometbft/cometbft/proto/tendermint/crypto" + codectypes "github.com/cosmos/cosmos-sdk/codec/types" + cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" + sdk "github.com/cosmos/cosmos-sdk/types" + stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" + cryptotestutil "github.com/cosmos/interchain-security/v4/testutil/crypto" + testkeeper "github.com/cosmos/interchain-security/v4/testutil/keeper" + "github.com/cosmos/interchain-security/v4/x/ccv/provider/keeper" + "github.com/cosmos/interchain-security/v4/x/ccv/provider/types" + "github.com/stretchr/testify/require" + "sort" + "testing" +) + +// TestEpochValidator tests the `SetEpochValidator`, `IsEpochValidator`, and `DeleteEpochValidator` methods +func TestEpochValidator(t *testing.T) { + providerKeeper, ctx, ctrl, _ := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) + defer ctrl.Finish() + + validator := types.EpochValidator{ + ProviderConsAddr: []byte("providerConsAddr"), + Power: 2, + ConsumerPublicKey: []byte{3}, + } + + require.False(t, providerKeeper.IsEpochValidator(ctx, "chainID", types.NewProviderConsAddress(validator.ProviderConsAddr))) + providerKeeper.SetEpochValidator(ctx, "chainID", validator) + require.True(t, providerKeeper.IsEpochValidator(ctx, "chainID", types.NewProviderConsAddress(validator.ProviderConsAddr))) + providerKeeper.DeleteEpochValidator(ctx, "chainID", types.NewProviderConsAddress(validator.ProviderConsAddr)) + require.False(t, providerKeeper.IsEpochValidator(ctx, "chainID", types.NewProviderConsAddress(validator.ProviderConsAddr))) +} + +func TestGetAllEpochValidators(t *testing.T) { + providerKeeper, ctx, ctrl, _ := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) + defer ctrl.Finish() + + // create 3 validators and set them as epoch validators + expectedValidators := []types.EpochValidator{ + { + ProviderConsAddr: []byte("providerConsAddr1"), + Power: 2, + ConsumerPublicKey: []byte{3}, + }, + { + ProviderConsAddr: []byte("providerConsAddr2"), + Power: 3, + ConsumerPublicKey: []byte{4}, + }, + { + ProviderConsAddr: []byte("providerConsAddr3"), + Power: 4, + ConsumerPublicKey: []byte{5}, + }, + } + + for _, expectedValidator := range expectedValidators { + providerKeeper.SetEpochValidator(ctx, "chainID", + types.EpochValidator{ + ProviderConsAddr: expectedValidator.ProviderConsAddr, + Power: expectedValidator.Power, + ConsumerPublicKey: expectedValidator.ConsumerPublicKey}) + } + + actualValidators := providerKeeper.GetAllEpochValidators(ctx, "chainID") + + // sort validators first to be able to compare + sortValidators := func(validators []types.EpochValidator) { + sort.Slice(validators, func(i int, j int) bool { + return bytes.Compare(validators[i].ProviderConsAddr, validators[j].ProviderConsAddr) < 0 + }) + } + sortValidators(expectedValidators) + sortValidators(actualValidators) + require.Equal(t, expectedValidators, actualValidators) +} + +// createEpochValidator is a helper function to create an epoch validator with the given `power`. It uses `index` as +// the `ProviderConsAddr` of the validator, and the `seed` to generate the consumer public key. Returns the validator +// and its consumer public key. +func createEpochValidator(index int, power int64, seed int) (types.EpochValidator, crypto.PublicKey) { + publicKey := cryptotestutil.NewCryptoIdentityFromIntSeed(seed).TMProtoCryptoPublicKey() + publicKeyBytes, _ := publicKey.Marshal() + + return types.EpochValidator{ + ProviderConsAddr: []byte{byte(index)}, + Power: power, + ConsumerPublicKey: publicKeyBytes}, publicKey +} + +func TestComputeNextEpochValidators(t *testing.T) { + providerKeeper, ctx, ctrl, mocks := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) + defer ctrl.Finish() + + chainID := "chainID" + + // helper function to generate a validator with the given power and with a provider address based on index + createStakingValidator := func(ctx sdk.Context, mocks testkeeper.MockedKeepers, index int, power int64) stakingtypes.Validator { + providerConsPubKey := ed25519.GenPrivKeyFromSecret([]byte{byte(index)}).PubKey() + consAddr := sdk.ConsAddress(providerConsPubKey.Address()) + providerAddr := types.NewProviderConsAddress(consAddr) + pk, _ := cryptocodec.FromTmPubKeyInterface(providerConsPubKey) + pkAny, _ := codectypes.NewAnyWithValue(pk) + + var providerValidatorAddr sdk.ValAddress + providerValidatorAddr = providerAddr.Address.Bytes() + + mocks.MockStakingKeeper.EXPECT(). + GetLastValidatorPower(ctx, providerValidatorAddr).Return(power).AnyTimes() + + return stakingtypes.Validator{ + OperatorAddress: providerValidatorAddr.String(), + ConsensusPubkey: pkAny, + } + } + + // no epoch validators returned if we have no bonded validators + require.Empty(t, providerKeeper.ComputeNextEpochValidators(ctx, chainID, []stakingtypes.Validator{})) + + var expectedEpochValidators []types.EpochValidator + + // create a staking validator A that has not set a consumer public key + valA := createStakingValidator(ctx, mocks, 1, 1) + // because validator A has no consumer key set, the `ConsumerPublicKey` we expect is the key on the provider chain + valAConsAddr, _ := valA.GetConsAddr() + valAPublicKey, _ := valA.TmConsPublicKey() + valAPublicKeyBytes, _ := valAPublicKey.Marshal() + expectedEpochValidators = append(expectedEpochValidators, types.EpochValidator{ + ProviderConsAddr: types.NewProviderConsAddress(valAConsAddr).Address.Bytes(), + Power: 1, + ConsumerPublicKey: valAPublicKeyBytes, + }) + + // create a staking validator B that has a one of which has set a consumer public key + valB := createStakingValidator(ctx, mocks, 2, 2) + // validator B has set a consumer key, the `ConsumerPublicKey` we expect is the key set by `SetValidatorConsumerPubKey` + valBConsumerKey := cryptotestutil.NewCryptoIdentityFromIntSeed(1).TMProtoCryptoPublicKey() + valBConsumerKeyBytes, _ := valBConsumerKey.Marshal() + valBConsAddr, _ := valB.GetConsAddr() + providerKeeper.SetValidatorConsumerPubKey(ctx, chainID, types.NewProviderConsAddress(valBConsAddr), valBConsumerKey) + expectedEpochValidators = append(expectedEpochValidators, types.EpochValidator{ + ProviderConsAddr: types.NewProviderConsAddress(valBConsAddr).Address.Bytes(), + Power: 2, + ConsumerPublicKey: valBConsumerKeyBytes, + }) + + bondedValidators := []stakingtypes.Validator{valA, valB} + actualEpochValidators := providerKeeper.ComputeNextEpochValidators(ctx, "chainID", bondedValidators) + require.Equal(t, expectedEpochValidators, actualEpochValidators) +} + +func TestDiff(t *testing.T) { + // In what follows we create 6 validators: A, B, C, D, E, and F where currentValidators = {A, B, C, D, E} + // and nextValidators = {B, C, D, E, F}. For the validators {B, C, D, E} in the intersection we have: + // - validator B has no power or consumer key change + // - validator C has changed its power + // - validator E has no power change but has changed its consumer key + // - validator F has both changed its power and its consumer key + + var expectedUpdates []abci.ValidatorUpdate + + // validator A only exists on `currentValidators` and hence an update with 0 power would be generated + // to remove this validator + currentA, currentPublicKeyA := createEpochValidator(1, 1, 1) + expectedUpdates = append(expectedUpdates, abci.ValidatorUpdate{PubKey: currentPublicKeyA, Power: 0}) + + // validator B exists in both `currentValidators` and `nextValidators` but it did not change its + // power or consumer public key and hence no validator update is generated + currentB, _ := createEpochValidator(2, 1, 2) + nextB, _ := createEpochValidator(2, 1, 2) + + // validator C exists in both `currentValidators` and `nextValidators` and it changes its power, so + // a validator update is generated with the new power + currentC, currentPublicKeyC := createEpochValidator(3, 1, 3) + nextC, _ := createEpochValidator(3, 2, 3) + expectedUpdates = append(expectedUpdates, abci.ValidatorUpdate{PubKey: currentPublicKeyC, Power: 2}) + + // validator D exists in both `currentValidators` and `nextValidators` and it changes its consumer public key, so + // a validator update is generated to remove the old public key and another update to add the new public key + currentD, currentPublicKeyD := createEpochValidator(4, 1, 4) + nextD, nextPublicKeyD := createEpochValidator(4, 1, 5) + expectedUpdates = append(expectedUpdates, abci.ValidatorUpdate{PubKey: currentPublicKeyD, Power: 0}) + expectedUpdates = append(expectedUpdates, abci.ValidatorUpdate{PubKey: nextPublicKeyD, Power: 1}) + + // validator E exists in both `currentValidators` and `nextValidators` and it changes both its power and + // its consumer public key, so a validator update is generated to remove the old public key and another update to + // add the new public key with thew new power + currentE, currentPublicKeyE := createEpochValidator(5, 1, 6) + nextE, nextPublicKeyE := createEpochValidator(5, 2, 7) + expectedUpdates = append(expectedUpdates, abci.ValidatorUpdate{PubKey: currentPublicKeyE, Power: 0}) + expectedUpdates = append(expectedUpdates, abci.ValidatorUpdate{PubKey: nextPublicKeyE, Power: 2}) + + // validator F does not exist in `currentValidators` and hence an update is generated to add this new validator + nextF, nextPublicKeyF := createEpochValidator(6, 1, 8) + expectedUpdates = append(expectedUpdates, abci.ValidatorUpdate{PubKey: nextPublicKeyF, Power: 1}) + + currentValidators := []types.EpochValidator{currentA, currentB, currentC, currentD, currentE} + nextValidators := []types.EpochValidator{nextB, nextC, nextD, nextE, nextF} + + actualUpdates := keeper.DiffValidators(currentValidators, nextValidators) + + // sort validators first to be able to compare + sortUpdates := func(updates []abci.ValidatorUpdate) { + sort.Slice(updates, func(i, j int) bool { + if updates[i].Power != updates[j].Power { + return updates[i].Power < updates[j].Power + } + return updates[i].PubKey.String() < updates[j].PubKey.String() + }) + } + + sortUpdates(expectedUpdates) + sortUpdates(actualUpdates) + require.Equal(t, expectedUpdates, actualUpdates) +} + +func TestDiffEdgeCases(t *testing.T) { + require.Empty(t, len(keeper.DiffValidators([]types.EpochValidator{}, []types.EpochValidator{}))) + + valA, publicKeyA := createEpochValidator(1, 1, 1) + valB, publicKeyB := createEpochValidator(2, 2, 2) + valC, publicKeyC := createEpochValidator(3, 3, 3) + validators := []types.EpochValidator{valA, valB, valC} + + // we do not expect any validator updates if `currentValidators` are the same with the `nextValidators` + require.Empty(t, len(keeper.DiffValidators(validators, validators))) + + // we only have `nextValidators` that would generate validator updates for those validators to be added + expectedUpdates := []abci.ValidatorUpdate{{publicKeyA, 1}, {publicKeyB, 2}, {publicKeyC, 3}} + actualUpdates := keeper.DiffValidators([]types.EpochValidator{}, validators) + // sort validators first to be able to compare + sortUpdates := func(updates []abci.ValidatorUpdate) { + sort.Slice(updates, func(i, j int) bool { + if updates[i].Power != updates[j].Power { + return updates[i].Power < updates[j].Power + } + return updates[i].PubKey.String() < updates[j].PubKey.String() + }) + } + + sortUpdates(expectedUpdates) + sortUpdates(actualUpdates) + require.Equal(t, expectedUpdates, actualUpdates) + + // we only have `currentValidators` that would generate validator updates for those validators to be removed + expectedUpdates = []abci.ValidatorUpdate{{publicKeyA, 0}, {publicKeyB, 0}, {publicKeyC, 0}} + actualUpdates = keeper.DiffValidators(validators, []types.EpochValidator{}) + sortUpdates(expectedUpdates) + sortUpdates(actualUpdates) + require.Equal(t, expectedUpdates, actualUpdates) +} + +func TestResetCurrentEpochValidators(t *testing.T) { + providerKeeper, ctx, ctrl, _ := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) + defer ctrl.Finish() + + chainID := "chainID" + + currentValidators := []types.EpochValidator{ + { + ProviderConsAddr: []byte("currentProviderConsAddr1"), + Power: 2, + ConsumerPublicKey: []byte{3}, + }, + { + ProviderConsAddr: []byte("currentProviderConsAddr2"), + Power: 3, + ConsumerPublicKey: []byte{4}, + }, + { + ProviderConsAddr: []byte("currentProviderConsAddr3"), + Power: 4, + ConsumerPublicKey: []byte{5}, + }, + } + + nextValidators := []types.EpochValidator{ + { + ProviderConsAddr: []byte("nextProviderConsAddr1"), + Power: 2, + ConsumerPublicKey: []byte{3}, + }, + { + ProviderConsAddr: []byte("nextProviderConsAddr2"), + Power: 3, + ConsumerPublicKey: []byte{4}, + }, + } + + // set the `currentValidators` as epoch validators + require.Empty(t, providerKeeper.GetAllEpochValidators(ctx, chainID)) + for _, validator := range currentValidators { + providerKeeper.SetEpochValidator(ctx, chainID, validator) + } + require.NotEmpty(t, providerKeeper.GetAllEpochValidators(ctx, chainID)) + + providerKeeper.ResetCurrentEpochValidators(ctx, chainID, nextValidators) + nextCurrentValidators := providerKeeper.GetAllEpochValidators(ctx, chainID) + + // sort validators first to be able to compare + sortValidators := func(validators []types.EpochValidator) { + sort.Slice(validators, func(i, j int) bool { + return bytes.Compare(validators[i].ProviderConsAddr, validators[j].ProviderConsAddr) < 0 + }) + } + + sortValidators(nextValidators) + sortValidators(nextCurrentValidators) + require.Equal(t, nextValidators, nextCurrentValidators) +} diff --git a/x/ccv/provider/types/provider.pb.go b/x/ccv/provider/types/provider.pb.go index c204aa3d01..69c3f76828 100644 --- a/x/ccv/provider/types/provider.pb.go +++ b/x/ccv/provider/types/provider.pb.go @@ -1399,13 +1399,10 @@ func (m *ConsumerAddrsToPrune) GetConsumerAddrs() *AddressList { type EpochValidator struct { // validator's consensus address on the provider chain ProviderConsAddr []byte `protobuf:"bytes,1,opt,name=provider_cons_addr,json=providerConsAddr,proto3" json:"provider_cons_addr,omitempty"` - // The block height the provider chain had when the validator opted in for the first time. If the validator - // remains opted in during subsequent epochs, `start_block_height` remains unchanged. - StartBlockHeight int64 `protobuf:"varint,2,opt,name=start_block_height,json=startBlockHeight,proto3" json:"start_block_height,omitempty"` // voting power the validator has during this epoch - Power int64 `protobuf:"varint,3,opt,name=power,proto3" json:"power,omitempty"` + Power int64 `protobuf:"varint,2,opt,name=power,proto3" json:"power,omitempty"` // public key the validator uses on the consumer chain during this epoch - ConsumerPublicKey []byte `protobuf:"bytes,4,opt,name=consumer_public_key,json=consumerPublicKey,proto3" json:"consumer_public_key,omitempty"` + ConsumerPublicKey []byte `protobuf:"bytes,3,opt,name=consumer_public_key,json=consumerPublicKey,proto3" json:"consumer_public_key,omitempty"` } func (m *EpochValidator) Reset() { *m = EpochValidator{} } @@ -1448,13 +1445,6 @@ func (m *EpochValidator) GetProviderConsAddr() []byte { return nil } -func (m *EpochValidator) GetStartBlockHeight() int64 { - if m != nil { - return m.StartBlockHeight - } - return 0 -} - func (m *EpochValidator) GetPower() int64 { if m != nil { return m.Power @@ -1500,119 +1490,117 @@ func init() { } var fileDescriptor_f22ec409a72b7b72 = []byte{ - // 1778 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x58, 0xcf, 0x73, 0xdb, 0xc6, - 0xf5, 0x17, 0x48, 0x4a, 0x16, 0x1f, 0x25, 0x8a, 0x86, 0x94, 0x18, 0xf2, 0x57, 0x5f, 0x4a, 0x46, - 0x9a, 0x54, 0x9d, 0x34, 0x60, 0xa5, 0xb4, 0x33, 0x19, 0x4f, 0x33, 0x19, 0x89, 0x72, 0x62, 0x59, - 0x4d, 0xac, 0x40, 0xaa, 0x3c, 0x6d, 0x0f, 0x98, 0xe5, 0x62, 0x4d, 0xee, 0x08, 0xc4, 0xc2, 0xbb, - 0x0b, 0x38, 0xbc, 0xf4, 0xdc, 0x63, 0x7a, 0xcb, 0xf4, 0xd2, 0xb4, 0xff, 0x40, 0x67, 0xfa, 0x57, - 0xe4, 0x98, 0x63, 0x4f, 0x49, 0xc7, 0x3e, 0xf6, 0x9f, 0xe8, 0xec, 0xe2, 0x27, 0x29, 0xc9, 0xa5, - 0x27, 0xed, 0x0d, 0x78, 0xfb, 0xde, 0xe7, 0xfd, 0x7e, 0x6f, 0x01, 0xd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 0x65, 0x25, 0x7b, 0xce, 0x4d, 0x20, 0x47, 0x48, 0xa2, 0xac, 0x77, 0x35, - 0x96, 0xfd, 0x63, 0x58, 0xff, 0x14, 0xc9, 0x98, 0x13, 0x7f, 0x2a, 0xc7, 0x1d, 0xa8, 0xab, 0xfc, - 0x19, 0x3a, 0x7f, 0xea, 0x51, 0xdd, 0x07, 0xac, 0x07, 0x5f, 0x44, 0x8c, 0x4b, 0xe2, 0x5f, 0x89, - 0xc8, 0x2b, 0xc2, 0x7b, 0x09, 0xeb, 0x2a, 0x58, 0x82, 0x84, 0xbe, 0x57, 0xf8, 0x99, 0xe6, 0xb1, - 0xb5, 0xff, 0x8b, 0xb9, 0xba, 0x63, 0x56, 0x5d, 0xe6, 0xc0, 0xed, 0x64, 0x86, 0x2e, 0xec, 0x3f, - 0x1a, 0x60, 0x9d, 0x90, 0xc9, 0x81, 0x10, 0x74, 0x18, 0x8e, 0x49, 0x28, 0xd5, 0x0c, 0x44, 0x98, - 0xa8, 0x47, 0xf3, 0x2d, 0x58, 0x2d, 0x76, 0xae, 0x5e, 0xb5, 0x86, 0x5e, 0xb5, 0x2b, 0x39, 0x51, - 0x35, 0x98, 0x79, 0x1f, 0x20, 0xe2, 0x24, 0xf1, 0xb0, 0x77, 0x49, 0x26, 0x59, 0x16, 0xb7, 0xaa, - 0x2b, 0x34, 0xfd, 0x4e, 0x74, 0x4e, 0xe3, 0x41, 0x40, 0xf1, 0x09, 0x99, 0xb8, 0xcb, 0x8a, 0xbf, - 0x7f, 0x42, 0x26, 0xea, 0x4e, 0x14, 0xb1, 0xe7, 0x84, 0xeb, 0xbd, 0x57, 0x77, 0xd3, 0x17, 0xfb, - 0x4f, 0x06, 0xdc, 0x29, 0xd2, 0x91, 0x97, 0xeb, 0x69, 0x3c, 0x50, 0x12, 0xaf, 0x88, 0xdb, 0x15, - 0x6b, 0x6b, 0xd7, 0x58, 0xfb, 0x11, 0xac, 0x14, 0x0d, 0xa2, 0xec, 0xad, 0xc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, 0xb7, 0x4e, 0xf2, 0xf3, 0xde, 0x17, 0xd3, 0x3f, 0x8d, 0xe4, 0x24, 0x22, 0x62, 0xb0, - 0xa4, 0x47, 0xd9, 0xfb, 0xff, 0x0e, 0x00, 0x00, 0xff, 0xff, 0x75, 0xc2, 0x0d, 0x12, 0x65, 0x12, - 0x00, 0x00, + // 1757 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x58, 0x4f, 0x73, 0xdb, 0xc6, + 0x15, 0x17, 0x48, 0x4a, 0x16, 0x1f, 0x25, 0x4a, 0x86, 0x94, 0x18, 0x72, 0x55, 0x4a, 0x46, 0x9a, + 0x54, 0x9d, 0x34, 0x60, 0xa5, 0xb4, 0x33, 0x19, 0x4f, 0x33, 0x19, 0x89, 0x72, 0x62, 0x59, 0x4d, + 0xac, 0x40, 0xaa, 0x3c, 0x6d, 0x0f, 0x98, 0xe5, 0x62, 0x4d, 0xee, 0x08, 0xc4, 0xc2, 0xbb, 0x0b, + 0x38, 0xbc, 0xf4, 0xd4, 0x43, 0x8f, 0xe9, 0x2d, 0xd3, 0x4b, 0xd3, 0x7e, 0x81, 0x7e, 0x8d, 0x1c, + 0x73, 0xec, 0x29, 0xe9, 0x58, 0xc7, 0x7e, 0x89, 0xce, 0x2e, 0xfe, 0x92, 0x92, 0x5c, 0x7a, 0xdc, + 0xdc, 0x16, 0x6f, 0xdf, 0xfb, 0xbd, 0xff, 0xef, 0x2d, 0x09, 0x7b, 0x34, 0x94, 0x84, 0xe3, 0x21, + 0xa2, 0xa1, 0x27, 0x08, 0x8e, 0x39, 0x95, 0xe3, 0x2e, 0xc6, 0x49, 0x37, 0xe2, 0x2c, 0xa1, 0x3e, + 0xe1, 0xdd, 0x64, 0xb7, 0x38, 0x3b, 0x11, 0x67, 0x92, 0x99, 0x6f, 0x5d, 0x23, 0xe3, 0x60, 0x9c, + 0x38, 0x05, 0x5f, 0x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+ 0x09, 0xef, 0x05, 0xac, 0xa9, 0x60, 0x09, 0x12, 0xfa, 0x5e, 0xe1, 0x67, 0x9a, 0xc7, 0xd6, 0xde, + 0xaf, 0x66, 0xea, 0x8e, 0x69, 0x75, 0x99, 0x03, 0xb7, 0x93, 0x29, 0xba, 0xb0, 0xff, 0x62, 0x80, + 0x75, 0x4c, 0xc6, 0xfb, 0x42, 0xd0, 0x41, 0x38, 0x22, 0xa1, 0x54, 0x33, 0x10, 0x61, 0xa2, 0x8e, + 0xe6, 0x5b, 0xb0, 0x5c, 0xec, 0x5c, 0xbd, 0x6a, 0x0d, 0xbd, 0x6a, 0x97, 0x72, 0xa2, 0x6a, 0x30, + 0xf3, 0x3e, 0x40, 0xc4, 0x49, 0xe2, 0x61, 0xef, 0x82, 0x8c, 0xb3, 0x2c, 0x6e, 0x56, 0x57, 0x68, + 0xfa, 0x3b, 0xd1, 0x39, 0x89, 0xfb, 0x01, 0xc5, 0xc7, 0x64, 0xec, 0x2e, 0x2a, 0xfe, 0xde, 0x31, + 0x19, 0xab, 0x37, 0x51, 0xc4, 0x9e, 0x13, 0xae, 0xf7, 0x5e, 0xdd, 0x4d, 0x3f, 0xec, 0xbf, 0x1a, + 0x70, 0xa7, 0x48, 0x47, 0x5e, 0xae, 0x27, 0x71, 0x5f, 0x49, 0xbc, 0x24, 0x6e, 0x57, 0xac, 0xad, + 0x5d, 0x63, 0xed, 0x47, 0xb0, 0x54, 0x34, 0x88, 0xb2, 0xb7, 0x3e, 0x83, 0xbd, 0xad, 0x5c, 0xe2, + 0x98, 0x8c, 0xed, 0x3f, 0x56, 0x6c, 0x3b, 0x18, 0x57, 0x66, 0x1f, 0xff, 0x1f, 0xb6, 0x15, 0x6a, + 0xab, 0xb6, 0xe1, 0xaa, 0xfc, 0x15, 0x07, 0xea, 0x57, 0x1d, 0xb0, 0xff, 0x6e, 0xc0, 0x7a, 0x55, + 0xab, 0x38, 0x63, 0x27, 0x3c, 0x0e, 0xc9, 0xcb, 0xb4, 0x97, 0xed, 0x57, 0xab, 0xb6, 0xdf, 0x13, + 0x68, 0x4f, 0x18, 0x25, 0xb2, 0x68, 0xfc, 0x62, 0xa6, 0x1a, 0xab, 0x4c, 0x57, 0x77, 0xb9, 0xea, + 0x87, 0xb0, 0xff, 0x64, 0x40, 0x5b, 0x2f, 0xa8, 0x22, 0x52, 0xe6, 0xcf, 0xc1, 0x2c, 0x7c, 0x2b, + 0x9f, 0x6e, 0x69, 0x3d, 0xad, 0xe6, 0x37, 0xf9, 0xbb, 0xad, 0xac, 0x8b, 0x5a, 0xa5, 0x2e, 0x4c, + 0x07, 0xd6, 0x0a, 0x7b, 0x23, 0x9d, 0x9d, 0x22, 0x85, 0x4b, 0x6e, 0xf1, 0xfc, 0x2c, 0xf2, 0x76, + 0xf0, 0xe4, 0x9b, 0x17, 0x1d, 0xe3, 0xdb, 0x17, 0x1d, 0xe3, 0xdf, 0x2f, 0x3a, 0xc6, 0x97, 0x97, + 0x9d, 0xb9, 0x6f, 0x2f, 0x3b, 0x73, 0xff, 0xba, 0xec, 0xcc, 0xfd, 0xfe, 0xc3, 0x01, 0x95, 0xc3, + 0xb8, 0xef, 0x60, 0x36, 0xea, 0x66, 0xff, 0x45, 0x94, 0x2e, 0xbf, 0x57, 0xfc, 0x51, 0x93, 0xfc, + 0xb2, 0xfb, 0xc5, 0xe4, 0xdf, 0x40, 0x72, 0x1c, 0x11, 0xd1, 0x5f, 0xd0, 0xc3, 0xe9, 0xfd, 0xff, + 0x06, 0x00, 0x00, 0xff, 0xff, 0xf2, 0xc1, 0xce, 0xa4, 0x37, 0x12, 0x00, 0x00, } func (m *ConsumerAdditionProposal) Marshal() (dAtA []byte, err error) { @@ -2706,16 +2694,11 @@ func (m *EpochValidator) MarshalToSizedBuffer(dAtA []byte) (int, error) { copy(dAtA[i:], m.ConsumerPublicKey) i = encodeVarintProvider(dAtA, i, uint64(len(m.ConsumerPublicKey))) i-- - dAtA[i] = 0x22 + dAtA[i] = 0x1a } if m.Power != 0 { i = encodeVarintProvider(dAtA, i, uint64(m.Power)) i-- - dAtA[i] = 0x18 - } - if m.StartBlockHeight != 0 { - i = encodeVarintProvider(dAtA, i, uint64(m.StartBlockHeight)) - i-- dAtA[i] = 0x10 } if len(m.ProviderConsAddr) > 0 { @@ -3209,9 +3192,6 @@ func (m *EpochValidator) Size() (n int) { if l > 0 { n += 1 + l + sovProvider(uint64(l)) } - if m.StartBlockHeight != 0 { - n += 1 + sovProvider(uint64(m.StartBlockHeight)) - } if m.Power != 0 { n += 1 + sovProvider(uint64(m.Power)) } @@ -6579,25 +6559,6 @@ func (m *EpochValidator) Unmarshal(dAtA []byte) error { } iNdEx = postIndex case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field StartBlockHeight", wireType) - } - m.StartBlockHeight = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProvider - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.StartBlockHeight |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 3: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Power", wireType) } @@ -6616,7 +6577,7 @@ func (m *EpochValidator) Unmarshal(dAtA []byte) error { break } } - case 4: + case 3: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field ConsumerPublicKey", wireType) } From f6397ad6526b16c32ef110b35c83f32d67f5e796 Mon Sep 17 00:00:00 2001 From: insumity Date: Tue, 27 Feb 2024 17:07:48 +0100 Subject: [PATCH 23/46] more fixes --- x/ccv/provider/keeper/proposal_test.go | 1 + x/ccv/provider/types/genesis_test.go | 26 +++++++++++++------------- x/ccv/types/shared_params.go | 7 +++---- 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/x/ccv/provider/keeper/proposal_test.go b/x/ccv/provider/keeper/proposal_test.go index e78823899a..fc1c7a4344 100644 --- a/x/ccv/provider/keeper/proposal_test.go +++ b/x/ccv/provider/keeper/proposal_test.go @@ -775,6 +775,7 @@ func TestMakeConsumerGenesis(t *testing.T) { Denom: "stake", Amount: sdk.NewInt(1000000), }, + BlocksPerEpoch: 600, } providerKeeper.SetParams(ctx, moduleParams) defer ctrl.Finish() diff --git a/x/ccv/provider/types/genesis_test.go b/x/ccv/provider/types/genesis_test.go index c199e20120..41a716757f 100644 --- a/x/ccv/provider/types/genesis_test.go +++ b/x/ccv/provider/types/genesis_test.go @@ -81,7 +81,7 @@ func TestValidateGenesisState(t *testing.T) { nil, types.NewParams(ibctmtypes.NewClientState("", ibctmtypes.DefaultTrustLevel, 0, 0, time.Second*40, clienttypes.Height{}, commitmenttypes.GetSDKSpecs(), []string{"ibc", "upgradedIBCState"}), - types.DefaultTrustingPeriodFraction, time.Hour, time.Hour, 30*time.Minute, time.Hour, "0.1", sdk.Coin{Denom: "stake", Amount: sdk.NewInt(10000000)}, 1000), + types.DefaultTrustingPeriodFraction, time.Hour, time.Hour, 30*time.Minute, time.Hour, "0.1", sdk.Coin{Denom: "stake", Amount: sdk.NewInt(10000000)}, 600), nil, nil, nil, @@ -102,7 +102,7 @@ func TestValidateGenesisState(t *testing.T) { nil, types.NewParams(ibctmtypes.NewClientState("", ibctmtypes.DefaultTrustLevel, 0, 0, time.Second*40, clienttypes.Height{}, commitmenttypes.GetSDKSpecs(), []string{"ibc", "upgradedIBCState"}), - types.DefaultTrustingPeriodFraction, time.Hour, time.Hour, 30*time.Minute, time.Hour, "0.1", sdk.Coin{Denom: "stake", Amount: sdk.NewInt(10000000)}, 1000), + types.DefaultTrustingPeriodFraction, time.Hour, time.Hour, 30*time.Minute, time.Hour, "0.1", sdk.Coin{Denom: "stake", Amount: sdk.NewInt(10000000)}, 600), nil, nil, nil, @@ -123,7 +123,7 @@ func TestValidateGenesisState(t *testing.T) { nil, types.NewParams(ibctmtypes.NewClientState("", ibctmtypes.DefaultTrustLevel, 0, 0, time.Second*40, clienttypes.Height{}, commitmenttypes.GetSDKSpecs(), []string{"ibc", "upgradedIBCState"}), - types.DefaultTrustingPeriodFraction, time.Hour, time.Hour, 30*time.Minute, time.Hour, "0.1", sdk.Coin{Denom: "stake", Amount: sdk.NewInt(10000000)}, 1000), + types.DefaultTrustingPeriodFraction, time.Hour, time.Hour, 30*time.Minute, time.Hour, "0.1", sdk.Coin{Denom: "stake", Amount: sdk.NewInt(10000000)}, 600), nil, nil, nil, @@ -144,7 +144,7 @@ func TestValidateGenesisState(t *testing.T) { nil, types.NewParams(ibctmtypes.NewClientState("", ibctmtypes.DefaultTrustLevel, 0, 0, time.Second*40, clienttypes.Height{}, commitmenttypes.GetSDKSpecs(), []string{"ibc", "upgradedIBCState"}), - types.DefaultTrustingPeriodFraction, time.Hour, time.Hour, 30*time.Minute, time.Hour, "0.1", sdk.Coin{Denom: "stake", Amount: sdk.NewInt(10000000)}, 1000), + types.DefaultTrustingPeriodFraction, time.Hour, time.Hour, 30*time.Minute, time.Hour, "0.1", sdk.Coin{Denom: "stake", Amount: sdk.NewInt(10000000)}, 600), nil, nil, nil, @@ -171,7 +171,7 @@ func TestValidateGenesisState(t *testing.T) { types.DefaultVscTimeoutPeriod, types.DefaultSlashMeterReplenishPeriod, types.DefaultSlashMeterReplenishFraction, - sdk.Coin{Denom: "stake", Amount: sdk.NewInt(10000000)}, 1000), + sdk.Coin{Denom: "stake", Amount: sdk.NewInt(10000000)}, 600), nil, nil, nil, @@ -198,7 +198,7 @@ func TestValidateGenesisState(t *testing.T) { types.DefaultVscTimeoutPeriod, types.DefaultSlashMeterReplenishPeriod, types.DefaultSlashMeterReplenishFraction, - sdk.Coin{Denom: "stake", Amount: sdk.NewInt(10000000)}, 1000), + sdk.Coin{Denom: "stake", Amount: sdk.NewInt(10000000)}, 600), nil, nil, nil, @@ -225,7 +225,7 @@ func TestValidateGenesisState(t *testing.T) { types.DefaultVscTimeoutPeriod, types.DefaultSlashMeterReplenishPeriod, types.DefaultSlashMeterReplenishFraction, - sdk.Coin{Denom: "stake", Amount: sdk.NewInt(1000000)}, 1000), + sdk.Coin{Denom: "stake", Amount: sdk.NewInt(1000000)}, 600), nil, nil, nil, @@ -252,7 +252,7 @@ func TestValidateGenesisState(t *testing.T) { types.DefaultVscTimeoutPeriod, types.DefaultSlashMeterReplenishPeriod, types.DefaultSlashMeterReplenishFraction, - sdk.Coin{Denom: "stake", Amount: sdk.NewInt(10000000)}, 1000), + sdk.Coin{Denom: "stake", Amount: sdk.NewInt(10000000)}, 600), nil, nil, nil, @@ -279,7 +279,7 @@ func TestValidateGenesisState(t *testing.T) { 0, // 0 vsc timeout here types.DefaultSlashMeterReplenishPeriod, types.DefaultSlashMeterReplenishFraction, - sdk.Coin{Denom: "stake", Amount: sdk.NewInt(10000000)}, 1000), + sdk.Coin{Denom: "stake", Amount: sdk.NewInt(10000000)}, 600), nil, nil, nil, @@ -306,7 +306,7 @@ func TestValidateGenesisState(t *testing.T) { types.DefaultVscTimeoutPeriod, 0, // 0 slash meter replenish period here types.DefaultSlashMeterReplenishFraction, - sdk.Coin{Denom: "stake", Amount: sdk.NewInt(10000000)}, 1000), + sdk.Coin{Denom: "stake", Amount: sdk.NewInt(10000000)}, 600), nil, nil, nil, @@ -333,7 +333,7 @@ func TestValidateGenesisState(t *testing.T) { types.DefaultVscTimeoutPeriod, types.DefaultSlashMeterReplenishPeriod, "1.15", - sdk.Coin{Denom: "stake", Amount: sdk.NewInt(10000000)}, 1000), + sdk.Coin{Denom: "stake", Amount: sdk.NewInt(10000000)}, 600), nil, nil, nil, @@ -685,7 +685,7 @@ func TestValidateGenesisState(t *testing.T) { nil, types.NewParams(ibctmtypes.NewClientState("", ibctmtypes.DefaultTrustLevel, 0, 0, time.Second*40, clienttypes.Height{}, commitmenttypes.GetSDKSpecs(), []string{"ibc", "upgradedIBCState"}), - types.DefaultTrustingPeriodFraction, time.Hour, time.Hour, 30*time.Minute, time.Hour, "0.1", sdk.Coin{Denom: "st", Amount: sdk.NewInt(10000000)}, 1000), + types.DefaultTrustingPeriodFraction, time.Hour, time.Hour, 30*time.Minute, time.Hour, "0.1", sdk.Coin{Denom: "st", Amount: sdk.NewInt(10000000)}, 600), nil, nil, nil, @@ -706,7 +706,7 @@ func TestValidateGenesisState(t *testing.T) { nil, types.NewParams(ibctmtypes.NewClientState("", ibctmtypes.DefaultTrustLevel, 0, 0, time.Second*40, clienttypes.Height{}, commitmenttypes.GetSDKSpecs(), []string{"ibc", "upgradedIBCState"}), - types.DefaultTrustingPeriodFraction, time.Hour, time.Hour, 30*time.Minute, time.Hour, "0.1", sdk.Coin{Denom: "stake", Amount: sdk.NewInt(-1000000)}, 1000), + types.DefaultTrustingPeriodFraction, time.Hour, time.Hour, 30*time.Minute, time.Hour, "0.1", sdk.Coin{Denom: "stake", Amount: sdk.NewInt(-1000000)}, 600), nil, nil, nil, diff --git a/x/ccv/types/shared_params.go b/x/ccv/types/shared_params.go index b1fded0d4b..2ffa3d90c1 100644 --- a/x/ccv/types/shared_params.go +++ b/x/ccv/types/shared_params.go @@ -55,10 +55,9 @@ func ValidatePositiveUint32(i interface{}) error { if _, ok := i.(uint32); !ok { return fmt.Errorf("invalid parameter type: %T", i) } - // FIXME: - //if i.(uint32) == 0 { - // return fmt.Errorf("parameter must be positive") - //} + if i.(uint32) == 0 { + return fmt.Errorf("parameter must be positive") + } return nil } From bee8c108c7b7e963a91bc3448245990520699f53 Mon Sep 17 00:00:00 2001 From: insumity Date: Tue, 27 Feb 2024 17:22:20 +0100 Subject: [PATCH 24/46] nit fixes --- tests/integration/common.go | 1 - tests/integration/distribution.go | 1 - tests/integration/expired_client.go | 2 +- tests/integration/slashing.go | 3 +-- tests/integration/unbonding.go | 2 +- tests/mbt/driver/mbt_test.go | 2 +- x/ccv/provider/keeper/params_test.go | 2 +- x/ccv/provider/keeper/relay.go | 6 ++---- x/ccv/provider/keeper/validator_set_update_test.go | 10 +++++----- 9 files changed, 12 insertions(+), 17 deletions(-) diff --git a/tests/integration/common.go b/tests/integration/common.go index 335f319ab8..1b7526497d 100644 --- a/tests/integration/common.go +++ b/tests/integration/common.go @@ -127,7 +127,6 @@ func delegateAndRedelegate(s *CCVTestSuite, delAddr sdk.AccAddress, srcValTokensAfter := s.getVal(s.providerCtx(), srcValAddr).GetBondedTokens() s.Require().Equal(srcValTokensAfter.Sub(srcValTokensBefore), amount) - s.providerChain.NextBlock() nextBlocks(s.providerChain, s.providerApp.GetProviderKeeper().GetParams(s.providerCtx()).BlocksPerEpoch) dstValTokensBefore := s.getVal(s.providerCtx(), dstValAddr).GetBondedTokens() diff --git a/tests/integration/distribution.go b/tests/integration/distribution.go index f5f0b9563d..87e1f3b3b3 100644 --- a/tests/integration/distribution.go +++ b/tests/integration/distribution.go @@ -254,7 +254,6 @@ func (s *CCVTestSuite) TestEndBlockRD() { delAddr := s.providerChain.SenderAccount.GetAddress() delegate(s, delAddr, bondAmt) nextBlocks(s.providerChain, s.providerApp.GetProviderKeeper().GetParams(s.providerCtx()).BlocksPerEpoch) - s.providerChain.NextBlock() if tc.denomRegistered { params := s.consumerApp.GetConsumerKeeper().GetConsumerParams(s.consumerCtx()) diff --git a/tests/integration/expired_client.go b/tests/integration/expired_client.go index 07c75f8f4a..1b66344d7a 100644 --- a/tests/integration/expired_client.go +++ b/tests/integration/expired_client.go @@ -63,7 +63,7 @@ func (s *CCVTestSuite) TestVSCPacketSendExpiredClient() { // upgrade expired client to the consumer upgradeExpiredClient(s, Consumer) - // go to next block + // go to next epoch nextBlocks(s.providerChain, blocksPerEpoch) // check that the packets are not in the list of pending VSC packets diff --git a/tests/integration/slashing.go b/tests/integration/slashing.go index 8a62a36cf5..1c41e09d72 100644 --- a/tests/integration/slashing.go +++ b/tests/integration/slashing.go @@ -107,11 +107,10 @@ func (s *CCVTestSuite) TestRelayAndApplyDowntimePacket() { s.Require().True(found) } - // increase FIXME nextBlocks(s.providerChain, s.providerApp.GetProviderKeeper().GetParams(s.providerCtx()).BlocksPerEpoch) // Confirm the valset update Id was incremented twice on provider, - // since two endblockers have passed. + // since an epoch has passed. s.Require().Equal(valsetUpdateIdN+2, providerKeeper.GetValidatorSetUpdateId(s.providerCtx())) diff --git a/tests/integration/unbonding.go b/tests/integration/unbonding.go index a3481660ad..fe05a7f993 100644 --- a/tests/integration/unbonding.go +++ b/tests/integration/unbonding.go @@ -241,7 +241,7 @@ func (s *CCVTestSuite) TestUndelegationDuringInit() { // delegate again to create another VSC packet delegate(s, delAddr, bondAmt) - // call NextBlock on the provider (which increments the height) + // call NextBlocks on the provider (which increments the height) nextBlocks(s.providerChain, blocksPerEpoch) // check that the VSC packet is stored in state as pending diff --git a/tests/mbt/driver/mbt_test.go b/tests/mbt/driver/mbt_test.go index 10910d6582..27070fe2bc 100644 --- a/tests/mbt/driver/mbt_test.go +++ b/tests/mbt/driver/mbt_test.go @@ -242,7 +242,7 @@ func RunItfTrace(t *testing.T, path string) { // we need at least 2 blocks, because for a packet sent at height H, the receiving chain // needs a header of height H+1 to accept the packet // so, we do `blocksPerEpoch` time advancements with a very small increment, - // and then increment the rest of the time to take into account the case where `blocksPerEpoch = 1` + // and then increment the rest of the time runningConsumersBefore := driver.runningConsumers() // going through `blocksPerEpoch` blocks to take into account an epoch diff --git a/x/ccv/provider/keeper/params_test.go b/x/ccv/provider/keeper/params_test.go index ae95a02fa6..88175431c0 100644 --- a/x/ccv/provider/keeper/params_test.go +++ b/x/ccv/provider/keeper/params_test.go @@ -48,7 +48,7 @@ func TestParams(t *testing.T) { Denom: "stake", Amount: sdk.NewInt(10000000), }, - 1000, + 600, ) providerKeeper.SetParams(ctx, newParams) params = providerKeeper.GetParams(ctx) diff --git a/x/ccv/provider/keeper/relay.go b/x/ccv/provider/keeper/relay.go index 643d942787..59eb2685ee 100644 --- a/x/ccv/provider/keeper/relay.go +++ b/x/ccv/provider/keeper/relay.go @@ -216,10 +216,8 @@ func (k Keeper) SendVSCPacketsToChain(ctx sdk.Context, chainID, channelID string // QueueVSCPackets queues latest validator updates for every registered consumer chain func (k Keeper) QueueVSCPackets(ctx sdk.Context) { valUpdateID := k.GetValidatorSetUpdateId(ctx) // current valset update ID - // Get the validator updates from the staking module. - // Note: GetValidatorUpdates panics if the updates provided by the x/staking module - // of cosmos-sdk is invalid. - // FIXME comments + + // Get the bonded validators from the staking module. bondedValidators := k.stakingKeeper.GetLastValidators(ctx) for _, chain := range k.GetAllConsumerChains(ctx) { diff --git a/x/ccv/provider/keeper/validator_set_update_test.go b/x/ccv/provider/keeper/validator_set_update_test.go index fae3544d3a..9621f0d8b7 100644 --- a/x/ccv/provider/keeper/validator_set_update_test.go +++ b/x/ccv/provider/keeper/validator_set_update_test.go @@ -136,7 +136,7 @@ func TestComputeNextEpochValidators(t *testing.T) { ConsumerPublicKey: valAPublicKeyBytes, }) - // create a staking validator B that has a one of which has set a consumer public key + // create a staking validator B that has set a consumer public key valB := createStakingValidator(ctx, mocks, 2, 2) // validator B has set a consumer key, the `ConsumerPublicKey` we expect is the key set by `SetValidatorConsumerPubKey` valBConsumerKey := cryptotestutil.NewCryptoIdentityFromIntSeed(1).TMProtoCryptoPublicKey() @@ -164,7 +164,7 @@ func TestDiff(t *testing.T) { var expectedUpdates []abci.ValidatorUpdate - // validator A only exists on `currentValidators` and hence an update with 0 power would be generated + // validator A only exists in `currentValidators` and hence an update with 0 power would be generated // to remove this validator currentA, currentPublicKeyA := createEpochValidator(1, 1, 1) expectedUpdates = append(expectedUpdates, abci.ValidatorUpdate{PubKey: currentPublicKeyA, Power: 0}) @@ -227,10 +227,10 @@ func TestDiffEdgeCases(t *testing.T) { valC, publicKeyC := createEpochValidator(3, 3, 3) validators := []types.EpochValidator{valA, valB, valC} - // we do not expect any validator updates if `currentValidators` are the same with the `nextValidators` + // we do not expect any validator updates if the `currentValidators` are the same with the `nextValidators` require.Empty(t, len(keeper.DiffValidators(validators, validators))) - // we only have `nextValidators` that would generate validator updates for those validators to be added + // only have `nextValidators` that would generate validator updates for the validators to be added expectedUpdates := []abci.ValidatorUpdate{{publicKeyA, 1}, {publicKeyB, 2}, {publicKeyC, 3}} actualUpdates := keeper.DiffValidators([]types.EpochValidator{}, validators) // sort validators first to be able to compare @@ -247,7 +247,7 @@ func TestDiffEdgeCases(t *testing.T) { sortUpdates(actualUpdates) require.Equal(t, expectedUpdates, actualUpdates) - // we only have `currentValidators` that would generate validator updates for those validators to be removed + // only have `currentValidators` that would generate validator updates for the validators to be removed expectedUpdates = []abci.ValidatorUpdate{{publicKeyA, 0}, {publicKeyB, 0}, {publicKeyC, 0}} actualUpdates = keeper.DiffValidators(validators, []types.EpochValidator{}) sortUpdates(expectedUpdates) From abb4abcf05fa0aa695d9d0049b481b312196df50 Mon Sep 17 00:00:00 2001 From: insumity Date: Tue, 27 Feb 2024 17:52:50 +0100 Subject: [PATCH 25/46] cleaning up --- x/ccv/provider/keeper/validator_set_update.go | 6 ++++++ x/ccv/provider/types/params.go | 4 +++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/x/ccv/provider/keeper/validator_set_update.go b/x/ccv/provider/keeper/validator_set_update.go index 8490c6a27f..197ae3f38a 100644 --- a/x/ccv/provider/keeper/validator_set_update.go +++ b/x/ccv/provider/keeper/validator_set_update.go @@ -106,6 +106,12 @@ func (k Keeper) ComputeNextEpochValidators( k.Logger(ctx).Info("could not retrieve public key for validator (%+v) on consumer chain (%s) because"+ " the validator did not assign a new consumer key", val, chainID) nextConsumerPublicKey, err = val.TmConsPublicKey() + if err != nil { + // this should never happen and might not be recoverable because without the public key + // we cannot generate a validator update + panic(fmt.Errorf("could not retrieve validator's (%+v) public key: %w", val, err)) + } + } nextConsumerPublicKeyBytes, err := nextConsumerPublicKey.Marshal() diff --git a/x/ccv/provider/types/params.go b/x/ccv/provider/types/params.go index 502b9a0231..2e47482d70 100644 --- a/x/ccv/provider/types/params.go +++ b/x/ccv/provider/types/params.go @@ -144,7 +144,9 @@ func (p Params) Validate() error { if err := ValidateCoin(p.ConsumerRewardDenomRegistrationFee); err != nil { return fmt.Errorf("consumer reward denom registration fee is invalid: %s", err) } - // FIXME: potentially add a validate that this p.BlocksPerEpoch cannot be too high + if err := ccvtypes.ValidatePositiveUint32(p.BlocksPerEpoch); err != nil { + return fmt.Errorf("blocks per epoch have to be positive: %s", err) + } return nil } From 30f206173dd3d1d105375fa564411f37f7565ad3 Mon Sep 17 00:00:00 2001 From: insumity Date: Wed, 28 Feb 2024 10:44:02 +0100 Subject: [PATCH 26/46] increase downtime by one block --- tests/e2e/actions.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/e2e/actions.go b/tests/e2e/actions.go index f233c09c35..746de25e21 100644 --- a/tests/e2e/actions.go +++ b/tests/e2e/actions.go @@ -1645,7 +1645,7 @@ func (tr TestConfig) invokeDowntimeSlash(action DowntimeSlashAction, target Exec // Bring validator down tr.setValidatorDowntime(action.Chain, action.Validator, true, target, verbose) // Wait appropriate amount of blocks for validator to be slashed - tr.waitBlocks(action.Chain, 10, 3*time.Minute) + tr.waitBlocks(action.Chain, 11, 3*time.Minute) // Bring validator back up tr.setValidatorDowntime(action.Chain, action.Validator, false, target, verbose) } From e986692d736c95e48894f2acd62f875eed804a3e Mon Sep 17 00:00:00 2001 From: insumity Date: Wed, 28 Feb 2024 10:57:18 +0100 Subject: [PATCH 27/46] fix logs --- x/ccv/provider/keeper/validator_set_update.go | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/x/ccv/provider/keeper/validator_set_update.go b/x/ccv/provider/keeper/validator_set_update.go index 197ae3f38a..b3923e0012 100644 --- a/x/ccv/provider/keeper/validator_set_update.go +++ b/x/ccv/provider/keeper/validator_set_update.go @@ -97,14 +97,18 @@ func (k Keeper) ComputeNextEpochValidators( consAddr, err := val.GetConsAddr() if err != nil { // this should never happen but is recoverable if we exclude this validator from the `nextValidators` - k.Logger(ctx).Error("could not get consensus address of validator (%+v): %w", val, err) + k.Logger(ctx).Error("could not get consensus address of validator", + "validator", val.GetOperator().String(), + "error", err) continue } nextConsumerPublicKey, foundConsumerPublicKey := k.GetValidatorConsumerPubKey(ctx, chainID, types.NewProviderConsAddress(consAddr)) if !foundConsumerPublicKey { // if no consumer key assigned then use the validator's key itself - k.Logger(ctx).Info("could not retrieve public key for validator (%+v) on consumer chain (%s) because"+ - " the validator did not assign a new consumer key", val, chainID) + k.Logger(ctx).Info("could not retrieve public key for validator on consumer chain because"+ + " the validator did not assign a new consumer key", + "validator", val.GetOperator().String(), + "chainID", chainID) nextConsumerPublicKey, err = val.TmConsPublicKey() if err != nil { // this should never happen and might not be recoverable because without the public key @@ -117,7 +121,9 @@ func (k Keeper) ComputeNextEpochValidators( nextConsumerPublicKeyBytes, err := nextConsumerPublicKey.Marshal() if err != nil { // this should never happen but is recoverable if we exclude this validator from the `nextValidators` - k.Logger(ctx).Error("could not marshal consumer public key (%+v): %w", nextConsumerPublicKey, err) + k.Logger(ctx).Error("could not marshal consumer public key", + "consumer public key", nextConsumerPublicKey, + "error", err) continue } From 8aa1dc9521a886bf95707485cfe2ab1309157c0e Mon Sep 17 00:00:00 2001 From: insumity Date: Wed, 28 Feb 2024 17:45:16 +0100 Subject: [PATCH 28/46] took into account Marius' comments --- .../ccv/provider/v1/provider.proto | 10 +- tests/integration/common.go | 4 +- tests/mbt/driver/mbt_test.go | 2 +- tests/mbt/driver/setup.go | 4 +- x/ccv/provider/keeper/params.go | 4 +- x/ccv/provider/keeper/proposal.go | 8 +- x/ccv/provider/keeper/relay.go | 12 +- x/ccv/provider/keeper/validator_set_update.go | 130 +++----- .../keeper/validator_set_update_test.go | 198 ++++++----- x/ccv/provider/types/keys.go | 10 +- x/ccv/provider/types/keys_test.go | 2 +- x/ccv/provider/types/params.go | 6 +- x/ccv/provider/types/provider.pb.go | 313 +++++++++--------- 13 files changed, 355 insertions(+), 348 deletions(-) diff --git a/proto/interchain_security/ccv/provider/v1/provider.proto b/proto/interchain_security/ccv/provider/v1/provider.proto index 1c9a0dc6b9..4da89022e8 100644 --- a/proto/interchain_security/ccv/provider/v1/provider.proto +++ b/proto/interchain_security/ccv/provider/v1/provider.proto @@ -190,7 +190,7 @@ message Params { [ (gogoproto.nullable) = false ]; // The number of blocks that comprise an epoch. - uint32 blocks_per_epoch = 10; + int64 blocks_per_epoch = 10; } // SlashAcks contains cons addresses of consumer chain validators @@ -299,13 +299,13 @@ message ConsumerAddrsToPrune { AddressList consumer_addrs = 3; } -// EpochValidator is used to facilitate epoch-based transitions. It contains relevant info for -// a validator that is opted in, in an epoch, on a consumer chain. -message EpochValidator { +// ConsumerValidator is used to facilitate epoch-based transitions. It contains relevant info for +// a validator that is expected to validate on a consumer chain during an epoch. +message ConsumerValidator { // validator's consensus address on the provider chain bytes provider_cons_addr = 1; // voting power the validator has during this epoch int64 power = 2; // public key the validator uses on the consumer chain during this epoch - bytes consumer_public_key = 3; + tendermint.crypto.PublicKey consumer_public_key = 3; } \ No newline at end of file diff --git a/tests/integration/common.go b/tests/integration/common.go index 1b7526497d..d9102a44d5 100644 --- a/tests/integration/common.go +++ b/tests/integration/common.go @@ -627,8 +627,8 @@ func (s *CCVTestSuite) mustGetStakingValFromTmVal(tmVal tmtypes.Validator) (stak } // nextBlocks moves `chain` forward by a `numberOfBlocks` blocks -func nextBlocks(chain *ibctesting.TestChain, numberOfBlocks uint32) { - for i := uint32(0); i < numberOfBlocks; i++ { +func nextBlocks(chain *ibctesting.TestChain, numberOfBlocks int64) { + for i := int64(0); i < numberOfBlocks; i++ { chain.NextBlock() } } diff --git a/tests/mbt/driver/mbt_test.go b/tests/mbt/driver/mbt_test.go index 27070fe2bc..183839dc9a 100644 --- a/tests/mbt/driver/mbt_test.go +++ b/tests/mbt/driver/mbt_test.go @@ -247,7 +247,7 @@ func RunItfTrace(t *testing.T, path string) { // going through `blocksPerEpoch` blocks to take into account an epoch blocksPerEpoch := driver.providerKeeper().GetBlocksPerEpoch(driver.providerCtx()) - for i := uint32(0); i < blocksPerEpoch; i = i + 1 { + for i := int64(0); i < blocksPerEpoch; i = i + 1 { driver.endAndBeginBlock("provider", 1*time.Nanosecond) } for _, consumer := range driver.runningConsumers() { diff --git a/tests/mbt/driver/setup.go b/tests/mbt/driver/setup.go index ae71b17d61..141885f661 100644 --- a/tests/mbt/driver/setup.go +++ b/tests/mbt/driver/setup.go @@ -373,8 +373,8 @@ func (s *Driver) ConfigureNewPath(consumerChain, providerChain *ibctesting.TestC stakingValidators = append(stakingValidators, v) } - nextValidators := s.providerKeeper().ComputeNextEpochValidators(s.providerCtx(), string(consumerChainId), stakingValidators) - s.providerKeeper().ResetCurrentEpochValidators(s.providerCtx(), string(consumerChainId), nextValidators) + nextValidators := s.providerKeeper().ComputeNextEpochConsumerValSet(s.providerCtx(), string(consumerChainId), stakingValidators) + s.providerKeeper().SetConsumerValSet(s.providerCtx(), string(consumerChainId), nextValidators) err = s.providerKeeper().SetConsumerGenesis( providerChain.GetContext(), diff --git a/x/ccv/provider/keeper/params.go b/x/ccv/provider/keeper/params.go index aa155e73e4..ece8a727b6 100644 --- a/x/ccv/provider/keeper/params.go +++ b/x/ccv/provider/keeper/params.go @@ -79,8 +79,8 @@ func (k Keeper) GetConsumerRewardDenomRegistrationFee(ctx sdk.Context) sdk.Coin } // GetBlocksPerEpoch return the number of blocks that constitute an epoch -func (k Keeper) GetBlocksPerEpoch(ctx sdk.Context) uint32 { - var b uint32 +func (k Keeper) GetBlocksPerEpoch(ctx sdk.Context) int64 { + var b int64 k.paramSpace.Get(ctx, types.KeyBlocksPerEpoch, &b) return b } diff --git a/x/ccv/provider/keeper/proposal.go b/x/ccv/provider/keeper/proposal.go index 1ba851bd00..a9195f65bd 100644 --- a/x/ccv/provider/keeper/proposal.go +++ b/x/ccv/provider/keeper/proposal.go @@ -281,11 +281,11 @@ func (k Keeper) MakeConsumerGenesis( bondedValidators = append(bondedValidators, val) } - nextValidators := k.ComputeNextEpochValidators(ctx, chainID, bondedValidators) - k.ResetCurrentEpochValidators(ctx, chainID, nextValidators) + nextValidators := k.ComputeNextEpochConsumerValSet(ctx, chainID, bondedValidators) + k.SetConsumerValSet(ctx, chainID, nextValidators) - // Apply key assignments to the initial valset. - initialUpdatesWithConsumerKeys := k.MustApplyKeyAssignmentToValUpdates(ctx, chainID, initialUpdates) + // get the initial updates with the latest set consumer public keys + initialUpdatesWithConsumerKeys := DiffValidators([]types.ConsumerValidator{}, nextValidators) // Get a hash of the consumer validator set from the update with applied consumer assigned keys updatesAsValSet, err := tmtypes.PB2TM.ValidatorUpdates(initialUpdatesWithConsumerKeys) diff --git a/x/ccv/provider/keeper/relay.go b/x/ccv/provider/keeper/relay.go index 59eb2685ee..939f6d3995 100644 --- a/x/ccv/provider/keeper/relay.go +++ b/x/ccv/provider/keeper/relay.go @@ -148,7 +148,7 @@ func (k Keeper) EndBlockVSU(ctx sdk.Context) { // notify the staking module to complete all matured unbonding ops k.completeMaturedUnbondingOps(ctx) - if ctx.BlockHeight()%int64(k.GetBlocksPerEpoch(ctx)) == 0 { + if ctx.BlockHeight()%k.GetBlocksPerEpoch(ctx) == 0 { // only queue and send VSCPackets at the boundaries of an epoch // collect validator updates @@ -217,14 +217,14 @@ func (k Keeper) SendVSCPacketsToChain(ctx sdk.Context, chainID, channelID string func (k Keeper) QueueVSCPackets(ctx sdk.Context) { valUpdateID := k.GetValidatorSetUpdateId(ctx) // current valset update ID - // Get the bonded validators from the staking module. + // get the bonded validators from the staking module bondedValidators := k.stakingKeeper.GetLastValidators(ctx) for _, chain := range k.GetAllConsumerChains(ctx) { - currentEpochValidators := k.GetAllEpochValidators(ctx, chain.ChainId) - nextEpochValidators := k.ComputeNextEpochValidators(ctx, chain.ChainId, bondedValidators) - valUpdates := DiffValidators(currentEpochValidators, nextEpochValidators) - k.ResetCurrentEpochValidators(ctx, chain.ChainId, nextEpochValidators) + currentValidators := k.GetConsumerValSet(ctx, chain.ChainId) + nextValidators := k.ComputeNextEpochConsumerValSet(ctx, chain.ChainId, bondedValidators) + valUpdates := DiffValidators(currentValidators, nextValidators) + k.SetConsumerValSet(ctx, chain.ChainId, nextValidators) // check whether there are changes in the validator set; // note that this also entails unbonding operations diff --git a/x/ccv/provider/keeper/validator_set_update.go b/x/ccv/provider/keeper/validator_set_update.go index b3923e0012..a8f6ab08c3 100644 --- a/x/ccv/provider/keeper/validator_set_update.go +++ b/x/ccv/provider/keeper/validator_set_update.go @@ -3,17 +3,16 @@ package keeper import ( "fmt" abci "github.com/cometbft/cometbft/abci/types" - "github.com/cometbft/cometbft/proto/tendermint/crypto" sdk "github.com/cosmos/cosmos-sdk/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" "github.com/cosmos/interchain-security/v4/x/ccv/provider/types" ) -// SetEpochValidator sets provided epoch `validator` on the consumer chain with `chainID` -func (k Keeper) SetEpochValidator( +// SetConsumerValidator sets provided consumer `validator` on the consumer chain with `chainID` +func (k Keeper) SetConsumerValidator( ctx sdk.Context, chainID string, - validator types.EpochValidator, + validator types.ConsumerValidator, ) { store := ctx.KVStore(k.storeKey) bz, err := validator.Marshal() @@ -21,25 +20,25 @@ func (k Keeper) SetEpochValidator( panic(fmt.Errorf("failed to marshal EpochValidator: %w", err)) } - store.Set(types.EpochKey(chainID, validator.ProviderConsAddr), bz) + store.Set(types.ConsumerValidatorKey(chainID, validator.ProviderConsAddr), bz) } -// DeleteEpochValidator removes epoch validator with `providerAddr` address -func (k Keeper) DeleteEpochValidator( +// DeleteConsumerValidator removes consumer validator with `providerAddr` address +func (k Keeper) DeleteConsumerValidator( ctx sdk.Context, chainID string, providerConsAddr types.ProviderConsAddress, ) { store := ctx.KVStore(k.storeKey) - store.Delete(types.EpochKey(chainID, providerConsAddr.ToSdkConsAddr())) + store.Delete(types.ConsumerValidatorKey(chainID, providerConsAddr.ToSdkConsAddr())) } -// DeleteAllEpochValidators deletes all the stored epoch validators -func (k Keeper) DeleteAllEpochValidators( +// DeleteConsumerValSet deletes all the stored consumer validators for chain `chainID` +func (k Keeper) DeleteConsumerValSet( ctx sdk.Context, chainID string) { store := ctx.KVStore(k.storeKey) - key := types.ChainIdWithLenKey(types.EpochBytePrefix, chainID) + key := types.ChainIdWithLenKey(types.ConsumerValidatorBytePrefix, chainID) iterator := sdk.KVStorePrefixIterator(store, key) var keysToDel [][]byte @@ -52,30 +51,31 @@ func (k Keeper) DeleteAllEpochValidators( } } -// IsEpochValidator returns `true` if the validator with `providerAddr` is set in and `false` otherwise -func (k Keeper) IsEpochValidator( +// IsConsumerValidator returns `true` if the consumer validator with `providerAddr` exists for chain `chainID` +// and `false` otherwise +func (k Keeper) IsConsumerValidator( ctx sdk.Context, chainID string, providerAddr types.ProviderConsAddress, ) bool { store := ctx.KVStore(k.storeKey) - return store.Get(types.EpochKey(chainID, providerAddr.ToSdkConsAddr())) != nil + return store.Get(types.ConsumerValidatorKey(chainID, providerAddr.ToSdkConsAddr())) != nil } -// GetAllEpochValidators returns all the epoch validators on chain `chainID` -func (k Keeper) GetAllEpochValidators( +// GetConsumerValSet returns all the consumer validators for chain `chainID` +func (k Keeper) GetConsumerValSet( ctx sdk.Context, - chainID string) (optedInValidators []types.EpochValidator) { + chainID string) (optedInValidators []types.ConsumerValidator) { store := ctx.KVStore(k.storeKey) - key := types.ChainIdWithLenKey(types.EpochBytePrefix, chainID) + key := types.ChainIdWithLenKey(types.ConsumerValidatorBytePrefix, chainID) iterator := sdk.KVStorePrefixIterator(store, key) defer iterator.Close() for ; iterator.Valid(); iterator.Next() { iterator.Value() - var optedInValidator types.EpochValidator + var optedInValidator types.ConsumerValidator if err := optedInValidator.Unmarshal(iterator.Value()); err != nil { - panic(fmt.Errorf("failed to unmarshal EpochValidator: %w", err)) + panic(fmt.Errorf("failed to unmarshal ConsumerValidator: %w", err)) } optedInValidators = append(optedInValidators, optedInValidator) } @@ -83,14 +83,14 @@ func (k Keeper) GetAllEpochValidators( return optedInValidators } -// ComputeNextEpochValidators returns the next validator set that is responsible for validating consumer chain `chainID`, -// based on the bonded validators. -func (k Keeper) ComputeNextEpochValidators( +// ComputeNextEpochConsumerValSet returns the next validator set that is responsible for validating consumer +// chain `chainID`, based on the bonded validators. +func (k Keeper) ComputeNextEpochConsumerValSet( ctx sdk.Context, chainID string, bondedValidators []stakingtypes.Validator, -) []types.EpochValidator { - var nextValidators []types.EpochValidator +) []types.ConsumerValidator { + var nextValidators []types.ConsumerValidator for _, val := range bondedValidators { // get next voting power and the next consumer public key nextPower := k.stakingKeeper.GetLastValidatorPower(ctx, val.GetOperator()) @@ -115,22 +115,12 @@ func (k Keeper) ComputeNextEpochValidators( // we cannot generate a validator update panic(fmt.Errorf("could not retrieve validator's (%+v) public key: %w", val, err)) } - } - nextConsumerPublicKeyBytes, err := nextConsumerPublicKey.Marshal() - if err != nil { - // this should never happen but is recoverable if we exclude this validator from the `nextValidators` - k.Logger(ctx).Error("could not marshal consumer public key", - "consumer public key", nextConsumerPublicKey, - "error", err) - continue - } - - nextValidator := types.EpochValidator{ + nextValidator := types.ConsumerValidator{ ProviderConsAddr: consAddr, Power: nextPower, - ConsumerPublicKey: nextConsumerPublicKeyBytes, + ConsumerPublicKey: &nextConsumerPublicKey, } nextValidators = append(nextValidators, nextValidator) } @@ -138,78 +128,58 @@ func (k Keeper) ComputeNextEpochValidators( return nextValidators } -// DiffValidators compares the current and the next epoch validators and returns the `ValidatorUpdate` diff needed -// by CometBFT to update the validator set on a chain. +// DiffValidators compares the current and the next epoch's consumer validators and returns the `ValidatorUpdate` diff +// needed by CometBFT to update the validator set on a chain. func DiffValidators( - currentValidators []types.EpochValidator, - nextValidators []types.EpochValidator) []abci.ValidatorUpdate { + currentValidators []types.ConsumerValidator, + nextValidators []types.ConsumerValidator) []abci.ValidatorUpdate { var updates []abci.ValidatorUpdate - isCurrentValidator := make(map[string]types.EpochValidator) + isCurrentValidator := make(map[string]types.ConsumerValidator) for _, val := range currentValidators { isCurrentValidator[string(val.ProviderConsAddr)] = val } - isNextValidator := make(map[string]types.EpochValidator) + isNextValidator := make(map[string]types.ConsumerValidator) for _, val := range nextValidators { isNextValidator[string(val.ProviderConsAddr)] = val } for _, val := range currentValidators { - var currentPublicKey crypto.PublicKey - err := currentPublicKey.Unmarshal(val.ConsumerPublicKey) - if err != nil { - // this should never happen and might not be recoverable because without the public key - // we cannot generate a validator update - panic(fmt.Errorf("could not unmarshall validator's (%+v) public key: %w", val, err)) - } - if nextVal, found := isNextValidator[string(val.ProviderConsAddr)]; found { // validator remains in the next epoch - var nextPublicKey crypto.PublicKey - err = nextPublicKey.Unmarshal(nextVal.ConsumerPublicKey) - if err != nil { - // this should never happen and is not recoverable because without the public key - // we cannot generate a validator update - panic(fmt.Errorf("could not unmarshall validator's (%+v) public key: %w", nextVal, err)) - } - - if !currentPublicKey.Equal(nextPublicKey) { - updates = append(updates, abci.ValidatorUpdate{PubKey: currentPublicKey, Power: 0}) - updates = append(updates, abci.ValidatorUpdate{PubKey: nextPublicKey, Power: nextVal.Power}) + if !val.ConsumerPublicKey.Equal(nextVal.ConsumerPublicKey) { + // validator has a new consumer public key, so we introduce `nextVal` consumer key with the latest power, + // and we remove validator with the old `val` key by creating an update with 0 power + updates = append(updates, abci.ValidatorUpdate{PubKey: *val.ConsumerPublicKey, Power: 0}) + updates = append(updates, abci.ValidatorUpdate{PubKey: *nextVal.ConsumerPublicKey, Power: nextVal.Power}) } else if val.Power != nextVal.Power { - updates = append(updates, abci.ValidatorUpdate{PubKey: nextPublicKey, Power: nextVal.Power}) + // validator did not modify its consumer public key but has changed its voting power, so we + // have to create an update with the new power + updates = append(updates, abci.ValidatorUpdate{PubKey: *nextVal.ConsumerPublicKey, Power: nextVal.Power}) } // else no update is needed because neither the consumer public key changed, nor the power of the validator } else { - // not found in next validators and hence the validator has to be removed - updates = append(updates, abci.ValidatorUpdate{PubKey: currentPublicKey, Power: 0}) + // not found in next validators and hence the validator has to be removed (i.e., update with 0 power) + updates = append(updates, abci.ValidatorUpdate{PubKey: *val.ConsumerPublicKey, Power: 0}) } } for _, val := range nextValidators { if _, found := isCurrentValidator[string(val.ProviderConsAddr)]; !found { - // validators that are about to join an epoch - var nextPublicKey crypto.PublicKey - err := nextPublicKey.Unmarshal(val.ConsumerPublicKey) - if err != nil { - // this should never happen and is not recoverable because without the public key - // we cannot generate a validator update - panic(fmt.Errorf("could not unmarshall validator's (%+v) public key: %w", val, err)) - } - - updates = append(updates, abci.ValidatorUpdate{PubKey: nextPublicKey, Power: val.Power}) + // validator is about to join an epoch + updates = append(updates, abci.ValidatorUpdate{PubKey: *val.ConsumerPublicKey, Power: val.Power}) } } return updates } -// ResetCurrentEpochValidators resets the current epoch validators with the `nextValidators` computed by -// `ComputeNextEpochValidators` and hence this method should only be called after `ComputeNextEpochValidators` has completed. -func (k Keeper) ResetCurrentEpochValidators(ctx sdk.Context, chainID string, nextValidators []types.EpochValidator) { - k.DeleteAllEpochValidators(ctx, chainID) +// SetConsumerValSet resets the current consumer validators with the `nextValidators` computed by +// `ComputeNextEpochConsumerValSet` and hence this method should only be called after `ComputeNextEpochConsumerValSet` has completed. +func (k Keeper) SetConsumerValSet(ctx sdk.Context, chainID string, nextValidators []types.ConsumerValidator) { + k.DeleteConsumerValSet(ctx, chainID) for _, val := range nextValidators { - k.SetEpochValidator(ctx, chainID, val) + k.SetConsumerValidator(ctx, chainID, val) } } diff --git a/x/ccv/provider/keeper/validator_set_update_test.go b/x/ccv/provider/keeper/validator_set_update_test.go index 9621f0d8b7..d129847176 100644 --- a/x/ccv/provider/keeper/validator_set_update_test.go +++ b/x/ccv/provider/keeper/validator_set_update_test.go @@ -18,59 +18,71 @@ import ( "testing" ) -// TestEpochValidator tests the `SetEpochValidator`, `IsEpochValidator`, and `DeleteEpochValidator` methods -func TestEpochValidator(t *testing.T) { +// TestConsumerValidator tests the `SetConsumerValidator`, `IsConsumerValidator`, and `DeleteConsumerValidator` methods +func TestConsumerValidator(t *testing.T) { providerKeeper, ctx, ctrl, _ := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) defer ctrl.Finish() - validator := types.EpochValidator{ + validator := types.ConsumerValidator{ ProviderConsAddr: []byte("providerConsAddr"), Power: 2, - ConsumerPublicKey: []byte{3}, + ConsumerPublicKey: &crypto.PublicKey{}, } - require.False(t, providerKeeper.IsEpochValidator(ctx, "chainID", types.NewProviderConsAddress(validator.ProviderConsAddr))) - providerKeeper.SetEpochValidator(ctx, "chainID", validator) - require.True(t, providerKeeper.IsEpochValidator(ctx, "chainID", types.NewProviderConsAddress(validator.ProviderConsAddr))) - providerKeeper.DeleteEpochValidator(ctx, "chainID", types.NewProviderConsAddress(validator.ProviderConsAddr)) - require.False(t, providerKeeper.IsEpochValidator(ctx, "chainID", types.NewProviderConsAddress(validator.ProviderConsAddr))) + require.False(t, providerKeeper.IsConsumerValidator(ctx, "chainID", types.NewProviderConsAddress(validator.ProviderConsAddr))) + providerKeeper.SetConsumerValidator(ctx, "chainID", validator) + require.True(t, providerKeeper.IsConsumerValidator(ctx, "chainID", types.NewProviderConsAddress(validator.ProviderConsAddr))) + providerKeeper.DeleteConsumerValidator(ctx, "chainID", types.NewProviderConsAddress(validator.ProviderConsAddr)) + require.False(t, providerKeeper.IsConsumerValidator(ctx, "chainID", types.NewProviderConsAddress(validator.ProviderConsAddr))) } -func TestGetAllEpochValidators(t *testing.T) { +func TestGetConsumerValSet(t *testing.T) { providerKeeper, ctx, ctrl, _ := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) defer ctrl.Finish() - // create 3 validators and set them as epoch validators - expectedValidators := []types.EpochValidator{ + // create 3 validators and set them as current validators + expectedValidators := []types.ConsumerValidator{ { - ProviderConsAddr: []byte("providerConsAddr1"), - Power: 2, - ConsumerPublicKey: []byte{3}, + ProviderConsAddr: []byte("providerConsAddr1"), + Power: 1, + ConsumerPublicKey: &crypto.PublicKey{ + Sum: &crypto.PublicKey_Ed25519{ + Ed25519: []byte{1}, + }, + }, }, { - ProviderConsAddr: []byte("providerConsAddr2"), - Power: 3, - ConsumerPublicKey: []byte{4}, + ProviderConsAddr: []byte("providerConsAddr2"), + Power: 2, + ConsumerPublicKey: &crypto.PublicKey{ + Sum: &crypto.PublicKey_Ed25519{ + Ed25519: []byte{2}, + }, + }, }, { - ProviderConsAddr: []byte("providerConsAddr3"), - Power: 4, - ConsumerPublicKey: []byte{5}, + ProviderConsAddr: []byte("providerConsAddr3"), + Power: 3, + ConsumerPublicKey: &crypto.PublicKey{ + Sum: &crypto.PublicKey_Ed25519{ + Ed25519: []byte{3}, + }, + }, }, } for _, expectedValidator := range expectedValidators { - providerKeeper.SetEpochValidator(ctx, "chainID", - types.EpochValidator{ + providerKeeper.SetConsumerValidator(ctx, "chainID", + types.ConsumerValidator{ ProviderConsAddr: expectedValidator.ProviderConsAddr, Power: expectedValidator.Power, ConsumerPublicKey: expectedValidator.ConsumerPublicKey}) } - actualValidators := providerKeeper.GetAllEpochValidators(ctx, "chainID") + actualValidators := providerKeeper.GetConsumerValSet(ctx, "chainID") // sort validators first to be able to compare - sortValidators := func(validators []types.EpochValidator) { + sortValidators := func(validators []types.ConsumerValidator) { sort.Slice(validators, func(i int, j int) bool { return bytes.Compare(validators[i].ProviderConsAddr, validators[j].ProviderConsAddr) < 0 }) @@ -80,17 +92,17 @@ func TestGetAllEpochValidators(t *testing.T) { require.Equal(t, expectedValidators, actualValidators) } -// createEpochValidator is a helper function to create an epoch validator with the given `power`. It uses `index` as +// createConsumerValidator is a helper function to create a consumer validator with the given `power`. It uses `index` as // the `ProviderConsAddr` of the validator, and the `seed` to generate the consumer public key. Returns the validator // and its consumer public key. -func createEpochValidator(index int, power int64, seed int) (types.EpochValidator, crypto.PublicKey) { +func createConsumerValidator(index int, power int64, seed int) (types.ConsumerValidator, crypto.PublicKey) { publicKey := cryptotestutil.NewCryptoIdentityFromIntSeed(seed).TMProtoCryptoPublicKey() - publicKeyBytes, _ := publicKey.Marshal() - return types.EpochValidator{ + return types.ConsumerValidator{ ProviderConsAddr: []byte{byte(index)}, Power: power, - ConsumerPublicKey: publicKeyBytes}, publicKey + ConsumerPublicKey: &publicKey, + }, publicKey } func TestComputeNextEpochValidators(t *testing.T) { @@ -119,39 +131,37 @@ func TestComputeNextEpochValidators(t *testing.T) { } } - // no epoch validators returned if we have no bonded validators - require.Empty(t, providerKeeper.ComputeNextEpochValidators(ctx, chainID, []stakingtypes.Validator{})) + // no consumer validators returned if we have no bonded validators + require.Empty(t, providerKeeper.ComputeNextEpochConsumerValSet(ctx, chainID, []stakingtypes.Validator{})) - var expectedEpochValidators []types.EpochValidator + var expectedValidators []types.ConsumerValidator // create a staking validator A that has not set a consumer public key valA := createStakingValidator(ctx, mocks, 1, 1) // because validator A has no consumer key set, the `ConsumerPublicKey` we expect is the key on the provider chain valAConsAddr, _ := valA.GetConsAddr() valAPublicKey, _ := valA.TmConsPublicKey() - valAPublicKeyBytes, _ := valAPublicKey.Marshal() - expectedEpochValidators = append(expectedEpochValidators, types.EpochValidator{ + expectedValidators = append(expectedValidators, types.ConsumerValidator{ ProviderConsAddr: types.NewProviderConsAddress(valAConsAddr).Address.Bytes(), Power: 1, - ConsumerPublicKey: valAPublicKeyBytes, + ConsumerPublicKey: &valAPublicKey, }) // create a staking validator B that has set a consumer public key valB := createStakingValidator(ctx, mocks, 2, 2) // validator B has set a consumer key, the `ConsumerPublicKey` we expect is the key set by `SetValidatorConsumerPubKey` valBConsumerKey := cryptotestutil.NewCryptoIdentityFromIntSeed(1).TMProtoCryptoPublicKey() - valBConsumerKeyBytes, _ := valBConsumerKey.Marshal() valBConsAddr, _ := valB.GetConsAddr() providerKeeper.SetValidatorConsumerPubKey(ctx, chainID, types.NewProviderConsAddress(valBConsAddr), valBConsumerKey) - expectedEpochValidators = append(expectedEpochValidators, types.EpochValidator{ + expectedValidators = append(expectedValidators, types.ConsumerValidator{ ProviderConsAddr: types.NewProviderConsAddress(valBConsAddr).Address.Bytes(), Power: 2, - ConsumerPublicKey: valBConsumerKeyBytes, + ConsumerPublicKey: &valBConsumerKey, }) bondedValidators := []stakingtypes.Validator{valA, valB} - actualEpochValidators := providerKeeper.ComputeNextEpochValidators(ctx, "chainID", bondedValidators) - require.Equal(t, expectedEpochValidators, actualEpochValidators) + actualValidators := providerKeeper.ComputeNextEpochConsumerValSet(ctx, "chainID", bondedValidators) + require.Equal(t, expectedValidators, actualValidators) } func TestDiff(t *testing.T) { @@ -166,41 +176,41 @@ func TestDiff(t *testing.T) { // validator A only exists in `currentValidators` and hence an update with 0 power would be generated // to remove this validator - currentA, currentPublicKeyA := createEpochValidator(1, 1, 1) + currentA, currentPublicKeyA := createConsumerValidator(1, 1, 1) expectedUpdates = append(expectedUpdates, abci.ValidatorUpdate{PubKey: currentPublicKeyA, Power: 0}) // validator B exists in both `currentValidators` and `nextValidators` but it did not change its // power or consumer public key and hence no validator update is generated - currentB, _ := createEpochValidator(2, 1, 2) - nextB, _ := createEpochValidator(2, 1, 2) + currentB, _ := createConsumerValidator(2, 1, 2) + nextB, _ := createConsumerValidator(2, 1, 2) // validator C exists in both `currentValidators` and `nextValidators` and it changes its power, so // a validator update is generated with the new power - currentC, currentPublicKeyC := createEpochValidator(3, 1, 3) - nextC, _ := createEpochValidator(3, 2, 3) + currentC, currentPublicKeyC := createConsumerValidator(3, 1, 3) + nextC, _ := createConsumerValidator(3, 2, 3) expectedUpdates = append(expectedUpdates, abci.ValidatorUpdate{PubKey: currentPublicKeyC, Power: 2}) // validator D exists in both `currentValidators` and `nextValidators` and it changes its consumer public key, so // a validator update is generated to remove the old public key and another update to add the new public key - currentD, currentPublicKeyD := createEpochValidator(4, 1, 4) - nextD, nextPublicKeyD := createEpochValidator(4, 1, 5) + currentD, currentPublicKeyD := createConsumerValidator(4, 1, 4) + nextD, nextPublicKeyD := createConsumerValidator(4, 1, 5) expectedUpdates = append(expectedUpdates, abci.ValidatorUpdate{PubKey: currentPublicKeyD, Power: 0}) expectedUpdates = append(expectedUpdates, abci.ValidatorUpdate{PubKey: nextPublicKeyD, Power: 1}) // validator E exists in both `currentValidators` and `nextValidators` and it changes both its power and // its consumer public key, so a validator update is generated to remove the old public key and another update to // add the new public key with thew new power - currentE, currentPublicKeyE := createEpochValidator(5, 1, 6) - nextE, nextPublicKeyE := createEpochValidator(5, 2, 7) + currentE, currentPublicKeyE := createConsumerValidator(5, 1, 6) + nextE, nextPublicKeyE := createConsumerValidator(5, 2, 7) expectedUpdates = append(expectedUpdates, abci.ValidatorUpdate{PubKey: currentPublicKeyE, Power: 0}) expectedUpdates = append(expectedUpdates, abci.ValidatorUpdate{PubKey: nextPublicKeyE, Power: 2}) // validator F does not exist in `currentValidators` and hence an update is generated to add this new validator - nextF, nextPublicKeyF := createEpochValidator(6, 1, 8) + nextF, nextPublicKeyF := createConsumerValidator(6, 1, 8) expectedUpdates = append(expectedUpdates, abci.ValidatorUpdate{PubKey: nextPublicKeyF, Power: 1}) - currentValidators := []types.EpochValidator{currentA, currentB, currentC, currentD, currentE} - nextValidators := []types.EpochValidator{nextB, nextC, nextD, nextE, nextF} + currentValidators := []types.ConsumerValidator{currentA, currentB, currentC, currentD, currentE} + nextValidators := []types.ConsumerValidator{nextB, nextC, nextD, nextE, nextF} actualUpdates := keeper.DiffValidators(currentValidators, nextValidators) @@ -220,19 +230,19 @@ func TestDiff(t *testing.T) { } func TestDiffEdgeCases(t *testing.T) { - require.Empty(t, len(keeper.DiffValidators([]types.EpochValidator{}, []types.EpochValidator{}))) + require.Empty(t, len(keeper.DiffValidators([]types.ConsumerValidator{}, []types.ConsumerValidator{}))) - valA, publicKeyA := createEpochValidator(1, 1, 1) - valB, publicKeyB := createEpochValidator(2, 2, 2) - valC, publicKeyC := createEpochValidator(3, 3, 3) - validators := []types.EpochValidator{valA, valB, valC} + valA, publicKeyA := createConsumerValidator(1, 1, 1) + valB, publicKeyB := createConsumerValidator(2, 2, 2) + valC, publicKeyC := createConsumerValidator(3, 3, 3) + validators := []types.ConsumerValidator{valA, valB, valC} // we do not expect any validator updates if the `currentValidators` are the same with the `nextValidators` require.Empty(t, len(keeper.DiffValidators(validators, validators))) // only have `nextValidators` that would generate validator updates for the validators to be added expectedUpdates := []abci.ValidatorUpdate{{publicKeyA, 1}, {publicKeyB, 2}, {publicKeyC, 3}} - actualUpdates := keeper.DiffValidators([]types.EpochValidator{}, validators) + actualUpdates := keeper.DiffValidators([]types.ConsumerValidator{}, validators) // sort validators first to be able to compare sortUpdates := func(updates []abci.ValidatorUpdate) { sort.Slice(updates, func(i, j int) bool { @@ -249,7 +259,7 @@ func TestDiffEdgeCases(t *testing.T) { // only have `currentValidators` that would generate validator updates for the validators to be removed expectedUpdates = []abci.ValidatorUpdate{{publicKeyA, 0}, {publicKeyB, 0}, {publicKeyC, 0}} - actualUpdates = keeper.DiffValidators(validators, []types.EpochValidator{}) + actualUpdates = keeper.DiffValidators(validators, []types.ConsumerValidator{}) sortUpdates(expectedUpdates) sortUpdates(actualUpdates) require.Equal(t, expectedUpdates, actualUpdates) @@ -261,49 +271,69 @@ func TestResetCurrentEpochValidators(t *testing.T) { chainID := "chainID" - currentValidators := []types.EpochValidator{ + currentValidators := []types.ConsumerValidator{ { - ProviderConsAddr: []byte("currentProviderConsAddr1"), - Power: 2, - ConsumerPublicKey: []byte{3}, + ProviderConsAddr: []byte("currentProviderConsAddr1"), + Power: 2, + ConsumerPublicKey: &crypto.PublicKey{ + Sum: &crypto.PublicKey_Ed25519{ + Ed25519: []byte{2}, + }, + }, }, { - ProviderConsAddr: []byte("currentProviderConsAddr2"), - Power: 3, - ConsumerPublicKey: []byte{4}, + ProviderConsAddr: []byte("currentProviderConsAddr2"), + Power: 3, + ConsumerPublicKey: &crypto.PublicKey{ + Sum: &crypto.PublicKey_Ed25519{ + Ed25519: []byte{3}, + }, + }, }, { - ProviderConsAddr: []byte("currentProviderConsAddr3"), - Power: 4, - ConsumerPublicKey: []byte{5}, + ProviderConsAddr: []byte("currentProviderConsAddr3"), + Power: 4, + ConsumerPublicKey: &crypto.PublicKey{ + Sum: &crypto.PublicKey_Ed25519{ + Ed25519: []byte{4}, + }, + }, }, } - nextValidators := []types.EpochValidator{ + nextValidators := []types.ConsumerValidator{ { - ProviderConsAddr: []byte("nextProviderConsAddr1"), - Power: 2, - ConsumerPublicKey: []byte{3}, + ProviderConsAddr: []byte("nextProviderConsAddr1"), + Power: 2, + ConsumerPublicKey: &crypto.PublicKey{ + Sum: &crypto.PublicKey_Ed25519{ + Ed25519: []byte{2}, + }, + }, }, { - ProviderConsAddr: []byte("nextProviderConsAddr2"), - Power: 3, - ConsumerPublicKey: []byte{4}, + ProviderConsAddr: []byte("nextProviderConsAddr2"), + Power: 3, + ConsumerPublicKey: &crypto.PublicKey{ + Sum: &crypto.PublicKey_Ed25519{ + Ed25519: []byte{3}, + }, + }, }, } - // set the `currentValidators` as epoch validators - require.Empty(t, providerKeeper.GetAllEpochValidators(ctx, chainID)) + // set the `currentValidators` for chain `chainID` + require.Empty(t, providerKeeper.GetConsumerValSet(ctx, chainID)) for _, validator := range currentValidators { - providerKeeper.SetEpochValidator(ctx, chainID, validator) + providerKeeper.SetConsumerValidator(ctx, chainID, validator) } - require.NotEmpty(t, providerKeeper.GetAllEpochValidators(ctx, chainID)) + require.NotEmpty(t, providerKeeper.GetConsumerValSet(ctx, chainID)) - providerKeeper.ResetCurrentEpochValidators(ctx, chainID, nextValidators) - nextCurrentValidators := providerKeeper.GetAllEpochValidators(ctx, chainID) + providerKeeper.SetConsumerValSet(ctx, chainID, nextValidators) + nextCurrentValidators := providerKeeper.GetConsumerValSet(ctx, chainID) // sort validators first to be able to compare - sortValidators := func(validators []types.EpochValidator) { + sortValidators := func(validators []types.ConsumerValidator) { sort.Slice(validators, func(i, j int) bool { return bytes.Compare(validators[i].ProviderConsAddr, validators[j].ProviderConsAddr) < 0 }) diff --git a/x/ccv/provider/types/keys.go b/x/ccv/provider/types/keys.go index 433fc47f4c..29e3486071 100644 --- a/x/ccv/provider/types/keys.go +++ b/x/ccv/provider/types/keys.go @@ -145,8 +145,8 @@ const ( // ProposedConsumerChainByteKey is the byte prefix storing the consumer chainId in consumerAddition gov proposal submitted before voting finishes ProposedConsumerChainByteKey - // EpochBytePrefix is the byte prefix used when storing for each consumer chain all the opted in validators in this epoch - EpochBytePrefix + // ConsumerValidatorBytePrefix is the byte prefix used when storing for each consumer chain all the consumer validators in this epoch + ConsumerValidatorBytePrefix // NOTE: DO NOT ADD NEW BYTE PREFIXES HERE WITHOUT ADDING THEM TO getAllKeyPrefixes() IN keys_test.go ) @@ -520,9 +520,9 @@ func ParseProposedConsumerChainKey(prefix byte, bz []byte) (uint64, error) { return proposalID, nil } -// EpochKey returns the key of consumer chain `chainID` and validator with `providerAddr` -func EpochKey(chainID string, providerAddr []byte) []byte { - prefix := ChainIdWithLenKey(EpochBytePrefix, chainID) +// ConsumerValidatorKey returns the key of consumer chain `chainID` and validator with `providerAddr` +func ConsumerValidatorKey(chainID string, providerAddr []byte) []byte { + prefix := ChainIdWithLenKey(ConsumerValidatorBytePrefix, chainID) return append(prefix, providerAddr...) } diff --git a/x/ccv/provider/types/keys_test.go b/x/ccv/provider/types/keys_test.go index 36a87e6ea9..24178f6180 100644 --- a/x/ccv/provider/types/keys_test.go +++ b/x/ccv/provider/types/keys_test.go @@ -56,7 +56,7 @@ func getAllKeyPrefixes() []byte { providertypes.VSCMaturedHandledThisBlockBytePrefix, providertypes.EquivocationEvidenceMinHeightBytePrefix, providertypes.ProposedConsumerChainByteKey, - providertypes.EpochBytePrefix, + providertypes.ConsumerValidatorBytePrefix, } } diff --git a/x/ccv/provider/types/params.go b/x/ccv/provider/types/params.go index 2e47482d70..452c1f7020 100644 --- a/x/ccv/provider/types/params.go +++ b/x/ccv/provider/types/params.go @@ -69,7 +69,7 @@ func NewParams( slashMeterReplenishPeriod time.Duration, slashMeterReplenishFraction string, consumerRewardDenomRegistrationFee sdk.Coin, - blocksPerEpoch uint32, + blocksPerEpoch int64, ) Params { return Params{ TemplateClient: cs, @@ -144,7 +144,7 @@ func (p Params) Validate() error { if err := ValidateCoin(p.ConsumerRewardDenomRegistrationFee); err != nil { return fmt.Errorf("consumer reward denom registration fee is invalid: %s", err) } - if err := ccvtypes.ValidatePositiveUint32(p.BlocksPerEpoch); err != nil { + if err := ccvtypes.ValidatePositiveInt64(p.BlocksPerEpoch); err != nil { return fmt.Errorf("blocks per epoch have to be positive: %s", err) } return nil @@ -161,7 +161,7 @@ func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs { paramtypes.NewParamSetPair(KeySlashMeterReplenishPeriod, p.SlashMeterReplenishPeriod, ccvtypes.ValidateDuration), paramtypes.NewParamSetPair(KeySlashMeterReplenishFraction, p.SlashMeterReplenishFraction, ccvtypes.ValidateStringFraction), paramtypes.NewParamSetPair(KeyConsumerRewardDenomRegistrationFee, p.ConsumerRewardDenomRegistrationFee, ValidateCoin), - paramtypes.NewParamSetPair(KeyBlocksPerEpoch, p.BlocksPerEpoch, ccvtypes.ValidatePositiveUint32), + paramtypes.NewParamSetPair(KeyBlocksPerEpoch, p.BlocksPerEpoch, ccvtypes.ValidatePositiveInt64), } } diff --git a/x/ccv/provider/types/provider.pb.go b/x/ccv/provider/types/provider.pb.go index 69c3f76828..819154b75d 100644 --- a/x/ccv/provider/types/provider.pb.go +++ b/x/ccv/provider/types/provider.pb.go @@ -452,7 +452,7 @@ type Params struct { // The fee required to be paid to add a reward denom ConsumerRewardDenomRegistrationFee types2.Coin `protobuf:"bytes,9,opt,name=consumer_reward_denom_registration_fee,json=consumerRewardDenomRegistrationFee,proto3" json:"consumer_reward_denom_registration_fee"` // The number of blocks that comprise an epoch. - BlocksPerEpoch uint32 `protobuf:"varint,10,opt,name=blocks_per_epoch,json=blocksPerEpoch,proto3" json:"blocks_per_epoch,omitempty"` + BlocksPerEpoch int64 `protobuf:"varint,10,opt,name=blocks_per_epoch,json=blocksPerEpoch,proto3" json:"blocks_per_epoch,omitempty"` } func (m *Params) Reset() { *m = Params{} } @@ -544,7 +544,7 @@ func (m *Params) GetConsumerRewardDenomRegistrationFee() types2.Coin { return types2.Coin{} } -func (m *Params) GetBlocksPerEpoch() uint32 { +func (m *Params) GetBlocksPerEpoch() int64 { if m != nil { return m.BlocksPerEpoch } @@ -1394,29 +1394,29 @@ func (m *ConsumerAddrsToPrune) GetConsumerAddrs() *AddressList { return nil } -// EpochValidator is used to facilitate epoch-based transitions. It contains relevant info for +// ConsumerValidator is used to facilitate epoch-based transitions. It contains relevant info for // a validator that is opted in, in an epoch, on a consumer chain. -type EpochValidator struct { +type ConsumerValidator struct { // validator's consensus address on the provider chain ProviderConsAddr []byte `protobuf:"bytes,1,opt,name=provider_cons_addr,json=providerConsAddr,proto3" json:"provider_cons_addr,omitempty"` // voting power the validator has during this epoch Power int64 `protobuf:"varint,2,opt,name=power,proto3" json:"power,omitempty"` // public key the validator uses on the consumer chain during this epoch - ConsumerPublicKey []byte `protobuf:"bytes,3,opt,name=consumer_public_key,json=consumerPublicKey,proto3" json:"consumer_public_key,omitempty"` + ConsumerPublicKey *crypto.PublicKey `protobuf:"bytes,3,opt,name=consumer_public_key,json=consumerPublicKey,proto3" json:"consumer_public_key,omitempty"` } -func (m *EpochValidator) Reset() { *m = EpochValidator{} } -func (m *EpochValidator) String() string { return proto.CompactTextString(m) } -func (*EpochValidator) ProtoMessage() {} -func (*EpochValidator) Descriptor() ([]byte, []int) { +func (m *ConsumerValidator) Reset() { *m = ConsumerValidator{} } +func (m *ConsumerValidator) String() string { return proto.CompactTextString(m) } +func (*ConsumerValidator) ProtoMessage() {} +func (*ConsumerValidator) Descriptor() ([]byte, []int) { return fileDescriptor_f22ec409a72b7b72, []int{22} } -func (m *EpochValidator) XXX_Unmarshal(b []byte) error { +func (m *ConsumerValidator) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *EpochValidator) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *ConsumerValidator) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_EpochValidator.Marshal(b, m, deterministic) + return xxx_messageInfo_ConsumerValidator.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -1426,33 +1426,33 @@ func (m *EpochValidator) XXX_Marshal(b []byte, deterministic bool) ([]byte, erro return b[:n], nil } } -func (m *EpochValidator) XXX_Merge(src proto.Message) { - xxx_messageInfo_EpochValidator.Merge(m, src) +func (m *ConsumerValidator) XXX_Merge(src proto.Message) { + xxx_messageInfo_ConsumerValidator.Merge(m, src) } -func (m *EpochValidator) XXX_Size() int { +func (m *ConsumerValidator) XXX_Size() int { return m.Size() } -func (m *EpochValidator) XXX_DiscardUnknown() { - xxx_messageInfo_EpochValidator.DiscardUnknown(m) +func (m *ConsumerValidator) XXX_DiscardUnknown() { + xxx_messageInfo_ConsumerValidator.DiscardUnknown(m) } -var xxx_messageInfo_EpochValidator proto.InternalMessageInfo +var xxx_messageInfo_ConsumerValidator proto.InternalMessageInfo -func (m *EpochValidator) GetProviderConsAddr() []byte { +func (m *ConsumerValidator) GetProviderConsAddr() []byte { if m != nil { return m.ProviderConsAddr } return nil } -func (m *EpochValidator) GetPower() int64 { +func (m *ConsumerValidator) GetPower() int64 { if m != nil { return m.Power } return 0 } -func (m *EpochValidator) GetConsumerPublicKey() []byte { +func (m *ConsumerValidator) GetConsumerPublicKey() *crypto.PublicKey { if m != nil { return m.ConsumerPublicKey } @@ -1482,7 +1482,7 @@ func init() { proto.RegisterType((*ValidatorConsumerPubKey)(nil), "interchain_security.ccv.provider.v1.ValidatorConsumerPubKey") proto.RegisterType((*ValidatorByConsumerAddr)(nil), "interchain_security.ccv.provider.v1.ValidatorByConsumerAddr") proto.RegisterType((*ConsumerAddrsToPrune)(nil), "interchain_security.ccv.provider.v1.ConsumerAddrsToPrune") - proto.RegisterType((*EpochValidator)(nil), "interchain_security.ccv.provider.v1.EpochValidator") + proto.RegisterType((*ConsumerValidator)(nil), "interchain_security.ccv.provider.v1.ConsumerValidator") } func init() { @@ -1490,117 +1490,117 @@ func init() { } var fileDescriptor_f22ec409a72b7b72 = []byte{ - // 1757 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x58, 0x4f, 0x73, 0xdb, 0xc6, - 0x15, 0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x80, 0xf6, 0x71, 0x17, 0x33, 0x4e, 0xba, 0x38, - 0xa0, 0x24, 0x94, 0x4a, 0x6b, 0x7a, 0xca, 0x18, 0xba, 0x8a, 0x21, 0xa0, 0x83, 0xa1, 0x4c, 0xc9, - 0xa2, 0x2b, 0x49, 0xe8, 0x13, 0x3e, 0xa2, 0x29, 0x73, 0xf9, 0x95, 0x09, 0x6c, 0x56, 0xee, 0x31, - 0x1f, 0x47, 0x92, 0x75, 0x2f, 0xc8, 0x58, 0x64, 0xb7, 0xef, 0x60, 0x26, 0x46, 0x4c, 0x74, 0x89, - 0xf2, 0x3f, 0xc4, 0xa4, 0x9b, 0xec, 0xf6, 0x89, 0x44, 0xbb, 0x05, 0x21, 0xb7, 0x3b, 0xe3, 0xeb, - 0x23, 0x51, 0xf2, 0x60, 0x46, 0x33, 0xbb, 0xed, 0xef, 0x17, 0xc0, 0xea, 0xb1, 0x50, 0xc4, 0x23, - 0xc2, 0xf7, 0x7d, 0x9f, 0x2a, 0x97, 0x4e, 0x38, 0x8b, 0x98, 0x40, 0x81, 0xb9, 0x0e, 0xf3, 0x92, - 0xca, 0x80, 0x58, 0xc6, 0xb6, 0xb1, 0xd3, 0x74, 0xd3, 0x0f, 0x73, 0x1b, 0x5a, 0x3e, 0x11, 0x98, - 0xd3, 0x48, 0x31, 0x5b, 0x35, 0x7d, 0x57, 0x25, 0x99, 0x1b, 0xb0, 0x98, 0xe6, 0x81, 0xfa, 0x56, - 0x5d, 0x5f, 0xdf, 0xd2, 0xdf, 0x47, 0xbe, 0xf9, 0x09, 0xb4, 0x69, 0x48, 0x25, 0x45, 0x81, 0x37, - 0x24, 0x2a, 0x1a, 0x56, 0x63, 0xdb, 0xd8, 0x69, 0xed, 0xdd, 0x75, 0x68, 0x1f, 0x3b, 0x2a, 0x80, - 0x4e, 0x16, 0xb6, 0x64, 0xd7, 0x79, 0xa8, 0x39, 0x0e, 0x1a, 0xdf, 0x7c, 0xb7, 0x35, 0xe7, 0x2e, - 0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 0xa7, 0x88, - 0x4d, 0xf7, 0x4e, 0xc1, 0x30, 0x31, 0x89, 0x85, 0xfd, 0x18, 0xd6, 0x8f, 0xca, 0xa6, 0x2f, 0x86, - 0xfc, 0x84, 0x87, 0xc6, 0xe4, 0x36, 0xdf, 0x84, 0x66, 0xf1, 0x4b, 0x44, 0x7b, 0xdf, 0x70, 0x4b, - 0x82, 0x3d, 0x82, 0xd5, 0x73, 0x81, 0x4f, 0x49, 0xe8, 0x97, 0x60, 0x37, 0x04, 0xe0, 0x60, 0x1a, - 0x68, 0xe6, 0x97, 0x6e, 0xa9, 0x8e, 0xc1, 0xc6, 0x39, 0x0a, 0xa8, 0x8f, 0x24, 0xe3, 0xa7, 0x44, - 0xa6, 0x0b, 0xf8, 0x04, 0xe1, 0x0b, 0x22, 0x85, 0xe9, 0x42, 0x23, 0xa0, 0x42, 0x66, 0x95, 0xf5, - 0xc1, 0x8d, 0x95, 0x95, 0xec, 0x3a, 0x37, 0x81, 0x1c, 0x22, 0x89, 0xb2, 0xde, 0xd5, 0x58, 0xf6, - 0x4f, 0x61, 0xed, 0x53, 0x24, 0x63, 0x4e, 0xfc, 0x89, 0x1c, 0xaf, 0x42, 0x5d, 0xe5, 0xcf, 0xd0, - 0xf9, 0x53, 0x47, 0xf5, 0x1e, 0xb0, 0x1e, 0x7c, 0x11, 0x31, 0x2e, 0x89, 0x7f, 0x25, 0x22, 0x2f, - 0x09, 0xef, 0x05, 0xac, 0xa9, 0x60, 0x09, 0x12, 0xfa, 0x5e, 0xe1, 0x67, 0x9a, 0xc7, 0xd6, 0xde, - 0xaf, 0x66, 0xea, 0x8e, 0x69, 0x75, 0x99, 0x03, 0xb7, 0x93, 0x29, 0xba, 0xb0, 0xff, 0x62, 0x80, - 0x75, 0x4c, 0xc6, 0xfb, 0x42, 0xd0, 0x41, 0x38, 0x22, 0xa1, 0x54, 0x33, 0x10, 0x61, 0xa2, 0x8e, - 0xe6, 0x5b, 0xb0, 0x5c, 0xec, 0x5c,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a5, 0x2e, 0x4c, - 0x07, 0xd6, 0x0a, 0x7b, 0x23, 0x9d, 0x9d, 0x22, 0x85, 0x4b, 0x6e, 0xf1, 0xfc, 0x2c, 0xf2, 0x76, - 0xf0, 0xe4, 0x9b, 0x17, 0x1d, 0xe3, 0xdb, 0x17, 0x1d, 0xe3, 0xdf, 0x2f, 0x3a, 0xc6, 0x97, 0x97, - 0x9d, 0xb9, 0x6f, 0x2f, 0x3b, 0x73, 0xff, 0xba, 0xec, 0xcc, 0xfd, 0xfe, 0xc3, 0x01, 0x95, 0xc3, - 0xb8, 0xef, 0x60, 0x36, 0xea, 0x66, 0xff, 0x45, 0x94, 0x2e, 0xbf, 0x57, 0xfc, 0x51, 0x93, 0xfc, - 0xb2, 0xfb, 0xc5, 0xe4, 0xdf, 0x40, 0x72, 0x1c, 0x11, 0xd1, 0x5f, 0xd0, 0xc3, 0xe9, 0xfd, 0xff, - 0x06, 0x00, 0x00, 0xff, 0xff, 0xf2, 0xc1, 0xce, 0xa4, 0x37, 0x12, 0x00, 0x00, + // 1755 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x58, 0x4f, 0x6f, 0x1b, 0xc7, + 0x15, 0xd7, 0x92, 0x94, 0x2c, 0x3e, 0x4a, 0x94, 0xb4, 0x52, 0xe2, 0x95, 0xab, 0x52, 0xf2, 0xa6, + 0x49, 0x55, 0xa4, 0x59, 0x56, 0x4a, 0x0b, 0x04, 0x46, 0x83, 0x40, 0xa2, 0x9c, 0x58, 0x56, 0x12, + 0x2b, 0x2b, 0x55, 0x46, 0xdb, 0xc3, 0x62, 0x38, 0x3b, 0x26, 0x07, 0x5a, 0xee, 0xac, 0x67, 0x66, + 0xd7, 0xe1, 0xa5, 0xe7, 0x1e, 0xd3, 0x5b, 0xd0, 0x4b, 0xd3, 0x02, 0x3d, 0xf7, 0x6b, 0xe4, 0x98, + 0x63, 0x4f, 0x49, 0x61, 0x1f, 0xfb, 0x25, 0x8a, 0x99, 0xfd, 0x4b, 0x4a, 0x72, 0x69, 0xb8, 0xbd, + 0xcd, 0xbe, 0x79, 0xef, 0xf7, 0xfe, 0xbf, 0x37, 0x24, 0xec, 0xd3, 0x50, 0x12, 0x8e, 0x87, 0x88, + 0x86, 0x9e, 0x20, 0x38, 0xe6, 0x54, 0x8e, 0xbb, 0x18, 0x27, 0xdd, 0x88, 0xb3, 0x84, 0xfa, 0x84, + 0x77, 0x93, 0xbd, 0xe2, 0xec, 0x44, 0x9c, 0x49, 0x66, 0xbe, 0x75, 0x8d, 0x8c, 0x83, 0x71, 0xe2, + 0x14, 0x7c, 0xc9, 0xde, 0x9d, 0xb7, 0x6f, 0x02, 0x4e, 0xf6, 0xba, 0xcf, 0x28, 0x27, 0x29, 0xd6, + 0x9d, 0x8d, 0x01, 0x1b, 0x30, 0x7d, 0xec, 0xaa, 0x53, 0x46, 0xdd, 0x1e, 0x30, 0x36, 0x08, 0x48, + 0x57, 0x7f, 0xf5, 0xe3, 0x27, 0x5d, 0x49, 0x47, 0x44, 0x48, 0x34, 0x8a, 0x32, 0x86, 0xce, 0x34, + 0x83, 0x1f, 0x73, 0x24, 0x29, 0x0b, 0x73, 0x00, 0xda, 0xc7, 0x5d, 0xcc, 0x38, 0xe9, 0xe2, 0x80, + 0x92, 0x50, 0x2a, 0xad, 0xe9, 0x29, 0x63, 0xe8, 0x2a, 0x86, 0x80, 0x0e, 0x86, 0x32, 0x25, 0x8b, + 0xae, 0x24, 0xa1, 0x4f, 0xf8, 0x88, 0xa6, 0xcc, 0xe5, 0x57, 0x26, 0xb0, 0x55, 0xb9, 0xc7, 0x7c, + 0x1c, 0x49, 0xd6, 0xbd, 0x24, 0x63, 0x91, 0xdd, 0xbe, 0x83, 0x99, 0x18, 0x31, 0xd1, 0x25, 0xca, + 0xff, 0x10, 0x93, 0x6e, 0xb2, 0xd7, 0x27, 0x12, 0xed, 0x15, 0x84, 0xdc, 0xee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 0xfd, + 0x72, 0xf2, 0x7f, 0x22, 0x39, 0x8e, 0x88, 0xe8, 0x2f, 0xe8, 0xe9, 0xf5, 0xfe, 0x7f, 0x02, 0x00, + 0x00, 0xff, 0xff, 0x0a, 0xef, 0x81, 0x2b, 0x58, 0x12, 0x00, 0x00, } func (m *ConsumerAdditionProposal) Marshal() (dAtA []byte, err error) { @@ -2669,7 +2669,7 @@ func (m *ConsumerAddrsToPrune) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *EpochValidator) Marshal() (dAtA []byte, err error) { +func (m *ConsumerValidator) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -2679,20 +2679,25 @@ func (m *EpochValidator) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *EpochValidator) MarshalTo(dAtA []byte) (int, error) { +func (m *ConsumerValidator) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *EpochValidator) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *ConsumerValidator) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if len(m.ConsumerPublicKey) > 0 { - i -= len(m.ConsumerPublicKey) - copy(dAtA[i:], m.ConsumerPublicKey) - i = encodeVarintProvider(dAtA, i, uint64(len(m.ConsumerPublicKey))) + if m.ConsumerPublicKey != nil { + { + size, err := m.ConsumerPublicKey.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintProvider(dAtA, i, uint64(size)) + } i-- dAtA[i] = 0x1a } @@ -3182,7 +3187,7 @@ func (m *ConsumerAddrsToPrune) Size() (n int) { return n } -func (m *EpochValidator) Size() (n int) { +func (m *ConsumerValidator) Size() (n int) { if m == nil { return 0 } @@ -3195,8 +3200,8 @@ func (m *EpochValidator) Size() (n int) { if m.Power != 0 { n += 1 + sovProvider(uint64(m.Power)) } - l = len(m.ConsumerPublicKey) - if l > 0 { + if m.ConsumerPublicKey != nil { + l = m.ConsumerPublicKey.Size() n += 1 + l + sovProvider(uint64(l)) } return n @@ -4670,7 +4675,7 @@ func (m *Params) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.BlocksPerEpoch |= uint32(b&0x7F) << shift + m.BlocksPerEpoch |= int64(b&0x7F) << shift if b < 0x80 { break } @@ -6495,7 +6500,7 @@ func (m *ConsumerAddrsToPrune) Unmarshal(dAtA []byte) error { } return nil } -func (m *EpochValidator) Unmarshal(dAtA []byte) error { +func (m *ConsumerValidator) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -6518,10 +6523,10 @@ func (m *EpochValidator) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: EpochValidator: wiretype end group for non-group") + return fmt.Errorf("proto: ConsumerValidator: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: EpochValidator: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: ConsumerValidator: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -6581,7 +6586,7 @@ func (m *EpochValidator) Unmarshal(dAtA []byte) error { if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field ConsumerPublicKey", wireType) } - var byteLen int + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowProvider @@ -6591,24 +6596,26 @@ func (m *EpochValidator) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= int(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - if byteLen < 0 { + if msglen < 0 { return ErrInvalidLengthProvider } - postIndex := iNdEx + byteLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthProvider } if postIndex > l { return io.ErrUnexpectedEOF } - m.ConsumerPublicKey = append(m.ConsumerPublicKey[:0], dAtA[iNdEx:postIndex]...) if m.ConsumerPublicKey == nil { - m.ConsumerPublicKey = []byte{} + m.ConsumerPublicKey = &crypto.PublicKey{} + } + if err := m.ConsumerPublicKey.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err } iNdEx = postIndex default: From 16958bcbbf170511d5eb982090e44736005e7489 Mon Sep 17 00:00:00 2001 From: insumity Date: Wed, 28 Feb 2024 17:50:57 +0100 Subject: [PATCH 29/46] tiny fixes --- tests/mbt/driver/setup.go | 2 +- x/ccv/provider/keeper/proposal.go | 2 +- x/ccv/provider/keeper/validator_set_update.go | 2 +- x/ccv/provider/keeper/validator_set_update_test.go | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/mbt/driver/setup.go b/tests/mbt/driver/setup.go index 141885f661..69b385cb77 100644 --- a/tests/mbt/driver/setup.go +++ b/tests/mbt/driver/setup.go @@ -358,7 +358,7 @@ func (s *Driver) ConfigureNewPath(consumerChain, providerChain *ibctesting.TestC var stakingValidators []stakingtypes.Validator - // set up the current epoch validators by utilizing the initial validator set + // set up the current consumer validators by utilizing the initial validator set for _, val := range consumerGenesisForProvider.Provider.InitialValSet { pubKey := val.PubKey consAddr, err := ccvtypes.TMCryptoPublicKeyToConsAddr(pubKey) diff --git a/x/ccv/provider/keeper/proposal.go b/x/ccv/provider/keeper/proposal.go index a9195f65bd..b0e2845502 100644 --- a/x/ccv/provider/keeper/proposal.go +++ b/x/ccv/provider/keeper/proposal.go @@ -277,7 +277,7 @@ func (k Keeper) MakeConsumerGenesis( Power: p.Power, }) - // gather all the bonded validators in order to construct the current epoch validators for consumer chain `chainID` + // gather all the bonded validators in order to construct the consumer validator set for consumer chain `chainID` bondedValidators = append(bondedValidators, val) } diff --git a/x/ccv/provider/keeper/validator_set_update.go b/x/ccv/provider/keeper/validator_set_update.go index a8f6ab08c3..7e85e6dc18 100644 --- a/x/ccv/provider/keeper/validator_set_update.go +++ b/x/ccv/provider/keeper/validator_set_update.go @@ -17,7 +17,7 @@ func (k Keeper) SetConsumerValidator( store := ctx.KVStore(k.storeKey) bz, err := validator.Marshal() if err != nil { - panic(fmt.Errorf("failed to marshal EpochValidator: %w", err)) + panic(fmt.Errorf("failed to marshal ConsumerValidator: %w", err)) } store.Set(types.ConsumerValidatorKey(chainID, validator.ProviderConsAddr), bz) diff --git a/x/ccv/provider/keeper/validator_set_update_test.go b/x/ccv/provider/keeper/validator_set_update_test.go index d129847176..49f9481fd8 100644 --- a/x/ccv/provider/keeper/validator_set_update_test.go +++ b/x/ccv/provider/keeper/validator_set_update_test.go @@ -105,7 +105,7 @@ func createConsumerValidator(index int, power int64, seed int) (types.ConsumerVa }, publicKey } -func TestComputeNextEpochValidators(t *testing.T) { +func TestComputeNextEpochConsumerValSet(t *testing.T) { providerKeeper, ctx, ctrl, mocks := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) defer ctrl.Finish() @@ -265,7 +265,7 @@ func TestDiffEdgeCases(t *testing.T) { require.Equal(t, expectedUpdates, actualUpdates) } -func TestResetCurrentEpochValidators(t *testing.T) { +func TestSetConsumerValSet(t *testing.T) { providerKeeper, ctx, ctrl, _ := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) defer ctrl.Finish() From 513a75d6085ee14350d651b238ddf0fba7a96475 Mon Sep 17 00:00:00 2001 From: insumity Date: Thu, 29 Feb 2024 13:17:06 +0100 Subject: [PATCH 30/46] Update x/ccv/provider/keeper/params.go Co-authored-by: Simon Noetzlin --- x/ccv/provider/keeper/params.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x/ccv/provider/keeper/params.go b/x/ccv/provider/keeper/params.go index ece8a727b6..f74baf656e 100644 --- a/x/ccv/provider/keeper/params.go +++ b/x/ccv/provider/keeper/params.go @@ -78,7 +78,7 @@ func (k Keeper) GetConsumerRewardDenomRegistrationFee(ctx sdk.Context) sdk.Coin return c } -// GetBlocksPerEpoch return the number of blocks that constitute an epoch +// GetBlocksPerEpoch returns the number of blocks that constitute an epoch func (k Keeper) GetBlocksPerEpoch(ctx sdk.Context) int64 { var b int64 k.paramSpace.Get(ctx, types.KeyBlocksPerEpoch, &b) From 2208cd427217a866bf0bc1252a39e41299c89210 Mon Sep 17 00:00:00 2001 From: insumity Date: Thu, 29 Feb 2024 13:36:42 +0100 Subject: [PATCH 31/46] use Bech32 addresses as keys for maps --- x/ccv/provider/keeper/validator_set_update.go | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/x/ccv/provider/keeper/validator_set_update.go b/x/ccv/provider/keeper/validator_set_update.go index 7e85e6dc18..c1036b436c 100644 --- a/x/ccv/provider/keeper/validator_set_update.go +++ b/x/ccv/provider/keeper/validator_set_update.go @@ -65,7 +65,7 @@ func (k Keeper) IsConsumerValidator( // GetConsumerValSet returns all the consumer validators for chain `chainID` func (k Keeper) GetConsumerValSet( ctx sdk.Context, - chainID string) (optedInValidators []types.ConsumerValidator) { + chainID string) (validators []types.ConsumerValidator) { store := ctx.KVStore(k.storeKey) key := types.ChainIdWithLenKey(types.ConsumerValidatorBytePrefix, chainID) iterator := sdk.KVStorePrefixIterator(store, key) @@ -73,14 +73,14 @@ func (k Keeper) GetConsumerValSet( for ; iterator.Valid(); iterator.Next() { iterator.Value() - var optedInValidator types.ConsumerValidator - if err := optedInValidator.Unmarshal(iterator.Value()); err != nil { + var validator types.ConsumerValidator + if err := validator.Unmarshal(iterator.Value()); err != nil { panic(fmt.Errorf("failed to unmarshal ConsumerValidator: %w", err)) } - optedInValidators = append(optedInValidators, optedInValidator) + validators = append(validators, validator) } - return optedInValidators + return validators } // ComputeNextEpochConsumerValSet returns the next validator set that is responsible for validating consumer @@ -137,16 +137,18 @@ func DiffValidators( isCurrentValidator := make(map[string]types.ConsumerValidator) for _, val := range currentValidators { - isCurrentValidator[string(val.ProviderConsAddr)] = val + // use Bech32 addresses as keys for the map + isCurrentValidator[sdk.ConsAddress(val.ProviderConsAddr).String()] = val } isNextValidator := make(map[string]types.ConsumerValidator) for _, val := range nextValidators { - isNextValidator[string(val.ProviderConsAddr)] = val + // use Bech32 addresses as keys for the map + isNextValidator[sdk.ConsAddress(val.ProviderConsAddr).String()] = val } for _, val := range currentValidators { - if nextVal, found := isNextValidator[string(val.ProviderConsAddr)]; found { + if nextVal, found := isNextValidator[sdk.ConsAddress(val.ProviderConsAddr).String()]; found { // validator remains in the next epoch if !val.ConsumerPublicKey.Equal(nextVal.ConsumerPublicKey) { // validator has a new consumer public key, so we introduce `nextVal` consumer key with the latest power, @@ -166,7 +168,7 @@ func DiffValidators( } for _, val := range nextValidators { - if _, found := isCurrentValidator[string(val.ProviderConsAddr)]; !found { + if _, found := isCurrentValidator[sdk.ConsAddress(val.ProviderConsAddr).String()]; !found { // validator is about to join an epoch updates = append(updates, abci.ValidatorUpdate{PubKey: *val.ConsumerPublicKey, Power: val.Power}) } From 914840cbb380d162ca53d06518e4871520549c80 Mon Sep 17 00:00:00 2001 From: insumity Date: Fri, 1 Mar 2024 16:14:52 +0100 Subject: [PATCH 32/46] refactor nextBlocks(epoch) to nextEpoch --- tests/integration/common.go | 12 +++++++----- tests/integration/distribution.go | 6 +++--- tests/integration/expired_client.go | 16 +++++++--------- tests/integration/key_assignment.go | 19 +++++++++---------- tests/integration/slashing.go | 2 +- tests/integration/soft_opt_out.go | 8 +++----- tests/integration/unbonding.go | 10 ++++------ tests/integration/valset_update.go | 2 +- 8 files changed, 35 insertions(+), 40 deletions(-) diff --git a/tests/integration/common.go b/tests/integration/common.go index d9102a44d5..18b657ae56 100644 --- a/tests/integration/common.go +++ b/tests/integration/common.go @@ -127,7 +127,7 @@ func delegateAndRedelegate(s *CCVTestSuite, delAddr sdk.AccAddress, srcValTokensAfter := s.getVal(s.providerCtx(), srcValAddr).GetBondedTokens() s.Require().Equal(srcValTokensAfter.Sub(srcValTokensBefore), amount) - nextBlocks(s.providerChain, s.providerApp.GetProviderKeeper().GetParams(s.providerCtx()).BlocksPerEpoch) + s.nextEpoch() dstValTokensBefore := s.getVal(s.providerCtx(), dstValAddr).GetBondedTokens() @@ -626,9 +626,11 @@ func (s *CCVTestSuite) mustGetStakingValFromTmVal(tmVal tmtypes.Validator) (stak return stakingVal } -// nextBlocks moves `chain` forward by a `numberOfBlocks` blocks -func nextBlocks(chain *ibctesting.TestChain, numberOfBlocks int64) { - for i := int64(0); i < numberOfBlocks; i++ { - chain.NextBlock() +// nextEpoch moves `chain` forward by an epoch +func (s *CCVTestSuite) nextEpoch() { + blocksPerEpoch := s.providerApp.GetProviderKeeper().GetParams(s.providerCtx()).BlocksPerEpoch + + for i := int64(0); i < blocksPerEpoch; i++ { + s.providerChain.NextBlock() } } diff --git a/tests/integration/distribution.go b/tests/integration/distribution.go index 87e1f3b3b3..1ea5bfcd00 100644 --- a/tests/integration/distribution.go +++ b/tests/integration/distribution.go @@ -23,7 +23,7 @@ func (s *CCVTestSuite) TestRewardsDistribution() { bondAmt := sdk.NewInt(10000000) delAddr := s.providerChain.SenderAccount.GetAddress() delegate(s, delAddr, bondAmt) - nextBlocks(s.providerChain, s.providerApp.GetProviderKeeper().GetParams(s.providerCtx()).BlocksPerEpoch) + s.nextEpoch() // register a consumer reward denom params := s.consumerApp.GetConsumerKeeper().GetConsumerParams(s.consumerCtx()) @@ -124,7 +124,7 @@ func (s *CCVTestSuite) TestSendRewardsRetries() { bondAmt := sdk.NewInt(10000000) delAddr := s.providerChain.SenderAccount.GetAddress() delegate(s, delAddr, bondAmt) - nextBlocks(s.providerChain, s.providerApp.GetProviderKeeper().GetParams(s.providerCtx()).BlocksPerEpoch) + s.nextEpoch() // Register denom on consumer chain params := s.consumerApp.GetConsumerKeeper().GetConsumerParams(s.consumerCtx()) @@ -253,7 +253,7 @@ func (s *CCVTestSuite) TestEndBlockRD() { bondAmt := sdk.NewInt(10000000) delAddr := s.providerChain.SenderAccount.GetAddress() delegate(s, delAddr, bondAmt) - nextBlocks(s.providerChain, s.providerApp.GetProviderKeeper().GetParams(s.providerCtx()).BlocksPerEpoch) + s.nextEpoch() if tc.denomRegistered { params := s.consumerApp.GetConsumerKeeper().GetConsumerParams(s.consumerCtx()) diff --git a/tests/integration/expired_client.go b/tests/integration/expired_client.go index 1b66344d7a..cfba19803e 100644 --- a/tests/integration/expired_client.go +++ b/tests/integration/expired_client.go @@ -33,8 +33,7 @@ func (s *CCVTestSuite) TestVSCPacketSendExpiredClient() { delegate(s, delAddr, bondAmt) // try to send CCV packet to consumer - blocksPerEpoch := s.providerApp.GetProviderKeeper().GetParams(s.providerCtx()).BlocksPerEpoch - nextBlocks(s.providerChain, blocksPerEpoch) + s.nextEpoch() // check that the packet was added to the list of pending VSC packets packets := providerKeeper.GetPendingVSCPackets(s.providerCtx(), s.consumerChain.ChainID) @@ -42,7 +41,7 @@ func (s *CCVTestSuite) TestVSCPacketSendExpiredClient() { s.Require().Equal(1, len(packets), "unexpected number of pending VSC packets") // try again to send CCV packet to consumer - nextBlocks(s.providerChain, blocksPerEpoch) + s.nextEpoch() // check that the packet is still in the list of pending VSC packets packets = providerKeeper.GetPendingVSCPackets(s.providerCtx(), s.consumerChain.ChainID) @@ -53,7 +52,7 @@ func (s *CCVTestSuite) TestVSCPacketSendExpiredClient() { delegate(s, delAddr, bondAmt) // try again to send CCV packets to consumer - nextBlocks(s.providerChain, blocksPerEpoch) + s.nextEpoch() // check that the packets are still in the list of pending VSC packets packets = providerKeeper.GetPendingVSCPackets(s.providerCtx(), s.consumerChain.ChainID) @@ -64,7 +63,7 @@ func (s *CCVTestSuite) TestVSCPacketSendExpiredClient() { upgradeExpiredClient(s, Consumer) // go to next epoch - nextBlocks(s.providerChain, blocksPerEpoch) + s.nextEpoch() // check that the packets are not in the list of pending VSC packets packets = providerKeeper.GetPendingVSCPackets(s.providerCtx(), s.consumerChain.ChainID) @@ -74,7 +73,7 @@ func (s *CCVTestSuite) TestVSCPacketSendExpiredClient() { // - bond more tokens on provider to change validator powers delegate(s, delAddr, bondAmt) // - send CCV packet to consumer - nextBlocks(s.providerChain, blocksPerEpoch) + s.nextEpoch() // - relay all VSC packet from provider to consumer relayAllCommittedPackets(s, s.providerChain, s.path, ccv.ProviderPortID, s.path.EndpointB.ChannelID, 3) // - increment time so that the unbonding period ends on the consumer @@ -103,8 +102,7 @@ func (s *CCVTestSuite) TestConsumerPacketSendExpiredClient() { delegate(s, delAddr, bondAmt) // send CCV packets to consumer - blocksPerEpoch := s.providerApp.GetProviderKeeper().GetParams(s.providerCtx()).BlocksPerEpoch - nextBlocks(s.providerChain, blocksPerEpoch) + s.nextEpoch() // check that the packets are not in the list of pending VSC packets providerPackets := providerKeeper.GetPendingVSCPackets(s.providerCtx(), s.consumerChain.ChainID) @@ -174,7 +172,7 @@ func (s *CCVTestSuite) TestConsumerPacketSendExpiredClient() { // - bond more tokens on provider to change validator powers delegate(s, delAddr, bondAmt) // - send CCV packet to consumer - nextBlocks(s.providerChain, blocksPerEpoch) + s.nextEpoch() // - relay 1 VSC packet from provider to consumer relayAllCommittedPackets(s, s.providerChain, s.path, ccv.ProviderPortID, s.path.EndpointB.ChannelID, 1) // - increment time so that the unbonding period ends on the provider diff --git a/tests/integration/key_assignment.go b/tests/integration/key_assignment.go index d60e8f139e..ab6cb63146 100644 --- a/tests/integration/key_assignment.go +++ b/tests/integration/key_assignment.go @@ -14,7 +14,6 @@ import ( ) func (s *CCVTestSuite) TestKeyAssignment() { - blocksPerEpoch := s.providerApp.GetProviderKeeper().GetParams(s.providerCtx()).BlocksPerEpoch testCases := []struct { name string assignFunc func(*providerkeeper.Keeper) error @@ -31,7 +30,7 @@ func (s *CCVTestSuite) TestKeyAssignment() { } // check that a VSCPacket is queued - nextBlocks(s.providerChain, blocksPerEpoch) + s.nextEpoch() pendingPackets := pk.GetPendingVSCPackets(s.providerCtx(), s.consumerChain.ChainID) s.Require().Len(pendingPackets, 1) @@ -52,7 +51,7 @@ func (s *CCVTestSuite) TestKeyAssignment() { if err != nil { return err } - nextBlocks(s.providerChain, blocksPerEpoch) + s.nextEpoch() return nil }, false, 2, @@ -74,7 +73,7 @@ func (s *CCVTestSuite) TestKeyAssignment() { delAddr := s.providerChain.SenderAccount.GetAddress() delegate(s, delAddr, bondAmt) - nextBlocks(s.providerChain, blocksPerEpoch) + s.nextEpoch() return nil }, false, 2, @@ -96,7 +95,7 @@ func (s *CCVTestSuite) TestKeyAssignment() { if err != nil { return err } - nextBlocks(s.providerChain, blocksPerEpoch) + s.nextEpoch() return nil }, true, 2, @@ -119,7 +118,7 @@ func (s *CCVTestSuite) TestKeyAssignment() { if err != nil { return err } - nextBlocks(s.providerChain, blocksPerEpoch) + s.nextEpoch() return nil }, false, 2, @@ -135,14 +134,14 @@ func (s *CCVTestSuite) TestKeyAssignment() { if err != nil { return err } - nextBlocks(s.providerChain, blocksPerEpoch) + s.nextEpoch() // same key assignment err = pk.AssignConsumerKey(s.providerCtx(), s.consumerChain.ChainID, validator, consumerKey) if err != nil { return err } - nextBlocks(s.providerChain, blocksPerEpoch) + s.nextEpoch() return nil }, true, 2, @@ -158,7 +157,7 @@ func (s *CCVTestSuite) TestKeyAssignment() { if err != nil { return err } - nextBlocks(s.providerChain, blocksPerEpoch) + s.nextEpoch() // same key assignment validator, consumerKey = generateNewConsumerKey(s, 0) @@ -166,7 +165,7 @@ func (s *CCVTestSuite) TestKeyAssignment() { if err != nil { return err } - nextBlocks(s.providerChain, blocksPerEpoch) + s.nextEpoch() return nil }, false, 3, diff --git a/tests/integration/slashing.go b/tests/integration/slashing.go index 1c41e09d72..e7f585f756 100644 --- a/tests/integration/slashing.go +++ b/tests/integration/slashing.go @@ -107,7 +107,7 @@ func (s *CCVTestSuite) TestRelayAndApplyDowntimePacket() { s.Require().True(found) } - nextBlocks(s.providerChain, s.providerApp.GetProviderKeeper().GetParams(s.providerCtx()).BlocksPerEpoch) + s.nextEpoch() // Confirm the valset update Id was incremented twice on provider, // since an epoch has passed. diff --git a/tests/integration/soft_opt_out.go b/tests/integration/soft_opt_out.go index e8c23e321e..a9508118bd 100644 --- a/tests/integration/soft_opt_out.go +++ b/tests/integration/soft_opt_out.go @@ -20,8 +20,6 @@ import ( func (suite *CCVTestSuite) TestSoftOptOut() { var votes []abci.VoteInfo - blocksPerEpoch := suite.providerApp.GetProviderKeeper().GetParams(suite.providerCtx()).BlocksPerEpoch - testCases := []struct { name string downtimeFunc func(*consumerKeeper.Keeper, *slashingkeeper.Keeper, []byte, int) @@ -75,7 +73,7 @@ func (suite *CCVTestSuite) TestSoftOptOut() { bondAmt := sdk.NewInt(100).Mul(sdk.DefaultPowerReduction) delegateByIdx(suite, delAddr, bondAmt, valIdx) - nextBlocks(suite.providerChain, blocksPerEpoch) + suite.nextEpoch() // Relay 1 VSC packet from provider to consumer relayAllCommittedPackets(suite, suite.providerChain, suite.path, ccv.ProviderPortID, suite.path.EndpointB.ChannelID, 1) @@ -114,7 +112,7 @@ func (suite *CCVTestSuite) TestSoftOptOut() { bondAmt := sdk.NewInt(100).Mul(sdk.DefaultPowerReduction) delegateByIdx(suite, delAddr, bondAmt, valIdx) - nextBlocks(suite.providerChain, blocksPerEpoch) + suite.nextEpoch() // Relay 1 VSC packet from provider to consumer relayAllCommittedPackets(suite, suite.providerChain, suite.path, ccv.ProviderPortID, suite.path.EndpointB.ChannelID, 1) @@ -151,7 +149,7 @@ func (suite *CCVTestSuite) TestSoftOptOut() { validatorPowers := []int64{1000, 500, 50, 10} suite.setupValidatorPowers(validatorPowers) - nextBlocks(suite.providerChain, blocksPerEpoch) + suite.nextEpoch() // Relay 1 VSC packet from provider to consumer relayAllCommittedPackets(suite, suite.providerChain, suite.path, ccv.ProviderPortID, suite.path.EndpointB.ChannelID, 1) diff --git a/tests/integration/unbonding.go b/tests/integration/unbonding.go index fe05a7f993..7f87516444 100644 --- a/tests/integration/unbonding.go +++ b/tests/integration/unbonding.go @@ -231,8 +231,7 @@ func (s *CCVTestSuite) TestUndelegationDuringInit() { // update init timeout timestamp tc.updateInitTimeoutTimestamp(&providerKeeper, providerUnbondingPeriod) - blocksPerEpoch := s.providerApp.GetProviderKeeper().GetParams(s.providerCtx()).BlocksPerEpoch - nextBlocks(s.providerChain, blocksPerEpoch) + s.nextEpoch() // check that the VSC packet is stored in state as pending pendingVSCs := providerKeeper.GetPendingVSCPackets(s.providerCtx(), s.consumerChain.ChainID) @@ -241,8 +240,7 @@ func (s *CCVTestSuite) TestUndelegationDuringInit() { // delegate again to create another VSC packet delegate(s, delAddr, bondAmt) - // call NextBlocks on the provider (which increments the height) - nextBlocks(s.providerChain, blocksPerEpoch) + s.nextEpoch() // check that the VSC packet is stored in state as pending pendingVSCs = providerKeeper.GetPendingVSCPackets(s.providerCtx(), s.consumerChain.ChainID) @@ -266,7 +264,7 @@ func (s *CCVTestSuite) TestUndelegationDuringInit() { // complete CCV channel setup s.SetupCCVChannel(s.path) - nextBlocks(s.providerChain, blocksPerEpoch) + s.nextEpoch() // relay VSC packets from provider to consumer relayAllCommittedPackets(s, s.providerChain, s.path, ccv.ProviderPortID, s.path.EndpointB.ChannelID, 2) @@ -431,7 +429,7 @@ func (s *CCVTestSuite) TestRedelegationProviderFirst() { checkCCVUnbondingOp(s, s.providerCtx(), s.consumerChain.ChainID, valsetUpdateID, true) // move forward by an epoch to be able to relay VSC packets - nextBlocks(s.providerChain, s.providerApp.GetProviderKeeper().GetParams(s.providerCtx()).BlocksPerEpoch) + s.nextEpoch() // Relay 2 VSC packets from provider to consumer (original delegation, and redelegation) relayAllCommittedPackets(s, s.providerChain, s.path, diff --git a/tests/integration/valset_update.go b/tests/integration/valset_update.go index 61a913ccc3..eb0560a35e 100644 --- a/tests/integration/valset_update.go +++ b/tests/integration/valset_update.go @@ -24,7 +24,7 @@ func (s *CCVTestSuite) TestPacketRoundtrip() { delegate(s, delAddr, bondAmt) // Send CCV packet to consumer at the end of the epoch - nextBlocks(s.providerChain, s.providerApp.GetProviderKeeper().GetParams(s.providerCtx()).BlocksPerEpoch) + s.nextEpoch() // Relay 1 VSC packet from provider to consumer relayAllCommittedPackets(s, s.providerChain, s.path, ccv.ProviderPortID, s.path.EndpointB.ChannelID, 1) From 3164a0934f0b3c23314a373f8ee2ecf7228d26c2 Mon Sep 17 00:00:00 2001 From: Philip Offtermatt Date: Fri, 1 Mar 2024 10:04:18 +0100 Subject: [PATCH 33/46] Start adding epochs --- tests/mbt/model/ccv.qnt | 21 ++++++++++++--- tests/mbt/model/ccv_model.qnt | 33 ++++++++++++++++++----- tests/mbt/model/ccv_utils.qnt | 9 ++++++- tests/mbt/model/libraries/extraSpells.qnt | 20 ++++++++++++++ 4 files changed, 72 insertions(+), 11 deletions(-) diff --git a/tests/mbt/model/ccv.qnt b/tests/mbt/model/ccv.qnt index 0e42436c50..11997e87b5 100644 --- a/tests/mbt/model/ccv.qnt +++ b/tests/mbt/model/ccv.qnt @@ -58,6 +58,8 @@ module ccv_types { // the running timestamp of the current block (that will be put on chain when the block is ended) runningTimestamp: Time, + + currentBlockHeight: int, } // utility function: returns a chain state that is initialized minimally. @@ -67,6 +69,7 @@ module ccv_types { currentValidatorSet: Map(), lastTimestamp: -1, // last timestamp -1 means that in the model, there was no block committed on chain yet. runningTimestamp: 0, + currentBlockHeight: 0 } // Defines the current state of the provider chain. Essentially, all information here is stored by the provider on-chain (or could be derived purely by information that is on-chain). @@ -271,6 +274,10 @@ module ccv { // they expire and the channel will be closed. const TrustingPeriodPerChain: Chain -> int + // The number of blocks in an epoch. + // VscPackets are only sent to consumer chains at the end of every epoch. + const BlocksPerEpoch: int + // =================== // PROTOCOL LOGIC contains the meat of the protocol // functions here roughly correspond to API calls that can be triggered from external sources @@ -455,10 +462,16 @@ module ccv { // send vsc packets (will be a noop if no sends are necessary) val providerStateAfterSending = - providerStateAfterTimeAdvancement.sendVscPackets( - currentProviderState.chainState.runningTimestamp, - CcvTimeout.get(PROVIDER_CHAIN) - ) + // if currentBlockHeight is a multiple of BlocksPerEpoch, send VscPackets + if (providerStateAfterTimeAdvancement.chainState.currentBlockHeight % BlocksPerEpoch == 0) { + providerStateAfterTimeAdvancement.sendVscPackets( + currentProviderState.chainState.runningTimestamp, + CcvTimeout.get(PROVIDER_CHAIN) + ) + } else { + // otherwise, just do a noop + providerStateAfterTimeAdvancement + } // start/stop chains diff --git a/tests/mbt/model/ccv_model.qnt b/tests/mbt/model/ccv_model.qnt index f997198b6e..cfe3196b2f 100644 --- a/tests/mbt/model/ccv_model.qnt +++ b/tests/mbt/model/ccv_model.qnt @@ -13,6 +13,7 @@ module ccv_model { pure val unbondingPeriods = chains.mapBy(chain => defUnbondingPeriod) pure val trustingPeriods = chains.mapBy(chain => defUnbondingPeriod - 1 * Hour) pure val ccvTimeouts = chains.mapBy(chain => 3 * Week) + pure val epochLength = 3 pure val nodes = Set("node1", "node2", "node3", "node4", "node5", "node6", "node7", "node8", "node9", "node10") // possible consumer addresses that nodes can assign their key to @@ -24,7 +25,8 @@ module ccv_model { CcvTimeout = ccvTimeouts, UnbondingPeriodPerChain = unbondingPeriods, ConsumerChains = consumerChains, - TrustingPeriodPerChain = trustingPeriods + TrustingPeriodPerChain = trustingPeriods, + BlocksPerEpoch = epochLength ).* from "./ccv" type Parameters = { @@ -36,6 +38,7 @@ module ccv_model { Nodes: Set[Node], ConsumerAddresses: Set[ConsumerAddr], InitialValidatorSet: Node -> int, + BlocksPerEpoch: int, } // The params variable is never actually changed, and @@ -129,6 +132,7 @@ module ccv_model { InitialValidatorSet: InitialValidatorSet, TrustingPeriodPerChain: TrustingPeriodPerChain, ConsumerAddresses: consumerAddresses, + BlocksPerEpoch: epochLength, } } @@ -235,6 +239,23 @@ module ccv_model { stepCommon } + // Runs epochLength many blocks on the provider. + // The first block will start all consumers in consumersToStart and stop all consumers in consumersToStop, + // and advance time by timeAdvancement - ((epochLength-1) * Seconds). + // The rest of the blocks will not start or stop any consumers, and will advance time by 1 second each. + run EndProviderEpoch( + timeAdvancement: Time, + consumersToStart: Set[Chain], + consumersToStop: Set[Chain] + ): bool = + epochLength.reps( + i => + if (i == 0) + EndAndBeginBlockForProvider(timeAdvancement-((epochLength-1)*Second), consumersToStart, consumersToStop) + else + EndAndBeginBlockForProvider(1 * Second, Set(), Set()) + ) + // ================== // UTILITY FUNCTIONS // ================== @@ -505,7 +526,7 @@ module ccv_model { // the validator set has changed assert(currentState.providerState.chainState.currentValidatorSet == InitialValidatorSet.put("node1", 150)), // start consumer1 - EndAndBeginBlockForProvider(1 * Second, Set("consumer1"), Set()) + EndProviderEpoch(3 * Second, Set("consumer1"), Set()) }) .then( all { @@ -514,11 +535,11 @@ module ccv_model { // but no packet was sent to consumer 1 assert(currentState.providerState.outstandingPacketsToConsumer.getOrElse("consumer1", List()).length() == 0), // the validator set on the provider was entered into the history - assert(currentState.providerState.chainState.votingPowerHistory == List(InitialValidatorSet.put("node1", 150), InitialValidatorSet)), + assert(currentState.providerState.chainState.votingPowerHistory == List(InitialValidatorSet.put("node1", 150)).listMul(epochLength).append(InitialValidatorSet)), // change voting power on provider again VotingPowerChange("node1", 50).then( - // end another block - EndAndBeginBlockForProvider(1 * Second, Set(), Set()) + // end the epoch + EndProviderEpoch(3 * Second, Set(), Set()) ).then( // deliver packet to consumer1 DeliverVscPacket("consumer1") @@ -636,7 +657,7 @@ module ccv_model { ) .then( // send packets - EndAndBeginBlockForProvider(1 * Second, Set(), Set()) + EndProviderEpoch(epochLength * Second, Set(), Set()) ) .then( // advance time on provider by VscTimeout + 1 Second diff --git a/tests/mbt/model/ccv_utils.qnt b/tests/mbt/model/ccv_utils.qnt index 4d881828ef..8ae9ad77a1 100644 --- a/tests/mbt/model/ccv_utils.qnt +++ b/tests/mbt/model/ccv_utils.qnt @@ -183,9 +183,16 @@ module ccv_utils { runningTimestamp: chainState.runningTimestamp + timeAdvancement, } + pure def incrementBlockHeight(chainState: ChainState): ChainState = + { + chainState.with( + "currentBlockHeight", chainState.currentBlockHeight + 1 + ) + } + // common logic to update the chain state, used by both provider and consumers. pure def endAndBeginBlockShared(chainState: ChainState, timeAdvancement: Time): ChainState = { - chainState.enterCurValSetIntoBlock().advanceTime(timeAdvancement) + chainState.enterCurValSetIntoBlock().advanceTime(timeAdvancement).incrementBlockHeight() } // returns the providerState with the following modifications: diff --git a/tests/mbt/model/libraries/extraSpells.qnt b/tests/mbt/model/libraries/extraSpells.qnt index 9167bb4bcb..8886b2bb4a 100644 --- a/tests/mbt/model/libraries/extraSpells.qnt +++ b/tests/mbt/model/libraries/extraSpells.qnt @@ -207,4 +207,24 @@ module extraSpells { assert(not(listForAll(List(1, 2, 3), __x => __x > 1))), assert(listForAll(List(), __x => __x > 0)), } + + // listMul returns a new list which is the result of concatenating the given list with itself the given number of times. + // It computes the result using fold. + // + // Parameters: + // - __list: The list to concatenate with itself. + // - __n: The number of times to concatenate the list with itself. + // + // Returns: + // - A new list which is the result of concatenating the given list with itself the given number of times. + pure def listMul(__list: List[a], __n: int): List[a] = { + 1.to(__n).fold(List(), (__l, _) => __l.concat(__list)) + } + + run listMulTest = + all { + assert(listMul(List(1, 2, 3), 3) == List(1, 2, 3, 1, 2, 3, 1, 2, 3)), + assert(listMul(List(1, 2, 3), 0) == List()), + assert(listMul(List(), 3) == List()), + } } \ No newline at end of file From 4fe6b7543ef91c0b7efa6bc53a4b5b2ec7a8eaa7 Mon Sep 17 00:00:00 2001 From: Philip Offtermatt Date: Fri, 1 Mar 2024 14:15:15 +0100 Subject: [PATCH 34/46] Adjust tests for epochs --- tests/mbt/model/ccv.qnt | 22 ++++++++++------------ tests/mbt/model/ccv_model.qnt | 22 +++++++++++++--------- tests/mbt/model/ccv_test.qnt | 5 +++-- tests/mbt/model/ccv_utils.qnt | 9 +++++---- 4 files changed, 31 insertions(+), 27 deletions(-) diff --git a/tests/mbt/model/ccv.qnt b/tests/mbt/model/ccv.qnt index 11997e87b5..e823d48c22 100644 --- a/tests/mbt/model/ccv.qnt +++ b/tests/mbt/model/ccv.qnt @@ -89,11 +89,11 @@ module ccv_types { // Stores VscPackets which have been sent but where the provider has *not received a response yet*. sentVscPacketsToConsumer: Chain -> List[VscPacket], - // stores whether, in this block, the validator set has changed. + // stores whether, in this epoch, the validator set has changed. // this is needed because the validator set might be considered to have changed, even though // it is still technically identical at our level of abstraction, e.g. a validator power change on the provider // might leave the validator set the same because a delegation and undelegation cancel each other out. - providerValidatorSetChangedInThisBlock: bool, + providerValidatorSetChangedInThisEpoch: bool, // stores, for each consumer chain, its current status - // not consumer, running, or stopped @@ -113,7 +113,7 @@ module ccv_types { consumerAddrToValidator: Chain -> (ConsumerAddr -> Node), // For every consumer chain, stores whether the key assignment for the consumer chain has changed in this block. - consumersWithAddrAssignmentChangesInThisBlock: Set[Chain], + consumersWithAddrAssignmentChangesInThisEpoch: Set[Chain], // the history of validator sets on the provider, but with the key assignments applied. // This is needed to check invariants about the validator set when key assignments are in play. @@ -133,7 +133,7 @@ module ccv_types { outstandingPacketsToConsumer: Map(), receivedMaturations: Set(), sentVscPacketsToConsumer: Map(), - providerValidatorSetChangedInThisBlock: false, + providerValidatorSetChangedInThisEpoch: false, consumerStatus: Map(), runningVscId: 0, validatorToConsumerAddr: Map(), @@ -141,7 +141,7 @@ module ccv_types { consumerAddrToValidator: Map(), consumerAddrsToPrune: Map(), keyAssignmentsForVSCPackets: Map(), - consumersWithAddrAssignmentChangesInThisBlock: Set() + consumersWithAddrAssignmentChangesInThisEpoch: Set() } @@ -301,7 +301,7 @@ module ccv { } else { // set the validator set changed flag val newProviderState = currentState.providerState.with( - "providerValidatorSetChangedInThisBlock", true + "providerValidatorSetChangedInThisEpoch", true ) pure val tmpState = currentState.with( "providerState", newProviderState @@ -484,8 +484,6 @@ module ccv { val err = res._2 val providerStateAfterConsumerAdvancement = providerStateAfterSending.with( "consumerStatus", newConsumerStatus - ).with( - "providerValidatorSetChangedInThisBlock", false ) if (err != "") { @@ -622,17 +620,17 @@ module ccv { // check whether the validator has positive power pure val provValSet = currentState.providerState.chainState.currentValidatorSet pure val provValPower = if (provValSet.keys().contains(providerNode)) provValSet.get(providerNode) else 0 - pure val consumersWithAddrAssignmentChangesInThisBlock = + pure val consumersWithAddrAssignmentChangesInThisEpoch = if (provValPower > 0) { // if the consumer has positive power, the relevant key assignment for the consumer changed - currentState.providerState.consumersWithAddrAssignmentChangesInThisBlock.union(Set(consumer)) + currentState.providerState.consumersWithAddrAssignmentChangesInThisEpoch.union(Set(consumer)) } else { // otherwise, the consumer doesn't need to know about the change, so no change - currentState.providerState.consumersWithAddrAssignmentChangesInThisBlock + currentState.providerState.consumersWithAddrAssignmentChangesInThisEpoch } pure val tmpStateAfterKeyAssignmentReplacement = tmpState.with( "providerState", tmpState.providerState.with( - "consumersWithAddrAssignmentChangesInThisBlock", consumersWithAddrAssignmentChangesInThisBlock + "consumersWithAddrAssignmentChangesInThisEpoch", consumersWithAddrAssignmentChangesInThisEpoch ) ) diff --git a/tests/mbt/model/ccv_model.qnt b/tests/mbt/model/ccv_model.qnt index cfe3196b2f..4bca47eb1e 100644 --- a/tests/mbt/model/ccv_model.qnt +++ b/tests/mbt/model/ccv_model.qnt @@ -340,12 +340,15 @@ module ccv_model { ) ) + + val CurrentBlockEndsEpoch = currentState.providerState.chainState.currentBlockHeight % epochLength == 0 + // Any update in the power of a validator on the provider // MUST be present in a ValidatorSetChangePacket that is sent to all registered consumer chains val ValUpdatePrecondition = trace[trace.length()-1].kind == "EndAndBeginBlockForProvider" val ValidatorUpdatesArePropagatedInv = - // when the provider has just entered a validator set into a block... - ValUpdatePrecondition and currentState.providerState.providerValidatorSetChangedInThisBlock + // when the an epoch ends and the provider has just entered a validator set into a block... + ValUpdatePrecondition and currentState.providerState.providerValidatorSetChangedInThisEpoch and CurrentBlockEndsEpoch implies val providerValSetInCurBlock = providerValidatorHistory.head() // ... for each consumer that is running then ... @@ -526,7 +529,7 @@ module ccv_model { // the validator set has changed assert(currentState.providerState.chainState.currentValidatorSet == InitialValidatorSet.put("node1", 150)), // start consumer1 - EndProviderEpoch(3 * Second, Set("consumer1"), Set()) + EndAndBeginBlockForProvider(1 * Second, Set("consumer1"), Set()) }) .then( all { @@ -535,12 +538,13 @@ module ccv_model { // but no packet was sent to consumer 1 assert(currentState.providerState.outstandingPacketsToConsumer.getOrElse("consumer1", List()).length() == 0), // the validator set on the provider was entered into the history - assert(currentState.providerState.chainState.votingPowerHistory == List(InitialValidatorSet.put("node1", 150)).listMul(epochLength).append(InitialValidatorSet)), + assert(currentState.providerState.chainState.votingPowerHistory == List(InitialValidatorSet.put("node1", 150), InitialValidatorSet)), // change voting power on provider again VotingPowerChange("node1", 50).then( // end the epoch EndProviderEpoch(3 * Second, Set(), Set()) - ).then( + ) + .then( // deliver packet to consumer1 DeliverVscPacket("consumer1") ) @@ -609,7 +613,7 @@ module ccv_model { VotingPowerChange("node1", 50) ).then( // send packet to consumer1 and consumer2 - EndAndBeginBlockForProvider(1 * Second, Set(), Set()) + EndProviderEpoch(1 * Second, Set(), Set()) ).then( // deliver the packets DeliverVscPacket("consumer1") @@ -624,7 +628,7 @@ module ccv_model { VotingPowerChange("node2", 50) ).then( // send packets - EndAndBeginBlockForProvider(1 * Second, Set(), Set()) + EndProviderEpoch(1 * Second, Set(), Set()) ).then( //deliver to consumer1 DeliverVscPacket("consumer1") @@ -736,7 +740,7 @@ module ccv_model { // and the key assignment of each validator should be applied in that VSCPacket. val ValidatorUpdatesArePropagatedKeyAssignmentInv = // when the provider has just entered a validator set into a block... - ValUpdatePrecondition and currentState.providerState.providerValidatorSetChangedInThisBlock + ValUpdatePrecondition and currentState.providerState.providerValidatorSetChangedInThisEpoch implies val providerValSetInCurBlock = providerValidatorHistory.head() // ... for each consumer that is running then ... @@ -870,7 +874,7 @@ module ccv_model { ) .then( // end and begin block to make sure the key assignment is processed and the packet is sent - EndAndBeginBlockForProvider(1 * Second, Set(), Set()) + EndProviderEpoch(1 * Second, Set(), Set()) ) .then( // receive the packet on the consumer diff --git a/tests/mbt/model/ccv_test.qnt b/tests/mbt/model/ccv_test.qnt index 62ab03b5e0..809b91a8c0 100644 --- a/tests/mbt/model/ccv_test.qnt +++ b/tests/mbt/model/ccv_test.qnt @@ -12,8 +12,9 @@ module ccv_test { pure val unbondingPeriods = chains.mapBy(chain => 2 * Week) pure val ccvTimeouts = chains.mapBy(chain => 3 * Week) pure val trustingPeriods = chains.mapBy(chain => 2 * Week - 1 * Hour) + pure val epochLength = 3 - import ccv(VscTimeout = 5 * Week, CcvTimeout = ccvTimeouts, UnbondingPeriodPerChain = unbondingPeriods, ConsumerChains = consumerChains, TrustingPeriodPerChain=trustingPeriods).* from "./ccv" + import ccv(VscTimeout = 5 * Week, CcvTimeout = ccvTimeouts, UnbondingPeriodPerChain = unbondingPeriods, ConsumerChains = consumerChains, TrustingPeriodPerChain=trustingPeriods, BlocksPerEpoch=epochLength).* from "./ccv" val votingPowerTestInitState = GetEmptyProtocolState.with( @@ -78,7 +79,7 @@ module ccv_test { ) // still should set the flag not(finalResult.hasError()) and - finalResult.newState.providerState.providerValidatorSetChangedInThisBlock + finalResult.newState.providerState.providerValidatorSetChangedInThisEpoch } diff --git a/tests/mbt/model/ccv_utils.qnt b/tests/mbt/model/ccv_utils.qnt index 8ae9ad77a1..6f470bedbf 100644 --- a/tests/mbt/model/ccv_utils.qnt +++ b/tests/mbt/model/ccv_utils.qnt @@ -208,8 +208,8 @@ module ccv_utils { val newSentPacketsPerConsumer = providerState.getConsumers().mapBy( // compute, for each consumer, a list of new packets to be sent (consumer) => // if validator set changed or the key assignments for this chain changed, and the consumer is running, send a packet - if ((providerState.providerValidatorSetChangedInThisBlock or - providerState.consumersWithAddrAssignmentChangesInThisBlock.contains(consumer)) + if ((providerState.providerValidatorSetChangedInThisEpoch or + providerState.consumersWithAddrAssignmentChangesInThisEpoch.contains(consumer)) and isRunningConsumer(consumer, providerState)) { // send a packet, i.e. use a list with one element (the packet to be sent) @@ -247,8 +247,9 @@ module ccv_utils { runningVscId: providerState.runningVscId + 1, // we ended the block and processed that the valset or key assignments changed, // so reset the flags - providerValidatorSetChangedInThisBlock: false, - consumersWithAddrAssignmentChangesInThisBlock: Set(), + providerValidatorSetChangedInThisEpoch: false, + consumersWithAddrAssignmentChangesInThisEpoch: Set(), + providerValidatorSetChangedInThisEpoch: false, // remember the key assignments that were applied to send the packets keyAssignmentsForVSCPackets: providerState.keyAssignmentsForVSCPackets.put( providerState.runningVscId, From af9df642eee030d4351a8c74b91a715bae47e65f Mon Sep 17 00:00:00 2001 From: Philip Offtermatt Date: Fri, 1 Mar 2024 14:30:04 +0100 Subject: [PATCH 35/46] Use invariant script instead of handwriting Makefile --- Makefile | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 1078c247f7..1327589cec 100644 --- a/Makefile +++ b/Makefile @@ -133,10 +133,8 @@ test-trace: # Note: this is *not* using the Quint models to test the system, # this tests/verifies the Quint models *themselves*. verify-models: - quint test tests/mbt/model/ccv_test.qnt;\ - quint test tests/mbt/model/ccv_model.qnt;\ - quint run --invariant "all{ValidatorUpdatesArePropagatedInv,ValidatorSetHasExistedInv,SameVscPacketsInv,MatureOnTimeInv,EventuallyMatureOnProviderInv}" tests/mbt/model/ccv_model.qnt --max-steps 200 --max-samples 200;\ - quint run --invariant "all{ValidatorUpdatesArePropagatedKeyAssignmentInv,ValidatorSetHasExistedKeyAssignmentInv,SameVscPacketsKeyAssignmentInv,MatureOnTimeInv,EventuallyMatureOnProviderInv,KeyAssignmentRulesInv}" tests/mbt/model/ccv_model.qnt --step stepKeyAssignment --max-steps 200 --max-samples 200 + cd tests/mbt/model;\ + ../run_invariants.sh From 614ff82a442c85e22edd5ff841eecc4139bf9d63 Mon Sep 17 00:00:00 2001 From: Philip Offtermatt Date: Fri, 1 Mar 2024 14:30:46 +0100 Subject: [PATCH 36/46] Fix key assignment valset invariant --- tests/mbt/model/ccv_model.qnt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/mbt/model/ccv_model.qnt b/tests/mbt/model/ccv_model.qnt index 4bca47eb1e..e2f8fecb34 100644 --- a/tests/mbt/model/ccv_model.qnt +++ b/tests/mbt/model/ccv_model.qnt @@ -740,7 +740,7 @@ module ccv_model { // and the key assignment of each validator should be applied in that VSCPacket. val ValidatorUpdatesArePropagatedKeyAssignmentInv = // when the provider has just entered a validator set into a block... - ValUpdatePrecondition and currentState.providerState.providerValidatorSetChangedInThisEpoch + ValUpdatePrecondition and currentState.providerState.providerValidatorSetChangedInThisEpoch and CurrentBlockEndsEpoch implies val providerValSetInCurBlock = providerValidatorHistory.head() // ... for each consumer that is running then ... From a16c49a308fd98f22b4b77c548275a8a3aa939d9 Mon Sep 17 00:00:00 2001 From: Philip Offtermatt Date: Fri, 1 Mar 2024 15:49:30 +0100 Subject: [PATCH 37/46] Add better run_invariants script --- tests/mbt/run_invariants.sh | 37 ++++++++++++++++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) diff --git a/tests/mbt/run_invariants.sh b/tests/mbt/run_invariants.sh index df22b97702..afe079387e 100755 --- a/tests/mbt/run_invariants.sh +++ b/tests/mbt/run_invariants.sh @@ -1,6 +1,41 @@ #!/bin/bash +# to stop on any errors +set -e + quint test ccv_model.qnt quint test ccv_test.qnt quint run --invariant "all{ValidatorUpdatesArePropagatedInv,ValidatorSetHasExistedInv,SameVscPacketsInv,MatureOnTimeInv,EventuallyMatureOnProviderInv}" ccv_model.qnt --max-steps 200 --max-samples 200 -quint run --invariant "all{ValidatorUpdatesArePropagatedKeyAssignmentInv,ValidatorSetHasExistedKeyAssignmentInv,SameVscPacketsKeyAssignmentInv,MatureOnTimeInv,EventuallyMatureOnProviderInv,KeyAssignmentRulesInv}" ccv_model.qnt --step stepKeyAssignment --max-steps 200 --max-samples 200 \ No newline at end of file +quint run --invariant "all{ValidatorUpdatesArePropagatedKeyAssignmentInv,ValidatorSetHasExistedKeyAssignmentInv,SameVscPacketsKeyAssignmentInv,MatureOnTimeInv,EventuallyMatureOnProviderInv,KeyAssignmentRulesInv}" ccv_model.qnt --step stepKeyAssignment --max-steps 200 --max-samples 200 + + +# do not stop on errors anymore, so we can give better output if we error +set +e + +run_invariant() { + local invariant=$1 + local step=$2 + local match=$3 + + if [[ -z "$step" ]]; then + quint run --invariant $invariant ccv_model.qnt | grep -q $match + else + quint run --invariant $invariant --step $step ccv_model.qnt | grep -q $match + fi + + if [[ $? -eq 0 ]]; then + echo "sanity check $invariant ok" + else + echo "sanity check $invariant not ok" + exit 1 + fi +} + +run_invariant "CanRunConsumer" "" '[violation]' +run_invariant "CanStopConsumer" "" '[violation]' +run_invariant "CanTimeoutConsumer" "" '[violation]' +run_invariant "CanSendVscPackets" "" '[violation]' +run_invariant "CanSendVscMaturedPackets" "" '[violation]' +run_invariant "CanAssignConsumerKey" "stepKeyAssignment" '[violation]' +run_invariant "CanHaveConsumerAddresses" "stepKeyAssignment" '[violation]' +run_invariant "CanReceiveMaturations" "stepKeyAssignment" '[violation]' \ No newline at end of file From bf9552b3a044ead66c5108b008213936faf72a0b Mon Sep 17 00:00:00 2001 From: Philip Offtermatt Date: Fri, 1 Mar 2024 17:16:16 +0100 Subject: [PATCH 38/46] Start adding epochs from trace into driver --- tests/mbt/driver/mbt_test.go | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/tests/mbt/driver/mbt_test.go b/tests/mbt/driver/mbt_test.go index 183839dc9a..f3d99e8e98 100644 --- a/tests/mbt/driver/mbt_test.go +++ b/tests/mbt/driver/mbt_test.go @@ -179,17 +179,23 @@ func RunItfTrace(t *testing.T, path string) { nodes[i] = addressMap[valName] } + // because the provider chain needs to produce 2 blocks per block in the model due to light client trust assumptions, + // we need to set the provider's BlocksPerEpoch to be double the value in the model + blocksPerEpoch := params["BlocksPerEpoch"].Value.(int64) * 2 + driver := newDriver(t, nodes, valNames) driver.DriverStats = &stats driver.setupProvider(modelParams, valSet, signers, nodes, valNames) - - // set `BlocksPerEpoch` to 10: a reasonable small value greater than 1 that prevents waiting for too - // many blocks and slowing down the tests providerParams := driver.providerKeeper().GetParams(driver.providerCtx()) - providerParams.BlocksPerEpoch = 10 + providerParams.BlocksPerEpoch = blocksPerEpoch driver.providerKeeper().SetParams(driver.providerCtx(), providerParams) + // begin enough blocks to end the first epoch + for i := int64(1); i < blocksPerEpoch; i++ { + driver.endAndBeginBlock("provider", 1*time.Nanosecond) + } + // remember the time offsets to be able to compare times to the model // this is necessary because the system needs to do many steps to initialize the chains, // which is abstracted away in the model @@ -200,6 +206,7 @@ func RunItfTrace(t *testing.T, path string) { t.Log("Reading the trace...") for index, state := range trace.States { + t.Log(driver.providerChain().CurrentHeader.Height % blocksPerEpoch) t.Logf("Reading state %v of trace %v", index, path) trace := state.VarValues["trace"].Value.(itf.ListExprType) @@ -245,16 +252,11 @@ func RunItfTrace(t *testing.T, path string) { // and then increment the rest of the time runningConsumersBefore := driver.runningConsumers() - // going through `blocksPerEpoch` blocks to take into account an epoch - blocksPerEpoch := driver.providerKeeper().GetBlocksPerEpoch(driver.providerCtx()) - for i := int64(0); i < blocksPerEpoch; i = i + 1 { - driver.endAndBeginBlock("provider", 1*time.Nanosecond) - } + driver.endAndBeginBlock("provider", 1*time.Nanosecond) for _, consumer := range driver.runningConsumers() { UpdateProviderClientOnConsumer(t, driver, consumer.ChainId) } - - driver.endAndBeginBlock("provider", time.Duration(timeAdvancement)*time.Second-time.Nanosecond*time.Duration(blocksPerEpoch)) + driver.endAndBeginBlock("provider", time.Duration(timeAdvancement)*time.Second-1*time.Nanosecond) runningConsumersAfter := driver.runningConsumers() From f7b38da6585e0134ce260b65ced867ebcee7f4cc Mon Sep 17 00:00:00 2001 From: Philip Offtermatt Date: Mon, 4 Mar 2024 09:51:59 +0100 Subject: [PATCH 39/46] Remove new block creation during consumer chain setup --- tests/mbt/driver/setup.go | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/tests/mbt/driver/setup.go b/tests/mbt/driver/setup.go index 69b385cb77..a794dce297 100644 --- a/tests/mbt/driver/setup.go +++ b/tests/mbt/driver/setup.go @@ -397,21 +397,15 @@ func (s *Driver) ConfigureNewPath(consumerChain, providerChain *ibctesting.TestC // their channel, and are ready for anything to happen. s.consumerKeeper(consumerChainId).SetProviderChannel(s.ctx(consumerChainId), consumerEndPoint.ChannelID) - // Commit a block on both chains, giving us two committed headers from - // the same time and height. This is the starting point for all our - // data driven testing. + // Commit a block on the consumer to get a header lastConsumerHeader, _ := simibc.EndBlock(consumerChain, func() {}) - lastProviderHeader, _ := simibc.EndBlock(providerChain, func() {}) - // Get ready to update clients. - simibc.BeginBlock(providerChain, 5) + // Begin a block on the consumer to get it ready for testing simibc.BeginBlock(consumerChain, 5) - // Update clients to the latest header. + // Update the client on the provider with the latest consumer header err = simibc.UpdateReceiverClient(consumerEndPoint, providerEndPoint, lastConsumerHeader, false) require.NoError(s.t, err, "Error updating client on consumer for chain %v", consumerChain.ChainID) - err = simibc.UpdateReceiverClient(providerEndPoint, consumerEndPoint, lastProviderHeader, false) - require.NoError(s.t, err, "Error updating client on provider for chain %v", consumerChain.ChainID) // path is ready to go return path From 9290a21158c21ce581f33c0fc4bd780c275efd2f Mon Sep 17 00:00:00 2001 From: Philip Offtermatt Date: Mon, 4 Mar 2024 14:00:25 +0100 Subject: [PATCH 40/46] Adjust model for epochs --- tests/mbt/driver/core.go | 4 +++ tests/mbt/driver/mbt_test.go | 44 +++++++++++++++++++++++++++++--- tests/mbt/driver/model_viewer.go | 4 +++ tests/mbt/model/ccv.qnt | 11 +++----- tests/mbt/model/ccv_model.qnt | 10 ++++---- tests/mbt/model/ccv_test.qnt | 6 ++++- tests/mbt/model/ccv_utils.qnt | 5 ++-- 7 files changed, 64 insertions(+), 20 deletions(-) diff --git a/tests/mbt/driver/core.go b/tests/mbt/driver/core.go index b9a4293df1..803cd486f1 100644 --- a/tests/mbt/driver/core.go +++ b/tests/mbt/driver/core.go @@ -76,6 +76,10 @@ func (s *Driver) providerChain() *ibctesting.TestChain { return s.chain("provider") } +func (s *Driver) providerHeight() int64 { + return s.providerChain().CurrentHeader.Height +} + func (s *Driver) providerCtx() sdk.Context { return s.providerChain().GetContext() } diff --git a/tests/mbt/driver/mbt_test.go b/tests/mbt/driver/mbt_test.go index f3d99e8e98..b1d8afbdcf 100644 --- a/tests/mbt/driver/mbt_test.go +++ b/tests/mbt/driver/mbt_test.go @@ -179,9 +179,11 @@ func RunItfTrace(t *testing.T, path string) { nodes[i] = addressMap[valName] } - // because the provider chain needs to produce 2 blocks per block in the model due to light client trust assumptions, - // we need to set the provider's BlocksPerEpoch to be double the value in the model - blocksPerEpoch := params["BlocksPerEpoch"].Value.(int64) * 2 + // very hacky: the system produces a lot of extra blocks, e.g. when setting up consumer chains, when updating clients, etc. + // to be able to compare the model to the system, we make the blocks per epoch a very large number (such that an epoch never ends naturally in the system while running the trace) + // When an epoch in the model ends (which we can detect by the height modulo the epoch length), we produce many, many blocks in the system, such that an epoch actually ends. + blocksPerEpoch := int64(200) + modelBlocksPerEpoch := params["BlocksPerEpoch"].Value.(int64) driver := newDriver(t, nodes, valNames) driver.DriverStats = &stats @@ -206,9 +208,16 @@ func RunItfTrace(t *testing.T, path string) { t.Log("Reading the trace...") for index, state := range trace.States { - t.Log(driver.providerChain().CurrentHeader.Height % blocksPerEpoch) + t.Log("Height modulo epoch length:", driver.providerChain().CurrentHeader.Height%blocksPerEpoch) + t.Log("Model height:", ProviderHeight(state.VarValues["currentState"].Value.(itf.MapExprType))%modelBlocksPerEpoch) t.Logf("Reading state %v of trace %v", index, path) + // store the height of the provider state before each step. + // The height should only pass an epoch when there passes an epoch in the model, too, + // otherwise there is an error, and blocksPerEpoch needs to be increased. + // See the comment for blocksPerEpoch above. + heightBeforeStep := driver.providerHeight() + trace := state.VarValues["trace"].Value.(itf.ListExprType) // lastAction will get the last action that was executed so far along the model trace, // i.e. the action we should perform before checking model vs actual system equivalence @@ -246,6 +255,22 @@ func RunItfTrace(t *testing.T, path string) { stats.numStartedChains += len(consumersToStart) stats.numStops += len(consumersToStop) + // get the block height in the model + modelHeight := ProviderHeight(currentModelState) + + if modelHeight%modelBlocksPerEpoch == 0 { + // in the model, an epoch ends, so we need to produce blocks in the system to get the actual height + // to end an epoch with the first of the two subsequent calls to endAndBeginBlock below + actualHeight := driver.providerHeight() + + heightInEpoch := actualHeight % blocksPerEpoch + + // produce blocks until the next block ends the epoch + for i := heightInEpoch; i < blocksPerEpoch; i++ { + driver.endAndBeginBlock("provider", 1*time.Nanosecond) + } + } + // we need at least 2 blocks, because for a packet sent at height H, the receiving chain // needs a header of height H+1 to accept the packet // so, we do `blocksPerEpoch` time advancements with a very small increment, @@ -438,6 +463,14 @@ func RunItfTrace(t *testing.T, path string) { stats.EnterStats(driver) + // should not have ended an epoch, unless we also ended an epoch in the model + heightAfterStep := driver.providerHeight() + + if heightBeforeStep/blocksPerEpoch != heightAfterStep/blocksPerEpoch { + // we changed epoch during this step, so ensure that the model also changed epochs + require.True(t, ProviderHeight(state.VarValues["currentState"].Value.(itf.MapExprType))%modelBlocksPerEpoch == 0, "Height in model did not change epoch, but did in system. increase blocksPerEpoch in the system") + } + t.Logf("State %v of trace %v is ok!", index, path) } t.Log("🟢 Trace is ok!") @@ -525,6 +558,9 @@ func ComparePacketQueues( consumer string, timeOffset time.Time, ) { + if consumer == "consumer1" { + return + } t.Helper() ComparePacketQueue(t, driver, currentModelState, PROVIDER, consumer, timeOffset) ComparePacketQueue(t, driver, currentModelState, consumer, PROVIDER, timeOffset) diff --git a/tests/mbt/driver/model_viewer.go b/tests/mbt/driver/model_viewer.go index ed090b2b86..f1f786c4f0 100644 --- a/tests/mbt/driver/model_viewer.go +++ b/tests/mbt/driver/model_viewer.go @@ -40,6 +40,10 @@ func RunningTime(curStateExpr itf.MapExprType, chain string) int64 { return ChainState(curStateExpr, chain)["runningTimestamp"].Value.(int64) } +func ProviderHeight(curStateExpr itf.MapExprType) int64 { + return ProviderState(curStateExpr)["chainState"].Value.(itf.MapExprType)["currentBlockHeight"].Value.(int64) +} + // PacketQueue returns the queued packets between sender and receiver. // Either sender or receiver need to be the provider. func PacketQueue(curStateExpr itf.MapExprType, sender, receiver string) itf.ListExprType { diff --git a/tests/mbt/model/ccv.qnt b/tests/mbt/model/ccv.qnt index e823d48c22..adcbbd3e54 100644 --- a/tests/mbt/model/ccv.qnt +++ b/tests/mbt/model/ccv.qnt @@ -89,11 +89,8 @@ module ccv_types { // Stores VscPackets which have been sent but where the provider has *not received a response yet*. sentVscPacketsToConsumer: Chain -> List[VscPacket], - // stores whether, in this epoch, the validator set has changed. - // this is needed because the validator set might be considered to have changed, even though - // it is still technically identical at our level of abstraction, e.g. a validator power change on the provider - // might leave the validator set the same because a delegation and undelegation cancel each other out. - providerValidatorSetChangedInThisEpoch: bool, + // stores for which consumer chains, in this epoch, the validator set is considered to have changed and we thus need to send a vscPacket to the consumer chains. + consumersWithPowerChangesInThisEpoch: Set[Chain], // stores, for each consumer chain, its current status - // not consumer, running, or stopped @@ -133,7 +130,7 @@ module ccv_types { outstandingPacketsToConsumer: Map(), receivedMaturations: Set(), sentVscPacketsToConsumer: Map(), - providerValidatorSetChangedInThisEpoch: false, + consumersWithPowerChangesInThisEpoch: Set(), consumerStatus: Map(), runningVscId: 0, validatorToConsumerAddr: Map(), @@ -301,7 +298,7 @@ module ccv { } else { // set the validator set changed flag val newProviderState = currentState.providerState.with( - "providerValidatorSetChangedInThisEpoch", true + "consumersWithPowerChangesInThisEpoch", getRunningConsumers(currentState.providerState) ) pure val tmpState = currentState.with( "providerState", newProviderState diff --git a/tests/mbt/model/ccv_model.qnt b/tests/mbt/model/ccv_model.qnt index e2f8fecb34..d37159f174 100644 --- a/tests/mbt/model/ccv_model.qnt +++ b/tests/mbt/model/ccv_model.qnt @@ -348,11 +348,11 @@ module ccv_model { val ValUpdatePrecondition = trace[trace.length()-1].kind == "EndAndBeginBlockForProvider" val ValidatorUpdatesArePropagatedInv = // when the an epoch ends and the provider has just entered a validator set into a block... - ValUpdatePrecondition and currentState.providerState.providerValidatorSetChangedInThisEpoch and CurrentBlockEndsEpoch + ValUpdatePrecondition and CurrentBlockEndsEpoch implies val providerValSetInCurBlock = providerValidatorHistory.head() - // ... for each consumer that is running then ... - runningConsumers.forall( + // ... for each consumer for which we need to send a vsc packet ... + currentState.providerState.consumersWithPowerChangesInThisEpoch.forall( // ...the validator set is in a sent packet... consumer => currentState.providerState.sentVscPacketsToConsumer.get(consumer).toSet().exists( packet => packet.validatorSet == providerValSetInCurBlock @@ -740,11 +740,11 @@ module ccv_model { // and the key assignment of each validator should be applied in that VSCPacket. val ValidatorUpdatesArePropagatedKeyAssignmentInv = // when the provider has just entered a validator set into a block... - ValUpdatePrecondition and currentState.providerState.providerValidatorSetChangedInThisEpoch and CurrentBlockEndsEpoch + ValUpdatePrecondition and CurrentBlockEndsEpoch implies val providerValSetInCurBlock = providerValidatorHistory.head() // ... for each consumer that is running then ... - runningConsumers.forall( + currentState.providerState.consumersWithPowerChangesInThisEpoch.forall( // ...the validator set under key assignment is in a sent packet... val providerState = currentState.providerState consumer => providerState.sentVscPacketsToConsumer.get(consumer).toSet().exists( diff --git a/tests/mbt/model/ccv_test.qnt b/tests/mbt/model/ccv_test.qnt index 809b91a8c0..ab47df50b7 100644 --- a/tests/mbt/model/ccv_test.qnt +++ b/tests/mbt/model/ccv_test.qnt @@ -26,6 +26,10 @@ module ccv_test { "validator2", 5 ) ) + ).with( + "consumerStatus", Map( + "consumer" -> RUNNING + ) ) ) @@ -79,7 +83,7 @@ module ccv_test { ) // still should set the flag not(finalResult.hasError()) and - finalResult.newState.providerState.providerValidatorSetChangedInThisEpoch + finalResult.newState.providerState.consumersWithPowerChangesInThisEpoch.contains("consumer") } diff --git a/tests/mbt/model/ccv_utils.qnt b/tests/mbt/model/ccv_utils.qnt index 6f470bedbf..476ef923dc 100644 --- a/tests/mbt/model/ccv_utils.qnt +++ b/tests/mbt/model/ccv_utils.qnt @@ -208,7 +208,7 @@ module ccv_utils { val newSentPacketsPerConsumer = providerState.getConsumers().mapBy( // compute, for each consumer, a list of new packets to be sent (consumer) => // if validator set changed or the key assignments for this chain changed, and the consumer is running, send a packet - if ((providerState.providerValidatorSetChangedInThisEpoch or + if ((providerState.consumersWithPowerChangesInThisEpoch.contains(consumer) or providerState.consumersWithAddrAssignmentChangesInThisEpoch.contains(consumer)) and isRunningConsumer(consumer, providerState)) { @@ -247,9 +247,8 @@ module ccv_utils { runningVscId: providerState.runningVscId + 1, // we ended the block and processed that the valset or key assignments changed, // so reset the flags - providerValidatorSetChangedInThisEpoch: false, + consumersWithPowerChangesInThisEpoch: Set(), consumersWithAddrAssignmentChangesInThisEpoch: Set(), - providerValidatorSetChangedInThisEpoch: false, // remember the key assignments that were applied to send the packets keyAssignmentsForVSCPackets: providerState.keyAssignmentsForVSCPackets.put( providerState.runningVscId, From ccf24af7d3d7675b65824a4b8052a95f71564efc Mon Sep 17 00:00:00 2001 From: Philip Offtermatt Date: Wed, 6 Mar 2024 11:09:48 +0100 Subject: [PATCH 41/46] Take into account comments --- tests/mbt/driver/mbt_test.go | 11 ++++------- tests/mbt/driver/setup.go | 10 ---------- tests/mbt/model/ccv.qnt | 2 +- tests/mbt/model/ccv_model.qnt | 2 +- 4 files changed, 6 insertions(+), 19 deletions(-) diff --git a/tests/mbt/driver/mbt_test.go b/tests/mbt/driver/mbt_test.go index b1d8afbdcf..df748ea11f 100644 --- a/tests/mbt/driver/mbt_test.go +++ b/tests/mbt/driver/mbt_test.go @@ -209,11 +209,11 @@ func RunItfTrace(t *testing.T, path string) { for index, state := range trace.States { t.Log("Height modulo epoch length:", driver.providerChain().CurrentHeader.Height%blocksPerEpoch) - t.Log("Model height:", ProviderHeight(state.VarValues["currentState"].Value.(itf.MapExprType))%modelBlocksPerEpoch) + t.Log("Model height modulo epoch length:", ProviderHeight(state.VarValues["currentState"].Value.(itf.MapExprType))%modelBlocksPerEpoch) t.Logf("Reading state %v of trace %v", index, path) // store the height of the provider state before each step. - // The height should only pass an epoch when there passes an epoch in the model, too, + // The height should only pass an epoch when it passes an epoch in the model, too, // otherwise there is an error, and blocksPerEpoch needs to be increased. // See the comment for blocksPerEpoch above. heightBeforeStep := driver.providerHeight() @@ -273,8 +273,8 @@ func RunItfTrace(t *testing.T, path string) { // we need at least 2 blocks, because for a packet sent at height H, the receiving chain // needs a header of height H+1 to accept the packet - // so, we do `blocksPerEpoch` time advancements with a very small increment, - // and then increment the rest of the time + // so, we do two blocks, one with a very small increment, + // and then another to increment the rest of the time runningConsumersBefore := driver.runningConsumers() driver.endAndBeginBlock("provider", 1*time.Nanosecond) @@ -558,9 +558,6 @@ func ComparePacketQueues( consumer string, timeOffset time.Time, ) { - if consumer == "consumer1" { - return - } t.Helper() ComparePacketQueue(t, driver, currentModelState, PROVIDER, consumer, timeOffset) ComparePacketQueue(t, driver, currentModelState, consumer, PROVIDER, timeOffset) diff --git a/tests/mbt/driver/setup.go b/tests/mbt/driver/setup.go index a794dce297..c0020a4095 100644 --- a/tests/mbt/driver/setup.go +++ b/tests/mbt/driver/setup.go @@ -397,16 +397,6 @@ func (s *Driver) ConfigureNewPath(consumerChain, providerChain *ibctesting.TestC // their channel, and are ready for anything to happen. s.consumerKeeper(consumerChainId).SetProviderChannel(s.ctx(consumerChainId), consumerEndPoint.ChannelID) - // Commit a block on the consumer to get a header - lastConsumerHeader, _ := simibc.EndBlock(consumerChain, func() {}) - - // Begin a block on the consumer to get it ready for testing - simibc.BeginBlock(consumerChain, 5) - - // Update the client on the provider with the latest consumer header - err = simibc.UpdateReceiverClient(consumerEndPoint, providerEndPoint, lastConsumerHeader, false) - require.NoError(s.t, err, "Error updating client on consumer for chain %v", consumerChain.ChainID) - // path is ready to go return path } diff --git a/tests/mbt/model/ccv.qnt b/tests/mbt/model/ccv.qnt index adcbbd3e54..2a81fe3a2d 100644 --- a/tests/mbt/model/ccv.qnt +++ b/tests/mbt/model/ccv.qnt @@ -89,7 +89,7 @@ module ccv_types { // Stores VscPackets which have been sent but where the provider has *not received a response yet*. sentVscPacketsToConsumer: Chain -> List[VscPacket], - // stores for which consumer chains, in this epoch, the validator set is considered to have changed and we thus need to send a vscPacket to the consumer chains. + // stores for which consumer chains, in this epoch, the validator set is considered to have changed and we thus need to send a VscPacket to the consumer chains. consumersWithPowerChangesInThisEpoch: Set[Chain], // stores, for each consumer chain, its current status - diff --git a/tests/mbt/model/ccv_model.qnt b/tests/mbt/model/ccv_model.qnt index d37159f174..b9913c0a35 100644 --- a/tests/mbt/model/ccv_model.qnt +++ b/tests/mbt/model/ccv_model.qnt @@ -542,7 +542,7 @@ module ccv_model { // change voting power on provider again VotingPowerChange("node1", 50).then( // end the epoch - EndProviderEpoch(3 * Second, Set(), Set()) + EndProviderEpoch(1 * Second, Set(), Set()) ) .then( // deliver packet to consumer1 From 9f1d40c64bda4aa3b2257accd43c69425df172cf Mon Sep 17 00:00:00 2001 From: Philip Offtermatt Date: Fri, 8 Mar 2024 09:44:02 +0100 Subject: [PATCH 42/46] Revert changes to actions.go --- tests/e2e/actions.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/tests/e2e/actions.go b/tests/e2e/actions.go index 0b35d6daf3..c6e5424813 100644 --- a/tests/e2e/actions.go +++ b/tests/e2e/actions.go @@ -291,6 +291,7 @@ func (tr TestConfig) submitConsumerAdditionProposal( bz, err = target.ExecCommand( "/bin/bash", "-c", fmt.Sprintf(`echo '%s' > %s`, jsonStr, "/temp-proposal.json"), ).CombinedOutput() + if err != nil { log.Fatal(err, "\n", string(bz)) } @@ -307,6 +308,7 @@ func (tr TestConfig) submitConsumerAdditionProposal( `--keyring-backend`, `test`, `-y`, ).CombinedOutput() + if err != nil { log.Fatal(err, "\n", string(bz)) } @@ -349,6 +351,7 @@ func (tr TestConfig) submitConsumerRemovalProposal( bz, err = target.ExecCommand( "/bin/bash", "-c", fmt.Sprintf(`echo '%s' > %s`, jsonStr, "/temp-proposal.json")).CombinedOutput() + if err != nil { log.Fatal(err, "\n", string(bz)) } @@ -365,6 +368,7 @@ func (tr TestConfig) submitConsumerRemovalProposal( `--keyring-backend`, `test`, `-y`, ).CombinedOutput() + if err != nil { log.Fatal(err, "\n", string(bz)) } @@ -423,6 +427,7 @@ func (tr TestConfig) submitParamChangeProposal( bz, err = target.ExecCommand( "/bin/bash", "-c", fmt.Sprintf(`echo '%s' > %s`, jsonStr, "/params-proposal.json"), ).CombinedOutput() + if err != nil { log.Fatal(err, "\n", string(bz)) } @@ -559,7 +564,7 @@ func (tr *TestConfig) transformConsumerGenesis(consumerChain ChainID, genesis [] panic(fmt.Sprintf("failed writing ccv consumer file : %v", err)) } defer file.Close() - err = os.WriteFile(file.Name(), genesis, 0o600) + err = os.WriteFile(file.Name(), genesis, 0600) if err != nil { log.Fatalf("Failed writing consumer genesis to file: %v", err) } @@ -870,6 +875,7 @@ func (tr TestConfig) addChainToHermes( "--chain", string(tr.chainConfigs[action.Chain].ChainId), "--mnemonic-file", "/root/.hermes/mnemonic.txt", ).CombinedOutput() + if err != nil { log.Fatal(err, "\n", string(bz)) } @@ -1831,6 +1837,7 @@ func (tr TestConfig) submitChangeRewardDenomsProposal(action SubmitChangeRewardD bz, err = target.ExecCommand( "/bin/bash", "-c", fmt.Sprintf(`echo '%s' > %s`, jsonStr, "/change-reward-denoms-proposal.json")).CombinedOutput() + if err != nil { log.Fatal(err, "\n", string(bz)) } @@ -1846,6 +1853,7 @@ func (tr TestConfig) submitChangeRewardDenomsProposal(action SubmitChangeRewardD `--keyring-backend`, `test`, `-y`, ).CombinedOutput() + if err != nil { log.Fatal(err, "\n", string(bz)) } From 4edaae2578c4b59e860bc26d87180f0e85feb9a7 Mon Sep 17 00:00:00 2001 From: Philip Offtermatt Date: Fri, 8 Mar 2024 09:44:30 +0100 Subject: [PATCH 43/46] Revert changes to x/ --- x/ccv/provider/keeper/validator_set_update.go | 10 +++------- x/ccv/provider/keeper/validator_set_update_test.go | 12 ------------ x/ccv/types/shared_params.go | 10 ---------- 3 files changed, 3 insertions(+), 29 deletions(-) diff --git a/x/ccv/provider/keeper/validator_set_update.go b/x/ccv/provider/keeper/validator_set_update.go index 78cd0e4724..71238d210d 100644 --- a/x/ccv/provider/keeper/validator_set_update.go +++ b/x/ccv/provider/keeper/validator_set_update.go @@ -2,7 +2,6 @@ package keeper import ( "fmt" - abci "github.com/cometbft/cometbft/abci/types" sdk "github.com/cosmos/cosmos-sdk/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" @@ -37,8 +36,7 @@ func (k Keeper) DeleteConsumerValidator( // DeleteConsumerValSet deletes all the stored consumer validators for chain `chainID` func (k Keeper) DeleteConsumerValSet( ctx sdk.Context, - chainID string, -) { + chainID string) { store := ctx.KVStore(k.storeKey) key := types.ChainIdWithLenKey(types.ConsumerValidatorBytePrefix, chainID) iterator := sdk.KVStorePrefixIterator(store, key) @@ -67,8 +65,7 @@ func (k Keeper) IsConsumerValidator( // GetConsumerValSet returns all the consumer validators for chain `chainID` func (k Keeper) GetConsumerValSet( ctx sdk.Context, - chainID string, -) (validators []types.ConsumerValidator) { + chainID string) (validators []types.ConsumerValidator) { store := ctx.KVStore(k.storeKey) key := types.ChainIdWithLenKey(types.ConsumerValidatorBytePrefix, chainID) iterator := sdk.KVStorePrefixIterator(store, key) @@ -135,8 +132,7 @@ func (k Keeper) ComputeNextEpochConsumerValSet( // needed by CometBFT to update the validator set on a chain. func DiffValidators( currentValidators []types.ConsumerValidator, - nextValidators []types.ConsumerValidator, -) []abci.ValidatorUpdate { + nextValidators []types.ConsumerValidator) []abci.ValidatorUpdate { var updates []abci.ValidatorUpdate isCurrentValidator := make(map[string]types.ConsumerValidator) diff --git a/x/ccv/provider/keeper/validator_set_update_test.go b/x/ccv/provider/keeper/validator_set_update_test.go index a97c5048a4..8505158816 100644 --- a/x/ccv/provider/keeper/validator_set_update_test.go +++ b/x/ccv/provider/keeper/validator_set_update_test.go @@ -77,12 +77,8 @@ func TestGetConsumerValSet(t *testing.T) { types.ConsumerValidator{ ProviderConsAddr: expectedValidator.ProviderConsAddr, Power: expectedValidator.Power, -<<<<<<< HEAD - ConsumerPublicKey: expectedValidator.ConsumerPublicKey}) -======= ConsumerPublicKey: expectedValidator.ConsumerPublicKey, }) ->>>>>>> feat/epochs } actualValidators := providerKeeper.GetConsumerValSet(ctx, "chainID") @@ -175,13 +171,8 @@ func TestDiff(t *testing.T) { // and nextValidators = {B, C, D, E, F}. For the validators {B, C, D, E} in the intersection we have: // - validator B has no power or consumer key change // - validator C has changed its power -<<<<<<< HEAD - // - validator E has no power change but has changed its consumer key - // - validator F has both changed its power and its consumer key -======= // - validator D has no power change but has changed its consumer key // - validator E has both changed its power and its consumer key ->>>>>>> feat/epochs var expectedUpdates []abci.ValidatorUpdate @@ -274,8 +265,6 @@ func TestDiffEdgeCases(t *testing.T) { sortUpdates(expectedUpdates) sortUpdates(actualUpdates) require.Equal(t, expectedUpdates, actualUpdates) -<<<<<<< HEAD -======= // have nonempty `currentValidators` and `nextValidators`, but with empty intersection // all old validators should be removed, all new validators should be added @@ -284,7 +273,6 @@ func TestDiffEdgeCases(t *testing.T) { sortUpdates(expectedUpdates) sortUpdates(actualUpdates) require.Equal(t, expectedUpdates, actualUpdates) ->>>>>>> feat/epochs } func TestSetConsumerValSet(t *testing.T) { diff --git a/x/ccv/types/shared_params.go b/x/ccv/types/shared_params.go index 2ffa3d90c1..566737c0b9 100644 --- a/x/ccv/types/shared_params.go +++ b/x/ccv/types/shared_params.go @@ -51,16 +51,6 @@ func ValidatePositiveInt64(i interface{}) error { return nil } -func ValidatePositiveUint32(i interface{}) error { - if _, ok := i.(uint32); !ok { - return fmt.Errorf("invalid parameter type: %T", i) - } - if i.(uint32) == 0 { - return fmt.Errorf("parameter must be positive") - } - return nil -} - func ValidateString(i interface{}) error { if _, ok := i.(string); !ok { return fmt.Errorf("invalid parameter type: %T", i) From edf8cd03cf291b8e64a16da8bb592d924f7aaf5a Mon Sep 17 00:00:00 2001 From: Philip Offtermatt Date: Fri, 8 Mar 2024 09:45:46 +0100 Subject: [PATCH 44/46] Remove unused listMul --- tests/mbt/model/libraries/extraSpells.qnt | 20 -------------------- 1 file changed, 20 deletions(-) diff --git a/tests/mbt/model/libraries/extraSpells.qnt b/tests/mbt/model/libraries/extraSpells.qnt index 8886b2bb4a..9167bb4bcb 100644 --- a/tests/mbt/model/libraries/extraSpells.qnt +++ b/tests/mbt/model/libraries/extraSpells.qnt @@ -207,24 +207,4 @@ module extraSpells { assert(not(listForAll(List(1, 2, 3), __x => __x > 1))), assert(listForAll(List(), __x => __x > 0)), } - - // listMul returns a new list which is the result of concatenating the given list with itself the given number of times. - // It computes the result using fold. - // - // Parameters: - // - __list: The list to concatenate with itself. - // - __n: The number of times to concatenate the list with itself. - // - // Returns: - // - A new list which is the result of concatenating the given list with itself the given number of times. - pure def listMul(__list: List[a], __n: int): List[a] = { - 1.to(__n).fold(List(), (__l, _) => __l.concat(__list)) - } - - run listMulTest = - all { - assert(listMul(List(1, 2, 3), 3) == List(1, 2, 3, 1, 2, 3, 1, 2, 3)), - assert(listMul(List(1, 2, 3), 0) == List()), - assert(listMul(List(), 3) == List()), - } } \ No newline at end of file From 769dc150a57501bb929f63a6076d3085de2d437a Mon Sep 17 00:00:00 2001 From: Philip Offtermatt Date: Fri, 8 Mar 2024 09:48:41 +0100 Subject: [PATCH 45/46] Advance time by epochLength instead of 1 second --- tests/mbt/model/ccv_model.qnt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/mbt/model/ccv_model.qnt b/tests/mbt/model/ccv_model.qnt index b9913c0a35..a225ebac59 100644 --- a/tests/mbt/model/ccv_model.qnt +++ b/tests/mbt/model/ccv_model.qnt @@ -542,7 +542,7 @@ module ccv_model { // change voting power on provider again VotingPowerChange("node1", 50).then( // end the epoch - EndProviderEpoch(1 * Second, Set(), Set()) + EndProviderEpoch(epochLength * Second, Set(), Set()) ) .then( // deliver packet to consumer1 @@ -613,7 +613,7 @@ module ccv_model { VotingPowerChange("node1", 50) ).then( // send packet to consumer1 and consumer2 - EndProviderEpoch(1 * Second, Set(), Set()) + EndProviderEpoch(epochLength * Second, Set(), Set()) ).then( // deliver the packets DeliverVscPacket("consumer1") @@ -628,7 +628,7 @@ module ccv_model { VotingPowerChange("node2", 50) ).then( // send packets - EndProviderEpoch(1 * Second, Set(), Set()) + EndProviderEpoch(epochLength * Second, Set(), Set()) ).then( //deliver to consumer1 DeliverVscPacket("consumer1") @@ -874,7 +874,7 @@ module ccv_model { ) .then( // end and begin block to make sure the key assignment is processed and the packet is sent - EndProviderEpoch(1 * Second, Set(), Set()) + EndProviderEpoch(epochLength * Second, Set(), Set()) ) .then( // receive the packet on the consumer From 46e8e4e2416c89d26cc0c359b415863d09cfcbb8 Mon Sep 17 00:00:00 2001 From: Philip Offtermatt Date: Fri, 8 Mar 2024 13:52:04 +0100 Subject: [PATCH 46/46] Indent condition and clarify EndProviderEpoch --- tests/mbt/model/ccv_model.qnt | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/tests/mbt/model/ccv_model.qnt b/tests/mbt/model/ccv_model.qnt index a225ebac59..1509ad439f 100644 --- a/tests/mbt/model/ccv_model.qnt +++ b/tests/mbt/model/ccv_model.qnt @@ -243,6 +243,7 @@ module ccv_model { // The first block will start all consumers in consumersToStart and stop all consumers in consumersToStop, // and advance time by timeAdvancement - ((epochLength-1) * Seconds). // The rest of the blocks will not start or stop any consumers, and will advance time by 1 second each. + // As a a `Run`, it is only used in tests, not during simulation or verification. run EndProviderEpoch( timeAdvancement: Time, consumersToStart: Set[Chain], @@ -250,10 +251,11 @@ module ccv_model { ): bool = epochLength.reps( i => - if (i == 0) - EndAndBeginBlockForProvider(timeAdvancement-((epochLength-1)*Second), consumersToStart, consumersToStop) - else - EndAndBeginBlockForProvider(1 * Second, Set(), Set()) + if (i == 0) { + EndAndBeginBlockForProvider(timeAdvancement-((epochLength-1)*Second), consumersToStart, consumersToStop) + } else { + EndAndBeginBlockForProvider(1 * Second, Set(), Set()) + } ) // ==================