From 1d780e94b9e037974b147ca6623be1e3ca0bdb65 Mon Sep 17 00:00:00 2001 From: Matija Martinic Date: Thu, 28 Jul 2022 16:03:35 +0200 Subject: [PATCH] Delete stale jobs from consensus queues --- proto/consensus/consensus_queue.proto | 19 +- x/consensus/keeper/attest.go | 4 +- x/consensus/keeper/concensus_keeper.go | 36 +++- x/consensus/keeper/consensus/consensus.go | 8 +- x/consensus/keeper/consensus/types.go | 9 + .../keeper/grpc_query_get_all_queue_names.go | 8 +- x/consensus/module.go | 3 + x/consensus/types/consensus.go | 3 + x/consensus/types/consensus_queue.pb.go | 192 +++++++++++++----- 9 files changed, 220 insertions(+), 62 deletions(-) diff --git a/proto/consensus/consensus_queue.proto b/proto/consensus/consensus_queue.proto index f9c29675..2f559b4c 100644 --- a/proto/consensus/consensus_queue.proto +++ b/proto/consensus/consensus_queue.proto @@ -1,6 +1,7 @@ syntax = "proto3"; import "google/protobuf/any.proto"; import "gogoproto/gogo.proto"; +import "google/protobuf/timestamp.proto"; package volumefi.paloma.consensus; @@ -9,12 +10,20 @@ option go_package = "github.com/palomachain/paloma/x/consensus/types"; // message for storing the queued signed message in the internal queue message QueuedSignedMessage { uint64 id = 1; - google.protobuf.Any msg = 2; - bytes bytesToSign = 3; - repeated SignData signData = 4; - repeated Evidence evidence = 5; - PublicAccessData publicAccessData = 6; + int64 addedAtBlockHeight = 2; + google.protobuf.Timestamp addedAt = 3 [ + (gogoproto.nullable) = false, + (gogoproto.stdtime) = true + ]; + + google.protobuf.Any msg = 4; + bytes bytesToSign = 5; + + repeated SignData signData = 6; + repeated Evidence evidence = 7; + + PublicAccessData publicAccessData = 8; } message BatchOfConsensusMessages { diff --git a/x/consensus/keeper/attest.go b/x/consensus/keeper/attest.go index 4be479de..a860e0d4 100644 --- a/x/consensus/keeper/attest.go +++ b/x/consensus/keeper/attest.go @@ -2,6 +2,7 @@ package keeper import ( sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/palomachain/paloma/x/consensus/keeper/consensus" ) // CheckAndProcessAttestedMessages is supposed to be used within the @@ -18,7 +19,8 @@ func (k Keeper) CheckAndProcessAttestedMessages(ctx sdk.Context) error { if err != nil { return err } - for _, opt := range opts { + for _, queueName := range consensus.SortedQueueNames(ctx, opts) { + opt := opts[queueName] msgs, err := k.GetMessagesFromQueue(ctx, opt.QueueTypeName, 9999) if err != nil { continue diff --git a/x/consensus/keeper/concensus_keeper.go b/x/consensus/keeper/concensus_keeper.go index e99f8a00..394c095a 100644 --- a/x/consensus/keeper/concensus_keeper.go +++ b/x/consensus/keeper/concensus_keeper.go @@ -2,6 +2,7 @@ package keeper import ( "fmt" + "time" codectypes "github.com/cosmos/cosmos-sdk/codec/types" sdk "github.com/cosmos/cosmos-sdk/types" @@ -12,7 +13,8 @@ import ( ) const ( - encodingDelimiter = byte('|') + encodingDelimiter = byte('|') + deleteJobAfterDuration = 30 * time.Minute ) // getConsensusQueue gets the consensus queue for the given type. @@ -288,3 +290,35 @@ func (k Keeper) queuedMessageToMessageToSign(msg types.QueuedSignedMessageI) *ty Msg: anyMsg, } } + +func (k Keeper) RemoveUnexecutedJobs(ctx sdk.Context) error { + now := ctx.BlockTime() + + for _, supported := range k.registry.slice { + queuesMap, err := supported.SupportedQueues(ctx) + if err != nil { + return err + } + for _, queueName := range consensus.SortedQueueNames(ctx, queuesMap) { + cq, err := k.getConsensusQueue(ctx, queueName) + if err != nil { + return err + } + + jobs, err := cq.GetAll(ctx) + if err != nil { + return err + } + + for _, job := range jobs { + if now.Sub(job.GetAddedAt()) >= deleteJobAfterDuration { + if err := cq.Remove(ctx, job.GetId()); err != nil { + return err + } + } + } + } + } + + return nil +} diff --git a/x/consensus/keeper/consensus/consensus.go b/x/consensus/keeper/consensus/consensus.go index bbc7089e..336ca438 100644 --- a/x/consensus/keeper/consensus/consensus.go +++ b/x/consensus/keeper/consensus/consensus.go @@ -139,9 +139,11 @@ func (c Queue) Put(ctx sdk.Context, msgs ...ConsensusMsg) error { return err } queuedMsg := &types.QueuedSignedMessage{ - Id: newID, - Msg: anyMsg, - SignData: []*types.SignData{}, + Id: newID, + Msg: anyMsg, + SignData: []*types.SignData{}, + AddedAtBlockHeight: ctx.BlockHeight(), + AddedAt: ctx.BlockTime(), BytesToSign: c.qo.BytesToSignCalculator(msg, types.Salt{ Nonce: nonce, }), diff --git a/x/consensus/keeper/consensus/types.go b/x/consensus/keeper/consensus/types.go index fb2b2895..3ebd1d20 100644 --- a/x/consensus/keeper/consensus/types.go +++ b/x/consensus/keeper/consensus/types.go @@ -1,7 +1,10 @@ package consensus import ( + "sort" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/palomachain/paloma/util/slice" "github.com/palomachain/paloma/x/consensus/types" ) @@ -40,3 +43,9 @@ type SupportsConsensusQueueAction struct { type SupportsConsensusQueue interface { SupportedQueues(ctx sdk.Context) (map[string]SupportsConsensusQueueAction, error) } + +func SortedQueueNames(ctx sdk.Context, queuesMap map[string]SupportsConsensusQueueAction) []string { + queueNames := slice.FromMapKeys(queuesMap) + sort.Strings(queueNames) + return queueNames +} diff --git a/x/consensus/keeper/grpc_query_get_all_queue_names.go b/x/consensus/keeper/grpc_query_get_all_queue_names.go index e2a7e787..824f4c5f 100644 --- a/x/consensus/keeper/grpc_query_get_all_queue_names.go +++ b/x/consensus/keeper/grpc_query_get_all_queue_names.go @@ -4,6 +4,7 @@ import ( "context" sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/palomachain/paloma/x/consensus/keeper/consensus" "github.com/palomachain/paloma/x/consensus/types" "github.com/vizualni/whoops" "google.golang.org/grpc/codes" @@ -16,10 +17,11 @@ func (k Keeper) GetAllQueueNames(goCtx context.Context, req *types.QueryGetAllQu } names := []string{} + ctx := sdk.UnwrapSDKContext(goCtx) + for _, supported := range k.registry.slice { - for queue := range whoops.Must(supported.SupportedQueues(sdk.UnwrapSDKContext(goCtx))) { - names = append(names, queue) - } + queuesMap := whoops.Must(supported.SupportedQueues(ctx)) + names = append(names, consensus.SortedQueueNames(ctx, queuesMap)...) } return &types.QueryGetAllQueueNamesResponse{ diff --git a/x/consensus/module.go b/x/consensus/module.go index ee1588f6..c02103e7 100644 --- a/x/consensus/module.go +++ b/x/consensus/module.go @@ -173,5 +173,8 @@ func (am AppModule) BeginBlock(ctx sdk.Context, _ abci.RequestBeginBlock) { // EndBlock executes all ABCI EndBlock logic respective to the capability module. It // returns no validator updates. func (am AppModule) EndBlock(ctx sdk.Context, _ abci.RequestEndBlock) []abci.ValidatorUpdate { + if ctx.BlockHeight()%10 == 9 { + am.keeper.RemoveUnexecutedJobs(ctx) + } return EndBlocker(ctx, am.keeper) } diff --git a/x/consensus/types/consensus.go b/x/consensus/types/consensus.go index 79483b22..9d11a144 100644 --- a/x/consensus/types/consensus.go +++ b/x/consensus/types/consensus.go @@ -5,6 +5,7 @@ import ( types "github.com/cosmos/cosmos-sdk/codec/types" sdk "github.com/cosmos/cosmos-sdk/types" proto "github.com/gogo/protobuf/proto" + "time" ) type ConsensusQueueType string @@ -14,6 +15,8 @@ type QueuedSignedMessageI interface { proto.Message GetId() uint64 Nonce() []byte + GetAddedAtBlockHeight() int64 + GetAddedAt() time.Time ConsensusMsg(AnyUnpacker) (ConsensusMsg, error) GetSignData() []*SignData AddSignData(*SignData) diff --git a/x/consensus/types/consensus_queue.pb.go b/x/consensus/types/consensus_queue.pb.go index 2075801b..c96d0222 100644 --- a/x/consensus/types/consensus_queue.pb.go +++ b/x/consensus/types/consensus_queue.pb.go @@ -9,15 +9,19 @@ import ( github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" _ "github.com/gogo/protobuf/gogoproto" proto "github.com/gogo/protobuf/proto" + github_com_gogo_protobuf_types "github.com/gogo/protobuf/types" + _ "google.golang.org/protobuf/types/known/timestamppb" io "io" math "math" math_bits "math/bits" + time "time" ) // Reference imports to suppress errors if they are not otherwise used. var _ = proto.Marshal var _ = fmt.Errorf var _ = math.Inf +var _ = time.Kitchen // This is a compile-time assertion to ensure that this generated file // is compatible with the proto package it is being compiled against. @@ -27,12 +31,14 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // message for storing the queued signed message in the internal queue type QueuedSignedMessage struct { - Id uint64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` - Msg *types.Any `protobuf:"bytes,2,opt,name=msg,proto3" json:"msg,omitempty"` - BytesToSign []byte `protobuf:"bytes,3,opt,name=bytesToSign,proto3" json:"bytesToSign,omitempty"` - SignData []*SignData `protobuf:"bytes,4,rep,name=signData,proto3" json:"signData,omitempty"` - Evidence []*Evidence `protobuf:"bytes,5,rep,name=evidence,proto3" json:"evidence,omitempty"` - PublicAccessData *PublicAccessData `protobuf:"bytes,6,opt,name=publicAccessData,proto3" json:"publicAccessData,omitempty"` + Id uint64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` + AddedAtBlockHeight int64 `protobuf:"varint,2,opt,name=addedAtBlockHeight,proto3" json:"addedAtBlockHeight,omitempty"` + AddedAt time.Time `protobuf:"bytes,3,opt,name=addedAt,proto3,stdtime" json:"addedAt"` + Msg *types.Any `protobuf:"bytes,4,opt,name=msg,proto3" json:"msg,omitempty"` + BytesToSign []byte `protobuf:"bytes,5,opt,name=bytesToSign,proto3" json:"bytesToSign,omitempty"` + SignData []*SignData `protobuf:"bytes,6,rep,name=signData,proto3" json:"signData,omitempty"` + Evidence []*Evidence `protobuf:"bytes,7,rep,name=evidence,proto3" json:"evidence,omitempty"` + PublicAccessData *PublicAccessData `protobuf:"bytes,8,opt,name=publicAccessData,proto3" json:"publicAccessData,omitempty"` } func (m *QueuedSignedMessage) Reset() { *m = QueuedSignedMessage{} } @@ -75,6 +81,20 @@ func (m *QueuedSignedMessage) GetId() uint64 { return 0 } +func (m *QueuedSignedMessage) GetAddedAtBlockHeight() int64 { + if m != nil { + return m.AddedAtBlockHeight + } + return 0 +} + +func (m *QueuedSignedMessage) GetAddedAt() time.Time { + if m != nil { + return m.AddedAt + } + return time.Time{} +} + func (m *QueuedSignedMessage) GetMsg() *types.Any { if m != nil { return m.Msg @@ -398,40 +418,44 @@ func init() { func init() { proto.RegisterFile("consensus/consensus_queue.proto", fileDescriptor_4cd502dda0bddc7c) } var fileDescriptor_4cd502dda0bddc7c = []byte{ - // 526 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x54, 0x4f, 0x8b, 0xd3, 0x40, - 0x14, 0xef, 0xf4, 0xcf, 0xd2, 0x9d, 0x2e, 0xb2, 0x8c, 0x45, 0xb2, 0x8b, 0x64, 0x43, 0x04, 0x09, - 0xc8, 0x26, 0xb8, 0x82, 0x57, 0x69, 0xd5, 0x83, 0x88, 0xe8, 0xa6, 0xa2, 0xe0, 0x45, 0xa6, 0x93, - 0x69, 0x1a, 0x4c, 0x32, 0x31, 0x2f, 0x29, 0xcd, 0xb7, 0xf0, 0x63, 0x89, 0xa7, 0x3d, 0x7a, 0x12, - 0x69, 0x3f, 0x80, 0x77, 0x4f, 0x92, 0x99, 0x24, 0x2d, 0x5d, 0x77, 0xf7, 0xb4, 0xa7, 0xbe, 0xbe, - 0xf9, 0xfd, 0x99, 0xf7, 0x9b, 0x47, 0xf0, 0x09, 0x13, 0x31, 0xf0, 0x18, 0x72, 0x70, 0x9a, 0xea, - 0xf3, 0xd7, 0x9c, 0xe7, 0xdc, 0x4e, 0x52, 0x91, 0x09, 0x72, 0xb4, 0x10, 0x61, 0x1e, 0xf1, 0x59, - 0x60, 0x27, 0x34, 0x14, 0x11, 0xb5, 0x1b, 0xd8, 0xf1, 0x91, 0x2f, 0x84, 0x1f, 0x72, 0x47, 0x02, - 0xa7, 0xf9, 0xcc, 0xa1, 0x71, 0xa1, 0x58, 0xc7, 0x43, 0x5f, 0xf8, 0x42, 0x96, 0x4e, 0x59, 0xa9, - 0xae, 0xf9, 0xa3, 0x8d, 0xef, 0x9e, 0x97, 0xda, 0xde, 0x24, 0xf0, 0x63, 0xee, 0xbd,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88, 0x04, 0x00, 0x00, + // 590 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x54, 0x4f, 0x6b, 0xd4, 0x40, + 0x14, 0xdf, 0xd9, 0x6c, 0xdb, 0xed, 0xb4, 0x48, 0x19, 0x8b, 0xa4, 0x45, 0xb2, 0x21, 0x82, 0x04, + 0xa4, 0x09, 0x56, 0xf0, 0xa8, 0x6c, 0x54, 0x50, 0x44, 0xb4, 0x69, 0x51, 0xf0, 0x22, 0xb3, 0x33, + 0xb3, 0xd9, 0xd0, 0x24, 0x13, 0x33, 0x93, 0xd2, 0x7c, 0x8b, 0x7e, 0x1e, 0x3f, 0x41, 0x8f, 0x3d, + 0x7a, 0xaa, 0xd2, 0xfd, 0x00, 0xde, 0x3d, 0x49, 0x26, 0x7f, 0x76, 0xd9, 0x6d, 0xed, 0xa9, 0xa7, + 0x7d, 0xfb, 0xe6, 0xfd, 0x7e, 0xef, 0xf7, 0x7e, 0xef, 0x11, 0x38, 0x20, 0x3c, 0x11, 0x2c, 0x11, + 0xb9, 0x70, 0xdb, 0xe8, 0xdb, 0xf7, 0x9c, 0xe5, 0xcc, 0x49, 0x33, 0x2e, 0x39, 0xda, 0x39, 0xe1, + 0x51, 0x1e, 0xb3, 0x71, 0xe8, 0xa4, 0x38, 0xe2, 0x31, 0x76, 0xda, 0xb2, 0xdd, 0x9d, 0x80, 0xf3, + 0x20, 0x62, 0xae, 0x2a, 0x1c, 0xe5, 0x63, 0x17, 0x27, 0x45, 0x85, 0xda, 0xdd, 0x0e, 0x78, 0xc0, + 0x55, 0xe8, 0x96, 0x51, 0x9d, 0x1d, 0x2c, 0x02, 0x64, 0x18, 0x33, 0x21, 0x71, 0x9c, 0x56, 0x05, + 0xd6, 0x0f, 0x0d, 0xde, 0x3f, 0x28, 0x9b, 0xd3, 0xc3, 0x30, 0x48, 0x18, 0xfd, 0xc0, 0x84, 0xc0, + 0x01, 0x43, 0xf7, 0x60, 0x37, 0xa4, 0x3a, 0x30, 0x81, 0xdd, 0xf3, 0xbb, 0x21, 0x45, 0x0e, 0x44, + 0x98, 0x52, 0x46, 0x87, 0xd2, 0x8b, 0x38, 0x39, 0x7e, 0xcb, 0xc2, 0x60, 0x22, 0xf5, 0xae, 0x09, + 0x6c, 0xcd, 0xbf, 0xe6, 0x05, 0xbd, 0x80, 0x6b, 0x75, 0x56, 0xd7, 0x4c, 0x60, 0x6f, 0xec, 0xef, + 0x3a, 0x95, 0x14, 0xa7, 0x91, 0xe2, 0x1c, 0x35, 0x52, 0xbc, 0xfe, 0xf9, 0xe5, 0xa0, 0x73, 0xf6, + 0x6b, 0x00, 0xfc, 0x06, 0x84, 0x1e, 0x43, 0x2d, 0x16, 0x81, 0xde, 0x53, 0xd8, 0xed, 0x25, 0xec, + 0x30, 0x29, 0xfc, 0xb2, 0x00, 0x99, 0x70, 0x63, 0x54, 0x48, 0x26, 0x8e, 0x78, 0xa9, 0x5f, 0x5f, + 0x31, 0x81, 0xbd, 0xe9, 0xcf, 0xa7, 0xd0, 0x4b, 0xd8, 0x17, 0x61, 0x90, 0xbc, 0xc6, 0x12, 0xeb, + 0xab, 0xa6, 0x66, 0x6f, 0xec, 0x3f, 0x72, 0x6e, 0x74, 0xd8, 0x39, 0xac, 0x4b, 0xfd, 0x16, 0x54, + 0x12, 0xb0, 0x93, 0x90, 0xb2, 0x84, 0x30, 0x7d, 0xed, 0x56, 0x82, 0x37, 0x75, 0xa9, 0xdf, 0x82, + 0xd0, 0x17, 0xb8, 0x95, 0xe6, 0xa3, 0x28, 0x24, 0x43, 0x42, 0x98, 0x10, 0x4a, 0x49, 0x5f, 0x0d, + 0xf6, 0xe4, 0x3f, 0x44, 0x9f, 0x16, 0x20, 0xfe, 0x12, 0x89, 0xe5, 0x41, 0xdd, 0xc3, 0x92, 0x4c, + 0x3e, 0x8e, 0x5f, 0x35, 0xb0, 0x7a, 0x7f, 0xa2, 0x31, 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 0x35, 0x3a, 0x17, 0x53, 0xa3, 0xf3, 0x73, 0x6a, 0x74, 0xbe, 0xba, 0x73, 0x8d, 0xaa, 0xa3, 0x26, + 0x13, 0x1c, 0x26, 0x75, 0xec, 0x9e, 0xce, 0xbe, 0x7a, 0x55, 0xd7, 0xd1, 0xaa, 0x3a, 0xb1, 0x67, + 0xff, 0x02, 0x00, 0x00, 0xff, 0xff, 0x3e, 0x50, 0x81, 0xc0, 0x19, 0x05, 0x00, 0x00, } func (m *QueuedSignedMessage) Marshal() (dAtA []byte, err error) { @@ -464,7 +488,7 @@ func (m *QueuedSignedMessage) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintConsensusQueue(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x32 + dAtA[i] = 0x42 } if len(m.Evidence) > 0 { for iNdEx := len(m.Evidence) - 1; iNdEx >= 0; iNdEx-- { @@ -477,7 +501,7 @@ func (m *QueuedSignedMessage) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintConsensusQueue(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x2a + dAtA[i] = 0x3a } } if len(m.SignData) > 0 { @@ -491,7 +515,7 @@ func (m *QueuedSignedMessage) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintConsensusQueue(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x22 + dAtA[i] = 0x32 } } if len(m.BytesToSign) > 0 { @@ -499,7 +523,7 @@ func (m *QueuedSignedMessage) MarshalToSizedBuffer(dAtA []byte) (int, error) { copy(dAtA[i:], m.BytesToSign) i = encodeVarintConsensusQueue(dAtA, i, uint64(len(m.BytesToSign))) i-- - dAtA[i] = 0x1a + dAtA[i] = 0x2a } if m.Msg != nil { { @@ -511,7 +535,20 @@ func (m *QueuedSignedMessage) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintConsensusQueue(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x12 + dAtA[i] = 0x22 + } + n3, err3 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.AddedAt, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.AddedAt):]) + if err3 != nil { + return 0, err3 + } + i -= n3 + i = encodeVarintConsensusQueue(dAtA, i, uint64(n3)) + i-- + dAtA[i] = 0x1a + if m.AddedAtBlockHeight != 0 { + i = encodeVarintConsensusQueue(dAtA, i, uint64(m.AddedAtBlockHeight)) + i-- + dAtA[i] = 0x10 } if m.Id != 0 { i = encodeVarintConsensusQueue(dAtA, i, uint64(m.Id)) @@ -752,6 +789,11 @@ func (m *QueuedSignedMessage) Size() (n int) { if m.Id != 0 { n += 1 + sovConsensusQueue(uint64(m.Id)) } + if m.AddedAtBlockHeight != 0 { + n += 1 + sovConsensusQueue(uint64(m.AddedAtBlockHeight)) + } + l = github_com_gogo_protobuf_types.SizeOfStdTime(m.AddedAt) + n += 1 + l + sovConsensusQueue(uint64(l)) if m.Msg != nil { l = m.Msg.Size() n += 1 + l + sovConsensusQueue(uint64(l)) @@ -929,6 +971,58 @@ func (m *QueuedSignedMessage) Unmarshal(dAtA []byte) error { } } case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field AddedAtBlockHeight", wireType) + } + m.AddedAtBlockHeight = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowConsensusQueue + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.AddedAtBlockHeight |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field AddedAt", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowConsensusQueue + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthConsensusQueue + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthConsensusQueue + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(&m.AddedAt, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Msg", wireType) } @@ -964,7 +1058,7 @@ func (m *QueuedSignedMessage) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 3: + case 5: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field BytesToSign", wireType) } @@ -998,7 +1092,7 @@ func (m *QueuedSignedMessage) Unmarshal(dAtA []byte) error { m.BytesToSign = []byte{} } iNdEx = postIndex - case 4: + case 6: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field SignData", wireType) } @@ -1032,7 +1126,7 @@ func (m *QueuedSignedMessage) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 5: + case 7: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Evidence", wireType) } @@ -1066,7 +1160,7 @@ func (m *QueuedSignedMessage) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 6: + case 8: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field PublicAccessData", wireType) }