From 8e38556e9711cb4604156ab6648fb6d4fe557179 Mon Sep 17 00:00:00 2001 From: Marius Poke Date: Wed, 31 Jul 2024 18:15:54 +0200 Subject: [PATCH] feat!: remove VSCMaturedPackets (provider changes) (#2098) * turn off expensive tests * deprecate key prefixes * tag protos for removal * remove QueryOldestUnconfirmedVsc * make AfterUnbondingInitiated a noop * add migration * remove completeMaturedUnbondingOps * send VSCPacket only on valupdates * remove VSC timeout logic * remove unbonding ops logic * remove VscUnbondingOps from ConsumerState * remove unnecessary fields from GenesisState * remove GetAllUnbondingOps * remove deprecated protos * remove TODO * remove unbonding integration tests * fix checkConsumerChainIsRemoved * remove checkCCVUnbondingOp * TestProviderStateIsCleanedAfterConsumerChainIsStopped * fix TestRelayAndApplyDowntimePacket * remove vsc_timeout_period param * add TestUndelegationCompletion * add TODO for init timeout * fix integration tests * avoid breaking protos * remove TestTooManyLastValidators * add ADR for removing vscmatured packets * Update docs/docs/adrs/adr-018-remove-vscmatured.md Co-authored-by: MSalopek * Update docs/docs/adrs/adr-018-remove-vscmatured.md Co-authored-by: MSalopek * add consumer changes -- wip * consumer changes * add new prefix for ConsumerAddrsToPrune * add consumer_addrs_to_prune_v2 to GenesisState * add migration for ConsumerAddrsToPrune index * Update docs/docs/adrs/adr-018-remove-vscmatured.md Co-authored-by: insumity * Update docs/docs/adrs/adr-018-remove-vscmatured.md Co-authored-by: insumity * deprecate ConsumerAddrsToPruneBytePrefix * change name of field for ConsumerAddrsToPruneV2 * reuse original ConsumerAddrsToPrune methods * stop handling VSCMaturedPackets * update ADR * apply review suggestions * Update docs/docs/adrs/adr-018-remove-vscmatured.md Co-authored-by: Philip Offtermatt <57488781+p-offtermatt@users.noreply.github.com> * Update docs/docs/adrs/adr-018-remove-vscmatured.md Co-authored-by: Philip Offtermatt <57488781+p-offtermatt@users.noreply.github.com> * Update docs/docs/adrs/adr-018-remove-vscmatured.md Co-authored-by: Simon Noetzlin * describe how hermes uses UnbondingPeriod * apply review suggestions * apply review suggestions * apply review suggestions * remove ConsumerAddrsToPrune * deprecate InitTimeoutTimestampBytePrefix * remove init timeout logic * migration to remove InitTimeoutTimestamp state * update GenesisState * fix tests * Update x/ccv/provider/types/keys.go Co-authored-by: insumity * apply review suggestions * uncomment TestSimulatedAssignmentsAndUpdateApplication * Fixed TestSimulatedAssignmentsAndUpdateApplication test * formatting fix * fix error message * remove TestInitTimeout * remove init_timeout_period param * fix migration and tests * update ADR 18 status * remove InitTimeoutTimestamp proto * add TestPreserveBytePrefix * fix migration; wip * remove throttle_legacy as not needed * fix v7 migration * remove GetBinaryCodec * avoid calling ConsumerAddrsToPruneV2Key twice * convert keys prefixes to byte * add changelog entries * update docs * remove duplicate event type * revert changes to test.yml * apply review suggestions * apply minor changes * add test for MigrateConsumerAddrsToPrune * apply review suggestion --------- Co-authored-by: MSalopek Co-authored-by: insumity Co-authored-by: Philip Offtermatt <57488781+p-offtermatt@users.noreply.github.com> Co-authored-by: Simon Noetzlin Co-authored-by: Bernd Mueller --- .../provider/2098-vscmatured-removal.md | 7 + .../provider/2098-vscmatured-removal.md | 8 + .../provider/2098-vscmatured-removal.md | 2 + app/provider/app.go | 6 +- docs/docs/adrs/adr-018-remove-vscmatured.md | 188 ++ docs/docs/adrs/intro.md | 1 + docs/docs/introduction/params.md | 15 - .../ccv/provider/v1/genesis.proto | 36 +- .../ccv/provider/v1/provider.proto | 62 +- .../ccv/provider/v1/query.proto | 16 +- tests/integration/channel_init.go | 96 - tests/integration/common.go | 49 +- tests/integration/slashing.go | 10 +- tests/integration/stop_consumer.go | 13 - tests/integration/unbonding.go | 525 +--- testutil/integration/debug_test.go | 32 +- testutil/keeper/unit_test_helpers.go | 11 - x/ccv/provider/client/cli/query.go | 28 - x/ccv/provider/ibc_module.go | 9 +- x/ccv/provider/ibc_module_test.go | 8 +- x/ccv/provider/keeper/genesis.go | 43 +- x/ccv/provider/keeper/genesis_test.go | 74 +- x/ccv/provider/keeper/grpc_query.go | 31 - x/ccv/provider/keeper/grpc_query_test.go | 44 - x/ccv/provider/keeper/hooks.go | 98 - x/ccv/provider/keeper/keeper.go | 434 +--- x/ccv/provider/keeper/keeper_test.go | 256 -- x/ccv/provider/keeper/key_assignment.go | 130 +- x/ccv/provider/keeper/key_assignment_test.go | 130 +- x/ccv/provider/keeper/params.go | 19 - x/ccv/provider/keeper/params_test.go | 2 - x/ccv/provider/keeper/proposal.go | 30 - x/ccv/provider/keeper/proposal_test.go | 2 - x/ccv/provider/keeper/relay.go | 183 +- x/ccv/provider/keeper/relay_test.go | 217 -- x/ccv/provider/keeper/throttle_legacy.go | 111 - x/ccv/provider/migrations/migrator.go | 45 +- .../provider/migrations/v3/migration_test.go | 117 - x/ccv/provider/migrations/v3/migrations.go | 25 - x/ccv/provider/migrations/v7/legacy_params.go | 16 - .../provider/migrations/v7/migrations_test.go | 2 - x/ccv/provider/migrations/v8/migrations.go | 120 + .../provider/migrations/v8/migrations_test.go | 140 ++ x/ccv/provider/module.go | 18 +- x/ccv/provider/module_test.go | 6 +- x/ccv/provider/types/consumer.go | 2 - x/ccv/provider/types/events.go | 1 - x/ccv/provider/types/genesis.go | 61 +- x/ccv/provider/types/genesis.pb.go | 446 +--- x/ccv/provider/types/genesis_test.go | 335 +-- x/ccv/provider/types/key_assignment.go | 3 +- x/ccv/provider/types/keys.go | 144 +- x/ccv/provider/types/keys_test.go | 94 +- x/ccv/provider/types/params.go | 22 - x/ccv/provider/types/params_test.go | 28 +- x/ccv/provider/types/provider.pb.go | 2218 +++-------------- x/ccv/provider/types/query.pb.go | 642 +---- x/ccv/provider/types/query.pb.gw.go | 101 - x/ccv/types/events.go | 1 - 59 files changed, 1488 insertions(+), 6025 deletions(-) create mode 100644 .changelog/unreleased/api-breaking/provider/2098-vscmatured-removal.md create mode 100644 .changelog/unreleased/features/provider/2098-vscmatured-removal.md create mode 100644 .changelog/unreleased/state-breaking/provider/2098-vscmatured-removal.md create mode 100644 docs/docs/adrs/adr-018-remove-vscmatured.md delete mode 100644 tests/integration/channel_init.go delete mode 100644 x/ccv/provider/keeper/throttle_legacy.go delete mode 100644 x/ccv/provider/migrations/v3/migration_test.go delete mode 100644 x/ccv/provider/migrations/v3/migrations.go create mode 100644 x/ccv/provider/migrations/v8/migrations.go create mode 100644 x/ccv/provider/migrations/v8/migrations_test.go diff --git a/.changelog/unreleased/api-breaking/provider/2098-vscmatured-removal.md b/.changelog/unreleased/api-breaking/provider/2098-vscmatured-removal.md new file mode 100644 index 0000000000..b5bb3ff5cc --- /dev/null +++ b/.changelog/unreleased/api-breaking/provider/2098-vscmatured-removal.md @@ -0,0 +1,7 @@ +- The removal of `VSCMaturedPackets` entail several API breaking changes. + ([\#2098](https://github.com/cosmos/interchain-security/pull/2098)) + + - Remove the `oldest_unconfirmed_vsc` query -- used to get + the send timestamp of the oldest unconfirmed VSCPacket. + - Deprecate the `init_timeout_period` and `vsc_timeout_period` parameters + from the provider module. diff --git a/.changelog/unreleased/features/provider/2098-vscmatured-removal.md b/.changelog/unreleased/features/provider/2098-vscmatured-removal.md new file mode 100644 index 0000000000..aa370d81d2 --- /dev/null +++ b/.changelog/unreleased/features/provider/2098-vscmatured-removal.md @@ -0,0 +1,8 @@ +- Remove `VSCMaturedPackets` from the provider module, which entails the following + changes to the provider. + ([\#2098](https://github.com/cosmos/interchain-security/pull/2098)) + + - Remove unbonding operations pausing. + - Remove the CCV channel initialization timeout. + - Remove `VSCPackets` timeout. + - Redesign key assignment pruning -- prune old consumer keys after the unbonding period elapses. diff --git a/.changelog/unreleased/state-breaking/provider/2098-vscmatured-removal.md b/.changelog/unreleased/state-breaking/provider/2098-vscmatured-removal.md new file mode 100644 index 0000000000..bc2dc743c2 --- /dev/null +++ b/.changelog/unreleased/state-breaking/provider/2098-vscmatured-removal.md @@ -0,0 +1,2 @@ +- Remove `VSCMaturedPackets` from the provider module. + ([\#2098](https://github.com/cosmos/interchain-security/pull/2098)) diff --git a/app/provider/app.go b/app/provider/app.go index 23262161b4..4867b6368c 100644 --- a/app/provider/app.go +++ b/app/provider/app.go @@ -505,7 +505,11 @@ func New( govtypes.NewMultiGovHooks(app.ProviderKeeper.Hooks()), ) - providerModule := ibcprovider.NewAppModule(&app.ProviderKeeper, app.GetSubspace(providertypes.ModuleName)) + providerModule := ibcprovider.NewAppModule( + &app.ProviderKeeper, + app.GetSubspace(providertypes.ModuleName), + keys[providertypes.StoreKey], + ) app.TransferKeeper = ibctransferkeeper.NewKeeper( appCodec, diff --git a/docs/docs/adrs/adr-018-remove-vscmatured.md b/docs/docs/adrs/adr-018-remove-vscmatured.md new file mode 100644 index 0000000000..9a1b5b736e --- /dev/null +++ b/docs/docs/adrs/adr-018-remove-vscmatured.md @@ -0,0 +1,188 @@ +--- +sidebar_position: 19 +title: Remove VSCMatured Packets +--- +# ADR 018: Remove VSCMatured Packets + +## Changelog +* 19/06/2024: Create initial draft + +## Status + +Accepted + +## Context + +> The idea of removing VSCMatured packets was first suggested by [Jae Kwon](https://github.com/jaekwon) over a conversation in 2022. +> As a result of that conversation, [an ADR was proposed](https://github.com/cosmos/interchain-security/pull/712) to halt consumer chain if VSC packets are no longer received. +> The ADR was not accepted due to other considerations regarding the safety of consumer chains. +> See [this blog post](https://informal.systems/blog/learning-to-live-with-unbonding-pausing) for more details. + +The consumer module on the consumer chains is a representation of the Hub’s staking module, i.e., it provides an _asynchronous_ view of the voting powers and indirectly of the locked collateral. +The key word here is _asynchronous_, which means that (in theory) there is no bound on the lag between the Hub’s view of stake and the consumer’s view of stake. +The reasons for this asynchrony are relaying delays and chain liveness (e.g., a consumer could be down for a long period of time without affecting the liveness of the staking module on the Hub). + +The current version of ICS uses `VSCMaturedPackets` to create on the consumers a _partially synchronous_ view of the Hub’s staking module. +Partially synchronous means that the lag between the Hub’s view of stake and the consumer’s view of stake is bounded, because consumers that exceed this lag are forcibly removed from the protocol. +Basically, unlocking collateral from the Hub is being delayed until the consumers’ `UnbondingPeriod` elapses. +The reason the view is only partially synchronous is that eventually the collateral is unlocked, i.e., if `VSCMaturedPackets` are not received from a consumer for `VscTimeoutPeriod` (default: 5 weeks), then the consumer is removed from ICS and the collateral is unlocked. +Note that keeping the stake locked “forever” would affect the Hub’s liveness, so it’s not a viable option. + +The issue is that whatever attack is possible with an asynchronous view of the staking module, it is eventually possible with the partially synchronous view as well. +For example, an attacker could wait for `VscTimeoutPeriod` for the collateral to be unlocked and then send invalid headers to third-party chains that are not aware the consumer's collateral is no longer locked on the Hub (i.e., the consumer is no longer part of ICS). + +Moreover, with the introduction of [PSS](./adr-015-partial-set-security.md), a consumer’s validator set could “lie” about its `UnbondingPeriod` elapsing by sending `VSCMaturedPackets` earlier. +This would result in a discrepancy between a light client’s view of the `UnbondingPeriod` and the actual Hub’s `UnbondingPeriod`. + +## Decision + +This ADR proposes the removal of `VSCMaturedPackets`. The reason is twofold. +First, `VSCMaturedPackets` provide a "false" sense of correctness as the attack discribed above is still possible. +Second, `VSCMaturedPackets` add considerable complexity to the ICS protocol -- an extra message plus the pausing of unbonding operations that can affect the UX. + +To simplify the upgrading process, removing `VSCMaturedPackets` can be done in two releases: + +* (R1) Update the provider to drop `VSCMaturedPackets`. +* (R2) Update the consumer to stop sending `VSCMaturedPackets`. + +As a result, once the provider chain runs R1, the consumers can start upgrading to R2. + +### Provider Changes (R1) + +#### Parameters + +Deprecate the `InitTimeoutPeriod` and `VscTimeoutPeriod` parameters. + +#### State + +Add the following key prefix to the state: + +- `ConsumerAddrsToPruneV2BytePrefix` -- the byte prefix for storing consumer validators addresses that need to be pruned. + These are stored as + ``` + ConsumerAddrsToPruneV2BytePrefix | len(chainID) | chainID | ts -> (consumer_address1, consumer_address2, ...) + ``` + where `ts` is the timestamp at which the consumer validators addresses can be pruned. + +Migrate the consumer validator addresses stored under the `ConsumerAddrsToPruneBytePrefix` to the new prefix `ConsumerAddrsToPruneV2BytePrefix`. +Note that these consumer validators addresses are stored as +``` +ConsumerAddrsToPruneBytePrefix | len(chainID) | chainID | vscID -> (consumer_address1, consumer_address2, ...) +``` +where `vscID` is the ID of the first VSCPacket sent after these consumer validator addresses were changed. +These means that we can use the `VscSendTimestamp`s to compute the timestamps when these consumer validator addresses can be pruned, i.e., +```golang +func MigrateConsumerAddrsToPrune() + iterator := sdk.KVStorePrefixIterator(store, []byte{providertypes.ConsumerAddrsToPruneBytePrefix}) + for ; iterator.Valid(); iterator.Next() { + chainID, vscID, _ := providertypes.ParseChainIdAndUintIdKey(providertypes.ConsumerAddrsToPruneBytePrefix, iterator.Key()) + // use the VscSendTimestamp index to compute the timestamp at which this consumer addresses can be pruned + vscSendTimestampKey := providertypes.ChainIdAndUintIdKey(providertypes.VscSendTimestampBytePrefix, chainID, vscID) + timeBz := store.Get(vscSendTimestampKey) + sentTime, _ := sdk.ParseTimeBytes(timeBz) + pruneTs := sentTime.Add(sk.UnbondingTime(ctx)) + + var addrs providertypes.AddressList + addrs.Unmarshal(iterator.Value()) + + for _, addr := range addrs.Addresses { + consumerAddr := providertypes.NewConsumerConsAddress(addr) + pk.AppendConsumerAddrsToPrune(ctx, chainID, pruneTs, consumerAddr) + } + } +} +``` + +Remove the following key prefixes from the state. Note that these removals require state migration. + +- `MaturedUnbondingOpsByteKey` -- the byte key that stores the list of all unbonding operations ids that have matured from a consumer chain perspective. +- `UnbondingOpBytePrefix` -- the byte prefix that stores a record of all the ids of consumer chains that need to unbond before a given unbonding operation can unbond on this chain. +- `UnbondingOpIndexBytePrefix` -- the byte prefix of the index for looking up which unbonding operations are waiting for a given consumer chain to unbond. +- `InitTimeoutTimestampBytePrefix` -- the byte prefix for storing the init timeout timestamp for a given consumer chainID. +- `VscSendTimestampBytePrefix` -- the byte prefix for storing the list of VSC sending timestamps for a given consumer chainID. +- `ConsumerAddrsToPruneBytePrefix` -- the byte prefix for storing the mapping from VSC IDs to consumer validators addresses that need to be pruned. + +#### State Transitions + +Removing `VSCMaturedPackets` affects three ICS sub-protocols (see [HandleVSCMaturedPacket](https://github.com/cosmos/interchain-security/blob/v4.2.0/x/ccv/provider/keeper/relay.go#L51)): unbonding operations pausing, `VSCPackets` timeout, and key assignment pruning. +The first two are no longer needed, while the third (key assignment pruning) needs to be redesigned to not depend on `VSCMaturedPackets`. + +**Removing unbonding operations pausing:** + +- Make the `AfterUnbondingInitiated` hook a no-op. As a result, unbonding operations are no longer paused. +- Stop calling the `UnbondingCanComplete` method from the staking keeper. This entails, it is no longer necessary to append `MaturedUnbondingOps` and the `completeMaturedUnbondingOps` method can be removed. +- Note, that during the upgrade, all unbonding operations stored under the `UnbondingOpBytePrefix` prefix need to be completed (via the `UnbondingCanComplete` method from the staking keeper). +- Remove the init timeout timestamp logic from the following methods: `CreateConsumerClient`, `SetConsumerChain`, and `EndBlockCCR`. + +**Removing `VSCPackets` timeout:** + +- Stop setting VSC send timestamps when sending `VSCPackets`. +- Stop removing the VSC send timestamps when receiving `VSCMaturedPackets`. +- Remove the logic from `EndBlockCCR` that checks if the first VSC send timestamp in iterator plus `VscTimeoutPeriod` exceeds the current block time. + +**Redesign key assignment pruning.** The reason for keeping "old" consumer addresses is to enable slashing / jailing validators that misbehave on consumer chains, +i.e., the slashing logic uses the `GetProviderAddrFromConsumerAddr` method that accesses the mapping from validator addresses on consumer chains to validator addresses on the provider chain (`ValidatorsByConsumerAddrBytePrefix`). +Thus, "old" consumer addresses are no longer needed after the provider's `UnbondingPeriod` elapses. +This means that once a validator changes its key on a consumer, we can prune the address corresponding to the "old" key after `UnbondingPeriod`. +This requires the following changes: + +- Adapt the `AppendConsumerAddrsToPrune()` method to use the timestamp at which it is safe to prune the consumer validator address (instead of the current `vscID`). +- Add a new method `ConsumeConsumerAddrsToPrune(ts)` that returns the list of consumer addresses that can be pruned at timestamp `ts`. +- Adapt the `PruneKeyAssignments()` method to call `ConsumeConsumerAddrsToPrune(ctx.BlockTime())`. +- Call the `PruneKeyAssignments()` method from every `EndBlock()` instead of calling it from `HandleVSCMaturedPacket()`. + +#### Queries + +Remove the `oldest_unconfirmed_vsc` query. + +### Consumer Changes (R2) + +#### Parameters + +Given that currently relayers use the consumer `UnbondingPeriod` (see `ConsumerParams`), this param cannot be deprecated. +Note that Hermes queries the `UnbondingPeriod` for sanity checks and to set the default trusting period when it is not specified. +As a result, the `UnbondingTime` method from the staking interface will continue to be used to retrieve the consumer's `UnbondingPeriod`. + +#### State + +Remove the following key prefixes from the state: + +- `PacketMaturityTimeBytePrefix` -- the byte prefix that will store maturity time for each received VSC packet + +Note that these removals require state migration. + +#### State Transitions + +To stop the consumer chains from sending `VSCMaturedPackets`, it is sufficient to not store the maturity time of `VSCPacket`s when receiving them, i.e., do not call `SetPacketMaturityTime` from the `OnRecvVSCPacket()` method. +Note that eventually, no additional `VSCMaturedPackets` will be added to the sending queue as `QueueVSCMaturedPackets` iterates over elapsed maturity times. +In addition, to clean up the code, the `QueueVSCMaturedPackets` must be removed. + +#### Messages + +`VSCMaturedPacketData` is deprecated. +Note that this is a wire-breaking change -- older consumer versions will send `VSCMaturedPackets` and older provider versions will expect to receive `VSCMaturedPackets`. + +## Consequences + +### Positive + +- Remove feature that provides a "false" sense of correctness. +- Remove unnecessary complexity, from both ICS and Cosmos SDK. +- Remove one IBC packet and, thus, reduce relaying cost. +- Remove unbonding pausing logic that could affect the UX. + +### Negative + +- Large refactor that might introduce unexpected bugs. +- Consumer chains are no longer removed if the duration between creating a client and creating the CCV channel exceeds `InitTimeoutPeriod`. + This means that if the CCV channel is not created on time, the client expires and the consumer chain can no longer start without a ClientUpdate proposal or re-submitting a `ConsumerAdditionProposal`. + +### Neutral + +- Consumer chains are no longer removed after a `VscTimeoutPeriod` of inactivity. + Note that consumers are still removed if their CCV channel expires, which usually happens after two weeks instead of five weeks (the default value for `VscTimeoutPeriod`). + +## References + +- [PR #712](https://github.com/cosmos/interchain-security/pull/712) -- Proposal to set an expiration date on the consumer chain updated on each VSCPacket received to ensure the chain is up-to-date. +- [Learning to Live with “Unbonding Pausing”](https://informal.systems/blog/learning-to-live-with-unbonding-pausing) blog post. diff --git a/docs/docs/adrs/intro.md b/docs/docs/adrs/intro.md index a1dac24771..dcb435832c 100644 --- a/docs/docs/adrs/intro.md +++ b/docs/docs/adrs/intro.md @@ -41,6 +41,7 @@ To suggest an ADR, please make use of the [ADR template](https://github.com/cosm - [ADR 013: Slashing on the provider for consumer equivocation](./adr-013-equivocation-slashing.md) - [ADR 014: Epochs](./adr-014-epochs.md) - [ADR 015: Partial Set Security](./adr-015-partial-set-security.md) +- [ADR 018: Remove VSCMatured Packets](./adr-018-remove-vscmatured.md) ### Proposed diff --git a/docs/docs/introduction/params.md b/docs/docs/introduction/params.md index 8d917b3070..3b52e772ab 100644 --- a/docs/docs/introduction/params.md +++ b/docs/docs/introduction/params.md @@ -61,21 +61,6 @@ CCVTimeoutPeriod may have different values on the provider and consumer chains. - `CCVTimeoutPeriod` on the provider **must** be larger than `ConsumerUnbondingPeriod` - `CCVTimeoutPeriod` on the consumer is initial set via the `ConsumerAdditionProposal` -### InitTimeoutPeriod -`InitTimeoutPeriod` is the maximum allowed duration for CCV channel initialization to execute. - -For any consumer chain, if the CCV channel is not established within `InitTimeoutPeriod` then the consumer chain will be removed and therefore will not be secured by the provider chain. - -The countdown starts when the `spawn_time` specified in the `ConsumerAdditionProposal` is reached. - -### VscTimeoutPeriod -`VscTimeoutPeriod` is the provider-side param that enables the provider to timeout VSC packets even when a consumer chain is not live. -If the `VscTimeoutPeriod` is ever reached for a consumer chain that chain will be considered not live and removed from interchain security. - -:::tip -`VscTimeoutPeriod` MUST be larger than the `ConsumerUnbondingPeriod`. -::: - ### BlocksPerDistributionTransmission `BlocksPerDistributionTransmission` is the number of blocks between rewards transfers from the consumer to the provider. diff --git a/proto/interchain_security/ccv/provider/v1/genesis.proto b/proto/interchain_security/ccv/provider/v1/genesis.proto index 269743721e..34c0daf633 100644 --- a/proto/interchain_security/ccv/provider/v1/genesis.proto +++ b/proto/interchain_security/ccv/provider/v1/genesis.proto @@ -11,6 +11,21 @@ import "interchain_security/ccv/provider/v1/provider.proto"; // GenesisState defines the CCV provider chain genesis state message GenesisState { + // Reserve 3rd slot for removed unbonding_ops field + reserved 3; + + // Reserve 4th slot for removed mature_unbonding_ops field + reserved 4; + + // Reserve 11th slot for consumer_addrs_to_prune field + reserved 11; + + // Reserve 12th slot for removed init_timeout_timestamps field + reserved 12; + + // Reserve 13th slot for removed exported_vsc_send_timestamps field + reserved 13; + // strictly positive and set to 1 (DefaultValsetUpdateID) for a new chain uint64 valset_update_id = 1; // empty for a new chain @@ -19,11 +34,6 @@ message GenesisState { (gogoproto.moretags) = "yaml:\"consumer_states\"" ]; // empty for a new chain - repeated interchain_security.ccv.provider.v1.UnbondingOp unbonding_ops = 3 - [ (gogoproto.nullable) = false ]; - // empty for a new chain - interchain_security.ccv.provider.v1.MaturedUnbondingOps mature_unbonding_ops = 4; - // empty for a new chain repeated ValsetUpdateIdToHeight valset_update_id_to_height = 5 [ (gogoproto.nullable) = false ]; // empty for a new chain @@ -39,14 +49,9 @@ message GenesisState { // empty for a new chain repeated ValidatorByConsumerAddr validators_by_consumer_addr = 10 [ (gogoproto.nullable) = false ]; - // empty for a new chain - repeated ConsumerAddrsToPrune consumer_addrs_to_prune = 11 - [ (gogoproto.nullable) = false ]; - repeated interchain_security.ccv.provider.v1.InitTimeoutTimestamp init_timeout_timestamps = 12 - [ (gogoproto.nullable) = false ]; - - repeated interchain_security.ccv.provider.v1.ExportedVscSendTimestamp exported_vsc_send_timestamps = 13 + // empty for a new chain + repeated ConsumerAddrsToPruneV2 consumer_addrs_to_prune_v2 = 14 [ (gogoproto.nullable) = false ]; } @@ -54,6 +59,9 @@ message GenesisState { // // Note this type is only used internally to the provider CCV module. message ConsumerState { + // Reserve 8th slot for removed unbonding_ops_index field + reserved 8; + // ChainID defines the chain ID for the consumer chain string chain_id = 1; // ChannelID defines the IBC channel ID for the consumer chain @@ -70,10 +78,6 @@ message ConsumerState { repeated interchain_security.ccv.v1.ValidatorSetChangePacketData pending_valset_changes = 6 [ (gogoproto.nullable) = false ]; repeated string slash_downtime_ack = 7; - // UnbondingOpsIndex defines the unbonding operations waiting on this consumer - // chain - repeated interchain_security.ccv.provider.v1.VscUnbondingOps - unbonding_ops_index = 8 [ (gogoproto.nullable) = false ]; } // ValsetUpdateIdToHeight defines the genesis information for the mapping diff --git a/proto/interchain_security/ccv/provider/v1/provider.proto b/proto/interchain_security/ccv/provider/v1/provider.proto index 26648c3fc5..38140dff44 100644 --- a/proto/interchain_security/ccv/provider/v1/provider.proto +++ b/proto/interchain_security/ccv/provider/v1/provider.proto @@ -215,6 +215,12 @@ message GlobalSlashEntry { // Params defines the parameters for CCV Provider module message Params { + // Reserve 4th slot for removed init_timeout_period param + reserved 4; + + // Reserve 5th slot for removed vsc_timeout_period param + reserved 5; + // Reserve 8th slot for removed max throttled packet param reserved 8; @@ -225,16 +231,6 @@ message Params { // Sent IBC packets will timeout after this duration google.protobuf.Duration ccv_timeout_period = 3 [ (gogoproto.nullable) = false, (gogoproto.stdduration) = true ]; - // The channel initialization (IBC channel opening handshake) will timeout - // after this duration - google.protobuf.Duration init_timeout_period = 4 - [ (gogoproto.nullable) = false, (gogoproto.stdduration) = true ]; - // The VSC packets sent by the provider will timeout after this duration. - // Note that unlike ccv_timeout_period which is an IBC param, - // the vsc_timeout_period is a provider-side param that enables the provider - // to timeout VSC packets even when a consumer chain is not live. - google.protobuf.Duration vsc_timeout_period = 5 - [ (gogoproto.nullable) = false, (gogoproto.stdduration) = true ]; // The period for which the slash meter is replenished google.protobuf.Duration slash_meter_replenish_period = 6 @@ -283,49 +279,12 @@ message ChannelToChain { string chain_id = 2; } -// VscUnbondingOps contains the IDs of unbonding operations that are waiting for -// at least one VSCMaturedPacket with vscID from a consumer chain -message VscUnbondingOps { - uint64 vsc_id = 1; - repeated uint64 unbonding_op_ids = 2; -} - -// UnbondingOp contains the ids of consumer chains that need to unbond before -// the unbonding operation with the given ID can unbond -message UnbondingOp { - uint64 id = 1; - // consumer chains that are still unbonding - repeated string unbonding_consumer_chains = 2; -} - -message InitTimeoutTimestamp { - string chain_id = 1; - uint64 timestamp = 2; -} - -message VscSendTimestamp { - uint64 vsc_id = 1; - google.protobuf.Timestamp timestamp = 2 - [ (gogoproto.stdtime) = true, (gogoproto.nullable) = false ]; -} - // ValidatorSetChangePackets is a pb list of ccv.ValidatorSetChangePacketData. message ValidatorSetChangePackets { repeated interchain_security.ccv.v1.ValidatorSetChangePacketData list = 1 [ (gogoproto.nullable) = false ]; } -// MaturedUnbondingOps defines a list of ids corresponding to ids of matured -// unbonding operations. -message MaturedUnbondingOps { repeated uint64 ids = 1; } - -// ExportedVscSendTimestamps is VscSendTimestamp with chainID info for exporting to genesis -message ExportedVscSendTimestamp { - string chain_id = 1; - repeated VscSendTimestamp vsc_send_timestamps = 2 - [ (gogoproto.nullable) = false ]; -} - // // Key assignment section // @@ -354,11 +313,12 @@ message ValidatorByConsumerAddr { bytes provider_addr = 3; } -// Used to serialize the ConsumerAddrsToPrune index from key assignment -// ConsumerAddrsToPrune: (chainID, vscID uint64) -> consumerAddrs AddressList -message ConsumerAddrsToPrune { +// Used to serialize the ConsumerAddrsToPruneV2 index from key assignment +// ConsumerAddrsToPruneV2: (chainID, pruneTs time.Time) -> consumerAddrs AddressList +message ConsumerAddrsToPruneV2 { string chain_id = 1; - uint64 vsc_id = 2; + google.protobuf.Timestamp prune_ts = 2 + [ (gogoproto.stdtime) = true, (gogoproto.nullable) = false ]; AddressList consumer_addrs = 3; } diff --git a/proto/interchain_security/ccv/provider/v1/query.proto b/proto/interchain_security/ccv/provider/v1/query.proto index 1acd816c3b..0051d83dd2 100644 --- a/proto/interchain_security/ccv/provider/v1/query.proto +++ b/proto/interchain_security/ccv/provider/v1/query.proto @@ -128,13 +128,6 @@ service Query { "/interchain_security/ccv/provider/consumer_commission_rate/{chain_id}/{provider_address}"; } - // QueryOldestUnconfirmedVsc returns the send timestamp of the oldest unconfirmed VSCPacket for a given chainID - rpc QueryOldestUnconfirmedVsc(QueryOldestUnconfirmedVscRequest) - returns (QueryOldestUnconfirmedVscResponse) { - option (google.api.http).get = - "/interchain_security/ccv/provider/oldest_unconfirmed_vsc/{chain_id}"; - } - // QueryConsumerValidators returns the latest set consumer-validator set for a given chainID // Note that this does not necessarily mean that the consumer chain is using this validator set at this exact moment // because a VSCPacket could be delayed to be delivered on the consumer chain. @@ -328,16 +321,9 @@ message QueryValidatorConsumerCommissionRateResponse { ]; } -message QueryOldestUnconfirmedVscRequest { string chain_id = 1; } - -message QueryOldestUnconfirmedVscResponse { - interchain_security.ccv.provider.v1.VscSendTimestamp vsc_send_timestamp = 1 - [ (gogoproto.nullable) = false ]; -} - message QueryBlocksUntilNextEpochRequest { } message QueryBlocksUntilNextEpochResponse { // The number of blocks until the next epoch starts uint64 blocks_until_next_epoch = 1; -} \ No newline at end of file +} diff --git a/tests/integration/channel_init.go b/tests/integration/channel_init.go deleted file mode 100644 index e9a41c66f5..0000000000 --- a/tests/integration/channel_init.go +++ /dev/null @@ -1,96 +0,0 @@ -package integration - -// TestInitTimeout tests the init timeout -func (suite *CCVTestSuite) TestInitTimeout() { - testCases := []struct { - name string - handshake func() - removed bool - }{ - { - "init times out before INIT", func() {}, true, - }, - { - "init times out before TRY", func() { - // send ChanOpenInit - err := suite.path.EndpointA.ChanOpenInit() - suite.Require().NoError(err) - }, true, - }, - { - "init times out before ACK", func() { - // send ChanOpenInit - err := suite.path.EndpointA.ChanOpenInit() - suite.Require().NoError(err) - // send ChanOpenTry - err = suite.path.EndpointB.ChanOpenTry() - suite.Require().NoError(err) - }, true, - }, - { - "init times out before CONFIRM", func() { - // send ChanOpenInit - err := suite.path.EndpointA.ChanOpenInit() - suite.Require().NoError(err) - // send ChanOpenTry - err = suite.path.EndpointB.ChanOpenTry() - suite.Require().NoError(err) - // send ChanOpenAck - err = suite.path.EndpointA.ChanOpenAck() - suite.Require().NoError(err) - }, true, - }, - { - "init completes before timeout", func() { - // send ChanOpenInit - err := suite.path.EndpointA.ChanOpenInit() - suite.Require().NoError(err) - // send ChanOpenTry - err = suite.path.EndpointB.ChanOpenTry() - suite.Require().NoError(err) - // send ChanOpenAck - err = suite.path.EndpointA.ChanOpenAck() - suite.Require().NoError(err) - // send ChanOpenConfirm - err = suite.path.EndpointB.ChanOpenConfirm() - suite.Require().NoError(err) - }, false, - }, - } - - for i, tc := range testCases { - providerKeeper := suite.providerApp.GetProviderKeeper() - initTimeout := providerKeeper.GetParams(suite.providerCtx()).InitTimeoutPeriod - chainID := suite.consumerChain.ChainID - - // check that the init timeout timestamp is set - _, found := providerKeeper.GetInitTimeoutTimestamp(suite.providerCtx(), chainID) - suite.Require().True(found, "cannot find init timeout timestamp; test: %s", tc.name) - - // create connection - suite.coordinator.CreateConnections(suite.path) - - // channel opening handshake - tc.handshake() - - // call NextBlock - suite.providerChain.NextBlock() - - // increment time - incrementTime(suite, initTimeout) - - // check whether the chain was removed - _, found = providerKeeper.GetConsumerClientId(suite.providerCtx(), chainID) - suite.Require().Equal(!tc.removed, found, "unexpected outcome; test: %s", tc.name) - - if tc.removed { - // check if the chain was properly removed - suite.checkConsumerChainIsRemoved(chainID, false) - } - - if i+1 < len(testCases) { - // reset suite to reset provider client - suite.SetupTest() - } - } -} diff --git a/tests/integration/common.go b/tests/integration/common.go index cc8a0e86a5..46ef499d01 100644 --- a/tests/integration/common.go +++ b/tests/integration/common.go @@ -301,6 +301,7 @@ func relayAllCommittedPackets( // // Note that it is expected for the provider unbonding period // to be one day larger than the consumer unbonding period. +// TODO (mpoke) get rid of consumer unbonding period func incrementTimeByUnbondingPeriod(s *CCVTestSuite, chainType ChainType) { // Get unboding periods providerUnbondingPeriod, err := s.providerApp.GetTestStakingKeeper().UnbondingTime(s.providerCtx()) @@ -315,7 +316,7 @@ func incrementTimeByUnbondingPeriod(s *CCVTestSuite, chainType ChainType) { incrementTime(s, jumpPeriod) } -func checkStakingUnbondingOps(s *CCVTestSuite, id uint64, found, onHold bool, msgAndArgs ...interface{}) { +func checkStakingUnbondingOps(s *CCVTestSuite, id uint64, found bool, msgAndArgs ...interface{}) { stakingUnbondingOp, wasFound := getStakingUnbondingDelegationEntry(s.providerCtx(), s.providerApp.GetTestStakingKeeper(), id) s.Require().Equal( found, @@ -323,53 +324,15 @@ func checkStakingUnbondingOps(s *CCVTestSuite, id uint64, found, onHold bool, ms fmt.Sprintf("checkStakingUnbondingOps failed - getStakingUnbondingDelegationEntry; %s", msgAndArgs...), ) if wasFound { - s.Require().True( - onHold == (0 < stakingUnbondingOp.UnbondingOnHoldRefCount), - fmt.Sprintf("checkStakingUnbondingOps failed - onHold; %s", msgAndArgs...), - ) - } -} - -func checkCCVUnbondingOp(s *CCVTestSuite, providerCtx sdk.Context, chainID string, valUpdateID uint64, found bool, msgAndArgs ...interface{}) { - entries := s.providerApp.GetProviderKeeper().GetUnbondingOpsFromIndex(providerCtx, chainID, valUpdateID) - if found { - s.Require().NotEmpty(entries, fmt.Sprintf("checkCCVUnbondingOp failed - should not be empty; %s", msgAndArgs...)) - s.Require().Greater( - len(entries), - 0, - fmt.Sprintf("checkCCVUnbondingOp failed - no unbonding ops found; %s", msgAndArgs...), - ) - s.Require().Greater( - len(entries[0].UnbondingConsumerChains), - 0, - fmt.Sprintf("checkCCVUnbondingOp failed - unbonding op with no consumer chains; %s", msgAndArgs...), - ) + // make sure UnbondingOnHoldRefCount remains zero s.Require().Equal( - "testchain2", - entries[0].UnbondingConsumerChains[0], - fmt.Sprintf("checkCCVUnbondingOp failed - unbonding op with unexpected consumer chain; %s", msgAndArgs...), + int64(0), + stakingUnbondingOp.UnbondingOnHoldRefCount, + fmt.Sprintf("checkStakingUnbondingOps failed - UnbondingOnHoldRefCount; %s", msgAndArgs...), ) } } -// Checks that an expected amount of redelegations exist for a delegator -// via the staking keeper, then returns those redelegations. -func checkRedelegations(s *CCVTestSuite, delAddr sdk.AccAddress, - expect uint16, -) []stakingtypes.Redelegation { - redelegations, err := s.providerApp.GetTestStakingKeeper().GetRedelegations(s.providerCtx(), delAddr, 2) - s.Require().NoError(err) - s.Require().Len(redelegations, int(expect)) - return redelegations -} - -// Checks that a redelegation entry has a completion time equal to an expected time -func checkRedelegationEntryCompletionTime( - s *CCVTestSuite, entry stakingtypes.RedelegationEntry, expectedCompletion time.Time, -) { - s.Require().Equal(expectedCompletion, entry.CompletionTime) -} - func getStakingUnbondingDelegationEntry(ctx sdk.Context, k testutil.TestStakingKeeper, id uint64) (stakingUnbondingOp stakingtypes.UnbondingDelegationEntry, found bool) { stakingUbd, err := k.GetUnbondingDelegationByUnbondingID(ctx, id) if err != nil { diff --git a/tests/integration/slashing.go b/tests/integration/slashing.go index 2e01c99fe7..b94fd5805d 100644 --- a/tests/integration/slashing.go +++ b/tests/integration/slashing.go @@ -106,14 +106,6 @@ func (s *CCVTestSuite) TestRelayAndApplyDowntimePacket() { // this call was added starging cosmos-sdk v0.50.x s.nextEpoch() - // VSC packets should have been sent from provider during block N to each consumer - expectedSentValsetUpdateId := valsetUpdateIdN - for _, bundle := range s.consumerBundles { - _, found := providerKeeper.GetVscSendTimestamp(s.providerCtx(), - bundle.Chain.ChainID, expectedSentValsetUpdateId) - s.Require().True(found) - } - s.nextEpoch() // Confirm the valset update Id was incremented twice on provider, @@ -124,6 +116,8 @@ func (s *CCVTestSuite) TestRelayAndApplyDowntimePacket() { // check that the validator was removed from the provider validator set by N + 2 s.Require().Len(s.providerChain.Vals.Validators, validatorsPerChain-1) + // VSC packets should have been sent from provider during block N to each consumer + expectedSentValsetUpdateId := valsetUpdateIdN for _, bundle := range s.consumerBundles { // Relay VSC packets from provider to each consumer relayAllCommittedPackets(s, s.providerChain, bundle.Path, diff --git a/tests/integration/stop_consumer.go b/tests/integration/stop_consumer.go index f7b2d6ef96..839bd10771 100644 --- a/tests/integration/stop_consumer.go +++ b/tests/integration/stop_consumer.go @@ -129,25 +129,12 @@ func (s *CCVTestSuite) TestStopConsumerOnChannelClosed() { func (s *CCVTestSuite) checkConsumerChainIsRemoved(chainID string, checkChannel bool) { channelID := s.path.EndpointB.ChannelID providerKeeper := s.providerApp.GetProviderKeeper() - providerStakingKeeper := s.providerApp.GetTestStakingKeeper() if checkChannel { // check channel's state is closed s.Require().Equal(channeltypes.CLOSED, s.path.EndpointB.GetChannel().State) } - // check UnbondingOps were deleted and undelegation entries aren't onHold - for _, unbondingOpsIndex := range providerKeeper.GetAllUnbondingOpIndexes(s.providerCtx(), chainID) { - _, found := providerKeeper.GetUnbondingOpIndex(s.providerCtx(), chainID, unbondingOpsIndex.VscId) - s.Require().False(found) - for _, ubdID := range unbondingOpsIndex.UnbondingOpIds { - _, found = providerKeeper.GetUnbondingOp(s.providerCtx(), unbondingOpsIndex.UnbondingOpIds[ubdID]) - s.Require().False(found) - ubd, _ := providerStakingKeeper.GetUnbondingDelegationByUnbondingID(s.providerCtx(), unbondingOpsIndex.UnbondingOpIds[ubdID]) - s.Require().Zero(ubd.Entries[ubdID].UnbondingOnHoldRefCount) - } - } - // verify consumer chain's states are removed _, found := providerKeeper.GetConsumerGenesis(s.providerCtx(), chainID) s.Require().False(found) diff --git a/tests/integration/unbonding.go b/tests/integration/unbonding.go index 6f027c3616..7316e6c7dd 100644 --- a/tests/integration/unbonding.go +++ b/tests/integration/unbonding.go @@ -1,529 +1,38 @@ package integration import ( - "time" - "cosmossdk.io/math" - sdk "github.com/cosmos/cosmos-sdk/types" - stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" - providerkeeper "github.com/cosmos/interchain-security/v5/x/ccv/provider/keeper" - ccv "github.com/cosmos/interchain-security/v5/x/ccv/types" ) -// TestUndelegationNormalOperation tests that undelegations complete after -// the unbonding period elapses on both the consumer and provider, without -// VSC packets timing out. -func (s *CCVTestSuite) TestUndelegationNormalOperation() { - unbondConsumer := func(expectedPackets int) { - // relay 1 VSC packet from provider to consumer - relayAllCommittedPackets(s, s.providerChain, s.path, ccv.ProviderPortID, s.path.EndpointB.ChannelID, expectedPackets) - // increment time so that the unbonding period ends on the consumer - incrementTimeByUnbondingPeriod(s, Consumer) - // relay 1 VSCMatured packet from consumer to provider - relayAllCommittedPackets(s, s.consumerChain, s.path, ccv.ConsumerPortID, s.path.EndpointA.ChannelID, expectedPackets) - } - - testCases := []struct { - name string - shareDiv int64 - unbond func(expBalance, balance math.Int) - }{ - { - "provider unbonding period elapses first", 2, func(expBalance, balance math.Int) { - // increment time so that the unbonding period ends on the provider - incrementTimeByUnbondingPeriod(s, Provider) - - // check that onHold is true - checkStakingUnbondingOps(s, 1, true, true, "unbonding should be on hold") - - // check that the unbonding is not complete - s.Require().Equal(expBalance, balance, "unexpected balance after provider unbonding") - - // undelegation complete on consumer - unbondConsumer(1) - }, - }, - { - "consumer unbonding period elapses first", 2, func(expBalance, balance math.Int) { - // undelegation complete on consumer - unbondConsumer(1) - - // check that onHold is false - checkStakingUnbondingOps(s, 1, true, false, "unbonding should be not be on hold") - - // check that the unbonding is not complete - s.Require().Equal(expBalance, balance, "unexpected balance after consumer unbonding") - - // increment time so that the unbonding period ends on the provider - incrementTimeByUnbondingPeriod(s, Provider) - }, - }, - { - "no valset changes", 1, func(expBalance, balance math.Int) { - // undelegation complete on consumer - unbondConsumer(1) - - // check that onHold is false - checkStakingUnbondingOps(s, 1, true, false, "unbonding should be not be on hold") - - // check that the unbonding is not complete - s.Require().Equal(expBalance, balance, "unexpected balance after consumer unbonding") - - // increment time so that the unbonding period ends on the provider - incrementTimeByUnbondingPeriod(s, Provider) - }, - }, - } - - for i, tc := range testCases { - providerKeeper := s.providerApp.GetProviderKeeper() - consumerKeeper := s.consumerApp.GetConsumerKeeper() - stakingKeeper := s.providerApp.GetTestStakingKeeper() - - s.SetupCCVChannel(s.path) - - // set VSC timeout period to not trigger the removal of the consumer chain - providerUnbondingPeriod, err := stakingKeeper.UnbondingTime(s.providerCtx()) - s.Require().NoError(err) - consumerUnbondingPeriod := consumerKeeper.GetUnbondingPeriod(s.consumerCtx()) - providerKeeper.SetVscTimeoutPeriod(s.providerCtx(), providerUnbondingPeriod+consumerUnbondingPeriod+24*time.Hour) - - // delegate bondAmt and undelegate tc.shareDiv of it - bondAmt := math.NewInt(10000000) - delAddr := s.providerChain.SenderAccount.GetAddress() - initBalance, valsetUpdateID := delegateAndUndelegate(s, delAddr, bondAmt, tc.shareDiv) - // - check that staking unbonding op was created and onHold is true - checkStakingUnbondingOps(s, 1, true, true, "test: "+tc.name) - // - check that CCV unbonding op was created - checkCCVUnbondingOp(s, s.providerCtx(), s.consumerChain.ChainID, valsetUpdateID, true, "test: "+tc.name) - - // call NextBlock on the provider (which increments the height) - s.nextEpoch() - - // unbond both on provider and consumer and check that - // the balance remains unchanged in between - tc.unbond(initBalance.Sub(bondAmt), getBalance(s, s.providerCtx(), delAddr)) - - // check that the unbonding operation completed - // - check that ccv unbonding op has been deleted - checkCCVUnbondingOp(s, s.providerCtx(), s.consumerChain.ChainID, valsetUpdateID, false, "test: "+tc.name) - // - check that staking unbonding op has been deleted - checkStakingUnbondingOps(s, valsetUpdateID, false, false, "test: "+tc.name) - // - check that necessary delegated coins have been returned - unbondAmt := bondAmt.Sub(bondAmt.Quo(math.NewInt(tc.shareDiv))) - s.Require().Equal( - initBalance.Sub(unbondAmt), - getBalance(s, s.providerCtx(), delAddr), - "unexpected initial balance after unbonding; test: %s", tc.name, - ) - - if i+1 < len(testCases) { - // reset suite to reset provider client - s.SetupTest() - } - } -} - -// TestUndelegationVscTimeout tests that an undelegation -// completes after vscTimeoutPeriod even if it does not -// reach maturity on the consumer chain. In this case, -// the consumer chain is removed. -func (s *CCVTestSuite) TestUndelegationVscTimeout() { - providerKeeper := s.providerApp.GetProviderKeeper() - +// TestUndelegationCompletion tests that undelegations complete after +// the unbonding period elapses on the provider, regardless of the consumer's state +func (s *CCVTestSuite) TestUndelegationCompletion() { s.SetupCCVChannel(s.path) - // set VSC timeout period to trigger the removal of the consumer chain - vscTimeout := providerKeeper.GetVscTimeoutPeriod(s.providerCtx()) - - // delegate bondAmt and undelegate 1/2 of it + // delegate bondAmt and undelegate 1/4 of it bondAmt := math.NewInt(10000000) delAddr := s.providerChain.SenderAccount.GetAddress() - initBalance, valsetUpdateID := delegateAndUndelegate(s, delAddr, bondAmt, 2) - // - check that staking unbonding op was created and onHold is true - checkStakingUnbondingOps(s, 1, true, true) - // - check that CCV unbonding op was created - checkCCVUnbondingOp(s, s.providerCtx(), s.consumerChain.ChainID, valsetUpdateID, true) + initBalance, valsetUpdateID := delegateAndUndelegate(s, delAddr, bondAmt, 4) + // - check that staking unbonding op was created + checkStakingUnbondingOps(s, 1, true) // call NextBlock on the provider (which increments the height) s.providerChain.NextBlock() - // increment time so that the unbonding period ends on the provider - incrementTimeByUnbondingPeriod(s, Provider) - - // check that onHold is true - checkStakingUnbondingOps(s, 1, true, true, "unbonding should be on hold") - - // check that the unbonding is not complete - s.Require().Equal( - initBalance.Sub(bondAmt), - getBalance(s, s.providerCtx(), delAddr), - "unexpected balance after provider unbonding") - - // increment time - incrementTime(s, vscTimeout) - - // check whether the chain was removed - chainID := s.consumerChain.ChainID - _, found := providerKeeper.GetConsumerClientId(s.providerCtx(), chainID) - s.Require().Equal(false, found, "consumer chain was not removed") - - // check if the chain was properly removed - s.checkConsumerChainIsRemoved(chainID, true) + // unbond on provider + stakingKeeper := s.providerApp.GetTestStakingKeeper() + unbondingPeriod, err := stakingKeeper.UnbondingTime(s.providerCtx()) + s.Require().NoError(err) + incrementTime(s, unbondingPeriod) // check that the unbonding operation completed - // - check that ccv unbonding op has been deleted - checkCCVUnbondingOp(s, s.providerCtx(), s.consumerChain.ChainID, valsetUpdateID, false) - // - check that staking unbonding op has been deleted - checkStakingUnbondingOps(s, valsetUpdateID, false, false) + checkStakingUnbondingOps(s, valsetUpdateID, false) // - check that necessary delegated coins have been returned - unbondAmt := bondAmt.Sub(bondAmt.Quo(math.NewInt(2))) + unbondAmt := bondAmt.Quo(math.NewInt(4)) + stillBondedAmt := bondAmt.Sub(unbondAmt) s.Require().Equal( - initBalance.Sub(unbondAmt), + initBalance.Sub(stillBondedAmt), getBalance(s, s.providerCtx(), delAddr), - "unexpected initial balance after VSC timeout", + "unexpected initial balance after unbonding; test: %s", ) } - -// TestUndelegationDuringInit checks that before the CCV channel is established -// - no undelegations can complete, even if the provider unbonding period elapses -// - all the VSC packets are stored in state as pending -// - if the channel handshake times out, then the undelegation completes -func (s *CCVTestSuite) TestUndelegationDuringInit() { - testCases := []struct { - name string - updateInitTimeoutTimestamp func(*providerkeeper.Keeper, time.Duration) - removed bool - }{ - { - "channel handshake completes after unbonding period", func(pk *providerkeeper.Keeper, pUnbondingPeriod time.Duration) { - // change the init timeout timestamp for this consumer chain - // to make sure the chain is not removed before the unbonding period elapses - ts := s.providerCtx().BlockTime().Add(pUnbondingPeriod + 24*time.Hour) - pk.SetInitTimeoutTimestamp(s.providerCtx(), s.consumerChain.ChainID, uint64(ts.UnixNano())) - }, false, - }, - { - "channel handshake times out before unbonding period", func(pk *providerkeeper.Keeper, pUnbondingPeriod time.Duration) { - // change the init timeout timestamp for this consumer chain - // to make sure the chain is removed before the unbonding period elapses - ts := s.providerCtx().BlockTime().Add(pUnbondingPeriod - 24*time.Hour) - pk.SetInitTimeoutTimestamp(s.providerCtx(), s.consumerChain.ChainID, uint64(ts.UnixNano())) - }, true, - }, - } - - for i, tc := range testCases { - providerKeeper := s.providerApp.GetProviderKeeper() - stakingKeeper := s.providerApp.GetTestStakingKeeper() - - // delegate bondAmt and undelegate 1/2 of it - bondAmt := math.NewInt(10000000) - delAddr := s.providerChain.SenderAccount.GetAddress() - initBalance, valsetUpdateID := delegateAndUndelegate(s, delAddr, bondAmt, 2) - // - check that staking unbonding op was created and onHold is true - checkStakingUnbondingOps(s, 1, true, true, "test: "+tc.name) - // - check that CCV unbonding op was created - checkCCVUnbondingOp(s, s.providerCtx(), s.consumerChain.ChainID, valsetUpdateID, true, "test: "+tc.name) - - // get provider unbonding period - providerUnbondingPeriod, err := stakingKeeper.UnbondingTime(s.providerCtx()) - s.Require().NoError(err) - // update init timeout timestamp - tc.updateInitTimeoutTimestamp(&providerKeeper, providerUnbondingPeriod) - - s.nextEpoch() - - // check that the VSC packet is stored in state as pending - pendingVSCs := providerKeeper.GetPendingVSCPackets(s.providerCtx(), s.consumerChain.ChainID) - s.Require().Lenf(pendingVSCs, 1, "no pending VSC packet found; test: %s", tc.name) - - // delegate again to create another VSC packet - delegate(s, delAddr, bondAmt) - - s.nextEpoch() - - // check that the VSC packet is stored in state as pending - pendingVSCs = providerKeeper.GetPendingVSCPackets(s.providerCtx(), s.consumerChain.ChainID) - s.Require().Lenf(pendingVSCs, 2, "only one pending VSC packet found; test: %s", tc.name) - - // increment time so that the unbonding period ends on the provider - incrementTimeByUnbondingPeriod(s, Provider) - - // check whether the unbonding op is still there and onHold is true - checkStakingUnbondingOps(s, 1, !tc.removed, true, "test: "+tc.name) - - if !tc.removed { - // check that unbonding has not yet completed, i.e., the initBalance - // is still lower by the bond amount, because it has been taken out of - // the delegator's account - s.Require().Equal( - initBalance.Sub(bondAmt).Sub(bondAmt), - getBalance(s, s.providerCtx(), delAddr), - "unexpected initial balance before unbonding; test: %s", tc.name, - ) - - // complete CCV channel setup - s.SetupCCVChannel(s.path) - s.nextEpoch() - - // relay VSC packets from provider to consumer - relayAllCommittedPackets(s, s.providerChain, s.path, ccv.ProviderPortID, s.path.EndpointB.ChannelID, 2) - - // increment time so that the unbonding period ends on the consumer - incrementTimeByUnbondingPeriod(s, Consumer) - - // relay VSCMatured packets from consumer to provider - relayAllCommittedPackets(s, s.consumerChain, s.path, ccv.ConsumerPortID, s.path.EndpointA.ChannelID, 2) - - // check that the unbonding operation completed - // - check that ccv unbonding op has been deleted - checkCCVUnbondingOp(s, s.providerCtx(), s.consumerChain.ChainID, valsetUpdateID, false, "test: "+tc.name) - // - check that staking unbonding op has been deleted - checkStakingUnbondingOps(s, valsetUpdateID, false, false, "test: "+tc.name) - // - check that one quarter the delegated coins have been returned - s.Require().Equal( - initBalance.Sub(bondAmt).Sub(bondAmt.Quo(math.NewInt(2))), - getBalance(s, s.providerCtx(), delAddr), - "unexpected initial balance after unbonding; test: %s", tc.name, - ) - } - - if i+1 < len(testCases) { - // reset suite to reset provider client - s.SetupTest() - } - } -} - -// Bond some tokens on provider -// Unbond them to create unbonding op -// Check unbonding ops on both sides -// Advance time so that provider's unbonding op completes -// Check that unbonding has completed in provider staking -func (s *CCVTestSuite) TestUnbondingNoConsumer() { - providerKeeper := s.providerApp.GetProviderKeeper() - providerStakingKeeper := s.providerApp.GetTestStakingKeeper() - - // remove all consumer chains, which were already started during setup - for chainID := range s.consumerBundles { - err := providerKeeper.StopConsumerChain(s.providerCtx(), chainID, true) - s.Require().NoError(err) - } - - // delegate bondAmt and undelegate 1/2 of it - bondAmt := math.NewInt(10000000) - delAddr := s.providerChain.SenderAccount.GetAddress() - initBalance, valsetUpdateID := delegateAndUndelegate(s, delAddr, bondAmt, 2) - // - check that staking unbonding op was created and onHold is FALSE - checkStakingUnbondingOps(s, 1, true, false) - // - check that CCV unbonding op was NOT created - checkCCVUnbondingOp(s, s.providerCtx(), s.consumerChain.ChainID, valsetUpdateID, false) - - // increment time so that the unbonding period ends on the provider; - // cannot use incrementTimeByUnbondingPeriod() since it tries - // to also update the provider's client on the consumer - providerUnbondingPeriod, err := providerStakingKeeper.UnbondingTime(s.providerCtx()) - s.Require().NoError(err) - s.coordinator.IncrementTimeBy(providerUnbondingPeriod + time.Hour) - - // call NextBlock on the provider (which increments the height) - s.providerChain.NextBlock() - - // check that the unbonding operation completed - // - check that staking unbonding op has been deleted - checkStakingUnbondingOps(s, valsetUpdateID, false, false) - // - check that half the coins have been returned - s.Require().True(getBalance(s, s.providerCtx(), delAddr).Equal(initBalance.Sub(bondAmt.Quo(math.NewInt(2))))) -} - -// TestRedelegationNoConsumer tests a redelegate transaction -// submitted on a provider chain with no consumers -func (s *CCVTestSuite) TestRedelegationNoConsumer() { - providerKeeper := s.providerApp.GetProviderKeeper() - stakingKeeper := s.providerApp.GetTestStakingKeeper() - - // stop the consumer chain, which was already started during setup - err := providerKeeper.StopConsumerChain(s.providerCtx(), s.consumerChain.ChainID, true) - s.Require().NoError(err) - - // Setup delegator, bond amount, and src/dst validators - bondAmt := math.NewInt(10000000) - delAddr := s.providerChain.SenderAccount.GetAddress() - _, srcVal := s.getValByIdx(0) - _, dstVal := s.getValByIdx(1) - - delegateAndRedelegate( - s, - delAddr, - srcVal, - dstVal, - bondAmt, - ) - - // 1 redelegation record should exist for original delegator - redelegations := checkRedelegations(s, delAddr, 1) - - // Check that the only entry has appropriate maturation time, the unbonding period from now - unbondingTime, err := stakingKeeper.UnbondingTime(s.providerCtx()) - s.Require().NoError(err) - checkRedelegationEntryCompletionTime( - s, - redelegations[0].Entries[0], - s.providerCtx().BlockTime().Add(unbondingTime), - ) - - // required before call to incrementTimeByUnbondingPeriod or else a panic - // occurs in ibc-go because trusted validators don't match last trusted. - s.providerChain.NextBlock() - - // Increment time so that the unbonding period passes on the provider - incrementTimeByUnbondingPeriod(s, Provider) - - // Call NextBlock on the provider (which increments the height) - s.providerChain.NextBlock() - - // No redelegation records should exist for original delegator anymore - checkRedelegations(s, delAddr, 0) -} - -// TestRedelegationWithConsumer tests a redelegate transaction submitted on a provider chain -// when the unbonding period elapses first on the provider chain -func (s *CCVTestSuite) TestRedelegationProviderFirst() { - s.SetupCCVChannel(s.path) - s.SetupTransferChannel() - - providerKeeper := s.providerApp.GetProviderKeeper() - consumerKeeper := s.consumerApp.GetConsumerKeeper() - stakingKeeper := s.providerApp.GetTestStakingKeeper() - - // set VSC timeout period to not trigger the removal of the consumer chain - providerUnbondingPeriod, err := stakingKeeper.UnbondingTime(s.providerCtx()) - s.Require().NoError(err) - consumerUnbondingPeriod := consumerKeeper.GetUnbondingPeriod(s.consumerCtx()) - providerKeeper.SetVscTimeoutPeriod(s.providerCtx(), providerUnbondingPeriod+consumerUnbondingPeriod+24*time.Hour) - - // Setup delegator, bond amount, and src/dst validators - bondAmt := math.NewInt(10000000) - delAddr := s.providerChain.SenderAccount.GetAddress() - _, srcVal := s.getValByIdx(0) - _, dstVal := s.getValByIdx(1) - - delegateAndRedelegate( - s, - delAddr, - srcVal, - dstVal, - bondAmt, - ) - - // 1 redelegation record should exist for original delegator - redelegations := checkRedelegations(s, delAddr, 1) - - // Check that the only entry has appropriate maturation time, the unbonding period from now - unbondingTime, err := stakingKeeper.UnbondingTime(s.providerCtx()) - s.Require().NoError(err) - checkRedelegationEntryCompletionTime( - s, - redelegations[0].Entries[0], - s.providerCtx().BlockTime().Add(unbondingTime), - ) - - // Save the current valset update ID - valsetUpdateID := providerKeeper.GetValidatorSetUpdateId(s.providerCtx()) - - // Check that CCV unbonding op was created from AfterUnbondingInitiated hook - checkCCVUnbondingOp(s, s.providerCtx(), s.consumerChain.ChainID, valsetUpdateID, true) - - // move forward by an epoch to be able to relay VSC packets - s.nextEpoch() - - // Relay 2 VSC packets from provider to consumer (original delegation, and redelegation) - relayAllCommittedPackets(s, s.providerChain, s.path, - ccv.ProviderPortID, s.path.EndpointB.ChannelID, 2) - - // Increment time so that the unbonding period ends on the provider - incrementTimeByUnbondingPeriod(s, Provider) - - // 1 redelegation record should still exist for original delegator on provider - checkRedelegations(s, delAddr, 1) - - // CCV unbonding op should also still exist - checkCCVUnbondingOp(s, s.providerCtx(), s.consumerChain.ChainID, valsetUpdateID, true) - - // Increment time so that the unbonding period ends on the consumer - incrementTimeByUnbondingPeriod(s, Consumer) - - // Relay 2 VSCMatured packets from consumer to provider (original delegation and redelegation) - relayAllCommittedPackets(s, s.consumerChain, - s.path, ccv.ConsumerPortID, s.path.EndpointA.ChannelID, 2) - - // - // Check that the redelegation operation has now completed on provider - // - - // Redelegation record should be deleted for original delegator - checkRedelegations(s, delAddr, 0) - - // Check that ccv unbonding op has been deleted - checkCCVUnbondingOp(s, s.providerCtx(), s.consumerChain.ChainID, valsetUpdateID, false) -} - -// This test reproduces a fixed bug when an inactive validator enters back into the active set. -// It used to cause a panic in the provider module hook called by AfterUnbondingInitiated -// during the staking module EndBlock. -func (s *CCVTestSuite) TestTooManyLastValidators() { - sk := s.providerApp.GetTestStakingKeeper() - pk := s.providerApp.GetProviderKeeper() - - getLastValsFn := func(ctx sdk.Context) []stakingtypes.Validator { - lastVals, err := pk.GetLastBondedValidators(s.providerCtx()) - s.Require().NoError(err) - return lastVals - } - - // get current staking params - p, err := sk.GetParams(s.providerCtx()) - s.Require().NoError(err) - - // get validators, which are all active at the moment - vals, err := sk.GetAllValidators(s.providerCtx()) - s.Require().NoError(err) - - s.Require().Equal(len(vals), len(getLastValsFn(s.providerCtx()))) - - // jail a validator - val := vals[0] - consAddr, err := val.GetConsAddr() - s.Require().NoError(err) - sk.Jail(s.providerCtx(), consAddr) - - // save the current number of bonded vals - lastVals := getLastValsFn(s.providerCtx()) - - // pass one block to apply the validator set changes - // (calls ApplyAndReturnValidatorSetUpdates in the the staking module EndBlock) - s.providerChain.NextBlock() - - // verify that the number of bonded validators is decreased by one - s.Require().Equal(len(lastVals)-1, len(getLastValsFn(s.providerCtx()))) - - // update maximum validator to equal the number of bonded validators - p.MaxValidators = uint32(len(getLastValsFn(s.providerCtx()))) - sk.SetParams(s.providerCtx(), p) - - // pass one block to apply validator set changes - s.providerChain.NextBlock() - - // unjail validator - // Note that since validators are sorted in descending order, the unjailed validator - // enters the active set again since it's ranked first by voting power. - sk.Unjail(s.providerCtx(), consAddr) - - // pass another block to update the validator set - // which causes a panic due to a GetLastValidator call in - // ApplyAndReturnValidatorSetUpdates where the staking module has a inconsistent state - s.Require().NotPanics(s.providerChain.NextBlock) - s.Require().NotPanics(func() { sk.ApplyAndReturnValidatorSetUpdates(s.providerCtx()) }) - s.Require().NotPanics(func() { getLastValsFn(s.providerCtx()) }) -} diff --git a/testutil/integration/debug_test.go b/testutil/integration/debug_test.go index d26246dcf5..022cc71429 100644 --- a/testutil/integration/debug_test.go +++ b/testutil/integration/debug_test.go @@ -49,14 +49,6 @@ func findAndCallMethod(t *testing.T, suite any, methodName string) { method.Func.Call([]reflect.Value{reflect.ValueOf(suite)}) } -// -// Channel init tests -// - -func TestInitTimeout(t *testing.T) { - runCCVTestByName(t, "TestInitTimeout") -} - // // Consumer democracy tests // @@ -201,28 +193,8 @@ func TestSlashAllValidators(t *testing.T) { // Unbonding tests // -func TestUndelegationNormalOperation(t *testing.T) { - runCCVTestByName(t, "TestUndelegationNormalOperation") -} - -func TestUndelegationVscTimeout(t *testing.T) { - runCCVTestByName(t, "TestUndelegationVscTimeout") -} - -func TestUndelegationDuringInit(t *testing.T) { - runCCVTestByName(t, "TestUndelegationDuringInit") -} - -func TestUnbondingNoConsumer(t *testing.T) { - runCCVTestByName(t, "TestUnbondingNoConsumer") -} - -func TestRedelegationNoConsumer(t *testing.T) { - runCCVTestByName(t, "TestRedelegationNoConsumer") -} - -func TestRedelegationProviderFirst(t *testing.T) { - runCCVTestByName(t, "TestRedelegationProviderFirst") +func TestUndelegationCompletion(t *testing.T) { + runCCVTestByName(t, "TestUndelegationCompletion") } // diff --git a/testutil/keeper/unit_test_helpers.go b/testutil/keeper/unit_test_helpers.go index 0fd86f3c1c..1e4eccb4d5 100644 --- a/testutil/keeper/unit_test_helpers.go +++ b/testutil/keeper/unit_test_helpers.go @@ -211,13 +211,6 @@ func GetNewSlashPacketData() types.SlashPacketData { } } -// Obtains vsc matured packet data with a newly generated key -func GetNewVSCMaturedPacketData() types.VSCMaturedPacketData { - b := make([]byte, 8) - _, _ = rand.Read(b) - return types.VSCMaturedPacketData{ValsetUpdateId: binary.BigEndian.Uint64(b)} -} - // SetupForStoppingConsumerChain registers expected mock calls and corresponding state setup // which assert that a consumer chain was properly setup to be later stopped from `StopConsumerChain`. // Note: This function only setups and tests that we correctly setup a consumer chain that we could later stop when @@ -259,10 +252,6 @@ func TestProviderStateIsCleanedAfterConsumerChainIsStopped(t *testing.T, ctx sdk require.False(t, found) acks := providerKeeper.GetSlashAcks(ctx, expectedChainID) require.Empty(t, acks) - _, found = providerKeeper.GetInitTimeoutTimestamp(ctx, expectedChainID) - require.False(t, found) - - require.Empty(t, providerKeeper.GetAllVscSendTimestamps(ctx, expectedChainID)) // in case the chain was successfully stopped, it should not contain a Top N associated to it _, found = providerKeeper.GetTopN(ctx, expectedChainID) diff --git a/x/ccv/provider/client/cli/query.go b/x/ccv/provider/client/cli/query.go index 4096d06ea5..84fbff3fd0 100644 --- a/x/ccv/provider/client/cli/query.go +++ b/x/ccv/provider/client/cli/query.go @@ -39,7 +39,6 @@ func NewQueryCmd() *cobra.Command { cmd.AddCommand(CmdConsumerValidators()) cmd.AddCommand(CmdConsumerChainsValidatorHasToValidate()) cmd.AddCommand(CmdValidatorConsumerCommissionRate()) - cmd.AddCommand(CmdOldestUnconfirmedVsc()) cmd.AddCommand(CmdBlocksUntilNextEpoch()) return cmd } @@ -571,33 +570,6 @@ $ %s validator-consumer-commission-rate foochain %s1gghjut3ccd8ay0zduzj64hwre2fx return cmd } -func CmdOldestUnconfirmedVsc() *cobra.Command { - cmd := &cobra.Command{ - Use: "oldest_unconfirmed_vsc [chainid]", - Short: "Query the send timestamp of the oldest unconfirmed VSCPacket by chain id", - Args: cobra.ExactArgs(1), - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx, err := client.GetClientQueryContext(cmd) - if err != nil { - return err - } - queryClient := types.NewQueryClient(clientCtx) - - req := types.QueryOldestUnconfirmedVscRequest{ChainId: args[0]} - res, err := queryClient.QueryOldestUnconfirmedVsc(cmd.Context(), &req) - if err != nil { - return err - } - - return clientCtx.PrintProto(&res.VscSendTimestamp) - }, - } - - flags.AddQueryFlagsToCmd(cmd) - - return cmd -} - func CmdBlocksUntilNextEpoch() *cobra.Command { cmd := &cobra.Command{ Use: "blocks-until-next-epoch", diff --git a/x/ccv/provider/ibc_module.go b/x/ccv/provider/ibc_module.go index f91f69e618..b41512e98a 100644 --- a/x/ccv/provider/ibc_module.go +++ b/x/ccv/provider/ibc_module.go @@ -197,13 +197,8 @@ func (am AppModule) OnRecvPacket( var err error switch consumerPacket.Type { case ccv.VscMaturedPacket: - // handle VSCMaturedPacket - data := *consumerPacket.GetVscMaturedPacketData() - err = am.keeper.OnRecvVSCMaturedPacket(ctx, packet, data) - if err == nil { - logger.Info("successfully handled VSCMaturedPacket", "sequence", packet.Sequence) - eventAttributes = append(eventAttributes, sdk.NewAttribute(ccv.AttributeValSetUpdateID, strconv.Itoa(int(data.ValsetUpdateId)))) - } + // ignore VSCMaturedPacket + err = nil case ccv.SlashPacket: // handle SlashPacket var ackResult ccv.PacketAckResult diff --git a/x/ccv/provider/ibc_module_test.go b/x/ccv/provider/ibc_module_test.go index fdae2a03ba..58573d3e3b 100644 --- a/x/ccv/provider/ibc_module_test.go +++ b/x/ccv/provider/ibc_module_test.go @@ -31,7 +31,7 @@ func TestOnChanOpenInit(t *testing.T) { providerKeeper, ctx, ctrl, _ := testkeeper.GetProviderKeeperAndCtx( t, keeperParams) defer ctrl.Finish() - providerModule := provider.NewAppModule(&providerKeeper, *keeperParams.ParamsSubspace) + providerModule := provider.NewAppModule(&providerKeeper, *keeperParams.ParamsSubspace, keeperParams.StoreKey) // OnChanOpenInit must error for provider even with correct arguments _, err := providerModule.OnChanOpenInit( @@ -119,7 +119,7 @@ func TestOnChanOpenTry(t *testing.T) { keeperParams := testkeeper.NewInMemKeeperParams(t) providerKeeper, ctx, ctrl, mocks := testkeeper.GetProviderKeeperAndCtx( t, keeperParams) - providerModule := provider.NewAppModule(&providerKeeper, *keeperParams.ParamsSubspace) + providerModule := provider.NewAppModule(&providerKeeper, *keeperParams.ParamsSubspace, keeperParams.StoreKey) providerKeeper.SetPort(ctx, ccv.ProviderPortID) providerKeeper.SetConsumerClientId(ctx, "consumerChainID", "clientIDToConsumer") @@ -190,7 +190,7 @@ func TestOnChanOpenAck(t *testing.T) { providerKeeper, ctx, ctrl, _ := testkeeper.GetProviderKeeperAndCtx( t, keeperParams) defer ctrl.Finish() - providerModule := provider.NewAppModule(&providerKeeper, *keeperParams.ParamsSubspace) + providerModule := provider.NewAppModule(&providerKeeper, *keeperParams.ParamsSubspace, keeperParams.StoreKey) // OnChanOpenAck must error for provider even with correct arguments err := providerModule.OnChanOpenAck( @@ -312,7 +312,7 @@ func TestOnChanOpenConfirm(t *testing.T) { providerKeeper.SetChainToChannel(ctx, "consumerChainID", "existingChannelID") } - providerModule := provider.NewAppModule(&providerKeeper, *keeperParams.ParamsSubspace) + providerModule := provider.NewAppModule(&providerKeeper, *keeperParams.ParamsSubspace, keeperParams.StoreKey) err := providerModule.OnChanOpenConfirm(ctx, "providerPortID", "channelID") diff --git a/x/ccv/provider/keeper/genesis.go b/x/ccv/provider/keeper/genesis.go index b965e3ed57..ffcd4e455a 100644 --- a/x/ccv/provider/keeper/genesis.go +++ b/x/ccv/provider/keeper/genesis.go @@ -39,15 +39,6 @@ func (k Keeper) InitGenesis(ctx sdk.Context, genState *types.GenesisState) { p := prop k.SetPendingConsumerRemovalProp(ctx, &p) } - for _, ubdOp := range genState.UnbondingOps { - k.SetUnbondingOp(ctx, ubdOp) - } - - // Note that MatureUnbondingOps aren't stored across blocks, but it - // might be used after implementing standalone to consumer transition - if genState.MatureUnbondingOps != nil { - k.AppendMaturedUnbondingOps(ctx, genState.MatureUnbondingOps.Ids) - } // Set initial state for each consumer chain for _, cs := range genState.ConsumerStates { @@ -58,9 +49,6 @@ func (k Keeper) InitGenesis(ctx sdk.Context, genState *types.GenesisState) { // the ConsumerGenesis validated in ConsumerState.Validate(). panic(fmt.Errorf("consumer chain genesis could not be persisted: %w", err)) } - for _, ubdOpIndex := range cs.UnbondingOpsIndex { - k.SetUnbondingOpIndex(ctx, chainID, ubdOpIndex.GetVscId(), ubdOpIndex.GetUnbondingOpIds()) - } // check if the CCV channel was established if cs.ChannelId != "" { k.SetChannelToChain(ctx, cs.ChannelId, chainID) @@ -84,20 +72,10 @@ func (k Keeper) InitGenesis(ctx sdk.Context, genState *types.GenesisState) { k.SetValidatorByConsumerAddr(ctx, item.ChainId, consumerAddr, providerAddr) } - for _, item := range genState.ConsumerAddrsToPrune { + for _, item := range genState.ConsumerAddrsToPruneV2 { for _, addr := range item.ConsumerAddrs.Addresses { consumerAddr := types.NewConsumerConsAddress(addr) - k.AppendConsumerAddrsToPrune(ctx, item.ChainId, item.VscId, consumerAddr) - } - } - - for _, item := range genState.InitTimeoutTimestamps { - k.SetInitTimeoutTimestamp(ctx, item.ChainId, item.Timestamp) - } - - for _, item := range genState.ExportedVscSendTimestamps { - for _, vscSendTimestamp := range item.VscSendTimestamps { - k.SetVscSendTimestamp(ctx, item.ChainId, vscSendTimestamp.VscId, vscSendTimestamp.Timestamp) + k.AppendConsumerAddrsToPrune(ctx, item.ChainId, item.PruneTs, consumerAddr) } } @@ -110,7 +88,6 @@ func (k Keeper) ExportGenesis(ctx sdk.Context) *types.GenesisState { // get a list of all registered consumer chains registeredChainIDs := k.GetAllRegisteredConsumerChainIDs(ctx) - var exportedVscSendTimestamps []types.ExportedVscSendTimestamp // export states for each consumer chains var consumerStates []types.ConsumerState for _, chainID := range registeredChainIDs { @@ -125,10 +102,9 @@ func (k Keeper) ExportGenesis(ctx sdk.Context) *types.GenesisState { // initial consumer chain states cs := types.ConsumerState{ - ChainId: chainID, - ClientId: clientID, - ConsumerGenesis: gen, - UnbondingOpsIndex: k.GetAllUnbondingOpIndexes(ctx, chainID), + ChainId: chainID, + ClientId: clientID, + ConsumerGenesis: gen, } // try to find channel id for the current consumer chain @@ -144,13 +120,10 @@ func (k Keeper) ExportGenesis(ctx sdk.Context) *types.GenesisState { cs.PendingValsetChanges = k.GetPendingVSCPackets(ctx, chainID) consumerStates = append(consumerStates, cs) - - vscSendTimestamps := k.GetAllVscSendTimestamps(ctx, chainID) - exportedVscSendTimestamps = append(exportedVscSendTimestamps, types.ExportedVscSendTimestamp{ChainId: chainID, VscSendTimestamps: vscSendTimestamps}) } // ConsumerAddrsToPrune are added only for registered consumer chains - consumerAddrsToPrune := []types.ConsumerAddrsToPrune{} + consumerAddrsToPrune := []types.ConsumerAddrsToPruneV2{} for _, chainID := range registeredChainIDs { consumerAddrsToPrune = append(consumerAddrsToPrune, k.GetAllConsumerAddrsToPrune(ctx, chainID)...) } @@ -161,15 +134,11 @@ func (k Keeper) ExportGenesis(ctx sdk.Context) *types.GenesisState { k.GetValidatorSetUpdateId(ctx), k.GetAllValsetUpdateBlockHeights(ctx), consumerStates, - k.GetAllUnbondingOps(ctx), - &types.MaturedUnbondingOps{Ids: k.GetMaturedUnbondingOps(ctx)}, k.GetAllPendingConsumerAdditionProps(ctx), k.GetAllPendingConsumerRemovalProps(ctx), params, k.GetAllValidatorConsumerPubKeys(ctx, nil), k.GetAllValidatorsByConsumerAddr(ctx, nil), consumerAddrsToPrune, - k.GetAllInitTimeoutTimestamps(ctx), - exportedVscSendTimestamps, ) } diff --git a/x/ccv/provider/keeper/genesis_test.go b/x/ccv/provider/keeper/genesis_test.go index 8fd22824ef..110252f208 100644 --- a/x/ccv/provider/keeper/genesis_test.go +++ b/x/ccv/provider/keeper/genesis_test.go @@ -1,7 +1,6 @@ package keeper_test import ( - "sort" "testing" "time" @@ -26,7 +25,6 @@ func TestInitAndExportGenesis(t *testing.T) { expClientID := "client" oneHourFromNow := time.Now().UTC().Add(time.Hour) initHeight, vscID := uint64(5), uint64(1) - ubdIndex := []uint64{0, 1, 2} params := providertypes.DefaultParams() // create validator keys and addresses for key assignment @@ -37,32 +35,6 @@ func TestInitAndExportGenesis(t *testing.T) { consumerTmPubKey := consumerCryptoId.TMProtoCryptoPublicKey() consumerConsAddr := consumerCryptoId.ConsumerConsAddress() - initTimeoutTimeStamps := []providertypes.InitTimeoutTimestamp{ - {ChainId: cChainIDs[0], Timestamp: uint64(time.Now().UTC().UnixNano()) + 10}, - {ChainId: cChainIDs[1], Timestamp: uint64(time.Now().UTC().UnixNano()) + 15}, - } - - now := time.Now().UTC() - exportedVscSendTimeStampsC0 := providertypes.ExportedVscSendTimestamp{ - ChainId: "c0", - VscSendTimestamps: []providertypes.VscSendTimestamp{ - {VscId: 1, Timestamp: now.Add(time.Hour)}, - {VscId: 2, Timestamp: now.Add(2 * time.Hour)}, - }, - } - - exportedVscSendTimeStampsC1 := providertypes.ExportedVscSendTimestamp{ - ChainId: "c1", - VscSendTimestamps: []providertypes.VscSendTimestamp{ - {VscId: 1, Timestamp: now.Add(-time.Hour)}, - {VscId: 2, Timestamp: now.Add(time.Hour)}, - }, - } - - var exportedVscSendTimeStampsAll []providertypes.ExportedVscSendTimestamp - exportedVscSendTimeStampsAll = append(exportedVscSendTimeStampsAll, exportedVscSendTimeStampsC0) - exportedVscSendTimeStampsAll = append(exportedVscSendTimeStampsAll, exportedVscSendTimeStampsC1) - // create genesis struct provGenesis := providertypes.NewGenesisState(vscID, []providertypes.ValsetUpdateIdToHeight{{ValsetUpdateId: vscID, Height: initHeight}}, @@ -73,9 +45,6 @@ func TestInitAndExportGenesis(t *testing.T) { "channel", initHeight, *ccv.DefaultConsumerGenesisState(), - []providertypes.VscUnbondingOps{ - {VscId: vscID, UnbondingOpIds: ubdIndex}, - }, []ccv.ValidatorSetChangePacketData{}, []string{"slashedValidatorConsAddress"}, ), @@ -85,16 +54,10 @@ func TestInitAndExportGenesis(t *testing.T) { "", 0, *ccv.DefaultConsumerGenesisState(), - nil, []ccv.ValidatorSetChangePacketData{{ValsetUpdateId: vscID}}, nil, ), }, - []providertypes.UnbondingOp{{ - Id: vscID, - UnbondingConsumerChains: []string{cChainIDs[0]}, - }}, - &providertypes.MaturedUnbondingOps{Ids: ubdIndex}, []providertypes.ConsumerAdditionProposal{{ ChainId: cChainIDs[0], SpawnTime: oneHourFromNow, @@ -118,15 +81,13 @@ func TestInitAndExportGenesis(t *testing.T) { ConsumerAddr: consumerConsAddr.ToSdkConsAddr(), }, }, - []providertypes.ConsumerAddrsToPrune{ + []providertypes.ConsumerAddrsToPruneV2{ { ChainId: cChainIDs[0], - VscId: vscID, + PruneTs: oneHourFromNow, ConsumerAddrs: &providertypes.AddressList{Addresses: [][]byte{consumerConsAddr.ToSdkConsAddr()}}, }, }, - initTimeoutTimeStamps, - exportedVscSendTimeStampsAll, ) // Instantiate in-mem provider keeper with mocks @@ -157,11 +118,6 @@ func TestInitAndExportGenesis(t *testing.T) { require.Equal(t, expectedCandidate, pk.GetSlashMeterReplenishTimeCandidate(ctx)) // check local provider chain states - ubdOps, found := pk.GetUnbondingOp(ctx, vscID) - require.True(t, found) - require.Equal(t, provGenesis.UnbondingOps[0], ubdOps) - matureUbdOps := pk.GetMaturedUnbondingOps(ctx) - require.Equal(t, ubdIndex, matureUbdOps) chainID, found := pk.GetChannelToChain(ctx, provGenesis.ConsumerStates[0].ChannelId) require.True(t, found) require.Equal(t, cChainIDs[0], chainID) @@ -183,7 +139,7 @@ func TestInitAndExportGenesis(t *testing.T) { require.True(t, found) require.Equal(t, provAddr, providerAddr) - addrs := pk.GetConsumerAddrsToPrune(ctx, cChainIDs[0], vscID) + addrs := pk.GetConsumerAddrsToPrune(ctx, cChainIDs[0], oneHourFromNow) // Expect same list as what was provided in provGenesis expectedAddrList := providertypes.AddressList{Addresses: [][]byte{consumerConsAddr.ToSdkConsAddr()}} require.Equal(t, expectedAddrList, addrs) @@ -193,24 +149,6 @@ func TestInitAndExportGenesis(t *testing.T) { // check the exported genesis require.Equal(t, provGenesis, pk.ExportGenesis(ctx)) - - initTimeoutTimestampInStore := pk.GetAllInitTimeoutTimestamps(ctx) - sort.Slice(initTimeoutTimestampInStore, func(i, j int) bool { - return initTimeoutTimestampInStore[i].Timestamp < initTimeoutTimestampInStore[j].Timestamp - }) - require.Equal(t, initTimeoutTimestampInStore, initTimeoutTimeStamps) - - vscSendTimestampsC0InStore := pk.GetAllVscSendTimestamps(ctx, cChainIDs[0]) - sort.Slice(vscSendTimestampsC0InStore, func(i, j int) bool { - return vscSendTimestampsC0InStore[i].VscId < vscSendTimestampsC0InStore[j].VscId - }) - require.Equal(t, vscSendTimestampsC0InStore, exportedVscSendTimeStampsC0.VscSendTimestamps) - - vscSendTimestampsC1InStore := pk.GetAllVscSendTimestamps(ctx, cChainIDs[1]) - sort.Slice(vscSendTimestampsC1InStore, func(i, j int) bool { - return vscSendTimestampsC1InStore[i].VscId < vscSendTimestampsC1InStore[j].VscId - }) - require.Equal(t, vscSendTimestampsC1InStore, exportedVscSendTimeStampsC1.VscSendTimestamps) } func assertConsumerChainStates(t *testing.T, ctx sdk.Context, pk keeper.Keeper, consumerStates ...providertypes.ConsumerState) { @@ -241,12 +179,6 @@ func assertConsumerChainStates(t *testing.T, ctx sdk.Context, pk keeper.Keeper, require.Equal(t, expVSC, gotVSC) } - for _, ubdOpIdx := range cs.UnbondingOpsIndex { - ubdIndex, found := pk.GetUnbondingOpIndex(ctx, chainID, ubdOpIdx.VscId) - require.True(t, found) - require.Equal(t, ubdOpIdx.UnbondingOpIds, ubdIndex) - } - require.Equal(t, cs.SlashDowntimeAck, pk.GetSlashAcks(ctx, chainID)) } } diff --git a/x/ccv/provider/keeper/grpc_query.go b/x/ccv/provider/keeper/grpc_query.go index 3ac0a4b63e..1748e1eebc 100644 --- a/x/ccv/provider/keeper/grpc_query.go +++ b/x/ccv/provider/keeper/grpc_query.go @@ -458,37 +458,6 @@ func (k Keeper) QueryValidatorConsumerCommissionRate(goCtx context.Context, req return res, nil } -func (k Keeper) QueryOldestUnconfirmedVsc(goCtx context.Context, req *types.QueryOldestUnconfirmedVscRequest) (*types.QueryOldestUnconfirmedVscResponse, error) { - ctx := sdk.UnwrapSDKContext(goCtx) - - if req == nil { - return nil, status.Errorf(codes.InvalidArgument, "empty request") - } - - if req.ChainId == "" { - return nil, status.Errorf(codes.InvalidArgument, "invalid request: chain id cannot be empty") - } - - if _, consumerRegistered := k.GetConsumerClientId(ctx, req.ChainId); !consumerRegistered { - return nil, status.Error( - codes.NotFound, - errorsmod.Wrap(types.ErrUnknownConsumerChainId, req.ChainId).Error(), - ) - } - - // Note that GetFirstVscSendTimestamp returns the send timestamp of the oldest - // unconfirmed VSCPacket as these timestamps are deleted when handling VSCMaturedPackets - ts, found := k.GetFirstVscSendTimestamp(ctx, req.ChainId) - if !found { - return nil, status.Error( - codes.NotFound, - errorsmod.Wrap(types.ErrNoUnconfirmedVSCPacket, req.ChainId).Error(), - ) - } - - return &types.QueryOldestUnconfirmedVscResponse{VscSendTimestamp: ts}, nil -} - // QueryBlocksUntilNextEpoch returns the number of blocks until the next epoch func (k Keeper) QueryBlocksUntilNextEpoch(goCtx context.Context, req *types.QueryBlocksUntilNextEpochRequest) (*types.QueryBlocksUntilNextEpochResponse, error) { ctx := sdk.UnwrapSDKContext(goCtx) diff --git a/x/ccv/provider/keeper/grpc_query_test.go b/x/ccv/provider/keeper/grpc_query_test.go index ebc4557227..4457ecb38e 100644 --- a/x/ccv/provider/keeper/grpc_query_test.go +++ b/x/ccv/provider/keeper/grpc_query_test.go @@ -3,7 +3,6 @@ package keeper_test import ( "fmt" "testing" - "time" "cosmossdk.io/math" "github.com/cometbft/cometbft/proto/tendermint/crypto" @@ -65,49 +64,6 @@ func TestQueryAllPairsValConAddrByConsumerChainID(t *testing.T) { require.Equal(t, &expectedResult, response.PairValConAddr[0]) } -func TestQueryOldestUnconfirmedVsc(t *testing.T) { - chainID := consumer - - pk, ctx, ctrl, _ := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) - defer ctrl.Finish() - - now := time.Now().UTC() - pk.SetVscSendTimestamp(ctx, chainID, 2, now) - pk.SetVscSendTimestamp(ctx, chainID, 1, now) - pk.SetConsumerClientId(ctx, chainID, "client-1") - - // Request is nil - _, err := pk.QueryOldestUnconfirmedVsc(ctx, nil) - require.Error(t, err) - - // Request with chainId is empty - _, err = pk.QueryOldestUnconfirmedVsc(ctx, &types.QueryOldestUnconfirmedVscRequest{}) - require.Error(t, err) - - // Request with chainId is invalid - _, err = pk.QueryOldestUnconfirmedVsc(ctx, &types.QueryOldestUnconfirmedVscRequest{ChainId: "invalidChainId"}) - require.Error(t, err) - - // Request is valid - response, err := pk.QueryOldestUnconfirmedVsc(ctx, &types.QueryOldestUnconfirmedVscRequest{ChainId: chainID}) - require.NoError(t, err) - expectedResult := types.VscSendTimestamp{ - VscId: 1, - Timestamp: now, - } - require.Equal(t, expectedResult, response.VscSendTimestamp) - - // Make sure that the oldest is queried - pk.DeleteVscSendTimestamp(ctx, chainID, 1) - response, err = pk.QueryOldestUnconfirmedVsc(ctx, &types.QueryOldestUnconfirmedVscRequest{ChainId: chainID}) - require.NoError(t, err) - expectedResult = types.VscSendTimestamp{ - VscId: 2, - Timestamp: now, - } - require.Equal(t, expectedResult, response.VscSendTimestamp) -} - func TestQueryConsumerChainOptedInValidators(t *testing.T) { chainID := "chainID" diff --git a/x/ccv/provider/keeper/hooks.go b/x/ccv/provider/keeper/hooks.go index e0b4a066c6..15d5d0e769 100644 --- a/x/ccv/provider/keeper/hooks.go +++ b/x/ccv/provider/keeper/hooks.go @@ -33,105 +33,7 @@ func (k *Keeper) Hooks() Hooks { // staking hooks // -// This stores a record of each unbonding op from staking, allowing us to track which consumer chains have unbonded func (h Hooks) AfterUnbondingInitiated(goCtx context.Context, id uint64) error { - var consumerChainIDS []string - - ctx := sdk.UnwrapSDKContext(goCtx) - - // get validator address from unbonding operation - unbondingType, err := h.k.stakingKeeper.GetUnbondingType(ctx, id) - vadAddrBech32 := "" - if err != nil { - ctx.Logger().Error("undefined type for unbonding operation: id: %d: %s", id, err) - return nil - } - - switch unbondingType { - case stakingtypes.UnbondingType_UnbondingDelegation: - ubd, err := h.k.stakingKeeper.GetUnbondingDelegationByUnbondingID(ctx, id) - if err != nil { - ctx.Logger().Error("unfound ubonding delegation for unbonding id: %d: %s", id, err) - return nil - } - vadAddrBech32 = ubd.ValidatorAddress - case stakingtypes.UnbondingType_Redelegation: - red, err := h.k.stakingKeeper.GetRedelegationByUnbondingID(ctx, id) - if err != nil { - ctx.Logger().Error("unfound relegation for unbonding operation id: %d: %s", id, err) - return nil - } - vadAddrBech32 = red.ValidatorSrcAddress - case stakingtypes.UnbondingType_ValidatorUnbonding: - val, err := h.k.stakingKeeper.GetValidatorByUnbondingID(ctx, id) - if err != nil { - ctx.Logger().Error("unfound validator for unbonding operation id: %d: %s", id, err) - return nil - } - vadAddrBech32 = val.OperatorAddress - default: - ctx.Logger().Error("invalid unbonding operation type: %s", unbondingType) - return nil - } - - valAddr, err := sdk.ValAddressFromBech32(vadAddrBech32) - if err != nil { - ctx.Logger().Error(err.Error()) - return nil - } - - validator, err := h.k.stakingKeeper.GetValidator(ctx, valAddr) - if err != nil { - ctx.Logger().Error("unfound validator for validator address: %s: %s", vadAddrBech32, err) - return nil - } - - consAddr, err := validator.GetConsAddr() - if err != nil { - ctx.Logger().Error(err.Error()) - return nil - } - - // get all consumers where the validator is in the validator set - for _, chainID := range h.k.GetAllRegisteredConsumerChainIDs(ctx) { - if h.k.IsConsumerValidator(ctx, chainID, providertypes.NewProviderConsAddress(consAddr)) { - consumerChainIDS = append(consumerChainIDS, chainID) - } - } - - if len(consumerChainIDS) == 0 { - // Do not put the unbonding op on hold if there are no consumer chains - return nil - } - - valsetUpdateID := h.k.GetValidatorSetUpdateId(ctx) - unbondingOp := providertypes.UnbondingOp{ - Id: id, - UnbondingConsumerChains: consumerChainIDS, - } - - // Add to indexes - for _, consumerChainID := range consumerChainIDS { - index, _ := h.k.GetUnbondingOpIndex(ctx, consumerChainID, valsetUpdateID) - index = append(index, id) - h.k.SetUnbondingOpIndex(ctx, consumerChainID, valsetUpdateID, index) - } - - h.k.SetUnbondingOp(ctx, unbondingOp) - - // Call back into staking to tell it to stop this op from unbonding when the unbonding period is complete - if err := h.k.stakingKeeper.PutUnbondingOnHold(ctx, id); err != nil { - // If there was an error putting the unbonding on hold, panic to end execution for - // the current tx and prevent committal of this invalid state. - // - // Note: that in the case of a validator unbonding, AfterUnbondingInitiated is called - // from staking.EndBlock, thus the following panic would halt the chain. - - // In this case PutUnbondingOnHold fails if either the unbonding operation was - // not found or the UnbondingOnHoldRefCount is negative. In either cases, - // the state of the x/staking module of cosmos-sdk is invalid. - panic(fmt.Errorf("unbonding could not be put on hold: %w", err)) - } return nil } diff --git a/x/ccv/provider/keeper/keeper.go b/x/ccv/provider/keeper/keeper.go index e8cb9f8bbf..7f1e633e24 100644 --- a/x/ccv/provider/keeper/keeper.go +++ b/x/ccv/provider/keeper/keeper.go @@ -426,8 +426,6 @@ func (k Keeper) SetConsumerChain(ctx sdk.Context, channelID string) error { k.SetChannelToChain(ctx, channelID, chainID) // - set current block height for the consumer chain initialization k.SetInitChainHeight(ctx, chainID, uint64(ctx.BlockHeight())) - // - remove init timeout timestamp - k.DeleteInitTimeoutTimestamp(ctx, chainID) // emit event on successful addition ctx.EventManager().EmitEvent( @@ -443,261 +441,6 @@ func (k Keeper) SetConsumerChain(ctx sdk.Context, channelID string) error { return nil } -// SetUnbondingOp sets the UnbondingOp by its unique ID -func (k Keeper) SetUnbondingOp(ctx sdk.Context, unbondingOp types.UnbondingOp) { - store := ctx.KVStore(k.storeKey) - bz, err := unbondingOp.Marshal() - if err != nil { - // An error here would indicate something is very wrong, - // unbondingOp is either instantiated in AfterUnbondingInitiated, - // updated correctly by RemoveConsumerFromUnbondingOp, - // or set during InitGenesis. - panic(fmt.Errorf("unbonding op could not be marshaled: %w", err)) - } - store.Set(types.UnbondingOpKey(unbondingOp.Id), bz) -} - -// GetUnbondingOp gets a UnbondingOp by its unique ID -func (k Keeper) GetUnbondingOp(ctx sdk.Context, id uint64) (types.UnbondingOp, bool) { - store := ctx.KVStore(k.storeKey) - bz := store.Get(types.UnbondingOpKey(id)) - if bz == nil { - return types.UnbondingOp{}, false - } - - var unbondingOp types.UnbondingOp - if err := unbondingOp.Unmarshal(bz); err != nil { - // An error here would indicate something is very wrong, - // the UnbondingOp is assumed to be correctly serialized in SetUnbondingOp. - panic(fmt.Errorf("failed to unmarshal UnbondingOp: %w", err)) - } - - return unbondingOp, true -} - -// DeleteUnbondingOp deletes a UnbondingOp given its ID -func (k Keeper) DeleteUnbondingOp(ctx sdk.Context, id uint64) { - store := ctx.KVStore(k.storeKey) - store.Delete(types.UnbondingOpKey(id)) -} - -// GetAllUnbondingOps gets all UnbondingOps, where each UnbondingOp consists -// of its unique ID and a list of consumer chainIDs that the unbonding operation -// is waiting on. -// -// Note that UnbondingOps are stored under keys with the following format: -// UnbondingOpKeyPrefix | ID -// Thus, the iteration is in ascending order of IDs. -func (k Keeper) GetAllUnbondingOps(ctx sdk.Context) (ops []types.UnbondingOp) { - store := ctx.KVStore(k.storeKey) - iterator := storetypes.KVStorePrefixIterator(store, types.UnbondingOpKeyPrefix()) - - defer iterator.Close() - for ; iterator.Valid(); iterator.Next() { - id := binary.BigEndian.Uint64(iterator.Key()[1:]) - bz := iterator.Value() - if bz == nil { - // An error here would indicate something is very wrong, - // the UnbondingOp is assumed to be correctly set in SetUnbondingOp. - panic(fmt.Errorf("unbonding operation is nil for id %d", id)) - } - var unbondingOp types.UnbondingOp - if err := unbondingOp.Unmarshal(bz); err != nil { - // An error here would indicate something is very wrong, - // the UnbondingOp is assumed to be correctly serialized in SetUnbondingOp. - panic(fmt.Errorf("failed to unmarshal UnbondingOp: %w", err)) - } - - ops = append(ops, unbondingOp) - } - - return ops -} - -// RemoveConsumerFromUnbondingOp removes a consumer chain ID that the unbonding op with 'id' is waiting on. -// The method returns true if the unbonding op can complete. In this case the record is removed from store. -// The method panics if the unbonding op with 'id' is not found. -func (k Keeper) RemoveConsumerFromUnbondingOp(ctx sdk.Context, id uint64, chainID string) (canComplete bool) { - // Get the unbonding op from store - unbondingOp, found := k.GetUnbondingOp(ctx, id) - if !found { - panic(fmt.Errorf("internal state corrupted; could not find UnbondingOp with ID %d", id)) - } - - // Remove consumer chain ID from unbonding op - var numRemoved int - unbondingOp.UnbondingConsumerChains, numRemoved = removeStringFromSlice(unbondingOp.UnbondingConsumerChains, chainID) - if numRemoved > 0 { - k.Logger(ctx).Debug("unbonding operation matured on consumer", "chainID", chainID, "opID", id) - - if len(unbondingOp.UnbondingConsumerChains) == 0 { - // Delete unbonding op - k.DeleteUnbondingOp(ctx, id) - // No more consumer chains; the unbonding op can complete - canComplete = true - } else { - // Update unbonding op in store - k.SetUnbondingOp(ctx, unbondingOp) - } - } - return -} - -func removeStringFromSlice(slice []string, x string) (newSlice []string, numRemoved int) { - for _, y := range slice { - if x != y { - newSlice = append(newSlice, y) - } - } - - return newSlice, len(slice) - len(newSlice) -} - -// SetUnbondingOpIndex sets the IDs of unbonding operations that are waiting for -// a VSCMaturedPacket with vscID from a consumer with chainID -func (k Keeper) SetUnbondingOpIndex(ctx sdk.Context, chainID string, vscID uint64, ids []uint64) { - store := ctx.KVStore(k.storeKey) - - vscUnbondingOps := types.VscUnbondingOps{ - VscId: vscID, - UnbondingOpIds: ids, - } - bz, err := vscUnbondingOps.Marshal() - if err != nil { - // An error here would indicate something is very wrong, - // vscUnbondingOps is instantiated in this method and should be able to be marshaled. - panic(fmt.Errorf("failed to marshal VscUnbondingOps: %w", err)) - } - - store.Set(types.UnbondingOpIndexKey(chainID, vscID), bz) -} - -// GetAllUnbondingOpIndexes gets all unbonding indexes for a given chain id, -// i.e., all the IDs of unbonding operations that are waiting for -// VSCMaturedPackets from a consumer with chainID. -// -// Note that the unbonding indexes for a given chainID are stored under keys with the following format: -// UnbondingOpIndexKeyPrefix | len(chainID) | chainID | vscID -// Thus, the returned array is in ascending order of vscIDs. -func (k Keeper) GetAllUnbondingOpIndexes(ctx sdk.Context, chainID string) (indexes []types.VscUnbondingOps) { - store := ctx.KVStore(k.storeKey) - bytePrefix := types.UnbondingOpIndexKeyPrefix() - iterator := storetypes.KVStorePrefixIterator(store, types.ChainIdWithLenKey(bytePrefix, chainID)) - defer iterator.Close() - - for ; iterator.Valid(); iterator.Next() { - var vscUnbondingOps types.VscUnbondingOps - if err := vscUnbondingOps.Unmarshal(iterator.Value()); err != nil { - // An error here would indicate something is very wrong, - // the VscUnbondingOps are assumed to be correctly serialized in SetUnbondingOpIndex. - panic(fmt.Errorf("failed to unmarshal VscUnbondingOps: %w", err)) - } - - indexes = append(indexes, types.VscUnbondingOps{ - VscId: vscUnbondingOps.GetVscId(), - UnbondingOpIds: vscUnbondingOps.GetUnbondingOpIds(), - }) - } - - return indexes -} - -// GetUnbondingOpIndex gets the IDs of unbonding operations that are waiting for -// a VSCMaturedPacket with vscID from a consumer with chainID -func (k Keeper) GetUnbondingOpIndex(ctx sdk.Context, chainID string, vscID uint64) ([]uint64, bool) { - store := ctx.KVStore(k.storeKey) - - bz := store.Get(types.UnbondingOpIndexKey(chainID, vscID)) - if bz == nil { - return []uint64{}, false - } - - var vscUnbondingOps types.VscUnbondingOps - if err := vscUnbondingOps.Unmarshal(bz); err != nil { - // An error here would indicate something is very wrong, - // the VscUnbondingOps are assumed to be correctly serialized in SetUnbondingOpIndex. - panic(fmt.Errorf("failed to unmarshal VscUnbondingOps: %w", err)) - } - - return vscUnbondingOps.GetUnbondingOpIds(), true -} - -// DeleteUnbondingOpIndex deletes the IDs of unbonding operations that are waiting for -// a VSCMaturedPacket with vscID from a consumer with chainID -func (k Keeper) DeleteUnbondingOpIndex(ctx sdk.Context, chainID string, vscID uint64) { - store := ctx.KVStore(k.storeKey) - store.Delete(types.UnbondingOpIndexKey(chainID, vscID)) -} - -// GetUnbondingOpsFromIndex gets the unbonding ops waiting for a given chainID and vscID -func (k Keeper) GetUnbondingOpsFromIndex(ctx sdk.Context, chainID string, valsetUpdateID uint64) (entries []types.UnbondingOp) { - ids, found := k.GetUnbondingOpIndex(ctx, chainID, valsetUpdateID) - if !found { - return entries - } - for _, id := range ids { - entry, found := k.GetUnbondingOp(ctx, id) - if !found { - // An error here would indicate something is very wrong. - // Every UnbondingOpIndex is assumed to have the corresponding UnbondingOps set in store. - // This is done in AfterUnbondingInitiated and InitGenesis. - panic("did not find UnbondingOp according to index- index was probably not correctly updated") - } - entries = append(entries, entry) - } - - return entries -} - -// GetMaturedUnbondingOps returns the list of matured unbonding operation ids -func (k Keeper) GetMaturedUnbondingOps(ctx sdk.Context) (ids []uint64) { - store := ctx.KVStore(k.storeKey) - bz := store.Get(types.MaturedUnbondingOpsKey()) - if bz == nil { - // Note that every call to ConsumeMaturedUnbondingOps - // deletes the MaturedUnbondingOpsKey, which means that - // the first call to GetMaturedUnbondingOps after that - // will enter this branch. - return nil - } - - var ops types.MaturedUnbondingOps - if err := ops.Unmarshal(bz); err != nil { - // An error here would indicate something is very wrong, - // the MaturedUnbondingOps are assumed to be correctly serialized in AppendMaturedUnbondingOps. - panic(fmt.Errorf("failed to unmarshal MaturedUnbondingOps: %w", err)) - } - return ops.GetIds() -} - -// AppendMaturedUnbondingOps adds a list of ids to the list of matured unbonding operation ids -func (k Keeper) AppendMaturedUnbondingOps(ctx sdk.Context, ids []uint64) { - if len(ids) == 0 { - return - } - existingIds := k.GetMaturedUnbondingOps(ctx) - maturedOps := types.MaturedUnbondingOps{ - Ids: append(existingIds, ids...), - } - - store := ctx.KVStore(k.storeKey) - bz, err := maturedOps.Marshal() - if err != nil { - // An error here would indicate something is very wrong, - // maturedOps is instantiated in this method and should be able to be marshaled. - panic(fmt.Sprintf("failed to marshal matured unbonding operations: %s", err)) - } - store.Set(types.MaturedUnbondingOpsKey(), bz) -} - -// ConsumeMaturedUnbondingOps empties and returns list of matured unbonding operation ids (if it exists) -func (k Keeper) ConsumeMaturedUnbondingOps(ctx sdk.Context) []uint64 { - ids := k.GetMaturedUnbondingOps(ctx) - store := ctx.KVStore(k.storeKey) - store.Delete(types.MaturedUnbondingOpsKey()) - return ids -} - // Retrieves the underlying client state corresponding to a connection ID. func (k Keeper) getUnderlyingClient(ctx sdk.Context, connectionID string) ( clientID string, tmClient *ibctmtypes.ClientState, err error, @@ -955,175 +698,6 @@ func (k Keeper) DeleteConsumerClientId(ctx sdk.Context, chainID string) { store.Delete(types.ChainToClientKey(chainID)) } -// SetInitTimeoutTimestamp sets the init timeout timestamp for the given chain ID -func (k Keeper) SetInitTimeoutTimestamp(ctx sdk.Context, chainID string, ts uint64) { - store := ctx.KVStore(k.storeKey) - tsBytes := make([]byte, 8) - binary.BigEndian.PutUint64(tsBytes, ts) - store.Set(types.InitTimeoutTimestampKey(chainID), tsBytes) -} - -// GetInitTimeoutTimestamp returns the init timeout timestamp for the given chain ID. -// This method is used only in testing. -func (k Keeper) GetInitTimeoutTimestamp(ctx sdk.Context, chainID string) (uint64, bool) { - store := ctx.KVStore(k.storeKey) - bz := store.Get(types.InitTimeoutTimestampKey(chainID)) - if bz == nil { - return 0, false - } - return binary.BigEndian.Uint64(bz), true -} - -// DeleteInitTimeoutTimestamp removes from the store the init timeout timestamp for the given chainID. -func (k Keeper) DeleteInitTimeoutTimestamp(ctx sdk.Context, chainID string) { - store := ctx.KVStore(k.storeKey) - store.Delete(types.InitTimeoutTimestampKey(chainID)) -} - -// GetAllInitTimeoutTimestamps gets all init timeout timestamps in the store. -// -// Note that the init timeout timestamps are stored under keys with the following format: -// InitTimeoutTimestampKeyPrefix | chainID -// Thus, the returned array is in ascending order of chainIDs (NOT in timestamp order). -func (k Keeper) GetAllInitTimeoutTimestamps(ctx sdk.Context) (initTimeoutTimestamps []types.InitTimeoutTimestamp) { - store := ctx.KVStore(k.storeKey) - iterator := storetypes.KVStorePrefixIterator(store, types.InitTimeoutTimestampKeyPrefix()) - - defer iterator.Close() - for ; iterator.Valid(); iterator.Next() { - chainID := string(iterator.Key()[1:]) - ts := binary.BigEndian.Uint64(iterator.Value()) - - initTimeoutTimestamps = append(initTimeoutTimestamps, types.InitTimeoutTimestamp{ - ChainId: chainID, - Timestamp: ts, - }) - } - - return initTimeoutTimestamps -} - -// SetVscSendTimestamp sets the VSC send timestamp -// for a VSCPacket with ID vscID sent to a chain with ID chainID -func (k Keeper) SetVscSendTimestamp( - ctx sdk.Context, - chainID string, - vscID uint64, - timestamp time.Time, -) { - store := ctx.KVStore(k.storeKey) - - // Convert timestamp into bytes for storage - timeBz := sdk.FormatTimeBytes(timestamp) - - store.Set(types.VscSendingTimestampKey(chainID, vscID), timeBz) -} - -// GetVscSendTimestamp returns a VSC send timestamp by chainID and vscID -// -// Note: This method is used only for testing. -func (k Keeper) GetVscSendTimestamp(ctx sdk.Context, chainID string, vscID uint64) (time.Time, bool) { - store := ctx.KVStore(k.storeKey) - - timeBz := store.Get(types.VscSendingTimestampKey(chainID, vscID)) - if timeBz == nil { - return time.Time{}, false - } - - ts, err := sdk.ParseTimeBytes(timeBz) - if err != nil { - return time.Time{}, false - } - return ts, true -} - -// DeleteVscSendTimestamp removes from the store a specific VSC send timestamp -// for the given chainID and vscID. -func (k Keeper) DeleteVscSendTimestamp(ctx sdk.Context, chainID string, vscID uint64) { - store := ctx.KVStore(k.storeKey) - store.Delete(types.VscSendingTimestampKey(chainID, vscID)) -} - -// GetAllVscSendTimestamps gets an array of all the vsc send timestamps of the given chainID. -// -// Note that the vsc send timestamps of a given chainID are stored under keys with the following format: -// VscSendTimestampKeyPrefix | len(chainID) | chainID | vscID -// Thus, the iteration is in ascending order of vscIDs, and as a result in send timestamp order. -func (k Keeper) GetAllVscSendTimestamps(ctx sdk.Context, chainID string) (vscSendTimestamps []types.VscSendTimestamp) { - store := ctx.KVStore(k.storeKey) - iterator := storetypes.KVStorePrefixIterator(store, types.ChainIdWithLenKey(types.VscSendingTimestampKeyPrefix(), chainID)) - defer iterator.Close() - - for ; iterator.Valid(); iterator.Next() { - _, vscID, err := types.ParseVscSendingTimestampKey(iterator.Key()) - if err != nil { - // An error here would indicate something is very wrong, - // the store key is assumed to be correctly serialized in SetVscSendTimestamp. - panic(fmt.Errorf("failed to parse VscSendTimestampKey: %w", err)) - } - ts, err := sdk.ParseTimeBytes(iterator.Value()) - if err != nil { - // An error here would indicate something is very wrong, - // the timestamp is assumed to be correctly serialized in SetVscSendTimestamp. - panic(fmt.Errorf("failed to parse timestamp value: %w", err)) - } - - vscSendTimestamps = append(vscSendTimestamps, types.VscSendTimestamp{ - VscId: vscID, - Timestamp: ts, - }) - } - - return vscSendTimestamps -} - -// DeleteVscSendTimestampsForConsumer deletes all VSC send timestamps for a given consumer chain -func (k Keeper) DeleteVscSendTimestampsForConsumer(ctx sdk.Context, consumerChainID string) { - store := ctx.KVStore(k.storeKey) - iterator := storetypes.KVStorePrefixIterator(store, types.ChainIdWithLenKey(types.VscSendingTimestampKeyPrefix(), consumerChainID)) - - defer iterator.Close() - - keysToDel := [][]byte{} - for ; iterator.Valid(); iterator.Next() { - keysToDel = append(keysToDel, iterator.Key()) - } - - // Delete data for this consumer - for _, key := range keysToDel { - store.Delete(key) - } -} - -// GetFirstVscSendTimestamp gets the vsc send timestamp with the lowest vscID for the given chainID. -func (k Keeper) GetFirstVscSendTimestamp(ctx sdk.Context, chainID string) (vscSendTimestamp types.VscSendTimestamp, found bool) { - store := ctx.KVStore(k.storeKey) - iterator := storetypes.KVStorePrefixIterator(store, types.ChainIdWithLenKey(types.VscSendingTimestampKeyPrefix(), chainID)) - defer iterator.Close() - - if iterator.Valid() { - _, vscID, err := types.ParseVscSendingTimestampKey(iterator.Key()) - if err != nil { - // An error here would indicate something is very wrong, - // the store key is assumed to be correctly serialized in SetVscSendTimestamp. - panic(fmt.Errorf("failed to parse VscSendTimestampKey: %w", err)) - } - ts, err := sdk.ParseTimeBytes(iterator.Value()) - if err != nil { - // An error here would indicate something is very wrong, - // the timestamp is assumed to be correctly serialized in SetVscSendTimestamp. - panic(fmt.Errorf("failed to parse timestamp value: %w", err)) - } - - return types.VscSendTimestamp{ - VscId: vscID, - Timestamp: ts, - }, true - } - - return types.VscSendTimestamp{}, false -} - // SetSlashLog updates validator's slash log for a consumer chain // If an entry exists for a given validator address, at least one // double signing slash packet was received by the provider from at least one consumer chain @@ -1583,3 +1157,11 @@ func (k Keeper) DeleteMinimumPowerInTopN( store := ctx.KVStore(k.storeKey) store.Delete(types.MinimumPowerInTopNKey(chainID)) } + +func (k Keeper) UnbondingCanComplete(ctx sdk.Context, id uint64) error { + return k.stakingKeeper.UnbondingCanComplete(ctx, id) +} + +func (k Keeper) UnbondingTime(ctx sdk.Context) (time.Duration, error) { + return k.stakingKeeper.UnbondingTime(ctx) +} diff --git a/x/ccv/provider/keeper/keeper_test.go b/x/ccv/provider/keeper/keeper_test.go index e61a93cda1..8072ef225e 100644 --- a/x/ccv/provider/keeper/keeper_test.go +++ b/x/ccv/provider/keeper/keeper_test.go @@ -5,7 +5,6 @@ import ( "fmt" "sort" "testing" - "time" "cosmossdk.io/math" ibctesting "github.com/cosmos/ibc-go/v8/testing" @@ -224,175 +223,6 @@ func TestInitHeight(t *testing.T) { } } -// TestGetAllUnbondingOpIndexes tests GetAllUnbondingOpIndexes behavior correctness -func TestGetAllUnbondingOpIndexes(t *testing.T) { - pk, ctx, ctrl, _ := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) - defer ctrl.Finish() - - ops := []types.VscUnbondingOps{ - { - VscId: 2, - UnbondingOpIds: []uint64{4, 5, 6, 7}, - }, - { - VscId: 1, - UnbondingOpIds: []uint64{1, 2, 3}, - }, - { - VscId: 4, - UnbondingOpIds: []uint64{10}, - }, - { - VscId: 3, - UnbondingOpIds: []uint64{8, 9}, - }, - } - // sorting by CrossChainValidator.Address - expectedGetAllOrder := ops - sort.Slice(expectedGetAllOrder, func(i, j int) bool { - return expectedGetAllOrder[i].VscId < expectedGetAllOrder[j].VscId - }) - - pk.SetUnbondingOpIndex(ctx, "chain-2", 1, []uint64{1, 2, 3}) - for _, op := range ops { - pk.SetUnbondingOpIndex(ctx, "chain-1", op.VscId, op.UnbondingOpIds) - } - - // iterate and check all results are returned in the expected order - result := pk.GetAllUnbondingOpIndexes(ctx, "chain-1") - require.Len(t, result, len(ops)) - require.Equal(t, result, expectedGetAllOrder) -} - -func TestMaturedUnbondingOps(t *testing.T) { - providerKeeper, ctx, ctrl, _ := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) - defer ctrl.Finish() - - ids := providerKeeper.GetMaturedUnbondingOps(ctx) - require.Nil(t, ids) - - unbondingOpIds := []uint64{0, 1, 2, 3, 4, 5, 6} - providerKeeper.AppendMaturedUnbondingOps(ctx, unbondingOpIds) - - ids = providerKeeper.ConsumeMaturedUnbondingOps(ctx) - require.Equal(t, len(unbondingOpIds), len(ids)) - for i := 0; i < len(unbondingOpIds); i++ { - require.Equal(t, unbondingOpIds[i], ids[i]) - } -} - -func TestInitTimeoutTimestamp(t *testing.T) { - pk, ctx, ctrl, _ := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) - defer ctrl.Finish() - - now := time.Now().UTC() - nsNow := uint64(now.UnixNano()) - timeoutTimestamps := []types.InitTimeoutTimestamp{ - { - ChainId: "chain-2", - Timestamp: nsNow, - }, - { - ChainId: "chain-1", - Timestamp: nsNow + 10, - }, - { - ChainId: "chain-4", - Timestamp: nsNow - 10, - }, - { - ChainId: "chain-3", - Timestamp: nsNow, - }, - } - - expectedGetAllOrder := timeoutTimestamps - // sorting by ChainId - sort.Slice(expectedGetAllOrder, func(i, j int) bool { - return expectedGetAllOrder[i].ChainId < expectedGetAllOrder[j].ChainId - }) - - _, found := pk.GetInitTimeoutTimestamp(ctx, timeoutTimestamps[0].ChainId) - require.False(t, found) - - for _, tt := range timeoutTimestamps { - pk.SetInitTimeoutTimestamp(ctx, tt.ChainId, tt.Timestamp) - } - - for _, tt := range timeoutTimestamps { - _, found := pk.GetInitTimeoutTimestamp(ctx, tt.ChainId) - require.True(t, found) - } - - // iterate and check all results are returned in the expected order - result := pk.GetAllInitTimeoutTimestamps(ctx) - require.Len(t, result, len(timeoutTimestamps)) - require.Equal(t, result, expectedGetAllOrder) - - pk.DeleteInitTimeoutTimestamp(ctx, timeoutTimestamps[0].ChainId) - _, found = pk.GetInitTimeoutTimestamp(ctx, timeoutTimestamps[0].ChainId) - require.False(t, found) -} - -// TestVscSendTimestamp tests the set, deletion, and iteration methods for VSC timeout timestamps -func TestVscSendTimestamp(t *testing.T) { - providerKeeper, ctx, ctrl, _ := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) - defer ctrl.Finish() - - now := time.Now().UTC() - - testCases := []struct { - chainID string - ts time.Time - vscID uint64 - }{ - {chainID: "chain", ts: now.Add(2 * time.Hour), vscID: 2}, - {chainID: "chain", ts: now.Add(time.Hour), vscID: 1}, - {chainID: "chain", ts: now.Add(time.Hour), vscID: 3}, - // this is not possible since the ts is the timestamp of sending, - // which means it must be in the same order as vscIDs, - // but it still worth testing - {chainID: "chain", ts: now.Add(-time.Hour), vscID: 4}, - {chainID: "chain1", ts: now.Add(time.Hour), vscID: 1}, - {chainID: "chain2", ts: now.Add(time.Hour), vscID: 1}, - } - chainID := testCases[0].chainID - expectedGetAllOrder := []types.VscSendTimestamp{} - for _, tc := range testCases { - if tc.chainID == chainID { - expectedGetAllOrder = append(expectedGetAllOrder, types.VscSendTimestamp{VscId: tc.vscID, Timestamp: tc.ts}) - } - } - // sorting by vscID - sort.Slice(expectedGetAllOrder, func(i, j int) bool { - return expectedGetAllOrder[i].VscId < expectedGetAllOrder[j].VscId - }) - - require.Empty(t, providerKeeper.GetAllVscSendTimestamps(ctx, chainID)) - - for _, tc := range testCases { - providerKeeper.SetVscSendTimestamp(ctx, tc.chainID, tc.vscID, tc.ts) - } - - // iterate and check all results are returned in the expected order - vscSendTimestamps := providerKeeper.GetAllVscSendTimestamps(ctx, chainID) - require.Equal(t, expectedGetAllOrder, vscSendTimestamps) - - vscSendTimestamp, found := providerKeeper.GetFirstVscSendTimestamp(ctx, chainID) - require.True(t, found) - require.Equal(t, vscSendTimestamp, expectedGetAllOrder[0]) - - // delete first VSC send timestamp - providerKeeper.DeleteVscSendTimestamp(ctx, chainID, vscSendTimestamp.VscId) - for _, vst := range providerKeeper.GetAllVscSendTimestamps(ctx, chainID) { - require.NotEqual(t, vscSendTimestamp, vst) - } - - // delete all VSC send timestamps - providerKeeper.DeleteVscSendTimestampsForConsumer(ctx, chainID) - require.Empty(t, providerKeeper.GetAllVscSendTimestamps(ctx, chainID)) -} - func TestGetAllRegisteredConsumerChainIDs(t *testing.T) { pk, ctx, ctrl, _ := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) defer ctrl.Finish() @@ -433,92 +263,6 @@ func TestGetAllChannelToChains(t *testing.T) { require.Equal(t, expectedGetAllOrder, result) } -// TestGetAllUnbondingOps tests GetAllUnbondingOps behaviour correctness -func TestGetAllUnbondingOps(t *testing.T) { - pk, ctx, ctrl, _ := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) - defer ctrl.Finish() - - ops := []types.UnbondingOp{ - { - Id: 2, - UnbondingConsumerChains: []string{"chain-2", "chain-1"}, - }, - { - Id: 1, - UnbondingConsumerChains: []string{"chain-1", "chain-2"}, - }, - { - Id: 4, - UnbondingConsumerChains: []string{"chain-2"}, - }, - { - Id: 3, - UnbondingConsumerChains: []string{"chain-3", "chain-1", "chain-2"}, - }, - } - expectedGetAllOrder := ops - // sorting by Id - sort.Slice(expectedGetAllOrder, func(i, j int) bool { - return expectedGetAllOrder[i].Id < expectedGetAllOrder[j].Id - }) - - for _, op := range ops { - pk.SetUnbondingOp(ctx, op) - } - - // iterate and check all results are returned - result := pk.GetAllUnbondingOps(ctx) - require.Len(t, result, len(ops)) - require.Equal(t, expectedGetAllOrder, result) -} - -// TestRemoveConsumerFromUnbondingOp tests RemoveConsumerFromUnbondingOp behaviour correctness -func TestRemoveConsumerFromUnbondingOp(t *testing.T) { - pk, ctx, ctrl, _ := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) - defer ctrl.Finish() - - var expectedID uint64 = 1 - expectedUnbondingOp := types.UnbondingOp{ - Id: expectedID, - UnbondingConsumerChains: []string{"chain-3", "chain-1", "chain-2"}, - } - - pk.SetUnbondingOp(ctx, expectedUnbondingOp) - - canComplete := pk.RemoveConsumerFromUnbondingOp(ctx, expectedID, "chain-1") - require.False(t, canComplete) - unbondingOp, found := pk.GetUnbondingOp(ctx, expectedID) - require.True(t, found) - expectedChainIDs := []string{"chain-3", "chain-2"} - require.Equal(t, expectedChainIDs, unbondingOp.UnbondingConsumerChains) - - canComplete = pk.RemoveConsumerFromUnbondingOp(ctx, expectedID, "chain-2") - require.False(t, canComplete) - unbondingOp, found = pk.GetUnbondingOp(ctx, expectedID) - require.True(t, found) - expectedChainIDs = []string{"chain-3"} - require.Equal(t, expectedChainIDs, unbondingOp.UnbondingConsumerChains) - - // check that it doesn't panic when calling with same chain ID - canComplete = pk.RemoveConsumerFromUnbondingOp(ctx, expectedID, "chain-2") - require.False(t, canComplete) - unbondingOp, found = pk.GetUnbondingOp(ctx, expectedID) - require.True(t, found) - require.Equal(t, expectedChainIDs, unbondingOp.UnbondingConsumerChains) - - canComplete = pk.RemoveConsumerFromUnbondingOp(ctx, expectedID, "chain-3") - require.True(t, canComplete) - unbondingOp, found = pk.GetUnbondingOp(ctx, expectedID) - require.False(t, found) - require.Empty(t, unbondingOp.UnbondingConsumerChains) - - // check that it panics when calling with wrong chain IDs - require.Panics(t, func() { - canComplete = pk.RemoveConsumerFromUnbondingOp(ctx, expectedID, "some_chain") - require.False(t, canComplete) - }) -} - // TestSetSlashLog tests slash log getter and setter methods func TestSetSlashLog(t *testing.T) { providerKeeper, ctx, ctrl, _ := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) diff --git a/x/ccv/provider/keeper/key_assignment.go b/x/ccv/provider/keeper/key_assignment.go index dd0868b9a2..23dd20109d 100644 --- a/x/ccv/provider/keeper/key_assignment.go +++ b/x/ccv/provider/keeper/key_assignment.go @@ -3,6 +3,7 @@ package keeper import ( "encoding/base64" "fmt" + "time" errorsmod "cosmossdk.io/errors" storetypes "cosmossdk.io/store/types" @@ -104,7 +105,7 @@ func (k Keeper) SetValidatorConsumerPubKey( // If chainID is nil, it returns all the validators public keys assigned for all consumer chains // // Note that the validators public keys assigned for a consumer chain are stored under keys -// with the following format: UnbondingOpIndexKeyPrefix | len(chainID) | chainID | providerAddress +// with the following format: ConsumerValidatorsBytePrefix | len(chainID) | chainID | providerAddress // Thus, the returned array is // - in ascending order of providerAddresses, if chainID is not nil; // - in undetermined order, if chainID is nil. @@ -235,16 +236,22 @@ func (k Keeper) DeleteValidatorByConsumerAddr(ctx sdk.Context, chainID string, c } // AppendConsumerAddrsToPrune appends a consumer validator address to the list of consumer addresses -// that can be pruned once the VSCMaturedPacket with vscID is received. +// that can be pruned once the block time is at least pruneTs. // // The following invariant needs to hold: // For each consumer address cAddr in ValidatorByConsumerAddr, // - either there exists a provider address pAddr in ValidatorConsumerPubKey, // s.t. hash(ValidatorConsumerPubKey(pAddr)) = cAddr -// - or there exists a vscID in ConsumerAddrsToPrune s.t. cAddr in ConsumerAddrsToPrune(vscID) -func (k Keeper) AppendConsumerAddrsToPrune(ctx sdk.Context, chainID string, vscID uint64, consumerAddr types.ConsumerConsAddress) { +// - or there exists a timestamp in ConsumerAddrsToPrune s.t. cAddr in ConsumerAddrsToPrune(timestamp) +func (k Keeper) AppendConsumerAddrsToPrune( + ctx sdk.Context, + chainID string, + pruneTs time.Time, + consumerAddr types.ConsumerConsAddress, +) { store := ctx.KVStore(k.storeKey) - bz := store.Get(types.ConsumerAddrsToPruneKey(chainID, vscID)) + storeKey := types.ConsumerAddrsToPruneV2Key(chainID, pruneTs) + bz := store.Get(storeKey) var consumerAddrsToPrune types.AddressList if bz != nil { err := consumerAddrsToPrune.Unmarshal(bz) @@ -261,18 +268,19 @@ func (k Keeper) AppendConsumerAddrsToPrune(ctx sdk.Context, chainID string, vscI // consumerAddrsToPrune is instantiated in this method and should be able to be marshaled. panic(err) } - store.Set(types.ConsumerAddrsToPruneKey(chainID, vscID), bz) + store.Set(storeKey, bz) } -// GetConsumerAddrsToPrune returns the list of consumer addresses -// that can be pruned once the VSCMaturedPacket with vscID is received +// GetConsumerAddrsToPrune returns the list of consumer addresses to prune stored under timestamp ts. +// Note that this method is only used in testing. func (k Keeper) GetConsumerAddrsToPrune( ctx sdk.Context, chainID string, - vscID uint64, + ts time.Time, ) (consumerAddrsToPrune types.AddressList) { store := ctx.KVStore(k.storeKey) - bz := store.Get(types.ConsumerAddrsToPruneKey(chainID, vscID)) + + bz := store.Get(types.ConsumerAddrsToPruneV2Key(chainID, ts)) if bz == nil { return } @@ -285,19 +293,78 @@ func (k Keeper) GetConsumerAddrsToPrune( return } -// GetAllConsumerAddrsToPrune gets all consumer addresses that can be pruned for a given chainID. +// ConsumeConsumerAddrsToPrune returns the list of consumer addresses that can be pruned at timestamp ts. +// The returned addresses are removed from the store. // // Note that the list of all consumer addresses is stored under keys with the following format: -// ConsumerAddrsToPruneKeyPrefix | len(chainID) | chainID | vscID -// Thus, the returned array is in ascending order of vscIDs. -func (k Keeper) GetAllConsumerAddrsToPrune(ctx sdk.Context, chainID string) (consumerAddrsToPrune []types.ConsumerAddrsToPrune) { +// ConsumerAddrsToPruneV2BytePrefix | len(chainID) | chainID | timestamp +// Thus, this method returns all the consumer addresses stored under keys in the following range: +// (ConsumerAddrsToPruneV2BytePrefix | len(chainID) | chainID | ts') where ts' <= ts +func (k Keeper) ConsumeConsumerAddrsToPrune( + ctx sdk.Context, + chainID string, + ts time.Time, +) (consumerAddrsToPrune types.AddressList) { store := ctx.KVStore(k.storeKey) - consumerAddrsToPruneKeyPrefix := types.ConsumerAddrsToPruneKeyPrefix() + consumerAddrsToPruneKeyPrefix := types.ConsumerAddrsToPruneV2KeyPrefix() + startPrefix := types.ChainIdWithLenKey(consumerAddrsToPruneKeyPrefix, chainID) + iterator := store.Iterator(startPrefix, + storetypes.InclusiveEndBytes(types.ConsumerAddrsToPruneV2Key(chainID, ts))) + defer iterator.Close() + + var keysToDel [][]byte + for ; iterator.Valid(); iterator.Next() { + // Sanity check + if _, pruneTs, err := types.ParseChainIdAndTsKey(consumerAddrsToPruneKeyPrefix, iterator.Key()); err != nil { + // An error here would indicate something is very wrong, + // store keys are assumed to be correctly serialized in AppendConsumerAddrsToPrune. + k.Logger(ctx).Error("ParseChainIdAndTsKey failed", + "key", string(iterator.Key()), + "error", err.Error(), + ) + continue + } else if pruneTs.After(ts) { + // An error here would indicate something is wrong the iterator + k.Logger(ctx).Error("iterator in ConsumeConsumerAddrsToPrune failed", "key", string(iterator.Key())) + continue + } + + keysToDel = append(keysToDel, iterator.Key()) + + var addrs types.AddressList + if err := addrs.Unmarshal(iterator.Value()); err != nil { + // An error here would indicate something is very wrong, + // the list of consumer addresses is assumed to be correctly serialized in AppendConsumerAddrsToPrune. + k.Logger(ctx).Error("unmarshaling in ConsumeConsumerAddrsToPrune failed", + "key", string(iterator.Key()), + "error", err.Error(), + ) + continue + } + + consumerAddrsToPrune.Addresses = append(consumerAddrsToPrune.Addresses, addrs.Addresses...) + } + + for _, delKey := range keysToDel { + store.Delete(delKey) + } + + return +} + +// GetAllConsumerAddrsToPrune gets all consumer addresses that can be eventually pruned for a given chainID. +// +// Note that the list of all consumer addresses is stored under keys with the following format: +// ConsumerAddrsToPruneV2BytePrefix | len(chainID) | chainID | timestamp +// Thus, the returned array is in ascending order of timestamps. +func (k Keeper) GetAllConsumerAddrsToPrune(ctx sdk.Context, chainID string) (consumerAddrsToPrune []types.ConsumerAddrsToPruneV2) { + store := ctx.KVStore(k.storeKey) + consumerAddrsToPruneKeyPrefix := types.ConsumerAddrsToPruneV2KeyPrefix() iteratorPrefix := types.ChainIdWithLenKey(consumerAddrsToPruneKeyPrefix, chainID) iterator := storetypes.KVStorePrefixIterator(store, iteratorPrefix) defer iterator.Close() for ; iterator.Valid(); iterator.Next() { - _, vscID, err := types.ParseChainIdAndUintIdKey(consumerAddrsToPruneKeyPrefix, iterator.Key()) + _, ts, err := types.ParseChainIdAndTsKey(consumerAddrsToPruneKeyPrefix, iterator.Key()) if err != nil { // An error here would indicate something is very wrong, // store keys are assumed to be correctly serialized in AppendConsumerAddrsToPrune. @@ -311,8 +378,8 @@ func (k Keeper) GetAllConsumerAddrsToPrune(ctx sdk.Context, chainID string) (con panic(err) } - consumerAddrsToPrune = append(consumerAddrsToPrune, types.ConsumerAddrsToPrune{ - VscId: vscID, + consumerAddrsToPrune = append(consumerAddrsToPrune, types.ConsumerAddrsToPruneV2{ + PruneTs: ts, ConsumerAddrs: &addrs, ChainId: chainID, }) @@ -321,10 +388,10 @@ func (k Keeper) GetAllConsumerAddrsToPrune(ctx sdk.Context, chainID string) (con return consumerAddrsToPrune } -// DeleteConsumerAddrsToPrune deletes the list of consumer addresses mapped to a given VSC ID -func (k Keeper) DeleteConsumerAddrsToPrune(ctx sdk.Context, chainID string, vscID uint64) { +// DeleteConsumerAddrsToPruneV2 deletes the list of consumer addresses mapped to a timestamp +func (k Keeper) DeleteConsumerAddrsToPrune(ctx sdk.Context, chainID string, pruneTs time.Time) { store := ctx.KVStore(k.storeKey) - store.Delete(types.ConsumerAddrsToPruneKey(chainID, vscID)) + store.Delete(types.ConsumerAddrsToPruneV2Key(chainID, pruneTs)) } // AssignConsumerKey assigns the consumerKey to the validator with providerAddr @@ -395,13 +462,16 @@ func (k Keeper) AssignConsumerKey( // check whether the consumer chain is already registered, // i.e., a client to the consumer was already created if _, consumerRegistered := k.GetConsumerClientId(ctx, chainID); consumerRegistered { - // mark the old consumer address as prunable once the VSCMaturedPacket - // for the current VSC ID is received; - // note: this state is removed on receiving the VSCMaturedPacket + // mark the old consumer address as prunable once UnbondingPeriod elapses; + // note: this state is removed on EndBlock + unbondingPeriod, err := k.stakingKeeper.UnbondingTime(ctx) + if err != nil { + return err + } k.AppendConsumerAddrsToPrune( ctx, chainID, - k.GetValidatorSetUpdateId(ctx), + ctx.BlockTime().Add(unbondingPeriod), oldConsumerAddr, ) } else { @@ -442,8 +512,10 @@ func (k Keeper) GetProviderAddrFromConsumerAddr( // PruneKeyAssignments prunes the consumer addresses no longer needed // as they cannot be referenced in slash requests (by a correct consumer) -func (k Keeper) PruneKeyAssignments(ctx sdk.Context, chainID string, vscID uint64) { - consumerAddrs := k.GetConsumerAddrsToPrune(ctx, chainID, vscID) +func (k Keeper) PruneKeyAssignments(ctx sdk.Context, chainID string) { + now := ctx.BlockTime() + + consumerAddrs := k.ConsumeConsumerAddrsToPrune(ctx, chainID, now) for _, addrBz := range consumerAddrs.Addresses { consumerAddr := types.NewConsumerConsAddress(addrBz) k.DeleteValidatorByConsumerAddr(ctx, chainID, consumerAddr) @@ -452,8 +524,6 @@ func (k Keeper) PruneKeyAssignments(ctx sdk.Context, chainID string, vscID uint6 "consumer consensus addr", consumerAddr.String(), ) } - - k.DeleteConsumerAddrsToPrune(ctx, chainID, vscID) } // DeleteKeyAssignments deletes all the state needed for key assignments on a consumer chain @@ -472,7 +542,7 @@ func (k Keeper) DeleteKeyAssignments(ctx sdk.Context, chainID string) { // delete ValidatorConsumerPubKey for _, consumerAddrsToPrune := range k.GetAllConsumerAddrsToPrune(ctx, chainID) { - k.DeleteConsumerAddrsToPrune(ctx, chainID, consumerAddrsToPrune.VscId) + k.DeleteConsumerAddrsToPrune(ctx, chainID, consumerAddrsToPrune.PruneTs) } } diff --git a/x/ccv/provider/keeper/key_assignment_test.go b/x/ccv/provider/keeper/key_assignment_test.go index 2f67890b00..910d008ec9 100644 --- a/x/ccv/provider/keeper/key_assignment_test.go +++ b/x/ccv/provider/keeper/key_assignment_test.go @@ -189,25 +189,52 @@ func TestGetAllValidatorsByConsumerAddr(t *testing.T) { func TestConsumerAddrsToPruneCRUD(t *testing.T) { chainID := consumer - consumerAddr := types.NewConsumerConsAddress([]byte("consumerAddr1")) - vscID := uint64(1) + consumerAddr1 := types.NewConsumerConsAddress([]byte("consumerAddr1")) + consumerAddr2 := types.NewConsumerConsAddress([]byte("consumerAddr2")) keeper, ctx, ctrl, _ := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) defer ctrl.Finish() - addrsToPrune := keeper.GetConsumerAddrsToPrune(ctx, chainID, vscID).Addresses + ts1 := ctx.BlockTime() + ts2 := ts1.Add(time.Hour) + + addrsToPrune := keeper.GetConsumerAddrsToPrune(ctx, chainID, ts1).Addresses require.Empty(t, addrsToPrune) - keeper.AppendConsumerAddrsToPrune(ctx, chainID, vscID, consumerAddr) + keeper.AppendConsumerAddrsToPrune(ctx, chainID, ts1, consumerAddr1) + + addrsToPrune = keeper.GetConsumerAddrsToPrune(ctx, chainID, ts1).Addresses + require.NotEmpty(t, addrsToPrune, "addresses to prune is empty") + require.Len(t, addrsToPrune, 1, "addresses to prune is not len 1") + require.Equal(t, addrsToPrune[0], consumerAddr1.ToSdkConsAddr().Bytes()) + + keeper.AppendConsumerAddrsToPrune(ctx, chainID, ts2, consumerAddr2) - addrsToPrune = keeper.GetConsumerAddrsToPrune(ctx, chainID, vscID).Addresses + addrsToPrune = keeper.GetConsumerAddrsToPrune(ctx, chainID, ts2).Addresses require.NotEmpty(t, addrsToPrune, "addresses to prune is empty") require.Len(t, addrsToPrune, 1, "addresses to prune is not len 1") - require.Equal(t, addrsToPrune[0], consumerAddr.ToSdkConsAddr().Bytes()) + require.Equal(t, addrsToPrune[0], consumerAddr2.ToSdkConsAddr().Bytes()) + + keeper.DeleteConsumerAddrsToPrune(ctx, chainID, ts1) + addrsToPrune = keeper.GetConsumerAddrsToPrune(ctx, chainID, ts1).Addresses + require.Empty(t, addrsToPrune, "addresses to prune was returned") + addrsToPrune = keeper.GetConsumerAddrsToPrune(ctx, chainID, ts2).Addresses + require.NotEmpty(t, addrsToPrune, "addresses to prune is empty") + require.Len(t, addrsToPrune, 1, "addresses to prune is not len 1") + require.Equal(t, addrsToPrune[0], consumerAddr2.ToSdkConsAddr().Bytes()) + + keeper.AppendConsumerAddrsToPrune(ctx, chainID, ts1, consumerAddr1) - keeper.DeleteConsumerAddrsToPrune(ctx, chainID, vscID) - addrsToPrune = keeper.GetConsumerAddrsToPrune(ctx, chainID, vscID).Addresses + addrsToPrune = keeper.ConsumeConsumerAddrsToPrune(ctx, chainID, ts1).Addresses + require.NotEmpty(t, addrsToPrune, "addresses to prune was returned") + require.Len(t, addrsToPrune, 1, "addresses to prune is not len 1") + require.Equal(t, addrsToPrune[0], consumerAddr1.ToSdkConsAddr().Bytes()) + addrsToPrune = keeper.GetConsumerAddrsToPrune(ctx, chainID, ts1).Addresses require.Empty(t, addrsToPrune, "addresses to prune was returned") + addrsToPrune = keeper.GetConsumerAddrsToPrune(ctx, chainID, ts2).Addresses + require.NotEmpty(t, addrsToPrune, "addresses to prune is empty") + require.Len(t, addrsToPrune, 1, "addresses to prune is not len 1") + require.Equal(t, addrsToPrune[0], consumerAddr2.ToSdkConsAddr().Bytes()) } func TestGetAllConsumerAddrsToPrune(t *testing.T) { @@ -219,7 +246,7 @@ func TestGetAllConsumerAddrsToPrune(t *testing.T) { chainIDs := []string{"consumer-1", "consumer-2", "consumer-3"} numAssignments := 10 - testAssignments := []types.ConsumerAddrsToPrune{} + testAssignments := []types.ConsumerAddrsToPruneV2{} for i := 0; i < numAssignments; i++ { consumerAddresses := types.AddressList{} for j := 0; j < 2*(i+1); j++ { @@ -227,9 +254,9 @@ func TestGetAllConsumerAddrsToPrune(t *testing.T) { consumerAddresses.Addresses = append(consumerAddresses.Addresses, addr) } testAssignments = append(testAssignments, - types.ConsumerAddrsToPrune{ + types.ConsumerAddrsToPruneV2{ ChainId: chainIDs[rng.Intn(len(chainIDs))], - VscId: rng.Uint64(), + PruneTs: time.Now().UTC(), ConsumerAddrs: &consumerAddresses, }, ) @@ -248,21 +275,21 @@ func TestGetAllConsumerAddrsToPrune(t *testing.T) { break } } - expectedGetAllOrder := []types.ConsumerAddrsToPrune{} + expectedGetAllOrder := []types.ConsumerAddrsToPruneV2{} for _, assignment := range testAssignments { if assignment.ChainId == chainID { expectedGetAllOrder = append(expectedGetAllOrder, assignment) } } - // sorting by ConsumerAddrsToPrune.VscId + // sorting by ConsumerAddrsToPrune.PruneTs sort.Slice(expectedGetAllOrder, func(i, j int) bool { - return expectedGetAllOrder[i].VscId < expectedGetAllOrder[j].VscId + return expectedGetAllOrder[i].PruneTs.Before(expectedGetAllOrder[j].PruneTs) }) for _, assignment := range testAssignments { for _, addr := range assignment.ConsumerAddrs.Addresses { consumerAddr := types.NewConsumerConsAddress(addr) - pk.AppendConsumerAddrsToPrune(ctx, assignment.ChainId, assignment.VscId, consumerAddr) + pk.AppendConsumerAddrsToPrune(ctx, assignment.ChainId, assignment.PruneTs, consumerAddr) } } @@ -277,7 +304,7 @@ func checkCorrectPruningProperty(ctx sdk.Context, k providerkeeper.Keeper, chain For each consumer address cAddr in ValidatorByConsumerAddr, - either there exists a provider address pAddr in ValidatorConsumerPubKey, s.t. hash(ValidatorConsumerPubKey(pAddr)) = cAddr - - or there exists a vscID in ConsumerAddrsToPrune s.t. cAddr in ConsumerAddrsToPrune(vscID) + - or there exists a timestamp in ConsumerAddrsToPrune s.t. cAddr in ConsumerAddrsToPrune(timestamp) */ willBePruned := map[string]bool{} for _, consAddrToPrune := range k.GetAllConsumerAddrsToPrune(ctx, chainID) { @@ -293,6 +320,7 @@ func checkCorrectPruningProperty(ctx sdk.Context, k providerkeeper.Keeper, chain // Address will be pruned, everything is fine. continue } + // Try to find a validator who has this consumer address currently assigned isCurrentlyAssigned := false for _, valconsPubKey := range k.GetAllValidatorConsumerPubKeys(ctx, &valByConsAddr.ChainId) { @@ -388,6 +416,7 @@ func TestAssignConsensusKeyForConsumerChain(t *testing.T) { mocks.MockStakingKeeper.EXPECT().GetValidatorByConsAddr(ctx, consumerIdentities[1].SDKValConsAddress(), ).Return(stakingtypes.Validator{}, stakingtypes.ErrNoValidatorFound), + mocks.MockStakingKeeper.EXPECT().UnbondingTime(ctx), ) }, doActions: func(sdkCtx sdk.Context, k providerkeeper.Keeper) { @@ -714,11 +743,6 @@ func TestSimulatedAssignmentsAndUpdateApplication(t *testing.T) { providerValset := CreateValSet(providerIDS) // NOTE: consumer must have space for provider identities because default key assignments are to provider keys consumerValset := CreateValSet(assignableIDS) - // For each validator on the consumer, record the corresponding provider - // address as looked up on the provider using GetProviderAddrFromConsumerAddr - // at a given vscid. - // consumer consAddr -> vscid -> provider consAddr - historicSlashQueries := map[string]map[uint64]string{} // Sanity check that the validator set update is initialised to 0, for clarity. require.Equal(t, k.GetValidatorSetUpdateId(ctx), uint64(0)) @@ -789,9 +813,14 @@ func TestSimulatedAssignmentsAndUpdateApplication(t *testing.T) { } } + // Set the unbonding time to 60s so that a key is prunable after 60s + unbondingTimeInNs := 60 * time.Second // 60 seconds + mocks.MockStakingKeeper.EXPECT().UnbondingTime(gomock.Any()).Return(unbondingTimeInNs, nil).AnyTimes() + // The consumer chain has not yet been registered // Apply some randomly generated key assignments assignments := getAssignments() + applyAssignments(assignments) // And generate a random provider valset which, in the real system, will // be put into the consumer genesis. @@ -802,15 +831,15 @@ func TestSimulatedAssignmentsAndUpdateApplication(t *testing.T) { // Register the consumer chain k.SetConsumerClientId(ctx, ChainID, "") - // Analogous to the last vscid received from the consumer in a maturity - // Used to check the correct pruning property - greatestPrunedVSCID := -1 + // Set the greatest block time up to which keys have been pruned. At the beginning, no pruning has taken + // place, so we set `greatestPrunedBlockTime` to 0, and set the current block time to 1. + greatestPrunedBlockTime := int64(0) + ctx = ctx.WithBlockTime(time.Unix(0, 1)) // Simulate a number of 'blocks' // Each block consists of a number of random key assignment tx's // and a random set of validator power updates for block := 0; block < NUM_BLOCKS_PER_EXECUTION; block++ { - stakingUpdates = getStakingUpdates() assignments = getAssignments() @@ -818,13 +847,14 @@ func TestSimulatedAssignmentsAndUpdateApplication(t *testing.T) { applyAssignments(assignments) applyUpdatesAndIncrementVSCID(stakingUpdates) - // Randomly fast forward the greatest pruned VSCID. This simulates - // delivery of maturity packets from the consumer chain. - prunedVscid := greatestPrunedVSCID + - // +1 and -1 because id was incremented (-1), (+1) to make upper bound inclusive - rng.Intn(int(k.GetValidatorSetUpdateId(ctx))+1-1-greatestPrunedVSCID) - k.PruneKeyAssignments(ctx, ChainID, uint64(prunedVscid)) - greatestPrunedVSCID = prunedVscid + // prune all keys that can be pruned up to the current block time + greatestPrunedBlockTime = ctx.BlockTime().UnixNano() + k.PruneKeyAssignments(ctx, ChainID) + + // Increase the block time by a small random amount up to UnbondingTime / 10. We do not increase the block time + // by UnbondingTime so that in the upcoming iteration of this `for` loop (i.e., new block), not all the keys + // previously (in this current block) set to be prunable are pruned. + ctx = ctx.WithBlockTime(time.Unix(0, ctx.BlockTime().UnixNano()+rng.Int63n(unbondingTimeInNs.Nanoseconds())/10)) /* @@ -880,20 +910,25 @@ func TestSimulatedAssignmentsAndUpdateApplication(t *testing.T) { Property: Pruning (bounded storage) Check that all keys have been or will eventually be pruned. */ - require.True(t, checkCorrectPruningProperty(ctx, k, ChainID)) /* Property: Correct Consumer Initiated Slash Lookup - Check that since the last pruning, it has never been possible to query - two different provider addresses from the same consumer address. + Check that since the last pruning took place, it has never been possible to have + two different provider addresses for the same consumer address. We know that the queried provider address was correct at least once, from checking the validator set replication property. These two facts together guarantee that the slash lookup is always correct. */ - // Build up the historicSlashQueries data structure + // For each validator on the consumer, record the corresponding provider + // address as looked up on the provider using `GetProviderAddrFromConsumerAddr` + // at a given block time. + // consumer consAddr -> block time -> provider consAddr + consumerAddrToBlockTimeToProviderAddr := map[string]map[uint64]string{} + + // Build up the consumerAddrToBlockTimeToProviderAddr data structure for i := range consumerValset.identities { // For each active validator on the consumer chain consC := consumerValset.identities[i].ConsumerConsAddress() @@ -901,28 +936,25 @@ func TestSimulatedAssignmentsAndUpdateApplication(t *testing.T) { // Get the provider who assigned the key consP := k.GetProviderAddrFromConsumerAddr(ctx, ChainID, consC) - if _, found := historicSlashQueries[consC.String()]; !found { - historicSlashQueries[consC.String()] = map[uint64]string{} + if _, found := consumerAddrToBlockTimeToProviderAddr[consC.String()]; !found { + consumerAddrToBlockTimeToProviderAddr[consC.String()] = map[uint64]string{} } - vscid := k.GetValidatorSetUpdateId(ctx) - 1 // -1 since it was incremented before - // Record the slash query result obtained at this block - historicSlashQueries[consC.String()][vscid] = consP.String() + consumerAddrToBlockTimeToProviderAddr[consC.String()][uint64(ctx.BlockTime().UnixNano())] = consP.String() } } - // Check that, for each address known the consumer at some block - // with vscid st. greatestPrunedVSCID < vscid, there were never - // conflicting slash query results. - for _, vscidToConsP := range historicSlashQueries { + // Check that, for each consumer address known at some block with blockTime st. greatestPrunedBlockTime < blockTime, + // there were never two providers with this consumer address. + for _, blockTimeToProviderAddr := range consumerAddrToBlockTimeToProviderAddr { seen := map[string]bool{} - for vscid, consP := range vscidToConsP { - if uint64(greatestPrunedVSCID) < vscid { - // The provider would have returned + for blockTime, consP := range blockTimeToProviderAddr { + if uint64(greatestPrunedBlockTime) < blockTime { seen[consP] = true } } - // No conflicts. + // Having len(seen) >= 2 implies that we had at least 2 different provider addresses that at some point + // had the exact same consumer address since the last pruning took place. This should not be possible! require.True(t, len(seen) < 2) } diff --git a/x/ccv/provider/keeper/params.go b/x/ccv/provider/keeper/params.go index da3dda92b7..343fdea168 100644 --- a/x/ccv/provider/keeper/params.go +++ b/x/ccv/provider/keeper/params.go @@ -30,25 +30,6 @@ func (k Keeper) GetCCVTimeoutPeriod(ctx sdk.Context) time.Duration { return params.CcvTimeoutPeriod } -// GetInitTimeoutPeriod returns the init timeout period -func (k Keeper) GetInitTimeoutPeriod(ctx sdk.Context) time.Duration { - params := k.GetParams(ctx) - return params.InitTimeoutPeriod -} - -// GetVscTimeoutPeriod returns the vsc timeout period -func (k Keeper) GetVscTimeoutPeriod(ctx sdk.Context) time.Duration { - params := k.GetParams(ctx) - return params.VscTimeoutPeriod -} - -// SetVscTimeoutPeriod sets the vsc timeout period -func (k Keeper) SetVscTimeoutPeriod(ctx sdk.Context, period time.Duration) { - params := k.GetParams(ctx) - params.VscTimeoutPeriod = period - k.SetParams(ctx, params) -} - // GetSlashMeterReplenishPeriod returns the period in which: // Once the slash meter becomes not-full, the slash meter is replenished after this period. func (k Keeper) GetSlashMeterReplenishPeriod(ctx sdk.Context) time.Duration { diff --git a/x/ccv/provider/keeper/params_test.go b/x/ccv/provider/keeper/params_test.go index cb1dc3cfe0..d286a71afc 100644 --- a/x/ccv/provider/keeper/params_test.go +++ b/x/ccv/provider/keeper/params_test.go @@ -41,8 +41,6 @@ func TestParams(t *testing.T) { ), "0.25", 7*24*time.Hour, - 5*time.Hour, - 10*time.Minute, time.Hour, "0.4", sdk.Coin{ diff --git a/x/ccv/provider/keeper/proposal.go b/x/ccv/provider/keeper/proposal.go index b02b3d0d4d..f3dd63534a 100644 --- a/x/ccv/provider/keeper/proposal.go +++ b/x/ccv/provider/keeper/proposal.go @@ -2,7 +2,6 @@ package keeper import ( "fmt" - "strconv" "time" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" @@ -141,10 +140,6 @@ func (k Keeper) CreateConsumerClient(ctx sdk.Context, prop *types.ConsumerAdditi } k.SetConsumerClientId(ctx, chainID, clientID) - // add the init timeout timestamp for this consumer chain - ts := ctx.BlockTime().Add(k.GetParams(ctx).InitTimeoutPeriod) - k.SetInitTimeoutTimestamp(ctx, chainID, uint64(ts.UnixNano())) - k.Logger(ctx).Info("consumer chain registered (client created)", "chainID", chainID, "clientID", clientID, @@ -157,7 +152,6 @@ func (k Keeper) CreateConsumerClient(ctx sdk.Context, prop *types.ConsumerAdditi sdk.NewAttribute(ccv.AttributeChainID, chainID), sdk.NewAttribute(clienttypes.AttributeKeyClientID, clientID), sdk.NewAttribute(types.AttributeInitialHeight, prop.InitialHeight.String()), - sdk.NewAttribute(types.AttributeInitializationTimeout, strconv.Itoa(int(ts.UnixNano()))), sdk.NewAttribute(types.AttributeTrustingPeriod, clientState.TrustingPeriod.String()), sdk.NewAttribute(types.AttributeUnbondingPeriod, clientState.UnbondingPeriod.String()), ), @@ -182,7 +176,6 @@ func (k Keeper) StopConsumerChain(ctx sdk.Context, chainID string, closeChan boo // clean up states k.DeleteConsumerClientId(ctx, chainID) k.DeleteConsumerGenesis(ctx, chainID) - k.DeleteInitTimeoutTimestamp(ctx, chainID) // Note: this call panics if the key assignment state is invalid k.DeleteKeyAssignments(ctx, chainID) k.DeleteMinimumPowerInTopN(ctx, chainID) @@ -207,9 +200,6 @@ func (k Keeper) StopConsumerChain(ctx sdk.Context, chainID string, closeChan boo } k.DeleteChainToChannel(ctx, chainID) k.DeleteChannelToChain(ctx, channelID) - - // delete VSC send timestamps - k.DeleteVscSendTimestampsForConsumer(ctx, chainID) } // delete consumer commission rate @@ -222,26 +212,6 @@ func (k Keeper) StopConsumerChain(ctx sdk.Context, chainID string, closeChan boo k.DeleteSlashAcks(ctx, chainID) k.DeletePendingVSCPackets(ctx, chainID) - // release unbonding operations - for _, unbondingOpsIndex := range k.GetAllUnbondingOpIndexes(ctx, chainID) { - // iterate over the unbonding operations for the current VSC ID - var maturedIds []uint64 - for _, id := range unbondingOpsIndex.UnbondingOpIds { - // Remove consumer chain ID from unbonding op record. - // Note that RemoveConsumerFromUnbondingOp cannot panic here - // as it is expected that for all UnbondingOpIds in every - // VscUnbondingOps returned by GetAllUnbondingOpIndexes - // there is an unbonding op in store that can be retrieved - // via via GetUnbondingOp. - if k.RemoveConsumerFromUnbondingOp(ctx, id, chainID) { - // Store id of matured unbonding op for later completion of unbonding in staking module - maturedIds = append(maturedIds, id) - } - } - k.AppendMaturedUnbondingOps(ctx, maturedIds) - k.DeleteUnbondingOpIndex(ctx, chainID, unbondingOpsIndex.VscId) - } - k.DeleteTopN(ctx, chainID) k.DeleteValidatorsPowerCap(ctx, chainID) k.DeleteValidatorSetCap(ctx, chainID) diff --git a/x/ccv/provider/keeper/proposal_test.go b/x/ccv/provider/keeper/proposal_test.go index 8cb9f3a00d..a915cb131b 100644 --- a/x/ccv/provider/keeper/proposal_test.go +++ b/x/ccv/provider/keeper/proposal_test.go @@ -650,8 +650,6 @@ func TestMakeConsumerGenesis(t *testing.T) { // They must be populated with reasonable values to satisfy SetParams though. TrustingPeriodFraction: providertypes.DefaultTrustingPeriodFraction, CcvTimeoutPeriod: ccvtypes.DefaultCCVTimeoutPeriod, - InitTimeoutPeriod: providertypes.DefaultInitTimeoutPeriod, - VscTimeoutPeriod: providertypes.DefaultVscTimeoutPeriod, SlashMeterReplenishPeriod: providertypes.DefaultSlashMeterReplenishPeriod, SlashMeterReplenishFraction: providertypes.DefaultSlashMeterReplenishFraction, ConsumerRewardDenomRegistrationFee: sdk.Coin{ diff --git a/x/ccv/provider/keeper/relay.go b/x/ccv/provider/keeper/relay.go index 9e4466765a..24320cdf1f 100644 --- a/x/ccv/provider/keeper/relay.go +++ b/x/ccv/provider/keeper/relay.go @@ -17,96 +17,6 @@ import ( ccv "github.com/cosmos/interchain-security/v5/x/ccv/types" ) -// OnRecvVSCMaturedPacket handles a VSCMatured packet and returns a no-op result ack. -func (k Keeper) OnRecvVSCMaturedPacket( - ctx sdk.Context, - packet channeltypes.Packet, - data ccv.VSCMaturedPacketData, -) error { - // check that the channel is established, panic if not - chainID, found := k.GetChannelToChain(ctx, packet.DestinationChannel) - if !found { - // VSCMatured packet was sent on a channel different than any of the established CCV channels; - // this should never happen - k.Logger(ctx).Error("VSCMaturedPacket received on unknown channel", - "channelID", packet.DestinationChannel, - ) - panic(fmt.Errorf("VSCMaturedPacket received on unknown channel %s", packet.DestinationChannel)) - } - - // validate packet data upon receiving - if err := data.Validate(); err != nil { - return errorsmod.Wrapf(err, "error validating VSCMaturedPacket data") - } - - k.HandleVSCMaturedPacket(ctx, chainID, data) - - k.Logger(ctx).Info("VSCMaturedPacket handled", - "chainID", chainID, - "vscID", data.ValsetUpdateId, - ) - - return nil -} - -// HandleVSCMaturedPacket handles a VSCMatured packet. -// -// Note: This method should only panic for a system critical error like a -// failed marshal/unmarshal, or persistence of critical data. -func (k Keeper) HandleVSCMaturedPacket(ctx sdk.Context, chainID string, data ccv.VSCMaturedPacketData) { - // iterate over the unbonding operations mapped to (chainID, data.ValsetUpdateId) - var maturedIds []uint64 - for _, unbondingOp := range k.GetUnbondingOpsFromIndex(ctx, chainID, data.ValsetUpdateId) { - // Remove consumer chain ID from unbonding op record. - // Note that RemoveConsumerFromUnbondingOp cannot panic here - // as all the unbonding ops returned by GetUnbondingOpsFromIndex - // are retrieved via GetUnbondingOp. - if k.RemoveConsumerFromUnbondingOp(ctx, unbondingOp.Id, chainID) { - // Store id of matured unbonding op for later completion of unbonding in staking module - maturedIds = append(maturedIds, unbondingOp.Id) - } - } - k.AppendMaturedUnbondingOps(ctx, maturedIds) - - // clean up index - k.DeleteUnbondingOpIndex(ctx, chainID, data.ValsetUpdateId) - - // remove the VSC timeout timestamp for this chainID and vscID - k.DeleteVscSendTimestamp(ctx, chainID, data.ValsetUpdateId) - - // prune previous consumer validator address that are no longer needed - k.PruneKeyAssignments(ctx, chainID, data.ValsetUpdateId) - - k.Logger(ctx).Info("VSCMaturedPacket handled", - "chainID", chainID, - "vscID", data.ValsetUpdateId, - ) -} - -// CompleteMaturedUnbondingOps attempts to complete all matured unbonding operations -func (k Keeper) completeMaturedUnbondingOps(ctx sdk.Context) { - for _, id := range k.ConsumeMaturedUnbondingOps(ctx) { - // Attempt to complete unbonding in staking module - err := k.stakingKeeper.UnbondingCanComplete(ctx, id) - if err != nil { - if errors.Is(err, stakingtypes.ErrNoUnbondingDelegation) { - // The unbonding was not found. - unbondingType, errGet := k.stakingKeeper.GetUnbondingType(ctx, id) - if errGet == nil && unbondingType == stakingtypes.UnbondingType_UnbondingDelegation { - // If this is an unbonding delegation, it may have been removed - // after through a CancelUnbondingDelegation message - k.Logger(ctx).Debug("unbonding delegation was already removed:", "unbondingID", id) - continue - } - } - // UnbondingCanComplete failing means that the state of the x/staking module - // of cosmos-sdk is invalid. An exception is the case handled above - panic(fmt.Sprintf("could not complete unbonding op: %s", err.Error())) - } - k.Logger(ctx).Debug("unbonding operation matured on all consumers", "opID", id) - } -} - // OnAcknowledgementPacket handles acknowledgments for sent VSC packets func (k Keeper) OnAcknowledgementPacket(ctx sdk.Context, packet channeltypes.Packet, ack channeltypes.Acknowledgement) error { if err := ack.GetError(); err != "" { @@ -146,9 +56,6 @@ func (k Keeper) OnTimeoutPacket(ctx sdk.Context, packet channeltypes.Packet) err // EndBlockVSU contains the EndBlock logic needed for // the Validator Set Update sub-protocol func (k Keeper) EndBlockVSU(ctx sdk.Context) { - // notify the staking module to complete all matured unbonding ops - k.completeMaturedUnbondingOps(ctx) - if k.BlocksUntilNextEpoch(ctx) == 0 { // only queue and send VSCPackets at the boundaries of an epoch @@ -219,10 +126,6 @@ func (k Keeper) SendVSCPacketsToChain(ctx sdk.Context, chainID, channelID string } return } - // set the VSC send timestamp for this packet; - // note that the VSC send timestamp are set when the packets - // are actually sent over IBC - k.SetVscSendTimestamp(ctx, chainID, data.ValsetUpdateId, ctx.BlockTime()) } k.DeletePendingVSCPackets(ctx, chainID) } @@ -263,11 +166,8 @@ func (k Keeper) QueueVSCPackets(ctx sdk.Context) { valUpdates := DiffValidators(currentValidators, nextValidators) k.SetConsumerValSet(ctx, chainID, nextValidators) - // 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 - unbondingOps := k.GetUnbondingOpsFromIndex(ctx, chainID, valUpdateID) - if len(valUpdates) != 0 || len(unbondingOps) != 0 { + // check whether there are changes in the validator set + if len(valUpdates) != 0 { // construct validator set change packet data packet := ccv.NewValidatorSetChangePacketData(valUpdates, valUpdateID, k.ConsumeSlashAcks(ctx, chainID)) k.AppendPendingVSCPackets(ctx, chainID, packet) @@ -275,7 +175,6 @@ func (k Keeper) QueueVSCPackets(ctx sdk.Context) { "chainID", chainID, "vscID", valUpdateID, "len updates", len(valUpdates), - "len unbonding ops", len(unbondingOps), ) } } @@ -306,6 +205,11 @@ func (k Keeper) EndBlockCIS(ctx sdk.Context) { valUpdateID := k.GetValidatorSetUpdateId(ctx) k.SetValsetUpdateBlockHeight(ctx, valUpdateID, blockHeight) k.Logger(ctx).Debug("vscID was mapped to block height", "vscID", valUpdateID, "height", blockHeight) + + // prune previous consumer validator addresses that are no longer needed + for _, chainID := range k.GetAllRegisteredConsumerChainIDs(ctx) { + k.PruneKeyAssignments(ctx, chainID) + } } // OnRecvSlashPacket delivers a received slash packet, validates it and @@ -430,7 +334,7 @@ func (k Keeper) HandleSlashPacket(ctx sdk.Context, chainID string, data ccv.Slas // Obtain provider chain consensus address using the consumer chain consensus address providerConsAddr := k.GetProviderAddrFromConsumerAddr(ctx, chainID, consumerConsAddr) - k.Logger(ctx).Debug("handling slash packet", + k.Logger(ctx).Debug("HandleSlashPacket", "chainID", chainID, "consumer cons addr", consumerConsAddr.String(), "provider cons addr", providerConsAddr.String(), @@ -449,10 +353,10 @@ func (k Keeper) HandleSlashPacket(ctx sdk.Context, chainID string, data ccv.Slas // stakingKeeper.Slash() panics otherwise if validator.IsUnbonded() { // if validator is not found or is unbonded, drop slash packet and log error. - // Note that it is impossible for the validator to be not found or unbonded if both the provider - // and the consumer are following the protocol. Thus if this branch is taken then one or both - // chains is incorrect, but it is impossible to tell which. - k.Logger(ctx).Error("validator already unbonded", "validator", providerConsAddr.String()) + k.Logger(ctx).Info( + "HandleSlashPacket - slash packet dropped because validator not found or is unbonded", + "provider cons addr", providerConsAddr.String(), + ) return } @@ -460,7 +364,7 @@ func (k Keeper) HandleSlashPacket(ctx sdk.Context, chainID string, data ccv.Slas if k.slashingKeeper.IsTombstoned(ctx, providerConsAddr.ToSdkConsAddr()) { // Log and drop packet if validator is tombstoned. k.Logger(ctx).Info( - "slash packet dropped because validator is already tombstoned", + "HandleSlashPacket - slash packet dropped because validator is already tombstoned", "provider cons addr", providerConsAddr.String(), ) return @@ -468,7 +372,10 @@ func (k Keeper) HandleSlashPacket(ctx sdk.Context, chainID string, data ccv.Slas infractionHeight, found := k.getMappedInfractionHeight(ctx, chainID, data.ValsetUpdateId) if !found { - k.Logger(ctx).Error("infraction height not found. But was found during slash packet validation") + k.Logger(ctx).Error( + "HandleSlashPacket - infraction height not found. But was found during slash packet validation", + "vscID", data.ValsetUpdateId, + ) // drop packet return } @@ -487,7 +394,7 @@ func (k Keeper) HandleSlashPacket(ctx sdk.Context, chainID string, data ccv.Slas k.Logger(ctx).Error("failed to jail vaidator", providerConsAddr.ToSdkConsAddr().String(), "err", err.Error()) return } - k.Logger(ctx).Info("validator jailed", "provider cons addr", providerConsAddr.String()) + k.Logger(ctx).Info("HandleSlashPacket - validator jailed", "provider cons addr", providerConsAddr.String()) jailDuration, err := k.slashingKeeper.DowntimeJailDuration(ctx) if err != nil { k.Logger(ctx).Error("failed to get jail duration", "err", err.Error()) @@ -513,60 +420,6 @@ func (k Keeper) HandleSlashPacket(ctx sdk.Context, chainID string, data ccv.Slas ) } -// EndBlockCCR contains the EndBlock logic needed for -// the Consumer Chain Removal sub-protocol -func (k Keeper) EndBlockCCR(ctx sdk.Context) { - currentTime := ctx.BlockTime() - currentTimeUint64 := uint64(currentTime.UnixNano()) - - for _, initTimeoutTimestamp := range k.GetAllInitTimeoutTimestamps(ctx) { - if currentTimeUint64 > initTimeoutTimestamp.Timestamp { - // initTimeout expired - // stop the consumer chain and unlock the unbonding. - // Note that the CCV channel was not established, - // thus closeChan is irrelevant - k.Logger(ctx).Info("about to remove timed out consumer chain - chain was not initialised", - "chainID", initTimeoutTimestamp.ChainId) - err := k.StopConsumerChain(ctx, initTimeoutTimestamp.ChainId, false) - if err != nil { - if errors.Is(err, providertypes.ErrConsumerChainNotFound) { - // consumer chain not found - continue - } - panic(fmt.Errorf("consumer chain failed to stop: %w", err)) - } - } - } - - for _, channelToChain := range k.GetAllChannelToChains(ctx) { - // Check if the first vscSendTimestamp in iterator + VscTimeoutPeriod - // exceed the current block time. - // Checking the first send timestamp for each chain is sufficient since - // timestamps are ordered by vsc ID. - // Note: GetFirstVscSendTimestamp panics if the internal state is invalid - vscSendTimestamp, found := k.GetFirstVscSendTimestamp(ctx, channelToChain.ChainId) - if found { - timeoutTimestamp := vscSendTimestamp.Timestamp.Add(k.GetParams(ctx).VscTimeoutPeriod) - if currentTime.After(timeoutTimestamp) { - // vscTimeout expired - // stop the consumer chain and release unbondings - k.Logger(ctx).Info("about to remove timed out consumer chain - VSCPacket timed out", - "chainID", channelToChain.ChainId, - "vscID", vscSendTimestamp.VscId, - ) - err := k.StopConsumerChain(ctx, channelToChain.ChainId, true) - if err != nil { - if errors.Is(err, providertypes.ErrConsumerChainNotFound) { - // consumer chain not found - continue - } - panic(fmt.Errorf("consumer chain failed to stop: %w", err)) - } - } - } - } -} - // getMappedInfractionHeight gets the infraction height mapped from val set ID for the given chain ID func (k Keeper) getMappedInfractionHeight(ctx sdk.Context, chainID string, valsetUpdateID uint64, diff --git a/x/ccv/provider/keeper/relay_test.go b/x/ccv/provider/keeper/relay_test.go index 25fdedfa56..90a17bcca4 100644 --- a/x/ccv/provider/keeper/relay_test.go +++ b/x/ccv/provider/keeper/relay_test.go @@ -11,9 +11,7 @@ import ( "github.com/golang/mock/gomock" "github.com/stretchr/testify/require" - codectypes "github.com/cosmos/cosmos-sdk/codec/types" cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" - cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" sdk "github.com/cosmos/cosmos-sdk/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" @@ -133,27 +131,6 @@ func TestQueueVSCPacketsDoesNotResetConsumerValidatorsHeights(t *testing.T) { require.Equal(t, chainHeight, cv.JoinHeight, "the consumer validator's height was not correctly set") } -// TestOnRecvVSCMaturedPacket tests the OnRecvVSCMaturedPacket method of the keeper. -// -// Note: Handling logic itself is not tested here. -func TestOnRecvVSCMaturedPacket(t *testing.T) { - providerKeeper, ctx, ctrl, _ := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) - defer ctrl.Finish() - providerKeeper.SetParams(ctx, providertypes.DefaultParams()) - - // Set channel to chain (faking multiple established channels) - providerKeeper.SetChannelToChain(ctx, "channel-1", "chain-1") - providerKeeper.SetChannelToChain(ctx, "channel-2", "chain-2") - - // Execute on recv for chain-1, confirm v1 result ack is returned - err := executeOnRecvVSCMaturedPacket(t, &providerKeeper, ctx, "channel-1", 1) - require.NoError(t, err) - - // Now queue a slash packet data instance for chain-2, confirm v1 result ack is returned - err = executeOnRecvVSCMaturedPacket(t, &providerKeeper, ctx, "channel-2", 2) - require.NoError(t, err) -} - // TestOnRecvDowntimeSlashPacket tests the OnRecvSlashPacket method specifically for downtime slash packets. func TestOnRecvDowntimeSlashPacket(t *testing.T) { providerKeeper, ctx, ctrl, mocks := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) @@ -257,22 +234,6 @@ func TestOnRecvDoubleSignSlashPacket(t *testing.T) { require.False(t, providerKeeper.GetSlashLog(ctx, randomAddress)) } -func executeOnRecvVSCMaturedPacket(t *testing.T, providerKeeper *keeper.Keeper, ctx sdk.Context, - channelID string, ibcSeqNum uint64, -) error { - t.Helper() - // Instantiate vsc matured packet data and bytes - data := testkeeper.GetNewVSCMaturedPacketData() - dataBz, err := data.Marshal() - require.NoError(t, err) - - return providerKeeper.OnRecvVSCMaturedPacket( - ctx, - channeltypes.NewPacket(dataBz, ibcSeqNum, "srcPort", "srcChan", "provider-port", channelID, clienttypes.Height{}, 1), - data, - ) -} - func executeOnRecvSlashPacket(t *testing.T, providerKeeper *keeper.Keeper, ctx sdk.Context, channelID string, ibcSeqNum uint64, packetData ccv.SlashPacketData, ) (ccv.PacketAckResult, error) { @@ -509,184 +470,6 @@ func TestHandleSlashPacket(t *testing.T) { } } -// TestHandleVSCMaturedPacket tests the handling of VSCMatured packets. -// Note that this method also tests the behaviour of AfterUnbondingInitiated. -func TestHandleVSCMaturedPacket(t *testing.T) { - pk, ctx, ctrl, mocks := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) - defer ctrl.Finish() - - // Init vscID - pk.SetValidatorSetUpdateId(ctx, 1) - - // Start first unbonding without any consumers registered - var unbondingOpId uint64 = 1 - gomock.InOrder( - mocks.MockStakingKeeper.EXPECT().GetUnbondingType(ctx, unbondingOpId).Return(stakingtypes.UnbondingType_Undefined, stakingtypes.ErrNoUnbondingType), - ) - - err := pk.Hooks().AfterUnbondingInitiated(ctx, unbondingOpId) - require.NoError(t, err) - // Check that no unbonding op was stored - _, found := pk.GetUnbondingOp(ctx, unbondingOpId) - require.False(t, found) - - // Increment vscID - pk.IncrementValidatorSetUpdateId(ctx) - require.Equal(t, uint64(2), pk.GetValidatorSetUpdateId(ctx)) - - // Register first consumer - pk.SetConsumerClientId(ctx, "chain-1", "client-1") - - // Create 2 validators - vals := []stakingtypes.Validator{} - valsPk := []cryptotypes.PubKey{} - for i := 0; i < 2; i++ { - pubkey, err := cryptocodec.FromTmPubKeyInterface(cryptotestutil.NewCryptoIdentityFromIntSeed(54321 + i).TMCryptoPubKey()) - require.NoError(t, err) - valsPk = append(valsPk, pubkey) - pkAny, err := codectypes.NewAnyWithValue(pubkey) - require.NoError(t, err) - vals = append(vals, stakingtypes.Validator{ConsensusPubkey: pkAny}) - } - - // Opt-in one validator to consumer - pk.SetConsumerValidator(ctx, "chain-1", providertypes.ConsumerValidator{ProviderConsAddr: valsPk[0].Address()}) - - // Start second unbonding - unbondingOpId = 2 - gomock.InOrder( - mocks.MockStakingKeeper.EXPECT().GetUnbondingType(ctx, unbondingOpId).Return(stakingtypes.UnbondingType_UnbondingDelegation, nil), - mocks.MockStakingKeeper.EXPECT().GetUnbondingDelegationByUnbondingID(ctx, unbondingOpId).Return( - stakingtypes.UnbondingDelegation{ - ValidatorAddress: sdk.ValAddress([]byte{1}).String(), - }, nil), - mocks.MockStakingKeeper.EXPECT().GetValidator(ctx, sdk.ValAddress([]byte{1})). - Return(vals[0], nil), - mocks.MockStakingKeeper.EXPECT().PutUnbondingOnHold(ctx, unbondingOpId).Return(nil), - ) - err = pk.Hooks().AfterUnbondingInitiated(ctx, unbondingOpId) - require.NoError(t, err) - // Check that an unbonding op was stored - expectedChains := []string{"chain-1"} - unbondingOp, found := pk.GetUnbondingOp(ctx, unbondingOpId) - require.True(t, found) - require.Equal(t, unbondingOpId, unbondingOp.Id) - require.Equal(t, expectedChains, unbondingOp.UnbondingConsumerChains) - // Check that the unbonding op index was stored - expectedUnbondingOpIds := []uint64{unbondingOpId} - ids, found := pk.GetUnbondingOpIndex(ctx, "chain-1", pk.GetValidatorSetUpdateId(ctx)) - require.True(t, found) - require.Equal(t, expectedUnbondingOpIds, ids) - - // Increment vscID - pk.IncrementValidatorSetUpdateId(ctx) - require.Equal(t, uint64(3), pk.GetValidatorSetUpdateId(ctx)) - - // Registered second consumer - pk.SetConsumerClientId(ctx, "chain-2", "client-2") - - // Opt-in both validators to second consumer - pk.SetConsumerValidator(ctx, "chain-2", providertypes.ConsumerValidator{ProviderConsAddr: valsPk[0].Address()}) - pk.SetConsumerValidator(ctx, "chain-2", providertypes.ConsumerValidator{ProviderConsAddr: valsPk[1].Address()}) - - // Start third and fourth unbonding - unbondingOpIds := []uint64{3, 4} - for _, id := range unbondingOpIds { - gomock.InOrder( - mocks.MockStakingKeeper.EXPECT().GetUnbondingType(ctx, id).Return(stakingtypes.UnbondingType_Redelegation, nil), - mocks.MockStakingKeeper.EXPECT().GetRedelegationByUnbondingID(ctx, id).Return( - stakingtypes.Redelegation{ - ValidatorSrcAddress: sdk.ValAddress([]byte{1}).String(), - }, nil), - mocks.MockStakingKeeper.EXPECT().GetValidator(ctx, sdk.ValAddress([]byte{1})). - Return(vals[0], nil), - mocks.MockStakingKeeper.EXPECT().PutUnbondingOnHold(ctx, id).Return(nil), - ) - err = pk.Hooks().AfterUnbondingInitiated(ctx, id) - require.NoError(t, err) - } - // Check that the unbonding ops were stored - expectedChains = []string{"chain-1", "chain-2"} - for _, id := range unbondingOpIds { - unbondingOp, found = pk.GetUnbondingOp(ctx, id) - require.True(t, found) - require.Equal(t, id, unbondingOp.Id) - require.Equal(t, expectedChains, unbondingOp.UnbondingConsumerChains) - } - // Check that the unbonding op index was stored - for _, chainID := range expectedChains { - ids, found := pk.GetUnbondingOpIndex(ctx, chainID, pk.GetValidatorSetUpdateId(ctx)) - require.True(t, found) - require.Equal(t, unbondingOpIds, ids) - } - - // Increment vscID - pk.IncrementValidatorSetUpdateId(ctx) - require.Equal(t, uint64(4), pk.GetValidatorSetUpdateId(ctx)) - - // Start fith unbonding - unbondingOpId = 5 - gomock.InOrder( - mocks.MockStakingKeeper.EXPECT().GetUnbondingType(ctx, unbondingOpId).Return(stakingtypes.UnbondingType_ValidatorUnbonding, nil), - mocks.MockStakingKeeper.EXPECT().GetValidatorByUnbondingID(ctx, unbondingOpId).Return( - stakingtypes.Validator{ - OperatorAddress: sdk.ValAddress([]byte{1}).String(), - }, nil), - mocks.MockStakingKeeper.EXPECT().GetValidator(ctx, sdk.ValAddress([]byte{1})). - Return(vals[1], nil), - mocks.MockStakingKeeper.EXPECT().PutUnbondingOnHold(ctx, unbondingOpId).Return(nil), - ) - err = pk.Hooks().AfterUnbondingInitiated(ctx, unbondingOpId) - require.NoError(t, err) - - // Check that an unbonding op was stored for chain-2 only - // since it's the only consumer the unbonding validator has opted-in to - expectedChains = []string{"chain-2"} - unbondingOp, found = pk.GetUnbondingOp(ctx, unbondingOpId) - require.True(t, found) - require.Equal(t, unbondingOpId, unbondingOp.Id) - require.Equal(t, expectedChains, unbondingOp.UnbondingConsumerChains) - - // Handle VSCMatured packet from chain-1 for vscID 1. - // Note that no VSCPacket was sent as the chain was not yet registered, - // but the code should still work - pk.HandleVSCMaturedPacket(ctx, "chain-1", ccv.VSCMaturedPacketData{ValsetUpdateId: 1}) - require.Empty(t, pk.ConsumeMaturedUnbondingOps(ctx)) - - // Handle VSCMatured packet from chain-1 for vscID 2. - pk.HandleVSCMaturedPacket(ctx, "chain-1", ccv.VSCMaturedPacketData{ValsetUpdateId: 2}) - // Check that the unbonding operation with ID=2 can complete - require.Equal(t, []uint64{2}, pk.ConsumeMaturedUnbondingOps(ctx)) - // Check that the unbonding op index was removed - _, found = pk.GetUnbondingOpIndex(ctx, "chain-1", 2) - require.False(t, found) - - // Handle VSCMatured packet from chain-2 for vscID 3. - pk.HandleVSCMaturedPacket(ctx, "chain-2", ccv.VSCMaturedPacketData{ValsetUpdateId: 3}) - // Check that the unbonding operations with IDs 3 and 4 no longer wait for chain-2 - expectedChains = []string{"chain-1"} - unbondingOpIds = []uint64{3, 4} - for _, id := range unbondingOpIds { - unbondingOp, found := pk.GetUnbondingOp(ctx, id) - require.True(t, found) - require.Equal(t, id, unbondingOp.Id) - require.Equal(t, expectedChains, unbondingOp.UnbondingConsumerChains) - } - // Check that no unbonding operation can complete - require.Empty(t, pk.ConsumeMaturedUnbondingOps(ctx)) - // Check that the unbonding op index was removed - _, found = pk.GetUnbondingOpIndex(ctx, "chain-2", 3) - require.False(t, found) - - // Handle VSCMatured packet from chain-1 for vscID 3. - pk.HandleVSCMaturedPacket(ctx, "chain-1", ccv.VSCMaturedPacketData{ValsetUpdateId: 3}) - // Check that the unbonding operations with IDs 3 and 4 can complete - require.Equal(t, unbondingOpIds, pk.ConsumeMaturedUnbondingOps(ctx)) - // Check that the unbonding op index was removed - _, found = pk.GetUnbondingOpIndex(ctx, "chain-1", 3) - require.False(t, found) -} - // TestSendVSCPacketsToChainFailure tests the SendVSCPacketsToChain method failing func TestSendVSCPacketsToChainFailure(t *testing.T) { // Keeper setup diff --git a/x/ccv/provider/keeper/throttle_legacy.go b/x/ccv/provider/keeper/throttle_legacy.go deleted file mode 100644 index 604f3a08c4..0000000000 --- a/x/ccv/provider/keeper/throttle_legacy.go +++ /dev/null @@ -1,111 +0,0 @@ -package keeper - -import ( - "fmt" - - storetypes "cosmossdk.io/store/types" - sdktypes "github.com/cosmos/cosmos-sdk/types" - - providertypes "github.com/cosmos/interchain-security/v5/x/ccv/provider/types" - ccvtypes "github.com/cosmos/interchain-security/v5/x/ccv/types" -) - -// Pending packet data type enum, used to encode the type of packet data stored at each entry in the mutual queue. -// Note this type is copy/pasted from throttle v1 code. -const ( - slashPacketData byte = iota - vscMaturedPacketData -) - -// Deprecated: LegacyGetAllThrottledPacketData is deprecated for ICS >= v4.0.0. -// LegacyGetAllThrottledPacketData returns all throttled packet data that was queued on the provider for a given consumer chain. -func (k Keeper) LegacyGetAllThrottledPacketData(ctx sdktypes.Context, consumerChainID string) ( - slashData []ccvtypes.SlashPacketData, vscMaturedData []ccvtypes.VSCMaturedPacketData, -) { - slashData = []ccvtypes.SlashPacketData{} - vscMaturedData = []ccvtypes.VSCMaturedPacketData{} - - store := ctx.KVStore(k.storeKey) - iteratorPrefix := providertypes.ChainIdWithLenKey(providertypes.ThrottledPacketDataKeyPrefix(), consumerChainID) - iterator := storetypes.KVStorePrefixIterator(store, iteratorPrefix) - defer iterator.Close() - - for ; iterator.Valid(); iterator.Next() { - bz := iterator.Value() - switch bz[0] { - case slashPacketData: - d := ccvtypes.SlashPacketData{} - if err := d.Unmarshal(bz[1:]); err != nil { - k.Logger(ctx).Error(fmt.Sprintf("failed to unmarshal slash packet data: %v", err)) - continue - } - slashData = append(slashData, d) - case vscMaturedPacketData: - d := ccvtypes.VSCMaturedPacketData{} - if err := d.Unmarshal(bz[1:]); err != nil { - k.Logger(ctx).Error(fmt.Sprintf("failed to unmarshal vsc matured packet data: %v", err)) - continue - } - vscMaturedData = append(vscMaturedData, d) - default: - k.Logger(ctx).Error(fmt.Sprintf("invalid packet data type: %v", bz[0])) - continue - } - } - - return slashData, vscMaturedData -} - -// Deprecated: LegacyDeleteThrottledPacketDataForConsumer is deprecated for ICS >= v4.0.0. -// LegacyDeleteThrottledPacketDataForConsumer removes all throttled packet data that was queued on the provider for a given consumer chain. -func (k Keeper) LegacyDeleteThrottledPacketDataForConsumer(ctx sdktypes.Context, consumerChainID string) { - store := ctx.KVStore(k.storeKey) - iteratorPrefix := providertypes.ChainIdWithLenKey(providertypes.ThrottledPacketDataKeyPrefix(), consumerChainID) - iterator := storetypes.KVStorePrefixIterator(store, iteratorPrefix) - defer iterator.Close() - - keysToDel := [][]byte{} - for ; iterator.Valid(); iterator.Next() { - keysToDel = append(keysToDel, iterator.Key()) - } - // Delete data for this consumer - for _, key := range keysToDel { - store.Delete(key) - } - - // Delete size of data queue for this consumer - store.Delete(providertypes.ThrottledPacketDataSizeKey(consumerChainID)) -} - -// Deprecated: LegacyQueueThrottledPacketData is deprecated for ICS >= v4.0.0. -// LegacyQueueThrottledPacketData queues throttled packet data for a given consumer chain on the provider. -// The method should not be used because the provider does not process throttled packet data anymore. -func (k Keeper) LegacyQueueThrottledPacketData( - ctx sdktypes.Context, consumerChainID string, ibcSeqNum uint64, packetData interface{}, -) error { - store := ctx.KVStore(k.storeKey) - - var bz []byte - var err error - switch data := packetData.(type) { - case ccvtypes.SlashPacketData: - bz, err = data.Marshal() - if err != nil { - return fmt.Errorf("failed to marshal slash packet data: %v", err) - } - bz = append([]byte{slashPacketData}, bz...) - case ccvtypes.VSCMaturedPacketData: - bz, err = data.Marshal() - if err != nil { - return fmt.Errorf("failed to marshal vsc matured packet data: %v", err) - } - bz = append([]byte{vscMaturedPacketData}, bz...) - default: - // Indicates a developer error, this method should only be called - // by tests, QueueThrottledSlashPacketData, or QueueThrottledVSCMaturedPacketData. - panic(fmt.Sprintf("unexpected packet data type: %T", data)) - } - - store.Set(providertypes.ThrottledPacketDataKey(consumerChainID, ibcSeqNum), bz) - return nil -} diff --git a/x/ccv/provider/migrations/migrator.go b/x/ccv/provider/migrations/migrator.go index b031f9705b..4678fe83cd 100644 --- a/x/ccv/provider/migrations/migrator.go +++ b/x/ccv/provider/migrations/migrator.go @@ -1,30 +1,38 @@ package migrations import ( + "fmt" + storetypes "cosmossdk.io/store/types" - "github.com/cosmos/cosmos-sdk/codec" sdktypes "github.com/cosmos/cosmos-sdk/types" paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" providerkeeper "github.com/cosmos/interchain-security/v5/x/ccv/provider/keeper" - v3 "github.com/cosmos/interchain-security/v5/x/ccv/provider/migrations/v3" v4 "github.com/cosmos/interchain-security/v5/x/ccv/provider/migrations/v4" v5 "github.com/cosmos/interchain-security/v5/x/ccv/provider/migrations/v5" v6 "github.com/cosmos/interchain-security/v5/x/ccv/provider/migrations/v6" v7 "github.com/cosmos/interchain-security/v5/x/ccv/provider/migrations/v7" + v8 "github.com/cosmos/interchain-security/v5/x/ccv/provider/migrations/v8" ) // Migrator is a struct for handling in-place store migrations. type Migrator struct { providerKeeper providerkeeper.Keeper paramSpace paramtypes.Subspace - cdc codec.BinaryCodec storeKey storetypes.StoreKey } // NewMigrator returns a new Migrator. -func NewMigrator(providerKeeper providerkeeper.Keeper, paramSpace paramtypes.Subspace) Migrator { - return Migrator{providerKeeper: providerKeeper, paramSpace: paramSpace} +func NewMigrator( + providerKeeper providerkeeper.Keeper, + paramSpace paramtypes.Subspace, + storeKey storetypes.StoreKey, +) Migrator { + return Migrator{ + providerKeeper: providerKeeper, + paramSpace: paramSpace, + storeKey: storeKey, + } } // Migrating consensus version 1 to 2 is a no-op. @@ -32,12 +40,16 @@ func NewMigrator(providerKeeper providerkeeper.Keeper, paramSpace paramtypes.Sub // First run provider@v2.x.y in production to migrate from consensus version 1 to 2. // Then, in order to migrate to consensus version 3, first upgrade to provider@v3.x.y. func (m Migrator) Migrate1to2(ctx sdktypes.Context) error { - return nil + return fmt.Errorf("state migration failed: " + + "first run provider@v2.x.y in production to migrate from consensus version 1 to 2; " + + "then, in order to migrate to consensus version 3, first upgrade to provider@v3.x.y") } // Migrate2to3 migrates x/ccvprovider state from consensus version 2 to 3. +// First run provider@v4.0.x in production to migrate from consensus version 2 to 3. func (m Migrator) Migrate2to3(ctx sdktypes.Context) error { - return v3.MigrateQueuedPackets(ctx, m.providerKeeper) + return fmt.Errorf("state migration failed: " + + "first run provider@v4.0.x in production to migrate from consensus version 2 to 3") } // Migrate3to4 migrates x/ccvprovider state from consensus version 3 to 4. @@ -54,7 +66,8 @@ func (m Migrator) Migrate4to5(ctx sdktypes.Context) error { return nil } -// Migrate5to6 consists of setting the `NumberOfEpochsToStartReceivingRewards` param, as well as +// Migrate5to6 migrates x/ccvprovider state from consensus version 5 to 6. +// It consists of setting the `NumberOfEpochsToStartReceivingRewards` param, as well as // computing and storing the minimal power in the top N for all registered consumer chains. func (m Migrator) Migrate5to6(ctx sdktypes.Context) error { v6.MigrateParams(ctx, m.paramSpace) @@ -67,3 +80,19 @@ func (m Migrator) Migrate5to6(ctx sdktypes.Context) error { func (m Migrator) Migrate6to7(ctx sdktypes.Context) error { return v7.MigrateLegacyParams(ctx, m.providerKeeper, m.paramSpace) } + +// Migrate7to8 migrates x/ccvprovider state from consensus version 7 to 8. +// The migration consists of the following actions: +// - complete the outstanding paused unbonding ops waiting for VSCMaturedPackets from consumer chains +// - migrate the ConsumerAddrsToPrune index to ConsumerAddrsToPruneV2 +// - cleanup deprecated state +func (m Migrator) Migrate7to8(ctx sdktypes.Context) error { + store := ctx.KVStore(m.storeKey) + v8.CompleteUnbondingOps(ctx, store, m.providerKeeper) + if err := v8.MigrateConsumerAddrsToPrune(ctx, store, m.providerKeeper); err != nil { + return err + } + v8.CleanupState(store) + + return nil +} diff --git a/x/ccv/provider/migrations/v3/migration_test.go b/x/ccv/provider/migrations/v3/migration_test.go deleted file mode 100644 index 56d6b617d9..0000000000 --- a/x/ccv/provider/migrations/v3/migration_test.go +++ /dev/null @@ -1,117 +0,0 @@ -package v3 - -import ( - "testing" - "time" - - "github.com/stretchr/testify/require" - - testutil "github.com/cosmos/interchain-security/v5/testutil/keeper" -) - -func TestMigrate2To3(t *testing.T) { - providerKeeper, ctx, ctrl, _ := testutil.GetProviderKeeperAndCtx(t, testutil.NewInMemKeeperParams(t)) - defer ctrl.Finish() - - // Set consumer client ids to mock consumers being connected to provider - providerKeeper.SetConsumerClientId(ctx, "chain-1", "client-1") - providerKeeper.SetConsumerClientId(ctx, "chain-2", "client-2") - providerKeeper.SetConsumerClientId(ctx, "chain-3", "client-3") - - // Queue some data for chain-1 - providerKeeper.LegacyQueueThrottledPacketData( - ctx, "chain-1", 66, testutil.GetNewSlashPacketData()) - providerKeeper.LegacyQueueThrottledPacketData( - ctx, "chain-1", 67, testutil.GetNewVSCMaturedPacketData()) - providerKeeper.LegacyQueueThrottledPacketData( - ctx, "chain-1", 68, testutil.GetNewSlashPacketData()) - providerKeeper.LegacyQueueThrottledPacketData( - ctx, "chain-1", 69, testutil.GetNewVSCMaturedPacketData()) - - // Queue some data for chain-2 - providerKeeper.LegacyQueueThrottledPacketData( - ctx, "chain-2", 789, testutil.GetNewVSCMaturedPacketData()) - providerKeeper.LegacyQueueThrottledPacketData( - ctx, "chain-2", 790, testutil.GetNewSlashPacketData()) - providerKeeper.LegacyQueueThrottledPacketData( - ctx, "chain-2", 791, testutil.GetNewVSCMaturedPacketData()) - - // Queue some data for chain-3 - providerKeeper.LegacyQueueThrottledPacketData( - ctx, "chain-3", 123, testutil.GetNewSlashPacketData()) - providerKeeper.LegacyQueueThrottledPacketData( - ctx, "chain-3", 124, testutil.GetNewVSCMaturedPacketData()) - providerKeeper.LegacyQueueThrottledPacketData( - ctx, "chain-3", 125, testutil.GetNewVSCMaturedPacketData()) - - // Confirm getter methods return expected values - slash1, vscm1 := providerKeeper.LegacyGetAllThrottledPacketData(ctx, "chain-1") - require.Len(t, slash1, 2) - require.Len(t, vscm1, 2) - - slash2, vscm2 := providerKeeper.LegacyGetAllThrottledPacketData(ctx, "chain-2") - require.Len(t, slash2, 1) - require.Len(t, vscm2, 2) - - slash3, vscm3 := providerKeeper.LegacyGetAllThrottledPacketData(ctx, "chain-3") - require.Len(t, slash3, 1) - require.Len(t, vscm3, 2) - - // Set vsc send timestamp for every queued vsc matured packet, - // as a way to assert that the vsc matured packets are handled in the migration. - // - // That is, timestamp should exist before a vsc matured packet is handled, - // and deleted after handling. - for _, data := range vscm1 { - providerKeeper.SetVscSendTimestamp(ctx, "chain-1", data.ValsetUpdateId, time.Now()) - } - for _, data := range vscm2 { - providerKeeper.SetVscSendTimestamp(ctx, "chain-2", data.ValsetUpdateId, time.Now()) - } - for _, data := range vscm3 { - providerKeeper.SetVscSendTimestamp(ctx, "chain-3", data.ValsetUpdateId, time.Now()) - } - - // Confirm timestamps are set - for _, data := range vscm1 { - _, found := providerKeeper.GetVscSendTimestamp(ctx, "chain-1", data.ValsetUpdateId) - require.True(t, found) - } - for _, data := range vscm2 { - _, found := providerKeeper.GetVscSendTimestamp(ctx, "chain-2", data.ValsetUpdateId) - require.True(t, found) - } - for _, data := range vscm3 { - _, found := providerKeeper.GetVscSendTimestamp(ctx, "chain-3", data.ValsetUpdateId) - require.True(t, found) - } - - // Run migration - err := MigrateQueuedPackets(ctx, providerKeeper) - require.NoError(t, err) - - // Confirm throttled data is now deleted - slash1, vscm1 = providerKeeper.LegacyGetAllThrottledPacketData(ctx, "chain-1") - require.Empty(t, slash1) - require.Empty(t, vscm1) - slash2, vscm2 = providerKeeper.LegacyGetAllThrottledPacketData(ctx, "chain-2") - require.Empty(t, slash2) - require.Empty(t, vscm2) - slash3, vscm3 = providerKeeper.LegacyGetAllThrottledPacketData(ctx, "chain-3") - require.Empty(t, slash3) - require.Empty(t, vscm3) - - // Confirm timestamps are deleted, meaning vsc matured packets were handled - for _, data := range vscm1 { - _, found := providerKeeper.GetVscSendTimestamp(ctx, "chain-1", data.ValsetUpdateId) - require.False(t, found) - } - for _, data := range vscm2 { - _, found := providerKeeper.GetVscSendTimestamp(ctx, "chain-2", data.ValsetUpdateId) - require.False(t, found) - } - for _, data := range vscm3 { - _, found := providerKeeper.GetVscSendTimestamp(ctx, "chain-3", data.ValsetUpdateId) - require.False(t, found) - } -} diff --git a/x/ccv/provider/migrations/v3/migrations.go b/x/ccv/provider/migrations/v3/migrations.go deleted file mode 100644 index 8c17000b0b..0000000000 --- a/x/ccv/provider/migrations/v3/migrations.go +++ /dev/null @@ -1,25 +0,0 @@ -package v3 - -import ( - "fmt" - - sdk "github.com/cosmos/cosmos-sdk/types" - - providerkeeper "github.com/cosmos/interchain-security/v5/x/ccv/provider/keeper" -) - -// MigrateQueuedPackets processes all queued packet data for all consumer chains that were stored -// on the provider in the v2 consensus version (jail throttling v1). -func MigrateQueuedPackets(ctx sdk.Context, k providerkeeper.Keeper) error { - for _, consumerChainID := range k.GetAllRegisteredConsumerChainIDs(ctx) { - slashData, vscmData := k.LegacyGetAllThrottledPacketData(ctx, consumerChainID) - if len(slashData) > 0 { - k.Logger(ctx).Error(fmt.Sprintf("slash data being dropped: %v", slashData)) - } - for _, data := range vscmData { - k.HandleVSCMaturedPacket(ctx, consumerChainID, data) - } - k.LegacyDeleteThrottledPacketDataForConsumer(ctx, consumerChainID) - } - return nil -} diff --git a/x/ccv/provider/migrations/v7/legacy_params.go b/x/ccv/provider/migrations/v7/legacy_params.go index a8c6d5218d..39c4f65788 100644 --- a/x/ccv/provider/migrations/v7/legacy_params.go +++ b/x/ccv/provider/migrations/v7/legacy_params.go @@ -32,20 +32,6 @@ func getCCVTimeoutPeriod(ctx sdk.Context, paramSpace ccvtypes.LegacyParamSubspac return p } -// getInitTimeoutPeriod returns the init timeout period -func getInitTimeoutPeriod(ctx sdk.Context, paramSpace ccvtypes.LegacyParamSubspace) time.Duration { - var p time.Duration - paramSpace.Get(ctx, types.KeyInitTimeoutPeriod, &p) - return p -} - -// getVscTimeoutPeriod returns the vsc timeout period -func getVscTimeoutPeriod(ctx sdk.Context, paramSpace ccvtypes.LegacyParamSubspace) time.Duration { - var p time.Duration - paramSpace.Get(ctx, types.KeyVscTimeoutPeriod, &p) - return p -} - // getSlashMeterReplenishPeriod returns the period in which: // Once the slash meter becomes not-full, the slash meter is replenished after this period. func getSlashMeterReplenishPeriod(ctx sdk.Context, paramSpace ccvtypes.LegacyParamSubspace) time.Duration { @@ -88,8 +74,6 @@ func GetParamsLegacy(ctx sdk.Context, paramspace ccvtypes.LegacyParamSubspace) t getTemplateClient(ctx, paramspace), getTrustingPeriodFraction(ctx, paramspace), getCCVTimeoutPeriod(ctx, paramspace), - getInitTimeoutPeriod(ctx, paramspace), - getVscTimeoutPeriod(ctx, paramspace), getSlashMeterReplenishPeriod(ctx, paramspace), getSlashMeterReplenishFraction(ctx, paramspace), getConsumerRewardDenomRegistrationFee(ctx, paramspace), diff --git a/x/ccv/provider/migrations/v7/migrations_test.go b/x/ccv/provider/migrations/v7/migrations_test.go index f4ee763263..4b983205cc 100644 --- a/x/ccv/provider/migrations/v7/migrations_test.go +++ b/x/ccv/provider/migrations/v7/migrations_test.go @@ -23,8 +23,6 @@ func TestMigrateParams(t *testing.T) { inMemParams.ParamsSubspace.Set(ctx, providertypes.KeyTemplateClient, defaultParams.TemplateClient) inMemParams.ParamsSubspace.Set(ctx, providertypes.KeyTrustingPeriodFraction, defaultParams.TrustingPeriodFraction) inMemParams.ParamsSubspace.Set(ctx, ccvtypes.KeyCCVTimeoutPeriod, defaultParams.CcvTimeoutPeriod) - inMemParams.ParamsSubspace.Set(ctx, providertypes.KeyInitTimeoutPeriod, defaultParams.InitTimeoutPeriod) - inMemParams.ParamsSubspace.Set(ctx, providertypes.KeyVscTimeoutPeriod, defaultParams.VscTimeoutPeriod) inMemParams.ParamsSubspace.Set(ctx, providertypes.KeySlashMeterReplenishPeriod, defaultParams.SlashMeterReplenishPeriod) inMemParams.ParamsSubspace.Set(ctx, providertypes.KeySlashMeterReplenishFraction, defaultParams.SlashMeterReplenishFraction) inMemParams.ParamsSubspace.Set(ctx, providertypes.KeyConsumerRewardDenomRegistrationFee, defaultParams.ConsumerRewardDenomRegistrationFee) diff --git a/x/ccv/provider/migrations/v8/migrations.go b/x/ccv/provider/migrations/v8/migrations.go new file mode 100644 index 0000000000..cdf299f91f --- /dev/null +++ b/x/ccv/provider/migrations/v8/migrations.go @@ -0,0 +1,120 @@ +package v8 + +import ( + "encoding/binary" + "time" + + storetypes "cosmossdk.io/store/types" + sdk "github.com/cosmos/cosmos-sdk/types" + + providerkeeper "github.com/cosmos/interchain-security/v5/x/ccv/provider/keeper" + providertypes "github.com/cosmos/interchain-security/v5/x/ccv/provider/types" +) + +const ( + LegacyUnbondingOpBytePrefix = byte(11) + LegacyConsumerAddrsToPruneBytePrefix = byte(25) + LegacyMaturedUnbondingOpsByteKey = byte(1) + LegacyUnbondingOpIndexBytePrefix = byte(12) + LegacyInitTimeoutTimestampBytePrefix = byte(8) + LegacyVscSendTimestampBytePrefix = byte(18) + LegacyVSCMaturedHandledThisBlockBytePrefix = byte(28) +) + +// CompleteUnbondingOps completes all unbonding operations. +// Note that it must be executed before CleanupState. +func CompleteUnbondingOps(ctx sdk.Context, store storetypes.KVStore, pk providerkeeper.Keeper) { + iterator := storetypes.KVStorePrefixIterator(store, []byte{LegacyUnbondingOpBytePrefix}) + defer func() { + if err := iterator.Close(); err != nil { + pk.Logger(ctx).Error("Failed to close iterator", "error", err) + } + }() + + for ; iterator.Valid(); iterator.Next() { + id := binary.BigEndian.Uint64(iterator.Key()[1:]) + if err := pk.UnbondingCanComplete(ctx, id); err != nil { + pk.Logger(ctx).Error("UnbondingCanComplete failed", "unbondingID", id, "error", err.Error()) + } + } +} + +// MigrateConsumerAddrsToPrune migrates the ConsumerAddrsToPrune index to ConsumerAddrsToPruneV2. +// Note: This migration must be done before removing the VscSendTimestamp index +func MigrateConsumerAddrsToPrune(ctx sdk.Context, store storetypes.KVStore, pk providerkeeper.Keeper) error { + iterator := storetypes.KVStorePrefixIterator(store, []byte{LegacyConsumerAddrsToPruneBytePrefix}) + defer iterator.Close() + + unbondingPeriod, err := pk.UnbondingTime(ctx) + if err != nil { + return err + } + + for ; iterator.Valid(); iterator.Next() { + chainID, vscID, err := providertypes.ParseChainIdAndUintIdKey(LegacyConsumerAddrsToPruneBytePrefix, iterator.Key()) + if err != nil { + pk.Logger(ctx).Error("ParseChainIdAndUintIdKey failed while migrating ConsumerAddrsToPrune", + "key", string(iterator.Key()), + "error", err.Error(), + ) + continue + } + // use the VscSendTimestamp index to compute the timestamp after which this consumer address can be pruned + vscSendTimestampKey := providertypes.ChainIdAndUintIdKey(LegacyVscSendTimestampBytePrefix, chainID, vscID) + var sentTime time.Time + if timeBz := store.Get(vscSendTimestampKey); timeBz != nil { + if ts, err := sdk.ParseTimeBytes(timeBz); err == nil { + sentTime = ts + } else { + pk.Logger(ctx).Error("MigrateConsumerAddrsToPrune failed parsing VSC send timestamp key", "error", err.Error()) + continue + } + } else { + pk.Logger(ctx).Error( + "MigrateConsumerAddrsToPrune cannot find VSC send timestamp", + "chainID", chainID, + "vscID", vscID, + ) + continue + } + pruneAfterTs := sentTime.Add(unbondingPeriod).UTC() + + var addrs providertypes.AddressList + err = addrs.Unmarshal(iterator.Value()) + if err != nil { + pk.Logger(ctx).Error("MigrateConsumerAddrsToPrune failed unmarshaling data from store", "key", string(iterator.Value())) + continue + } + + for _, addr := range addrs.Addresses { + consumerAddr := providertypes.NewConsumerConsAddress(addr) + pk.AppendConsumerAddrsToPrune(ctx, chainID, pruneAfterTs, consumerAddr) + } + } + + return nil +} + +// CleanupState removes deprecated state +func CleanupState(store storetypes.KVStore) { + removePrefix(store, LegacyMaturedUnbondingOpsByteKey) + removePrefix(store, LegacyUnbondingOpBytePrefix) + removePrefix(store, LegacyUnbondingOpIndexBytePrefix) + removePrefix(store, LegacyInitTimeoutTimestampBytePrefix) + removePrefix(store, LegacyVscSendTimestampBytePrefix) + removePrefix(store, LegacyVSCMaturedHandledThisBlockBytePrefix) + removePrefix(store, LegacyConsumerAddrsToPruneBytePrefix) +} + +func removePrefix(store storetypes.KVStore, prefix byte) { + iterator := storetypes.KVStorePrefixIterator(store, []byte{prefix}) + defer iterator.Close() + + var keysToDel [][]byte + for ; iterator.Valid(); iterator.Next() { + keysToDel = append(keysToDel, iterator.Key()) + } + for _, delKey := range keysToDel { + store.Delete(delKey) + } +} diff --git a/x/ccv/provider/migrations/v8/migrations_test.go b/x/ccv/provider/migrations/v8/migrations_test.go new file mode 100644 index 0000000000..8c23fccc64 --- /dev/null +++ b/x/ccv/provider/migrations/v8/migrations_test.go @@ -0,0 +1,140 @@ +package v8 + +import ( + "testing" + "time" + + "github.com/golang/mock/gomock" + + storetypes "cosmossdk.io/store/types" + sdk "github.com/cosmos/cosmos-sdk/types" + testutil "github.com/cosmos/interchain-security/v5/testutil/keeper" + providertypes "github.com/cosmos/interchain-security/v5/x/ccv/provider/types" + "github.com/stretchr/testify/require" +) + +func legacyConsumerAddrsToPruneKey(chainID string, vscID uint64) []byte { + return providertypes.ChainIdAndUintIdKey(LegacyConsumerAddrsToPruneBytePrefix, chainID, vscID) +} + +func legacyAppendConsumerAddrsToPrune( + store storetypes.KVStore, + chainID string, + vscID uint64, + consumerAddr providertypes.ConsumerConsAddress, +) { + bz := store.Get(legacyConsumerAddrsToPruneKey(chainID, vscID)) + var consumerAddrsToPrune providertypes.AddressList + if bz != nil { + err := consumerAddrsToPrune.Unmarshal(bz) + if err != nil { + // An error here would indicate something is very wrong, + // the data bytes are assumed to be correctly serialized by previous calls to this method. + panic(err) + } + } + consumerAddrsToPrune.Addresses = append(consumerAddrsToPrune.Addresses, consumerAddr.ToSdkConsAddr()) + bz, err := consumerAddrsToPrune.Marshal() + if err != nil { + // An error here would indicate something is very wrong, + // consumerAddrsToPrune is instantiated in this method and should be able to be marshaled. + panic(err) + } + store.Set(legacyConsumerAddrsToPruneKey(chainID, vscID), bz) +} + +func legacyVscSendingTimestampKey(chainID string, vscID uint64) []byte { + return providertypes.ChainIdAndUintIdKey(LegacyVscSendTimestampBytePrefix, chainID, vscID) +} + +func legacySetVscSendTimestamp( + store storetypes.KVStore, + chainID string, + vscID uint64, + timestamp time.Time, +) { + // Convert timestamp into bytes for storage + timeBz := sdk.FormatTimeBytes(timestamp) + + store.Set(legacyVscSendingTimestampKey(chainID, vscID), timeBz) +} + +func TestMigrateConsumerAddrsToPrune(t *testing.T) { + t.Helper() + inMemParams := testutil.NewInMemKeeperParams(t) + pk, ctx, ctrl, mocks := testutil.GetProviderKeeperAndCtx(t, inMemParams) + defer ctrl.Finish() + + store := ctx.KVStore(inMemParams.StoreKey) + + consumerAddrsToPrune := []struct { + chainId string + vscId uint64 + address providertypes.ConsumerConsAddress + }{ + {"chain-1", 1, providertypes.NewConsumerConsAddress([]byte{0x01})}, + {"chain-1", 1, providertypes.NewConsumerConsAddress([]byte{0x02})}, + {"chain-2", 1, providertypes.NewConsumerConsAddress([]byte{0x03})}, + {"chain-1", 2, providertypes.NewConsumerConsAddress([]byte{0x04})}, + {"chain-1", 3, providertypes.NewConsumerConsAddress([]byte{0x05})}, + } + for _, x := range consumerAddrsToPrune { + legacyAppendConsumerAddrsToPrune(store, x.chainId, x.vscId, x.address) + } + + ts1 := time.Now().UTC() + ts2 := ts1.Add(time.Minute).UTC() + ts3 := ts2.Add(time.Hour).UTC() + vscSendTimestamps := []struct { + chainId string + vscId uint64 + ts time.Time + }{ + {"chain-1", 1, ts1}, + {"chain-1", 2, ts2}, + {"chain-1", 3, ts3}, + {"chain-2", 1, ts1}, + } + for _, x := range vscSendTimestamps { + legacySetVscSendTimestamp(store, x.chainId, x.vscId, x.ts) + } + + gomock.InOrder( + mocks.MockStakingKeeper.EXPECT().UnbondingTime(ctx).Times(2), + ) + + unbondingPeriod, err := pk.UnbondingTime(ctx) + require.NoError(t, err) + + err = MigrateConsumerAddrsToPrune(ctx, store, pk) + require.NoError(t, err) + + consumerAddrs := pk.GetAllConsumerAddrsToPrune(ctx, "chain-1") + require.Len(t, consumerAddrs, 3) + // two addresses with ts1 + require.Equal(t, ts1.Add(unbondingPeriod).UTC(), consumerAddrs[0].PruneTs) + require.Len(t, consumerAddrs[0].ConsumerAddrs.Addresses, 2) + consumerAddr := providertypes.NewConsumerConsAddress(consumerAddrs[0].ConsumerAddrs.Addresses[0]) + require.Equal(t, consumerAddrsToPrune[0].address, consumerAddr) + consumerAddr = providertypes.NewConsumerConsAddress(consumerAddrs[0].ConsumerAddrs.Addresses[1]) + require.Equal(t, consumerAddrsToPrune[1].address, consumerAddr) + // one address with ts2 + require.Equal(t, ts2.Add(unbondingPeriod).UTC(), consumerAddrs[1].PruneTs) + require.Len(t, consumerAddrs[1].ConsumerAddrs.Addresses, 1) + consumerAddr = providertypes.NewConsumerConsAddress(consumerAddrs[1].ConsumerAddrs.Addresses[0]) + require.Equal(t, consumerAddrsToPrune[3].address, consumerAddr) + // one address with ts3 + require.Equal(t, ts3.Add(unbondingPeriod).UTC(), consumerAddrs[2].PruneTs) + require.Len(t, consumerAddrs[2].ConsumerAddrs.Addresses, 1) + consumerAddr = providertypes.NewConsumerConsAddress(consumerAddrs[2].ConsumerAddrs.Addresses[0]) + require.Equal(t, consumerAddrsToPrune[4].address, consumerAddr) + + consumerAddrs = pk.GetAllConsumerAddrsToPrune(ctx, "chain-2") + require.Len(t, consumerAddrs, 1) + // one address with ts1 + require.Equal(t, ts1.Add(unbondingPeriod).UTC(), consumerAddrs[0].PruneTs) + require.Len(t, consumerAddrs[0].ConsumerAddrs.Addresses, 1) + consumerAddr = providertypes.NewConsumerConsAddress(consumerAddrs[0].ConsumerAddrs.Addresses[0]) + require.Equal(t, consumerAddrsToPrune[2].address, consumerAddr) + +} diff --git a/x/ccv/provider/module.go b/x/ccv/provider/module.go index 8c87262640..c8e646ded9 100644 --- a/x/ccv/provider/module.go +++ b/x/ccv/provider/module.go @@ -9,6 +9,7 @@ import ( "github.com/grpc-ecosystem/grpc-gateway/runtime" "github.com/spf13/cobra" + storetypes "cosmossdk.io/store/types" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/codec" codectypes "github.com/cosmos/cosmos-sdk/codec/types" @@ -101,13 +102,15 @@ type AppModule struct { AppModuleBasic keeper *keeper.Keeper paramSpace paramtypes.Subspace + storeKey storetypes.StoreKey } // NewAppModule creates a new provider module -func NewAppModule(k *keeper.Keeper, paramSpace paramtypes.Subspace) AppModule { +func NewAppModule(k *keeper.Keeper, paramSpace paramtypes.Subspace, storeKey storetypes.StoreKey) AppModule { return AppModule{ keeper: k, paramSpace: paramSpace, + storeKey: storeKey, } } @@ -121,7 +124,7 @@ func (am AppModule) RegisterServices(cfg module.Configurator) { providertypes.RegisterMsgServer(cfg.MsgServer(), keeper.NewMsgServerImpl(am.keeper)) providertypes.RegisterQueryServer(cfg.QueryServer(), am.keeper) - migrator := migrations.NewMigrator(*am.keeper, am.paramSpace) + migrator := migrations.NewMigrator(*am.keeper, am.paramSpace, am.storeKey) if err := cfg.RegisterMigration(providertypes.ModuleName, 2, migrator.Migrate2to3); err != nil { panic(fmt.Sprintf("failed to register migrator for %s: %s -- from 2 -> 3", providertypes.ModuleName, err)) } @@ -132,10 +135,13 @@ func (am AppModule) RegisterServices(cfg module.Configurator) { panic(fmt.Sprintf("failed to register migrator for %s: %s -- from 4 -> 5", providertypes.ModuleName, err)) } if err := cfg.RegisterMigration(providertypes.ModuleName, 5, migrator.Migrate5to6); err != nil { - panic(fmt.Sprintf("failed to register migrator for %s: %s", providertypes.ModuleName, err)) + panic(fmt.Sprintf("failed to register migrator for %s: %s -- from 5 -> 6", providertypes.ModuleName, err)) } if err := cfg.RegisterMigration(providertypes.ModuleName, 6, migrator.Migrate6to7); err != nil { - panic(fmt.Sprintf("failed to register migrator for %s: %s", providertypes.ModuleName, err)) + panic(fmt.Sprintf("failed to register migrator for %s: %s -- from 6 -> 7", providertypes.ModuleName, err)) + } + if err := cfg.RegisterMigration(providertypes.ModuleName, 7, migrator.Migrate7to8); err != nil { + panic(fmt.Sprintf("failed to register migrator for %s: %s -- from 7 -> 8", providertypes.ModuleName, err)) } } @@ -157,7 +163,7 @@ func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.Raw } // ConsensusVersion implements AppModule/ConsensusVersion. -func (AppModule) ConsensusVersion() uint64 { return 7 } +func (AppModule) ConsensusVersion() uint64 { return 8 } // BeginBlock implements the AppModule interface func (am AppModule) BeginBlock(ctx context.Context) error { @@ -181,8 +187,6 @@ func (am AppModule) EndBlock(ctx context.Context) error { // EndBlock logic needed for the Consumer Initiated Slashing sub-protocol. // Important: EndBlockCIS must be called before EndBlockVSU am.keeper.EndBlockCIS(sdkCtx) - // EndBlock logic needed for the Consumer Chain Removal sub-protocol - am.keeper.EndBlockCCR(sdkCtx) // EndBlock logic needed for the Validator Set Update sub-protocol am.keeper.EndBlockVSU(sdkCtx) diff --git a/x/ccv/provider/module_test.go b/x/ccv/provider/module_test.go index b37c34d1da..b6a2e1e1be 100644 --- a/x/ccv/provider/module_test.go +++ b/x/ccv/provider/module_test.go @@ -95,21 +95,17 @@ func TestInitGenesis(t *testing.T) { keeperParams := testkeeper.NewInMemKeeperParams(t) providerKeeper, ctx, ctrl, mocks := testkeeper.GetProviderKeeperAndCtx(t, keeperParams) - appModule := provider.NewAppModule(&providerKeeper, *keeperParams.ParamsSubspace) + appModule := provider.NewAppModule(&providerKeeper, *keeperParams.ParamsSubspace, keeperParams.StoreKey) genState := types.NewGenesisState( providerKeeper.GetValidatorSetUpdateId(ctx), nil, tc.consumerStates, nil, nil, - nil, - nil, types.DefaultParams(), nil, nil, nil, - nil, - nil, ) cdc := keeperParams.Cdc diff --git a/x/ccv/provider/types/consumer.go b/x/ccv/provider/types/consumer.go index 02651ac03e..37c286422f 100644 --- a/x/ccv/provider/types/consumer.go +++ b/x/ccv/provider/types/consumer.go @@ -10,7 +10,6 @@ func NewConsumerStates( channelID string, initialHeight uint64, genesis ccv.ConsumerGenesisState, - unbondingOpsIndexes []VscUnbondingOps, pendingValsetChanges []ccv.ValidatorSetChangePacketData, slashDowntimeAck []string, ) ConsumerState { @@ -19,7 +18,6 @@ func NewConsumerStates( ClientId: clientID, ChannelId: channelID, InitialHeight: initialHeight, - UnbondingOpsIndex: unbondingOpsIndexes, PendingValsetChanges: pendingValsetChanges, ConsumerGenesis: genesis, SlashDowntimeAck: slashDowntimeAck, diff --git a/x/ccv/provider/types/events.go b/x/ccv/provider/types/events.go index 8701821c52..9abcba7836 100644 --- a/x/ccv/provider/types/events.go +++ b/x/ccv/provider/types/events.go @@ -12,7 +12,6 @@ const ( EventTypeOptOut = "opt_out" AttributeInfractionHeight = "infraction_height" AttributeInitialHeight = "initial_height" - AttributeInitializationTimeout = "initialization_timeout" AttributeTrustingPeriod = "trusting_period" AttributeUnbondingPeriod = "unbonding_period" AttributeProviderValidatorAddress = "provider_validator_address" diff --git a/x/ccv/provider/types/genesis.go b/x/ccv/provider/types/genesis.go index 7ef643970b..5cd60982a6 100644 --- a/x/ccv/provider/types/genesis.go +++ b/x/ccv/provider/types/genesis.go @@ -16,31 +16,23 @@ func NewGenesisState( vscID uint64, vscIdToHeights []ValsetUpdateIdToHeight, consumerStates []ConsumerState, - unbondingOps []UnbondingOp, - matureUbdOps *MaturedUnbondingOps, additionProposals []ConsumerAdditionProposal, removalProposals []ConsumerRemovalProposal, params Params, validatorConsumerPubkeys []ValidatorConsumerPubKey, validatorsByConsumerAddr []ValidatorByConsumerAddr, - consumerAddrsToPrune []ConsumerAddrsToPrune, - initTimeoutTimestamps []InitTimeoutTimestamp, - exportedVscSendTimestamps []ExportedVscSendTimestamp, + consumerAddrsToPrune []ConsumerAddrsToPruneV2, ) *GenesisState { return &GenesisState{ ValsetUpdateId: vscID, ValsetUpdateIdToHeight: vscIdToHeights, ConsumerStates: consumerStates, - UnbondingOps: unbondingOps, - MatureUnbondingOps: matureUbdOps, ConsumerAdditionProposals: additionProposals, ConsumerRemovalProposals: removalProposals, Params: params, ValidatorConsumerPubkeys: validatorConsumerPubkeys, ValidatorsByConsumerAddr: validatorsByConsumerAddr, - ConsumerAddrsToPrune: consumerAddrsToPrune, - InitTimeoutTimestamps: initTimeoutTimestamps, - ExportedVscSendTimestamps: exportedVscSendTimestamps, + ConsumerAddrsToPruneV2: consumerAddrsToPrune, } } @@ -57,12 +49,6 @@ func (gs GenesisState) Validate() error { return errorsmod.Wrap(ccv.ErrInvalidGenesis, "valset update ID cannot be equal to zero") } - for _, ubdOp := range gs.UnbondingOps { - if err := gs.ValidateUnbondingOp(ubdOp); err != nil { - return err - } - } - for _, prop := range gs.ConsumerAdditionProposals { if err := prop.ValidateBasic(); err != nil { return errorsmod.Wrap(ccv.ErrInvalidGenesis, err.Error()) @@ -94,7 +80,7 @@ func (gs GenesisState) Validate() error { if err := KeyAssignmentValidateBasic(gs.ValidatorConsumerPubkeys, gs.ValidatorsByConsumerAddr, - gs.ConsumerAddrsToPrune, + gs.ConsumerAddrsToPruneV2, ); err != nil { return err } @@ -102,38 +88,6 @@ func (gs GenesisState) Validate() error { return nil } -func (gs GenesisState) ValidateUnbondingOp(ubdOp UnbondingOp) error { - if len(ubdOp.UnbondingConsumerChains) == 0 { - return errorsmod.Wrap(ccv.ErrInvalidGenesis, "unbonding operations cannot have an empty consumer chain list") - } - - // Check that the ID is set correctly in the UnbondingOpsIndex - for _, chainID := range ubdOp.UnbondingConsumerChains { - found := false - - // Find consumer state for this consumer chain - for _, cs := range gs.ConsumerStates { - if cs.ChainId != chainID { - continue - } - for _, vscUnbondingOps := range cs.UnbondingOpsIndex { - for _, id := range vscUnbondingOps.GetUnbondingOpIds() { - if id == ubdOp.Id { - found = true - break - } - } - } - } - if !found { - return errorsmod.Wrap(ccv.ErrInvalidGenesis, - fmt.Sprintf("unbonding operation without UnbondingOpsIndex, opID=%d, chainID=%s", ubdOp.Id, chainID)) - } - } - - return nil -} - // Validate performs a consumer state validation returning an error upon any failure. // It ensures that the chain id, client id and consumer genesis states are valid and non-empty. func (cs ConsumerState) Validate() error { @@ -167,15 +121,6 @@ func (cs ConsumerState) Validate() error { } } - for _, ubdOpIdx := range cs.UnbondingOpsIndex { - if ubdOpIdx.VscId == 0 { - return fmt.Errorf("UnbondingOpsIndex vscID cannot be equal to zero") - } - if len(ubdOpIdx.UnbondingOpIds) == 0 { - return fmt.Errorf("unbonding operation index cannot be empty: %#v", ubdOpIdx) - } - } - return nil } diff --git a/x/ccv/provider/types/genesis.pb.go b/x/ccv/provider/types/genesis.pb.go index d885dbc667..7097cd1a2b 100644 --- a/x/ccv/provider/types/genesis.pb.go +++ b/x/ccv/provider/types/genesis.pb.go @@ -31,10 +31,6 @@ type GenesisState struct { // empty for a new chain ConsumerStates []ConsumerState `protobuf:"bytes,2,rep,name=consumer_states,json=consumerStates,proto3" json:"consumer_states" yaml:"consumer_states"` // empty for a new chain - UnbondingOps []UnbondingOp `protobuf:"bytes,3,rep,name=unbonding_ops,json=unbondingOps,proto3" json:"unbonding_ops"` - // empty for a new chain - MatureUnbondingOps *MaturedUnbondingOps `protobuf:"bytes,4,opt,name=mature_unbonding_ops,json=matureUnbondingOps,proto3" json:"mature_unbonding_ops,omitempty"` - // empty for a new chain ValsetUpdateIdToHeight []ValsetUpdateIdToHeight `protobuf:"bytes,5,rep,name=valset_update_id_to_height,json=valsetUpdateIdToHeight,proto3" json:"valset_update_id_to_height"` // empty for a new chain ConsumerAdditionProposals []ConsumerAdditionProposal `protobuf:"bytes,6,rep,name=consumer_addition_proposals,json=consumerAdditionProposals,proto3" json:"consumer_addition_proposals"` @@ -46,9 +42,7 @@ type GenesisState struct { // empty for a new chain ValidatorsByConsumerAddr []ValidatorByConsumerAddr `protobuf:"bytes,10,rep,name=validators_by_consumer_addr,json=validatorsByConsumerAddr,proto3" json:"validators_by_consumer_addr"` // empty for a new chain - ConsumerAddrsToPrune []ConsumerAddrsToPrune `protobuf:"bytes,11,rep,name=consumer_addrs_to_prune,json=consumerAddrsToPrune,proto3" json:"consumer_addrs_to_prune"` - InitTimeoutTimestamps []InitTimeoutTimestamp `protobuf:"bytes,12,rep,name=init_timeout_timestamps,json=initTimeoutTimestamps,proto3" json:"init_timeout_timestamps"` - ExportedVscSendTimestamps []ExportedVscSendTimestamp `protobuf:"bytes,13,rep,name=exported_vsc_send_timestamps,json=exportedVscSendTimestamps,proto3" json:"exported_vsc_send_timestamps"` + ConsumerAddrsToPruneV2 []ConsumerAddrsToPruneV2 `protobuf:"bytes,14,rep,name=consumer_addrs_to_prune_v2,json=consumerAddrsToPruneV2,proto3" json:"consumer_addrs_to_prune_v2"` } func (m *GenesisState) Reset() { *m = GenesisState{} } @@ -98,20 +92,6 @@ func (m *GenesisState) GetConsumerStates() []ConsumerState { return nil } -func (m *GenesisState) GetUnbondingOps() []UnbondingOp { - if m != nil { - return m.UnbondingOps - } - return nil -} - -func (m *GenesisState) GetMatureUnbondingOps() *MaturedUnbondingOps { - if m != nil { - return m.MatureUnbondingOps - } - return nil -} - func (m *GenesisState) GetValsetUpdateIdToHeight() []ValsetUpdateIdToHeight { if m != nil { return m.ValsetUpdateIdToHeight @@ -154,23 +134,9 @@ func (m *GenesisState) GetValidatorsByConsumerAddr() []ValidatorByConsumerAddr { return nil } -func (m *GenesisState) GetConsumerAddrsToPrune() []ConsumerAddrsToPrune { +func (m *GenesisState) GetConsumerAddrsToPruneV2() []ConsumerAddrsToPruneV2 { if m != nil { - return m.ConsumerAddrsToPrune - } - return nil -} - -func (m *GenesisState) GetInitTimeoutTimestamps() []InitTimeoutTimestamp { - if m != nil { - return m.InitTimeoutTimestamps - } - return nil -} - -func (m *GenesisState) GetExportedVscSendTimestamps() []ExportedVscSendTimestamp { - if m != nil { - return m.ExportedVscSendTimestamps + return m.ConsumerAddrsToPruneV2 } return nil } @@ -193,9 +159,6 @@ type ConsumerState struct { // consumer chain PendingValsetChanges []types.ValidatorSetChangePacketData `protobuf:"bytes,6,rep,name=pending_valset_changes,json=pendingValsetChanges,proto3" json:"pending_valset_changes"` SlashDowntimeAck []string `protobuf:"bytes,7,rep,name=slash_downtime_ack,json=slashDowntimeAck,proto3" json:"slash_downtime_ack,omitempty"` - // UnbondingOpsIndex defines the unbonding operations waiting on this consumer - // chain - UnbondingOpsIndex []VscUnbondingOps `protobuf:"bytes,8,rep,name=unbonding_ops_index,json=unbondingOpsIndex,proto3" json:"unbonding_ops_index"` } func (m *ConsumerState) Reset() { *m = ConsumerState{} } @@ -280,13 +243,6 @@ func (m *ConsumerState) GetSlashDowntimeAck() []string { return nil } -func (m *ConsumerState) GetUnbondingOpsIndex() []VscUnbondingOps { - if m != nil { - return m.UnbondingOpsIndex - } - return nil -} - // ValsetUpdateIdToHeight defines the genesis information for the mapping // of each valset update id to a block height type ValsetUpdateIdToHeight struct { @@ -352,64 +308,56 @@ func init() { } var fileDescriptor_48411d9c7900d48e = []byte{ - // 908 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x56, 0xdd, 0x6e, 0x1b, 0x45, - 0x14, 0xce, 0x26, 0x69, 0x1a, 0x4f, 0x7e, 0x08, 0x43, 0x70, 0x37, 0x09, 0xb8, 0x91, 0x51, 0xa5, - 0x48, 0x80, 0xdd, 0x04, 0x90, 0xca, 0x4f, 0x2f, 0x9a, 0x16, 0x81, 0x85, 0x10, 0x96, 0x93, 0x06, - 0xa9, 0x5c, 0x8c, 0xc6, 0x33, 0x23, 0x7b, 0x1a, 0x7b, 0x66, 0x35, 0x67, 0x76, 0x13, 0x0b, 0x21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71, 0x1e, 0x2e, 0x3b, 0x83, 0x9f, 0x4f, 0xf7, - 0x12, 0x81, 0x95, 0x67, 0x87, 0x37, 0xf7, 0x6e, 0x79, 0x76, 0xb5, 0x52, 0xd2, 0xfa, 0x33, 0x54, - 0x9d, 0x3c, 0x0d, 0x66, 0x18, 0xef, 0x55, 0xb4, 0xe4, 0xab, 0x3a, 0xef, 0x70, 0xff, 0xeb, 0xf0, - 0xe7, 0x97, 0x97, 0xb5, 0xe0, 0xe2, 0xb2, 0x16, 0xfc, 0x73, 0x59, 0x0b, 0xfe, 0xba, 0xaa, 0xcd, - 0x5d, 0x5c, 0xd5, 0xe6, 0xfe, 0xbe, 0xaa, 0xcd, 0x3d, 0x7b, 0xd8, 0x93, 0xb6, 0x1f, 0x77, 0x1b, - 0x4c, 0x0f, 0x9b, 0x4c, 0xc3, 0x50, 0x43, 0xf3, 0x75, 0x56, 0x9f, 0x16, 0x5f, 0x24, 0xc9, 0x17, - 0xcd, 0xf3, 0xf1, 0xcf, 0x12, 0x3b, 0x8a, 0x04, 0x74, 0x97, 0xdc, 0x17, 0xc9, 0x67, 0xff, 0x05, - 0x00, 0x00, 0xff, 0xff, 0xae, 0xb1, 0x22, 0x59, 0x8e, 0x09, 0x00, 0x00, + // 782 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x55, 0xd1, 0x6e, 0xda, 0x48, + 0x14, 0xc5, 0xc1, 0x21, 0x66, 0x12, 0x58, 0xcb, 0x8a, 0x90, 0x43, 0xb4, 0x24, 0x62, 0x15, 0x09, + 0x69, 0x77, 0x71, 0x60, 0xb5, 0xd2, 0x6a, 0x77, 0xf3, 0x10, 0x12, 0x69, 0x17, 0xfa, 0x82, 0x48, + 0x9a, 0x4a, 0x79, 0xb1, 0x86, 0xf1, 0x08, 0x46, 0x18, 0x8f, 0xe5, 0x19, 0x9c, 0xa2, 0xaa, 0x52, + 0xab, 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xcc, 0xe0, 0xa0, 0xe4, 0x63, 0xcf, 0x21, 0xde, 0xc0, 0x96, 0x1b, + 0x27, 0x4a, 0x61, 0x80, 0x93, 0x21, 0xff, 0xeb, 0xa9, 0x40, 0x69, 0x13, 0x9c, 0x61, 0x7e, 0x22, + 0x68, 0x5d, 0x88, 0x46, 0x98, 0x9f, 0x42, 0x0e, 0x65, 0xc0, 0x6d, 0xa9, 0x1e, 0xef, 0xa1, 0xf8, + 0x12, 0x33, 0x7e, 0x03, 0x06, 0x73, 0x21, 0x1b, 0xda, 0x0e, 0xbd, 0xf2, 0x38, 0x19, 0x63, 0x1b, + 0xa2, 0x91, 0x98, 0xe8, 0x7c, 0x4f, 0x17, 0xc8, 0xa9, 0x04, 0x8e, 0xd1, 0xa8, 0xa3, 0x6a, 0x9a, + 0x9e, 0xaf, 0x5e, 0x82, 0xd2, 0xe2, 0x65, 0xb6, 0xc2, 0x52, 0x2f, 0x81, 0x9c, 0xac, 0xf7, 0x9a, + 0xc0, 0xe5, 0xbf, 0xd6, 0x8b, 0xeb, 0xbb, 0x8a, 0x72, 0x73, 0x57, 0x51, 0x3e, 0xdf, 0x55, 0x94, + 0xf7, 0xf7, 0x95, 0xcc, 0xcd, 0x7d, 0x25, 0xf3, 0xe9, 0xbe, 0x92, 0xb9, 0x3c, 0x1a, 0x10, 0x3e, + 0x9c, 0xf4, 0xeb, 0x88, 0x8e, 0x2d, 0x44, 0xd9, 0x98, 0x32, 0xeb, 0x5b, 0x41, 0x7e, 0x4f, 0xdf, + 0xa1, 0xf0, 0x4f, 0xeb, 0xe5, 0xfc, 0x63, 0xc4, 0xa7, 0x3e, 0x66, 0xfd, 0x9c, 0x78, 0x87, 0xfe, + 0xf8, 0x1a, 0x00, 0x00, 0xff, 0xff, 0xa4, 0x95, 0x75, 0xdb, 0x84, 0x07, 0x00, 0x00, } func (m *GenesisState) Marshal() (dAtA []byte, err error) { @@ -432,10 +380,10 @@ func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if len(m.ExportedVscSendTimestamps) > 0 { - for iNdEx := len(m.ExportedVscSendTimestamps) - 1; iNdEx >= 0; iNdEx-- { + if len(m.ConsumerAddrsToPruneV2) > 0 { + for iNdEx := len(m.ConsumerAddrsToPruneV2) - 1; iNdEx >= 0; iNdEx-- { { - size, err := m.ExportedVscSendTimestamps[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + size, err := m.ConsumerAddrsToPruneV2[iNdEx].MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -443,35 +391,7 @@ func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintGenesis(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x6a - } - } - if len(m.InitTimeoutTimestamps) > 0 { - for iNdEx := len(m.InitTimeoutTimestamps) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.InitTimeoutTimestamps[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenesis(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x62 - } - } - if len(m.ConsumerAddrsToPrune) > 0 { - for iNdEx := len(m.ConsumerAddrsToPrune) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.ConsumerAddrsToPrune[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenesis(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x5a + dAtA[i] = 0x72 } } if len(m.ValidatorsByConsumerAddr) > 0 { @@ -554,32 +474,6 @@ func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { dAtA[i] = 0x2a } } - if m.MatureUnbondingOps != nil { - { - size, err := m.MatureUnbondingOps.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenesis(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x22 - } - if len(m.UnbondingOps) > 0 { - for iNdEx := len(m.UnbondingOps) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.UnbondingOps[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenesis(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - } if len(m.ConsumerStates) > 0 { for iNdEx := len(m.ConsumerStates) - 1; iNdEx >= 0; iNdEx-- { { @@ -622,20 +516,6 @@ func (m *ConsumerState) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if len(m.UnbondingOpsIndex) > 0 { - for iNdEx := len(m.UnbondingOpsIndex) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.UnbondingOpsIndex[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenesis(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x42 - } - } if len(m.SlashDowntimeAck) > 0 { for iNdEx := len(m.SlashDowntimeAck) - 1; iNdEx >= 0; iNdEx-- { i -= len(m.SlashDowntimeAck[iNdEx]) @@ -757,16 +637,6 @@ func (m *GenesisState) Size() (n int) { n += 1 + l + sovGenesis(uint64(l)) } } - if len(m.UnbondingOps) > 0 { - for _, e := range m.UnbondingOps { - l = e.Size() - n += 1 + l + sovGenesis(uint64(l)) - } - } - if m.MatureUnbondingOps != nil { - l = m.MatureUnbondingOps.Size() - n += 1 + l + sovGenesis(uint64(l)) - } if len(m.ValsetUpdateIdToHeight) > 0 { for _, e := range m.ValsetUpdateIdToHeight { l = e.Size() @@ -799,20 +669,8 @@ func (m *GenesisState) Size() (n int) { n += 1 + l + sovGenesis(uint64(l)) } } - if len(m.ConsumerAddrsToPrune) > 0 { - for _, e := range m.ConsumerAddrsToPrune { - l = e.Size() - n += 1 + l + sovGenesis(uint64(l)) - } - } - if len(m.InitTimeoutTimestamps) > 0 { - for _, e := range m.InitTimeoutTimestamps { - l = e.Size() - n += 1 + l + sovGenesis(uint64(l)) - } - } - if len(m.ExportedVscSendTimestamps) > 0 { - for _, e := range m.ExportedVscSendTimestamps { + if len(m.ConsumerAddrsToPruneV2) > 0 { + for _, e := range m.ConsumerAddrsToPruneV2 { l = e.Size() n += 1 + l + sovGenesis(uint64(l)) } @@ -855,12 +713,6 @@ func (m *ConsumerState) Size() (n int) { n += 1 + l + sovGenesis(uint64(l)) } } - if len(m.UnbondingOpsIndex) > 0 { - for _, e := range m.UnbondingOpsIndex { - l = e.Size() - n += 1 + l + sovGenesis(uint64(l)) - } - } return n } @@ -967,76 +819,6 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field UnbondingOps", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenesis - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenesis - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.UnbondingOps = append(m.UnbondingOps, UnbondingOp{}) - if err := m.UnbondingOps[len(m.UnbondingOps)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MatureUnbondingOps", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenesis - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenesis - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.MatureUnbondingOps == nil { - m.MatureUnbondingOps = &MaturedUnbondingOps{} - } - if err := m.MatureUnbondingOps.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex case 5: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field ValsetUpdateIdToHeight", wireType) @@ -1240,43 +1022,9 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 11: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ConsumerAddrsToPrune", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenesis - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenesis - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ConsumerAddrsToPrune = append(m.ConsumerAddrsToPrune, ConsumerAddrsToPrune{}) - if err := m.ConsumerAddrsToPrune[len(m.ConsumerAddrsToPrune)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 12: + case 14: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field InitTimeoutTimestamps", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ConsumerAddrsToPruneV2", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -1303,42 +1051,8 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.InitTimeoutTimestamps = append(m.InitTimeoutTimestamps, InitTimeoutTimestamp{}) - if err := m.InitTimeoutTimestamps[len(m.InitTimeoutTimestamps)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 13: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ExportedVscSendTimestamps", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenesis - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenesis - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ExportedVscSendTimestamps = append(m.ExportedVscSendTimestamps, ExportedVscSendTimestamp{}) - if err := m.ExportedVscSendTimestamps[len(m.ExportedVscSendTimestamps)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + m.ConsumerAddrsToPruneV2 = append(m.ConsumerAddrsToPruneV2, ConsumerAddrsToPruneV2{}) + if err := m.ConsumerAddrsToPruneV2[len(m.ConsumerAddrsToPruneV2)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -1606,40 +1320,6 @@ func (m *ConsumerState) Unmarshal(dAtA []byte) error { } m.SlashDowntimeAck = append(m.SlashDowntimeAck, string(dAtA[iNdEx:postIndex])) iNdEx = postIndex - case 8: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field UnbondingOpsIndex", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenesis - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenesis - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.UnbondingOpsIndex = append(m.UnbondingOpsIndex, VscUnbondingOps{}) - if err := m.UnbondingOpsIndex[len(m.UnbondingOpsIndex)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipGenesis(dAtA[iNdEx:]) diff --git a/x/ccv/provider/types/genesis_test.go b/x/ccv/provider/types/genesis_test.go index 6a9e5a7593..642dc54a54 100644 --- a/x/ccv/provider/types/genesis_test.go +++ b/x/ccv/provider/types/genesis_test.go @@ -35,14 +35,10 @@ func TestValidateGenesisState(t *testing.T) { []types.ConsumerState{{ChainId: "chainid-1", ChannelId: "channelid", ClientId: "client-id", ConsumerGenesis: getInitialConsumerGenesis(t, "chainid-1")}}, nil, nil, - nil, - nil, types.DefaultParams(), nil, nil, nil, - nil, - nil, ), true, }, @@ -59,14 +55,10 @@ func TestValidateGenesisState(t *testing.T) { }, nil, nil, - nil, - nil, types.DefaultParams(), nil, nil, nil, - nil, - nil, ), true, }, @@ -78,13 +70,9 @@ func TestValidateGenesisState(t *testing.T) { []types.ConsumerState{{ChainId: "chainid-1", ChannelId: "channelid", ClientId: "client-id", ConsumerGenesis: getInitialConsumerGenesis(t, "chainid-1")}}, nil, nil, - nil, - 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: math.NewInt(10000000)}, 600, 24), - nil, - nil, + types.DefaultTrustingPeriodFraction, time.Hour, time.Hour, "0.1", sdk.Coin{Denom: "stake", Amount: math.NewInt(10000000)}, 600, 24), nil, nil, nil, @@ -99,13 +87,9 @@ func TestValidateGenesisState(t *testing.T) { nil, nil, nil, - nil, - 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: math.NewInt(10000000)}, 600, 24), - nil, - nil, + types.DefaultTrustingPeriodFraction, time.Hour, time.Hour, "0.1", sdk.Coin{Denom: "stake", Amount: math.NewInt(10000000)}, 600, 24), nil, nil, nil, @@ -120,34 +104,9 @@ func TestValidateGenesisState(t *testing.T) { nil, nil, nil, - nil, - 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: math.NewInt(10000000)}, 600, 24), - nil, - nil, - nil, - nil, - nil, - ), - false, - }, - { - "invalid unbonding op", - types.NewGenesisState( - types.DefaultValsetUpdateID, - nil, - nil, - []types.UnbondingOp{{UnbondingConsumerChains: nil}}, - nil, - nil, - 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: math.NewInt(10000000)}, 600, 24), - nil, - nil, + types.DefaultTrustingPeriodFraction, time.Hour, time.Hour, "0.1", sdk.Coin{Denom: "stake", Amount: math.NewInt(10000000)}, 600, 24), nil, nil, nil, @@ -162,22 +121,16 @@ func TestValidateGenesisState(t *testing.T) { []types.ConsumerState{{ChainId: "chainid-1", ChannelId: "channelid", ClientId: "client-id"}}, nil, nil, - nil, - nil, types.NewParams(ibctmtypes.NewClientState("", ibctmtypes.DefaultTrustLevel, 0, 0, 0, clienttypes.Height{}, nil, []string{"ibc", "upgradedIBCState"}), types.DefaultTrustingPeriodFraction, ccv.DefaultCCVTimeoutPeriod, - types.DefaultInitTimeoutPeriod, - types.DefaultVscTimeoutPeriod, types.DefaultSlashMeterReplenishPeriod, types.DefaultSlashMeterReplenishFraction, sdk.Coin{Denom: "stake", Amount: math.NewInt(10000000)}, 600, 24), nil, nil, nil, - nil, - nil, ), false, }, @@ -189,22 +142,16 @@ func TestValidateGenesisState(t *testing.T) { []types.ConsumerState{{ChainId: "chainid-1", ChannelId: "channelid", ClientId: "client-id"}}, nil, nil, - nil, - nil, types.NewParams(ibctmtypes.NewClientState("", ibctmtypes.DefaultTrustLevel, 0, 0, time.Second*40, clienttypes.Height{}, commitmenttypes.GetSDKSpecs(), []string{"ibc", "upgradedIBCState"}), "0.0", // 0 trusting period fraction here ccv.DefaultCCVTimeoutPeriod, - types.DefaultInitTimeoutPeriod, - types.DefaultVscTimeoutPeriod, types.DefaultSlashMeterReplenishPeriod, types.DefaultSlashMeterReplenishFraction, sdk.Coin{Denom: "stake", Amount: math.NewInt(10000000)}, 600, 24), nil, nil, nil, - nil, - nil, ), false, }, @@ -216,76 +163,16 @@ func TestValidateGenesisState(t *testing.T) { []types.ConsumerState{{ChainId: "chainid-1", ChannelId: "channelid", ClientId: "client-id"}}, nil, nil, - nil, - nil, types.NewParams(ibctmtypes.NewClientState("", ibctmtypes.DefaultTrustLevel, 0, 0, time.Second*40, clienttypes.Height{}, commitmenttypes.GetSDKSpecs(), []string{"ibc", "upgradedIBCState"}), types.DefaultTrustingPeriodFraction, 0, // 0 ccv timeout here - types.DefaultInitTimeoutPeriod, - types.DefaultVscTimeoutPeriod, types.DefaultSlashMeterReplenishPeriod, types.DefaultSlashMeterReplenishFraction, sdk.Coin{Denom: "stake", Amount: math.NewInt(1000000)}, 600, 24), nil, nil, nil, - nil, - nil, - ), - false, - }, - { - "invalid params, zero init timeout", - types.NewGenesisState( - 0, - nil, - []types.ConsumerState{{ChainId: "chainid-1", ChannelId: "channelid", ClientId: "client-id"}}, - nil, - nil, - nil, - nil, - types.NewParams(ibctmtypes.NewClientState("", ibctmtypes.DefaultTrustLevel, 0, 0, - time.Second*40, clienttypes.Height{}, commitmenttypes.GetSDKSpecs(), []string{"ibc", "upgradedIBCState"}), - types.DefaultTrustingPeriodFraction, - ccv.DefaultCCVTimeoutPeriod, - 0, // 0 init timeout here - types.DefaultVscTimeoutPeriod, - types.DefaultSlashMeterReplenishPeriod, - types.DefaultSlashMeterReplenishFraction, - sdk.Coin{Denom: "stake", Amount: math.NewInt(10000000)}, 600, 24), - nil, - nil, - nil, - nil, - nil, - ), - false, - }, - { - "invalid params, zero vsc timeout", - types.NewGenesisState( - types.DefaultValsetUpdateID, - nil, - []types.ConsumerState{{ChainId: "chainid-1", ChannelId: "channelid", ClientId: "client-id"}}, - nil, - nil, - nil, - nil, - types.NewParams(ibctmtypes.NewClientState("", ibctmtypes.DefaultTrustLevel, 0, 0, - time.Second*40, clienttypes.Height{}, commitmenttypes.GetSDKSpecs(), []string{"ibc", "upgradedIBCState"}), - types.DefaultTrustingPeriodFraction, - ccv.DefaultCCVTimeoutPeriod, - types.DefaultInitTimeoutPeriod, - 0, // 0 vsc timeout here - types.DefaultSlashMeterReplenishPeriod, - types.DefaultSlashMeterReplenishFraction, - sdk.Coin{Denom: "stake", Amount: math.NewInt(10000000)}, 600, 24), - nil, - nil, - nil, - nil, - nil, ), false, }, @@ -297,22 +184,16 @@ func TestValidateGenesisState(t *testing.T) { []types.ConsumerState{{ChainId: "chainid-1", ChannelId: "channelid", ClientId: "client-id"}}, nil, nil, - nil, - nil, types.NewParams(ibctmtypes.NewClientState("", ibctmtypes.DefaultTrustLevel, 0, 0, time.Second*40, clienttypes.Height{}, commitmenttypes.GetSDKSpecs(), []string{"ibc", "upgradedIBCState"}), types.DefaultTrustingPeriodFraction, ccv.DefaultCCVTimeoutPeriod, - types.DefaultInitTimeoutPeriod, - types.DefaultVscTimeoutPeriod, 0, // 0 slash meter replenish period here types.DefaultSlashMeterReplenishFraction, sdk.Coin{Denom: "stake", Amount: math.NewInt(10000000)}, 600, 24), nil, nil, nil, - nil, - nil, ), false, }, @@ -324,22 +205,16 @@ func TestValidateGenesisState(t *testing.T) { []types.ConsumerState{{ChainId: "chainid-1", ChannelId: "channelid", ClientId: "client-id"}}, nil, nil, - nil, - nil, types.NewParams(ibctmtypes.NewClientState("", ibctmtypes.DefaultTrustLevel, 0, 0, time.Second*40, clienttypes.Height{}, commitmenttypes.GetSDKSpecs(), []string{"ibc", "upgradedIBCState"}), types.DefaultTrustingPeriodFraction, ccv.DefaultCCVTimeoutPeriod, - types.DefaultInitTimeoutPeriod, - types.DefaultVscTimeoutPeriod, types.DefaultSlashMeterReplenishPeriod, "1.15", sdk.Coin{Denom: "stake", Amount: math.NewInt(10000000)}, 600, 24), nil, nil, nil, - nil, - nil, ), false, }, @@ -351,14 +226,10 @@ func TestValidateGenesisState(t *testing.T) { []types.ConsumerState{{ChainId: "", ChannelId: "channelid", ClientId: "client-id"}}, nil, nil, - nil, - nil, types.DefaultParams(), nil, nil, nil, - nil, - nil, ), false, }, @@ -370,14 +241,10 @@ func TestValidateGenesisState(t *testing.T) { []types.ConsumerState{{ChainId: "chainid", ChannelId: "ivnalidChannel{}", ClientId: "client-id"}}, nil, nil, - nil, - nil, types.DefaultParams(), nil, nil, nil, - nil, - nil, ), false, }, @@ -389,14 +256,10 @@ func TestValidateGenesisState(t *testing.T) { []types.ConsumerState{{ChainId: "chainid", ChannelId: "channel-0", ClientId: ""}}, nil, nil, - nil, - nil, types.DefaultParams(), nil, nil, nil, - nil, - nil, ), false, }, @@ -408,14 +271,10 @@ func TestValidateGenesisState(t *testing.T) { []types.ConsumerState{{ChainId: "chainid", ChannelId: "channel-0", ClientId: "abc", ConsumerGenesis: getInitialConsumerGenesis(t, "chainid")}}, nil, nil, - nil, - nil, types.DefaultParams(), nil, nil, nil, - nil, - nil, ), false, }, @@ -430,14 +289,10 @@ func TestValidateGenesisState(t *testing.T) { }}, nil, nil, - nil, - nil, types.DefaultParams(), nil, nil, nil, - nil, - nil, ), false, }, @@ -453,14 +308,10 @@ func TestValidateGenesisState(t *testing.T) { }}, nil, nil, - nil, - nil, types.DefaultParams(), nil, nil, nil, - nil, - nil, ), false, }, @@ -476,14 +327,10 @@ func TestValidateGenesisState(t *testing.T) { }}, nil, nil, - nil, - nil, types.DefaultParams(), nil, nil, nil, - nil, - nil, ), false, }, @@ -503,174 +350,10 @@ func TestValidateGenesisState(t *testing.T) { }}, nil, nil, - nil, - nil, types.DefaultParams(), nil, nil, nil, - nil, - nil, - ), - false, - }, - { - "invalid consumer state UnbondingOpsIndex - zero vscID", - types.NewGenesisState( - types.DefaultValsetUpdateID, - nil, - []types.ConsumerState{ - { - ChainId: "chainid", - ChannelId: "channel-0", - ClientId: "client-id", - ConsumerGenesis: getInitialConsumerGenesis(t, "chainid"), - UnbondingOpsIndex: []types.VscUnbondingOps{{}}, - }, - }, - nil, - nil, - nil, - nil, - types.DefaultParams(), - nil, - nil, - nil, - nil, - nil, - ), - false, - }, - { - "invalid consumer state UnbondingOpsIndex - no IDs", - types.NewGenesisState( - types.DefaultValsetUpdateID, - nil, - []types.ConsumerState{ - { - ChainId: "chainid", - ChannelId: "channel-0", - ClientId: "client-id", - ConsumerGenesis: getInitialConsumerGenesis(t, "chainid"), - UnbondingOpsIndex: []types.VscUnbondingOps{{VscId: 1}}, - }, - }, - nil, - nil, - nil, - nil, - types.DefaultParams(), - nil, - nil, - nil, - nil, - nil, - ), - false, - }, - { - "invalid consumer state UnbondingOp - no matching UnbondingOpsIndex", - types.NewGenesisState( - types.DefaultValsetUpdateID, - nil, - []types.ConsumerState{ - { - ChainId: "chainid", - ChannelId: "channel-0", - ClientId: "client-id", - ConsumerGenesis: getInitialConsumerGenesis(t, "chainid"), - UnbondingOpsIndex: []types.VscUnbondingOps{ - { - VscId: 1, - }, - }, - }, - }, - []types.UnbondingOp{ - { - Id: 13, - UnbondingConsumerChains: []string{"chainid"}, - }, - }, - nil, - nil, - nil, - types.DefaultParams(), - nil, - nil, - nil, - nil, - nil, - ), - false, - }, - { - "invalid consumer state UnbondingOp - no matching UnbondingOpsIndex 2", - types.NewGenesisState( - types.DefaultValsetUpdateID, - nil, - []types.ConsumerState{ - { - ChainId: "chainid", - ChannelId: "channel-0", - ClientId: "client-id", - ConsumerGenesis: getInitialConsumerGenesis(t, "chainid"), - UnbondingOpsIndex: []types.VscUnbondingOps{ - { - VscId: 1, - UnbondingOpIds: []uint64{13}, - }, - }, - }, - { - ChainId: "chainid-2", - ChannelId: "channel-0", - ClientId: "client-id", - ConsumerGenesis: getInitialConsumerGenesis(t, "chainid-2"), - UnbondingOpsIndex: []types.VscUnbondingOps{ - { - VscId: 1, - }, - }, - }, - }, - []types.UnbondingOp{ - { - Id: 13, - UnbondingConsumerChains: []string{"chainid", "chainid-2"}, - }, - }, - nil, - nil, - nil, - types.DefaultParams(), - nil, - nil, - nil, - nil, - nil, - ), - false, - }, - { - "invalid consumer state unbonding operation operation 2", - types.NewGenesisState( - types.DefaultValsetUpdateID, - nil, - []types.ConsumerState{{ - ChainId: "chainid", ChannelId: "channel-0", ClientId: "client-id", - UnbondingOpsIndex: []types.VscUnbondingOps{{VscId: 1}}, - }}, - nil, - nil, - nil, - nil, - types.DefaultParams(), - nil, - nil, - nil, - nil, - nil, ), false, }, @@ -682,13 +365,9 @@ func TestValidateGenesisState(t *testing.T) { []types.ConsumerState{{ChainId: "chainid-1", ChannelId: "channelid", ClientId: "client-id", ConsumerGenesis: getInitialConsumerGenesis(t, "chainid-1")}}, nil, nil, - nil, - 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: math.NewInt(10000000)}, 600, 24), - nil, - nil, + types.DefaultTrustingPeriodFraction, time.Hour, time.Hour, "0.1", sdk.Coin{Denom: "st", Amount: math.NewInt(10000000)}, 600, 24), nil, nil, nil, @@ -703,13 +382,9 @@ func TestValidateGenesisState(t *testing.T) { []types.ConsumerState{{ChainId: "chainid-1", ChannelId: "channelid", ClientId: "client-id", ConsumerGenesis: getInitialConsumerGenesis(t, "chainid-1")}}, nil, nil, - nil, - 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: math.NewInt(-1000000)}, 600, 24), - nil, - nil, + types.DefaultTrustingPeriodFraction, time.Hour, time.Hour, "0.1", sdk.Coin{Denom: "stake", Amount: math.NewInt(-1000000)}, 600, 24), nil, nil, nil, diff --git a/x/ccv/provider/types/key_assignment.go b/x/ccv/provider/types/key_assignment.go index ee403e1e49..7149ebc6cc 100644 --- a/x/ccv/provider/types/key_assignment.go +++ b/x/ccv/provider/types/key_assignment.go @@ -67,7 +67,7 @@ func (c *ConsumerConsAddress) String() string { func KeyAssignmentValidateBasic( assignedKeys []ValidatorConsumerPubKey, byConsumerAddrs []ValidatorByConsumerAddr, - consumerAddrsToPrune []ConsumerAddrsToPrune, + consumerAddrsToPrune []ConsumerAddrsToPruneV2, ) error { for _, e := range assignedKeys { if strings.TrimSpace(e.ChainId) == "" { @@ -95,7 +95,6 @@ func KeyAssignmentValidateBasic( if strings.TrimSpace(e.ChainId) == "" { return errorsmod.Wrap(ccvtypes.ErrInvalidGenesis, "consumer chain id must not be blank") } - // Don't check e.vscid, it's an unsigned integer for _, a := range e.ConsumerAddrs.Addresses { if err := sdk.VerifyAddressFormat(a); err != nil { return errorsmod.Wrap(ccvtypes.ErrInvalidGenesis, fmt.Sprintf("invalid consumer address: %s", a)) diff --git a/x/ccv/provider/types/keys.go b/x/ccv/provider/types/keys.go index a7d7134943..6c90c92b48 100644 --- a/x/ccv/provider/types/keys.go +++ b/x/ccv/provider/types/keys.go @@ -41,7 +41,7 @@ const ( PortKeyName = "PortKey" - MaturedUnbondingOpsKeyName = "MaturedUnbondingOpsKey" + DeprecatedMaturedUnbondingOpsKeyName = "DeprecatedMaturedUnbondingOpsKey" ValidatorSetUpdateIdKeyName = "ValidatorSetUpdateIdKey" @@ -55,15 +55,15 @@ const ( ChainToClientKeyName = "ChainToClientKey" - InitTimeoutTimestampKeyName = "InitTimeoutTimestampKey" + DeprecatedInitTimeoutTimestampKeyName = "DeprecatedInitTimeoutTimestampKey" PendingCAPKeyName = "PendingCAPKey" PendingCRPKeyName = "PendingCRPKey" - UnbondingOpKeyName = "UnbondingOpKey" + DeprecatedUnbondingOpKeyName = "DeprecatedUnbondingOpKey" - UnbondingOpIndexKeyName = "UnbondingOpIndexKey" + DeprecatedUnbondingOpIndexKeyName = "DeprecatedUnbondingOpIndexKey" ValsetUpdateBlockHeightKeyName = "ValsetUpdateBlockHeightKey" @@ -75,7 +75,7 @@ const ( PendingVSCsKeyName = "PendingVSCsKey" - VscSendTimestampKeyName = "VscSendTimestampKey" + DeprecatedVscSendTimestampKeyName = "DeprecatedVscSendTimestampKey" ThrottledPacketDataSizeKeyName = "ThrottledPacketDataSizeKey" @@ -87,15 +87,15 @@ const ( ValidatorsByConsumerAddrKeyName = "ValidatorsByConsumerAddrKey" - KeyAssignmentReplacementsKeyName = "DeprecatedKeyAssignmentReplacementsKey" + DeprecatedKeyAssignmentReplacementsKeyName = "DeprecatedKeyAssignmentReplacementsKey" - ConsumerAddrsToPruneKeyName = "ConsumerAddrsToPruneKey" + DeprecatedConsumerAddrsToPruneKeyName = "DeprecatedConsumerAddrsToPruneKey" SlashLogKeyName = "SlashLogKey" ConsumerRewardDenomsKeyName = "ConsumerRewardDenomsKey" - VSCMaturedHandledThisBlockKeyName = "VSCMaturedHandledThisBlockKey" + DeprecatedVSCMaturedHandledThisBlockKeyName = "DeprecatedVSCMaturedHandledThisBlockKey" EquivocationEvidenceMinHeightKeyName = "EquivocationEvidenceMinHeightKey" @@ -120,6 +120,8 @@ const ( ConsumerCommissionRateKeyName = "ConsumerCommissionRateKey" MinimumPowerInTopNKeyName = "MinimumPowerInTopNKey" + + ConsumerAddrsToPruneV2KeyName = "ConsumerAddrsToPruneV2Key" ) // getKeyPrefixes returns a constant map of all the byte prefixes for existing keys @@ -136,7 +138,9 @@ func getKeyPrefixes() map[string]byte { // MaturedUnbondingOpsKey is the key that stores the list of all unbonding operations ids // that have matured from a consumer chain perspective, // i.e., no longer waiting on the unbonding period to elapse on any consumer chain - MaturedUnbondingOpsKeyName: 1, + // NOTE: This prefix is deprecated, but left in place to avoid state migrations + // [DEPRECATED] + DeprecatedMaturedUnbondingOpsKeyName: 1, // ValidatorSetUpdateIdKey is the key that stores the current validator set update id ValidatorSetUpdateIdKeyName: 2, @@ -160,7 +164,9 @@ func getKeyPrefixes() map[string]byte { // InitTimeoutTimestampKey is the key for storing // the init timeout timestamp for a given consumer chainID. - InitTimeoutTimestampKeyName: 8, + // NOTE: This prefix is deprecated, but left in place to avoid state migrations + // [DEPRECATED] + DeprecatedInitTimeoutTimestampKeyName: 8, // PendingCAPKey is the key for storing pending consumer addition proposals before the spawn time occurs. // The key includes the BigEndian timestamp to allow for efficient chronological iteration @@ -172,11 +178,15 @@ func getKeyPrefixes() map[string]byte { // UnbondingOpKey is the key that stores a record of all the ids of consumer chains that // need to unbond before a given unbonding operation can unbond on this chain. - UnbondingOpKeyName: 11, + // NOTE: This prefix is deprecated, but left in place to avoid state migrations + // [DEPRECATED] + DeprecatedUnbondingOpKeyName: 11, // UnbondingOpIndexKey is key of the index for looking up which unbonding // operations are waiting for a given consumer chain to unbond - UnbondingOpIndexKeyName: 12, + // NOTE: This prefix is deprecated, but left in place to avoid state migrations + // [DEPRECATED] + DeprecatedUnbondingOpIndexKeyName: 12, // ValsetUpdateBlockHeightKey is the key for storing the mapping from vscIDs to block heights ValsetUpdateBlockHeightKeyName: 13, @@ -196,7 +206,9 @@ func getKeyPrefixes() map[string]byte { // VscSendTimestampKey is the key for storing // the list of VSC sending timestamps for a given consumer chainID. - VscSendTimestampKeyName: 18, + // NOTE: This prefix is deprecated, but left in place to avoid state migrations + // [DEPRECATED] + DeprecatedVscSendTimestampKeyName: 18, // ThrottledPacketDataSizeKey is the key for storing the size of chain-specific throttled packet data queues ThrottledPacketDataSizeKeyName: 19, @@ -217,11 +229,13 @@ func getKeyPrefixes() map[string]byte { // DeprecatedKeyAssignmentReplacementsKey was the key used to store the key assignments that needed to be replaced in the current block // NOTE: This prefix is deprecated, but left in place to avoid consumer state migrations // [DEPRECATED] - KeyAssignmentReplacementsKeyName: 24, + DeprecatedKeyAssignmentReplacementsKeyName: 24, // ConsumerAddrsToPruneKey is the key for storing the mapping from VSC ids // to consumer validators addresses needed for pruning - ConsumerAddrsToPruneKeyName: 25, + // NOTE: This prefix is deprecated, but left in place to avoid consumer state migrations + // [DEPRECATED] + DeprecatedConsumerAddrsToPruneKeyName: 25, // SlashLogKey is the key for storing the mapping from provider address to boolean // denoting whether the provider address has committed any double signign infractions @@ -232,7 +246,9 @@ func getKeyPrefixes() map[string]byte { // VSCMaturedHandledThisBlockKey is the key for storing the number of vsc matured packets // handled in the current block - VSCMaturedHandledThisBlockKeyName: 28, + // NOTE: This prefix is deprecated, but left in place to avoid state migrations + // [DEPRECATED] + DeprecatedVSCMaturedHandledThisBlockKeyName: 28, // EquivocationEvidenceMinHeightKey is the key for storing the mapping from consumer chain IDs // to the minimum height of a valid consumer equivocation evidence @@ -281,6 +297,10 @@ func getKeyPrefixes() map[string]byte { // minimum power required to be in the top N per consumer chain. MinimumPowerInTopNKeyName: 40, + // ConsumerAddrsToPruneV2Key is the key for storing + // consumer validators addresses that need to be pruned. + ConsumerAddrsToPruneV2KeyName: 41, + // NOTE: DO NOT ADD NEW BYTE PREFIXES HERE WITHOUT ADDING THEM TO TestPreserveBytePrefix() IN keys_test.go } } @@ -338,11 +358,6 @@ func PortKey() []byte { return []byte{mustGetKeyPrefix(PortKeyName)} } -// MaturedUnbondingOpsKey returns the key for storing the list of matured unbonding operations. -func MaturedUnbondingOpsKey() []byte { - return []byte{mustGetKeyPrefix(MaturedUnbondingOpsKeyName)} -} - // ValidatorSetUpdateIdKey is the key that stores the current validator set update id func ValidatorSetUpdateIdKey() []byte { return []byte{mustGetKeyPrefix(ValidatorSetUpdateIdKeyName)} @@ -383,16 +398,6 @@ func ChainToClientKey(chainID string) []byte { return append(ChainToClientKeyPrefix(), []byte(chainID)...) } -// InitTimeoutTimestampKeyPrefix returns the key prefix for storing the init timeout timestamps -func InitTimeoutTimestampKeyPrefix() []byte { - return []byte{mustGetKeyPrefix(InitTimeoutTimestampKeyName)} -} - -// InitTimeoutTimestampKey returns the key under which the init timeout timestamp for the given chainID is stored. -func InitTimeoutTimestampKey(chainID string) []byte { - return append(InitTimeoutTimestampKeyPrefix(), []byte(chainID)...) -} - // PendingCAPKeyPrefix returns the key prefix for storing a pending consumer addition proposal func PendingCAPKeyPrefix() []byte { return []byte{mustGetKeyPrefix(PendingCAPKeyName)} @@ -431,36 +436,6 @@ func PendingCRPKey(timestamp time.Time, chainID string) []byte { ) } -// UnbondingOpKeyPrefix returns the key prefix that stores a record of all the ids of consumer chains that -// need to unbond before a given unbonding operation can unbond on this chain. -func UnbondingOpKeyPrefix() []byte { - return []byte{mustGetKeyPrefix(UnbondingOpKeyName)} -} - -// UnbondingOpKey returns the key that stores a record of all the ids of consumer chains that -// need to unbond before a given unbonding operation can unbond on this chain. -func UnbondingOpKey(id uint64) []byte { - bz := make([]byte, 8) - binary.BigEndian.PutUint64(bz, id) - return append(UnbondingOpKeyPrefix(), bz...) -} - -// UnbondingOpIndexKeyPrefix returns the key prefix for storing an unbonding op index -func UnbondingOpIndexKeyPrefix() byte { - return mustGetKeyPrefix(UnbondingOpIndexKeyName) -} - -// UnbondingOpIndexKey returns the key for storing an unbonding op index -func UnbondingOpIndexKey(chainID string, vscID uint64) []byte { - return ChainIdAndUintIdKey(UnbondingOpIndexKeyPrefix(), chainID, vscID) -} - -// ParseUnbondingOpIndexKey parses an unbonding op index key for VSC ID -// Removes the prefix + chainID from index key and returns only the key part. -func ParseUnbondingOpIndexKey(key []byte) (string, uint64, error) { - return ParseChainIdAndUintIdKey(UnbondingOpIndexKeyPrefix(), key) -} - // ValsetUpdateBlockHeightKeyPrefix returns the key prefix that storing the mapping from valset update ID to block height func ValsetUpdateBlockHeightKeyPrefix() []byte { return []byte{mustGetKeyPrefix(ValsetUpdateBlockHeightKeyName)} @@ -495,23 +470,6 @@ func PendingVSCsKey(chainID string) []byte { return append([]byte{mustGetKeyPrefix(PendingVSCsKeyName)}, []byte(chainID)...) } -// VscSendingTimestampKeyPrefix returns the key for storing the sending timestamp of VSCPackets -func VscSendingTimestampKeyPrefix() byte { - return mustGetKeyPrefix(VscSendTimestampKeyName) -} - -// VscSendingTimestampKey returns the key under which the -// sending timestamp of the VSCPacket with vsc ID is stored -func VscSendingTimestampKey(chainID string, vscID uint64) []byte { - return ChainIdAndUintIdKey(VscSendingTimestampKeyPrefix(), chainID, vscID) -} - -// ParseVscTimeoutTimestampKey returns chain ID and vsc ID -// for a VscSendingTimestampKey or an error if unparsable -func ParseVscSendingTimestampKey(bz []byte) (string, uint64, error) { - return ParseChainIdAndUintIdKey(VscSendingTimestampKeyPrefix(), bz) -} - // ThrottledPacketDataSizeKey returns the key storing the size of the throttled packet data queue for a given chain ID func ThrottledPacketDataSizeKey(consumerChainID string) []byte { return append([]byte{mustGetKeyPrefix(ThrottledPacketDataSizeKeyName)}, []byte(consumerChainID)...) @@ -608,27 +566,11 @@ func ValidatorsByConsumerAddrKey(chainID string, addr ConsumerConsAddress) []byt return ChainIdAndConsAddrKey(ValidatorsByConsumerAddrKeyPrefix(), chainID, addr.ToSdkConsAddr()) } -// ConsumerAddrsToPruneKeyPrefix returns the key prefix for storing the -// mapping from VSC ids to consumer validators addresses -func ConsumerAddrsToPruneKeyPrefix() byte { - return mustGetKeyPrefix(ConsumerAddrsToPruneKeyName) -} - -// ConsumerAddrsToPruneKey returns the key for storing the -// mapping from VSC ids to consumer validators addresses -func ConsumerAddrsToPruneKey(chainID string, vscID uint64) []byte { - return ChainIdAndUintIdKey(ConsumerAddrsToPruneKeyPrefix(), chainID, vscID) -} - // SlashLogKey returns the key to a validator's slash log func SlashLogKey(providerAddr ProviderConsAddress) []byte { return append([]byte{mustGetKeyPrefix(SlashLogKeyName)}, providerAddr.ToSdkConsAddr().Bytes()...) } -func VSCMaturedHandledThisBlockKey() []byte { - return []byte{mustGetKeyPrefix(VSCMaturedHandledThisBlockKeyName)} -} - // ConsumerRewardDenomsKeyPrefix returns the key prefix for storing consumer reward denoms func ConsumerRewardDenomsKeyPrefix() []byte { return []byte{mustGetKeyPrefix(ConsumerRewardDenomsKeyName)} @@ -759,6 +701,20 @@ func MinimumPowerInTopNKey(chainID string) []byte { return ChainIdWithLenKey(mustGetKeyPrefix(MinimumPowerInTopNKeyName), chainID) } +// ConsumerAddrsToPruneV2KeyPrefix returns the key prefix for storing the consumer validators +// addresses that need to be pruned. These are stored as a +// (chainID, ts) -> (consumer_address1, consumer_address2, ...) mapping, where ts is the +// timestamp at which the consumer validators addresses can be pruned. +func ConsumerAddrsToPruneV2KeyPrefix() byte { + return mustGetKeyPrefix(ConsumerAddrsToPruneV2KeyName) +} + +// ConsumerAddrsToPruneV2Key returns the key for storing the consumer validators +// addresses that need to be pruned. +func ConsumerAddrsToPruneV2Key(chainID string, pruneTs time.Time) []byte { + return ChainIdAndTsKey(ConsumerAddrsToPruneV2KeyPrefix(), chainID, pruneTs) +} + // NOTE: DO NOT ADD FULLY DEFINED KEY FUNCTIONS WITHOUT ADDING THEM TO getAllFullyDefinedKeys() IN keys_test.go // diff --git a/x/ccv/provider/types/keys_test.go b/x/ccv/provider/types/keys_test.go index fd37ad654f..cf97c79ad7 100644 --- a/x/ccv/provider/types/keys_test.go +++ b/x/ccv/provider/types/keys_test.go @@ -27,89 +27,91 @@ func TestNoDuplicates(t *testing.T) { // Test that the value of all byte prefixes is preserved func TestPreserveBytePrefix(t *testing.T) { i := 0 - require.Equal(t, uint8(0xFF), providertypes.ParametersKey()[0]) + require.Equal(t, byte(0xFF), providertypes.ParametersKey()[0]) i++ - require.Equal(t, uint8(0), providertypes.PortKey()[0]) + require.Equal(t, byte(0), providertypes.PortKey()[0]) i++ - require.Equal(t, uint8(1), providertypes.MaturedUnbondingOpsKey()[0]) + // reserve 1 as deprecated i++ - require.Equal(t, uint8(2), providertypes.ValidatorSetUpdateIdKey()[0]) + require.Equal(t, byte(2), providertypes.ValidatorSetUpdateIdKey()[0]) i++ - require.Equal(t, uint8(3), providertypes.SlashMeterKey()[0]) + require.Equal(t, byte(3), providertypes.SlashMeterKey()[0]) i++ - require.Equal(t, uint8(4), providertypes.SlashMeterReplenishTimeCandidateKey()[0]) + require.Equal(t, byte(4), providertypes.SlashMeterReplenishTimeCandidateKey()[0]) i++ - require.Equal(t, uint8(5), providertypes.ChainToChannelKey("chainID")[0]) + require.Equal(t, byte(5), providertypes.ChainToChannelKey("chainID")[0]) i++ - require.Equal(t, uint8(6), providertypes.ChannelToChainKeyPrefix()[0]) + require.Equal(t, byte(6), providertypes.ChannelToChainKeyPrefix()[0]) i++ - require.Equal(t, uint8(7), providertypes.ChainToClientKeyPrefix()[0]) + require.Equal(t, byte(7), providertypes.ChainToClientKeyPrefix()[0]) i++ - require.Equal(t, uint8(8), providertypes.InitTimeoutTimestampKeyPrefix()[0]) + // reserve 8 as deprecated i++ - require.Equal(t, uint8(9), providertypes.PendingCAPKeyPrefix()[0]) + require.Equal(t, byte(9), providertypes.PendingCAPKeyPrefix()[0]) i++ - require.Equal(t, uint8(10), providertypes.PendingCRPKeyPrefix()[0]) + require.Equal(t, byte(10), providertypes.PendingCRPKeyPrefix()[0]) i++ - require.Equal(t, uint8(11), providertypes.UnbondingOpKeyPrefix()[0]) + // reserve 11 as deprecated i++ - require.Equal(t, uint8(12), providertypes.UnbondingOpIndexKeyPrefix()) + // reserve 12 as deprecated i++ - require.Equal(t, uint8(13), providertypes.ValsetUpdateBlockHeightKeyPrefix()[0]) + require.Equal(t, byte(13), providertypes.ValsetUpdateBlockHeightKeyPrefix()[0]) i++ - require.Equal(t, uint8(14), providertypes.ConsumerGenesisKey("chainID")[0]) + require.Equal(t, byte(14), providertypes.ConsumerGenesisKey("chainID")[0]) i++ - require.Equal(t, uint8(15), providertypes.SlashAcksKey("chainID")[0]) + require.Equal(t, byte(15), providertypes.SlashAcksKey("chainID")[0]) i++ - require.Equal(t, uint8(16), providertypes.InitChainHeightKey("chainID")[0]) + require.Equal(t, byte(16), providertypes.InitChainHeightKey("chainID")[0]) i++ - require.Equal(t, uint8(17), providertypes.PendingVSCsKey("chainID")[0]) + require.Equal(t, byte(17), providertypes.PendingVSCsKey("chainID")[0]) i++ - require.Equal(t, uint8(18), providertypes.VscSendingTimestampKeyPrefix()) + // reserve 18 as deprecated i++ - require.Equal(t, uint8(19), providertypes.ThrottledPacketDataSizeKey("chainID")[0]) + require.Equal(t, byte(19), providertypes.ThrottledPacketDataSizeKey("chainID")[0]) i++ - require.Equal(t, uint8(20), providertypes.ThrottledPacketDataKeyPrefix()) + require.Equal(t, byte(20), providertypes.ThrottledPacketDataKeyPrefix()) i++ - require.Equal(t, uint8(21), providertypes.GlobalSlashEntryKeyPrefix()[0]) + require.Equal(t, byte(21), providertypes.GlobalSlashEntryKeyPrefix()[0]) i++ - require.Equal(t, uint8(22), providertypes.ConsumerValidatorsKeyPrefix()) + require.Equal(t, byte(22), providertypes.ConsumerValidatorsKeyPrefix()) i++ - require.Equal(t, uint8(23), providertypes.ValidatorsByConsumerAddrKeyPrefix()) + require.Equal(t, byte(23), providertypes.ValidatorsByConsumerAddrKeyPrefix()) i++ // reserve 24 as deprecated i++ - require.Equal(t, uint8(25), providertypes.ConsumerAddrsToPruneKeyPrefix()) + // reserve 25 as deprecated i++ - require.Equal(t, uint8(26), providertypes.SlashLogKey(providertypes.NewProviderConsAddress([]byte{0x05}))[0]) + require.Equal(t, byte(26), providertypes.SlashLogKey(providertypes.NewProviderConsAddress([]byte{0x05}))[0]) i++ - require.Equal(t, uint8(27), providertypes.ConsumerRewardDenomsKeyPrefix()[0]) + require.Equal(t, byte(27), providertypes.ConsumerRewardDenomsKeyPrefix()[0]) i++ - require.Equal(t, uint8(28), providertypes.VSCMaturedHandledThisBlockKey()[0]) + // reserve 28 as deprecated i++ - require.Equal(t, uint8(29), providertypes.EquivocationEvidenceMinHeightKey("chainID")[0]) + require.Equal(t, byte(29), providertypes.EquivocationEvidenceMinHeightKey("chainID")[0]) i++ - require.Equal(t, uint8(30), providertypes.ProposedConsumerChainKeyPrefix()[0]) + require.Equal(t, byte(30), providertypes.ProposedConsumerChainKeyPrefix()[0]) i++ - require.Equal(t, uint8(31), providertypes.ConsumerValidatorKeyPrefix()) + require.Equal(t, byte(31), providertypes.ConsumerValidatorKeyPrefix()) i++ - require.Equal(t, uint8(32), providertypes.OptedInKeyPrefix()) + require.Equal(t, byte(32), providertypes.OptedInKeyPrefix()) i++ - require.Equal(t, uint8(33), providertypes.TopNKey("chainID")[0]) + require.Equal(t, byte(33), providertypes.TopNKey("chainID")[0]) i++ - require.Equal(t, uint8(34), providertypes.ValidatorsPowerCapKey("chainID")[0]) + require.Equal(t, byte(34), providertypes.ValidatorsPowerCapKey("chainID")[0]) i++ - require.Equal(t, uint8(35), providertypes.ValidatorSetCapKey("chainID")[0]) + require.Equal(t, byte(35), providertypes.ValidatorSetCapKey("chainID")[0]) i++ - require.Equal(t, uint8(36), providertypes.AllowlistKeyPrefix()) + require.Equal(t, byte(36), providertypes.AllowlistKeyPrefix()) i++ - require.Equal(t, uint8(37), providertypes.DenylistKeyPrefix()) + require.Equal(t, byte(37), providertypes.DenylistKeyPrefix()) i++ - require.Equal(t, uint8(38), providertypes.ConsumerRewardsAllocationKey("chainID")[0]) + require.Equal(t, byte(38), providertypes.ConsumerRewardsAllocationKey("chainID")[0]) i++ - require.Equal(t, uint8(39), providertypes.ConsumerCommissionRateKeyPrefix()) + require.Equal(t, byte(39), providertypes.ConsumerCommissionRateKeyPrefix()) i++ - require.Equal(t, uint8(40), providertypes.MinimumPowerInTopNKey("chainID")[0]) + require.Equal(t, byte(40), providertypes.MinimumPowerInTopNKey("chainID")[0]) + i++ + require.Equal(t, byte(41), providertypes.ConsumerAddrsToPruneV2KeyPrefix()) i++ prefixes := providertypes.GetAllKeyPrefixes() require.Equal(t, len(prefixes), i) @@ -142,32 +144,25 @@ func getAllFullyDefinedKeys() [][]byte { return [][]byte{ providertypes.ParametersKey(), providertypes.PortKey(), - providertypes.MaturedUnbondingOpsKey(), providertypes.ValidatorSetUpdateIdKey(), providertypes.SlashMeterKey(), providertypes.SlashMeterReplenishTimeCandidateKey(), providertypes.ChainToChannelKey("chainID"), providertypes.ChannelToChainKey("channelID"), providertypes.ChainToClientKey("chainID"), - providertypes.InitTimeoutTimestampKey("chainID"), providertypes.PendingCAPKey(time.Time{}, "chainID"), providertypes.PendingCRPKey(time.Time{}, "chainID"), - providertypes.UnbondingOpKey(7), - providertypes.UnbondingOpIndexKey("chainID", 7), providertypes.ValsetUpdateBlockHeightKey(7), providertypes.ConsumerGenesisKey("chainID"), providertypes.SlashAcksKey("chainID"), providertypes.InitChainHeightKey("chainID"), providertypes.PendingVSCsKey("chainID"), - providertypes.VscSendingTimestampKey("chainID", 8), providertypes.ThrottledPacketDataSizeKey("chainID"), providertypes.ThrottledPacketDataKey("chainID", 88), providertypes.GlobalSlashEntryKey(providertypes.GlobalSlashEntry{}), providertypes.ConsumerValidatorsKey("chainID", providertypes.NewProviderConsAddress([]byte{0x05})), providertypes.ValidatorsByConsumerAddrKey("chainID", providertypes.NewConsumerConsAddress([]byte{0x05})), - providertypes.ConsumerAddrsToPruneKey("chainID", 88), providertypes.SlashLogKey(providertypes.NewProviderConsAddress([]byte{0x05})), - providertypes.VSCMaturedHandledThisBlockKey(), providertypes.ConsumerRewardDenomsKey("uatom"), providertypes.EquivocationEvidenceMinHeightKey("chainID"), providertypes.ProposedConsumerChainKey(1), @@ -181,6 +176,7 @@ func getAllFullyDefinedKeys() [][]byte { providertypes.ConsumerRewardsAllocationKey("chainID"), providertypes.ConsumerCommissionRateKey("chainID", providertypes.NewProviderConsAddress([]byte{0x05})), providertypes.MinimumPowerInTopNKey("chainID"), + providertypes.ConsumerAddrsToPruneV2Key("chainID", time.Time{}), } } @@ -329,7 +325,6 @@ func TestKeysWithPrefixAndId(t *testing.T) { providertypes.ChainToChannelKey, providertypes.ChannelToChainKey, providertypes.ChainToClientKey, - providertypes.InitTimeoutTimestampKey, providertypes.ConsumerGenesisKey, providertypes.SlashAcksKey, providertypes.InitChainHeightKey, @@ -354,7 +349,6 @@ func TestKeysWithPrefixAndId(t *testing.T) { func TestKeysWithUint64Payload(t *testing.T) { funcs := []func(uint64) []byte{ - providertypes.UnbondingOpKey, providertypes.ValsetUpdateBlockHeightKey, } diff --git a/x/ccv/provider/types/params.go b/x/ccv/provider/types/params.go index 81d69cd7eb..b5bc0f7db2 100644 --- a/x/ccv/provider/types/params.go +++ b/x/ccv/provider/types/params.go @@ -24,12 +24,6 @@ const ( // as UnbondingPeriod * TrustingPeriodFraction DefaultTrustingPeriodFraction = "0.66" - // DefaultInitTimeoutPeriod defines the init timeout period - DefaultInitTimeoutPeriod = 7 * 24 * time.Hour - - // DefaultVscTimeoutPeriod defines the VSC timeout period - DefaultVscTimeoutPeriod = 5 * 7 * 24 * time.Hour - // DefaultSlashMeterReplenishPeriod defines the default period for which the slash gas meter is replenished DefaultSlashMeterReplenishPeriod = time.Hour @@ -62,8 +56,6 @@ const ( var ( KeyTemplateClient = []byte("TemplateClient") KeyTrustingPeriodFraction = []byte("TrustingPeriodFraction") - KeyInitTimeoutPeriod = []byte("InitTimeoutPeriod") - KeyVscTimeoutPeriod = []byte("VscTimeoutPeriod") KeySlashMeterReplenishPeriod = []byte("SlashMeterReplenishPeriod") KeySlashMeterReplenishFraction = []byte("SlashMeterReplenishFraction") KeyConsumerRewardDenomRegistrationFee = []byte("ConsumerRewardDenomRegistrationFee") @@ -81,8 +73,6 @@ func NewParams( cs *ibctmtypes.ClientState, trustingPeriodFraction string, ccvTimeoutPeriod time.Duration, - initTimeoutPeriod time.Duration, - vscTimeoutPeriod time.Duration, slashMeterReplenishPeriod time.Duration, slashMeterReplenishFraction string, consumerRewardDenomRegistrationFee sdk.Coin, @@ -93,8 +83,6 @@ func NewParams( TemplateClient: cs, TrustingPeriodFraction: trustingPeriodFraction, CcvTimeoutPeriod: ccvTimeoutPeriod, - InitTimeoutPeriod: initTimeoutPeriod, - VscTimeoutPeriod: vscTimeoutPeriod, SlashMeterReplenishPeriod: slashMeterReplenishPeriod, SlashMeterReplenishFraction: slashMeterReplenishFraction, ConsumerRewardDenomRegistrationFee: consumerRewardDenomRegistrationFee, @@ -120,8 +108,6 @@ func DefaultParams() Params { ), DefaultTrustingPeriodFraction, ccvtypes.DefaultCCVTimeoutPeriod, - DefaultInitTimeoutPeriod, - DefaultVscTimeoutPeriod, DefaultSlashMeterReplenishPeriod, DefaultSlashMeterReplenishFraction, // Defining this inline because it's not possible to define a constant of type sdk.Coin. @@ -149,12 +135,6 @@ func (p Params) Validate() error { if err := ccvtypes.ValidateDuration(p.CcvTimeoutPeriod); err != nil { return fmt.Errorf("ccv timeout period is invalid: %s", err) } - if err := ccvtypes.ValidateDuration(p.InitTimeoutPeriod); err != nil { - return fmt.Errorf("init timeout period is invalid: %s", err) - } - if err := ccvtypes.ValidateDuration(p.VscTimeoutPeriod); err != nil { - return fmt.Errorf("vsc timeout period is invalid: %s", err) - } if err := ccvtypes.ValidateDuration(p.SlashMeterReplenishPeriod); err != nil { return fmt.Errorf("slash meter replenish period is invalid: %s", err) } @@ -179,8 +159,6 @@ func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs { paramtypes.NewParamSetPair(KeyTemplateClient, p.TemplateClient, ValidateTemplateClient), paramtypes.NewParamSetPair(KeyTrustingPeriodFraction, p.TrustingPeriodFraction, ccvtypes.ValidateStringFraction), paramtypes.NewParamSetPair(ccvtypes.KeyCCVTimeoutPeriod, p.CcvTimeoutPeriod, ccvtypes.ValidateDuration), - paramtypes.NewParamSetPair(KeyInitTimeoutPeriod, p.InitTimeoutPeriod, ccvtypes.ValidateDuration), - paramtypes.NewParamSetPair(KeyVscTimeoutPeriod, p.VscTimeoutPeriod, ccvtypes.ValidateDuration), paramtypes.NewParamSetPair(KeySlashMeterReplenishPeriod, p.SlashMeterReplenishPeriod, ccvtypes.ValidateDuration), paramtypes.NewParamSetPair(KeySlashMeterReplenishFraction, p.SlashMeterReplenishFraction, ccvtypes.ValidateStringFraction), paramtypes.NewParamSetPair(KeyConsumerRewardDenomRegistrationFee, p.ConsumerRewardDenomRegistrationFee, ValidateCoin), diff --git a/x/ccv/provider/types/params_test.go b/x/ccv/provider/types/params_test.go index 8ff8da58f1..18f1cf51c4 100644 --- a/x/ccv/provider/types/params_test.go +++ b/x/ccv/provider/types/params_test.go @@ -25,43 +25,37 @@ 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: math.NewInt(10000000)}, 1000, 24), true}, + "0.33", time.Hour, 30*time.Minute, "0.1", sdk.Coin{Denom: "stake", Amount: math.NewInt(10000000)}, 1000, 24), 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: math.NewInt(10000000)}, 1000, 24), false}, + "0.33", time.Hour, 30*time.Minute, "0.1", sdk.Coin{Denom: "stake", Amount: math.NewInt(10000000)}, 1000, 24), 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: math.NewInt(10000000)}, 1000, 24), false}, - {"nil client", types.NewParams(nil, "0.33", time.Hour, time.Hour, time.Hour, 30*time.Minute, "0.1", sdk.Coin{Denom: "stake", Amount: math.NewInt(10000000)}, 1000, 24), false}, + "0.33", time.Hour, 30*time.Minute, "0.1", sdk.Coin{Denom: "stake", Amount: math.NewInt(10000000)}, 1000, 24), false}, + {"nil client", types.NewParams(nil, "0.33", time.Hour, 30*time.Minute, "0.1", sdk.Coin{Denom: "stake", Amount: math.NewInt(10000000)}, 1000, 24), 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: math.NewInt(10000000)}, 1000, 24), true}, + "0.00", time.Hour, 30*time.Minute, "0.1", sdk.Coin{Denom: "stake", Amount: math.NewInt(10000000)}, 1000, 24), 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: math.NewInt(10000000)}, 1000, 24), 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: math.NewInt(10000000)}, 1000, 24), 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: math.NewInt(10000000)}, 1000, 24), false}, + "0.33", 0, 30*time.Minute, "0.1", sdk.Coin{Denom: "stake", Amount: math.NewInt(10000000)}, 1000, 24), 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: math.NewInt(10000000)}, 1000, 24), false}, + "0.33", time.Hour, 0, "0.1", sdk.Coin{Denom: "stake", Amount: math.NewInt(10000000)}, 1000, 24), 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: math.NewInt(10000000)}, 1000, 24), false}, + "0.33", time.Hour, time.Hour, "1.5", sdk.Coin{Denom: "stake", Amount: math.NewInt(10000000)}, 1000, 24), 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: math.NewInt(10000000)}, 1000, 24), false}, + "0.33", time.Hour, time.Hour, "0.1", sdk.Coin{Denom: "st", Amount: math.NewInt(10000000)}, 1000, 24), 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: math.NewInt(-10000000)}, 1000, 24), false}, + "0.33", time.Hour, time.Hour, "0.1", sdk.Coin{Denom: "stake", Amount: math.NewInt(-10000000)}, 1000, 24), false}, {"invalid number of epochs to start receiving rewards", 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: math.NewInt(10000000)}, 1000, 0), false}, + "0.33", time.Hour, 30*time.Minute, "0.1", sdk.Coin{Denom: "stake", Amount: math.NewInt(10000000)}, 1000, 0), false}, } for _, tc := range testCases { diff --git a/x/ccv/provider/types/provider.pb.go b/x/ccv/provider/types/provider.pb.go index e602595797..72a3c0ddec 100644 --- a/x/ccv/provider/types/provider.pb.go +++ b/x/ccv/provider/types/provider.pb.go @@ -579,14 +579,6 @@ type Params struct { TrustingPeriodFraction string `protobuf:"bytes,2,opt,name=trusting_period_fraction,json=trustingPeriodFraction,proto3" json:"trusting_period_fraction,omitempty"` // Sent IBC packets will timeout after this duration CcvTimeoutPeriod time.Duration `protobuf:"bytes,3,opt,name=ccv_timeout_period,json=ccvTimeoutPeriod,proto3,stdduration" json:"ccv_timeout_period"` - // The channel initialization (IBC channel opening handshake) will timeout - // after this duration - InitTimeoutPeriod time.Duration `protobuf:"bytes,4,opt,name=init_timeout_period,json=initTimeoutPeriod,proto3,stdduration" json:"init_timeout_period"` - // The VSC packets sent by the provider will timeout after this duration. - // Note that unlike ccv_timeout_period which is an IBC param, - // the vsc_timeout_period is a provider-side param that enables the provider - // to timeout VSC packets even when a consumer chain is not live. - VscTimeoutPeriod time.Duration `protobuf:"bytes,5,opt,name=vsc_timeout_period,json=vscTimeoutPeriod,proto3,stdduration" json:"vsc_timeout_period"` // The period for which the slash meter is replenished SlashMeterReplenishPeriod time.Duration `protobuf:"bytes,6,opt,name=slash_meter_replenish_period,json=slashMeterReplenishPeriod,proto3,stdduration" json:"slash_meter_replenish_period"` // The fraction of total voting power that is replenished to the slash meter @@ -655,20 +647,6 @@ func (m *Params) GetCcvTimeoutPeriod() time.Duration { return 0 } -func (m *Params) GetInitTimeoutPeriod() time.Duration { - if m != nil { - return m.InitTimeoutPeriod - } - return 0 -} - -func (m *Params) GetVscTimeoutPeriod() time.Duration { - if m != nil { - return m.VscTimeoutPeriod - } - return 0 -} - func (m *Params) GetSlashMeterReplenishPeriod() time.Duration { if m != nil { return m.SlashMeterReplenishPeriod @@ -942,219 +920,6 @@ func (m *ChannelToChain) GetChainId() string { return "" } -// VscUnbondingOps contains the IDs of unbonding operations that are waiting for -// at least one VSCMaturedPacket with vscID from a consumer chain -type VscUnbondingOps struct { - VscId uint64 `protobuf:"varint,1,opt,name=vsc_id,json=vscId,proto3" json:"vsc_id,omitempty"` - UnbondingOpIds []uint64 `protobuf:"varint,2,rep,packed,name=unbonding_op_ids,json=unbondingOpIds,proto3" json:"unbonding_op_ids,omitempty"` -} - -func (m *VscUnbondingOps) Reset() { *m = VscUnbondingOps{} } -func (m *VscUnbondingOps) String() string { return proto.CompactTextString(m) } -func (*VscUnbondingOps) ProtoMessage() {} -func (*VscUnbondingOps) Descriptor() ([]byte, []int) { - return fileDescriptor_f22ec409a72b7b72, []int{12} -} -func (m *VscUnbondingOps) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *VscUnbondingOps) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_VscUnbondingOps.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 *VscUnbondingOps) XXX_Merge(src proto.Message) { - xxx_messageInfo_VscUnbondingOps.Merge(m, src) -} -func (m *VscUnbondingOps) XXX_Size() int { - return m.Size() -} -func (m *VscUnbondingOps) XXX_DiscardUnknown() { - xxx_messageInfo_VscUnbondingOps.DiscardUnknown(m) -} - -var xxx_messageInfo_VscUnbondingOps proto.InternalMessageInfo - -func (m *VscUnbondingOps) GetVscId() uint64 { - if m != nil { - return m.VscId - } - return 0 -} - -func (m *VscUnbondingOps) GetUnbondingOpIds() []uint64 { - if m != nil { - return m.UnbondingOpIds - } - return nil -} - -// UnbondingOp contains the ids of consumer chains that need to unbond before -// the unbonding operation with the given ID can unbond -type UnbondingOp struct { - Id uint64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` - // consumer chains that are still unbonding - UnbondingConsumerChains []string `protobuf:"bytes,2,rep,name=unbonding_consumer_chains,json=unbondingConsumerChains,proto3" json:"unbonding_consumer_chains,omitempty"` -} - -func (m *UnbondingOp) Reset() { *m = UnbondingOp{} } -func (m *UnbondingOp) String() string { return proto.CompactTextString(m) } -func (*UnbondingOp) ProtoMessage() {} -func (*UnbondingOp) Descriptor() ([]byte, []int) { - return fileDescriptor_f22ec409a72b7b72, []int{13} -} -func (m *UnbondingOp) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *UnbondingOp) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_UnbondingOp.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 *UnbondingOp) XXX_Merge(src proto.Message) { - xxx_messageInfo_UnbondingOp.Merge(m, src) -} -func (m *UnbondingOp) XXX_Size() int { - return m.Size() -} -func (m *UnbondingOp) XXX_DiscardUnknown() { - xxx_messageInfo_UnbondingOp.DiscardUnknown(m) -} - -var xxx_messageInfo_UnbondingOp proto.InternalMessageInfo - -func (m *UnbondingOp) GetId() uint64 { - if m != nil { - return m.Id - } - return 0 -} - -func (m *UnbondingOp) GetUnbondingConsumerChains() []string { - if m != nil { - return m.UnbondingConsumerChains - } - return nil -} - -type InitTimeoutTimestamp struct { - ChainId string `protobuf:"bytes,1,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` - Timestamp uint64 `protobuf:"varint,2,opt,name=timestamp,proto3" json:"timestamp,omitempty"` -} - -func (m *InitTimeoutTimestamp) Reset() { *m = InitTimeoutTimestamp{} } -func (m *InitTimeoutTimestamp) String() string { return proto.CompactTextString(m) } -func (*InitTimeoutTimestamp) ProtoMessage() {} -func (*InitTimeoutTimestamp) Descriptor() ([]byte, []int) { - return fileDescriptor_f22ec409a72b7b72, []int{14} -} -func (m *InitTimeoutTimestamp) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *InitTimeoutTimestamp) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_InitTimeoutTimestamp.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 *InitTimeoutTimestamp) XXX_Merge(src proto.Message) { - xxx_messageInfo_InitTimeoutTimestamp.Merge(m, src) -} -func (m *InitTimeoutTimestamp) XXX_Size() int { - return m.Size() -} -func (m *InitTimeoutTimestamp) XXX_DiscardUnknown() { - xxx_messageInfo_InitTimeoutTimestamp.DiscardUnknown(m) -} - -var xxx_messageInfo_InitTimeoutTimestamp proto.InternalMessageInfo - -func (m *InitTimeoutTimestamp) GetChainId() string { - if m != nil { - return m.ChainId - } - return "" -} - -func (m *InitTimeoutTimestamp) GetTimestamp() uint64 { - if m != nil { - return m.Timestamp - } - return 0 -} - -type VscSendTimestamp struct { - VscId uint64 `protobuf:"varint,1,opt,name=vsc_id,json=vscId,proto3" json:"vsc_id,omitempty"` - Timestamp time.Time `protobuf:"bytes,2,opt,name=timestamp,proto3,stdtime" json:"timestamp"` -} - -func (m *VscSendTimestamp) Reset() { *m = VscSendTimestamp{} } -func (m *VscSendTimestamp) String() string { return proto.CompactTextString(m) } -func (*VscSendTimestamp) ProtoMessage() {} -func (*VscSendTimestamp) Descriptor() ([]byte, []int) { - return fileDescriptor_f22ec409a72b7b72, []int{15} -} -func (m *VscSendTimestamp) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *VscSendTimestamp) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_VscSendTimestamp.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 *VscSendTimestamp) XXX_Merge(src proto.Message) { - xxx_messageInfo_VscSendTimestamp.Merge(m, src) -} -func (m *VscSendTimestamp) XXX_Size() int { - return m.Size() -} -func (m *VscSendTimestamp) XXX_DiscardUnknown() { - xxx_messageInfo_VscSendTimestamp.DiscardUnknown(m) -} - -var xxx_messageInfo_VscSendTimestamp proto.InternalMessageInfo - -func (m *VscSendTimestamp) GetVscId() uint64 { - if m != nil { - return m.VscId - } - return 0 -} - -func (m *VscSendTimestamp) GetTimestamp() time.Time { - if m != nil { - return m.Timestamp - } - return time.Time{} -} - // ValidatorSetChangePackets is a pb list of ccv.ValidatorSetChangePacketData. type ValidatorSetChangePackets struct { List []types3.ValidatorSetChangePacketData `protobuf:"bytes,1,rep,name=list,proto3" json:"list"` @@ -1164,7 +929,7 @@ func (m *ValidatorSetChangePackets) Reset() { *m = ValidatorSetChangePac func (m *ValidatorSetChangePackets) String() string { return proto.CompactTextString(m) } func (*ValidatorSetChangePackets) ProtoMessage() {} func (*ValidatorSetChangePackets) Descriptor() ([]byte, []int) { - return fileDescriptor_f22ec409a72b7b72, []int{16} + return fileDescriptor_f22ec409a72b7b72, []int{12} } func (m *ValidatorSetChangePackets) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1200,105 +965,6 @@ func (m *ValidatorSetChangePackets) GetList() []types3.ValidatorSetChangePacketD return nil } -// MaturedUnbondingOps defines a list of ids corresponding to ids of matured -// unbonding operations. -type MaturedUnbondingOps struct { - Ids []uint64 `protobuf:"varint,1,rep,packed,name=ids,proto3" json:"ids,omitempty"` -} - -func (m *MaturedUnbondingOps) Reset() { *m = MaturedUnbondingOps{} } -func (m *MaturedUnbondingOps) String() string { return proto.CompactTextString(m) } -func (*MaturedUnbondingOps) ProtoMessage() {} -func (*MaturedUnbondingOps) Descriptor() ([]byte, []int) { - return fileDescriptor_f22ec409a72b7b72, []int{17} -} -func (m *MaturedUnbondingOps) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MaturedUnbondingOps) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MaturedUnbondingOps.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 *MaturedUnbondingOps) XXX_Merge(src proto.Message) { - xxx_messageInfo_MaturedUnbondingOps.Merge(m, src) -} -func (m *MaturedUnbondingOps) XXX_Size() int { - return m.Size() -} -func (m *MaturedUnbondingOps) XXX_DiscardUnknown() { - xxx_messageInfo_MaturedUnbondingOps.DiscardUnknown(m) -} - -var xxx_messageInfo_MaturedUnbondingOps proto.InternalMessageInfo - -func (m *MaturedUnbondingOps) GetIds() []uint64 { - if m != nil { - return m.Ids - } - return nil -} - -// ExportedVscSendTimestamps is VscSendTimestamp with chainID info for exporting to genesis -type ExportedVscSendTimestamp struct { - ChainId string `protobuf:"bytes,1,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` - VscSendTimestamps []VscSendTimestamp `protobuf:"bytes,2,rep,name=vsc_send_timestamps,json=vscSendTimestamps,proto3" json:"vsc_send_timestamps"` -} - -func (m *ExportedVscSendTimestamp) Reset() { *m = ExportedVscSendTimestamp{} } -func (m *ExportedVscSendTimestamp) String() string { return proto.CompactTextString(m) } -func (*ExportedVscSendTimestamp) ProtoMessage() {} -func (*ExportedVscSendTimestamp) Descriptor() ([]byte, []int) { - return fileDescriptor_f22ec409a72b7b72, []int{18} -} -func (m *ExportedVscSendTimestamp) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ExportedVscSendTimestamp) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_ExportedVscSendTimestamp.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 *ExportedVscSendTimestamp) XXX_Merge(src proto.Message) { - xxx_messageInfo_ExportedVscSendTimestamp.Merge(m, src) -} -func (m *ExportedVscSendTimestamp) XXX_Size() int { - return m.Size() -} -func (m *ExportedVscSendTimestamp) XXX_DiscardUnknown() { - xxx_messageInfo_ExportedVscSendTimestamp.DiscardUnknown(m) -} - -var xxx_messageInfo_ExportedVscSendTimestamp proto.InternalMessageInfo - -func (m *ExportedVscSendTimestamp) GetChainId() string { - if m != nil { - return m.ChainId - } - return "" -} - -func (m *ExportedVscSendTimestamp) GetVscSendTimestamps() []VscSendTimestamp { - if m != nil { - return m.VscSendTimestamps - } - return nil -} - type KeyAssignmentReplacement struct { ProviderAddr []byte `protobuf:"bytes,1,opt,name=provider_addr,json=providerAddr,proto3" json:"provider_addr,omitempty"` PrevCKey *crypto.PublicKey `protobuf:"bytes,2,opt,name=prev_c_key,json=prevCKey,proto3" json:"prev_c_key,omitempty"` @@ -1309,7 +975,7 @@ func (m *KeyAssignmentReplacement) Reset() { *m = KeyAssignmentReplaceme func (m *KeyAssignmentReplacement) String() string { return proto.CompactTextString(m) } func (*KeyAssignmentReplacement) ProtoMessage() {} func (*KeyAssignmentReplacement) Descriptor() ([]byte, []int) { - return fileDescriptor_f22ec409a72b7b72, []int{19} + return fileDescriptor_f22ec409a72b7b72, []int{13} } func (m *KeyAssignmentReplacement) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1372,7 +1038,7 @@ func (m *ValidatorConsumerPubKey) Reset() { *m = ValidatorConsumerPubKey func (m *ValidatorConsumerPubKey) String() string { return proto.CompactTextString(m) } func (*ValidatorConsumerPubKey) ProtoMessage() {} func (*ValidatorConsumerPubKey) Descriptor() ([]byte, []int) { - return fileDescriptor_f22ec409a72b7b72, []int{20} + return fileDescriptor_f22ec409a72b7b72, []int{14} } func (m *ValidatorConsumerPubKey) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1435,7 +1101,7 @@ func (m *ValidatorByConsumerAddr) Reset() { *m = ValidatorByConsumerAddr func (m *ValidatorByConsumerAddr) String() string { return proto.CompactTextString(m) } func (*ValidatorByConsumerAddr) ProtoMessage() {} func (*ValidatorByConsumerAddr) Descriptor() ([]byte, []int) { - return fileDescriptor_f22ec409a72b7b72, []int{21} + return fileDescriptor_f22ec409a72b7b72, []int{15} } func (m *ValidatorByConsumerAddr) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1485,26 +1151,26 @@ func (m *ValidatorByConsumerAddr) GetProviderAddr() []byte { return nil } -// Used to serialize the ConsumerAddrsToPrune index from key assignment -// ConsumerAddrsToPrune: (chainID, vscID uint64) -> consumerAddrs AddressList -type ConsumerAddrsToPrune struct { +// Used to serialize the ConsumerAddrsToPruneV2 index from key assignment +// ConsumerAddrsToPruneV2: (chainID, pruneTs time.Time) -> consumerAddrs AddressList +type ConsumerAddrsToPruneV2 struct { ChainId string `protobuf:"bytes,1,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` - VscId uint64 `protobuf:"varint,2,opt,name=vsc_id,json=vscId,proto3" json:"vsc_id,omitempty"` + PruneTs time.Time `protobuf:"bytes,2,opt,name=prune_ts,json=pruneTs,proto3,stdtime" json:"prune_ts"` ConsumerAddrs *AddressList `protobuf:"bytes,3,opt,name=consumer_addrs,json=consumerAddrs,proto3" json:"consumer_addrs,omitempty"` } -func (m *ConsumerAddrsToPrune) Reset() { *m = ConsumerAddrsToPrune{} } -func (m *ConsumerAddrsToPrune) String() string { return proto.CompactTextString(m) } -func (*ConsumerAddrsToPrune) ProtoMessage() {} -func (*ConsumerAddrsToPrune) Descriptor() ([]byte, []int) { - return fileDescriptor_f22ec409a72b7b72, []int{22} +func (m *ConsumerAddrsToPruneV2) Reset() { *m = ConsumerAddrsToPruneV2{} } +func (m *ConsumerAddrsToPruneV2) String() string { return proto.CompactTextString(m) } +func (*ConsumerAddrsToPruneV2) ProtoMessage() {} +func (*ConsumerAddrsToPruneV2) Descriptor() ([]byte, []int) { + return fileDescriptor_f22ec409a72b7b72, []int{16} } -func (m *ConsumerAddrsToPrune) XXX_Unmarshal(b []byte) error { +func (m *ConsumerAddrsToPruneV2) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *ConsumerAddrsToPrune) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *ConsumerAddrsToPruneV2) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_ConsumerAddrsToPrune.Marshal(b, m, deterministic) + return xxx_messageInfo_ConsumerAddrsToPruneV2.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -1514,33 +1180,33 @@ func (m *ConsumerAddrsToPrune) XXX_Marshal(b []byte, deterministic bool) ([]byte return b[:n], nil } } -func (m *ConsumerAddrsToPrune) XXX_Merge(src proto.Message) { - xxx_messageInfo_ConsumerAddrsToPrune.Merge(m, src) +func (m *ConsumerAddrsToPruneV2) XXX_Merge(src proto.Message) { + xxx_messageInfo_ConsumerAddrsToPruneV2.Merge(m, src) } -func (m *ConsumerAddrsToPrune) XXX_Size() int { +func (m *ConsumerAddrsToPruneV2) XXX_Size() int { return m.Size() } -func (m *ConsumerAddrsToPrune) XXX_DiscardUnknown() { - xxx_messageInfo_ConsumerAddrsToPrune.DiscardUnknown(m) +func (m *ConsumerAddrsToPruneV2) XXX_DiscardUnknown() { + xxx_messageInfo_ConsumerAddrsToPruneV2.DiscardUnknown(m) } -var xxx_messageInfo_ConsumerAddrsToPrune proto.InternalMessageInfo +var xxx_messageInfo_ConsumerAddrsToPruneV2 proto.InternalMessageInfo -func (m *ConsumerAddrsToPrune) GetChainId() string { +func (m *ConsumerAddrsToPruneV2) GetChainId() string { if m != nil { return m.ChainId } return "" } -func (m *ConsumerAddrsToPrune) GetVscId() uint64 { +func (m *ConsumerAddrsToPruneV2) GetPruneTs() time.Time { if m != nil { - return m.VscId + return m.PruneTs } - return 0 + return time.Time{} } -func (m *ConsumerAddrsToPrune) GetConsumerAddrs() *AddressList { +func (m *ConsumerAddrsToPruneV2) GetConsumerAddrs() *AddressList { if m != nil { return m.ConsumerAddrs } @@ -1567,7 +1233,7 @@ 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{23} + return fileDescriptor_f22ec409a72b7b72, []int{17} } func (m *ConsumerValidator) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1635,7 +1301,7 @@ func (m *ConsumerRewardsAllocation) Reset() { *m = ConsumerRewardsAlloca func (m *ConsumerRewardsAllocation) String() string { return proto.CompactTextString(m) } func (*ConsumerRewardsAllocation) ProtoMessage() {} func (*ConsumerRewardsAllocation) Descriptor() ([]byte, []int) { - return fileDescriptor_f22ec409a72b7b72, []int{24} + return fileDescriptor_f22ec409a72b7b72, []int{18} } func (m *ConsumerRewardsAllocation) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1684,17 +1350,11 @@ func init() { proto.RegisterType((*ConsumerRemovalProposals)(nil), "interchain_security.ccv.provider.v1.ConsumerRemovalProposals") proto.RegisterType((*AddressList)(nil), "interchain_security.ccv.provider.v1.AddressList") proto.RegisterType((*ChannelToChain)(nil), "interchain_security.ccv.provider.v1.ChannelToChain") - proto.RegisterType((*VscUnbondingOps)(nil), "interchain_security.ccv.provider.v1.VscUnbondingOps") - proto.RegisterType((*UnbondingOp)(nil), "interchain_security.ccv.provider.v1.UnbondingOp") - proto.RegisterType((*InitTimeoutTimestamp)(nil), "interchain_security.ccv.provider.v1.InitTimeoutTimestamp") - proto.RegisterType((*VscSendTimestamp)(nil), "interchain_security.ccv.provider.v1.VscSendTimestamp") proto.RegisterType((*ValidatorSetChangePackets)(nil), "interchain_security.ccv.provider.v1.ValidatorSetChangePackets") - proto.RegisterType((*MaturedUnbondingOps)(nil), "interchain_security.ccv.provider.v1.MaturedUnbondingOps") - proto.RegisterType((*ExportedVscSendTimestamp)(nil), "interchain_security.ccv.provider.v1.ExportedVscSendTimestamp") proto.RegisterType((*KeyAssignmentReplacement)(nil), "interchain_security.ccv.provider.v1.KeyAssignmentReplacement") 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((*ConsumerAddrsToPruneV2)(nil), "interchain_security.ccv.provider.v1.ConsumerAddrsToPruneV2") proto.RegisterType((*ConsumerValidator)(nil), "interchain_security.ccv.provider.v1.ConsumerValidator") proto.RegisterType((*ConsumerRewardsAllocation)(nil), "interchain_security.ccv.provider.v1.ConsumerRewardsAllocation") } @@ -1704,136 +1364,124 @@ func init() { } var fileDescriptor_f22ec409a72b7b72 = []byte{ - // 2052 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x58, 0xbb, 0x6f, 0x1c, 0xc7, - 0x19, 0xe7, 0xf2, 0x8e, 0x8f, 0xfb, 0x8e, 0xcf, 0x21, 0x6d, 0x2d, 0x19, 0xe6, 0x48, 0xad, 0x23, - 0x85, 0xb1, 0xa2, 0x3b, 0x53, 0x86, 0x01, 0x41, 0x88, 0x61, 0xf0, 0x21, 0x5b, 0x0f, 0x4b, 0xa2, - 0x97, 0x8c, 0x84, 0x38, 0xc5, 0x62, 0x6e, 0x76, 0x78, 0x37, 0xe1, 0xde, 0xce, 0x6a, 0x66, 0x6e, - 0xe9, 0x6b, 0x52, 0xa7, 0x09, 0xe0, 0x74, 0x46, 0x8a, 0xc4, 0x49, 0x15, 0xb8, 0x4a, 0x91, 0x3e, - 0x40, 0x8a, 0xc0, 0x48, 0x13, 0x97, 0xa9, 0xec, 0x40, 0x2a, 0x52, 0xe4, 0x9f, 0x08, 0x66, 0xf6, - 0x79, 0x7c, 0x48, 0x27, 0x38, 0x6e, 0xc8, 0xdb, 0xef, 0xf1, 0xfb, 0xbe, 0x99, 0xef, 0xb9, 0x0b, - 0x37, 0x58, 0xa8, 0xa8, 0x20, 0x5d, 0xcc, 0x42, 0x4f, 0x52, 0xd2, 0x17, 0x4c, 0x0d, 0x5a, 0x84, - 0xc4, 0xad, 0x48, 0xf0, 0x98, 0xf9, 0x54, 0xb4, 0xe2, 0xad, 0xfc, 0x77, 0x33, 0x12, 0x5c, 0x71, - 0xf4, 0xc6, 0x39, 0x3a, 0x4d, 0x42, 0xe2, 0x66, 0x2e, 0x17, 0x6f, 0xad, 0x5e, 0xb9, 0x08, 0x38, - 0xde, 0x6a, 0x9d, 0x30, 0x41, 0x13, 0xac, 0xd5, 0xe5, 0x0e, 0xef, 0x70, 0xf3, 0xb3, 0xa5, 0x7f, - 0xa5, 0xd4, 0xf5, 0x0e,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, 0x7f, 0x3f, 0x6b, 0x58, - 0x9f, 0x3e, 0x6f, 0x8c, 0x7d, 0xf5, 0xbc, 0x31, 0xf6, 0xaf, 0xe7, 0x8d, 0xb1, 0x8f, 0xdf, 0x3d, - 0x0b, 0x5a, 0x04, 0xf1, 0x7a, 0xfe, 0xc1, 0x34, 0x7e, 0xa7, 0xf5, 0xc9, 0xf0, 0xe7, 0x58, 0x63, - 0xaf, 0x3d, 0x69, 0xda, 0xed, 0xdb, 0xff, 0x0b, 0x00, 0x00, 0xff, 0xff, 0x5f, 0xaa, 0x2b, 0x22, - 0xbf, 0x15, 0x00, 0x00, + // 1865 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x58, 0x4f, 0x6f, 0x1b, 0xc7, + 0x15, 0xd7, 0x8a, 0x94, 0x44, 0x0e, 0xf5, 0x87, 0x1a, 0xb9, 0xf1, 0x4a, 0x55, 0x49, 0x9a, 0xa9, + 0x0d, 0x35, 0xae, 0x97, 0x91, 0x82, 0x02, 0x86, 0xd1, 0xc0, 0x90, 0x28, 0x27, 0x8e, 0x94, 0x38, + 0xec, 0x8a, 0x70, 0x80, 0xf4, 0xb0, 0x18, 0xce, 0x8e, 0xc8, 0xa9, 0x96, 0x3b, 0xeb, 0x99, 0xe1, + 0xaa, 0xbc, 0xf4, 0xdc, 0x4b, 0x81, 0xf4, 0x16, 0xf4, 0xd0, 0x06, 0xe8, 0xa5, 0xc8, 0xa9, 0x87, + 0x7e, 0x82, 0x1e, 0x8a, 0xa0, 0x40, 0xd1, 0x1c, 0x7b, 0x4a, 0x0a, 0xfb, 0xd0, 0x43, 0xbf, 0x44, + 0x31, 0x33, 0xbb, 0xcb, 0xa5, 0xfe, 0xc4, 0x34, 0xd2, 0x5c, 0xa4, 0xdd, 0xf7, 0x7e, 0xef, 0x37, + 0xef, 0xcd, 0xbc, 0x79, 0xef, 0x2d, 0xc1, 0x1e, 0x0d, 0x25, 0xe1, 0x78, 0x80, 0x68, 0xe8, 0x09, + 0x82, 0x47, 0x9c, 0xca, 0x71, 0x0b, 0xe3, 0xb8, 0x15, 0x71, 0x16, 0x53, 0x9f, 0xf0, 0x56, 0xbc, + 0x9b, 0x3d, 0x3b, 0x11, 0x67, 0x92, 0xc1, 0xd7, 0xaf, 0xb0, 0x71, 0x30, 0x8e, 0x9d, 0x0c, 0x17, + 0xef, 0x6e, 0xdd, 0xbe, 0x8e, 0x38, 0xde, 0x6d, 0x9d, 0x53, 0x4e, 0x0c, 0xd7, 0xd6, 0x8d, 0x3e, + 0xeb, 0x33, 0xfd, 0xd8, 0x52, 0x4f, 0x89, 0xb4, 0xde, 0x67, 0xac, 0x1f, 0x90, 0x96, 0x7e, 0xeb, + 0x8d, 0x4e, 0x5b, 0x92, 0x0e, 0x89, 0x90, 0x68, 0x18, 0x25, 0x80, 0xda, 0x45, 0x80, 0x3f, 0xe2, + 0x48, 0x52, 0x16, 0xa6, 0x04, 0xb4, 0x87, 0x5b, 0x98, 0x71, 0xd2, 0xc2, 0x01, 0x25, 0xa1, 0x54, + 0xab, 0x9a, 0xa7, 0x04, 0xd0, 0x52, 0x80, 0x80, 0xf6, 0x07, 0xd2, 0x88, 0x45, 0x4b, 0x92, 0xd0, + 0x27, 0x7c, 0x48, 0x0d, 0x78, 0xf2, 0x96, 0x18, 0x6c, 0xe7, 0xf4, 0x98, 0x8f, 0x23, 0xc9, 0x5a, + 0x67, 0x64, 0x2c, 0x12, 0xed, 0x1d, 0xcc, 0xc4, 0x90, 0x89, 0x16, 0x51, 0xf1, 0x87, 0x98, 0xb4, + 0xe2, 0xdd, 0x1e, 0x91, 0x68, 0x37, 0x13, 0xa4, 0x7e, 0x27, 0xb8, 0x1e, 0x12, 0x13, 0x0c, 0x66, + 0x34, 0xf5, 0x7b, 0xd3, 0xe8, 0x3d, 0xb3, 0x23, 0xe6, 0x25, 0x51, 0xad, 0xa3, 0x21, 0x0d, 0x59, + 0x4b, 0xff, 0x35, 0xa2, 0xe6, 0xe7, 0x25, 0x60, 0xb7, 0x59, 0x28, 0x46, 0x43, 0xc2, 0xf7, 0x7d, + 0x9f, 0xaa, 0x0d, 0xe8, 0x70, 0x16, 0x31, 0x81, 0x02, 0x78, 0x03, 0x2c, 0x48, 0x2a, 0x03, 0x62, + 0x5b, 0x0d, 0x6b, 0xa7, 0xec, 0x9a, 0x17, 0xd8, 0x00, 0x15, 0x9f, 0x08, 0xcc, 0x69, 0xa4, 0xc0, + 0xf6, 0xbc, 0xd6, 0xe5, 0x45, 0x70, 0x13, 0x94, 0xcc, 0xa9, 0x51, 0xdf, 0x2e, 0x68, 0xf5, 0x92, + 0x7e, 0x7f, 0xcf, 0x87, 0xef, 0x82, 0x55, 0x1a, 0x52, 0x49, 0x51, 0xe0, 0x0d, 0x88, 0xda, 0x3b, + 0xbb, 0xd8, 0xb0, 0x76, 0x2a, 0x7b, 0x5b, 0x0e, 0xed, 0x61, 0x47, 0x6d, 0xb7, 0x93, 0x6c, 0x72, + 0xbc, 0xeb, 0x3c, 0xd6, 0x88, 0x83, 0xe2, 0x17, 0x5f, 0xd5, 0xe7, 0xdc, 0x95, 0xc4, 0xce, 0x08, + 0xe1, 0x2d, 0xb0, 0xdc, 0x27, 0x21, 0x11, 0x54, 0x78, 0x03, 0x24, 0x06, 0xf6, 0x42, 0xc3, 0xda, + 0x59, 0x76, 0x2b, 0x89, 0xec, 0x31, 0x12, 0x03, 0x58, 0x07, 0x95, 0x1e, 0x0d, 0x11, 0x1f, 0x1b, + 0xc4, 0xa2, 0x46, 0x00, 0x23, 0xd2, 0x80, 0x36, 0x00, 0x22, 0x42, 0xe7, 0xa1, 0xa7, 0x72, 0xc3, + 0x5e, 0x4a, 0x1c, 0x31, 0x79, 0xe1, 0xa4, 0x79, 0xe1, 0x74, 0xd3, 0xc4, 0x39, 0x28, 0x29, 0x47, + 0x3e, 0xf9, 0xba, 0x6e, 0xb9, 0x65, 0x6d, 0xa7, 0x34, 0xf0, 0x09, 0xa8, 0x8e, 0xc2, 0x1e, 0x0b, + 0x7d, 0x1a, 0xf6, 0xbd, 0x88, 0x70, 0xca, 0x7c, 0xbb, 0xa4, 0xa9, 0x36, 0x2f, 0x51, 0x1d, 0x26, + 0x29, 0x66, 0x98, 0x3e, 0x55, 0x4c, 0x6b, 0x99, 0x71, 0x47, 0xdb, 0xc2, 0x9f, 0x01, 0x88, 0x71, + 0xac, 0x5d, 0x62, 0x23, 0x99, 0x32, 0x96, 0x67, 0x67, 0xac, 0x62, 0x1c, 0x77, 0x8d, 0x75, 0x42, + 0xf9, 0x73, 0x70, 0x53, 0x72, 0x14, 0x8a, 0x53, 0xc2, 0x2f, 0xf2, 0x82, 0xd9, 0x79, 0xbf, 0x97, + 0x72, 0x4c, 0x93, 0x3f, 0x06, 0x0d, 0x9c, 0x24, 0x90, 0xc7, 0x89, 0x4f, 0x85, 0xe4, 0xb4, 0x37, + 0x52, 0xb6, 0xde, 0x29, 0x47, 0x58, 0xe7, 0x48, 0x45, 0x27, 0x41, 0x2d, 0xc5, 0xb9, 0x53, 0xb0, + 0x77, 0x12, 0x14, 0xfc, 0x10, 0xfc, 0xb0, 0x17, 0x30, 0x7c, 0x26, 0x94, 0x73, 0xde, 0x14, 0x93, + 0x5e, 0x7a, 0x48, 0x85, 0x50, 0x6c, 0xcb, 0x0d, 0x6b, 0xa7, 0xe0, 0xde, 0x32, 0xd8, 0x0e, 0xe1, + 0x87, 0x39, 0x64, 0x37, 0x07, 0x84, 0xf7, 0x00, 0x1c, 0x50, 0x21, 0x19, 0xa7, 0x18, 0x05, 0x1e, + 0x09, 0x25, 0xa7, 0x44, 0xd8, 0x2b, 0xda, 0x7c, 0x7d, 0xa2, 0x79, 0x64, 0x14, 0xf0, 0x08, 0xdc, + 0xba, 0x76, 0x51, 0x0f, 0x0f, 0x50, 0x18, 0x92, 0xc0, 0x5e, 0xd5, 0xa1, 0xd4, 0xfd, 0x6b, 0xd6, + 0x6c, 0x1b, 0x18, 0xdc, 0x00, 0x0b, 0x92, 0x45, 0xde, 0x13, 0x7b, 0xad, 0x61, 0xed, 0xac, 0xb8, + 0x45, 0xc9, 0xa2, 0x27, 0xf0, 0x4d, 0x70, 0x23, 0x46, 0x01, 0xf5, 0x91, 0x64, 0x5c, 0x78, 0x11, + 0x3b, 0x27, 0xdc, 0xc3, 0x28, 0xb2, 0xab, 0x1a, 0x03, 0x27, 0xba, 0x8e, 0x52, 0xb5, 0x51, 0x04, + 0xdf, 0x00, 0xeb, 0x99, 0xd4, 0x13, 0x44, 0x6a, 0xf8, 0xba, 0x86, 0xaf, 0x65, 0x8a, 0x13, 0x22, + 0x15, 0x76, 0x1b, 0x94, 0x51, 0x10, 0xb0, 0xf3, 0x80, 0x0a, 0x69, 0xc3, 0x46, 0x61, 0xa7, 0xec, + 0x4e, 0x04, 0x70, 0x0b, 0x94, 0x7c, 0x12, 0x8e, 0xb5, 0x72, 0x43, 0x2b, 0xb3, 0xf7, 0x07, 0x77, + 0x7e, 0xfd, 0x59, 0x7d, 0xee, 0xd3, 0xcf, 0xea, 0x73, 0x7f, 0xff, 0xcb, 0xbd, 0xad, 0xa4, 0x62, + 0xf4, 0x59, 0xec, 0x24, 0xd5, 0xc5, 0x69, 0xb3, 0x50, 0x92, 0x50, 0x36, 0xff, 0x69, 0x81, 0x9b, + 0xed, 0xec, 0x0c, 0x87, 0x2c, 0x46, 0xc1, 0x77, 0x59, 0x2b, 0xf6, 0x41, 0x59, 0xa8, 0x4d, 0xd4, + 0xb7, 0xb3, 0xf8, 0x0a, 0xb7, 0xb3, 0xa4, 0xcc, 0x94, 0xe2, 0x41, 0xed, 0x25, 0x11, 0xfd, 0x7e, + 0x1e, 0x6c, 0xa7, 0x11, 0x7d, 0xc0, 0x7c, 0x7a, 0x4a, 0x31, 0xfa, 0xae, 0x4b, 0x60, 0x96, 0x1a, + 0xc5, 0x19, 0x52, 0x63, 0xe1, 0xd5, 0x52, 0x63, 0x71, 0x86, 0xd4,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0x30, 0xea, 0x39, 0x98, 0x0d, 0x93, 0x1f, + 0x39, 0x92, 0x7f, 0xf7, 0x84, 0x7f, 0xd6, 0x92, 0xe3, 0x88, 0x88, 0xd4, 0x46, 0xfc, 0xe9, 0x3f, + 0x7f, 0x7e, 0xc3, 0x72, 0xd3, 0x65, 0x0e, 0x3e, 0xfa, 0xe2, 0x79, 0xcd, 0xfa, 0xf2, 0x79, 0xcd, + 0xfa, 0xf7, 0xf3, 0x9a, 0xf5, 0xc9, 0x8b, 0xda, 0xdc, 0x97, 0x2f, 0x6a, 0x73, 0xff, 0x7a, 0x51, + 0x9b, 0xfb, 0xf8, 0xed, 0xcb, 0xa4, 0x93, 0x43, 0xbc, 0x97, 0xfd, 0x06, 0x15, 0xff, 0xa4, 0xf5, + 0xcb, 0xe9, 0x5f, 0xb8, 0xf4, 0x7a, 0xbd, 0x45, 0x9d, 0x31, 0x6f, 0xfd, 0x2f, 0x00, 0x00, 0xff, + 0xff, 0xae, 0x29, 0x6e, 0xec, 0x12, 0x13, 0x00, 0x00, } func (m *ConsumerAdditionProposal) Marshal() (dAtA []byte, err error) { @@ -2341,29 +1989,13 @@ func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintProvider(dAtA, i, uint64(n9)) i-- dAtA[i] = 0x32 - n10, err10 := github_com_cosmos_gogoproto_types.StdDurationMarshalTo(m.VscTimeoutPeriod, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdDuration(m.VscTimeoutPeriod):]) + n10, err10 := github_com_cosmos_gogoproto_types.StdDurationMarshalTo(m.CcvTimeoutPeriod, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdDuration(m.CcvTimeoutPeriod):]) if err10 != nil { return 0, err10 } i -= n10 i = encodeVarintProvider(dAtA, i, uint64(n10)) i-- - dAtA[i] = 0x2a - n11, err11 := github_com_cosmos_gogoproto_types.StdDurationMarshalTo(m.InitTimeoutPeriod, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdDuration(m.InitTimeoutPeriod):]) - if err11 != nil { - return 0, err11 - } - i -= n11 - i = encodeVarintProvider(dAtA, i, uint64(n11)) - i-- - dAtA[i] = 0x22 - n12, err12 := github_com_cosmos_gogoproto_types.StdDurationMarshalTo(m.CcvTimeoutPeriod, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdDuration(m.CcvTimeoutPeriod):]) - if err12 != nil { - return 0, err12 - } - i -= n12 - i = encodeVarintProvider(dAtA, i, uint64(n12)) - i-- dAtA[i] = 0x1a if len(m.TrustingPeriodFraction) > 0 { i -= len(m.TrustingPeriodFraction) @@ -2562,7 +2194,7 @@ func (m *ChannelToChain) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *VscUnbondingOps) Marshal() (dAtA []byte, err error) { +func (m *ValidatorSetChangePackets) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -2572,43 +2204,34 @@ func (m *VscUnbondingOps) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *VscUnbondingOps) MarshalTo(dAtA []byte) (int, error) { +func (m *ValidatorSetChangePackets) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *VscUnbondingOps) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *ValidatorSetChangePackets) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if len(m.UnbondingOpIds) > 0 { - dAtA15 := make([]byte, len(m.UnbondingOpIds)*10) - var j14 int - for _, num := range m.UnbondingOpIds { - for num >= 1<<7 { - dAtA15[j14] = uint8(uint64(num)&0x7f | 0x80) - num >>= 7 - j14++ - } - dAtA15[j14] = uint8(num) - j14++ - } - i -= j14 - copy(dAtA[i:], dAtA15[:j14]) - i = encodeVarintProvider(dAtA, i, uint64(j14)) - i-- - dAtA[i] = 0x12 - } - if m.VscId != 0 { - i = encodeVarintProvider(dAtA, i, uint64(m.VscId)) - i-- - dAtA[i] = 0x8 + if len(m.List) > 0 { + for iNdEx := len(m.List) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.List[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintProvider(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } } return len(dAtA) - i, nil } -func (m *UnbondingOp) Marshal() (dAtA []byte, err error) { +func (m *KeyAssignmentReplacement) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -2618,262 +2241,32 @@ func (m *UnbondingOp) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *UnbondingOp) MarshalTo(dAtA []byte) (int, error) { +func (m *KeyAssignmentReplacement) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *UnbondingOp) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *KeyAssignmentReplacement) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if len(m.UnbondingConsumerChains) > 0 { - for iNdEx := len(m.UnbondingConsumerChains) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.UnbondingConsumerChains[iNdEx]) - copy(dAtA[i:], m.UnbondingConsumerChains[iNdEx]) - i = encodeVarintProvider(dAtA, i, uint64(len(m.UnbondingConsumerChains[iNdEx]))) - i-- - dAtA[i] = 0x12 - } + if m.Power != 0 { + i = encodeVarintProvider(dAtA, i, uint64(m.Power)) + i-- + dAtA[i] = 0x18 } - if m.Id != 0 { - i = encodeVarintProvider(dAtA, i, uint64(m.Id)) + if m.PrevCKey != nil { + { + size, err := m.PrevCKey.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintProvider(dAtA, i, uint64(size)) + } i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *InitTimeoutTimestamp) 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 *InitTimeoutTimestamp) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *InitTimeoutTimestamp) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Timestamp != 0 { - i = encodeVarintProvider(dAtA, i, uint64(m.Timestamp)) - i-- - dAtA[i] = 0x10 - } - if len(m.ChainId) > 0 { - i -= len(m.ChainId) - copy(dAtA[i:], m.ChainId) - i = encodeVarintProvider(dAtA, i, uint64(len(m.ChainId))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *VscSendTimestamp) 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 *VscSendTimestamp) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *VscSendTimestamp) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - n16, err16 := github_com_cosmos_gogoproto_types.StdTimeMarshalTo(m.Timestamp, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdTime(m.Timestamp):]) - if err16 != nil { - return 0, err16 - } - i -= n16 - i = encodeVarintProvider(dAtA, i, uint64(n16)) - i-- - dAtA[i] = 0x12 - if m.VscId != 0 { - i = encodeVarintProvider(dAtA, i, uint64(m.VscId)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *ValidatorSetChangePackets) 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 *ValidatorSetChangePackets) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ValidatorSetChangePackets) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.List) > 0 { - for iNdEx := len(m.List) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.List[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintProvider(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - -func (m *MaturedUnbondingOps) 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 *MaturedUnbondingOps) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MaturedUnbondingOps) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Ids) > 0 { - dAtA18 := make([]byte, len(m.Ids)*10) - var j17 int - for _, num := range m.Ids { - for num >= 1<<7 { - dAtA18[j17] = uint8(uint64(num)&0x7f | 0x80) - num >>= 7 - j17++ - } - dAtA18[j17] = uint8(num) - j17++ - } - i -= j17 - copy(dAtA[i:], dAtA18[:j17]) - i = encodeVarintProvider(dAtA, i, uint64(j17)) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *ExportedVscSendTimestamp) 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 *ExportedVscSendTimestamp) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ExportedVscSendTimestamp) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.VscSendTimestamps) > 0 { - for iNdEx := len(m.VscSendTimestamps) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.VscSendTimestamps[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintProvider(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - } - if len(m.ChainId) > 0 { - i -= len(m.ChainId) - copy(dAtA[i:], m.ChainId) - i = encodeVarintProvider(dAtA, i, uint64(len(m.ChainId))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *KeyAssignmentReplacement) 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 *KeyAssignmentReplacement) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *KeyAssignmentReplacement) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Power != 0 { - i = encodeVarintProvider(dAtA, i, uint64(m.Power)) - i-- - dAtA[i] = 0x18 - } - if m.PrevCKey != nil { - { - size, err := m.PrevCKey.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintProvider(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 + dAtA[i] = 0x12 } if len(m.ProviderAddr) > 0 { i -= len(m.ProviderAddr) @@ -2978,7 +2371,7 @@ func (m *ValidatorByConsumerAddr) MarshalToSizedBuffer(dAtA []byte) (int, error) return len(dAtA) - i, nil } -func (m *ConsumerAddrsToPrune) Marshal() (dAtA []byte, err error) { +func (m *ConsumerAddrsToPruneV2) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -2988,12 +2381,12 @@ func (m *ConsumerAddrsToPrune) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *ConsumerAddrsToPrune) MarshalTo(dAtA []byte) (int, error) { +func (m *ConsumerAddrsToPruneV2) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *ConsumerAddrsToPrune) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *ConsumerAddrsToPruneV2) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -3010,11 +2403,14 @@ func (m *ConsumerAddrsToPrune) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x1a } - if m.VscId != 0 { - i = encodeVarintProvider(dAtA, i, uint64(m.VscId)) - i-- - dAtA[i] = 0x10 + n15, err15 := github_com_cosmos_gogoproto_types.StdTimeMarshalTo(m.PruneTs, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdTime(m.PruneTs):]) + if err15 != nil { + return 0, err15 } + i -= n15 + i = encodeVarintProvider(dAtA, i, uint64(n15)) + i-- + dAtA[i] = 0x12 if len(m.ChainId) > 0 { i -= len(m.ChainId) copy(dAtA[i:], m.ChainId) @@ -3354,10 +2750,6 @@ func (m *Params) Size() (n int) { } l = github_com_cosmos_gogoproto_types.SizeOfStdDuration(m.CcvTimeoutPeriod) n += 1 + l + sovProvider(uint64(l)) - l = github_com_cosmos_gogoproto_types.SizeOfStdDuration(m.InitTimeoutPeriod) - n += 1 + l + sovProvider(uint64(l)) - l = github_com_cosmos_gogoproto_types.SizeOfStdDuration(m.VscTimeoutPeriod) - n += 1 + l + sovProvider(uint64(l)) l = github_com_cosmos_gogoproto_types.SizeOfStdDuration(m.SlashMeterReplenishPeriod) n += 1 + l + sovProvider(uint64(l)) l = len(m.SlashMeterReplenishFraction) @@ -3452,44 +2844,42 @@ func (m *ChannelToChain) Size() (n int) { return n } -func (m *VscUnbondingOps) Size() (n int) { +func (m *ValidatorSetChangePackets) Size() (n int) { if m == nil { return 0 } var l int _ = l - if m.VscId != 0 { - n += 1 + sovProvider(uint64(m.VscId)) - } - if len(m.UnbondingOpIds) > 0 { - l = 0 - for _, e := range m.UnbondingOpIds { - l += sovProvider(uint64(e)) + if len(m.List) > 0 { + for _, e := range m.List { + l = e.Size() + n += 1 + l + sovProvider(uint64(l)) } - n += 1 + sovProvider(uint64(l)) + l } return n } -func (m *UnbondingOp) Size() (n int) { +func (m *KeyAssignmentReplacement) Size() (n int) { if m == nil { return 0 } var l int _ = l - if m.Id != 0 { - n += 1 + sovProvider(uint64(m.Id)) + l = len(m.ProviderAddr) + if l > 0 { + n += 1 + l + sovProvider(uint64(l)) } - if len(m.UnbondingConsumerChains) > 0 { - for _, s := range m.UnbondingConsumerChains { - l = len(s) - n += 1 + l + sovProvider(uint64(l)) - } + if m.PrevCKey != nil { + l = m.PrevCKey.Size() + n += 1 + l + sovProvider(uint64(l)) + } + if m.Power != 0 { + n += 1 + sovProvider(uint64(m.Power)) } return n } -func (m *InitTimeoutTimestamp) Size() (n int) { +func (m *ValidatorConsumerPubKey) Size() (n int) { if m == nil { return 0 } @@ -3499,159 +2889,58 @@ func (m *InitTimeoutTimestamp) Size() (n int) { if l > 0 { n += 1 + l + sovProvider(uint64(l)) } - if m.Timestamp != 0 { - n += 1 + sovProvider(uint64(m.Timestamp)) + l = len(m.ProviderAddr) + if l > 0 { + n += 1 + l + sovProvider(uint64(l)) + } + if m.ConsumerKey != nil { + l = m.ConsumerKey.Size() + n += 1 + l + sovProvider(uint64(l)) } return n } -func (m *VscSendTimestamp) Size() (n int) { +func (m *ValidatorByConsumerAddr) Size() (n int) { if m == nil { return 0 } var l int _ = l - if m.VscId != 0 { - n += 1 + sovProvider(uint64(m.VscId)) + l = len(m.ChainId) + if l > 0 { + n += 1 + l + sovProvider(uint64(l)) } - l = github_com_cosmos_gogoproto_types.SizeOfStdTime(m.Timestamp) - n += 1 + l + sovProvider(uint64(l)) - return n -} - -func (m *ValidatorSetChangePackets) Size() (n int) { - if m == nil { - return 0 + l = len(m.ConsumerAddr) + if l > 0 { + n += 1 + l + sovProvider(uint64(l)) } - var l int - _ = l - if len(m.List) > 0 { - for _, e := range m.List { - l = e.Size() - n += 1 + l + sovProvider(uint64(l)) - } + l = len(m.ProviderAddr) + if l > 0 { + n += 1 + l + sovProvider(uint64(l)) } return n } -func (m *MaturedUnbondingOps) Size() (n int) { +func (m *ConsumerAddrsToPruneV2) Size() (n int) { if m == nil { return 0 } var l int _ = l - if len(m.Ids) > 0 { - l = 0 - for _, e := range m.Ids { - l += sovProvider(uint64(e)) - } - n += 1 + sovProvider(uint64(l)) + l + l = len(m.ChainId) + if l > 0 { + n += 1 + l + sovProvider(uint64(l)) + } + l = github_com_cosmos_gogoproto_types.SizeOfStdTime(m.PruneTs) + n += 1 + l + sovProvider(uint64(l)) + if m.ConsumerAddrs != nil { + l = m.ConsumerAddrs.Size() + n += 1 + l + sovProvider(uint64(l)) } return n } -func (m *ExportedVscSendTimestamp) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.ChainId) - if l > 0 { - n += 1 + l + sovProvider(uint64(l)) - } - if len(m.VscSendTimestamps) > 0 { - for _, e := range m.VscSendTimestamps { - l = e.Size() - n += 1 + l + sovProvider(uint64(l)) - } - } - return n -} - -func (m *KeyAssignmentReplacement) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.ProviderAddr) - if l > 0 { - n += 1 + l + sovProvider(uint64(l)) - } - if m.PrevCKey != nil { - l = m.PrevCKey.Size() - n += 1 + l + sovProvider(uint64(l)) - } - if m.Power != 0 { - n += 1 + sovProvider(uint64(m.Power)) - } - return n -} - -func (m *ValidatorConsumerPubKey) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.ChainId) - if l > 0 { - n += 1 + l + sovProvider(uint64(l)) - } - l = len(m.ProviderAddr) - if l > 0 { - n += 1 + l + sovProvider(uint64(l)) - } - if m.ConsumerKey != nil { - l = m.ConsumerKey.Size() - n += 1 + l + sovProvider(uint64(l)) - } - return n -} - -func (m *ValidatorByConsumerAddr) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.ChainId) - if l > 0 { - n += 1 + l + sovProvider(uint64(l)) - } - l = len(m.ConsumerAddr) - if l > 0 { - n += 1 + l + sovProvider(uint64(l)) - } - l = len(m.ProviderAddr) - if l > 0 { - n += 1 + l + sovProvider(uint64(l)) - } - return n -} - -func (m *ConsumerAddrsToPrune) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.ChainId) - if l > 0 { - n += 1 + l + sovProvider(uint64(l)) - } - if m.VscId != 0 { - n += 1 + sovProvider(uint64(m.VscId)) - } - if m.ConsumerAddrs != nil { - l = m.ConsumerAddrs.Size() - n += 1 + l + sovProvider(uint64(l)) - } - return n -} - -func (m *ConsumerValidator) Size() (n int) { +func (m *ConsumerValidator) Size() (n int) { if m == nil { return 0 } @@ -5367,72 +4656,6 @@ func (m *Params) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field InitTimeoutPeriod", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProvider - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthProvider - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthProvider - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := github_com_cosmos_gogoproto_types.StdDurationUnmarshal(&m.InitTimeoutPeriod, dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field VscTimeoutPeriod", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProvider - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthProvider - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthProvider - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := github_com_cosmos_gogoproto_types.StdDurationUnmarshal(&m.VscTimeoutPeriod, dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex case 6: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field SlashMeterReplenishPeriod", wireType) @@ -5527,549 +4750,15 @@ func (m *Params) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.ConsumerRewardDenomRegistrationFee.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - 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 |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 11: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field NumberOfEpochsToStartReceivingRewards", wireType) - } - m.NumberOfEpochsToStartReceivingRewards = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProvider - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.NumberOfEpochsToStartReceivingRewards |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - 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 (m *SlashAcks) 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: SlashAcks: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: SlashAcks: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Addresses", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProvider - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthProvider - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthProvider - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Addresses = append(m.Addresses, string(dAtA[iNdEx:postIndex])) - 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 (m *ConsumerAdditionProposals) 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: ConsumerAdditionProposals: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ConsumerAdditionProposals: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Pending", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProvider - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthProvider - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthProvider - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Pending = append(m.Pending, &ConsumerAdditionProposal{}) - if err := m.Pending[len(m.Pending)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - 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 (m *ConsumerRemovalProposals) 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: ConsumerRemovalProposals: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ConsumerRemovalProposals: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Pending", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProvider - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthProvider - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthProvider - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Pending = append(m.Pending, &ConsumerRemovalProposal{}) - if err := m.Pending[len(m.Pending)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - 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 (m *AddressList) 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: AddressList: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: AddressList: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Addresses", 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.Addresses = append(m.Addresses, make([]byte, postIndex-iNdEx)) - copy(m.Addresses[len(m.Addresses)-1], dAtA[iNdEx:postIndex]) - 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 (m *ChannelToChain) 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: ChannelToChain: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ChannelToChain: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ChannelId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProvider - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthProvider - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthProvider - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ChannelId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ChainId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProvider - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthProvider - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthProvider - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ChainId = string(dAtA[iNdEx:postIndex]) - 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 (m *VscUnbondingOps) 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 + if err := m.ConsumerRewardDenomRegistrationFee.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: VscUnbondingOps: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: VscUnbondingOps: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: + iNdEx = postIndex + case 10: if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field VscId", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field BlocksPerEpoch", wireType) } - m.VscId = 0 + m.BlocksPerEpoch = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowProvider @@ -6079,86 +4768,29 @@ func (m *VscUnbondingOps) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.VscId |= uint64(b&0x7F) << shift + m.BlocksPerEpoch |= int64(b&0x7F) << shift if b < 0x80 { break } } - case 2: - if wireType == 0 { - var v uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProvider - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.UnbondingOpIds = append(m.UnbondingOpIds, v) - } else if wireType == 2 { - var packedLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProvider - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - packedLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if packedLen < 0 { - return ErrInvalidLengthProvider - } - postIndex := iNdEx + packedLen - if postIndex < 0 { - return ErrInvalidLengthProvider - } - if postIndex > l { + case 11: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field NumberOfEpochsToStartReceivingRewards", wireType) + } + m.NumberOfEpochsToStartReceivingRewards = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProvider + } + if iNdEx >= l { return io.ErrUnexpectedEOF } - var elementCount int - var count int - for _, integer := range dAtA[iNdEx:postIndex] { - if integer < 128 { - count++ - } - } - elementCount = count - if elementCount != 0 && len(m.UnbondingOpIds) == 0 { - m.UnbondingOpIds = make([]uint64, 0, elementCount) - } - for iNdEx < postIndex { - var v uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProvider - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.UnbondingOpIds = append(m.UnbondingOpIds, v) - } - } else { - return fmt.Errorf("proto: wrong wireType = %d for field UnbondingOpIds", wireType) + b := dAtA[iNdEx] + iNdEx++ + m.NumberOfEpochsToStartReceivingRewards |= int64(b&0x7F) << shift + if b < 0x80 { + break + } } default: iNdEx = preIndex @@ -6181,7 +4813,7 @@ func (m *VscUnbondingOps) Unmarshal(dAtA []byte) error { } return nil } -func (m *UnbondingOp) Unmarshal(dAtA []byte) error { +func (m *SlashAcks) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -6204,34 +4836,15 @@ func (m *UnbondingOp) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: UnbondingOp: wiretype end group for non-group") + return fmt.Errorf("proto: SlashAcks: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: UnbondingOp: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: SlashAcks: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Id", wireType) - } - m.Id = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProvider - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Id |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field UnbondingConsumerChains", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Addresses", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -6259,7 +4872,7 @@ func (m *UnbondingOp) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.UnbondingConsumerChains = append(m.UnbondingConsumerChains, string(dAtA[iNdEx:postIndex])) + m.Addresses = append(m.Addresses, string(dAtA[iNdEx:postIndex])) iNdEx = postIndex default: iNdEx = preIndex @@ -6282,7 +4895,7 @@ func (m *UnbondingOp) Unmarshal(dAtA []byte) error { } return nil } -func (m *InitTimeoutTimestamp) Unmarshal(dAtA []byte) error { +func (m *ConsumerAdditionProposals) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -6305,17 +4918,17 @@ func (m *InitTimeoutTimestamp) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: InitTimeoutTimestamp: wiretype end group for non-group") + return fmt.Errorf("proto: ConsumerAdditionProposals: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: InitTimeoutTimestamp: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: ConsumerAdditionProposals: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ChainId", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Pending", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowProvider @@ -6325,43 +4938,26 @@ func (m *InitTimeoutTimestamp) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthProvider } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthProvider } if postIndex > l { return io.ErrUnexpectedEOF } - m.ChainId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Timestamp", wireType) - } - m.Timestamp = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProvider - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Timestamp |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } + m.Pending = append(m.Pending, &ConsumerAdditionProposal{}) + if err := m.Pending[len(m.Pending)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipProvider(dAtA[iNdEx:]) @@ -6383,7 +4979,7 @@ func (m *InitTimeoutTimestamp) Unmarshal(dAtA []byte) error { } return nil } -func (m *VscSendTimestamp) Unmarshal(dAtA []byte) error { +func (m *ConsumerRemovalProposals) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -6406,34 +5002,15 @@ func (m *VscSendTimestamp) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: VscSendTimestamp: wiretype end group for non-group") + return fmt.Errorf("proto: ConsumerRemovalProposals: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: VscSendTimestamp: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: ConsumerRemovalProposals: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field VscId", wireType) - } - m.VscId = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProvider - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.VscId |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Timestamp", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Pending", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -6460,7 +5037,8 @@ func (m *VscSendTimestamp) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := github_com_cosmos_gogoproto_types.StdTimeUnmarshal(&m.Timestamp, dAtA[iNdEx:postIndex]); err != nil { + m.Pending = append(m.Pending, &ConsumerRemovalProposal{}) + if err := m.Pending[len(m.Pending)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -6485,7 +5063,7 @@ func (m *VscSendTimestamp) Unmarshal(dAtA []byte) error { } return nil } -func (m *ValidatorSetChangePackets) Unmarshal(dAtA []byte) error { +func (m *AddressList) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -6508,17 +5086,17 @@ func (m *ValidatorSetChangePackets) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: ValidatorSetChangePackets: wiretype end group for non-group") + return fmt.Errorf("proto: AddressList: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: ValidatorSetChangePackets: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: AddressList: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field List", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Addresses", wireType) } - var msglen int + var byteLen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowProvider @@ -6528,25 +5106,23 @@ func (m *ValidatorSetChangePackets) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { + if byteLen < 0 { return ErrInvalidLengthProvider } - postIndex := iNdEx + msglen + postIndex := iNdEx + byteLen if postIndex < 0 { return ErrInvalidLengthProvider } if postIndex > l { return io.ErrUnexpectedEOF } - m.List = append(m.List, types3.ValidatorSetChangePacketData{}) - if err := m.List[len(m.List)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } + m.Addresses = append(m.Addresses, make([]byte, postIndex-iNdEx)) + copy(m.Addresses[len(m.Addresses)-1], dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -6569,7 +5145,7 @@ func (m *ValidatorSetChangePackets) Unmarshal(dAtA []byte) error { } return nil } -func (m *MaturedUnbondingOps) Unmarshal(dAtA []byte) error { +func (m *ChannelToChain) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -6592,88 +5168,76 @@ func (m *MaturedUnbondingOps) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MaturedUnbondingOps: wiretype end group for non-group") + return fmt.Errorf("proto: ChannelToChain: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MaturedUnbondingOps: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: ChannelToChain: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: - if wireType == 0 { - var v uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProvider - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.Ids = append(m.Ids, v) - } else if wireType == 2 { - var packedLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProvider - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - packedLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if packedLen < 0 { - return ErrInvalidLengthProvider - } - postIndex := iNdEx + packedLen - if postIndex < 0 { - return ErrInvalidLengthProvider - } - if postIndex > l { + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ChannelId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProvider + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthProvider + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthProvider + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ChannelId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ChainId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProvider + } + if iNdEx >= l { return io.ErrUnexpectedEOF } - var elementCount int - var count int - for _, integer := range dAtA[iNdEx:postIndex] { - if integer < 128 { - count++ - } - } - elementCount = count - if elementCount != 0 && len(m.Ids) == 0 { - m.Ids = make([]uint64, 0, elementCount) - } - for iNdEx < postIndex { - var v uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProvider - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.Ids = append(m.Ids, v) - } - } else { - return fmt.Errorf("proto: wrong wireType = %d for field Ids", wireType) + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthProvider } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthProvider + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ChainId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipProvider(dAtA[iNdEx:]) @@ -6695,7 +5259,7 @@ func (m *MaturedUnbondingOps) Unmarshal(dAtA []byte) error { } return nil } -func (m *ExportedVscSendTimestamp) Unmarshal(dAtA []byte) error { +func (m *ValidatorSetChangePackets) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -6718,47 +5282,15 @@ func (m *ExportedVscSendTimestamp) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: ExportedVscSendTimestamp: wiretype end group for non-group") + return fmt.Errorf("proto: ValidatorSetChangePackets: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: ExportedVscSendTimestamp: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: ValidatorSetChangePackets: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ChainId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProvider - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthProvider - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthProvider - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ChainId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field VscSendTimestamps", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field List", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -6785,8 +5317,8 @@ func (m *ExportedVscSendTimestamp) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.VscSendTimestamps = append(m.VscSendTimestamps, VscSendTimestamp{}) - if err := m.VscSendTimestamps[len(m.VscSendTimestamps)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + m.List = append(m.List, types3.ValidatorSetChangePacketData{}) + if err := m.List[len(m.List)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -7252,7 +5784,7 @@ func (m *ValidatorByConsumerAddr) Unmarshal(dAtA []byte) error { } return nil } -func (m *ConsumerAddrsToPrune) Unmarshal(dAtA []byte) error { +func (m *ConsumerAddrsToPruneV2) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -7275,10 +5807,10 @@ func (m *ConsumerAddrsToPrune) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: ConsumerAddrsToPrune: wiretype end group for non-group") + return fmt.Errorf("proto: ConsumerAddrsToPruneV2: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: ConsumerAddrsToPrune: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: ConsumerAddrsToPruneV2: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -7314,10 +5846,10 @@ func (m *ConsumerAddrsToPrune) Unmarshal(dAtA []byte) error { m.ChainId = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field VscId", wireType) + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PruneTs", wireType) } - m.VscId = 0 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowProvider @@ -7327,11 +5859,25 @@ func (m *ConsumerAddrsToPrune) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.VscId |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } + if msglen < 0 { + return ErrInvalidLengthProvider + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthProvider + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := github_com_cosmos_gogoproto_types.StdTimeUnmarshal(&m.PruneTs, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex case 3: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field ConsumerAddrs", wireType) diff --git a/x/ccv/provider/types/query.pb.go b/x/ccv/provider/types/query.pb.go index 55c3610bd6..34f334704a 100644 --- a/x/ccv/provider/types/query.pb.go +++ b/x/ccv/provider/types/query.pb.go @@ -1656,94 +1656,6 @@ func (m *QueryValidatorConsumerCommissionRateResponse) XXX_DiscardUnknown() { var xxx_messageInfo_QueryValidatorConsumerCommissionRateResponse proto.InternalMessageInfo -type QueryOldestUnconfirmedVscRequest struct { - ChainId string `protobuf:"bytes,1,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` -} - -func (m *QueryOldestUnconfirmedVscRequest) Reset() { *m = QueryOldestUnconfirmedVscRequest{} } -func (m *QueryOldestUnconfirmedVscRequest) String() string { return proto.CompactTextString(m) } -func (*QueryOldestUnconfirmedVscRequest) ProtoMessage() {} -func (*QueryOldestUnconfirmedVscRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_422512d7b7586cd7, []int{34} -} -func (m *QueryOldestUnconfirmedVscRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryOldestUnconfirmedVscRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryOldestUnconfirmedVscRequest.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 *QueryOldestUnconfirmedVscRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryOldestUnconfirmedVscRequest.Merge(m, src) -} -func (m *QueryOldestUnconfirmedVscRequest) XXX_Size() int { - return m.Size() -} -func (m *QueryOldestUnconfirmedVscRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryOldestUnconfirmedVscRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryOldestUnconfirmedVscRequest proto.InternalMessageInfo - -func (m *QueryOldestUnconfirmedVscRequest) GetChainId() string { - if m != nil { - return m.ChainId - } - return "" -} - -type QueryOldestUnconfirmedVscResponse struct { - VscSendTimestamp VscSendTimestamp `protobuf:"bytes,1,opt,name=vsc_send_timestamp,json=vscSendTimestamp,proto3" json:"vsc_send_timestamp"` -} - -func (m *QueryOldestUnconfirmedVscResponse) Reset() { *m = QueryOldestUnconfirmedVscResponse{} } -func (m *QueryOldestUnconfirmedVscResponse) String() string { return proto.CompactTextString(m) } -func (*QueryOldestUnconfirmedVscResponse) ProtoMessage() {} -func (*QueryOldestUnconfirmedVscResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_422512d7b7586cd7, []int{35} -} -func (m *QueryOldestUnconfirmedVscResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryOldestUnconfirmedVscResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryOldestUnconfirmedVscResponse.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 *QueryOldestUnconfirmedVscResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryOldestUnconfirmedVscResponse.Merge(m, src) -} -func (m *QueryOldestUnconfirmedVscResponse) XXX_Size() int { - return m.Size() -} -func (m *QueryOldestUnconfirmedVscResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryOldestUnconfirmedVscResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryOldestUnconfirmedVscResponse proto.InternalMessageInfo - -func (m *QueryOldestUnconfirmedVscResponse) GetVscSendTimestamp() VscSendTimestamp { - if m != nil { - return m.VscSendTimestamp - } - return VscSendTimestamp{} -} - type QueryBlocksUntilNextEpochRequest struct { } @@ -1751,7 +1663,7 @@ func (m *QueryBlocksUntilNextEpochRequest) Reset() { *m = QueryBlocksUnt func (m *QueryBlocksUntilNextEpochRequest) String() string { return proto.CompactTextString(m) } func (*QueryBlocksUntilNextEpochRequest) ProtoMessage() {} func (*QueryBlocksUntilNextEpochRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_422512d7b7586cd7, []int{36} + return fileDescriptor_422512d7b7586cd7, []int{34} } func (m *QueryBlocksUntilNextEpochRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1789,7 +1701,7 @@ func (m *QueryBlocksUntilNextEpochResponse) Reset() { *m = QueryBlocksUn func (m *QueryBlocksUntilNextEpochResponse) String() string { return proto.CompactTextString(m) } func (*QueryBlocksUntilNextEpochResponse) ProtoMessage() {} func (*QueryBlocksUntilNextEpochResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_422512d7b7586cd7, []int{37} + return fileDescriptor_422512d7b7586cd7, []int{35} } func (m *QueryBlocksUntilNextEpochResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1860,8 +1772,6 @@ func init() { proto.RegisterType((*QueryConsumerChainsValidatorHasToValidateResponse)(nil), "interchain_security.ccv.provider.v1.QueryConsumerChainsValidatorHasToValidateResponse") proto.RegisterType((*QueryValidatorConsumerCommissionRateRequest)(nil), "interchain_security.ccv.provider.v1.QueryValidatorConsumerCommissionRateRequest") proto.RegisterType((*QueryValidatorConsumerCommissionRateResponse)(nil), "interchain_security.ccv.provider.v1.QueryValidatorConsumerCommissionRateResponse") - proto.RegisterType((*QueryOldestUnconfirmedVscRequest)(nil), "interchain_security.ccv.provider.v1.QueryOldestUnconfirmedVscRequest") - proto.RegisterType((*QueryOldestUnconfirmedVscResponse)(nil), "interchain_security.ccv.provider.v1.QueryOldestUnconfirmedVscResponse") proto.RegisterType((*QueryBlocksUntilNextEpochRequest)(nil), "interchain_security.ccv.provider.v1.QueryBlocksUntilNextEpochRequest") proto.RegisterType((*QueryBlocksUntilNextEpochResponse)(nil), "interchain_security.ccv.provider.v1.QueryBlocksUntilNextEpochResponse") } @@ -1871,138 +1781,132 @@ func init() { } var fileDescriptor_422512d7b7586cd7 = []byte{ - // 2094 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x5a, 0xcd, 0x6f, 0xdc, 0xc6, - 0x15, 0x17, 0x57, 0x1f, 0x91, 0x46, 0xf1, 0x47, 0xc6, 0x6a, 0x2c, 0x53, 0xca, 0xae, 0x4c, 0xf7, - 0x43, 0x96, 0xdd, 0xa5, 0x24, 0xc3, 0x88, 0x63, 0x57, 0x91, 0xb5, 0x92, 0xec, 0x2c, 0xec, 0xd8, - 0x0a, 0x2d, 0xab, 0x85, 0x5b, 0x94, 0xa6, 0xc8, 0xc9, 0x8a, 0x30, 0x97, 0x43, 0x71, 0x66, 0xd7, - 0x5e, 0x18, 0x39, 0xa4, 0x87, 0x36, 0xa7, 0x22, 0xe8, 0x07, 0xd0, 0x63, 0x2e, 0x05, 0x7a, 0xe9, - 0xa5, 0x87, 0xa2, 0x7f, 0x42, 0x6e, 0x4d, 0x91, 0x4b, 0xd1, 0x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, 0xaa, 0x6b, 0xb6, 0xe1, 0x29, 0x8b, 0x58, 0xc8, 0x4c, 0xaf, 0x8a, 0x65, 0xff, 0x31, - 0x2c, 0x07, 0x8f, 0x61, 0x79, 0x37, 0x78, 0x0c, 0x2b, 0x93, 0x5e, 0x76, 0xfe, 0xf4, 0xcf, 0x25, - 0x41, 0x79, 0xd3, 0x43, 0x51, 0x02, 0x90, 0xcd, 0x00, 0x43, 0xba, 0x0c, 0x96, 0x98, 0x4a, 0x0a, - 0xaa, 0x99, 0x84, 0x22, 0x17, 0x19, 0x51, 0xdc, 0x3f, 0xd5, 0x5c, 0x63, 0x0b, 0xd9, 0xb8, 0x1e, - 0x26, 0x9e, 0x6d, 0x70, 0x29, 0x13, 0x35, 0xb7, 0xc8, 0x9b, 0x60, 0xc2, 0x60, 0x2b, 0x2c, 0x97, - 0x4f, 0x29, 0xfc, 0x4b, 0x2a, 0xf2, 0xd7, 0xc9, 0xcf, 0x29, 0xc8, 0x60, 0x29, 0xa4, 0xba, 0x15, - 0x1e, 0xf3, 0xb1, 0x00, 0xde, 0xea, 0x42, 0xc0, 0x91, 0x1f, 0x83, 0x93, 0x4e, 0x7c, 0x2f, 0x78, - 0x2d, 0x56, 0x33, 0xa5, 0xb6, 0x04, 0x2c, 0x7f, 0xc2, 0xda, 0xf0, 0xa4, 0x2a, 0x38, 0x91, 0x20, - 0x83, 0xb3, 0x80, 0xfb, 0xef, 0x56, 0xd2, 0x9d, 0xb7, 0x60, 0x11, 0x80, 0x20, 0x25, 0x56, 0xb7, - 0xd8, 0x65, 0x8e, 0x29, 0xb1, 0x15, 0xe9, 0x2e, 0x90, 0x99, 0x36, 0x1b, 0x96, 0xb5, 0xa3, 0x99, - 0x2e, 0xd9, 0xd3, 0xac, 0x4d, 0x6c, 0x7b, 0x2e, 0x57, 0x49, 0x66, 0xf0, 0xea, 0x56, 0x86, 0xa7, - 0xfd, 0x97, 0x02, 0x58, 0xce, 0x0e, 0xc7, 0xed, 0x75, 0x08, 0xde, 0x70, 0x34, 0xd3, 0x55, 0x9b, - 0x9a, 0xe5, 0x15, 0x31, 0x2c, 0x0c, 0xb8, 0xc9, 0x6e, 0x65, 0x33, 0x99, 0x66, 0xba, 0xd1, 0x41, - 0x61, 0x98, 0xd9, 0x91, 0x03, 0x9c, 0x74, 0x12, 0x24, 0xd2, 0xbf, 0x05, 0x70, 0xbe, 0x2f, 0x17, - 0xbc, 0xd5, 0x2d, 0x36, 0x2b, 0x73, 0xaf, 0x5e, 0x94, 0xce, 0xfa, 0xa9, 0xa0, 0x9d, 0xa2, 0x33, - 0xdd, 0x79, 0x38, 0x5d, 0x52, 0x4a, 0x0c, 0xa7, 0x9d, 0xa2, 0x33, 0xb7, 0xc0, 0x75, 0xf0, 0x7a, - 0x48, 0xf5, 0x04, 0xb5, 0x78, 0x8c, 0xcd, 0x97, 0xa3, 0x12, 0xae, 0xec, 0x97, 0x70, 0xe5, 0x9d, - 0xc6, 0xbe, 0x65, 0xea, 0x77, 0x50, 0x4b, 0x99, 0x0e, 0x38, 0xee, 0xa0, 0x96, 0x34, 0x03, 0xa0, - 0xef, 0xba, 0x9a, 0xab, 0x45, 0x81, 0xf3, 0x18, 0x9c, 0x49, 0xac, 0xf2, 0x6b, 0xa9, 0x82, 0x09, - 0x87, 0xad, 0xf0, 0x97, 0xf9, 0x52, 0xc6, 0xbb, 0xf0, 0x58, 0xb8, 0xdf, 0x72, 0x00, 0xe9, 0x36, - 0x0f, 0xe4, 0x84, 0x07, 0xdc, 0x77, 0x28, 0x32, 0xaa, 0x76, 0x98, 0x1e, 0xb3, 0x94, 0x8e, 0x87, - 0x3c, 0xc6, 0xfb, 0x01, 0x85, 0xf5, 0xda, 0x5b, 0xf1, 0xf7, 0xb7, 0xed, 0xa6, 0x50, 0x10, 0xfa, - 0x73, 0xb1, 0x87, 0x38, 0x79, 0x75, 0x88, 0x48, 0x37, 0x40, 0x31, 0x71, 0x64, 0x2e, 0x79, 0x7f, - 0x27, 0x80, 0x85, 0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 0x5b, 0x16, 0x3f, 0x38, 0x46, - 0x44, 0x6e, 0xa9, 0xc7, 0xcc, 0x52, 0x8f, 0xe0, 0x77, 0xf2, 0x58, 0x2a, 0x84, 0x52, 0xbd, 0x0e, - 0x38, 0xe6, 0x55, 0x69, 0xf6, 0xfa, 0x8f, 0xc0, 0x47, 0xfc, 0x69, 0x0d, 0x2e, 0xcc, 0x31, 0x59, - 0xe9, 0xd1, 0x60, 0x8b, 0xb7, 0x86, 0x85, 0xc9, 0xff, 0x60, 0x62, 0x86, 0xa3, 0x36, 0x22, 0x20, - 0xb5, 0x49, 0xf4, 0x78, 0x88, 0xfd, 0xb3, 0xbd, 0x01, 0x88, 0xe5, 0x9a, 0xcd, 0x61, 0x26, 0x4a, - 0x81, 0xd6, 0x5b, 0xc3, 0x81, 0x0c, 0xd1, 0xf1, 0xa4, 0xe7, 0x94, 0x7f, 0x04, 0x57, 0x9d, 0x36, - 0x17, 0xc8, 0x73, 0xd5, 0x3d, 0x66, 0x0f, 0x79, 0xae, 0xba, 0xd7, 0x78, 0x22, 0x4f, 0xed, 0xdb, - 0x65, 0x8c, 0x51, 0xf9, 0xf6, 0xe7, 0x47, 0x45, 0xe1, 0x8b, 0xa3, 0xa2, 0xf0, 0x97, 0xa3, 0xa2, - 0xf0, 0xe9, 0xcb, 0xe2, 0xc8, 0x17, 0x2f, 0x8b, 0x23, 0x7f, 0x7c, 0x59, 0x1c, 0x79, 0xb4, 0x56, - 0x33, 0xe9, 0x41, 0x63, 0xbf, 0xac, 0xe3, 0x3a, 0xff, 0x0f, 0x83, 0xd8, 0x29, 0xdf, 0x0c, 0x4f, - 0x69, 0x5e, 0x95, 0x9f, 0xb5, 0xd5, 0xa2, 0x2d, 0x07, 0x91, 0xfd, 0x09, 0xf6, 0xa7, 0xa5, 0x2b, - 0xff, 0x0b, 0x00, 0x00, 0xff, 0xff, 0x26, 0x02, 0x36, 0x87, 0x01, 0x22, 0x00, 0x00, + // 1994 bytes of a gzipped FileDescriptor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85, 0x7a, 0xe1, 0xc9, 0xd5, 0xf0, 0xb0, + 0xdf, 0x8e, 0x98, 0xf6, 0xac, 0x93, 0xb2, 0x7d, 0x08, 0x7f, 0x53, 0x02, 0x5f, 0xcf, 0xc3, 0xc4, + 0xe0, 0xce, 0x08, 0x83, 0x49, 0x26, 0xbb, 0x94, 0x3f, 0x38, 0x42, 0x44, 0x11, 0xa9, 0x47, 0x3c, + 0x52, 0x0f, 0xe1, 0xf7, 0x8a, 0x44, 0x2a, 0x86, 0x32, 0x02, 0xc6, 0x98, 0xc8, 0xaa, 0xac, 0x78, + 0xfd, 0xbb, 0x73, 0x0c, 0x4e, 0x54, 0xdc, 0xe6, 0x28, 0xbf, 0x43, 0x44, 0x51, 0xd9, 0x1a, 0x0d, + 0x64, 0x84, 0xb9, 0x3f, 0xbb, 0xb2, 0xfe, 0x25, 0x89, 0xff, 0x01, 0x64, 0xb1, 0x63, 0x58, 0xe0, + 0xa7, 0x97, 0x3e, 0x0c, 0x5c, 0xbe, 0x31, 0x2a, 0x4c, 0xf1, 0x09, 0xb0, 0x07, 0x99, 0xaf, 0x7e, + 0xf7, 0xb3, 0x17, 0x65, 0xe9, 0xf3, 0x17, 0x65, 0xe9, 0x6f, 0x2f, 0xca, 0xd2, 0x27, 0x2f, 0xcb, + 0x63, 0x9f, 0xbf, 0x2c, 0x8f, 0xfd, 0xf9, 0x65, 0x79, 0xec, 0xe1, 0xb5, 0xba, 0xcd, 0xf6, 0x0f, + 0xf7, 0x54, 0x93, 0x34, 0xc4, 0xff, 0xa5, 0x13, 0xa7, 0x7c, 0x3b, 0x3e, 0xa5, 0x79, 0x49, 0x7b, + 0xda, 0x31, 0x91, 0xb5, 0x3c, 0x4c, 0xf7, 0x26, 0xf9, 0x3f, 0x24, 0x2e, 0xfe, 0x3f, 0x00, 0x00, + 0xff, 0xff, 0xb5, 0x03, 0x23, 0x90, 0x37, 0x20, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -2056,8 +1960,6 @@ type QueryClient interface { // QueryValidatorConsumerCommissionRate returns the commission rate a given // validator charges on a given consumer chain QueryValidatorConsumerCommissionRate(ctx context.Context, in *QueryValidatorConsumerCommissionRateRequest, opts ...grpc.CallOption) (*QueryValidatorConsumerCommissionRateResponse, error) - // QueryOldestUnconfirmedVsc returns the send timestamp of the oldest unconfirmed VSCPacket for a given chainID - QueryOldestUnconfirmedVsc(ctx context.Context, in *QueryOldestUnconfirmedVscRequest, opts ...grpc.CallOption) (*QueryOldestUnconfirmedVscResponse, error) // QueryConsumerValidators returns the latest set consumer-validator set for a given chainID // Note that this does not necessarily mean that the consumer chain is using this validator set at this exact moment // because a VSCPacket could be delayed to be delivered on the consumer chain. @@ -2201,15 +2103,6 @@ func (c *queryClient) QueryValidatorConsumerCommissionRate(ctx context.Context, return out, nil } -func (c *queryClient) QueryOldestUnconfirmedVsc(ctx context.Context, in *QueryOldestUnconfirmedVscRequest, opts ...grpc.CallOption) (*QueryOldestUnconfirmedVscResponse, error) { - out := new(QueryOldestUnconfirmedVscResponse) - err := c.cc.Invoke(ctx, "/interchain_security.ccv.provider.v1.Query/QueryOldestUnconfirmedVsc", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - func (c *queryClient) QueryConsumerValidators(ctx context.Context, in *QueryConsumerValidatorsRequest, opts ...grpc.CallOption) (*QueryConsumerValidatorsResponse, error) { out := new(QueryConsumerValidatorsResponse) err := c.cc.Invoke(ctx, "/interchain_security.ccv.provider.v1.Query/QueryConsumerValidators", in, out, opts...) @@ -2269,8 +2162,6 @@ type QueryServer interface { // QueryValidatorConsumerCommissionRate returns the commission rate a given // validator charges on a given consumer chain QueryValidatorConsumerCommissionRate(context.Context, *QueryValidatorConsumerCommissionRateRequest) (*QueryValidatorConsumerCommissionRateResponse, error) - // QueryOldestUnconfirmedVsc returns the send timestamp of the oldest unconfirmed VSCPacket for a given chainID - QueryOldestUnconfirmedVsc(context.Context, *QueryOldestUnconfirmedVscRequest) (*QueryOldestUnconfirmedVscResponse, error) // QueryConsumerValidators returns the latest set consumer-validator set for a given chainID // Note that this does not necessarily mean that the consumer chain is using this validator set at this exact moment // because a VSCPacket could be delayed to be delivered on the consumer chain. @@ -2326,9 +2217,6 @@ func (*UnimplementedQueryServer) QueryConsumerChainsValidatorHasToValidate(ctx c func (*UnimplementedQueryServer) QueryValidatorConsumerCommissionRate(ctx context.Context, req *QueryValidatorConsumerCommissionRateRequest) (*QueryValidatorConsumerCommissionRateResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method QueryValidatorConsumerCommissionRate not implemented") } -func (*UnimplementedQueryServer) QueryOldestUnconfirmedVsc(ctx context.Context, req *QueryOldestUnconfirmedVscRequest) (*QueryOldestUnconfirmedVscResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method QueryOldestUnconfirmedVsc not implemented") -} func (*UnimplementedQueryServer) QueryConsumerValidators(ctx context.Context, req *QueryConsumerValidatorsRequest) (*QueryConsumerValidatorsResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method QueryConsumerValidators not implemented") } @@ -2592,24 +2480,6 @@ func _Query_QueryValidatorConsumerCommissionRate_Handler(srv interface{}, ctx co return interceptor(ctx, in, info, handler) } -func _Query_QueryOldestUnconfirmedVsc_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryOldestUnconfirmedVscRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).QueryOldestUnconfirmedVsc(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/interchain_security.ccv.provider.v1.Query/QueryOldestUnconfirmedVsc", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).QueryOldestUnconfirmedVsc(ctx, req.(*QueryOldestUnconfirmedVscRequest)) - } - return interceptor(ctx, in, info, handler) -} - func _Query_QueryConsumerValidators_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(QueryConsumerValidatorsRequest) if err := dec(in); err != nil { @@ -2706,10 +2576,6 @@ var _Query_serviceDesc = grpc.ServiceDesc{ MethodName: "QueryValidatorConsumerCommissionRate", Handler: _Query_QueryValidatorConsumerCommissionRate_Handler, }, - { - MethodName: "QueryOldestUnconfirmedVsc", - Handler: _Query_QueryOldestUnconfirmedVsc_Handler, - }, { MethodName: "QueryConsumerValidators", Handler: _Query_QueryConsumerValidators_Handler, @@ -3865,69 +3731,6 @@ func (m *QueryValidatorConsumerCommissionRateResponse) MarshalToSizedBuffer(dAtA return len(dAtA) - i, nil } -func (m *QueryOldestUnconfirmedVscRequest) 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 *QueryOldestUnconfirmedVscRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryOldestUnconfirmedVscRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.ChainId) > 0 { - i -= len(m.ChainId) - copy(dAtA[i:], m.ChainId) - i = encodeVarintQuery(dAtA, i, uint64(len(m.ChainId))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *QueryOldestUnconfirmedVscResponse) 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 *QueryOldestUnconfirmedVscResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryOldestUnconfirmedVscResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.VscSendTimestamp.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - func (m *QueryBlocksUntilNextEpochRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -4474,30 +4277,6 @@ func (m *QueryValidatorConsumerCommissionRateResponse) Size() (n int) { return n } -func (m *QueryOldestUnconfirmedVscRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.ChainId) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryOldestUnconfirmedVscResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.VscSendTimestamp.Size() - n += 1 + l + sovQuery(uint64(l)) - return n -} - func (m *QueryBlocksUntilNextEpochRequest) Size() (n int) { if m == nil { return 0 @@ -7558,171 +7337,6 @@ func (m *QueryValidatorConsumerCommissionRateResponse) Unmarshal(dAtA []byte) er } return nil } -func (m *QueryOldestUnconfirmedVscRequest) 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 ErrIntOverflowQuery - } - 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: QueryOldestUnconfirmedVscRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryOldestUnconfirmedVscRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ChainId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ChainId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryOldestUnconfirmedVscResponse) 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 ErrIntOverflowQuery - } - 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: QueryOldestUnconfirmedVscResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryOldestUnconfirmedVscResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field VscSendTimestamp", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.VscSendTimestamp.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} func (m *QueryBlocksUntilNextEpochRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 diff --git a/x/ccv/provider/types/query.pb.gw.go b/x/ccv/provider/types/query.pb.gw.go index 707242058e..a115ace156 100644 --- a/x/ccv/provider/types/query.pb.gw.go +++ b/x/ccv/provider/types/query.pb.gw.go @@ -505,60 +505,6 @@ func local_request_Query_QueryValidatorConsumerCommissionRate_0(ctx context.Cont } -func request_Query_QueryOldestUnconfirmedVsc_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryOldestUnconfirmedVscRequest - var metadata runtime.ServerMetadata - - var ( - val string - ok bool - err error - _ = err - ) - - val, ok = pathParams["chain_id"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "chain_id") - } - - protoReq.ChainId, err = runtime.String(val) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "chain_id", err) - } - - msg, err := client.QueryOldestUnconfirmedVsc(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_Query_QueryOldestUnconfirmedVsc_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryOldestUnconfirmedVscRequest - var metadata runtime.ServerMetadata - - var ( - val string - ok bool - err error - _ = err - ) - - val, ok = pathParams["chain_id"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "chain_id") - } - - protoReq.ChainId, err = runtime.String(val) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "chain_id", err) - } - - msg, err := server.QueryOldestUnconfirmedVsc(ctx, &protoReq) - return msg, metadata, err - -} - func request_Query_QueryConsumerValidators_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq QueryConsumerValidatorsRequest var metadata runtime.ServerMetadata @@ -959,29 +905,6 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv }) - mux.Handle("GET", pattern_Query_QueryOldestUnconfirmedVsc_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_Query_QueryOldestUnconfirmedVsc_0(rctx, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Query_QueryOldestUnconfirmedVsc_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - mux.Handle("GET", pattern_Query_QueryConsumerValidators_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() @@ -1349,26 +1272,6 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie }) - mux.Handle("GET", pattern_Query_QueryOldestUnconfirmedVsc_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_Query_QueryOldestUnconfirmedVsc_0(rctx, inboundMarshaler, client, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Query_QueryOldestUnconfirmedVsc_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - mux.Handle("GET", pattern_Query_QueryConsumerValidators_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() @@ -1441,8 +1344,6 @@ var ( pattern_Query_QueryValidatorConsumerCommissionRate_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4, 1, 0, 4, 1, 5, 5}, []string{"interchain_security", "ccv", "provider", "consumer_commission_rate", "chain_id", "provider_address"}, "", runtime.AssumeColonVerbOpt(false))) - pattern_Query_QueryOldestUnconfirmedVsc_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"interchain_security", "ccv", "provider", "oldest_unconfirmed_vsc", "chain_id"}, "", runtime.AssumeColonVerbOpt(false))) - pattern_Query_QueryConsumerValidators_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"interchain_security", "ccv", "provider", "consumer_validators", "chain_id"}, "", runtime.AssumeColonVerbOpt(false))) pattern_Query_QueryBlocksUntilNextEpoch_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"interchain_security", "ccv", "provider", "blocks_until_next_epoch"}, "", runtime.AssumeColonVerbOpt(false))) @@ -1477,8 +1378,6 @@ var ( forward_Query_QueryValidatorConsumerCommissionRate_0 = runtime.ForwardResponseMessage - forward_Query_QueryOldestUnconfirmedVsc_0 = runtime.ForwardResponseMessage - forward_Query_QueryConsumerValidators_0 = runtime.ForwardResponseMessage forward_Query_QueryBlocksUntilNextEpoch_0 = runtime.ForwardResponseMessage diff --git a/x/ccv/types/events.go b/x/ccv/types/events.go index 4c597ded56..3c63fd7954 100644 --- a/x/ccv/types/events.go +++ b/x/ccv/types/events.go @@ -15,7 +15,6 @@ const ( EventTypeExecuteConsumerChainSlash = "execute_consumer_chain_slash" EventTypeFeeDistribution = "fee_distribution" EventTypeConsumerSlashRequest = "consumer_slash_request" - EventTypeVSCMatured = "vsc_matured" AttributeKeyAckSuccess = "success" AttributeKeyAck = "acknowledgement"