diff --git a/proto/interchain_security/ccv/consumer/v1/consumer.proto b/proto/interchain_security/ccv/consumer/v1/consumer.proto index 082315aff2..170c146cfd 100644 --- a/proto/interchain_security/ccv/consumer/v1/consumer.proto +++ b/proto/interchain_security/ccv/consumer/v1/consumer.proto @@ -9,6 +9,7 @@ import "google/protobuf/any.proto"; import "gogoproto/gogo.proto"; import "cosmos_proto/cosmos.proto"; import "google/protobuf/duration.proto"; +import "google/protobuf/timestamp.proto"; // Params defines the parameters for CCV consumer module message Params { @@ -68,3 +69,8 @@ message CrossChainValidator { ]; } +// MaturingVSCPacket contains the maturing time of a received VSCPacket +message MaturingVSCPacket { + uint64 vscId = 1; + google.protobuf.Timestamp maturity_time = 2 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false]; +} diff --git a/proto/interchain_security/ccv/consumer/v1/genesis.proto b/proto/interchain_security/ccv/consumer/v1/genesis.proto index 3d5a69fdbd..6adbc79f54 100644 --- a/proto/interchain_security/ccv/consumer/v1/genesis.proto +++ b/proto/interchain_security/ccv/consumer/v1/genesis.proto @@ -23,7 +23,7 @@ message GenesisState { // ProviderConsensusState filled in on new chain, nil on restart. ibc.lightclients.tendermint.v1.ConsensusState provider_consensus_state = 6; // MaturingPackets nil on new chain, filled in on restart. - repeated MaturingVSCPacket maturing_packets = 7 + repeated interchain_security.ccv.consumer.v1.MaturingVSCPacket maturing_packets = 7 [ (gogoproto.nullable) = false ]; // InitialValset filled in on new chain and on restart. repeated .tendermint.abci.ValidatorUpdate initial_val_set = 8 @@ -42,13 +42,6 @@ message GenesisState { [ (gogoproto.nullable) = false ]; } -// MaturingVSCPacket defines the genesis information for the -// unbonding VSC packet -message MaturingVSCPacket { - uint64 vscId = 1; - uint64 maturity_time = 2; -} - // HeightValsetUpdateID defines the genesis information for the mapping // of each block height to a valset update id message HeightToValsetUpdateID { diff --git a/tests/e2e/valset_update.go b/tests/e2e/valset_update.go index 4b250eaaaa..d56b5f0f66 100644 --- a/tests/e2e/valset_update.go +++ b/tests/e2e/valset_update.go @@ -99,6 +99,8 @@ func (suite *CCVTestSuite) TestQueueAndSendVSCMaturedPackets() { suite.Require().NotNil(ack, "OnRecvVSCPacket did not return ack") suite.Require().True(ack.Success(), "OnRecvVSCPacket did not return a Success Acknowledgment") + 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 @@ -106,14 +108,31 @@ func (suite *CCVTestSuite) TestQueueAndSendVSCMaturedPackets() { // ensure first two packets are unbonded and VSCMatured packets are queued // unbonded time is deleted - time1 := consumerKeeper.GetPacketMaturityTime(suite.consumerChain.GetContext(), 1) - time2 := consumerKeeper.GetPacketMaturityTime(suite.consumerChain.GetContext(), 2) - suite.Require().Equal(uint64(0), time1, "maturity time not deleted for mature packet 1") - suite.Require().Equal(uint64(0), time2, "maturity time not deleted for mature packet 2") - + 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 - time3 := consumerKeeper.GetPacketMaturityTime(suite.consumerChain.GetContext(), 3) - suite.Require().True(time3 > uint64(suite.consumerChain.GetContext().BlockTime().UnixNano()), "maturity time for packet 3 is not after current time") + 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( diff --git a/x/ccv/consumer/keeper/genesis_test.go b/x/ccv/consumer/keeper/genesis_test.go index 6d25b724e9..66e4638d3a 100644 --- a/x/ccv/consumer/keeper/genesis_test.go +++ b/x/ccv/consumer/keeper/genesis_test.go @@ -64,7 +64,7 @@ func TestInitGenesis(t *testing.T) { matPackets := []consumertypes.MaturingVSCPacket{ { VscId: 1, - MaturityTime: uint64(time.Now().UnixNano()), + MaturityTime: time.Now().UTC(), }, } pendingDataPackets := ccv.ConsumerPacketDataList{ @@ -185,7 +185,7 @@ func TestInitGenesis(t *testing.T) { require.True(t, ok) require.Equal(t, provChannelID, gotChannelID) - require.Equal(t, vscID, ck.GetPacketMaturityTime(ctx, vscID)) + require.True(t, ck.PacketMaturityTimeExists(ctx, matPackets[0].VscId, matPackets[0].MaturityTime)) require.Equal(t, pendingDataPackets, ck.GetPendingPackets(ctx)) require.Equal(t, gs.OutstandingDowntimeSlashing, ck.GetAllOutstandingDowntimes(ctx)) @@ -236,7 +236,7 @@ func TestExportGenesis(t *testing.T) { matPackets := []consumertypes.MaturingVSCPacket{ { VscId: 1, - MaturityTime: uint64(time.Now().UnixNano()), + MaturityTime: time.Now().UTC(), }, } diff --git a/x/ccv/consumer/keeper/keeper.go b/x/ccv/consumer/keeper/keeper.go index 15441c228d..f4c6e720bc 100644 --- a/x/ccv/consumer/keeper/keeper.go +++ b/x/ccv/consumer/keeper/keeper.go @@ -3,6 +3,7 @@ package keeper import ( "encoding/binary" "fmt" + "time" "github.com/cosmos/cosmos-sdk/codec" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" @@ -206,76 +207,81 @@ func (k Keeper) DeletePendingChanges(ctx sdk.Context) { store.Delete(types.PendingChangesKey()) } -// GetElapsedPacketMaturityTimes returns a slice of already elapsed PacketMaturityTimes, sorted by vscIDs, -// i.e., the slice contains the IDs of the matured VSCPackets -func (k Keeper) GetElapsedPacketMaturityTimes(ctx sdk.Context) (maturingVSCPacket []consumertypes.MaturingVSCPacket) { - currentTime := uint64(ctx.BlockTime().UnixNano()) +// 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 []consumertypes.MaturingVSCPacket) { store := ctx.KVStore(k.storeKey) iterator := sdk.KVStorePrefixIterator(store, []byte{types.PacketMaturityTimeBytePrefix}) defer iterator.Close() for ; iterator.Valid(); iterator.Next() { - vscId := binary.BigEndian.Uint64(iterator.Key()[1:]) - maturityTime := binary.BigEndian.Uint64(iterator.Value()) + var maturingVSCPacket consumertypes.MaturingVSCPacket + if err := maturingVSCPacket.Unmarshal(iterator.Value()); err != nil { + panic(fmt.Errorf("failed to unmarshal MaturingVSCPacket: %w", err)) + } - // If the maturity time is after the current time, then stop the iteration; - // TODO: the iteration over PacketMaturityTimes should be over maturity times, - // see https://github.com/cosmos/interchain-security/issues/598 - if currentTime < maturityTime { + // 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 } - maturingVSCPacket = append(maturingVSCPacket, consumertypes.MaturingVSCPacket{ - VscId: vscId, - MaturityTime: maturityTime, - }) + maturingVSCPackets = append(maturingVSCPackets, maturingVSCPacket) } - return maturingVSCPacket + return maturingVSCPackets } -// GetAllPacketMaturityTimes returns a slice of all PacketMaturityTimes, sorted by vscIDs. -func (k Keeper) GetAllPacketMaturityTimes(ctx sdk.Context) (maturingVSCPacket []consumertypes.MaturingVSCPacket) { +// GetAllPacketMaturityTimes returns a slice of all PacketMaturityTimes, sorted by maturity times. +// +// Note that PacketMaturityTimes are stored under keys with the following format: +// PacketMaturityTimeBytePrefix | 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 []consumertypes.MaturingVSCPacket) { store := ctx.KVStore(k.storeKey) iterator := sdk.KVStorePrefixIterator(store, []byte{types.PacketMaturityTimeBytePrefix}) defer iterator.Close() for ; iterator.Valid(); iterator.Next() { - vscId := binary.BigEndian.Uint64(iterator.Key()[1:]) - maturityTime := binary.BigEndian.Uint64(iterator.Value()) + var maturingVSCPacket consumertypes.MaturingVSCPacket + if err := maturingVSCPacket.Unmarshal(iterator.Value()); err != nil { + panic(fmt.Errorf("failed to unmarshal MaturingVSCPacket: %w", err)) + } - maturingVSCPacket = append(maturingVSCPacket, consumertypes.MaturingVSCPacket{ - VscId: vscId, - MaturityTime: maturityTime, - }) + maturingVSCPackets = append(maturingVSCPackets, maturingVSCPacket) } - return maturingVSCPacket + return maturingVSCPackets } // SetPacketMaturityTime sets the maturity time for a given received VSC packet id -func (k Keeper) SetPacketMaturityTime(ctx sdk.Context, vscId, maturityTime uint64) { +func (k Keeper) SetPacketMaturityTime(ctx sdk.Context, vscId uint64, maturityTime time.Time) { store := ctx.KVStore(k.storeKey) - timeBytes := make([]byte, 8) - binary.BigEndian.PutUint64(timeBytes, maturityTime) - store.Set(types.PacketMaturityTimeKey(vscId), timeBytes) + maturingVSCPacket := consumertypes.MaturingVSCPacket{ + VscId: vscId, + MaturityTime: maturityTime, + } + bz, err := maturingVSCPacket.Marshal() + if err != nil { + panic(fmt.Errorf("failed to marshal MaturingVSCPacket: %w", err)) + } + store.Set(types.PacketMaturityTimeKey(vscId, maturityTime), bz) } -// GetPacketMaturityTime gets the maturity time for a given received VSC packet id -func (k Keeper) GetPacketMaturityTime(ctx sdk.Context, vscId uint64) uint64 { +// 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)) - if bz == nil { - return 0 - } - return binary.BigEndian.Uint64(bz) + bz := store.Get(types.PacketMaturityTimeKey(vscId, maturityTime)) + return bz != nil } -// DeletePacketMaturityTimes deletes the packet maturity time for given received VSC packet ids -func (k Keeper) DeletePacketMaturityTimes(ctx sdk.Context, vscIds ...uint64) { +// 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) - for _, vscId := range vscIds { - store.Delete(types.PacketMaturityTimeKey(vscId)) - } + store.Delete(types.PacketMaturityTimeKey(vscId, maturityTime)) } // VerifyProviderChain verifies that the chain trying to connect on the channel handshake diff --git a/x/ccv/consumer/keeper/keeper_test.go b/x/ccv/consumer/keeper/keeper_test.go index aae0d509fc..ab582c1ac0 100644 --- a/x/ccv/consumer/keeper/keeper_test.go +++ b/x/ccv/consumer/keeper/keeper_test.go @@ -90,60 +90,51 @@ func TestPacketMaturityTime(t *testing.T) { defer ctrl.Finish() now := time.Now().UTC() - nsNow := uint64(now.UnixNano()) packets := []types.MaturingVSCPacket{ { VscId: 2, - MaturityTime: nsNow, + MaturityTime: now, }, { VscId: 1, - MaturityTime: nsNow - 15, + MaturityTime: now.Add(-time.Hour), }, { VscId: 5, - MaturityTime: nsNow - 30, + MaturityTime: now.Add(-2 * time.Hour), }, { VscId: 6, - MaturityTime: nsNow + 10, + MaturityTime: now.Add(time.Hour), }, } - expectedGetAllOrder := packets - // sorting by VscId - sort.Slice(expectedGetAllOrder, func(i, j int) bool { - return expectedGetAllOrder[i].VscId < expectedGetAllOrder[j].VscId - }) - expectedGetElapsedOrder := []types.MaturingVSCPacket{} - for _, packet := range packets { - // only packets with MaturityTime <= nsNow - if packet.MaturityTime <= nsNow { - expectedGetElapsedOrder = append(expectedGetElapsedOrder, packet) - } - } - // sorting by VscId - sort.Slice(expectedGetElapsedOrder, func(i, j int) bool { - return expectedGetElapsedOrder[i].VscId < expectedGetElapsedOrder[j].VscId - }) + // 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.Equal(t, packet.MaturityTime, ck.GetPacketMaturityTime(ctx, packet.VscId)) + 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) - ck.DeletePacketMaturityTimes(ctx, 6) - require.Equal(t, uint64(0), ck.GetPacketMaturityTime(ctx, 3)) - require.Equal(t, uint64(0), ck.GetPacketMaturityTime(ctx, 6)) + // 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 diff --git a/x/ccv/consumer/keeper/relay.go b/x/ccv/consumer/keeper/relay.go index 1f3cea38c4..de1a526c81 100644 --- a/x/ccv/consumer/keeper/relay.go +++ b/x/ccv/consumer/keeper/relay.go @@ -64,7 +64,7 @@ func (k Keeper) OnRecvVSCPacket(ctx sdk.Context, packet channeltypes.Packet, new // Save maturity time and packet maturityTime := ctx.BlockTime().Add(k.GetUnbondingPeriod(ctx)) - k.SetPacketMaturityTime(ctx, newChanges.ValsetUpdateId, uint64(maturityTime.UnixNano())) + k.SetPacketMaturityTime(ctx, newChanges.ValsetUpdateId, maturityTime) // set height to VSC id mapping k.SetHeightValsetUpdateID(ctx, uint64(ctx.BlockHeight())+1, newChanges.ValsetUpdateId) @@ -85,24 +85,22 @@ func (k Keeper) OnRecvVSCPacket(ctx sdk.Context, packet channeltypes.Packet, new // operations that resulted in validator updates included in that VSC have matured on // the consumer chain. func (k Keeper) QueueVSCMaturedPackets(ctx sdk.Context) { - currentTime := uint64(ctx.BlockTime().UnixNano()) - for _, maturityTime := range k.GetElapsedPacketMaturityTimes(ctx) { - if currentTime < maturityTime.MaturityTime { - panic(fmt.Errorf("maturity time %d is greater than current time %d", maturityTime.MaturityTime, currentTime)) + if ctx.BlockTime().Before(maturityTime.MaturityTime) { + panic(fmt.Errorf("maturity time %s is after than current time %s", maturityTime.MaturityTime, ctx.BlockTime())) } // 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 + // Append VSCMatured packet to pending packets. + // Sending packets is attempted each EndBlock. + // Unsent packets remain in the queue until sent. k.AppendPendingPacket(ctx, ccv.ConsumerPacketData{ Type: ccv.VscMaturedPacket, Data: &ccv.ConsumerPacketData_VscMaturedPacketData{VscMaturedPacketData: vscPacket}, }) - k.DeletePacketMaturityTimes(ctx, uint64(maturityTime.VscId)) + k.DeletePacketMaturityTimes(ctx, maturityTime.VscId, maturityTime.MaturityTime) ctx.EventManager().EmitEvent( sdk.NewEvent( @@ -111,7 +109,7 @@ func (k Keeper) QueueVSCMaturedPackets(ctx sdk.Context) { sdk.NewAttribute(ccv.AttributeChainID, ctx.ChainID()), sdk.NewAttribute(ccv.AttributeConsumerHeight, strconv.Itoa(int(ctx.BlockHeight()))), sdk.NewAttribute(ccv.AttributeValSetUpdateID, strconv.Itoa(int(maturityTime.VscId))), - sdk.NewAttribute(ccv.AttributeTimestamp, strconv.Itoa(int(currentTime))), + sdk.NewAttribute(ccv.AttributeTimestamp, ctx.BlockTime().String()), ), ) } diff --git a/x/ccv/consumer/keeper/relay_test.go b/x/ccv/consumer/keeper/relay_test.go index 218d8c4d6a..86b46e37f7 100644 --- a/x/ccv/consumer/keeper/relay_test.go +++ b/x/ccv/consumer/keeper/relay_test.go @@ -143,9 +143,12 @@ func TestOnRecvVSCPacket(t *testing.T) { }) require.Equal(t, tc.expectedPendingChanges, *actualPendingChanges, "pending changes not equal to expected changes after successful packet receive. case: %s", tc.name) - expectedTime := uint64(ctx.BlockTime().Add(consumerKeeper.GetUnbondingPeriod(ctx)).UnixNano()) - maturityTime := consumerKeeper.GetPacketMaturityTime(ctx, tc.newChanges.ValsetUpdateId) - require.Equal(t, expectedTime, maturityTime, "packet maturity time has unexpected value for case: %s", tc.name) + expectedTime := ctx.BlockTime().Add(consumerKeeper.GetUnbondingPeriod(ctx)) + require.True( + t, + consumerKeeper.PacketMaturityTimeExists(ctx, tc.newChanges.ValsetUpdateId, expectedTime), + "no packet maturity time for case: %s", tc.name, + ) } } diff --git a/x/ccv/consumer/types/consumer.pb.go b/x/ccv/consumer/types/consumer.pb.go index 2d2903e9d6..5d20bfce95 100644 --- a/x/ccv/consumer/types/consumer.pb.go +++ b/x/ccv/consumer/types/consumer.pb.go @@ -12,6 +12,7 @@ import ( github_com_gogo_protobuf_types "github.com/gogo/protobuf/types" _ "github.com/regen-network/cosmos-proto" _ "google.golang.org/protobuf/types/known/durationpb" + _ "google.golang.org/protobuf/types/known/timestamppb" io "io" math "math" math_bits "math/bits" @@ -268,10 +269,64 @@ func (m *CrossChainValidator) GetPubkey() *types.Any { return nil } +// MaturingVSCPacket contains the maturing time of a received VSCPacket +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_5b27a82b276e7f93, []int{3} +} +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{} +} + func init() { proto.RegisterType((*Params)(nil), "interchain_security.ccv.consumer.v1.Params") proto.RegisterType((*LastTransmissionBlockHeight)(nil), "interchain_security.ccv.consumer.v1.LastTransmissionBlockHeight") proto.RegisterType((*CrossChainValidator)(nil), "interchain_security.ccv.consumer.v1.CrossChainValidator") + proto.RegisterType((*MaturingVSCPacket)(nil), "interchain_security.ccv.consumer.v1.MaturingVSCPacket") } func init() { @@ -279,48 +334,52 @@ func init() { } var fileDescriptor_5b27a82b276e7f93 = []byte{ - // 641 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x94, 0x4f, 0x4e, 0x14, 0x4f, - 0x14, 0xc7, 0xa7, 0x7f, 0xc0, 0x00, 0xc5, 0x2f, 0x11, 0xcb, 0x11, 0x1a, 0x4c, 0x7a, 0x86, 0x91, - 0xc5, 0x6c, 0xe8, 0x0e, 0x10, 0x37, 0xec, 0x18, 0x90, 0x10, 0x35, 0x3a, 0xb6, 0xc4, 0x85, 0x2e, - 0x2a, 0xd5, 0xd5, 0x35, 0x3d, 0x15, 0xba, 0xab, 0x3a, 0x55, 0xd5, 0xad, 0x7d, 0x0b, 0x97, 0x1e, - 0xc1, 0x03, 0x78, 0x08, 0xe2, 0x8a, 0xa5, 0x2b, 0x34, 0x70, 0x03, 0xe3, 0x01, 0x4c, 0xff, 0x1b, - 0x18, 0x74, 0x12, 0x76, 0xef, 0xe5, 0x7d, 0xdf, 0x27, 0xf5, 0x7d, 0xf5, 0xaa, 0xc0, 0x0e, 0xe3, - 0x9a, 0x4a, 0x32, 0xc2, 0x8c, 0x23, 0x45, 0x49, 0x22, 0x99, 0xce, 0x1c, 0x42, 0x52, 0x87, 0x08, - 0xae, 0x92, 0x88, 0x4a, 0x27, 0xdd, 0x1e, 0xc7, 0x76, 0x2c, 0x85, 0x16, 0xf0, 0xf1, 0x3f, 0x7a, - 0x6c, 0x42, 0x52, 0x7b, 0xac, 0x4b, 0xb7, 0xd7, 0x37, 0xa7, 0x81, 0x73, 0x1e, 0x49, 0x4b, 0xd4, - 0xfa, 0x5a, 0x20, 0x44, 0x10, 0x52, 0xa7, 0xc8, 0xbc, 0x64, 0xe8, 0x60, 0x9e, 0x55, 0xa5, 0x56, - 0x20, 0x02, 0x51, 0x84, 0x4e, 0x1e, 0xd5, 0x0d, 0x44, 0xa8, 0x48, 0x28, 0x54, 0x16, 0xca, 0xa4, - 0x2a, 0x59, 0xb7, 0x59, 0x7e, 0x22, 0xb1, 0x66, 0x82, 0x97, 0xf5, 0xee, 0xef, 0x59, 0xd0, 0x1c, - 0x60, 0x89, 0x23, 0x05, 0x4d, 0x30, 0x4f, 0x39, 0xf6, 0x42, 0xea, 0x9b, 0x46, 0xc7, 0xe8, 0x2d, - 0xb8, 0x75, 0x0a, 0x5f, 0x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0x2d, 0xe3, 0xfc, 0xd2, 0x32, 0x7e, 0x5e, 0x5a, 0xc6, 0xa7, 0x2b, 0xab, 0x71, 0x7e, 0x65, 0x35, - 0xbe, 0x5f, 0x59, 0x8d, 0x77, 0x7b, 0x01, 0xd3, 0xa3, 0xc4, 0xb3, 0x89, 0x88, 0xaa, 0xb7, 0xea, - 0x5c, 0x7f, 0x0b, 0x5b, 0xe3, 0x6f, 0xe1, 0xe3, 0xe4, 0x8f, 0xa3, 0xb3, 0x98, 0x2a, 0xaf, 0x59, - 0x1c, 0x70, 0xf7, 0x4f, 0x00, 0x00, 0x00, 0xff, 0xff, 0xde, 0xc7, 0xba, 0xd1, 0xa2, 0x04, 0x00, - 0x00, + // 709 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x54, 0xcf, 0x4e, 0xdb, 0x48, + 0x18, 0x8f, 0x17, 0x08, 0x30, 0xb0, 0x5a, 0xf0, 0x66, 0xc1, 0x64, 0x25, 0x27, 0x64, 0x39, 0xe4, + 0x82, 0x23, 0x82, 0xf6, 0xc2, 0x8d, 0x84, 0x45, 0xb0, 0xfd, 0x97, 0x9a, 0x88, 0x43, 0x7b, 0xb0, + 0xc6, 0xe3, 0x89, 0x33, 0xc2, 0x9e, 0xb1, 0x66, 0xc6, 0x6e, 0xfd, 0x16, 0x1c, 0xfb, 0x08, 0x7d, + 0x80, 0x3e, 0x04, 0xea, 0x89, 0x63, 0x4f, 0xb4, 0x82, 0x37, 0xa8, 0xfa, 0x00, 0x95, 0x3d, 0x76, + 0x20, 0x50, 0x24, 0x6e, 0xdf, 0xa7, 0xdf, 0x1f, 0xcf, 0xf7, 0xf3, 0x37, 0x03, 0xba, 0x84, 0x4a, + 0xcc, 0xd1, 0x18, 0x12, 0xea, 0x08, 0x8c, 0x62, 0x4e, 0x64, 0xda, 0x41, 0x28, 0xe9, 0x20, 0x46, + 0x45, 0x1c, 0x62, 0xde, 0x49, 0x76, 0x26, 0xb5, 0x15, 0x71, 0x26, 0x99, 0xfe, 0xcf, 0x2f, 0x34, + 0x16, 0x42, 0x89, 0x35, 0xe1, 0x25, 0x3b, 0xf5, 0xad, 0xc7, 0x8c, 0x33, 0x3f, 0x94, 0x28, 0xab, + 0xfa, 0x86, 0xcf, 0x98, 0x1f, 0xe0, 0x4e, 0xde, 0xb9, 0xf1, 0xa8, 0x03, 0x69, 0x5a, 0x40, 0x35, + 0x9f, 0xf9, 0x2c, 0x2f, 0x3b, 0x59, 0x55, 0x0a, 0x10, 0x13, 0x21, 0x13, 0x8e, 0x02, 0x54, 0x53, + 0x40, 0xe6, 0x7d, 0x2f, 0x2f, 0xe6, 0x50, 0x12, 0x46, 0x0b, 0xbc, 0x71, 0x1f, 0x97, 0x24, 0xc4, + 0x42, 0xc2, 0x30, 0x52, 0x84, 0xd6, 0x8f, 0x59, 0x50, 0x1d, 0x40, 0x0e, 0x43, 0xa1, 0x1b, 0x60, + 0x1e, 0x53, 0xe8, 0x06, 0xd8, 0x33, 0xb4, 0xa6, 0xd6, 0x5e, 0xb0, 0xcb, 0x56, 0x7f, 0x05, 0xb6, + 0xdc, 0x80, 0xa1, 0x33, 0xe1, 0x44, 0x98, 0x3b, 0x1e, 0x11, 0x92, 0x13, 0x37, 0xce, 0x3e, 0xe3, + 0x48, 0x0e, 0xa9, 0x08, 0x89, 0x10, 0x84, 0x51, 0xe3, 0xb7, 0xa6, 0xd6, 0x9e, 0xb1, 0x37, 0x15, + 0x77, 0x80, 0xf9, 0xc1, 0x1d, 0xe6, 0xf0, 0x0e, 0x51, 0xff, 0x1f, 0x6c, 0x3e, 0xea, 0xe2, 0xa0, + 0x31, 0xa4, 0x14, 0x07, 0xc6, 0x4c, 0x53, 0x6b, 0x2f, 0xda, 0x0d, 0xef, 0x11, 0x93, 0xbe, 0xa2, + 0xe9, 0x7b, 0xa0, 0x1e, 0x71, 0x96, 0x10, 0x0f, 0x73, 0x67, 0x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5, 0xcd, 0x9e, 0x4f, 0xe4, 0x38, 0x76, 0x2d, 0xc4, + 0xc2, 0xe2, 0x09, 0xe9, 0xdc, 0xbe, 0x56, 0xdb, 0x93, 0xd7, 0xea, 0xfd, 0xf4, 0x43, 0x28, 0xd3, + 0x08, 0x0b, 0xb7, 0x9a, 0x9f, 0x60, 0xf7, 0x67, 0x00, 0x00, 0x00, 0xff, 0xff, 0xde, 0xaf, 0xcf, + 0x76, 0x39, 0x05, 0x00, 0x00, } func (m *Params) Marshal() (dAtA []byte, err error) { @@ -486,6 +545,42 @@ func (m *CrossChainValidator) MarshalToSizedBuffer(dAtA []byte) (int, error) { 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 + n5, err5 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.MaturityTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.MaturityTime):]) + if err5 != nil { + return 0, err5 + } + i -= n5 + i = encodeVarintConsumer(dAtA, i, uint64(n5)) + i-- + dAtA[i] = 0x12 + if m.VscId != 0 { + i = encodeVarintConsumer(dAtA, i, uint64(m.VscId)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + func encodeVarintConsumer(dAtA []byte, offset int, v uint64) int { offset -= sovConsumer(v) base := offset @@ -565,6 +660,20 @@ func (m *CrossChainValidator) 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 + sovConsumer(uint64(m.VscId)) + } + l = github_com_gogo_protobuf_types.SizeOfStdTime(m.MaturityTime) + n += 1 + l + sovConsumer(uint64(l)) + return n +} + func sovConsumer(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -1082,6 +1191,108 @@ func (m *CrossChainValidator) 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 ErrIntOverflowConsumer + } + 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 ErrIntOverflowConsumer + } + 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 ErrIntOverflowConsumer + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthConsumer + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthConsumer + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(&m.MaturityTime, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipConsumer(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthConsumer + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipConsumer(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/ccv/consumer/types/genesis.go b/x/ccv/consumer/types/genesis.go index 09b6af6f79..e94984b3f0 100644 --- a/x/ccv/consumer/types/genesis.go +++ b/x/ccv/consumer/types/genesis.go @@ -158,7 +158,7 @@ func (gs GenesisState) Validate() error { } func (mat MaturingVSCPacket) Validate() error { - if mat.MaturityTime == 0 { + if mat.MaturityTime.IsZero() { return sdkerrors.Wrap(ccv.ErrInvalidVSCMaturedTime, "cannot have 0 maturity time") } if mat.VscId == 0 { diff --git a/x/ccv/consumer/types/genesis.pb.go b/x/ccv/consumer/types/genesis.pb.go index 3093e5ab1c..c72bf936b8 100644 --- a/x/ccv/consumer/types/genesis.pb.go +++ b/x/ccv/consumer/types/genesis.pb.go @@ -169,60 +169,6 @@ func (m *GenesisState) GetLastTransmissionBlockHeight() LastTransmissionBlockHei return LastTransmissionBlockHeight{} } -// MaturingVSCPacket defines the genesis information for the -// unbonding VSC packet -type MaturingVSCPacket struct { - VscId uint64 `protobuf:"varint,1,opt,name=vscId,proto3" json:"vscId,omitempty"` - MaturityTime uint64 `protobuf:"varint,2,opt,name=maturity_time,json=maturityTime,proto3" json:"maturity_time,omitempty"` -} - -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{1} -} -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() uint64 { - if m != nil { - return m.MaturityTime - } - return 0 -} - // HeightValsetUpdateID defines the genesis information for the mapping // of each block height to a valset update id type HeightToValsetUpdateID struct { @@ -234,7 +180,7 @@ func (m *HeightToValsetUpdateID) Reset() { *m = HeightToValsetUpdateID{} func (m *HeightToValsetUpdateID) String() string { return proto.CompactTextString(m) } func (*HeightToValsetUpdateID) ProtoMessage() {} func (*HeightToValsetUpdateID) Descriptor() ([]byte, []int) { - return fileDescriptor_2db73a6057a27482, []int{2} + return fileDescriptor_2db73a6057a27482, []int{1} } func (m *HeightToValsetUpdateID) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -287,7 +233,7 @@ func (m *OutstandingDowntime) Reset() { *m = OutstandingDowntime{} } func (m *OutstandingDowntime) String() string { return proto.CompactTextString(m) } func (*OutstandingDowntime) ProtoMessage() {} func (*OutstandingDowntime) Descriptor() ([]byte, []int) { - return fileDescriptor_2db73a6057a27482, []int{3} + return fileDescriptor_2db73a6057a27482, []int{2} } func (m *OutstandingDowntime) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -325,7 +271,6 @@ func (m *OutstandingDowntime) GetValidatorConsensusAddress() string { func init() { proto.RegisterType((*GenesisState)(nil), "interchain_security.ccv.consumer.v1.GenesisState") - proto.RegisterType((*MaturingVSCPacket)(nil), "interchain_security.ccv.consumer.v1.MaturingVSCPacket") proto.RegisterType((*HeightToValsetUpdateID)(nil), "interchain_security.ccv.consumer.v1.HeightToValsetUpdateID") proto.RegisterType((*OutstandingDowntime)(nil), "interchain_security.ccv.consumer.v1.OutstandingDowntime") } @@ -335,58 +280,56 @@ func init() { } var fileDescriptor_2db73a6057a27482 = []byte{ - // 806 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x55, 0xcf, 0x6f, 0xf3, 0x34, - 0x18, 0x6e, 0xf8, 0xfa, 0x95, 0xd6, 0xdb, 0xc7, 0xb7, 0x79, 0xa3, 0x0a, 0xad, 0x08, 0xa5, 0xe3, - 0x50, 0x09, 0x48, 0xd4, 0x22, 0x21, 0x04, 0x12, 0x82, 0x6d, 0x12, 0x54, 0x1a, 0x63, 0x6a, 0xbb, - 0x1e, 0x76, 0x89, 0x5c, 0xc7, 0x24, 0xd6, 0x12, 0xbb, 0x8a, 0x9d, 0x8c, 0x1d, 0xb8, 0x70, 0xe5, - 0xc2, 0x9f, 0xb5, 0xe3, 0x8e, 0x9c, 0x26, 0xb4, 0xfd, 0x23, 0x28, 0xb6, 0xd3, 0x1f, 0xac, 0xd3, - 0xd7, 0x53, 0x6c, 0xbf, 0xef, 0xf3, 0x3c, 0xef, 0xaf, 0xd8, 0xa0, 0x4f, 0x99, 0x24, 0x29, 0x8e, - 0x10, 0x65, 0xbe, 0x20, 0x38, 0x4b, 0xa9, 0xbc, 0xf5, 0x30, 0xce, 0x3d, 0xcc, 0x99, 0xc8, 0x12, - 0x92, 0x7a, 0x79, 0xdf, 0x0b, 0x09, 0x23, 0x82, 0x0a, 0x77, 0x9e, 0x72, 0xc9, 0xe1, 0xd1, 0x06, - 0x88, 0x8b, 0x71, 0xee, 0x96, 0x10, 0x37, 0xef, 0xb7, 0x3e, 0x7b, 0x89, 0x37, 0xef, 0x17, 0x1f, - 0x4d, 0xd5, 0x1a, 0x6c, 0xa3, 0xbe, 0xa0, 0xd5, 0x98, 0xb6, 0x24, 0x2c, 0x20, 0x69, 0x42, 0x99, - 0xf4, 0xd0, 0x0c, 0x53, 0x4f, 0xde, 0xce, 0x89, 0x89, 0xad, 0xe5, 0xd1, 0x19, 0xf6, 0x62, 0x1a, - 0x46, 0x12, 0xc7, 0x94, 0x30, 0x29, 0xbc, 0x15, 0xef, 0xbc, 0xbf, 0xb2, 0x33, 0x80, 0x4f, 0x0b, - 0x00, 0xe6, 0x29, 0xf1, 0x70, 0x84, 0x18, 0x23, 0xb1, 0x52, 0xd4, 0x4b, 0xe3, 0xe2, 0x84, 0x9c, - 0x87, 0x31, 0xf1, 0xd4, 0x6e, 0x96, 0xfd, 0xe6, 0x05, 0x59, 0x8a, 0x24, 0xe5, 0xcc, 0xd8, 0x0f, - 0x43, 0x1e, 0x72, 0xb5, 0xf4, 0x8a, 0x95, 0x3e, 0xed, 0x3e, 0xd4, 0xc1, 0xee, 0x4f, 0xba, 0x6e, - 0x63, 0x89, 0x24, 0x81, 0x43, 0x50, 0x9b, 0xa3, 0x14, 0x25, 0xc2, 0xb6, 0x3a, 0x56, 0x6f, 0x67, - 0xf0, 0xb9, 0xbb, 0x45, 0x1d, 0xdd, 0x0b, 0x05, 0x39, 0xae, 0xde, 0x3d, 0x7c, 0x52, 0x19, 0x19, - 0x02, 0xf8, 0x05, 0x80, 0xf3, 0x94, 0xe7, 0x34, 0x20, 0xa9, 0xaf, 0xf3, 0xf4, 0x69, 0x60, 0xbf, - 0xd7, 0xb1, 0x7a, 0x8d, 0xd1, 0x5e, 0x69, 0x39, 0x51, 0x86, 0x61, 0x00, 0x5d, 0x70, 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0xa8, 0xae, 0x8a, 0xea, 0x68, - 0xb7, 0x3c, 0x9c, 0xd0, 0x84, 0x74, 0xaf, 0x40, 0x73, 0xf3, 0x38, 0xc0, 0x26, 0xa8, 0x99, 0xf4, - 0x34, 0xab, 0xd9, 0xc1, 0x1e, 0xd8, 0x7b, 0x36, 0x7d, 0x9a, 0xf9, 0x83, 0x7c, 0x6d, 0x64, 0xba, - 0x97, 0xe0, 0x60, 0x43, 0x9f, 0xe1, 0xf7, 0xa0, 0x9d, 0x97, 0x03, 0xbf, 0xf2, 0xb3, 0xa3, 0x20, - 0x48, 0x89, 0xd0, 0xf7, 0x64, 0x63, 0xf4, 0xd1, 0xc2, 0x65, 0xf1, 0xff, 0xfe, 0xa8, 0x1d, 0x8e, - 0x27, 0x77, 0x8f, 0x8e, 0x75, 0xff, 0xe8, 0x58, 0xff, 0x3e, 0x3a, 0xd6, 0xdf, 0x4f, 0x4e, 0xe5, - 0xfe, 0xc9, 0xa9, 0xfc, 0xf3, 0xe4, 0x54, 0xae, 0xbe, 0x0d, 0xa9, 0x8c, 0xb2, 0x99, 0x8b, 0x79, - 0xe2, 0x61, 0x2e, 0x12, 0x2e, 0xbc, 0x65, 0x4b, 0xbe, 0x5c, 0x3c, 0x35, 0xbf, 0xaf, 0x3f, 0x36, - 0xea, 0x25, 0x99, 0xd5, 0xd4, 0x05, 0xfe, 0xd5, 0x7f, 0x01, 0x00, 0x00, 0xff, 0xff, 0x26, 0xd7, - 0xbf, 0x88, 0x1b, 0x07, 0x00, 0x00, + // 773 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x55, 0xcf, 0x6f, 0xdb, 0x36, + 0x14, 0xb6, 0x92, 0xcc, 0xb3, 0x99, 0x6c, 0xc9, 0x98, 0xcd, 0xd0, 0x6c, 0x4c, 0xf3, 0xb2, 0x1d, + 0x0c, 0x6c, 0x93, 0x60, 0x0f, 0x18, 0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0x45, 0x92, + 0x72, 0x66, 0xe2, 0x3f, 0x86, 0x3c, 0xe4, 0x6a, 0xe9, 0x15, 0x2b, 0x7d, 0xba, 0x77, 0x53, 0x03, + 0x5b, 0xcf, 0xf4, 0xdc, 0x86, 0x12, 0x49, 0x02, 0xfb, 0xa0, 0x3a, 0x41, 0x29, 0x4a, 0x84, 0x6d, + 0xb5, 0xad, 0xce, 0x66, 0xef, 0x4f, 0x77, 0x85, 0x39, 0xba, 0xc7, 0x2a, 0x65, 0x7f, 0xe3, 0xea, + 0xe6, 0xd7, 0xca, 0xc0, 0x10, 0xc0, 0xbf, 0x00, 0x9c, 0xa4, 0x3c, 0xa7, 0x01, 0x49, 0x7d, 0xdd, + 0xa7, 0x4f, 0x03, 0x7b, 0xad, 0x6d, 0x75, 0xea, 0x83, 0x9d, 0x32, 0x72, 0xa0, 0x02, 0xfd, 0x00, + 0xba, 0x60, 0x77, 0x86, 0xd6, 0x9d, 0x15, 0xf0, 0x75, 0x05, 0xff, 0x61, 0x0a, 0xd7, 0x91, 0x7e, + 0x00, 0x5b, 0xa0, 0xce, 0xc8, 0x85, 0xaf, 0x0a, 0xb3, 0x37, 0xda, 0x56, 0xa7, 0x36, 0xa8, 0x31, + 0x72, 0x71, 0x50, 0xec, 0xa1, 0x0f, 0x7e, 0xfa, 0x52, 0x5a, 0x14, 0xed, 0xd9, 0xdf, 0x94, 0x4d, + 0x8d, 0xb1, 0x3b, 0x6f, 0x80, 0x3b, 0x37, 0xf2, 0xbc, 0xeb, 0xea, 0xaa, 0xd4, 0x44, 0x06, 0xbb, + 0x8b, 0xa5, 0xea, 0x31, 0x45, 0xc0, 0x9e, 0x09, 0x70, 0x26, 0x08, 0x13, 0x99, 0x30, 0x1a, 0x55, + 0xa5, 0xe1, 0x7e, 0x55, 0xa3, 0x4c, 0xd3, 0x32, 0x8d, 0xa9, 0xcc, 0xc2, 0x39, 0x0c, 0xc1, 0x4e, + 0x82, 0x64, 0x96, 0x52, 0x16, 0xfa, 0x13, 0x84, 0xcf, 0x89, 0x14, 0xf6, 0xb7, 0xed, 0xf5, 0xce, + 0x66, 0xef, 0xdf, 0x95, 0xac, 0x79, 0x61, 0x92, 0x47, 0xc3, 0x83, 0x63, 0x95, 0x6e, 0x5c, 0xda, + 0x2e, 0x59, 0xf5, 0xa9, 0x80, 0x2f, 0xc1, 0x36, 0x65, 0x54, 0x52, 0x14, 0xfb, 0x39, 0x8a, 0x7d, + 0x41, 0xa4, 0x5d, 0x53, 0x3a, 0xed, 0xf9, 0xc2, 0x8b, 0xbb, 0xec, 0x8e, 0x50, 0x4c, 0x03, 0x24, + 0x79, 0x7a, 0x3a, 0x09, 0x90, 0x24, 0x86, 0xf1, 0x3b, 0x93, 0x3e, 0x42, 0xf1, 0x90, 0x48, 0xf8, + 0x16, 0x34, 0x23, 0x52, 0xb4, 0xef, 0x4b, 0x5e, 0x30, 0x0a, 0x22, 0xfd, 0x4c, 0xe1, 0x0b, 0x5f, + 0xeb, 0x8a, 0xfa, 0xd1, 0x4a, 0x2d, 0x3c, 0x57, 0x34, 0x27, 0x7c, 0xa4, 0x48, 0xb4, 0x66, 0xff, + 0xd0, 0xa8, 0x36, 0xa2, 0x65, 0xd1, 0x00, 0xbe, 0xb3, 0xc0, 0x2f, 0x3c, 0x93, 0x42, 0x22, 0x16, + 0x14, 0xb3, 0x0b, 0xf8, 0x05, 0x93, 0x34, 0x21, 0xbe, 0x88, 0x91, 0x88, 0x28, 0x0b, 0x6d, 0xa0, + 0x4a, 0xf8, 0x6f, 0xa5, 0x12, 0x5e, 0xcd, 0x98, 0x0e, 0x0d, 0x91, 0xd1, 0x6f, 0xf1, 0xfb, 0xa1, + 0xa1, 0x91, 0x80, 0x29, 0xb0, 0x27, 0x44, 0xeb, 0x97, 0x6c, 0x53, 0x13, 0x37, 0xd5, 0x35, 0xe9, + 0x3d, 0x28, 0x6f, 0xae, 0x48, 0x91, 0xa3, 0x2d, 0x3a, 0x44, 0x12, 0x1d, 0x51, 0x51, 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 0x00, } func (m *GenesisState) Marshal() (dAtA []byte, err error) { @@ -546,39 +489,6 @@ func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { 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 - if m.MaturityTime != 0 { - i = encodeVarintGenesis(dAtA, i, uint64(m.MaturityTime)) - i-- - dAtA[i] = 0x10 - } - if m.VscId != 0 { - i = encodeVarintGenesis(dAtA, i, uint64(m.VscId)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - func (m *HeightToValsetUpdateID) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -711,21 +621,6 @@ func (m *GenesisState) 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)) - } - if m.MaturityTime != 0 { - n += 1 + sovGenesis(uint64(m.MaturityTime)) - } - return n -} - func (m *HeightToValsetUpdateID) Size() (n int) { if m == nil { return 0 @@ -1201,94 +1096,6 @@ func (m *GenesisState) 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 != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field MaturityTime", wireType) - } - m.MaturityTime = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.MaturityTime |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - 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 *HeightToValsetUpdateID) 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 844097abb9..eb69c8cf70 100644 --- a/x/ccv/consumer/types/genesis_test.go +++ b/x/ccv/consumer/types/genesis_test.go @@ -294,9 +294,9 @@ func TestValidateRestartGenesisState(t *testing.T) { { "valid restart consumer genesis state: maturing packets", types.NewRestartGenesisState("ccvclient", "ccvchannel", []types.MaturingVSCPacket{ - {1, uint64(time.Now().UnixNano())}, - {3, uint64(time.Now().UnixNano())}, - {5, uint64(time.Now().UnixNano())}, + {1, time.Now().UTC()}, + {3, time.Now().UTC()}, + {5, time.Now().UTC()}, }, valUpdates, heightToValsetUpdateID, ccv.ConsumerPacketDataList{}, []types.OutstandingDowntime{{ValidatorConsensusAddress: sdk.ConsAddress(validator.Address.Bytes()).String()}}, types.LastTransmissionBlockHeight{}, params), @@ -310,14 +310,14 @@ func TestValidateRestartGenesisState(t *testing.T) { { "invalid restart consumer genesis state: maturing packet vscId is invalid", types.NewRestartGenesisState("ccvclient", "ccvchannel", []types.MaturingVSCPacket{ - {0, uint64(time.Now().UnixNano())}, + {0, time.Now().UTC()}, }, valUpdates, nil, ccv.ConsumerPacketDataList{}, nil, types.LastTransmissionBlockHeight{}, params), true, }, { "invalid restart consumer genesis state: maturing packet time is invalid", types.NewRestartGenesisState("ccvclient", "ccvchannel", []types.MaturingVSCPacket{ - {1, 0}, + {1, time.Time{}}, }, valUpdates, nil, ccv.ConsumerPacketDataList{}, nil, types.LastTransmissionBlockHeight{}, params), true, }, @@ -365,12 +365,12 @@ func TestValidateRestartGenesisState(t *testing.T) { { "invalid restart consumer genesis state: nil height to validator set id mapping", types.NewRestartGenesisState("ccvclient", "", - []types.MaturingVSCPacket{{1, 0}}, valUpdates, nil, ccv.ConsumerPacketDataList{}, nil, types.LastTransmissionBlockHeight{}, params), + []types.MaturingVSCPacket{{1, time.Time{}}}, valUpdates, nil, ccv.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{{1, 0}}, valUpdates, heightToValsetUpdateID, ccv.ConsumerPacketDataList{}, nil, types.LastTransmissionBlockHeight{}, params), + []types.MaturingVSCPacket{{1, time.Time{}}}, valUpdates, heightToValsetUpdateID, ccv.ConsumerPacketDataList{}, nil, types.LastTransmissionBlockHeight{}, params), true, }, { diff --git a/x/ccv/consumer/types/keys.go b/x/ccv/consumer/types/keys.go index 46fb5e9b8a..1e2d6ae0a8 100644 --- a/x/ccv/consumer/types/keys.go +++ b/x/ccv/consumer/types/keys.go @@ -2,8 +2,11 @@ package types import ( "encoding/binary" + time "time" sdk "github.com/cosmos/cosmos-sdk/types" + + utils "github.com/cosmos/interchain-security/x/ccv/utils" ) const ( @@ -99,17 +102,17 @@ func PendingChangesKey() []byte { return []byte{PendingChangesByteKey} } -// PacketMaturityTimeKey returns the key for storing maturity time for a given received VSC packet id -func PacketMaturityTimeKey(id uint64) []byte { - seqBytes := make([]byte, 8) - binary.BigEndian.PutUint64(seqBytes, id) - return append([]byte{PacketMaturityTimeBytePrefix}, seqBytes...) -} - -// IdFromPacketMaturityTimeKey returns the packet id corresponding to a maturity time full key (including prefix) -func IdFromPacketMaturityTimeKey(key []byte) uint64 { - // Bytes after single byte prefix are converted to uin64 - return binary.BigEndian.Uint64(key[1:]) +// 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 utils.AppendMany( + // Append the prefix + []byte{PacketMaturityTimeBytePrefix}, + // Append the time + sdk.Uint64ToBigEndian(ts), + // Append the vscID + sdk.Uint64ToBigEndian(vscID), + ) } // HeightValsetUpdateIDKey returns the key to a valset update ID for a given block height diff --git a/x/ccv/provider/types/keys.go b/x/ccv/provider/types/keys.go index 30a473b90d..122fbdd54f 100644 --- a/x/ccv/provider/types/keys.go +++ b/x/ccv/provider/types/keys.go @@ -7,6 +7,8 @@ import ( "time" sdk "github.com/cosmos/cosmos-sdk/types" + + ccvutils "github.com/cosmos/interchain-security/x/ccv/utils" ) type Status int @@ -173,7 +175,7 @@ func InitTimeoutTimestampKey(chainID string) []byte { // The key has the following format: PendingCAPBytePrefix | timestamp.UnixNano() | chainID func PendingCAPKey(timestamp time.Time, chainID string) []byte { ts := uint64(timestamp.UTC().UnixNano()) - return AppendMany( + return ccvutils.AppendMany( // Append the prefix []byte{PendingCAPBytePrefix}, // Append the time @@ -187,7 +189,7 @@ func PendingCAPKey(timestamp time.Time, chainID string) []byte { // The key has the following format: PendingCRPBytePrefix | timestamp.UnixNano() | chainID func PendingCRPKey(timestamp time.Time, chainID string) []byte { ts := uint64(timestamp.UTC().UnixNano()) - return AppendMany( + return ccvutils.AppendMany( // Append the prefix []byte{PendingCRPBytePrefix}, // Append the time @@ -306,7 +308,7 @@ func MustParseThrottledPacketDataKey(key []byte) (string, uint64) { // GlobalSlashEntryKey returns the key for storing a global slash queue entry. func GlobalSlashEntryKey(entry GlobalSlashEntry) []byte { recvTime := uint64(entry.RecvTime.UTC().UnixNano()) - return AppendMany( + return ccvutils.AppendMany( // Append byte prefix []byte{GlobalSlashEntryBytePrefix}, // Append time bz @@ -341,20 +343,12 @@ func ParseGlobalSlashEntryKey(bz []byte) ( return recvTime, chainID, ibcSeqNum } -// AppendMany appends a variable number of byte slices together -func AppendMany(byteses ...[]byte) (out []byte) { - for _, bytes := range byteses { - out = append(out, bytes...) - } - return out -} - // ChainIdAndTsKey returns the key with the following format: // bytePrefix | len(chainID) | chainID | timestamp func ChainIdAndTsKey(prefix byte, chainID string, timestamp time.Time) []byte { partialKey := ChainIdWithLenKey(prefix, chainID) timeBz := sdk.FormatTimeBytes(timestamp) - return AppendMany( + return ccvutils.AppendMany( // Append the partialKey partialKey, // Append the time bytes @@ -366,7 +360,7 @@ func ChainIdAndTsKey(prefix byte, chainID string, timestamp time.Time) []byte { // bytePrefix | len(chainID) | chainID func ChainIdWithLenKey(prefix byte, chainID string) []byte { chainIdL := len(chainID) - return AppendMany( + return ccvutils.AppendMany( // Append the prefix []byte{prefix}, // Append the chainID length @@ -396,7 +390,7 @@ func ParseChainIdAndTsKey(prefix byte, bz []byte) (string, time.Time, error) { // bytePrefix | len(chainID) | chainID | uint64(ID) func ChainIdAndUintIdKey(prefix byte, chainID string, uintId uint64) []byte { partialKey := ChainIdWithLenKey(prefix, chainID) - return AppendMany( + return ccvutils.AppendMany( // Append the partialKey partialKey, // Append the uint id bytes @@ -421,7 +415,7 @@ func ParseChainIdAndUintIdKey(prefix byte, bz []byte) (string, uint64, error) { // bytePrefix | len(chainID) | chainID | ConsAddress func ChainIdAndConsAddrKey(prefix byte, chainID string, addr sdk.ConsAddress) []byte { partialKey := ChainIdWithLenKey(prefix, chainID) - return AppendMany( + return ccvutils.AppendMany( // Append the partialKey partialKey, // Append the addr bytes diff --git a/x/ccv/utils/utils.go b/x/ccv/utils/utils.go index 3f1978f64f..d1b3f6f38b 100644 --- a/x/ccv/utils/utils.go +++ b/x/ccv/utils/utils.go @@ -98,3 +98,11 @@ func SendIBCPacket( return channelKeeper.SendPacket(ctx, channelCap, packet) } + +// AppendMany appends a variable number of byte slices together +func AppendMany(byteses ...[]byte) (out []byte) { + for _, bytes := range byteses { + out = append(out, bytes...) + } + return out +}