diff --git a/proto/tendermint/types/types.pb.go b/proto/tendermint/types/types.pb.go index ce6844badb0..25552aa6828 100644 --- a/proto/tendermint/types/types.pb.go +++ b/proto/tendermint/types/types.pb.go @@ -210,8 +210,9 @@ func (m *Part) GetProof() crypto.Proof { // BlockID type BlockID struct { - Hash []byte `protobuf:"bytes,1,opt,name=hash,proto3" json:"hash,omitempty"` - PartSetHeader PartSetHeader `protobuf:"bytes,2,opt,name=part_set_header,json=partSetHeader,proto3" json:"part_set_header"` + Hash []byte `protobuf:"bytes,1,opt,name=hash,proto3" json:"hash,omitempty"` + PartSetHeader PartSetHeader `protobuf:"bytes,2,opt,name=part_set_header,json=partSetHeader,proto3" json:"part_set_header"` + HashAbiEncoded []byte `protobuf:"bytes,3,opt,name=hash_abi_encoded,json=hashAbiEncoded,proto3" json:"hash_abi_encoded,omitempty"` } func (m *BlockID) Reset() { *m = BlockID{} } @@ -261,6 +262,13 @@ func (m *BlockID) GetPartSetHeader() PartSetHeader { return PartSetHeader{} } +func (m *BlockID) GetHashAbiEncoded() []byte { + if m != nil { + return m.HashAbiEncoded + } + return nil +} + // Header defines the structure of a block header. type Header struct { // basic block info @@ -1049,90 +1057,91 @@ func init() { func init() { proto.RegisterFile("tendermint/types/types.proto", fileDescriptor_d3a6e55e2345de56) } var fileDescriptor_d3a6e55e2345de56 = []byte{ - // 1316 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x57, 0x4f, 0x6f, 0x1b, 0x45, - 0x14, 0xcf, 0xda, 0x9b, 0xd8, 0x7e, 0xb6, 0x13, 0x67, 0x95, 0xb6, 0xae, 0xdb, 0x38, 0x2b, 0x23, - 0x20, 0x2d, 0x68, 0x53, 0x52, 0x84, 0xe0, 0xc0, 0xc1, 0x76, 0xd2, 0xd6, 0x6a, 0xec, 0x58, 0x6b, - 0xb7, 0x08, 0x2e, 0xab, 0xb5, 0x77, 0x62, 0x2f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0x2b, 0x45, 0x50, 0x77, - 0x6c, 0x6a, 0x6b, 0x05, 0x48, 0xd2, 0x23, 0x52, 0x54, 0xf4, 0xe4, 0x66, 0xce, 0x64, 0x9f, 0x95, - 0xbf, 0x13, 0xa0, 0x3e, 0xc6, 0x14, 0x69, 0x77, 0x41, 0x65, 0x6d, 0xe2, 0xea, 0x5b, 0xbe, 0x48, - 0xcf, 0x1d, 0x77, 0xe0, 0x23, 0xa7, 0x49, 0x06, 0xdd, 0xe3, 0x00, 0x99, 0x1c, 0x1c, 0x93, 0x53, - 0x62, 0x46, 0x4e, 0x6b, 0xb0, 0x18, 0xe2, 0xb1, 0xef, 0x70, 0x95, 0x2d, 0x9a, 0x62, 0xa0, 0xed, - 0x42, 0x3a, 0x52, 0x89, 0xfa, 0x5f, 0x2a, 0x59, 0x61, 0x2a, 0x61, 0x1a, 0x96, 0x06, 0x33, 0xd5, - 0x93, 0x62, 0xa9, 0x41, 0x26, 0x3a, 0xbc, 0xa4, 0xda, 0x5e, 0x4f, 0xb0, 0xd3, 0x30, 0xed, 0x03, - 0x58, 0x8d, 0x7a, 0x1f, 0x91, 0x27, 0x14, 0x57, 0x88, 0x1c, 0x92, 0xbd, 0x19, 0x59, 0x59, 0xe2, - 0x00, 0x4a, 0xf1, 0xba, 0xa6, 0xb2, 0x6a, 0xf0, 0x93, 0xe8, 0x26, 0x64, 0x88, 0x3b, 0xf0, 0x6d, - 0x3a, 0x0e, 0x91, 0x54, 0xde, 0xd4, 0x50, 0xf9, 0x59, 0x81, 0x25, 0xa1, 0xe4, 0x18, 0x6f, 0xca, - 0xc5, 0xbc, 0x25, 0x2e, 0xe3, 0x2d, 0xf9, 0xe6, 0xbc, 0x55, 0x01, 0xa2, 0x64, 0x48, 0x51, 0xd5, - 0x93, 0x9b, 0xd9, 0xed, 0x1b, 0xf3, 0x13, 0x89, 0x14, 0x3b, 0xee, 0x40, 0x6e, 0xd4, 0x58, 0x50, - 0xe5, 0x77, 0x05, 0x32, 0x91,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f, - 0xfe, 0x50, 0x56, 0x58, 0x65, 0xf9, 0x99, 0x33, 0x42, 0xfb, 0x10, 0xae, 0x75, 0x1a, 0xf7, 0x5b, - 0xbb, 0x3b, 0x56, 0xb3, 0x73, 0xdf, 0xea, 0x7e, 0xd9, 0xde, 0x8d, 0x55, 0xb7, 0x72, 0x72, 0xaa, - 0x67, 0x65, 0x49, 0x97, 0xa1, 0xdb, 0xe6, 0xee, 0xe3, 0xfd, 0xee, 0x6e, 0x41, 0x11, 0xe8, 0x76, - 0x88, 0x0e, 0x31, 0x45, 0x1c, 0x7d, 0x07, 0xae, 0x5f, 0x80, 0x8e, 0x0a, 0x5b, 0x3d, 0x39, 0xd5, - 0xf3, 0xed, 0x10, 0x89, 0xfd, 0xc3, 0x23, 0x0c, 0x28, 0xce, 0x47, 0xec, 0xb7, 0xf7, 0x3b, 0xd5, - 0xbd, 0x82, 0x5e, 0x2a, 0x9c, 0x9c, 0xea, 0xb9, 0xc9, 0x61, 0xc8, 0xf0, 0xd3, 0xca, 0x6a, 0xcd, - 0xe7, 0x67, 0x65, 0xe5, 0xc5, 0x59, 0x59, 0xf9, 0xf3, 0xac, 0xac, 0x3c, 0x7b, 0x55, 0x5e, 0x78, - 0xf1, 0xaa, 0xbc, 0xf0, 0xdb, 0xab, 0xf2, 0xc2, 0x57, 0x77, 0x07, 0x2e, 0x1d, 0x8e, 0x7b, 0x46, - 0x1f, 0x8f, 0xb6, 0xfa, 0x78, 0x84, 0x68, 0xef, 0x80, 0x4e, 0x3f, 0xc4, 0xdf, 0x92, 0xf3, 0x7f, - 0x15, 0x7a, 0x4b, 0xdc, 0x7e, 0xf7, 0x9f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x9c, 0x41, 0x46, 0x23, - 0xeb, 0x0c, 0x00, 0x00, + // 1338 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x57, 0x4f, 0x6f, 0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0x04, 0x79, 0x64, 0x4c, 0xe4, 0xc9, + 0x93, 0x18, 0xed, 0x3d, 0x48, 0xf6, 0x06, 0xb6, 0xeb, 0x59, 0xae, 0xc3, 0x73, 0x4f, 0x55, 0xd2, + 0xe7, 0x2f, 0xb7, 0x12, 0x55, 0x66, 0xab, 0xef, 0x99, 0x09, 0xee, 0xac, 0x3b, 0xda, 0x55, 0x58, + 0x19, 0x20, 0xb7, 0x3f, 0xa0, 0x3c, 0xa3, 0xb8, 0x29, 0x57, 0xda, 0xa7, 0xa0, 0x32, 0xed, 0xe4, + 0x55, 0x7e, 0x76, 0xc1, 0x10, 0xc2, 0x32, 0x26, 0xc2, 0x32, 0x3a, 0x13, 0x61, 0x55, 0x92, 0xec, + 0xe0, 0x67, 0x7f, 0x6c, 0x29, 0x26, 0x8f, 0xd0, 0xaa, 0x90, 0x1d, 0xda, 0x84, 0x5a, 0x5d, 0x46, + 0x30, 0x3b, 0x7e, 0x99, 0x6f, 0x71, 0x7d, 0x9e, 0x3a, 0xd9, 0x02, 0x99, 0x7a, 0x9a, 0x45, 0x09, + 0x93, 0xc3, 0x28, 0xe3, 0x9b, 0xf4, 0xf0, 0x68, 0xe4, 0x52, 0x8b, 0x77, 0x68, 0x45, 0x50, 0xc6, + 0xec, 0x55, 0x6e, 0x7e, 0xc0, 0x7a, 0x75, 0x03, 0x52, 0x8e, 0x4d, 0x6d, 0x01, 0x49, 0x70, 0x48, + 0x92, 0x19, 0xb8, 0xf3, 0x7d, 0x58, 0x0b, 0x05, 0x4a, 0x04, 0x24, 0x29, 0x76, 0x99, 0x9a, 0x39, + 0xf0, 0x0e, 0x6c, 0x78, 0xe8, 0x98, 0x5a, 0x17, 0xd1, 0x29, 0x8e, 0xd6, 0x98, 0xef, 0xf1, 0x6c, + 0xc4, 0xbb, 0xb0, 0xda, 0x9b, 0x90, 0x2f, 0xb0, 0xc0, 0xb1, 0xd9, 0xd0, 0xca, 0x61, 0xd7, 0x21, + 0x69, 0xfb, 0xbe, 0x00, 0xa4, 0x39, 0x20, 0x61, 0xfb, 0x3e, 0x77, 0xdd, 0x86, 0x75, 0x5e, 0x63, + 0x80, 0xc8, 0x78, 0x48, 0xe5, 0x26, 0x19, 0x8e, 0x59, 0x63, 0x0e, 0x53, 0xd8, 0x39, 0xf6, 0x1d, + 0xc8, 0xa2, 0x23, 0xd7, 0x41, 0x5e, 0x0f, 0x09, 0x5c, 0x96, 0xe3, 0x32, 0x13, 0x23, 0x07, 0xdd, + 0x82, 0x9c, 0x1f, 0x60, 0x1f, 0x13, 0x14, 0x58, 0xb6, 0xe3, 0x04, 0x88, 0x90, 0xfc, 0xaa, 0xd8, + 0x6f, 0x62, 0x2f, 0x0b, 0x73, 0x29, 0x0f, 0xea, 0x9e, 0x4d, 0x6d, 0x2d, 0x07, 0x71, 0x7a, 0x4c, + 0xf2, 0x8a, 0x1e, 0xdf, 0xce, 0x98, 0xec, 0xb1, 0xf4, 0x77, 0x0c, 0xd4, 0xc7, 0x98, 0x22, 0xed, + 0x2e, 0xa8, 0xac, 0x4d, 0x5c, 0x7d, 0xab, 0x97, 0x29, 0xbf, 0xed, 0xf6, 0x3d, 0xe4, 0x34, 0x48, + 0xbf, 0x73, 0xe2, 0x23, 0x93, 0x83, 0x23, 0x72, 0x8a, 0xcd, 0xc8, 0x69, 0x03, 0x96, 0x03, 0x3c, + 0xf6, 0x84, 0xee, 0x97, 0x4d, 0xb1, 0xd0, 0x6a, 0x90, 0x0c, 0x55, 0xa2, 0xfe, 0x97, 0x4a, 0xd6, + 0x98, 0x4a, 0x98, 0x86, 0xa5, 0xc1, 0x4c, 0x74, 0xa5, 0x58, 0x2a, 0x90, 0x0a, 0xef, 0x39, 0xa9, + 0xb6, 0xd7, 0x13, 0xec, 0x34, 0x4c, 0xfb, 0x00, 0xd6, 0xc3, 0xde, 0x87, 0xe4, 0x09, 0xc5, 0xe5, + 0x42, 0x87, 0x64, 0x6f, 0x46, 0x56, 0x96, 0xb8, 0xab, 0x12, 0xbc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5, 0xa5, 0xaf, 0xee, + 0xf6, 0x5d, 0x3a, 0x18, 0x77, 0x8d, 0x1e, 0x1e, 0xed, 0xf4, 0xf0, 0x08, 0xd1, 0xee, 0x21, 0x9d, + 0x3e, 0x88, 0x7f, 0x30, 0x17, 0xff, 0x55, 0x74, 0x57, 0xb8, 0xfd, 0xee, 0x3f, 0x01, 0x00, 0x00, + 0xff, 0xff, 0x43, 0x43, 0x1d, 0x70, 0x16, 0x0d, 0x00, 0x00, } func (m *PartSetHeader) Marshal() (dAtA []byte, err error) { @@ -1235,6 +1244,13 @@ func (m *BlockID) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if len(m.HashAbiEncoded) > 0 { + i -= len(m.HashAbiEncoded) + copy(dAtA[i:], m.HashAbiEncoded) + i = encodeVarintTypes(dAtA, i, uint64(len(m.HashAbiEncoded))) + i-- + dAtA[i] = 0x1a + } { size, err := m.PartSetHeader.MarshalToSizedBuffer(dAtA[:i]) if err != nil { @@ -1916,6 +1932,10 @@ func (m *BlockID) Size() (n int) { } l = m.PartSetHeader.Size() n += 1 + l + sovTypes(uint64(l)) + l = len(m.HashAbiEncoded) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } return n } @@ -2514,6 +2534,40 @@ func (m *BlockID) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field HashAbiEncoded", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.HashAbiEncoded = append(m.HashAbiEncoded[:0], dAtA[iNdEx:postIndex]...) + if m.HashAbiEncoded == nil { + m.HashAbiEncoded = []byte{} + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipTypes(dAtA[iNdEx:]) diff --git a/proto/tendermint/types/types.proto b/proto/tendermint/types/types.proto index 425f041dab2..f80d3f837bc 100644 --- a/proto/tendermint/types/types.proto +++ b/proto/tendermint/types/types.proto @@ -50,6 +50,7 @@ message Part { message BlockID { bytes hash = 1; PartSetHeader part_set_header = 2 [(gogoproto.nullable) = false]; + bytes hash_abi_encoded = 3; } // -------------------------------- diff --git a/types/block.go b/types/block.go index c93acf85c26..556084a5b2f 100644 --- a/types/block.go +++ b/types/block.go @@ -118,6 +118,23 @@ func (b *Block) fillHeader() { } } +// fillHeader fills in any remaining header fields that are a function of the block data +func (b *Block) fillHeaderAbiEncoded() { + if b.LastCommitHash == nil { + // b.LastCommitHash = b.LastCommit.Hash() + // TODO(blas) + } + if b.DataHash == nil { + // b.DataHash = b.Data.Hash() + // TODO(blas) + + } + if b.EvidenceHash == nil { + // b.EvidenceHash = b.Evidence.Hash() + // TODO(blas) + } +} + // Hash computes and returns the block hash. // If the block is incomplete, block hash is nil for safety. func (b *Block) Hash() cmtbytes.HexBytes { @@ -134,6 +151,22 @@ func (b *Block) Hash() cmtbytes.HexBytes { return b.Header.Hash() } +// Hash computes and returns the block hash. +// If the block is incomplete, block hash is nil for safety. +func (b *Block) HashAbiEncoded() cmtbytes.HexBytes { + if b == nil { + return nil + } + b.mtx.Lock() + defer b.mtx.Unlock() + + if b.LastCommit == nil { + return nil + } + b.fillHeaderAbiEncoded() + return b.Header.HashAbiEncoded() +} + // MakePartSet returns a PartSet containing parts of a serialized block. // This is the form in which the block is gossipped to peers. // CONTRACT: partSize is greater than zero. @@ -474,6 +507,17 @@ func (h *Header) Hash() cmtbytes.HexBytes { }) } +// Hash returns the hash of the header. +// It computes a Merkle tree from the header fields +// ordered as they appear in the Header. +// Returns nil if ValidatorHash is missing, +// since a Header is not valid unless there is +// a ValidatorsHash (corresponding to the validator set). +func (h *Header) HashAbiEncoded() cmtbytes.HexBytes { + // TODO(blas) + return nil +} + // StringIndented returns an indented string representation of the header. func (h *Header) StringIndented(indent string) string { if h == nil { @@ -1159,14 +1203,15 @@ func (data *EvidenceData) FromProto(eviData *cmtproto.EvidenceList) error { // BlockID type BlockID struct { - Hash cmtbytes.HexBytes `json:"hash"` - PartSetHeader PartSetHeader `json:"parts"` + Hash cmtbytes.HexBytes `json:"hash"` + PartSetHeader PartSetHeader `json:"parts"` + HashAbiEncoded cmtbytes.HexBytes `json:"hash"` } // Equals returns true if the BlockID matches the given BlockID func (blockID BlockID) Equals(other BlockID) bool { return bytes.Equal(blockID.Hash, other.Hash) && - blockID.PartSetHeader.Equals(other.PartSetHeader) + blockID.PartSetHeader.Equals(other.PartSetHeader) && bytes.Equal(blockID.HashAbiEncoded, other.HashAbiEncoded) } // Key returns a machine-readable string representation of the BlockID @@ -1186,6 +1231,9 @@ func (blockID BlockID) ValidateBasic() error { if err := ValidateHash(blockID.Hash); err != nil { return fmt.Errorf("wrong Hash") } + if err := ValidateHash(blockID.HashAbiEncoded); err != nil { + return fmt.Errorf("wrong Hash") + } if err := blockID.PartSetHeader.ValidateBasic(); err != nil { return fmt.Errorf("wrong PartSetHeader: %v", err) } @@ -1222,8 +1270,9 @@ func (blockID *BlockID) ToProto() cmtproto.BlockID { } return cmtproto.BlockID{ - Hash: blockID.Hash, - PartSetHeader: blockID.PartSetHeader.ToProto(), + Hash: blockID.Hash, + PartSetHeader: blockID.PartSetHeader.ToProto(), + HashAbiEncoded: blockID.HashAbiEncoded, } } @@ -1242,6 +1291,7 @@ func BlockIDFromProto(bID *cmtproto.BlockID) (*BlockID, error) { blockID.PartSetHeader = *ph blockID.Hash = bID.Hash + blockID.HashAbiEncoded = bID.HashAbiEncoded return blockID, blockID.ValidateBasic() } diff --git a/types/block_meta.go b/types/block_meta.go index d66cc8f36cd..5174fceb4b2 100644 --- a/types/block_meta.go +++ b/types/block_meta.go @@ -19,7 +19,7 @@ type BlockMeta struct { // NewBlockMeta returns a new BlockMeta. func NewBlockMeta(block *Block, blockParts *PartSet) *BlockMeta { return &BlockMeta{ - BlockID: BlockID{block.Hash(), blockParts.Header()}, + BlockID: BlockID{block.Hash(), blockParts.Header(), block.HashAbiEncoded()}, BlockSize: block.Size(), Header: block.Header, NumTxs: len(block.Data.Txs), diff --git a/types/block_test.go b/types/block_test.go index 615e265f032..d5a23597690 100644 --- a/types/block_test.go +++ b/types/block_test.go @@ -185,12 +185,13 @@ func TestBlockString(t *testing.T) { func makeBlockIDRandom() BlockID { var ( - blockHash = make([]byte, tmhash.Size) - partSetHash = make([]byte, tmhash.Size) + blockHash = make([]byte, tmhash.Size) + blockHashAbiEncoded = make([]byte, tmhash.Size) + partSetHash = make([]byte, tmhash.Size) ) rand.Read(blockHash) //nolint: errcheck // ignore errcheck for read rand.Read(partSetHash) //nolint: errcheck // ignore errcheck for read - return BlockID{blockHash, PartSetHeader{123, partSetHash}} + return BlockID{blockHash, PartSetHeader{123, partSetHash}, blockHashAbiEncoded} } func makeBlockID(hash []byte, partSetSize uint32, partSetHash []byte) BlockID { diff --git a/types/proposal_test.go b/types/proposal_test.go index 0e7f574c4ac..61c2110f177 100644 --- a/types/proposal_test.go +++ b/types/proposal_test.go @@ -61,7 +61,7 @@ func TestProposalVerifySignature(t *testing.T) { prop := NewProposal( 4, 2, 2, - BlockID{cmtrand.Bytes(tmhash.Size), PartSetHeader{777, cmtrand.Bytes(tmhash.Size)}}) + BlockID{cmtrand.Bytes(tmhash.Size), PartSetHeader{777, cmtrand.Bytes(tmhash.Size)}, cmtrand.Bytes(tmhash.Size)}) p := prop.ToProto() signBytes := ProposalSignBytes("test_chain_id", p) @@ -136,7 +136,7 @@ func TestProposalValidateBasic(t *testing.T) { {"Invalid Round", func(p *Proposal) { p.Round = -1 }, true}, {"Invalid POLRound", func(p *Proposal) { p.POLRound = -2 }, true}, {"Invalid BlockId", func(p *Proposal) { - p.BlockID = BlockID{[]byte{1, 2, 3}, PartSetHeader{111, []byte("blockparts")}} + p.BlockID = BlockID{[]byte{1, 2, 3}, PartSetHeader{111, []byte("blockparts")}, []byte{1, 2, 3}} }, true}, {"Invalid Signature", func(p *Proposal) { p.Signature = make([]byte, 0) diff --git a/types/vote_set_test.go b/types/vote_set_test.go index 7c3c049d312..507d90ac531 100644 --- a/types/vote_set_test.go +++ b/types/vote_set_test.go @@ -34,7 +34,7 @@ func TestVoteSet_AddVote_Good(t *testing.T) { Round: round, Type: cmtproto.PrevoteType, Timestamp: cmttime.Now(), - BlockID: BlockID{nil, PartSetHeader{}}, + BlockID: BlockID{nil, PartSetHeader{}, nil}, } _, err = signAddVote(val0, vote, voteSet) require.NoError(t, err) @@ -56,7 +56,7 @@ func TestVoteSet_AddVote_Bad(t *testing.T) { Round: round, Timestamp: cmttime.Now(), Type: cmtproto.PrevoteType, - BlockID: BlockID{nil, PartSetHeader{}}, + BlockID: BlockID{nil, PartSetHeader{}, nil}, } // val0 votes for nil. @@ -131,7 +131,7 @@ func TestVoteSet_2_3Majority(t *testing.T) { Round: round, Type: cmtproto.PrevoteType, Timestamp: cmttime.Now(), - BlockID: BlockID{nil, PartSetHeader{}}, + BlockID: BlockID{nil, PartSetHeader{}, nil}, } // 6 out of 10 voted for nil. for i := int32(0); i < 6; i++ { @@ -175,6 +175,7 @@ func TestVoteSet_2_3MajorityRedux(t *testing.T) { voteSet, _, privValidators := randVoteSet(height, round, cmtproto.PrevoteType, 100, 1) blockHash := crypto.CRandBytes(32) + blockHashAbiEncoded := crypto.CRandBytes(32) blockPartsTotal := uint32(123) blockPartSetHeader := PartSetHeader{blockPartsTotal, crypto.CRandBytes(32)} @@ -185,7 +186,7 @@ func TestVoteSet_2_3MajorityRedux(t *testing.T) { Round: round, Timestamp: cmttime.Now(), Type: cmtproto.PrevoteType, - BlockID: BlockID{blockHash, blockPartSetHeader}, + BlockID: BlockID{blockHash, blockPartSetHeader, blockHashAbiEncoded}, } // 66 out of 100 voted for nil. @@ -264,7 +265,7 @@ func TestVoteSet_2_3MajorityRedux(t *testing.T) { _, err = signAddVote(privValidators[70], vote, voteSet) require.NoError(t, err) blockID, ok = voteSet.TwoThirdsMajority() - assert.True(t, ok && blockID.Equals(BlockID{blockHash, blockPartSetHeader}), + assert.True(t, ok && blockID.Equals(BlockID{blockHash, blockPartSetHeader, blockHashAbiEncoded}), "there should be 2/3 majority") } } @@ -274,6 +275,7 @@ func TestVoteSet_Conflicts(t *testing.T) { voteSet, _, privValidators := randVoteSet(height, round, cmtproto.PrevoteType, 4, 1) blockHash1 := cmtrand.Bytes(32) blockHash2 := cmtrand.Bytes(32) + blockHashAbiEncoded := cmtrand.Bytes(32) voteProto := &Vote{ ValidatorAddress: nil, @@ -282,7 +284,7 @@ func TestVoteSet_Conflicts(t *testing.T) { Round: round, Timestamp: cmttime.Now(), Type: cmtproto.PrevoteType, - BlockID: BlockID{nil, PartSetHeader{}}, + BlockID: BlockID{nil, PartSetHeader{}, nil}, } val0, err := privValidators[0].GetPubKey() @@ -307,7 +309,7 @@ func TestVoteSet_Conflicts(t *testing.T) { } // start tracking blockHash1 - err = voteSet.SetPeerMaj23("peerA", BlockID{blockHash1, PartSetHeader{}}) + err = voteSet.SetPeerMaj23("peerA", BlockID{blockHash1, PartSetHeader{}, blockHashAbiEncoded}) require.NoError(t, err) // val0 votes again for blockHash1. @@ -319,7 +321,7 @@ func TestVoteSet_Conflicts(t *testing.T) { } // attempt tracking blockHash2, should fail because already set for peerA. - err = voteSet.SetPeerMaj23("peerA", BlockID{blockHash2, PartSetHeader{}}) + err = voteSet.SetPeerMaj23("peerA", BlockID{blockHash2, PartSetHeader{}, blockHashAbiEncoded}) require.Error(t, err) // val0 votes again for blockHash1. @@ -371,7 +373,7 @@ func TestVoteSet_Conflicts(t *testing.T) { } // now attempt tracking blockHash1 - err = voteSet.SetPeerMaj23("peerB", BlockID{blockHash1, PartSetHeader{}}) + err = voteSet.SetPeerMaj23("peerB", BlockID{blockHash1, PartSetHeader{}, blockHashAbiEncoded}) require.NoError(t, err) // val2 votes for blockHash1. @@ -402,6 +404,7 @@ func TestVoteSet_MakeCommit(t *testing.T) { height, round := int64(1), int32(0) voteSet, _, privValidators := randVoteSet(height, round, cmtproto.PrecommitType, 10, 1) blockHash, blockPartSetHeader := crypto.CRandBytes(32), PartSetHeader{123, crypto.CRandBytes(32)} + blockHashAbiEncoded := crypto.CRandBytes(32) voteProto := &Vote{ ValidatorAddress: nil, @@ -410,7 +413,7 @@ func TestVoteSet_MakeCommit(t *testing.T) { Round: round, Timestamp: cmttime.Now(), Type: cmtproto.PrecommitType, - BlockID: BlockID{blockHash, blockPartSetHeader}, + BlockID: BlockID{blockHash, blockPartSetHeader, blockHashAbiEncoded}, } // 6 out of 10 voted for some block. diff --git a/types/vote_test.go b/types/vote_test.go index 6b8657d5c0b..42c503a3301 100644 --- a/types/vote_test.go +++ b/types/vote_test.go @@ -244,7 +244,7 @@ func TestVoteValidateBasic(t *testing.T) { {"Zero Height", func(v *Vote) { v.Height = 0 }, true}, {"Negative Round", func(v *Vote) { v.Round = -1 }, true}, {"Invalid BlockID", func(v *Vote) { - v.BlockID = BlockID{[]byte{1, 2, 3}, PartSetHeader{111, []byte("blockparts")}} + v.BlockID = BlockID{[]byte{1, 2, 3}, PartSetHeader{111, []byte("blockparts")}, []byte{1, 2, 3}} }, true}, {"Invalid Address", func(v *Vote) { v.ValidatorAddress = make([]byte, 1) }, true}, {"Invalid ValidatorIndex", func(v *Vote) { v.ValidatorIndex = -1 }, true},