diff --git a/data/block/blockV2.pb.go b/data/block/blockV2.pb.go index add958a5..93b551c7 100644 --- a/data/block/blockV2.pb.go +++ b/data/block/blockV2.pb.go @@ -234,6 +234,7 @@ func (m *MiniBlockHeaderReserved) GetIndexOfLastTxProcessed() int32 { return 0 } +// TODO: remove this struct // PreviousHeaderProof defines a header proof type PreviousHeaderProof struct { PubKeysBitmap []byte `protobuf:"bytes,1,opt,name=PubKeysBitmap,proto3" json:"pubKeysBitmap"` @@ -282,62 +283,149 @@ func (m *PreviousHeaderProof) GetAggregatedSignature() []byte { return nil } +// HeaderProof defines a proof for a specific header +type HeaderProof struct { + PubKeysBitmap []byte `protobuf:"bytes,1,opt,name=PubKeysBitmap,proto3" json:"pubKeysBitmap"` + AggregatedSignature []byte `protobuf:"bytes,2,opt,name=AggregatedSignature,proto3" json:"aggregatedSignature"` + HeaderHash []byte `protobuf:"bytes,3,opt,name=HeaderHash,proto3" json:"headerHash"` + HeaderEpoch uint32 `protobuf:"varint,4,opt,name=HeaderEpoch,proto3" json:"headerEpoch"` + HeaderNonce uint64 `protobuf:"varint,5,opt,name=HeaderNonce,proto3" json:"headerNonce"` + HeaderShardId uint32 `protobuf:"varint,6,opt,name=HeaderShardId,proto3" json:"headerShardId"` +} + +func (m *HeaderProof) Reset() { *m = HeaderProof{} } +func (*HeaderProof) ProtoMessage() {} +func (*HeaderProof) Descriptor() ([]byte, []int) { + return fileDescriptor_17a3844aa051366e, []int{4} +} +func (m *HeaderProof) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *HeaderProof) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *HeaderProof) XXX_Merge(src proto.Message) { + xxx_messageInfo_HeaderProof.Merge(m, src) +} +func (m *HeaderProof) XXX_Size() int { + return m.Size() +} +func (m *HeaderProof) XXX_DiscardUnknown() { + xxx_messageInfo_HeaderProof.DiscardUnknown(m) +} + +var xxx_messageInfo_HeaderProof proto.InternalMessageInfo + +func (m *HeaderProof) GetPubKeysBitmap() []byte { + if m != nil { + return m.PubKeysBitmap + } + return nil +} + +func (m *HeaderProof) GetAggregatedSignature() []byte { + if m != nil { + return m.AggregatedSignature + } + return nil +} + +func (m *HeaderProof) GetHeaderHash() []byte { + if m != nil { + return m.HeaderHash + } + return nil +} + +func (m *HeaderProof) GetHeaderEpoch() uint32 { + if m != nil { + return m.HeaderEpoch + } + return 0 +} + +func (m *HeaderProof) GetHeaderNonce() uint64 { + if m != nil { + return m.HeaderNonce + } + return 0 +} + +func (m *HeaderProof) GetHeaderShardId() uint32 { + if m != nil { + return m.HeaderShardId + } + return 0 +} + func init() { proto.RegisterType((*HeaderV2)(nil), "proto.HeaderV2") proto.RegisterType((*MiniBlockReserved)(nil), "proto.MiniBlockReserved") proto.RegisterType((*MiniBlockHeaderReserved)(nil), "proto.MiniBlockHeaderReserved") proto.RegisterType((*PreviousHeaderProof)(nil), "proto.PreviousHeaderProof") + proto.RegisterType((*HeaderProof)(nil), "proto.HeaderProof") } func init() { proto.RegisterFile("blockV2.proto", fileDescriptor_17a3844aa051366e) } var fileDescriptor_17a3844aa051366e = []byte{ - // 717 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x55, 0x3f, 0x4f, 0xf3, 0x46, - 0x18, 0xcf, 0x51, 0x92, 0xd2, 0x83, 0x54, 0x60, 0xfe, 0xc4, 0x0d, 0x92, 0x1d, 0x65, 0x62, 0x68, - 0x12, 0x29, 0x95, 0xda, 0x81, 0xa1, 0xc5, 0x2d, 0x94, 0xa8, 0x50, 0xa2, 0x83, 0x32, 0x74, 0xbb, - 0xd8, 0x4f, 0x9c, 0x53, 0x63, 0x5f, 0xe4, 0x3b, 0x47, 0xa1, 0x53, 0x3f, 0x42, 0xd7, 0x7e, 0x00, - 0xa4, 0xaa, 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, 0x8f, 0x3d, 0x2a, 0x7b, 0x8d, 0x0e, 0x73, - 0xeb, 0x2d, 0x5f, 0x1e, 0xce, 0x5c, 0x97, 0x17, 0xf6, 0x25, 0x1b, 0x42, 0x20, 0x46, 0x0d, 0x6f, - 0x54, 0xb3, 0x7b, 0x94, 0xf9, 0x35, 0x9b, 0x07, 0x50, 0x73, 0x79, 0xc3, 0xa1, 0x92, 0xd6, 0x2d, - 0xe6, 0xb6, 0x7c, 0xf9, 0x2d, 0x15, 0x12, 0x02, 0xb2, 0x34, 0x90, 0x76, 0x8b, 0xf0, 0xde, 0x14, - 0xfc, 0x0e, 0x86, 0xd0, 0xe7, 0x03, 0x08, 0x54, 0xd6, 0x55, 0x95, 0xd5, 0x4b, 0x22, 0xb3, 0x22, - 0x32, 0x19, 0x6f, 0x91, 0x74, 0x49, 0x18, 0xed, 0x0c, 0xef, 0x4c, 0x91, 0xef, 0xa9, 0x68, 0x07, - 0x7c, 0xc8, 0x1c, 0x70, 0xf4, 0x7c, 0x05, 0x1d, 0xac, 0x5a, 0x7a, 0x12, 0x99, 0x3b, 0x22, 0x03, - 0x27, 0x99, 0x2a, 0xed, 0x02, 0xef, 0xce, 0xd5, 0xc1, 0xa7, 0x7d, 0xf6, 0x2b, 0x38, 0x7a, 0x41, - 0xd9, 0x7d, 0x96, 0x44, 0xe6, 0xae, 0xc8, 0x22, 0x90, 0x6c, 0xdd, 0xeb, 0x78, 0x04, 0xba, 0xa1, - 0x3f, 0x8e, 0xf7, 0x71, 0x76, 0xbc, 0x67, 0x9c, 0x64, 0xaa, 0x34, 0xc0, 0xdb, 0xed, 0x00, 0x86, - 0x8c, 0x87, 0x22, 0xed, 0xd1, 0x76, 0xc0, 0x79, 0x57, 0x5f, 0x53, 0xbd, 0x5d, 0x9e, 0xf4, 0x76, - 0x06, 0xc3, 0x2a, 0x25, 0x91, 0xb9, 0x3d, 0x58, 0x04, 0x48, 0x96, 0x5f, 0xf5, 0x16, 0xe1, 0xad, - 0x73,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, 0x9e, 0xa7, 0xb5, 0xf0, 0xf6, 0x91, 0xeb, 0x06, - 0xe0, 0x8e, 0x7f, 0x55, 0x2e, 0x99, 0xeb, 0x53, 0x19, 0x06, 0xcf, 0x8f, 0xac, 0x5a, 0x92, 0x2e, - 0xc2, 0x24, 0x4b, 0x63, 0x7d, 0x7d, 0xf7, 0x60, 0xe4, 0xee, 0x1f, 0x8c, 0xdc, 0xd3, 0x83, 0x81, - 0x7e, 0x8b, 0x0d, 0xf4, 0x67, 0x6c, 0xa0, 0x7f, 0x63, 0x03, 0xdd, 0xc5, 0x06, 0xba, 0x8f, 0x0d, - 0xf4, 0x2e, 0x36, 0xd0, 0xfb, 0xd8, 0xc8, 0x3d, 0xc5, 0x06, 0xfa, 0xfd, 0xd1, 0xc8, 0xdd, 0x3d, - 0x1a, 0xb9, 0xfb, 0x47, 0x23, 0xf7, 0x73, 0x5e, 0xfd, 0x39, 0x74, 0x0a, 0xea, 0xbd, 0xbe, 0xf8, - 0x10, 0x00, 0x00, 0xff, 0xff, 0xa8, 0xe3, 0xe1, 0x73, 0x71, 0x06, 0x00, 0x00, + // 803 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x55, 0x3d, 0x6f, 0xe3, 0x36, + 0x18, 0x36, 0xd3, 0x38, 0xbd, 0x32, 0xe7, 0xeb, 0x85, 0xf9, 0x52, 0x73, 0x80, 0x14, 0x78, 0xca, + 0xd0, 0xd8, 0x68, 0x0a, 0xb4, 0xc3, 0x0d, 0xed, 0xa9, 0xcd, 0xf5, 0x8c, 0xde, 0x47, 0xc0, 0xa4, + 0x37, 0x74, 0xa3, 0xa5, 0x37, 0x12, 0x51, 0x4b, 0x14, 0x44, 0xca, 0x70, 0x3a, 0xf5, 0x27, 0x74, + 0xed, 0x0f, 0x38, 0xa0, 0x68, 0xff, 0x44, 0xc7, 0x0e, 0x1d, 0x32, 0x66, 0x52, 0x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0x82, 0x14, 0x82, 0xf1, 0xad, 0x72, 0xcc, 0x83, 0x98, 0xa9, 0x2c, 0xbd, 0xfe, + 0xc8, 0xfa, 0x48, 0xb2, 0x79, 0x98, 0xd6, 0x69, 0xda, 0x6f, 0x97, 0xf0, 0xea, 0x7b, 0x96, 0x89, + 0x74, 0x30, 0x36, 0x91, 0xf4, 0x8f, 0xc1, 0xdc, 0xe0, 0x0f, 0xca, 0xdc, 0xc1, 0xe1, 0xb4, 0x4a, + 0x2b, 0x0c, 0xf2, 0xd9, 0xf5, 0x2b, 0x1c, 0x26, 0xc2, 0x0b, 0xf5, 0x87, 0x6a, 0xb9, 0x1f, 0x97, + 0xb9, 0xb3, 0x1a, 0xde, 0x94, 0x69, 0x95, 0x73, 0x23, 0x79, 0x29, 0x62, 0x0f, 0x26, 0x97, 0x5a, + 0x45, 0xa2, 0xcb, 0xb4, 0xca, 0x19, 0xef, 0x8c, 0x99, 0x1e, 0x87, 0x2c, 0xf5, 0x7b, 0xe6, 0xea, + 0x6a, 0x99, 0x9d, 0x09, 0xab, 0x00, 0x9d, 0xe5, 0xb9, 0x5f, 0x9d, 0x5f, 0xda, 0x8d, 0x8b, 0x4b, + 0xbb, 0xf1, 0xee, 0xd2, 0x46, 0xbf, 0x14, 0x36, 0xfa, 0xbd, 0xb0, 0xd1, 0xdf, 0x85, 0x8d, 0xce, + 0x0b, 0x1b, 0x5d, 0x14, 0x36, 0x7a, 0x5b, 0xd8, 0xe8, 0xbf, 0xc2, 0x6e, 0xbc, 0x2b, 0x6c, 0xf4, + 0xeb, 0x95, 0xdd, 0x38, 0xbf, 0xb2, 0x1b, 0x17, 0x57, 0x76, 0xe3, 0xc7, 0xa6, 0xfe, 0xff, 0xf6, + 0x57, 0x74, 0x4b, 0x7c, 0xfe, 0x7f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x8e, 0xff, 0x7b, 0x14, 0xd4, + 0x07, 0x00, 0x00, } func (this *HeaderV2) Equal(that interface{}) bool { @@ -478,6 +566,45 @@ func (this *PreviousHeaderProof) Equal(that interface{}) bool { } return true } +func (this *HeaderProof) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*HeaderProof) + if !ok { + that2, ok := that.(HeaderProof) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if !bytes.Equal(this.PubKeysBitmap, that1.PubKeysBitmap) { + return false + } + if !bytes.Equal(this.AggregatedSignature, that1.AggregatedSignature) { + return false + } + if !bytes.Equal(this.HeaderHash, that1.HeaderHash) { + return false + } + if this.HeaderEpoch != that1.HeaderEpoch { + return false + } + if this.HeaderNonce != that1.HeaderNonce { + return false + } + if this.HeaderShardId != that1.HeaderShardId { + return false + } + return true +} func (this *HeaderV2) GoString() string { if this == nil { return "nil" @@ -534,6 +661,21 @@ func (this *PreviousHeaderProof) GoString() string { s = append(s, "}") return strings.Join(s, "") } +func (this *HeaderProof) GoString() string { + if this == nil { + return "nil" + } + s := make([]string, 0, 10) + s = append(s, "&block.HeaderProof{") + s = append(s, "PubKeysBitmap: "+fmt.Sprintf("%#v", this.PubKeysBitmap)+",\n") + s = append(s, "AggregatedSignature: "+fmt.Sprintf("%#v", this.AggregatedSignature)+",\n") + s = append(s, "HeaderHash: "+fmt.Sprintf("%#v", this.HeaderHash)+",\n") + s = append(s, "HeaderEpoch: "+fmt.Sprintf("%#v", this.HeaderEpoch)+",\n") + s = append(s, "HeaderNonce: "+fmt.Sprintf("%#v", this.HeaderNonce)+",\n") + s = append(s, "HeaderShardId: "+fmt.Sprintf("%#v", this.HeaderShardId)+",\n") + s = append(s, "}") + return strings.Join(s, "") +} func valueToGoStringBlockV2(v interface{}, typ string) string { rv := reflect.ValueOf(v) if rv.IsNil() { @@ -748,6 +890,65 @@ func (m *PreviousHeaderProof) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *HeaderProof) 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 *HeaderProof) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *HeaderProof) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.HeaderShardId != 0 { + i = encodeVarintBlockV2(dAtA, i, uint64(m.HeaderShardId)) + i-- + dAtA[i] = 0x30 + } + if m.HeaderNonce != 0 { + i = encodeVarintBlockV2(dAtA, i, uint64(m.HeaderNonce)) + i-- + dAtA[i] = 0x28 + } + if m.HeaderEpoch != 0 { + i = encodeVarintBlockV2(dAtA, i, uint64(m.HeaderEpoch)) + i-- + dAtA[i] = 0x20 + } + if len(m.HeaderHash) > 0 { + i -= len(m.HeaderHash) + copy(dAtA[i:], m.HeaderHash) + i = encodeVarintBlockV2(dAtA, i, uint64(len(m.HeaderHash))) + i-- + dAtA[i] = 0x1a + } + if len(m.AggregatedSignature) > 0 { + i -= len(m.AggregatedSignature) + copy(dAtA[i:], m.AggregatedSignature) + i = encodeVarintBlockV2(dAtA, i, uint64(len(m.AggregatedSignature))) + i-- + dAtA[i] = 0x12 + } + if len(m.PubKeysBitmap) > 0 { + i -= len(m.PubKeysBitmap) + copy(dAtA[i:], m.PubKeysBitmap) + i = encodeVarintBlockV2(dAtA, i, uint64(len(m.PubKeysBitmap))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + func encodeVarintBlockV2(dAtA []byte, offset int, v uint64) int { offset -= sovBlockV2(v) base := offset @@ -853,6 +1054,36 @@ func (m *PreviousHeaderProof) Size() (n int) { return n } +func (m *HeaderProof) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.PubKeysBitmap) + if l > 0 { + n += 1 + l + sovBlockV2(uint64(l)) + } + l = len(m.AggregatedSignature) + if l > 0 { + n += 1 + l + sovBlockV2(uint64(l)) + } + l = len(m.HeaderHash) + if l > 0 { + n += 1 + l + sovBlockV2(uint64(l)) + } + if m.HeaderEpoch != 0 { + n += 1 + sovBlockV2(uint64(m.HeaderEpoch)) + } + if m.HeaderNonce != 0 { + n += 1 + sovBlockV2(uint64(m.HeaderNonce)) + } + if m.HeaderShardId != 0 { + n += 1 + sovBlockV2(uint64(m.HeaderShardId)) + } + return n +} + func sovBlockV2(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -911,6 +1142,21 @@ func (this *PreviousHeaderProof) String() string { }, "") return s } +func (this *HeaderProof) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&HeaderProof{`, + `PubKeysBitmap:` + fmt.Sprintf("%v", this.PubKeysBitmap) + `,`, + `AggregatedSignature:` + fmt.Sprintf("%v", this.AggregatedSignature) + `,`, + `HeaderHash:` + fmt.Sprintf("%v", this.HeaderHash) + `,`, + `HeaderEpoch:` + fmt.Sprintf("%v", this.HeaderEpoch) + `,`, + `HeaderNonce:` + fmt.Sprintf("%v", this.HeaderNonce) + `,`, + `HeaderShardId:` + fmt.Sprintf("%v", this.HeaderShardId) + `,`, + `}`, + }, "") + return s +} func valueToStringBlockV2(v interface{}) string { rv := reflect.ValueOf(v) if rv.IsNil() { @@ -1567,6 +1813,218 @@ func (m *PreviousHeaderProof) Unmarshal(dAtA []byte) error { } return nil } +func (m *HeaderProof) 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 ErrIntOverflowBlockV2 + } + 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: HeaderProof: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: HeaderProof: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PubKeysBitmap", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowBlockV2 + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthBlockV2 + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthBlockV2 + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.PubKeysBitmap = append(m.PubKeysBitmap[:0], dAtA[iNdEx:postIndex]...) + if m.PubKeysBitmap == nil { + m.PubKeysBitmap = []byte{} + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field AggregatedSignature", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowBlockV2 + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthBlockV2 + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthBlockV2 + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.AggregatedSignature = append(m.AggregatedSignature[:0], dAtA[iNdEx:postIndex]...) + if m.AggregatedSignature == nil { + m.AggregatedSignature = []byte{} + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field HeaderHash", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowBlockV2 + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthBlockV2 + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthBlockV2 + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.HeaderHash = append(m.HeaderHash[:0], dAtA[iNdEx:postIndex]...) + if m.HeaderHash == nil { + m.HeaderHash = []byte{} + } + iNdEx = postIndex + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field HeaderEpoch", wireType) + } + m.HeaderEpoch = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowBlockV2 + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.HeaderEpoch |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field HeaderNonce", wireType) + } + m.HeaderNonce = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowBlockV2 + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.HeaderNonce |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 6: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field HeaderShardId", wireType) + } + m.HeaderShardId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowBlockV2 + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.HeaderShardId |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipBlockV2(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthBlockV2 + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthBlockV2 + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipBlockV2(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/data/block/blockV2.proto b/data/block/blockV2.proto index 0f49680f..08ce9526 100644 --- a/data/block/blockV2.proto +++ b/data/block/blockV2.proto @@ -33,8 +33,19 @@ message MiniBlockHeaderReserved { int32 IndexOfLastTxProcessed = 4 [(gogoproto.jsontag) = "indexOfLastTxProcessed"]; } +// TODO: remove this struct // PreviousHeaderProof defines a header proof message PreviousHeaderProof { bytes PubKeysBitmap = 1 [(gogoproto.jsontag) = "pubKeysBitmap"]; bytes AggregatedSignature = 2 [(gogoproto.jsontag) = "aggregatedSignature"]; } + +// HeaderProof defines a proof for a specific header +message HeaderProof { + bytes PubKeysBitmap = 1 [(gogoproto.jsontag) = "pubKeysBitmap"]; + bytes AggregatedSignature = 2 [(gogoproto.jsontag) = "aggregatedSignature"]; + bytes HeaderHash = 3 [(gogoproto.jsontag) = "headerHash"]; + uint32 HeaderEpoch = 4 [(gogoproto.jsontag) = "headerEpoch"]; + uint64 HeaderNonce = 5 [(gogoproto.jsontag) = "headerNonce"]; + uint32 HeaderShardId = 6 [(gogoproto.jsontag) = "headerShardId"]; +} diff --git a/data/interface.go b/data/interface.go index 3bc10548..3ad0cbcd 100644 --- a/data/interface.go +++ b/data/interface.go @@ -412,3 +412,13 @@ type UserAccountHandler interface { AddressBytes() []byte IsInterfaceNil() bool } + +// HeaderProofHandler defines getters and setters for the header proof +type HeaderProofHandler interface { + GetPubKeysBitmap() []byte + GetAggregatedSignature() []byte + GetHeaderHash() []byte + GetHeaderEpoch() uint32 + GetHeaderNonce() uint64 + GetHeaderShardId() uint32 +}