From c7ab5da54ea366df326654d5cbed74190b4540c6 Mon Sep 17 00:00:00 2001 From: Marius Poke Date: Thu, 7 Nov 2024 15:47:51 +0100 Subject: [PATCH] feat!: remove vscmatured packets (#2372) * deprecate PacketMaturityTimeKey * remove TestPacketMaturityTime * update genesis logic * remove maturity logic * add migration * fix UT * fix integration tests * update proto files * remove genesis transformation * Update testing documentation * Revert "remove genesis transformation" This reverts commit 89b1d05a1c6d0eee92c4db2cccdc6e5d549d4a90. * add changelog entries --------- Co-authored-by: github-actions --- .../2101-introduce-priority-validators.md | 2 + .../features/2372-vscmatured-packets.md | 2 + .../features/2378-allow-chain-id-updates.md | 2 +- .../2101-introduce-priority-validators.md | 2 - .../2101-introduce-priority-validators.md | 2 +- .../state-breaking/2372-vscmatured-packets.md | 2 + .../ccv/consumer/v1/genesis.proto | 30 +- scripts/test_doc/test_documentation.md | 5 +- tests/integration/expired_client.go | 21 +- tests/integration/valset_update.go | 132 ---- x/ccv/consumer/keeper/genesis.go | 6 - x/ccv/consumer/keeper/genesis_test.go | 20 - x/ccv/consumer/keeper/keeper.go | 84 --- x/ccv/consumer/keeper/keeper_test.go | 54 -- x/ccv/consumer/keeper/migrations.go | 9 + x/ccv/consumer/keeper/relay.go | 44 -- x/ccv/consumer/keeper/relay_test.go | 12 - x/ccv/consumer/migrations/v4/migration.go | 27 + x/ccv/consumer/module.go | 6 +- x/ccv/consumer/types/genesis.go | 24 - x/ccv/consumer/types/genesis.pb.go | 574 ++---------------- x/ccv/consumer/types/genesis_test.go | 104 +--- x/ccv/consumer/types/keys.go | 27 +- x/ccv/consumer/types/keys_test.go | 4 +- 24 files changed, 127 insertions(+), 1068 deletions(-) create mode 100644 .changelog/unreleased/features/2101-introduce-priority-validators.md create mode 100644 .changelog/unreleased/features/2372-vscmatured-packets.md delete mode 100644 .changelog/unreleased/features/provider/2101-introduce-priority-validators.md create mode 100644 .changelog/unreleased/state-breaking/2372-vscmatured-packets.md create mode 100644 x/ccv/consumer/migrations/v4/migration.go diff --git a/.changelog/unreleased/features/2101-introduce-priority-validators.md b/.changelog/unreleased/features/2101-introduce-priority-validators.md new file mode 100644 index 0000000000..24b2684433 --- /dev/null +++ b/.changelog/unreleased/features/2101-introduce-priority-validators.md @@ -0,0 +1,2 @@ +- `[x/provider]` Allow consumer chains to specify a list of priority validators that are included in the validator set before other validators are considered + ([\#2101](https://github.com/cosmos/interchain-security/pull/2101)) \ No newline at end of file diff --git a/.changelog/unreleased/features/2372-vscmatured-packets.md b/.changelog/unreleased/features/2372-vscmatured-packets.md new file mode 100644 index 0000000000..cd51735056 --- /dev/null +++ b/.changelog/unreleased/features/2372-vscmatured-packets.md @@ -0,0 +1,2 @@ +- `[x/consumer]` Remove `VSCMaturedPackets`. Consumer-side changes for [ADR 018](https://cosmos.github.io/interchain-security/adrs/adr-018-remove-vscmatured#consumer-changes-r2). + ([\#2372](https://github.com/cosmos/interchain-security/pull/2372)) \ No newline at end of file diff --git a/.changelog/unreleased/features/2378-allow-chain-id-updates.md b/.changelog/unreleased/features/2378-allow-chain-id-updates.md index cab2fdc62b..c12277e63a 100644 --- a/.changelog/unreleased/features/2378-allow-chain-id-updates.md +++ b/.changelog/unreleased/features/2378-allow-chain-id-updates.md @@ -1,2 +1,2 @@ -- Allow the chain id of a consumer chain to be updated before the chain +- `[x/provider]` Allow the chain id of a consumer chain to be updated before the chain launches. ([\#2378](https://github.com/cosmos/interchain-security/pull/2378)) \ No newline at end of file diff --git a/.changelog/unreleased/features/provider/2101-introduce-priority-validators.md b/.changelog/unreleased/features/provider/2101-introduce-priority-validators.md deleted file mode 100644 index a90e0a6e26..0000000000 --- a/.changelog/unreleased/features/provider/2101-introduce-priority-validators.md +++ /dev/null @@ -1,2 +0,0 @@ -- Allow consumer chains to specify a list of priority validators that are included in the validator set before other validators are considered - ([\#2101](https://github.com/cosmos/interchain-security/pull/2101)) \ No newline at end of file diff --git a/.changelog/unreleased/state-breaking/2101-introduce-priority-validators.md b/.changelog/unreleased/state-breaking/2101-introduce-priority-validators.md index a90e0a6e26..24b2684433 100644 --- a/.changelog/unreleased/state-breaking/2101-introduce-priority-validators.md +++ b/.changelog/unreleased/state-breaking/2101-introduce-priority-validators.md @@ -1,2 +1,2 @@ -- Allow consumer chains to specify a list of priority validators that are included in the validator set before other validators are considered +- `[x/provider]` Allow consumer chains to specify a list of priority validators that are included in the validator set before other validators are considered ([\#2101](https://github.com/cosmos/interchain-security/pull/2101)) \ No newline at end of file diff --git a/.changelog/unreleased/state-breaking/2372-vscmatured-packets.md b/.changelog/unreleased/state-breaking/2372-vscmatured-packets.md new file mode 100644 index 0000000000..cd51735056 --- /dev/null +++ b/.changelog/unreleased/state-breaking/2372-vscmatured-packets.md @@ -0,0 +1,2 @@ +- `[x/consumer]` Remove `VSCMaturedPackets`. Consumer-side changes for [ADR 018](https://cosmos.github.io/interchain-security/adrs/adr-018-remove-vscmatured#consumer-changes-r2). + ([\#2372](https://github.com/cosmos/interchain-security/pull/2372)) \ No newline at end of file diff --git a/proto/interchain_security/ccv/consumer/v1/genesis.proto b/proto/interchain_security/ccv/consumer/v1/genesis.proto index 69a765b8e2..499bb44b3a 100644 --- a/proto/interchain_security/ccv/consumer/v1/genesis.proto +++ b/proto/interchain_security/ccv/consumer/v1/genesis.proto @@ -20,6 +20,18 @@ import "tendermint/abci/types.proto"; // Note: this type is only used on consumer side and references shared types with // provider message GenesisState { + // Reserve 5th slot for removed provider_client_state field + reserved 5; + + // Reserve 6th slot for removed provider_consensus_state field + reserved 6; + + // Reserve 7th slot for removed maturing_packets field + reserved 7; + + // Reserve 8th slot for removed initial_val_set field + reserved 8; + // ConsumerParams is a shared type with provider module interchain_security.ccv.v1.ConsumerParams params = 1 [ (gogoproto.nullable) = false ]; @@ -29,15 +41,6 @@ message GenesisState { string provider_channel_id = 3; // true for new chain, false for chain restart. bool new_chain = 4; - // !!! DEPRECATED !!! ProviderClientState is deprecated. Use provider.client_state instead - ibc.lightclients.tendermint.v1.ClientState provider_client_state = 5 [ deprecated = true]; - // !!! DEPRECATED !!! ProviderConsensusState is deprecated. Use provider.consensus_state instead - ibc.lightclients.tendermint.v1.ConsensusState provider_consensus_state = 6 [ deprecated = true]; - // MaturingPackets nil on new chain, filled in on restart. - repeated MaturingVSCPacket maturing_packets = 7 - [ (gogoproto.nullable) = false ]; - // !!! DEPRECATED !!!! InitialValset is deprecated. Use provider.initial_val_set instead - repeated .tendermint.abci.ValidatorUpdate initial_val_set = 8 [ (gogoproto.nullable) = false, deprecated = true ]; // HeightToValsetUpdateId nil on new chain, filled in on restart. repeated HeightToValsetUpdateID height_to_valset_update_id = 9 [ (gogoproto.nullable) = false ]; @@ -73,15 +76,6 @@ message OutstandingDowntime { string validator_consensus_address = 1; } // to the consumer CCV module. message LastTransmissionBlockHeight { int64 height = 1; } -// MaturingVSCPacket represents a vsc packet that is maturing internal to the -// consumer CCV module, where the consumer has not yet relayed a VSCMatured -// packet back to the provider. -message MaturingVSCPacket { - uint64 vscId = 1; - google.protobuf.Timestamp maturity_time = 2 - [ (gogoproto.stdtime) = true, (gogoproto.nullable) = false ]; -} - // ConsumerPacketDataList is a list of consumer packet data packets. // // Note this type is used internally to the consumer CCV module diff --git a/scripts/test_doc/test_documentation.md b/scripts/test_doc/test_documentation.md index 5e8b1eb6b2..016e9cefe6 100644 --- a/scripts/test_doc/test_documentation.md +++ b/scripts/test_doc/test_documentation.md @@ -48,7 +48,7 @@ | Function | Short Description | |----------|-------------------| [TestVSCPacketSendExpiredClient](../../tests/integration/expired_client.go#L29) | TestVSCPacketSendExpiredClient tests queueing of VSCPackets when the consumer client is expired.
Details* Set up a CCV channel and expire the client on consumer chain.
* Bond tokens to provider, send CCV packet to consumer and check pending packets.
* While the consumer client is expired (or inactive for some reason) all packets will be queued.
* The packet sending and checks are then repeated.
* More tokens are bonded on provider to change validator powers.
* Upgrade expired client to the consumer and all packets are cleared once the consumer client is established.
| - [TestConsumerPacketSendExpiredClient](../../tests/integration/expired_client.go#L99) | TestConsumerPacketSendExpiredClient tests the consumer sending packets when the provider client is expired.
Details* Set up a CCV channel and bond tokens on provider.
* Send CCV packet to consumer and rebond tokens on provider.
* Check for pending VSC packets and relay all VSC packets to consumer.
* The provider client is then expired.
* Confirm that while the provider client is expired all packets will be queued and then cleared
once the provider client is upgraded.
| + [TestConsumerPacketSendExpiredClient](../../tests/integration/expired_client.go#L95) | TestConsumerPacketSendExpiredClient tests the consumer sending packets when the provider client is expired.
Details* Set up a CCV channel and bond tokens on provider.
* Send CCV packet to consumer and rebond tokens on provider.
* Check for pending VSC packets and relay all VSC packets to consumer.
* The provider client is then expired.
* Confirm that while the provider client is expired all packets will be queued and then cleared
once the provider client is upgraded.
| # [key_assignment.go](../../tests/integration/key_assignment.go) @@ -135,7 +135,6 @@ | Function | Short Description | |----------|-------------------| - [TestPacketRoundtrip](../../tests/integration/valset_update.go#L23) | TestPacketRoundtrip tests a CCV packet roundtrip when tokens are bonded on the provider.
Details* Set up CCV and transfer channels.
* Bond some tokens on the provider side in order to change validator power.
* Relay a packet from the provider chain to the consumer chain.
* Relays a matured packet from the consumer chain back to the provider chain.
| - [TestQueueAndSendVSCMaturedPackets](../../tests/integration/valset_update.go#L59) | TestQueueAndSendVSCMaturedPackets tests the behavior of EndBlock QueueVSCMaturedPackets call and its integration with SendPackets call.
Details* Set up CCV channel.
* Create and simulate the sending of three VSC packets from the provider chain to the consumer chain at different times.
* Send the first packet and validate its processing.
* Simulate the passage of one hour.
* Send the second packet and validate its processing.
* Simulate the passage of 24 more hours.
* Send the third packet and validate its processing.
* Retrieve all packet maturity times from the consumer, and use this to check the maturity status of the packets sent earlier.
* Advance the time so that the first two packets reach their unbonding period, while the third packet does not.
* Ensure first two packets are unbonded, their maturity times are deleted, and that VSCMatured packets are queued.
* The third packet is still in the store and has not yet been processed for unbonding.
* Checks that the packet commitments for the processed packets are correctly reflected in the consumer chain's state.
| + [TestPacketRoundtrip](../../tests/integration/valset_update.go#L15) | TestPacketRoundtrip tests a CCV packet roundtrip when tokens are bonded on the provider.
Details* Set up CCV and transfer channels.
* Bond some tokens on the provider side in order to change validator power.
* Relay a packet from the provider chain to the consumer chain.
* Relays a matured packet from the consumer chain back to the provider chain.
| diff --git a/tests/integration/expired_client.go b/tests/integration/expired_client.go index 099fdd1613..f07c8cc752 100644 --- a/tests/integration/expired_client.go +++ b/tests/integration/expired_client.go @@ -82,10 +82,6 @@ func (s *CCVTestSuite) TestVSCPacketSendExpiredClient() { s.nextEpoch() // - relay all VSC packet from provider to consumer relayAllCommittedPackets(s, s.providerChain, s.path, ccv.ProviderPortID, s.path.EndpointB.ChannelID, 3) - // - increment time so that the unbonding period ends on the consumer - incrementTimeByUnbondingPeriod(s, Consumer) - // - relay all VSCMatured packet from consumer to provider - relayAllCommittedPackets(s, s.consumerChain, s.path, ccv.ConsumerPortID, s.path.EndpointA.ChannelID, 3) } // TestConsumerPacketSendExpiredClient tests the consumer sending packets when the provider client is expired. @@ -134,10 +130,9 @@ func (s *CCVTestSuite) TestConsumerPacketSendExpiredClient() { consumerUnbondingPeriod := s.consumerApp.GetConsumerKeeper().GetUnbondingPeriod(s.consumerCtx()) incrementTimeWithoutUpdate(s, consumerUnbondingPeriod+time.Hour, Provider) - // check that the packets were added to the list of pending data packets + // check that no packets were added to the list of pending data packets consumerPackets := consumerKeeper.GetPendingPackets(s.consumerCtx()) - s.Require().NotEmpty(consumerPackets) - s.Require().Len(consumerPackets, 2, "unexpected number of pending data packets") + s.Require().Empty(consumerPackets) // try to send slash packet for downtime infraction addr := ed25519.GenPrivKey().PubKey().Address() @@ -151,8 +146,8 @@ func (s *CCVTestSuite) TestConsumerPacketSendExpiredClient() { // check that the packets were added to the list of pending data packets consumerPackets = consumerKeeper.GetPendingPackets(s.consumerCtx()) s.Require().NotEmpty(consumerPackets) - // At this point we expect 4 packets, two vsc matured packets and two trailing slash packets - s.Require().Len(consumerPackets, 4, "unexpected number of pending data packets") + // At this point we expect two trailing slash packets + s.Require().Len(consumerPackets, 2, "unexpected number of pending data packets") // upgrade expired client to the consumer upgradeExpiredClient(s, Provider) @@ -160,12 +155,12 @@ func (s *CCVTestSuite) TestConsumerPacketSendExpiredClient() { // go to next block to trigger SendPendingPackets s.consumerChain.NextBlock() - // Check that the leading vsc matured packets were sent and no longer pending + // Check that both slash packets are still pending consumerPackets = consumerKeeper.GetPendingPackets(s.consumerCtx()) s.Require().Len(consumerPackets, 2, "unexpected number of pending data packets") // relay committed packets from consumer to provider, first slash packet should be committed - relayAllCommittedPackets(s, s.consumerChain, s.path, ccv.ConsumerPortID, s.path.EndpointA.ChannelID, 3) // two vsc matured + one slash + relayAllCommittedPackets(s, s.consumerChain, s.path, ccv.ConsumerPortID, s.path.EndpointA.ChannelID, 1) // one slash // First slash has been acked, now only the second slash packet should remain as pending consumerPackets = consumerKeeper.GetPendingPackets(s.consumerCtx()) @@ -187,10 +182,6 @@ func (s *CCVTestSuite) TestConsumerPacketSendExpiredClient() { s.nextEpoch() // - relay 1 VSC packet from provider to consumer relayAllCommittedPackets(s, s.providerChain, s.path, ccv.ProviderPortID, s.path.EndpointB.ChannelID, 1) - // - increment time so that the unbonding period ends on the provider - incrementTimeByUnbondingPeriod(s, Consumer) - // - relay 1 VSCMatured packet from consumer to provider - relayAllCommittedPackets(s, s.consumerChain, s.path, ccv.ConsumerPortID, s.path.EndpointA.ChannelID, 1) } // expireClient expires the client to the `clientTo` chain diff --git a/tests/integration/valset_update.go b/tests/integration/valset_update.go index 89078bb26e..ac84d9de32 100644 --- a/tests/integration/valset_update.go +++ b/tests/integration/valset_update.go @@ -1,16 +1,8 @@ package integration import ( - "time" - - clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" - "cosmossdk.io/math" - cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" - - abci "github.com/cometbft/cometbft/abci/types" - ccv "github.com/cosmos/interchain-security/v6/x/ccv/types" ) @@ -34,128 +26,4 @@ func (s *CCVTestSuite) TestPacketRoundtrip() { // Relay 1 VSC packet from provider to consumer relayAllCommittedPackets(s, s.providerChain, s.path, ccv.ProviderPortID, s.path.EndpointB.ChannelID, 1) - - // Increment time so that the unbonding period ends on the provider - incrementTimeByUnbondingPeriod(s, Provider) - - // Relay 1 VSCMatured packet from consumer to provider - relayAllCommittedPackets(s, s.consumerChain, s.path, ccv.ConsumerPortID, s.path.EndpointA.ChannelID, 1) -} - -// TestQueueAndSendVSCMaturedPackets tests the behavior of EndBlock QueueVSCMaturedPackets call and its integration with SendPackets call. -// @Long Description@ -// * Set up CCV channel. -// * Create and simulate the sending of three VSC packets from the provider chain to the consumer chain at different times. -// * Send the first packet and validate its processing. -// * Simulate the passage of one hour. -// * Send the second packet and validate its processing. -// * Simulate the passage of 24 more hours. -// * Send the third packet and validate its processing. -// * Retrieve all packet maturity times from the consumer, and use this to check the maturity status of the packets sent earlier. -// * Advance the time so that the first two packets reach their unbonding period, while the third packet does not. -// * Ensure first two packets are unbonded, their maturity times are deleted, and that VSCMatured packets are queued. -// * The third packet is still in the store and has not yet been processed for unbonding. -// * Checks that the packet commitments for the processed packets are correctly reflected in the consumer chain's state. -func (suite *CCVTestSuite) TestQueueAndSendVSCMaturedPackets() { - consumerKeeper := suite.consumerApp.GetConsumerKeeper() - - // setup CCV channel - suite.SetupCCVChannel(suite.path) - - // send 3 packets to consumer chain at different times - pk, err := cryptocodec.FromCmtPubKeyInterface(suite.providerChain.Vals.Validators[0].PubKey) - suite.Require().NoError(err) - pk1, err := cryptocodec.ToCmtProtoPublicKey(pk) - suite.Require().NoError(err) - pk, err = cryptocodec.FromCmtPubKeyInterface(suite.providerChain.Vals.Validators[1].PubKey) - suite.Require().NoError(err) - pk2, err := cryptocodec.ToCmtProtoPublicKey(pk) - suite.Require().NoError(err) - - pd := ccv.NewValidatorSetChangePacketData( - []abci.ValidatorUpdate{ - { - PubKey: pk1, - Power: 30, - }, - { - PubKey: pk2, - Power: 20, - }, - }, - 1, - nil, - ) - - // send first packet - packet := suite.newPacketFromProvider(pd.GetBytes(), 1, suite.path, clienttypes.NewHeight(1, 0), 0) - err = consumerKeeper.OnRecvVSCPacket(suite.consumerChain.GetContext(), packet, pd) - suite.Require().Nil(err, "OnRecvVSCPacket did return non-nil error") - - // increase time - incrementTime(suite, time.Hour) - - // update time and send second packet - pd.ValidatorUpdates[0].Power = 15 - pd.ValsetUpdateId = 2 - packet.Data = pd.GetBytes() - packet.Sequence = 2 - err = consumerKeeper.OnRecvVSCPacket(suite.consumerChain.GetContext(), packet, pd) - suite.Require().Nil(err, "OnRecvVSCPacket did return non-nil error") - - // increase time - incrementTime(suite, 24*time.Hour) - - // update time and send third packet - pd.ValidatorUpdates[1].Power = 40 - pd.ValsetUpdateId = 3 - packet.Data = pd.GetBytes() - packet.Sequence = 3 - err = consumerKeeper.OnRecvVSCPacket(suite.consumerChain.GetContext(), packet, pd) - suite.Require().Nil(err, "OnRecvVSCPacket did return non-nil error") - - packetMaturities := consumerKeeper.GetAllPacketMaturityTimes(suite.consumerChain.GetContext()) - - // increase time such that first two packets are unbonded but third is not. - unbondingPeriod := consumerKeeper.GetUnbondingPeriod(suite.consumerChain.GetContext()) - // increase time - incrementTime(suite, unbondingPeriod-time.Hour) - - // ensure first two packets are unbonded and VSCMatured packets are queued - // unbonded time is deleted - suite.Require().False( - consumerKeeper.PacketMaturityTimeExists( - suite.consumerChain.GetContext(), - packetMaturities[0].VscId, - packetMaturities[0].MaturityTime, - ), - "maturity time not deleted for mature packet 1", - ) - suite.Require().False( - consumerKeeper.PacketMaturityTimeExists( - suite.consumerChain.GetContext(), - packetMaturities[1].VscId, - packetMaturities[1].MaturityTime, - ), - "maturity time not deleted for mature packet 2", - ) - // ensure that third packet did not get unbonded and is still in store - suite.Require().True( - consumerKeeper.PacketMaturityTimeExists( - suite.consumerChain.GetContext(), - packetMaturities[2].VscId, - packetMaturities[2].MaturityTime, - ), - "maturity time for packet 3 is not after current time", - ) - - // check that the packets are committed in state - commitments := suite.consumerApp.GetIBCKeeper().ChannelKeeper.GetAllPacketCommitmentsAtChannel( - suite.consumerChain.GetContext(), - ccv.ConsumerPortID, - suite.path.EndpointA.ChannelID, - ) - suite.Require().Equal(2, len(commitments), "did not find packet commitments") - suite.Require().Equal(uint64(1), commitments[0].Sequence, "did not send VSCMatured packet for VSC packet 1") - suite.Require().Equal(uint64(2), commitments[1].Sequence, "did not send VSCMatured packet for VSC packet 2") } diff --git a/x/ccv/consumer/keeper/genesis.go b/x/ccv/consumer/keeper/genesis.go index e45a5fa892..5e850ba351 100644 --- a/x/ccv/consumer/keeper/genesis.go +++ b/x/ccv/consumer/keeper/genesis.go @@ -73,10 +73,6 @@ func (k Keeper) InitGenesis(ctx sdk.Context, state *types.GenesisState) []abci.V if state.ProviderChannelId != "" { // set provider channel ID k.SetProviderChannel(ctx, state.ProviderChannelId) - // set all unbonding sequences - for _, mp := range state.MaturingPackets { - k.SetPacketMaturityTime(ctx, mp.VscId, mp.MaturityTime) - } // set outstanding downtime slashing requests for _, od := range state.OutstandingDowntimeSlashing { consAddr, err := sdk.ConsAddressFromBech32(od.ValidatorConsensusAddress) @@ -141,7 +137,6 @@ func (k Keeper) ExportGenesis(ctx sdk.Context) (genesis *types.GenesisState) { genesis = types.NewRestartGenesisState( clientID, channelID, - k.GetAllPacketMaturityTimes(ctx), valset, k.GetAllHeightToValsetUpdateIDs(ctx), pendingPacketsDepreciated, @@ -161,7 +156,6 @@ func (k Keeper) ExportGenesis(ctx sdk.Context) (genesis *types.GenesisState) { genesis = types.NewRestartGenesisState( clientID, "", - nil, valset, k.GetAllHeightToValsetUpdateIDs(ctx), pendingPacketsDepreciated, diff --git a/x/ccv/consumer/keeper/genesis_test.go b/x/ccv/consumer/keeper/genesis_test.go index 4ea693273a..677397cf07 100644 --- a/x/ccv/consumer/keeper/genesis_test.go +++ b/x/ccv/consumer/keeper/genesis_test.go @@ -61,12 +61,6 @@ func TestInitGenesis(t *testing.T) { []string{"upgrade", "upgradedIBCState"}, ) - matPackets := []consumertypes.MaturingVSCPacket{ - { - VscId: 1, - MaturityTime: time.Now().UTC(), - }, - } pendingDataPackets := consumertypes.ConsumerPacketDataList{ List: []ccv.ConsumerPacketData{ { @@ -137,7 +131,6 @@ func TestInitGenesis(t *testing.T) { consumertypes.NewRestartGenesisState( provClientID, "", - matPackets, valset, defaultHeightValsetUpdateIDs, pendingDataPackets, @@ -173,7 +166,6 @@ func TestInitGenesis(t *testing.T) { consumertypes.NewRestartGenesisState( provClientID, provChannelID, - matPackets, valset, updatedHeightValsetUpdateIDs, pendingDataPackets, @@ -190,8 +182,6 @@ func TestInitGenesis(t *testing.T) { require.True(t, ok) require.Equal(t, provChannelID, gotChannelID) - require.True(t, ck.PacketMaturityTimeExists(ctx, matPackets[0].VscId, matPackets[0].MaturityTime)) - obtainedPendingPackets := ck.GetPendingPackets(ctx) for idx, expectedPacketData := range pendingDataPackets.List { require.Equal(t, expectedPacketData.Type, obtainedPendingPackets[idx].Type) @@ -239,13 +229,6 @@ func TestExportGenesis(t *testing.T) { vscID := uint64(0) blockHeight := uint64(0) - matPackets := []consumertypes.MaturingVSCPacket{ - { - VscId: 1, - MaturityTime: time.Now().UTC(), - }, - } - // mock a validator set pubKey := ed25519.GenPrivKey().PubKey() tmPK, err := cryptocodec.ToCmtPubKeyInterface(pubKey) @@ -310,7 +293,6 @@ func TestExportGenesis(t *testing.T) { consumertypes.NewRestartGenesisState( provClientID, "", - nil, valset, defaultHeightValsetUpdateIDs, consPackets, @@ -339,14 +321,12 @@ func TestExportGenesis(t *testing.T) { } // populate the required states for an established CCV channel - ck.SetPacketMaturityTime(ctx, matPackets[0].VscId, matPackets[0].MaturityTime) ck.SetOutstandingDowntime(ctx, sdk.ConsAddress(validator.Address.Bytes())) ck.SetLastTransmissionBlockHeight(ctx, ltbh) }, consumertypes.NewRestartGenesisState( provClientID, provChannelID, - matPackets, valset, updatedHeightValsetUpdateIDs, consPackets, diff --git a/x/ccv/consumer/keeper/keeper.go b/x/ccv/consumer/keeper/keeper.go index cd5b2f7255..ecb3f1abd3 100644 --- a/x/ccv/consumer/keeper/keeper.go +++ b/x/ccv/consumer/keeper/keeper.go @@ -4,7 +4,6 @@ import ( "encoding/binary" "fmt" "reflect" - "time" capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" @@ -357,89 +356,6 @@ func (k Keeper) GetLastStandaloneValidators(ctx sdk.Context) ([]stakingtypes.Val return k.GetLastBondedValidators(ctx) } -// GetElapsedPacketMaturityTimes returns a slice of already elapsed PacketMaturityTimes, sorted by maturity times, -// i.e., the slice contains the IDs of the matured VSCPackets. -func (k Keeper) GetElapsedPacketMaturityTimes(ctx sdk.Context) (maturingVSCPackets []types.MaturingVSCPacket) { - store := ctx.KVStore(k.storeKey) - iterator := storetypes.KVStorePrefixIterator(store, types.PacketMaturityTimeKeyPrefix()) - - defer iterator.Close() - - for ; iterator.Valid(); iterator.Next() { - var maturingVSCPacket types.MaturingVSCPacket - if err := maturingVSCPacket.Unmarshal(iterator.Value()); err != nil { - // An error here would indicate something is very wrong, - // the MaturingVSCPackets are assumed to be correctly serialized in SetPacketMaturityTime. - panic(fmt.Errorf("failed to unmarshal MaturingVSCPacket: %w", err)) - } - - // If the current block time is before maturity time then stop the iteration. - // This is possible since the iteration over PacketMaturityTimes is in order - // of maturity times - if ctx.BlockTime().Before(maturingVSCPacket.MaturityTime) { - break - } - - maturingVSCPackets = append(maturingVSCPackets, maturingVSCPacket) - } - return maturingVSCPackets -} - -// GetAllPacketMaturityTimes returns a slice of all PacketMaturityTimes, sorted by maturity times. -// -// Note that PacketMaturityTimes are stored under keys with the following format: -// PacketMaturityTimeKeyPrefix | maturityTime.UnixNano() | vscID -// Thus, the returned array is in ascending order of maturityTimes. -// If two entries have the same maturityTime, then they are ordered by vscID. -func (k Keeper) GetAllPacketMaturityTimes(ctx sdk.Context) (maturingVSCPackets []types.MaturingVSCPacket) { - store := ctx.KVStore(k.storeKey) - iterator := storetypes.KVStorePrefixIterator(store, types.PacketMaturityTimeKeyPrefix()) - - defer iterator.Close() - for ; iterator.Valid(); iterator.Next() { - var maturingVSCPacket types.MaturingVSCPacket - if err := maturingVSCPacket.Unmarshal(iterator.Value()); err != nil { - // An error here would indicate something is very wrong, - // the MaturingVSCPackets are assumed to be correctly serialized in SetPacketMaturityTime. - panic(fmt.Errorf("failed to unmarshal MaturingVSCPacket: %w", err)) - } - - maturingVSCPackets = append(maturingVSCPackets, maturingVSCPacket) - } - return maturingVSCPackets -} - -// SetPacketMaturityTime sets the maturity time for a given received VSC packet id -func (k Keeper) SetPacketMaturityTime(ctx sdk.Context, vscId uint64, maturityTime time.Time) { - store := ctx.KVStore(k.storeKey) - maturingVSCPacket := types.MaturingVSCPacket{ - VscId: vscId, - MaturityTime: maturityTime, - } - bz, err := maturingVSCPacket.Marshal() - if err != nil { - // An error here would indicate something is very wrong, - // maturingVSCPacket is instantiated in this method and should be able to be marshaled. - panic(fmt.Errorf("failed to marshal MaturingVSCPacket: %w", err)) - } - store.Set(types.PacketMaturityTimeKey(vscId, maturityTime), bz) -} - -// PacketMaturityExists checks whether the packet maturity time for a given vscId and maturityTime exists. -// -// Note: this method is only used in testing. -func (k Keeper) PacketMaturityTimeExists(ctx sdk.Context, vscId uint64, maturityTime time.Time) bool { - store := ctx.KVStore(k.storeKey) - bz := store.Get(types.PacketMaturityTimeKey(vscId, maturityTime)) - return bz != nil -} - -// DeletePacketMaturityTimes deletes the packet maturity time for a given vscId and maturityTime -func (k Keeper) DeletePacketMaturityTimes(ctx sdk.Context, vscId uint64, maturityTime time.Time) { - store := ctx.KVStore(k.storeKey) - store.Delete(types.PacketMaturityTimeKey(vscId, maturityTime)) -} - // VerifyProviderChain verifies that the chain trying to connect on the channel handshake // is the expected provider chain. func (k Keeper) VerifyProviderChain(ctx sdk.Context, connectionHops []string) error { diff --git a/x/ccv/consumer/keeper/keeper_test.go b/x/ccv/consumer/keeper/keeper_test.go index 89515033b5..28be9e0d5e 100644 --- a/x/ccv/consumer/keeper/keeper_test.go +++ b/x/ccv/consumer/keeper/keeper_test.go @@ -4,7 +4,6 @@ import ( "bytes" "sort" "testing" - "time" conntypes "github.com/cosmos/ibc-go/v8/modules/core/03-connection/types" "github.com/golang/mock/gomock" @@ -198,59 +197,6 @@ func TestGetLastSovereignValidators(t *testing.T) { lastSovVals[0].Description.Moniker) } -// TestPacketMaturityTime tests getter, setter, and iterator functionality for the packet maturity time of a received VSC packet -func TestPacketMaturityTime(t *testing.T) { - ck, ctx, ctrl, _ := testkeeper.GetConsumerKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) - defer ctrl.Finish() - - now := time.Now().UTC() - packets := []types.MaturingVSCPacket{ - { - VscId: 2, - MaturityTime: now, - }, - { - VscId: 1, - MaturityTime: now.Add(-time.Hour), - }, - { - VscId: 5, - MaturityTime: now.Add(-2 * time.Hour), - }, - { - VscId: 6, - MaturityTime: now.Add(time.Hour), - }, - } - // sort by MaturityTime and not by VscId - expectedGetAllOrder := []types.MaturingVSCPacket{packets[2], packets[1], packets[0], packets[3]} - // only packets with MaturityTime before or equal to now - expectedGetElapsedOrder := []types.MaturingVSCPacket{packets[2], packets[1], packets[0]} - - // test SetPacketMaturityTime - for _, packet := range packets { - ck.SetPacketMaturityTime(ctx, packet.VscId, packet.MaturityTime) - } - - // test PacketMaturityTimeExists - for _, packet := range packets { - require.True(t, ck.PacketMaturityTimeExists(ctx, packet.VscId, packet.MaturityTime)) - } - - // test GetAllPacketMaturityTimes - maturingVSCPackets := ck.GetAllPacketMaturityTimes(ctx) - require.Len(t, maturingVSCPackets, len(packets)) - require.Equal(t, expectedGetAllOrder, maturingVSCPackets) - - // test GetElapsedPacketMaturityTimes - elapsedMaturingVSCPackets := ck.GetElapsedPacketMaturityTimes(ctx.WithBlockTime(now)) - require.Equal(t, expectedGetElapsedOrder, elapsedMaturingVSCPackets) - - // test DeletePacketMaturityTimes - ck.DeletePacketMaturityTimes(ctx, packets[0].VscId, packets[0].MaturityTime) - require.False(t, ck.PacketMaturityTimeExists(ctx, packets[0].VscId, packets[0].MaturityTime)) -} - // TestCrossChainValidator tests the getter, setter, and deletion method for cross chain validator records func TestCrossChainValidator(t *testing.T) { keeperParams := testkeeper.NewInMemKeeperParams(t) diff --git a/x/ccv/consumer/keeper/migrations.go b/x/ccv/consumer/keeper/migrations.go index ab3b45ffca..7bc776ea00 100644 --- a/x/ccv/consumer/keeper/migrations.go +++ b/x/ccv/consumer/keeper/migrations.go @@ -6,6 +6,7 @@ import ( v2 "github.com/cosmos/interchain-security/v6/x/ccv/consumer/migrations/v2" v3 "github.com/cosmos/interchain-security/v6/x/ccv/consumer/migrations/v3" + v4 "github.com/cosmos/interchain-security/v6/x/ccv/consumer/migrations/v4" ) // Migrator is a struct for handling in-place store migrations. @@ -32,3 +33,11 @@ func (m Migrator) Migrate2to3(ctx sdk.Context) error { cdc := m.keeper.cdc return v3.MigrateLegacyParams(ctx, cdc, store, m.paramSpace) } + +// Migrate3to4 migrates x/ccvconsumer from consensus version 3 to 4. +func (m Migrator) Migrate3to4(ctx sdk.Context) error { + store := ctx.KVStore(m.keeper.storeKey) + v4.CleanupState(store) + + return nil +} diff --git a/x/ccv/consumer/keeper/relay.go b/x/ccv/consumer/keeper/relay.go index bcccb57e34..d32ac8f039 100644 --- a/x/ccv/consumer/keeper/relay.go +++ b/x/ccv/consumer/keeper/relay.go @@ -67,15 +67,6 @@ func (k Keeper) OnRecvVSCPacket(ctx sdk.Context, packet channeltypes.Packet, new ValidatorUpdates: pendingChanges, }) - // Save maturity time and packet - maturityTime := ctx.BlockTime().Add(k.GetUnbondingPeriod(ctx)) - k.SetPacketMaturityTime(ctx, newChanges.ValsetUpdateId, maturityTime) - k.Logger(ctx).Debug("packet maturity time was set", - "vscID", newChanges.ValsetUpdateId, - "maturity time (utc)", maturityTime.UTC(), - "maturity time (nano)", uint64(maturityTime.UnixNano()), - ) - // set height to VSC id mapping blockHeight := uint64(ctx.BlockHeight()) + 1 k.SetHeightValsetUpdateID(ctx, blockHeight, newChanges.ValsetUpdateId) @@ -106,41 +97,6 @@ func (k Keeper) OnRecvVSCPacket(ctx sdk.Context, packet channeltypes.Packet, new return nil } -// QueueVSCMaturedPackets appends matured VSCs to an internal queue. -// -// Note: Per spec, a VSC reaching maturity on a consumer chain means that all the unbonding -// operations that resulted in validator updates included in that VSC have matured on -// the consumer chain. -func (k Keeper) QueueVSCMaturedPackets(ctx sdk.Context) { - for _, maturityTime := range k.GetElapsedPacketMaturityTimes(ctx) { - // construct validator set change packet data - vscPacket := ccv.NewVSCMaturedPacketData(maturityTime.VscId) - - // Append VSCMatured packet to pending packets. - // Sending packets is attempted each EndBlock. - // Unsent packets remain in the queue until sent. - k.AppendPendingPacket(ctx, - ccv.VscMaturedPacket, - &ccv.ConsumerPacketData_VscMaturedPacketData{VscMaturedPacketData: vscPacket}, - ) - - k.DeletePacketMaturityTimes(ctx, maturityTime.VscId, maturityTime.MaturityTime) - - k.Logger(ctx).Info("VSCMaturedPacket enqueued", "vscID", vscPacket.ValsetUpdateId) - - ctx.EventManager().EmitEvent( - sdk.NewEvent( - types.EventTypeVSCMatured, - sdk.NewAttribute(sdk.AttributeKeyModule, types.ModuleName), - sdk.NewAttribute(ccv.AttributeChainID, ctx.ChainID()), - sdk.NewAttribute(types.AttributeConsumerHeight, strconv.Itoa(int(ctx.BlockHeight()))), - sdk.NewAttribute(ccv.AttributeValSetUpdateID, strconv.Itoa(int(maturityTime.VscId))), - sdk.NewAttribute(types.AttributeTimestamp, ctx.BlockTime().String()), - ), - ) - } -} - // QueueSlashPacket appends a slash packet containing the given validator data and slashing info to queue. func (k Keeper) QueueSlashPacket(ctx sdk.Context, validator abci.Validator, valsetUpdateID uint64, infraction stakingtypes.Infraction) { consAddr := sdk.ConsAddress(validator.Address) diff --git a/x/ccv/consumer/keeper/relay_test.go b/x/ccv/consumer/keeper/relay_test.go index f21fa9fd25..1db62c9b5d 100644 --- a/x/ccv/consumer/keeper/relay_test.go +++ b/x/ccv/consumer/keeper/relay_test.go @@ -150,11 +150,6 @@ func TestOnRecvVSCPacket(t *testing.T) { // Set channel to provider, still in context of consumer chain consumerKeeper.SetProviderChannel(ctx, consumerCCVChannelID) - // Set module params with custom unbonding period - moduleParams := types.DefaultParams() - moduleParams.UnbondingPeriod = 100 * time.Hour - consumerKeeper.SetParams(ctx, moduleParams) - for _, tc := range testCases { var newChanges types.ValidatorSetChangePacketData err := types.ModuleCdc.UnmarshalJSON(tc.packet.GetData(), &newChanges) @@ -182,13 +177,6 @@ func TestOnRecvVSCPacket(t *testing.T) { return tc.expectedPendingChanges.ValidatorUpdates[i].PubKey.Compare(tc.expectedPendingChanges.ValidatorUpdates[j].PubKey) == -1 }) require.Equal(t, tc.expectedPendingChanges, *actualPendingChanges, "pending changes not equal to expected changes after successful packet receive. case: %s", tc.name) - - expectedTime := ctx.BlockTime().Add(consumerKeeper.GetUnbondingPeriod(ctx)) - require.True( - t, - consumerKeeper.PacketMaturityTimeExists(ctx, newChanges.ValsetUpdateId, expectedTime), - "no packet maturity time for case: %s", tc.name, - ) } } diff --git a/x/ccv/consumer/migrations/v4/migration.go b/x/ccv/consumer/migrations/v4/migration.go new file mode 100644 index 0000000000..3a65343a7e --- /dev/null +++ b/x/ccv/consumer/migrations/v4/migration.go @@ -0,0 +1,27 @@ +package v4 + +import ( + storetypes "cosmossdk.io/store/types" +) + +const ( + LegacyPacketMaturityTimeKeyName = byte(12) +) + +// CleanupState removes deprecated state +func CleanupState(store storetypes.KVStore) { + removePrefix(store, LegacyPacketMaturityTimeKeyName) +} + +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/consumer/module.go b/x/ccv/consumer/module.go index 31e12ef380..452acdd652 100644 --- a/x/ccv/consumer/module.go +++ b/x/ccv/consumer/module.go @@ -150,7 +150,7 @@ func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.Raw // ConsensusVersion implements AppModule/ConsensusVersion. func (AppModule) ConsensusVersion() uint64 { - return 3 + return 4 } // BeginBlock implements the AppModule interface @@ -197,10 +197,6 @@ func (am AppModule) EndBlock(goCtx context.Context) ([]abci.ValidatorUpdate, err // Execute EndBlock logic for the Reward Distribution sub-protocol am.keeper.EndBlockRD(ctx) - // NOTE: Slash packets are queued in BeginBlock via the Slash function - // Packet ordering is managed by the PendingPackets queue. - am.keeper.QueueVSCMaturedPackets(ctx) - // panics on invalid packets and unexpected send errors am.keeper.SendPackets(ctx) diff --git a/x/ccv/consumer/types/genesis.go b/x/ccv/consumer/types/genesis.go index 2a18846f6a..2d5ae3a848 100644 --- a/x/ccv/consumer/types/genesis.go +++ b/x/ccv/consumer/types/genesis.go @@ -13,7 +13,6 @@ import ( // NewRestartGenesisState returns a consumer GenesisState that has already been established. func NewRestartGenesisState( clientID, channelID string, - maturingPackets []MaturingVSCPacket, initValSet []abci.ValidatorUpdate, heightToValsetUpdateIDs []HeightToValsetUpdateID, pendingConsumerPackets ConsumerPacketDataList, @@ -27,7 +26,6 @@ func NewRestartGenesisState( Provider: ccv.ProviderInfo{ InitialValSet: initValSet, }, - MaturingPackets: maturingPackets, HeightToValsetUpdateId: heightToValsetUpdateIDs, PendingConsumerPackets: pendingConsumerPackets, OutstandingDowntimeSlashing: outstandingDowntimes, @@ -107,9 +105,6 @@ func (gs GenesisState) Validate() error { if gs.ProviderChannelId != "" { return errorsmod.Wrap(ccv.ErrInvalidGenesis, "provider channel id cannot be set for new chain. It must be established on handshake") } - if len(gs.MaturingPackets) != 0 { - return errorsmod.Wrap(ccv.ErrInvalidGenesis, "maturing packets must be empty for new chain") - } if len(gs.PendingConsumerPackets.List) != 0 { return errorsmod.Wrap(ccv.ErrInvalidGenesis, "pending consumer packets must be empty for new chain") } @@ -124,10 +119,6 @@ func (gs GenesisState) Validate() error { // handshake is still in progress handshakeInProgress := gs.ProviderChannelId == "" if handshakeInProgress { - if len(gs.MaturingPackets) != 0 { - return errorsmod.Wrap( - ccv.ErrInvalidGenesis, "maturing packets must be empty when handshake isn't completed") - } if len(gs.OutstandingDowntimeSlashing) != 0 { return errorsmod.Wrap( ccv.ErrInvalidGenesis, "outstanding downtime must be empty when handshake isn't completed") @@ -153,21 +144,6 @@ func (gs GenesisState) Validate() error { if gs.Provider.ClientState != nil || gs.Provider.ConsensusState != nil { return errorsmod.Wrap(ccv.ErrInvalidGenesis, "provider client state and consensus state must be nil for a restarting genesis state") } - for _, mat := range gs.MaturingPackets { - if err := mat.Validate(); err != nil { - return errorsmod.Wrap(err, "invalid unbonding sequences") - } - } - } - return nil -} - -func (mat MaturingVSCPacket) Validate() error { - if mat.MaturityTime.IsZero() { - return errorsmod.Wrap(ccv.ErrInvalidVSCMaturedTime, "cannot have 0 maturity time") - } - if mat.VscId == 0 { - return errorsmod.Wrap(ccv.ErrInvalidVSCMaturedId, "cannot have 0 maturity time") } return nil } diff --git a/x/ccv/consumer/types/genesis.pb.go b/x/ccv/consumer/types/genesis.pb.go index 34eeb43cfa..33350f3e2c 100644 --- a/x/ccv/consumer/types/genesis.pb.go +++ b/x/ccv/consumer/types/genesis.pb.go @@ -5,24 +5,21 @@ package types import ( fmt "fmt" - types1 "github.com/cometbft/cometbft/abci/types" + _ "github.com/cometbft/cometbft/abci/types" _ "github.com/cosmos/gogoproto/gogoproto" proto "github.com/cosmos/gogoproto/proto" - github_com_cosmos_gogoproto_types "github.com/cosmos/gogoproto/types" - _07_tendermint "github.com/cosmos/ibc-go/v8/modules/light-clients/07-tendermint" + _ "github.com/cosmos/ibc-go/v8/modules/light-clients/07-tendermint" types "github.com/cosmos/interchain-security/v6/x/ccv/types" _ "google.golang.org/protobuf/types/known/timestamppb" io "io" math "math" math_bits "math/bits" - time "time" ) // Reference imports to suppress errors if they are not otherwise used. var _ = proto.Marshal var _ = fmt.Errorf var _ = math.Inf -var _ = time.Kitchen // This is a compile-time assertion to ensure that this generated file // is compatible with the proto package it is being compiled against. @@ -43,14 +40,6 @@ type GenesisState struct { ProviderChannelId string `protobuf:"bytes,3,opt,name=provider_channel_id,json=providerChannelId,proto3" json:"provider_channel_id,omitempty"` // true for new chain, false for chain restart. NewChain bool `protobuf:"varint,4,opt,name=new_chain,json=newChain,proto3" json:"new_chain,omitempty"` - // !!! DEPRECATED !!! ProviderClientState is deprecated. Use provider.client_state instead - ProviderClientState *_07_tendermint.ClientState `protobuf:"bytes,5,opt,name=provider_client_state,json=providerClientState,proto3" json:"provider_client_state,omitempty"` // Deprecated: Do not use. - // !!! DEPRECATED !!! ProviderConsensusState is deprecated. Use provider.consensus_state instead - ProviderConsensusState *_07_tendermint.ConsensusState `protobuf:"bytes,6,opt,name=provider_consensus_state,json=providerConsensusState,proto3" json:"provider_consensus_state,omitempty"` // Deprecated: Do not use. - // MaturingPackets nil on new chain, filled in on restart. - MaturingPackets []MaturingVSCPacket `protobuf:"bytes,7,rep,name=maturing_packets,json=maturingPackets,proto3" json:"maturing_packets"` - // !!! DEPRECATED !!!! InitialValset is deprecated. Use provider.initial_val_set instead - InitialValSet []types1.ValidatorUpdate `protobuf:"bytes,8,rep,name=initial_val_set,json=initialValSet,proto3" json:"initial_val_set"` // Deprecated: Do not use. // HeightToValsetUpdateId nil on new chain, filled in on restart. HeightToValsetUpdateId []HeightToValsetUpdateID `protobuf:"bytes,9,rep,name=height_to_valset_update_id,json=heightToValsetUpdateId,proto3" json:"height_to_valset_update_id"` // OutstandingDowntimes nil on new chain, filled in on restart. @@ -125,37 +114,6 @@ func (m *GenesisState) GetNewChain() bool { return false } -// Deprecated: Do not use. -func (m *GenesisState) GetProviderClientState() *_07_tendermint.ClientState { - if m != nil { - return m.ProviderClientState - } - return nil -} - -// Deprecated: Do not use. -func (m *GenesisState) GetProviderConsensusState() *_07_tendermint.ConsensusState { - if m != nil { - return m.ProviderConsensusState - } - return nil -} - -func (m *GenesisState) GetMaturingPackets() []MaturingVSCPacket { - if m != nil { - return m.MaturingPackets - } - return nil -} - -// Deprecated: Do not use. -func (m *GenesisState) GetInitialValSet() []types1.ValidatorUpdate { - if m != nil { - return m.InitialValSet - } - return nil -} - func (m *GenesisState) GetHeightToValsetUpdateId() []HeightToValsetUpdateID { if m != nil { return m.HeightToValsetUpdateId @@ -346,61 +304,6 @@ func (m *LastTransmissionBlockHeight) GetHeight() int64 { return 0 } -// MaturingVSCPacket represents a vsc packet that is maturing internal to the -// consumer CCV module, where the consumer has not yet relayed a VSCMatured -// packet back to the provider. -type MaturingVSCPacket struct { - VscId uint64 `protobuf:"varint,1,opt,name=vscId,proto3" json:"vscId,omitempty"` - MaturityTime time.Time `protobuf:"bytes,2,opt,name=maturity_time,json=maturityTime,proto3,stdtime" json:"maturity_time"` -} - -func (m *MaturingVSCPacket) Reset() { *m = MaturingVSCPacket{} } -func (m *MaturingVSCPacket) String() string { return proto.CompactTextString(m) } -func (*MaturingVSCPacket) ProtoMessage() {} -func (*MaturingVSCPacket) Descriptor() ([]byte, []int) { - return fileDescriptor_2db73a6057a27482, []int{4} -} -func (m *MaturingVSCPacket) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MaturingVSCPacket) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MaturingVSCPacket.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 *MaturingVSCPacket) XXX_Merge(src proto.Message) { - xxx_messageInfo_MaturingVSCPacket.Merge(m, src) -} -func (m *MaturingVSCPacket) XXX_Size() int { - return m.Size() -} -func (m *MaturingVSCPacket) XXX_DiscardUnknown() { - xxx_messageInfo_MaturingVSCPacket.DiscardUnknown(m) -} - -var xxx_messageInfo_MaturingVSCPacket proto.InternalMessageInfo - -func (m *MaturingVSCPacket) GetVscId() uint64 { - if m != nil { - return m.VscId - } - return 0 -} - -func (m *MaturingVSCPacket) GetMaturityTime() time.Time { - if m != nil { - return m.MaturityTime - } - return time.Time{} -} - // ConsumerPacketDataList is a list of consumer packet data packets. // // Note this type is used internally to the consumer CCV module @@ -413,7 +316,7 @@ func (m *ConsumerPacketDataList) Reset() { *m = ConsumerPacketDataList{} func (m *ConsumerPacketDataList) String() string { return proto.CompactTextString(m) } func (*ConsumerPacketDataList) ProtoMessage() {} func (*ConsumerPacketDataList) Descriptor() ([]byte, []int) { - return fileDescriptor_2db73a6057a27482, []int{5} + return fileDescriptor_2db73a6057a27482, []int{4} } func (m *ConsumerPacketDataList) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -454,7 +357,6 @@ func init() { proto.RegisterType((*HeightToValsetUpdateID)(nil), "interchain_security.ccv.consumer.v1.HeightToValsetUpdateID") proto.RegisterType((*OutstandingDowntime)(nil), "interchain_security.ccv.consumer.v1.OutstandingDowntime") proto.RegisterType((*LastTransmissionBlockHeight)(nil), "interchain_security.ccv.consumer.v1.LastTransmissionBlockHeight") - proto.RegisterType((*MaturingVSCPacket)(nil), "interchain_security.ccv.consumer.v1.MaturingVSCPacket") proto.RegisterType((*ConsumerPacketDataList)(nil), "interchain_security.ccv.consumer.v1.ConsumerPacketDataList") } @@ -463,64 +365,54 @@ func init() { } var fileDescriptor_2db73a6057a27482 = []byte{ - // 912 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x56, 0xcf, 0x6f, 0x23, 0x35, - 0x14, 0xee, 0xb4, 0xdd, 0x90, 0xb8, 0xed, 0x6e, 0xd7, 0x5d, 0xa2, 0xa1, 0x11, 0x69, 0x14, 0x84, - 0x14, 0xf1, 0xc3, 0x43, 0x8a, 0x58, 0x21, 0x21, 0x10, 0x24, 0x95, 0x68, 0x50, 0x11, 0x55, 0xda, - 0x0d, 0xd2, 0x5e, 0x46, 0x8e, 0xc7, 0x3b, 0xb1, 0x76, 0xc6, 0x1e, 0x8d, 0x9d, 0x09, 0x15, 0xe2, - 0xc2, 0x95, 0xcb, 0xfe, 0x59, 0x7b, 0xdc, 0x03, 0x07, 0x4e, 0x80, 0xda, 0x7f, 0x04, 0xd9, 0xe3, - 0x99, 0x24, 0x34, 0xed, 0xe6, 0x16, 0xcf, 0x7b, 0xef, 0xfb, 0xde, 0xfb, 0xde, 0x7b, 0x76, 0x40, - 0x97, 0x71, 0x45, 0x53, 0x32, 0xc1, 0x8c, 0xfb, 0x92, 0x92, 0x69, 0xca, 0xd4, 0x95, 0x47, 0x48, - 0xe6, 0x11, 0xc1, 0xe5, 0x34, 0xa6, 0xa9, 0x97, 0x75, 0xbd, 0x90, 0x72, 0x2a, 0x99, 0x44, 0x49, - 0x2a, 0x94, 0x80, 0x1f, 0xac, 0x08, 0x41, 0x84, 0x64, 0xa8, 0x08, 0x41, 0x59, 0xf7, 0xf0, 0xb3, - 0xbb, 0x70, 0xb3, 0xae, 0x27, 0x27, 0x38, 0xa5, 0x81, 0x5f, 0xba, 0x1b, 0xd8, 0x43, 0x8f, 0x8d, - 0x89, 0x17, 0xb1, 0x70, 0xa2, 0x48, 0xc4, 0x28, 0x57, 0xd2, 0x53, 0x94, 0x07, 0x34, 0x8d, 0x19, - 0x57, 0x3a, 0x6a, 0x7e, 0xb2, 0x01, 0x4f, 0x42, 0x11, 0x0a, 0xf3, 0xd3, 0xd3, 0xbf, 0xec, 0xd7, - 0x0f, 0xef, 0x21, 0x9e, 0xb1, 0x94, 0x5a, 0xb7, 0xa3, 0x50, 0x88, 0x30, 0xa2, 0x9e, 0x39, 0x8d, - 0xa7, 0x2f, 0x3c, 0xc5, 0x62, 0x2a, 0x15, 0x8e, 0x13, 0xeb, 0xd0, 0x58, 0x60, 0xc7, 0x63, 0xc2, - 0x3c, 0x75, 0x95, 0x50, 0x2b, 0x41, 0xfb, 0xcf, 0x1a, 0xd8, 0xfd, 0x3e, 0x17, 0xe5, 0x42, 0x61, - 0x45, 0xe1,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xed, 0x1c, 0x1f, 0xa2, 0xfc, 0x05, 0x41, 0xc5, 0x0b, 0x82, 0x2e, 0x8b, 0x17, 0xa4, - 0x57, 0xd5, 0xba, 0xbe, 0xfa, 0xe7, 0xc8, 0x19, 0xee, 0x16, 0xa1, 0xda, 0xd8, 0x1e, 0x83, 0xfa, - 0xea, 0x49, 0x84, 0xa7, 0x60, 0x3b, 0x62, 0x52, 0x67, 0xb9, 0x95, 0xdf, 0x80, 0xeb, 0xbc, 0x1e, - 0x05, 0x82, 0xed, 0xa3, 0x41, 0xe8, 0xfd, 0xfc, 0xfa, 0xba, 0xe9, 0xbc, 0xb9, 0x6e, 0x3a, 0xff, - 0x5e, 0x37, 0x9d, 0x57, 0x37, 0xcd, 0x8d, 0x37, 0x37, 0xcd, 0x8d, 0xbf, 0x6e, 0x9a, 0x1b, 0xcf, - 0xbf, 0x0e, 0x99, 0x9a, 0x4c, 0xc7, 0x88, 0x88, 0xd8, 0x23, 0x42, 0xc6, 0x42, 0x7a, 0x73, 0x9a, - 0x4f, 0xcb, 0xb7, 0x32, 0x7b, 0xea, 0xfd, 0xb2, 0xfc, 0x0f, 0xc0, 0xbc, 0x7c, 0xe3, 0x8a, 0x29, - 0xf4, 0xf3, 0xff, 0x02, 0x00, 0x00, 0xff, 0xff, 0xe1, 0x67, 0x80, 0x40, 0x32, 0x08, 0x00, 0x00, + // 741 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x55, 0x4d, 0x6b, 0xdb, 0x4a, + 0x14, 0xb5, 0x12, 0x3d, 0x47, 0x9e, 0xe4, 0x05, 0x3f, 0xe5, 0x61, 0xf4, 0x62, 0x9e, 0x63, 0x5c, + 0x0a, 0xa6, 0xb4, 0x52, 0x9d, 0xd2, 0x52, 0x28, 0x2d, 0x6d, 0x1c, 0x68, 0x6c, 0x02, 0x0d, 0xce, + 0x47, 0x21, 0x9b, 0x61, 0x2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, 0x4f, 0x51, 0x48, 0x3c, 0x24, 0x58, + 0x22, 0x77, 0x8f, 0x29, 0x1f, 0x71, 0x88, 0x3c, 0x2f, 0xc1, 0x3c, 0xff, 0xae, 0x2b, 0x83, 0xff, + 0x26, 0x90, 0x6e, 0x81, 0xf8, 0x90, 0x03, 0x5a, 0x2f, 0x41, 0x7d, 0xf7, 0x61, 0x37, 0x6f, 0xe8, + 0x5e, 0x2c, 0x74, 0xb7, 0x86, 0xa0, 0x36, 0x3b, 0x2b, 0xe6, 0x0e, 0xd0, 0x43, 0xc2, 0x33, 0x7c, + 0x96, 0x7a, 0x7b, 0xbe, 0x1b, 0xa5, 0x60, 0x50, 0x4e, 0x4b, 0x86, 0xad, 0xcf, 0xe7, 0x57, 0x0d, + 0xed, 0xe2, 0xaa, 0xa1, 0xfd, 0xbe, 0x6a, 0x68, 0x3f, 0xaf, 0x1b, 0xa5, 0x8b, 0xeb, 0x46, 0xe9, + 0xd7, 0x75, 0xa3, 0x74, 0xfc, 0xd6, 0x27, 0x22, 0x18, 0x0d, 0x6d, 0x97, 0x45, 0x8e, 0xcb, 0x78, + 0xc4, 0xb8, 0x33, 0x1d, 0xf3, 0x6c, 0x72, 0x7f, 0xa6, 0xaf, 0x9c, 0x2f, 0xb7, 0xff, 0x15, 0xe4, + 0x6d, 0x38, 0x2c, 0xcb, 0xeb, 0xf0, 0xc5, 0x9f, 0x00, 0x00, 0x00, 0xff, 0xff, 0xfd, 0xe7, 0x1e, + 0x4d, 0x46, 0x06, 0x00, 0x00, } func (m *GenesisState) Marshal() (dAtA []byte, err error) { @@ -611,58 +503,6 @@ func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { dAtA[i] = 0x4a } } - if len(m.InitialValSet) > 0 { - for iNdEx := len(m.InitialValSet) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.InitialValSet[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.MaturingPackets) > 0 { - for iNdEx := len(m.MaturingPackets) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.MaturingPackets[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenesis(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x3a - } - } - if m.ProviderConsensusState != nil { - { - size, err := m.ProviderConsensusState.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenesis(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x32 - } - if m.ProviderClientState != nil { - { - size, err := m.ProviderClientState.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenesis(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x2a - } if m.NewChain { i-- if m.NewChain { @@ -791,42 +631,6 @@ func (m *LastTransmissionBlockHeight) MarshalToSizedBuffer(dAtA []byte) (int, er return len(dAtA) - i, nil } -func (m *MaturingVSCPacket) 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 *MaturingVSCPacket) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MaturingVSCPacket) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - n7, err7 := github_com_cosmos_gogoproto_types.StdTimeMarshalTo(m.MaturityTime, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdTime(m.MaturityTime):]) - if err7 != nil { - return 0, err7 - } - i -= n7 - i = encodeVarintGenesis(dAtA, i, uint64(n7)) - i-- - dAtA[i] = 0x12 - if m.VscId != 0 { - i = encodeVarintGenesis(dAtA, i, uint64(m.VscId)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - func (m *ConsumerPacketDataList) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -894,26 +698,6 @@ func (m *GenesisState) Size() (n int) { if m.NewChain { n += 2 } - if m.ProviderClientState != nil { - l = m.ProviderClientState.Size() - n += 1 + l + sovGenesis(uint64(l)) - } - if m.ProviderConsensusState != nil { - l = m.ProviderConsensusState.Size() - n += 1 + l + sovGenesis(uint64(l)) - } - if len(m.MaturingPackets) > 0 { - for _, e := range m.MaturingPackets { - l = e.Size() - n += 1 + l + sovGenesis(uint64(l)) - } - } - if len(m.InitialValSet) > 0 { - for _, e := range m.InitialValSet { - l = e.Size() - n += 1 + l + sovGenesis(uint64(l)) - } - } if len(m.HeightToValsetUpdateId) > 0 { for _, e := range m.HeightToValsetUpdateId { l = e.Size() @@ -978,20 +762,6 @@ func (m *LastTransmissionBlockHeight) Size() (n int) { return n } -func (m *MaturingVSCPacket) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.VscId != 0 { - n += 1 + sovGenesis(uint64(m.VscId)) - } - l = github_com_cosmos_gogoproto_types.SizeOfStdTime(m.MaturityTime) - n += 1 + l + sovGenesis(uint64(l)) - return n -} - func (m *ConsumerPacketDataList) Size() (n int) { if m == nil { return 0 @@ -1159,146 +929,6 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { } } m.NewChain = bool(v != 0) - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ProviderClientState", 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.ProviderClientState == nil { - m.ProviderClientState = &_07_tendermint.ClientState{} - } - if err := m.ProviderClientState.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 6: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ProviderConsensusState", 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.ProviderConsensusState == nil { - m.ProviderConsensusState = &_07_tendermint.ConsensusState{} - } - if err := m.ProviderConsensusState.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 7: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MaturingPackets", 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.MaturingPackets = append(m.MaturingPackets, MaturingVSCPacket{}) - if err := m.MaturingPackets[len(m.MaturingPackets)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 8: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field InitialValSet", 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.InitialValSet = append(m.InitialValSet, types1.ValidatorUpdate{}) - if err := m.InitialValSet[len(m.InitialValSet)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex case 9: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field HeightToValsetUpdateId", wireType) @@ -1746,108 +1376,6 @@ func (m *LastTransmissionBlockHeight) Unmarshal(dAtA []byte) error { } return nil } -func (m *MaturingVSCPacket) 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 ErrIntOverflowGenesis - } - 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: MaturingVSCPacket: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MaturingVSCPacket: 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 ErrIntOverflowGenesis - } - 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 MaturityTime", 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 err := github_com_cosmos_gogoproto_types.StdTimeUnmarshal(&m.MaturityTime, dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenesis(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenesis - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} func (m *ConsumerPacketDataList) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 diff --git a/x/ccv/consumer/types/genesis_test.go b/x/ccv/consumer/types/genesis_test.go index b77ee85f1a..bbe031d0d7 100644 --- a/x/ccv/consumer/types/genesis_test.go +++ b/x/ccv/consumer/types/genesis_test.go @@ -9,7 +9,6 @@ import ( ibctmtypes "github.com/cosmos/ibc-go/v8/modules/light-clients/07-tendermint" "github.com/stretchr/testify/require" - sdk "github.com/cosmos/cosmos-sdk/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" abci "github.com/cometbft/cometbft/abci/types" @@ -95,7 +94,6 @@ func TestValidateInitialGenesisState(t *testing.T) { ConsensusState: consensusState, InitialValSet: valUpdates, }, - MaturingPackets: nil, HeightToValsetUpdateId: nil, OutstandingDowntimeSlashing: nil, PendingConsumerPackets: types.ConsumerPacketDataList{}, @@ -116,28 +114,6 @@ func TestValidateInitialGenesisState(t *testing.T) { ConsensusState: consensusState, InitialValSet: valUpdates, }, - MaturingPackets: nil, - HeightToValsetUpdateId: nil, - OutstandingDowntimeSlashing: nil, - PendingConsumerPackets: types.ConsumerPacketDataList{}, - LastTransmissionBlockHeight: types.LastTransmissionBlockHeight{}, - PreCCV: false, - }, - true, - }, - { - "invalid new consumer genesis state: non-empty unbonding sequences", - &types.GenesisState{ - Params: params, - ProviderClientId: "", - ProviderChannelId: "", - NewChain: true, - Provider: ccv.ProviderInfo{ - ClientState: cs, - ConsensusState: consensusState, - InitialValSet: valUpdates, - }, - MaturingPackets: []types.MaturingVSCPacket{{}}, HeightToValsetUpdateId: nil, OutstandingDowntimeSlashing: nil, PendingConsumerPackets: types.ConsumerPacketDataList{}, @@ -158,7 +134,6 @@ func TestValidateInitialGenesisState(t *testing.T) { ConsensusState: consensusState, InitialValSet: valUpdates, }, - MaturingPackets: nil, HeightToValsetUpdateId: nil, OutstandingDowntimeSlashing: nil, PendingConsumerPackets: types.ConsumerPacketDataList{}, @@ -179,7 +154,6 @@ func TestValidateInitialGenesisState(t *testing.T) { ConsensusState: consensusState, InitialValSet: valUpdates, }, - MaturingPackets: nil, HeightToValsetUpdateId: nil, OutstandingDowntimeSlashing: nil, PendingConsumerPackets: types.ConsumerPacketDataList{List: []ccv.ConsumerPacketData{{}}}, @@ -282,13 +256,6 @@ func TestValidateRestartConsumerGenesisState(t *testing.T) { valHash := valSet.Hash() valUpdates := tmtypes.TM2PB.ValidatorUpdates(valSet) - matConsumerPacket := ccv.ConsumerPacketData{ - Type: ccv.VscMaturedPacket, - Data: &ccv.ConsumerPacketData_VscMaturedPacketData{ - VscMaturedPacketData: ccv.NewVSCMaturedPacketData(1), - }, - } - slashConsumerPacket := ccv.ConsumerPacketData{ Type: ccv.SlashPacket, Data: &ccv.ConsumerPacketData_SlashPacketData{ @@ -315,47 +282,15 @@ func TestValidateRestartConsumerGenesisState(t *testing.T) { gs *types.GenesisState expError bool }{ - { - "valid restart consumer genesis state: empty maturing packets", - types.NewRestartGenesisState("ccvclient", "ccvchannel", nil, valUpdates, heightToValsetUpdateID, - types.ConsumerPacketDataList{List: []ccv.ConsumerPacketData{matConsumerPacket, slashConsumerPacket}}, - nil, types.LastTransmissionBlockHeight{Height: 100}, params), - false, - }, { "valid restart consumer genesis state: handshake in progress ", - types.NewRestartGenesisState("ccvclient", "", nil, valUpdates, heightToValsetUpdateID, + types.NewRestartGenesisState("ccvclient", "", valUpdates, heightToValsetUpdateID, types.ConsumerPacketDataList{List: []ccv.ConsumerPacketData{slashConsumerPacket}}, nil, types.LastTransmissionBlockHeight{}, params), false, }, - { - "valid restart consumer genesis state: maturing packets", - types.NewRestartGenesisState("ccvclient", "ccvchannel", []types.MaturingVSCPacket{ - {VscId: 1, MaturityTime: time.Now().UTC()}, - {VscId: 3, MaturityTime: time.Now().UTC()}, - {VscId: 5, MaturityTime: time.Now().UTC()}, - }, valUpdates, heightToValsetUpdateID, types.ConsumerPacketDataList{}, - []types.OutstandingDowntime{{ValidatorConsensusAddress: sdk.ConsAddress(validator.Address.Bytes()).String()}}, - types.LastTransmissionBlockHeight{}, params), - false, - }, { "invalid restart consumer genesis state: provider id is empty", - types.NewRestartGenesisState("", "ccvchannel", nil, valUpdates, heightToValsetUpdateID, types.ConsumerPacketDataList{}, nil, types.LastTransmissionBlockHeight{}, params), - true, - }, - { - "invalid restart consumer genesis state: maturing packet vscId is invalid", - types.NewRestartGenesisState("ccvclient", "ccvchannel", []types.MaturingVSCPacket{ - {VscId: 0, MaturityTime: time.Now().UTC()}, - }, valUpdates, nil, types.ConsumerPacketDataList{}, nil, types.LastTransmissionBlockHeight{}, params), - true, - }, - { - "invalid restart consumer genesis state: maturing packet time is invalid", - types.NewRestartGenesisState("ccvclient", "ccvchannel", []types.MaturingVSCPacket{ - {VscId: 1, MaturityTime: time.Time{}}, - }, valUpdates, nil, types.ConsumerPacketDataList{}, nil, types.LastTransmissionBlockHeight{}, params), + types.NewRestartGenesisState("", "ccvchannel", valUpdates, heightToValsetUpdateID, types.ConsumerPacketDataList{}, nil, types.LastTransmissionBlockHeight{}, params), true, }, { @@ -370,7 +305,6 @@ func TestValidateRestartConsumerGenesisState(t *testing.T) { ConsensusState: nil, InitialValSet: valUpdates, }, - MaturingPackets: nil, HeightToValsetUpdateId: nil, OutstandingDowntimeSlashing: nil, PendingConsumerPackets: types.ConsumerPacketDataList{}, @@ -391,7 +325,6 @@ func TestValidateRestartConsumerGenesisState(t *testing.T) { ConsensusState: consensusState, InitialValSet: valUpdates, }, - MaturingPackets: nil, HeightToValsetUpdateId: nil, OutstandingDowntimeSlashing: nil, PendingConsumerPackets: types.ConsumerPacketDataList{}, @@ -402,50 +335,25 @@ func TestValidateRestartConsumerGenesisState(t *testing.T) { }, { "invalid restart consumer genesis state: nil initial validator set", - types.NewRestartGenesisState("ccvclient", "ccvchannel", nil, nil, nil, types.ConsumerPacketDataList{}, nil, types.LastTransmissionBlockHeight{}, params), - true, - }, - { - "invalid restart consumer genesis state: nil height to validator set id mapping", - types.NewRestartGenesisState("ccvclient", "", - []types.MaturingVSCPacket{{VscId: 1, MaturityTime: time.Time{}}}, valUpdates, nil, types.ConsumerPacketDataList{}, nil, types.LastTransmissionBlockHeight{}, params), - true, - }, - { - "invalid restart consumer genesis state: maturing packet defined when handshake is still in progress", - types.NewRestartGenesisState("ccvclient", "", - []types.MaturingVSCPacket{{VscId: 1, MaturityTime: time.Time{}}}, valUpdates, heightToValsetUpdateID, types.ConsumerPacketDataList{}, nil, types.LastTransmissionBlockHeight{}, params), + types.NewRestartGenesisState("ccvclient", "ccvchannel", nil, nil, types.ConsumerPacketDataList{}, nil, types.LastTransmissionBlockHeight{}, params), true, }, { "invalid restart consumer genesis state: outstanding downtime defined when handshake is still in progress", types.NewRestartGenesisState("ccvclient", "", - nil, valUpdates, heightToValsetUpdateID, types.ConsumerPacketDataList{}, []types.OutstandingDowntime{{ValidatorConsensusAddress: "cosmosvalconsxxx"}}, + valUpdates, heightToValsetUpdateID, types.ConsumerPacketDataList{}, []types.OutstandingDowntime{{ValidatorConsensusAddress: "cosmosvalconsxxx"}}, types.LastTransmissionBlockHeight{}, params), true, }, { "invalid restart consumer genesis state: last transmission block height defined when handshake is still in progress", types.NewRestartGenesisState("ccvclient", "", - nil, valUpdates, heightToValsetUpdateID, types.ConsumerPacketDataList{}, nil, types.LastTransmissionBlockHeight{Height: int64(1)}, params), - true, - }, - { - "invalid restart consumer genesis state: pending maturing packets defined when handshake is still in progress", - types.NewRestartGenesisState("ccvclient", "", - nil, valUpdates, heightToValsetUpdateID, types.ConsumerPacketDataList{ - List: []ccv.ConsumerPacketData{ - { - Type: ccv.VscMaturedPacket, - Data: &ccv.ConsumerPacketData_VscMaturedPacketData{VscMaturedPacketData: ccv.NewVSCMaturedPacketData(1)}, - }, - }, - }, nil, types.LastTransmissionBlockHeight{Height: int64(1)}, params), + valUpdates, heightToValsetUpdateID, types.ConsumerPacketDataList{}, nil, types.LastTransmissionBlockHeight{Height: int64(1)}, params), true, }, { "invalid restart consumer genesis state: invalid params", - types.NewRestartGenesisState("ccvclient", "ccvchannel", nil, valUpdates, nil, types.ConsumerPacketDataList{}, nil, types.LastTransmissionBlockHeight{}, + types.NewRestartGenesisState("ccvclient", "ccvchannel", valUpdates, nil, types.ConsumerPacketDataList{}, nil, types.LastTransmissionBlockHeight{}, ccv.NewParams( true, ccv.DefaultBlocksPerDistributionTransmission, diff --git a/x/ccv/consumer/types/keys.go b/x/ccv/consumer/types/keys.go index f551a5d79a..bded8ba3bd 100644 --- a/x/ccv/consumer/types/keys.go +++ b/x/ccv/consumer/types/keys.go @@ -4,11 +4,8 @@ import ( "encoding/binary" fmt "fmt" "sort" - time "time" sdk "github.com/cosmos/cosmos-sdk/types" - - ccvtypes "github.com/cosmos/interchain-security/v6/x/ccv/types" ) const ( @@ -59,7 +56,7 @@ const ( HistoricalInfoKeyName = "HistoricalInfoKey" - PacketMaturityTimeKeyName = "PacketMaturityTimeKey" + DeprecatedPacketMaturityTimeKeyName = "DeprecatedPacketMaturityTimeKey" HeightValsetUpdateIDKeyName = "HeightValsetUpdateIDKey" @@ -127,7 +124,9 @@ func getKeyPrefixes() map[string]byte { HistoricalInfoKeyName: 11, // PacketMaturityTimeKey is the key for storing maturity time for each received VSC packet - PacketMaturityTimeKeyName: 12, + // NOTE: This prefix is deprecated, but left in place to avoid state migrations + // [DEPRECATED] + DeprecatedPacketMaturityTimeKeyName: 12, // HeightValsetUpdateIDKey is the key for storing the mapping from block height to valset update ID HeightValsetUpdateIDKeyName: 13, @@ -263,24 +262,6 @@ func HistoricalInfoKey(height int64) []byte { return append(HistoricalInfoKeyPrefix(), hBytes...) } -// PacketMaturityTimeKeyPrefix returns the key prefix for storing maturity time for each received VSC packet -func PacketMaturityTimeKeyPrefix() []byte { - return []byte{mustGetKeyPrefix(PacketMaturityTimeKeyName)} -} - -// PacketMaturityTimeKey returns the key for storing the maturity time for a given received VSC packet id -func PacketMaturityTimeKey(vscID uint64, maturityTime time.Time) []byte { - ts := uint64(maturityTime.UTC().UnixNano()) - return ccvtypes.AppendMany( - // Append the prefix - PacketMaturityTimeKeyPrefix(), - // Append the time - sdk.Uint64ToBigEndian(ts), - // Append the vscID - sdk.Uint64ToBigEndian(vscID), - ) -} - // HeightValsetUpdateIDKeyPrefix returns the key for storing a valset update ID for a given block height func HeightValsetUpdateIDKeyPrefix() []byte { return []byte{mustGetKeyPrefix(HeightValsetUpdateIDKeyName)} diff --git a/x/ccv/consumer/types/keys_test.go b/x/ccv/consumer/types/keys_test.go index 059699a6d2..fe8522c698 100644 --- a/x/ccv/consumer/types/keys_test.go +++ b/x/ccv/consumer/types/keys_test.go @@ -3,7 +3,6 @@ package types_test import ( "strings" "testing" - "time" "github.com/stretchr/testify/require" @@ -49,7 +48,7 @@ func TestPreserveBytePrefix(t *testing.T) { i++ require.Equal(t, byte(11), consumertypes.HistoricalInfoKeyPrefix()[0]) i++ - require.Equal(t, byte(12), consumertypes.PacketMaturityTimeKeyPrefix()[0]) + // reserve 12 as deprecated i++ require.Equal(t, byte(13), consumertypes.HeightValsetUpdateIDKeyPrefix()[0]) i++ @@ -108,7 +107,6 @@ func getAllFullyDefinedKeys() [][]byte { consumertypes.ProviderChannelIDKey(), consumertypes.PendingChangesKey(), consumertypes.HistoricalInfoKey(0), - consumertypes.PacketMaturityTimeKey(0, time.Time{}), consumertypes.HeightValsetUpdateIDKey(0), consumertypes.OutstandingDowntimeKey(sdk.ConsAddress([]byte{0x05})), consumertypes.CrossChainValidatorKey([]byte{0x05}),