diff --git a/proto/interchain_security/ccv/v1/ccv.proto b/proto/interchain_security/ccv/v1/ccv.proto index ffae373aa6..1f3722a234 100644 --- a/proto/interchain_security/ccv/v1/ccv.proto +++ b/proto/interchain_security/ccv/v1/ccv.proto @@ -84,4 +84,42 @@ enum ConsumerPacketDataType { // VSCMatured packet CONSUMER_PACKET_TYPE_VSCM = 2 [ (gogoproto.enumvalue_customname) = "VscMaturedPacket" ]; -} \ No newline at end of file +} + +// ConsumerPacketData contains a consumer packet data and a type tag +// that is compatible with ICS v1 and v2 over the wire. It is not used for internal storage. +message ConsumerPacketDataV1 { + ConsumerPacketDataType type = 1; + + oneof data { + SlashPacketDataV1 slashPacketData = 2; + VSCMaturedPacketData vscMaturedPacketData = 3; + } +} + +// This packet is sent from the consumer chain to the provider chain +// It is backward compatible with the ICS v1 and v2 version of the packet. +message SlashPacketDataV1 { + tendermint.abci.Validator validator = 1 [ + (gogoproto.nullable) = false, + (gogoproto.moretags) = "yaml:\"validator\"" + ]; + // map to the infraction block height on the provider + uint64 valset_update_id = 2; + // tell if the slashing is for a downtime or a double-signing infraction + InfractionType infraction = 3; +} + +// InfractionType indicates the infraction type a validator commited. +// NOTE: ccv.InfractionType to maintain compatibility between ICS versions +// using different versions of the cosmos-sdk and ibc-go modules. +enum InfractionType { + option (gogoproto.goproto_enum_prefix) = false; + + // UNSPECIFIED defines an empty infraction type. + INFRACTION_TYPE_UNSPECIFIED = 0 [(gogoproto.enumvalue_customname) = "InfractionEmpty"]; + // DOUBLE_SIGN defines a validator that double-signs a block. + INFRACTION_TYPE_DOUBLE_SIGN = 1 [(gogoproto.enumvalue_customname) = "DoubleSign"]; + // DOWNTIME defines a validator that missed signing too many blocks. + INFRACTION_TYPE_DOWNTIME = 2 [(gogoproto.enumvalue_customname) = "Downtime"]; +} diff --git a/tests/integration/throttle.go b/tests/integration/throttle.go index 92800cd1bb..0620bdd6b6 100644 --- a/tests/integration/throttle.go +++ b/tests/integration/throttle.go @@ -9,6 +9,7 @@ import ( channeltypes "github.com/cosmos/ibc-go/v7/modules/core/04-channel/types" icstestingutils "github.com/cosmos/interchain-security/v3/testutil/ibc_testing" + "github.com/cosmos/interchain-security/v3/x/ccv/provider" providertypes "github.com/cosmos/interchain-security/v3/x/ccv/provider/types" ccvtypes "github.com/cosmos/interchain-security/v3/x/ccv/types" ) @@ -314,8 +315,8 @@ func (s *CCVTestSuite) TestPacketSpam() { // Recv 500 packets from consumer to provider in same block for _, packet := range packets { - consumerPacketData := ccvtypes.ConsumerPacketData{} - ccvtypes.ModuleCdc.MustUnmarshalJSON(packet.GetData(), &consumerPacketData) + consumerPacketData, err := provider.UnmarshalConsumerPacket(packet) // Same func used by provider's OnRecvPacket + s.Require().NoError(err) providerKeeper.OnRecvSlashPacket(s.providerCtx(), packet, *consumerPacketData.GetSlashPacketData()) } @@ -368,8 +369,8 @@ func (s *CCVTestSuite) TestDoubleSignDoesNotAffectThrottling() { // Recv 500 packets from consumer to provider in same block for _, packet := range packets { - consumerPacketData := ccvtypes.ConsumerPacketData{} - ccvtypes.ModuleCdc.MustUnmarshalJSON(packet.GetData(), &consumerPacketData) + consumerPacketData, err := provider.UnmarshalConsumerPacket(packet) // Same func used by provider's OnRecvPacket + s.Require().NoError(err) providerKeeper.OnRecvSlashPacket(s.providerCtx(), packet, *consumerPacketData.GetSlashPacketData()) } @@ -464,8 +465,10 @@ func (s *CCVTestSuite) TestQueueOrdering() { // Recv 500 packets from consumer to provider in same block for i, packet := range packets { - consumerPacketData := ccvtypes.ConsumerPacketData{} - ccvtypes.ModuleCdc.MustUnmarshalJSON(packet.GetData(), &consumerPacketData) + + consumerPacketData, err := provider.UnmarshalConsumerPacket(packet) // Same func used by provider's OnRecvPacket + s.Require().NoError(err) + // Type depends on index packets were appended from above if (i+5)%10 == 0 { vscMaturedPacketData := consumerPacketData.GetVscMaturedPacketData() @@ -678,8 +681,8 @@ func (s *CCVTestSuite) TestSlashSameValidator() { // Recv and queue all slash packets. for _, packet := range packets { - consumerPacketData := ccvtypes.ConsumerPacketData{} - ccvtypes.ModuleCdc.MustUnmarshalJSON(packet.GetData(), &consumerPacketData) + consumerPacketData, err := provider.UnmarshalConsumerPacket(packet) // Same func used by provider's OnRecvPacket + s.Require().NoError(err) providerKeeper.OnRecvSlashPacket(s.providerCtx(), packet, *consumerPacketData.GetSlashPacketData()) } @@ -739,8 +742,8 @@ func (s CCVTestSuite) TestSlashAllValidators() { //nolint:govet // this is a tes // Recv and queue all slash packets. for _, packet := range packets { - consumerPacketData := ccvtypes.ConsumerPacketData{} - ccvtypes.ModuleCdc.MustUnmarshalJSON(packet.GetData(), &consumerPacketData) + consumerPacketData, err := provider.UnmarshalConsumerPacket(packet) // Same func used by provider's OnRecvPacket + s.Require().NoError(err) providerKeeper.OnRecvSlashPacket(s.providerCtx(), packet, *consumerPacketData.GetSlashPacketData()) } @@ -786,10 +789,9 @@ func (s *CCVTestSuite) TestLeadingVSCMaturedAreDequeued() { ibcSeqNum := uint64(i) packet := s.constructSlashPacketFromConsumer(*bundle, *s.providerChain.Vals.Validators[0], stakingtypes.Infraction_INFRACTION_DOWNTIME, ibcSeqNum) - packetData := ccvtypes.ConsumerPacketData{} - ccvtypes.ModuleCdc.MustUnmarshalJSON(packet.GetData(), &packetData) - providerKeeper.OnRecvSlashPacket(s.providerCtx(), - packet, *packetData.GetSlashPacketData()) + consumerPacketData, err := provider.UnmarshalConsumerPacket(packet) // Same func used by provider's OnRecvPacket + s.Require().NoError(err) + providerKeeper.OnRecvSlashPacket(s.providerCtx(), packet, *consumerPacketData.GetSlashPacketData()) } } @@ -877,10 +879,9 @@ func (s *CCVTestSuite) TestVscMaturedHandledPerBlockLimit() { ibcSeqNum := uint64(i) packet := s.constructSlashPacketFromConsumer(*bundle, *s.providerChain.Vals.Validators[0], stakingtypes.Infraction_INFRACTION_DOWNTIME, ibcSeqNum) - packetData := ccvtypes.ConsumerPacketData{} - ccvtypes.ModuleCdc.MustUnmarshalJSON(packet.GetData(), &packetData) - providerKeeper.OnRecvSlashPacket(s.providerCtx(), - packet, *packetData.GetSlashPacketData()) + consumerPacketData, err := provider.UnmarshalConsumerPacket(packet) // Same func used by provider's OnRecvPacket + s.Require().NoError(err) + providerKeeper.OnRecvSlashPacket(s.providerCtx(), packet, *consumerPacketData.GetSlashPacketData()) } } diff --git a/x/ccv/provider/ibc_module.go b/x/ccv/provider/ibc_module.go index df0f6066a3..698d37385b 100644 --- a/x/ccv/provider/ibc_module.go +++ b/x/ccv/provider/ibc_module.go @@ -174,29 +174,26 @@ func (am AppModule) OnRecvPacket( packet channeltypes.Packet, _ sdk.AccAddress, ) ibcexported.Acknowledgement { - var ( - ack ibcexported.Acknowledgement - consumerPacket ccv.ConsumerPacketData - ) - // unmarshall consumer packet - if err := ccv.ModuleCdc.UnmarshalJSON(packet.GetData(), &consumerPacket); err != nil { - errAck := ccv.NewErrorAcknowledgementWithLog(ctx, fmt.Errorf("cannot unmarshal CCV packet data")) + consumerPacket, err := UnmarshalConsumerPacket(packet) + if err != nil { + errAck := ccv.NewErrorAcknowledgementWithLog(ctx, err) + return &errAck + } + + // TODO: call ValidateBasic method on consumer packet data + // See: https://github.com/cosmos/interchain-security/issues/634 + + var ack ibcexported.Acknowledgement + switch consumerPacket.Type { + case ccv.VscMaturedPacket: + // handle VSCMaturedPacket + ack = am.keeper.OnRecvVSCMaturedPacket(ctx, packet, *consumerPacket.GetVscMaturedPacketData()) + case ccv.SlashPacket: + // handle SlashPacket + ack = am.keeper.OnRecvSlashPacket(ctx, packet, *consumerPacket.GetSlashPacketData()) + default: + errAck := ccv.NewErrorAcknowledgementWithLog(ctx, fmt.Errorf("invalid consumer packet type: %q", consumerPacket.Type)) ack = &errAck - } else { - // TODO: call ValidateBasic method on consumer packet data - // See: https://github.com/cosmos/interchain-security/issues/634 - - switch consumerPacket.Type { - case ccv.VscMaturedPacket: - // handle VSCMaturedPacket - ack = am.keeper.OnRecvVSCMaturedPacket(ctx, packet, *consumerPacket.GetVscMaturedPacketData()) - case ccv.SlashPacket: - // handle SlashPacket - ack = am.keeper.OnRecvSlashPacket(ctx, packet, *consumerPacket.GetSlashPacketData()) - default: - errAck := ccv.NewErrorAcknowledgementWithLog(ctx, fmt.Errorf("invalid consumer packet type: %q", consumerPacket.Type)) - ack = &errAck - } } ctx.EventManager().EmitEvent( @@ -210,6 +207,33 @@ func (am AppModule) OnRecvPacket( return ack } +func UnmarshalConsumerPacket(packet channeltypes.Packet) (consumerPacket ccv.ConsumerPacketData, err error) { + // First try unmarshaling into ccv.ConsumerPacketData type + if err := ccv.ModuleCdc.UnmarshalJSON(packet.GetData(), &consumerPacket); err != nil { + // If failed, packet should be a v1 slash packet, retry for ConsumerPacketDataV1 packet type + var v1Packet ccv.ConsumerPacketDataV1 + errV1 := ccv.ModuleCdc.UnmarshalJSON(packet.GetData(), &v1Packet) + if errV1 != nil { + // If neither worked, return error + return ccv.ConsumerPacketData{}, errV1 + } + + // VSC matured packets should not be unmarshaled as v1 packets + if v1Packet.Type == ccv.VscMaturedPacket { + return ccv.ConsumerPacketData{}, fmt.Errorf("VSC matured packets should be correctly unmarshaled") + } + + // Convert from v1 packet type + consumerPacket = ccv.ConsumerPacketData{ + Type: v1Packet.Type, + Data: &ccv.ConsumerPacketData_SlashPacketData{ + SlashPacketData: v1Packet.GetSlashPacketData().FromV1(), + }, + } + } + return consumerPacket, nil +} + // OnAcknowledgementPacket implements the IBCModule interface func (am AppModule) OnAcknowledgementPacket( ctx sdk.Context, diff --git a/x/ccv/provider/ibc_module_test.go b/x/ccv/provider/ibc_module_test.go index 42279fbb73..96e0eb97d1 100644 --- a/x/ccv/provider/ibc_module_test.go +++ b/x/ccv/provider/ibc_module_test.go @@ -7,6 +7,7 @@ import ( authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types" + "github.com/cosmos/ibc-go/v7/modules/core/02-client/types" conntypes "github.com/cosmos/ibc-go/v7/modules/core/03-connection/types" channeltypes "github.com/cosmos/ibc-go/v7/modules/core/04-channel/types" host "github.com/cosmos/ibc-go/v7/modules/core/24-host" @@ -338,3 +339,62 @@ func TestOnChanOpenConfirm(t *testing.T) { ctrl.Finish() } } + +func TestUnmarshalConsumerPacket(t *testing.T) { + testCases := []struct { + name string + packet channeltypes.Packet + expectedPacketData ccv.ConsumerPacketData + }{ + { + name: "vsc matured", + packet: channeltypes.NewPacket( + ccv.ConsumerPacketData{ + Type: ccv.VscMaturedPacket, + Data: &ccv.ConsumerPacketData_VscMaturedPacketData{ + VscMaturedPacketData: &ccv.VSCMaturedPacketData{ + ValsetUpdateId: 420, + }, + }, + }.GetBytes(), + 342, "sourcePort", "sourceChannel", "destinationPort", "destinationChannel", types.Height{}, 0, + ), + expectedPacketData: ccv.ConsumerPacketData{ + Type: ccv.VscMaturedPacket, + Data: &ccv.ConsumerPacketData_VscMaturedPacketData{ + VscMaturedPacketData: &ccv.VSCMaturedPacketData{ + ValsetUpdateId: 420, + }, + }, + }, + }, + { + name: "slash packet", + packet: channeltypes.NewPacket( + ccv.ConsumerPacketData{ + Type: ccv.SlashPacket, + Data: &ccv.ConsumerPacketData_SlashPacketData{ + SlashPacketData: &ccv.SlashPacketData{ + ValsetUpdateId: 789, + }, + }, + }.GetBytes(), // Note packet data is converted to v1 bytes here + 342, "sourcePort", "sourceChannel", "destinationPort", "destinationChannel", types.Height{}, 0, + ), + expectedPacketData: ccv.ConsumerPacketData{ + Type: ccv.SlashPacket, + Data: &ccv.ConsumerPacketData_SlashPacketData{ + SlashPacketData: &ccv.SlashPacketData{ + ValsetUpdateId: 789, + }, + }, + }, + }, + } + + for _, tc := range testCases { + actualConsumerPacketData, err := provider.UnmarshalConsumerPacket(tc.packet) + require.NoError(t, err) + require.Equal(t, tc.expectedPacketData, actualConsumerPacketData) + } +} diff --git a/x/ccv/provider/proposal_handler_test.go b/x/ccv/provider/proposal_handler_test.go index 4f78695935..a85853a246 100644 --- a/x/ccv/provider/proposal_handler_test.go +++ b/x/ccv/provider/proposal_handler_test.go @@ -81,7 +81,8 @@ func TestProviderProposalHandler(t *testing.T) { { name: "unsupported proposal type", // lint rule disabled because this is a test case for an unsupported proposal type - content: &distributiontypes.CommunityPoolSpendProposal{ // nolint:staticcheck + // nolint:staticcheck + content: &distributiontypes.CommunityPoolSpendProposal{ Title: "title", Description: "desc", Recipient: "", diff --git a/x/ccv/types/ccv.go b/x/ccv/types/ccv.go index 62111a7b65..e7739b4c2f 100644 --- a/x/ccv/types/ccv.go +++ b/x/ccv/types/ccv.go @@ -59,6 +59,23 @@ func NewSlashPacketData(validator abci.Validator, valUpdateId uint64, infraction } } +// NewSlashPacketDataV1 creates a new SlashPacketDataV1 that uses ccv.InfractionTypes to maintain backward compatibility. +func NewSlashPacketDataV1(validator abci.Validator, valUpdateId uint64, infractionType stakingtypes.Infraction) *SlashPacketDataV1 { + v1Type := InfractionEmpty + switch infractionType { + case stakingtypes.Infraction_INFRACTION_DOWNTIME: + v1Type = Downtime + case stakingtypes.Infraction_INFRACTION_DOUBLE_SIGN: + v1Type = DoubleSign + } + + return &SlashPacketDataV1{ + Validator: validator, + ValsetUpdateId: valUpdateId, + Infraction: v1Type, + } +} + func (vdt SlashPacketData) ValidateBasic() error { if len(vdt.Validator.Address) == 0 || vdt.Validator.Power == 0 { return errorsmod.Wrap(ErrInvalidPacketData, "validator fields cannot be empty") @@ -76,6 +93,10 @@ func (vdt SlashPacketData) GetBytes() []byte { return valDowntimeBytes } +func (vdt SlashPacketData) ToV1() *SlashPacketDataV1 { + return NewSlashPacketDataV1(vdt.Validator, vdt.ValsetUpdateId, vdt.Infraction) +} + func (cp ConsumerPacketData) ValidateBasic() (err error) { switch cp.Type { case VscMaturedPacket: @@ -99,7 +120,45 @@ func (cp ConsumerPacketData) ValidateBasic() (err error) { return } +// Convert to bytes while maintaining over the wire compatibility with previous versions. func (cp ConsumerPacketData) GetBytes() []byte { - bytes := ModuleCdc.MustMarshalJSON(&cp) + return cp.ToV1Bytes() +} + +// ToV1Bytes converts the ConsumerPacketData to JSON byte array compatible +// with the format used by ICS versions using cosmos-sdk v45 (ICS v1 and ICS v2). +func (cp ConsumerPacketData) ToV1Bytes() []byte { + if cp.Type != SlashPacket { + bytes := ModuleCdc.MustMarshalJSON(&cp) + return bytes + } + + sp := cp.GetSlashPacketData() + spdv1 := NewSlashPacketDataV1(sp.Validator, sp.ValsetUpdateId, sp.Infraction) + cpv1 := ConsumerPacketDataV1{ + Type: cp.Type, + Data: &ConsumerPacketDataV1_SlashPacketData{ + SlashPacketData: spdv1, + }, + } + bytes := ModuleCdc.MustMarshalJSON(&cpv1) return bytes } + +// FromV1 converts SlashPacketDataV1 to SlashPacketData. +// Provider must handle both V1 and later versions of the SlashPacketData. +func (vdt1 SlashPacketDataV1) FromV1() *SlashPacketData { + newType := stakingtypes.Infraction_INFRACTION_UNSPECIFIED + switch vdt1.Infraction { + case Downtime: + newType = stakingtypes.Infraction_INFRACTION_DOWNTIME + case DoubleSign: + newType = stakingtypes.Infraction_INFRACTION_DOUBLE_SIGN + } + + return &SlashPacketData{ + Validator: vdt1.Validator, + ValsetUpdateId: vdt1.ValsetUpdateId, + Infraction: newType, + } +} diff --git a/x/ccv/types/ccv.pb.go b/x/ccv/types/ccv.pb.go index 21d0b32f0b..c2f0bd3ecc 100644 --- a/x/ccv/types/ccv.pb.go +++ b/x/ccv/types/ccv.pb.go @@ -57,6 +57,40 @@ func (ConsumerPacketDataType) EnumDescriptor() ([]byte, []int) { return fileDescriptor_68bd5f3242e6f29c, []int{0} } +// InfractionType indicates the infraction type a validator commited. +// NOTE: ccv.InfractionType to maintain compatibility between ICS versions +// using different versions of the cosmos-sdk and ibc-go modules. +type InfractionType int32 + +const ( + // UNSPECIFIED defines an empty infraction type. + InfractionEmpty InfractionType = 0 + // DOUBLE_SIGN defines a validator that double-signs a block. + DoubleSign InfractionType = 1 + // DOWNTIME defines a validator that missed signing too many blocks. + Downtime InfractionType = 2 +) + +var InfractionType_name = map[int32]string{ + 0: "INFRACTION_TYPE_UNSPECIFIED", + 1: "INFRACTION_TYPE_DOUBLE_SIGN", + 2: "INFRACTION_TYPE_DOWNTIME", +} + +var InfractionType_value = map[string]int32{ + "INFRACTION_TYPE_UNSPECIFIED": 0, + "INFRACTION_TYPE_DOUBLE_SIGN": 1, + "INFRACTION_TYPE_DOWNTIME": 2, +} + +func (x InfractionType) String() string { + return proto.EnumName(InfractionType_name, int32(x)) +} + +func (InfractionType) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_68bd5f3242e6f29c, []int{1} +} + // This packet is sent from provider chain to consumer chain if the validator // set for consumer chain changes (due to new bonding/unbonding messages or // slashing events) A VSCMatured packet from consumer chain will be sent @@ -466,8 +500,168 @@ func (m *ConsumerPacketDataList) GetList() []ConsumerPacketData { return nil } +// ConsumerPacketData contains a consumer packet data and a type tag +// that is compatible with ICS v1 and v2 over the wire. It is not used for internal storage. +type ConsumerPacketDataV1 struct { + Type ConsumerPacketDataType `protobuf:"varint,1,opt,name=type,proto3,enum=interchain_security.ccv.v1.ConsumerPacketDataType" json:"type,omitempty"` + // Types that are valid to be assigned to Data: + // *ConsumerPacketDataV1_SlashPacketData + // *ConsumerPacketDataV1_VscMaturedPacketData + Data isConsumerPacketDataV1_Data `protobuf_oneof:"data"` +} + +func (m *ConsumerPacketDataV1) Reset() { *m = ConsumerPacketDataV1{} } +func (m *ConsumerPacketDataV1) String() string { return proto.CompactTextString(m) } +func (*ConsumerPacketDataV1) ProtoMessage() {} +func (*ConsumerPacketDataV1) Descriptor() ([]byte, []int) { + return fileDescriptor_68bd5f3242e6f29c, []int{7} +} +func (m *ConsumerPacketDataV1) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ConsumerPacketDataV1) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ConsumerPacketDataV1.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 *ConsumerPacketDataV1) XXX_Merge(src proto.Message) { + xxx_messageInfo_ConsumerPacketDataV1.Merge(m, src) +} +func (m *ConsumerPacketDataV1) XXX_Size() int { + return m.Size() +} +func (m *ConsumerPacketDataV1) XXX_DiscardUnknown() { + xxx_messageInfo_ConsumerPacketDataV1.DiscardUnknown(m) +} + +var xxx_messageInfo_ConsumerPacketDataV1 proto.InternalMessageInfo + +type isConsumerPacketDataV1_Data interface { + isConsumerPacketDataV1_Data() + MarshalTo([]byte) (int, error) + Size() int +} + +type ConsumerPacketDataV1_SlashPacketData struct { + SlashPacketData *SlashPacketDataV1 `protobuf:"bytes,2,opt,name=slashPacketData,proto3,oneof" json:"slashPacketData,omitempty"` +} +type ConsumerPacketDataV1_VscMaturedPacketData struct { + VscMaturedPacketData *VSCMaturedPacketData `protobuf:"bytes,3,opt,name=vscMaturedPacketData,proto3,oneof" json:"vscMaturedPacketData,omitempty"` +} + +func (*ConsumerPacketDataV1_SlashPacketData) isConsumerPacketDataV1_Data() {} +func (*ConsumerPacketDataV1_VscMaturedPacketData) isConsumerPacketDataV1_Data() {} + +func (m *ConsumerPacketDataV1) GetData() isConsumerPacketDataV1_Data { + if m != nil { + return m.Data + } + return nil +} + +func (m *ConsumerPacketDataV1) GetType() ConsumerPacketDataType { + if m != nil { + return m.Type + } + return UnspecifiedPacket +} + +func (m *ConsumerPacketDataV1) GetSlashPacketData() *SlashPacketDataV1 { + if x, ok := m.GetData().(*ConsumerPacketDataV1_SlashPacketData); ok { + return x.SlashPacketData + } + return nil +} + +func (m *ConsumerPacketDataV1) GetVscMaturedPacketData() *VSCMaturedPacketData { + if x, ok := m.GetData().(*ConsumerPacketDataV1_VscMaturedPacketData); ok { + return x.VscMaturedPacketData + } + return nil +} + +// XXX_OneofWrappers is for the internal use of the proto package. +func (*ConsumerPacketDataV1) XXX_OneofWrappers() []interface{} { + return []interface{}{ + (*ConsumerPacketDataV1_SlashPacketData)(nil), + (*ConsumerPacketDataV1_VscMaturedPacketData)(nil), + } +} + +// This packet is sent from the consumer chain to the provider chain +// It is backward compatible with the ICS v1 and v2 version of the packet. +type SlashPacketDataV1 struct { + Validator types.Validator `protobuf:"bytes,1,opt,name=validator,proto3" json:"validator" yaml:"validator"` + // map to the infraction block height on the provider + ValsetUpdateId uint64 `protobuf:"varint,2,opt,name=valset_update_id,json=valsetUpdateId,proto3" json:"valset_update_id,omitempty"` + // tell if the slashing is for a downtime or a double-signing infraction + Infraction InfractionType `protobuf:"varint,3,opt,name=infraction,proto3,enum=interchain_security.ccv.v1.InfractionType" json:"infraction,omitempty"` +} + +func (m *SlashPacketDataV1) Reset() { *m = SlashPacketDataV1{} } +func (m *SlashPacketDataV1) String() string { return proto.CompactTextString(m) } +func (*SlashPacketDataV1) ProtoMessage() {} +func (*SlashPacketDataV1) Descriptor() ([]byte, []int) { + return fileDescriptor_68bd5f3242e6f29c, []int{8} +} +func (m *SlashPacketDataV1) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *SlashPacketDataV1) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_SlashPacketDataV1.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 *SlashPacketDataV1) XXX_Merge(src proto.Message) { + xxx_messageInfo_SlashPacketDataV1.Merge(m, src) +} +func (m *SlashPacketDataV1) XXX_Size() int { + return m.Size() +} +func (m *SlashPacketDataV1) XXX_DiscardUnknown() { + xxx_messageInfo_SlashPacketDataV1.DiscardUnknown(m) +} + +var xxx_messageInfo_SlashPacketDataV1 proto.InternalMessageInfo + +func (m *SlashPacketDataV1) GetValidator() types.Validator { + if m != nil { + return m.Validator + } + return types.Validator{} +} + +func (m *SlashPacketDataV1) GetValsetUpdateId() uint64 { + if m != nil { + return m.ValsetUpdateId + } + return 0 +} + +func (m *SlashPacketDataV1) GetInfraction() InfractionType { + if m != nil { + return m.Infraction + } + return InfractionEmpty +} + func init() { proto.RegisterEnum("interchain_security.ccv.v1.ConsumerPacketDataType", ConsumerPacketDataType_name, ConsumerPacketDataType_value) + proto.RegisterEnum("interchain_security.ccv.v1.InfractionType", InfractionType_name, InfractionType_value) proto.RegisterType((*ValidatorSetChangePacketData)(nil), "interchain_security.ccv.v1.ValidatorSetChangePacketData") proto.RegisterType((*ValidatorSetChangePackets)(nil), "interchain_security.ccv.v1.ValidatorSetChangePackets") proto.RegisterType((*VSCMaturedPacketData)(nil), "interchain_security.ccv.v1.VSCMaturedPacketData") @@ -475,6 +669,8 @@ func init() { proto.RegisterType((*MaturedUnbondingOps)(nil), "interchain_security.ccv.v1.MaturedUnbondingOps") proto.RegisterType((*ConsumerPacketData)(nil), "interchain_security.ccv.v1.ConsumerPacketData") proto.RegisterType((*ConsumerPacketDataList)(nil), "interchain_security.ccv.v1.ConsumerPacketDataList") + proto.RegisterType((*ConsumerPacketDataV1)(nil), "interchain_security.ccv.v1.ConsumerPacketDataV1") + proto.RegisterType((*SlashPacketDataV1)(nil), "interchain_security.ccv.v1.SlashPacketDataV1") } func init() { @@ -482,51 +678,60 @@ func init() { } var fileDescriptor_68bd5f3242e6f29c = []byte{ - // 697 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x94, 0xcf, 0x6a, 0xdb, 0x4a, - 0x14, 0xc6, 0xa5, 0x58, 0x04, 0x32, 0x86, 0x44, 0xd1, 0xf5, 0xbd, 0x38, 0xba, 0xad, 0x22, 0x44, - 0xa0, 0xa6, 0xa5, 0x52, 0xad, 0x74, 0x51, 0xda, 0x4d, 0x63, 0xc7, 0xc1, 0xa6, 0xf9, 0x63, 0xa4, - 0x38, 0xa5, 0xdd, 0x88, 0xb1, 0x34, 0xb1, 0x07, 0xdb, 0x1a, 0xa3, 0x19, 0x8b, 0xfa, 0x0d, 0x4a, - 0x56, 0x7d, 0x81, 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 0xec, 0x5c, 0x15, 0x4f, 0x66, 0x68, 0xc9, 0xc2, - 0xd7, 0xef, 0x0a, 0x57, 0x3a, 0xbc, 0xb8, 0x51, 0xf8, 0xcb, 0x1b, 0x85, 0xff, 0x7d, 0xa3, 0xf0, - 0xdf, 0x6e, 0x15, 0xee, 0xf2, 0x56, 0xe1, 0xae, 0x6e, 0x15, 0xee, 0xf3, 0xeb, 0x16, 0x66, 0xed, - 0x41, 0x53, 0x77, 0x49, 0xcf, 0x48, 0x56, 0xeb, 0x1d, 0xaa, 0x97, 0x93, 0x1d, 0x1d, 0x6e, 0x1b, - 0x5f, 0xe2, 0x45, 0x1d, 0xaf, 0xcc, 0xe6, 0x72, 0xbc, 0x33, 0xb7, 0xff, 0x06, 0x00, 0x00, 0xff, - 0xff, 0xc0, 0xe2, 0x3f, 0x59, 0xd0, 0x05, 0x00, 0x00, + // 836 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x56, 0xcf, 0x6e, 0xe2, 0x46, + 0x1c, 0xb6, 0x01, 0xad, 0x9a, 0xa1, 0x22, 0xce, 0x2c, 0xad, 0x58, 0x6f, 0xcb, 0x5a, 0xd6, 0x4a, + 0x45, 0xa9, 0xd6, 0x2e, 0x64, 0x0f, 0x55, 0x7b, 0x69, 0x00, 0xa7, 0x71, 0x9b, 0x90, 0xc8, 0x06, + 0x56, 0xdb, 0x8b, 0x35, 0xd8, 0x13, 0x32, 0x0a, 0xd8, 0xc8, 0x33, 0xb8, 0xe5, 0x0d, 0x2a, 0x4e, + 0x7d, 0x01, 0x4e, 0x55, 0x0f, 0xfb, 0x18, 0xbd, 0xed, 0x71, 0xa5, 0x5e, 0xf6, 0xd2, 0xa8, 0x4a, + 0xde, 0xa0, 0x4f, 0x50, 0xd9, 0xfc, 0xc7, 0x06, 0x29, 0x52, 0xa5, 0xf6, 0x84, 0x19, 0xff, 0xbe, + 0x4f, 0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xff, 0x8f, 0xbf, 0xfc, 0xd2, + 0x88, 0x08, 0x00, 0x00, } func (m *ValidatorSetChangePacketData) Marshal() (dAtA []byte, err error) { @@ -845,6 +1050,128 @@ func (m *ConsumerPacketDataList) MarshalToSizedBuffer(dAtA []byte) (int, error) return len(dAtA) - i, nil } +func (m *ConsumerPacketDataV1) 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 *ConsumerPacketDataV1) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ConsumerPacketDataV1) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Data != nil { + { + size := m.Data.Size() + i -= size + if _, err := m.Data.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + } + } + if m.Type != 0 { + i = encodeVarintCcv(dAtA, i, uint64(m.Type)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *ConsumerPacketDataV1_SlashPacketData) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ConsumerPacketDataV1_SlashPacketData) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + if m.SlashPacketData != nil { + { + size, err := m.SlashPacketData.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintCcv(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + return len(dAtA) - i, nil +} +func (m *ConsumerPacketDataV1_VscMaturedPacketData) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ConsumerPacketDataV1_VscMaturedPacketData) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + if m.VscMaturedPacketData != nil { + { + size, err := m.VscMaturedPacketData.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintCcv(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + return len(dAtA) - i, nil +} +func (m *SlashPacketDataV1) 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 *SlashPacketDataV1) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *SlashPacketDataV1) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Infraction != 0 { + i = encodeVarintCcv(dAtA, i, uint64(m.Infraction)) + i-- + dAtA[i] = 0x18 + } + if m.ValsetUpdateId != 0 { + i = encodeVarintCcv(dAtA, i, uint64(m.ValsetUpdateId)) + i-- + dAtA[i] = 0x10 + } + { + size, err := m.Validator.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintCcv(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + func encodeVarintCcv(dAtA []byte, offset int, v uint64) int { offset -= sovCcv(v) base := offset @@ -994,13 +1321,69 @@ func (m *ConsumerPacketDataList) Size() (n int) { return n } -func sovCcv(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 +func (m *ConsumerPacketDataV1) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Type != 0 { + n += 1 + sovCcv(uint64(m.Type)) + } + if m.Data != nil { + n += m.Data.Size() + } + return n } -func sozCcv(x uint64) (n int) { - return sovCcv(uint64((x << 1) ^ uint64((int64(x) >> 63)))) + +func (m *ConsumerPacketDataV1_SlashPacketData) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.SlashPacketData != nil { + l = m.SlashPacketData.Size() + n += 1 + l + sovCcv(uint64(l)) + } + return n } -func (m *ValidatorSetChangePacketData) Unmarshal(dAtA []byte) error { +func (m *ConsumerPacketDataV1_VscMaturedPacketData) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.VscMaturedPacketData != nil { + l = m.VscMaturedPacketData.Size() + n += 1 + l + sovCcv(uint64(l)) + } + return n +} +func (m *SlashPacketDataV1) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Validator.Size() + n += 1 + l + sovCcv(uint64(l)) + if m.ValsetUpdateId != 0 { + n += 1 + sovCcv(uint64(m.ValsetUpdateId)) + } + if m.Infraction != 0 { + n += 1 + sovCcv(uint64(m.Infraction)) + } + return n +} + +func sovCcv(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozCcv(x uint64) (n int) { + return sovCcv(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *ValidatorSetChangePacketData) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1758,6 +2141,266 @@ func (m *ConsumerPacketDataList) Unmarshal(dAtA []byte) error { } return nil } +func (m *ConsumerPacketDataV1) 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 ErrIntOverflowCcv + } + 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: ConsumerPacketDataV1: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ConsumerPacketDataV1: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType) + } + m.Type = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCcv + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Type |= ConsumerPacketDataType(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SlashPacketData", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCcv + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthCcv + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthCcv + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + v := &SlashPacketDataV1{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.Data = &ConsumerPacketDataV1_SlashPacketData{v} + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field VscMaturedPacketData", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCcv + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthCcv + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthCcv + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + v := &VSCMaturedPacketData{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.Data = &ConsumerPacketDataV1_VscMaturedPacketData{v} + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipCcv(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthCcv + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *SlashPacketDataV1) 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 ErrIntOverflowCcv + } + 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: SlashPacketDataV1: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: SlashPacketDataV1: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Validator", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCcv + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthCcv + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthCcv + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Validator.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ValsetUpdateId", wireType) + } + m.ValsetUpdateId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCcv + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ValsetUpdateId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Infraction", wireType) + } + m.Infraction = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCcv + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Infraction |= InfractionType(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipCcv(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthCcv + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipCcv(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0