diff --git a/proto/dymensionxyz/dymension/delayedack/tx.proto b/proto/dymensionxyz/dymension/delayedack/tx.proto index 56bd62b22..ffced9525 100644 --- a/proto/dymensionxyz/dymension/delayedack/tx.proto +++ b/proto/dymensionxyz/dymension/delayedack/tx.proto @@ -13,6 +13,8 @@ service Msg { // FinalizePacket finalizes a singe packet. rpc FinalizePacket(MsgFinalizePacket) returns (MsgFinalizePacketResponse); + rpc FinalizePacketByPacketKey(MsgFinalizePacketByPacketKey) returns (MsgFinalizePacketByPacketKeyResponse); + // FinalizePacketsUntilHeight finalizes the packets for the given rollapp until the given height inclusively. rpc FinalizePacketsUntilHeight(MsgFinalizePacketsUntilHeight) returns (MsgFinalizePacketsUntilHeightResponse); @@ -41,6 +43,18 @@ message MsgFinalizePacket { message MsgFinalizePacketResponse {} +// MsgFinalizePacketByPacketKey finalizes a single packet by the packet key. +message MsgFinalizePacketByPacketKey { + option (cosmos.msg.v1.signer) = "sender"; + + // Sender is the signer of the message. + string sender = 1; + // PacketKey is a key of the packet. + string packet_key = 2; +} + +message MsgFinalizePacketByPacketKeyResponse {} + // MsgFinalizePacketsUntilHeight finalizes packets for the given rollapp until the given height inclusively. message MsgFinalizePacketsUntilHeight { option (cosmos.msg.v1.signer) = "sender"; diff --git a/proto/dymensionxyz/dymension/eibc/events.proto b/proto/dymensionxyz/dymension/eibc/events.proto index a7a303be2..c4a8016b7 100644 --- a/proto/dymensionxyz/dymension/eibc/events.proto +++ b/proto/dymensionxyz/dymension/eibc/events.proto @@ -20,7 +20,7 @@ message EventDemandOrderCreated { bool is_fulfilled = 4; // packet_status is the status of the packet. string packet_status = 5; - // packet_key is the key of the packet. + // packet_key is the base64 encoded key of the packet. string packet_key = 6; // rollapp_id is the id of the rollapp. string rollapp_id = 7; @@ -28,6 +28,8 @@ message EventDemandOrderCreated { string recipient = 8; // packet_type is the type of the packet. string packet_type = 9; + // proof_height is the height of the block when order was created. + uint64 proof_height = 10; } // EventDemandOrderPacketStatusUpdate is emitted when the status of the related packet is updated. diff --git a/x/delayedack/keeper/finalize.go b/x/delayedack/keeper/finalize.go index 4b27cf99c..eb000f17e 100644 --- a/x/delayedack/keeper/finalize.go +++ b/x/delayedack/keeper/finalize.go @@ -75,26 +75,26 @@ func (k Keeper) FinalizeRollappPacketsByReceiver(ctx sdk.Context, ibc porttypes. } // FinalizeRollappPacket finalizes a singe packet by its rollapp packet key. -func (k Keeper) FinalizeRollappPacket(ctx sdk.Context, ibc porttypes.IBCModule, rollappID string, rollappPacketKey string) error { +func (k Keeper) FinalizeRollappPacket(ctx sdk.Context, ibc porttypes.IBCModule, rollappPacketKey string) (*commontypes.RollappPacket, error) { // Get a rollapp packet packet, err := k.GetRollappPacket(ctx, rollappPacketKey) if err != nil { - return fmt.Errorf("get rollapp packet: %w", err) + return nil, fmt.Errorf("get rollapp packet: %w", err) } // Verify the height is finalized - err = k.VerifyHeightFinalized(ctx, rollappID, packet.ProofHeight) + err = k.VerifyHeightFinalized(ctx, packet.RollappId, packet.ProofHeight) if err != nil { - return fmt.Errorf("verify height is finalized: rollapp '%s': %w", rollappID, err) + return packet, fmt.Errorf("verify height is finalized: rollapp '%s': %w", packet.RollappId, err) } // Finalize the packet - err = k.finalizeRollappPacket(ctx, ibc, rollappID, *packet) + err = k.finalizeRollappPacket(ctx, ibc, packet.RollappId, *packet) if err != nil { - return fmt.Errorf("finalize rollapp packet: %w", err) + return packet, fmt.Errorf("finalize rollapp packet: %w", err) } - return nil + return packet, nil } type wrappedFunc func(ctx sdk.Context) error diff --git a/x/delayedack/keeper/msg_server.go b/x/delayedack/keeper/msg_server.go index e8e758352..01a0c7d4c 100644 --- a/x/delayedack/keeper/msg_server.go +++ b/x/delayedack/keeper/msg_server.go @@ -36,7 +36,7 @@ func (m MsgServer) FinalizePacket(goCtx context.Context, msg *types.MsgFinalizeP ctx := sdk.UnwrapSDKContext(goCtx) - err = m.k.FinalizeRollappPacket(ctx, m.ibc.NextIBCMiddleware(), msg.RollappId, string(msg.PendingPacketKey())) + _, err = m.k.FinalizeRollappPacket(ctx, m.ibc.NextIBCMiddleware(), string(msg.PendingPacketKey())) if err != nil { return nil, err } @@ -56,6 +56,45 @@ func (m MsgServer) FinalizePacket(goCtx context.Context, msg *types.MsgFinalizeP return &types.MsgFinalizePacketResponse{}, nil } +func (m MsgServer) FinalizePacketByPacketKey(goCtx context.Context, msg *types.MsgFinalizePacketByPacketKey) (*types.MsgFinalizePacketByPacketKeyResponse, error) { + err := msg.ValidateBasic() + if err != nil { + return nil, err + } + + ctx := sdk.UnwrapSDKContext(goCtx) + + packetKey := string(msg.MustDecodePacketKey()) + packet, err := m.k.FinalizeRollappPacket(ctx, m.ibc.NextIBCMiddleware(), packetKey) + if err != nil { + return nil, err + } + + var ( + sourceChannel string + sequence uint64 + ) + + if packet.Packet != nil { + sourceChannel = packet.Packet.SourceChannel + sequence = packet.Packet.Sequence + } + + err = uevent.EmitTypedEvent(ctx, &types.EventFinalizePacket{ + Sender: msg.Sender, + RollappId: packet.RollappId, + PacketProofHeight: packet.ProofHeight, + PacketType: packet.Type, + PacketSrcChannel: sourceChannel, + PacketSequence: sequence, + }) + if err != nil { + return nil, fmt.Errorf("emit event: %w", err) + } + + return &types.MsgFinalizePacketByPacketKeyResponse{}, nil +} + func (m MsgServer) FinalizePacketsUntilHeight(goCtx context.Context, msg *types.MsgFinalizePacketsUntilHeight) (*types.MsgFinalizePacketsUntilHeightResponse, error) { err := msg.ValidateBasic() if err != nil { diff --git a/x/delayedack/types/msgs.go b/x/delayedack/types/msgs.go index 4093edbf0..414e694da 100644 --- a/x/delayedack/types/msgs.go +++ b/x/delayedack/types/msgs.go @@ -1,7 +1,10 @@ package types import ( + "bytes" + "encoding/base64" "errors" + "fmt" errorsmod "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" @@ -44,6 +47,50 @@ func (m MsgFinalizePacket) PendingPacketKey() []byte { ) } +func (m MsgFinalizePacketByPacketKey) ValidateBasic() error { + _, err := sdk.AccAddressFromBech32(m.Sender) + if err != nil { + return errors.Join( + sdkerrors.ErrInvalidAddress, + errorsmod.Wrapf(err, "sender must be a valid bech32 address: %s", m.Sender), + ) + } + if len(m.PacketKey) == 0 { + return gerrc.ErrInvalidArgument.Wrap("rollappId must be non-empty") + } + + if _, err := m.DecodePacketKey(); err != nil { + return gerrc.ErrInvalidArgument.Wrap("packet key must be a valid base64 encoded string") + } + return nil +} + +func (m MsgFinalizePacketByPacketKey) GetSigners() []sdk.AccAddress { + signer, _ := sdk.AccAddressFromBech32(m.Sender) + return []sdk.AccAddress{signer} +} + +func (m MsgFinalizePacketByPacketKey) DecodePacketKey() ([]byte, error) { + // decode base64 + rollappPacketKeyBytes := make([]byte, base64.StdEncoding.DecodedLen(len(m.PacketKey))) + _, err := base64.StdEncoding.Decode(rollappPacketKeyBytes, []byte(m.PacketKey)) + if err != nil { + return nil, err + } + + rollappPacketKeyBytes = bytes.TrimRight(rollappPacketKeyBytes, "\x00") // remove padding + return rollappPacketKeyBytes, nil +} + +func (m MsgFinalizePacketByPacketKey) MustDecodePacketKey() []byte { + packetKey, err := m.DecodePacketKey() + if err != nil { + panic(fmt.Errorf("failed to decode base64 packet key: %w", err)) + } + + return packetKey +} + func (m MsgFinalizePacketsUntilHeight) ValidateBasic() error { _, err := sdk.AccAddressFromBech32(m.Sender) if err != nil { diff --git a/x/delayedack/types/tx.pb.go b/x/delayedack/types/tx.pb.go index c3d2a8963..08ad76162 100644 --- a/x/delayedack/types/tx.pb.go +++ b/x/delayedack/types/tx.pb.go @@ -156,6 +156,97 @@ func (m *MsgFinalizePacketResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgFinalizePacketResponse proto.InternalMessageInfo +// MsgFinalizePacketByPacketKey finalizes a single packet by the packet key. +type MsgFinalizePacketByPacketKey struct { + // Sender is the signer of the message. + Sender string `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty"` + // PacketKey is a key of the packet. + PacketKey string `protobuf:"bytes,2,opt,name=packet_key,json=packetKey,proto3" json:"packet_key,omitempty"` +} + +func (m *MsgFinalizePacketByPacketKey) Reset() { *m = MsgFinalizePacketByPacketKey{} } +func (m *MsgFinalizePacketByPacketKey) String() string { return proto.CompactTextString(m) } +func (*MsgFinalizePacketByPacketKey) ProtoMessage() {} +func (*MsgFinalizePacketByPacketKey) Descriptor() ([]byte, []int) { + return fileDescriptor_604a74c1ca57f5ed, []int{2} +} +func (m *MsgFinalizePacketByPacketKey) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgFinalizePacketByPacketKey) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgFinalizePacketByPacketKey.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 *MsgFinalizePacketByPacketKey) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgFinalizePacketByPacketKey.Merge(m, src) +} +func (m *MsgFinalizePacketByPacketKey) XXX_Size() int { + return m.Size() +} +func (m *MsgFinalizePacketByPacketKey) XXX_DiscardUnknown() { + xxx_messageInfo_MsgFinalizePacketByPacketKey.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgFinalizePacketByPacketKey proto.InternalMessageInfo + +func (m *MsgFinalizePacketByPacketKey) GetSender() string { + if m != nil { + return m.Sender + } + return "" +} + +func (m *MsgFinalizePacketByPacketKey) GetPacketKey() string { + if m != nil { + return m.PacketKey + } + return "" +} + +type MsgFinalizePacketByPacketKeyResponse struct { +} + +func (m *MsgFinalizePacketByPacketKeyResponse) Reset() { *m = MsgFinalizePacketByPacketKeyResponse{} } +func (m *MsgFinalizePacketByPacketKeyResponse) String() string { return proto.CompactTextString(m) } +func (*MsgFinalizePacketByPacketKeyResponse) ProtoMessage() {} +func (*MsgFinalizePacketByPacketKeyResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_604a74c1ca57f5ed, []int{3} +} +func (m *MsgFinalizePacketByPacketKeyResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgFinalizePacketByPacketKeyResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgFinalizePacketByPacketKeyResponse.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 *MsgFinalizePacketByPacketKeyResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgFinalizePacketByPacketKeyResponse.Merge(m, src) +} +func (m *MsgFinalizePacketByPacketKeyResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgFinalizePacketByPacketKeyResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgFinalizePacketByPacketKeyResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgFinalizePacketByPacketKeyResponse proto.InternalMessageInfo + // MsgFinalizePacketsUntilHeight finalizes packets for the given rollapp until the given height inclusively. type MsgFinalizePacketsUntilHeight struct { // Sender is the signer of the message. @@ -170,7 +261,7 @@ func (m *MsgFinalizePacketsUntilHeight) Reset() { *m = MsgFinalizePacket func (m *MsgFinalizePacketsUntilHeight) String() string { return proto.CompactTextString(m) } func (*MsgFinalizePacketsUntilHeight) ProtoMessage() {} func (*MsgFinalizePacketsUntilHeight) Descriptor() ([]byte, []int) { - return fileDescriptor_604a74c1ca57f5ed, []int{2} + return fileDescriptor_604a74c1ca57f5ed, []int{4} } func (m *MsgFinalizePacketsUntilHeight) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -227,7 +318,7 @@ func (m *MsgFinalizePacketsUntilHeightResponse) Reset() { *m = MsgFinali func (m *MsgFinalizePacketsUntilHeightResponse) String() string { return proto.CompactTextString(m) } func (*MsgFinalizePacketsUntilHeightResponse) ProtoMessage() {} func (*MsgFinalizePacketsUntilHeightResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_604a74c1ca57f5ed, []int{3} + return fileDescriptor_604a74c1ca57f5ed, []int{5} } func (m *MsgFinalizePacketsUntilHeightResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -271,7 +362,7 @@ func (m *MsgFinalizeRollappPacketsByReceiver) Reset() { *m = MsgFinalize func (m *MsgFinalizeRollappPacketsByReceiver) String() string { return proto.CompactTextString(m) } func (*MsgFinalizeRollappPacketsByReceiver) ProtoMessage() {} func (*MsgFinalizeRollappPacketsByReceiver) Descriptor() ([]byte, []int) { - return fileDescriptor_604a74c1ca57f5ed, []int{4} + return fileDescriptor_604a74c1ca57f5ed, []int{6} } func (m *MsgFinalizeRollappPacketsByReceiver) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -332,7 +423,7 @@ func (m *MsgFinalizeRollappPacketsByReceiverResponse) String() string { } func (*MsgFinalizeRollappPacketsByReceiverResponse) ProtoMessage() {} func (*MsgFinalizeRollappPacketsByReceiverResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_604a74c1ca57f5ed, []int{5} + return fileDescriptor_604a74c1ca57f5ed, []int{7} } func (m *MsgFinalizeRollappPacketsByReceiverResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -364,6 +455,8 @@ var xxx_messageInfo_MsgFinalizeRollappPacketsByReceiverResponse proto.InternalMe func init() { proto.RegisterType((*MsgFinalizePacket)(nil), "dymensionxyz.dymension.delayedack.MsgFinalizePacket") proto.RegisterType((*MsgFinalizePacketResponse)(nil), "dymensionxyz.dymension.delayedack.MsgFinalizePacketResponse") + proto.RegisterType((*MsgFinalizePacketByPacketKey)(nil), "dymensionxyz.dymension.delayedack.MsgFinalizePacketByPacketKey") + proto.RegisterType((*MsgFinalizePacketByPacketKeyResponse)(nil), "dymensionxyz.dymension.delayedack.MsgFinalizePacketByPacketKeyResponse") proto.RegisterType((*MsgFinalizePacketsUntilHeight)(nil), "dymensionxyz.dymension.delayedack.MsgFinalizePacketsUntilHeight") proto.RegisterType((*MsgFinalizePacketsUntilHeightResponse)(nil), "dymensionxyz.dymension.delayedack.MsgFinalizePacketsUntilHeightResponse") proto.RegisterType((*MsgFinalizeRollappPacketsByReceiver)(nil), "dymensionxyz.dymension.delayedack.MsgFinalizeRollappPacketsByReceiver") @@ -375,41 +468,44 @@ func init() { } var fileDescriptor_604a74c1ca57f5ed = []byte{ - // 531 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x94, 0x31, 0x6f, 0xd3, 0x40, - 0x14, 0xc7, 0x73, 0x4d, 0x1b, 0x91, 0x57, 0x29, 0xd0, 0x43, 0x2a, 0xc6, 0xa8, 0x56, 0x08, 0x42, - 0x8d, 0x02, 0xd8, 0x6a, 0x8a, 0x84, 0x84, 0x18, 0x50, 0x91, 0xaa, 0x32, 0x14, 0x15, 0x03, 0x0b, - 0x4b, 0xe4, 0xda, 0x8f, 0xc4, 0xaa, 0x73, 0x67, 0x7c, 0x6e, 0x14, 0x97, 0x05, 0x21, 0xd8, 0xf9, - 0x18, 0x8c, 0x15, 0x23, 0x9f, 0x80, 0xb1, 0x23, 0x23, 0x4a, 0x86, 0x7e, 0x08, 0x16, 0x14, 0xdf, - 0xc5, 0xc4, 0x44, 0x69, 0x21, 0x30, 0xd9, 0xef, 0xde, 0xbb, 0xff, 0xfb, 0xdd, 0xff, 0xec, 0x07, - 0x0d, 0x2f, 0xe9, 0x22, 0x13, 0x3e, 0x67, 0xfd, 0xe4, 0xc8, 0xca, 0x02, 0xcb, 0xc3, 0xc0, 0x49, - 0xd0, 0x73, 0xdc, 0x03, 0x2b, 0xee, 0x9b, 0x61, 0xc4, 0x63, 0x4e, 0xaf, 0x4f, 0xd6, 0x9a, 0x59, - 0x60, 0xfe, 0xaa, 0xd5, 0xaf, 0xb8, 0x5c, 0x74, 0xb9, 0xb0, 0xba, 0xa2, 0x6d, 0xf5, 0x36, 0x46, - 0x0f, 0xb9, 0x57, 0x6f, 0xce,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- 0xec, 0x97, 0xd2, 0x31, 0xb8, 0xf9, 0x33, 0x00, 0x00, 0xff, 0xff, 0x16, 0xed, 0x0f, 0x08, 0xa4, - 0x05, 0x00, 0x00, + // 584 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x95, 0x4d, 0x6f, 0xd3, 0x4c, + 0x10, 0xc7, 0xbb, 0x7d, 0x89, 0x9e, 0x4c, 0xa5, 0x3c, 0xd4, 0x48, 0xc5, 0x35, 0xd4, 0x0a, 0xe1, + 0xa5, 0x51, 0x00, 0x5b, 0x4d, 0x91, 0x90, 0x10, 0x12, 0x28, 0x48, 0xa5, 0x08, 0x15, 0x15, 0x03, + 0x17, 0x2e, 0x91, 0x63, 0x0f, 0x89, 0x15, 0xc7, 0x6b, 0xbc, 0x6e, 0x14, 0x97, 0x0b, 0x42, 0x70, + 0xe7, 0x3b, 0x20, 0x24, 0x8e, 0x15, 0x47, 0x3e, 0x01, 0xc7, 0x1e, 0x39, 0xa2, 0xe4, 0xd0, 0xaf, + 0x81, 0xe2, 0x5d, 0x9b, 0x98, 0x28, 0x29, 0xa4, 0x9c, 0x36, 0xb3, 0x33, 0xf3, 0x9f, 0x5f, 0x66, + 0x76, 0xbd, 0x50, 0xb1, 0xa3, 0x0e, 0x7a, 0xcc, 0xa1, 0x5e, 0x2f, 0x3a, 0xd0, 0x53, 0x43, 0xb7, + 0xd1, 0x35, 0x23, 0xb4, 0x4d, 0xab, 0xad, 0x87, 0x3d, 0xcd, 0x0f, 0x68, 0x48, 0xa5, 0x8b, 0xa3, + 0xb1, 0x5a, 0x6a, 0x68, 0xbf, 0x62, 0x95, 0x73, 0x16, 0x65, 0x1d, 0xca, 0xf4, 0x0e, 0x6b, 0xea, + 0xdd, 0xcd, 0xe1, 0xc2, 0x73, 0x95, 0xea, 0x84, 0x3a, 0x16, 0xed, 0x74, 0xa8, 0xa7, 0x07, 0xd4, + 0x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0xea, 0xab, 0xe4, + 0x47, 0x5f, 0x25, 0x1f, 0x06, 0xea, 0xdc, 0xd1, 0x40, 0x9d, 0xfb, 0x3e, 0x50, 0xe7, 0x5e, 0xdc, + 0x6a, 0x3a, 0x61, 0x6b, 0xbf, 0x31, 0xfc, 0xae, 0xea, 0x13, 0x5e, 0x8e, 0xee, 0x96, 0xde, 0xcb, + 0x3c, 0x53, 0x91, 0x8f, 0xac, 0x91, 0x8b, 0x9f, 0x8e, 0xad, 0x9f, 0x01, 0x00, 0x00, 0xff, 0xff, + 0xe1, 0xca, 0x2c, 0xf7, 0xd8, 0x06, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -426,6 +522,7 @@ const _ = grpc.SupportPackageIsVersion4 type MsgClient interface { // FinalizePacket finalizes a singe packet. FinalizePacket(ctx context.Context, in *MsgFinalizePacket, opts ...grpc.CallOption) (*MsgFinalizePacketResponse, error) + FinalizePacketByPacketKey(ctx context.Context, in *MsgFinalizePacketByPacketKey, opts ...grpc.CallOption) (*MsgFinalizePacketByPacketKeyResponse, error) // FinalizePacketsUntilHeight finalizes the packets for the given rollapp until the given height inclusively. FinalizePacketsUntilHeight(ctx context.Context, in *MsgFinalizePacketsUntilHeight, opts ...grpc.CallOption) (*MsgFinalizePacketsUntilHeightResponse, error) // FinalizeRollappPacketsByReceiver finalizes the rollapp packets for the specified receiver until the latest @@ -450,6 +547,15 @@ func (c *msgClient) FinalizePacket(ctx context.Context, in *MsgFinalizePacket, o return out, nil } +func (c *msgClient) FinalizePacketByPacketKey(ctx context.Context, in *MsgFinalizePacketByPacketKey, opts ...grpc.CallOption) (*MsgFinalizePacketByPacketKeyResponse, error) { + out := new(MsgFinalizePacketByPacketKeyResponse) + err := c.cc.Invoke(ctx, "/dymensionxyz.dymension.delayedack.Msg/FinalizePacketByPacketKey", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + func (c *msgClient) FinalizePacketsUntilHeight(ctx context.Context, in *MsgFinalizePacketsUntilHeight, opts ...grpc.CallOption) (*MsgFinalizePacketsUntilHeightResponse, error) { out := new(MsgFinalizePacketsUntilHeightResponse) err := c.cc.Invoke(ctx, "/dymensionxyz.dymension.delayedack.Msg/FinalizePacketsUntilHeight", in, out, opts...) @@ -472,6 +578,7 @@ func (c *msgClient) FinalizeRollappPacketsByReceiver(ctx context.Context, in *Ms type MsgServer interface { // FinalizePacket finalizes a singe packet. FinalizePacket(context.Context, *MsgFinalizePacket) (*MsgFinalizePacketResponse, error) + FinalizePacketByPacketKey(context.Context, *MsgFinalizePacketByPacketKey) (*MsgFinalizePacketByPacketKeyResponse, error) // FinalizePacketsUntilHeight finalizes the packets for the given rollapp until the given height inclusively. FinalizePacketsUntilHeight(context.Context, *MsgFinalizePacketsUntilHeight) (*MsgFinalizePacketsUntilHeightResponse, error) // FinalizeRollappPacketsByReceiver finalizes the rollapp packets for the specified receiver until the latest @@ -486,6 +593,9 @@ type UnimplementedMsgServer struct { func (*UnimplementedMsgServer) FinalizePacket(ctx context.Context, req *MsgFinalizePacket) (*MsgFinalizePacketResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method FinalizePacket not implemented") } +func (*UnimplementedMsgServer) FinalizePacketByPacketKey(ctx context.Context, req *MsgFinalizePacketByPacketKey) (*MsgFinalizePacketByPacketKeyResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method FinalizePacketByPacketKey not implemented") +} func (*UnimplementedMsgServer) FinalizePacketsUntilHeight(ctx context.Context, req *MsgFinalizePacketsUntilHeight) (*MsgFinalizePacketsUntilHeightResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method FinalizePacketsUntilHeight not implemented") } @@ -515,6 +625,24 @@ func _Msg_FinalizePacket_Handler(srv interface{}, ctx context.Context, dec func( return interceptor(ctx, in, info, handler) } +func _Msg_FinalizePacketByPacketKey_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgFinalizePacketByPacketKey) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).FinalizePacketByPacketKey(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/dymensionxyz.dymension.delayedack.Msg/FinalizePacketByPacketKey", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).FinalizePacketByPacketKey(ctx, req.(*MsgFinalizePacketByPacketKey)) + } + return interceptor(ctx, in, info, handler) +} + func _Msg_FinalizePacketsUntilHeight_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(MsgFinalizePacketsUntilHeight) if err := dec(in); err != nil { @@ -559,6 +687,10 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ MethodName: "FinalizePacket", Handler: _Msg_FinalizePacket_Handler, }, + { + MethodName: "FinalizePacketByPacketKey", + Handler: _Msg_FinalizePacketByPacketKey_Handler, + }, { MethodName: "FinalizePacketsUntilHeight", Handler: _Msg_FinalizePacketsUntilHeight_Handler, @@ -654,6 +786,66 @@ func (m *MsgFinalizePacketResponse) MarshalToSizedBuffer(dAtA []byte) (int, erro return len(dAtA) - i, nil } +func (m *MsgFinalizePacketByPacketKey) 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 *MsgFinalizePacketByPacketKey) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgFinalizePacketByPacketKey) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.PacketKey) > 0 { + i -= len(m.PacketKey) + copy(dAtA[i:], m.PacketKey) + i = encodeVarintTx(dAtA, i, uint64(len(m.PacketKey))) + i-- + dAtA[i] = 0x12 + } + if len(m.Sender) > 0 { + i -= len(m.Sender) + copy(dAtA[i:], m.Sender) + i = encodeVarintTx(dAtA, i, uint64(len(m.Sender))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgFinalizePacketByPacketKeyResponse) 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 *MsgFinalizePacketByPacketKeyResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgFinalizePacketByPacketKeyResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + func (m *MsgFinalizePacketsUntilHeight) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -836,6 +1028,32 @@ func (m *MsgFinalizePacketResponse) Size() (n int) { return n } +func (m *MsgFinalizePacketByPacketKey) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Sender) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.PacketKey) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgFinalizePacketByPacketKeyResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + func (m *MsgFinalizePacketsUntilHeight) Size() (n int) { if m == nil { return 0 @@ -1154,6 +1372,170 @@ func (m *MsgFinalizePacketResponse) Unmarshal(dAtA []byte) error { } return nil } +func (m *MsgFinalizePacketByPacketKey) 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 ErrIntOverflowTx + } + 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: MsgFinalizePacketByPacketKey: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgFinalizePacketByPacketKey: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Sender", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Sender = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PacketKey", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.PacketKey = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgFinalizePacketByPacketKeyResponse) 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 ErrIntOverflowTx + } + 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: MsgFinalizePacketByPacketKeyResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgFinalizePacketByPacketKeyResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func (m *MsgFinalizePacketsUntilHeight) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 diff --git a/x/eibc/keeper/handler.go b/x/eibc/keeper/handler.go index f8d0ca980..c2cfae26c 100644 --- a/x/eibc/keeper/handler.go +++ b/x/eibc/keeper/handler.go @@ -53,7 +53,7 @@ func (k Keeper) EIBCDemandOrderHandler(ctx sdk.Context, rollappPacket commontype return fmt.Errorf("set eibc demand order: %w", err) } - if err = uevent.EmitTypedEvent(ctx, eibcDemandOrder.GetCreatedEvent()); err != nil { + if err = uevent.EmitTypedEvent(ctx, eibcDemandOrder.GetCreatedEvent(rollappPacket.ProofHeight)); err != nil { return fmt.Errorf("emit event: %w", err) } diff --git a/x/eibc/types/demand_order.go b/x/eibc/types/demand_order.go index a97e132a0..09dbf103c 100644 --- a/x/eibc/types/demand_order.go +++ b/x/eibc/types/demand_order.go @@ -2,6 +2,7 @@ package types import ( "crypto/sha256" + "encoding/base64" "encoding/hex" "cosmossdk.io/math" @@ -70,17 +71,19 @@ func (m *DemandOrder) Validate() error { return nil } -func (m *DemandOrder) GetCreatedEvent() *EventDemandOrderCreated { +func (m *DemandOrder) GetCreatedEvent(proofHeight uint64) *EventDemandOrderCreated { + packetKey := base64.StdEncoding.EncodeToString([]byte(m.TrackingPacketKey)) return &EventDemandOrderCreated{ OrderId: m.Id, Price: m.Price.String(), Fee: m.Fee.String(), IsFulfilled: m.IsFulfilled(), PacketStatus: m.TrackingPacketStatus.String(), - PacketKey: m.TrackingPacketKey, + PacketKey: packetKey, RollappId: m.RollappId, Recipient: m.Recipient, PacketType: m.Type.String(), + ProofHeight: proofHeight, } } diff --git a/x/eibc/types/events.pb.go b/x/eibc/types/events.pb.go index e865b0c42..4a08fb165 100644 --- a/x/eibc/types/events.pb.go +++ b/x/eibc/types/events.pb.go @@ -36,7 +36,7 @@ type EventDemandOrderCreated struct { IsFulfilled bool `protobuf:"varint,4,opt,name=is_fulfilled,json=isFulfilled,proto3" json:"is_fulfilled,omitempty"` // packet_status is the status of the packet. PacketStatus string `protobuf:"bytes,5,opt,name=packet_status,json=packetStatus,proto3" json:"packet_status,omitempty"` - // packet_key is the key of the packet. + // packet_key is the base64 encoded key of the packet. PacketKey string `protobuf:"bytes,6,opt,name=packet_key,json=packetKey,proto3" json:"packet_key,omitempty"` // rollapp_id is the id of the rollapp. RollappId string `protobuf:"bytes,7,opt,name=rollapp_id,json=rollappId,proto3" json:"rollapp_id,omitempty"` @@ -44,6 +44,8 @@ type EventDemandOrderCreated struct { Recipient string `protobuf:"bytes,8,opt,name=recipient,proto3" json:"recipient,omitempty"` // packet_type is the type of the packet. PacketType string `protobuf:"bytes,9,opt,name=packet_type,json=packetType,proto3" json:"packet_type,omitempty"` + // proof_height is the height of the block when order was created. + ProofHeight uint64 `protobuf:"varint,10,opt,name=proof_height,json=proofHeight,proto3" json:"proof_height,omitempty"` } func (m *EventDemandOrderCreated) Reset() { *m = EventDemandOrderCreated{} } @@ -142,6 +144,13 @@ func (m *EventDemandOrderCreated) GetPacketType() string { return "" } +func (m *EventDemandOrderCreated) GetProofHeight() uint64 { + if m != nil { + return m.ProofHeight + } + return 0 +} + // EventDemandOrderPacketStatusUpdate is emitted when the status of the related packet is updated. type EventDemandOrderPacketStatusUpdated struct { // order_id is the unique identifier of the demand order. @@ -373,37 +382,38 @@ func init() { } var fileDescriptor_87abe4479c806cf7 = []byte{ - // 469 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x53, 0xcb, 0x6e, 0x13, 0x31, - 0x14, 0xcd, 0x34, 0x34, 0xc9, 0xdc, 0x96, 0x97, 0x55, 0xa9, 0xd3, 0x50, 0x86, 0x92, 0x0a, 0x29, - 0x62, 0x31, 0x23, 0xe8, 0x1f, 0xf0, 0x88, 0x54, 0x75, 0x41, 0x09, 0xb0, 0x61, 0x33, 0x9a, 0x8c, - 0x6f, 0x82, 0xd5, 0x89, 0x6d, 0xcd, 0x38, 0x4d, 0x87, 0xaf, 0xe0, 0x17, 0xf8, 0x09, 0xbe, 0x81, - 0x65, 0x97, 0x2c, 0x51, 0x22, 0xfe, 0x03, 0xd9, 0x9e, 0x84, 0x30, 0x51, 0x80, 0x25, 0x3b, 0xdf, - 0x73, 0x8f, 0x8f, 0x8f, 0xef, 0xb1, 0xa1, 0x4b, 0x8b, 0x31, 0xf2, 0x9c, 0x09, 0x7e, 0x55, 0x7c, - 0x0c, 0x97, 0x45, 0x88, 0x6c, 0x90, 0x84, 0x78, 0x89, 0x5c, 0xe5, 0x81, 0xcc, 0x84, 0x12, 0xe4, - 0xde, 0x2a, 0x33, 0x58, 0x16, 0x81, 0x66, 0xb6, 0xf7, 0x46, 0x62, 0x24, 0x0c, 0x2f, 0xd4, 0x2b, - 0xbb, 0xa5, 0xfd, 0x78, 0x83, 0x78, 0x22, 0xc6, 0x63, 0xc1, 0xc3, 0x5c, 0xc5, 0x6a, 0x52, 0xca, - 0xb7, 0x83, 0x3f, 0x19, 0xa1, 0x38, 0x8e, 0x39, 0x8d, 0x44, 0x46, 0x31, 0xb3, 0xfc, 0xce, 0xe7, - 0x2d, 0xd8, 0x7f, 0xa9, 0xfd, 0xbd, 0x30, 0xbd, 0x57, 0xba, 0xf5, 0x3c, 0xc3, 0x58, 0x21, 0x25, - 0x07, 0xd0, 0x32, 0xd4, 0x88, 0x51, 0xcf, 0x39, 0x72, 0xba, 0x6e, 0xbf, 0x69, 0xea, 0x53, 0x4a, - 0xf6, 0x60, 0x5b, 0x66, 0x2c, 0x41, 0x6f, 0xcb, 0xe0, 0xb6, 0x20, 0x77, 0xa0, 0x3e, 0x44, 0xf4, - 0xea, 0x06, 0xd3, 0x4b, 0xf2, 0x10, 0x76, 0x59, 0x1e, 0x0d, 0x27, 0xe9, 0x90, 0xa5, 0x29, 0x52, - 0xef, 0xc6, 0x91, 0xd3, 0x6d, 0xf5, 0x77, 0x58, 0xde, 0x5b, 0x40, 0xe4, 0x18, 0x6e, 0xca, 0x38, - 0xb9, 0x40, 0x15, 0xd9, 0x8b, 0x78, 0xdb, 0x66, 0xfb, 0xae, 0x05, 0xdf, 0x18, 0x8c, 0xdc, 0x07, - 0x28, 0x49, 0x17, 0x58, 0x78, 0x0d, 0xc3, 0x70, 0x2d, 0x72, 0x86, 0x85, 0x6e, 0x67, 0x22, 0x4d, - 0x63, 0x29, 0xb5, 0xd7, 0xa6, 0x6d, 0x97, 0xc8, 0x29, 0x25, 0x87, 0xe0, 0x66, 0x98, 0x30, 0xc9, - 0x90, 0x2b, 0xaf, 0x55, 0x76, 0x17, 0x00, 0x79, 0x00, 0x3b, 0xa5, 0xb6, 0x2a, 0x24, 0x7a, 0xae, - 0xe9, 0x97, 0xc7, 0xbd, 0x2d, 0x24, 0x76, 0xbe, 0x38, 0x70, 0x5c, 0x9d, 0xd1, 0xf9, 0x8a, 0xbb, - 0x77, 0x92, 0xfe, 0x6d, 0x5e, 0xaf, 0xe1, 0x2e, 0xc7, 0x69, 0xf4, 0xfb, 0x45, 0xf5, 0xec, 0x6e, - 0x3d, 0x7d, 0x14, 0x6c, 0x78, 0x11, 0x36, 0xde, 0xc0, 0x9e, 0xd1, 0xbf, 0xcd, 0x71, 0xba, 0x7a, - 0xe8, 0xda, 0x68, 0xeb, 0x6b, 0xa3, 0xed, 0x9c, 0x43, 0xbb, 0xea, 0xbb, 0x87, 0xf8, 0x0f, 0x76, - 0xf7, 0xa1, 0xa9, 0xed, 0xea, 0x30, 0x6d, 0xc0, 0x0d, 0x8e, 0xd3, 0x1e, 0x62, 0xe7, 0x87, 0x03, - 0x07, 0x6b, 0x92, 0xcb, 0x28, 0xff, 0xa3, 0x07, 0x73, 0x08, 0xee, 0x42, 0x24, 0x2b, 0x23, 0xfd, - 0x05, 0x54, 0x23, 0x87, 0x6a, 0xe4, 0xcf, 0xce, 0xbe, 0xce, 0x7c, 0xe7, 0x7a, 0xe6, 0x3b, 0xdf, - 0x67, 0xbe, 0xf3, 0x69, 0xee, 0xd7, 0xae, 0xe7, 0x7e, 0xed, 0xdb, 0xdc, 0xaf, 0xbd, 0x7f, 0x32, - 0x62, 0xea, 0xc3, 0x64, 0xa0, 0xd3, 0x09, 0x37, 0xfc, 0xb5, 0xcb, 0x93, 0xf0, 0xca, 0x7e, 0x38, - 0xad, 0x9e, 0x0f, 0x1a, 0xe6, 0xab, 0x9d, 0xfc, 0x0c, 0x00, 0x00, 0xff, 0xff, 0xa0, 0x6d, 0xea, - 0xf7, 0x25, 0x04, 0x00, 0x00, + // 491 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x53, 0xcd, 0x6e, 0xd3, 0x40, + 0x10, 0x8e, 0x9b, 0x36, 0x89, 0x27, 0xe5, 0xcf, 0xaa, 0x54, 0x37, 0x14, 0x13, 0x52, 0x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x78, 0xa0, 0x92, 0xe2, + 0xa4, 0x83, 0xd8, 0xfa, 0x69, 0xc1, 0xd1, 0x46, 0xc9, 0xe5, 0xb4, 0x6f, 0x90, 0xa7, 0x8e, 0xc1, + 0x5e, 0x14, 0x11, 0xc5, 0xd4, 0x7f, 0x03, 0xeb, 0xae, 0x80, 0x75, 0x57, 0x3c, 0x3f, 0xff, 0x36, + 0xf3, 0xac, 0xe9, 0xcc, 0xb3, 0x7e, 0xcc, 0x3c, 0xeb, 0xf3, 0xdc, 0x2b, 0x4d, 0xe7, 0x5e, 0xe9, + 0xfb, 0xdc, 0x2b, 0x7d, 0x7c, 0x3a, 0xa0, 0x72, 0x38, 0xee, 0xa9, 0xe9, 0x04, 0x5b, 0xd6, 0xf1, + 0xea, 0x34, 0xb8, 0x36, 0x3b, 0xa9, 0xaa, 0x67, 0xbd, 0x8a, 0xde, 0xc6, 0xd3, 0x5f, 0x01, 0x00, + 0x00, 0xff, 0xff, 0xa8, 0xca, 0xea, 0xe9, 0x48, 0x04, 0x00, 0x00, } func (m *EventDemandOrderCreated) Marshal() (dAtA []byte, err error) { @@ -426,6 +436,11 @@ func (m *EventDemandOrderCreated) MarshalToSizedBuffer(dAtA []byte) (int, error) _ = i var l int _ = l + if m.ProofHeight != 0 { + i = encodeVarintEvents(dAtA, i, uint64(m.ProofHeight)) + i-- + dAtA[i] = 0x50 + } if len(m.PacketType) > 0 { i -= len(m.PacketType) copy(dAtA[i:], m.PacketType) @@ -704,6 +719,9 @@ func (m *EventDemandOrderCreated) Size() (n int) { if l > 0 { n += 1 + l + sovEvents(uint64(l)) } + if m.ProofHeight != 0 { + n += 1 + sovEvents(uint64(m.ProofHeight)) + } return n } @@ -1090,6 +1108,25 @@ func (m *EventDemandOrderCreated) Unmarshal(dAtA []byte) error { } m.PacketType = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex + case 10: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ProofHeight", wireType) + } + m.ProofHeight = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ProofHeight |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } default: iNdEx = preIndex skippy, err := skipEvents(dAtA[iNdEx:])