From 28426eae1a239b46a38453ee2bc7bd1cb8ee7fbb Mon Sep 17 00:00:00 2001 From: evan-forbes Date: Mon, 23 Aug 2021 16:20:06 -0500 Subject: [PATCH 01/10] Revert "Remove the PartSetHeader from VoteSetMaj23, VoteSetBits, and state.State (#479)" This reverts commit 3ba47c2dd58042cd07d3ac740d7fc2ab54fdab9b. --- consensus/msgs.go | 48 +++-- consensus/msgs_test.go | 48 ++--- consensus/reactor.go | 80 ++++---- consensus/reactor_test.go | 47 +++-- consensus/types/height_vote_set.go | 3 +- node/node_test.go | 1 + proto/tendermint/consensus/types.pb.go | 251 ++++++++++++++++++------- proto/tendermint/consensus/types.proto | 4 +- proto/tendermint/state/types.pb.go | 218 +++++++++++++-------- proto/tendermint/state/types.proto | 19 +- state/execution.go | 4 +- state/export_test.go | 2 +- state/state.go | 29 ++- state/validation.go | 2 +- state/validation_test.go | 4 +- statesync/stateprovider.go | 1 + types/block_test.go | 2 +- types/validator_set.go | 12 +- types/validator_set_test.go | 4 +- types/vote_set.go | 4 +- types/vote_set_test.go | 6 +- 21 files changed, 524 insertions(+), 265 deletions(-) diff --git a/consensus/msgs.go b/consensus/msgs.go index a03b1926cf..bd5b13daa3 100644 --- a/consensus/msgs.go +++ b/consensus/msgs.go @@ -109,26 +109,30 @@ func MsgToProto(msg Message) (*tmcons.Message, error) { } case *VoteSetMaj23Message: bi := msg.BlockID.ToProto() + psh := msg.PartSetHeader.ToProto() pb = tmcons.Message{ Sum: &tmcons.Message_VoteSetMaj23{ VoteSetMaj23: &tmcons.VoteSetMaj23{ - Height: msg.Height, - Round: msg.Round, - Type: msg.Type, - BlockID: bi, + Height: msg.Height, + Round: msg.Round, + Type: msg.Type, + BlockID: bi, + PartSetHeader: &psh, }, }, } case *VoteSetBitsMessage: bi := msg.BlockID.ToProto() + psh := msg.PartSetHeader.ToProto() bits := msg.Votes.ToProto() vsb := &tmcons.Message_VoteSetBits{ VoteSetBits: &tmcons.VoteSetBits{ - Height: msg.Height, - Round: msg.Round, - Type: msg.Type, - BlockID: bi, + Height: msg.Height, + Round: msg.Round, + Type: msg.Type, + BlockID: bi, + PartSetHeader: &psh, }, } @@ -238,17 +242,26 @@ func MsgFromProto(msg *tmcons.Message) (Message, error) { if err != nil { return nil, fmt.Errorf("voteSetMaj23 msg to proto error: %w", err) } + psh, err := types.PartSetHeaderFromProto(msg.VoteSetMaj23.PartSetHeader) + if err != nil { + return nil, fmt.Errorf("voteSetMaj23 msg to proto error: %w", err) + } pb = &VoteSetMaj23Message{ - Height: msg.VoteSetMaj23.Height, - Round: msg.VoteSetMaj23.Round, - Type: msg.VoteSetMaj23.Type, - BlockID: *bi, + Height: msg.VoteSetMaj23.Height, + Round: msg.VoteSetMaj23.Round, + Type: msg.VoteSetMaj23.Type, + BlockID: *bi, + PartSetHeader: *psh, } case *tmcons.Message_VoteSetBits: bi, err := types.BlockIDFromProto(&msg.VoteSetBits.BlockID) if err != nil { return nil, fmt.Errorf("block ID to proto error: %w", err) } + psh, err := types.PartSetHeaderFromProto(msg.VoteSetBits.PartSetHeader) + if err != nil { + return nil, fmt.Errorf("part set header to proto error: %w", err) + } bits := new(bits.BitArray) err = bits.FromProto(&msg.VoteSetBits.Votes) if err != nil { @@ -256,11 +269,12 @@ func MsgFromProto(msg *tmcons.Message) (Message, error) { } pb = &VoteSetBitsMessage{ - Height: msg.VoteSetBits.Height, - Round: msg.VoteSetBits.Round, - Type: msg.VoteSetBits.Type, - BlockID: *bi, - Votes: bits, + Height: msg.VoteSetBits.Height, + Round: msg.VoteSetBits.Round, + Type: msg.VoteSetBits.Type, + BlockID: *bi, + PartSetHeader: *psh, + Votes: bits, } default: return nil, fmt.Errorf("consensus: message not recognized: %T", msg) diff --git a/consensus/msgs_test.go b/consensus/msgs_test.go index 1bb8c5e2a9..e2596b9792 100644 --- a/consensus/msgs_test.go +++ b/consensus/msgs_test.go @@ -162,34 +162,38 @@ func TestMsgToProto(t *testing.T) { }, }, false}, {"successful VoteSetMaj23", &VoteSetMaj23Message{ - Height: 1, - Round: 1, - Type: 1, - BlockID: bi, + Height: 1, + Round: 1, + Type: 1, + BlockID: bi, + PartSetHeader: psh, }, &tmcons.Message{ Sum: &tmcons.Message_VoteSetMaj23{ VoteSetMaj23: &tmcons.VoteSetMaj23{ - Height: 1, - Round: 1, - Type: 1, - BlockID: pbBi, + Height: 1, + Round: 1, + Type: 1, + BlockID: pbBi, + PartSetHeader: &pbPsh, }, }, }, false}, {"successful VoteSetBits", &VoteSetBitsMessage{ - Height: 1, - Round: 1, - Type: 1, - BlockID: bi, - Votes: bits, + Height: 1, + Round: 1, + Type: 1, + BlockID: bi, + PartSetHeader: psh, + Votes: bits, }, &tmcons.Message{ Sum: &tmcons.Message_VoteSetBits{ VoteSetBits: &tmcons.VoteSetBits{ - Height: 1, - Round: 1, - Type: 1, - BlockID: pbBi, - Votes: *pbBits, + Height: 1, + Round: 1, + Type: 1, + BlockID: pbBi, + PartSetHeader: &pbPsh, + Votes: *pbBits, }, }, }, false}, @@ -420,11 +424,11 @@ func TestConsMsgsVectors(t *testing.T) { Type: tmproto.PrevoteType, Index: math.MaxInt32}}}, "3a1808ffffffffffffffff7f10ffffffff07180120ffffffff07"}, {"VoteSetMaj23", &tmcons.Message{Sum: &tmcons.Message_VoteSetMaj23{ - VoteSetMaj23: &tmcons.VoteSetMaj23{Height: 1, Round: 1, Type: tmproto.PrevoteType, BlockID: pbBi}}}, - "422a08011001180122220a206164645f6d6f72655f6578636c616d6174696f6e5f6d61726b735f636f64652d"}, + VoteSetMaj23: &tmcons.VoteSetMaj23{Height: 1, Round: 1, Type: tmproto.PrevoteType, BlockID: pbBi, PartSetHeader: &pbPsh}}}, + "425008011001180122220a206164645f6d6f72655f6578636c616d6174696f6e5f6d61726b735f636f64652d2a24080112206164645f6d6f72655f6578636c616d6174696f6e5f6d61726b735f636f64652d"}, {"VoteSetBits", &tmcons.Message{Sum: &tmcons.Message_VoteSetBits{ - VoteSetBits: &tmcons.VoteSetBits{Height: 1, Round: 1, Type: tmproto.PrevoteType, BlockID: pbBi, Votes: *pbBits}}}, - "4a3108011001180122220a206164645f6d6f72655f6578636c616d6174696f6e5f6d61726b735f636f64652d2a050801120100"}, + VoteSetBits: &tmcons.VoteSetBits{Height: 1, Round: 1, Type: tmproto.PrevoteType, BlockID: pbBi, PartSetHeader: &pbPsh, Votes: *pbBits}}}, + "4a5708011001180122220a206164645f6d6f72655f6578636c616d6174696f6e5f6d61726b735f636f64652d2a24080112206164645f6d6f72655f6578636c616d6174696f6e5f6d61726b735f636f64652d32050801120100"}, } for _, tc := range testCases { diff --git a/consensus/reactor.go b/consensus/reactor.go index 19384cd3e8..21dfd02047 100644 --- a/consensus/reactor.go +++ b/consensus/reactor.go @@ -275,7 +275,7 @@ func (conR *Reactor) Receive(chID byte, src p2p.Peer, msgBytes []byte) { return } // Peer claims to have a maj23 for some BlockID at H,R,S, - err := votes.SetPeerMaj23(msg.Round, msg.Type, ps.peer.ID(), msg.BlockID) + err := votes.SetPeerMaj23(msg.Round, msg.Type, ps.peer.ID(), msg.BlockID, msg.PartSetHeader) if err != nil { conR.Switch.StopPeerForError(src, err) return @@ -285,18 +285,19 @@ func (conR *Reactor) Receive(chID byte, src p2p.Peer, msgBytes []byte) { var ourVotes *bits.BitArray switch msg.Type { case tmproto.PrevoteType: - ourVotes = votes.Prevotes(msg.Round).BitArrayByBlockID(msg.BlockID) + ourVotes = votes.Prevotes(msg.Round).BitArrayByBlockID(msg.BlockID, msg.PartSetHeader) case tmproto.PrecommitType: - ourVotes = votes.Precommits(msg.Round).BitArrayByBlockID(msg.BlockID) + ourVotes = votes.Precommits(msg.Round).BitArrayByBlockID(msg.BlockID, msg.PartSetHeader) default: panic("Bad VoteSetBitsMessage field Type. Forgot to add a check in ValidateBasic?") } src.TrySend(VoteSetBitsChannel, MustEncode(&VoteSetBitsMessage{ - Height: msg.Height, - Round: msg.Round, - Type: msg.Type, - BlockID: msg.BlockID, - Votes: ourVotes, + Height: msg.Height, + Round: msg.Round, + Type: msg.Type, + BlockID: msg.BlockID, + PartSetHeader: msg.PartSetHeader, + Votes: ourVotes, })) default: conR.Logger.Error(fmt.Sprintf("Unknown message type %v", reflect.TypeOf(msg))) @@ -359,9 +360,9 @@ func (conR *Reactor) Receive(chID byte, src p2p.Peer, msgBytes []byte) { var ourVotes *bits.BitArray switch msg.Type { case tmproto.PrevoteType: - ourVotes = votes.Prevotes(msg.Round).BitArrayByBlockID(msg.BlockID) + ourVotes = votes.Prevotes(msg.Round).BitArrayByBlockID(msg.BlockID, msg.PartSetHeader) case tmproto.PrecommitType: - ourVotes = votes.Precommits(msg.Round).BitArrayByBlockID(msg.BlockID) + ourVotes = votes.Precommits(msg.Round).BitArrayByBlockID(msg.BlockID, msg.PartSetHeader) default: panic("Bad VoteSetBitsMessage field Type. Forgot to add a check in ValidateBasic?") } @@ -778,12 +779,13 @@ OUTER_LOOP: rs := conR.conS.GetRoundState() prs := ps.GetRoundState() if rs.Height == prs.Height { - if maj23, _, ok := rs.Votes.Prevotes(prs.Round).TwoThirdsMajority(); ok { + if maj23, maj23PSH, ok := rs.Votes.Prevotes(prs.Round).TwoThirdsMajority(); ok { peer.TrySend(StateChannel, MustEncode(&VoteSetMaj23Message{ - Height: prs.Height, - Round: prs.Round, - Type: tmproto.PrevoteType, - BlockID: maj23, + Height: prs.Height, + Round: prs.Round, + Type: tmproto.PrevoteType, + BlockID: maj23, + PartSetHeader: maj23PSH, })) time.Sleep(conR.conS.config.PeerQueryMaj23SleepDuration) } @@ -795,12 +797,13 @@ OUTER_LOOP: rs := conR.conS.GetRoundState() prs := ps.GetRoundState() if rs.Height == prs.Height { - if maj23, _, ok := rs.Votes.Precommits(prs.Round).TwoThirdsMajority(); ok { + if maj23, maj23PSH, ok := rs.Votes.Precommits(prs.Round).TwoThirdsMajority(); ok { peer.TrySend(StateChannel, MustEncode(&VoteSetMaj23Message{ - Height: prs.Height, - Round: prs.Round, - Type: tmproto.PrecommitType, - BlockID: maj23, + Height: prs.Height, + Round: prs.Round, + Type: tmproto.PrecommitType, + BlockID: maj23, + PartSetHeader: maj23PSH, })) time.Sleep(conR.conS.config.PeerQueryMaj23SleepDuration) } @@ -812,12 +815,13 @@ OUTER_LOOP: rs := conR.conS.GetRoundState() prs := ps.GetRoundState() if rs.Height == prs.Height && prs.ProposalPOLRound >= 0 { - if maj23, _, ok := rs.Votes.Prevotes(prs.ProposalPOLRound).TwoThirdsMajority(); ok { + if maj23, maj23PSH, ok := rs.Votes.Prevotes(prs.ProposalPOLRound).TwoThirdsMajority(); ok { peer.TrySend(StateChannel, MustEncode(&VoteSetMaj23Message{ - Height: prs.Height, - Round: prs.ProposalPOLRound, - Type: tmproto.PrevoteType, - BlockID: maj23, + Height: prs.Height, + Round: prs.ProposalPOLRound, + Type: tmproto.PrevoteType, + BlockID: maj23, + PartSetHeader: maj23PSH, })) time.Sleep(conR.conS.config.PeerQueryMaj23SleepDuration) } @@ -1661,10 +1665,11 @@ func (m *HasVoteMessage) String() string { // VoteSetMaj23Message is sent to indicate that a given BlockID has seen +2/3 votes. type VoteSetMaj23Message struct { - Height int64 - Round int32 - Type tmproto.SignedMsgType - BlockID types.BlockID + Height int64 + Round int32 + Type tmproto.SignedMsgType + BlockID types.BlockID + PartSetHeader types.PartSetHeader } // ValidateBasic performs basic validation. @@ -1681,6 +1686,9 @@ func (m *VoteSetMaj23Message) ValidateBasic() error { if err := m.BlockID.ValidateBasic(); err != nil { return fmt.Errorf("wrong BlockID: %w", err) } + if err := m.PartSetHeader.ValidateBasic(); err != nil { + return fmt.Errorf("wrong PartSetHeader: %w", err) + } return nil } @@ -1693,11 +1701,12 @@ func (m *VoteSetMaj23Message) String() string { // VoteSetBitsMessage is sent to communicate the bit-array of votes seen for the BlockID. type VoteSetBitsMessage struct { - Height int64 - Round int32 - Type tmproto.SignedMsgType - BlockID types.BlockID - Votes *bits.BitArray + Height int64 + Round int32 + Type tmproto.SignedMsgType + BlockID types.BlockID + PartSetHeader types.PartSetHeader + Votes *bits.BitArray } // ValidateBasic performs basic validation. @@ -1711,6 +1720,9 @@ func (m *VoteSetBitsMessage) ValidateBasic() error { if err := m.BlockID.ValidateBasic(); err != nil { return fmt.Errorf("wrong BlockID: %v", err) } + if err := m.PartSetHeader.ValidateBasic(); err != nil { + return fmt.Errorf("wrong PartSetHeader: %w", err) + } // NOTE: Votes.Size() can be zero if the node does not have any if m.Votes.Size() > types.MaxVotesCount { return fmt.Errorf("votes bit array is too big: %d, max: %d", m.Votes.Size(), types.MaxVotesCount) diff --git a/consensus/reactor_test.go b/consensus/reactor_test.go index de3a1c72e1..b3684ab911 100644 --- a/consensus/reactor_test.go +++ b/consensus/reactor_test.go @@ -926,8 +926,13 @@ func TestVoteSetMaj23MessageValidateBasic(t *testing.T) { ) validBlockID := types.BlockID{} + validPSH := types.PartSetHeader{} invalidBlockID := types.BlockID{ - Hash: bytes.HexBytes("invalid"), + Hash: bytes.HexBytes{}, + } + invalidPSH := types.PartSetHeader{ + Total: 1, + Hash: []byte{0}, } testCases := []struct { // nolint: maligned @@ -937,22 +942,24 @@ func TestVoteSetMaj23MessageValidateBasic(t *testing.T) { testName string messageType tmproto.SignedMsgType messageBlockID types.BlockID + messagePSH types.PartSetHeader }{ - {false, 0, 0, "Valid Message", validSignedMsgType, validBlockID}, - {true, -1, 0, "Invalid Message", validSignedMsgType, validBlockID}, - {true, 0, -1, "Invalid Message", validSignedMsgType, validBlockID}, - {true, 0, 0, "Invalid Message", invalidSignedMsgType, validBlockID}, - {true, 0, 0, "Invalid Message", validSignedMsgType, invalidBlockID}, + {false, 0, 0, "Valid Message", validSignedMsgType, validBlockID, validPSH}, + {true, -1, 0, "Invalid Message", validSignedMsgType, validBlockID, validPSH}, + {true, 0, -1, "Invalid Message", validSignedMsgType, validBlockID, validPSH}, + {true, 0, 0, "Invalid Message", invalidSignedMsgType, validBlockID, validPSH}, + {true, 0, 0, "Invalid Message", validSignedMsgType, invalidBlockID, invalidPSH}, } for _, tc := range testCases { tc := tc t.Run(tc.testName, func(t *testing.T) { message := VoteSetMaj23Message{ - Height: tc.messageHeight, - Round: tc.messageRound, - Type: tc.messageType, - BlockID: tc.messageBlockID, + Height: tc.messageHeight, + Round: tc.messageRound, + Type: tc.messageType, + BlockID: tc.messageBlockID, + PartSetHeader: tc.messagePSH, } assert.Equal(t, tc.expectErr, message.ValidateBasic() != nil, "Validate Basic had an unexpected result") @@ -968,6 +975,15 @@ func TestVoteSetBitsMessageValidateBasic(t *testing.T) { {func(msg *VoteSetBitsMessage) {}, ""}, {func(msg *VoteSetBitsMessage) { msg.Height = -1 }, "negative Height"}, {func(msg *VoteSetBitsMessage) { msg.Type = 0x03 }, "invalid Type"}, + {func(msg *VoteSetBitsMessage) { + msg.BlockID = types.BlockID{ + Hash: bytes.HexBytes{}, + } + msg.PartSetHeader = types.PartSetHeader{ + Total: 1, + Hash: []byte{0}, + } + }, "wrong PartSetHeader: wrong Hash:"}, {func(msg *VoteSetBitsMessage) { msg.Votes = bits.NewBitArray(types.MaxVotesCount + 1) }, "votes bit array is too big: 10001, max: 10000"}, } @@ -976,11 +992,12 @@ func TestVoteSetBitsMessageValidateBasic(t *testing.T) { tc := tc t.Run(fmt.Sprintf("#%d", i), func(t *testing.T) { msg := &VoteSetBitsMessage{ - Height: 1, - Round: 0, - Type: 0x01, - Votes: bits.NewBitArray(1), - BlockID: types.BlockID{}, + Height: 1, + Round: 0, + Type: 0x01, + Votes: bits.NewBitArray(1), + BlockID: types.BlockID{}, + PartSetHeader: types.PartSetHeader{}, } tc.malleateFn(msg) diff --git a/consensus/types/height_vote_set.go b/consensus/types/height_vote_set.go index 91335cd164..4232696286 100644 --- a/consensus/types/height_vote_set.go +++ b/consensus/types/height_vote_set.go @@ -187,6 +187,7 @@ func (hvs *HeightVoteSet) SetPeerMaj23( voteType tmproto.SignedMsgType, peerID p2p.ID, blockID types.BlockID, + partSetHeader types.PartSetHeader, ) error { hvs.mtx.Lock() defer hvs.mtx.Unlock() @@ -197,7 +198,7 @@ func (hvs *HeightVoteSet) SetPeerMaj23( if voteSet == nil { return nil // something we don't know about yet } - return voteSet.SetPeerMaj23(types.P2PID(peerID), blockID) + return voteSet.SetPeerMaj23(types.P2PID(peerID), blockID, partSetHeader) } //--------------------------------------------------------- diff --git a/node/node_test.go b/node/node_test.go index 135566f07b..568e85bd6a 100644 --- a/node/node_test.go +++ b/node/node_test.go @@ -467,6 +467,7 @@ func TestMaxProposalBlockSize(t *testing.T) { timestamp := time.Date(math.MaxInt64, 0, 0, 0, 0, 0, math.MaxInt64, time.UTC) // change state in order to produce the largest accepted header state.LastBlockID = blockID + state.LastPartSetHeader = psh state.LastBlockHeight = math.MaxInt64 - 1 state.LastBlockTime = timestamp state.LastResultsHash = tmhash.Sum([]byte("last_results_hash")) diff --git a/proto/tendermint/consensus/types.pb.go b/proto/tendermint/consensus/types.pb.go index 3ca53812cc..1bca909a81 100644 --- a/proto/tendermint/consensus/types.pb.go +++ b/proto/tendermint/consensus/types.pb.go @@ -465,10 +465,11 @@ func (m *HasVote) GetIndex() int32 { // VoteSetMaj23 is sent to indicate that a given BlockID has seen +2/3 votes. type VoteSetMaj23 struct { - Height int64 `protobuf:"varint,1,opt,name=height,proto3" json:"height,omitempty"` - Round int32 `protobuf:"varint,2,opt,name=round,proto3" json:"round,omitempty"` - Type types.SignedMsgType `protobuf:"varint,3,opt,name=type,proto3,enum=tendermint.types.SignedMsgType" json:"type,omitempty"` - BlockID types.BlockID `protobuf:"bytes,4,opt,name=block_id,json=blockId,proto3" json:"block_id"` + Height int64 `protobuf:"varint,1,opt,name=height,proto3" json:"height,omitempty"` + Round int32 `protobuf:"varint,2,opt,name=round,proto3" json:"round,omitempty"` + Type types.SignedMsgType `protobuf:"varint,3,opt,name=type,proto3,enum=tendermint.types.SignedMsgType" json:"type,omitempty"` + BlockID types.BlockID `protobuf:"bytes,4,opt,name=block_id,json=blockId,proto3" json:"block_id"` + PartSetHeader *types.PartSetHeader `protobuf:"bytes,5,opt,name=part_set_header,json=partSetHeader,proto3" json:"part_set_header,omitempty"` } func (m *VoteSetMaj23) Reset() { *m = VoteSetMaj23{} } @@ -532,13 +533,21 @@ func (m *VoteSetMaj23) GetBlockID() types.BlockID { return types.BlockID{} } +func (m *VoteSetMaj23) GetPartSetHeader() *types.PartSetHeader { + if m != nil { + return m.PartSetHeader + } + return nil +} + // VoteSetBits is sent to communicate the bit-array of votes seen for the BlockID. type VoteSetBits struct { - Height int64 `protobuf:"varint,1,opt,name=height,proto3" json:"height,omitempty"` - Round int32 `protobuf:"varint,2,opt,name=round,proto3" json:"round,omitempty"` - Type types.SignedMsgType `protobuf:"varint,3,opt,name=type,proto3,enum=tendermint.types.SignedMsgType" json:"type,omitempty"` - BlockID types.BlockID `protobuf:"bytes,4,opt,name=block_id,json=blockId,proto3" json:"block_id"` - Votes bits.BitArray `protobuf:"bytes,5,opt,name=votes,proto3" json:"votes"` + Height int64 `protobuf:"varint,1,opt,name=height,proto3" json:"height,omitempty"` + Round int32 `protobuf:"varint,2,opt,name=round,proto3" json:"round,omitempty"` + Type types.SignedMsgType `protobuf:"varint,3,opt,name=type,proto3,enum=tendermint.types.SignedMsgType" json:"type,omitempty"` + BlockID types.BlockID `protobuf:"bytes,4,opt,name=block_id,json=blockId,proto3" json:"block_id"` + PartSetHeader *types.PartSetHeader `protobuf:"bytes,5,opt,name=part_set_header,json=partSetHeader,proto3" json:"part_set_header,omitempty"` + Votes bits.BitArray `protobuf:"bytes,6,opt,name=votes,proto3" json:"votes"` } func (m *VoteSetBits) Reset() { *m = VoteSetBits{} } @@ -602,6 +611,13 @@ func (m *VoteSetBits) GetBlockID() types.BlockID { return types.BlockID{} } +func (m *VoteSetBits) GetPartSetHeader() *types.PartSetHeader { + if m != nil { + return m.PartSetHeader + } + return nil +} + func (m *VoteSetBits) GetVotes() bits.BitArray { if m != nil { return m.Votes @@ -801,61 +817,62 @@ func init() { func init() { proto.RegisterFile("tendermint/consensus/types.proto", fileDescriptor_81a22d2efc008981) } var fileDescriptor_81a22d2efc008981 = []byte{ - // 863 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x56, 0x4f, 0x8f, 0xdb, 0x44, - 0x14, 0xb7, 0x59, 0x67, 0x93, 0x7d, 0xde, 0x3f, 0x30, 0xda, 0x56, 0x61, 0x81, 0x6c, 0x30, 0x97, - 0x15, 0x02, 0x07, 0x65, 0x0f, 0x48, 0x15, 0x12, 0xc5, 0xfc, 0xa9, 0x5b, 0x35, 0x6d, 0xe4, 0x54, - 0x15, 0xea, 0xc5, 0x72, 0xe2, 0x91, 0x33, 0xd4, 0xf6, 0x58, 0x9e, 0x49, 0x96, 0x70, 0xe4, 0x13, - 0xf0, 0x01, 0xf8, 0x1a, 0x48, 0x7c, 0x84, 0x1e, 0x7b, 0xe4, 0x54, 0xa1, 0xec, 0x47, 0x40, 0x70, - 0x46, 0x33, 0x9e, 0x24, 0x13, 0xea, 0x2e, 0xec, 0x05, 0xa9, 0xb7, 0x99, 0xbc, 0xf7, 0x7e, 0xf3, - 0xde, 0xef, 0xbd, 0xf7, 0x8b, 0xa1, 0xcb, 0x71, 0x1e, 0xe3, 0x32, 0x23, 0x39, 0xef, 0x4d, 0x68, - 0xce, 0x70, 0xce, 0x66, 0xac, 0xc7, 0x17, 0x05, 0x66, 0x6e, 0x51, 0x52, 0x4e, 0xd1, 0xf1, 0xc6, - 0xc3, 0x5d, 0x7b, 0x9c, 0x1c, 0x27, 0x34, 0xa1, 0xd2, 0xa1, 0x27, 0x4e, 0x95, 0xef, 0xc9, 0xbb, - 0x1a, 0x9a, 0xc4, 0xd0, 0x91, 0x4e, 0xf4, 0xb7, 0x52, 0x32, 0x66, 0xbd, 0x31, 0xe1, 0x5b, 0x1e, - 0xce, 0x2f, 0x26, 0xec, 0x3f, 0xc0, 0x17, 0x01, 0x9d, 0xe5, 0xf1, 0x88, 0xe3, 0x02, 0xdd, 0x84, - 0xdd, 0x29, 0x26, 0xc9, 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, 0x16, 0xca, 0xa8, 0xa6, 0x8c, 0x7a, 0xaf, 0x3e, - 0x4a, 0xed, 0xbe, 0x6f, 0x04, 0xcd, 0xa9, 0x92, 0x81, 0x7b, 0x70, 0x28, 0xe2, 0xe4, 0xdf, 0x49, - 0x26, 0xd6, 0xb1, 0xdd, 0xba, 0xaa, 0xa1, 0xfa, 0xe2, 0x8a, 0x86, 0xce, 0xf5, 0x45, 0xbe, 0x03, - 0x07, 0x6b, 0x2c, 0x31, 0x4f, 0xed, 0xbd, 0xab, 0x48, 0xd4, 0x16, 0x49, 0x90, 0x38, 0xdf, 0x5c, - 0xbd, 0x06, 0xec, 0xb0, 0x59, 0xe6, 0x3d, 0x79, 0xb6, 0xec, 0x98, 0xcf, 0x97, 0x1d, 0xf3, 0xf7, - 0x65, 0xc7, 0xfc, 0xe9, 0xb2, 0x63, 0x3c, 0xbf, 0xec, 0x18, 0xbf, 0x5d, 0x76, 0x8c, 0x27, 0xb7, - 0x13, 0xc2, 0xa7, 0xb3, 0xb1, 0x3b, 0xa1, 0x59, 0x2f, 0x8d, 0x7e, 0x58, 0xa4, 0x38, 0x4e, 0x70, - 0xa9, 0x1d, 0x3f, 0x9e, 0xd0, 0x12, 0xf7, 0xaa, 0x4f, 0x8f, 0xba, 0x8f, 0x97, 0xf1, 0xae, 0xb4, - 0x9d, 0xff, 0x1d, 0x00, 0x00, 0xff, 0xff, 0x08, 0xab, 0x10, 0x2c, 0xdb, 0x08, 0x00, 0x00, + // 877 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe4, 0x56, 0x4f, 0x6f, 0xdc, 0x44, + 0x14, 0xb7, 0x93, 0xdd, 0xec, 0xe6, 0x6d, 0x36, 0x81, 0x51, 0x5a, 0x99, 0x00, 0x9b, 0x60, 0x2e, + 0x11, 0x02, 0x2f, 0xda, 0x1c, 0x90, 0x2a, 0x24, 0x8a, 0xf9, 0x53, 0x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, 0xa6, 0x94, 0xc8, 0x86, 0x9e, 0x9a, 0xd2, 0x72, 0x07, 0xfa, 0x4b, 0x2c, + 0x39, 0x4f, 0xce, 0xe6, 0x75, 0x24, 0x1a, 0x37, 0x52, 0x92, 0x78, 0x5a, 0x6f, 0xfd, 0x36, 0xac, + 0xf3, 0x93, 0xcc, 0x7f, 0xf2, 0xec, 0x62, 0x60, 0x3f, 0xbf, 0x18, 0xd8, 0x7f, 0x5e, 0x0c, 0xec, + 0x5f, 0x2e, 0x07, 0xd6, 0xf3, 0xcb, 0x81, 0xf5, 0xc7, 0xe5, 0xc0, 0x7a, 0x72, 0x3b, 0xa1, 0x62, + 0x7e, 0x32, 0xf5, 0x66, 0x2c, 0x1b, 0xa6, 0xd1, 0x8f, 0xe7, 0x29, 0x89, 0x13, 0x52, 0x1a, 0xcb, + 0x4f, 0x66, 0xac, 0x24, 0xc3, 0xea, 0x67, 0xa8, 0xe9, 0x77, 0x6a, 0xba, 0xa1, 0x6c, 0x47, 0xff, + 0x04, 0x00, 0x00, 0xff, 0xff, 0x23, 0xdb, 0x51, 0xd3, 0x6d, 0x09, 0x00, 0x00, } func (m *NewRoundStep) Marshal() (dAtA []byte, err error) { @@ -1188,6 +1205,18 @@ func (m *VoteSetMaj23) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if m.PartSetHeader != nil { + { + size, err := m.PartSetHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x2a + } { size, err := m.BlockID.MarshalToSizedBuffer(dAtA[:i]) if err != nil { @@ -1245,7 +1274,19 @@ func (m *VoteSetBits) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintTypes(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x2a + dAtA[i] = 0x32 + if m.PartSetHeader != nil { + { + size, err := m.PartSetHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x2a + } { size, err := m.BlockID.MarshalToSizedBuffer(dAtA[:i]) if err != nil { @@ -1650,6 +1691,10 @@ func (m *VoteSetMaj23) Size() (n int) { } l = m.BlockID.Size() n += 1 + l + sovTypes(uint64(l)) + if m.PartSetHeader != nil { + l = m.PartSetHeader.Size() + n += 1 + l + sovTypes(uint64(l)) + } return n } @@ -1670,6 +1715,10 @@ func (m *VoteSetBits) Size() (n int) { } l = m.BlockID.Size() n += 1 + l + sovTypes(uint64(l)) + if m.PartSetHeader != nil { + l = m.PartSetHeader.Size() + n += 1 + l + sovTypes(uint64(l)) + } l = m.Votes.Size() n += 1 + l + sovTypes(uint64(l)) return n @@ -2780,6 +2829,42 @@ func (m *VoteSetMaj23) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PartSetHeader", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.PartSetHeader == nil { + m.PartSetHeader = &types.PartSetHeader{} + } + if err := m.PartSetHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipTypes(dAtA[iNdEx:]) @@ -2921,6 +3006,42 @@ func (m *VoteSetBits) Unmarshal(dAtA []byte) error { } iNdEx = postIndex case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PartSetHeader", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.PartSetHeader == nil { + m.PartSetHeader = &types.PartSetHeader{} + } + if err := m.PartSetHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 6: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Votes", wireType) } diff --git a/proto/tendermint/consensus/types.proto b/proto/tendermint/consensus/types.proto index 4e76167c2e..f84e69a676 100644 --- a/proto/tendermint/consensus/types.proto +++ b/proto/tendermint/consensus/types.proto @@ -66,6 +66,7 @@ message VoteSetMaj23 { int32 round = 2; tendermint.types.SignedMsgType type = 3; tendermint.types.BlockID block_id = 4 [(gogoproto.customname) = "BlockID", (gogoproto.nullable) = false]; + tendermint.types.PartSetHeader part_set_header = 5; } // VoteSetBits is sent to communicate the bit-array of votes seen for the BlockID. @@ -74,7 +75,8 @@ message VoteSetBits { int32 round = 2; tendermint.types.SignedMsgType type = 3; tendermint.types.BlockID block_id = 4 [(gogoproto.customname) = "BlockID", (gogoproto.nullable) = false]; - tendermint.libs.bits.BitArray votes = 5 [(gogoproto.nullable) = false]; + tendermint.types.PartSetHeader part_set_header = 5; + tendermint.libs.bits.BitArray votes = 6 [(gogoproto.nullable) = false]; } message Message { diff --git a/proto/tendermint/state/types.pb.go b/proto/tendermint/state/types.pb.go index 7c2be41703..e4f2082063 100644 --- a/proto/tendermint/state/types.pb.go +++ b/proto/tendermint/state/types.pb.go @@ -257,27 +257,28 @@ type State struct { ChainID string `protobuf:"bytes,2,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` InitialHeight int64 `protobuf:"varint,15,opt,name=initial_height,json=initialHeight,proto3" json:"initial_height,omitempty"` // LastBlockHeight=0 at genesis (ie. block(H=0) does not exist) - LastBlockHeight int64 `protobuf:"varint,3,opt,name=last_block_height,json=lastBlockHeight,proto3" json:"last_block_height,omitempty"` - LastBlockID types1.BlockID `protobuf:"bytes,4,opt,name=last_block_id,json=lastBlockId,proto3" json:"last_block_id"` - LastBlockTime time.Time `protobuf:"bytes,5,opt,name=last_block_time,json=lastBlockTime,proto3,stdtime" json:"last_block_time"` + LastBlockHeight int64 `protobuf:"varint,3,opt,name=last_block_height,json=lastBlockHeight,proto3" json:"last_block_height,omitempty"` + LastBlockID types1.BlockID `protobuf:"bytes,4,opt,name=last_block_id,json=lastBlockId,proto3" json:"last_block_id"` + LastPartSetHeader *types1.PartSetHeader `protobuf:"bytes,5,opt,name=last_part_set_header,json=lastPartSetHeader,proto3" json:"last_part_set_header,omitempty"` + LastBlockTime time.Time `protobuf:"bytes,6,opt,name=last_block_time,json=lastBlockTime,proto3,stdtime" json:"last_block_time"` // LastValidators is used to validate block.LastCommit. // Validators are persisted to the database separately every time they change, // so we can query for historical validator sets. // Note that if s.LastBlockHeight causes a valset change, // we set s.LastHeightValidatorsChanged = s.LastBlockHeight + 1 + 1 // Extra +1 due to nextValSet delay. - NextValidators *types1.ValidatorSet `protobuf:"bytes,6,opt,name=next_validators,json=nextValidators,proto3" json:"next_validators,omitempty"` - Validators *types1.ValidatorSet `protobuf:"bytes,7,opt,name=validators,proto3" json:"validators,omitempty"` - LastValidators *types1.ValidatorSet `protobuf:"bytes,8,opt,name=last_validators,json=lastValidators,proto3" json:"last_validators,omitempty"` - LastHeightValidatorsChanged int64 `protobuf:"varint,9,opt,name=last_height_validators_changed,json=lastHeightValidatorsChanged,proto3" json:"last_height_validators_changed,omitempty"` + NextValidators *types1.ValidatorSet `protobuf:"bytes,7,opt,name=next_validators,json=nextValidators,proto3" json:"next_validators,omitempty"` + Validators *types1.ValidatorSet `protobuf:"bytes,8,opt,name=validators,proto3" json:"validators,omitempty"` + LastValidators *types1.ValidatorSet `protobuf:"bytes,9,opt,name=last_validators,json=lastValidators,proto3" json:"last_validators,omitempty"` + LastHeightValidatorsChanged int64 `protobuf:"varint,10,opt,name=last_height_validators_changed,json=lastHeightValidatorsChanged,proto3" json:"last_height_validators_changed,omitempty"` // Consensus parameters used for validating blocks. // Changes returned by EndBlock and updated after Commit. - ConsensusParams types1.ConsensusParams `protobuf:"bytes,10,opt,name=consensus_params,json=consensusParams,proto3" json:"consensus_params"` - LastHeightConsensusParamsChanged int64 `protobuf:"varint,11,opt,name=last_height_consensus_params_changed,json=lastHeightConsensusParamsChanged,proto3" json:"last_height_consensus_params_changed,omitempty"` + ConsensusParams types1.ConsensusParams `protobuf:"bytes,11,opt,name=consensus_params,json=consensusParams,proto3" json:"consensus_params"` + LastHeightConsensusParamsChanged int64 `protobuf:"varint,12,opt,name=last_height_consensus_params_changed,json=lastHeightConsensusParamsChanged,proto3" json:"last_height_consensus_params_changed,omitempty"` // Merkle root of the results from executing prev block - LastResultsHash []byte `protobuf:"bytes,12,opt,name=last_results_hash,json=lastResultsHash,proto3" json:"last_results_hash,omitempty"` + LastResultsHash []byte `protobuf:"bytes,13,opt,name=last_results_hash,json=lastResultsHash,proto3" json:"last_results_hash,omitempty"` // the latest AppHash we've received from calling abci.Commit() - AppHash []byte `protobuf:"bytes,13,opt,name=app_hash,json=appHash,proto3" json:"app_hash,omitempty"` + AppHash []byte `protobuf:"bytes,14,opt,name=app_hash,json=appHash,proto3" json:"app_hash,omitempty"` } func (m *State) Reset() { *m = State{} } @@ -348,6 +349,13 @@ func (m *State) GetLastBlockID() types1.BlockID { return types1.BlockID{} } +func (m *State) GetLastPartSetHeader() *types1.PartSetHeader { + if m != nil { + return m.LastPartSetHeader + } + return nil +} + func (m *State) GetLastBlockTime() time.Time { if m != nil { return m.LastBlockTime @@ -422,56 +430,58 @@ func init() { func init() { proto.RegisterFile("tendermint/state/types.proto", fileDescriptor_ccfacf933f22bf93) } var fileDescriptor_ccfacf933f22bf93 = []byte{ - // 776 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x95, 0xcf, 0x4f, 0xe3, 0x46, - 0x14, 0xc7, 0xe3, 0x06, 0x48, 0x32, 0x26, 0x84, 0x0e, 0x3d, 0x98, 0x50, 0x9c, 0x90, 0xfe, 0x10, - 0xaa, 0x54, 0x47, 0xa2, 0xa7, 0x4a, 0x15, 0x12, 0x4e, 0xaa, 0x12, 0x09, 0x55, 0x95, 0x41, 0x1c, - 0x7a, 0xb1, 0x26, 0xf6, 0x60, 0x5b, 0x75, 0x6c, 0xcb, 0x33, 0x49, 0xa1, 0xf7, 0xde, 0xb9, 0xf6, - 0x3f, 0xe2, 0xc8, 0xb1, 0xda, 0x03, 0xbb, 0x1b, 0xfe, 0x91, 0xd5, 0xfc, 0xb0, 0x33, 0x49, 0x16, - 0x89, 0xd5, 0xde, 0xc6, 0xf3, 0xbe, 0xef, 0x33, 0xdf, 0x79, 0xf3, 0x9e, 0x0c, 0xbe, 0xa6, 0x38, - 0xf1, 0x71, 0x3e, 0x89, 0x12, 0xda, 0x27, 0x14, 0x51, 0xdc, 0xa7, 0x77, 0x19, 0x26, 0x56, 0x96, - 0xa7, 0x34, 0x85, 0xbb, 0x8b, 0xa8, 0xc5, 0xa3, 0xed, 0xaf, 0x82, 0x34, 0x48, 0x79, 0xb0, 0xcf, - 0x56, 0x42, 0xd7, 0x3e, 0x50, 0x28, 0x68, 0xec, 0x45, 0x2a, 0xa4, 0xad, 0x1e, 0xc1, 0xf7, 0x97, - 0xa2, 0xdd, 0xb5, 0xe8, 0x0c, 0xc5, 0x91, 0x8f, 0x68, 0x9a, 0x4b, 0xc5, 0xe1, 0x9a, 0x22, 0x43, - 0x39, 0x9a, 0x14, 0x00, 0x53, 0x09, 0xcf, 0x70, 0x4e, 0xa2, 0x34, 0x59, 0x3a, 0xa0, 0x13, 0xa4, - 0x69, 0x10, 0xe3, 0x3e, 0xff, 0x1a, 0x4f, 0x6f, 0xfa, 0x34, 0x9a, 0x60, 0x42, 0xd1, 0x24, 0x13, - 0x82, 0xde, 0x1b, 0x0d, 0x34, 0xcf, 0xec, 0xc1, 0xc8, 0xc1, 0x24, 0x4b, 0x13, 0x82, 0x09, 0x1c, - 0x00, 0xdd, 0xc7, 0x71, 0x34, 0xc3, 0xb9, 0x4b, 0x6f, 0x89, 0xa1, 0x75, 0xab, 0xc7, 0xfa, 0x49, - 0xcf, 0x52, 0x8a, 0xc1, 0x2e, 0x69, 0x15, 0x09, 0x43, 0xa1, 0xbd, 0xba, 0x75, 0x80, 0x5f, 0x2c, - 0x09, 0x3c, 0x05, 0x0d, 0x9c, 0xf8, 0xee, 0x38, 0x4e, 0xbd, 0xbf, 0x8c, 0x2f, 0xba, 0xda, 0xb1, - 0x7e, 0x72, 0xf4, 0x22, 0xe2, 0xd7, 0xc4, 0xb7, 0x99, 0xd0, 0xa9, 0x63, 0xb9, 0x82, 0x43, 0xa0, - 0x8f, 0x71, 0x10, 0x25, 0x92, 0x50, 0xe5, 0x84, 0x6f, 0x5e, 0x24, 0xd8, 0x4c, 0x2b, 0x18, 0x60, - 0x5c, 0xae, 0x7b, 0xff, 0x6a, 0x60, 0xe7, 0xba, 0x28, 0x28, 0x19, 0x25, 0x37, 0x29, 0x1c, 0x80, - 0x66, 0x59, 0x62, 0x97, 0x60, 0x6a, 0x68, 0x1c, 0x6d, 0xaa, 0x68, 0x51, 0xc0, 0x32, 0xf1, 0x12, - 0x53, 0x67, 0x7b, 0xa6, 0x7c, 0x41, 0x0b, 0xec, 0xc5, 0x88, 0x50, 0x37, 0xc4, 0x51, 0x10, 0x52, - 0xd7, 0x0b, 0x51, 0x12, 0x60, 0x9f, 0xdf, 0xb3, 0xea, 0x7c, 0xc9, 0x42, 0xe7, 0x3c, 0x32, 0x10, - 0x81, 0xde, 0x7f, 0x1a, 0xd8, 0x1b, 0x30, 0x9f, 0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67, 0xb3, 0xf2, 0xe7, 0x2f, 0x41, 0x44, 0xc3, 0xe9, 0xd8, 0xf2, 0xd2, - 0x49, 0x3f, 0x46, 0xff, 0xdc, 0xc5, 0xd8, 0x0f, 0x70, 0xae, 0x2c, 0x7f, 0xf4, 0xd2, 0x5c, 0xfe, - 0x28, 0xfa, 0xab, 0xff, 0xc5, 0xf1, 0x16, 0xdf, 0xff, 0xe9, 0x43, 0x00, 0x00, 0x00, 0xff, 0xff, - 0x62, 0x98, 0xd0, 0xfd, 0x32, 0x07, 0x00, 0x00, + // 809 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x55, 0xcd, 0x4e, 0xf3, 0x46, + 0x14, 0x8d, 0x9b, 0x0f, 0x92, 0x8c, 0x49, 0x42, 0x07, 0x16, 0x26, 0x14, 0x27, 0xa4, 0x3f, 0x42, + 0x95, 0xea, 0x48, 0x74, 0x55, 0xa9, 0x42, 0xc2, 0x49, 0x55, 0x22, 0xa1, 0x0a, 0x19, 0xc4, 0xa2, + 0x1b, 0x6b, 0x62, 0x0f, 0xb6, 0x55, 0xc7, 0xb6, 0x3c, 0x93, 0x14, 0xba, 0xef, 0x9e, 0x6d, 0x9f, + 0xa3, 0x2f, 0xc1, 0x92, 0x65, 0xd5, 0x05, 0xad, 0xc2, 0x8b, 0x54, 0xf3, 0x63, 0x67, 0x92, 0x14, + 0x89, 0xaa, 0xbb, 0xf1, 0xbd, 0xe7, 0x9e, 0x39, 0x73, 0xe7, 0x9e, 0x31, 0xf8, 0x84, 0xe2, 0xc4, + 0xc7, 0xf9, 0x34, 0x4a, 0xe8, 0x80, 0x50, 0x44, 0xf1, 0x80, 0x3e, 0x64, 0x98, 0x58, 0x59, 0x9e, + 0xd2, 0x14, 0xee, 0x2e, 0xb3, 0x16, 0xcf, 0x76, 0xf6, 0x83, 0x34, 0x48, 0x79, 0x72, 0xc0, 0x56, + 0x02, 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f, 0xc6, 0xd5, 0xff, 0xa7, 0x71, 0x7f, 0x00, 0x9f, 0xad, 0x18, 0x77, 0x8d, + 0xbf, 0x94, 0xb7, 0xc3, 0xe5, 0xf5, 0x14, 0x27, 0xaf, 0x12, 0x15, 0x1a, 0x8b, 0xd1, 0xce, 0x31, + 0x99, 0xc5, 0x94, 0xb8, 0x21, 0x22, 0xa1, 0xd1, 0xec, 0x69, 0x27, 0x3b, 0x62, 0xb4, 0x1d, 0x11, + 0xbf, 0x40, 0x24, 0x84, 0x07, 0xa0, 0x8e, 0xb2, 0x4c, 0x40, 0x5a, 0x1c, 0x52, 0x43, 0x59, 0xc6, + 0x52, 0xf6, 0xed, 0xd3, 0xc2, 0xd4, 0x9e, 0x17, 0xa6, 0xf6, 0xf7, 0xc2, 0xd4, 0x1e, 0x5f, 0xcd, + 0xca, 0xf3, 0xab, 0x59, 0xf9, 0xe3, 0xd5, 0xac, 0xfc, 0xf8, 0x6d, 0x10, 0xd1, 0x70, 0x36, 0xb1, + 0xbc, 0x74, 0x3a, 0x88, 0xd1, 0x2f, 0x0f, 0x31, 0xf6, 0x03, 0x9c, 0x2b, 0xcb, 0xaf, 0xbc, 0x34, + 0x97, 0xbf, 0x9e, 0xc1, 0xfa, 0x9f, 0x76, 0xb2, 0xcd, 0xe3, 0x5f, 0xff, 0x13, 0x00, 0x00, 0xff, + 0xff, 0x9d, 0xd6, 0x60, 0x0f, 0x84, 0x07, 0x00, 0x00, } func (m *ABCIResponses) Marshal() (dAtA []byte, err error) { @@ -683,19 +693,19 @@ func (m *State) MarshalToSizedBuffer(dAtA []byte) (int, error) { copy(dAtA[i:], m.AppHash) i = encodeVarintTypes(dAtA, i, uint64(len(m.AppHash))) i-- - dAtA[i] = 0x6a + dAtA[i] = 0x72 } if len(m.LastResultsHash) > 0 { i -= len(m.LastResultsHash) copy(dAtA[i:], m.LastResultsHash) i = encodeVarintTypes(dAtA, i, uint64(len(m.LastResultsHash))) i-- - dAtA[i] = 0x62 + dAtA[i] = 0x6a } if m.LastHeightConsensusParamsChanged != 0 { i = encodeVarintTypes(dAtA, i, uint64(m.LastHeightConsensusParamsChanged)) i-- - dAtA[i] = 0x58 + dAtA[i] = 0x60 } { size, err := m.ConsensusParams.MarshalToSizedBuffer(dAtA[:i]) @@ -706,11 +716,11 @@ func (m *State) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintTypes(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x52 + dAtA[i] = 0x5a if m.LastHeightValidatorsChanged != 0 { i = encodeVarintTypes(dAtA, i, uint64(m.LastHeightValidatorsChanged)) i-- - dAtA[i] = 0x48 + dAtA[i] = 0x50 } if m.LastValidators != nil { { @@ -722,7 +732,7 @@ func (m *State) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintTypes(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x42 + dAtA[i] = 0x4a } if m.Validators != nil { { @@ -734,7 +744,7 @@ func (m *State) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintTypes(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x3a + dAtA[i] = 0x42 } if m.NextValidators != nil { { @@ -746,7 +756,7 @@ func (m *State) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintTypes(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x32 + dAtA[i] = 0x3a } n10, err10 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.LastBlockTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.LastBlockTime):]) if err10 != nil { @@ -755,7 +765,19 @@ func (m *State) MarshalToSizedBuffer(dAtA []byte) (int, error) { i -= n10 i = encodeVarintTypes(dAtA, i, uint64(n10)) i-- - dAtA[i] = 0x2a + dAtA[i] = 0x32 + if m.LastPartSetHeader != nil { + { + size, err := m.LastPartSetHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x2a + } { size, err := m.LastBlockID.MarshalToSizedBuffer(dAtA[:i]) if err != nil { @@ -887,6 +909,10 @@ func (m *State) Size() (n int) { } l = m.LastBlockID.Size() n += 1 + l + sovTypes(uint64(l)) + if m.LastPartSetHeader != nil { + l = m.LastPartSetHeader.Size() + n += 1 + l + sovTypes(uint64(l)) + } l = github_com_gogo_protobuf_types.SizeOfStdTime(m.LastBlockTime) n += 1 + l + sovTypes(uint64(l)) if m.NextValidators != nil { @@ -1554,6 +1580,42 @@ func (m *State) Unmarshal(dAtA []byte) error { } iNdEx = postIndex case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field LastPartSetHeader", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.LastPartSetHeader == nil { + m.LastPartSetHeader = &types1.PartSetHeader{} + } + if err := m.LastPartSetHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 6: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field LastBlockTime", wireType) } @@ -1586,7 +1648,7 @@ func (m *State) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 6: + case 7: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field NextValidators", wireType) } @@ -1622,7 +1684,7 @@ func (m *State) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 7: + case 8: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Validators", wireType) } @@ -1658,7 +1720,7 @@ func (m *State) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 8: + case 9: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field LastValidators", wireType) } @@ -1694,7 +1756,7 @@ func (m *State) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 9: + case 10: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field LastHeightValidatorsChanged", wireType) } @@ -1713,7 +1775,7 @@ func (m *State) Unmarshal(dAtA []byte) error { break } } - case 10: + case 11: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field ConsensusParams", wireType) } @@ -1746,7 +1808,7 @@ func (m *State) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 11: + case 12: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field LastHeightConsensusParamsChanged", wireType) } @@ -1765,7 +1827,7 @@ func (m *State) Unmarshal(dAtA []byte) error { break } } - case 12: + case 13: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field LastResultsHash", wireType) } @@ -1799,7 +1861,7 @@ func (m *State) Unmarshal(dAtA []byte) error { m.LastResultsHash = []byte{} } iNdEx = postIndex - case 13: + case 14: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field AppHash", wireType) } diff --git a/proto/tendermint/state/types.proto b/proto/tendermint/state/types.proto index 7c7992904b..bdace5ff81 100644 --- a/proto/tendermint/state/types.proto +++ b/proto/tendermint/state/types.proto @@ -48,7 +48,8 @@ message State { int64 last_block_height = 3; tendermint.types.BlockID last_block_id = 4 [(gogoproto.nullable) = false, (gogoproto.customname) = "LastBlockID"]; - google.protobuf.Timestamp last_block_time = 5 + tendermint.types.PartSetHeader last_part_set_header = 5; + google.protobuf.Timestamp last_block_time = 6 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; // LastValidators is used to validate block.LastCommit. @@ -57,19 +58,19 @@ message State { // Note that if s.LastBlockHeight causes a valset change, // we set s.LastHeightValidatorsChanged = s.LastBlockHeight + 1 + 1 // Extra +1 due to nextValSet delay. - tendermint.types.ValidatorSet next_validators = 6; - tendermint.types.ValidatorSet validators = 7; - tendermint.types.ValidatorSet last_validators = 8; - int64 last_height_validators_changed = 9; + tendermint.types.ValidatorSet next_validators = 7; + tendermint.types.ValidatorSet validators = 8; + tendermint.types.ValidatorSet last_validators = 9; + int64 last_height_validators_changed = 10; // Consensus parameters used for validating blocks. // Changes returned by EndBlock and updated after Commit. - tendermint.types.ConsensusParams consensus_params = 10 [(gogoproto.nullable) = false]; - int64 last_height_consensus_params_changed = 11; + tendermint.types.ConsensusParams consensus_params = 11 [(gogoproto.nullable) = false]; + int64 last_height_consensus_params_changed = 12; // Merkle root of the results from executing prev block - bytes last_results_hash = 12; + bytes last_results_hash = 13; // the latest AppHash we've received from calling abci.Commit() - bytes app_hash = 13; + bytes app_hash = 14; } diff --git a/state/execution.go b/state/execution.go index 72ced3d4ab..0f0e1d4126 100644 --- a/state/execution.go +++ b/state/execution.go @@ -220,7 +220,7 @@ func (blockExec *BlockExecutor) ApplyBlock( } // Update the state with the block and responses. - state, err = updateState(state, blockID, &block.Header, abciResponses, validatorUpdates) + state, err = updateState(state, blockID, partSetHeader, &block.Header, abciResponses, validatorUpdates) if err != nil { return state, 0, fmt.Errorf("commit failed for application: %v", err) } @@ -456,6 +456,7 @@ func validateValidatorUpdates(abciUpdates []abci.ValidatorUpdate, func updateState( state State, blockID types.BlockID, + partSetHeader types.PartSetHeader, header *types.Header, abciResponses *tmstate.ABCIResponses, validatorUpdates []*types.Validator, @@ -506,6 +507,7 @@ func updateState( InitialHeight: state.InitialHeight, LastBlockHeight: header.Height, LastBlockID: blockID, + LastPartSetHeader: partSetHeader, LastBlockTime: header.Time, NextValidators: nValSet, Validators: state.NextValidators.Copy(), diff --git a/state/export_test.go b/state/export_test.go index e57e7dde7f..d5335421d4 100644 --- a/state/export_test.go +++ b/state/export_test.go @@ -31,7 +31,7 @@ func UpdateState( abciResponses *tmstate.ABCIResponses, validatorUpdates []*types.Validator, ) (State, error) { - return updateState(state, blockID, header, abciResponses, validatorUpdates) + return updateState(state, blockID, partSetHeader, header, abciResponses, validatorUpdates) } // ValidateValidatorUpdates is an alias for validateValidatorUpdates exported diff --git a/state/state.go b/state/state.go index 6aefbfc3c1..db5ed26ecf 100644 --- a/state/state.go +++ b/state/state.go @@ -54,9 +54,10 @@ type State struct { InitialHeight int64 // should be 1, not 0, when starting from height 1 // LastBlockHeight=0 at genesis (ie. block(H=0) does not exist) - LastBlockHeight int64 - LastBlockID types.BlockID - LastBlockTime time.Time + LastBlockHeight int64 + LastBlockID types.BlockID + LastPartSetHeader types.PartSetHeader + LastBlockTime time.Time // LastValidators is used to validate block.LastCommit. // Validators are persisted to the database separately every time they change, @@ -89,9 +90,10 @@ func (state State) Copy() State { ChainID: state.ChainID, InitialHeight: state.InitialHeight, - LastBlockHeight: state.LastBlockHeight, - LastBlockID: state.LastBlockID, - LastBlockTime: state.LastBlockTime, + LastBlockHeight: state.LastBlockHeight, + LastBlockID: state.LastBlockID, + LastPartSetHeader: state.LastPartSetHeader, + LastBlockTime: state.LastBlockTime, NextValidators: state.NextValidators.Copy(), Validators: state.Validators.Copy(), @@ -146,6 +148,8 @@ func (state *State) ToProto() (*tmstate.State, error) { sm.LastBlockHeight = state.LastBlockHeight sm.LastBlockID = state.LastBlockID.ToProto() + lpsh := state.LastPartSetHeader.ToProto() + sm.LastPartSetHeader = &lpsh sm.LastBlockTime = state.LastBlockTime vals, err := state.Validators.ToProto() if err != nil { @@ -194,6 +198,12 @@ func StateFromProto(pb *tmstate.State) (*State, error) { //nolint:golint } state.LastBlockID = *bi + lpsh, err := types.PartSetHeaderFromProto(pb.LastPartSetHeader) + if err != nil { + return nil, err + } + state.LastPartSetHeader = *lpsh + state.LastBlockHeight = pb.LastBlockHeight state.LastBlockTime = pb.LastBlockTime @@ -343,9 +353,10 @@ func MakeGenesisState(genDoc *types.GenesisDoc) (State, error) { ChainID: genDoc.ChainID, InitialHeight: genDoc.InitialHeight, - LastBlockHeight: 0, - LastBlockID: types.BlockID{}, - LastBlockTime: genDoc.GenesisTime, + LastBlockHeight: 0, + LastBlockID: types.BlockID{}, + LastPartSetHeader: types.PartSetHeader{}, + LastBlockTime: genDoc.GenesisTime, NextValidators: nextValidatorSet, Validators: validatorSet, diff --git a/state/validation.go b/state/validation.go index fd68df8269..80c9d58037 100644 --- a/state/validation.go +++ b/state/validation.go @@ -90,7 +90,7 @@ func validateBlock(state State, block *types.Block) error { } else { // LastCommit.Signatures length is checked in VerifyCommit. if err := state.LastValidators.VerifyCommit( - state.ChainID, state.LastBlockID, block.Height-1, block.LastCommit); err != nil { + state.ChainID, state.LastBlockID, state.LastPartSetHeader, block.Height-1, block.LastCommit); err != nil { return err } } diff --git a/state/validation_test.go b/state/validation_test.go index 2b14146f5e..faeb8015f7 100644 --- a/state/validation_test.go +++ b/state/validation_test.go @@ -142,7 +142,7 @@ func TestValidateBlockCommit(t *testing.T) { wrongHeightVote, err := types.MakeVote( height, state.LastBlockID, - types.PartSetHeader{}, + state.LastPartSetHeader, state.Validators, privVals[proposerAddr.String()], chainID, @@ -154,7 +154,7 @@ func TestValidateBlockCommit(t *testing.T) { wrongHeightVote.Round, state.LastBlockID, []types.CommitSig{wrongHeightVote.CommitSig()}, - types.PartSetHeader{}, + state.LastPartSetHeader, ) block, _ := state.MakeBlock(height, makeTxs(height), nil, nil, types.Messages{}, wrongHeightCommit, proposerAddr) err = blockExec.ValidateBlock(state, block) diff --git a/statesync/stateprovider.go b/statesync/stateprovider.go index 7bd2474e21..7407d98988 100644 --- a/statesync/stateprovider.go +++ b/statesync/stateprovider.go @@ -161,6 +161,7 @@ func (s *lightClientStateProvider) State(ctx context.Context, height uint64) (sm state.LastBlockHeight = lastLightBlock.Height state.LastBlockTime = lastLightBlock.Time state.LastBlockID = lastLightBlock.Commit.BlockID + state.LastPartSetHeader = lastLightBlock.Commit.PartSetHeader state.AppHash = curLightBlock.AppHash state.LastResultsHash = curLightBlock.LastResultsHash state.LastValidators = lastLightBlock.ValidatorSet diff --git a/types/block_test.go b/types/block_test.go index bbc3521ec8..214ef1fbcd 100644 --- a/types/block_test.go +++ b/types/block_test.go @@ -627,7 +627,7 @@ func TestCommitToVoteSetWithVotesForNilBlock(t *testing.T) { if tc.valid { commit := voteSet.MakeCommit() // panics without > 2/3 valid votes assert.NotNil(t, commit) - err := valSet.VerifyCommit(voteSet.ChainID(), blockID, height-1, commit) + err := valSet.VerifyCommit(voteSet.ChainID(), blockID, psh, height-1, commit) assert.Nil(t, err) } else { assert.Panics(t, func() { voteSet.MakeCommit() }) diff --git a/types/validator_set.go b/types/validator_set.go index f9b79f9df6..1d2f122c09 100644 --- a/types/validator_set.go +++ b/types/validator_set.go @@ -659,7 +659,8 @@ func (vals *ValidatorSet) UpdateWithChangeSet(changes []*Validator) error { // application that depends on the LastCommitInfo sent in BeginBlock, which // includes which validators signed. For instance, Gaia incentivizes proposers // with a bonus for including more than +2/3 of the signatures. -func (vals *ValidatorSet) VerifyCommit(chainID string, blockID BlockID, height int64, commit *Commit) error { +func (vals *ValidatorSet) VerifyCommit(chainID string, blockID BlockID, + partSetHeader PartSetHeader, height int64, commit *Commit) error { if commit == nil { return errors.New("nil commit") } @@ -677,6 +678,11 @@ func (vals *ValidatorSet) VerifyCommit(chainID string, blockID BlockID, height i blockID, commit.BlockID) } + if !partSetHeader.Equals(commit.PartSetHeader) { + return fmt.Errorf("invalid commit -- wrong Part Set eader: want %v, got %v", + partSetHeader, commit.PartSetHeader) + } + talliedVotingPower := int64(0) votingPowerNeeded := vals.TotalVotingPower() * 2 / 3 for idx, commitSig := range commit.Signatures { @@ -734,6 +740,10 @@ func (vals *ValidatorSet) VerifyCommitLight(chainID string, blockID BlockID, return fmt.Errorf("invalid commit -- wrong block ID: want %v, got %v", blockID, commit.BlockID) } + if !partSetHeader.Equals(commit.PartSetHeader) { + return fmt.Errorf("invalid commit -- wrong PartSetHeader: want %v, got %v", + partSetHeader, commit.PartSetHeader) + } talliedVotingPower := int64(0) votingPowerNeeded := vals.TotalVotingPower() * 2 / 3 diff --git a/types/validator_set_test.go b/types/validator_set_test.go index f0fe1f433e..aabbca0545 100644 --- a/types/validator_set_test.go +++ b/types/validator_set_test.go @@ -724,7 +724,7 @@ func TestValidatorSet_VerifyCommit_All(t *testing.T) { for _, tc := range testCases { tc := tc t.Run(tc.description, func(t *testing.T) { - err := vset.VerifyCommit(tc.chainID, tc.blockID, tc.height, tc.commit) + err := vset.VerifyCommit(tc.chainID, tc.blockID, tc.partSetHeader, tc.height, tc.commit) if tc.expErr { if assert.Error(t, err, "VerifyCommit") { assert.Contains(t, err.Error(), tc.description, "VerifyCommit") @@ -765,7 +765,7 @@ func TestValidatorSet_VerifyCommit_CheckAllSignatures(t *testing.T) { vote.Signature = v.Signature commit.Signatures[3] = vote.CommitSig() - err = valSet.VerifyCommit(chainID, blockID, h, commit) + err = valSet.VerifyCommit(chainID, blockID, psh, h, commit) if assert.Error(t, err) { assert.Contains(t, err.Error(), "wrong signature (#3)") } diff --git a/types/vote_set.go b/types/vote_set.go index cf3db03a3d..38295e878f 100644 --- a/types/vote_set.go +++ b/types/vote_set.go @@ -309,7 +309,7 @@ func (voteSet *VoteSet) addVerifiedVote( // this can cause memory issues. // TODO: implement ability to remove peers too // NOTE: VoteSet must not be nil -func (voteSet *VoteSet) SetPeerMaj23(peerID P2PID, blockID BlockID) error { +func (voteSet *VoteSet) SetPeerMaj23(peerID P2PID, blockID BlockID, partSetHeader PartSetHeader) error { if voteSet == nil { panic("SetPeerMaj23() on nil VoteSet") } @@ -354,7 +354,7 @@ func (voteSet *VoteSet) BitArray() *bits.BitArray { return voteSet.votesBitArray.Copy() } -func (voteSet *VoteSet) BitArrayByBlockID(blockID BlockID) *bits.BitArray { +func (voteSet *VoteSet) BitArrayByBlockID(blockID BlockID, partSetHeader PartSetHeader) *bits.BitArray { if voteSet == nil { return nil } diff --git a/types/vote_set_test.go b/types/vote_set_test.go index 3e311a4c02..fc5f9b8559 100644 --- a/types/vote_set_test.go +++ b/types/vote_set_test.go @@ -287,7 +287,7 @@ func TestVoteSet_Conflicts(t *testing.T) { } // start tracking blockHash1 - err = voteSet.SetPeerMaj23("peerA", BlockID{blockHash1}) + err = voteSet.SetPeerMaj23("peerA", BlockID{blockHash1}, PartSetHeader{}) require.NoError(t, err) // val0 votes again for blockHash1. @@ -299,7 +299,7 @@ func TestVoteSet_Conflicts(t *testing.T) { } // attempt tracking blockHash2, should fail because already set for peerA. - err = voteSet.SetPeerMaj23("peerA", BlockID{blockHash2}) + err = voteSet.SetPeerMaj23("peerA", BlockID{blockHash2}, PartSetHeader{}) require.Error(t, err) // val0 votes again for blockHash1. @@ -351,7 +351,7 @@ func TestVoteSet_Conflicts(t *testing.T) { } // now attempt tracking blockHash1 - err = voteSet.SetPeerMaj23("peerB", BlockID{blockHash1}) + err = voteSet.SetPeerMaj23("peerB", BlockID{blockHash1}, PartSetHeader{}) require.NoError(t, err) // val2 votes for blockHash1. From 68a08c60a62717770b2ba64b8774675056c944a7 Mon Sep 17 00:00:00 2001 From: evan-forbes Date: Mon, 23 Aug 2021 16:21:40 -0500 Subject: [PATCH 02/10] Revert "Stop Signing over the `PartSetHeader` for Votes and remove it from the `Header` (#457)" This reverts commit 818be04956367e3f43bc323126fe8f744e2ccd40. --- blockchain/msgs_test.go | 2 +- evidence/verify_test.go | 1 + proto/tendermint/types/canonical.pb.go | 151 ++++++--- proto/tendermint/types/canonical.proto | 1 + proto/tendermint/types/types.pb.go | 423 ++++++++++++++----------- proto/tendermint/types/types.proto | 21 +- state/state.go | 2 +- state/tx_filter_test.go | 4 +- state/validation.go | 7 + state/validation_test.go | 1 + types/block.go | 29 +- types/block_test.go | 63 +++- types/canonical.go | 14 +- types/evidence_test.go | 1 + types/protobuf.go | 4 +- types/vote.go | 4 - types/vote_test.go | 38 +-- 17 files changed, 476 insertions(+), 290 deletions(-) diff --git a/blockchain/msgs_test.go b/blockchain/msgs_test.go index a01ddf4936..80ff2c6b65 100644 --- a/blockchain/msgs_test.go +++ b/blockchain/msgs_test.go @@ -97,7 +97,7 @@ func TestBlockchainMessageVectors(t *testing.T) { BlockRequest: &bcproto.BlockRequest{Height: math.MaxInt64}}}, "0a0a08ffffffffffffffff7f"}, {"BlockResponseMessage", &bcproto.Message{Sum: &bcproto.Message_BlockResponse{ - BlockResponse: &bcproto.BlockResponse{Block: bpb}}}, "1ac0020abd020a5b0a02080b1803220b088092b8c398feffffff012a00380142204c149a7cfadc92b669b0cbfa4951a1b18c2d9f3177a3b8756d39ebb96e9d63317220e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b85512130a0b48656c6c6f20576f726c6412001a0022001ac8010a3000000000000000010000000000000001b81cb5596c28d044214b9f935e4af7dbe76e417f6182d86fbee68bfff7b2ff3a0a30ffffffffffffffffffffffffffffffffc4096ba8fccf882c309896e9168fa43fe62fccb752cb12d5160cc1d9c2ebffe7123000000000000000010000000000000001b81cb5596c28d044214b9f935e4af7dbe76e417f6182d86fbee68bfff7b2ff3a1230ffffffffffffffffffffffffffffffffc4096ba8fccf882c309896e9168fa43fe62fccb752cb12d5160cc1d9c2ebffe7"}, + BlockResponse: &bcproto.BlockResponse{Block: bpb}}}, "1ac2020abf020a5d0a02080b1803220b088092b8c398feffffff012a00320040014a204c149a7cfadc92b669b0cbfa4951a1b18c2d9f3177a3b8756d39ebb96e9d63317a20e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b85512130a0b48656c6c6f20576f726c6412001a0022001ac8010a3000000000000000010000000000000001b81cb5596c28d044214b9f935e4af7dbe76e417f6182d86fbee68bfff7b2ff3a0a30ffffffffffffffffffffffffffffffffc4096ba8fccf882c309896e9168fa43fe62fccb752cb12d5160cc1d9c2ebffe7123000000000000000010000000000000001b81cb5596c28d044214b9f935e4af7dbe76e417f6182d86fbee68bfff7b2ff3a1230ffffffffffffffffffffffffffffffffc4096ba8fccf882c309896e9168fa43fe62fccb752cb12d5160cc1d9c2ebffe7"}, {"NoBlockResponseMessage", &bcproto.Message{Sum: &bcproto.Message_NoBlockResponse{ NoBlockResponse: &bcproto.NoBlockResponse{Height: 1}}}, "12020801"}, {"NoBlockResponseMessage", &bcproto.Message{Sum: &bcproto.Message_NoBlockResponse{ diff --git a/evidence/verify_test.go b/evidence/verify_test.go index 1463c104f3..2cdedb707e 100644 --- a/evidence/verify_test.go +++ b/evidence/verify_test.go @@ -442,6 +442,7 @@ func makeHeaderRandom(height int64) *types.Header { Height: height, Time: defaultEvidenceTime, LastBlockID: makeBlockID([]byte("headerhash")), + LastPartSetHeader: makePartSetHeader(1000, []byte("partshash")), LastCommitHash: crypto.CRandBytes(tmhash.Size), DataHash: crypto.CRandBytes(tmhash.Size), ValidatorsHash: crypto.CRandBytes(tmhash.Size), diff --git a/proto/tendermint/types/canonical.pb.go b/proto/tendermint/types/canonical.pb.go index b058083ff5..f362c30feb 100644 --- a/proto/tendermint/types/canonical.pb.go +++ b/proto/tendermint/types/canonical.pb.go @@ -233,12 +233,13 @@ func (m *CanonicalProposal) GetPartSetHeader() *CanonicalPartSetHeader { } type CanonicalVote struct { - Type SignedMsgType `protobuf:"varint,1,opt,name=type,proto3,enum=tendermint.types.SignedMsgType" json:"type,omitempty"` - Height int64 `protobuf:"fixed64,2,opt,name=height,proto3" json:"height,omitempty"` - Round int64 `protobuf:"fixed64,3,opt,name=round,proto3" json:"round,omitempty"` - BlockID *CanonicalBlockID `protobuf:"bytes,4,opt,name=block_id,json=blockId,proto3" json:"block_id,omitempty"` - Timestamp time.Time `protobuf:"bytes,5,opt,name=timestamp,proto3,stdtime" json:"timestamp"` - ChainID string `protobuf:"bytes,6,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` + Type SignedMsgType `protobuf:"varint,1,opt,name=type,proto3,enum=tendermint.types.SignedMsgType" json:"type,omitempty"` + Height int64 `protobuf:"fixed64,2,opt,name=height,proto3" json:"height,omitempty"` + Round int64 `protobuf:"fixed64,3,opt,name=round,proto3" json:"round,omitempty"` + BlockID *CanonicalBlockID `protobuf:"bytes,4,opt,name=block_id,json=blockId,proto3" json:"block_id,omitempty"` + Timestamp time.Time `protobuf:"bytes,5,opt,name=timestamp,proto3,stdtime" json:"timestamp"` + ChainID string `protobuf:"bytes,6,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` + PartSetHeader *CanonicalPartSetHeader `protobuf:"bytes,7,opt,name=part_set_header,json=partSetHeader,proto3" json:"part_set_header,omitempty"` } func (m *CanonicalVote) Reset() { *m = CanonicalVote{} } @@ -316,6 +317,13 @@ func (m *CanonicalVote) GetChainID() string { return "" } +func (m *CanonicalVote) GetPartSetHeader() *CanonicalPartSetHeader { + if m != nil { + return m.PartSetHeader + } + return nil +} + func init() { proto.RegisterType((*CanonicalBlockID)(nil), "tendermint.types.CanonicalBlockID") proto.RegisterType((*CanonicalPartSetHeader)(nil), "tendermint.types.CanonicalPartSetHeader") @@ -326,40 +334,41 @@ func init() { func init() { proto.RegisterFile("tendermint/types/canonical.proto", fileDescriptor_8d1a1a84ff7267ed) } var fileDescriptor_8d1a1a84ff7267ed = []byte{ - // 528 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x54, 0xbd, 0x6e, 0xdb, 0x3c, - 0x14, 0xb5, 0x12, 0xff, 0xc8, 0x4c, 0xfc, 0x7d, 0x2e, 0x11, 0x04, 0x86, 0x51, 0x48, 0x86, 0x87, - 0xc0, 0x1d, 0x2a, 0x01, 0xc9, 0xda, 0x25, 0x8a, 0x87, 0xba, 0x68, 0x51, 0x83, 0x0e, 0x32, 0x74, - 0x31, 0x28, 0x91, 0x95, 0x88, 0xd2, 0xa2, 0x20, 0xd1, 0x05, 0xdc, 0xa9, 0x8f, 0x90, 0xe7, 0xe8, - 0x93, 0x64, 0xcc, 0xd8, 0xc9, 0x2d, 0xe4, 0x17, 0x29, 0x44, 0xca, 0x3f, 0xb0, 0x9b, 0xa9, 0x45, - 0x17, 0xe1, 0x9e, 0x7b, 0x0f, 0xcf, 0xbd, 0xba, 0x47, 0x22, 0xe8, 0x49, 0x1a, 0x13, 0x9a, 0xce, - 0x58, 0x2c, 0x5d, 0xb9, 0x48, 0x68, 0xe6, 0x06, 0x38, 0x16, 0x31, 0x0b, 0x30, 0x77, 0x92, 0x54, - 0x48, 0x01, 0xdb, 0x5b, 0x86, 0xa3, 0x18, 0xdd, 0xb3, 0x50, 0x84, 0x42, 0x15, 0xdd, 0x22, 0xd2, - 0xbc, 0xee, 0xf3, 0x03, 0x25, 0xf5, 0x2c, 0xab, 0x76, 0x28, 0x44, 0xc8, 0xa9, 0xab, 0x90, 0x3f, - 0xff, 0xe8, 0x4a, 0x36, 0xa3, 0x99, 0xc4, 0xb3, 0x44, 0x13, 0xfa, 0x17, 0xa0, 0x7d, 0xb3, 0xee, - 0xec, 0x71, 0x11, 0x7c, 0x1a, 0x0d, 0x21, 0x04, 0xd5, 0x08, 0x67, 0x51, 0xc7, 0xe8, 0x19, 0x83, - 0x53, 0xa4, 0xe2, 0xbe, 0x07, 0xce, 0x37, 0xbc, 0x31, 0x4e, 0xe5, 0x84, 0xca, 0xd7, 0x14, 0x13, - 0x9a, 0xc2, 0x33, 0x50, 0x93, 0x42, 0x62, 0xae, 0xe8, 0x2d, 0xa4, 0xc1, 0x46, 0xe3, 0x68, 0x47, - 0xe3, 0x6b, 0x15, 0x3c, 0xdb, 0x8a, 0xa4, 0x22, 0x11, 0x19, 0xe6, 0xf0, 0x0a, 0x54, 0x8b, 0x89, - 0xd5, 0xf1, 0xff, 0x2e, 0x6d, 0x67, 0xff, 0xbd, 0x9d, 0x09, 0x0b, 0x63, 0x4a, 0xde, 0x65, 0xe1, - 0xed, 0x22, 0xa1, 0x48, 0x91, 0xe1, 0x39, 0xa8, 0x47, 0x94, 0x85, 0x91, 0x54, 0x0d, 0xda, 0xa8, - 0x44, 0xc5, 0x30, 0xa9, 0x98, 0xc7, 0xa4, 0x73, 0xac, 0xd2, 0x1a, 0xc0, 0x17, 0xa0, 0x99, 0x08, - 0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0xfb, 0x73, 0x4f, 0xeb, 0x4f, 0x7b, 0xea, 0xdd, 0x3d, 0xe4, 0x96, - 0xf1, 0x98, 0x5b, 0xc6, 0xcf, 0xdc, 0x32, 0xee, 0x57, 0x56, 0xe5, 0x71, 0x65, 0x55, 0xbe, 0xaf, - 0xac, 0xca, 0x87, 0x57, 0x21, 0x93, 0xd1, 0xdc, 0x77, 0x02, 0x31, 0x73, 0x39, 0xfe, 0xb2, 0xe0, - 0x94, 0x84, 0x34, 0xdd, 0x09, 0x5f, 0x06, 0x22, 0x2d, 0xff, 0x7a, 0x77, 0xff, 0x82, 0xf0, 0xeb, - 0x2a, 0x7f, 0xf5, 0x2b, 0x00, 0x00, 0xff, 0xff, 0xa4, 0x25, 0x48, 0x96, 0x85, 0x04, 0x00, 0x00, + // 533 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x54, 0x3d, 0x6f, 0xdb, 0x30, + 0x10, 0xb5, 0x12, 0x7f, 0xc8, 0x4c, 0xdc, 0xba, 0x44, 0x10, 0x18, 0x46, 0x21, 0x19, 0x1e, 0x02, + 0x77, 0xa8, 0x04, 0x24, 0x6b, 0x97, 0x28, 0x1e, 0xea, 0xa2, 0x45, 0x0d, 0x3a, 0xc8, 0xd0, 0xc5, + 0xa0, 0x45, 0x56, 0x22, 0x4a, 0x8b, 0x82, 0x44, 0x17, 0x70, 0xa7, 0xfe, 0x84, 0xfc, 0xac, 0x8c, + 0x19, 0x3b, 0xb9, 0x85, 0xfc, 0x37, 0x3a, 0x14, 0x22, 0xe5, 0x0f, 0xd8, 0x69, 0x97, 0x14, 0x59, + 0x84, 0x7b, 0x77, 0x8f, 0xef, 0x4e, 0xf7, 0x08, 0x82, 0x8e, 0xa4, 0x11, 0xa1, 0xc9, 0x94, 0x45, + 0xd2, 0x95, 0xf3, 0x98, 0xa6, 0xae, 0x8f, 0x23, 0x11, 0x31, 0x1f, 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 0xf8, 0x95, 0x59, 0xc6, 0xed, 0xd2, 0x2a, 0xdd, + 0x2f, 0xad, 0xd2, 0x8f, 0xa5, 0x55, 0xfa, 0xf4, 0x26, 0x60, 0x32, 0x9c, 0x4d, 0x1c, 0x5f, 0x4c, + 0x5d, 0x8e, 0xbf, 0xcd, 0x39, 0x25, 0x01, 0x4d, 0xb6, 0xc2, 0xd7, 0xbe, 0x48, 0x8a, 0x77, 0xc4, + 0xdd, 0x7d, 0x72, 0x26, 0x55, 0x95, 0xbf, 0xf8, 0x13, 0x00, 0x00, 0xff, 0xff, 0x86, 0x9b, 0x2b, + 0x01, 0xd7, 0x04, 0x00, 0x00, } func (m *CanonicalBlockID) Marshal() (dAtA []byte, err error) { @@ -543,6 +552,18 @@ func (m *CanonicalVote) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if m.PartSetHeader != nil { + { + size, err := m.PartSetHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintCanonical(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x3a + } if len(m.ChainID) > 0 { i -= len(m.ChainID) copy(dAtA[i:], m.ChainID) @@ -550,12 +571,12 @@ func (m *CanonicalVote) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x32 } - n5, err5 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.Timestamp, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.Timestamp):]) - if err5 != nil { - return 0, err5 + n6, err6 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.Timestamp, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.Timestamp):]) + if err6 != nil { + return 0, err6 } - i -= n5 - i = encodeVarintCanonical(dAtA, i, uint64(n5)) + i -= n6 + i = encodeVarintCanonical(dAtA, i, uint64(n6)) i-- dAtA[i] = 0x2a if m.BlockID != nil { @@ -694,6 +715,10 @@ func (m *CanonicalVote) Size() (n int) { if l > 0 { n += 1 + l + sovCanonical(uint64(l)) } + if m.PartSetHeader != nil { + l = m.PartSetHeader.Size() + n += 1 + l + sovCanonical(uint64(l)) + } return n } @@ -1340,6 +1365,42 @@ func (m *CanonicalVote) Unmarshal(dAtA []byte) error { } m.ChainID = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PartSetHeader", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCanonical + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthCanonical + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthCanonical + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.PartSetHeader == nil { + m.PartSetHeader = &CanonicalPartSetHeader{} + } + if err := m.PartSetHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipCanonical(dAtA[iNdEx:]) diff --git a/proto/tendermint/types/canonical.proto b/proto/tendermint/types/canonical.proto index 1d0911d356..6de5c35d87 100644 --- a/proto/tendermint/types/canonical.proto +++ b/proto/tendermint/types/canonical.proto @@ -35,4 +35,5 @@ message CanonicalVote { CanonicalBlockID block_id = 4 [(gogoproto.customname) = "BlockID"]; google.protobuf.Timestamp timestamp = 5 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; string chain_id = 6 [(gogoproto.customname) = "ChainID"]; + CanonicalPartSetHeader part_set_header = 7; } diff --git a/proto/tendermint/types/types.pb.go b/proto/tendermint/types/types.pb.go index ca771349dd..d7139a655f 100644 --- a/proto/tendermint/types/types.pb.go +++ b/proto/tendermint/types/types.pb.go @@ -261,20 +261,21 @@ type Header struct { Height int64 `protobuf:"varint,3,opt,name=height,proto3" json:"height,omitempty"` Time time.Time `protobuf:"bytes,4,opt,name=time,proto3,stdtime" json:"time"` // prev block info - LastBlockId BlockID `protobuf:"bytes,5,opt,name=last_block_id,json=lastBlockId,proto3" json:"last_block_id"` + LastBlockId BlockID `protobuf:"bytes,5,opt,name=last_block_id,json=lastBlockId,proto3" json:"last_block_id"` + LastPartSetHeader *PartSetHeader `protobuf:"bytes,6,opt,name=last_part_set_header,json=lastPartSetHeader,proto3" json:"last_part_set_header,omitempty"` // hashes of block data - LastCommitHash []byte `protobuf:"bytes,6,opt,name=last_commit_hash,json=lastCommitHash,proto3" json:"last_commit_hash,omitempty"` - NumOriginalDataShares uint64 `protobuf:"varint,7,opt,name=num_original_data_shares,json=numOriginalDataShares,proto3" json:"num_original_data_shares,omitempty"` - DataHash []byte `protobuf:"bytes,8,opt,name=data_hash,json=dataHash,proto3" json:"data_hash,omitempty"` + LastCommitHash []byte `protobuf:"bytes,7,opt,name=last_commit_hash,json=lastCommitHash,proto3" json:"last_commit_hash,omitempty"` + NumOriginalDataShares uint64 `protobuf:"varint,8,opt,name=num_original_data_shares,json=numOriginalDataShares,proto3" json:"num_original_data_shares,omitempty"` + DataHash []byte `protobuf:"bytes,9,opt,name=data_hash,json=dataHash,proto3" json:"data_hash,omitempty"` // hashes from the app output from the prev block - ValidatorsHash []byte `protobuf:"bytes,9,opt,name=validators_hash,json=validatorsHash,proto3" json:"validators_hash,omitempty"` - NextValidatorsHash []byte `protobuf:"bytes,10,opt,name=next_validators_hash,json=nextValidatorsHash,proto3" json:"next_validators_hash,omitempty"` - ConsensusHash []byte `protobuf:"bytes,11,opt,name=consensus_hash,json=consensusHash,proto3" json:"consensus_hash,omitempty"` - AppHash []byte `protobuf:"bytes,12,opt,name=app_hash,json=appHash,proto3" json:"app_hash,omitempty"` - LastResultsHash []byte `protobuf:"bytes,13,opt,name=last_results_hash,json=lastResultsHash,proto3" json:"last_results_hash,omitempty"` + ValidatorsHash []byte `protobuf:"bytes,10,opt,name=validators_hash,json=validatorsHash,proto3" json:"validators_hash,omitempty"` + NextValidatorsHash []byte `protobuf:"bytes,11,opt,name=next_validators_hash,json=nextValidatorsHash,proto3" json:"next_validators_hash,omitempty"` + ConsensusHash []byte `protobuf:"bytes,12,opt,name=consensus_hash,json=consensusHash,proto3" json:"consensus_hash,omitempty"` + AppHash []byte `protobuf:"bytes,13,opt,name=app_hash,json=appHash,proto3" json:"app_hash,omitempty"` + LastResultsHash []byte `protobuf:"bytes,14,opt,name=last_results_hash,json=lastResultsHash,proto3" json:"last_results_hash,omitempty"` // consensus info - EvidenceHash []byte `protobuf:"bytes,14,opt,name=evidence_hash,json=evidenceHash,proto3" json:"evidence_hash,omitempty"` - ProposerAddress []byte `protobuf:"bytes,15,opt,name=proposer_address,json=proposerAddress,proto3" json:"proposer_address,omitempty"` + EvidenceHash []byte `protobuf:"bytes,15,opt,name=evidence_hash,json=evidenceHash,proto3" json:"evidence_hash,omitempty"` + ProposerAddress []byte `protobuf:"bytes,16,opt,name=proposer_address,json=proposerAddress,proto3" json:"proposer_address,omitempty"` } func (m *Header) Reset() { *m = Header{} } @@ -345,6 +346,13 @@ func (m *Header) GetLastBlockId() BlockID { return BlockID{} } +func (m *Header) GetLastPartSetHeader() *PartSetHeader { + if m != nil { + return m.LastPartSetHeader + } + return nil +} + func (m *Header) GetLastCommitHash() []byte { if m != nil { return m.LastCommitHash @@ -1632,126 +1640,127 @@ func init() { func init() { proto.RegisterFile("tendermint/types/types.proto", fileDescriptor_d3a6e55e2345de56) } var fileDescriptor_d3a6e55e2345de56 = []byte{ - // 1893 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x58, 0x49, 0x6f, 0xe3, 0xc8, - 0xf5, 0x37, 0xb5, 0x58, 0xd4, 0x93, 0x64, 0xcb, 0xf5, 0xb7, 0xdd, 0xb2, 0xba, 0x2d, 0xeb, 0xaf, - 0x2c, 0xe3, 0xd9, 0xe4,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, 0x1d, 0xbb, 0xef, 0x12, 0xeb, 0x88, - 0xf6, 0x4f, 0x2f, 0x7d, 0x62, 0x08, 0x70, 0x6c, 0x65, 0x48, 0x4c, 0xac, 0x0c, 0xab, 0x90, 0x0e, - 0xbc, 0x91, 0x6b, 0x89, 0x4e, 0x4d, 0x1b, 0xf2, 0x01, 0x1d, 0x80, 0x1e, 0x6d, 0x02, 0xa9, 0xff, - 0xb4, 0x09, 0x2c, 0xf3, 0x84, 0xf2, 0x3d, 0x45, 0x11, 0x8c, 0x4c, 0x57, 0x2d, 0x04, 0xf7, 0x50, - 0x6c, 0xe8, 0x7d, 0x58, 0x19, 0x4f, 0x8a, 0xf0, 0x9e, 0x93, 0x5b, 0x45, 0x31, 0x62, 0xa8, 0x8b, - 0x6e, 0x72, 0xac, 0xc8, 0xad, 0x30, 0x23, 0xfc, 0x1a, 0x8f, 0x95, 0x96, 0x58, 0x0f, 0x1f, 0x41, - 0x96, 0xda, 0x7d, 0x17, 0xb3, 0x51, 0x40, 0xd4, 0x1e, 0x31, 0x26, 0xa0, 0x27, 0xb0, 0xec, 0xe3, - 0x80, 0x99, 0x94, 0x30, 0x73, 0x20, 0xb2, 0x27, 0x16, 0x89, 0xdc, 0xac, 0x60, 0x4f, 0xac, 0xaf, - 0x46, 0xc1, 0x8f, 0x3f, 0xd6, 0x7e, 0x9f, 0x80, 0x45, 0xb9, 0xf6, 0xc4, 0x12, 0xa0, 0xcd, 0x4e, - 0x40, 0x62, 0x5e, 0x02, 0x92, 0x77, 0x4f, 0x40, 0x03, 0x20, 0xf2, 0x8a, 0xdf, 0x99, 0x73, 0x26, - 0x8c, 0x34, 0xb1, 0x63, 0xf7, 0x55, 0x73, 0xc6, 0x84, 0xd0, 0x16, 0xe4, 0x64, 0x08, 0xe4, 0x26, - 0x92, 0x16, 0xb1, 0x02, 0x49, 0x12, 0x7b, 0xc8, 0x8c, 0x60, 0x2d, 0xde, 0x29, 0x58, 0x7f, 0xd3, - 0x20, 0x1b, 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xab, 0x4f, 0x82, 0xd8, 0xdf, 0x0f, 0x7b, 0x5e, 0xa0, 0xbe, 0x28, 0xee, 0xdc, - 0xfe, 0xfc, 0xd7, 0x5d, 0x14, 0xf4, 0x8f, 0xfe, 0x1d, 0x00, 0x00, 0xff, 0xff, 0x09, 0x91, 0xde, - 0x4a, 0xbf, 0x14, 0x00, 0x00, + // 1910 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x58, 0x4b, 0x73, 0xdb, 0xc8, + 0x11, 0x16, 0xf8, 0x66, 0x93, 0x94, 0xa8, 0x89, 0x24, 0x53, 0xb2, 0x45, 0x31, 0xcc, 0x63, 0xb5, + 0x2f, 0xca, 0xf1, 0xa6, 0xf2, 0xa8, 0xda, 0x6c, 0x2d, 0x29, 0x69, 0x6d, 0x66, 0xf5, 0x60, 0x81, + 0x5a, 0xe5, 0x71, 0x41, 0x0d, 0x89, 0x31, 0x89, 0x18, 0x04, 0x58, 0xc0, 0x50, 0x96, 0x7c, 0xcc, + 0x29, 0xa5, 0x93, 0xff, 0x80, 0x4e, 0xc9, 0x21, 0x95, 0x5b, 0xfe, 0xc5, 0x5e, 0x52, 0xb5, 0xc9, + 0x25, 0xb9, 0xc4, 0x49, 0xc9, 0xb9, 0xe5, 0x94, 0x7f, 0x90, 0x9a, 0x9e, 0x01, 0x08, 0x8a, 0xa4, + 0xe3, 0xa8, 0x54, 0x7b, 0x61, 0x11, 0xdd, 0x5f, 0xf7, 0xf4, 0x7b, 0x1a, 0x80, 0x07, 0x9c, 0x39, + 0x26, 0xf3, 0x06, 0x96, 0xc3, 0x77, 0xf8, 0xc5, 0x90, 0xf9, 0xf2, 0xb7, 0x36, 0xf4, 0x5c, 0xee, + 0x92, 0xe2, 0x98, 0x5b, 0x43, 0xfa, 0xc6, 0x4a, 0xcf, 0xed, 0xb9, 0xc8, 0xdc, 0x11, 0xff, 0x24, + 0x6e, 0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09, 0x7d, + 0xd5, 0x19, 0x0d, 0x8e, 0x15, 0x7b, 0x8f, 0x72, 0xda, 0x46, 0x26, 0xb9, 0x0f, 0x59, 0xc4, 0xa2, + 0xee, 0x2c, 0xea, 0xce, 0x08, 0x02, 0x6a, 0x7d, 0x07, 0x96, 0xc2, 0x8a, 0xf5, 0x25, 0x04, 0xe4, + 0xf1, 0x63, 0x32, 0x02, 0x1f, 0xc2, 0x8a, 0xc3, 0xce, 0xb9, 0x71, 0x13, 0x9d, 0x43, 0x34, 0x11, + 0xbc, 0xd3, 0x49, 0x89, 0xef, 0xc0, 0x62, 0x37, 0xa8, 0x03, 0x89, 0xcd, 0x23, 0xb6, 0x10, 0x52, + 0x11, 0xb6, 0x0e, 0x19, 0x3a, 0x1c, 0x4a, 0x40, 0x01, 0x01, 0x69, 0x3a, 0x1c, 0x22, 0xeb, 0x3d, + 0xc0, 0x88, 0x19, 0x1e, 0xf3, 0x47, 0x36, 0x57, 0x4a, 0x16, 0x11, 0xb3, 0x24, 0x18, 0xba, 0xa4, + 0x23, 0xf6, 0x5b, 0x50, 0x60, 0x67, 0x96, 0xc9, 0x9c, 0x2e, 0x93, 0xb8, 0x25, 0xc4, 0xe5, 0x03, + 0x22, 0x82, 0xde, 0x85, 0xe2, 0xd0, 0x73, 0x87, 0xae, 0xcf, 0x3c, 0x83, 0x9a, 0xa6, 0xc7, 0x7c, + 0xbf, 0x54, 0x94, 0xfa, 0x02, 0x7a, 0x5d, 0x92, 0xab, 0xbf, 0x8e, 0x41, 0x42, 0x04, 0x91, 0x14, + 0x21, 0xce, 0xcf, 0xfd, 0x92, 0x56, 0x89, 0x6f, 0xe7, 0x75, 0xf1, 0x97, 0xf4, 0xa1, 0x64, 0x39, + 0x9c, 0x79, 0x03, 0x66, 0x5a, 0x94, 0x33, 0xc3, 0xe7, 0xe2, 0xd7, 0x73, 0x5d, 0x2e, 0x9b, 0x31, + 0xf7, 0x68, 0x7b, 0xba, 0x12, 0x9a, 0x11, 0x89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x78, 0xbb, 0x42, 0xf4, + 0x43, 0x58, 0x9f, 0x81, 0x0e, 0x1d, 0x5b, 0xbe, 0xbc, 0xaa, 0x14, 0x5a, 0x1e, 0x93, 0x43, 0x02, + 0x25, 0x6a, 0x50, 0x9a, 0x96, 0x38, 0x6e, 0x1d, 0xb7, 0xeb, 0x07, 0xc5, 0xca, 0x46, 0xf1, 0xf2, + 0xaa, 0x92, 0x0f, 0xee, 0x23, 0x81, 0x1f, 0x7b, 0xd6, 0x38, 0xfd, 0xf2, 0xba, 0xac, 0x7d, 0x75, + 0x5d, 0xd6, 0xfe, 0x79, 0x5d, 0xd6, 0x5e, 0xbe, 0x2e, 0x2f, 0x7c, 0xf5, 0xba, 0xbc, 0xf0, 0xb7, + 0xd7, 0xe5, 0x85, 0x5f, 0x7e, 0xdc, 0xb3, 0x78, 0x7f, 0xd4, 0xa9, 0x75, 0xdd, 0xc1, 0x8e, 0x4d, + 0x5f, 0x5c, 0xd8, 0xcc, 0xec, 0x31, 0x2f, 0xf2, 0xf7, 0xc3, 0xae, 0xeb, 0xa9, 0x6f, 0x94, 0x3b, + 0x37, 0x3f, 0x28, 0x76, 0x52, 0x48, 0xff, 0xe8, 0xbf, 0x01, 0x00, 0x00, 0xff, 0xff, 0x0c, 0x11, + 0x7f, 0xd5, 0x11, 0x15, 0x00, 0x00, } func (m *PartSetHeader) Marshal() (dAtA []byte, err error) { @@ -1889,67 +1898,81 @@ func (m *Header) MarshalToSizedBuffer(dAtA []byte) (int, error) { copy(dAtA[i:], m.ProposerAddress) i = encodeVarintTypes(dAtA, i, uint64(len(m.ProposerAddress))) i-- - dAtA[i] = 0x7a + dAtA[i] = 0x1 + i-- + dAtA[i] = 0x82 } if len(m.EvidenceHash) > 0 { i -= len(m.EvidenceHash) copy(dAtA[i:], m.EvidenceHash) i = encodeVarintTypes(dAtA, i, uint64(len(m.EvidenceHash))) i-- - dAtA[i] = 0x72 + dAtA[i] = 0x7a } if len(m.LastResultsHash) > 0 { i -= len(m.LastResultsHash) copy(dAtA[i:], m.LastResultsHash) i = encodeVarintTypes(dAtA, i, uint64(len(m.LastResultsHash))) i-- - dAtA[i] = 0x6a + dAtA[i] = 0x72 } if len(m.AppHash) > 0 { i -= len(m.AppHash) copy(dAtA[i:], m.AppHash) i = encodeVarintTypes(dAtA, i, uint64(len(m.AppHash))) i-- - dAtA[i] = 0x62 + dAtA[i] = 0x6a } if len(m.ConsensusHash) > 0 { i -= len(m.ConsensusHash) copy(dAtA[i:], m.ConsensusHash) i = encodeVarintTypes(dAtA, i, uint64(len(m.ConsensusHash))) i-- - dAtA[i] = 0x5a + dAtA[i] = 0x62 } if len(m.NextValidatorsHash) > 0 { i -= len(m.NextValidatorsHash) copy(dAtA[i:], m.NextValidatorsHash) i = encodeVarintTypes(dAtA, i, uint64(len(m.NextValidatorsHash))) i-- - dAtA[i] = 0x52 + dAtA[i] = 0x5a } if len(m.ValidatorsHash) > 0 { i -= len(m.ValidatorsHash) copy(dAtA[i:], m.ValidatorsHash) i = encodeVarintTypes(dAtA, i, uint64(len(m.ValidatorsHash))) i-- - dAtA[i] = 0x4a + dAtA[i] = 0x52 } if len(m.DataHash) > 0 { i -= len(m.DataHash) copy(dAtA[i:], m.DataHash) i = encodeVarintTypes(dAtA, i, uint64(len(m.DataHash))) i-- - dAtA[i] = 0x42 + dAtA[i] = 0x4a } if m.NumOriginalDataShares != 0 { i = encodeVarintTypes(dAtA, i, uint64(m.NumOriginalDataShares)) i-- - dAtA[i] = 0x38 + dAtA[i] = 0x40 } if len(m.LastCommitHash) > 0 { i -= len(m.LastCommitHash) copy(dAtA[i:], m.LastCommitHash) i = encodeVarintTypes(dAtA, i, uint64(len(m.LastCommitHash))) i-- + dAtA[i] = 0x3a + } + if m.LastPartSetHeader != nil { + { + size, err := m.LastPartSetHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- dAtA[i] = 0x32 } { @@ -1962,12 +1985,12 @@ func (m *Header) MarshalToSizedBuffer(dAtA []byte) (int, error) { } i-- dAtA[i] = 0x2a - n3, err3 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.Time, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.Time):]) - if err3 != nil { - return 0, err3 + n4, err4 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.Time, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.Time):]) + if err4 != nil { + return 0, err4 } - i -= n3 - i = encodeVarintTypes(dAtA, i, uint64(n3)) + i -= n4 + i = encodeVarintTypes(dAtA, i, uint64(n4)) i-- dAtA[i] = 0x22 if m.Height != 0 { @@ -2151,12 +2174,12 @@ func (m *DuplicateVoteEvidence) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - n10, err10 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.Timestamp, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.Timestamp):]) - if err10 != nil { - return 0, err10 + n11, err11 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.Timestamp, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.Timestamp):]) + if err11 != nil { + return 0, err11 } - i -= n10 - i = encodeVarintTypes(dAtA, i, uint64(n10)) + i -= n11 + i = encodeVarintTypes(dAtA, i, uint64(n11)) i-- dAtA[i] = 0x2a if m.ValidatorPower != 0 { @@ -2216,12 +2239,12 @@ func (m *LightClientAttackEvidence) MarshalToSizedBuffer(dAtA []byte) (int, erro _ = i var l int _ = l - n13, err13 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.Timestamp, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.Timestamp):]) - if err13 != nil { - return 0, err13 + n14, err14 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.Timestamp, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.Timestamp):]) + if err14 != nil { + return 0, err14 } - i -= n13 - i = encodeVarintTypes(dAtA, i, uint64(n13)) + i -= n14 + i = encodeVarintTypes(dAtA, i, uint64(n14)) i-- dAtA[i] = 0x2a if m.TotalVotingPower != 0 { @@ -2498,12 +2521,12 @@ func (m *Vote) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x32 } - n16, err16 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.Timestamp, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.Timestamp):]) - if err16 != nil { - return 0, err16 + n17, err17 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.Timestamp, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.Timestamp):]) + if err17 != nil { + return 0, err17 } - i -= n16 - i = encodeVarintTypes(dAtA, i, uint64(n16)) + i -= n17 + i = encodeVarintTypes(dAtA, i, uint64(n17)) i-- dAtA[i] = 0x2a { @@ -2637,12 +2660,12 @@ func (m *CommitSig) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x22 } - n20, err20 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.Timestamp, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.Timestamp):]) - if err20 != nil { - return 0, err20 + n21, err21 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.Timestamp, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.Timestamp):]) + if err21 != nil { + return 0, err21 } - i -= n20 - i = encodeVarintTypes(dAtA, i, uint64(n20)) + i -= n21 + i = encodeVarintTypes(dAtA, i, uint64(n21)) i-- dAtA[i] = 0x1a if len(m.ValidatorAddress) > 0 { @@ -2711,12 +2734,12 @@ func (m *Proposal) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x3a } - n23, err23 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.Timestamp, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.Timestamp):]) - if err23 != nil { - return 0, err23 + n24, err24 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.Timestamp, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.Timestamp):]) + if err24 != nil { + return 0, err24 } - i -= n23 - i = encodeVarintTypes(dAtA, i, uint64(n23)) + i -= n24 + i = encodeVarintTypes(dAtA, i, uint64(n24)) i-- dAtA[i] = 0x32 { @@ -3061,6 +3084,10 @@ func (m *Header) Size() (n int) { n += 1 + l + sovTypes(uint64(l)) l = m.LastBlockId.Size() n += 1 + l + sovTypes(uint64(l)) + if m.LastPartSetHeader != nil { + l = m.LastPartSetHeader.Size() + n += 1 + l + sovTypes(uint64(l)) + } l = len(m.LastCommitHash) if l > 0 { n += 1 + l + sovTypes(uint64(l)) @@ -3098,7 +3125,7 @@ func (m *Header) Size() (n int) { } l = len(m.ProposerAddress) if l > 0 { - n += 1 + l + sovTypes(uint64(l)) + n += 2 + l + sovTypes(uint64(l)) } return n } @@ -4017,6 +4044,42 @@ func (m *Header) Unmarshal(dAtA []byte) error { } iNdEx = postIndex case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field LastPartSetHeader", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.LastPartSetHeader == nil { + m.LastPartSetHeader = &PartSetHeader{} + } + if err := m.LastPartSetHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 7: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field LastCommitHash", wireType) } @@ -4050,7 +4113,7 @@ func (m *Header) Unmarshal(dAtA []byte) error { m.LastCommitHash = []byte{} } iNdEx = postIndex - case 7: + case 8: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field NumOriginalDataShares", wireType) } @@ -4069,7 +4132,7 @@ func (m *Header) Unmarshal(dAtA []byte) error { break } } - case 8: + case 9: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field DataHash", wireType) } @@ -4103,7 +4166,7 @@ func (m *Header) Unmarshal(dAtA []byte) error { m.DataHash = []byte{} } iNdEx = postIndex - case 9: + case 10: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field ValidatorsHash", wireType) } @@ -4137,7 +4200,7 @@ func (m *Header) Unmarshal(dAtA []byte) error { m.ValidatorsHash = []byte{} } iNdEx = postIndex - case 10: + case 11: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field NextValidatorsHash", wireType) } @@ -4171,7 +4234,7 @@ func (m *Header) Unmarshal(dAtA []byte) error { m.NextValidatorsHash = []byte{} } iNdEx = postIndex - case 11: + case 12: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field ConsensusHash", wireType) } @@ -4205,7 +4268,7 @@ func (m *Header) Unmarshal(dAtA []byte) error { m.ConsensusHash = []byte{} } iNdEx = postIndex - case 12: + case 13: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field AppHash", wireType) } @@ -4239,7 +4302,7 @@ func (m *Header) Unmarshal(dAtA []byte) error { m.AppHash = []byte{} } iNdEx = postIndex - case 13: + case 14: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field LastResultsHash", wireType) } @@ -4273,7 +4336,7 @@ func (m *Header) Unmarshal(dAtA []byte) error { m.LastResultsHash = []byte{} } iNdEx = postIndex - case 14: + case 15: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field EvidenceHash", wireType) } @@ -4307,7 +4370,7 @@ func (m *Header) Unmarshal(dAtA []byte) error { m.EvidenceHash = []byte{} } iNdEx = postIndex - case 15: + case 16: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field ProposerAddress", wireType) } diff --git a/proto/tendermint/types/types.proto b/proto/tendermint/types/types.proto index a809aeb56a..e290222e96 100644 --- a/proto/tendermint/types/types.proto +++ b/proto/tendermint/types/types.proto @@ -63,22 +63,23 @@ message Header { // prev block info BlockID last_block_id = 5 [(gogoproto.nullable) = false]; + PartSetHeader last_part_set_header = 6; // hashes of block data - bytes last_commit_hash = 6; // commit from validators from the last block - uint64 num_original_data_shares = 7; // number of shares used in the original data square - bytes data_hash = 8; // transactions + bytes last_commit_hash = 7; // commit from validators from the last block + uint64 num_original_data_shares = 8; // number of shares used in the original data square + bytes data_hash = 9; // transactions // hashes from the app output from the prev block - bytes validators_hash = 9; // validators for the current block - bytes next_validators_hash = 10; // validators for the next block - bytes consensus_hash = 11; // consensus params for current block - bytes app_hash = 12; // state after txs from the previous block - bytes last_results_hash = 13; // root hash of all results from the txs from the previous block + bytes validators_hash = 10; // validators for the current block + bytes next_validators_hash = 11; // validators for the next block + bytes consensus_hash = 12; // consensus params for current block + bytes app_hash = 13; // state after txs from the previous block + bytes last_results_hash = 14; // root hash of all results from the txs from the previous block // consensus info - bytes evidence_hash = 14; // evidence included in the block - bytes proposer_address = 15; // original proposer of the block + bytes evidence_hash = 15; // evidence included in the block + bytes proposer_address = 16; // original proposer of the block } // Data contains the set of transactions included in the block diff --git a/state/state.go b/state/state.go index db5ed26ecf..ab91764e02 100644 --- a/state/state.go +++ b/state/state.go @@ -268,7 +268,7 @@ func (state State) MakeBlock( // Fill rest of header with state data. block.Header.Populate( state.Version.Consensus, state.ChainID, - timestamp, state.LastBlockID, + timestamp, state.LastBlockID, state.LastPartSetHeader, state.Validators.Hash(), state.NextValidators.Hash(), types.HashConsensusParams(state.ConsensusParams), state.AppHash, state.LastResultsHash, proposerAddress, diff --git a/state/tx_filter_test.go b/state/tx_filter_test.go index 4ae7279839..f9464702be 100644 --- a/state/tx_filter_test.go +++ b/state/tx_filter_test.go @@ -14,7 +14,7 @@ import ( func TestTxFilter(t *testing.T) { genDoc := randomGenesisDoc() - genDoc.ConsensusParams.Block.MaxBytes = 3000 + genDoc.ConsensusParams.Block.MaxBytes = 3001 genDoc.ConsensusParams.Evidence.MaxBytes = 1500 // Max size of Txs is much smaller than size of block, @@ -24,7 +24,7 @@ func TestTxFilter(t *testing.T) { isErr bool }{ {types.Tx(tmrand.Bytes(2139)), false}, - {types.Tx(tmrand.Bytes(2190)), true}, + {types.Tx(tmrand.Bytes(2150)), true}, {types.Tx(tmrand.Bytes(3000)), true}, } diff --git a/state/validation.go b/state/validation.go index 80c9d58037..741777e984 100644 --- a/state/validation.go +++ b/state/validation.go @@ -49,6 +49,13 @@ func validateBlock(state State, block *types.Block) error { ) } + if !block.LastPartSetHeader.Equals(state.LastPartSetHeader) { + return fmt.Errorf("wrong Block.Header.LastPartSetHeader. Expected %v, got %v", + state.LastPartSetHeader, + block.LastPartSetHeader, + ) + } + // Validate app info if !bytes.Equal(block.AppHash, state.AppHash) { return fmt.Errorf("wrong Block.Header.AppHash. Expected %X, got %v", diff --git a/state/validation_test.go b/state/validation_test.go index faeb8015f7..6f6886e2b6 100644 --- a/state/validation_test.go +++ b/state/validation_test.go @@ -57,6 +57,7 @@ func TestValidateBlockHeader(t *testing.T) { {"Time wrong", func(block *types.Block) { block.Time = block.Time.Add(-time.Second * 1) }}, {"Time wrong 2", func(block *types.Block) { block.Time = block.Time.Add(time.Second * 1) }}, + {"LastBlockID wrong", func(block *types.Block) { block.LastPartSetHeader.Total += 10 }}, {"LastCommitHash wrong", func(block *types.Block) { block.LastCommitHash = wrongHash }}, {"DataHash wrong", func(block *types.Block) { block.DataHash = wrongHash }}, diff --git a/types/block.go b/types/block.go index 33a058a5f8..780ab0ff93 100644 --- a/types/block.go +++ b/types/block.go @@ -32,7 +32,7 @@ const ( // MaxHeaderBytes is a maximum header size. // NOTE: Because app hash can be of arbitrary size, the header is therefore not // capped in size and thus this number should be seen as a soft max - MaxHeaderBytes int64 = 594 + MaxHeaderBytes int64 = 637 // MaxOverheadForBlock - maximum overhead to encode a block (up to // MaxBlockSizeBytes in size) not including it's parts except Data. @@ -513,7 +513,8 @@ type Header struct { Time time.Time `json:"time"` // prev block info - LastBlockID BlockID `json:"last_block_id"` + LastBlockID BlockID `json:"last_block_id"` + LastPartSetHeader PartSetHeader `json:"last_part_set_header"` // hashes of block data LastCommitHash tmbytes.HexBytes `json:"last_commit_hash"` // commit from validators from the last block @@ -543,6 +544,7 @@ func (h *Header) Populate( chainID string, timestamp time.Time, lastBlockID BlockID, + lastPartSetHeader PartSetHeader, valHash, nextValHash []byte, consensusHash, appHash, lastResultsHash []byte, proposerAddress Address, @@ -550,6 +552,7 @@ func (h *Header) Populate( h.Version = version h.ChainID = chainID h.Time = timestamp + h.LastPartSetHeader = lastPartSetHeader h.LastBlockID = lastBlockID h.ValidatorsHash = valHash h.NextValidatorsHash = nextValHash @@ -581,6 +584,10 @@ func (h Header) ValidateBasic() error { return fmt.Errorf("wrong LastBlockID: %w", err) } + if err := h.LastPartSetHeader.ValidateBasic(); err != nil { + return fmt.Errorf("wrong PartSetHeader: %w", err) + } + if err := ValidateHash(h.LastCommitHash); err != nil { return fmt.Errorf("wrong LastCommitHash: %v", err) } @@ -645,12 +652,19 @@ func (h *Header) Hash() tmbytes.HexBytes { return nil } + pbpsh := h.LastPartSetHeader.ToProto() + bzpsh, err := pbpsh.Marshal() + if err != nil { + return nil + } + return merkle.HashFromByteSlices([][]byte{ hbz, cdcEncode(h.ChainID), cdcEncode(h.Height), pbt, bzbi, + bzpsh, cdcEncode(h.LastCommitHash), cdcEncode(h.DataHash), cdcEncode(h.NumOriginalDataShares), @@ -675,6 +689,7 @@ func (h *Header) StringIndented(indent string) string { %s Height: %v %s Time: %v %s LastBlockID: %v +%s LastPartSetHeader: %v %s LastCommit: %v %s Data: %v %s Validators: %v @@ -690,6 +705,7 @@ func (h *Header) StringIndented(indent string) string { indent, h.Height, indent, h.Time, indent, h.LastBlockID, + indent, h.LastPartSetHeader, indent, h.LastCommitHash, indent, h.DataHash, indent, h.ValidatorsHash, @@ -708,12 +724,15 @@ func (h *Header) ToProto() *tmproto.Header { return nil } + ppsh := h.LastPartSetHeader.ToProto() + return &tmproto.Header{ Version: h.Version, ChainID: h.ChainID, Height: h.Height, Time: h.Time, LastBlockId: h.LastBlockID.ToProto(), + LastPartSetHeader: &ppsh, ValidatorsHash: h.ValidatorsHash, NextValidatorsHash: h.NextValidatorsHash, ConsensusHash: h.ConsensusHash, @@ -741,12 +760,18 @@ func HeaderFromProto(ph *tmproto.Header) (Header, error) { return Header{}, err } + lpsh, err := PartSetHeaderFromProto(ph.LastPartSetHeader) + if err != nil { + return Header{}, err + } + h.Version = ph.Version h.ChainID = ph.ChainID h.Height = ph.Height h.Time = ph.Time h.Height = ph.Height h.LastBlockID = *bi + h.LastPartSetHeader = *lpsh h.ValidatorsHash = ph.ValidatorsHash h.NextValidatorsHash = ph.NextValidatorsHash h.ConsensusHash = ph.ConsensusHash diff --git a/types/block_test.go b/types/block_test.go index 214ef1fbcd..47f5021b07 100644 --- a/types/block_test.go +++ b/types/block_test.go @@ -351,6 +351,7 @@ func TestHeaderHash(t *testing.T) { Height: 3, Time: time.Date(2019, 10, 13, 16, 14, 44, 0, time.UTC), LastBlockID: makeBlockID(make([]byte, tmhash.Size)), + LastPartSetHeader: makePartSetHeader(6, make([]byte, tmhash.Size)), LastCommitHash: tmhash.Sum([]byte("last_commit_hash")), DataHash: tmhash.Sum([]byte("data_hash")), NumOriginalDataShares: 4, @@ -361,7 +362,7 @@ func TestHeaderHash(t *testing.T) { LastResultsHash: tmhash.Sum([]byte("last_results_hash")), EvidenceHash: tmhash.Sum([]byte("evidence_hash")), ProposerAddress: crypto.AddressHash([]byte("proposer_address")), - }, hexBytesFromString("0E5747B09FE96A3F1DC58DBB137A82825B6E046A753D52FBB0F4C692D5F6F57E")}, + }, hexBytesFromString("CBE1A9A83217E1EEDE92B9F85B6519B6DA2B2AC8BF69421A1CB0227C5CD3B353")}, {"nil header yields nil", nil, nil}, {"nil ValidatorsHash yields nil", &Header{ Version: tmversion.Consensus{Block: 1, App: 2}, @@ -369,6 +370,7 @@ func TestHeaderHash(t *testing.T) { Height: 3, Time: time.Date(2019, 10, 13, 16, 14, 44, 0, time.UTC), LastBlockID: makeBlockID(make([]byte, tmhash.Size)), + LastPartSetHeader: makePartSetHeader(6, make([]byte, tmhash.Size)), LastCommitHash: tmhash.Sum([]byte("last_commit_hash")), DataHash: tmhash.Sum([]byte("data_hash")), ValidatorsHash: nil, @@ -449,6 +451,7 @@ func TestMaxHeaderBytes(t *testing.T) { Height: math.MaxInt64, Time: timestamp, LastBlockID: makeBlockID(make([]byte, tmhash.Size)), + LastPartSetHeader: makePartSetHeader(math.MaxInt32, make([]byte, tmhash.Size)), LastCommitHash: tmhash.Sum([]byte("last_commit_hash")), DataHash: tmhash.Sum([]byte("data_hash")), NumOriginalDataShares: math.MaxInt64, @@ -497,11 +500,11 @@ func TestBlockMaxDataBytes(t *testing.T) { }{ 0: {-10, 1, 0, true, 0}, 1: {10, 1, 0, true, 0}, - 2: {808, 1, 0, true, 0}, - 3: {810, 1, 0, false, 0}, - 4: {811, 1, 0, false, 1}, - 5: {922, 2, 0, false, 1}, - 6: {1021, 2, 100, false, 0}, + 2: {851, 1, 0, true, 0}, + 3: {853, 1, 0, false, 0}, + 4: {854, 1, 0, false, 1}, + 5: {965, 2, 0, false, 1}, + 6: {1064, 2, 100, false, 0}, } for i, tc := range testCases { @@ -528,9 +531,9 @@ func TestBlockMaxDataBytesNoEvidence(t *testing.T) { }{ 0: {-10, 1, true, 0}, 1: {10, 1, true, 0}, - 2: {808, 1, true, 0}, - 3: {810, 1, false, 0}, - 4: {811, 1, false, 1}, + 2: {851, 1, true, 0}, + 3: {853, 1, false, 0}, + 4: {854, 1, false, 1}, } for i, tc := range testCases { @@ -1026,6 +1029,21 @@ func TestHeader_ValidateBasic(t *testing.T) { }, true, "wrong Hash", }, + { + "invalid block ID parts header hash", + Header{ + Version: tmversion.Consensus{Block: version.BlockProtocol}, + ChainID: string(make([]byte, MaxChainIDLen)), + Height: 1, + LastBlockID: BlockID{ + Hash: make([]byte, tmhash.Size), + }, + LastPartSetHeader: PartSetHeader{ + Hash: make([]byte, tmhash.Size+1), + }, + }, + true, "wrong PartSetHeader", + }, { "invalid last commit hash", Header{ @@ -1035,6 +1053,9 @@ func TestHeader_ValidateBasic(t *testing.T) { LastBlockID: BlockID{ Hash: make([]byte, tmhash.Size), }, + LastPartSetHeader: PartSetHeader{ + Hash: make([]byte, tmhash.Size), + }, LastCommitHash: make([]byte, tmhash.Size+1), }, true, "wrong LastCommitHash", @@ -1048,6 +1069,9 @@ func TestHeader_ValidateBasic(t *testing.T) { LastBlockID: BlockID{ Hash: make([]byte, tmhash.Size), }, + LastPartSetHeader: PartSetHeader{ + Hash: make([]byte, tmhash.Size), + }, LastCommitHash: make([]byte, tmhash.Size), DataHash: make([]byte, tmhash.Size+1), }, @@ -1062,6 +1086,9 @@ func TestHeader_ValidateBasic(t *testing.T) { LastBlockID: BlockID{ Hash: make([]byte, tmhash.Size), }, + LastPartSetHeader: PartSetHeader{ + Hash: make([]byte, tmhash.Size), + }, LastCommitHash: make([]byte, tmhash.Size), DataHash: make([]byte, tmhash.Size), EvidenceHash: make([]byte, tmhash.Size+1), @@ -1077,6 +1104,9 @@ func TestHeader_ValidateBasic(t *testing.T) { LastBlockID: BlockID{ Hash: make([]byte, tmhash.Size), }, + LastPartSetHeader: PartSetHeader{ + Hash: make([]byte, tmhash.Size), + }, LastCommitHash: make([]byte, tmhash.Size), DataHash: make([]byte, tmhash.Size), EvidenceHash: make([]byte, tmhash.Size), @@ -1093,6 +1123,9 @@ func TestHeader_ValidateBasic(t *testing.T) { LastBlockID: BlockID{ Hash: make([]byte, tmhash.Size), }, + LastPartSetHeader: PartSetHeader{ + Hash: make([]byte, tmhash.Size), + }, LastCommitHash: make([]byte, tmhash.Size), DataHash: make([]byte, tmhash.Size), EvidenceHash: make([]byte, tmhash.Size), @@ -1110,6 +1143,9 @@ func TestHeader_ValidateBasic(t *testing.T) { LastBlockID: BlockID{ Hash: make([]byte, tmhash.Size), }, + LastPartSetHeader: PartSetHeader{ + Hash: make([]byte, tmhash.Size), + }, LastCommitHash: make([]byte, tmhash.Size), DataHash: make([]byte, tmhash.Size), EvidenceHash: make([]byte, tmhash.Size), @@ -1128,6 +1164,9 @@ func TestHeader_ValidateBasic(t *testing.T) { LastBlockID: BlockID{ Hash: make([]byte, tmhash.Size), }, + LastPartSetHeader: PartSetHeader{ + Hash: make([]byte, tmhash.Size), + }, LastCommitHash: make([]byte, tmhash.Size), DataHash: make([]byte, tmhash.Size), EvidenceHash: make([]byte, tmhash.Size), @@ -1147,6 +1186,9 @@ func TestHeader_ValidateBasic(t *testing.T) { LastBlockID: BlockID{ Hash: make([]byte, tmhash.Size), }, + LastPartSetHeader: PartSetHeader{ + Hash: make([]byte, tmhash.Size), + }, LastCommitHash: make([]byte, tmhash.Size), DataHash: make([]byte, tmhash.Size), EvidenceHash: make([]byte, tmhash.Size), @@ -1167,6 +1209,9 @@ func TestHeader_ValidateBasic(t *testing.T) { LastBlockID: BlockID{ Hash: make([]byte, tmhash.Size), }, + LastPartSetHeader: PartSetHeader{ + Hash: make([]byte, tmhash.Size), + }, LastCommitHash: make([]byte, tmhash.Size), DataHash: make([]byte, tmhash.Size), EvidenceHash: make([]byte, tmhash.Size), diff --git a/types/canonical.go b/types/canonical.go index 945c80de3a..321d78b542 100644 --- a/types/canonical.go +++ b/types/canonical.go @@ -56,13 +56,15 @@ func CanonicalizeProposal(chainID string, proposal *tmproto.Proposal) tmproto.Ca // CanonicalizeVote transforms the given Vote to a CanonicalVote, which does // not contain ValidatorIndex and ValidatorAddress fields. func CanonicalizeVote(chainID string, vote *tmproto.Vote) tmproto.CanonicalVote { + cppsh := CanonicalizePartSetHeader(*vote.PartSetHeader) return tmproto.CanonicalVote{ - Type: vote.Type, - Height: vote.Height, // encoded as sfixed64 - Round: int64(vote.Round), // encoded as sfixed64 - BlockID: CanonicalizeBlockID(vote.BlockID), - Timestamp: vote.Timestamp, - ChainID: chainID, + Type: vote.Type, + Height: vote.Height, // encoded as sfixed64 + Round: int64(vote.Round), // encoded as sfixed64 + BlockID: CanonicalizeBlockID(vote.BlockID), + Timestamp: vote.Timestamp, + ChainID: chainID, + PartSetHeader: &cppsh, } } diff --git a/types/evidence_test.go b/types/evidence_test.go index d538ccb56d..cb49d669a5 100644 --- a/types/evidence_test.go +++ b/types/evidence_test.go @@ -256,6 +256,7 @@ func makeHeaderRandom() *Header { Height: int64(mrand.Uint32() + 1), Time: time.Now(), LastBlockID: makeBlockIDRandom(), + LastPartSetHeader: makePartSetHeaderRandom(), LastCommitHash: crypto.CRandBytes(tmhash.Size), DataHash: crypto.CRandBytes(tmhash.Size), ValidatorsHash: crypto.CRandBytes(tmhash.Size), diff --git a/types/protobuf.go b/types/protobuf.go index 74c7a43490..51bbcb4bc1 100644 --- a/types/protobuf.go +++ b/types/protobuf.go @@ -33,13 +33,15 @@ var TM2PB = tm2pb{} type tm2pb struct{} func (tm2pb) Header(header *Header) tmproto.Header { + lpsh := header.LastPartSetHeader.ToProto() return tmproto.Header{ Version: header.Version, ChainID: header.ChainID, Height: header.Height, Time: header.Time, - LastBlockId: header.LastBlockID.ToProto(), + LastBlockId: header.LastBlockID.ToProto(), + LastPartSetHeader: &lpsh, LastCommitHash: header.LastCommitHash, DataHash: header.DataHash, diff --git a/types/vote.go b/types/vote.go index 6bf2dbe1d6..1c82e4fbe1 100644 --- a/types/vote.go +++ b/types/vote.go @@ -180,10 +180,6 @@ func (vote *Vote) ValidateBasic() error { return fmt.Errorf("wrong PartSetHeader: %v", err) } - if err := vote.PartSetHeader.ValidateBasic(); err != nil { - return fmt.Errorf("wrong PartSetHeader: %v", err) - } - // BlockID.ValidateBasic would not err if we for instance have an empty hash but a // non-empty PartsSetHeader: if !vote.BlockID.IsZero() && !vote.BlockID.IsComplete() { diff --git a/types/vote_test.go b/types/vote_test.go index ae6207001a..b91bc79f20 100644 --- a/types/vote_test.go +++ b/types/vote_test.go @@ -67,13 +67,13 @@ func TestVoteSignBytesTestVectors(t *testing.T) { 0: { "", &Vote{}, // NOTE: Height and Round are skipped here. This case needs to be considered while parsing. - []byte{0xd, 0x2a, 0xb, 0x8, 0x80, 0x92, 0xb8, 0xc3, 0x98, 0xfe, 0xff, 0xff, 0xff, 0x1}, + []byte{0xf, 0x2a, 0xb, 0x8, 0x80, 0x92, 0xb8, 0xc3, 0x98, 0xfe, 0xff, 0xff, 0xff, 0x1, 0x3a, 0x0}, }, // with proper (fixed size) height and round (PreCommit): 1: { "", &Vote{Height: 1, Round: 1, Type: tmproto.PrecommitType}, []byte{ - 0x21, // length + 0x23, // length 0x8, // (field_number << 3) | wire_type 0x2, // PrecommitType 0x11, // (field_number << 3) | wire_type @@ -82,13 +82,13 @@ func TestVoteSignBytesTestVectors(t *testing.T) { 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, // round 0x2a, // (field_number << 3) | wire_type // remaining fields (timestamp): - 0xb, 0x8, 0x80, 0x92, 0xb8, 0xc3, 0x98, 0xfe, 0xff, 0xff, 0xff, 0x1}, + 0xb, 0x8, 0x80, 0x92, 0xb8, 0xc3, 0x98, 0xfe, 0xff, 0xff, 0xff, 0x1, 0x3a, 0x0}, }, // with proper (fixed size) height and round (PreVote): 2: { "", &Vote{Height: 1, Round: 1, Type: tmproto.PrevoteType}, []byte{ - 0x21, // length + 0x23, // length 0x8, // (field_number << 3) | wire_type 0x1, // PrevoteType 0x11, // (field_number << 3) | wire_type @@ -97,25 +97,25 @@ func TestVoteSignBytesTestVectors(t *testing.T) { 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, // round 0x2a, // (field_number << 3) | wire_type // remaining fields (timestamp): - 0xb, 0x8, 0x80, 0x92, 0xb8, 0xc3, 0x98, 0xfe, 0xff, 0xff, 0xff, 0x1}, + 0xb, 0x8, 0x80, 0x92, 0xb8, 0xc3, 0x98, 0xfe, 0xff, 0xff, 0xff, 0x1, 0x3a, 0x0}, }, 3: { "", &Vote{Height: 1, Round: 1}, []byte{ - 0x1f, // length + 0x21, // length 0x11, // (field_number << 3) | wire_type 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, // height 0x19, // (field_number << 3) | wire_type 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, // round // remaining fields (timestamp): 0x2a, - 0xb, 0x8, 0x80, 0x92, 0xb8, 0xc3, 0x98, 0xfe, 0xff, 0xff, 0xff, 0x1}, + 0xb, 0x8, 0x80, 0x92, 0xb8, 0xc3, 0x98, 0xfe, 0xff, 0xff, 0xff, 0x1, 0x3a, 0x0}, }, // containing non-empty chain_id: 4: { "test_chain_id", &Vote{Height: 1, Round: 1}, []byte{ - 0x2e, // length + 0x30, // length 0x11, // (field_number << 3) | wire_type 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, // height 0x19, // (field_number << 3) | wire_type @@ -125,7 +125,7 @@ func TestVoteSignBytesTestVectors(t *testing.T) { 0xb, 0x8, 0x80, 0x92, 0xb8, 0xc3, 0x98, 0xfe, 0xff, 0xff, 0xff, 0x1, // timestamp // (field_number << 3) | wire_type 0x32, - 0xd, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x5f, 0x69, 0x64}, // chainID + 0xd, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x5f, 0x69, 0x64, 0x3a, 0x0}, // chainID }, } for i, tc := range tests { @@ -294,23 +294,3 @@ func TestVoteProtobuf(t *testing.T) { } } } - -// TestDoNotSignOverPartSetHeader simply ensures that the partset header is not signed over while voting. -func TestDoNotSignOverPartSetHeader(t *testing.T) { - pv := NewMockPV() - pubKey, err := pv.GetPubKey() - require.NoError(t, err) - blockID := randBlockID() - psh := randPartSetHeader() - currentTime := time.Now() - voteA := makeMockVote(1, 0, 0, pubKey.Address(), blockID, psh, currentTime).ToProto() - voteB := makeMockVote(1, 0, 0, pubKey.Address(), blockID, PartSetHeader{}, currentTime).ToProto() - - err = pv.SignVote("test", voteA) - require.NoError(t, err) - err = pv.SignVote("test", voteB) - require.NoError(t, err) - - require.Equal(t, voteA.Signature, voteB.Signature) - -} From dbf5418aa04904572242fbab2e32ca76ad485e64 Mon Sep 17 00:00:00 2001 From: evan-forbes Date: Mon, 23 Aug 2021 16:22:54 -0500 Subject: [PATCH 03/10] Revert "Decouple PartSetHeader from BlockID (#441)" This reverts commit 9d4265d84db4834f555873946d99d7fa0c6f0271. --- abci/types/types.pb.go | 220 ++++- blockchain/msgs_test.go | 2 +- blockchain/v0/reactor.go | 6 +- blockchain/v0/reactor_test.go | 9 +- consensus/byzantine_test.go | 12 +- consensus/common_test.go | 17 +- consensus/invalid_test.go | 5 +- consensus/msgs.go | 48 +- consensus/msgs_test.go | 93 +- consensus/reactor.go | 94 +- consensus/reactor_test.go | 50 +- consensus/replay.go | 4 +- consensus/replay_test.go | 41 +- consensus/state.go | 57 +- consensus/state_test.go | 17 +- consensus/types/height_vote_set.go | 14 +- consensus/types/height_vote_set_test.go | 3 +- consensus/types/round_state.go | 12 +- evidence/pool_test.go | 11 +- evidence/reactor_test.go | 10 +- evidence/verify.go | 9 +- evidence/verify_test.go | 108 +-- light/client.go | 2 +- light/helpers_test.go | 12 +- light/verifier.go | 4 +- node/node_test.go | 20 +- p2p/ipld/write_test.go | 16 +- privval/file_test.go | 65 +- privval/msgs_test.go | 28 +- privval/signer_client_test.go | 68 +- proto/tendermint/blockchain/types.pb.go | 30 +- proto/tendermint/consensus/types.pb.go | 301 +++---- proto/tendermint/consensus/types.proto | 4 +- proto/tendermint/consensus/wal.pb.go | 25 +- proto/tendermint/crypto/keys.pb.go | 5 +- proto/tendermint/crypto/proof.pb.go | 25 +- proto/tendermint/libs/bits/types.pb.go | 5 +- proto/tendermint/mempool/types.pb.go | 10 +- proto/tendermint/p2p/conn.pb.go | 25 +- proto/tendermint/p2p/pex.pb.go | 15 +- proto/tendermint/p2p/types.pb.go | 20 +- proto/tendermint/privval/types.pb.go | 55 +- proto/tendermint/state/types.pb.go | 249 +++--- proto/tendermint/state/types.proto | 21 +- proto/tendermint/statesync/types.pb.go | 25 +- proto/tendermint/store/types.pb.go | 5 +- proto/tendermint/types/block.pb.go | 5 +- proto/tendermint/types/canonical.pb.go | 301 +++---- proto/tendermint/types/canonical.proto | 3 +- proto/tendermint/types/events.pb.go | 5 +- proto/tendermint/types/params.pb.go | 30 +- proto/tendermint/types/types.pb.go | 844 +++++++----------- proto/tendermint/types/types.proto | 26 +- proto/tendermint/types/validator.pb.go | 15 +- proto/tendermint/version/types.pb.go | 5 +- rpc/client/evidence_test.go | 8 +- rpc/grpc/types.pb.go | 20 +- state/execution.go | 9 +- state/execution_test.go | 51 +- state/export_test.go | 3 +- state/helpers_test.go | 40 +- state/state.go | 32 +- state/state_test.go | 70 +- state/tx_filter_test.go | 2 +- state/validation.go | 9 +- state/validation_test.go | 27 +- statesync/stateprovider.go | 1 - store/store.go | 2 +- store/store_test.go | 4 +- .../internal/test_harness.go | 16 +- types/block.go | 122 +-- types/block_meta.go | 44 +- types/block_meta_test.go | 42 +- types/block_test.go | 214 +++-- types/canonical.go | 35 +- types/canonical_test.go | 12 +- types/events.go | 3 +- types/evidence.go | 18 +- types/evidence_test.go | 46 +- types/proposal.go | 56 +- types/proposal_test.go | 32 +- types/protobuf.go | 7 +- types/shares_test.go | 9 +- types/test_util.go | 5 +- types/validator_set.go | 13 +- types/validator_set_test.go | 63 +- types/vote.go | 14 - types/vote_set.go | 31 +- types/vote_set_test.go | 78 +- types/vote_test.go | 35 +- 90 files changed, 1953 insertions(+), 2331 deletions(-) diff --git a/abci/types/types.pb.go b/abci/types/types.pb.go index 7f1aa454a8..569a7ae4ad 100644 --- a/abci/types/types.pb.go +++ b/abci/types/types.pb.go @@ -8313,7 +8313,10 @@ func (m *Request) Unmarshal(dAtA []byte) error { if err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { return ErrInvalidLengthTypes } if (iNdEx + skippy) > l { @@ -8395,7 +8398,10 @@ func (m *RequestEcho) Unmarshal(dAtA []byte) error { if err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { return ErrInvalidLengthTypes } if (iNdEx + skippy) > l { @@ -8445,7 +8451,10 @@ func (m *RequestFlush) Unmarshal(dAtA []byte) error { if err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { return ErrInvalidLengthTypes } if (iNdEx + skippy) > l { @@ -8597,7 +8606,10 @@ func (m *RequestInfo) Unmarshal(dAtA []byte) error { if err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { return ErrInvalidLengthTypes } if (iNdEx + skippy) > l { @@ -8835,7 +8847,10 @@ func (m *RequestInitChain) Unmarshal(dAtA []byte) error { if err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { return ErrInvalidLengthTypes } if (iNdEx + skippy) > l { @@ -8990,7 +9005,10 @@ func (m *RequestQuery) Unmarshal(dAtA []byte) error { if err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { return ErrInvalidLengthTypes } if (iNdEx + skippy) > l { @@ -9174,7 +9192,10 @@ func (m *RequestBeginBlock) Unmarshal(dAtA []byte) error { if err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { return ErrInvalidLengthTypes } if (iNdEx + skippy) > l { @@ -9277,7 +9298,10 @@ func (m *RequestCheckTx) Unmarshal(dAtA []byte) error { if err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { return ErrInvalidLengthTypes } if (iNdEx + skippy) > l { @@ -9361,7 +9385,10 @@ func (m *RequestDeliverTx) Unmarshal(dAtA []byte) error { if err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { return ErrInvalidLengthTypes } if (iNdEx + skippy) > l { @@ -9430,7 +9457,10 @@ func (m *RequestEndBlock) Unmarshal(dAtA []byte) error { if err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { return ErrInvalidLengthTypes } if (iNdEx + skippy) > l { @@ -9480,7 +9510,10 @@ func (m *RequestCommit) Unmarshal(dAtA []byte) error { if err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { return ErrInvalidLengthTypes } if (iNdEx + skippy) > l { @@ -9530,7 +9563,10 @@ func (m *RequestListSnapshots) Unmarshal(dAtA []byte) error { if err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { return ErrInvalidLengthTypes } if (iNdEx + skippy) > l { @@ -9650,7 +9686,10 @@ func (m *RequestOfferSnapshot) Unmarshal(dAtA []byte) error { if err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { return ErrInvalidLengthTypes } if (iNdEx + skippy) > l { @@ -9757,7 +9796,10 @@ func (m *RequestLoadSnapshotChunk) Unmarshal(dAtA []byte) error { if err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { return ErrInvalidLengthTypes } if (iNdEx + skippy) > l { @@ -9892,7 +9934,10 @@ func (m *RequestApplySnapshotChunk) Unmarshal(dAtA []byte) error { if err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { return ErrInvalidLengthTypes } if (iNdEx + skippy) > l { @@ -9974,7 +10019,10 @@ func (m *RequestPreprocessTxs) Unmarshal(dAtA []byte) error { if err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { return ErrInvalidLengthTypes } if (iNdEx + skippy) > l { @@ -10584,7 +10632,10 @@ func (m *Response) Unmarshal(dAtA []byte) error { if err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { return ErrInvalidLengthTypes } if (iNdEx + skippy) > l { @@ -10666,7 +10717,10 @@ func (m *ResponseException) Unmarshal(dAtA []byte) error { if err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { return ErrInvalidLengthTypes } if (iNdEx + skippy) > l { @@ -10748,7 +10802,10 @@ func (m *ResponseEcho) Unmarshal(dAtA []byte) error { if err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { return ErrInvalidLengthTypes } if (iNdEx + skippy) > l { @@ -10798,7 +10855,10 @@ func (m *ResponseFlush) Unmarshal(dAtA []byte) error { if err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { return ErrInvalidLengthTypes } if (iNdEx + skippy) > l { @@ -10984,7 +11044,10 @@ func (m *ResponseInfo) Unmarshal(dAtA []byte) error { if err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { return ErrInvalidLengthTypes } if (iNdEx + skippy) > l { @@ -11138,7 +11201,10 @@ func (m *ResponseInitChain) Unmarshal(dAtA []byte) error { if err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { return ErrInvalidLengthTypes } if (iNdEx + skippy) > l { @@ -11445,7 +11511,10 @@ func (m *ResponseQuery) Unmarshal(dAtA []byte) error { if err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { return ErrInvalidLengthTypes } if (iNdEx + skippy) > l { @@ -11529,7 +11598,10 @@ func (m *ResponseBeginBlock) Unmarshal(dAtA []byte) error { if err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { return ErrInvalidLengthTypes } if (iNdEx + skippy) > l { @@ -11800,7 +11872,10 @@ func (m *ResponseCheckTx) Unmarshal(dAtA []byte) error { if err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { return ErrInvalidLengthTypes } if (iNdEx + skippy) > l { @@ -12071,7 +12146,10 @@ func (m *ResponseDeliverTx) Unmarshal(dAtA []byte) error { if err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { return ErrInvalidLengthTypes } if (iNdEx + skippy) > l { @@ -12225,7 +12303,10 @@ func (m *ResponseEndBlock) Unmarshal(dAtA []byte) error { if err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { return ErrInvalidLengthTypes } if (iNdEx + skippy) > l { @@ -12328,7 +12409,10 @@ func (m *ResponseCommit) Unmarshal(dAtA []byte) error { if err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { return ErrInvalidLengthTypes } if (iNdEx + skippy) > l { @@ -12412,7 +12496,10 @@ func (m *ResponseListSnapshots) Unmarshal(dAtA []byte) error { if err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { return ErrInvalidLengthTypes } if (iNdEx + skippy) > l { @@ -12481,7 +12568,10 @@ func (m *ResponseOfferSnapshot) Unmarshal(dAtA []byte) error { if err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { return ErrInvalidLengthTypes } if (iNdEx + skippy) > l { @@ -12565,7 +12655,10 @@ func (m *ResponseLoadSnapshotChunk) Unmarshal(dAtA []byte) error { if err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { return ErrInvalidLengthTypes } if (iNdEx + skippy) > l { @@ -12742,7 +12835,10 @@ func (m *ResponseApplySnapshotChunk) Unmarshal(dAtA []byte) error { if err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { return ErrInvalidLengthTypes } if (iNdEx + skippy) > l { @@ -12860,7 +12956,10 @@ func (m *ResponsePreprocessTxs) Unmarshal(dAtA []byte) error { if err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { return ErrInvalidLengthTypes } if (iNdEx + skippy) > l { @@ -13054,7 +13153,10 @@ func (m *ConsensusParams) Unmarshal(dAtA []byte) error { if err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { return ErrInvalidLengthTypes } if (iNdEx + skippy) > l { @@ -13142,7 +13244,10 @@ func (m *BlockParams) Unmarshal(dAtA []byte) error { if err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { return ErrInvalidLengthTypes } if (iNdEx + skippy) > l { @@ -13245,7 +13350,10 @@ func (m *LastCommitInfo) Unmarshal(dAtA []byte) error { if err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { return ErrInvalidLengthTypes } if (iNdEx + skippy) > l { @@ -13361,7 +13469,10 @@ func (m *Event) Unmarshal(dAtA []byte) error { if err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { return ErrInvalidLengthTypes } if (iNdEx + skippy) > l { @@ -13499,7 +13610,10 @@ func (m *EventAttribute) Unmarshal(dAtA []byte) error { if err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { return ErrInvalidLengthTypes } if (iNdEx + skippy) > l { @@ -13654,7 +13768,10 @@ func (m *TxResult) Unmarshal(dAtA []byte) error { if err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { return ErrInvalidLengthTypes } if (iNdEx + skippy) > l { @@ -13757,7 +13874,10 @@ func (m *Validator) Unmarshal(dAtA []byte) error { if err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { return ErrInvalidLengthTypes } if (iNdEx + skippy) > l { @@ -13859,7 +13979,10 @@ func (m *ValidatorUpdate) Unmarshal(dAtA []byte) error { if err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { return ErrInvalidLengthTypes } if (iNdEx + skippy) > l { @@ -13962,7 +14085,10 @@ func (m *VoteInfo) Unmarshal(dAtA []byte) error { if err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { return ErrInvalidLengthTypes } if (iNdEx + skippy) > l { @@ -14135,7 +14261,10 @@ func (m *Evidence) Unmarshal(dAtA []byte) error { if err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { return ErrInvalidLengthTypes } if (iNdEx + skippy) > l { @@ -14310,7 +14439,10 @@ func (m *Snapshot) Unmarshal(dAtA []byte) error { if err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { return ErrInvalidLengthTypes } if (iNdEx + skippy) > l { diff --git a/blockchain/msgs_test.go b/blockchain/msgs_test.go index 80ff2c6b65..a486c984ad 100644 --- a/blockchain/msgs_test.go +++ b/blockchain/msgs_test.go @@ -97,7 +97,7 @@ func TestBlockchainMessageVectors(t *testing.T) { BlockRequest: &bcproto.BlockRequest{Height: math.MaxInt64}}}, "0a0a08ffffffffffffffff7f"}, {"BlockResponseMessage", &bcproto.Message{Sum: &bcproto.Message_BlockResponse{ - BlockResponse: &bcproto.BlockResponse{Block: bpb}}}, "1ac2020abf020a5d0a02080b1803220b088092b8c398feffffff012a00320040014a204c149a7cfadc92b669b0cbfa4951a1b18c2d9f3177a3b8756d39ebb96e9d63317a20e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b85512130a0b48656c6c6f20576f726c6412001a0022001ac8010a3000000000000000010000000000000001b81cb5596c28d044214b9f935e4af7dbe76e417f6182d86fbee68bfff7b2ff3a0a30ffffffffffffffffffffffffffffffffc4096ba8fccf882c309896e9168fa43fe62fccb752cb12d5160cc1d9c2ebffe7123000000000000000010000000000000001b81cb5596c28d044214b9f935e4af7dbe76e417f6182d86fbee68bfff7b2ff3a1230ffffffffffffffffffffffffffffffffc4096ba8fccf882c309896e9168fa43fe62fccb752cb12d5160cc1d9c2ebffe7"}, + BlockResponse: &bcproto.BlockResponse{Block: bpb}}}, "1ac2020abf020a5d0a02080b1803220b088092b8c398feffffff012a021200380142204c149a7cfadc92b669b0cbfa4951a1b18c2d9f3177a3b8756d39ebb96e9d63317220e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b85512130a0b48656c6c6f20576f726c6412001a0022001ac8010a3000000000000000010000000000000001b81cb5596c28d044214b9f935e4af7dbe76e417f6182d86fbee68bfff7b2ff3a0a30ffffffffffffffffffffffffffffffffc4096ba8fccf882c309896e9168fa43fe62fccb752cb12d5160cc1d9c2ebffe7123000000000000000010000000000000001b81cb5596c28d044214b9f935e4af7dbe76e417f6182d86fbee68bfff7b2ff3a1230ffffffffffffffffffffffffffffffffc4096ba8fccf882c309896e9168fa43fe62fccb752cb12d5160cc1d9c2ebffe7"}, {"NoBlockResponseMessage", &bcproto.Message{Sum: &bcproto.Message_NoBlockResponse{ NoBlockResponse: &bcproto.NoBlockResponse{Height: 1}}}, "12020801"}, {"NoBlockResponseMessage", &bcproto.Message{Sum: &bcproto.Message_NoBlockResponse{ diff --git a/blockchain/v0/reactor.go b/blockchain/v0/reactor.go index d24e8b6da0..f30a40a109 100644 --- a/blockchain/v0/reactor.go +++ b/blockchain/v0/reactor.go @@ -389,14 +389,14 @@ FOR_LOOP: var ( firstParts = first.MakePartSet(types.BlockPartSizeBytes) firstPartSetHeader = firstParts.Header() - firstID = types.BlockID{Hash: first.Hash()} + firstID = types.BlockID{Hash: first.Hash(), PartSetHeader: firstPartSetHeader} ) // Finally, verify the first block using the second's commit // NOTE: we can probably make this more efficient, but note that calling // first.Hash() doesn't verify the tx contents, so MakePartSet() is // currently necessary. - err := state.Validators.VerifyCommitLight(chainID, firstID, firstPartSetHeader, first.Height, second.LastCommit) + err := state.Validators.VerifyCommitLight(chainID, firstID, first.Height, second.LastCommit) if err != nil { err = fmt.Errorf("invalid last commit: %w", err) bcR.Logger.Error(err.Error(), @@ -430,7 +430,7 @@ FOR_LOOP: // TODO: same thing for app - but we would need a way to get the hash // without persisting the state. - state, _, err = bcR.blockExec.ApplyBlock(state, firstID, firstPartSetHeader, first) + state, _, err = bcR.blockExec.ApplyBlock(state, firstID, first) if err != nil { // TODO This is bad, are we zombie? panic(fmt.Sprintf("Failed to process committed block (%d:%X): %v", first.Height, first.Hash(), err)) diff --git a/blockchain/v0/reactor_test.go b/blockchain/v0/reactor_test.go index 8fdf5f15b7..cf774e95f0 100644 --- a/blockchain/v0/reactor_test.go +++ b/blockchain/v0/reactor_test.go @@ -96,7 +96,7 @@ func newBlockchainReactor( // let's add some blocks in for blockHeight := int64(1); blockHeight <= maxBlockHeight; blockHeight++ { - lastCommit := types.NewCommit(blockHeight-1, 0, types.BlockID{}, nil, types.PartSetHeader{}) + lastCommit := types.NewCommit(blockHeight-1, 0, types.BlockID{}, nil) if blockHeight > 1 { lastBlockMeta := blockStore.LoadBlockMeta(blockHeight - 1) lastBlock, err := blockStore.LoadBlock(context.TODO(), blockHeight-1) @@ -107,7 +107,6 @@ func newBlockchainReactor( vote, err := types.MakeVote( lastBlock.Header.Height, lastBlockMeta.BlockID, - lastBlockMeta.PartSetHeader, state.Validators, privVals[0], lastBlock.Header.ChainID, @@ -117,15 +116,15 @@ func newBlockchainReactor( panic(err) } lastCommit = types.NewCommit(vote.Height, vote.Round, - lastBlockMeta.BlockID, []types.CommitSig{vote.CommitSig()}, lastBlockMeta.PartSetHeader) + lastBlockMeta.BlockID, []types.CommitSig{vote.CommitSig()}) } thisBlock := makeBlock(blockHeight, state, lastCommit) thisParts := thisBlock.MakePartSet(types.BlockPartSizeBytes) - blockID := types.BlockID{Hash: thisBlock.Hash()} + blockID := types.BlockID{Hash: thisBlock.Hash(), PartSetHeader: thisParts.Header()} - state, _, err = blockExec.ApplyBlock(state, blockID, thisParts.Header(), thisBlock) + state, _, err = blockExec.ApplyBlock(state, blockID, thisBlock) if err != nil { panic(fmt.Errorf("error apply block: %w", err)) } diff --git a/consensus/byzantine_test.go b/consensus/byzantine_test.go index 6e8c9b90af..0934785e37 100644 --- a/consensus/byzantine_test.go +++ b/consensus/byzantine_test.go @@ -385,10 +385,8 @@ func byzantineDecideProposalFunc(t *testing.T, height int64, round int32, cs *St // Create a new proposal block from state/txs from the mempool. block1, blockParts1 := cs.createProposalBlock() - polRound, propBlockID := cs.ValidRound, types.BlockID{Hash: block1.Hash()} - proposal1 := types.NewProposal( - height, round, polRound, propBlockID, &block1.DataAvailabilityHeader, blockParts1.Header(), - ) + polRound, propBlockID := cs.ValidRound, types.BlockID{Hash: block1.Hash(), PartSetHeader: blockParts1.Header()} + proposal1 := types.NewProposal(height, round, polRound, propBlockID, &block1.DataAvailabilityHeader) p1, err := proposal1.ToProto() require.NoError(t, err) if err := cs.privValidator.SignProposal(cs.state.ChainID, p1); err != nil { @@ -402,10 +400,8 @@ func byzantineDecideProposalFunc(t *testing.T, height int64, round int32, cs *St // Create a new proposal block from state/txs from the mempool. block2, blockParts2 := cs.createProposalBlock() - polRound, propBlockID = cs.ValidRound, types.BlockID{Hash: block2.Hash()} - proposal2 := types.NewProposal( - height, round, polRound, propBlockID, &block2.DataAvailabilityHeader, blockParts2.Header(), - ) + polRound, propBlockID = cs.ValidRound, types.BlockID{Hash: block2.Hash(), PartSetHeader: blockParts2.Header()} + proposal2 := types.NewProposal(height, round, polRound, propBlockID, &block2.DataAvailabilityHeader) p2, err := proposal2.ToProto() require.NoError(t, err) if err := cs.privValidator.SignProposal(cs.state.ChainID, p2); err != nil { diff --git a/consensus/common_test.go b/consensus/common_test.go index d3d8e04032..b00468ccf5 100644 --- a/consensus/common_test.go +++ b/consensus/common_test.go @@ -108,8 +108,7 @@ func (vs *validatorStub) signVote( Round: vs.Round, Timestamp: tmtime.Now(), Type: voteType, - BlockID: types.BlockID{Hash: hash}, - PartSetHeader: header, + BlockID: types.BlockID{Hash: hash, PartSetHeader: header}, } v := vote.ToProto() err = vs.PrivValidator.SignVote(config.ChainID(), v) @@ -206,8 +205,8 @@ func decideProposal( } // Make proposal - polRound, propBlockID := validRound, types.BlockID{Hash: block.Hash()} - proposal = types.NewProposal(height, round, polRound, propBlockID, &block.DataAvailabilityHeader, blockParts.Header()) + polRound, propBlockID := validRound, types.BlockID{Hash: block.Hash(), PartSetHeader: blockParts.Header()} + proposal = types.NewProposal(height, round, polRound, propBlockID, &block.DataAvailabilityHeader) p, err := proposal.ToProto() if err != nil { panic(err) @@ -600,13 +599,7 @@ func ensureNewUnlock(unlockCh <-chan tmpubsub.Message, height int64, round int32 "Timeout expired while waiting for NewUnlock event") } -func ensureProposal( - proposalCh <-chan tmpubsub.Message, - height int64, - round int32, - propID types.BlockID, - propPartSetHeader types.PartSetHeader, -) { +func ensureProposal(proposalCh <-chan tmpubsub.Message, height int64, round int32, propID types.BlockID) { select { case <-time.After(ensureTimeout): panic("Timeout expired while waiting for NewProposal event") @@ -622,7 +615,7 @@ func ensureProposal( if proposalEvent.Round != round { panic(fmt.Sprintf("expected round %v, got %v", round, proposalEvent.Round)) } - if !proposalEvent.BlockID.Equals(propID) || !proposalEvent.PartSetHeader.Equals(propPartSetHeader) { + if !proposalEvent.BlockID.Equals(propID) { panic(fmt.Sprintf("Proposed block does not match expected block (%v != %v)", proposalEvent.BlockID, propID)) } } diff --git a/consensus/invalid_test.go b/consensus/invalid_test.go index cde4daeac8..22e38558b6 100644 --- a/consensus/invalid_test.go +++ b/consensus/invalid_test.go @@ -83,9 +83,8 @@ func invalidDoPrevoteFunc(t *testing.T, height int64, round int32, cs *State, sw Timestamp: cs.voteTime(), Type: tmproto.PrecommitType, BlockID: types.BlockID{ - Hash: blockHash, - }, - PartSetHeader: types.PartSetHeader{Total: 1, Hash: tmrand.Bytes(32)}, + Hash: blockHash, + PartSetHeader: types.PartSetHeader{Total: 1, Hash: tmrand.Bytes(32)}}, } p := precommit.ToProto() err = cs.privValidator.SignVote(cs.state.ChainID, p) diff --git a/consensus/msgs.go b/consensus/msgs.go index bd5b13daa3..a03b1926cf 100644 --- a/consensus/msgs.go +++ b/consensus/msgs.go @@ -109,30 +109,26 @@ func MsgToProto(msg Message) (*tmcons.Message, error) { } case *VoteSetMaj23Message: bi := msg.BlockID.ToProto() - psh := msg.PartSetHeader.ToProto() pb = tmcons.Message{ Sum: &tmcons.Message_VoteSetMaj23{ VoteSetMaj23: &tmcons.VoteSetMaj23{ - Height: msg.Height, - Round: msg.Round, - Type: msg.Type, - BlockID: bi, - PartSetHeader: &psh, + Height: msg.Height, + Round: msg.Round, + Type: msg.Type, + BlockID: bi, }, }, } case *VoteSetBitsMessage: bi := msg.BlockID.ToProto() - psh := msg.PartSetHeader.ToProto() bits := msg.Votes.ToProto() vsb := &tmcons.Message_VoteSetBits{ VoteSetBits: &tmcons.VoteSetBits{ - Height: msg.Height, - Round: msg.Round, - Type: msg.Type, - BlockID: bi, - PartSetHeader: &psh, + Height: msg.Height, + Round: msg.Round, + Type: msg.Type, + BlockID: bi, }, } @@ -242,26 +238,17 @@ func MsgFromProto(msg *tmcons.Message) (Message, error) { if err != nil { return nil, fmt.Errorf("voteSetMaj23 msg to proto error: %w", err) } - psh, err := types.PartSetHeaderFromProto(msg.VoteSetMaj23.PartSetHeader) - if err != nil { - return nil, fmt.Errorf("voteSetMaj23 msg to proto error: %w", err) - } pb = &VoteSetMaj23Message{ - Height: msg.VoteSetMaj23.Height, - Round: msg.VoteSetMaj23.Round, - Type: msg.VoteSetMaj23.Type, - BlockID: *bi, - PartSetHeader: *psh, + Height: msg.VoteSetMaj23.Height, + Round: msg.VoteSetMaj23.Round, + Type: msg.VoteSetMaj23.Type, + BlockID: *bi, } case *tmcons.Message_VoteSetBits: bi, err := types.BlockIDFromProto(&msg.VoteSetBits.BlockID) if err != nil { return nil, fmt.Errorf("block ID to proto error: %w", err) } - psh, err := types.PartSetHeaderFromProto(msg.VoteSetBits.PartSetHeader) - if err != nil { - return nil, fmt.Errorf("part set header to proto error: %w", err) - } bits := new(bits.BitArray) err = bits.FromProto(&msg.VoteSetBits.Votes) if err != nil { @@ -269,12 +256,11 @@ func MsgFromProto(msg *tmcons.Message) (Message, error) { } pb = &VoteSetBitsMessage{ - Height: msg.VoteSetBits.Height, - Round: msg.VoteSetBits.Round, - Type: msg.VoteSetBits.Type, - BlockID: *bi, - PartSetHeader: *psh, - Votes: bits, + Height: msg.VoteSetBits.Height, + Round: msg.VoteSetBits.Round, + Type: msg.VoteSetBits.Type, + BlockID: *bi, + Votes: bits, } default: return nil, fmt.Errorf("consensus: message not recognized: %T", msg) diff --git a/consensus/msgs_test.go b/consensus/msgs_test.go index e2596b9792..6403b08d20 100644 --- a/consensus/msgs_test.go +++ b/consensus/msgs_test.go @@ -28,7 +28,8 @@ func TestMsgToProto(t *testing.T) { } pbPsh := psh.ToProto() bi := types.BlockID{ - Hash: tmrand.Bytes(32), + Hash: tmrand.Bytes(32), + PartSetHeader: psh, } pbBi := bi.ToProto() bits := bits.NewBitArray(1) @@ -50,14 +51,13 @@ func TestMsgToProto(t *testing.T) { roots, err := types.NmtRootsFromBytes([][]byte{tmrand.Bytes(2*consts.NamespaceSize + tmhash.Size)}) require.NoError(t, err) proposal := types.Proposal{ - Type: tmproto.ProposalType, - Height: 1, - Round: 1, - POLRound: 1, - BlockID: bi, - PartSetHeader: psh, - Timestamp: time.Now(), - Signature: tmrand.Bytes(20), + Type: tmproto.ProposalType, + Height: 1, + Round: 1, + POLRound: 1, + BlockID: bi, + Timestamp: time.Now(), + Signature: tmrand.Bytes(20), DAHeader: &types.DataAvailabilityHeader{ RowsRoots: roots, ColumnRoots: roots, @@ -72,7 +72,7 @@ func TestMsgToProto(t *testing.T) { val := types.NewValidator(pk, 100) vote, err := types.MakeVote( - 1, types.BlockID{}, types.PartSetHeader{}, &types.ValidatorSet{Proposer: val, Validators: []*types.Validator{val}}, + 1, types.BlockID{}, &types.ValidatorSet{Proposer: val, Validators: []*types.Validator{val}}, pv, "chainID", time.Now()) require.NoError(t, err) pbVote := vote.ToProto() @@ -162,38 +162,34 @@ func TestMsgToProto(t *testing.T) { }, }, false}, {"successful VoteSetMaj23", &VoteSetMaj23Message{ - Height: 1, - Round: 1, - Type: 1, - BlockID: bi, - PartSetHeader: psh, + Height: 1, + Round: 1, + Type: 1, + BlockID: bi, }, &tmcons.Message{ Sum: &tmcons.Message_VoteSetMaj23{ VoteSetMaj23: &tmcons.VoteSetMaj23{ - Height: 1, - Round: 1, - Type: 1, - BlockID: pbBi, - PartSetHeader: &pbPsh, + Height: 1, + Round: 1, + Type: 1, + BlockID: pbBi, }, }, }, false}, {"successful VoteSetBits", &VoteSetBitsMessage{ - Height: 1, - Round: 1, - Type: 1, - BlockID: bi, - PartSetHeader: psh, - Votes: bits, + Height: 1, + Round: 1, + Type: 1, + BlockID: bi, + Votes: bits, }, &tmcons.Message{ Sum: &tmcons.Message_VoteSetBits{ VoteSetBits: &tmcons.VoteSetBits{ - Height: 1, - Round: 1, - Type: 1, - BlockID: pbBi, - PartSetHeader: &pbPsh, - Votes: *pbBits, + Height: 1, + Round: 1, + Type: 1, + BlockID: pbBi, + Votes: *pbBits, }, }, }, false}, @@ -337,7 +333,8 @@ func TestConsMsgsVectors(t *testing.T) { pbPsh := psh.ToProto() bi := types.BlockID{ - Hash: []byte("add_more_exclamation_marks_code-"), + Hash: []byte("add_more_exclamation_marks_code-"), + PartSetHeader: psh, } pbBi := bi.ToProto() bits := bits.NewBitArray(1) @@ -357,15 +354,14 @@ func TestConsMsgsVectors(t *testing.T) { require.NoError(t, err) proposal := types.Proposal{ - Type: tmproto.ProposalType, - Height: 1, - Round: 1, - POLRound: 1, - BlockID: bi, - Timestamp: date, - Signature: []byte("add_more_exclamation"), - DAHeader: &types.DataAvailabilityHeader{}, - PartSetHeader: psh, + Type: tmproto.ProposalType, + Height: 1, + Round: 1, + POLRound: 1, + BlockID: bi, + Timestamp: date, + Signature: []byte("add_more_exclamation"), + DAHeader: &types.DataAvailabilityHeader{}, } pbProposal, err := proposal.ToProto() require.NoError(t, err) @@ -378,7 +374,6 @@ func TestConsMsgsVectors(t *testing.T) { Timestamp: date, Type: tmproto.PrecommitType, BlockID: bi, - PartSetHeader: psh, } vpb := v.ToProto() @@ -406,7 +401,7 @@ func TestConsMsgsVectors(t *testing.T) { Height: 1, Round: 1, BlockPartSetHeader: pbPsh, BlockParts: pbBits, IsCommit: false}}}, "1231080110011a24080112206164645f6d6f72655f6578636c616d6174696f6e5f6d61726b735f636f64652d22050801120100"}, {"Proposal", &tmcons.Message{Sum: &tmcons.Message_Proposal{Proposal: &tmcons.Proposal{Proposal: *pbProposal}}}, - "1a740a7208201001180120012a220a206164645f6d6f72655f6578636c616d6174696f6e5f6d61726b735f636f64652d320608c0b89fdc053a146164645f6d6f72655f6578636c616d6174696f6e42004a24080112206164645f6d6f72655f6578636c616d6174696f6e5f6d61726b735f636f64652d"}, + "1a740a7208201001180120012a480a206164645f6d6f72655f6578636c616d6174696f6e5f6d61726b735f636f64652d1224080112206164645f6d6f72655f6578636c616d6174696f6e5f6d61726b735f636f64652d320608c0b89fdc053a146164645f6d6f72655f6578636c616d6174696f6e4200"}, {"ProposalPol", &tmcons.Message{Sum: &tmcons.Message_ProposalPol{ ProposalPol: &tmcons.ProposalPOL{Height: 1, ProposalPolRound: 1}}}, "2206080110011a00"}, @@ -415,7 +410,7 @@ func TestConsMsgsVectors(t *testing.T) { "2a36080110011a3008011204746573741a26080110011a206164645f6d6f72655f6578636c616d6174696f6e5f6d61726b735f636f64652d"}, {"Vote", &tmcons.Message{Sum: &tmcons.Message_Vote{ Vote: &tmcons.Vote{Vote: vpb}}}, - "32700a6e0802100122220a206164645f6d6f72655f6578636c616d6174696f6e5f6d61726b735f636f64652d2a0608c0b89fdc0532146164645f6d6f72655f6578636c616d6174696f6e38014a24080112206164645f6d6f72655f6578636c616d6174696f6e5f6d61726b735f636f64652d"}, + "32700a6e0802100122480a206164645f6d6f72655f6578636c616d6174696f6e5f6d61726b735f636f64652d1224080112206164645f6d6f72655f6578636c616d6174696f6e5f6d61726b735f636f64652d2a0608c0b89fdc0532146164645f6d6f72655f6578636c616d6174696f6e3801"}, {"HasVote", &tmcons.Message{Sum: &tmcons.Message_HasVote{ HasVote: &tmcons.HasVote{Height: 1, Round: 1, Type: tmproto.PrevoteType, Index: 1}}}, "3a080801100118012001"}, @@ -424,11 +419,11 @@ func TestConsMsgsVectors(t *testing.T) { Type: tmproto.PrevoteType, Index: math.MaxInt32}}}, "3a1808ffffffffffffffff7f10ffffffff07180120ffffffff07"}, {"VoteSetMaj23", &tmcons.Message{Sum: &tmcons.Message_VoteSetMaj23{ - VoteSetMaj23: &tmcons.VoteSetMaj23{Height: 1, Round: 1, Type: tmproto.PrevoteType, BlockID: pbBi, PartSetHeader: &pbPsh}}}, - "425008011001180122220a206164645f6d6f72655f6578636c616d6174696f6e5f6d61726b735f636f64652d2a24080112206164645f6d6f72655f6578636c616d6174696f6e5f6d61726b735f636f64652d"}, + VoteSetMaj23: &tmcons.VoteSetMaj23{Height: 1, Round: 1, Type: tmproto.PrevoteType, BlockID: pbBi}}}, + "425008011001180122480a206164645f6d6f72655f6578636c616d6174696f6e5f6d61726b735f636f64652d1224080112206164645f6d6f72655f6578636c616d6174696f6e5f6d61726b735f636f64652d"}, {"VoteSetBits", &tmcons.Message{Sum: &tmcons.Message_VoteSetBits{ - VoteSetBits: &tmcons.VoteSetBits{Height: 1, Round: 1, Type: tmproto.PrevoteType, BlockID: pbBi, PartSetHeader: &pbPsh, Votes: *pbBits}}}, - "4a5708011001180122220a206164645f6d6f72655f6578636c616d6174696f6e5f6d61726b735f636f64652d2a24080112206164645f6d6f72655f6578636c616d6174696f6e5f6d61726b735f636f64652d32050801120100"}, + VoteSetBits: &tmcons.VoteSetBits{Height: 1, Round: 1, Type: tmproto.PrevoteType, BlockID: pbBi, Votes: *pbBits}}}, + "4a5708011001180122480a206164645f6d6f72655f6578636c616d6174696f6e5f6d61726b735f636f64652d1224080112206164645f6d6f72655f6578636c616d6174696f6e5f6d61726b735f636f64652d2a050801120100"}, } for _, tc := range testCases { diff --git a/consensus/reactor.go b/consensus/reactor.go index 21dfd02047..f72358fada 100644 --- a/consensus/reactor.go +++ b/consensus/reactor.go @@ -275,7 +275,7 @@ func (conR *Reactor) Receive(chID byte, src p2p.Peer, msgBytes []byte) { return } // Peer claims to have a maj23 for some BlockID at H,R,S, - err := votes.SetPeerMaj23(msg.Round, msg.Type, ps.peer.ID(), msg.BlockID, msg.PartSetHeader) + err := votes.SetPeerMaj23(msg.Round, msg.Type, ps.peer.ID(), msg.BlockID) if err != nil { conR.Switch.StopPeerForError(src, err) return @@ -285,19 +285,18 @@ func (conR *Reactor) Receive(chID byte, src p2p.Peer, msgBytes []byte) { var ourVotes *bits.BitArray switch msg.Type { case tmproto.PrevoteType: - ourVotes = votes.Prevotes(msg.Round).BitArrayByBlockID(msg.BlockID, msg.PartSetHeader) + ourVotes = votes.Prevotes(msg.Round).BitArrayByBlockID(msg.BlockID) case tmproto.PrecommitType: - ourVotes = votes.Precommits(msg.Round).BitArrayByBlockID(msg.BlockID, msg.PartSetHeader) + ourVotes = votes.Precommits(msg.Round).BitArrayByBlockID(msg.BlockID) default: panic("Bad VoteSetBitsMessage field Type. Forgot to add a check in ValidateBasic?") } src.TrySend(VoteSetBitsChannel, MustEncode(&VoteSetBitsMessage{ - Height: msg.Height, - Round: msg.Round, - Type: msg.Type, - BlockID: msg.BlockID, - PartSetHeader: msg.PartSetHeader, - Votes: ourVotes, + Height: msg.Height, + Round: msg.Round, + Type: msg.Type, + BlockID: msg.BlockID, + Votes: ourVotes, })) default: conR.Logger.Error(fmt.Sprintf("Unknown message type %v", reflect.TypeOf(msg))) @@ -360,9 +359,9 @@ func (conR *Reactor) Receive(chID byte, src p2p.Peer, msgBytes []byte) { var ourVotes *bits.BitArray switch msg.Type { case tmproto.PrevoteType: - ourVotes = votes.Prevotes(msg.Round).BitArrayByBlockID(msg.BlockID, msg.PartSetHeader) + ourVotes = votes.Prevotes(msg.Round).BitArrayByBlockID(msg.BlockID) case tmproto.PrecommitType: - ourVotes = votes.Precommits(msg.Round).BitArrayByBlockID(msg.BlockID, msg.PartSetHeader) + ourVotes = votes.Precommits(msg.Round).BitArrayByBlockID(msg.BlockID) default: panic("Bad VoteSetBitsMessage field Type. Forgot to add a check in ValidateBasic?") } @@ -532,7 +531,7 @@ OUTER_LOOP: "blockstoreBase", conR.conS.blockStore.Base(), "blockstoreHeight", conR.conS.blockStore.Height()) time.Sleep(conR.conS.config.PeerGossipSleepDuration) } else { - ps.InitProposalBlockParts(blockMeta.PartSetHeader) + ps.InitProposalBlockParts(blockMeta.BlockID.PartSetHeader) } // continue the loop since prs is a copy and not effected by this initialization continue OUTER_LOOP @@ -598,9 +597,9 @@ func (conR *Reactor) gossipDataForCatchup(logger log.Logger, rs *cstypes.RoundSt "blockstoreBase", conR.conS.blockStore.Base(), "blockstoreHeight", conR.conS.blockStore.Height()) time.Sleep(conR.conS.config.PeerGossipSleepDuration) return - } else if !blockMeta.PartSetHeader.Equals(prs.ProposalBlockPartSetHeader) { + } else if !blockMeta.BlockID.PartSetHeader.Equals(prs.ProposalBlockPartSetHeader) { logger.Info("Peer ProposalBlockPartSetHeader mismatch, sleeping", - "blockPartSetHeader", blockMeta.PartSetHeader, "peerBlockPartSetHeader", prs.ProposalBlockPartSetHeader) + "blockPartSetHeader", blockMeta.BlockID.PartSetHeader, "peerBlockPartSetHeader", prs.ProposalBlockPartSetHeader) time.Sleep(conR.conS.config.PeerGossipSleepDuration) return } @@ -608,7 +607,7 @@ func (conR *Reactor) gossipDataForCatchup(logger log.Logger, rs *cstypes.RoundSt part := conR.conS.blockStore.LoadBlockPart(prs.Height, index) if part == nil { logger.Error("Could not load part", "index", index, - "blockPartSetHeader", blockMeta.PartSetHeader, "peerBlockPartSetHeader", prs.ProposalBlockPartSetHeader) + "blockPartSetHeader", blockMeta.BlockID.PartSetHeader, "peerBlockPartSetHeader", prs.ProposalBlockPartSetHeader) time.Sleep(conR.conS.config.PeerGossipSleepDuration) return } @@ -779,13 +778,12 @@ OUTER_LOOP: rs := conR.conS.GetRoundState() prs := ps.GetRoundState() if rs.Height == prs.Height { - if maj23, maj23PSH, ok := rs.Votes.Prevotes(prs.Round).TwoThirdsMajority(); ok { + if maj23, ok := rs.Votes.Prevotes(prs.Round).TwoThirdsMajority(); ok { peer.TrySend(StateChannel, MustEncode(&VoteSetMaj23Message{ - Height: prs.Height, - Round: prs.Round, - Type: tmproto.PrevoteType, - BlockID: maj23, - PartSetHeader: maj23PSH, + Height: prs.Height, + Round: prs.Round, + Type: tmproto.PrevoteType, + BlockID: maj23, })) time.Sleep(conR.conS.config.PeerQueryMaj23SleepDuration) } @@ -797,13 +795,12 @@ OUTER_LOOP: rs := conR.conS.GetRoundState() prs := ps.GetRoundState() if rs.Height == prs.Height { - if maj23, maj23PSH, ok := rs.Votes.Precommits(prs.Round).TwoThirdsMajority(); ok { + if maj23, ok := rs.Votes.Precommits(prs.Round).TwoThirdsMajority(); ok { peer.TrySend(StateChannel, MustEncode(&VoteSetMaj23Message{ - Height: prs.Height, - Round: prs.Round, - Type: tmproto.PrecommitType, - BlockID: maj23, - PartSetHeader: maj23PSH, + Height: prs.Height, + Round: prs.Round, + Type: tmproto.PrecommitType, + BlockID: maj23, })) time.Sleep(conR.conS.config.PeerQueryMaj23SleepDuration) } @@ -815,13 +812,12 @@ OUTER_LOOP: rs := conR.conS.GetRoundState() prs := ps.GetRoundState() if rs.Height == prs.Height && prs.ProposalPOLRound >= 0 { - if maj23, maj23PSH, ok := rs.Votes.Prevotes(prs.ProposalPOLRound).TwoThirdsMajority(); ok { + if maj23, ok := rs.Votes.Prevotes(prs.ProposalPOLRound).TwoThirdsMajority(); ok { peer.TrySend(StateChannel, MustEncode(&VoteSetMaj23Message{ - Height: prs.Height, - Round: prs.ProposalPOLRound, - Type: tmproto.PrevoteType, - BlockID: maj23, - PartSetHeader: maj23PSH, + Height: prs.Height, + Round: prs.ProposalPOLRound, + Type: tmproto.PrevoteType, + BlockID: maj23, })) time.Sleep(conR.conS.config.PeerQueryMaj23SleepDuration) } @@ -1021,8 +1017,8 @@ func (ps *PeerState) SetHasProposal(proposal *types.Proposal) { return } - ps.PRS.ProposalBlockPartSetHeader = proposal.PartSetHeader - ps.PRS.ProposalBlockParts = bits.NewBitArray(int(proposal.PartSetHeader.Total)) + ps.PRS.ProposalBlockPartSetHeader = proposal.BlockID.PartSetHeader + ps.PRS.ProposalBlockParts = bits.NewBitArray(int(proposal.BlockID.PartSetHeader.Total)) ps.PRS.ProposalPOLRound = proposal.POLRound ps.PRS.ProposalPOL = nil // Nil until ProposalPOLMessage received. } @@ -1665,11 +1661,10 @@ func (m *HasVoteMessage) String() string { // VoteSetMaj23Message is sent to indicate that a given BlockID has seen +2/3 votes. type VoteSetMaj23Message struct { - Height int64 - Round int32 - Type tmproto.SignedMsgType - BlockID types.BlockID - PartSetHeader types.PartSetHeader + Height int64 + Round int32 + Type tmproto.SignedMsgType + BlockID types.BlockID } // ValidateBasic performs basic validation. @@ -1684,10 +1679,7 @@ func (m *VoteSetMaj23Message) ValidateBasic() error { return errors.New("invalid Type") } if err := m.BlockID.ValidateBasic(); err != nil { - return fmt.Errorf("wrong BlockID: %w", err) - } - if err := m.PartSetHeader.ValidateBasic(); err != nil { - return fmt.Errorf("wrong PartSetHeader: %w", err) + return fmt.Errorf("wrong BlockID: %v", err) } return nil } @@ -1701,12 +1693,11 @@ func (m *VoteSetMaj23Message) String() string { // VoteSetBitsMessage is sent to communicate the bit-array of votes seen for the BlockID. type VoteSetBitsMessage struct { - Height int64 - Round int32 - Type tmproto.SignedMsgType - BlockID types.BlockID - PartSetHeader types.PartSetHeader - Votes *bits.BitArray + Height int64 + Round int32 + Type tmproto.SignedMsgType + BlockID types.BlockID + Votes *bits.BitArray } // ValidateBasic performs basic validation. @@ -1720,9 +1711,6 @@ func (m *VoteSetBitsMessage) ValidateBasic() error { if err := m.BlockID.ValidateBasic(); err != nil { return fmt.Errorf("wrong BlockID: %v", err) } - if err := m.PartSetHeader.ValidateBasic(); err != nil { - return fmt.Errorf("wrong PartSetHeader: %w", err) - } // NOTE: Votes.Size() can be zero if the node does not have any if m.Votes.Size() > types.MaxVotesCount { return fmt.Errorf("votes bit array is too big: %d, max: %d", m.Votes.Size(), types.MaxVotesCount) diff --git a/consensus/reactor_test.go b/consensus/reactor_test.go index b3684ab911..a0c668bdb5 100644 --- a/consensus/reactor_test.go +++ b/consensus/reactor_test.go @@ -926,13 +926,12 @@ func TestVoteSetMaj23MessageValidateBasic(t *testing.T) { ) validBlockID := types.BlockID{} - validPSH := types.PartSetHeader{} invalidBlockID := types.BlockID{ Hash: bytes.HexBytes{}, - } - invalidPSH := types.PartSetHeader{ - Total: 1, - Hash: []byte{0}, + PartSetHeader: types.PartSetHeader{ + Total: 1, + Hash: []byte{0}, + }, } testCases := []struct { // nolint: maligned @@ -942,24 +941,22 @@ func TestVoteSetMaj23MessageValidateBasic(t *testing.T) { testName string messageType tmproto.SignedMsgType messageBlockID types.BlockID - messagePSH types.PartSetHeader }{ - {false, 0, 0, "Valid Message", validSignedMsgType, validBlockID, validPSH}, - {true, -1, 0, "Invalid Message", validSignedMsgType, validBlockID, validPSH}, - {true, 0, -1, "Invalid Message", validSignedMsgType, validBlockID, validPSH}, - {true, 0, 0, "Invalid Message", invalidSignedMsgType, validBlockID, validPSH}, - {true, 0, 0, "Invalid Message", validSignedMsgType, invalidBlockID, invalidPSH}, + {false, 0, 0, "Valid Message", validSignedMsgType, validBlockID}, + {true, -1, 0, "Invalid Message", validSignedMsgType, validBlockID}, + {true, 0, -1, "Invalid Message", validSignedMsgType, validBlockID}, + {true, 0, 0, "Invalid Message", invalidSignedMsgType, validBlockID}, + {true, 0, 0, "Invalid Message", validSignedMsgType, invalidBlockID}, } for _, tc := range testCases { tc := tc t.Run(tc.testName, func(t *testing.T) { message := VoteSetMaj23Message{ - Height: tc.messageHeight, - Round: tc.messageRound, - Type: tc.messageType, - BlockID: tc.messageBlockID, - PartSetHeader: tc.messagePSH, + Height: tc.messageHeight, + Round: tc.messageRound, + Type: tc.messageType, + BlockID: tc.messageBlockID, } assert.Equal(t, tc.expectErr, message.ValidateBasic() != nil, "Validate Basic had an unexpected result") @@ -978,12 +975,12 @@ func TestVoteSetBitsMessageValidateBasic(t *testing.T) { {func(msg *VoteSetBitsMessage) { msg.BlockID = types.BlockID{ Hash: bytes.HexBytes{}, + PartSetHeader: types.PartSetHeader{ + Total: 1, + Hash: []byte{0}, + }, } - msg.PartSetHeader = types.PartSetHeader{ - Total: 1, - Hash: []byte{0}, - } - }, "wrong PartSetHeader: wrong Hash:"}, + }, "wrong BlockID: wrong PartSetHeader: wrong Hash:"}, {func(msg *VoteSetBitsMessage) { msg.Votes = bits.NewBitArray(types.MaxVotesCount + 1) }, "votes bit array is too big: 10001, max: 10000"}, } @@ -992,12 +989,11 @@ func TestVoteSetBitsMessageValidateBasic(t *testing.T) { tc := tc t.Run(fmt.Sprintf("#%d", i), func(t *testing.T) { msg := &VoteSetBitsMessage{ - Height: 1, - Round: 0, - Type: 0x01, - Votes: bits.NewBitArray(1), - BlockID: types.BlockID{}, - PartSetHeader: types.PartSetHeader{}, + Height: 1, + Round: 0, + Type: 0x01, + Votes: bits.NewBitArray(1), + BlockID: types.BlockID{}, } tc.malleateFn(msg) diff --git a/consensus/replay.go b/consensus/replay.go index bdd5d89448..e01845abf6 100644 --- a/consensus/replay.go +++ b/consensus/replay.go @@ -70,7 +70,7 @@ func (cs *State) readReplayMessage(msg *TimedWALMessage, newStepSub types.Subscr case *ProposalMessage: p := msg.Proposal cs.Logger.Info("Replay: Proposal", "height", p.Height, "round", p.Round, "header", - p.PartSetHeader, "pol", p.POLRound, "peer", peerID) + p.BlockID.PartSetHeader, "pol", p.POLRound, "peer", peerID) case *BlockPartMessage: cs.Logger.Info("Replay: BlockPart", "height", msg.Height, "round", msg.Round, "peer", peerID) case *VoteMessage: @@ -506,7 +506,7 @@ func (h *Handshaker) replayBlock(state sm.State, height int64, proxyApp proxy.Ap blockExec := sm.NewBlockExecutor(h.stateStore, h.logger, proxyApp, emptyMempool{}, sm.EmptyEvidencePool{}) blockExec.SetEventBus(h.eventBus) - state, _, err = blockExec.ApplyBlock(state, meta.BlockID, meta.PartSetHeader, block) + state, _, err = blockExec.ApplyBlock(state, meta.BlockID, block) if err != nil { return sm.State{}, err } diff --git a/consensus/replay_test.go b/consensus/replay_test.go index e18422b5ab..a6888d3c45 100644 --- a/consensus/replay_test.go +++ b/consensus/replay_test.go @@ -370,11 +370,9 @@ func TestSimulateValidatorsChange(t *testing.T) { assert.Nil(t, err) propBlock, _ := css[0].createProposalBlock() // changeProposer(t, cs1, vs2) propBlockParts := propBlock.MakePartSet(partSize) - blockID := types.BlockID{Hash: propBlock.Hash()} + blockID := types.BlockID{Hash: propBlock.Hash(), PartSetHeader: propBlockParts.Header()} - proposal := types.NewProposal( - vss[1].Height, round, -1, blockID, &propBlock.DataAvailabilityHeader, propBlockParts.Header(), - ) + proposal := types.NewProposal(vss[1].Height, round, -1, blockID, &propBlock.DataAvailabilityHeader) p, err := proposal.ToProto() require.NoError(t, err) if err := vss[1].SignProposal(config.ChainID(), p); err != nil { @@ -403,11 +401,9 @@ func TestSimulateValidatorsChange(t *testing.T) { assert.Nil(t, err) propBlock, _ = css[0].createProposalBlock() // changeProposer(t, cs1, vs2) propBlockParts = propBlock.MakePartSet(partSize) - blockID = types.BlockID{Hash: propBlock.Hash()} + blockID = types.BlockID{Hash: propBlock.Hash(), PartSetHeader: propBlockParts.Header()} - proposal = types.NewProposal( - vss[2].Height, round, -1, blockID, &propBlock.DataAvailabilityHeader, propBlockParts.Header(), - ) + proposal = types.NewProposal(vss[2].Height, round, -1, blockID, &propBlock.DataAvailabilityHeader) p, err = proposal.ToProto() require.NoError(t, err) if err := vss[2].SignProposal(config.ChainID(), p); err != nil { @@ -443,8 +439,7 @@ func TestSimulateValidatorsChange(t *testing.T) { assert.Nil(t, err) propBlock, _ = css[0].createProposalBlock() // changeProposer(t, cs1, vs2) propBlockParts = propBlock.MakePartSet(partSize) - blockID = types.BlockID{Hash: propBlock.Hash()} - psh := propBlockParts.Header() + blockID = types.BlockID{Hash: propBlock.Hash(), PartSetHeader: propBlockParts.Header()} newVss := make([]*validatorStub, nVals+1) copy(newVss, vss[:nVals+1]) sort.Sort(ValidatorStubsByPower(newVss)) @@ -466,7 +461,7 @@ func TestSimulateValidatorsChange(t *testing.T) { selfIndex := valIndexFn(0) - proposal = types.NewProposal(vss[3].Height, round, -1, blockID, &propBlock.DataAvailabilityHeader, psh) + proposal = types.NewProposal(vss[3].Height, round, -1, blockID, &propBlock.DataAvailabilityHeader) p, err = proposal.ToProto() require.NoError(t, err) if err := vss[3].SignProposal(config.ChainID(), p); err != nil { @@ -520,14 +515,13 @@ func TestSimulateValidatorsChange(t *testing.T) { assert.Nil(t, err) propBlock, _ = css[0].createProposalBlock() // changeProposer(t, cs1, vs2) propBlockParts = propBlock.MakePartSet(partSize) - blockID = types.BlockID{Hash: propBlock.Hash()} - psh = propBlockParts.Header() + blockID = types.BlockID{Hash: propBlock.Hash(), PartSetHeader: propBlockParts.Header()} newVss = make([]*validatorStub, nVals+3) copy(newVss, vss[:nVals+3]) sort.Sort(ValidatorStubsByPower(newVss)) selfIndex = valIndexFn(0) - proposal = types.NewProposal(vss[1].Height, round, -1, blockID, &propBlock.DataAvailabilityHeader, psh) + proposal = types.NewProposal(vss[1].Height, round, -1, blockID, &propBlock.DataAvailabilityHeader) p, err = proposal.ToProto() require.NoError(t, err) if err := vss[1].SignProposal(config.ChainID(), p); err != nil { @@ -797,9 +791,8 @@ func applyBlock(stateStore sm.Store, st sm.State, blk *types.Block, proxyApp pro testPartSize := types.BlockPartSizeBytes blockExec := sm.NewBlockExecutor(stateStore, log.TestingLogger(), proxyApp.Consensus(), mempool, evpool) - blkID := types.BlockID{Hash: blk.Hash()} - psh := blk.MakePartSet(testPartSize).Header() - newState, _, err := blockExec.ApplyBlock(st, blkID, psh, blk) + blkID := types.BlockID{Hash: blk.Hash(), PartSetHeader: blk.MakePartSet(testPartSize).Header()} + newState, _, err := blockExec.ApplyBlock(st, blkID, blk) if err != nil { panic(err) } @@ -996,18 +989,17 @@ func makeBlocks(n int, state *sm.State, privVal types.PrivValidator) []*types.Bl func makeBlock(state sm.State, lastBlock *types.Block, lastBlockMeta *types.BlockMeta, privVal types.PrivValidator, height int64) (*types.Block, *types.PartSet) { - lastCommit := types.NewCommit(height-1, 0, types.BlockID{}, nil, types.PartSetHeader{}) + lastCommit := types.NewCommit(height-1, 0, types.BlockID{}, nil) if height > 1 { vote, _ := types.MakeVote( lastBlock.Header.Height, lastBlockMeta.BlockID, - lastBlockMeta.PartSetHeader, state.Validators, privVal, lastBlock.Header.ChainID, time.Now()) lastCommit = types.NewCommit(vote.Height, vote.Round, - lastBlockMeta.BlockID, []types.CommitSig{vote.CommitSig()}, lastBlockMeta.PartSetHeader) + lastBlockMeta.BlockID, []types.CommitSig{vote.CommitSig()}) } return state.MakeBlock( @@ -1121,7 +1113,7 @@ func makeBlockchainFromWAL(wal WAL) ([]*types.Block, []*types.Commit, error) { case *types.Vote: if p.Type == tmproto.PrecommitType { thisBlockCommit = types.NewCommit(p.Height, p.Round, - p.BlockID, []types.CommitSig{p.CommitSig()}, p.PartSetHeader) + p.BlockID, []types.CommitSig{p.CommitSig()}) } } } @@ -1157,7 +1149,7 @@ func readPieceFromWAL(msg *TimedWALMessage) interface{} { case msgInfo: switch msg := m.Msg.(type) { case *ProposalMessage: - return &msg.Proposal.PartSetHeader + return &msg.Proposal.BlockID.PartSetHeader case *BlockPartMessage: return msg.Part case *VoteMessage: @@ -1216,9 +1208,8 @@ func (bs *mockBlockStore) LoadBlockByHash(ctx context.Context, hash []byte) (*ty func (bs *mockBlockStore) LoadBlockMeta(height int64) *types.BlockMeta { block := bs.chain[height-1] return &types.BlockMeta{ - BlockID: types.BlockID{Hash: block.Hash()}, - PartSetHeader: block.MakePartSet(types.BlockPartSizeBytes).Header(), - Header: block.Header, + BlockID: types.BlockID{Hash: block.Hash(), PartSetHeader: block.MakePartSet(types.BlockPartSizeBytes).Header()}, + Header: block.Header, } } func (bs *mockBlockStore) LoadBlockPart(height int64, index int) *types.Part { return nil } diff --git a/consensus/state.go b/consensus/state.go index 78dd0a0faf..659ae9d7a0 100644 --- a/consensus/state.go +++ b/consensus/state.go @@ -1093,15 +1093,8 @@ func (cs *State) defaultDecideProposal(height int64, round int32) { } // Make proposal - propBlockID := types.BlockID{Hash: block.Hash()} - proposal := types.NewProposal( - height, - round, - cs.ValidRound, - propBlockID, - &block.DataAvailabilityHeader, - blockParts.Header(), - ) + propBlockID := types.BlockID{Hash: block.Hash(), PartSetHeader: blockParts.Header()} + proposal := types.NewProposal(height, round, cs.ValidRound, propBlockID, &block.DataAvailabilityHeader) p, err := proposal.ToProto() if err != nil { cs.Logger.Error(fmt.Sprintf("can't serialize proposal: %s", err.Error())) @@ -1157,7 +1150,7 @@ func (cs *State) createProposalBlock() (block *types.Block, blockParts *types.Pa case cs.Height == cs.state.InitialHeight: // We're creating a proposal for the first block. // The commit is empty, but not nil. - commit = types.NewCommit(0, 0, types.BlockID{}, nil, types.PartSetHeader{}) + commit = types.NewCommit(0, 0, types.BlockID{}, nil) case cs.LastCommit.HasTwoThirdsMajority(): // Make the commit from LastCommit commit = cs.LastCommit.MakeCommit() @@ -1299,7 +1292,7 @@ func (cs *State) enterPrecommit(height int64, round int32) { }() // check for a polka - blockID, partSetHeader, ok := cs.Votes.Prevotes(round).TwoThirdsMajority() + blockID, ok := cs.Votes.Prevotes(round).TwoThirdsMajority() // If we don't have a polka, we must precommit nil. if !ok { @@ -1318,7 +1311,7 @@ func (cs *State) enterPrecommit(height int64, round int32) { } // the latest POLRound should be this round. - polRound, _, _ := cs.Votes.POLInfo() + polRound, _ := cs.Votes.POLInfo() if polRound < round { panic(fmt.Sprintf("This POLRound should be %v but got %v", round, polRound)) } @@ -1349,7 +1342,7 @@ func (cs *State) enterPrecommit(height int64, round int32) { if err := cs.eventBus.PublishEventRelock(cs.RoundStateEvent()); err != nil { cs.Logger.Error("Error publishing event relock", "err", err) } - cs.signAddVote(tmproto.PrecommitType, blockID.Hash, partSetHeader) + cs.signAddVote(tmproto.PrecommitType, blockID.Hash, blockID.PartSetHeader) return } @@ -1366,7 +1359,7 @@ func (cs *State) enterPrecommit(height int64, round int32) { if err := cs.eventBus.PublishEventLock(cs.RoundStateEvent()); err != nil { cs.Logger.Error("Error publishing event lock", "err", err) } - cs.signAddVote(tmproto.PrecommitType, blockID.Hash, partSetHeader) + cs.signAddVote(tmproto.PrecommitType, blockID.Hash, blockID.PartSetHeader) return } @@ -1377,9 +1370,9 @@ func (cs *State) enterPrecommit(height int64, round int32) { cs.LockedRound = -1 cs.LockedBlock = nil cs.LockedBlockParts = nil - if !cs.ProposalBlockParts.HasHeader(partSetHeader) { + if !cs.ProposalBlockParts.HasHeader(blockID.PartSetHeader) { cs.ProposalBlock = nil - cs.ProposalBlockParts = types.NewPartSetFromHeader(partSetHeader) + cs.ProposalBlockParts = types.NewPartSetFromHeader(blockID.PartSetHeader) } if err := cs.eventBus.PublishEventUnlock(cs.RoundStateEvent()); err != nil { cs.Logger.Error("Error publishing event unlock", "err", err) @@ -1442,7 +1435,7 @@ func (cs *State) enterCommit(height int64, commitRound int32) { cs.tryFinalizeCommit(height) }() - blockID, partSetHeader, ok := cs.Votes.Precommits(commitRound).TwoThirdsMajority() + blockID, ok := cs.Votes.Precommits(commitRound).TwoThirdsMajority() if !ok { panic("RunActionCommit() expects +2/3 precommits") } @@ -1458,7 +1451,7 @@ func (cs *State) enterCommit(height int64, commitRound int32) { // If we don't have the block being committed, set up to get it. if !cs.ProposalBlock.HashesTo(blockID.Hash) { - if !cs.ProposalBlockParts.HasHeader(partSetHeader) { + if !cs.ProposalBlockParts.HasHeader(blockID.PartSetHeader) { logger.Info( "Commit is for a block we don't know about. Set ProposalBlock=nil", "proposal", @@ -1468,7 +1461,7 @@ func (cs *State) enterCommit(height int64, commitRound int32) { // We're getting the wrong block. // Set up ProposalBlockParts and keep waiting. cs.ProposalBlock = nil - cs.ProposalBlockParts = types.NewPartSetFromHeader(partSetHeader) + cs.ProposalBlockParts = types.NewPartSetFromHeader(blockID.PartSetHeader) if err := cs.eventBus.PublishEventValidBlock(cs.RoundStateEvent()); err != nil { cs.Logger.Error("Error publishing valid block", "err", err) } @@ -1488,7 +1481,7 @@ func (cs *State) tryFinalizeCommit(height int64) { panic(fmt.Sprintf("tryFinalizeCommit() cs.Height: %v vs height: %v", cs.Height, height)) } - blockID, _, ok := cs.Votes.Precommits(cs.CommitRound).TwoThirdsMajority() + blockID, ok := cs.Votes.Precommits(cs.CommitRound).TwoThirdsMajority() if !ok || len(blockID.Hash) == 0 { logger.Error("Attempt to finalize failed. There was no +2/3 majority, or +2/3 was for .") return @@ -1521,13 +1514,13 @@ func (cs *State) finalizeCommit(height int64) { return } - blockID, partSetHeader, ok := cs.Votes.Precommits(cs.CommitRound).TwoThirdsMajority() + blockID, ok := cs.Votes.Precommits(cs.CommitRound).TwoThirdsMajority() block, blockParts := cs.ProposalBlock, cs.ProposalBlockParts if !ok { panic("Cannot finalizeCommit, commit does not have two thirds majority") } - if !blockParts.HasHeader(partSetHeader) { + if !blockParts.HasHeader(blockID.PartSetHeader) { panic("Expected ProposalBlockParts header to be commit header") } if !block.HashesTo(blockID.Hash) { @@ -1593,8 +1586,7 @@ func (cs *State) finalizeCommit(height int64) { var retainHeight int64 stateCopy, retainHeight, err = cs.blockExec.ApplyBlock( stateCopy, - types.BlockID{Hash: block.Hash()}, - blockParts.Header(), + types.BlockID{Hash: block.Hash(), PartSetHeader: blockParts.Header()}, block) if err != nil { cs.Logger.Error("Error on ApplyBlock", "err", err) @@ -1778,7 +1770,7 @@ func (cs *State) defaultSetProposal(proposal *types.Proposal) error { // This happens if we're already in cstypes.RoundStepCommit or if there is a valid block in the current round. // TODO: We can check if Proposal is for a different block as this is a sign of misbehavior! if cs.ProposalBlockParts == nil { - cs.ProposalBlockParts = types.NewPartSetFromHeader(proposal.PartSetHeader) + cs.ProposalBlockParts = types.NewPartSetFromHeader(proposal.BlockID.PartSetHeader) } cs.Logger.Info("Received proposal", "proposal", proposal) return nil @@ -1840,7 +1832,7 @@ func (cs *State) addProposalBlockPart(msg *BlockPartMessage, peerID p2p.ID) (add // Update Valid* if we can. prevotes := cs.Votes.Prevotes(cs.Round) - blockID, _, hasTwoThirds := prevotes.TwoThirdsMajority() + blockID, hasTwoThirds := prevotes.TwoThirdsMajority() if hasTwoThirds && !blockID.IsZero() && (cs.ValidRound < cs.Round) { if cs.ProposalBlock.HashesTo(blockID.Hash) { cs.Logger.Info("Updating valid block to new proposal block", @@ -1997,7 +1989,7 @@ func (cs *State) addVote( cs.Logger.Info("Added to prevote", "vote", vote, "prevotes", prevotes.StringShort()) // If +2/3 prevotes for a block or nil for *any* round: - if blockID, partSetHeader, ok := prevotes.TwoThirdsMajority(); ok { + if blockID, ok := prevotes.TwoThirdsMajority(); ok { // There was a polka! // If we're locked but this is a recent polka, unlock. @@ -2036,8 +2028,8 @@ func (cs *State) addVote( // We're getting the wrong block. cs.ProposalBlock = nil } - if !cs.ProposalBlockParts.HasHeader(partSetHeader) { - cs.ProposalBlockParts = types.NewPartSetFromHeader(partSetHeader) + if !cs.ProposalBlockParts.HasHeader(blockID.PartSetHeader) { + cs.ProposalBlockParts = types.NewPartSetFromHeader(blockID.PartSetHeader) } cs.evsw.FireEvent(types.EventValidBlock, &cs.RoundState) if err := cs.eventBus.PublishEventValidBlock(cs.RoundStateEvent()); err != nil { @@ -2052,7 +2044,7 @@ func (cs *State) addVote( // Round-skip if there is any 2/3+ of votes ahead of us cs.enterNewRound(height, vote.Round) case cs.Round == vote.Round && cstypes.RoundStepPrevote <= cs.Step: // current round - blockID, _, ok := prevotes.TwoThirdsMajority() + blockID, ok := prevotes.TwoThirdsMajority() if ok && (cs.isProposalComplete() || len(blockID.Hash) == 0) { cs.enterPrecommit(height, vote.Round) } else if prevotes.HasTwoThirdsAny() { @@ -2069,7 +2061,7 @@ func (cs *State) addVote( precommits := cs.Votes.Precommits(vote.Round) cs.Logger.Info("Added to precommit", "vote", vote, "precommits", precommits.StringShort()) - blockID, _, ok := precommits.TwoThirdsMajority() + blockID, ok := precommits.TwoThirdsMajority() if ok { // Executed as TwoThirdsMajority could be from a higher round cs.enterNewRound(height, vote.Round) @@ -2119,8 +2111,7 @@ func (cs *State) signVote( Round: cs.Round, Timestamp: cs.voteTime(), Type: msgType, - BlockID: types.BlockID{Hash: hash}, - PartSetHeader: header, + BlockID: types.BlockID{Hash: hash, PartSetHeader: header}, } v := vote.ToProto() err := cs.privValidator.SignVote(cs.state.ChainID, v) diff --git a/consensus/state_test.go b/consensus/state_test.go index 98273ee59a..568c1990d5 100644 --- a/consensus/state_test.go +++ b/consensus/state_test.go @@ -208,9 +208,8 @@ func TestStateBadProposal(t *testing.T) { stateHash[0] = (stateHash[0] + 1) % 255 propBlock.AppHash = stateHash propBlockParts := propBlock.MakePartSet(partSize) - blockID := types.BlockID{Hash: propBlock.Hash()} - psh := propBlockParts.Header() - proposal := types.NewProposal(vs2.Height, round, -1, blockID, &propBlock.DataAvailabilityHeader, psh) + blockID := types.BlockID{Hash: propBlock.Hash(), PartSetHeader: propBlockParts.Header()} + proposal := types.NewProposal(vs2.Height, round, -1, blockID, &propBlock.DataAvailabilityHeader) p, err := proposal.ToProto() require.NoError(t, err) if err := vs2.SignProposal(config.ChainID(), p); err != nil { @@ -228,7 +227,7 @@ func TestStateBadProposal(t *testing.T) { startTestRound(cs1, height, round) // wait for proposal - ensureProposal(proposalCh, height, round, blockID, psh) + ensureProposal(proposalCh, height, round, blockID) // wait for prevote ensurePrevote(voteCh, height, round) @@ -265,8 +264,8 @@ func TestStateOversizedBlock(t *testing.T) { incrementRound(vss[1:]...) propBlockParts := propBlock.MakePartSet(partSize) - blockID := types.BlockID{Hash: propBlock.Hash()} - proposal := types.NewProposal(height, round, -1, blockID, &propBlock.DataAvailabilityHeader, propBlockParts.Header()) + blockID := types.BlockID{Hash: propBlock.Hash(), PartSetHeader: propBlockParts.Header()} + proposal := types.NewProposal(height, round, -1, blockID, &propBlock.DataAvailabilityHeader) p, err := proposal.ToProto() require.NoError(t, err) if err := vs2.SignProposal(config.ChainID(), p); err != nil { @@ -1054,7 +1053,7 @@ func TestStateLockPOLSafety2(t *testing.T) { _, propBlock0 := decideProposal(cs1, vss[0], height, round) propBlockHash0 := propBlock0.Hash() propBlockParts0 := propBlock0.MakePartSet(partSize) - propBlockID0 := types.BlockID{Hash: propBlockHash0} + propBlockID0 := types.BlockID{Hash: propBlockHash0, PartSetHeader: propBlockParts0.Header()} // the others sign a polka but we don't see it prevotes := signVotes(tmproto.PrevoteType, propBlockHash0, propBlockParts0.Header(), vs2, vs3, vs4) @@ -1097,9 +1096,7 @@ func TestStateLockPOLSafety2(t *testing.T) { round++ // moving to the next round // in round 2 we see the polkad block from round 0 - newProp := types.NewProposal( - height, round, 0, propBlockID0, &propBlock0.DataAvailabilityHeader, propBlockParts0.Header(), - ) + newProp := types.NewProposal(height, round, 0, propBlockID0, &propBlock0.DataAvailabilityHeader) p, err := newProp.ToProto() require.NoError(t, err) if err := vs3.SignProposal(config.ChainID(), p); err != nil { diff --git a/consensus/types/height_vote_set.go b/consensus/types/height_vote_set.go index 4232696286..a2b93ba329 100644 --- a/consensus/types/height_vote_set.go +++ b/consensus/types/height_vote_set.go @@ -150,17 +150,17 @@ func (hvs *HeightVoteSet) Precommits(round int32) *types.VoteSet { // Last round and blockID that has +2/3 prevotes for a particular block or nil. // Returns -1 if no such round exists. -func (hvs *HeightVoteSet) POLInfo() (polRound int32, polBlockID types.BlockID, polPSH types.PartSetHeader) { +func (hvs *HeightVoteSet) POLInfo() (polRound int32, polBlockID types.BlockID) { hvs.mtx.Lock() defer hvs.mtx.Unlock() for r := hvs.round; r >= 0; r-- { rvs := hvs.getVoteSet(r, tmproto.PrevoteType) - polBlockID, polPSH, ok := rvs.TwoThirdsMajority() + polBlockID, ok := rvs.TwoThirdsMajority() if ok { - return r, polBlockID, polPSH + return r, polBlockID } } - return -1, types.BlockID{}, types.PartSetHeader{} + return -1, types.BlockID{} } func (hvs *HeightVoteSet) getVoteSet(round int32, voteType tmproto.SignedMsgType) *types.VoteSet { @@ -186,9 +186,7 @@ func (hvs *HeightVoteSet) SetPeerMaj23( round int32, voteType tmproto.SignedMsgType, peerID p2p.ID, - blockID types.BlockID, - partSetHeader types.PartSetHeader, -) error { + blockID types.BlockID) error { hvs.mtx.Lock() defer hvs.mtx.Unlock() if !types.IsVoteTypeValid(voteType) { @@ -198,7 +196,7 @@ func (hvs *HeightVoteSet) SetPeerMaj23( if voteSet == nil { return nil // something we don't know about yet } - return voteSet.SetPeerMaj23(types.P2PID(peerID), blockID, partSetHeader) + return voteSet.SetPeerMaj23(types.P2PID(peerID), blockID) } //--------------------------------------------------------- diff --git a/consensus/types/height_vote_set_test.go b/consensus/types/height_vote_set_test.go index 5f84421fba..0082f99513 100644 --- a/consensus/types/height_vote_set_test.go +++ b/consensus/types/height_vote_set_test.go @@ -71,8 +71,7 @@ func makeVoteHR(t *testing.T, height int64, valIndex, round int32, privVals []ty Round: round, Timestamp: tmtime.Now(), Type: tmproto.PrecommitType, - BlockID: types.BlockID{Hash: randBytes}, - PartSetHeader: types.PartSetHeader{}, + BlockID: types.BlockID{Hash: randBytes, PartSetHeader: types.PartSetHeader{}}, } chainID := config.ChainID() diff --git a/consensus/types/round_state.go b/consensus/types/round_state.go index 0b4c2328ed..9e96724dea 100644 --- a/consensus/types/round_state.go +++ b/consensus/types/round_state.go @@ -149,15 +149,15 @@ func (rs *RoundState) CompleteProposalEvent() types.EventDataCompleteProposal { // We must construct BlockID from ProposalBlock and ProposalBlockParts // cs.Proposal is not guaranteed to be set when this function is called blockID := types.BlockID{ - Hash: rs.ProposalBlock.Hash(), + Hash: rs.ProposalBlock.Hash(), + PartSetHeader: rs.ProposalBlockParts.Header(), } return types.EventDataCompleteProposal{ - Height: rs.Height, - Round: rs.Round, - Step: rs.Step.String(), - BlockID: blockID, - PartSetHeader: rs.ProposalBlockParts.Header(), + Height: rs.Height, + Round: rs.Round, + Step: rs.Step.String(), + BlockID: blockID, } } diff --git a/evidence/pool_test.go b/evidence/pool_test.go index 8c7475bf7e..55623c6538 100644 --- a/evidence/pool_test.go +++ b/evidence/pool_test.go @@ -240,10 +240,9 @@ func TestCheckEvidenceWithLightClientAttack(t *testing.T) { // for simplicity we are simulating a duplicate vote attack where all the validators in the // conflictingVals set voted twice - blockID := makeBlockID(conflictingHeader.Hash()) - psh := makePartSetHeader(1000, []byte("partshash")) + blockID := makeBlockID(conflictingHeader.Hash(), 1000, []byte("partshash")) voteSet := types.NewVoteSet(evidenceChainID, height, 1, tmproto.SignedMsgType(2), conflictingVals) - commit, err := types.MakeCommit(blockID, psh, height, 1, voteSet, conflictingPrivVals, defaultEvidenceTime) + commit, err := types.MakeCommit(blockID, height, 1, voteSet, conflictingPrivVals, defaultEvidenceTime) require.NoError(t, err) ev := &types.LightClientAttackEvidence{ ConflictingBlock: &types.LightBlock{ @@ -259,9 +258,9 @@ func TestCheckEvidenceWithLightClientAttack(t *testing.T) { Timestamp: defaultEvidenceTime, } - trustedBlockID := makeBlockID(trustedHeader.Hash()) + trustedBlockID := makeBlockID(trustedHeader.Hash(), 1000, []byte("partshash")) trustedVoteSet := types.NewVoteSet(evidenceChainID, height, 1, tmproto.SignedMsgType(2), conflictingVals) - trustedCommit, err := types.MakeCommit(trustedBlockID, psh, height, 1, trustedVoteSet, conflictingPrivVals, + trustedCommit, err := types.MakeCommit(trustedBlockID, height, 1, trustedVoteSet, conflictingPrivVals, defaultEvidenceTime) require.NoError(t, err) @@ -425,7 +424,7 @@ func makeCommit(height int64, valAddr []byte) *types.Commit { Timestamp: defaultEvidenceTime, Signature: []byte("Signature"), }} - return types.NewCommit(height, 0, types.BlockID{}, commitSigs, types.PartSetHeader{}) + return types.NewCommit(height, 0, types.BlockID{}, commitSigs) } func defaultTestPool(height int64) (*evidence.Pool, types.MockPV) { diff --git a/evidence/reactor_test.go b/evidence/reactor_test.go index 39e159519d..ee6862f917 100644 --- a/evidence/reactor_test.go +++ b/evidence/reactor_test.go @@ -319,10 +319,10 @@ func exampleVote(t byte) *types.Vote { Timestamp: stamp, BlockID: types.BlockID{ Hash: tmhash.Sum([]byte("blockID_hash")), - }, - PartSetHeader: types.PartSetHeader{ - Total: 1000000, - Hash: tmhash.Sum([]byte("blockID_part_set_header_hash")), + PartSetHeader: types.PartSetHeader{ + Total: 1000000, + Hash: tmhash.Sum([]byte("blockID_part_set_header_hash")), + }, }, ValidatorAddress: crypto.AddressHash([]byte("validator_address")), ValidatorIndex: 56789, @@ -351,7 +351,7 @@ func TestEvidenceVectors(t *testing.T) { evidenceList []types.Evidence expBytes string }{ - {"DuplicateVoteEvidence", []types.Evidence{dupl}, "0a85020a82020a7908021003180222220a208b01023386c371778ecb6368573e539afc3cc860ec3a2f614e54fe5652f4fc802a0b08b1d381d20510809dca6f32146af1f4111082efb388211bc72c55bcd61e9ac3d538d5bb034a2608c0843d122072db3d959635dff1bb567bedaa70573392c5159666a3f8caf11e413aac52207a127908011003180222220a208b01023386c371778ecb6368573e539afc3cc860ec3a2f614e54fe5652f4fc802a0b08b1d381d20510809dca6f32146af1f4111082efb388211bc72c55bcd61e9ac3d538d5bb034a2608c0843d122072db3d959635dff1bb567bedaa70573392c5159666a3f8caf11e413aac52207a180a200a2a060880dbaae105"}, + {"DuplicateVoteEvidence", []types.Evidence{dupl}, "0a85020a82020a79080210031802224a0a208b01023386c371778ecb6368573e539afc3cc860ec3a2f614e54fe5652f4fc80122608c0843d122072db3d959635dff1bb567bedaa70573392c5159666a3f8caf11e413aac52207a2a0b08b1d381d20510809dca6f32146af1f4111082efb388211bc72c55bcd61e9ac3d538d5bb031279080110031802224a0a208b01023386c371778ecb6368573e539afc3cc860ec3a2f614e54fe5652f4fc80122608c0843d122072db3d959635dff1bb567bedaa70573392c5159666a3f8caf11e413aac52207a2a0b08b1d381d20510809dca6f32146af1f4111082efb388211bc72c55bcd61e9ac3d538d5bb03180a200a2a060880dbaae105"}, } for _, tc := range testCases { diff --git a/evidence/verify.go b/evidence/verify.go index 00acee1eaa..5235aed02c 100644 --- a/evidence/verify.go +++ b/evidence/verify.go @@ -138,7 +138,7 @@ func VerifyLightClientAttack(e *types.LightClientAttackEvidence, commonHeader, t } // ensure that 2/3 of the validator set did vote for this block if err := e.ConflictingBlock.ValidatorSet.VerifyCommitLight(trustedHeader.ChainID, e.ConflictingBlock.Commit.BlockID, - e.ConflictingBlock.Commit.PartSetHeader, e.ConflictingBlock.Height, e.ConflictingBlock.Commit); err != nil { + e.ConflictingBlock.Height, e.ConflictingBlock.Commit); err != nil { return fmt.Errorf("invalid commit from conflicting block: %w", err) } } @@ -186,12 +186,11 @@ func VerifyDuplicateVote(e *types.DuplicateVoteEvidence, chainID string, valSet ) } - // BlockIDs or PartSetHeaders must be different - if e.VoteA.BlockID.Equals(e.VoteB.BlockID) && e.VoteA.PartSetHeader.Equals(e.VoteB.PartSetHeader) { + // BlockIDs must be different + if e.VoteA.BlockID.Equals(e.VoteB.BlockID) { return fmt.Errorf( - "block IDs and PartSetHeaders are the same (%v, %v) - not a real duplicate vote", + "block IDs are the same (%v) - not a real duplicate vote", e.VoteA.BlockID, - e.VoteA.PartSetHeader, ) } diff --git a/evidence/verify_test.go b/evidence/verify_test.go index 2cdedb707e..e316593e4c 100644 --- a/evidence/verify_test.go +++ b/evidence/verify_test.go @@ -39,10 +39,9 @@ func TestVerifyLightClientAttack_Lunatic(t *testing.T) { conflictingHeader.ValidatorsHash = conflictingVals.Hash() // we are simulating a lunatic light client attack - blockID := makeBlockID(conflictingHeader.Hash()) - psh := makePartSetHeader(1000, []byte("partshash")) + blockID := makeBlockID(conflictingHeader.Hash(), 1000, []byte("partshash")) voteSet := types.NewVoteSet(evidenceChainID, 10, 1, tmproto.SignedMsgType(2), conflictingVals) - commit, err := types.MakeCommit(blockID, psh, 10, 1, voteSet, conflictingPrivVals, defaultEvidenceTime) + commit, err := types.MakeCommit(blockID, 10, 1, voteSet, conflictingPrivVals, defaultEvidenceTime) require.NoError(t, err) ev := &types.LightClientAttackEvidence{ ConflictingBlock: &types.LightBlock{ @@ -62,10 +61,10 @@ func TestVerifyLightClientAttack_Lunatic(t *testing.T) { Header: commonHeader, Commit: &types.Commit{}, } - trustedBlockID := makeBlockID(trustedHeader.Hash()) + trustedBlockID := makeBlockID(trustedHeader.Hash(), 1000, []byte("partshash")) vals, privVals := types.RandValidatorSet(3, 8) trustedVoteSet := types.NewVoteSet(evidenceChainID, 10, 1, tmproto.SignedMsgType(2), vals) - trustedCommit, err := types.MakeCommit(trustedBlockID, psh, 10, 1, trustedVoteSet, privVals, defaultEvidenceTime) + trustedCommit, err := types.MakeCommit(trustedBlockID, 10, 1, trustedVoteSet, privVals, defaultEvidenceTime) require.NoError(t, err) trustedSignedHeader := &types.SignedHeader{ Header: trustedHeader, @@ -143,10 +142,9 @@ func TestVerifyLightClientAttack_Equivocation(t *testing.T) { // we are simulating a duplicate vote attack where all the validators in the conflictingVals set // except the last validator vote twice - blockID := makeBlockID(conflictingHeader.Hash()) - psh := makePartSetHeader(1000, []byte("partshash")) + blockID := makeBlockID(conflictingHeader.Hash(), 1000, []byte("partshash")) voteSet := types.NewVoteSet(evidenceChainID, 10, 1, tmproto.SignedMsgType(2), conflictingVals) - commit, err := types.MakeCommit(blockID, psh, 10, 1, voteSet, conflictingPrivVals[:4], defaultEvidenceTime) + commit, err := types.MakeCommit(blockID, 10, 1, voteSet, conflictingPrivVals[:4], defaultEvidenceTime) require.NoError(t, err) ev := &types.LightClientAttackEvidence{ ConflictingBlock: &types.LightBlock{ @@ -162,17 +160,9 @@ func TestVerifyLightClientAttack_Equivocation(t *testing.T) { Timestamp: defaultEvidenceTime, } - trustedBlockID := makeBlockID(trustedHeader.Hash()) + trustedBlockID := makeBlockID(trustedHeader.Hash(), 1000, []byte("partshash")) trustedVoteSet := types.NewVoteSet(evidenceChainID, 10, 1, tmproto.SignedMsgType(2), conflictingVals) - trustedCommit, err := types.MakeCommit( - trustedBlockID, - psh, - 10, - 1, - trustedVoteSet, - conflictingPrivVals, - defaultEvidenceTime, - ) + trustedCommit, err := types.MakeCommit(trustedBlockID, 10, 1, trustedVoteSet, conflictingPrivVals, defaultEvidenceTime) require.NoError(t, err) trustedSignedHeader := &types.SignedHeader{ Header: trustedHeader, @@ -236,10 +226,9 @@ func TestVerifyLightClientAttack_Amnesia(t *testing.T) { // we are simulating an amnesia attack where all the validators in the conflictingVals set // except the last validator vote twice. However this time the commits are of different rounds. - blockID := makeBlockID(conflictingHeader.Hash()) - psh := makePartSetHeader(1000, []byte("partshash")) + blockID := makeBlockID(conflictingHeader.Hash(), 1000, []byte("partshash")) voteSet := types.NewVoteSet(evidenceChainID, 10, 0, tmproto.SignedMsgType(2), conflictingVals) - commit, err := types.MakeCommit(blockID, psh, 10, 0, voteSet, conflictingPrivVals, defaultEvidenceTime) + commit, err := types.MakeCommit(blockID, 10, 0, voteSet, conflictingPrivVals, defaultEvidenceTime) require.NoError(t, err) ev := &types.LightClientAttackEvidence{ ConflictingBlock: &types.LightBlock{ @@ -255,18 +244,9 @@ func TestVerifyLightClientAttack_Amnesia(t *testing.T) { Timestamp: defaultEvidenceTime, } - trustedBlockID := makeBlockID(trustedHeader.Hash()) - trustedPSH := makePartSetHeader(1000, []byte("partshash")) + trustedBlockID := makeBlockID(trustedHeader.Hash(), 1000, []byte("partshash")) trustedVoteSet := types.NewVoteSet(evidenceChainID, 10, 1, tmproto.SignedMsgType(2), conflictingVals) - trustedCommit, err := types.MakeCommit( - trustedBlockID, - trustedPSH, - 10, - 1, - trustedVoteSet, - conflictingPrivVals, - defaultEvidenceTime, - ) + trustedCommit, err := types.MakeCommit(trustedBlockID, 10, 1, trustedVoteSet, conflictingPrivVals, defaultEvidenceTime) require.NoError(t, err) trustedSignedHeader := &types.SignedHeader{ Header: trustedHeader, @@ -318,22 +298,18 @@ func TestVerifyDuplicateVoteEvidence(t *testing.T) { val2 := types.NewMockPV() valSet := types.NewValidatorSet([]*types.Validator{val.ExtractIntoValidator(1)}) - blockID := makeBlockID([]byte("blockhash")) - psh := makePartSetHeader(1000, []byte("partshash")) - blockID2 := makeBlockID([]byte("blockhash2")) - psh2 := makePartSetHeader(1000, []byte("partshash")) - blockID3 := makeBlockID([]byte("blockhash")) - psh3 := makePartSetHeader(10000, []byte("partshash")) - blockID4 := makeBlockID([]byte("blockhash")) - psh4 := makePartSetHeader(10000, []byte("partshash2")) + blockID := makeBlockID([]byte("blockhash"), 1000, []byte("partshash")) + blockID2 := makeBlockID([]byte("blockhash2"), 1000, []byte("partshash")) + blockID3 := makeBlockID([]byte("blockhash"), 10000, []byte("partshash")) + blockID4 := makeBlockID([]byte("blockhash"), 10000, []byte("partshash2")) const chainID = "mychain" - vote1 := makeVote(t, val, chainID, 0, 10, 2, 1, blockID, psh, defaultEvidenceTime) + vote1 := makeVote(t, val, chainID, 0, 10, 2, 1, blockID, defaultEvidenceTime) v1 := vote1.ToProto() err := val.SignVote(chainID, v1) require.NoError(t, err) - badVote := makeVote(t, val, chainID, 0, 10, 2, 1, blockID, psh, defaultEvidenceTime) + badVote := makeVote(t, val, chainID, 0, 10, 2, 1, blockID, defaultEvidenceTime) bv := badVote.ToProto() err = val2.SignVote(chainID, bv) require.NoError(t, err) @@ -342,17 +318,17 @@ func TestVerifyDuplicateVoteEvidence(t *testing.T) { badVote.Signature = bv.Signature cases := []voteData{ - {vote1, makeVote(t, val, chainID, 0, 10, 2, 1, blockID2, psh2, defaultEvidenceTime), true}, // different block ids - {vote1, makeVote(t, val, chainID, 0, 10, 2, 1, blockID3, psh3, defaultEvidenceTime), true}, - {vote1, makeVote(t, val, chainID, 0, 10, 2, 1, blockID4, psh4, defaultEvidenceTime), true}, - {vote1, makeVote(t, val, chainID, 0, 10, 2, 1, blockID, psh, defaultEvidenceTime), false}, // wrong block id - {vote1, makeVote(t, val, "mychain2", 0, 10, 2, 1, blockID2, psh2, defaultEvidenceTime), false}, // wrong chain id - {vote1, makeVote(t, val, chainID, 0, 11, 2, 1, blockID2, psh2, defaultEvidenceTime), false}, // wrong height - {vote1, makeVote(t, val, chainID, 0, 10, 3, 1, blockID2, psh2, defaultEvidenceTime), false}, // wrong round - {vote1, makeVote(t, val, chainID, 0, 10, 2, 2, blockID2, psh2, defaultEvidenceTime), false}, // wrong step - {vote1, makeVote(t, val2, chainID, 0, 10, 2, 1, blockID2, psh2, defaultEvidenceTime), false}, // wrong validator + {vote1, makeVote(t, val, chainID, 0, 10, 2, 1, blockID2, defaultEvidenceTime), true}, // different block ids + {vote1, makeVote(t, val, chainID, 0, 10, 2, 1, blockID3, defaultEvidenceTime), true}, + {vote1, makeVote(t, val, chainID, 0, 10, 2, 1, blockID4, defaultEvidenceTime), true}, + {vote1, makeVote(t, val, chainID, 0, 10, 2, 1, blockID, defaultEvidenceTime), false}, // wrong block id + {vote1, makeVote(t, val, "mychain2", 0, 10, 2, 1, blockID2, defaultEvidenceTime), false}, // wrong chain id + {vote1, makeVote(t, val, chainID, 0, 11, 2, 1, blockID2, defaultEvidenceTime), false}, // wrong height + {vote1, makeVote(t, val, chainID, 0, 10, 3, 1, blockID2, defaultEvidenceTime), false}, // wrong round + {vote1, makeVote(t, val, chainID, 0, 10, 2, 2, blockID2, defaultEvidenceTime), false}, // wrong step + {vote1, makeVote(t, val2, chainID, 0, 10, 2, 1, blockID2, defaultEvidenceTime), false}, // wrong validator // a different vote time doesn't matter - {vote1, makeVote(t, val, chainID, 0, 10, 2, 1, blockID2, psh2, time.Date(2020, 1, 1, 0, 0, 0, 0, time.UTC)), true}, + {vote1, makeVote(t, val, chainID, 0, 10, 2, 1, blockID2, time.Date(2020, 1, 1, 0, 0, 0, 0, time.UTC)), true}, {vote1, badVote, false}, // signed by wrong key } @@ -412,7 +388,7 @@ func TestVerifyDuplicateVoteEvidence(t *testing.T) { func makeVote( t *testing.T, val types.PrivValidator, chainID string, valIndex int32, height int64, - round int32, step int, blockID types.BlockID, psh types.PartSetHeader, time time.Time) *types.Vote { + round int32, step int, blockID types.BlockID, time time.Time) *types.Vote { pubKey, err := val.GetPubKey() require.NoError(t, err) v := &types.Vote{ @@ -422,7 +398,6 @@ func makeVote( Round: round, Type: tmproto.SignedMsgType(step), BlockID: blockID, - PartSetHeader: psh, Timestamp: time, } @@ -441,8 +416,7 @@ func makeHeaderRandom(height int64) *types.Header { ChainID: evidenceChainID, Height: height, Time: defaultEvidenceTime, - LastBlockID: makeBlockID([]byte("headerhash")), - LastPartSetHeader: makePartSetHeader(1000, []byte("partshash")), + LastBlockID: makeBlockID([]byte("headerhash"), 1000, []byte("partshash")), LastCommitHash: crypto.CRandBytes(tmhash.Size), DataHash: crypto.CRandBytes(tmhash.Size), ValidatorsHash: crypto.CRandBytes(tmhash.Size), @@ -455,24 +429,18 @@ func makeHeaderRandom(height int64) *types.Header { } } -func makeBlockID(hash []byte) types.BlockID { +func makeBlockID(hash []byte, partSetSize uint32, partSetHash []byte) types.BlockID { var ( - h = make([]byte, tmhash.Size) + h = make([]byte, tmhash.Size) + psH = make([]byte, tmhash.Size) ) copy(h, hash) + copy(psH, partSetHash) return types.BlockID{ Hash: h, + PartSetHeader: types.PartSetHeader{ + Total: partSetSize, + Hash: psH, + }, } } - -func makePartSetHeader(partSetSize uint32, partSetHash []byte) types.PartSetHeader { - var ( - psH = make([]byte, tmhash.Size) - ) - copy(psH, partSetHash) - return types.PartSetHeader{ - Total: partSetSize, - Hash: psH, - } - -} diff --git a/light/client.go b/light/client.go index 03b684788b..da9d62943c 100644 --- a/light/client.go +++ b/light/client.go @@ -374,7 +374,7 @@ func (c *Client) initializeWithTrustOptions(ctx context.Context, options TrustOp } // 2) Ensure that +2/3 of validators signed correctly. - err = l.ValidatorSet.VerifyCommitLight(c.chainID, l.Commit.BlockID, l.Commit.PartSetHeader, l.Height, l.Commit) + err = l.ValidatorSet.VerifyCommitLight(c.chainID, l.Commit.BlockID, l.Height, l.Commit) if err != nil { return fmt.Errorf("invalid commit: %w", err) } diff --git a/light/helpers_test.go b/light/helpers_test.go index 4e90b5c807..7a7eeb170e 100644 --- a/light/helpers_test.go +++ b/light/helpers_test.go @@ -80,22 +80,21 @@ func (pkz privKeys) signHeader(header *types.Header, valSet *types.ValidatorSet, } blockID := types.BlockID{ - Hash: header.Hash(), + Hash: header.Hash(), + PartSetHeader: types.PartSetHeader{Total: 1, Hash: crypto.CRandBytes(32)}, } - psh := types.PartSetHeader{Total: 1, Hash: crypto.CRandBytes(32)} - // Fill in the votes we want. for i := first; i < last && i < len(pkz); i++ { - vote := makeVote(header, valSet, pkz[i], blockID, psh) + vote := makeVote(header, valSet, pkz[i], blockID) commitSigs[vote.ValidatorIndex] = vote.CommitSig() } - return types.NewCommit(header.Height, 1, blockID, commitSigs, psh) + return types.NewCommit(header.Height, 1, blockID, commitSigs) } func makeVote(header *types.Header, valset *types.ValidatorSet, - key crypto.PrivKey, blockID types.BlockID, psh types.PartSetHeader) *types.Vote { + key crypto.PrivKey, blockID types.BlockID) *types.Vote { addr := key.PubKey().Address() idx, _ := valset.GetByAddress(addr) @@ -107,7 +106,6 @@ func makeVote(header *types.Header, valset *types.ValidatorSet, Timestamp: tmtime.Now(), Type: tmproto.PrecommitType, BlockID: blockID, - PartSetHeader: psh, } v := vote.ToProto() diff --git a/light/verifier.go b/light/verifier.go index af80a7c7fe..fa37f1e936 100644 --- a/light/verifier.go +++ b/light/verifier.go @@ -79,7 +79,7 @@ func VerifyNonAdjacent( // intentionally made very large to DOS the light client. not the case for // VerifyAdjacent, where validator set is known in advance. if err := untrustedVals.VerifyCommitLight(trustedHeader.ChainID, untrustedHeader.Commit.BlockID, - untrustedHeader.Commit.PartSetHeader, untrustedHeader.Height, untrustedHeader.Commit); err != nil { + untrustedHeader.Height, untrustedHeader.Commit); err != nil { return ErrInvalidHeader{err} } @@ -139,7 +139,7 @@ func VerifyAdjacent( // Ensure that +2/3 of new validators signed correctly. if err := untrustedVals.VerifyCommitLight(trustedHeader.ChainID, untrustedHeader.Commit.BlockID, - untrustedHeader.Commit.PartSetHeader, untrustedHeader.Height, untrustedHeader.Commit); err != nil { + untrustedHeader.Height, untrustedHeader.Commit); err != nil { return ErrInvalidHeader{err} } diff --git a/node/node_test.go b/node/node_test.go index 568e85bd6a..59de04dac2 100644 --- a/node/node_test.go +++ b/node/node_test.go @@ -320,7 +320,7 @@ func TestCreateProposalBlock(t *testing.T) { evidencePool, ) - commit := types.NewCommit(height-1, 0, types.BlockID{}, nil, types.PartSetHeader{}) + commit := types.NewCommit(height-1, 0, types.BlockID{}, nil) block, _ := blockExec.CreateProposalBlock( height, state, commit, @@ -389,7 +389,7 @@ func TestMaxTxsProposalBlockSize(t *testing.T) { sm.EmptyEvidencePool{}, ) - commit := types.NewCommit(height-1, 0, types.BlockID{}, nil, types.PartSetHeader{}) + commit := types.NewCommit(height-1, 0, types.BlockID{}, nil) block, _ := blockExec.CreateProposalBlock( height, state, commit, @@ -458,16 +458,15 @@ func TestMaxProposalBlockSize(t *testing.T) { blockID := types.BlockID{ Hash: tmhash.Sum([]byte("blockID_hash")), - } - psh := types.PartSetHeader{ - Total: math.MaxInt32, - Hash: tmhash.Sum([]byte("blockID_part_set_header_hash")), + PartSetHeader: types.PartSetHeader{ + Total: math.MaxInt32, + Hash: tmhash.Sum([]byte("blockID_part_set_header_hash")), + }, } timestamp := time.Date(math.MaxInt64, 0, 0, 0, 0, 0, math.MaxInt64, time.UTC) // change state in order to produce the largest accepted header state.LastBlockID = blockID - state.LastPartSetHeader = psh state.LastBlockHeight = math.MaxInt64 - 1 state.LastBlockTime = timestamp state.LastResultsHash = tmhash.Sum([]byte("last_results_hash")) @@ -488,10 +487,9 @@ func TestMaxProposalBlockSize(t *testing.T) { } commit := &types.Commit{ - Height: math.MaxInt64, - Round: math.MaxInt32, - BlockID: blockID, - PartSetHeader: psh, + Height: math.MaxInt64, + Round: math.MaxInt32, + BlockID: blockID, } // add maximum amount of signatures to a single commit diff --git a/p2p/ipld/write_test.go b/p2p/ipld/write_test.go index 7fdcfc5a88..111c6764eb 100644 --- a/p2p/ipld/write_test.go +++ b/p2p/ipld/write_test.go @@ -137,11 +137,10 @@ func TestDataAvailabilityHeaderRewriteBug(t *testing.T) { messages := types.MessagesFromProto(pbmessages) lastID := makeBlockIDRandom() - lastPSH := makePartSetHeaderRandom() h := int64(3) voteSet, _, vals := randVoteSet(h-1, 1, tmproto.PrecommitType, 10, 1) - commit, err := types.MakeCommit(lastID, lastPSH, h-1, 1, voteSet, vals, time.Now()) + commit, err := types.MakeCommit(lastID, h-1, 1, voteSet, vals, time.Now()) assert.NoError(t, err) block := types.MakeBlock(1, processedTxs, nil, nil, messages, commit) block.Hash() @@ -179,15 +178,10 @@ func makeBlockIDRandom() types.BlockID { mrand.Read(partSetHash) return types.BlockID{ Hash: blockHash, - } -} - -func makePartSetHeaderRandom() types.PartSetHeader { - partSetHash := make([]byte, tmhash.Size) - mrand.Read(partSetHash) - return types.PartSetHeader{ - Total: 123, - Hash: partSetHash, + PartSetHeader: types.PartSetHeader{ + Total: 123, + Hash: partSetHash, + }, } } diff --git a/privval/file_test.go b/privval/file_test.go index 2f423cb79d..3e5be7f94c 100644 --- a/privval/file_test.go +++ b/privval/file_test.go @@ -58,8 +58,8 @@ func TestResetValidator(t *testing.T) { height, round := int64(10), int32(1) voteType := tmproto.PrevoteType randBytes := tmrand.Bytes(tmhash.Size) - blockID := types.BlockID{Hash: randBytes} - vote := newVote(privVal.Key.Address, 0, height, round, voteType, blockID, types.PartSetHeader{}) + blockID := types.BlockID{Hash: randBytes, PartSetHeader: types.PartSetHeader{}} + vote := newVote(privVal.Key.Address, 0, height, round, voteType, blockID) err = privVal.SignVote("mychainid", vote.ToProto()) assert.NoError(t, err, "expected no error signing vote") @@ -174,16 +174,16 @@ func TestSignVote(t *testing.T) { randbytes := tmrand.Bytes(tmhash.Size) randbytes2 := tmrand.Bytes(tmhash.Size) - block1 := types.BlockID{Hash: randbytes} - psh1 := types.PartSetHeader{Total: 5, Hash: randbytes} - block2 := types.BlockID{Hash: randbytes2} - psh2 := types.PartSetHeader{Total: 10, Hash: randbytes2} + block1 := types.BlockID{Hash: randbytes, + PartSetHeader: types.PartSetHeader{Total: 5, Hash: randbytes}} + block2 := types.BlockID{Hash: randbytes2, + PartSetHeader: types.PartSetHeader{Total: 10, Hash: randbytes2}} height, round := int64(10), int32(1) voteType := tmproto.PrevoteType // sign a vote for first time - vote := newVote(privVal.Key.Address, 0, height, round, voteType, block1, psh1) + vote := newVote(privVal.Key.Address, 0, height, round, voteType, block1) v := vote.ToProto() err = privVal.SignVote("mychainid", v) assert.NoError(err, "expected no error signing vote") @@ -194,10 +194,10 @@ func TestSignVote(t *testing.T) { // now try some bad votes cases := []*types.Vote{ - newVote(privVal.Key.Address, 0, height, round-1, voteType, block1, psh1), // round regression - newVote(privVal.Key.Address, 0, height-1, round, voteType, block1, psh1), // height regression - newVote(privVal.Key.Address, 0, height-2, round+4, voteType, block1, psh1), // height regression and different round - newVote(privVal.Key.Address, 0, height, round, voteType, block2, psh2), // different block + newVote(privVal.Key.Address, 0, height, round-1, voteType, block1), // round regression + newVote(privVal.Key.Address, 0, height-1, round, voteType, block1), // height regression + newVote(privVal.Key.Address, 0, height-2, round+4, voteType, block1), // height regression and different round + newVote(privVal.Key.Address, 0, height, round, voteType, block2), // different block } for _, c := range cases { @@ -228,14 +228,14 @@ func TestSignProposal(t *testing.T) { randbytes := tmrand.Bytes(tmhash.Size) randbytes2 := tmrand.Bytes(tmhash.Size) - block1 := types.BlockID{Hash: randbytes} - psh1 := types.PartSetHeader{Total: 5, Hash: randbytes} - block2 := types.BlockID{Hash: randbytes2} - psh2 := types.PartSetHeader{Total: 10, Hash: randbytes2} + block1 := types.BlockID{Hash: randbytes, + PartSetHeader: types.PartSetHeader{Total: 5, Hash: randbytes}} + block2 := types.BlockID{Hash: randbytes2, + PartSetHeader: types.PartSetHeader{Total: 10, Hash: randbytes2}} height, round := int64(10), int32(1) // sign a proposal for first time - proposal := newProposal(height, round, block1, psh1) + proposal := newProposal(height, round, block1) pbp, err := proposal.ToProto() require.NoError(t, err) err = privVal.SignProposal("mychainid", pbp) @@ -247,10 +247,10 @@ func TestSignProposal(t *testing.T) { // now try some bad Proposals cases := []*types.Proposal{ - newProposal(height, round-1, block1, psh1), // round regression - newProposal(height-1, round, block1, psh1), // height regression - newProposal(height-2, round+4, block1, psh1), // height regression and different round - newProposal(height, round, block2, psh2), // different block + newProposal(height, round-1, block1), // round regression + newProposal(height-1, round, block1), // height regression + newProposal(height-2, round+4, block1), // height regression and different round + newProposal(height, round, block2), // different block } for _, c := range cases { @@ -277,14 +277,13 @@ func TestDifferByTimestamp(t *testing.T) { privVal, err := GenFilePV(tempKeyFile.Name(), tempStateFile.Name(), "") require.NoError(t, err) randbytes := tmrand.Bytes(tmhash.Size) - block1 := types.BlockID{Hash: randbytes} - psh1 := types.PartSetHeader{Total: 5, Hash: randbytes} + block1 := types.BlockID{Hash: randbytes, PartSetHeader: types.PartSetHeader{Total: 5, Hash: randbytes}} height, round := int64(10), int32(1) chainID := "mychainid" // test proposal { - proposal := newProposal(height, round, block1, psh1) + proposal := newProposal(height, round, block1) pb, err := proposal.ToProto() require.NoError(t, err) err = privVal.SignProposal(chainID, pb) @@ -309,8 +308,8 @@ func TestDifferByTimestamp(t *testing.T) { // test vote { voteType := tmproto.PrevoteType - blockID := types.BlockID{Hash: randbytes} - vote := newVote(privVal.Key.Address, 0, height, round, voteType, blockID, types.PartSetHeader{}) + blockID := types.BlockID{Hash: randbytes, PartSetHeader: types.PartSetHeader{}} + vote := newVote(privVal.Key.Address, 0, height, round, voteType, blockID) v := vote.ToProto() err := privVal.SignVote("mychainid", v) assert.NoError(t, err, "expected no error signing vote") @@ -333,7 +332,7 @@ func TestDifferByTimestamp(t *testing.T) { } func newVote(addr types.Address, idx int32, height int64, round int32, - typ tmproto.SignedMsgType, blockID types.BlockID, psh types.PartSetHeader) *types.Vote { + typ tmproto.SignedMsgType, blockID types.BlockID) *types.Vote { return &types.Vote{ ValidatorAddress: addr, ValidatorIndex: idx, @@ -342,17 +341,15 @@ func newVote(addr types.Address, idx int32, height int64, round int32, Type: typ, Timestamp: tmtime.Now(), BlockID: blockID, - PartSetHeader: psh, } } -func newProposal(height int64, round int32, blockID types.BlockID, psh types.PartSetHeader) *types.Proposal { +func newProposal(height int64, round int32, blockID types.BlockID) *types.Proposal { return &types.Proposal{ - Height: height, - Round: round, - BlockID: blockID, - Timestamp: tmtime.Now(), - DAHeader: &types.DataAvailabilityHeader{}, - PartSetHeader: psh, + Height: height, + Round: round, + BlockID: blockID, + Timestamp: tmtime.Now(), + DAHeader: &types.DataAvailabilityHeader{}, } } diff --git a/privval/msgs_test.go b/privval/msgs_test.go index 47fad0fdf4..cd16ed9e6b 100644 --- a/privval/msgs_test.go +++ b/privval/msgs_test.go @@ -28,10 +28,10 @@ func exampleVote() *types.Vote { Timestamp: stamp, BlockID: types.BlockID{ Hash: tmhash.Sum([]byte("blockID_hash")), - }, - PartSetHeader: types.PartSetHeader{ - Total: 1000000, - Hash: tmhash.Sum([]byte("blockID_part_set_header_hash")), + PartSetHeader: types.PartSetHeader{ + Total: 1000000, + Hash: tmhash.Sum([]byte("blockID_part_set_header_hash")), + }, }, ValidatorAddress: crypto.AddressHash([]byte("validator_address")), ValidatorIndex: 56789, @@ -49,10 +49,10 @@ func exampleProposal() *types.Proposal { Signature: []byte("it's a signature"), BlockID: types.BlockID{ Hash: tmhash.Sum([]byte("blockID_hash")), - }, - PartSetHeader: types.PartSetHeader{ - Total: 1000000, - Hash: tmhash.Sum([]byte("blockID_part_set_header_hash")), + PartSetHeader: types.PartSetHeader{ + Total: 1000000, + Hash: tmhash.Sum([]byte("blockID_part_set_header_hash")), + }, }, DAHeader: &types.DataAvailabilityHeader{}, } @@ -86,12 +86,12 @@ func TestPrivvalVectors(t *testing.T) { {"pubKey request", &privproto.PubKeyRequest{}, "0a00"}, {"pubKey response", &privproto.PubKeyResponse{PubKey: ppk, Error: nil}, "12240a220a20556a436f1218d30942efe798420f51dc9b6a311b929c578257457d05c5fcf230"}, {"pubKey response with error", &privproto.PubKeyResponse{PubKey: cryptoproto.PublicKey{}, Error: remoteError}, "12140a0012100801120c697427732061206572726f72"}, - {"Vote Request", &privproto.SignVoteRequest{Vote: votepb}, "1a760a7408011003180222220a208b01023386c371778ecb6368573e539afc3cc860ec3a2f614e54fe5652f4fc802a0608f49a8ded0532146af1f4111082efb388211bc72c55bcd61e9ac3d538d5bb034a2608c0843d122072db3d959635dff1bb567bedaa70573392c5159666a3f8caf11e413aac52207a"}, - {"Vote Response", &privproto.SignedVoteResponse{Vote: *votepb, Error: nil}, "22760a7408011003180222220a208b01023386c371778ecb6368573e539afc3cc860ec3a2f614e54fe5652f4fc802a0608f49a8ded0532146af1f4111082efb388211bc72c55bcd61e9ac3d538d5bb034a2608c0843d122072db3d959635dff1bb567bedaa70573392c5159666a3f8caf11e413aac52207a"}, - {"Vote Response with error", &privproto.SignedVoteResponse{Vote: tmproto.Vote{}, Error: remoteError}, "22230a0f22002a0b088092b8c398feffffff0112100801120c697427732061206572726f72"}, - {"Proposal Request", &privproto.SignProposalRequest{Proposal: proposalpb}, "2a720a7008011003180220022a220a208b01023386c371778ecb6368573e539afc3cc860ec3a2f614e54fe5652f4fc80320608f49a8ded053a10697427732061207369676e617475726542004a2608c0843d122072db3d959635dff1bb567bedaa70573392c5159666a3f8caf11e413aac52207a"}, - {"Proposal Response", &privproto.SignedProposalResponse{Proposal: *proposalpb, Error: nil}, "32720a7008011003180220022a220a208b01023386c371778ecb6368573e539afc3cc860ec3a2f614e54fe5652f4fc80320608f49a8ded053a10697427732061207369676e617475726542004a2608c0843d122072db3d959635dff1bb567bedaa70573392c5159666a3f8caf11e413aac52207a"}, - {"Proposal Response with error", &privproto.SignedProposalResponse{Proposal: tmproto.Proposal{}, Error: remoteError}, "32230a0f2a00320b088092b8c398feffffff0112100801120c697427732061206572726f72"}, + {"Vote Request", &privproto.SignVoteRequest{Vote: votepb}, "1a760a74080110031802224a0a208b01023386c371778ecb6368573e539afc3cc860ec3a2f614e54fe5652f4fc80122608c0843d122072db3d959635dff1bb567bedaa70573392c5159666a3f8caf11e413aac52207a2a0608f49a8ded0532146af1f4111082efb388211bc72c55bcd61e9ac3d538d5bb03"}, + {"Vote Response", &privproto.SignedVoteResponse{Vote: *votepb, Error: nil}, "22760a74080110031802224a0a208b01023386c371778ecb6368573e539afc3cc860ec3a2f614e54fe5652f4fc80122608c0843d122072db3d959635dff1bb567bedaa70573392c5159666a3f8caf11e413aac52207a2a0608f49a8ded0532146af1f4111082efb388211bc72c55bcd61e9ac3d538d5bb03"}, + {"Vote Response with error", &privproto.SignedVoteResponse{Vote: tmproto.Vote{}, Error: remoteError}, "22250a11220212002a0b088092b8c398feffffff0112100801120c697427732061206572726f72"}, + {"Proposal Request", &privproto.SignProposalRequest{Proposal: proposalpb}, "2a720a7008011003180220022a4a0a208b01023386c371778ecb6368573e539afc3cc860ec3a2f614e54fe5652f4fc80122608c0843d122072db3d959635dff1bb567bedaa70573392c5159666a3f8caf11e413aac52207a320608f49a8ded053a10697427732061207369676e61747572654200"}, + {"Proposal Response", &privproto.SignedProposalResponse{Proposal: *proposalpb, Error: nil}, "32720a7008011003180220022a4a0a208b01023386c371778ecb6368573e539afc3cc860ec3a2f614e54fe5652f4fc80122608c0843d122072db3d959635dff1bb567bedaa70573392c5159666a3f8caf11e413aac52207a320608f49a8ded053a10697427732061207369676e61747572654200"}, + {"Proposal Response with error", &privproto.SignedProposalResponse{Proposal: tmproto.Proposal{}, Error: remoteError}, "32250a112a021200320b088092b8c398feffffff0112100801120c697427732061206572726f72"}, } for _, tc := range testCases { diff --git a/privval/signer_client_test.go b/privval/signer_client_test.go index 89fb8a4986..af2cad2432 100644 --- a/privval/signer_client_test.go +++ b/privval/signer_client_test.go @@ -119,24 +119,22 @@ func TestSignerProposal(t *testing.T) { ts := time.Now() hash := tmrand.Bytes(tmhash.Size) have := &types.Proposal{ - Type: tmproto.ProposalType, - Height: 1, - Round: 2, - POLRound: 2, - BlockID: types.BlockID{Hash: hash}, - PartSetHeader: types.PartSetHeader{Hash: hash, Total: 2}, - Timestamp: ts, - DAHeader: &types.DataAvailabilityHeader{}, + Type: tmproto.ProposalType, + Height: 1, + Round: 2, + POLRound: 2, + BlockID: types.BlockID{Hash: hash, PartSetHeader: types.PartSetHeader{Hash: hash, Total: 2}}, + Timestamp: ts, + DAHeader: &types.DataAvailabilityHeader{}, } want := &types.Proposal{ - Type: tmproto.ProposalType, - Height: 1, - Round: 2, - POLRound: 2, - BlockID: types.BlockID{Hash: hash}, - PartSetHeader: types.PartSetHeader{Hash: hash, Total: 2}, - Timestamp: ts, - DAHeader: &types.DataAvailabilityHeader{}, + Type: tmproto.ProposalType, + Height: 1, + Round: 2, + POLRound: 2, + BlockID: types.BlockID{Hash: hash, PartSetHeader: types.PartSetHeader{Hash: hash, Total: 2}}, + Timestamp: ts, + DAHeader: &types.DataAvailabilityHeader{}, } tc := tc @@ -174,8 +172,7 @@ func TestSignerVote(t *testing.T) { Type: tmproto.PrecommitType, Height: 1, Round: 2, - BlockID: types.BlockID{Hash: hash}, - PartSetHeader: types.PartSetHeader{Hash: hash, Total: 2}, + BlockID: types.BlockID{Hash: hash, PartSetHeader: types.PartSetHeader{Hash: hash, Total: 2}}, Timestamp: ts, ValidatorAddress: valAddr, ValidatorIndex: 1, @@ -185,8 +182,7 @@ func TestSignerVote(t *testing.T) { Type: tmproto.PrecommitType, Height: 1, Round: 2, - BlockID: types.BlockID{Hash: hash}, - PartSetHeader: types.PartSetHeader{Hash: hash, Total: 2}, + BlockID: types.BlockID{Hash: hash, PartSetHeader: types.PartSetHeader{Hash: hash, Total: 2}}, Timestamp: ts, ValidatorAddress: valAddr, ValidatorIndex: 1, @@ -220,8 +216,7 @@ func TestSignerVoteResetDeadline(t *testing.T) { Type: tmproto.PrecommitType, Height: 1, Round: 2, - BlockID: types.BlockID{Hash: hash}, - PartSetHeader: types.PartSetHeader{Hash: hash, Total: 2}, + BlockID: types.BlockID{Hash: hash, PartSetHeader: types.PartSetHeader{Hash: hash, Total: 2}}, Timestamp: ts, ValidatorAddress: valAddr, ValidatorIndex: 1, @@ -231,8 +226,7 @@ func TestSignerVoteResetDeadline(t *testing.T) { Type: tmproto.PrecommitType, Height: 1, Round: 2, - BlockID: types.BlockID{Hash: hash}, - PartSetHeader: types.PartSetHeader{Hash: hash, Total: 2}, + BlockID: types.BlockID{Hash: hash, PartSetHeader: types.PartSetHeader{Hash: hash, Total: 2}}, Timestamp: ts, ValidatorAddress: valAddr, ValidatorIndex: 1, @@ -276,8 +270,7 @@ func TestSignerVoteKeepAlive(t *testing.T) { Type: tmproto.PrecommitType, Height: 1, Round: 2, - BlockID: types.BlockID{Hash: hash}, - PartSetHeader: types.PartSetHeader{Hash: hash, Total: 2}, + BlockID: types.BlockID{Hash: hash, PartSetHeader: types.PartSetHeader{Hash: hash, Total: 2}}, Timestamp: ts, ValidatorAddress: valAddr, ValidatorIndex: 1, @@ -287,8 +280,7 @@ func TestSignerVoteKeepAlive(t *testing.T) { Type: tmproto.PrecommitType, Height: 1, Round: 2, - BlockID: types.BlockID{Hash: hash}, - PartSetHeader: types.PartSetHeader{Hash: hash, Total: 2}, + BlockID: types.BlockID{Hash: hash, PartSetHeader: types.PartSetHeader{Hash: hash, Total: 2}}, Timestamp: ts, ValidatorAddress: valAddr, ValidatorIndex: 1, @@ -343,15 +335,14 @@ func TestSignerSignProposalErrors(t *testing.T) { ts := time.Now() hash := tmrand.Bytes(tmhash.Size) proposal := &types.Proposal{ - Type: tmproto.ProposalType, - Height: 1, - Round: 2, - POLRound: 2, - BlockID: types.BlockID{Hash: hash}, - PartSetHeader: types.PartSetHeader{Hash: hash, Total: 2}, - Timestamp: ts, - Signature: []byte("signature"), - DAHeader: &types.DataAvailabilityHeader{}, + Type: tmproto.ProposalType, + Height: 1, + Round: 2, + POLRound: 2, + BlockID: types.BlockID{Hash: hash, PartSetHeader: types.PartSetHeader{Hash: hash, Total: 2}}, + Timestamp: ts, + Signature: []byte("signature"), + DAHeader: &types.DataAvailabilityHeader{}, } p, err := proposal.ToProto() @@ -380,8 +371,7 @@ func TestSignerSignVoteErrors(t *testing.T) { Type: tmproto.PrecommitType, Height: 1, Round: 2, - BlockID: types.BlockID{Hash: hash}, - PartSetHeader: types.PartSetHeader{Hash: hash, Total: 2}, + BlockID: types.BlockID{Hash: hash, PartSetHeader: types.PartSetHeader{Hash: hash, Total: 2}}, Timestamp: ts, ValidatorAddress: valAddr, ValidatorIndex: 1, diff --git a/proto/tendermint/blockchain/types.pb.go b/proto/tendermint/blockchain/types.pb.go index f0be74830f..509d485f9a 100644 --- a/proto/tendermint/blockchain/types.pb.go +++ b/proto/tendermint/blockchain/types.pb.go @@ -900,7 +900,10 @@ func (m *BlockRequest) Unmarshal(dAtA []byte) error { if err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { return ErrInvalidLengthTypes } if (iNdEx + skippy) > l { @@ -969,7 +972,10 @@ func (m *NoBlockResponse) Unmarshal(dAtA []byte) error { if err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { return ErrInvalidLengthTypes } if (iNdEx + skippy) > l { @@ -1055,7 +1061,10 @@ func (m *BlockResponse) Unmarshal(dAtA []byte) error { if err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { return ErrInvalidLengthTypes } if (iNdEx + skippy) > l { @@ -1105,7 +1114,10 @@ func (m *StatusRequest) Unmarshal(dAtA []byte) error { if err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { return ErrInvalidLengthTypes } if (iNdEx + skippy) > l { @@ -1193,7 +1205,10 @@ func (m *StatusResponse) Unmarshal(dAtA []byte) error { if err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { return ErrInvalidLengthTypes } if (iNdEx + skippy) > l { @@ -1418,7 +1433,10 @@ func (m *Message) Unmarshal(dAtA []byte) error { if err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { return ErrInvalidLengthTypes } if (iNdEx + skippy) > l { diff --git a/proto/tendermint/consensus/types.pb.go b/proto/tendermint/consensus/types.pb.go index 1bca909a81..98f0fec1e3 100644 --- a/proto/tendermint/consensus/types.pb.go +++ b/proto/tendermint/consensus/types.pb.go @@ -465,11 +465,10 @@ func (m *HasVote) GetIndex() int32 { // VoteSetMaj23 is sent to indicate that a given BlockID has seen +2/3 votes. type VoteSetMaj23 struct { - Height int64 `protobuf:"varint,1,opt,name=height,proto3" json:"height,omitempty"` - Round int32 `protobuf:"varint,2,opt,name=round,proto3" json:"round,omitempty"` - Type types.SignedMsgType `protobuf:"varint,3,opt,name=type,proto3,enum=tendermint.types.SignedMsgType" json:"type,omitempty"` - BlockID types.BlockID `protobuf:"bytes,4,opt,name=block_id,json=blockId,proto3" json:"block_id"` - PartSetHeader *types.PartSetHeader `protobuf:"bytes,5,opt,name=part_set_header,json=partSetHeader,proto3" json:"part_set_header,omitempty"` + Height int64 `protobuf:"varint,1,opt,name=height,proto3" json:"height,omitempty"` + Round int32 `protobuf:"varint,2,opt,name=round,proto3" json:"round,omitempty"` + Type types.SignedMsgType `protobuf:"varint,3,opt,name=type,proto3,enum=tendermint.types.SignedMsgType" json:"type,omitempty"` + BlockID types.BlockID `protobuf:"bytes,4,opt,name=block_id,json=blockId,proto3" json:"block_id"` } func (m *VoteSetMaj23) Reset() { *m = VoteSetMaj23{} } @@ -533,21 +532,13 @@ func (m *VoteSetMaj23) GetBlockID() types.BlockID { return types.BlockID{} } -func (m *VoteSetMaj23) GetPartSetHeader() *types.PartSetHeader { - if m != nil { - return m.PartSetHeader - } - return nil -} - // VoteSetBits is sent to communicate the bit-array of votes seen for the BlockID. type VoteSetBits struct { - Height int64 `protobuf:"varint,1,opt,name=height,proto3" json:"height,omitempty"` - Round int32 `protobuf:"varint,2,opt,name=round,proto3" json:"round,omitempty"` - Type types.SignedMsgType `protobuf:"varint,3,opt,name=type,proto3,enum=tendermint.types.SignedMsgType" json:"type,omitempty"` - BlockID types.BlockID `protobuf:"bytes,4,opt,name=block_id,json=blockId,proto3" json:"block_id"` - PartSetHeader *types.PartSetHeader `protobuf:"bytes,5,opt,name=part_set_header,json=partSetHeader,proto3" json:"part_set_header,omitempty"` - Votes bits.BitArray `protobuf:"bytes,6,opt,name=votes,proto3" json:"votes"` + Height int64 `protobuf:"varint,1,opt,name=height,proto3" json:"height,omitempty"` + Round int32 `protobuf:"varint,2,opt,name=round,proto3" json:"round,omitempty"` + Type types.SignedMsgType `protobuf:"varint,3,opt,name=type,proto3,enum=tendermint.types.SignedMsgType" json:"type,omitempty"` + BlockID types.BlockID `protobuf:"bytes,4,opt,name=block_id,json=blockId,proto3" json:"block_id"` + Votes bits.BitArray `protobuf:"bytes,5,opt,name=votes,proto3" json:"votes"` } func (m *VoteSetBits) Reset() { *m = VoteSetBits{} } @@ -611,13 +602,6 @@ func (m *VoteSetBits) GetBlockID() types.BlockID { return types.BlockID{} } -func (m *VoteSetBits) GetPartSetHeader() *types.PartSetHeader { - if m != nil { - return m.PartSetHeader - } - return nil -} - func (m *VoteSetBits) GetVotes() bits.BitArray { if m != nil { return m.Votes @@ -817,62 +801,61 @@ func init() { func init() { proto.RegisterFile("tendermint/consensus/types.proto", fileDescriptor_81a22d2efc008981) } var fileDescriptor_81a22d2efc008981 = []byte{ - // 877 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe4, 0x56, 0x4f, 0x6f, 0xdc, 0x44, - 0x14, 0xb7, 0x93, 0xdd, 0xec, 0xe6, 0x6d, 0x36, 0x81, 0x51, 0x5a, 0x99, 0x00, 0x9b, 0x60, 0x2e, - 0x11, 0x02, 0x2f, 0xda, 0x1c, 0x90, 0x2a, 0x24, 0x8a, 0xf9, 0x53, 0xb7, 0x6a, 0xda, 0xd5, 0x6c, - 0x55, 0xa1, 0x5e, 0x2c, 0xef, 0x7a, 0xe4, 0x1d, 0x6a, 0x7b, 0x2c, 0xcf, 0x24, 0x21, 0xdc, 0xe0, - 0x13, 0xf0, 0x01, 0xf8, 0x1a, 0xdc, 0xf8, 0x00, 0x3d, 0xf6, 0xc8, 0xa9, 0x42, 0xc9, 0x67, 0x80, - 0x33, 0x9a, 0xf1, 0xec, 0x7a, 0xd2, 0xba, 0x81, 0xbd, 0x70, 0xe9, 0x6d, 0xc6, 0xef, 0xbd, 0xdf, - 0xbc, 0xf7, 0x7b, 0x6f, 0x7e, 0x63, 0x38, 0x10, 0x24, 0x8f, 0x49, 0x99, 0xd1, 0x5c, 0x0c, 0x67, - 0x2c, 0xe7, 0x24, 0xe7, 0x27, 0x7c, 0x28, 0xce, 0x0b, 0xc2, 0xbd, 0xa2, 0x64, 0x82, 0xa1, 0xdd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 0x77, 0x6a, 0xba, 0xa1, 0x6c, 0x47, 0xff, - 0x04, 0x00, 0x00, 0xff, 0xff, 0x23, 0xdb, 0x51, 0xd3, 0x6d, 0x09, 0x00, 0x00, + // 863 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x56, 0x4f, 0x8f, 0xdb, 0x44, + 0x14, 0xb7, 0x59, 0x67, 0x93, 0x7d, 0xde, 0x3f, 0x30, 0xda, 0x56, 0x61, 0x81, 0x6c, 0x30, 0x97, + 0x15, 0x02, 0x07, 0x65, 0x0f, 0x48, 0x15, 0x12, 0xc5, 0xfc, 0xa9, 0x5b, 0x35, 0x6d, 0xe4, 0x54, + 0x15, 0xea, 0xc5, 0x72, 0xe2, 0x91, 0x33, 0xd4, 0xf6, 0x58, 0x9e, 0x49, 0x96, 0x70, 0xe4, 0x13, + 0xf0, 0x01, 0xf8, 0x1a, 0x48, 0x7c, 0x84, 0x1e, 0x7b, 0xe4, 0x54, 0xa1, 0xec, 0x47, 0x40, 0x70, + 0x46, 0x33, 0x9e, 0x24, 0x13, 0xea, 0x2e, 0xec, 0x05, 0xa9, 0xb7, 0x99, 0xbc, 0xf7, 0x7e, 0xf3, + 0xde, 0xef, 0xbd, 0xf7, 0x8b, 0xa1, 0xcb, 0x71, 0x1e, 0xe3, 0x32, 0x23, 0x39, 0xef, 0x4d, 0x68, + 0xce, 0x70, 0xce, 0x66, 0xac, 0xc7, 0x17, 0x05, 0x66, 0x6e, 0x51, 0x52, 0x4e, 0xd1, 0xf1, 0xc6, + 0xc3, 0x5d, 0x7b, 0x9c, 0x1c, 0x27, 0x34, 0xa1, 0xd2, 0xa1, 0x27, 0x4e, 0x95, 0xef, 0xc9, 0xbb, + 0x1a, 0x9a, 0xc4, 0xd0, 0x91, 0x4e, 0xf4, 0xb7, 0x52, 0x32, 0x66, 0xbd, 0x31, 0xe1, 0x5b, 0x1e, + 0xce, 0x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x20, 0x17, 0x7a, 0xf7, 0x65, 0x79, 0xdc, 0xc4, 0x8a, 0x29, 0xf4, + 0x8d, 0x6a, 0xad, 0xd1, 0x2d, 0x68, 0x4d, 0x23, 0x16, 0xca, 0xa8, 0xa6, 0x8c, 0x7a, 0xaf, 0x3e, + 0x4a, 0xed, 0xbe, 0x6f, 0x04, 0xcd, 0xa9, 0x92, 0x81, 0x7b, 0x70, 0x28, 0xe2, 0xe4, 0xdf, 0x49, + 0x26, 0xd6, 0xb1, 0xdd, 0xba, 0xaa, 0xa1, 0xfa, 0xe2, 0x8a, 0x86, 0xce, 0xf5, 0x45, 0xbe, 0x03, + 0x07, 0x6b, 0x2c, 0x31, 0x4f, 0xed, 0xbd, 0xab, 0x48, 0xd4, 0x16, 0x49, 0x90, 0x38, 0xdf, 0x5c, + 0xbd, 0x06, 0xec, 0xb0, 0x59, 0xe6, 0x3d, 0x79, 0xb6, 0xec, 0x98, 0xcf, 0x97, 0x1d, 0xf3, 0xf7, + 0x65, 0xc7, 0xfc, 0xe9, 0xb2, 0x63, 0x3c, 0xbf, 0xec, 0x18, 0xbf, 0x5d, 0x76, 0x8c, 0x27, 0xb7, + 0x13, 0xc2, 0xa7, 0xb3, 0xb1, 0x3b, 0xa1, 0x59, 0x2f, 0x8d, 0x7e, 0x58, 0xa4, 0x38, 0x4e, 0x70, + 0xa9, 0x1d, 0x3f, 0x9e, 0xd0, 0x12, 0xf7, 0xaa, 0x4f, 0x8f, 0xba, 0x8f, 0x97, 0xf1, 0xae, 0xb4, + 0x9d, 0xff, 0x1d, 0x00, 0x00, 0xff, 0xff, 0x08, 0xab, 0x10, 0x2c, 0xdb, 0x08, 0x00, 0x00, } func (m *NewRoundStep) Marshal() (dAtA []byte, err error) { @@ -1205,18 +1188,6 @@ func (m *VoteSetMaj23) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if m.PartSetHeader != nil { - { - size, err := m.PartSetHeader.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTypes(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x2a - } { size, err := m.BlockID.MarshalToSizedBuffer(dAtA[:i]) if err != nil { @@ -1274,19 +1245,7 @@ func (m *VoteSetBits) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintTypes(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x32 - if m.PartSetHeader != nil { - { - size, err := m.PartSetHeader.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTypes(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x2a - } + dAtA[i] = 0x2a { size, err := m.BlockID.MarshalToSizedBuffer(dAtA[:i]) if err != nil { @@ -1691,10 +1650,6 @@ func (m *VoteSetMaj23) Size() (n int) { } l = m.BlockID.Size() n += 1 + l + sovTypes(uint64(l)) - if m.PartSetHeader != nil { - l = m.PartSetHeader.Size() - n += 1 + l + sovTypes(uint64(l)) - } return n } @@ -1715,10 +1670,6 @@ func (m *VoteSetBits) Size() (n int) { } l = m.BlockID.Size() n += 1 + l + sovTypes(uint64(l)) - if m.PartSetHeader != nil { - l = m.PartSetHeader.Size() - n += 1 + l + sovTypes(uint64(l)) - } l = m.Votes.Size() n += 1 + l + sovTypes(uint64(l)) return n @@ -1981,7 +1932,10 @@ func (m *NewRoundStep) Unmarshal(dAtA []byte) error { if err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { return ErrInvalidLengthTypes } if (iNdEx + skippy) > l { @@ -2158,7 +2112,10 @@ func (m *NewValidBlock) Unmarshal(dAtA []byte) error { if err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { return ErrInvalidLengthTypes } if (iNdEx + skippy) > l { @@ -2241,7 +2198,10 @@ func (m *Proposal) Unmarshal(dAtA []byte) error { if err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { return ErrInvalidLengthTypes } if (iNdEx + skippy) > l { @@ -2362,7 +2322,10 @@ func (m *ProposalPOL) Unmarshal(dAtA []byte) error { if err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { return ErrInvalidLengthTypes } if (iNdEx + skippy) > l { @@ -2483,7 +2446,10 @@ func (m *BlockPart) Unmarshal(dAtA []byte) error { if err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { return ErrInvalidLengthTypes } if (iNdEx + skippy) > l { @@ -2569,7 +2535,10 @@ func (m *Vote) Unmarshal(dAtA []byte) error { if err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { return ErrInvalidLengthTypes } if (iNdEx + skippy) > l { @@ -2695,7 +2664,10 @@ func (m *HasVote) Unmarshal(dAtA []byte) error { if err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { return ErrInvalidLengthTypes } if (iNdEx + skippy) > l { @@ -2829,49 +2801,16 @@ func (m *VoteSetMaj23) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field PartSetHeader", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.PartSetHeader == nil { - m.PartSetHeader = &types.PartSetHeader{} - } - if err := m.PartSetHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipTypes(dAtA[iNdEx:]) if err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { return ErrInvalidLengthTypes } if (iNdEx + skippy) > l { @@ -3006,42 +2945,6 @@ func (m *VoteSetBits) Unmarshal(dAtA []byte) error { } iNdEx = postIndex case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field PartSetHeader", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.PartSetHeader == nil { - m.PartSetHeader = &types.PartSetHeader{} - } - if err := m.PartSetHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 6: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Votes", wireType) } @@ -3080,7 +2983,10 @@ func (m *VoteSetBits) Unmarshal(dAtA []byte) error { if err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { return ErrInvalidLengthTypes } if (iNdEx + skippy) > l { @@ -3445,7 +3351,10 @@ func (m *Message) Unmarshal(dAtA []byte) error { if err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { return ErrInvalidLengthTypes } if (iNdEx + skippy) > l { diff --git a/proto/tendermint/consensus/types.proto b/proto/tendermint/consensus/types.proto index f84e69a676..4e76167c2e 100644 --- a/proto/tendermint/consensus/types.proto +++ b/proto/tendermint/consensus/types.proto @@ -66,7 +66,6 @@ message VoteSetMaj23 { int32 round = 2; tendermint.types.SignedMsgType type = 3; tendermint.types.BlockID block_id = 4 [(gogoproto.customname) = "BlockID", (gogoproto.nullable) = false]; - tendermint.types.PartSetHeader part_set_header = 5; } // VoteSetBits is sent to communicate the bit-array of votes seen for the BlockID. @@ -75,8 +74,7 @@ message VoteSetBits { int32 round = 2; tendermint.types.SignedMsgType type = 3; tendermint.types.BlockID block_id = 4 [(gogoproto.customname) = "BlockID", (gogoproto.nullable) = false]; - tendermint.types.PartSetHeader part_set_header = 5; - tendermint.libs.bits.BitArray votes = 6 [(gogoproto.nullable) = false]; + tendermint.libs.bits.BitArray votes = 5 [(gogoproto.nullable) = false]; } message Message { diff --git a/proto/tendermint/consensus/wal.pb.go b/proto/tendermint/consensus/wal.pb.go index a4bd5be5f6..82351812b3 100644 --- a/proto/tendermint/consensus/wal.pb.go +++ b/proto/tendermint/consensus/wal.pb.go @@ -922,7 +922,10 @@ func (m *MsgInfo) Unmarshal(dAtA []byte) error { if err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { + if skippy < 0 { + return ErrInvalidLengthWal + } + if (iNdEx + skippy) < 0 { return ErrInvalidLengthWal } if (iNdEx + skippy) > l { @@ -1062,7 +1065,10 @@ func (m *TimeoutInfo) Unmarshal(dAtA []byte) error { if err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { + if skippy < 0 { + return ErrInvalidLengthWal + } + if (iNdEx + skippy) < 0 { return ErrInvalidLengthWal } if (iNdEx + skippy) > l { @@ -1131,7 +1137,10 @@ func (m *EndHeight) Unmarshal(dAtA []byte) error { if err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { + if skippy < 0 { + return ErrInvalidLengthWal + } + if (iNdEx + skippy) < 0 { return ErrInvalidLengthWal } if (iNdEx + skippy) > l { @@ -1321,7 +1330,10 @@ func (m *WALMessage) Unmarshal(dAtA []byte) error { if err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { + if skippy < 0 { + return ErrInvalidLengthWal + } + if (iNdEx + skippy) < 0 { return ErrInvalidLengthWal } if (iNdEx + skippy) > l { @@ -1440,7 +1452,10 @@ func (m *TimedWALMessage) Unmarshal(dAtA []byte) error { if err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { + if skippy < 0 { + return ErrInvalidLengthWal + } + if (iNdEx + skippy) < 0 { return ErrInvalidLengthWal } if (iNdEx + skippy) > l { diff --git a/proto/tendermint/crypto/keys.pb.go b/proto/tendermint/crypto/keys.pb.go index 8444b190cd..dc740626e4 100644 --- a/proto/tendermint/crypto/keys.pb.go +++ b/proto/tendermint/crypto/keys.pb.go @@ -555,7 +555,10 @@ func (m *PublicKey) Unmarshal(dAtA []byte) error { if err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { + if skippy < 0 { + return ErrInvalidLengthKeys + } + if (iNdEx + skippy) < 0 { return ErrInvalidLengthKeys } if (iNdEx + skippy) > l { diff --git a/proto/tendermint/crypto/proof.pb.go b/proto/tendermint/crypto/proof.pb.go index 93d638f15c..f959c51acb 100644 --- a/proto/tendermint/crypto/proof.pb.go +++ b/proto/tendermint/crypto/proof.pb.go @@ -821,7 +821,10 @@ func (m *Proof) Unmarshal(dAtA []byte) error { if err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { + if skippy < 0 { + return ErrInvalidLengthProof + } + if (iNdEx + skippy) < 0 { return ErrInvalidLengthProof } if (iNdEx + skippy) > l { @@ -941,7 +944,10 @@ func (m *ValueOp) Unmarshal(dAtA []byte) error { if err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { + if skippy < 0 { + return ErrInvalidLengthProof + } + if (iNdEx + skippy) < 0 { return ErrInvalidLengthProof } if (iNdEx + skippy) > l { @@ -1087,7 +1093,10 @@ func (m *DominoOp) Unmarshal(dAtA []byte) error { if err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { + if skippy < 0 { + return ErrInvalidLengthProof + } + if (iNdEx + skippy) < 0 { return ErrInvalidLengthProof } if (iNdEx + skippy) > l { @@ -1237,7 +1246,10 @@ func (m *ProofOp) Unmarshal(dAtA []byte) error { if err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { + if skippy < 0 { + return ErrInvalidLengthProof + } + if (iNdEx + skippy) < 0 { return ErrInvalidLengthProof } if (iNdEx + skippy) > l { @@ -1321,7 +1333,10 @@ func (m *ProofOps) Unmarshal(dAtA []byte) error { if err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { + if skippy < 0 { + return ErrInvalidLengthProof + } + if (iNdEx + skippy) < 0 { return ErrInvalidLengthProof } if (iNdEx + skippy) > l { diff --git a/proto/tendermint/libs/bits/types.pb.go b/proto/tendermint/libs/bits/types.pb.go index 595c89b8d2..16b152b6e7 100644 --- a/proto/tendermint/libs/bits/types.pb.go +++ b/proto/tendermint/libs/bits/types.pb.go @@ -308,7 +308,10 @@ func (m *BitArray) Unmarshal(dAtA []byte) error { if err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { return ErrInvalidLengthTypes } if (iNdEx + skippy) > l { diff --git a/proto/tendermint/mempool/types.pb.go b/proto/tendermint/mempool/types.pb.go index 1e1a3cfbd3..0e8245aefd 100644 --- a/proto/tendermint/mempool/types.pb.go +++ b/proto/tendermint/mempool/types.pb.go @@ -371,7 +371,10 @@ func (m *Txs) Unmarshal(dAtA []byte) error { if err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { return ErrInvalidLengthTypes } if (iNdEx + skippy) > l { @@ -456,7 +459,10 @@ func (m *Message) Unmarshal(dAtA []byte) error { if err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { return ErrInvalidLengthTypes } if (iNdEx + skippy) > l { diff --git a/proto/tendermint/p2p/conn.pb.go b/proto/tendermint/p2p/conn.pb.go index 6997795932..5a580208ac 100644 --- a/proto/tendermint/p2p/conn.pb.go +++ b/proto/tendermint/p2p/conn.pb.go @@ -724,7 +724,10 @@ func (m *PacketPing) Unmarshal(dAtA []byte) error { if err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { + if skippy < 0 { + return ErrInvalidLengthConn + } + if (iNdEx + skippy) < 0 { return ErrInvalidLengthConn } if (iNdEx + skippy) > l { @@ -774,7 +777,10 @@ func (m *PacketPong) Unmarshal(dAtA []byte) error { if err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { + if skippy < 0 { + return ErrInvalidLengthConn + } + if (iNdEx + skippy) < 0 { return ErrInvalidLengthConn } if (iNdEx + skippy) > l { @@ -897,7 +903,10 @@ func (m *PacketMsg) Unmarshal(dAtA []byte) error { if err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { + if skippy < 0 { + return ErrInvalidLengthConn + } + if (iNdEx + skippy) < 0 { return ErrInvalidLengthConn } if (iNdEx + skippy) > l { @@ -1052,7 +1061,10 @@ func (m *Packet) Unmarshal(dAtA []byte) error { if err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { + if skippy < 0 { + return ErrInvalidLengthConn + } + if (iNdEx + skippy) < 0 { return ErrInvalidLengthConn } if (iNdEx + skippy) > l { @@ -1169,7 +1181,10 @@ func (m *AuthSigMessage) Unmarshal(dAtA []byte) error { if err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { + if skippy < 0 { + return ErrInvalidLengthConn + } + if (iNdEx + skippy) < 0 { return ErrInvalidLengthConn } if (iNdEx + skippy) > l { diff --git a/proto/tendermint/p2p/pex.pb.go b/proto/tendermint/p2p/pex.pb.go index bc0f6e907d..5bd894776b 100644 --- a/proto/tendermint/p2p/pex.pb.go +++ b/proto/tendermint/p2p/pex.pb.go @@ -465,7 +465,10 @@ func (m *PexRequest) Unmarshal(dAtA []byte) error { if err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { + if skippy < 0 { + return ErrInvalidLengthPex + } + if (iNdEx + skippy) < 0 { return ErrInvalidLengthPex } if (iNdEx + skippy) > l { @@ -549,7 +552,10 @@ func (m *PexAddrs) Unmarshal(dAtA []byte) error { if err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { + if skippy < 0 { + return ErrInvalidLengthPex + } + if (iNdEx + skippy) < 0 { return ErrInvalidLengthPex } if (iNdEx + skippy) > l { @@ -669,7 +675,10 @@ func (m *Message) Unmarshal(dAtA []byte) error { if err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { + if skippy < 0 { + return ErrInvalidLengthPex + } + if (iNdEx + skippy) < 0 { return ErrInvalidLengthPex } if (iNdEx + skippy) > l { diff --git a/proto/tendermint/p2p/types.pb.go b/proto/tendermint/p2p/types.pb.go index ab8b05f486..c43f9dc1bd 100644 --- a/proto/tendermint/p2p/types.pb.go +++ b/proto/tendermint/p2p/types.pb.go @@ -768,7 +768,10 @@ func (m *NetAddress) Unmarshal(dAtA []byte) error { if err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { return ErrInvalidLengthTypes } if (iNdEx + skippy) > l { @@ -875,7 +878,10 @@ func (m *ProtocolVersion) Unmarshal(dAtA []byte) error { if err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { return ErrInvalidLengthTypes } if (iNdEx + skippy) > l { @@ -1185,7 +1191,10 @@ func (m *DefaultNodeInfo) Unmarshal(dAtA []byte) error { if err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { return ErrInvalidLengthTypes } if (iNdEx + skippy) > l { @@ -1299,7 +1308,10 @@ func (m *DefaultNodeInfoOther) Unmarshal(dAtA []byte) error { if err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { return ErrInvalidLengthTypes } if (iNdEx + skippy) > l { diff --git a/proto/tendermint/privval/types.pb.go b/proto/tendermint/privval/types.pb.go index 7bf57463c8..1129d19261 100644 --- a/proto/tendermint/privval/types.pb.go +++ b/proto/tendermint/privval/types.pb.go @@ -1709,7 +1709,10 @@ func (m *RemoteSignerError) Unmarshal(dAtA []byte) error { if err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { return ErrInvalidLengthTypes } if (iNdEx + skippy) > l { @@ -1791,7 +1794,10 @@ func (m *PubKeyRequest) Unmarshal(dAtA []byte) error { if err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { return ErrInvalidLengthTypes } if (iNdEx + skippy) > l { @@ -1910,7 +1916,10 @@ func (m *PubKeyResponse) Unmarshal(dAtA []byte) error { if err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { return ErrInvalidLengthTypes } if (iNdEx + skippy) > l { @@ -2028,7 +2037,10 @@ func (m *SignVoteRequest) Unmarshal(dAtA []byte) error { if err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { return ErrInvalidLengthTypes } if (iNdEx + skippy) > l { @@ -2147,7 +2159,10 @@ func (m *SignedVoteResponse) Unmarshal(dAtA []byte) error { if err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { return ErrInvalidLengthTypes } if (iNdEx + skippy) > l { @@ -2265,7 +2280,10 @@ func (m *SignProposalRequest) Unmarshal(dAtA []byte) error { if err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { return ErrInvalidLengthTypes } if (iNdEx + skippy) > l { @@ -2384,7 +2402,10 @@ func (m *SignedProposalResponse) Unmarshal(dAtA []byte) error { if err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { return ErrInvalidLengthTypes } if (iNdEx + skippy) > l { @@ -2434,7 +2455,10 @@ func (m *PingRequest) Unmarshal(dAtA []byte) error { if err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { return ErrInvalidLengthTypes } if (iNdEx + skippy) > l { @@ -2484,7 +2508,10 @@ func (m *PingResponse) Unmarshal(dAtA []byte) error { if err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { return ErrInvalidLengthTypes } if (iNdEx + skippy) > l { @@ -2814,7 +2841,10 @@ func (m *Message) Unmarshal(dAtA []byte) error { if err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { return ErrInvalidLengthTypes } if (iNdEx + skippy) > l { @@ -2931,7 +2961,10 @@ func (m *AuthSigMessage) Unmarshal(dAtA []byte) error { if err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { return ErrInvalidLengthTypes } if (iNdEx + skippy) > l { diff --git a/proto/tendermint/state/types.pb.go b/proto/tendermint/state/types.pb.go index e4f2082063..6ce6506b98 100644 --- a/proto/tendermint/state/types.pb.go +++ b/proto/tendermint/state/types.pb.go @@ -255,30 +255,29 @@ type State struct { Version Version `protobuf:"bytes,1,opt,name=version,proto3" json:"version"` // immutable ChainID string `protobuf:"bytes,2,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` - InitialHeight int64 `protobuf:"varint,15,opt,name=initial_height,json=initialHeight,proto3" json:"initial_height,omitempty"` + InitialHeight int64 `protobuf:"varint,14,opt,name=initial_height,json=initialHeight,proto3" json:"initial_height,omitempty"` // LastBlockHeight=0 at genesis (ie. block(H=0) does not exist) - LastBlockHeight int64 `protobuf:"varint,3,opt,name=last_block_height,json=lastBlockHeight,proto3" json:"last_block_height,omitempty"` - LastBlockID types1.BlockID `protobuf:"bytes,4,opt,name=last_block_id,json=lastBlockId,proto3" json:"last_block_id"` - LastPartSetHeader *types1.PartSetHeader `protobuf:"bytes,5,opt,name=last_part_set_header,json=lastPartSetHeader,proto3" json:"last_part_set_header,omitempty"` - LastBlockTime time.Time `protobuf:"bytes,6,opt,name=last_block_time,json=lastBlockTime,proto3,stdtime" json:"last_block_time"` + LastBlockHeight int64 `protobuf:"varint,3,opt,name=last_block_height,json=lastBlockHeight,proto3" json:"last_block_height,omitempty"` + LastBlockID types1.BlockID `protobuf:"bytes,4,opt,name=last_block_id,json=lastBlockId,proto3" json:"last_block_id"` + LastBlockTime time.Time `protobuf:"bytes,5,opt,name=last_block_time,json=lastBlockTime,proto3,stdtime" json:"last_block_time"` // LastValidators is used to validate block.LastCommit. // Validators are persisted to the database separately every time they change, // so we can query for historical validator sets. // Note that if s.LastBlockHeight causes a valset change, // we set s.LastHeightValidatorsChanged = s.LastBlockHeight + 1 + 1 // Extra +1 due to nextValSet delay. - NextValidators *types1.ValidatorSet `protobuf:"bytes,7,opt,name=next_validators,json=nextValidators,proto3" json:"next_validators,omitempty"` - Validators *types1.ValidatorSet `protobuf:"bytes,8,opt,name=validators,proto3" json:"validators,omitempty"` - LastValidators *types1.ValidatorSet `protobuf:"bytes,9,opt,name=last_validators,json=lastValidators,proto3" json:"last_validators,omitempty"` - LastHeightValidatorsChanged int64 `protobuf:"varint,10,opt,name=last_height_validators_changed,json=lastHeightValidatorsChanged,proto3" json:"last_height_validators_changed,omitempty"` + NextValidators *types1.ValidatorSet `protobuf:"bytes,6,opt,name=next_validators,json=nextValidators,proto3" json:"next_validators,omitempty"` + Validators *types1.ValidatorSet `protobuf:"bytes,7,opt,name=validators,proto3" json:"validators,omitempty"` + LastValidators *types1.ValidatorSet `protobuf:"bytes,8,opt,name=last_validators,json=lastValidators,proto3" json:"last_validators,omitempty"` + LastHeightValidatorsChanged int64 `protobuf:"varint,9,opt,name=last_height_validators_changed,json=lastHeightValidatorsChanged,proto3" json:"last_height_validators_changed,omitempty"` // Consensus parameters used for validating blocks. // Changes returned by EndBlock and updated after Commit. - ConsensusParams types1.ConsensusParams `protobuf:"bytes,11,opt,name=consensus_params,json=consensusParams,proto3" json:"consensus_params"` - LastHeightConsensusParamsChanged int64 `protobuf:"varint,12,opt,name=last_height_consensus_params_changed,json=lastHeightConsensusParamsChanged,proto3" json:"last_height_consensus_params_changed,omitempty"` + ConsensusParams types1.ConsensusParams `protobuf:"bytes,10,opt,name=consensus_params,json=consensusParams,proto3" json:"consensus_params"` + LastHeightConsensusParamsChanged int64 `protobuf:"varint,11,opt,name=last_height_consensus_params_changed,json=lastHeightConsensusParamsChanged,proto3" json:"last_height_consensus_params_changed,omitempty"` // Merkle root of the results from executing prev block - LastResultsHash []byte `protobuf:"bytes,13,opt,name=last_results_hash,json=lastResultsHash,proto3" json:"last_results_hash,omitempty"` + LastResultsHash []byte `protobuf:"bytes,12,opt,name=last_results_hash,json=lastResultsHash,proto3" json:"last_results_hash,omitempty"` // the latest AppHash we've received from calling abci.Commit() - AppHash []byte `protobuf:"bytes,14,opt,name=app_hash,json=appHash,proto3" json:"app_hash,omitempty"` + AppHash []byte `protobuf:"bytes,13,opt,name=app_hash,json=appHash,proto3" json:"app_hash,omitempty"` } func (m *State) Reset() { *m = State{} } @@ -349,13 +348,6 @@ func (m *State) GetLastBlockID() types1.BlockID { return types1.BlockID{} } -func (m *State) GetLastPartSetHeader() *types1.PartSetHeader { - if m != nil { - return m.LastPartSetHeader - } - return nil -} - func (m *State) GetLastBlockTime() time.Time { if m != nil { return m.LastBlockTime @@ -430,58 +422,56 @@ func init() { func init() { proto.RegisterFile("tendermint/state/types.proto", fileDescriptor_ccfacf933f22bf93) } var fileDescriptor_ccfacf933f22bf93 = []byte{ - // 809 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x55, 0xcd, 0x4e, 0xf3, 0x46, - 0x14, 0x8d, 0x9b, 0x0f, 0x92, 0x8c, 0x49, 0x42, 0x07, 0x16, 0x26, 0x14, 0x27, 0xa4, 0x3f, 0x42, - 0x95, 0xea, 0x48, 0x74, 0x55, 0xa9, 0x42, 0xc2, 0x49, 0x55, 0x22, 0xa1, 0x0a, 0x19, 0xc4, 0xa2, - 0x1b, 0x6b, 0x62, 0x0f, 0xb6, 0x55, 0xc7, 0xb6, 0x3c, 0x93, 0x14, 0xba, 0xef, 0x9e, 0x6d, 0x9f, - 0xa3, 0x2f, 0xc1, 0x92, 0x65, 0xd5, 0x05, 0xad, 0xc2, 0x8b, 0x54, 0xf3, 0x63, 0x67, 0x92, 0x14, - 0x89, 0xaa, 0xbb, 0xf1, 0xbd, 0xe7, 0x9e, 0x39, 0x73, 0xe7, 0x9e, 0x31, 0xf8, 0x84, 0xe2, 0xc4, -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a, 0x26, 0x84, 0x1f, 0x4b, 0x21, 0x69, 0xbc, 0x4f, 0x08, 0x2b, 0x53, 0x84, - 0x0c, 0x81, 0xa9, 0xfa, 0x63, 0xc9, 0x57, 0x5a, 0x05, 0xf0, 0xeb, 0x3f, 0x5c, 0x5a, 0x65, 0x59, - 0x2d, 0x4d, 0xf3, 0xaf, 0xc6, 0xd5, 0xff, 0xa7, 0x71, 0x7f, 0x00, 0x9f, 0xad, 0x18, 0x77, 0x8d, - 0xbf, 0x94, 0xb7, 0xc3, 0xe5, 0xf5, 0x14, 0x27, 0xaf, 0x12, 0x15, 0x1a, 0x8b, 0xd1, 0xce, 0x31, - 0x99, 0xc5, 0x94, 0xb8, 0x21, 0x22, 0xa1, 0xd1, 0xec, 0x69, 0x27, 0x3b, 0x62, 0xb4, 0x1d, 0x11, - 0xbf, 0x40, 0x24, 0x84, 0x07, 0xa0, 0x8e, 0xb2, 0x4c, 0x40, 0x5a, 0x1c, 0x52, 0x43, 0x59, 0xc6, - 0x52, 0xf6, 0xed, 0xd3, 0xc2, 0xd4, 0x9e, 0x17, 0xa6, 0xf6, 0xf7, 0xc2, 0xd4, 0x1e, 0x5f, 0xcd, - 0xca, 0xf3, 0xab, 0x59, 0xf9, 0xe3, 0xd5, 0xac, 0xfc, 0xf8, 0x6d, 0x10, 0xd1, 0x70, 0x36, 0xb1, - 0xbc, 0x74, 0x3a, 0x88, 0xd1, 0x2f, 0x0f, 0x31, 0xf6, 0x03, 0x9c, 0x2b, 0xcb, 0xaf, 0xbc, 0x34, - 0x97, 0xbf, 0x9e, 0xc1, 0xfa, 0x9f, 0x76, 0xb2, 0xcd, 0xe3, 0x5f, 0xff, 0x13, 0x00, 0x00, 0xff, - 0xff, 0x9d, 0xd6, 0x60, 0x0f, 0x84, 0x07, 0x00, 0x00, + // 775 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x95, 0x4d, 0x4f, 0xeb, 0x46, + 0x14, 0x86, 0xe3, 0x06, 0x48, 0x32, 0x26, 0x09, 0x1d, 0xba, 0x30, 0xa1, 0x38, 0x21, 0xfd, 0x10, + 0xaa, 0x54, 0x47, 0xa2, 0xab, 0x4a, 0x15, 0x12, 0x4e, 0xaa, 0x12, 0x09, 0x55, 0x95, 0x41, 0x2c, + 0xba, 0xb1, 0x26, 0xf6, 0x60, 0x5b, 0x75, 0x6c, 0xcb, 0x33, 0x49, 0xa1, 0xfb, 0xee, 0xd9, 0xf6, + 0x1f, 0xb1, 0x64, 0x59, 0x75, 0x41, 0xdb, 0xf0, 0x47, 0xae, 0xe6, 0xc3, 0xce, 0x24, 0xb9, 0x48, + 0x5c, 0xdd, 0xdd, 0x78, 0xce, 0x7b, 0x9e, 0x79, 0xe7, 0xcc, 0x39, 0x32, 0xf8, 0x9c, 0xe2, 0xc4, + 0xc7, 0xf9, 0x34, 0x4a, 0xe8, 0x80, 0x50, 0x44, 0xf1, 0x80, 0xde, 0x67, 0x98, 0x58, 0x59, 0x9e, + 0xd2, 0x14, 0xee, 0x2d, 0xa3, 0x16, 0x8f, 0x76, 0x3e, 0x0b, 0xd2, 0x20, 0xe5, 0xc1, 0x01, 0x5b, + 0x09, 0x5d, 0xe7, 0x50, 0xa1, 0xa0, 0x89, 0x17, 0xa9, 0x90, 0x8e, 0x7a, 0x04, 0xdf, 0x5f, 0x89, + 0xf6, 0x36, 0xa2, 0x73, 0x14, 0x47, 0x3e, 0xa2, 0x69, 0x2e, 0x15, 0x47, 0x1b, 0x8a, 0x0c, 0xe5, + 0x68, 0x5a, 0x00, 0x4c, 0x25, 0x3c, 0xc7, 0x39, 0x89, 0xd2, 0x64, 0xe5, 0x80, 0x6e, 0x90, 0xa6, + 0x41, 0x8c, 0x07, 0xfc, 0x6b, 0x32, 0xbb, 0x1d, 0xd0, 0x68, 0x8a, 0x09, 0x45, 0xd3, 0x4c, 0x08, + 0xfa, 0xff, 0x68, 0xa0, 0x79,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73, 0x65, 0xf9, 0xad, 0x97, 0xe6, 0xf2, 0x47, + 0x31, 0x58, 0xff, 0x2f, 0x4e, 0x76, 0xf8, 0xfe, 0x77, 0xef, 0x02, 0x00, 0x00, 0xff, 0xff, 0x42, + 0x7a, 0x07, 0x95, 0x32, 0x07, 0x00, 0x00, } func (m *ABCIResponses) Marshal() (dAtA []byte, err error) { @@ -686,26 +676,26 @@ func (m *State) MarshalToSizedBuffer(dAtA []byte) (int, error) { if m.InitialHeight != 0 { i = encodeVarintTypes(dAtA, i, uint64(m.InitialHeight)) i-- - dAtA[i] = 0x78 + dAtA[i] = 0x70 } if len(m.AppHash) > 0 { i -= len(m.AppHash) copy(dAtA[i:], m.AppHash) i = encodeVarintTypes(dAtA, i, uint64(len(m.AppHash))) i-- - dAtA[i] = 0x72 + dAtA[i] = 0x6a } if len(m.LastResultsHash) > 0 { i -= len(m.LastResultsHash) copy(dAtA[i:], m.LastResultsHash) i = encodeVarintTypes(dAtA, i, uint64(len(m.LastResultsHash))) i-- - dAtA[i] = 0x6a + dAtA[i] = 0x62 } if m.LastHeightConsensusParamsChanged != 0 { i = encodeVarintTypes(dAtA, i, uint64(m.LastHeightConsensusParamsChanged)) i-- - dAtA[i] = 0x60 + dAtA[i] = 0x58 } { size, err := m.ConsensusParams.MarshalToSizedBuffer(dAtA[:i]) @@ -716,11 +706,11 @@ func (m *State) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintTypes(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x5a + dAtA[i] = 0x52 if m.LastHeightValidatorsChanged != 0 { i = encodeVarintTypes(dAtA, i, uint64(m.LastHeightValidatorsChanged)) i-- - dAtA[i] = 0x50 + dAtA[i] = 0x48 } if m.LastValidators != nil { { @@ -732,7 +722,7 @@ func (m *State) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintTypes(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x4a + dAtA[i] = 0x42 } if m.Validators != nil { { @@ -744,7 +734,7 @@ func (m *State) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintTypes(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x42 + dAtA[i] = 0x3a } if m.NextValidators != nil { { @@ -756,7 +746,7 @@ func (m *State) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintTypes(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x3a + dAtA[i] = 0x32 } n10, err10 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.LastBlockTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.LastBlockTime):]) if err10 != nil { @@ -765,19 +755,7 @@ func (m *State) MarshalToSizedBuffer(dAtA []byte) (int, error) { i -= n10 i = encodeVarintTypes(dAtA, i, uint64(n10)) i-- - dAtA[i] = 0x32 - if m.LastPartSetHeader != nil { - { - size, err := m.LastPartSetHeader.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTypes(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x2a - } + dAtA[i] = 0x2a { size, err := m.LastBlockID.MarshalToSizedBuffer(dAtA[:i]) if err != nil { @@ -909,10 +887,6 @@ func (m *State) Size() (n int) { } l = m.LastBlockID.Size() n += 1 + l + sovTypes(uint64(l)) - if m.LastPartSetHeader != nil { - l = m.LastPartSetHeader.Size() - n += 1 + l + sovTypes(uint64(l)) - } l = github_com_gogo_protobuf_types.SizeOfStdTime(m.LastBlockTime) n += 1 + l + sovTypes(uint64(l)) if m.NextValidators != nil { @@ -1096,7 +1070,10 @@ func (m *ABCIResponses) Unmarshal(dAtA []byte) error { if err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { return ErrInvalidLengthTypes } if (iNdEx + skippy) > l { @@ -1201,7 +1178,10 @@ func (m *ValidatorsInfo) Unmarshal(dAtA []byte) error { if err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { return ErrInvalidLengthTypes } if (iNdEx + skippy) > l { @@ -1303,7 +1283,10 @@ func (m *ConsensusParamsInfo) Unmarshal(dAtA []byte) error { if err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { return ErrInvalidLengthTypes } if (iNdEx + skippy) > l { @@ -1418,7 +1401,10 @@ func (m *Version) Unmarshal(dAtA []byte) error { if err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { return ErrInvalidLengthTypes } if (iNdEx + skippy) > l { @@ -1580,42 +1566,6 @@ func (m *State) Unmarshal(dAtA []byte) error { } iNdEx = postIndex case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field LastPartSetHeader", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.LastPartSetHeader == nil { - m.LastPartSetHeader = &types1.PartSetHeader{} - } - if err := m.LastPartSetHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 6: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field LastBlockTime", wireType) } @@ -1648,7 +1598,7 @@ func (m *State) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 7: + case 6: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field NextValidators", wireType) } @@ -1684,7 +1634,7 @@ func (m *State) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 8: + case 7: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Validators", wireType) } @@ -1720,7 +1670,7 @@ func (m *State) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 9: + case 8: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field LastValidators", wireType) } @@ -1756,7 +1706,7 @@ func (m *State) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 10: + case 9: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field LastHeightValidatorsChanged", wireType) } @@ -1775,7 +1725,7 @@ func (m *State) Unmarshal(dAtA []byte) error { break } } - case 11: + case 10: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field ConsensusParams", wireType) } @@ -1808,7 +1758,7 @@ func (m *State) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 12: + case 11: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field LastHeightConsensusParamsChanged", wireType) } @@ -1827,7 +1777,7 @@ func (m *State) Unmarshal(dAtA []byte) error { break } } - case 13: + case 12: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field LastResultsHash", wireType) } @@ -1861,7 +1811,7 @@ func (m *State) Unmarshal(dAtA []byte) error { m.LastResultsHash = []byte{} } iNdEx = postIndex - case 14: + case 13: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field AppHash", wireType) } @@ -1895,7 +1845,7 @@ func (m *State) Unmarshal(dAtA []byte) error { m.AppHash = []byte{} } iNdEx = postIndex - case 15: + case 14: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field InitialHeight", wireType) } @@ -1920,7 +1870,10 @@ func (m *State) Unmarshal(dAtA []byte) error { if err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { return ErrInvalidLengthTypes } if (iNdEx + skippy) > l { diff --git a/proto/tendermint/state/types.proto b/proto/tendermint/state/types.proto index bdace5ff81..d91fe5a660 100644 --- a/proto/tendermint/state/types.proto +++ b/proto/tendermint/state/types.proto @@ -42,14 +42,13 @@ message State { // immutable string chain_id = 2 [(gogoproto.customname) = "ChainID"]; - int64 initial_height = 15; + int64 initial_height = 14; // LastBlockHeight=0 at genesis (ie. block(H=0) does not exist) int64 last_block_height = 3; tendermint.types.BlockID last_block_id = 4 [(gogoproto.nullable) = false, (gogoproto.customname) = "LastBlockID"]; - tendermint.types.PartSetHeader last_part_set_header = 5; - google.protobuf.Timestamp last_block_time = 6 + google.protobuf.Timestamp last_block_time = 5 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; // LastValidators is used to validate block.LastCommit. @@ -58,19 +57,19 @@ message State { // Note that if s.LastBlockHeight causes a valset change, // we set s.LastHeightValidatorsChanged = s.LastBlockHeight + 1 + 1 // Extra +1 due to nextValSet delay. - tendermint.types.ValidatorSet next_validators = 7; - tendermint.types.ValidatorSet validators = 8; - tendermint.types.ValidatorSet last_validators = 9; - int64 last_height_validators_changed = 10; + tendermint.types.ValidatorSet next_validators = 6; + tendermint.types.ValidatorSet validators = 7; + tendermint.types.ValidatorSet last_validators = 8; + int64 last_height_validators_changed = 9; // Consensus parameters used for validating blocks. // Changes returned by EndBlock and updated after Commit. - tendermint.types.ConsensusParams consensus_params = 11 [(gogoproto.nullable) = false]; - int64 last_height_consensus_params_changed = 12; + tendermint.types.ConsensusParams consensus_params = 10 [(gogoproto.nullable) = false]; + int64 last_height_consensus_params_changed = 11; // Merkle root of the results from executing prev block - bytes last_results_hash = 13; + bytes last_results_hash = 12; // the latest AppHash we've received from calling abci.Commit() - bytes app_hash = 14; + bytes app_hash = 13; } diff --git a/proto/tendermint/statesync/types.pb.go b/proto/tendermint/statesync/types.pb.go index 972df894de..16b2c88e87 100644 --- a/proto/tendermint/statesync/types.pb.go +++ b/proto/tendermint/statesync/types.pb.go @@ -1035,7 +1035,10 @@ func (m *Message) Unmarshal(dAtA []byte) error { if err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { return ErrInvalidLengthTypes } if (iNdEx + skippy) > l { @@ -1085,7 +1088,10 @@ func (m *SnapshotsRequest) Unmarshal(dAtA []byte) error { if err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { return ErrInvalidLengthTypes } if (iNdEx + skippy) > l { @@ -1260,7 +1266,10 @@ func (m *SnapshotsResponse) Unmarshal(dAtA []byte) error { if err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { return ErrInvalidLengthTypes } if (iNdEx + skippy) > l { @@ -1367,7 +1376,10 @@ func (m *ChunkRequest) Unmarshal(dAtA []byte) error { if err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { return ErrInvalidLengthTypes } if (iNdEx + skippy) > l { @@ -1528,7 +1540,10 @@ func (m *ChunkResponse) Unmarshal(dAtA []byte) error { if err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { return ErrInvalidLengthTypes } if (iNdEx + skippy) > l { diff --git a/proto/tendermint/store/types.pb.go b/proto/tendermint/store/types.pb.go index 519132c5f6..505d482c8e 100644 --- a/proto/tendermint/store/types.pb.go +++ b/proto/tendermint/store/types.pb.go @@ -234,7 +234,10 @@ func (m *BlockStoreState) Unmarshal(dAtA []byte) error { if err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { return ErrInvalidLengthTypes } if (iNdEx + skippy) > l { diff --git a/proto/tendermint/types/block.pb.go b/proto/tendermint/types/block.pb.go index 9c18995df6..0b00f36bc0 100644 --- a/proto/tendermint/types/block.pb.go +++ b/proto/tendermint/types/block.pb.go @@ -397,7 +397,10 @@ func (m *Block) Unmarshal(dAtA []byte) error { if err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { + if skippy < 0 { + return ErrInvalidLengthBlock + } + if (iNdEx + skippy) < 0 { return ErrInvalidLengthBlock } if (iNdEx + skippy) > l { diff --git a/proto/tendermint/types/canonical.pb.go b/proto/tendermint/types/canonical.pb.go index f362c30feb..dfeb236a7a 100644 --- a/proto/tendermint/types/canonical.pb.go +++ b/proto/tendermint/types/canonical.pb.go @@ -29,7 +29,8 @@ var _ = time.Kitchen const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package type CanonicalBlockID struct { - Hash []byte `protobuf:"bytes,1,opt,name=hash,proto3" json:"hash,omitempty"` + Hash []byte `protobuf:"bytes,1,opt,name=hash,proto3" json:"hash,omitempty"` + PartSetHeader CanonicalPartSetHeader `protobuf:"bytes,2,opt,name=part_set_header,json=partSetHeader,proto3" json:"part_set_header"` } func (m *CanonicalBlockID) Reset() { *m = CanonicalBlockID{} } @@ -72,6 +73,13 @@ func (m *CanonicalBlockID) GetHash() []byte { return nil } +func (m *CanonicalBlockID) GetPartSetHeader() CanonicalPartSetHeader { + if m != nil { + return m.PartSetHeader + } + return CanonicalPartSetHeader{} +} + type CanonicalPartSetHeader struct { Total uint32 `protobuf:"varint,1,opt,name=total,proto3" json:"total,omitempty"` Hash []byte `protobuf:"bytes,2,opt,name=hash,proto3" json:"hash,omitempty"` @@ -125,15 +133,14 @@ func (m *CanonicalPartSetHeader) GetHash() []byte { } type CanonicalProposal struct { - Type SignedMsgType `protobuf:"varint,1,opt,name=type,proto3,enum=tendermint.types.SignedMsgType" json:"type,omitempty"` - Height int64 `protobuf:"fixed64,2,opt,name=height,proto3" json:"height,omitempty"` - Round int64 `protobuf:"fixed64,3,opt,name=round,proto3" json:"round,omitempty"` - POLRound int64 `protobuf:"varint,4,opt,name=pol_round,json=polRound,proto3" json:"pol_round,omitempty"` - BlockID *CanonicalBlockID `protobuf:"bytes,5,opt,name=block_id,json=blockId,proto3" json:"block_id,omitempty"` - Timestamp time.Time `protobuf:"bytes,6,opt,name=timestamp,proto3,stdtime" json:"timestamp"` - ChainID string `protobuf:"bytes,7,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` - DAHeader *DataAvailabilityHeader `protobuf:"bytes,8,opt,name=da_header,json=daHeader,proto3" json:"da_header,omitempty"` - PartSetHeader *CanonicalPartSetHeader `protobuf:"bytes,9,opt,name=part_set_header,json=partSetHeader,proto3" json:"part_set_header,omitempty"` + Type SignedMsgType `protobuf:"varint,1,opt,name=type,proto3,enum=tendermint.types.SignedMsgType" json:"type,omitempty"` + Height int64 `protobuf:"fixed64,2,opt,name=height,proto3" json:"height,omitempty"` + Round int64 `protobuf:"fixed64,3,opt,name=round,proto3" json:"round,omitempty"` + POLRound int64 `protobuf:"varint,4,opt,name=pol_round,json=polRound,proto3" json:"pol_round,omitempty"` + BlockID *CanonicalBlockID `protobuf:"bytes,5,opt,name=block_id,json=blockId,proto3" json:"block_id,omitempty"` + Timestamp time.Time `protobuf:"bytes,6,opt,name=timestamp,proto3,stdtime" json:"timestamp"` + ChainID string `protobuf:"bytes,7,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` + DAHeader *DataAvailabilityHeader `protobuf:"bytes,8,opt,name=da_header,json=daHeader,proto3" json:"da_header,omitempty"` } func (m *CanonicalProposal) Reset() { *m = CanonicalProposal{} } @@ -225,21 +232,13 @@ func (m *CanonicalProposal) GetDAHeader() *DataAvailabilityHeader { return nil } -func (m *CanonicalProposal) GetPartSetHeader() *CanonicalPartSetHeader { - if m != nil { - return m.PartSetHeader - } - return nil -} - type CanonicalVote struct { - Type SignedMsgType `protobuf:"varint,1,opt,name=type,proto3,enum=tendermint.types.SignedMsgType" json:"type,omitempty"` - Height int64 `protobuf:"fixed64,2,opt,name=height,proto3" json:"height,omitempty"` - Round int64 `protobuf:"fixed64,3,opt,name=round,proto3" json:"round,omitempty"` - BlockID *CanonicalBlockID `protobuf:"bytes,4,opt,name=block_id,json=blockId,proto3" json:"block_id,omitempty"` - Timestamp time.Time `protobuf:"bytes,5,opt,name=timestamp,proto3,stdtime" json:"timestamp"` - ChainID string `protobuf:"bytes,6,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` - PartSetHeader *CanonicalPartSetHeader `protobuf:"bytes,7,opt,name=part_set_header,json=partSetHeader,proto3" json:"part_set_header,omitempty"` + Type SignedMsgType `protobuf:"varint,1,opt,name=type,proto3,enum=tendermint.types.SignedMsgType" json:"type,omitempty"` + Height int64 `protobuf:"fixed64,2,opt,name=height,proto3" json:"height,omitempty"` + Round int64 `protobuf:"fixed64,3,opt,name=round,proto3" json:"round,omitempty"` + BlockID *CanonicalBlockID `protobuf:"bytes,4,opt,name=block_id,json=blockId,proto3" json:"block_id,omitempty"` + Timestamp time.Time `protobuf:"bytes,5,opt,name=timestamp,proto3,stdtime" json:"timestamp"` + ChainID string `protobuf:"bytes,6,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` } func (m *CanonicalVote) Reset() { *m = CanonicalVote{} } @@ -317,13 +316,6 @@ func (m *CanonicalVote) GetChainID() string { return "" } -func (m *CanonicalVote) GetPartSetHeader() *CanonicalPartSetHeader { - if m != nil { - return m.PartSetHeader - } - return nil -} - func init() { proto.RegisterType((*CanonicalBlockID)(nil), "tendermint.types.CanonicalBlockID") proto.RegisterType((*CanonicalPartSetHeader)(nil), "tendermint.types.CanonicalPartSetHeader") @@ -335,40 +327,40 @@ func init() { proto.RegisterFile("tendermint/types/canonical.proto", fileDescrip var fileDescriptor_8d1a1a84ff7267ed = []byte{ // 533 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x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, 0xc2, 0x4f, 0xdb, 0xd2, 0xec, 0x4e, 0xb9, 0xeb, + 0xa2, 0xa8, 0x15, 0xbb, 0x54, 0x73, 0x4c, 0xe0, 0x04, 0x74, 0x08, 0xde, 0x10, 0xd7, 0x1f, 0x22, + 0x3e, 0xc2, 0x12, 0x9f, 0x7f, 0xc2, 0x8c, 0x63, 0x9f, 0x71, 0x26, 0x97, 0x15, 0x71, 0x75, 0x8c, + 0xd1, 0x79, 0x99, 0x21, 0x9d, 0xe0, 0x0a, 0xfa, 0xd7, 0x03, 0xd0, 0xdd, 0x7e, 0xd7, 0xa9, 0x90, + 0xf4, 0x7f, 0xc0, 0xda, 0x27, 0xd0, 0xf8, 0x97, 0x04, 0x9a, 0x7f, 0x4f, 0xa0, 0xf5, 0x30, 0x01, + 0x6f, 0x7a, 0x93, 0x1b, 0xda, 0x6d, 0x6e, 0x68, 0x3f, 0x73, 0x43, 0xbb, 0x5e, 0x1b, 0xb5, 0xdb, + 0xb5, 0x51, 0xfb, 0xbe, 0x36, 0x6a, 0xef, 0x5f, 0x86, 0x4c, 0x46, 0x0b, 0xdf, 0x09, 0xc4, 0xdc, + 0xe5, 0xf8, 0xf3, 0x92, 0x53, 0x12, 0xd2, 0x74, 0x2f, 0x7c, 0x11, 0x88, 0xb4, 0xfa, 0xed, 0xbb, + 0x77, 0xff, 0x26, 0xfc, 0x96, 0xaa, 0x9f, 0xfd, 0x0a, 0x00, 0x00, 0xff, 0xff, 0x72, 0x3e, 0x7e, + 0x19, 0x8b, 0x04, 0x00, 0x00, } func (m *CanonicalBlockID) Marshal() (dAtA []byte, err error) { @@ -391,6 +383,16 @@ func (m *CanonicalBlockID) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + { + size, err := m.PartSetHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintCanonical(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 if len(m.Hash) > 0 { i -= len(m.Hash) copy(dAtA[i:], m.Hash) @@ -456,18 +458,6 @@ func (m *CanonicalProposal) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if m.PartSetHeader != nil { - { - size, err := m.PartSetHeader.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintCanonical(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x4a - } if m.DAHeader != nil { { size, err := m.DAHeader.MarshalToSizedBuffer(dAtA[:i]) @@ -552,18 +542,6 @@ func (m *CanonicalVote) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if m.PartSetHeader != nil { - { - size, err := m.PartSetHeader.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintCanonical(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x3a - } if len(m.ChainID) > 0 { i -= len(m.ChainID) copy(dAtA[i:], m.ChainID) @@ -571,12 +549,12 @@ func (m *CanonicalVote) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x32 } - n6, err6 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.Timestamp, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.Timestamp):]) - if err6 != nil { - return 0, err6 + n5, err5 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.Timestamp, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.Timestamp):]) + if err5 != nil { + return 0, err5 } - i -= n6 - i = encodeVarintCanonical(dAtA, i, uint64(n6)) + i -= n5 + i = encodeVarintCanonical(dAtA, i, uint64(n5)) i-- dAtA[i] = 0x2a if m.BlockID != nil { @@ -632,6 +610,8 @@ func (m *CanonicalBlockID) Size() (n int) { if l > 0 { n += 1 + l + sovCanonical(uint64(l)) } + l = m.PartSetHeader.Size() + n += 1 + l + sovCanonical(uint64(l)) return n } @@ -683,10 +663,6 @@ func (m *CanonicalProposal) Size() (n int) { l = m.DAHeader.Size() n += 1 + l + sovCanonical(uint64(l)) } - if m.PartSetHeader != nil { - l = m.PartSetHeader.Size() - n += 1 + l + sovCanonical(uint64(l)) - } return n } @@ -715,10 +691,6 @@ func (m *CanonicalVote) Size() (n int) { if l > 0 { n += 1 + l + sovCanonical(uint64(l)) } - if m.PartSetHeader != nil { - l = m.PartSetHeader.Size() - n += 1 + l + sovCanonical(uint64(l)) - } return n } @@ -791,13 +763,49 @@ func (m *CanonicalBlockID) Unmarshal(dAtA []byte) error { m.Hash = []byte{} } iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PartSetHeader", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCanonical + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthCanonical + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthCanonical + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.PartSetHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipCanonical(dAtA[iNdEx:]) if err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { + if skippy < 0 { + return ErrInvalidLengthCanonical + } + if (iNdEx + skippy) < 0 { return ErrInvalidLengthCanonical } if (iNdEx + skippy) > l { @@ -900,7 +908,10 @@ func (m *CanonicalPartSetHeader) Unmarshal(dAtA []byte) error { if err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { + if skippy < 0 { + return ErrInvalidLengthCanonical + } + if (iNdEx + skippy) < 0 { return ErrInvalidLengthCanonical } if (iNdEx + skippy) > l { @@ -1139,49 +1150,16 @@ func (m *CanonicalProposal) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 9: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field PartSetHeader", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCanonical - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthCanonical - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthCanonical - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.PartSetHeader == nil { - m.PartSetHeader = &CanonicalPartSetHeader{} - } - if err := m.PartSetHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipCanonical(dAtA[iNdEx:]) if err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { + if skippy < 0 { + return ErrInvalidLengthCanonical + } + if (iNdEx + skippy) < 0 { return ErrInvalidLengthCanonical } if (iNdEx + skippy) > l { @@ -1365,49 +1343,16 @@ func (m *CanonicalVote) Unmarshal(dAtA []byte) error { } m.ChainID = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 7: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field PartSetHeader", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCanonical - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthCanonical - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthCanonical - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.PartSetHeader == nil { - m.PartSetHeader = &CanonicalPartSetHeader{} - } - if err := m.PartSetHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipCanonical(dAtA[iNdEx:]) if err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { + if skippy < 0 { + return ErrInvalidLengthCanonical + } + if (iNdEx + skippy) < 0 { return ErrInvalidLengthCanonical } if (iNdEx + skippy) > l { diff --git a/proto/tendermint/types/canonical.proto b/proto/tendermint/types/canonical.proto index 6de5c35d87..ff86aa2f57 100644 --- a/proto/tendermint/types/canonical.proto +++ b/proto/tendermint/types/canonical.proto @@ -9,6 +9,7 @@ import "google/protobuf/timestamp.proto"; message CanonicalBlockID { bytes hash = 1; + CanonicalPartSetHeader part_set_header = 2 [(gogoproto.nullable) = false]; } message CanonicalPartSetHeader { @@ -25,7 +26,6 @@ message CanonicalProposal { google.protobuf.Timestamp timestamp = 6 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; string chain_id = 7 [(gogoproto.customname) = "ChainID"]; DataAvailabilityHeader da_header = 8 [(gogoproto.customname) = "DAHeader"]; - CanonicalPartSetHeader part_set_header = 9; } message CanonicalVote { @@ -35,5 +35,4 @@ message CanonicalVote { CanonicalBlockID block_id = 4 [(gogoproto.customname) = "BlockID"]; google.protobuf.Timestamp timestamp = 5 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; string chain_id = 6 [(gogoproto.customname) = "ChainID"]; - CanonicalPartSetHeader part_set_header = 7; } diff --git a/proto/tendermint/types/events.pb.go b/proto/tendermint/types/events.pb.go index deef9454c2..f3d30b6c37 100644 --- a/proto/tendermint/types/events.pb.go +++ b/proto/tendermint/types/events.pb.go @@ -286,7 +286,10 @@ func (m *EventDataRoundState) Unmarshal(dAtA []byte) error { if err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { + if skippy < 0 { + return ErrInvalidLengthEvents + } + if (iNdEx + skippy) < 0 { return ErrInvalidLengthEvents } if (iNdEx + skippy) > l { diff --git a/proto/tendermint/types/params.pb.go b/proto/tendermint/types/params.pb.go index 61b760ebbb..19c95dbf12 100644 --- a/proto/tendermint/types/params.pb.go +++ b/proto/tendermint/types/params.pb.go @@ -1213,7 +1213,10 @@ func (m *ConsensusParams) Unmarshal(dAtA []byte) error { if err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { + if skippy < 0 { + return ErrInvalidLengthParams + } + if (iNdEx + skippy) < 0 { return ErrInvalidLengthParams } if (iNdEx + skippy) > l { @@ -1320,7 +1323,10 @@ func (m *BlockParams) Unmarshal(dAtA []byte) error { if err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { + if skippy < 0 { + return ErrInvalidLengthParams + } + if (iNdEx + skippy) < 0 { return ErrInvalidLengthParams } if (iNdEx + skippy) > l { @@ -1441,7 +1447,10 @@ func (m *EvidenceParams) Unmarshal(dAtA []byte) error { if err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { + if skippy < 0 { + return ErrInvalidLengthParams + } + if (iNdEx + skippy) < 0 { return ErrInvalidLengthParams } if (iNdEx + skippy) > l { @@ -1523,7 +1532,10 @@ func (m *ValidatorParams) Unmarshal(dAtA []byte) error { if err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { + if skippy < 0 { + return ErrInvalidLengthParams + } + if (iNdEx + skippy) < 0 { return ErrInvalidLengthParams } if (iNdEx + skippy) > l { @@ -1592,7 +1604,10 @@ func (m *VersionParams) Unmarshal(dAtA []byte) error { if err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { + if skippy < 0 { + return ErrInvalidLengthParams + } + if (iNdEx + skippy) < 0 { return ErrInvalidLengthParams } if (iNdEx + skippy) > l { @@ -1680,7 +1695,10 @@ func (m *HashedParams) Unmarshal(dAtA []byte) error { if err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { + if skippy < 0 { + return ErrInvalidLengthParams + } + if (iNdEx + skippy) < 0 { return ErrInvalidLengthParams } if (iNdEx + skippy) > l { diff --git a/proto/tendermint/types/types.pb.go b/proto/tendermint/types/types.pb.go index d7139a655f..2903453e77 100644 --- a/proto/tendermint/types/types.pb.go +++ b/proto/tendermint/types/types.pb.go @@ -210,7 +210,8 @@ func (m *Part) GetProof() crypto.Proof { // BlockID type BlockID struct { - Hash []byte `protobuf:"bytes,1,opt,name=hash,proto3" json:"hash,omitempty"` + 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"` } func (m *BlockID) Reset() { *m = BlockID{} } @@ -253,6 +254,13 @@ func (m *BlockID) GetHash() []byte { return nil } +func (m *BlockID) GetPartSetHeader() PartSetHeader { + if m != nil { + return m.PartSetHeader + } + return PartSetHeader{} +} + // Header defines the structure of a Tendermint block header. type Header struct { // basic block info @@ -261,21 +269,20 @@ type Header struct { Height int64 `protobuf:"varint,3,opt,name=height,proto3" json:"height,omitempty"` Time time.Time `protobuf:"bytes,4,opt,name=time,proto3,stdtime" json:"time"` // prev block info - LastBlockId BlockID `protobuf:"bytes,5,opt,name=last_block_id,json=lastBlockId,proto3" json:"last_block_id"` - LastPartSetHeader *PartSetHeader `protobuf:"bytes,6,opt,name=last_part_set_header,json=lastPartSetHeader,proto3" json:"last_part_set_header,omitempty"` + LastBlockId BlockID `protobuf:"bytes,5,opt,name=last_block_id,json=lastBlockId,proto3" json:"last_block_id"` // hashes of block data - LastCommitHash []byte `protobuf:"bytes,7,opt,name=last_commit_hash,json=lastCommitHash,proto3" json:"last_commit_hash,omitempty"` - NumOriginalDataShares uint64 `protobuf:"varint,8,opt,name=num_original_data_shares,json=numOriginalDataShares,proto3" json:"num_original_data_shares,omitempty"` - DataHash []byte `protobuf:"bytes,9,opt,name=data_hash,json=dataHash,proto3" json:"data_hash,omitempty"` + LastCommitHash []byte `protobuf:"bytes,6,opt,name=last_commit_hash,json=lastCommitHash,proto3" json:"last_commit_hash,omitempty"` + NumOriginalDataShares uint64 `protobuf:"varint,7,opt,name=num_original_data_shares,json=numOriginalDataShares,proto3" json:"num_original_data_shares,omitempty"` + DataHash []byte `protobuf:"bytes,8,opt,name=data_hash,json=dataHash,proto3" json:"data_hash,omitempty"` // hashes from the app output from the prev block - ValidatorsHash []byte `protobuf:"bytes,10,opt,name=validators_hash,json=validatorsHash,proto3" json:"validators_hash,omitempty"` - NextValidatorsHash []byte `protobuf:"bytes,11,opt,name=next_validators_hash,json=nextValidatorsHash,proto3" json:"next_validators_hash,omitempty"` - ConsensusHash []byte `protobuf:"bytes,12,opt,name=consensus_hash,json=consensusHash,proto3" json:"consensus_hash,omitempty"` - AppHash []byte `protobuf:"bytes,13,opt,name=app_hash,json=appHash,proto3" json:"app_hash,omitempty"` - LastResultsHash []byte `protobuf:"bytes,14,opt,name=last_results_hash,json=lastResultsHash,proto3" json:"last_results_hash,omitempty"` + ValidatorsHash []byte `protobuf:"bytes,9,opt,name=validators_hash,json=validatorsHash,proto3" json:"validators_hash,omitempty"` + NextValidatorsHash []byte `protobuf:"bytes,10,opt,name=next_validators_hash,json=nextValidatorsHash,proto3" json:"next_validators_hash,omitempty"` + ConsensusHash []byte `protobuf:"bytes,11,opt,name=consensus_hash,json=consensusHash,proto3" json:"consensus_hash,omitempty"` + AppHash []byte `protobuf:"bytes,12,opt,name=app_hash,json=appHash,proto3" json:"app_hash,omitempty"` + LastResultsHash []byte `protobuf:"bytes,13,opt,name=last_results_hash,json=lastResultsHash,proto3" json:"last_results_hash,omitempty"` // consensus info - EvidenceHash []byte `protobuf:"bytes,15,opt,name=evidence_hash,json=evidenceHash,proto3" json:"evidence_hash,omitempty"` - ProposerAddress []byte `protobuf:"bytes,16,opt,name=proposer_address,json=proposerAddress,proto3" json:"proposer_address,omitempty"` + EvidenceHash []byte `protobuf:"bytes,14,opt,name=evidence_hash,json=evidenceHash,proto3" json:"evidence_hash,omitempty"` + ProposerAddress []byte `protobuf:"bytes,15,opt,name=proposer_address,json=proposerAddress,proto3" json:"proposer_address,omitempty"` } func (m *Header) Reset() { *m = Header{} } @@ -346,13 +353,6 @@ func (m *Header) GetLastBlockId() BlockID { return BlockID{} } -func (m *Header) GetLastPartSetHeader() *PartSetHeader { - if m != nil { - return m.LastPartSetHeader - } - return nil -} - func (m *Header) GetLastCommitHash() []byte { if m != nil { return m.LastCommitHash @@ -985,15 +985,14 @@ func (m *DataAvailabilityHeader) GetColumnRoots() [][]byte { // Vote represents a prevote, precommit, or commit vote from validators for // consensus. type Vote struct { - Type SignedMsgType `protobuf:"varint,1,opt,name=type,proto3,enum=tendermint.types.SignedMsgType" json:"type,omitempty"` - Height int64 `protobuf:"varint,2,opt,name=height,proto3" json:"height,omitempty"` - Round int32 `protobuf:"varint,3,opt,name=round,proto3" json:"round,omitempty"` - BlockID BlockID `protobuf:"bytes,4,opt,name=block_id,json=blockId,proto3" json:"block_id"` - Timestamp time.Time `protobuf:"bytes,5,opt,name=timestamp,proto3,stdtime" json:"timestamp"` - ValidatorAddress []byte `protobuf:"bytes,6,opt,name=validator_address,json=validatorAddress,proto3" json:"validator_address,omitempty"` - ValidatorIndex int32 `protobuf:"varint,7,opt,name=validator_index,json=validatorIndex,proto3" json:"validator_index,omitempty"` - Signature []byte `protobuf:"bytes,8,opt,name=signature,proto3" json:"signature,omitempty"` - PartSetHeader *PartSetHeader `protobuf:"bytes,9,opt,name=part_set_header,json=partSetHeader,proto3" json:"part_set_header,omitempty"` + Type SignedMsgType `protobuf:"varint,1,opt,name=type,proto3,enum=tendermint.types.SignedMsgType" json:"type,omitempty"` + Height int64 `protobuf:"varint,2,opt,name=height,proto3" json:"height,omitempty"` + Round int32 `protobuf:"varint,3,opt,name=round,proto3" json:"round,omitempty"` + BlockID BlockID `protobuf:"bytes,4,opt,name=block_id,json=blockId,proto3" json:"block_id"` + Timestamp time.Time `protobuf:"bytes,5,opt,name=timestamp,proto3,stdtime" json:"timestamp"` + ValidatorAddress []byte `protobuf:"bytes,6,opt,name=validator_address,json=validatorAddress,proto3" json:"validator_address,omitempty"` + ValidatorIndex int32 `protobuf:"varint,7,opt,name=validator_index,json=validatorIndex,proto3" json:"validator_index,omitempty"` + Signature []byte `protobuf:"bytes,8,opt,name=signature,proto3" json:"signature,omitempty"` } func (m *Vote) Reset() { *m = Vote{} } @@ -1085,21 +1084,13 @@ func (m *Vote) GetSignature() []byte { return nil } -func (m *Vote) GetPartSetHeader() *PartSetHeader { - if m != nil { - return m.PartSetHeader - } - return nil -} - // Commit contains the evidence that a block was committed by a set of validators. type Commit struct { - Height int64 `protobuf:"varint,1,opt,name=height,proto3" json:"height,omitempty"` - Round int32 `protobuf:"varint,2,opt,name=round,proto3" json:"round,omitempty"` - BlockID BlockID `protobuf:"bytes,3,opt,name=block_id,json=blockId,proto3" json:"block_id"` - Signatures []CommitSig `protobuf:"bytes,4,rep,name=signatures,proto3" json:"signatures"` - HeaderHash []byte `protobuf:"bytes,5,opt,name=header_hash,json=headerHash,proto3" json:"header_hash,omitempty"` - PartSetHeader *PartSetHeader `protobuf:"bytes,6,opt,name=part_set_header,json=partSetHeader,proto3" json:"part_set_header,omitempty"` + Height int64 `protobuf:"varint,1,opt,name=height,proto3" json:"height,omitempty"` + Round int32 `protobuf:"varint,2,opt,name=round,proto3" json:"round,omitempty"` + BlockID BlockID `protobuf:"bytes,3,opt,name=block_id,json=blockId,proto3" json:"block_id"` + Signatures []CommitSig `protobuf:"bytes,4,rep,name=signatures,proto3" json:"signatures"` + HeaderHash []byte `protobuf:"bytes,5,opt,name=header_hash,json=headerHash,proto3" json:"header_hash,omitempty"` } func (m *Commit) Reset() { *m = Commit{} } @@ -1170,13 +1161,6 @@ func (m *Commit) GetHeaderHash() []byte { return nil } -func (m *Commit) GetPartSetHeader() *PartSetHeader { - if m != nil { - return m.PartSetHeader - } - return nil -} - // CommitSig is a part of the Vote included in a Commit. type CommitSig struct { BlockIdFlag BlockIDFlag `protobuf:"varint,1,opt,name=block_id_flag,json=blockIdFlag,proto3,enum=tendermint.types.BlockIDFlag" json:"block_id_flag,omitempty"` @@ -1247,15 +1231,14 @@ func (m *CommitSig) GetSignature() []byte { } type Proposal struct { - Type SignedMsgType `protobuf:"varint,1,opt,name=type,proto3,enum=tendermint.types.SignedMsgType" json:"type,omitempty"` - Height int64 `protobuf:"varint,2,opt,name=height,proto3" json:"height,omitempty"` - Round int32 `protobuf:"varint,3,opt,name=round,proto3" json:"round,omitempty"` - PolRound int32 `protobuf:"varint,4,opt,name=pol_round,json=polRound,proto3" json:"pol_round,omitempty"` - BlockID BlockID `protobuf:"bytes,5,opt,name=block_id,json=blockId,proto3" json:"block_id"` - Timestamp time.Time `protobuf:"bytes,6,opt,name=timestamp,proto3,stdtime" json:"timestamp"` - Signature []byte `protobuf:"bytes,7,opt,name=signature,proto3" json:"signature,omitempty"` - DAHeader *DataAvailabilityHeader `protobuf:"bytes,8,opt,name=da_header,json=daHeader,proto3" json:"da_header,omitempty"` - PartSetHeader *PartSetHeader `protobuf:"bytes,9,opt,name=part_set_header,json=partSetHeader,proto3" json:"part_set_header,omitempty"` + Type SignedMsgType `protobuf:"varint,1,opt,name=type,proto3,enum=tendermint.types.SignedMsgType" json:"type,omitempty"` + Height int64 `protobuf:"varint,2,opt,name=height,proto3" json:"height,omitempty"` + Round int32 `protobuf:"varint,3,opt,name=round,proto3" json:"round,omitempty"` + PolRound int32 `protobuf:"varint,4,opt,name=pol_round,json=polRound,proto3" json:"pol_round,omitempty"` + BlockID BlockID `protobuf:"bytes,5,opt,name=block_id,json=blockId,proto3" json:"block_id"` + Timestamp time.Time `protobuf:"bytes,6,opt,name=timestamp,proto3,stdtime" json:"timestamp"` + Signature []byte `protobuf:"bytes,7,opt,name=signature,proto3" json:"signature,omitempty"` + DAHeader *DataAvailabilityHeader `protobuf:"bytes,8,opt,name=da_header,json=daHeader,proto3" json:"da_header,omitempty"` } func (m *Proposal) Reset() { *m = Proposal{} } @@ -1347,13 +1330,6 @@ func (m *Proposal) GetDAHeader() *DataAvailabilityHeader { return nil } -func (m *Proposal) GetPartSetHeader() *PartSetHeader { - if m != nil { - return m.PartSetHeader - } - return nil -} - type SignedHeader struct { Header *Header `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` Commit *Commit `protobuf:"bytes,2,opt,name=commit,proto3" json:"commit,omitempty"` @@ -1467,12 +1443,11 @@ func (m *LightBlock) GetDAHeader() *DataAvailabilityHeader { } type BlockMeta struct { - BlockID BlockID `protobuf:"bytes,1,opt,name=block_id,json=blockId,proto3" json:"block_id"` - BlockSize int64 `protobuf:"varint,2,opt,name=block_size,json=blockSize,proto3" json:"block_size,omitempty"` - Header Header `protobuf:"bytes,3,opt,name=header,proto3" json:"header"` - NumTxs int64 `protobuf:"varint,4,opt,name=num_txs,json=numTxs,proto3" json:"num_txs,omitempty"` - DaHeader *DataAvailabilityHeader `protobuf:"bytes,5,opt,name=da_header,json=daHeader,proto3" json:"da_header,omitempty"` - PartSetHeader *PartSetHeader `protobuf:"bytes,6,opt,name=part_set_header,json=partSetHeader,proto3" json:"part_set_header,omitempty"` + BlockID BlockID `protobuf:"bytes,1,opt,name=block_id,json=blockId,proto3" json:"block_id"` + BlockSize int64 `protobuf:"varint,2,opt,name=block_size,json=blockSize,proto3" json:"block_size,omitempty"` + Header Header `protobuf:"bytes,3,opt,name=header,proto3" json:"header"` + NumTxs int64 `protobuf:"varint,4,opt,name=num_txs,json=numTxs,proto3" json:"num_txs,omitempty"` + DaHeader *DataAvailabilityHeader `protobuf:"bytes,5,opt,name=da_header,json=daHeader,proto3" json:"da_header,omitempty"` } func (m *BlockMeta) Reset() { *m = BlockMeta{} } @@ -1543,13 +1518,6 @@ func (m *BlockMeta) GetDaHeader() *DataAvailabilityHeader { return nil } -func (m *BlockMeta) GetPartSetHeader() *PartSetHeader { - if m != nil { - return m.PartSetHeader - } - return nil -} - // TxProof represents a Merkle proof of the presence of a transaction in the Merkle tree. type TxProof struct { RootHash []byte `protobuf:"bytes,1,opt,name=root_hash,json=rootHash,proto3" json:"root_hash,omitempty"` @@ -1640,127 +1608,125 @@ func init() { func init() { proto.RegisterFile("tendermint/types/types.proto", fileDescriptor_d3a6e55e2345de56) } var fileDescriptor_d3a6e55e2345de56 = []byte{ - // 1910 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x58, 0x4b, 0x73, 0xdb, 0xc8, - 0x11, 0x16, 0xf8, 0x66, 0x93, 0x94, 0xa8, 0x89, 0x24, 0x53, 0xb2, 0x45, 0x31, 0xcc, 0x63, 0xb5, - 0x2f, 0xca, 0xf1, 0xa6, 0xf2, 0xa8, 0xda, 0x6c, 0x2d, 0x29, 0x69, 0x6d, 0x66, 0xf5, 0x60, 0x81, - 0x5a, 0xe5, 0x71, 0x41, 0x0d, 0x89, 0x31, 0x89, 0x18, 0x04, 0x58, 0xc0, 0x50, 0x96, 0x7c, 0xcc, - 0x29, 0xa5, 0x93, 0xff, 0x80, 0x4e, 0xc9, 0x21, 0x95, 0x5b, 0xfe, 0xc5, 0x5e, 0x52, 0xb5, 0xc9, - 0x25, 0xb9, 0xc4, 0x49, 0xc9, 0xb9, 0xe5, 0x94, 0x7f, 0x90, 0x9a, 0x9e, 0x01, 0x08, 0x8a, 0xa4, - 0xe3, 0xa8, 0x54, 0x7b, 0x61, 0x11, 0xdd, 0x5f, 0xf7, 0xf4, 0x7b, 0x1a, 0x80, 0x07, 0x9c, 0x39, - 0x26, 0xf3, 0x06, 0x96, 0xc3, 0x77, 0xf8, 0xc5, 0x90, 0xf9, 0xf2, 0xb7, 0x36, 0xf4, 0x5c, 0xee, - 0x92, 0xe2, 0x98, 0x5b, 0x43, 0xfa, 0xc6, 0x4a, 0xcf, 0xed, 0xb9, 0xc8, 0xdc, 0x11, 0xff, 0x24, - 0x6e, 0x63, 0xab, 0xe7, 0xba, 0x3d, 0x9b, 0xed, 0xe0, 0x53, 0x67, 0xf4, 0x74, 0x87, 0x5b, 0x03, - 0xe6, 0x73, 0x3a, 0x18, 0x2a, 0xc0, 0x66, 0xe4, 0x98, 0xae, 0x77, 0x31, 0xe4, 0xae, 0xc0, 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, 0xf5, 0x25, 0x04, 0xe4, - 0xf1, 0x63, 0x32, 0x02, 0x1f, 0xc2, 0x8a, 0xc3, 0xce, 0xb9, 0x71, 0x13, 0x9d, 0x43, 0x34, 0x11, - 0xbc, 0xd3, 0x49, 0x89, 0xef, 0xc0, 0x62, 0x37, 0xa8, 0x03, 0x89, 0xcd, 0x23, 0xb6, 0x10, 0x52, - 0x11, 0xb6, 0x0e, 0x19, 0x3a, 0x1c, 0x4a, 0x40, 0x01, 0x01, 0x69, 0x3a, 0x1c, 0x22, 0xeb, 0x3d, - 0xc0, 0x88, 0x19, 0x1e, 0xf3, 0x47, 0x36, 0x57, 0x4a, 0x16, 0x11, 0xb3, 0x24, 0x18, 0xba, 0xa4, - 0x23, 0xf6, 0x5b, 0x50, 0x60, 0x67, 0x96, 0xc9, 0x9c, 0x2e, 0x93, 0xb8, 0x25, 0xc4, 0xe5, 0x03, - 0x22, 0x82, 0xde, 0x85, 0xe2, 0xd0, 0x73, 0x87, 0xae, 0xcf, 0x3c, 0x83, 0x9a, 0xa6, 0xc7, 0x7c, - 0xbf, 0x54, 0x94, 0xfa, 0x02, 0x7a, 0x5d, 0x92, 0xab, 0xbf, 0x8e, 0x41, 0x42, 0x04, 0x91, 0x14, - 0x21, 0xce, 0xcf, 0xfd, 0x92, 0x56, 0x89, 0x6f, 0xe7, 0x75, 0xf1, 0x97, 0xf4, 0xa1, 0x64, 0x39, - 0x9c, 0x79, 0x03, 0x66, 0x5a, 0x94, 0x33, 0xc3, 0xe7, 0xe2, 0xd7, 0x73, 0x5d, 0x2e, 0x9b, 0x31, - 0xf7, 0x68, 0x7b, 0xba, 0x12, 0x9a, 0x11, 0x89, 0xb6, 0x10, 0xd0, 0x05, 0x5e, 0x15, 0xd9, 0x9a, - 0x35, 0x93, 0x4b, 0x3e, 0x85, 0x4c, 0x60, 0xbf, 0x6a, 0xe8, 0xf2, 0xb4, 0xe6, 0x7d, 0x85, 0x38, - 0xb0, 0x7c, 0xae, 0xf4, 0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xeb, 0x07, 0xc5, 0xca, 0x46, 0xf1, 0xf2, - 0xaa, 0x92, 0x0f, 0xee, 0x23, 0x81, 0x1f, 0x7b, 0xd6, 0x38, 0xfd, 0xf2, 0xba, 0xac, 0x7d, 0x75, - 0x5d, 0xd6, 0xfe, 0x79, 0x5d, 0xd6, 0x5e, 0xbe, 0x2e, 0x2f, 0x7c, 0xf5, 0xba, 0xbc, 0xf0, 0xb7, - 0xd7, 0xe5, 0x85, 0x5f, 0x7e, 0xdc, 0xb3, 0x78, 0x7f, 0xd4, 0xa9, 0x75, 0xdd, 0xc1, 0x8e, 0x4d, - 0x5f, 0x5c, 0xd8, 0xcc, 0xec, 0x31, 0x2f, 0xf2, 0xf7, 0xc3, 0xae, 0xeb, 0xa9, 0x6f, 0x94, 0x3b, - 0x37, 0x3f, 0x28, 0x76, 0x52, 0x48, 0xff, 0xe8, 0xbf, 0x01, 0x00, 0x00, 0xff, 0xff, 0x0c, 0x11, - 0x7f, 0xd5, 0x11, 0x15, 0x00, 0x00, + // 1879 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x58, 0x4b, 0x6f, 0x1b, 0xc9, + 0x11, 0xd6, 0xf0, 0x21, 0x92, 0x45, 0x52, 0xa2, 0x3a, 0x92, 0x4c, 0xc9, 0x36, 0xc5, 0x30, 0x8f, + 0xd5, 0xbe, 0x28, 0xc7, 0x1b, 0xe4, 0x01, 0x6c, 0x16, 0x4b, 0x4a, 0x5a, 0x9b, 0x59, 0x3d, 0x88, + 0xa1, 0x56, 0x79, 0x5c, 0x06, 0x4d, 0x4e, 0x9b, 0x9c, 0x78, 0x38, 0x3d, 0x98, 0x6e, 0xca, 0x92, + 0x8f, 0x39, 0x6d, 0x74, 0xf2, 0x1f, 0x10, 0x72, 0x48, 0x0e, 0xf9, 0x29, 0x7b, 0x09, 0xb0, 0xb7, + 0xe4, 0x12, 0x27, 0x91, 0x73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15, 0x1b, 0xd3, 0x01, 0xd1, 0x81, 0xd5, 0xa6, 0xe7, 0x85, 0x94, 0x22, 0xd9, 0x68, 0x1b, 0x4a, + 0x52, 0x49, 0x8f, 0x0e, 0x87, 0x0e, 0xb7, 0x64, 0xdc, 0x17, 0x65, 0xdc, 0x97, 0x04, 0x7d, 0x57, + 0x92, 0x1f, 0x8b, 0x13, 0xf8, 0x31, 0x94, 0xbd, 0xd1, 0xd0, 0xa2, 0x81, 0xd3, 0x77, 0x3c, 0xec, + 0x5a, 0x36, 0xe6, 0xd8, 0x62, 0x03, 0x1c, 0x10, 0x56, 0xce, 0x54, 0x8d, 0xed, 0x94, 0xb9, 0xe6, + 0x8d, 0x86, 0xc7, 0x9a, 0xbd, 0x87, 0x39, 0xee, 0x48, 0x26, 0xba, 0x0b, 0x39, 0x89, 0x95, 0xba, + 0xb3, 0x52, 0x77, 0x56, 0x10, 0xa4, 0xd6, 0x77, 0x60, 0x39, 0x4a, 0x57, 0xa6, 0x20, 0x39, 0xb5, + 0xfd, 0x98, 0x2c, 0x81, 0x0f, 0x60, 0xd5, 0x23, 0xe7, 0xdc, 0xba, 0x89, 0x06, 0x89, 0x46, 0x82, + 0x77, 0x3a, 0x29, 0xf1, 0x3d, 0x58, 0xea, 0x85, 0xa7, 0xa6, 0xb0, 0x79, 0x89, 0x2d, 0x46, 0x54, + 0x09, 0xdb, 0x80, 0x2c, 0xf6, 0x7d, 0x05, 0x28, 0x48, 0x40, 0x06, 0xfb, 0xbe, 0x64, 0xbd, 0x07, + 0x2b, 0x32, 0x38, 0x01, 0x61, 0x23, 0x97, 0x6b, 0x25, 0x45, 0x89, 0x59, 0x16, 0x0c, 0x53, 0xd1, + 0x25, 0xf6, 0x3b, 0x50, 0x24, 0x67, 0x8e, 0x4d, 0xbc, 0x1e, 0x51, 0xb8, 0x25, 0x89, 0x2b, 0x84, + 0x44, 0x09, 0x7a, 0x17, 0x4a, 0x7e, 0x40, 0x7d, 0xca, 0x48, 0x60, 0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e, 0x7e, 0xd5, 0xde, 0x8f, 0x79, 0xb7, 0x7c, 0x79, 0x55, 0xcd, 0x6b, 0x97, 0xe6, + 0xa1, 0xdb, 0xe6, 0xfe, 0xe9, 0xf1, 0xc9, 0x7e, 0xc9, 0x50, 0xe8, 0x76, 0x40, 0xc4, 0xcb, 0x41, + 0xa2, 0x1f, 0xc0, 0xc6, 0x0c, 0x74, 0xe4, 0xd8, 0xca, 0xe5, 0x55, 0xb5, 0xd8, 0x0e, 0x88, 0xaa, + 0x6d, 0x29, 0x51, 0x87, 0xf2, 0xb4, 0xc4, 0x71, 0xfb, 0xb8, 0xd3, 0x38, 0x28, 0x55, 0x37, 0x4b, + 0x97, 0x57, 0xd5, 0x42, 0xd8, 0xfd, 0x05, 0x7e, 0xec, 0x59, 0xf3, 0xf4, 0xab, 0xeb, 0x8a, 0xf1, + 0xf5, 0x75, 0xc5, 0xf8, 0xc7, 0x75, 0xc5, 0x78, 0xf1, 0xaa, 0xb2, 0xf0, 0xf5, 0xab, 0xca, 0xc2, + 0x5f, 0x5f, 0x55, 0x16, 0x7e, 0xfd, 0x71, 0xdf, 0xe1, 0x83, 0x51, 0xb7, 0xde, 0xa3, 0xc3, 0x1d, + 0x17, 0x3f, 0xbf, 0x70, 0x89, 0xdd, 0x27, 0x41, 0xec, 0xef, 0x87, 0x3d, 0x1a, 0xe8, 0x8f, 0x6f, + 0x3b, 0x37, 0xbf, 0x94, 0x75, 0x17, 0x25, 0xfd, 0xa3, 0xff, 0x06, 0x00, 0x00, 0xff, 0xff, 0xfb, + 0xec, 0xf0, 0x8b, 0xea, 0x13, 0x00, 0x00, } func (m *PartSetHeader) Marshal() (dAtA []byte, err error) { @@ -1863,6 +1829,16 @@ func (m *BlockID) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + { + size, err := m.PartSetHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 if len(m.Hash) > 0 { i -= len(m.Hash) copy(dAtA[i:], m.Hash) @@ -1898,81 +1874,67 @@ func (m *Header) MarshalToSizedBuffer(dAtA []byte) (int, error) { copy(dAtA[i:], m.ProposerAddress) i = encodeVarintTypes(dAtA, i, uint64(len(m.ProposerAddress))) i-- - dAtA[i] = 0x1 - i-- - dAtA[i] = 0x82 + dAtA[i] = 0x7a } if len(m.EvidenceHash) > 0 { i -= len(m.EvidenceHash) copy(dAtA[i:], m.EvidenceHash) i = encodeVarintTypes(dAtA, i, uint64(len(m.EvidenceHash))) i-- - dAtA[i] = 0x7a + dAtA[i] = 0x72 } if len(m.LastResultsHash) > 0 { i -= len(m.LastResultsHash) copy(dAtA[i:], m.LastResultsHash) i = encodeVarintTypes(dAtA, i, uint64(len(m.LastResultsHash))) i-- - dAtA[i] = 0x72 + dAtA[i] = 0x6a } if len(m.AppHash) > 0 { i -= len(m.AppHash) copy(dAtA[i:], m.AppHash) i = encodeVarintTypes(dAtA, i, uint64(len(m.AppHash))) i-- - dAtA[i] = 0x6a + dAtA[i] = 0x62 } if len(m.ConsensusHash) > 0 { i -= len(m.ConsensusHash) copy(dAtA[i:], m.ConsensusHash) i = encodeVarintTypes(dAtA, i, uint64(len(m.ConsensusHash))) i-- - dAtA[i] = 0x62 + dAtA[i] = 0x5a } if len(m.NextValidatorsHash) > 0 { i -= len(m.NextValidatorsHash) copy(dAtA[i:], m.NextValidatorsHash) i = encodeVarintTypes(dAtA, i, uint64(len(m.NextValidatorsHash))) i-- - dAtA[i] = 0x5a + dAtA[i] = 0x52 } if len(m.ValidatorsHash) > 0 { i -= len(m.ValidatorsHash) copy(dAtA[i:], m.ValidatorsHash) i = encodeVarintTypes(dAtA, i, uint64(len(m.ValidatorsHash))) i-- - dAtA[i] = 0x52 + dAtA[i] = 0x4a } if len(m.DataHash) > 0 { i -= len(m.DataHash) copy(dAtA[i:], m.DataHash) i = encodeVarintTypes(dAtA, i, uint64(len(m.DataHash))) i-- - dAtA[i] = 0x4a + dAtA[i] = 0x42 } if m.NumOriginalDataShares != 0 { i = encodeVarintTypes(dAtA, i, uint64(m.NumOriginalDataShares)) i-- - dAtA[i] = 0x40 + dAtA[i] = 0x38 } if len(m.LastCommitHash) > 0 { i -= len(m.LastCommitHash) copy(dAtA[i:], m.LastCommitHash) i = encodeVarintTypes(dAtA, i, uint64(len(m.LastCommitHash))) i-- - dAtA[i] = 0x3a - } - if m.LastPartSetHeader != nil { - { - size, err := m.LastPartSetHeader.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTypes(dAtA, i, uint64(size)) - } - i-- dAtA[i] = 0x32 } { @@ -2490,18 +2452,6 @@ func (m *Vote) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if m.PartSetHeader != nil { - { - size, err := m.PartSetHeader.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTypes(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x4a - } if len(m.Signature) > 0 { i -= len(m.Signature) copy(dAtA[i:], m.Signature) @@ -2521,12 +2471,12 @@ func (m *Vote) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x32 } - n17, err17 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.Timestamp, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.Timestamp):]) - if err17 != nil { - return 0, err17 + n16, err16 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.Timestamp, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.Timestamp):]) + if err16 != nil { + return 0, err16 } - i -= n17 - i = encodeVarintTypes(dAtA, i, uint64(n17)) + i -= n16 + i = encodeVarintTypes(dAtA, i, uint64(n16)) i-- dAtA[i] = 0x2a { @@ -2577,18 +2527,6 @@ func (m *Commit) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if m.PartSetHeader != nil { - { - size, err := m.PartSetHeader.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTypes(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x32 - } if len(m.HeaderHash) > 0 { i -= len(m.HeaderHash) copy(dAtA[i:], m.HeaderHash) @@ -2660,12 +2598,12 @@ func (m *CommitSig) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x22 } - n21, err21 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.Timestamp, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.Timestamp):]) - if err21 != nil { - return 0, err21 + n19, err19 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.Timestamp, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.Timestamp):]) + if err19 != nil { + return 0, err19 } - i -= n21 - i = encodeVarintTypes(dAtA, i, uint64(n21)) + i -= n19 + i = encodeVarintTypes(dAtA, i, uint64(n19)) i-- dAtA[i] = 0x1a if len(m.ValidatorAddress) > 0 { @@ -2703,18 +2641,6 @@ func (m *Proposal) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if m.PartSetHeader != nil { - { - size, err := m.PartSetHeader.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTypes(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x4a - } if m.DAHeader != nil { { size, err := m.DAHeader.MarshalToSizedBuffer(dAtA[:i]) @@ -2734,12 +2660,12 @@ func (m *Proposal) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x3a } - n24, err24 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.Timestamp, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.Timestamp):]) - if err24 != nil { - return 0, err24 + n21, err21 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.Timestamp, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.Timestamp):]) + if err21 != nil { + return 0, err21 } - i -= n24 - i = encodeVarintTypes(dAtA, i, uint64(n24)) + i -= n21 + i = encodeVarintTypes(dAtA, i, uint64(n21)) i-- dAtA[i] = 0x32 { @@ -2901,18 +2827,6 @@ func (m *BlockMeta) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if m.PartSetHeader != nil { - { - size, err := m.PartSetHeader.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTypes(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x32 - } if m.DaHeader != nil { { size, err := m.DaHeader.MarshalToSizedBuffer(dAtA[:i]) @@ -3062,6 +2976,8 @@ func (m *BlockID) Size() (n int) { if l > 0 { n += 1 + l + sovTypes(uint64(l)) } + l = m.PartSetHeader.Size() + n += 1 + l + sovTypes(uint64(l)) return n } @@ -3084,10 +3000,6 @@ func (m *Header) Size() (n int) { n += 1 + l + sovTypes(uint64(l)) l = m.LastBlockId.Size() n += 1 + l + sovTypes(uint64(l)) - if m.LastPartSetHeader != nil { - l = m.LastPartSetHeader.Size() - n += 1 + l + sovTypes(uint64(l)) - } l = len(m.LastCommitHash) if l > 0 { n += 1 + l + sovTypes(uint64(l)) @@ -3125,7 +3037,7 @@ func (m *Header) Size() (n int) { } l = len(m.ProposerAddress) if l > 0 { - n += 2 + l + sovTypes(uint64(l)) + n += 1 + l + sovTypes(uint64(l)) } return n } @@ -3352,10 +3264,6 @@ func (m *Vote) Size() (n int) { if l > 0 { n += 1 + l + sovTypes(uint64(l)) } - if m.PartSetHeader != nil { - l = m.PartSetHeader.Size() - n += 1 + l + sovTypes(uint64(l)) - } return n } @@ -3383,10 +3291,6 @@ func (m *Commit) Size() (n int) { if l > 0 { n += 1 + l + sovTypes(uint64(l)) } - if m.PartSetHeader != nil { - l = m.PartSetHeader.Size() - n += 1 + l + sovTypes(uint64(l)) - } return n } @@ -3442,10 +3346,6 @@ func (m *Proposal) Size() (n int) { l = m.DAHeader.Size() n += 1 + l + sovTypes(uint64(l)) } - if m.PartSetHeader != nil { - l = m.PartSetHeader.Size() - n += 1 + l + sovTypes(uint64(l)) - } return n } @@ -3507,10 +3407,6 @@ func (m *BlockMeta) Size() (n int) { l = m.DaHeader.Size() n += 1 + l + sovTypes(uint64(l)) } - if m.PartSetHeader != nil { - l = m.PartSetHeader.Size() - n += 1 + l + sovTypes(uint64(l)) - } return n } @@ -3629,7 +3525,10 @@ func (m *PartSetHeader) Unmarshal(dAtA []byte) error { if err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { return ErrInvalidLengthTypes } if (iNdEx + skippy) > l { @@ -3765,7 +3664,10 @@ func (m *Part) Unmarshal(dAtA []byte) error { if err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { return ErrInvalidLengthTypes } if (iNdEx + skippy) > l { @@ -3843,13 +3745,49 @@ func (m *BlockID) Unmarshal(dAtA []byte) error { m.Hash = []byte{} } iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PartSetHeader", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.PartSetHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipTypes(dAtA[iNdEx:]) if err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { return ErrInvalidLengthTypes } if (iNdEx + skippy) > l { @@ -4044,42 +3982,6 @@ func (m *Header) Unmarshal(dAtA []byte) error { } iNdEx = postIndex case 6: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field LastPartSetHeader", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.LastPartSetHeader == nil { - m.LastPartSetHeader = &PartSetHeader{} - } - if err := m.LastPartSetHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 7: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field LastCommitHash", wireType) } @@ -4113,7 +4015,7 @@ func (m *Header) Unmarshal(dAtA []byte) error { m.LastCommitHash = []byte{} } iNdEx = postIndex - case 8: + case 7: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field NumOriginalDataShares", wireType) } @@ -4132,7 +4034,7 @@ func (m *Header) Unmarshal(dAtA []byte) error { break } } - case 9: + case 8: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field DataHash", wireType) } @@ -4166,7 +4068,7 @@ func (m *Header) Unmarshal(dAtA []byte) error { m.DataHash = []byte{} } iNdEx = postIndex - case 10: + case 9: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field ValidatorsHash", wireType) } @@ -4200,7 +4102,7 @@ func (m *Header) Unmarshal(dAtA []byte) error { m.ValidatorsHash = []byte{} } iNdEx = postIndex - case 11: + case 10: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field NextValidatorsHash", wireType) } @@ -4234,7 +4136,7 @@ func (m *Header) Unmarshal(dAtA []byte) error { m.NextValidatorsHash = []byte{} } iNdEx = postIndex - case 12: + case 11: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field ConsensusHash", wireType) } @@ -4268,7 +4170,7 @@ func (m *Header) Unmarshal(dAtA []byte) error { m.ConsensusHash = []byte{} } iNdEx = postIndex - case 13: + case 12: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field AppHash", wireType) } @@ -4302,7 +4204,7 @@ func (m *Header) Unmarshal(dAtA []byte) error { m.AppHash = []byte{} } iNdEx = postIndex - case 14: + case 13: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field LastResultsHash", wireType) } @@ -4336,7 +4238,7 @@ func (m *Header) Unmarshal(dAtA []byte) error { m.LastResultsHash = []byte{} } iNdEx = postIndex - case 15: + case 14: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field EvidenceHash", wireType) } @@ -4370,7 +4272,7 @@ func (m *Header) Unmarshal(dAtA []byte) error { m.EvidenceHash = []byte{} } iNdEx = postIndex - case 16: + case 15: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field ProposerAddress", wireType) } @@ -4410,7 +4312,10 @@ func (m *Header) Unmarshal(dAtA []byte) error { if err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { return ErrInvalidLengthTypes } if (iNdEx + skippy) > l { @@ -4591,7 +4496,10 @@ func (m *Data) Unmarshal(dAtA []byte) error { if err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { return ErrInvalidLengthTypes } if (iNdEx + skippy) > l { @@ -4711,7 +4619,10 @@ func (m *Evidence) Unmarshal(dAtA []byte) error { if err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { return ErrInvalidLengthTypes } if (iNdEx + skippy) > l { @@ -4904,7 +4815,10 @@ func (m *DuplicateVoteEvidence) Unmarshal(dAtA []byte) error { if err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { return ErrInvalidLengthTypes } if (iNdEx + skippy) > l { @@ -5095,7 +5009,10 @@ func (m *LightClientAttackEvidence) Unmarshal(dAtA []byte) error { if err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { return ErrInvalidLengthTypes } if (iNdEx + skippy) > l { @@ -5179,7 +5096,10 @@ func (m *EvidenceList) Unmarshal(dAtA []byte) error { if err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { return ErrInvalidLengthTypes } if (iNdEx + skippy) > l { @@ -5261,7 +5181,10 @@ func (m *IntermediateStateRoots) Unmarshal(dAtA []byte) error { if err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { return ErrInvalidLengthTypes } if (iNdEx + skippy) > l { @@ -5345,7 +5268,10 @@ func (m *Messages) Unmarshal(dAtA []byte) error { if err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { return ErrInvalidLengthTypes } if (iNdEx + skippy) > l { @@ -5463,7 +5389,10 @@ func (m *Message) Unmarshal(dAtA []byte) error { if err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { return ErrInvalidLengthTypes } if (iNdEx + skippy) > l { @@ -5577,7 +5506,10 @@ func (m *DataAvailabilityHeader) Unmarshal(dAtA []byte) error { if err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { return ErrInvalidLengthTypes } if (iNdEx + skippy) > l { @@ -5831,49 +5763,16 @@ func (m *Vote) Unmarshal(dAtA []byte) error { m.Signature = []byte{} } iNdEx = postIndex - case 9: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field PartSetHeader", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.PartSetHeader == nil { - m.PartSetHeader = &PartSetHeader{} - } - if err := m.PartSetHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipTypes(dAtA[iNdEx:]) if err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { return ErrInvalidLengthTypes } if (iNdEx + skippy) > l { @@ -6056,49 +5955,16 @@ func (m *Commit) Unmarshal(dAtA []byte) error { m.HeaderHash = []byte{} } iNdEx = postIndex - case 6: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field PartSetHeader", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.PartSetHeader == nil { - m.PartSetHeader = &PartSetHeader{} - } - if err := m.PartSetHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipTypes(dAtA[iNdEx:]) if err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { return ErrInvalidLengthTypes } if (iNdEx + skippy) > l { @@ -6268,7 +6134,10 @@ func (m *CommitSig) Unmarshal(dAtA []byte) error { if err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { return ErrInvalidLengthTypes } if (iNdEx + skippy) > l { @@ -6524,49 +6393,16 @@ func (m *Proposal) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 9: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field PartSetHeader", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.PartSetHeader == nil { - m.PartSetHeader = &PartSetHeader{} - } - if err := m.PartSetHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipTypes(dAtA[iNdEx:]) if err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { return ErrInvalidLengthTypes } if (iNdEx + skippy) > l { @@ -6688,7 +6524,10 @@ func (m *SignedHeader) Unmarshal(dAtA []byte) error { if err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { return ErrInvalidLengthTypes } if (iNdEx + skippy) > l { @@ -6846,7 +6685,10 @@ func (m *LightBlock) Unmarshal(dAtA []byte) error { if err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { return ErrInvalidLengthTypes } if (iNdEx + skippy) > l { @@ -7030,49 +6872,16 @@ func (m *BlockMeta) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 6: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field PartSetHeader", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.PartSetHeader == nil { - m.PartSetHeader = &PartSetHeader{} - } - if err := m.PartSetHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipTypes(dAtA[iNdEx:]) if err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { return ErrInvalidLengthTypes } if (iNdEx + skippy) > l { @@ -7226,7 +7035,10 @@ func (m *TxProof) Unmarshal(dAtA []byte) error { if err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { return ErrInvalidLengthTypes } if (iNdEx + skippy) > l { diff --git a/proto/tendermint/types/types.proto b/proto/tendermint/types/types.proto index e290222e96..bfeef6c942 100644 --- a/proto/tendermint/types/types.proto +++ b/proto/tendermint/types/types.proto @@ -49,6 +49,7 @@ message Part { // BlockID message BlockID { bytes hash = 1; + PartSetHeader part_set_header = 2 [(gogoproto.nullable) = false]; } // -------------------------------- @@ -63,23 +64,22 @@ message Header { // prev block info BlockID last_block_id = 5 [(gogoproto.nullable) = false]; - PartSetHeader last_part_set_header = 6; // hashes of block data - bytes last_commit_hash = 7; // commit from validators from the last block - uint64 num_original_data_shares = 8; // number of shares used in the original data square - bytes data_hash = 9; // transactions + bytes last_commit_hash = 6; // commit from validators from the last block + uint64 num_original_data_shares = 7; // number of shares used in the original data square + bytes data_hash = 8; // transactions // hashes from the app output from the prev block - bytes validators_hash = 10; // validators for the current block - bytes next_validators_hash = 11; // validators for the next block - bytes consensus_hash = 12; // consensus params for current block - bytes app_hash = 13; // state after txs from the previous block - bytes last_results_hash = 14; // root hash of all results from the txs from the previous block + bytes validators_hash = 9; // validators for the current block + bytes next_validators_hash = 10; // validators for the next block + bytes consensus_hash = 11; // consensus params for current block + bytes app_hash = 12; // state after txs from the previous block + bytes last_results_hash = 13; // root hash of all results from the txs from the previous block // consensus info - bytes evidence_hash = 15; // evidence included in the block - bytes proposer_address = 16; // original proposer of the block + bytes evidence_hash = 14; // evidence included in the block + bytes proposer_address = 15; // original proposer of the block } // Data contains the set of transactions included in the block @@ -165,7 +165,6 @@ message Vote { bytes validator_address = 6; int32 validator_index = 7; bytes signature = 8; - PartSetHeader part_set_header = 9; } // Commit contains the evidence that a block was committed by a set of validators. @@ -175,7 +174,6 @@ message Commit { BlockID block_id = 3 [(gogoproto.nullable) = false, (gogoproto.customname) = "BlockID"]; repeated CommitSig signatures = 4 [(gogoproto.nullable) = false]; bytes header_hash = 5; - PartSetHeader part_set_header = 6; } // CommitSig is a part of the Vote included in a Commit. @@ -197,7 +195,6 @@ message Proposal { [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; bytes signature = 7; DataAvailabilityHeader da_header = 8 [(gogoproto.customname) = "DAHeader"]; - PartSetHeader part_set_header = 9; } message SignedHeader { @@ -217,7 +214,6 @@ message BlockMeta { Header header = 3 [(gogoproto.nullable) = false]; int64 num_txs = 4; DataAvailabilityHeader da_header = 5; - PartSetHeader part_set_header = 6; } // TxProof represents a Merkle proof of the presence of a transaction in the Merkle tree. diff --git a/proto/tendermint/types/validator.pb.go b/proto/tendermint/types/validator.pb.go index 1cdfcc3a80..402ebed6f3 100644 --- a/proto/tendermint/types/validator.pb.go +++ b/proto/tendermint/types/validator.pb.go @@ -584,7 +584,10 @@ func (m *ValidatorSet) Unmarshal(dAtA []byte) error { if err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { + if skippy < 0 { + return ErrInvalidLengthValidator + } + if (iNdEx + skippy) < 0 { return ErrInvalidLengthValidator } if (iNdEx + skippy) > l { @@ -739,7 +742,10 @@ func (m *Validator) Unmarshal(dAtA []byte) error { if err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { + if skippy < 0 { + return ErrInvalidLengthValidator + } + if (iNdEx + skippy) < 0 { return ErrInvalidLengthValidator } if (iNdEx + skippy) > l { @@ -844,7 +850,10 @@ func (m *SimpleValidator) Unmarshal(dAtA []byte) error { if err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { + if skippy < 0 { + return ErrInvalidLengthValidator + } + if (iNdEx + skippy) < 0 { return ErrInvalidLengthValidator } if (iNdEx + skippy) > l { diff --git a/proto/tendermint/version/types.pb.go b/proto/tendermint/version/types.pb.go index 62d4f06ddb..e5111738c4 100644 --- a/proto/tendermint/version/types.pb.go +++ b/proto/tendermint/version/types.pb.go @@ -266,7 +266,10 @@ func (m *Consensus) Unmarshal(dAtA []byte) error { if err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { return ErrInvalidLengthTypes } if (iNdEx + skippy) > l { diff --git a/rpc/client/evidence_test.go b/rpc/client/evidence_test.go index e5b2521069..9bf0e4fbaf 100644 --- a/rpc/client/evidence_test.go +++ b/rpc/client/evidence_test.go @@ -62,10 +62,10 @@ func makeEvidences( Timestamp: defaultTestTime, BlockID: types.BlockID{ Hash: tmhash.Sum(tmrand.Bytes(tmhash.Size)), - }, - PartSetHeader: types.PartSetHeader{ - Total: 1000, - Hash: tmhash.Sum([]byte("partset")), + PartSetHeader: types.PartSetHeader{ + Total: 1000, + Hash: tmhash.Sum([]byte("partset")), + }, }, } diff --git a/rpc/grpc/types.pb.go b/rpc/grpc/types.pb.go index 9f10ae5ca0..a51d818d9e 100644 --- a/rpc/grpc/types.pb.go +++ b/rpc/grpc/types.pb.go @@ -568,7 +568,10 @@ func (m *RequestPing) Unmarshal(dAtA []byte) error { if err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { return ErrInvalidLengthTypes } if (iNdEx + skippy) > l { @@ -652,7 +655,10 @@ func (m *RequestBroadcastTx) Unmarshal(dAtA []byte) error { if err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { return ErrInvalidLengthTypes } if (iNdEx + skippy) > l { @@ -702,7 +708,10 @@ func (m *ResponsePing) Unmarshal(dAtA []byte) error { if err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { return ErrInvalidLengthTypes } if (iNdEx + skippy) > l { @@ -824,7 +833,10 @@ func (m *ResponseBroadcastTx) Unmarshal(dAtA []byte) error { if err != nil { return err } - if (skippy < 0) || (iNdEx+skippy) < 0 { + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { return ErrInvalidLengthTypes } if (iNdEx + skippy) > l { diff --git a/state/execution.go b/state/execution.go index 0f0e1d4126..e338057724 100644 --- a/state/execution.go +++ b/state/execution.go @@ -177,10 +177,7 @@ func (blockExec *BlockExecutor) ValidateBlock(state State, block *types.Block) e // from outside this package to process and commit an entire block. // It takes a blockID to avoid recomputing the parts hash. func (blockExec *BlockExecutor) ApplyBlock( - state State, - blockID types.BlockID, - partSetHeader types.PartSetHeader, - block *types.Block, + state State, blockID types.BlockID, block *types.Block, ) (State, int64, error) { if err := validateBlock(state, block); err != nil { @@ -220,7 +217,7 @@ func (blockExec *BlockExecutor) ApplyBlock( } // Update the state with the block and responses. - state, err = updateState(state, blockID, partSetHeader, &block.Header, abciResponses, validatorUpdates) + state, err = updateState(state, blockID, &block.Header, abciResponses, validatorUpdates) if err != nil { return state, 0, fmt.Errorf("commit failed for application: %v", err) } @@ -456,7 +453,6 @@ func validateValidatorUpdates(abciUpdates []abci.ValidatorUpdate, func updateState( state State, blockID types.BlockID, - partSetHeader types.PartSetHeader, header *types.Header, abciResponses *tmstate.ABCIResponses, validatorUpdates []*types.Validator, @@ -507,7 +503,6 @@ func updateState( InitialHeight: state.InitialHeight, LastBlockHeight: header.Height, LastBlockID: blockID, - LastPartSetHeader: partSetHeader, LastBlockTime: header.Time, NextValidators: nValSet, Validators: state.NextValidators.Copy(), diff --git a/state/execution_test.go b/state/execution_test.go index 112bd06e2b..a177e361ae 100644 --- a/state/execution_test.go +++ b/state/execution_test.go @@ -47,10 +47,9 @@ func TestApplyBlock(t *testing.T) { mmock.Mempool{}, sm.EmptyEvidencePool{}) block := makeBlock(state, 1) - blockID := types.BlockID{Hash: block.Hash()} - psh := block.MakePartSet(testPartSize).Header() + blockID := types.BlockID{Hash: block.Hash(), PartSetHeader: block.MakePartSet(testPartSize).Header()} - state, retainHeight, err := blockExec.ApplyBlock(state, blockID, psh, block) + state, retainHeight, err := blockExec.ApplyBlock(state, blockID, block) require.Nil(t, err) assert.EqualValues(t, retainHeight, 1) @@ -72,7 +71,7 @@ func TestBeginBlockValidators(t *testing.T) { prevHash := state.LastBlockID.Hash prevParts := types.PartSetHeader{} - prevBlockID := types.BlockID{Hash: prevHash} + prevBlockID := types.BlockID{Hash: prevHash, PartSetHeader: prevParts} var ( now = tmtime.Now() @@ -98,7 +97,7 @@ func TestBeginBlockValidators(t *testing.T) { } for _, tc := range testCases { - lastCommit := types.NewCommit(1, 0, prevBlockID, tc.lastCommitSigs, prevParts) + lastCommit := types.NewCommit(1, 0, prevBlockID, tc.lastCommitSigs) // block for height 2 block, _ := state.MakeBlock(2, makeTxs(2), nil, nil, @@ -136,7 +135,7 @@ func TestBeginBlockByzantineValidators(t *testing.T) { defaultEvidenceTime := time.Date(2019, 1, 1, 0, 0, 0, 0, time.UTC) privVal := privVals[state.Validators.Validators[0].Address.String()] - blockID := makeBlockID([]byte("headerhash")) + blockID := makeBlockID([]byte("headerhash"), 1000, []byte("partshash")) header := &types.Header{ Version: tmversion.Consensus{Block: version.BlockProtocol, App: 1}, ChainID: state.ChainID, @@ -157,18 +156,16 @@ func TestBeginBlockByzantineValidators(t *testing.T) { // we don't need to worry about validating the evidence as long as they pass validate basic dve := types.NewMockDuplicateVoteEvidenceWithValidator(3, defaultEvidenceTime, privVal, state.ChainID) dve.ValidatorPower = 1000 - bID := makeBlockID(header.Hash()) - psH := makePartSetHeader(100, []byte("partshash")) lcae := &types.LightClientAttackEvidence{ ConflictingBlock: &types.LightBlock{ SignedHeader: &types.SignedHeader{ Header: header, - Commit: types.NewCommit(10, 0, bID, []types.CommitSig{{ + Commit: types.NewCommit(10, 0, makeBlockID(header.Hash(), 100, []byte("partshash")), []types.CommitSig{{ BlockIDFlag: types.BlockIDFlagNil, ValidatorAddress: crypto.AddressHash([]byte("validator_address")), Timestamp: defaultEvidenceTime, Signature: crypto.CRandBytes(types.MaxSignatureSize), - }}, psH), + }}), }, ValidatorSet: state.Validators, }, @@ -208,10 +205,9 @@ func TestBeginBlockByzantineValidators(t *testing.T) { block := makeBlock(state, 1) block.Evidence = types.EvidenceData{Evidence: ev} block.Header.EvidenceHash = block.Evidence.Hash() - blockID = types.BlockID{Hash: block.Hash()} - psh := block.MakePartSet(testPartSize).Header() + blockID = types.BlockID{Hash: block.Hash(), PartSetHeader: block.MakePartSet(testPartSize).Header()} - state, retainHeight, err := blockExec.ApplyBlock(state, blockID, psh, block) + state, retainHeight, err := blockExec.ApplyBlock(state, blockID, block) require.Nil(t, err) assert.EqualValues(t, retainHeight, 1) @@ -384,8 +380,7 @@ func TestEndBlockValidatorUpdates(t *testing.T) { require.NoError(t, err) block := makeBlock(state, 1) - blockID := types.BlockID{Hash: block.Hash()} - psh := block.MakePartSet(testPartSize).Header() + blockID := types.BlockID{Hash: block.Hash(), PartSetHeader: block.MakePartSet(testPartSize).Header()} pubkey := ed25519.GenPrivKey().PubKey() pk, err := cryptoenc.PubKeyToProto(pubkey) @@ -394,7 +389,7 @@ func TestEndBlockValidatorUpdates(t *testing.T) { {PubKey: pk, Power: 10}, } - state, _, err = blockExec.ApplyBlock(state, blockID, psh, block) + state, _, err = blockExec.ApplyBlock(state, blockID, block) require.Nil(t, err) // test new validator was added to NextValidators if assert.Equal(t, state.Validators.Size()+1, state.NextValidators.Size()) { @@ -441,8 +436,7 @@ func TestEndBlockValidatorUpdatesResultingInEmptySet(t *testing.T) { ) block := makeBlock(state, 1) - blockID := types.BlockID{Hash: block.Hash()} - psh := block.MakePartSet(testPartSize).Header() + blockID := types.BlockID{Hash: block.Hash(), PartSetHeader: block.MakePartSet(testPartSize).Header()} vp, err := cryptoenc.PubKeyToProto(state.Validators.Validators[0].PubKey) require.NoError(t, err) @@ -451,26 +445,23 @@ func TestEndBlockValidatorUpdatesResultingInEmptySet(t *testing.T) { {PubKey: vp, Power: 0}, } - assert.NotPanics(t, func() { state, _, err = blockExec.ApplyBlock(state, blockID, psh, block) }) + assert.NotPanics(t, func() { state, _, err = blockExec.ApplyBlock(state, blockID, block) }) assert.NotNil(t, err) assert.NotEmpty(t, state.NextValidators.Validators) } -func makeBlockID(hash []byte) types.BlockID { +func makeBlockID(hash []byte, partSetSize uint32, partSetHash []byte) types.BlockID { var ( - h = make([]byte, tmhash.Size) + h = make([]byte, tmhash.Size) + psH = make([]byte, tmhash.Size) ) copy(h, hash) + copy(psH, partSetHash) return types.BlockID{ Hash: h, - } -} - -func makePartSetHeader(partSetSize uint32, partSetHash []byte) types.PartSetHeader { - var psH = make([]byte, tmhash.Size) - copy(psH, partSetHash) - return types.PartSetHeader{ - Total: partSetSize, - Hash: psH, + PartSetHeader: types.PartSetHeader{ + Total: partSetSize, + Hash: psH, + }, } } diff --git a/state/export_test.go b/state/export_test.go index d5335421d4..39fd191a6a 100644 --- a/state/export_test.go +++ b/state/export_test.go @@ -26,12 +26,11 @@ const ValSetCheckpointInterval = valSetCheckpointInterval func UpdateState( state State, blockID types.BlockID, - partSetHeader types.PartSetHeader, header *types.Header, abciResponses *tmstate.ABCIResponses, validatorUpdates []*types.Validator, ) (State, error) { - return updateState(state, blockID, partSetHeader, header, abciResponses, validatorUpdates) + return updateState(state, blockID, header, abciResponses, validatorUpdates) } // ValidateValidatorUpdates is an alias for validateValidatorUpdates exported diff --git a/state/helpers_test.go b/state/helpers_test.go index fb643a0795..a91b3b5a14 100644 --- a/state/helpers_test.go +++ b/state/helpers_test.go @@ -37,24 +37,23 @@ func makeAndCommitGoodBlock( proposerAddr []byte, blockExec *sm.BlockExecutor, privVals map[string]types.PrivValidator, - evidence []types.Evidence, -) (sm.State, types.BlockID, types.PartSetHeader, *types.Commit, error) { + evidence []types.Evidence) (sm.State, types.BlockID, *types.Commit, error) { // A good block passes - state, blockID, psh, err := makeAndApplyGoodBlock(state, height, lastCommit, proposerAddr, blockExec, evidence) + state, blockID, err := makeAndApplyGoodBlock(state, height, lastCommit, proposerAddr, blockExec, evidence) if err != nil { - return state, types.BlockID{}, types.PartSetHeader{}, nil, err + return state, types.BlockID{}, nil, err } // Simulate a lastCommit for this block from all validators for the next height - commit, err := makeValidCommit(height, blockID, psh, state.Validators, privVals) + commit, err := makeValidCommit(height, blockID, state.Validators, privVals) if err != nil { - return state, types.BlockID{}, types.PartSetHeader{}, nil, err + return state, types.BlockID{}, nil, err } - return state, blockID, psh, commit, nil + return state, blockID, commit, nil } func makeAndApplyGoodBlock(state sm.State, height int64, lastCommit *types.Commit, proposerAddr []byte, - blockExec *sm.BlockExecutor, evidence []types.Evidence) (sm.State, types.BlockID, types.PartSetHeader, error) { + blockExec *sm.BlockExecutor, evidence []types.Evidence) (sm.State, types.BlockID, error) { block, _ := state.MakeBlock( height, makeTxs(height), @@ -65,34 +64,33 @@ func makeAndApplyGoodBlock(state sm.State, height int64, lastCommit *types.Commi proposerAddr, ) if err := blockExec.ValidateBlock(state, block); err != nil { - return state, types.BlockID{}, types.PartSetHeader{}, err + return state, types.BlockID{}, err } - blockID := types.BlockID{Hash: block.Hash()} - psh := types.PartSetHeader{Total: 3, Hash: tmrand.Bytes(32)} - state, _, err := blockExec.ApplyBlock(state, blockID, psh, block) + blockID := types.BlockID{Hash: block.Hash(), + PartSetHeader: types.PartSetHeader{Total: 3, Hash: tmrand.Bytes(32)}} + state, _, err := blockExec.ApplyBlock(state, blockID, block) if err != nil { - return state, types.BlockID{}, types.PartSetHeader{}, err + return state, types.BlockID{}, err } - return state, blockID, psh, nil + return state, blockID, nil } func makeValidCommit( height int64, blockID types.BlockID, - partSetHeader types.PartSetHeader, vals *types.ValidatorSet, privVals map[string]types.PrivValidator, ) (*types.Commit, error) { sigs := make([]types.CommitSig, 0) for i := 0; i < vals.Size(); i++ { _, val := vals.GetByIndex(int32(i)) - vote, err := types.MakeVote(height, blockID, partSetHeader, vals, privVals[val.Address.String()], chainID, time.Now()) + vote, err := types.MakeVote(height, blockID, vals, privVals[val.Address.String()], chainID, time.Now()) if err != nil { return nil, err } sigs = append(sigs, vote.CommitSig()) } - return types.NewCommit(height, 0, blockID, sigs, partSetHeader), nil + return types.NewCommit(height, 0, blockID, sigs), nil } // make some bogus txs @@ -182,7 +180,8 @@ func makeHeaderPartsResponsesValPubKeyChange( }, } } - return block.Header, types.BlockID{Hash: block.Hash()}, abciResponses + + return block.Header, types.BlockID{Hash: block.Hash(), PartSetHeader: types.PartSetHeader{}}, abciResponses } func makeHeaderPartsResponsesValPowerChange( @@ -205,7 +204,8 @@ func makeHeaderPartsResponsesValPowerChange( }, } } - return block.Header, types.BlockID{Hash: block.Hash()}, abciResponses + + return block.Header, types.BlockID{Hash: block.Hash(), PartSetHeader: types.PartSetHeader{}}, abciResponses } func makeHeaderPartsResponsesParams( @@ -218,7 +218,7 @@ func makeHeaderPartsResponsesParams( BeginBlock: &abci.ResponseBeginBlock{}, EndBlock: &abci.ResponseEndBlock{ConsensusParamUpdates: types.TM2PB.ConsensusParams(¶ms)}, } - return block.Header, types.BlockID{Hash: block.Hash()}, abciResponses + return block.Header, types.BlockID{Hash: block.Hash(), PartSetHeader: types.PartSetHeader{}}, abciResponses } func randomGenesisDoc() *types.GenesisDoc { diff --git a/state/state.go b/state/state.go index ab91764e02..aaaea6e8b2 100644 --- a/state/state.go +++ b/state/state.go @@ -54,10 +54,9 @@ type State struct { InitialHeight int64 // should be 1, not 0, when starting from height 1 // LastBlockHeight=0 at genesis (ie. block(H=0) does not exist) - LastBlockHeight int64 - LastBlockID types.BlockID - LastPartSetHeader types.PartSetHeader - LastBlockTime time.Time + LastBlockHeight int64 + LastBlockID types.BlockID + LastBlockTime time.Time // LastValidators is used to validate block.LastCommit. // Validators are persisted to the database separately every time they change, @@ -90,10 +89,9 @@ func (state State) Copy() State { ChainID: state.ChainID, InitialHeight: state.InitialHeight, - LastBlockHeight: state.LastBlockHeight, - LastBlockID: state.LastBlockID, - LastPartSetHeader: state.LastPartSetHeader, - LastBlockTime: state.LastBlockTime, + LastBlockHeight: state.LastBlockHeight, + LastBlockID: state.LastBlockID, + LastBlockTime: state.LastBlockTime, NextValidators: state.NextValidators.Copy(), Validators: state.Validators.Copy(), @@ -148,8 +146,6 @@ func (state *State) ToProto() (*tmstate.State, error) { sm.LastBlockHeight = state.LastBlockHeight sm.LastBlockID = state.LastBlockID.ToProto() - lpsh := state.LastPartSetHeader.ToProto() - sm.LastPartSetHeader = &lpsh sm.LastBlockTime = state.LastBlockTime vals, err := state.Validators.ToProto() if err != nil { @@ -197,13 +193,6 @@ func StateFromProto(pb *tmstate.State) (*State, error) { //nolint:golint return nil, err } state.LastBlockID = *bi - - lpsh, err := types.PartSetHeaderFromProto(pb.LastPartSetHeader) - if err != nil { - return nil, err - } - state.LastPartSetHeader = *lpsh - state.LastBlockHeight = pb.LastBlockHeight state.LastBlockTime = pb.LastBlockTime @@ -268,7 +257,7 @@ func (state State) MakeBlock( // Fill rest of header with state data. block.Header.Populate( state.Version.Consensus, state.ChainID, - timestamp, state.LastBlockID, state.LastPartSetHeader, + timestamp, state.LastBlockID, state.Validators.Hash(), state.NextValidators.Hash(), types.HashConsensusParams(state.ConsensusParams), state.AppHash, state.LastResultsHash, proposerAddress, @@ -353,10 +342,9 @@ func MakeGenesisState(genDoc *types.GenesisDoc) (State, error) { ChainID: genDoc.ChainID, InitialHeight: genDoc.InitialHeight, - LastBlockHeight: 0, - LastBlockID: types.BlockID{}, - LastPartSetHeader: types.PartSetHeader{}, - LastBlockTime: genDoc.GenesisTime, + LastBlockHeight: 0, + LastBlockID: types.BlockID{}, + LastBlockTime: genDoc.GenesisTime, NextValidators: nextValidatorSet, Validators: validatorSet, diff --git a/state/state_test.go b/state/state_test.go index 855957b0b7..dcaf6b2ebf 100644 --- a/state/state_test.go +++ b/state/state_test.go @@ -271,7 +271,7 @@ func TestOneValidatorChangesSaveLoad(t *testing.T) { header, blockID, responses := makeHeaderPartsResponsesValPowerChange(state, power) validatorUpdates, err = types.PB2TM.ValidatorUpdates(responses.EndBlock.ValidatorUpdates) require.NoError(t, err) - state, err = sm.UpdateState(state, blockID, types.PartSetHeader{}, &header, responses, validatorUpdates) + state, err = sm.UpdateState(state, blockID, &header, responses, validatorUpdates) require.NoError(t, err) err := stateStore.Save(state) require.NoError(t, err) @@ -443,15 +443,14 @@ func TestProposerPriorityDoesNotGetResetToZero(t *testing.T) { assert.EqualValues(t, 0, val1.ProposerPriority) block := makeBlock(state, state.LastBlockHeight+1) - blockID := types.BlockID{Hash: block.Hash()} - psh := block.MakePartSet(testPartSize).Header() + blockID := types.BlockID{Hash: block.Hash(), PartSetHeader: block.MakePartSet(testPartSize).Header()} abciResponses := &tmstate.ABCIResponses{ BeginBlock: &abci.ResponseBeginBlock{}, EndBlock: &abci.ResponseEndBlock{ValidatorUpdates: nil}, } validatorUpdates, err := types.PB2TM.ValidatorUpdates(abciResponses.EndBlock.ValidatorUpdates) require.NoError(t, err) - updatedState, err := sm.UpdateState(state, blockID, psh, &block.Header, abciResponses, validatorUpdates) + updatedState, err := sm.UpdateState(state, blockID, &block.Header, abciResponses, validatorUpdates) assert.NoError(t, err) curTotal := val1VotingPower // one increment step and one validator: 0 + power - total_power == 0 @@ -466,7 +465,7 @@ func TestProposerPriorityDoesNotGetResetToZero(t *testing.T) { updateAddVal := abci.ValidatorUpdate{PubKey: fvp, Power: val2VotingPower} validatorUpdates, err = types.PB2TM.ValidatorUpdates([]abci.ValidatorUpdate{updateAddVal}) assert.NoError(t, err) - updatedState2, err := sm.UpdateState(updatedState, blockID, psh, &block.Header, abciResponses, validatorUpdates) + updatedState2, err := sm.UpdateState(updatedState, blockID, &block.Header, abciResponses, validatorUpdates) assert.NoError(t, err) require.Equal(t, len(updatedState2.NextValidators.Validators), 2) @@ -505,14 +504,7 @@ func TestProposerPriorityDoesNotGetResetToZero(t *testing.T) { // this will cause the diff of priorities (77) // to be larger than threshold == 2*totalVotingPower (22): - updatedState3, err := sm.UpdateState( - updatedState2, - blockID, - types.PartSetHeader{}, - &block.Header, - abciResponses, - validatorUpdates, - ) + updatedState3, err := sm.UpdateState(updatedState2, blockID, &block.Header, abciResponses, validatorUpdates) assert.NoError(t, err) require.Equal(t, len(updatedState3.NextValidators.Validators), 2) @@ -565,8 +557,7 @@ func TestProposerPriorityProposerAlternates(t *testing.T) { assert.Equal(t, val1PubKey.Address(), state.Validators.Proposer.Address) block := makeBlock(state, state.LastBlockHeight+1) - blockID := types.BlockID{Hash: block.Hash()} - psh := block.MakePartSet(testPartSize).Header() + blockID := types.BlockID{Hash: block.Hash(), PartSetHeader: block.MakePartSet(testPartSize).Header()} // no updates: abciResponses := &tmstate.ABCIResponses{ BeginBlock: &abci.ResponseBeginBlock{}, @@ -575,7 +566,7 @@ func TestProposerPriorityProposerAlternates(t *testing.T) { validatorUpdates, err := types.PB2TM.ValidatorUpdates(abciResponses.EndBlock.ValidatorUpdates) require.NoError(t, err) - updatedState, err := sm.UpdateState(state, blockID, psh, &block.Header, abciResponses, validatorUpdates) + updatedState, err := sm.UpdateState(state, blockID, &block.Header, abciResponses, validatorUpdates) assert.NoError(t, err) // 0 + 10 (initial prio) - 10 (avg) - 10 (mostest - total) = -10 @@ -592,7 +583,7 @@ func TestProposerPriorityProposerAlternates(t *testing.T) { validatorUpdates, err = types.PB2TM.ValidatorUpdates([]abci.ValidatorUpdate{updateAddVal}) assert.NoError(t, err) - updatedState2, err := sm.UpdateState(updatedState, blockID, psh, &block.Header, abciResponses, validatorUpdates) + updatedState2, err := sm.UpdateState(updatedState, blockID, &block.Header, abciResponses, validatorUpdates) assert.NoError(t, err) require.Equal(t, len(updatedState2.NextValidators.Validators), 2) @@ -635,7 +626,7 @@ func TestProposerPriorityProposerAlternates(t *testing.T) { validatorUpdates, err = types.PB2TM.ValidatorUpdates(abciResponses.EndBlock.ValidatorUpdates) require.NoError(t, err) - updatedState3, err := sm.UpdateState(updatedState2, blockID, psh, &block.Header, abciResponses, validatorUpdates) + updatedState3, err := sm.UpdateState(updatedState2, blockID, &block.Header, abciResponses, validatorUpdates) assert.NoError(t, err) assert.Equal(t, updatedState3.Validators.Proposer.Address, updatedState3.NextValidators.Proposer.Address) @@ -678,7 +669,7 @@ func TestProposerPriorityProposerAlternates(t *testing.T) { validatorUpdates, err = types.PB2TM.ValidatorUpdates(abciResponses.EndBlock.ValidatorUpdates) require.NoError(t, err) - oldState, err = sm.UpdateState(oldState, blockID, psh, &block.Header, abciResponses, validatorUpdates) + oldState, err = sm.UpdateState(oldState, blockID, &block.Header, abciResponses, validatorUpdates) assert.NoError(t, err) expectedVal1Prio2 = 1 expectedVal2Prio2 = -1 @@ -694,7 +685,7 @@ func TestProposerPriorityProposerAlternates(t *testing.T) { validatorUpdates, err = types.PB2TM.ValidatorUpdates(abciResponses.EndBlock.ValidatorUpdates) require.NoError(t, err) - updatedState, err := sm.UpdateState(oldState, blockID, psh, &block.Header, abciResponses, validatorUpdates) + updatedState, err := sm.UpdateState(oldState, blockID, &block.Header, abciResponses, validatorUpdates) assert.NoError(t, err) // alternate (and cyclic priorities): assert.NotEqual( @@ -753,10 +744,9 @@ func TestLargeGenesisValidator(t *testing.T) { require.NoError(t, err) block := makeBlock(oldState, oldState.LastBlockHeight+1) - blockID := types.BlockID{Hash: block.Hash()} - psh := block.MakePartSet(testPartSize).Header() + blockID := types.BlockID{Hash: block.Hash(), PartSetHeader: block.MakePartSet(testPartSize).Header()} - updatedState, err := sm.UpdateState(oldState, blockID, psh, &block.Header, abciResponses, validatorUpdates) + updatedState, err := sm.UpdateState(oldState, blockID, &block.Header, abciResponses, validatorUpdates) require.NoError(t, err) // no changes in voting power (ProposerPrio += VotingPower == Voting in 1st round; than shiftByAvg == 0, // than -Total == -Voting) @@ -783,9 +773,8 @@ func TestLargeGenesisValidator(t *testing.T) { EndBlock: &abci.ResponseEndBlock{ValidatorUpdates: []abci.ValidatorUpdate{firstAddedVal}}, } block := makeBlock(oldState, oldState.LastBlockHeight+1) - blockID := types.BlockID{Hash: block.Hash()} - psh := block.MakePartSet(testPartSize).Header() - updatedState, err := sm.UpdateState(oldState, blockID, psh, &block.Header, abciResponses, validatorUpdates) + blockID := types.BlockID{Hash: block.Hash(), PartSetHeader: block.MakePartSet(testPartSize).Header()} + updatedState, err := sm.UpdateState(oldState, blockID, &block.Header, abciResponses, validatorUpdates) require.NoError(t, err) lastState := updatedState @@ -799,10 +788,9 @@ func TestLargeGenesisValidator(t *testing.T) { require.NoError(t, err) block := makeBlock(lastState, lastState.LastBlockHeight+1) - blockID := types.BlockID{Hash: block.Hash()} - psh := block.MakePartSet(testPartSize).Header() + blockID := types.BlockID{Hash: block.Hash(), PartSetHeader: block.MakePartSet(testPartSize).Header()} - updatedStateInner, err := sm.UpdateState(lastState, blockID, psh, &block.Header, abciResponses, validatorUpdates) + updatedStateInner, err := sm.UpdateState(lastState, blockID, &block.Header, abciResponses, validatorUpdates) require.NoError(t, err) lastState = updatedStateInner } @@ -833,9 +821,8 @@ func TestLargeGenesisValidator(t *testing.T) { EndBlock: &abci.ResponseEndBlock{ValidatorUpdates: []abci.ValidatorUpdate{addedVal}}, } block := makeBlock(oldState, oldState.LastBlockHeight+1) - blockID := types.BlockID{Hash: block.Hash()} - psh := block.MakePartSet(testPartSize).Header() - state, err = sm.UpdateState(state, blockID, psh, &block.Header, abciResponses, validatorUpdates) + blockID := types.BlockID{Hash: block.Hash(), PartSetHeader: block.MakePartSet(testPartSize).Header()} + state, err = sm.UpdateState(state, blockID, &block.Header, abciResponses, validatorUpdates) require.NoError(t, err) } require.Equal(t, 10+2, len(state.NextValidators.Validators)) @@ -849,11 +836,10 @@ func TestLargeGenesisValidator(t *testing.T) { EndBlock: &abci.ResponseEndBlock{ValidatorUpdates: []abci.ValidatorUpdate{removeGenesisVal}}, } block = makeBlock(oldState, oldState.LastBlockHeight+1) - blockID = types.BlockID{Hash: block.Hash()} - psh = block.MakePartSet(testPartSize).Header() + blockID = types.BlockID{Hash: block.Hash(), PartSetHeader: block.MakePartSet(testPartSize).Header()} validatorUpdates, err = types.PB2TM.ValidatorUpdates(abciResponses.EndBlock.ValidatorUpdates) require.NoError(t, err) - updatedState, err = sm.UpdateState(state, blockID, psh, &block.Header, abciResponses, validatorUpdates) + updatedState, err = sm.UpdateState(state, blockID, &block.Header, abciResponses, validatorUpdates) require.NoError(t, err) // only the first added val (not the genesis val) should be left assert.Equal(t, 11, len(updatedState.NextValidators.Validators)) @@ -871,9 +857,8 @@ func TestLargeGenesisValidator(t *testing.T) { validatorUpdates, err = types.PB2TM.ValidatorUpdates(abciResponses.EndBlock.ValidatorUpdates) require.NoError(t, err) block = makeBlock(curState, curState.LastBlockHeight+1) - blockID = types.BlockID{Hash: block.Hash()} - psh = block.MakePartSet(testPartSize).Header() - curState, err = sm.UpdateState(curState, blockID, psh, &block.Header, abciResponses, validatorUpdates) + blockID = types.BlockID{Hash: block.Hash(), PartSetHeader: block.MakePartSet(testPartSize).Header()} + curState, err = sm.UpdateState(curState, blockID, &block.Header, abciResponses, validatorUpdates) require.NoError(t, err) if !bytes.Equal(curState.Validators.Proposer.Address, curState.NextValidators.Proposer.Address) { isProposerUnchanged = false @@ -897,10 +882,9 @@ func TestLargeGenesisValidator(t *testing.T) { require.NoError(t, err) block := makeBlock(updatedState, updatedState.LastBlockHeight+1) - blockID := types.BlockID{Hash: block.Hash()} - psh := block.MakePartSet(testPartSize).Header() + blockID := types.BlockID{Hash: block.Hash(), PartSetHeader: block.MakePartSet(testPartSize).Header()} - updatedState, err = sm.UpdateState(updatedState, blockID, psh, &block.Header, abciResponses, validatorUpdates) + updatedState, err = sm.UpdateState(updatedState, blockID, &block.Header, abciResponses, validatorUpdates) require.NoError(t, err) if i > numVals { // expect proposers to cycle through after the first iteration (of numVals blocks): if proposers[i%numVals] == nil { @@ -959,7 +943,7 @@ func TestManyValidatorChangesSaveLoad(t *testing.T) { var validatorUpdates []*types.Validator validatorUpdates, err = types.PB2TM.ValidatorUpdates(responses.EndBlock.ValidatorUpdates) require.NoError(t, err) - state, err = sm.UpdateState(state, blockID, types.PartSetHeader{}, &header, responses, validatorUpdates) + state, err = sm.UpdateState(state, blockID, &header, responses, validatorUpdates) require.Nil(t, err) nextHeight := state.LastBlockHeight + 1 err = stateStore.Save(state) @@ -1037,7 +1021,7 @@ func TestConsensusParamsChangesSaveLoad(t *testing.T) { header, blockID, responses := makeHeaderPartsResponsesParams(state, cp) validatorUpdates, err = types.PB2TM.ValidatorUpdates(responses.EndBlock.ValidatorUpdates) require.NoError(t, err) - state, err = sm.UpdateState(state, blockID, types.PartSetHeader{}, &header, responses, validatorUpdates) + state, err = sm.UpdateState(state, blockID, &header, responses, validatorUpdates) require.Nil(t, err) err := stateStore.Save(state) diff --git a/state/tx_filter_test.go b/state/tx_filter_test.go index f9464702be..3e6eb998da 100644 --- a/state/tx_filter_test.go +++ b/state/tx_filter_test.go @@ -14,7 +14,7 @@ import ( func TestTxFilter(t *testing.T) { genDoc := randomGenesisDoc() - genDoc.ConsensusParams.Block.MaxBytes = 3001 + genDoc.ConsensusParams.Block.MaxBytes = 3000 genDoc.ConsensusParams.Evidence.MaxBytes = 1500 // Max size of Txs is much smaller than size of block, diff --git a/state/validation.go b/state/validation.go index 741777e984..fd68df8269 100644 --- a/state/validation.go +++ b/state/validation.go @@ -49,13 +49,6 @@ func validateBlock(state State, block *types.Block) error { ) } - if !block.LastPartSetHeader.Equals(state.LastPartSetHeader) { - return fmt.Errorf("wrong Block.Header.LastPartSetHeader. Expected %v, got %v", - state.LastPartSetHeader, - block.LastPartSetHeader, - ) - } - // Validate app info if !bytes.Equal(block.AppHash, state.AppHash) { return fmt.Errorf("wrong Block.Header.AppHash. Expected %X, got %v", @@ -97,7 +90,7 @@ func validateBlock(state State, block *types.Block) error { } else { // LastCommit.Signatures length is checked in VerifyCommit. if err := state.LastValidators.VerifyCommit( - state.ChainID, state.LastBlockID, state.LastPartSetHeader, block.Height-1, block.LastCommit); err != nil { + state.ChainID, state.LastBlockID, block.Height-1, block.LastCommit); err != nil { return err } } diff --git a/state/validation_test.go b/state/validation_test.go index 6f6886e2b6..11dd5f4de0 100644 --- a/state/validation_test.go +++ b/state/validation_test.go @@ -36,7 +36,7 @@ func TestValidateBlockHeader(t *testing.T) { memmock.Mempool{}, sm.EmptyEvidencePool{}, ) - lastCommit := types.NewCommit(0, 0, types.BlockID{}, nil, types.PartSetHeader{}) + lastCommit := types.NewCommit(0, 0, types.BlockID{}, nil) // some bad values wrongHash := tmhash.Sum([]byte("this hash is wrong")) @@ -57,7 +57,7 @@ func TestValidateBlockHeader(t *testing.T) { {"Time wrong", func(block *types.Block) { block.Time = block.Time.Add(-time.Second * 1) }}, {"Time wrong 2", func(block *types.Block) { block.Time = block.Time.Add(time.Second * 1) }}, - {"LastBlockID wrong", func(block *types.Block) { block.LastPartSetHeader.Total += 10 }}, + {"LastBlockID wrong", func(block *types.Block) { block.LastBlockID.PartSetHeader.Total += 10 }}, {"LastCommitHash wrong", func(block *types.Block) { block.LastCommitHash = wrongHash }}, {"DataHash wrong", func(block *types.Block) { block.DataHash = wrongHash }}, @@ -72,9 +72,7 @@ func TestValidateBlockHeader(t *testing.T) { {"Proposer invalid", func(block *types.Block) { block.ProposerAddress = []byte("wrong size") }}, {"first LastCommit contains signatures", func(block *types.Block) { - block.LastCommit = types.NewCommit( - 0, 0, types.BlockID{}, []types.CommitSig{types.NewCommitSigAbsent()}, types.PartSetHeader{}, - ) + block.LastCommit = types.NewCommit(0, 0, types.BlockID{}, []types.CommitSig{types.NewCommitSigAbsent()}) block.LastCommitHash = block.LastCommit.Hash() }}, } @@ -97,7 +95,7 @@ func TestValidateBlockHeader(t *testing.T) { A good block passes */ var err error - state, _, _, lastCommit, err = makeAndCommitGoodBlock(state, height, + state, _, lastCommit, err = makeAndCommitGoodBlock(state, height, lastCommit, proposerAddr, blockExec, privVals, nil) require.NoError(t, err, "height %d", height) } @@ -129,8 +127,8 @@ func TestValidateBlockCommit(t *testing.T) { memmock.Mempool{}, sm.EmptyEvidencePool{}, ) - lastCommit := types.NewCommit(0, 0, types.BlockID{}, nil, types.PartSetHeader{}) - wrongSigsCommit := types.NewCommit(1, 0, types.BlockID{}, nil, types.PartSetHeader{}) + lastCommit := types.NewCommit(0, 0, types.BlockID{}, nil) + wrongSigsCommit := types.NewCommit(1, 0, types.BlockID{}, nil) badPrivVal := types.NewMockPV() for height := int64(1); height < validationTestsStopHeight; height++ { @@ -143,7 +141,6 @@ func TestValidateBlockCommit(t *testing.T) { wrongHeightVote, err := types.MakeVote( height, state.LastBlockID, - state.LastPartSetHeader, state.Validators, privVals[proposerAddr.String()], chainID, @@ -155,7 +152,6 @@ func TestValidateBlockCommit(t *testing.T) { wrongHeightVote.Round, state.LastBlockID, []types.CommitSig{wrongHeightVote.CommitSig()}, - state.LastPartSetHeader, ) block, _ := state.MakeBlock(height, makeTxs(height), nil, nil, types.Messages{}, wrongHeightCommit, proposerAddr) err = blockExec.ValidateBlock(state, block) @@ -181,9 +177,8 @@ func TestValidateBlockCommit(t *testing.T) { var ( err error blockID types.BlockID - psh types.PartSetHeader ) - state, blockID, psh, lastCommit, err = makeAndCommitGoodBlock( + state, blockID, lastCommit, err = makeAndCommitGoodBlock( state, height, lastCommit, @@ -199,7 +194,6 @@ func TestValidateBlockCommit(t *testing.T) { */ goodVote, err := types.MakeVote(height, blockID, - psh, state.Validators, privVals[proposerAddr.String()], chainID, @@ -218,7 +212,6 @@ func TestValidateBlockCommit(t *testing.T) { Timestamp: tmtime.Now(), Type: tmproto.PrecommitType, BlockID: blockID, - PartSetHeader: psh, } g := goodVote.ToProto() @@ -232,7 +225,7 @@ func TestValidateBlockCommit(t *testing.T) { goodVote.Signature, badVote.Signature = g.Signature, b.Signature wrongSigsCommit = types.NewCommit(goodVote.Height, goodVote.Round, - blockID, []types.CommitSig{goodVote.CommitSig(), badVote.CommitSig()}, psh) + blockID, []types.CommitSig{goodVote.CommitSig(), badVote.CommitSig()}) } } @@ -259,7 +252,7 @@ func TestValidateBlockEvidence(t *testing.T) { memmock.Mempool{}, evpool, ) - lastCommit := types.NewCommit(0, 0, types.BlockID{}, nil, types.PartSetHeader{}) + lastCommit := types.NewCommit(0, 0, types.BlockID{}, nil) for height := int64(1); height < validationTestsStopHeight; height++ { proposerAddr := state.Validators.GetProposer().Address @@ -303,7 +296,7 @@ func TestValidateBlockEvidence(t *testing.T) { var err error - state, _, _, lastCommit, err = makeAndCommitGoodBlock( + state, _, lastCommit, err = makeAndCommitGoodBlock( state, height, lastCommit, diff --git a/statesync/stateprovider.go b/statesync/stateprovider.go index 7407d98988..7bd2474e21 100644 --- a/statesync/stateprovider.go +++ b/statesync/stateprovider.go @@ -161,7 +161,6 @@ func (s *lightClientStateProvider) State(ctx context.Context, height uint64) (sm state.LastBlockHeight = lastLightBlock.Height state.LastBlockTime = lastLightBlock.Time state.LastBlockID = lastLightBlock.Commit.BlockID - state.LastPartSetHeader = lastLightBlock.Commit.PartSetHeader state.AppHash = curLightBlock.AppHash state.LastResultsHash = curLightBlock.LastResultsHash state.LastValidators = lastLightBlock.ValidatorSet diff --git a/store/store.go b/store/store.go index 930683c5de..4e9be36cf9 100644 --- a/store/store.go +++ b/store/store.go @@ -309,7 +309,7 @@ func (bs *BlockStore) PruneBlocks(height int64) (uint64, error) { if err := batch.Delete(calcSeenCommitKey(h)); err != nil { return 0, err } - for p := 0; p < int(meta.PartSetHeader.Total); p++ { + for p := 0; p < int(meta.BlockID.PartSetHeader.Total); p++ { if err := batch.Delete(calcBlockPartKey(h, p)); err != nil { return 0, err } diff --git a/store/store_test.go b/store/store_test.go index 4e3652a9a3..39c89e7e02 100644 --- a/store/store_test.go +++ b/store/store_test.go @@ -46,10 +46,8 @@ func makeTestCommit(height int64, timestamp time.Time) *types.Commit { hh := sha256.Sum256([]byte("Headerhash")) copy(hash, hh[:]) - psh := types.PartSetHeader{Hash: []byte(""), Total: 2} - return types.NewCommit(height, 0, - types.BlockID{Hash: hash}, commitSigs, psh) + types.BlockID{Hash: hash, PartSetHeader: types.PartSetHeader{Hash: []byte(""), Total: 2}}, commitSigs) } func makeTxs(height int64) (txs []types.Tx) { diff --git a/tools/tm-signer-harness/internal/test_harness.go b/tools/tm-signer-harness/internal/test_harness.go index 7c3ee801b2..bc9d94a46b 100644 --- a/tools/tm-signer-harness/internal/test_harness.go +++ b/tools/tm-signer-harness/internal/test_harness.go @@ -222,10 +222,10 @@ func (th *TestHarness) TestSignProposal() error { POLRound: -1, BlockID: types.BlockID{ Hash: hash, - }, - PartSetHeader: types.PartSetHeader{ - Hash: hash, - Total: 1000000, + PartSetHeader: types.PartSetHeader{ + Hash: hash, + Total: 1000000, + }, }, Timestamp: time.Now(), DAHeader: &types.DataAvailabilityHeader{}, @@ -273,10 +273,10 @@ func (th *TestHarness) TestSignVote() error { Round: 0, BlockID: types.BlockID{ Hash: hash, - }, - PartSetHeader: types.PartSetHeader{ - Hash: hash, - Total: 1000000, + PartSetHeader: types.PartSetHeader{ + Hash: hash, + Total: 1000000, + }, }, ValidatorIndex: 0, ValidatorAddress: tmhash.SumTruncated([]byte("addr")), diff --git a/types/block.go b/types/block.go index 780ab0ff93..5defc87842 100644 --- a/types/block.go +++ b/types/block.go @@ -32,7 +32,7 @@ const ( // MaxHeaderBytes is a maximum header size. // NOTE: Because app hash can be of arbitrary size, the header is therefore not // capped in size and thus this number should be seen as a soft max - MaxHeaderBytes int64 = 637 + MaxHeaderBytes int64 = 636 // MaxOverheadForBlock - maximum overhead to encode a block (up to // MaxBlockSizeBytes in size) not including it's parts except Data. @@ -513,8 +513,7 @@ type Header struct { Time time.Time `json:"time"` // prev block info - LastBlockID BlockID `json:"last_block_id"` - LastPartSetHeader PartSetHeader `json:"last_part_set_header"` + LastBlockID BlockID `json:"last_block_id"` // hashes of block data LastCommitHash tmbytes.HexBytes `json:"last_commit_hash"` // commit from validators from the last block @@ -540,11 +539,8 @@ type Header struct { // Populate the Header with state-derived data. // Call this after MakeBlock to complete the Header. func (h *Header) Populate( - version tmversion.Consensus, - chainID string, - timestamp time.Time, - lastBlockID BlockID, - lastPartSetHeader PartSetHeader, + version tmversion.Consensus, chainID string, + timestamp time.Time, lastBlockID BlockID, valHash, nextValHash []byte, consensusHash, appHash, lastResultsHash []byte, proposerAddress Address, @@ -552,7 +548,6 @@ func (h *Header) Populate( h.Version = version h.ChainID = chainID h.Time = timestamp - h.LastPartSetHeader = lastPartSetHeader h.LastBlockID = lastBlockID h.ValidatorsHash = valHash h.NextValidatorsHash = nextValHash @@ -584,10 +579,6 @@ func (h Header) ValidateBasic() error { return fmt.Errorf("wrong LastBlockID: %w", err) } - if err := h.LastPartSetHeader.ValidateBasic(); err != nil { - return fmt.Errorf("wrong PartSetHeader: %w", err) - } - if err := ValidateHash(h.LastCommitHash); err != nil { return fmt.Errorf("wrong LastCommitHash: %v", err) } @@ -651,20 +642,12 @@ func (h *Header) Hash() tmbytes.HexBytes { if err != nil { return nil } - - pbpsh := h.LastPartSetHeader.ToProto() - bzpsh, err := pbpsh.Marshal() - if err != nil { - return nil - } - return merkle.HashFromByteSlices([][]byte{ hbz, cdcEncode(h.ChainID), cdcEncode(h.Height), pbt, bzbi, - bzpsh, cdcEncode(h.LastCommitHash), cdcEncode(h.DataHash), cdcEncode(h.NumOriginalDataShares), @@ -689,7 +672,6 @@ func (h *Header) StringIndented(indent string) string { %s Height: %v %s Time: %v %s LastBlockID: %v -%s LastPartSetHeader: %v %s LastCommit: %v %s Data: %v %s Validators: %v @@ -705,7 +687,6 @@ func (h *Header) StringIndented(indent string) string { indent, h.Height, indent, h.Time, indent, h.LastBlockID, - indent, h.LastPartSetHeader, indent, h.LastCommitHash, indent, h.DataHash, indent, h.ValidatorsHash, @@ -724,15 +705,12 @@ func (h *Header) ToProto() *tmproto.Header { return nil } - ppsh := h.LastPartSetHeader.ToProto() - return &tmproto.Header{ Version: h.Version, ChainID: h.ChainID, Height: h.Height, Time: h.Time, LastBlockId: h.LastBlockID.ToProto(), - LastPartSetHeader: &ppsh, ValidatorsHash: h.ValidatorsHash, NextValidatorsHash: h.NextValidatorsHash, ConsensusHash: h.ConsensusHash, @@ -760,18 +738,12 @@ func HeaderFromProto(ph *tmproto.Header) (Header, error) { return Header{}, err } - lpsh, err := PartSetHeaderFromProto(ph.LastPartSetHeader) - if err != nil { - return Header{}, err - } - h.Version = ph.Version h.ChainID = ph.ChainID h.Height = ph.Height h.Time = ph.Time h.Height = ph.Height h.LastBlockID = *bi - h.LastPartSetHeader = *lpsh h.ValidatorsHash = ph.ValidatorsHash h.NextValidatorsHash = ph.NextValidatorsHash h.ConsensusHash = ph.ConsensusHash @@ -881,21 +853,6 @@ func (cs CommitSig) BlockID(commitBlockID BlockID) BlockID { return blockID } -func (cs CommitSig) PartSetHeader(commitPSH PartSetHeader) PartSetHeader { - var psh PartSetHeader - switch cs.BlockIDFlag { - case BlockIDFlagAbsent: - psh = PartSetHeader{} - case BlockIDFlagCommit: - psh = commitPSH - case BlockIDFlagNil: - psh = PartSetHeader{} - default: - panic(fmt.Sprintf("Unknown BlockIDFlag: %v", cs.BlockIDFlag)) - } - return psh -} - // ValidateBasic performs basic validation. func (cs CommitSig) ValidateBasic() error { switch cs.BlockIDFlag { @@ -971,12 +928,11 @@ type Commit struct { // ValidatorSet order. // Any peer with a block can gossip signatures by index with a peer without // recalculating the active ValidatorSet. - Height int64 `json:"height"` - Round int32 `json:"round"` - BlockID BlockID `json:"block_id"` - Signatures []CommitSig `json:"signatures"` - HeaderHash []byte `json:"header_hash"` - PartSetHeader PartSetHeader `json:"part_set_header"` + Height int64 `json:"height"` + Round int32 `json:"round"` + BlockID BlockID `json:"block_id"` + Signatures []CommitSig `json:"signatures"` + HeaderHash []byte `json:"header_hash"` // Memoized in first call to corresponding method. // NOTE: can't memoize in constructor because constructor isn't used for @@ -986,14 +942,13 @@ type Commit struct { } // NewCommit returns a new Commit. -func NewCommit(height int64, round int32, blockID BlockID, commitSigs []CommitSig, psh PartSetHeader) *Commit { +func NewCommit(height int64, round int32, blockID BlockID, commitSigs []CommitSig) *Commit { return &Commit{ - Height: height, - Round: round, - BlockID: blockID, - Signatures: commitSigs, - HeaderHash: blockID.Hash, - PartSetHeader: psh, + Height: height, + Round: round, + BlockID: blockID, + Signatures: commitSigs, + HeaderHash: blockID.Hash, } } @@ -1024,7 +979,6 @@ func (commit *Commit) GetVote(valIdx int32) *Vote { Height: commit.Height, Round: commit.Round, BlockID: commitSig.BlockID(commit.BlockID), - PartSetHeader: commitSig.PartSetHeader(commit.PartSetHeader), Timestamp: commitSig.Timestamp, ValidatorAddress: commitSig.ValidatorAddress, ValidatorIndex: valIdx, @@ -1164,14 +1118,12 @@ func (commit *Commit) StringIndented(indent string) string { %s Height: %d %s Round: %d %s BlockID: %v -%s PartSetHeader: %v %s Signatures: %s %v %s}#%v`, indent, commit.Height, indent, commit.Round, indent, commit.BlockID, - indent, commit.PartSetHeader, indent, indent, strings.Join(commitSigStrings, "\n"+indent+" "), indent, commit.hash) @@ -1190,13 +1142,10 @@ func (commit *Commit) ToProto() *tmproto.Commit { } c.Signatures = sigs - ppsh := commit.PartSetHeader.ToProto() - c.Height = commit.Height c.Round = commit.Round c.BlockID = commit.BlockID.ToProto() c.HeaderHash = commit.HeaderHash - c.PartSetHeader = &ppsh return c } @@ -1217,11 +1166,6 @@ func CommitFromProto(cp *tmproto.Commit) (*Commit, error) { return nil, err } - psh, err := PartSetHeaderFromProto(cp.PartSetHeader) - if err != nil { - return nil, err - } - sigs := make([]CommitSig, len(cp.Signatures)) for i := range cp.Signatures { if err := sigs[i].FromProto(cp.Signatures[i]); err != nil { @@ -1234,7 +1178,6 @@ func CommitFromProto(cp *tmproto.Commit) (*Commit, error) { commit.Round = cp.Round commit.BlockID = *bi commit.HeaderHash = cp.HeaderHash - commit.PartSetHeader = *psh return commit, commit.ValidateBasic() } @@ -1603,17 +1546,25 @@ func (data *EvidenceData) SplitIntoShares() NamespacedShares { // BlockID type BlockID struct { - Hash tmbytes.HexBytes `json:"hash"` + Hash tmbytes.HexBytes `json:"hash"` + PartSetHeader PartSetHeader `json:"part_set_header"` } // Equals returns true if the BlockID matches the given BlockID func (blockID BlockID) Equals(other BlockID) bool { - return bytes.Equal(blockID.Hash, other.Hash) + return bytes.Equal(blockID.Hash, other.Hash) && + blockID.PartSetHeader.Equals(other.PartSetHeader) } // Key returns a machine-readable string representation of the BlockID func (blockID BlockID) Key() string { - return string(blockID.Hash) + pbph := blockID.PartSetHeader.ToProto() + bz, err := pbph.Marshal() + if err != nil { + panic(err) + } + + return string(blockID.Hash) + string(bz) } // ValidateBasic performs basic validation. @@ -1622,17 +1573,23 @@ func (blockID BlockID) ValidateBasic() error { if err := ValidateHash(blockID.Hash); err != nil { return fmt.Errorf("wrong Hash") } + if err := blockID.PartSetHeader.ValidateBasic(); err != nil { + return fmt.Errorf("wrong PartSetHeader: %v", err) + } return nil } // IsZero returns true if this is the BlockID of a nil block. func (blockID BlockID) IsZero() bool { - return len(blockID.Hash) == 0 + return len(blockID.Hash) == 0 && + blockID.PartSetHeader.IsZero() } // IsComplete returns true if this is a valid BlockID of a non-nil block. func (blockID BlockID) IsComplete() bool { - return len(blockID.Hash) == tmhash.Size + return len(blockID.Hash) == tmhash.Size && + blockID.PartSetHeader.Total > 0 && + len(blockID.PartSetHeader.Hash) == tmhash.Size } // String returns a human readable string representation of the BlockID. @@ -1642,7 +1599,7 @@ func (blockID BlockID) IsComplete() bool { // // See PartSetHeader#String func (blockID BlockID) String() string { - return fmt.Sprintf(`%v`, blockID.Hash) + return fmt.Sprintf(`%v:%v`, blockID.Hash, blockID.PartSetHeader) } // ToProto converts BlockID to protobuf @@ -1652,7 +1609,8 @@ func (blockID *BlockID) ToProto() tmproto.BlockID { } return tmproto.BlockID{ - Hash: blockID.Hash, + Hash: blockID.Hash, + PartSetHeader: blockID.PartSetHeader.ToProto(), } } @@ -1664,6 +1622,12 @@ func BlockIDFromProto(bID *tmproto.BlockID) (*BlockID, error) { } blockID := new(BlockID) + ph, err := PartSetHeaderFromProto(&bID.PartSetHeader) + if err != nil { + return nil, err + } + + blockID.PartSetHeader = *ph blockID.Hash = bID.Hash return blockID, blockID.ValidateBasic() diff --git a/types/block_meta.go b/types/block_meta.go index 44548ca773..4c1061d0cd 100644 --- a/types/block_meta.go +++ b/types/block_meta.go @@ -10,23 +10,21 @@ import ( // BlockMeta contains meta information. type BlockMeta struct { - BlockID BlockID `json:"block_id"` - BlockSize int `json:"block_size"` - Header Header `json:"header"` - NumTxs int `json:"num_txs"` - DAHeader DataAvailabilityHeader `json:"da_header"` - PartSetHeader PartSetHeader `json:"part_set_header"` + BlockID BlockID `json:"block_id"` + BlockSize int `json:"block_size"` + Header Header `json:"header"` + NumTxs int `json:"num_txs"` + DAHeader DataAvailabilityHeader `json:"da_header"` } // NewBlockMeta returns a new BlockMeta. func NewBlockMeta(block *Block, blockParts *PartSet) *BlockMeta { return &BlockMeta{ - BlockID: BlockID{block.Hash()}, - BlockSize: block.Size(), - Header: block.Header, - NumTxs: len(block.Data.Txs), - DAHeader: block.DataAvailabilityHeader, - PartSetHeader: blockParts.Header(), + BlockID: BlockID{block.Hash(), blockParts.Header()}, + BlockSize: block.Size(), + Header: block.Header, + NumTxs: len(block.Data.Txs), + DAHeader: block.DataAvailabilityHeader, } } @@ -40,15 +38,12 @@ func (bm *BlockMeta) ToProto() (*tmproto.BlockMeta, error) { return nil, err } - ppsh := bm.PartSetHeader.ToProto() - pb := &tmproto.BlockMeta{ - BlockID: bm.BlockID.ToProto(), - BlockSize: int64(bm.BlockSize), - Header: *bm.Header.ToProto(), - NumTxs: int64(bm.NumTxs), - DaHeader: protoDAH, - PartSetHeader: &ppsh, + BlockID: bm.BlockID.ToProto(), + BlockSize: int64(bm.BlockSize), + Header: *bm.Header.ToProto(), + NumTxs: int64(bm.NumTxs), + DaHeader: protoDAH, } return pb, nil } @@ -75,17 +70,11 @@ func BlockMetaFromProto(pb *tmproto.BlockMeta) (*BlockMeta, error) { return nil, err } - psh, err := PartSetHeaderFromProto(pb.PartSetHeader) - if err != nil { - return nil, err - } - bm.BlockID = *bi bm.BlockSize = int(pb.BlockSize) bm.Header = h bm.NumTxs = int(pb.NumTxs) bm.DAHeader = *dah - bm.PartSetHeader = *psh return bm, bm.ValidateBasic() } @@ -95,9 +84,6 @@ func (bm *BlockMeta) ValidateBasic() error { if err := bm.BlockID.ValidateBasic(); err != nil { return err } - if err := bm.PartSetHeader.ValidateBasic(); err != nil { - return err - } if !bytes.Equal(bm.BlockID.Hash, bm.Header.Hash()) { return fmt.Errorf("expected BlockID#Hash and Header#Hash to be the same, got %X != %X", bm.BlockID.Hash, bm.Header.Hash()) diff --git a/types/block_meta_test.go b/types/block_meta_test.go index 845b077f61..c6a5243152 100644 --- a/types/block_meta_test.go +++ b/types/block_meta_test.go @@ -11,17 +11,15 @@ import ( func TestBlockMeta_ToProto(t *testing.T) { h := makeRandHeader() - bi := BlockID{Hash: h.Hash()} - psh := PartSetHeader{Total: 123, Hash: tmrand.Bytes(tmhash.Size)} + bi := BlockID{Hash: h.Hash(), PartSetHeader: PartSetHeader{Total: 123, Hash: tmrand.Bytes(tmhash.Size)}} dah := makeDAHeaderRandom() bm := &BlockMeta{ - BlockID: bi, - PartSetHeader: psh, - BlockSize: 200, - Header: h, - NumTxs: 0, - DAHeader: *dah, + BlockID: bi, + BlockSize: 200, + Header: h, + NumTxs: 0, + DAHeader: *dah, } tests := []struct { @@ -53,18 +51,17 @@ func TestBlockMeta_ToProto(t *testing.T) { func TestBlockMeta_ValidateBasic(t *testing.T) { h := makeRandHeader() - bi := BlockID{Hash: h.Hash()} - psh := PartSetHeader{Total: 123, Hash: tmrand.Bytes(tmhash.Size)} - bi2 := BlockID{Hash: tmrand.Bytes(tmhash.Size)} - bi3 := BlockID{Hash: []byte("incorrect hash")} - psh3 := PartSetHeader{Total: 123, Hash: []byte("incorrect hash")} + bi := BlockID{Hash: h.Hash(), PartSetHeader: PartSetHeader{Total: 123, Hash: tmrand.Bytes(tmhash.Size)}} + bi2 := BlockID{Hash: tmrand.Bytes(tmhash.Size), + PartSetHeader: PartSetHeader{Total: 123, Hash: tmrand.Bytes(tmhash.Size)}} + bi3 := BlockID{Hash: []byte("incorrect hash"), + PartSetHeader: PartSetHeader{Total: 123, Hash: []byte("incorrect hash")}} bm := &BlockMeta{ - BlockID: bi, - PartSetHeader: psh, - BlockSize: 200, - Header: h, - NumTxs: 0, + BlockID: bi, + BlockSize: 200, + Header: h, + NumTxs: 0, } bm2 := &BlockMeta{ @@ -75,11 +72,10 @@ func TestBlockMeta_ValidateBasic(t *testing.T) { } bm3 := &BlockMeta{ - BlockID: bi3, - PartSetHeader: psh3, - BlockSize: 200, - Header: h, - NumTxs: 0, + BlockID: bi3, + BlockSize: 200, + Header: h, + NumTxs: 0, } tests := []struct { diff --git a/types/block_test.go b/types/block_test.go index 47f5021b07..adbfa1c210 100644 --- a/types/block_test.go +++ b/types/block_test.go @@ -34,11 +34,10 @@ func TestMain(m *testing.M) { func TestBlockAddEvidence(t *testing.T) { txs := []Tx{Tx("foo"), Tx("bar")} lastID := makeBlockIDRandom() - lastPSH := makePartSetHeaderRandom() h := int64(3) voteSet, _, vals := randVoteSet(h-1, 1, tmproto.PrecommitType, 10, 1) - commit, err := MakeCommit(lastID, lastPSH, h-1, 1, voteSet, vals, time.Now()) + commit, err := MakeCommit(lastID, h-1, 1, voteSet, vals, time.Now()) require.NoError(t, err) ev := NewMockDuplicateVoteEvidenceWithValidator(h, time.Now(), vals[0], "block-test-chain") @@ -55,11 +54,10 @@ func TestBlockValidateBasic(t *testing.T) { txs := []Tx{Tx("foo"), Tx("bar")} lastID := makeBlockIDRandom() - lastPSH := makePartSetHeaderRandom() h := int64(3) voteSet, valSet, vals := randVoteSet(h-1, 1, tmproto.PrecommitType, 10, 1) - commit, err := MakeCommit(lastID, lastPSH, h-1, 1, voteSet, vals, time.Now()) + commit, err := MakeCommit(lastID, h-1, 1, voteSet, vals, time.Now()) require.NoError(t, err) ev := NewMockDuplicateVoteEvidenceWithValidator(h, time.Now(), vals[0], "block-test-chain") @@ -95,7 +93,7 @@ func TestBlockValidateBasic(t *testing.T) { blk.LastCommit = nil }, true}, {"Invalid LastCommit", func(blk *Block) { - blk.LastCommit = NewCommit(-1, 0, *voteSet.maj23, nil, *voteSet.maj23PartSetHeader) + blk.LastCommit = NewCommit(-1, 0, *voteSet.maj23, nil) }, true}, {"Invalid Evidence", func(blk *Block) { emptyEv := &DuplicateVoteEvidence{} @@ -133,11 +131,10 @@ func TestBlockMakePartSetWithEvidence(t *testing.T) { assert.Nil(t, (*Block)(nil).MakePartSet(2)) lastID := makeBlockIDRandom() - lastPSH := makePartSetHeaderRandom() h := int64(3) voteSet, _, vals := randVoteSet(h-1, 1, tmproto.PrecommitType, 10, 1) - commit, err := MakeCommit(lastID, lastPSH, h-1, 1, voteSet, vals, time.Now()) + commit, err := MakeCommit(lastID, h-1, 1, voteSet, vals, time.Now()) require.NoError(t, err) ev := NewMockDuplicateVoteEvidenceWithValidator(h, time.Now(), vals[0], "block-test-chain") @@ -152,10 +149,9 @@ func TestBlockHashesTo(t *testing.T) { assert.False(t, (*Block)(nil).HashesTo(nil)) lastID := makeBlockIDRandom() - lastPSH := makePartSetHeaderRandom() h := int64(3) voteSet, valSet, vals := randVoteSet(h-1, 1, tmproto.PrecommitType, 10, 1) - commit, err := MakeCommit(lastID, lastPSH, h-1, 1, voteSet, vals, time.Now()) + commit, err := MakeCommit(lastID, h-1, 1, voteSet, vals, time.Now()) require.NoError(t, err) ev := NewMockDuplicateVoteEvidenceWithValidator(h, time.Now(), vals[0], "block-test-chain") @@ -188,34 +184,27 @@ func TestBlockString(t *testing.T) { func makeBlockIDRandom() BlockID { var ( - blockHash = make([]byte, tmhash.Size) + blockHash = make([]byte, tmhash.Size) + partSetHash = make([]byte, tmhash.Size) ) mrand.Read(blockHash) - return BlockID{blockHash} -} - -func makePartSetHeaderRandom() PartSetHeader { - partSetHash := make([]byte, tmhash.Size) mrand.Read(partSetHash) - return PartSetHeader{123, partSetHash} + return BlockID{blockHash, PartSetHeader{123, partSetHash}} } -func makeBlockID(hash []byte) BlockID { +func makeBlockID(hash []byte, partSetSize uint32, partSetHash []byte) BlockID { var ( - h = make([]byte, tmhash.Size) + h = make([]byte, tmhash.Size) + psH = make([]byte, tmhash.Size) ) copy(h, hash) + copy(psH, partSetHash) return BlockID{ Hash: h, - } -} - -func makePartSetHeader(partSetSize uint32, partSetHash []byte) PartSetHeader { - psH := make([]byte, tmhash.Size) - copy(psH, partSetHash) - return PartSetHeader{ - Total: partSetSize, - Hash: psH, + PartSetHeader: PartSetHeader{ + Total: partSetSize, + Hash: psH, + }, } } @@ -253,10 +242,9 @@ func TestEmptyBlockData(t *testing.T) { func TestCommit(t *testing.T) { lastID := makeBlockIDRandom() - lastPSH := makePartSetHeaderRandom() h := int64(3) voteSet, _, vals := randVoteSet(h-1, 1, tmproto.PrecommitType, 10, 1) - commit, err := MakeCommit(lastID, lastPSH, h-1, 1, voteSet, vals, time.Now()) + commit, err := MakeCommit(lastID, h-1, 1, voteSet, vals, time.Now()) require.NoError(t, err) assert.Equal(t, h-1, commit.Height) @@ -316,10 +304,10 @@ func TestMaxCommitBytes(t *testing.T) { Round: math.MaxInt32, BlockID: BlockID{ Hash: tmhash.Sum([]byte("blockID_hash")), - }, - PartSetHeader: PartSetHeader{ - Total: math.MaxInt32, - Hash: tmhash.Sum([]byte("blockID_part_set_header_hash")), + PartSetHeader: PartSetHeader{ + Total: math.MaxInt32, + Hash: tmhash.Sum([]byte("blockID_part_set_header_hash")), + }, }, Signatures: []CommitSig{cs}, } @@ -350,8 +338,7 @@ func TestHeaderHash(t *testing.T) { ChainID: "chainId", Height: 3, Time: time.Date(2019, 10, 13, 16, 14, 44, 0, time.UTC), - LastBlockID: makeBlockID(make([]byte, tmhash.Size)), - LastPartSetHeader: makePartSetHeader(6, make([]byte, tmhash.Size)), + LastBlockID: makeBlockID(make([]byte, tmhash.Size), 6, make([]byte, tmhash.Size)), LastCommitHash: tmhash.Sum([]byte("last_commit_hash")), DataHash: tmhash.Sum([]byte("data_hash")), NumOriginalDataShares: 4, @@ -362,15 +349,14 @@ func TestHeaderHash(t *testing.T) { LastResultsHash: tmhash.Sum([]byte("last_results_hash")), EvidenceHash: tmhash.Sum([]byte("evidence_hash")), ProposerAddress: crypto.AddressHash([]byte("proposer_address")), - }, hexBytesFromString("CBE1A9A83217E1EEDE92B9F85B6519B6DA2B2AC8BF69421A1CB0227C5CD3B353")}, + }, hexBytesFromString("3BA96EAE652191EDBEA84E130C32E94AD86A901B856EC7201B776669F72DE39F")}, {"nil header yields nil", nil, nil}, {"nil ValidatorsHash yields nil", &Header{ Version: tmversion.Consensus{Block: 1, App: 2}, ChainID: "chainId", Height: 3, Time: time.Date(2019, 10, 13, 16, 14, 44, 0, time.UTC), - LastBlockID: makeBlockID(make([]byte, tmhash.Size)), - LastPartSetHeader: makePartSetHeader(6, make([]byte, tmhash.Size)), + LastBlockID: makeBlockID(make([]byte, tmhash.Size), 6, make([]byte, tmhash.Size)), LastCommitHash: tmhash.Sum([]byte("last_commit_hash")), DataHash: tmhash.Sum([]byte("data_hash")), ValidatorsHash: nil, @@ -415,11 +401,6 @@ func TestHeaderHash(t *testing.T) { bz, err := pbbi.Marshal() require.NoError(t, err) byteSlices = append(byteSlices, bz) - case PartSetHeader: - pbpsh := f.ToProto() - bz, err := pbpsh.Marshal() - require.NoError(t, err) - byteSlices = append(byteSlices, bz) default: t.Errorf("unknown type %T", f) } @@ -450,8 +431,7 @@ func TestMaxHeaderBytes(t *testing.T) { ChainID: maxChainID, Height: math.MaxInt64, Time: timestamp, - LastBlockID: makeBlockID(make([]byte, tmhash.Size)), - LastPartSetHeader: makePartSetHeader(math.MaxInt32, make([]byte, tmhash.Size)), + LastBlockID: makeBlockID(make([]byte, tmhash.Size), math.MaxInt32, make([]byte, tmhash.Size)), LastCommitHash: tmhash.Sum([]byte("last_commit_hash")), DataHash: tmhash.Sum([]byte("data_hash")), NumOriginalDataShares: math.MaxInt64, @@ -472,10 +452,9 @@ func TestMaxHeaderBytes(t *testing.T) { func randCommit(now time.Time) *Commit { lastID := makeBlockIDRandom() - lastPSH := makePartSetHeaderRandom() h := int64(3) voteSet, _, vals := randVoteSet(h-1, 1, tmproto.PrecommitType, 10, 1) - commit, err := MakeCommit(lastID, lastPSH, h-1, 1, voteSet, vals, now) + commit, err := MakeCommit(lastID, h-1, 1, voteSet, vals, now) if err != nil { panic(err) } @@ -501,10 +480,10 @@ func TestBlockMaxDataBytes(t *testing.T) { 0: {-10, 1, 0, true, 0}, 1: {10, 1, 0, true, 0}, 2: {851, 1, 0, true, 0}, - 3: {853, 1, 0, false, 0}, - 4: {854, 1, 0, false, 1}, - 5: {965, 2, 0, false, 1}, - 6: {1064, 2, 100, false, 0}, + 3: {852, 1, 0, false, 0}, + 4: {853, 1, 0, false, 1}, + 5: {964, 2, 0, false, 1}, + 6: {1063, 2, 100, false, 0}, } for i, tc := range testCases { @@ -532,8 +511,8 @@ func TestBlockMaxDataBytesNoEvidence(t *testing.T) { 0: {-10, 1, true, 0}, 1: {10, 1, true, 0}, 2: {851, 1, true, 0}, - 3: {853, 1, false, 0}, - 4: {854, 1, false, 1}, + 3: {852, 1, false, 0}, + 4: {853, 1, false, 1}, } for i, tc := range testCases { @@ -553,11 +532,10 @@ func TestBlockMaxDataBytesNoEvidence(t *testing.T) { func TestCommitToVoteSet(t *testing.T) { lastID := makeBlockIDRandom() - lastPSH := makePartSetHeaderRandom() h := int64(3) voteSet, valSet, vals := randVoteSet(h-1, 1, tmproto.PrecommitType, 10, 1) - commit, err := MakeCommit(lastID, lastPSH, h-1, 1, voteSet, vals, time.Now()) + commit, err := MakeCommit(lastID, h-1, 1, voteSet, vals, time.Now()) assert.NoError(t, err) chainID := voteSet.ChainID() @@ -580,8 +558,7 @@ func TestCommitToVoteSet(t *testing.T) { } func TestCommitToVoteSetWithVotesForNilBlock(t *testing.T) { - blockID := makeBlockID([]byte("blockhash")) - psh := makePartSetHeader(1000, []byte("partshash")) + blockID := makeBlockID([]byte("blockhash"), 1000, []byte("partshash")) const ( height = int64(3) @@ -589,15 +566,14 @@ func TestCommitToVoteSetWithVotesForNilBlock(t *testing.T) { ) type commitVoteTest struct { - blockIDs []BlockID - partSetHeaders []PartSetHeader - numVotes []int // must sum to numValidators - numValidators int - valid bool + blockIDs []BlockID + numVotes []int // must sum to numValidators + numValidators int + valid bool } testCases := []commitVoteTest{ - {[]BlockID{blockID, {}}, []PartSetHeader{psh, {}}, []int{67, 33}, 100, true}, + {[]BlockID{blockID, {}}, []int{67, 33}, 100, true}, } for _, tc := range testCases { @@ -615,7 +591,6 @@ func TestCommitToVoteSetWithVotesForNilBlock(t *testing.T) { Round: round, Type: tmproto.PrecommitType, BlockID: tc.blockIDs[n], - PartSetHeader: tc.partSetHeaders[n], Timestamp: tmtime.Now(), } @@ -630,7 +605,7 @@ func TestCommitToVoteSetWithVotesForNilBlock(t *testing.T) { if tc.valid { commit := voteSet.MakeCommit() // panics without > 2/3 valid votes assert.NotNil(t, commit) - err := valSet.VerifyCommit(voteSet.ChainID(), blockID, psh, height-1, commit) + err := valSet.VerifyCommit(voteSet.ChainID(), blockID, height-1, commit) assert.Nil(t, err) } else { assert.Panics(t, func() { voteSet.MakeCommit() }) @@ -641,26 +616,37 @@ func TestCommitToVoteSetWithVotesForNilBlock(t *testing.T) { func TestBlockIDValidateBasic(t *testing.T) { validBlockID := BlockID{ Hash: bytes.HexBytes{}, + PartSetHeader: PartSetHeader{ + Total: 1, + Hash: bytes.HexBytes{}, + }, } invalidBlockID := BlockID{ Hash: []byte{0}, + PartSetHeader: PartSetHeader{ + Total: 1, + Hash: []byte{0}, + }, } testCases := []struct { - testName string - blockIDHash bytes.HexBytes - expectErr bool + testName string + blockIDHash bytes.HexBytes + blockIDPartSetHeader PartSetHeader + expectErr bool }{ - {"Valid BlockID", validBlockID.Hash, false}, - {"Invalid BlockID", invalidBlockID.Hash, true}, + {"Valid BlockID", validBlockID.Hash, validBlockID.PartSetHeader, false}, + {"Invalid BlockID", invalidBlockID.Hash, validBlockID.PartSetHeader, true}, + {"Invalid BlockID", validBlockID.Hash, invalidBlockID.PartSetHeader, true}, } for _, tc := range testCases { tc := tc t.Run(tc.testName, func(t *testing.T) { blockID := BlockID{ - Hash: tc.blockIDHash, + Hash: tc.blockIDHash, + PartSetHeader: tc.blockIDPartSetHeader, } assert.Equal(t, tc.expectErr, blockID.ValidateBasic() != nil, "Validate Basic had an unexpected result") }) @@ -831,7 +817,7 @@ func TestHeaderProto(t *testing.T) { } func TestBlockIDProtoBuf(t *testing.T) { - blockID := makeBlockID([]byte("hash")) + blockID := makeBlockID([]byte("hash"), 2, []byte("part_set_hash")) testCases := []struct { msg string bid1 *BlockID @@ -885,9 +871,9 @@ func TestSignedHeaderProtoBuf(t *testing.T) { func TestBlockIDEquals(t *testing.T) { var ( - blockID = makeBlockID([]byte("hash")) - blockIDDuplicate = makeBlockID([]byte("hash")) - blockIDDifferent = makeBlockID([]byte("different_hash")) + blockID = makeBlockID([]byte("hash"), 2, []byte("part_set_hash")) + blockIDDuplicate = makeBlockID([]byte("hash"), 2, []byte("part_set_hash")) + blockIDDifferent = makeBlockID([]byte("different_hash"), 2, []byte("part_set_hash")) blockIDEmpty = BlockID{} ) @@ -1037,9 +1023,9 @@ func TestHeader_ValidateBasic(t *testing.T) { Height: 1, LastBlockID: BlockID{ Hash: make([]byte, tmhash.Size), - }, - LastPartSetHeader: PartSetHeader{ - Hash: make([]byte, tmhash.Size+1), + PartSetHeader: PartSetHeader{ + Hash: make([]byte, tmhash.Size+1), + }, }, }, true, "wrong PartSetHeader", @@ -1052,9 +1038,9 @@ func TestHeader_ValidateBasic(t *testing.T) { Height: 1, LastBlockID: BlockID{ Hash: make([]byte, tmhash.Size), - }, - LastPartSetHeader: PartSetHeader{ - Hash: make([]byte, tmhash.Size), + PartSetHeader: PartSetHeader{ + Hash: make([]byte, tmhash.Size), + }, }, LastCommitHash: make([]byte, tmhash.Size+1), }, @@ -1068,9 +1054,9 @@ func TestHeader_ValidateBasic(t *testing.T) { Height: 1, LastBlockID: BlockID{ Hash: make([]byte, tmhash.Size), - }, - LastPartSetHeader: PartSetHeader{ - Hash: make([]byte, tmhash.Size), + PartSetHeader: PartSetHeader{ + Hash: make([]byte, tmhash.Size), + }, }, LastCommitHash: make([]byte, tmhash.Size), DataHash: make([]byte, tmhash.Size+1), @@ -1085,9 +1071,9 @@ func TestHeader_ValidateBasic(t *testing.T) { Height: 1, LastBlockID: BlockID{ Hash: make([]byte, tmhash.Size), - }, - LastPartSetHeader: PartSetHeader{ - Hash: make([]byte, tmhash.Size), + PartSetHeader: PartSetHeader{ + Hash: make([]byte, tmhash.Size), + }, }, LastCommitHash: make([]byte, tmhash.Size), DataHash: make([]byte, tmhash.Size), @@ -1103,9 +1089,9 @@ func TestHeader_ValidateBasic(t *testing.T) { Height: 1, LastBlockID: BlockID{ Hash: make([]byte, tmhash.Size), - }, - LastPartSetHeader: PartSetHeader{ - Hash: make([]byte, tmhash.Size), + PartSetHeader: PartSetHeader{ + Hash: make([]byte, tmhash.Size), + }, }, LastCommitHash: make([]byte, tmhash.Size), DataHash: make([]byte, tmhash.Size), @@ -1122,9 +1108,9 @@ func TestHeader_ValidateBasic(t *testing.T) { Height: 1, LastBlockID: BlockID{ Hash: make([]byte, tmhash.Size), - }, - LastPartSetHeader: PartSetHeader{ - Hash: make([]byte, tmhash.Size), + PartSetHeader: PartSetHeader{ + Hash: make([]byte, tmhash.Size), + }, }, LastCommitHash: make([]byte, tmhash.Size), DataHash: make([]byte, tmhash.Size), @@ -1142,9 +1128,9 @@ func TestHeader_ValidateBasic(t *testing.T) { Height: 1, LastBlockID: BlockID{ Hash: make([]byte, tmhash.Size), - }, - LastPartSetHeader: PartSetHeader{ - Hash: make([]byte, tmhash.Size), + PartSetHeader: PartSetHeader{ + Hash: make([]byte, tmhash.Size), + }, }, LastCommitHash: make([]byte, tmhash.Size), DataHash: make([]byte, tmhash.Size), @@ -1163,9 +1149,9 @@ func TestHeader_ValidateBasic(t *testing.T) { Height: 1, LastBlockID: BlockID{ Hash: make([]byte, tmhash.Size), - }, - LastPartSetHeader: PartSetHeader{ - Hash: make([]byte, tmhash.Size), + PartSetHeader: PartSetHeader{ + Hash: make([]byte, tmhash.Size), + }, }, LastCommitHash: make([]byte, tmhash.Size), DataHash: make([]byte, tmhash.Size), @@ -1185,9 +1171,9 @@ func TestHeader_ValidateBasic(t *testing.T) { Height: 1, LastBlockID: BlockID{ Hash: make([]byte, tmhash.Size), - }, - LastPartSetHeader: PartSetHeader{ - Hash: make([]byte, tmhash.Size), + PartSetHeader: PartSetHeader{ + Hash: make([]byte, tmhash.Size), + }, }, LastCommitHash: make([]byte, tmhash.Size), DataHash: make([]byte, tmhash.Size), @@ -1208,9 +1194,9 @@ func TestHeader_ValidateBasic(t *testing.T) { Height: 1, LastBlockID: BlockID{ Hash: make([]byte, tmhash.Size), - }, - LastPartSetHeader: PartSetHeader{ - Hash: make([]byte, tmhash.Size), + PartSetHeader: PartSetHeader{ + Hash: make([]byte, tmhash.Size), + }, }, LastCommitHash: make([]byte, tmhash.Size), DataHash: make([]byte, tmhash.Size), @@ -1274,9 +1260,9 @@ func TestCommit_ValidateBasic(t *testing.T) { Round: 1, BlockID: BlockID{ Hash: make([]byte, tmhash.Size), - }, - PartSetHeader: PartSetHeader{ - Hash: make([]byte, tmhash.Size), + PartSetHeader: PartSetHeader{ + Hash: make([]byte, tmhash.Size), + }, }, HeaderHash: make([]byte, tmhash.Size), }, @@ -1289,9 +1275,9 @@ func TestCommit_ValidateBasic(t *testing.T) { Round: 1, BlockID: BlockID{ Hash: make([]byte, tmhash.Size), - }, - PartSetHeader: PartSetHeader{ - Hash: make([]byte, tmhash.Size), + PartSetHeader: PartSetHeader{ + Hash: make([]byte, tmhash.Size), + }, }, Signatures: []CommitSig{ { @@ -1311,9 +1297,9 @@ func TestCommit_ValidateBasic(t *testing.T) { Round: 1, BlockID: BlockID{ Hash: make([]byte, tmhash.Size), - }, - PartSetHeader: PartSetHeader{ - Hash: make([]byte, tmhash.Size), + PartSetHeader: PartSetHeader{ + Hash: make([]byte, tmhash.Size), + }, }, Signatures: []CommitSig{ { diff --git a/types/canonical.go b/types/canonical.go index 321d78b542..9ed4650f1c 100644 --- a/types/canonical.go +++ b/types/canonical.go @@ -25,7 +25,8 @@ func CanonicalizeBlockID(bid tmproto.BlockID) *tmproto.CanonicalBlockID { cbid = nil } else { cbid = &tmproto.CanonicalBlockID{ - Hash: bid.Hash, + Hash: bid.Hash, + PartSetHeader: CanonicalizePartSetHeader(bid.PartSetHeader), } } @@ -39,32 +40,28 @@ func CanonicalizePartSetHeader(psh tmproto.PartSetHeader) tmproto.CanonicalPartS // CanonicalizeVote transforms the given Proposal to a CanonicalProposal. func CanonicalizeProposal(chainID string, proposal *tmproto.Proposal) tmproto.CanonicalProposal { - cppsh := CanonicalizePartSetHeader(*proposal.PartSetHeader) return tmproto.CanonicalProposal{ - Type: tmproto.ProposalType, - Height: proposal.Height, // encoded as sfixed64 - Round: int64(proposal.Round), // encoded as sfixed64 - POLRound: int64(proposal.PolRound), - BlockID: CanonicalizeBlockID(proposal.BlockID), - Timestamp: proposal.Timestamp, - ChainID: chainID, - DAHeader: proposal.DAHeader, - PartSetHeader: &cppsh, + Type: tmproto.ProposalType, + Height: proposal.Height, // encoded as sfixed64 + Round: int64(proposal.Round), // encoded as sfixed64 + POLRound: int64(proposal.PolRound), + BlockID: CanonicalizeBlockID(proposal.BlockID), + Timestamp: proposal.Timestamp, + ChainID: chainID, + DAHeader: proposal.DAHeader, } } // CanonicalizeVote transforms the given Vote to a CanonicalVote, which does // not contain ValidatorIndex and ValidatorAddress fields. func CanonicalizeVote(chainID string, vote *tmproto.Vote) tmproto.CanonicalVote { - cppsh := CanonicalizePartSetHeader(*vote.PartSetHeader) return tmproto.CanonicalVote{ - Type: vote.Type, - Height: vote.Height, // encoded as sfixed64 - Round: int64(vote.Round), // encoded as sfixed64 - BlockID: CanonicalizeBlockID(vote.BlockID), - Timestamp: vote.Timestamp, - ChainID: chainID, - PartSetHeader: &cppsh, + Type: vote.Type, + Height: vote.Height, // encoded as sfixed64 + Round: int64(vote.Round), // encoded as sfixed64 + BlockID: CanonicalizeBlockID(vote.BlockID), + Timestamp: vote.Timestamp, + ChainID: chainID, } } diff --git a/types/canonical_test.go b/types/canonical_test.go index 71ecf7d357..9c4d9e55cb 100644 --- a/types/canonical_test.go +++ b/types/canonical_test.go @@ -11,10 +11,14 @@ import ( func TestCanonicalizeBlockID(t *testing.T) { randhash := tmrand.Bytes(tmhash.Size) - block1 := tmproto.BlockID{Hash: randhash} - block2 := tmproto.BlockID{Hash: randhash} - cblock1 := tmproto.CanonicalBlockID{Hash: randhash} - cblock2 := tmproto.CanonicalBlockID{Hash: randhash} + block1 := tmproto.BlockID{Hash: randhash, + PartSetHeader: tmproto.PartSetHeader{Total: 5, Hash: randhash}} + block2 := tmproto.BlockID{Hash: randhash, + PartSetHeader: tmproto.PartSetHeader{Total: 10, Hash: randhash}} + cblock1 := tmproto.CanonicalBlockID{Hash: randhash, + PartSetHeader: tmproto.CanonicalPartSetHeader{Total: 5, Hash: randhash}} + cblock2 := tmproto.CanonicalBlockID{Hash: randhash, + PartSetHeader: tmproto.CanonicalPartSetHeader{Total: 10, Hash: randhash}} tests := []struct { name string diff --git a/types/events.go b/types/events.go index 04244a7a80..91c5d07b22 100644 --- a/types/events.go +++ b/types/events.go @@ -112,8 +112,7 @@ type EventDataCompleteProposal struct { Round int32 `json:"round"` Step string `json:"step"` - BlockID BlockID `json:"block_id"` - PartSetHeader PartSetHeader `json:"part_set_header"` + BlockID BlockID `json:"block_id"` } type EventDataVote struct { diff --git a/types/evidence.go b/types/evidence.go index 782adf317e..df7ef12b16 100644 --- a/types/evidence.go +++ b/types/evidence.go @@ -549,11 +549,11 @@ func NewMockDuplicateVoteEvidenceWithValidator(height int64, time time.Time, pv PrivValidator, chainID string) *DuplicateVoteEvidence { pubKey, _ := pv.GetPubKey() val := NewValidator(pubKey, 10) - voteA := makeMockVote(height, 0, 0, pubKey.Address(), randBlockID(), randPartSetHeader(), time) + voteA := makeMockVote(height, 0, 0, pubKey.Address(), randBlockID(), time) vA := voteA.ToProto() _ = pv.SignVote(chainID, vA) voteA.Signature = vA.Signature - voteB := makeMockVote(height, 0, 0, pubKey.Address(), randBlockID(), randPartSetHeader(), time) + voteB := makeMockVote(height, 0, 0, pubKey.Address(), randBlockID(), time) vB := voteB.ToProto() _ = pv.SignVote(chainID, vB) voteB.Signature = vB.Signature @@ -561,13 +561,12 @@ func NewMockDuplicateVoteEvidenceWithValidator(height int64, time time.Time, } func makeMockVote(height int64, round, index int32, addr Address, - blockID BlockID, psh PartSetHeader, time time.Time) *Vote { + blockID BlockID, time time.Time) *Vote { return &Vote{ Type: tmproto.SignedMsgType(2), Height: height, Round: round, BlockID: blockID, - PartSetHeader: psh, Timestamp: time, ValidatorAddress: addr, ValidatorIndex: index, @@ -577,12 +576,9 @@ func makeMockVote(height int64, round, index int32, addr Address, func randBlockID() BlockID { return BlockID{ Hash: tmrand.Bytes(tmhash.Size), - } -} - -func randPartSetHeader() PartSetHeader { - return PartSetHeader{ - Total: 1, - Hash: tmrand.Bytes(tmhash.Size), + PartSetHeader: PartSetHeader{ + Total: 1, + Hash: tmrand.Bytes(tmhash.Size), + }, } } diff --git a/types/evidence_test.go b/types/evidence_test.go index cb49d669a5..aadcd21105 100644 --- a/types/evidence_test.go +++ b/types/evidence_test.go @@ -30,14 +30,12 @@ func TestEvidenceList(t *testing.T) { func randomDuplicateVoteEvidence(t *testing.T) *DuplicateVoteEvidence { val := NewMockPV() - blockID := makeBlockID([]byte("blockhash")) - psh := makePartSetHeader(1000, []byte("partshash")) - blockID2 := makeBlockID([]byte("blockhash2")) - psh2 := makePartSetHeader(1000, []byte("partshash")) + blockID := makeBlockID([]byte("blockhash"), 1000, []byte("partshash")) + blockID2 := makeBlockID([]byte("blockhash2"), 1000, []byte("partshash")) const chainID = "mychain" return &DuplicateVoteEvidence{ - VoteA: makeVote(t, val, chainID, 0, 10, 2, 1, blockID, psh, defaultVoteTime), - VoteB: makeVote(t, val, chainID, 0, 10, 2, 1, blockID2, psh2, defaultVoteTime.Add(1*time.Minute)), + VoteA: makeVote(t, val, chainID, 0, 10, 2, 1, blockID, defaultVoteTime), + VoteB: makeVote(t, val, chainID, 0, 10, 2, 1, blockID2, defaultVoteTime.Add(1*time.Minute)), TotalVotingPower: 30, ValidatorPower: 10, Timestamp: defaultVoteTime, @@ -54,9 +52,8 @@ func TestDuplicateVoteEvidence(t *testing.T) { func TestDuplicateVoteEvidenceValidation(t *testing.T) { val := NewMockPV() - psh := makePartSetHeader(math.MaxInt32, tmhash.Sum([]byte("partshash"))) - blockID := makeBlockID(tmhash.Sum([]byte("blockhash"))) - blockID2 := makeBlockID(tmhash.Sum([]byte("blockhash2"))) + blockID := makeBlockID(tmhash.Sum([]byte("blockhash")), math.MaxInt32, tmhash.Sum([]byte("partshash"))) + blockID2 := makeBlockID(tmhash.Sum([]byte("blockhash2")), math.MaxInt32, tmhash.Sum([]byte("partshash"))) const chainID = "mychain" testCases := []struct { @@ -72,7 +69,7 @@ func TestDuplicateVoteEvidenceValidation(t *testing.T) { ev.VoteB = nil }, true}, {"Invalid vote type", func(ev *DuplicateVoteEvidence) { - ev.VoteA = makeVote(t, val, chainID, math.MaxInt32, math.MaxInt64, math.MaxInt32, 0, blockID2, psh, defaultVoteTime) + ev.VoteA = makeVote(t, val, chainID, math.MaxInt32, math.MaxInt64, math.MaxInt32, 0, blockID2, defaultVoteTime) }, true}, {"Invalid vote order", func(ev *DuplicateVoteEvidence) { swap := ev.VoteA.Copy() @@ -83,8 +80,8 @@ func TestDuplicateVoteEvidenceValidation(t *testing.T) { for _, tc := range testCases { tc := tc t.Run(tc.testName, func(t *testing.T) { - vote1 := makeVote(t, val, chainID, math.MaxInt32, math.MaxInt64, math.MaxInt32, 0x02, blockID, psh, defaultVoteTime) - vote2 := makeVote(t, val, chainID, math.MaxInt32, math.MaxInt64, math.MaxInt32, 0x02, blockID2, psh, defaultVoteTime) + vote1 := makeVote(t, val, chainID, math.MaxInt32, math.MaxInt64, math.MaxInt32, 0x02, blockID, defaultVoteTime) + vote2 := makeVote(t, val, chainID, math.MaxInt32, math.MaxInt64, math.MaxInt32, 0x02, blockID2, defaultVoteTime) valSet := NewValidatorSet([]*Validator{val.ExtractIntoValidator(10)}) ev := NewDuplicateVoteEvidence(vote1, vote2, defaultVoteTime, valSet) tc.malleateEvidence(ev) @@ -98,9 +95,8 @@ func TestLightClientAttackEvidence(t *testing.T) { voteSet, valSet, privVals := randVoteSet(height, 1, tmproto.PrecommitType, 10, 1) header := makeHeaderRandom() header.Height = height - blockID := makeBlockID(tmhash.Sum([]byte("blockhash"))) - psh := makePartSetHeader(math.MaxInt32, tmhash.Sum([]byte("partshash"))) - commit, err := MakeCommit(blockID, psh, height, 1, voteSet, privVals, defaultVoteTime) + blockID := makeBlockID(tmhash.Sum([]byte("blockhash")), math.MaxInt32, tmhash.Sum([]byte("partshash"))) + commit, err := MakeCommit(blockID, height, 1, voteSet, privVals, defaultVoteTime) require.NoError(t, err) lcae := &LightClientAttackEvidence{ ConflictingBlock: &LightBlock{ @@ -115,7 +111,7 @@ func TestLightClientAttackEvidence(t *testing.T) { assert.NotNil(t, lcae.String()) assert.NotNil(t, lcae.Hash()) // only 7 validators sign - differentCommit, err := MakeCommit(blockID, psh, height, 1, voteSet, privVals[:7], defaultVoteTime) + differentCommit, err := MakeCommit(blockID, height, 1, voteSet, privVals[:7], defaultVoteTime) require.NoError(t, err) differentEv := &LightClientAttackEvidence{ ConflictingBlock: &LightBlock{ @@ -163,9 +159,8 @@ func TestLightClientAttackEvidenceValidation(t *testing.T) { header := makeHeaderRandom() header.Height = height header.ValidatorsHash = valSet.Hash() - blockID := makeBlockID(header.Hash()) - psh := makePartSetHeader(math.MaxInt32, tmhash.Sum([]byte("partshash"))) - commit, err := MakeCommit(blockID, psh, height, 1, voteSet, privVals, time.Now()) + blockID := makeBlockID(header.Hash(), math.MaxInt32, tmhash.Sum([]byte("partshash"))) + commit, err := MakeCommit(blockID, height, 1, voteSet, privVals, time.Now()) require.NoError(t, err) lcae := &LightClientAttackEvidence{ ConflictingBlock: &LightBlock{ @@ -226,7 +221,7 @@ func TestMockEvidenceValidateBasic(t *testing.T) { func makeVote( t *testing.T, val PrivValidator, chainID string, valIndex int32, height int64, round int32, step int, blockID BlockID, - psh PartSetHeader, time time.Time) *Vote { + time time.Time) *Vote { pubKey, err := val.GetPubKey() require.NoError(t, err) v := &Vote{ @@ -236,7 +231,6 @@ func makeVote( Round: round, Type: tmproto.SignedMsgType(step), BlockID: blockID, - PartSetHeader: psh, Timestamp: time, } @@ -256,7 +250,6 @@ func makeHeaderRandom() *Header { Height: int64(mrand.Uint32() + 1), Time: time.Now(), LastBlockID: makeBlockIDRandom(), - LastPartSetHeader: makePartSetHeaderRandom(), LastCommitHash: crypto.CRandBytes(tmhash.Size), DataHash: crypto.CRandBytes(tmhash.Size), ValidatorsHash: crypto.CRandBytes(tmhash.Size), @@ -272,12 +265,11 @@ func makeHeaderRandom() *Header { func TestEvidenceProto(t *testing.T) { // -------- Votes -------- val := NewMockPV() - blockID := makeBlockID(tmhash.Sum([]byte("blockhash"))) - psh := makePartSetHeader(math.MaxInt32, tmhash.Sum([]byte("partshash"))) - blockID2 := makeBlockID(tmhash.Sum([]byte("blockhash2"))) + blockID := makeBlockID(tmhash.Sum([]byte("blockhash")), math.MaxInt32, tmhash.Sum([]byte("partshash"))) + blockID2 := makeBlockID(tmhash.Sum([]byte("blockhash2")), math.MaxInt32, tmhash.Sum([]byte("partshash"))) const chainID = "mychain" - v := makeVote(t, val, chainID, math.MaxInt32, math.MaxInt64, 1, 0x01, blockID, psh, defaultVoteTime) - v2 := makeVote(t, val, chainID, math.MaxInt32, math.MaxInt64, 2, 0x01, blockID2, psh, defaultVoteTime) + v := makeVote(t, val, chainID, math.MaxInt32, math.MaxInt64, 1, 0x01, blockID, defaultVoteTime) + v2 := makeVote(t, val, chainID, math.MaxInt32, math.MaxInt64, 2, 0x01, blockID2, defaultVoteTime) // -------- SignedHeaders -------- const height int64 = 37 diff --git a/types/proposal.go b/types/proposal.go index 6cbad11918..7ae3f41ebc 100644 --- a/types/proposal.go +++ b/types/proposal.go @@ -23,36 +23,27 @@ var ( // a so-called Proof-of-Lock (POL) round, as noted in the POLRound. // If POLRound >= 0, then BlockID corresponds to the block that is locked in POLRound. type Proposal struct { - Type tmproto.SignedMsgType - Height int64 `json:"height"` - Round int32 `json:"round"` // there can not be greater than 2_147_483_647 rounds - POLRound int32 `json:"pol_round"` // -1 if null. - BlockID BlockID `json:"block_id"` - Timestamp time.Time `json:"timestamp"` - Signature []byte `json:"signature"` - DAHeader *DataAvailabilityHeader `json:"da_header"` - PartSetHeader PartSetHeader `json:"part_set_header"` + Type tmproto.SignedMsgType + Height int64 `json:"height"` + Round int32 `json:"round"` // there can not be greater than 2_147_483_647 rounds + POLRound int32 `json:"pol_round"` // -1 if null. + BlockID BlockID `json:"block_id"` + Timestamp time.Time `json:"timestamp"` + Signature []byte `json:"signature"` + DAHeader *DataAvailabilityHeader `json:"da_header"` } // NewProposal returns a new Proposal. // If there is no POLRound, polRound should be -1. -func NewProposal( - height int64, - round int32, - polRound int32, - blockID BlockID, - daH *DataAvailabilityHeader, - psh PartSetHeader, -) *Proposal { +func NewProposal(height int64, round int32, polRound int32, blockID BlockID, daH *DataAvailabilityHeader) *Proposal { return &Proposal{ - Type: tmproto.ProposalType, - Height: height, - Round: round, - BlockID: blockID, - POLRound: polRound, - Timestamp: tmtime.Now(), - DAHeader: daH, - PartSetHeader: psh, + Type: tmproto.ProposalType, + Height: height, + Round: round, + BlockID: blockID, + POLRound: polRound, + Timestamp: tmtime.Now(), + DAHeader: daH, } } @@ -77,9 +68,6 @@ func (p *Proposal) ValidateBasic() error { if !p.BlockID.IsComplete() { return fmt.Errorf("expected a complete, non-empty BlockID, got: %v", p.BlockID) } - if err := p.PartSetHeader.ValidateBasic(); err != nil { - return fmt.Errorf("wrong PartSetHeader: %w", err) - } // NOTE: Timestamp validation is subtle and handled elsewhere. @@ -104,11 +92,10 @@ func (p *Proposal) ValidateBasic() error { // 7. timestamp // See BlockID#String. func (p *Proposal) String() string { - return fmt.Sprintf("Proposal{%v/%v (%v, %v %v, %v) %X @ %s}", + return fmt.Sprintf("Proposal{%v/%v (%v, %v, %v) %X @ %s}", p.Height, p.Round, p.BlockID, - p.PartSetHeader, p.DAHeader, p.POLRound, tmbytes.Fingerprint(p.Signature), @@ -144,8 +131,6 @@ func (p *Proposal) ToProto() (*tmproto.Proposal, error) { return nil, err } - ppsh := p.PartSetHeader.ToProto() - pb := new(tmproto.Proposal) pb.BlockID = p.BlockID.ToProto() pb.Type = p.Type @@ -155,7 +140,6 @@ func (p *Proposal) ToProto() (*tmproto.Proposal, error) { pb.Timestamp = p.Timestamp pb.Signature = p.Signature pb.DAHeader = pdah - pb.PartSetHeader = &ppsh return pb, nil } @@ -178,11 +162,6 @@ func ProposalFromProto(pp *tmproto.Proposal) (*Proposal, error) { return nil, err } - psh, err := PartSetHeaderFromProto(pp.PartSetHeader) - if err != nil { - return nil, err - } - p.BlockID = *blockID p.Type = pp.Type p.Height = pp.Height @@ -191,7 +170,6 @@ func ProposalFromProto(pp *tmproto.Proposal) (*Proposal, error) { p.Timestamp = pp.Timestamp p.Signature = pp.Signature p.DAHeader = dah - p.PartSetHeader = *psh return p, p.ValidateBasic() } diff --git a/types/proposal_test.go b/types/proposal_test.go index dc3d56a3ca..bf3d13cc5d 100644 --- a/types/proposal_test.go +++ b/types/proposal_test.go @@ -29,12 +29,12 @@ func init() { panic(err) } testProposal = &Proposal{ - Height: 12345, - Round: 23456, - BlockID: BlockID{Hash: []byte("--June_15_2020_amino_was_removed")}, - PartSetHeader: PartSetHeader{Total: 111, Hash: []byte("--June_15_2020_amino_was_removed")}, - POLRound: -1, - Timestamp: stamp, + Height: 12345, + Round: 23456, + BlockID: BlockID{Hash: []byte("--June_15_2020_amino_was_removed"), + PartSetHeader: PartSetHeader{Total: 111, Hash: []byte("--June_15_2020_amino_was_removed")}}, + POLRound: -1, + Timestamp: stamp, DAHeader: &DataAvailabilityHeader{ RowsRoots: rows, ColumnRoots: clmns, @@ -58,7 +58,7 @@ func TestProposalSignable(t *testing.T) { func TestProposalString(t *testing.T) { str := testProposal.String() - expected := `Proposal{12345/23456 (2D2D4A756E655F31355F323032305F616D696E6F5F7761735F72656D6F766564, 111:2D2D4A756E65 1ACC82AE4B38A876BEC82CCC91873315063C374599BBCC4BF1E783D5A73B0E5A, -1) 000000000000 @ 2018-02-11T07:09:22.765Z}` //nolint:lll // ignore line length for tests + expected := `Proposal{12345/23456 (2D2D4A756E655F31355F323032305F616D696E6F5F7761735F72656D6F766564:111:2D2D4A756E65, 1ACC82AE4B38A876BEC82CCC91873315063C374599BBCC4BF1E783D5A73B0E5A, -1) 000000000000 @ 2018-02-11T07:09:22.765Z}` //nolint:lll // ignore line length for tests if str != expected { t.Errorf("got unexpected string for Proposal. Expected:\n%v\nGot:\n%v", expected, str) } @@ -71,9 +71,8 @@ func TestProposalVerifySignature(t *testing.T) { prop := NewProposal( 4, 2, 2, - BlockID{tmrand.Bytes(tmhash.Size)}, + BlockID{tmrand.Bytes(tmhash.Size), PartSetHeader{777, tmrand.Bytes(tmhash.Size)}}, makeDAHeaderRandom(), - PartSetHeader{777, tmrand.Bytes(tmhash.Size)}, ) p, err := prop.ToProto() require.NoError(t, err) @@ -150,8 +149,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}} - p.PartSetHeader = PartSetHeader{111, []byte("blockparts")} + p.BlockID = BlockID{[]byte{1, 2, 3}, PartSetHeader{111, []byte("blockparts")}} }, true}, {"Invalid Signature", func(p *Proposal) { p.Signature = make([]byte, 0) @@ -160,14 +158,13 @@ func TestProposalValidateBasic(t *testing.T) { p.Signature = make([]byte, MaxSignatureSize+1) }, true}, } - blockID := makeBlockID(tmhash.Sum([]byte("blockhash"))) - psh := makePartSetHeader(math.MaxInt32, tmhash.Sum([]byte("partshash"))) + blockID := makeBlockID(tmhash.Sum([]byte("blockhash")), math.MaxInt32, tmhash.Sum([]byte("partshash"))) dah := makeDAHeaderRandom() for _, tc := range testCases { tc := tc t.Run(tc.testName, func(t *testing.T) { - prop := NewProposal(4, 2, 2, blockID, dah, psh) + prop := NewProposal(4, 2, 2, blockID, dah) p, err := prop.ToProto() require.NoError(t, err) err = privVal.SignProposal("test_chain_id", p) @@ -180,18 +177,15 @@ func TestProposalValidateBasic(t *testing.T) { } func TestProposalProtoBuf(t *testing.T) { - bid := makeBlockID([]byte("hash")) - psh := makePartSetHeader(2, []byte("part_set_hash")) proposal := NewProposal( 1, 2, 3, - bid, + makeBlockID([]byte("hash"), 2, []byte("part_set_hash")), makeDAHeaderRandom(), - psh, ) proposal.Signature = []byte("sig") - proposal2 := NewProposal(1, 2, 3, BlockID{}, &DataAvailabilityHeader{}, PartSetHeader{}) + proposal2 := NewProposal(1, 2, 3, BlockID{}, &DataAvailabilityHeader{}) testCases := []struct { msg string diff --git a/types/protobuf.go b/types/protobuf.go index 51bbcb4bc1..97e67cb307 100644 --- a/types/protobuf.go +++ b/types/protobuf.go @@ -33,15 +33,13 @@ var TM2PB = tm2pb{} type tm2pb struct{} func (tm2pb) Header(header *Header) tmproto.Header { - lpsh := header.LastPartSetHeader.ToProto() return tmproto.Header{ Version: header.Version, ChainID: header.ChainID, Height: header.Height, Time: header.Time, - LastBlockId: header.LastBlockID.ToProto(), - LastPartSetHeader: &lpsh, + LastBlockId: header.LastBlockID.ToProto(), LastCommitHash: header.LastCommitHash, DataHash: header.DataHash, @@ -66,7 +64,8 @@ func (tm2pb) Validator(val *Validator) abci.Validator { func (tm2pb) BlockID(blockID BlockID) tmproto.BlockID { return tmproto.BlockID{ - Hash: blockID.Hash, + Hash: blockID.Hash, + PartSetHeader: TM2PB.PartSetHeader(blockID.PartSetHeader), } } diff --git a/types/shares_test.go b/types/shares_test.go index 17fdab1576..041e91bc57 100644 --- a/types/shares_test.go +++ b/types/shares_test.go @@ -27,11 +27,10 @@ func TestMakeShares(t *testing.T) { reservedTxNamespaceID := append(bytes.Repeat([]byte{0}, 7), 1) reservedEvidenceNamespaceID := append(bytes.Repeat([]byte{0}, 7), 3) val := NewMockPV() - blockID := makeBlockID([]byte("blockhash")) - psh := makePartSetHeader(1000, []byte("partshash")) - blockID2 := makeBlockID([]byte("blockhash2")) - vote1 := makeVote(t, val, "chainID", 0, 10, 2, 1, blockID, psh, defaultVoteTime) - vote2 := makeVote(t, val, "chainID", 0, 10, 2, 1, blockID2, psh, defaultVoteTime) + blockID := makeBlockID([]byte("blockhash"), 1000, []byte("partshash")) + blockID2 := makeBlockID([]byte("blockhash2"), 1000, []byte("partshash")) + vote1 := makeVote(t, val, "chainID", 0, 10, 2, 1, blockID, defaultVoteTime) + vote2 := makeVote(t, val, "chainID", 0, 10, 2, 1, blockID2, defaultVoteTime) testEvidence := &DuplicateVoteEvidence{ VoteA: vote1, VoteB: vote2, diff --git a/types/test_util.go b/types/test_util.go index 63ab69010a..f1260db10c 100644 --- a/types/test_util.go +++ b/types/test_util.go @@ -7,7 +7,7 @@ import ( tmproto "github.com/celestiaorg/celestia-core/proto/tendermint/types" ) -func MakeCommit(blockID BlockID, partSetHeader PartSetHeader, height int64, round int32, +func MakeCommit(blockID BlockID, height int64, round int32, voteSet *VoteSet, validators []PrivValidator, now time.Time) (*Commit, error) { // all sign @@ -23,7 +23,6 @@ func MakeCommit(blockID BlockID, partSetHeader PartSetHeader, height int64, roun Round: round, Type: tmproto.PrecommitType, BlockID: blockID, - PartSetHeader: partSetHeader, Timestamp: now, } @@ -49,7 +48,6 @@ func signAddVote(privVal PrivValidator, vote *Vote, voteSet *VoteSet) (signed bo func MakeVote( height int64, blockID BlockID, - partSetHeader PartSetHeader, valSet *ValidatorSet, privVal PrivValidator, chainID string, @@ -69,7 +67,6 @@ func MakeVote( Timestamp: now, Type: tmproto.PrecommitType, BlockID: blockID, - PartSetHeader: partSetHeader, } v := vote.ToProto() diff --git a/types/validator_set.go b/types/validator_set.go index 1d2f122c09..865b2847a4 100644 --- a/types/validator_set.go +++ b/types/validator_set.go @@ -660,7 +660,7 @@ func (vals *ValidatorSet) UpdateWithChangeSet(changes []*Validator) error { // includes which validators signed. For instance, Gaia incentivizes proposers // with a bonus for including more than +2/3 of the signatures. func (vals *ValidatorSet) VerifyCommit(chainID string, blockID BlockID, - partSetHeader PartSetHeader, height int64, commit *Commit) error { + height int64, commit *Commit) error { if commit == nil { return errors.New("nil commit") } @@ -678,11 +678,6 @@ func (vals *ValidatorSet) VerifyCommit(chainID string, blockID BlockID, blockID, commit.BlockID) } - if !partSetHeader.Equals(commit.PartSetHeader) { - return fmt.Errorf("invalid commit -- wrong Part Set eader: want %v, got %v", - partSetHeader, commit.PartSetHeader) - } - talliedVotingPower := int64(0) votingPowerNeeded := vals.TotalVotingPower() * 2 / 3 for idx, commitSig := range commit.Signatures { @@ -723,7 +718,7 @@ func (vals *ValidatorSet) VerifyCommit(chainID string, blockID BlockID, // This method is primarily used by the light client and does not check all the // signatures. func (vals *ValidatorSet) VerifyCommitLight(chainID string, blockID BlockID, - partSetHeader PartSetHeader, height int64, commit *Commit) error { + height int64, commit *Commit) error { if commit == nil { return errors.New("nil commit") } @@ -740,10 +735,6 @@ func (vals *ValidatorSet) VerifyCommitLight(chainID string, blockID BlockID, return fmt.Errorf("invalid commit -- wrong block ID: want %v, got %v", blockID, commit.BlockID) } - if !partSetHeader.Equals(commit.PartSetHeader) { - return fmt.Errorf("invalid commit -- wrong PartSetHeader: want %v, got %v", - partSetHeader, commit.PartSetHeader) - } talliedVotingPower := int64(0) votingPowerNeeded := vals.TotalVotingPower() * 2 / 3 diff --git a/types/validator_set_test.go b/types/validator_set_test.go index aabbca0545..c867b5acc9 100644 --- a/types/validator_set_test.go +++ b/types/validator_set_test.go @@ -683,7 +683,7 @@ func TestValidatorSet_VerifyCommit_All(t *testing.T) { require.NoError(t, err) vote.Signature = sig - commit := NewCommit(vote.Height, vote.Round, vote.BlockID, []CommitSig{vote.CommitSig()}, vote.PartSetHeader) + commit := NewCommit(vote.Height, vote.Round, vote.BlockID, []CommitSig{vote.CommitSig()}) vote2 := *vote sig2, err := privKey.Sign(VoteSignBytes("EpsilonEridani", v)) @@ -691,40 +691,38 @@ func TestValidatorSet_VerifyCommit_All(t *testing.T) { vote2.Signature = sig2 testCases := []struct { - description string - chainID string - blockID BlockID - partSetHeader PartSetHeader - height int64 - commit *Commit - expErr bool + description string + chainID string + blockID BlockID + height int64 + commit *Commit + expErr bool }{ - {"good", chainID, vote.BlockID, vote.PartSetHeader, vote.Height, commit, false}, + {"good", chainID, vote.BlockID, vote.Height, commit, false}, - {"wrong signature (#0)", "EpsilonEridani", vote.BlockID, vote.PartSetHeader, vote.Height, commit, true}, - {"wrong block ID", chainID, makeBlockIDRandom(), makePartSetHeaderRandom(), vote.Height, commit, true}, - {"wrong height", chainID, vote.BlockID, vote.PartSetHeader, vote.Height - 1, commit, true}, + {"wrong signature (#0)", "EpsilonEridani", vote.BlockID, vote.Height, commit, true}, + {"wrong block ID", chainID, makeBlockIDRandom(), vote.Height, commit, true}, + {"wrong height", chainID, vote.BlockID, vote.Height - 1, commit, true}, - {"wrong set size: 1 vs 0", chainID, vote.BlockID, vote.PartSetHeader, vote.Height, - NewCommit(vote.Height, vote.Round, vote.BlockID, []CommitSig{}, vote.PartSetHeader), true}, + {"wrong set size: 1 vs 0", chainID, vote.BlockID, vote.Height, + NewCommit(vote.Height, vote.Round, vote.BlockID, []CommitSig{}), true}, - {"wrong set size: 1 vs 2", chainID, vote.BlockID, vote.PartSetHeader, vote.Height, + {"wrong set size: 1 vs 2", chainID, vote.BlockID, vote.Height, NewCommit(vote.Height, vote.Round, vote.BlockID, - []CommitSig{vote.CommitSig(), {BlockIDFlag: BlockIDFlagAbsent}}, vote.PartSetHeader), true}, + []CommitSig{vote.CommitSig(), {BlockIDFlag: BlockIDFlagAbsent}}), true}, - {"insufficient voting power: got 0, needed more than 666", chainID, vote.BlockID, vote.PartSetHeader, vote.Height, - NewCommit(vote.Height, vote.Round, vote.BlockID, []CommitSig{{BlockIDFlag: BlockIDFlagAbsent}}, - vote.PartSetHeader), true, + {"insufficient voting power: got 0, needed more than 666", chainID, vote.BlockID, vote.Height, + NewCommit(vote.Height, vote.Round, vote.BlockID, []CommitSig{{BlockIDFlag: BlockIDFlagAbsent}}), true, }, - {"wrong signature (#0)", chainID, vote.BlockID, vote.PartSetHeader, vote.Height, - NewCommit(vote.Height, vote.Round, vote.BlockID, []CommitSig{vote2.CommitSig()}, vote.PartSetHeader), true}, + {"wrong signature (#0)", chainID, vote.BlockID, vote.Height, + NewCommit(vote.Height, vote.Round, vote.BlockID, []CommitSig{vote2.CommitSig()}), true}, } for _, tc := range testCases { tc := tc t.Run(tc.description, func(t *testing.T) { - err := vset.VerifyCommit(tc.chainID, tc.blockID, tc.partSetHeader, tc.height, tc.commit) + err := vset.VerifyCommit(tc.chainID, tc.blockID, tc.height, tc.commit) if tc.expErr { if assert.Error(t, err, "VerifyCommit") { assert.Contains(t, err.Error(), tc.description, "VerifyCommit") @@ -733,7 +731,7 @@ func TestValidatorSet_VerifyCommit_All(t *testing.T) { assert.NoError(t, err, "VerifyCommit") } - err = vset.VerifyCommitLight(tc.chainID, tc.blockID, tc.partSetHeader, tc.height, tc.commit) + err = vset.VerifyCommitLight(tc.chainID, tc.blockID, tc.height, tc.commit) if tc.expErr { if assert.Error(t, err, "VerifyCommitLight") { assert.Contains(t, err.Error(), tc.description, "VerifyCommitLight") @@ -750,11 +748,10 @@ func TestValidatorSet_VerifyCommit_CheckAllSignatures(t *testing.T) { chainID = "test_chain_id" h = int64(3) blockID = makeBlockIDRandom() - psh = makePartSetHeaderRandom() ) voteSet, valSet, vals := randVoteSet(h, 0, tmproto.PrecommitType, 4, 10) - commit, err := MakeCommit(blockID, psh, h, 0, voteSet, vals, time.Now()) + commit, err := MakeCommit(blockID, h, 0, voteSet, vals, time.Now()) require.NoError(t, err) // malleate 4th signature @@ -765,7 +762,7 @@ func TestValidatorSet_VerifyCommit_CheckAllSignatures(t *testing.T) { vote.Signature = v.Signature commit.Signatures[3] = vote.CommitSig() - err = valSet.VerifyCommit(chainID, blockID, psh, h, commit) + err = valSet.VerifyCommit(chainID, blockID, h, commit) if assert.Error(t, err) { assert.Contains(t, err.Error(), "wrong signature (#3)") } @@ -776,11 +773,10 @@ func TestValidatorSet_VerifyCommitLight_ReturnsAsSoonAsMajorityOfVotingPowerSign chainID = "test_chain_id" h = int64(3) blockID = makeBlockIDRandom() - psh = makePartSetHeaderRandom() ) voteSet, valSet, vals := randVoteSet(h, 0, tmproto.PrecommitType, 4, 10) - commit, err := MakeCommit(blockID, psh, h, 0, voteSet, vals, time.Now()) + commit, err := MakeCommit(blockID, h, 0, voteSet, vals, time.Now()) require.NoError(t, err) // malleate 4th signature (3 signatures are enough for 2/3+) @@ -791,7 +787,7 @@ func TestValidatorSet_VerifyCommitLight_ReturnsAsSoonAsMajorityOfVotingPowerSign vote.Signature = v.Signature commit.Signatures[3] = vote.CommitSig() - err = valSet.VerifyCommitLight(chainID, blockID, psh, h, commit) + err = valSet.VerifyCommitLight(chainID, blockID, h, commit) assert.NoError(t, err) } @@ -800,11 +796,10 @@ func TestValidatorSet_VerifyCommitLightTrusting_ReturnsAsSoonAsTrustLevelOfVotin chainID = "test_chain_id" h = int64(3) blockID = makeBlockIDRandom() - psh = makePartSetHeaderRandom() ) voteSet, valSet, vals := randVoteSet(h, 0, tmproto.PrecommitType, 4, 10) - commit, err := MakeCommit(blockID, psh, h, 0, voteSet, vals, time.Now()) + commit, err := MakeCommit(blockID, h, 0, voteSet, vals, time.Now()) require.NoError(t, err) // malleate 3rd signature (2 signatures are enough for 1/3+ trust level) @@ -1525,9 +1520,8 @@ func TestValSetUpdateOverflowRelated(t *testing.T) { func TestValidatorSet_VerifyCommitLightTrusting(t *testing.T) { var ( blockID = makeBlockIDRandom() - psh = makePartSetHeaderRandom() voteSet, originalValset, vals = randVoteSet(1, 1, tmproto.PrecommitType, 6, 1) - commit, err = MakeCommit(blockID, psh, 1, 1, voteSet, vals, time.Now()) + commit, err = MakeCommit(blockID, 1, 1, voteSet, vals, time.Now()) newValSet, _ = RandValidatorSet(2, 1) ) require.NoError(t, err) @@ -1567,9 +1561,8 @@ func TestValidatorSet_VerifyCommitLightTrusting(t *testing.T) { func TestValidatorSet_VerifyCommitLightTrustingErrorsOnOverflow(t *testing.T) { var ( blockID = makeBlockIDRandom() - psh = makePartSetHeaderRandom() voteSet, valSet, vals = randVoteSet(1, 1, tmproto.PrecommitType, 1, MaxTotalVotingPower) - commit, err = MakeCommit(blockID, psh, 1, 1, voteSet, vals, time.Now()) + commit, err = MakeCommit(blockID, 1, 1, voteSet, vals, time.Now()) ) require.NoError(t, err) diff --git a/types/vote.go b/types/vote.go index 1c82e4fbe1..8bcd3c7b6c 100644 --- a/types/vote.go +++ b/types/vote.go @@ -56,7 +56,6 @@ type Vote struct { ValidatorAddress Address `json:"validator_address"` ValidatorIndex int32 `json:"validator_index"` Signature []byte `json:"signature"` - PartSetHeader PartSetHeader `json:"part_set_header"` } // CommitSig converts the Vote to a CommitSig. @@ -176,10 +175,6 @@ func (vote *Vote) ValidateBasic() error { return fmt.Errorf("wrong BlockID: %v", err) } - if err := vote.PartSetHeader.ValidateBasic(); err != nil { - return fmt.Errorf("wrong PartSetHeader: %v", err) - } - // BlockID.ValidateBasic would not err if we for instance have an empty hash but a // non-empty PartsSetHeader: if !vote.BlockID.IsZero() && !vote.BlockID.IsComplete() { @@ -213,8 +208,6 @@ func (vote *Vote) ToProto() *tmproto.Vote { return nil } - psh := vote.PartSetHeader.ToProto() - return &tmproto.Vote{ Type: vote.Type, Height: vote.Height, @@ -224,7 +217,6 @@ func (vote *Vote) ToProto() *tmproto.Vote { ValidatorAddress: vote.ValidatorAddress, ValidatorIndex: vote.ValidatorIndex, Signature: vote.Signature, - PartSetHeader: &psh, } } @@ -240,11 +232,6 @@ func VoteFromProto(pv *tmproto.Vote) (*Vote, error) { return nil, err } - psh, err := PartSetHeaderFromProto(pv.PartSetHeader) - if err != nil { - return nil, err - } - vote := new(Vote) vote.Type = pv.Type vote.Height = pv.Height @@ -254,7 +241,6 @@ func VoteFromProto(pv *tmproto.Vote) (*Vote, error) { vote.ValidatorAddress = pv.ValidatorAddress vote.ValidatorIndex = pv.ValidatorIndex vote.Signature = pv.Signature - vote.PartSetHeader = *psh return vote, vote.ValidateBasic() } diff --git a/types/vote_set.go b/types/vote_set.go index 38295e878f..3daa1492df 100644 --- a/types/vote_set.go +++ b/types/vote_set.go @@ -65,14 +65,13 @@ type VoteSet struct { signedMsgType tmproto.SignedMsgType valSet *ValidatorSet - mtx tmsync.Mutex - votesBitArray *bits.BitArray - votes []*Vote // Primary votes to share - sum int64 // Sum of voting power for seen votes, discounting conflicts - maj23 *BlockID // First 2/3 majority seen - maj23PartSetHeader *PartSetHeader // First 2/3 majority seen partsetheader - votesByBlock map[string]*blockVotes // string(blockHash|blockParts) -> blockVotes - peerMaj23s map[P2PID]BlockID // Maj23 for each peer + mtx tmsync.Mutex + votesBitArray *bits.BitArray + votes []*Vote // Primary votes to share + sum int64 // Sum of voting power for seen votes, discounting conflicts + maj23 *BlockID // First 2/3 majority seen + votesByBlock map[string]*blockVotes // string(blockHash|blockParts) -> blockVotes + peerMaj23s map[P2PID]BlockID // Maj23 for each peer } // Constructs a new VoteSet struct used to accumulate votes for given height/round. @@ -290,8 +289,6 @@ func (voteSet *VoteSet) addVerifiedVote( if voteSet.maj23 == nil { maj23BlockID := vote.BlockID voteSet.maj23 = &maj23BlockID - maj23PartSetHeader := vote.PartSetHeader - voteSet.maj23PartSetHeader = &maj23PartSetHeader // And also copy votes over to voteSet.votes for i, vote := range votesByBlock.votes { if vote != nil { @@ -309,7 +306,7 @@ func (voteSet *VoteSet) addVerifiedVote( // this can cause memory issues. // TODO: implement ability to remove peers too // NOTE: VoteSet must not be nil -func (voteSet *VoteSet) SetPeerMaj23(peerID P2PID, blockID BlockID, partSetHeader PartSetHeader) error { +func (voteSet *VoteSet) SetPeerMaj23(peerID P2PID, blockID BlockID) error { if voteSet == nil { panic("SetPeerMaj23() on nil VoteSet") } @@ -354,7 +351,7 @@ func (voteSet *VoteSet) BitArray() *bits.BitArray { return voteSet.votesBitArray.Copy() } -func (voteSet *VoteSet) BitArrayByBlockID(blockID BlockID, partSetHeader PartSetHeader) *bits.BitArray { +func (voteSet *VoteSet) BitArrayByBlockID(blockID BlockID) *bits.BitArray { if voteSet == nil { return nil } @@ -430,16 +427,16 @@ func (voteSet *VoteSet) HasAll() bool { // If there was a +2/3 majority for blockID, return blockID and true. // Else, return the empty BlockID{} and false. -func (voteSet *VoteSet) TwoThirdsMajority() (blockID BlockID, partSetHeader PartSetHeader, ok bool) { +func (voteSet *VoteSet) TwoThirdsMajority() (blockID BlockID, ok bool) { if voteSet == nil { - return BlockID{}, PartSetHeader{}, false + return BlockID{}, false } voteSet.mtx.Lock() defer voteSet.mtx.Unlock() if voteSet.maj23 != nil { - return *voteSet.maj23, *voteSet.maj23PartSetHeader, true + return *voteSet.maj23, true } - return BlockID{}, PartSetHeader{}, false + return BlockID{}, false } //-------------------------------------------------------------------------------- @@ -601,7 +598,7 @@ func (voteSet *VoteSet) MakeCommit() *Commit { commitSigs[i] = commitSig } - return NewCommit(voteSet.GetHeight(), voteSet.GetRound(), *voteSet.maj23, commitSigs, *voteSet.maj23PartSetHeader) + return NewCommit(voteSet.GetHeight(), voteSet.GetRound(), *voteSet.maj23, commitSigs) } //-------------------------------------------------------------------------------- diff --git a/types/vote_set_test.go b/types/vote_set_test.go index fc5f9b8559..4265f5d199 100644 --- a/types/vote_set_test.go +++ b/types/vote_set_test.go @@ -3,7 +3,6 @@ package types import ( "bytes" "crypto/sha256" - "fmt" "testing" "github.com/stretchr/testify/assert" @@ -26,7 +25,7 @@ func TestVoteSet_AddVote_Good(t *testing.T) { assert.Nil(t, voteSet.GetByAddress(val0Addr)) assert.False(t, voteSet.BitArray().GetIndex(0)) - blockID, _, ok := voteSet.TwoThirdsMajority() + blockID, ok := voteSet.TwoThirdsMajority() assert.False(t, ok || !blockID.IsZero(), "there should be no 2/3 majority") vote := &Vote{ @@ -36,15 +35,14 @@ func TestVoteSet_AddVote_Good(t *testing.T) { Round: round, Type: tmproto.PrevoteType, Timestamp: tmtime.Now(), - BlockID: BlockID{nil}, - PartSetHeader: PartSetHeader{}, + BlockID: BlockID{nil, PartSetHeader{}}, } _, err = signAddVote(val0, vote, voteSet) require.NoError(t, err) assert.NotNil(t, voteSet.GetByAddress(val0Addr)) assert.True(t, voteSet.BitArray().GetIndex(0)) - blockID, _, ok = voteSet.TwoThirdsMajority() + blockID, ok = voteSet.TwoThirdsMajority() assert.False(t, ok || !blockID.IsZero(), "there should be no 2/3 majority") } @@ -59,8 +57,7 @@ func TestVoteSet_AddVote_Bad(t *testing.T) { Round: round, Timestamp: tmtime.Now(), Type: tmproto.PrevoteType, - BlockID: BlockID{nil}, - PartSetHeader: PartSetHeader{}, + BlockID: BlockID{nil, PartSetHeader{}}, } // val0 votes for nil. @@ -135,8 +132,7 @@ func TestVoteSet_2_3Majority(t *testing.T) { Round: round, Type: tmproto.PrevoteType, Timestamp: tmtime.Now(), - BlockID: BlockID{nil}, - PartSetHeader: PartSetHeader{}, + BlockID: BlockID{nil, PartSetHeader{}}, } // 6 out of 10 voted for nil. for i := int32(0); i < 6; i++ { @@ -147,7 +143,7 @@ func TestVoteSet_2_3Majority(t *testing.T) { _, err = signAddVote(privValidators[i], vote, voteSet) require.NoError(t, err) } - blockID, _, ok := voteSet.TwoThirdsMajority() + blockID, ok := voteSet.TwoThirdsMajority() assert.False(t, ok || !blockID.IsZero(), "there should be no 2/3 majority") // 7th validator voted for some blockhash @@ -158,7 +154,7 @@ func TestVoteSet_2_3Majority(t *testing.T) { vote := withValidator(voteProto, addr, 6) _, err = signAddVote(privValidators[6], withBlockHash(vote, tmrand.Bytes(32)), voteSet) require.NoError(t, err) - blockID, _, ok = voteSet.TwoThirdsMajority() + blockID, ok = voteSet.TwoThirdsMajority() assert.False(t, ok || !blockID.IsZero(), "there should be no 2/3 majority") } @@ -170,7 +166,7 @@ func TestVoteSet_2_3Majority(t *testing.T) { vote := withValidator(voteProto, addr, 7) _, err = signAddVote(privValidators[7], vote, voteSet) require.NoError(t, err) - blockID, _, ok = voteSet.TwoThirdsMajority() + blockID, ok = voteSet.TwoThirdsMajority() assert.True(t, ok || blockID.IsZero(), "there should be 2/3 majority for nil") } } @@ -190,8 +186,7 @@ func TestVoteSet_2_3MajorityRedux(t *testing.T) { Round: round, Timestamp: tmtime.Now(), Type: tmproto.PrevoteType, - BlockID: BlockID{blockHash}, - PartSetHeader: blockPartSetHeader, + BlockID: BlockID{blockHash, blockPartSetHeader}, } // 66 out of 100 voted for nil. @@ -203,7 +198,7 @@ func TestVoteSet_2_3MajorityRedux(t *testing.T) { _, err = signAddVote(privValidators[i], vote, voteSet) require.NoError(t, err) } - blockID, _, ok := voteSet.TwoThirdsMajority() + blockID, ok := voteSet.TwoThirdsMajority() assert.False(t, ok || !blockID.IsZero(), "there should be no 2/3 majority") @@ -215,11 +210,39 @@ func TestVoteSet_2_3MajorityRedux(t *testing.T) { vote := withValidator(voteProto, adrr, 66) _, err = signAddVote(privValidators[66], withBlockHash(vote, nil), voteSet) require.NoError(t, err) - blockID, _, ok = voteSet.TwoThirdsMajority() + blockID, ok = voteSet.TwoThirdsMajority() assert.False(t, ok || !blockID.IsZero(), "there should be no 2/3 majority: last vote added was nil") } + // 68th validator voted for a different BlockParts PartSetHeader + { + pubKey, err := privValidators[67].GetPubKey() + require.NoError(t, err) + addr := pubKey.Address() + vote := withValidator(voteProto, addr, 67) + blockPartsHeader := PartSetHeader{blockPartsTotal, crypto.CRandBytes(32)} + _, err = signAddVote(privValidators[67], withBlockPartSetHeader(vote, blockPartsHeader), voteSet) + require.NoError(t, err) + blockID, ok = voteSet.TwoThirdsMajority() + assert.False(t, ok || !blockID.IsZero(), + "there should be no 2/3 majority: last vote added had different PartSetHeader Hash") + } + + // 69th validator voted for different BlockParts Total + { + pubKey, err := privValidators[68].GetPubKey() + require.NoError(t, err) + addr := pubKey.Address() + vote := withValidator(voteProto, addr, 68) + blockPartsHeader := PartSetHeader{blockPartsTotal + 1, blockPartSetHeader.Hash} + _, err = signAddVote(privValidators[68], withBlockPartSetHeader(vote, blockPartsHeader), voteSet) + require.NoError(t, err) + blockID, ok = voteSet.TwoThirdsMajority() + assert.False(t, ok || !blockID.IsZero(), + "there should be no 2/3 majority: last vote added had different PartSetHeader Total") + } + // 70th validator voted for different BlockHash { pubKey, err := privValidators[69].GetPubKey() @@ -228,8 +251,7 @@ func TestVoteSet_2_3MajorityRedux(t *testing.T) { vote := withValidator(voteProto, addr, 69) _, err = signAddVote(privValidators[69], withBlockHash(vote, tmrand.Bytes(32)), voteSet) require.NoError(t, err) - blockID, _, ok = voteSet.TwoThirdsMajority() - fmt.Println(blockID) + blockID, ok = voteSet.TwoThirdsMajority() assert.False(t, ok || !blockID.IsZero(), "there should be no 2/3 majority: last vote added had different BlockHash") } @@ -242,8 +264,8 @@ func TestVoteSet_2_3MajorityRedux(t *testing.T) { vote := withValidator(voteProto, addr, 70) _, err = signAddVote(privValidators[70], vote, voteSet) require.NoError(t, err) - blockID, _, ok = voteSet.TwoThirdsMajority() - assert.True(t, ok && blockID.Equals(BlockID{blockHash}), + blockID, ok = voteSet.TwoThirdsMajority() + assert.True(t, ok && blockID.Equals(BlockID{blockHash, blockPartSetHeader}), "there should be 2/3 majority") } } @@ -261,8 +283,7 @@ func TestVoteSet_Conflicts(t *testing.T) { Round: round, Timestamp: tmtime.Now(), Type: tmproto.PrevoteType, - BlockID: BlockID{nil}, - PartSetHeader: PartSetHeader{}, + BlockID: BlockID{nil, PartSetHeader{}}, } val0, err := privValidators[0].GetPubKey() @@ -287,7 +308,7 @@ func TestVoteSet_Conflicts(t *testing.T) { } // start tracking blockHash1 - err = voteSet.SetPeerMaj23("peerA", BlockID{blockHash1}, PartSetHeader{}) + err = voteSet.SetPeerMaj23("peerA", BlockID{blockHash1, PartSetHeader{}}) require.NoError(t, err) // val0 votes again for blockHash1. @@ -299,7 +320,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{}}) require.Error(t, err) // val0 votes again for blockHash1. @@ -351,7 +372,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{}}) require.NoError(t, err) // val2 votes for blockHash1. @@ -369,7 +390,7 @@ func TestVoteSet_Conflicts(t *testing.T) { if !voteSet.HasTwoThirdsMajority() { t.Errorf("we should have 2/3 majority for blockHash1") } - blockIDMaj23, _, _ := voteSet.TwoThirdsMajority() + blockIDMaj23, _ := voteSet.TwoThirdsMajority() if !bytes.Equal(blockIDMaj23.Hash, blockHash1) { t.Errorf("got the wrong 2/3 majority blockhash") } @@ -390,8 +411,7 @@ func TestVoteSet_MakeCommit(t *testing.T) { Round: round, Timestamp: tmtime.Now(), Type: tmproto.PrecommitType, - BlockID: BlockID{blockHash}, - PartSetHeader: blockPartSetHeader, + BlockID: BlockID{blockHash, blockPartSetHeader}, } // 6 out of 10 voted for some block. @@ -509,6 +529,6 @@ func withBlockHash(vote *Vote, blockHash []byte) *Vote { // Convenience: Return new vote with different blockParts func withBlockPartSetHeader(vote *Vote, blockPartsHeader PartSetHeader) *Vote { vote = vote.Copy() - vote.PartSetHeader = blockPartsHeader + vote.BlockID.PartSetHeader = blockPartsHeader return vote } diff --git a/types/vote_test.go b/types/vote_test.go index b91bc79f20..a1060d9b47 100644 --- a/types/vote_test.go +++ b/types/vote_test.go @@ -36,10 +36,10 @@ func exampleVote(t byte) *Vote { Timestamp: stamp, BlockID: BlockID{ Hash: tmhash.Sum([]byte("blockID_hash")), - }, - PartSetHeader: PartSetHeader{ - Total: 1000000, - Hash: tmhash.Sum([]byte("blockID_part_set_header_hash")), + PartSetHeader: PartSetHeader{ + Total: 1000000, + Hash: tmhash.Sum([]byte("blockID_part_set_header_hash")), + }, }, ValidatorAddress: crypto.AddressHash([]byte("validator_address")), ValidatorIndex: 56789, @@ -67,13 +67,13 @@ func TestVoteSignBytesTestVectors(t *testing.T) { 0: { "", &Vote{}, // NOTE: Height and Round are skipped here. This case needs to be considered while parsing. - []byte{0xf, 0x2a, 0xb, 0x8, 0x80, 0x92, 0xb8, 0xc3, 0x98, 0xfe, 0xff, 0xff, 0xff, 0x1, 0x3a, 0x0}, + []byte{0xd, 0x2a, 0xb, 0x8, 0x80, 0x92, 0xb8, 0xc3, 0x98, 0xfe, 0xff, 0xff, 0xff, 0x1}, }, // with proper (fixed size) height and round (PreCommit): 1: { "", &Vote{Height: 1, Round: 1, Type: tmproto.PrecommitType}, []byte{ - 0x23, // length + 0x21, // length 0x8, // (field_number << 3) | wire_type 0x2, // PrecommitType 0x11, // (field_number << 3) | wire_type @@ -82,13 +82,13 @@ func TestVoteSignBytesTestVectors(t *testing.T) { 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, // round 0x2a, // (field_number << 3) | wire_type // remaining fields (timestamp): - 0xb, 0x8, 0x80, 0x92, 0xb8, 0xc3, 0x98, 0xfe, 0xff, 0xff, 0xff, 0x1, 0x3a, 0x0}, + 0xb, 0x8, 0x80, 0x92, 0xb8, 0xc3, 0x98, 0xfe, 0xff, 0xff, 0xff, 0x1}, }, // with proper (fixed size) height and round (PreVote): 2: { "", &Vote{Height: 1, Round: 1, Type: tmproto.PrevoteType}, []byte{ - 0x23, // length + 0x21, // length 0x8, // (field_number << 3) | wire_type 0x1, // PrevoteType 0x11, // (field_number << 3) | wire_type @@ -97,25 +97,25 @@ func TestVoteSignBytesTestVectors(t *testing.T) { 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, // round 0x2a, // (field_number << 3) | wire_type // remaining fields (timestamp): - 0xb, 0x8, 0x80, 0x92, 0xb8, 0xc3, 0x98, 0xfe, 0xff, 0xff, 0xff, 0x1, 0x3a, 0x0}, + 0xb, 0x8, 0x80, 0x92, 0xb8, 0xc3, 0x98, 0xfe, 0xff, 0xff, 0xff, 0x1}, }, 3: { "", &Vote{Height: 1, Round: 1}, []byte{ - 0x21, // length + 0x1f, // length 0x11, // (field_number << 3) | wire_type 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, // height 0x19, // (field_number << 3) | wire_type 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, // round // remaining fields (timestamp): 0x2a, - 0xb, 0x8, 0x80, 0x92, 0xb8, 0xc3, 0x98, 0xfe, 0xff, 0xff, 0xff, 0x1, 0x3a, 0x0}, + 0xb, 0x8, 0x80, 0x92, 0xb8, 0xc3, 0x98, 0xfe, 0xff, 0xff, 0xff, 0x1}, }, // containing non-empty chain_id: 4: { "test_chain_id", &Vote{Height: 1, Round: 1}, []byte{ - 0x30, // length + 0x2e, // length 0x11, // (field_number << 3) | wire_type 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, // height 0x19, // (field_number << 3) | wire_type @@ -125,7 +125,7 @@ func TestVoteSignBytesTestVectors(t *testing.T) { 0xb, 0x8, 0x80, 0x92, 0xb8, 0xc3, 0x98, 0xfe, 0xff, 0xff, 0xff, 0x1, // timestamp // (field_number << 3) | wire_type 0x32, - 0xd, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x5f, 0x69, 0x64, 0x3a, 0x0}, // chainID + 0xd, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x5f, 0x69, 0x64}, // chainID }, } for i, tc := range tests { @@ -137,8 +137,8 @@ func TestVoteSignBytesTestVectors(t *testing.T) { } func TestVoteProposalNotEq(t *testing.T) { - cv := CanonicalizeVote("", &tmproto.Vote{Height: 1, Round: 1, PartSetHeader: &tmproto.PartSetHeader{}}) - p := CanonicalizeProposal("", &tmproto.Proposal{Height: 1, Round: 1, PartSetHeader: &tmproto.PartSetHeader{}}) + cv := CanonicalizeVote("", &tmproto.Vote{Height: 1, Round: 1}) + p := CanonicalizeProposal("", &tmproto.Proposal{Height: 1, Round: 1}) vb, err := proto.Marshal(&cv) require.NoError(t, err) pb, err := proto.Marshal(&p) @@ -242,9 +242,8 @@ func TestVoteValidateBasic(t *testing.T) { {"Good Vote", func(v *Vote) {}, false}, {"Negative Height", func(v *Vote) { v.Height = -1 }, true}, {"Negative Round", func(v *Vote) { v.Round = -1 }, true}, - {"Invalid BlockID and PartSetHeader", func(v *Vote) { - v.BlockID = BlockID{[]byte{1, 2, 3}} - v.PartSetHeader = PartSetHeader{111, []byte("blockparts")} + {"Invalid BlockID", func(v *Vote) { + v.BlockID = BlockID{[]byte{1, 2, 3}, PartSetHeader{111, []byte("blockparts")}} }, true}, {"Invalid Address", func(v *Vote) { v.ValidatorAddress = make([]byte, 1) }, true}, {"Invalid ValidatorIndex", func(v *Vote) { v.ValidatorIndex = -1 }, true}, From cb6f83fec887c8ee221bca225cc89ed0293651f3 Mon Sep 17 00:00:00 2001 From: evan-forbes Date: Tue, 24 Aug 2021 17:11:27 -0500 Subject: [PATCH 04/10] Revert "Save and load block data using IPFS (#374)" This reverts commit 8da16447f34680639033b531ed10b9ab756a14e0. --- blockchain/v0/reactor.go | 13 ++--- blockchain/v0/reactor_test.go | 20 +++----- consensus/byzantine_test.go | 9 ++-- consensus/common_test.go | 17 +++---- consensus/mempool_test.go | 11 +++-- consensus/reactor_test.go | 4 +- consensus/replay.go | 11 ++--- consensus/replay_file.go | 2 +- consensus/replay_test.go | 30 +++++------- consensus/state.go | 6 +-- consensus/wal_test.go | 2 +- evidence/pool_test.go | 9 ++-- go.mod | 1 - ipfs/mock.go | 7 --- node/node.go | 2 +- node/node_test.go | 3 +- rpc/core/blocks.go | 21 ++------ rpc/core/blocks_test.go | 27 ++++------- rpc/core/tx.go | 10 +--- state/services.go | 8 ++-- store/mock.go | 21 -------- store/store.go | 85 +++++++++++++-------------------- store/store_test.go | 90 +++++++++++------------------------ 23 files changed, 130 insertions(+), 279 deletions(-) delete mode 100644 store/mock.go diff --git a/blockchain/v0/reactor.go b/blockchain/v0/reactor.go index f30a40a109..55bde3b247 100644 --- a/blockchain/v0/reactor.go +++ b/blockchain/v0/reactor.go @@ -1,7 +1,6 @@ package v0 import ( - "context" "fmt" "reflect" "time" @@ -179,10 +178,7 @@ func (bcR *BlockchainReactor) RemovePeer(peer p2p.Peer, reason interface{}) { func (bcR *BlockchainReactor) respondToPeer(msg *bcproto.BlockRequest, src p2p.Peer) (queued bool) { - block, err := bcR.store.LoadBlock(context.TODO(), msg.Height) - if err != nil { - panic(err) - } + block := bcR.store.LoadBlock(msg.Height) if block != nil { bl, err := block.ToProto() if err != nil { @@ -422,14 +418,11 @@ FOR_LOOP: bcR.pool.PopRequest() // TODO: batch saves so we dont persist to disk every block - err := bcR.store.SaveBlock(context.TODO(), first, firstParts, second.LastCommit) - if err != nil { - // an error is only returned if something with the local IPFS blockstore is seriously wrong - panic(err) - } + bcR.store.SaveBlock(first, firstParts, second.LastCommit) // TODO: same thing for app - but we would need a way to get the hash // without persisting the state. + var err error state, _, err = bcR.blockExec.ApplyBlock(state, firstID, first) if err != nil { // TODO This is bad, are we zombie? diff --git a/blockchain/v0/reactor_test.go b/blockchain/v0/reactor_test.go index cf774e95f0..55155cdbb8 100644 --- a/blockchain/v0/reactor_test.go +++ b/blockchain/v0/reactor_test.go @@ -1,7 +1,6 @@ package v0 import ( - "context" "crypto/sha256" "fmt" "os" @@ -9,6 +8,7 @@ import ( "testing" "time" + mdutils "github.com/ipfs/go-merkledag/test" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" @@ -69,9 +69,10 @@ func newBlockchainReactor( panic(fmt.Errorf("error start app: %w", err)) } + blockDB := memdb.NewDB() stateDB := memdb.NewDB() stateStore := sm.NewStore(stateDB) - blockStore := store.MockBlockStore(nil) + blockStore := store.NewBlockStore(blockDB, mdutils.Mock()) state, err := stateStore.LoadFromDBOrGenesisDoc(genDoc) if err != nil { @@ -99,10 +100,7 @@ func newBlockchainReactor( lastCommit := types.NewCommit(blockHeight-1, 0, types.BlockID{}, nil) if blockHeight > 1 { lastBlockMeta := blockStore.LoadBlockMeta(blockHeight - 1) - lastBlock, err := blockStore.LoadBlock(context.TODO(), blockHeight-1) - if err != nil { - panic(err) - } + lastBlock := blockStore.LoadBlock(blockHeight - 1) vote, err := types.MakeVote( lastBlock.Header.Height, @@ -129,10 +127,7 @@ func newBlockchainReactor( panic(fmt.Errorf("error apply block: %w", err)) } - err := blockStore.SaveBlock(context.TODO(), thisBlock, thisParts, lastCommit) - if err != nil { - panic(err) - } + blockStore.SaveBlock(thisBlock, thisParts, lastCommit) } bcReactor := NewBlockchainReactor(state.Copy(), blockExec, blockStore, fastSync) @@ -189,10 +184,7 @@ func TestNoBlockResponse(t *testing.T) { assert.Equal(t, maxBlockHeight, reactorPairs[0].reactor.store.Height()) for _, tt := range tests { - block, err := reactorPairs[1].reactor.store.LoadBlock(context.TODO(), tt.height) - if err != nil { - panic(err) - } + block := reactorPairs[1].reactor.store.LoadBlock(tt.height) if tt.existent { assert.True(t, block != nil) } else { diff --git a/consensus/byzantine_test.go b/consensus/byzantine_test.go index 0934785e37..2c2efa2879 100644 --- a/consensus/byzantine_test.go +++ b/consensus/byzantine_test.go @@ -9,9 +9,7 @@ import ( "testing" "time" - "github.com/ipfs/go-blockservice" - offline "github.com/ipfs/go-ipfs-exchange-offline" - "github.com/ipfs/go-merkledag" + mdutils "github.com/ipfs/go-merkledag/test" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" @@ -59,9 +57,8 @@ func TestByzantinePrevoteEquivocation(t *testing.T) { app.InitChain(abci.RequestInitChain{Validators: vals}) blockDB := memdb.NewDB() - bs := ipfs.MockBlockStore() - dag := merkledag.NewDAGService(blockservice.New(bs, offline.Exchange(bs))) - blockStore := store.NewBlockStore(blockDB, bs, log.TestingLogger()) + dag := mdutils.Mock() + blockStore := store.NewBlockStore(blockDB, dag) // one for mempool, one for consensus mtx := new(tmsync.Mutex) diff --git a/consensus/common_test.go b/consensus/common_test.go index b00468ccf5..23dfef6bc8 100644 --- a/consensus/common_test.go +++ b/consensus/common_test.go @@ -14,10 +14,7 @@ import ( "time" "github.com/go-kit/kit/log/term" - "github.com/ipfs/go-blockservice" - offline "github.com/ipfs/go-ipfs-exchange-offline" format "github.com/ipfs/go-ipld-format" - "github.com/ipfs/go-merkledag" mdutils "github.com/ipfs/go-merkledag/test" "github.com/stretchr/testify/require" @@ -359,7 +356,7 @@ func subscribeToVoter(cs *State, addr []byte) <-chan tmpubsub.Message { func newState(state sm.State, pv types.PrivValidator, app abci.Application, ipfsDagAPI format.DAGService) *State { config := cfg.ResetTestRoot("consensus_state_test") - return newStateWithConfig(config, state, pv, app) + return newStateWithConfig(config, state, pv, app, ipfsDagAPI) } func newStateWithConfig( @@ -367,9 +364,10 @@ func newStateWithConfig( state sm.State, pv types.PrivValidator, app abci.Application, + ipfsDagAPI format.DAGService, ) *State { blockDB := memdb.NewDB() - return newStateWithConfigAndBlockStore(thisConfig, state, pv, app, blockDB) + return newStateWithConfigAndBlockStore(thisConfig, state, pv, app, blockDB, ipfsDagAPI) } func newStateWithConfigAndBlockStore( @@ -378,11 +376,10 @@ func newStateWithConfigAndBlockStore( pv types.PrivValidator, app abci.Application, blockDB dbm.DB, + dag format.DAGService, ) *State { // Get BlockStore - bs := ipfs.MockBlockStore() - dag := merkledag.NewDAGService(blockservice.New(bs, offline.Exchange(bs))) - blockStore := store.NewBlockStore(blockDB, bs, log.TestingLogger()) + blockStore := store.NewBlockStore(blockDB, dag) // one for mempool, one for consensus mtx := new(tmsync.Mutex) @@ -711,7 +708,7 @@ func randConsensusNet( vals := types.TM2PB.ValidatorUpdates(state.Validators) app.InitChain(abci.RequestInitChain{Validators: vals}) - css[i] = newStateWithConfigAndBlockStore(thisConfig, state, privVals[i], app, stateDB) + css[i] = newStateWithConfigAndBlockStore(thisConfig, state, privVals[i], app, stateDB, mdutils.Mock()) css[i].SetTimeoutTicker(tickerFunc()) css[i].SetLogger(logger.With("validator", i, "module", "consensus")) } @@ -774,7 +771,7 @@ func randConsensusNetWithPeers( app.InitChain(abci.RequestInitChain{Validators: vals}) // sm.SaveState(stateDB,state) //height 1's validatorsInfo already saved in LoadStateFromDBOrGenesisDoc above - css[i] = newStateWithConfig(thisConfig, state, privVal, app) + css[i] = newStateWithConfig(thisConfig, state, privVal, app, mdutils.Mock()) css[i].SetTimeoutTicker(tickerFunc()) css[i].SetLogger(logger.With("validator", i, "module", "consensus")) } diff --git a/consensus/mempool_test.go b/consensus/mempool_test.go index 1624e2e704..cbbafa0292 100644 --- a/consensus/mempool_test.go +++ b/consensus/mempool_test.go @@ -7,6 +7,7 @@ import ( "testing" "time" + mdutils "github.com/ipfs/go-merkledag/test" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" @@ -29,7 +30,7 @@ func TestMempoolNoProgressUntilTxsAvailable(t *testing.T) { config.Consensus.CreateEmptyBlocks = false state, privVals := randGenesisState(1, false, 10) - cs := newStateWithConfig(config, state, privVals[0], NewCounterApplication()) + cs := newStateWithConfig(config, state, privVals[0], NewCounterApplication(), mdutils.Mock()) assertMempool(cs.txNotifier).EnableTxsAvailable() height, round := cs.Height, cs.Round newBlockCh := subscribe(cs.eventBus, types.EventQueryNewBlock) @@ -49,7 +50,7 @@ func TestMempoolProgressAfterCreateEmptyBlocksInterval(t *testing.T) { config.Consensus.CreateEmptyBlocksInterval = ensureTimeout state, privVals := randGenesisState(1, false, 10) - cs := newStateWithConfig(config, state, privVals[0], NewCounterApplication()) + cs := newStateWithConfig(config, state, privVals[0], NewCounterApplication(), mdutils.Mock()) assertMempool(cs.txNotifier).EnableTxsAvailable() @@ -67,7 +68,7 @@ func TestMempoolProgressInHigherRound(t *testing.T) { config.Consensus.CreateEmptyBlocks = false state, privVals := randGenesisState(1, false, 10) - cs := newStateWithConfig(config, state, privVals[0], NewCounterApplication()) + cs := newStateWithConfig(config, state, privVals[0], NewCounterApplication(), mdutils.Mock()) assertMempool(cs.txNotifier).EnableTxsAvailable() height, round := cs.Height, cs.Round @@ -117,7 +118,7 @@ func TestMempoolTxConcurrentWithCommit(t *testing.T) { blockDB := memdb.NewDB() stateStore := sm.NewStore(blockDB) - cs := newStateWithConfigAndBlockStore(config, state, privVals[0], NewCounterApplication(), blockDB) + cs := newStateWithConfigAndBlockStore(config, state, privVals[0], NewCounterApplication(), blockDB, mdutils.Mock()) err := stateStore.Save(state) require.NoError(t, err) newBlockHeaderCh := subscribe(cs.eventBus, types.EventQueryNewBlockHeader) @@ -143,7 +144,7 @@ func TestMempoolRmBadTx(t *testing.T) { blockDB := memdb.NewDB() stateStore := sm.NewStore(blockDB) - cs := newStateWithConfigAndBlockStore(config, state, privVals[0], app, blockDB) + cs := newStateWithConfigAndBlockStore(config, state, privVals[0], app, blockDB, mdutils.Mock()) err := stateStore.Save(state) require.NoError(t, err) diff --git a/consensus/reactor_test.go b/consensus/reactor_test.go index a0c668bdb5..a322919436 100644 --- a/consensus/reactor_test.go +++ b/consensus/reactor_test.go @@ -155,8 +155,10 @@ func TestReactorWithEvidence(t *testing.T) { // duplicate code from: // css[i] = newStateWithConfig(thisConfig, state, privVals[i], app) + blockDB := memdb.NewDB() dag := mdutils.Mock() - blockStore := store.MockBlockStore(nil) + blockStore := store.NewBlockStore(blockDB, dag) + // one for mempool, one for consensus mtx := new(tmsync.Mutex) proxyAppConnMem := abcicli.NewLocalClient(mtx, app) diff --git a/consensus/replay.go b/consensus/replay.go index e01845abf6..1bc77f9e51 100644 --- a/consensus/replay.go +++ b/consensus/replay.go @@ -463,10 +463,7 @@ func (h *Handshaker) replayBlocks( } for i := firstBlock; i <= finalBlock; i++ { h.logger.Info("Applying block", "height", i) - block, err := h.store.LoadBlock(context.TODO(), i) - if err != nil { - return nil, err - } + block := h.store.LoadBlock(i) // Extra check to ensure the app was not changed in a way it shouldn't have. if len(appHash) > 0 { assertAppHashEqualsOneFromBlock(appHash, block) @@ -495,10 +492,7 @@ func (h *Handshaker) replayBlocks( // ApplyBlock on the proxyApp with the last block. func (h *Handshaker) replayBlock(state sm.State, height int64, proxyApp proxy.AppConnConsensus) (sm.State, error) { - block, err := h.store.LoadBlock(context.TODO(), height) - if err != nil { - return sm.State{}, err - } + block := h.store.LoadBlock(height) meta := h.store.LoadBlockMeta(height) // Use stubs for both mempool and evidence pool since no transactions nor @@ -506,6 +500,7 @@ func (h *Handshaker) replayBlock(state sm.State, height int64, proxyApp proxy.Ap blockExec := sm.NewBlockExecutor(h.stateStore, h.logger, proxyApp, emptyMempool{}, sm.EmptyEvidencePool{}) blockExec.SetEventBus(h.eventBus) + var err error state, _, err = blockExec.ApplyBlock(state, meta.BlockID, block) if err != nil { return sm.State{}, err diff --git a/consensus/replay_file.go b/consensus/replay_file.go index 5d5682f41a..92439dea2f 100644 --- a/consensus/replay_file.go +++ b/consensus/replay_file.go @@ -291,7 +291,7 @@ func newConsensusStateForReplay(config cfg.BaseConfig, csConfig *cfg.ConsensusCo tmos.Exit(err.Error()) } dag := mdutils.Mock() - blockStore := store.MockBlockStore(blockStoreDB) + blockStore := store.NewBlockStore(blockStoreDB, dag) // Get State stateDB, err := badgerdb.NewDB("state", config.DBDir()) diff --git a/consensus/replay_test.go b/consensus/replay_test.go index a6888d3c45..8e157eb622 100644 --- a/consensus/replay_test.go +++ b/consensus/replay_test.go @@ -79,6 +79,7 @@ func startNewStateAndWaitForBlock(t *testing.T, consensusReplayConfig *cfg.Confi privValidator, kvstore.NewApplication(), blockDB, + mdutils.Mock(), ) cs.SetLogger(logger) @@ -173,6 +174,7 @@ LOOP: privValidator, kvstore.NewApplication(), blockDB, + mdutils.Mock(), ) cs.SetLogger(logger) @@ -546,9 +548,7 @@ func TestSimulateValidatorsChange(t *testing.T) { sim.Chain = make([]*types.Block, 0) sim.Commits = make([]*types.Commit, 0) for i := 1; i <= numBlocks; i++ { - blck, err := css[0].blockStore.LoadBlock(context.TODO(), int64(i)) - require.NoError(t, err) - sim.Chain = append(sim.Chain, blck) + sim.Chain = append(sim.Chain, css[0].blockStore.LoadBlock(int64(i))) sim.Commits = append(sim.Commits, css[0].blockStore.LoadBlockCommit(int64(i))) } } @@ -1195,15 +1195,13 @@ func newMockBlockStore(config *cfg.Config, params tmproto.ConsensusParams) *mock return &mockBlockStore{config, params, nil, nil, 0, mdutils.Mock()} } -func (bs *mockBlockStore) Height() int64 { return int64(len(bs.chain)) } -func (bs *mockBlockStore) Base() int64 { return bs.base } -func (bs *mockBlockStore) Size() int64 { return bs.Height() - bs.Base() + 1 } -func (bs *mockBlockStore) LoadBaseMeta() *types.BlockMeta { return bs.LoadBlockMeta(bs.base) } -func (bs *mockBlockStore) LoadBlock(ctx context.Context, height int64) (*types.Block, error) { - return bs.chain[height-1], nil -} -func (bs *mockBlockStore) LoadBlockByHash(ctx context.Context, hash []byte) (*types.Block, error) { - return bs.chain[int64(len(bs.chain))-1], nil +func (bs *mockBlockStore) Height() int64 { return int64(len(bs.chain)) } +func (bs *mockBlockStore) Base() int64 { return bs.base } +func (bs *mockBlockStore) Size() int64 { return bs.Height() - bs.Base() + 1 } +func (bs *mockBlockStore) LoadBaseMeta() *types.BlockMeta { return bs.LoadBlockMeta(bs.base) } +func (bs *mockBlockStore) LoadBlock(height int64) *types.Block { return bs.chain[height-1] } +func (bs *mockBlockStore) LoadBlockByHash(hash []byte) *types.Block { + return bs.chain[int64(len(bs.chain))-1] } func (bs *mockBlockStore) LoadBlockMeta(height int64) *types.BlockMeta { block := bs.chain[height-1] @@ -1213,13 +1211,7 @@ func (bs *mockBlockStore) LoadBlockMeta(height int64) *types.BlockMeta { } } func (bs *mockBlockStore) LoadBlockPart(height int64, index int) *types.Part { return nil } -func (bs *mockBlockStore) SaveBlock( - ctx context.Context, - block *types.Block, - blockParts *types.PartSet, - seenCommit *types.Commit, -) error { - return nil +func (bs *mockBlockStore) SaveBlock(block *types.Block, blockParts *types.PartSet, seenCommit *types.Commit) { } func (bs *mockBlockStore) LoadBlockCommit(height int64) *types.Commit { return bs.commits[height-1] diff --git a/consensus/state.go b/consensus/state.go index 659ae9d7a0..a1476ba7c6 100644 --- a/consensus/state.go +++ b/consensus/state.go @@ -2,7 +2,6 @@ package consensus import ( "bytes" - "context" "errors" "fmt" "io/ioutil" @@ -1545,10 +1544,7 @@ func (cs *State) finalizeCommit(height int64) { // but may differ from the LastCommit included in the next block precommits := cs.Votes.Precommits(cs.CommitRound) seenCommit := precommits.MakeCommit() - err := cs.blockStore.SaveBlock(context.TODO(), block, blockParts, seenCommit) - if err != nil { - panic(err) - } + cs.blockStore.SaveBlock(block, blockParts, seenCommit) } else { // Happens during replay if we already saved the block but didn't commit cs.Logger.Info("Calling finalizeCommit on already stored block", "height", block.Height) diff --git a/consensus/wal_test.go b/consensus/wal_test.go index 75778d3902..08d1d969a5 100644 --- a/consensus/wal_test.go +++ b/consensus/wal_test.go @@ -311,7 +311,7 @@ func walGenerateNBlocks(t *testing.T, wr io.Writer, numBlocks int) (err error) { t.Error(err) } dag := mdutils.Mock() - blockStore := store.MockBlockStore(blockStoreDB) + blockStore := store.NewBlockStore(blockStoreDB, dag) proxyApp := proxy.NewAppConns(proxy.NewLocalClientCreator(app)) proxyApp.SetLogger(logger.With("module", "proxy")) diff --git a/evidence/pool_test.go b/evidence/pool_test.go index 55623c6538..bb1a06baaa 100644 --- a/evidence/pool_test.go +++ b/evidence/pool_test.go @@ -1,11 +1,11 @@ package evidence_test import ( - "context" "os" "testing" "time" + mdutils "github.com/ipfs/go-merkledag/test" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" "github.com/stretchr/testify/require" @@ -396,7 +396,7 @@ func initializeValidatorState(privVal types.PrivValidator, height int64) sm.Stor // initializeBlockStore creates a block storage and populates it w/ a dummy // block at +height+. func initializeBlockStore(db dbm.DB, state sm.State, valAddr []byte) *store.BlockStore { - blockStore := store.MockBlockStore(db) + blockStore := store.NewBlockStore(db, mdutils.Mock()) for i := int64(1); i <= state.LastBlockHeight; i++ { lastCommit := makeCommit(i-1, valAddr) @@ -408,10 +408,7 @@ func initializeBlockStore(db dbm.DB, state sm.State, valAddr []byte) *store.Bloc partSet := block.MakePartSet(parts) seenCommit := makeCommit(i, valAddr) - err := blockStore.SaveBlock(context.TODO(), block, partSet, seenCommit) - if err != nil { - panic(err) - } + blockStore.SaveBlock(block, partSet, seenCommit) } return blockStore diff --git a/go.mod b/go.mod index 6cf863b7c6..525e0e21e8 100644 --- a/go.mod +++ b/go.mod @@ -28,7 +28,6 @@ require ( github.com/ipfs/go-ipfs-api v0.2.0 github.com/ipfs/go-ipfs-blockstore v0.1.4 github.com/ipfs/go-ipfs-config v0.11.0 - github.com/ipfs/go-ipfs-exchange-offline v0.0.1 github.com/ipfs/go-ipfs-routing v0.1.0 github.com/ipfs/go-ipld-format v0.2.0 github.com/ipfs/go-merkledag v0.3.2 diff --git a/ipfs/mock.go b/ipfs/mock.go index 40a8ff36e5..45e66e542e 100644 --- a/ipfs/mock.go +++ b/ipfs/mock.go @@ -3,9 +3,6 @@ package ipfs import ( "context" - ds "github.com/ipfs/go-datastore" - ds_sync "github.com/ipfs/go-datastore/sync" - blockstore "github.com/ipfs/go-ipfs-blockstore" nilrouting "github.com/ipfs/go-ipfs-routing/none" "github.com/ipfs/go-ipfs/core" coremock "github.com/ipfs/go-ipfs/core/mock" @@ -46,7 +43,3 @@ func MockRouting() routing.Routing { croute, _ := nilrouting.ConstructNilRouting(context.TODO(), nil, nil, nil) return croute } - -func MockBlockStore() blockstore.Blockstore { - return blockstore.NewBlockstore(ds_sync.MutexWrap(ds.NewMapDatastore())) -} diff --git a/node/node.go b/node/node.go index f548ae3e2d..b203bf4793 100644 --- a/node/node.go +++ b/node/node.go @@ -690,7 +690,7 @@ func NewNode(config *cfg.Config, return nil, err } - blockStore := store.NewBlockStore(blockStoreDB, ipfsNode.Blockstore, logger) + blockStore := store.NewBlockStore(blockStoreDB, ipfsNode.DAG) // Create the handshaker, which calls RequestInfo, sets the AppVersion on the state, // and replays any blocks as necessary to sync tendermint with the app. diff --git a/node/node_test.go b/node/node_test.go index 59de04dac2..2a4641f465 100644 --- a/node/node_test.go +++ b/node/node_test.go @@ -10,6 +10,7 @@ import ( "testing" "time" + mdutils "github.com/ipfs/go-merkledag/test" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" @@ -283,7 +284,7 @@ func TestCreateProposalBlock(t *testing.T) { // Make EvidencePool evidenceDB := memdb.NewDB() - blockStore := store.MockBlockStore(nil) + blockStore := store.NewBlockStore(memdb.NewDB(), mdutils.Mock()) evidencePool, err := evidence.NewPool(evidenceDB, stateStore, blockStore) require.NoError(t, err) evidencePool.SetLogger(logger) diff --git a/rpc/core/blocks.go b/rpc/core/blocks.go index 24236e73f6..20a97fdb7a 100644 --- a/rpc/core/blocks.go +++ b/rpc/core/blocks.go @@ -89,10 +89,7 @@ func Block(ctx *rpctypes.Context, heightPtr *int64) (*ctypes.ResultBlock, error) return nil, err } - block, err := env.BlockStore.LoadBlock(ctx.Context(), height) - if err != nil { - return &ctypes.ResultBlock{BlockID: types.BlockID{}, Block: block}, err - } + block := env.BlockStore.LoadBlock(height) blockMeta := env.BlockStore.LoadBlockMeta(height) if blockMeta == nil { return &ctypes.ResultBlock{BlockID: types.BlockID{}, Block: block}, nil @@ -103,10 +100,7 @@ func Block(ctx *rpctypes.Context, heightPtr *int64) (*ctypes.ResultBlock, error) // BlockByHash gets block by hash. // More: https://docs.tendermint.com/master/rpc/#/Info/block_by_hash func BlockByHash(ctx *rpctypes.Context, hash []byte) (*ctypes.ResultBlock, error) { - block, err := env.BlockStore.LoadBlockByHash(ctx.Context(), hash) - if err != nil { - return &ctypes.ResultBlock{BlockID: types.BlockID{}, Block: nil}, err - } + block := env.BlockStore.LoadBlockByHash(hash) if block == nil { return &ctypes.ResultBlock{BlockID: types.BlockID{}, Block: nil}, nil } @@ -151,14 +145,9 @@ func DataAvailabilityHeader(ctx *rpctypes.Context, heightPtr *int64) (*ctypes.Re // TODO: store DAHeader to avoid loading the full block each time // depends on either: - // - https://github.com/celestiaorg/celestia-core/pull/312, or - // - https://github.com/celestiaorg/celestia-core/pull/218 - block, err := env.BlockStore.LoadBlock(ctx.Context(), height) - if err != nil { - return &ctypes.ResultDataAvailabilityHeader{ - DataAvailabilityHeader: types.DataAvailabilityHeader{}, - }, err - } + // - https://github.com/lazyledger/lazyledger-core/pull/312, or + // - https://github.com/lazyledger/lazyledger-core/pull/218 + block := env.BlockStore.LoadBlock(height) _ = block.Hash() dah := block.DataAvailabilityHeader return &ctypes.ResultDataAvailabilityHeader{ diff --git a/rpc/core/blocks_test.go b/rpc/core/blocks_test.go index d4e68f0666..9998969a75 100644 --- a/rpc/core/blocks_test.go +++ b/rpc/core/blocks_test.go @@ -1,7 +1,6 @@ package core import ( - "context" "fmt" "testing" @@ -119,26 +118,16 @@ type mockBlockStore struct { height int64 } -func (mockBlockStore) Base() int64 { return 1 } -func (store mockBlockStore) Height() int64 { return store.height } -func (store mockBlockStore) Size() int64 { return store.height } -func (mockBlockStore) LoadBaseMeta() *types.BlockMeta { return nil } -func (mockBlockStore) LoadBlockMeta(height int64) *types.BlockMeta { return nil } -func (mockBlockStore) LoadBlock(ctx context.Context, height int64) (*types.Block, error) { - return nil, nil -} -func (mockBlockStore) LoadBlockByHash(ctx context.Context, hash []byte) (*types.Block, error) { - return nil, nil -} +func (mockBlockStore) Base() int64 { return 1 } +func (store mockBlockStore) Height() int64 { return store.height } +func (store mockBlockStore) Size() int64 { return store.height } +func (mockBlockStore) LoadBaseMeta() *types.BlockMeta { return nil } +func (mockBlockStore) LoadBlockMeta(height int64) *types.BlockMeta { return nil } +func (mockBlockStore) LoadBlock(height int64) *types.Block { return nil } +func (mockBlockStore) LoadBlockByHash(hash []byte) *types.Block { return nil } func (mockBlockStore) LoadBlockPart(height int64, index int) *types.Part { return nil } func (mockBlockStore) LoadBlockCommit(height int64) *types.Commit { return nil } func (mockBlockStore) LoadSeenCommit(height int64) *types.Commit { return nil } func (mockBlockStore) PruneBlocks(height int64) (uint64, error) { return 0, nil } -func (mockBlockStore) SaveBlock( - ctx context.Context, - block *types.Block, - blockParts *types.PartSet, - seenCommit *types.Commit, -) error { - return nil +func (mockBlockStore) SaveBlock(block *types.Block, blockParts *types.PartSet, seenCommit *types.Commit) { } diff --git a/rpc/core/tx.go b/rpc/core/tx.go index 817cd56eb1..0d2b6c21bb 100644 --- a/rpc/core/tx.go +++ b/rpc/core/tx.go @@ -37,10 +37,7 @@ func Tx(ctx *rpctypes.Context, hash []byte, prove bool) (*ctypes.ResultTx, error var proof types.TxProof if prove { - block, err := env.BlockStore.LoadBlock(ctx.Context(), height) - if err != nil { - return nil, err - } + block := env.BlockStore.LoadBlock(height) proof = block.Data.Txs.Proof(int(index)) // XXX: overflow on 32-bit machines } @@ -110,10 +107,7 @@ func TxSearch(ctx *rpctypes.Context, query string, prove bool, pagePtr, perPageP var proof types.TxProof if prove { - block, err := env.BlockStore.LoadBlock(ctx.Context(), r.Height) - if err != nil { - return nil, err - } + block := env.BlockStore.LoadBlock(r.Height) proof = block.Data.Txs.Proof(int(r.Index)) // XXX: overflow on 32-bit machines } diff --git a/state/services.go b/state/services.go index 0ca6a4e935..6dd03fad17 100644 --- a/state/services.go +++ b/state/services.go @@ -1,8 +1,6 @@ package state import ( - "context" - "github.com/celestiaorg/celestia-core/types" ) @@ -22,13 +20,13 @@ type BlockStore interface { LoadBaseMeta() *types.BlockMeta LoadBlockMeta(height int64) *types.BlockMeta - LoadBlock(ctx context.Context, height int64) (*types.Block, error) + LoadBlock(height int64) *types.Block - SaveBlock(ctx context.Context, block *types.Block, blockParts *types.PartSet, seenCommit *types.Commit) error + SaveBlock(block *types.Block, blockParts *types.PartSet, seenCommit *types.Commit) PruneBlocks(height int64) (uint64, error) - LoadBlockByHash(ctx context.Context, hash []byte) (*types.Block, error) + LoadBlockByHash(hash []byte) *types.Block LoadBlockPart(height int64, index int) *types.Part LoadBlockCommit(height int64) *types.Commit diff --git a/store/mock.go b/store/mock.go deleted file mode 100644 index 2c2e7e90cc..0000000000 --- a/store/mock.go +++ /dev/null @@ -1,21 +0,0 @@ -package store - -import ( - "github.com/celestiaorg/celestia-core/ipfs" - dbm "github.com/celestiaorg/celestia-core/libs/db" - "github.com/celestiaorg/celestia-core/libs/db/memdb" - "github.com/celestiaorg/celestia-core/libs/log" -) - -// MockBlockStore returns a mocked blockstore. a nil db will result in a new in memory db -func MockBlockStore(db dbm.DB) *BlockStore { - if db == nil { - db = memdb.NewDB() - } - - return NewBlockStore( - db, - ipfs.MockBlockStore(), - log.NewNopLogger(), - ) -} diff --git a/store/store.go b/store/store.go index 4e9be36cf9..2c8aeab27d 100644 --- a/store/store.go +++ b/store/store.go @@ -1,28 +1,18 @@ package store import ( - "context" "fmt" - "strings" - "strconv" "github.com/gogo/protobuf/proto" - "github.com/ipfs/go-blockservice" - blockstore "github.com/ipfs/go-ipfs-blockstore" - offline "github.com/ipfs/go-ipfs-exchange-offline" - format "github.com/ipfs/go-ipld-format" - "github.com/ipfs/go-merkledag" + ipld "github.com/ipfs/go-ipld-format" - "github.com/celestiaorg/celestia-core/ipfs" dbm "github.com/celestiaorg/celestia-core/libs/db" - "github.com/celestiaorg/celestia-core/libs/log" tmsync "github.com/celestiaorg/celestia-core/libs/sync" "github.com/celestiaorg/celestia-core/p2p/ipld" tmstore "github.com/celestiaorg/celestia-core/proto/tendermint/store" tmproto "github.com/celestiaorg/celestia-core/proto/tendermint/types" "github.com/celestiaorg/celestia-core/types" - "github.com/celestiaorg/rsmt2d" ) /* @@ -54,20 +44,18 @@ type BlockStore struct { base int64 height int64 - dag format.DAGService - logger log.Logger + ipfsDagAPI ipld.DAGService } // NewBlockStore returns a new BlockStore with the given DB, // initialized to the last height that was committed to the DB. -func NewBlockStore(db dbm.DB, bstore blockstore.Blockstore, logger log.Logger) *BlockStore { +func NewBlockStore(db dbm.DB, dagAPI ipld.DAGService) *BlockStore { bs := LoadBlockStoreState(db) return &BlockStore{ - base: bs.Base, - height: bs.Height, - db: db, - dag: merkledag.NewDAGService(blockservice.New(bstore, offline.Exchange(bstore))), - logger: logger, + base: bs.Base, + height: bs.Height, + db: db, + ipfsDagAPI: dagAPI, } } @@ -107,43 +95,48 @@ func (bs *BlockStore) LoadBaseMeta() *types.BlockMeta { // LoadBlock returns the block with the given height. // If no block is found for that height, it returns nil. -func (bs *BlockStore) LoadBlock(ctx context.Context, height int64) (*types.Block, error) { - blockMeta := bs.LoadBlockMeta(height) +func (bs *BlockStore) LoadBlock(height int64) *types.Block { + var blockMeta = bs.LoadBlockMeta(height) if blockMeta == nil { - return nil, nil + return nil } - lastCommit := bs.LoadBlockCommit(height - 1) - - data, err := ipld.RetrieveBlockData(ctx, &blockMeta.DAHeader, bs.dag, rsmt2d.NewRSGF8Codec()) - if err != nil { - if strings.Contains(err.Error(), format.ErrNotFound.Error()) { - return nil, fmt.Errorf("failure to retrieve block data from local ipfs store: %w", err) + pbb := new(tmproto.Block) + buf := []byte{} + for i := 0; i < int(blockMeta.BlockID.PartSetHeader.Total); i++ { + part := bs.LoadBlockPart(height, i) + // If the part is missing (e.g. since it has been deleted after we + // loaded the block meta) we consider the whole block to be missing. + if part == nil { + return nil } - bs.logger.Info("failure to retrieve block data", err) - return nil, err + buf = append(buf, part.Bytes...) + } + err := proto.Unmarshal(buf, pbb) + if err != nil { + // NOTE: The existence of meta should imply the existence of the + // block. So, make sure meta is only saved after blocks are saved. + panic(fmt.Sprintf("Error reading block: %v", err)) } - block := types.Block{ - Header: blockMeta.Header, - Data: data, - DataAvailabilityHeader: blockMeta.DAHeader, - LastCommit: lastCommit, + block, err := types.BlockFromProto(pbb) + if err != nil { + panic(fmt.Errorf("error from proto block: %w", err)) } - return &block, nil + return block } // LoadBlockByHash returns the block with the given hash. // If no block is found for that hash, it returns nil. // Panics if it fails to parse height associated with the given hash. -func (bs *BlockStore) LoadBlockByHash(ctx context.Context, hash []byte) (*types.Block, error) { +func (bs *BlockStore) LoadBlockByHash(hash []byte) *types.Block { bz, err := bs.db.Get(calcBlockHashKey(hash)) if err != nil { panic(err) } if len(bz) == 0 { - return nil, nil + return nil } s := string(bz) @@ -152,7 +145,7 @@ func (bs *BlockStore) LoadBlockByHash(ctx context.Context, hash []byte) (*types. if err != nil { panic(fmt.Sprintf("failed to extract height from %s: %v", s, err)) } - return bs.LoadBlock(ctx, height) + return bs.LoadBlock(height) } // LoadBlockPart returns the Part at the given index @@ -340,12 +333,7 @@ func (bs *BlockStore) PruneBlocks(height int64) (uint64, error) { // If all the nodes restart after committing a block, // we need this to reload the precommits to catch-up nodes to the // most recent height. Otherwise they'd stall at H-1. -func (bs *BlockStore) SaveBlock( - ctx context.Context, - block *types.Block, - blockParts *types.PartSet, - seenCommit *types.Commit, -) error { +func (bs *BlockStore) SaveBlock(block *types.Block, blockParts *types.PartSet, seenCommit *types.Commit) { if block == nil { panic("BlockStore can only save a non-nil block") } @@ -369,11 +357,6 @@ func (bs *BlockStore) SaveBlock( bs.saveBlockPart(height, i, part) } - err := ipld.PutBlock(ctx, bs.dag, block, ipfs.MockRouting(), bs.logger) - if err != nil { - return err - } - // Save block meta blockMeta := types.NewBlockMeta(block, blockParts) pbm, err := blockMeta.ToProto() @@ -416,8 +399,6 @@ func (bs *BlockStore) SaveBlock( // Save new BlockStoreState descriptor. This also flushes the database. bs.saveState() - - return nil } func (bs *BlockStore) saveBlockPart(height int64, index int, part *types.Part) { diff --git a/store/store_test.go b/store/store_test.go index 39c89e7e02..c14d507af9 100644 --- a/store/store_test.go +++ b/store/store_test.go @@ -2,7 +2,6 @@ package store import ( "bytes" - "context" "crypto/sha256" "fmt" "os" @@ -12,6 +11,7 @@ import ( "time" "github.com/gogo/protobuf/proto" + mdutils "github.com/ipfs/go-merkledag/test" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" @@ -74,7 +74,7 @@ func makeStateAndBlockStore(logger log.Logger) (sm.State, *BlockStore, cleanupFu if err != nil { panic(fmt.Errorf("error constructing state from genesis file: %w", err)) } - return state, MockBlockStore(blockDB), func() { os.RemoveAll(config.RootDir) } + return state, NewBlockStore(blockDB, mdutils.Mock()), func() { os.RemoveAll(config.RootDir) } } func TestLoadBlockStoreState(t *testing.T) { @@ -106,7 +106,7 @@ func TestNewBlockStore(t *testing.T) { bz, _ := proto.Marshal(&bss) err := db.Set(blockStoreKey, bz) require.NoError(t, err) - bs := MockBlockStore(db) + bs := NewBlockStore(db, mdutils.Mock()) require.Equal(t, int64(100), bs.Base(), "failed to properly parse blockstore") require.Equal(t, int64(10000), bs.Height(), "failed to properly parse blockstore") @@ -124,7 +124,7 @@ func TestNewBlockStore(t *testing.T) { _, _, panicErr := doFn(func() (interface{}, error) { err := db.Set(blockStoreKey, tt.data) require.NoError(t, err) - _ = MockBlockStore(db) + _ = NewBlockStore(db, mdutils.Mock()) return nil, nil }) require.NotNil(t, panicErr, "#%d panicCauser: %q expected a panic", i, tt.data) @@ -133,13 +133,13 @@ func TestNewBlockStore(t *testing.T) { err = db.Set(blockStoreKey, []byte{}) require.NoError(t, err) - bs = MockBlockStore(db) + bs = NewBlockStore(db, mdutils.Mock()) assert.Equal(t, bs.Height(), int64(0), "expecting empty bytes to be unmarshaled alright") } func freshBlockStore() (*BlockStore, dbm.DB) { db := memdb.NewDB() - return MockBlockStore(db), db + return NewBlockStore(db, mdutils.Mock()), db } var ( @@ -172,12 +172,10 @@ func TestBlockStoreSaveLoadBlock(t *testing.T) { require.Equal(t, bs.Base(), int64(0), "initially the base should be zero") require.Equal(t, bs.Height(), int64(0), "initially the height should be zero") - ctx := context.TODO() - // check there are no blocks at various heights noBlockHeights := []int64{0, -1, 100, 1000, 2} for i, height := range noBlockHeights { - if g, _ := bs.LoadBlock(ctx, height); g != nil { + if g := bs.LoadBlock(height); g != nil { t.Errorf("#%d: height(%d) got a block; want nil", i, height) } } @@ -186,14 +184,13 @@ func TestBlockStoreSaveLoadBlock(t *testing.T) { block := makeBlock(bs.Height()+1, state, new(types.Commit)) validPartSet := block.MakePartSet(2) seenCommit := makeTestCommit(10, tmtime.Now()) - err := bs.SaveBlock(ctx, block, partSet, seenCommit) - require.NoError(t, err) + bs.SaveBlock(block, partSet, seenCommit) require.EqualValues(t, 1, bs.Base(), "expecting the new height to be changed") require.EqualValues(t, block.Header.Height, bs.Height(), "expecting the new height to be changed") incompletePartSet := types.NewPartSetFromHeader(types.PartSetHeader{Total: 2}) uncontiguousPartSet := types.NewPartSetFromHeader(types.PartSetHeader{Total: 0}) - _, err = uncontiguousPartSet.AddPart(part2) + _, err := uncontiguousPartSet.AddPart(part2) require.Error(t, err) header1 := types.Header{ @@ -308,20 +305,16 @@ func TestBlockStoreSaveLoadBlock(t *testing.T) { bs, db := freshBlockStore() // SaveBlock res, err, panicErr := doFn(func() (interface{}, error) { - err := bs.SaveBlock(ctx, tuple.block, tuple.parts, tuple.seenCommit) + bs.SaveBlock(tuple.block, tuple.parts, tuple.seenCommit) if tuple.block == nil { return nil, nil } - if err != nil { - return nil, err - } if tuple.corruptBlockInDB { err := db.Set(calcBlockMetaKey(tuple.block.Height), []byte("block-bogus")) require.NoError(t, err) } - bBlock, err := bs.LoadBlock(ctx, tuple.block.Height) - require.NoError(t, err) + bBlock := bs.LoadBlock(tuple.block.Height) bBlockMeta := bs.LoadBlockMeta(tuple.block.Height) if tuple.eraseSeenCommitInDB { @@ -388,14 +381,13 @@ func TestLoadBaseMeta(t *testing.T) { stateStore := sm.NewStore(memdb.NewDB()) state, err := stateStore.LoadFromDBOrGenesisFile(config.GenesisFile()) require.NoError(t, err) - bs := MockBlockStore(nil) + bs := NewBlockStore(memdb.NewDB(), mdutils.Mock()) for h := int64(1); h <= 10; h++ { block := makeBlock(h, state, new(types.Commit)) partSet := block.MakePartSet(2) seenCommit := makeTestCommit(h, tmtime.Now()) - err := bs.SaveBlock(context.TODO(), block, partSet, seenCommit) - require.NoError(t, err) + bs.SaveBlock(block, partSet, seenCommit) } _, err = bs.PruneBlocks(4) @@ -446,13 +438,11 @@ func TestPruneBlocks(t *testing.T) { state, err := stateStore.LoadFromDBOrGenesisFile(config.GenesisFile()) require.NoError(t, err) db := memdb.NewDB() - bs := MockBlockStore(db) + bs := NewBlockStore(db, mdutils.Mock()) assert.EqualValues(t, 0, bs.Base()) assert.EqualValues(t, 0, bs.Height()) assert.EqualValues(t, 0, bs.Size()) - ctx := context.TODO() - // pruning an empty store should error, even when pruning to 0 _, err = bs.PruneBlocks(1) require.Error(t, err) @@ -465,16 +455,14 @@ func TestPruneBlocks(t *testing.T) { block := makeBlock(h, state, new(types.Commit)) partSet := block.MakePartSet(2) seenCommit := makeTestCommit(h, tmtime.Now()) - err := bs.SaveBlock(ctx, block, partSet, seenCommit) - require.NoError(t, err) + bs.SaveBlock(block, partSet, seenCommit) } assert.EqualValues(t, 1, bs.Base()) assert.EqualValues(t, 1500, bs.Height()) assert.EqualValues(t, 1500, bs.Size()) - prunedBlock, err := bs.LoadBlock(ctx, 1199) - require.NoError(t, err) + prunedBlock := bs.LoadBlock(1199) // Check that basic pruning works pruned, err := bs.PruneBlocks(1200) @@ -488,29 +476,18 @@ func TestPruneBlocks(t *testing.T) { Height: 1500, }, LoadBlockStoreState(db)) - b, err := bs.LoadBlock(ctx, 1200) - require.NotNil(t, b) - require.NoError(t, err) - b, err = bs.LoadBlock(ctx, 1199) - require.NoError(t, err) - require.Nil(t, b) - b, err = bs.LoadBlockByHash(ctx, prunedBlock.Hash()) - require.Nil(t, b) - require.NoError(t, err) - + require.NotNil(t, bs.LoadBlock(1200)) + require.Nil(t, bs.LoadBlock(1199)) + require.Nil(t, bs.LoadBlockByHash(prunedBlock.Hash())) require.Nil(t, bs.LoadBlockCommit(1199)) require.Nil(t, bs.LoadBlockMeta(1199)) require.Nil(t, bs.LoadBlockPart(1199, 1)) for i := int64(1); i < 1200; i++ { - b, err := bs.LoadBlock(ctx, i) - require.Nil(t, b) - require.NoError(t, err) + require.Nil(t, bs.LoadBlock(i)) } for i := int64(1200); i <= 1500; i++ { - b, err := bs.LoadBlock(ctx, i) - require.NotNil(t, b) - require.NoError(t, err) + require.NotNil(t, bs.LoadBlock(i)) } // Pruning below the current base should error @@ -536,15 +513,9 @@ func TestPruneBlocks(t *testing.T) { pruned, err = bs.PruneBlocks(1500) require.NoError(t, err) assert.EqualValues(t, 200, pruned) - b, err = bs.LoadBlock(ctx, 1499) - assert.Nil(t, b) - require.NoError(t, err) - b, err = bs.LoadBlock(ctx, 1500) - assert.NotNil(t, b) - require.NoError(t, err) - b, err = bs.LoadBlock(ctx, 1501) - assert.Nil(t, b) - require.NoError(t, err) + assert.Nil(t, bs.LoadBlock(1499)) + assert.NotNil(t, bs.LoadBlock(1500)) + assert.Nil(t, bs.LoadBlock(1501)) } func TestLoadBlockMeta(t *testing.T) { @@ -590,7 +561,6 @@ func TestLoadBlockMeta(t *testing.T) { } func TestBlockFetchAtHeight(t *testing.T) { - ctx := context.TODO() state, bs, cleanup := makeStateAndBlockStore(log.NewTMLogger(new(bytes.Buffer))) defer cleanup() require.Equal(t, bs.Height(), int64(0), "initially the height should be zero") @@ -598,12 +568,10 @@ func TestBlockFetchAtHeight(t *testing.T) { partSet := block.MakePartSet(2) seenCommit := makeTestCommit(10, tmtime.Now()) - err := bs.SaveBlock(ctx, block, partSet, seenCommit) - require.NoError(t, err) + bs.SaveBlock(block, partSet, seenCommit) require.Equal(t, bs.Height(), block.Header.Height, "expecting the new height to be changed") - blockAtHeight, err := bs.LoadBlock(ctx, bs.Height()) - require.NoError(t, err) + blockAtHeight := bs.LoadBlock(bs.Height()) b1, err := block.ToProto() require.NoError(t, err) b2, err := blockAtHeight.ToProto() @@ -614,11 +582,9 @@ func TestBlockFetchAtHeight(t *testing.T) { require.Equal(t, block.Hash(), blockAtHeight.Hash(), "expecting a successful load of the last saved block") - blockAtHeightPlus1, err := bs.LoadBlock(ctx, bs.Height()+1) - require.NoError(t, err) + blockAtHeightPlus1 := bs.LoadBlock(bs.Height() + 1) require.Nil(t, blockAtHeightPlus1, "expecting an unsuccessful load of Height()+1") - blockAtHeightPlus2, err := bs.LoadBlock(ctx, bs.Height()+2) - require.NoError(t, err) + blockAtHeightPlus2 := bs.LoadBlock(bs.Height() + 2) require.Nil(t, blockAtHeightPlus2, "expecting an unsuccessful load of Height()+2") } From 27bfd13c676cc85b16d1c293b7ed144d10b5af6b Mon Sep 17 00:00:00 2001 From: evan-forbes Date: Tue, 24 Aug 2021 17:12:16 -0500 Subject: [PATCH 05/10] fix merge error --- store/store.go | 1 - 1 file changed, 1 deletion(-) diff --git a/store/store.go b/store/store.go index 2c8aeab27d..8f4efa7579 100644 --- a/store/store.go +++ b/store/store.go @@ -9,7 +9,6 @@ import ( dbm "github.com/celestiaorg/celestia-core/libs/db" tmsync "github.com/celestiaorg/celestia-core/libs/sync" - "github.com/celestiaorg/celestia-core/p2p/ipld" tmstore "github.com/celestiaorg/celestia-core/proto/tendermint/store" tmproto "github.com/celestiaorg/celestia-core/proto/tendermint/types" "github.com/celestiaorg/celestia-core/types" From 225ee8bc25a1d19c9222b762da1294407c15c3c9 Mon Sep 17 00:00:00 2001 From: evan-forbes Date: Tue, 24 Aug 2021 18:45:18 -0500 Subject: [PATCH 06/10] Revert "Add the ipfs dag api object in Blockstore (#356)" and get rid of embedded ipfs objects This reverts commit 40acb17283ebfe1c49b804a786464b93c2213a97. --- blockchain/v0/reactor_test.go | 3 +-- config/config.go | 2 +- consensus/byzantine_test.go | 7 ++----- consensus/common_test.go | 23 +++++++++-------------- consensus/mempool_test.go | 11 +++++------ consensus/reactor_test.go | 9 +++------ consensus/replay_file.go | 9 +++------ consensus/replay_test.go | 20 ++++++++------------ consensus/state.go | 9 --------- consensus/state_test.go | 7 +++---- consensus/wal_test.go | 10 ++++------ evidence/pool_test.go | 3 +-- evidence/reactor_test.go | 10 +++++----- go.mod | 2 +- node/node.go | 19 ++++--------------- node/node_test.go | 5 ++--- store/store.go | 12 ++++-------- store/store_test.go | 15 +++++++-------- 18 files changed, 63 insertions(+), 113 deletions(-) diff --git a/blockchain/v0/reactor_test.go b/blockchain/v0/reactor_test.go index 55155cdbb8..cd9825fda1 100644 --- a/blockchain/v0/reactor_test.go +++ b/blockchain/v0/reactor_test.go @@ -8,7 +8,6 @@ import ( "testing" "time" - mdutils "github.com/ipfs/go-merkledag/test" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" @@ -72,7 +71,7 @@ func newBlockchainReactor( blockDB := memdb.NewDB() stateDB := memdb.NewDB() stateStore := sm.NewStore(stateDB) - blockStore := store.NewBlockStore(blockDB, mdutils.Mock()) + blockStore := store.NewBlockStore(blockDB) state, err := stateStore.LoadFromDBOrGenesisDoc(genDoc) if err != nil { diff --git a/config/config.go b/config/config.go index fbaf69c7fb..8f0301ed61 100644 --- a/config/config.go +++ b/config/config.go @@ -847,7 +847,7 @@ func TestConsensusConfig() *ConsensusConfig { cfg.TimeoutProposeDelta = 20 * time.Millisecond cfg.TimeoutPrevote = 80 * time.Millisecond cfg.TimeoutPrevoteDelta = 20 * time.Millisecond - cfg.TimeoutPrecommit = 160 * time.Millisecond + cfg.TimeoutPrecommit = 80 * time.Millisecond cfg.TimeoutPrecommitDelta = 20 * time.Millisecond // NOTE: when modifying, make sure to update time_iota_ms (testGenesisFmt) in toml.go cfg.TimeoutCommit = 80 * time.Millisecond diff --git a/consensus/byzantine_test.go b/consensus/byzantine_test.go index 2c2efa2879..9d53eff4d3 100644 --- a/consensus/byzantine_test.go +++ b/consensus/byzantine_test.go @@ -9,14 +9,12 @@ import ( "testing" "time" - mdutils "github.com/ipfs/go-merkledag/test" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" abcicli "github.com/celestiaorg/celestia-core/abci/client" abci "github.com/celestiaorg/celestia-core/abci/types" "github.com/celestiaorg/celestia-core/evidence" - "github.com/celestiaorg/celestia-core/ipfs" "github.com/celestiaorg/celestia-core/libs/db/memdb" "github.com/celestiaorg/celestia-core/libs/log" "github.com/celestiaorg/celestia-core/libs/service" @@ -57,8 +55,7 @@ func TestByzantinePrevoteEquivocation(t *testing.T) { app.InitChain(abci.RequestInitChain{Validators: vals}) blockDB := memdb.NewDB() - dag := mdutils.Mock() - blockStore := store.NewBlockStore(blockDB, dag) + blockStore := store.NewBlockStore(blockDB) // one for mempool, one for consensus mtx := new(tmsync.Mutex) @@ -81,7 +78,7 @@ func TestByzantinePrevoteEquivocation(t *testing.T) { // Make State blockExec := sm.NewBlockExecutor(stateStore, log.TestingLogger(), proxyAppConnCon, mempool, evpool) cs := NewState(thisConfig.Consensus, state, blockExec, blockStore, - mempool, dag, ipfs.MockRouting(), evpool) + mempool, evpool) cs.SetLogger(cs.Logger) // set private validator pv := privVals[i] diff --git a/consensus/common_test.go b/consensus/common_test.go index 23dfef6bc8..6867a0f350 100644 --- a/consensus/common_test.go +++ b/consensus/common_test.go @@ -14,8 +14,6 @@ import ( "time" "github.com/go-kit/kit/log/term" - format "github.com/ipfs/go-ipld-format" - mdutils "github.com/ipfs/go-merkledag/test" "github.com/stretchr/testify/require" abcicli "github.com/celestiaorg/celestia-core/abci/client" @@ -24,7 +22,6 @@ import ( abci "github.com/celestiaorg/celestia-core/abci/types" cfg "github.com/celestiaorg/celestia-core/config" cstypes "github.com/celestiaorg/celestia-core/consensus/types" - "github.com/celestiaorg/celestia-core/ipfs" tmbytes "github.com/celestiaorg/celestia-core/libs/bytes" dbm "github.com/celestiaorg/celestia-core/libs/db" "github.com/celestiaorg/celestia-core/libs/db/memdb" @@ -54,7 +51,7 @@ type cleanupFunc func() var ( config *cfg.Config // NOTE: must be reset for each _test.go file consensusReplayConfig *cfg.Config - ensureTimeout = 4 * time.Second + ensureTimeout = 2 * time.Second ) func ensureDir(dir string, mode os.FileMode) { @@ -354,9 +351,9 @@ func subscribeToVoter(cs *State, addr []byte) <-chan tmpubsub.Message { //------------------------------------------------------------------------------- // consensus states -func newState(state sm.State, pv types.PrivValidator, app abci.Application, ipfsDagAPI format.DAGService) *State { +func newState(state sm.State, pv types.PrivValidator, app abci.Application) *State { config := cfg.ResetTestRoot("consensus_state_test") - return newStateWithConfig(config, state, pv, app, ipfsDagAPI) + return newStateWithConfig(config, state, pv, app) } func newStateWithConfig( @@ -364,10 +361,9 @@ func newStateWithConfig( state sm.State, pv types.PrivValidator, app abci.Application, - ipfsDagAPI format.DAGService, ) *State { blockDB := memdb.NewDB() - return newStateWithConfigAndBlockStore(thisConfig, state, pv, app, blockDB, ipfsDagAPI) + return newStateWithConfigAndBlockStore(thisConfig, state, pv, app, blockDB) } func newStateWithConfigAndBlockStore( @@ -376,10 +372,9 @@ func newStateWithConfigAndBlockStore( pv types.PrivValidator, app abci.Application, blockDB dbm.DB, - dag format.DAGService, ) *State { // Get BlockStore - blockStore := store.NewBlockStore(blockDB, dag) + blockStore := store.NewBlockStore(blockDB) // one for mempool, one for consensus mtx := new(tmsync.Mutex) @@ -403,7 +398,7 @@ func newStateWithConfigAndBlockStore( } blockExec := sm.NewBlockExecutor(stateStore, log.TestingLogger(), proxyAppConnCon, mempool, evpool) - cs := NewState(thisConfig.Consensus, state, blockExec, blockStore, mempool, dag, ipfs.MockRouting(), evpool) + cs := NewState(thisConfig.Consensus, state, blockExec, blockStore, mempool, evpool) cs.SetLogger(log.TestingLogger().With("module", "consensus")) cs.SetPrivValidator(pv) @@ -435,7 +430,7 @@ func randState(nValidators int) (*State, []*validatorStub) { vss := make([]*validatorStub, nValidators) - cs := newState(state, privVals[0], counter.NewApplication(true), mdutils.Mock()) + cs := newState(state, privVals[0], counter.NewApplication(true)) for i := 0; i < nValidators; i++ { vss[i] = newValidatorStub(privVals[i], int32(i)) @@ -708,7 +703,7 @@ func randConsensusNet( vals := types.TM2PB.ValidatorUpdates(state.Validators) app.InitChain(abci.RequestInitChain{Validators: vals}) - css[i] = newStateWithConfigAndBlockStore(thisConfig, state, privVals[i], app, stateDB, mdutils.Mock()) + css[i] = newStateWithConfigAndBlockStore(thisConfig, state, privVals[i], app, stateDB) css[i].SetTimeoutTicker(tickerFunc()) css[i].SetLogger(logger.With("validator", i, "module", "consensus")) } @@ -771,7 +766,7 @@ func randConsensusNetWithPeers( app.InitChain(abci.RequestInitChain{Validators: vals}) // sm.SaveState(stateDB,state) //height 1's validatorsInfo already saved in LoadStateFromDBOrGenesisDoc above - css[i] = newStateWithConfig(thisConfig, state, privVal, app, mdutils.Mock()) + css[i] = newStateWithConfig(thisConfig, state, privVal, app) css[i].SetTimeoutTicker(tickerFunc()) css[i].SetLogger(logger.With("validator", i, "module", "consensus")) } diff --git a/consensus/mempool_test.go b/consensus/mempool_test.go index cbbafa0292..1624e2e704 100644 --- a/consensus/mempool_test.go +++ b/consensus/mempool_test.go @@ -7,7 +7,6 @@ import ( "testing" "time" - mdutils "github.com/ipfs/go-merkledag/test" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" @@ -30,7 +29,7 @@ func TestMempoolNoProgressUntilTxsAvailable(t *testing.T) { config.Consensus.CreateEmptyBlocks = false state, privVals := randGenesisState(1, false, 10) - cs := newStateWithConfig(config, state, privVals[0], NewCounterApplication(), mdutils.Mock()) + cs := newStateWithConfig(config, state, privVals[0], NewCounterApplication()) assertMempool(cs.txNotifier).EnableTxsAvailable() height, round := cs.Height, cs.Round newBlockCh := subscribe(cs.eventBus, types.EventQueryNewBlock) @@ -50,7 +49,7 @@ func TestMempoolProgressAfterCreateEmptyBlocksInterval(t *testing.T) { config.Consensus.CreateEmptyBlocksInterval = ensureTimeout state, privVals := randGenesisState(1, false, 10) - cs := newStateWithConfig(config, state, privVals[0], NewCounterApplication(), mdutils.Mock()) + cs := newStateWithConfig(config, state, privVals[0], NewCounterApplication()) assertMempool(cs.txNotifier).EnableTxsAvailable() @@ -68,7 +67,7 @@ func TestMempoolProgressInHigherRound(t *testing.T) { config.Consensus.CreateEmptyBlocks = false state, privVals := randGenesisState(1, false, 10) - cs := newStateWithConfig(config, state, privVals[0], NewCounterApplication(), mdutils.Mock()) + cs := newStateWithConfig(config, state, privVals[0], NewCounterApplication()) assertMempool(cs.txNotifier).EnableTxsAvailable() height, round := cs.Height, cs.Round @@ -118,7 +117,7 @@ func TestMempoolTxConcurrentWithCommit(t *testing.T) { blockDB := memdb.NewDB() stateStore := sm.NewStore(blockDB) - cs := newStateWithConfigAndBlockStore(config, state, privVals[0], NewCounterApplication(), blockDB, mdutils.Mock()) + cs := newStateWithConfigAndBlockStore(config, state, privVals[0], NewCounterApplication(), blockDB) err := stateStore.Save(state) require.NoError(t, err) newBlockHeaderCh := subscribe(cs.eventBus, types.EventQueryNewBlockHeader) @@ -144,7 +143,7 @@ func TestMempoolRmBadTx(t *testing.T) { blockDB := memdb.NewDB() stateStore := sm.NewStore(blockDB) - cs := newStateWithConfigAndBlockStore(config, state, privVals[0], app, blockDB, mdutils.Mock()) + cs := newStateWithConfigAndBlockStore(config, state, privVals[0], app, blockDB) err := stateStore.Save(state) require.NoError(t, err) diff --git a/consensus/reactor_test.go b/consensus/reactor_test.go index a322919436..8e428c8c98 100644 --- a/consensus/reactor_test.go +++ b/consensus/reactor_test.go @@ -11,7 +11,6 @@ import ( "testing" "time" - mdutils "github.com/ipfs/go-merkledag/test" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" "github.com/stretchr/testify/require" @@ -23,7 +22,6 @@ import ( cstypes "github.com/celestiaorg/celestia-core/consensus/types" cryptoenc "github.com/celestiaorg/celestia-core/crypto/encoding" "github.com/celestiaorg/celestia-core/crypto/tmhash" - "github.com/celestiaorg/celestia-core/ipfs" "github.com/celestiaorg/celestia-core/libs/bits" "github.com/celestiaorg/celestia-core/libs/bytes" "github.com/celestiaorg/celestia-core/libs/db/memdb" @@ -156,8 +154,7 @@ func TestReactorWithEvidence(t *testing.T) { // css[i] = newStateWithConfig(thisConfig, state, privVals[i], app) blockDB := memdb.NewDB() - dag := mdutils.Mock() - blockStore := store.NewBlockStore(blockDB, dag) + blockStore := store.NewBlockStore(blockDB) // one for mempool, one for consensus mtx := new(tmsync.Mutex) @@ -186,7 +183,7 @@ func TestReactorWithEvidence(t *testing.T) { // Make State blockExec := sm.NewBlockExecutor(stateStore, log.TestingLogger(), proxyAppConnCon, mempool, evpool) cs := NewState(thisConfig.Consensus, state, blockExec, blockStore, - mempool, dag, ipfs.MockRouting(), evpool2) + mempool, evpool2) cs.SetLogger(log.TestingLogger().With("module", "consensus")) cs.SetPrivValidator(pv) @@ -673,7 +670,7 @@ func timeoutWaitGroup(t *testing.T, n int, f func(int), css []*State) { // we're running many nodes in-process, possibly in in a virtual machine, // and spewing debug messages - making a block could take a while, - timeout := time.Minute * 8 + timeout := time.Minute * 4 select { case <-done: diff --git a/consensus/replay_file.go b/consensus/replay_file.go index 92439dea2f..5361480990 100644 --- a/consensus/replay_file.go +++ b/consensus/replay_file.go @@ -11,7 +11,6 @@ import ( "strings" cfg "github.com/celestiaorg/celestia-core/config" - "github.com/celestiaorg/celestia-core/ipfs" "github.com/celestiaorg/celestia-core/libs/db/badgerdb" "github.com/celestiaorg/celestia-core/libs/log" tmos "github.com/celestiaorg/celestia-core/libs/os" @@ -19,7 +18,6 @@ import ( sm "github.com/celestiaorg/celestia-core/state" "github.com/celestiaorg/celestia-core/store" "github.com/celestiaorg/celestia-core/types" - mdutils "github.com/ipfs/go-merkledag/test" ) const ( @@ -131,7 +129,7 @@ func (pb *playback) replayReset(count int, newStepSub types.Subscription) error pb.cs.Wait() newCS := NewState(pb.cs.config, pb.genesisState.Copy(), pb.cs.blockExec, - pb.cs.blockStore, pb.cs.txNotifier, mdutils.Mock(), ipfs.MockRouting(), pb.cs.evpool) + pb.cs.blockStore, pb.cs.txNotifier, pb.cs.evpool) newCS.SetEventBus(pb.cs.eventBus) newCS.startForReplay() @@ -290,8 +288,7 @@ func newConsensusStateForReplay(config cfg.BaseConfig, csConfig *cfg.ConsensusCo if err != nil { tmos.Exit(err.Error()) } - dag := mdutils.Mock() - blockStore := store.NewBlockStore(blockStoreDB, dag) + blockStore := store.NewBlockStore(blockStoreDB) // Get State stateDB, err := badgerdb.NewDB("state", config.DBDir()) @@ -332,7 +329,7 @@ func newConsensusStateForReplay(config cfg.BaseConfig, csConfig *cfg.ConsensusCo blockExec := sm.NewBlockExecutor(stateStore, log.TestingLogger(), proxyApp.Consensus(), mempool, evpool) consensusState := NewState(csConfig, state.Copy(), blockExec, - blockStore, mempool, dag, ipfs.MockRouting(), evpool) + blockStore, mempool, evpool) consensusState.SetEventBus(eventBus) return consensusState } diff --git a/consensus/replay_test.go b/consensus/replay_test.go index 8e157eb622..3fa63b5d74 100644 --- a/consensus/replay_test.go +++ b/consensus/replay_test.go @@ -14,8 +14,6 @@ import ( "time" "github.com/gogo/protobuf/proto" - format "github.com/ipfs/go-ipld-format" - mdutils "github.com/ipfs/go-merkledag/test" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" @@ -79,7 +77,6 @@ func startNewStateAndWaitForBlock(t *testing.T, consensusReplayConfig *cfg.Confi privValidator, kvstore.NewApplication(), blockDB, - mdutils.Mock(), ) cs.SetLogger(logger) @@ -132,7 +129,8 @@ func TestWALCrash(t *testing.T) { heightToStop int64 }{ {"empty block", - func(stateDB dbm.DB, cs *State, ctx context.Context) {}, + func(stateDB dbm.DB, cs *State, ctx context.Context) { + }, 1}, {"many non-empty blocks", func(stateDB dbm.DB, cs *State, ctx context.Context) { @@ -174,7 +172,6 @@ LOOP: privValidator, kvstore.NewApplication(), blockDB, - mdutils.Mock(), ) cs.SetLogger(logger) @@ -1182,17 +1179,16 @@ func stateAndStore( // mock block store type mockBlockStore struct { - config *cfg.Config - params tmproto.ConsensusParams - chain []*types.Block - commits []*types.Commit - base int64 - ipfsDagAPI format.DAGService + config *cfg.Config + params tmproto.ConsensusParams + chain []*types.Block + commits []*types.Commit + base int64 } // TODO: NewBlockStore(db.NewMemDB) ... func newMockBlockStore(config *cfg.Config, params tmproto.ConsensusParams) *mockBlockStore { - return &mockBlockStore{config, params, nil, nil, 0, mdutils.Mock()} + return &mockBlockStore{config, params, nil, nil, 0} } func (bs *mockBlockStore) Height() int64 { return int64(len(bs.chain)) } diff --git a/consensus/state.go b/consensus/state.go index a1476ba7c6..d52933324c 100644 --- a/consensus/state.go +++ b/consensus/state.go @@ -11,8 +11,6 @@ import ( "time" "github.com/gogo/protobuf/proto" - format "github.com/ipfs/go-ipld-format" - "github.com/libp2p/go-libp2p-core/routing" cfg "github.com/celestiaorg/celestia-core/config" cstypes "github.com/celestiaorg/celestia-core/consensus/types" @@ -94,9 +92,6 @@ type State struct { // store blocks and commits blockStore sm.BlockStore - dag format.DAGService - croute routing.ContentRouting - // create and execute blocks blockExec *sm.BlockExecutor @@ -164,8 +159,6 @@ func NewState( blockExec *sm.BlockExecutor, blockStore sm.BlockStore, txNotifier txNotifier, - dag format.DAGService, - croute routing.ContentRouting, evpool evidencePool, options ...StateOption, ) *State { @@ -173,8 +166,6 @@ func NewState( config: config, blockExec: blockExec, blockStore: blockStore, - dag: dag, - croute: croute, txNotifier: txNotifier, peerMsgQueue: make(chan msgInfo, msgQueueSize), internalMsgQueue: make(chan msgInfo, msgQueueSize), diff --git a/consensus/state_test.go b/consensus/state_test.go index 568c1990d5..683931d995 100644 --- a/consensus/state_test.go +++ b/consensus/state_test.go @@ -7,7 +7,6 @@ import ( "testing" "time" - mdutils "github.com/ipfs/go-merkledag/test" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" @@ -640,7 +639,7 @@ func TestStateLockPOLRelock(t *testing.T) { signAddVotes(cs1, tmproto.PrecommitType, nil, types.PartSetHeader{}, vs2, vs3, vs4) // before we timeout to the new round set the new proposal - cs2 := newState(cs1.state, vs2, counter.NewApplication(true), mdutils.Mock()) + cs2 := newState(cs1.state, vs2, counter.NewApplication(true)) prop, propBlock := decideProposal(cs2, vs2, vs2.Height, vs2.Round+1) if prop == nil || propBlock == nil { t.Fatal("Failed to create proposal block with vs2") @@ -826,7 +825,7 @@ func TestStateLockPOLUnlockOnUnknownBlock(t *testing.T) { signAddVotes(cs1, tmproto.PrecommitType, nil, types.PartSetHeader{}, vs2, vs3, vs4) // before we timeout to the new round set the new proposal - cs2 := newState(cs1.state, vs2, counter.NewApplication(true), mdutils.Mock()) + cs2 := newState(cs1.state, vs2, counter.NewApplication(true)) prop, propBlock := decideProposal(cs2, vs2, vs2.Height, vs2.Round+1) if prop == nil || propBlock == nil { t.Fatal("Failed to create proposal block with vs2") @@ -870,7 +869,7 @@ func TestStateLockPOLUnlockOnUnknownBlock(t *testing.T) { signAddVotes(cs1, tmproto.PrecommitType, nil, types.PartSetHeader{}, vs2, vs3, vs4) // before we timeout to the new round set the new proposal - cs3 := newState(cs1.state, vs3, counter.NewApplication(true), mdutils.Mock()) + cs3 := newState(cs1.state, vs3, counter.NewApplication(true)) prop, propBlock = decideProposal(cs3, vs3, vs3.Height, vs3.Round+1) if prop == nil || propBlock == nil { t.Fatal("Failed to create proposal block with vs2") diff --git a/consensus/wal_test.go b/consensus/wal_test.go index 08d1d969a5..3e1f65652e 100644 --- a/consensus/wal_test.go +++ b/consensus/wal_test.go @@ -11,7 +11,6 @@ import ( "testing" "time" - mdutils "github.com/ipfs/go-merkledag/test" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" @@ -19,7 +18,6 @@ import ( cfg "github.com/celestiaorg/celestia-core/config" "github.com/celestiaorg/celestia-core/consensus/types" "github.com/celestiaorg/celestia-core/crypto/merkle" - "github.com/celestiaorg/celestia-core/ipfs" "github.com/celestiaorg/celestia-core/libs/autofile" "github.com/celestiaorg/celestia-core/libs/db/memdb" "github.com/celestiaorg/celestia-core/libs/log" @@ -66,7 +64,7 @@ func TestWALTruncate(t *testing.T) { err = walGenerateNBlocks(t, wal.Group(), 60) require.NoError(t, err) - time.Sleep(5 * time.Millisecond) // wait groupCheckDuration, make sure RotateFile run + time.Sleep(1 * time.Millisecond) // wait groupCheckDuration, make sure RotateFile run if err := wal.FlushAndSync(); err != nil { t.Error(err) @@ -310,8 +308,8 @@ func walGenerateNBlocks(t *testing.T, wr io.Writer, numBlocks int) (err error) { if err = stateStore.Save(state); err != nil { t.Error(err) } - dag := mdutils.Mock() - blockStore := store.NewBlockStore(blockStoreDB, dag) + + blockStore := store.NewBlockStore(blockStoreDB) proxyApp := proxy.NewAppConns(proxy.NewLocalClientCreator(app)) proxyApp.SetLogger(logger.With("module", "proxy")) @@ -339,7 +337,7 @@ func walGenerateNBlocks(t *testing.T, wr io.Writer, numBlocks int) (err error) { blockExec := sm.NewBlockExecutor(stateStore, log.TestingLogger(), proxyApp.Consensus(), mempool, evpool) require.NoError(t, err) consensusState := NewState(config.Consensus, state.Copy(), blockExec, blockStore, - mempool, dag, ipfs.MockRouting(), evpool) + mempool, evpool) consensusState.SetLogger(logger) consensusState.SetEventBus(eventBus) if privValidator != nil && privValidator != (*privval.FilePV)(nil) { diff --git a/evidence/pool_test.go b/evidence/pool_test.go index bb1a06baaa..ebf0dd3344 100644 --- a/evidence/pool_test.go +++ b/evidence/pool_test.go @@ -5,7 +5,6 @@ import ( "testing" "time" - mdutils "github.com/ipfs/go-merkledag/test" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" "github.com/stretchr/testify/require" @@ -396,7 +395,7 @@ func initializeValidatorState(privVal types.PrivValidator, height int64) sm.Stor // initializeBlockStore creates a block storage and populates it w/ a dummy // block at +height+. func initializeBlockStore(db dbm.DB, state sm.State, valAddr []byte) *store.BlockStore { - blockStore := store.NewBlockStore(db, mdutils.Mock()) + blockStore := store.NewBlockStore(db) for i := int64(1); i <= state.LastBlockHeight; i++ { lastCommit := makeCommit(i-1, valAddr) diff --git a/evidence/reactor_test.go b/evidence/reactor_test.go index ee6862f917..dc84b62b5a 100644 --- a/evidence/reactor_test.go +++ b/evidence/reactor_test.go @@ -130,7 +130,7 @@ func TestReactorsGossipNoCommittedEvidence(t *testing.T) { pools[0].Update(state, evList) require.EqualValues(t, uint32(0), pools[0].Size()) - time.Sleep(200 * time.Millisecond) + time.Sleep(100 * time.Millisecond) peer := reactors[0].Switch.Peers().List()[0] ps := peerState{height - 2} @@ -141,7 +141,7 @@ func TestReactorsGossipNoCommittedEvidence(t *testing.T) { peer.Set(types.PeerStateKey, ps) // wait to see that no evidence comes through - time.Sleep(600 * time.Millisecond) + time.Sleep(300 * time.Millisecond) // the second pool should not have received any evidence because it has already been committed assert.Equal(t, uint32(0), pools[1].Size(), "second reactor should not have received evidence") @@ -157,7 +157,7 @@ func TestReactorsGossipNoCommittedEvidence(t *testing.T) { } // wait to see that only one evidence is sent - time.Sleep(600 * time.Millisecond) + time.Sleep(300 * time.Millisecond) // the second pool should only have received the first evidence because it is behind peerEv, _ := pools[1].PendingEvidence(10000) @@ -178,9 +178,9 @@ func TestReactorsGossipNoCommittedEvidence(t *testing.T) { peer.Set(types.PeerStateKey, ps) // wait to see that only two evidence is sent - time.Sleep(1800 * time.Millisecond) + time.Sleep(300 * time.Millisecond) - peerEv, _ = pools[1].PendingEvidence(2000) + peerEv, _ = pools[1].PendingEvidence(1000) assert.EqualValues(t, []types.Evidence{evList[0], evList[1]}, peerEv) } diff --git a/go.mod b/go.mod index 525e0e21e8..462f12daca 100644 --- a/go.mod +++ b/go.mod @@ -30,7 +30,7 @@ require ( github.com/ipfs/go-ipfs-config v0.11.0 github.com/ipfs/go-ipfs-routing v0.1.0 github.com/ipfs/go-ipld-format v0.2.0 - github.com/ipfs/go-merkledag v0.3.2 + github.com/ipfs/go-merkledag v0.3.2 // indirect github.com/ipfs/go-path v0.0.9 // indirect github.com/ipfs/go-verifcid v0.0.1 github.com/ipfs/interface-go-ipfs-core v0.4.0 diff --git a/node/node.go b/node/node.go index b203bf4793..3b7af0b6c1 100644 --- a/node/node.go +++ b/node/node.go @@ -5,7 +5,6 @@ import ( "context" "errors" "fmt" - "io" "net" "net/http" _ "net/http/pprof" // nolint: gosec // securely exposed on separate, optional port @@ -215,8 +214,6 @@ type Node struct { txIndexer txindex.TxIndexer indexerService *txindex.IndexerService prometheusSrv *http.Server - - ipfsClose io.Closer } func createAndStartProxyAppConns(clientCreator proxy.ClientCreator, logger log.Logger) (proxy.AppConns, error) { @@ -369,8 +366,7 @@ func createBlockchainReactor(config *cfg.Config, return bcReactor, nil } -func createConsensusReactor( - config *cfg.Config, +func createConsensusReactor(config *cfg.Config, state sm.State, blockExec *sm.BlockExecutor, blockStore sm.BlockStore, @@ -390,8 +386,6 @@ func createConsensusReactor( blockExec, blockStore, mempool, - dag, - croute, evidencePool, cs.StateMetrics(csMetrics), ) @@ -690,7 +684,7 @@ func NewNode(config *cfg.Config, return nil, err } - blockStore := store.NewBlockStore(blockStoreDB, ipfsNode.DAG) + blockStore := store.NewBlockStore(blockStoreDB) // Create the handshaker, which calls RequestInfo, sets the AppVersion on the state, // and replays any blocks as necessary to sync tendermint with the app. @@ -852,7 +846,6 @@ func NewNode(config *cfg.Config, txIndexer: txIndexer, indexerService: indexerService, eventBus: eventBus, - ipfsClose: ipfsNode, } node.BaseService = *service.NewBaseService(logger, "Node", node) @@ -996,10 +989,6 @@ func (n *Node) OnStop() { n.Logger.Error("Prometheus HTTP server Shutdown", "err", err) } } - - if err := n.ipfsClose.Close(); err != nil { - n.Logger.Error("ipfsClose.Close()", err) - } } // ConfigureRPC makes sure RPC has all the objects it needs to operate. @@ -1402,8 +1391,8 @@ func createAndStartPrivValidatorSocketClient( } const ( - retries = 50 // 50 * 200ms = 10s total - timeout = 200 * time.Millisecond + retries = 50 // 50 * 100ms = 5s total + timeout = 100 * time.Millisecond ) pvscWithRetries := privval.NewRetrySignerClient(pvsc, retries, timeout) diff --git a/node/node_test.go b/node/node_test.go index 2a4641f465..dae28fc401 100644 --- a/node/node_test.go +++ b/node/node_test.go @@ -10,7 +10,6 @@ import ( "testing" "time" - mdutils "github.com/ipfs/go-merkledag/test" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" @@ -219,7 +218,7 @@ func TestNodeSetPrivValIPC(t *testing.T) { log.TestingLogger(), dialer, ) - privval.SignerDialerEndpointTimeoutReadWrite(400 * time.Millisecond)(dialerEndpoint) + privval.SignerDialerEndpointTimeoutReadWrite(100 * time.Millisecond)(dialerEndpoint) pvsc := privval.NewSignerServer( dialerEndpoint, @@ -284,7 +283,7 @@ func TestCreateProposalBlock(t *testing.T) { // Make EvidencePool evidenceDB := memdb.NewDB() - blockStore := store.NewBlockStore(memdb.NewDB(), mdutils.Mock()) + blockStore := store.NewBlockStore(memdb.NewDB()) evidencePool, err := evidence.NewPool(evidenceDB, stateStore, blockStore) require.NoError(t, err) evidencePool.SetLogger(logger) diff --git a/store/store.go b/store/store.go index 8f4efa7579..69955470b6 100644 --- a/store/store.go +++ b/store/store.go @@ -5,7 +5,6 @@ import ( "strconv" "github.com/gogo/protobuf/proto" - ipld "github.com/ipfs/go-ipld-format" dbm "github.com/celestiaorg/celestia-core/libs/db" tmsync "github.com/celestiaorg/celestia-core/libs/sync" @@ -42,19 +41,16 @@ type BlockStore struct { mtx tmsync.RWMutex base int64 height int64 - - ipfsDagAPI ipld.DAGService } // NewBlockStore returns a new BlockStore with the given DB, // initialized to the last height that was committed to the DB. -func NewBlockStore(db dbm.DB, dagAPI ipld.DAGService) *BlockStore { +func NewBlockStore(db dbm.DB) *BlockStore { bs := LoadBlockStoreState(db) return &BlockStore{ - base: bs.Base, - height: bs.Height, - db: db, - ipfsDagAPI: dagAPI, + base: bs.Base, + height: bs.Height, + db: db, } } diff --git a/store/store_test.go b/store/store_test.go index c14d507af9..0a4659fe48 100644 --- a/store/store_test.go +++ b/store/store_test.go @@ -11,7 +11,6 @@ import ( "time" "github.com/gogo/protobuf/proto" - mdutils "github.com/ipfs/go-merkledag/test" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" @@ -74,7 +73,7 @@ func makeStateAndBlockStore(logger log.Logger) (sm.State, *BlockStore, cleanupFu if err != nil { panic(fmt.Errorf("error constructing state from genesis file: %w", err)) } - return state, NewBlockStore(blockDB, mdutils.Mock()), func() { os.RemoveAll(config.RootDir) } + return state, NewBlockStore(blockDB), func() { os.RemoveAll(config.RootDir) } } func TestLoadBlockStoreState(t *testing.T) { @@ -106,7 +105,7 @@ func TestNewBlockStore(t *testing.T) { bz, _ := proto.Marshal(&bss) err := db.Set(blockStoreKey, bz) require.NoError(t, err) - bs := NewBlockStore(db, mdutils.Mock()) + bs := NewBlockStore(db) require.Equal(t, int64(100), bs.Base(), "failed to properly parse blockstore") require.Equal(t, int64(10000), bs.Height(), "failed to properly parse blockstore") @@ -124,7 +123,7 @@ func TestNewBlockStore(t *testing.T) { _, _, panicErr := doFn(func() (interface{}, error) { err := db.Set(blockStoreKey, tt.data) require.NoError(t, err) - _ = NewBlockStore(db, mdutils.Mock()) + _ = NewBlockStore(db) return nil, nil }) require.NotNil(t, panicErr, "#%d panicCauser: %q expected a panic", i, tt.data) @@ -133,13 +132,13 @@ func TestNewBlockStore(t *testing.T) { err = db.Set(blockStoreKey, []byte{}) require.NoError(t, err) - bs = NewBlockStore(db, mdutils.Mock()) + bs = NewBlockStore(db) assert.Equal(t, bs.Height(), int64(0), "expecting empty bytes to be unmarshaled alright") } func freshBlockStore() (*BlockStore, dbm.DB) { db := memdb.NewDB() - return NewBlockStore(db, mdutils.Mock()), db + return NewBlockStore(db), db } var ( @@ -381,7 +380,7 @@ func TestLoadBaseMeta(t *testing.T) { stateStore := sm.NewStore(memdb.NewDB()) state, err := stateStore.LoadFromDBOrGenesisFile(config.GenesisFile()) require.NoError(t, err) - bs := NewBlockStore(memdb.NewDB(), mdutils.Mock()) + bs := NewBlockStore(memdb.NewDB()) for h := int64(1); h <= 10; h++ { block := makeBlock(h, state, new(types.Commit)) @@ -438,7 +437,7 @@ func TestPruneBlocks(t *testing.T) { state, err := stateStore.LoadFromDBOrGenesisFile(config.GenesisFile()) require.NoError(t, err) db := memdb.NewDB() - bs := NewBlockStore(db, mdutils.Mock()) + bs := NewBlockStore(db) assert.EqualValues(t, 0, bs.Base()) assert.EqualValues(t, 0, bs.Height()) assert.EqualValues(t, 0, bs.Size()) From 21572834427a4c303526e32a19099337c87d625d Mon Sep 17 00:00:00 2001 From: evan-forbes Date: Tue, 24 Aug 2021 18:58:39 -0500 Subject: [PATCH 07/10] remove ipfs node provider from new node --- abci/example/dummyapp/main.go | 3 +-- cmd/tendermint/commands/run_node.go | 2 -- node/node.go | 18 +++--------------- node/node_test.go | 3 --- rpc/test/helpers.go | 2 -- test/e2e/app/main.go | 2 -- 6 files changed, 4 insertions(+), 26 deletions(-) diff --git a/abci/example/dummyapp/main.go b/abci/example/dummyapp/main.go index c62e884d37..359b9350a0 100644 --- a/abci/example/dummyapp/main.go +++ b/abci/example/dummyapp/main.go @@ -78,7 +78,7 @@ func main() { } // DummyNode implements NodeProvider. -func DummyNode(config *cfg.Config, provider ipfs.NodeProvider, logger log.Logger) (*node.Node, error) { +func DummyNode(config *cfg.Config, logger log.Logger) (*node.Node, error) { if err := ipfs.InitRepo(config.IPFS.Path(), logger); err != nil { return nil, fmt.Errorf("failed to initialize IPFS repo at path %s: %v", config.IPFS.Path(), err) } @@ -103,7 +103,6 @@ func DummyNode(config *cfg.Config, provider ipfs.NodeProvider, logger log.Logger proxy.NewLocalClientCreator(app), node.DefaultGenesisDocProviderFunc(config), node.DefaultDBProvider, - provider, node.DefaultMetricsProvider(config.Instrumentation), logger, ) diff --git a/cmd/tendermint/commands/run_node.go b/cmd/tendermint/commands/run_node.go index 02e4f757b2..dfa8808209 100644 --- a/cmd/tendermint/commands/run_node.go +++ b/cmd/tendermint/commands/run_node.go @@ -10,7 +10,6 @@ import ( "github.com/spf13/cobra" cfg "github.com/celestiaorg/celestia-core/config" - "github.com/celestiaorg/celestia-core/ipfs" tmos "github.com/celestiaorg/celestia-core/libs/os" nm "github.com/celestiaorg/celestia-core/node" ) @@ -123,7 +122,6 @@ func NewRunNodeCmd(nodeProvider nm.Provider) *cobra.Command { n, err := nodeProvider( config, - ipfs.Embedded(initIPFS, config.IPFS, logger), logger, ) if err != nil { diff --git a/node/node.go b/node/node.go index 3b7af0b6c1..3082c939f2 100644 --- a/node/node.go +++ b/node/node.go @@ -11,8 +11,6 @@ import ( "strings" "time" - ipld "github.com/ipfs/go-ipld-format" - "github.com/libp2p/go-libp2p-core/routing" "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus/promhttp" "github.com/rs/cors" @@ -23,7 +21,6 @@ import ( cs "github.com/celestiaorg/celestia-core/consensus" "github.com/celestiaorg/celestia-core/crypto" "github.com/celestiaorg/celestia-core/evidence" - "github.com/celestiaorg/celestia-core/ipfs" dbm "github.com/celestiaorg/celestia-core/libs/db" "github.com/celestiaorg/celestia-core/libs/db/badgerdb" tmjson "github.com/celestiaorg/celestia-core/libs/json" @@ -86,12 +83,12 @@ func DefaultGenesisDocProviderFunc(config *cfg.Config) GenesisDocProvider { } // Provider takes a config and a logger and returns a ready to go Node. -type Provider func(*cfg.Config, ipfs.NodeProvider, log.Logger) (*Node, error) +type Provider func(*cfg.Config, log.Logger) (*Node, error) // DefaultNewNode returns a Tendermint node with default settings for the // PrivValidator, ClientCreator, GenesisDoc, and DBProvider. // It implements NodeProvider. -func DefaultNewNode(config *cfg.Config, ipfs ipfs.NodeProvider, logger log.Logger) (*Node, error) { +func DefaultNewNode(config *cfg.Config, logger log.Logger) (*Node, error) { nodeKey, err := p2p.LoadOrGenNodeKey(config.NodeKeyFile()) if err != nil { return nil, fmt.Errorf("failed to load or gen node key %s: %w", config.NodeKeyFile(), err) @@ -108,7 +105,6 @@ func DefaultNewNode(config *cfg.Config, ipfs ipfs.NodeProvider, logger log.Logge proxy.DefaultClientCreator(config.ProxyApp, config.DBDir()), DefaultGenesisDocProviderFunc(config), DefaultDBProvider, - ipfs, DefaultMetricsProvider(config.Instrumentation), logger, ) @@ -376,8 +372,6 @@ func createConsensusReactor(config *cfg.Config, csMetrics *cs.Metrics, waitSync bool, eventBus *types.EventBus, - dag ipld.DAGService, - croute routing.ContentRouting, consensusLogger log.Logger) (*cs.Reactor, *cs.State) { consensusState := cs.NewState( @@ -614,7 +608,6 @@ func NewNode(config *cfg.Config, clientCreator proxy.ClientCreator, genesisDocProvider GenesisDocProvider, dbProvider DBProvider, - ipfsProvider ipfs.NodeProvider, metricsProvider MetricsProvider, logger log.Logger, options ...Option) (*Node, error) { @@ -679,11 +672,6 @@ func NewNode(config *cfg.Config, return nil, err } - ipfsNode, err := ipfsProvider() - if err != nil { - return nil, err - } - blockStore := store.NewBlockStore(blockStoreDB) // Create the handshaker, which calls RequestInfo, sets the AppVersion on the state, @@ -745,7 +733,7 @@ func NewNode(config *cfg.Config, } consensusReactor, consensusState := createConsensusReactor( config, state, blockExec, blockStore, mempool, evidencePool, - privValidator, csMetrics, stateSync || fastSync, eventBus, ipfsNode.DAG, ipfsNode.Routing, consensusLogger, + privValidator, csMetrics, stateSync || fastSync, eventBus, consensusLogger, ) // Set up state sync reactor, and schedule a sync if requested. diff --git a/node/node_test.go b/node/node_test.go index dae28fc401..df3ecabf97 100644 --- a/node/node_test.go +++ b/node/node_test.go @@ -19,7 +19,6 @@ import ( "github.com/celestiaorg/celestia-core/crypto/ed25519" "github.com/celestiaorg/celestia-core/crypto/tmhash" "github.com/celestiaorg/celestia-core/evidence" - "github.com/celestiaorg/celestia-core/ipfs" dbm "github.com/celestiaorg/celestia-core/libs/db" "github.com/celestiaorg/celestia-core/libs/db/memdb" "github.com/celestiaorg/celestia-core/libs/log" @@ -52,7 +51,6 @@ func defaultNewTestNode(config *cfg.Config, logger log.Logger) (*Node, error) { proxy.DefaultClientCreator(config.ProxyApp, config.DBDir()), DefaultGenesisDocProviderFunc(config), InMemDBProvider, - ipfs.Mock(), DefaultMetricsProvider(config.Instrumentation), logger, ) @@ -539,7 +537,6 @@ func TestNodeNewNodeCustomReactors(t *testing.T) { proxy.DefaultClientCreator(config.ProxyApp, config.DBDir()), DefaultGenesisDocProviderFunc(config), InMemDBProvider, - ipfs.Mock(), DefaultMetricsProvider(config.Instrumentation), log.TestingLogger(), CustomReactors(map[string]p2p.Reactor{"FOO": cr, "BLOCKCHAIN": customBlockchainReactor}), diff --git a/rpc/test/helpers.go b/rpc/test/helpers.go index 981cbfd855..b2e8233abe 100644 --- a/rpc/test/helpers.go +++ b/rpc/test/helpers.go @@ -10,7 +10,6 @@ import ( abci "github.com/celestiaorg/celestia-core/abci/types" cfg "github.com/celestiaorg/celestia-core/config" - "github.com/celestiaorg/celestia-core/ipfs" "github.com/celestiaorg/celestia-core/libs/log" tmnet "github.com/celestiaorg/celestia-core/libs/net" nm "github.com/celestiaorg/celestia-core/node" @@ -176,7 +175,6 @@ func NewTendermint(app abci.Application, opts *Options) *nm.Node { node, err := nm.NewNode(config, pv, nodeKey, papp, nm.DefaultGenesisDocProviderFunc(config), nm.InMemDBProvider, - ipfs.Mock(), nm.DefaultMetricsProvider(config.Instrumentation), logger, ) diff --git a/test/e2e/app/main.go b/test/e2e/app/main.go index 3bc274ac88..cd91686215 100644 --- a/test/e2e/app/main.go +++ b/test/e2e/app/main.go @@ -11,7 +11,6 @@ import ( "github.com/celestiaorg/celestia-core/config" "github.com/celestiaorg/celestia-core/crypto/ed25519" - "github.com/celestiaorg/celestia-core/ipfs" tmflags "github.com/celestiaorg/celestia-core/libs/cli/flags" "github.com/celestiaorg/celestia-core/libs/log" tmnet "github.com/celestiaorg/celestia-core/libs/net" @@ -104,7 +103,6 @@ func startNode(cfg *Config) error { proxy.NewLocalClientCreator(app), node.DefaultGenesisDocProviderFunc(tmcfg), node.DefaultDBProvider, - ipfs.Embedded(true, ipfs.DefaultConfig(), nodeLogger), node.DefaultMetricsProvider(tmcfg.Instrumentation), nodeLogger, ) From c022206b96f87361e285c71c0c521cc3380936e3 Mon Sep 17 00:00:00 2001 From: evan-forbes Date: Tue, 24 Aug 2021 19:02:56 -0500 Subject: [PATCH 08/10] stop init ipfs repos --- abci/example/dummyapp/main.go | 5 ----- cmd/tendermint/commands/init.go | 4 +--- test/e2e/runner/setup.go | 5 ----- 3 files changed, 1 insertion(+), 13 deletions(-) diff --git a/abci/example/dummyapp/main.go b/abci/example/dummyapp/main.go index 359b9350a0..a9eb04bbd1 100644 --- a/abci/example/dummyapp/main.go +++ b/abci/example/dummyapp/main.go @@ -10,7 +10,6 @@ import ( cmd "github.com/celestiaorg/celestia-core/cmd/tendermint/commands" "github.com/celestiaorg/celestia-core/cmd/tendermint/commands/debug" cfg "github.com/celestiaorg/celestia-core/config" - "github.com/celestiaorg/celestia-core/ipfs" "github.com/celestiaorg/celestia-core/libs/cli" "github.com/celestiaorg/celestia-core/libs/log" "github.com/celestiaorg/celestia-core/node" @@ -79,10 +78,6 @@ func main() { // DummyNode implements NodeProvider. func DummyNode(config *cfg.Config, logger log.Logger) (*node.Node, error) { - if err := ipfs.InitRepo(config.IPFS.Path(), logger); err != nil { - return nil, fmt.Errorf("failed to initialize IPFS repo at path %s: %v", config.IPFS.Path(), err) - } - nodeKey, err := p2p.LoadOrGenNodeKey(config.NodeKeyFile()) if err != nil { return nil, fmt.Errorf("failed to load or gen node key %s: %w", config.NodeKeyFile(), err) diff --git a/cmd/tendermint/commands/init.go b/cmd/tendermint/commands/init.go index 6f0ace24c3..aa35f1efac 100644 --- a/cmd/tendermint/commands/init.go +++ b/cmd/tendermint/commands/init.go @@ -6,7 +6,6 @@ import ( "github.com/spf13/cobra" cfg "github.com/celestiaorg/celestia-core/config" - "github.com/celestiaorg/celestia-core/ipfs" tmos "github.com/celestiaorg/celestia-core/libs/os" tmrand "github.com/celestiaorg/celestia-core/libs/rand" "github.com/celestiaorg/celestia-core/p2p" @@ -99,6 +98,5 @@ func initFilesWithConfig(config *cfg.Config) error { logger.Info("Generated genesis file", "path", genFile) } - // TODO(ismail): add counter part in ResetAllCmd - return ipfs.InitRepo(config.IPFS.Path(), logger) + return nil } diff --git a/test/e2e/runner/setup.go b/test/e2e/runner/setup.go index db876c38de..ab5fa860a7 100644 --- a/test/e2e/runner/setup.go +++ b/test/e2e/runner/setup.go @@ -21,7 +21,6 @@ import ( "github.com/celestiaorg/celestia-core/config" "github.com/celestiaorg/celestia-core/crypto/ed25519" - "github.com/celestiaorg/celestia-core/ipfs" "github.com/celestiaorg/celestia-core/p2p" "github.com/celestiaorg/celestia-core/privval" e2e "github.com/celestiaorg/celestia-core/test/e2e/pkg" @@ -115,10 +114,6 @@ func Setup(testnet *e2e.Testnet) error { filepath.Join(nodeDir, PrivvalDummyKeyFile), filepath.Join(nodeDir, PrivvalDummyStateFile), )).Save() - err = ipfs.InitRepo(cfg.IPFS.RepoPath, logger) - if err != nil { - return err - } } return nil From bfebf9bcda605ca151b40ae82bba6326f41777c9 Mon Sep 17 00:00:00 2001 From: evan-forbes Date: Tue, 24 Aug 2021 19:05:27 -0500 Subject: [PATCH 09/10] remove IPFS node config --- cmd/tendermint/commands/run_node.go | 16 ---------------- config/config.go | 5 ----- test/e2e/runner/setup.go | 3 +-- 3 files changed, 1 insertion(+), 23 deletions(-) diff --git a/cmd/tendermint/commands/run_node.go b/cmd/tendermint/commands/run_node.go index dfa8808209..ca7a46b18f 100644 --- a/cmd/tendermint/commands/run_node.go +++ b/cmd/tendermint/commands/run_node.go @@ -90,22 +90,6 @@ func AddNodeFlags(cmd *cobra.Command) { config.DBPath, "database directory") - cmd.Flags().String( - "ipfs.repo-path", - config.IPFS.RepoPath, - "custom IPFS repository path. Defaults to `.{RootDir}/ipfs`", - ) - cmd.Flags().Bool( - "ipfs.serve-api", - config.IPFS.ServeAPI, - "set this to expose IPFS API(useful for debugging)", - ) - cmd.Flags().BoolVar( - &initIPFS, - "ipfs.init", - false, - "set this to initialize repository for embedded IPFS node. Flag is ignored if repo is already initialized", - ) } // NewRunNodeCmd returns the command that allows the CLI to start a node. diff --git a/config/config.go b/config/config.go index 8f0301ed61..a49a08debc 100644 --- a/config/config.go +++ b/config/config.go @@ -67,8 +67,6 @@ type Config struct { Consensus *ConsensusConfig `mapstructure:"consensus"` TxIndex *TxIndexConfig `mapstructure:"tx-index"` Instrumentation *InstrumentationConfig `mapstructure:"instrumentation"` - // Options for IPFS service - IPFS *ipfs.Config `mapstructure:"ipfs"` } // DefaultConfig returns a default configuration for a Tendermint node @@ -83,7 +81,6 @@ func DefaultConfig() *Config { Consensus: DefaultConsensusConfig(), TxIndex: DefaultTxIndexConfig(), Instrumentation: DefaultInstrumentationConfig(), - IPFS: ipfs.DefaultConfig(), } } @@ -99,7 +96,6 @@ func TestConfig() *Config { Consensus: TestConsensusConfig(), TxIndex: TestTxIndexConfig(), Instrumentation: TestInstrumentationConfig(), - IPFS: TetsIpfsConfig(), } } @@ -110,7 +106,6 @@ func (cfg *Config) SetRoot(root string) *Config { cfg.P2P.RootDir = root cfg.Mempool.RootDir = root cfg.Consensus.RootDir = root - cfg.IPFS.RootDir = root return cfg } diff --git a/test/e2e/runner/setup.go b/test/e2e/runner/setup.go index ab5fa860a7..11565ecba0 100644 --- a/test/e2e/runner/setup.go +++ b/test/e2e/runner/setup.go @@ -85,8 +85,7 @@ func Setup(testnet *e2e.Testnet) error { if err != nil { return err } - // todo(evan): the path should be a constant - cfg.IPFS.RepoPath = filepath.Join(nodeDir, ".ipfs") + config.WriteConfigFile(filepath.Join(nodeDir, "config", "config.toml"), cfg) // panics appCfg, err := MakeAppConfig(node) From 1131140d00e4aa897aef10fca3ed5e2199006ec2 Mon Sep 17 00:00:00 2001 From: evan-forbes Date: Tue, 24 Aug 2021 19:14:47 -0500 Subject: [PATCH 10/10] clean up remaining ipfs stuff --- cmd/tendermint/commands/run_node.go | 1 - config/config.go | 6 ------ config/toml.go | 9 --------- consensus/common_test.go | 2 +- 4 files changed, 1 insertion(+), 17 deletions(-) diff --git a/cmd/tendermint/commands/run_node.go b/cmd/tendermint/commands/run_node.go index ca7a46b18f..361af54362 100644 --- a/cmd/tendermint/commands/run_node.go +++ b/cmd/tendermint/commands/run_node.go @@ -16,7 +16,6 @@ import ( var ( genesisHash []byte - initIPFS bool ) // AddNodeFlags exposes some common configuration options on the command-line diff --git a/config/config.go b/config/config.go index a49a08debc..d10c23dabd 100644 --- a/config/config.go +++ b/config/config.go @@ -8,8 +8,6 @@ import ( "os" "path/filepath" "time" - - "github.com/celestiaorg/celestia-core/ipfs" ) const ( @@ -1004,10 +1002,6 @@ func DefaultInstrumentationConfig() *InstrumentationConfig { } } -func TetsIpfsConfig() *ipfs.Config { - return ipfs.DefaultConfig() -} - // TestInstrumentationConfig returns a default configuration for metrics // reporting. func TestInstrumentationConfig() *InstrumentationConfig { diff --git a/config/toml.go b/config/toml.go index 48ae268159..664c0182a3 100644 --- a/config/toml.go +++ b/config/toml.go @@ -430,15 +430,6 @@ max-open-connections = {{ .Instrumentation.MaxOpenConnections }} # Instrumentation namespace namespace = "{{ .Instrumentation.Namespace }}" - -####################################################### -### IPFS Configuration Options ### -####################################################### -[ipfs] - -# IPFS related configuration -repo-path = "{{ .IPFS.RepoPath}}" -serve-api = "{{ .IPFS.ServeAPI}}" ` /****** these are for test settings ***********/ diff --git a/consensus/common_test.go b/consensus/common_test.go index 6867a0f350..01aa4e09e8 100644 --- a/consensus/common_test.go +++ b/consensus/common_test.go @@ -47,7 +47,7 @@ const ( // test. type cleanupFunc func() -// genesis, chain_id, priv_val, ipfsAPI +// genesis, chain_id, priv_val var ( config *cfg.Config // NOTE: must be reset for each _test.go file consensusReplayConfig *cfg.Config