From f7c42922e14e4fea011d9b77379724378aca5290 Mon Sep 17 00:00:00 2001 From: Marko Baricevic Date: Thu, 4 Feb 2021 11:40:53 +0100 Subject: [PATCH] complete consensus errors --- abci/cmd/abci-cli/abci-cli.go | 2 +- consensus/byzantine_test.go | 16 ++--- consensus/common_test.go | 30 ++++----- consensus/invalid_test.go | 4 +- consensus/reactor.go | 26 ++++---- consensus/reactor_test.go | 20 ++---- consensus/replay.go | 8 +-- consensus/replay_test.go | 46 +++++++------- consensus/state.go | 10 +-- consensus/types/height_vote_set.go | 8 +-- consensus/types/height_vote_set_test.go | 2 +- consensus/types/peer_round_state.go | 2 +- proto/tendermint/consensus/wal.pb.go | 82 ++++++++++++------------- proto/tendermint/consensus/wal.proto | 4 +- 14 files changed, 126 insertions(+), 134 deletions(-) diff --git a/abci/cmd/abci-cli/abci-cli.go b/abci/cmd/abci-cli/abci-cli.go index 20cf9a808..e2f69bb64 100644 --- a/abci/cmd/abci-cli/abci-cli.go +++ b/abci/cmd/abci-cli/abci-cli.go @@ -576,7 +576,7 @@ func cmdQuery(cmd *cobra.Command, args []string) error { resQuery, err := client.QuerySync(ctx, types.RequestQuery{ Data: queryBytes, Path: flagPath, - Height: int64(flagHeight), + Height: uint64(flagHeight), Prove: flagProve, }) if err != nil { diff --git a/consensus/byzantine_test.go b/consensus/byzantine_test.go index b16a98c6a..42d6dae3e 100644 --- a/consensus/byzantine_test.go +++ b/consensus/byzantine_test.go @@ -35,7 +35,7 @@ import ( func TestByzantinePrevoteEquivocation(t *testing.T) { const nValidators = 4 const byzantineNode = 0 - const prevoteHeight = int64(2) + const prevoteHeight = uint64(2) testName := "consensus_byzantine_test" tickerFunc := newMockTickerFunc(true) appFunc := newCounter @@ -127,7 +127,7 @@ func TestByzantinePrevoteEquivocation(t *testing.T) { bcs := css[byzantineNode] // alter prevote so that the byzantine node double votes when height is 2 - bcs.doPrevote = func(height int64, round int32) { + bcs.doPrevote = func(height uint64, round int32) { // allow first height to happen normally so that byzantine validator is no longer proposer if height == prevoteHeight { bcs.Logger.Info("Sending two votes") @@ -158,7 +158,7 @@ func TestByzantinePrevoteEquivocation(t *testing.T) { // proposed will have a valid timestamp lazyProposer := css[1] - lazyProposer.decideProposal = func(height int64, round int32) { + lazyProposer.decideProposal = func(height uint64, round int32) { lazyProposer.Logger.Info("Lazy Proposer proposing condensed commit") if lazyProposer.privValidator == nil { panic("entered createProposalBlock with privValidator being nil") @@ -337,14 +337,14 @@ func TestByzantineConflictingProposalsWithPartition(t *testing.T) { // NOTE: Now, test validators are MockPV, which by default doesn't // do any safety checks. css[0].privValidator.(types.MockPV).DisableChecks() - css[0].decideProposal = func(j int32) func(int64, int32) { - return func(height int64, round int32) { + css[0].decideProposal = func(j int32) func(uint64, int32) { + return func(height uint64, round int32) { byzantineDecideProposalFunc(t, height, round, css[j], switches[j]) } }(int32(0)) // We are setting the prevote function to do nothing because the prevoting // and precommitting are done alongside the proposal. - css[0].doPrevote = func(height int64, round int32) {} + css[0].doPrevote = func(height uint64, round int32) {} defer func() { for _, sw := range switches { @@ -417,7 +417,7 @@ func TestByzantineConflictingProposalsWithPartition(t *testing.T) { //------------------------------- // byzantine consensus functions -func byzantineDecideProposalFunc(t *testing.T, height int64, round int32, cs *State, sw *p2p.Switch) { +func byzantineDecideProposalFunc(t *testing.T, height uint64, round int32, cs *State, sw *p2p.Switch) { // byzantine user should create two proposals and try to split the vote. // Avoid sending on internalMsgQueue and running consensus state. @@ -462,7 +462,7 @@ func byzantineDecideProposalFunc(t *testing.T, height int64, round int32, cs *St } func sendProposalAndParts( - height int64, + height uint64, round int32, cs *State, peer p2p.Peer, diff --git a/consensus/common_test.go b/consensus/common_test.go index 8502883e7..e6dba3c43 100644 --- a/consensus/common_test.go +++ b/consensus/common_test.go @@ -70,7 +70,7 @@ func ResetConfig(name string) *cfg.Config { type validatorStub struct { Index int32 // Validator index. NOTE: we don't assume validator set changes. - Height int64 + Height uint64 Round int32 types.PrivValidator VotingPower int64 @@ -178,7 +178,7 @@ func (vss ValidatorStubsByPower) Swap(i, j int) { //------------------------------------------------------------------------------- // Functions for transitioning the consensus state -func startTestRound(cs *State, height int64, round int32) { +func startTestRound(cs *State, height uint64, round int32) { cs.enterNewRound(height, round) cs.startRoutines(0) } @@ -187,7 +187,7 @@ func startTestRound(cs *State, height int64, round int32) { func decideProposal( cs1 *State, vs *validatorStub, - height int64, + height uint64, round int32, ) (proposal *types.Proposal, block *types.Block) { cs1.mtx.Lock() @@ -480,7 +480,7 @@ func ensureNoNewTimeout(stepCh <-chan tmpubsub.Message, timeout int64) { "We should be stuck waiting, not receiving NewTimeout event") } -func ensureNewEvent(ch <-chan tmpubsub.Message, height int64, round int32, timeout time.Duration, errorMessage string) { +func ensureNewEvent(ch <-chan tmpubsub.Message, height uint64, round int32, timeout time.Duration, errorMessage string) { select { case <-time.After(timeout): panic(errorMessage) @@ -500,7 +500,7 @@ func ensureNewEvent(ch <-chan tmpubsub.Message, height int64, round int32, timeo } } -func ensureNewRound(roundCh <-chan tmpubsub.Message, height int64, round int32) { +func ensureNewRound(roundCh <-chan tmpubsub.Message, height uint64, round int32) { select { case <-time.After(ensureTimeout): panic("Timeout expired while waiting for NewRound event") @@ -519,13 +519,13 @@ func ensureNewRound(roundCh <-chan tmpubsub.Message, height int64, round int32) } } -func ensureNewTimeout(timeoutCh <-chan tmpubsub.Message, height int64, round int32, timeout int64) { +func ensureNewTimeout(timeoutCh <-chan tmpubsub.Message, height uint64, round int32, timeout int64) { timeoutDuration := time.Duration(timeout*10) * time.Nanosecond ensureNewEvent(timeoutCh, height, round, timeoutDuration, "Timeout expired while waiting for NewTimeout event") } -func ensureNewProposal(proposalCh <-chan tmpubsub.Message, height int64, round int32) { +func ensureNewProposal(proposalCh <-chan tmpubsub.Message, height uint64, round int32) { select { case <-time.After(ensureTimeout): panic("Timeout expired while waiting for NewProposal event") @@ -544,12 +544,12 @@ func ensureNewProposal(proposalCh <-chan tmpubsub.Message, height int64, round i } } -func ensureNewValidBlock(validBlockCh <-chan tmpubsub.Message, height int64, round int32) { +func ensureNewValidBlock(validBlockCh <-chan tmpubsub.Message, height uint64, round int32) { ensureNewEvent(validBlockCh, height, round, ensureTimeout, "Timeout expired while waiting for NewValidBlock event") } -func ensureNewBlock(blockCh <-chan tmpubsub.Message, height int64) { +func ensureNewBlock(blockCh <-chan tmpubsub.Message, height uint64) { select { case <-time.After(ensureTimeout): panic("Timeout expired while waiting for NewBlock event") @@ -565,7 +565,7 @@ func ensureNewBlock(blockCh <-chan tmpubsub.Message, height int64) { } } -func ensureNewBlockHeader(blockCh <-chan tmpubsub.Message, height int64, blockHash tmbytes.HexBytes) { +func ensureNewBlockHeader(blockCh <-chan tmpubsub.Message, height uint64, blockHash tmbytes.HexBytes) { select { case <-time.After(ensureTimeout): panic("Timeout expired while waiting for NewBlockHeader event") @@ -584,12 +584,12 @@ func ensureNewBlockHeader(blockCh <-chan tmpubsub.Message, height int64, blockHa } } -func ensureNewUnlock(unlockCh <-chan tmpubsub.Message, height int64, round int32) { +func ensureNewUnlock(unlockCh <-chan tmpubsub.Message, height uint64, round int32) { ensureNewEvent(unlockCh, height, round, ensureTimeout, "Timeout expired while waiting for NewUnlock event") } -func ensureProposal(proposalCh <-chan tmpubsub.Message, height int64, round int32, propID types.BlockID) { +func ensureProposal(proposalCh <-chan tmpubsub.Message, height uint64, round int32, propID types.BlockID) { select { case <-time.After(ensureTimeout): panic("Timeout expired while waiting for NewProposal event") @@ -611,15 +611,15 @@ func ensureProposal(proposalCh <-chan tmpubsub.Message, height int64, round int3 } } -func ensurePrecommit(voteCh <-chan tmpubsub.Message, height int64, round int32) { +func ensurePrecommit(voteCh <-chan tmpubsub.Message, height uint64, round int32) { ensureVote(voteCh, height, round, tmproto.PrecommitType) } -func ensurePrevote(voteCh <-chan tmpubsub.Message, height int64, round int32) { +func ensurePrevote(voteCh <-chan tmpubsub.Message, height uint64, round int32) { ensureVote(voteCh, height, round, tmproto.PrevoteType) } -func ensureVote(voteCh <-chan tmpubsub.Message, height int64, round int32, +func ensureVote(voteCh <-chan tmpubsub.Message, height uint64, round int32, voteType tmproto.SignedMsgType) { select { case <-time.After(ensureTimeout): diff --git a/consensus/invalid_test.go b/consensus/invalid_test.go index 5b161dd71..f794e742d 100644 --- a/consensus/invalid_test.go +++ b/consensus/invalid_test.go @@ -39,7 +39,7 @@ func TestReactorInvalidPrecommit(t *testing.T) { // and otherwise disable the priv validator byzVal.mtx.Lock() pv := byzVal.privValidator - byzVal.doPrevote = func(height int64, round int32) { + byzVal.doPrevote = func(height uint64, round int32) { invalidDoPrevoteFunc(t, height, round, byzVal, byzR.Switch, pv) } byzVal.mtx.Unlock() @@ -54,7 +54,7 @@ func TestReactorInvalidPrecommit(t *testing.T) { } } -func invalidDoPrevoteFunc(t *testing.T, height int64, round int32, cs *State, sw *p2p.Switch, pv types.PrivValidator) { +func invalidDoPrevoteFunc(t *testing.T, height uint64, round int32, cs *State, sw *p2p.Switch, pv types.PrivValidator) { // routine to: // - precommit for a random block // - send precommit to all peers diff --git a/consensus/reactor.go b/consensus/reactor.go index 01b0197f1..92ceb19d6 100644 --- a/consensus/reactor.go +++ b/consensus/reactor.go @@ -991,7 +991,7 @@ func (ps *PeerState) ToJSON() ([]byte, error) { // GetHeight returns an atomic snapshot of the PeerRoundState's height // used by the mempool to ensure peers are caught up before broadcasting new txs -func (ps *PeerState) GetHeight() int64 { +func (ps *PeerState) GetHeight() uint64 { ps.mtx.Lock() defer ps.mtx.Unlock() return ps.PRS.Height @@ -1037,7 +1037,7 @@ func (ps *PeerState) InitProposalBlockParts(partSetHeader types.PartSetHeader) { } // SetHasProposalBlockPart sets the given block part index as known for the peer. -func (ps *PeerState) SetHasProposalBlockPart(height int64, round int32, index int) { +func (ps *PeerState) SetHasProposalBlockPart(height uint64, round int32, index int) { ps.mtx.Lock() defer ps.mtx.Unlock() @@ -1093,7 +1093,7 @@ func (ps *PeerState) PickVoteToSend(votes types.VoteSetReader) (vote *types.Vote return nil, false } -func (ps *PeerState) getVoteBitArray(height int64, round int32, votesType tmproto.SignedMsgType) *bits.BitArray { +func (ps *PeerState) getVoteBitArray(height uint64, round int32, votesType tmproto.SignedMsgType) *bits.BitArray { if !types.IsVoteTypeValid(votesType) { return nil } @@ -1140,7 +1140,7 @@ func (ps *PeerState) getVoteBitArray(height int64, round int32, votesType tmprot } // 'round': A round for which we have a +2/3 commit. -func (ps *PeerState) ensureCatchupCommitRound(height int64, round int32, numValidators int) { +func (ps *PeerState) ensureCatchupCommitRound(height uint64, round int32, numValidators int) { if ps.PRS.Height != height { return } @@ -1172,13 +1172,13 @@ func (ps *PeerState) ensureCatchupCommitRound(height int64, round int32, numVali // what votes this peer has received. // NOTE: It's important to make sure that numValidators actually matches // what the node sees as the number of validators for height. -func (ps *PeerState) EnsureVoteBitArrays(height int64, numValidators int) { +func (ps *PeerState) EnsureVoteBitArrays(height uint64, numValidators int) { ps.mtx.Lock() defer ps.mtx.Unlock() ps.ensureVoteBitArrays(height, numValidators) } -func (ps *PeerState) ensureVoteBitArrays(height int64, numValidators int) { +func (ps *PeerState) ensureVoteBitArrays(height uint64, numValidators int) { if ps.PRS.Height == height { if ps.PRS.Prevotes == nil { ps.PRS.Prevotes = bits.NewBitArray(numValidators) @@ -1245,7 +1245,7 @@ func (ps *PeerState) SetHasVote(vote *types.Vote) { ps.setHasVote(vote.Height, vote.Round, vote.Type, vote.ValidatorIndex) } -func (ps *PeerState) setHasVote(height int64, round int32, voteType tmproto.SignedMsgType, index int32) { +func (ps *PeerState) setHasVote(height uint64, round int32, voteType tmproto.SignedMsgType, index int32) { logger := ps.logger.With( "peerH/R", fmt.Sprintf("%d/%d", ps.PRS.Height, ps.PRS.Round), @@ -1434,7 +1434,7 @@ func decodeMsg(bz []byte) (msg Message, err error) { // NewRoundStepMessage is sent for every step taken in the ConsensusState. // For every height/round/step transition type NewRoundStepMessage struct { - Height int64 + Height uint64 Round int32 Step cstypes.RoundStepType SecondsSinceStartTime int64 @@ -1466,7 +1466,7 @@ func (m *NewRoundStepMessage) ValidateBasic() error { } // ValidateHeight validates the height given the chain's initial height. -func (m *NewRoundStepMessage) ValidateHeight(initialHeight int64) error { +func (m *NewRoundStepMessage) ValidateHeight(initialHeight uint64) error { if m.Height < initialHeight { return fmt.Errorf("invalid Height %v (lower than initial height %v)", m.Height, initialHeight) @@ -1494,7 +1494,7 @@ func (m *NewRoundStepMessage) String() string { // i.e., there is a Proposal for block B and 2/3+ prevotes for the block B in the round r. // In case the block is also committed, then IsCommit flag is set to true. type NewValidBlockMessage struct { - Height int64 + Height uint64 Round int32 BlockPartSetHeader types.PartSetHeader BlockParts *bits.BitArray @@ -1553,7 +1553,7 @@ func (m *ProposalMessage) String() string { // ProposalPOLMessage is sent when a previous proposal is re-proposed. type ProposalPOLMessage struct { - Height int64 + Height uint64 ProposalPOLRound int32 ProposalPOL *bits.BitArray } @@ -1629,7 +1629,7 @@ func (m *VoteMessage) String() string { // HasVoteMessage is sent to indicate that a particular vote has been received. type HasVoteMessage struct { - Height int64 + Height uint64 Round int32 Type tmproto.SignedMsgType Index int32 @@ -1661,7 +1661,7 @@ func (m *HasVoteMessage) String() string { // VoteSetMaj23Message is sent to indicate that a given BlockID has seen +2/3 votes. type VoteSetMaj23Message struct { - Height int64 + Height uint64 Round int32 Type tmproto.SignedMsgType BlockID types.BlockID diff --git a/consensus/reactor_test.go b/consensus/reactor_test.go index f23ec727d..e2823da7d 100644 --- a/consensus/reactor_test.go +++ b/consensus/reactor_test.go @@ -672,13 +672,12 @@ func TestNewRoundStepMessageValidateBasic(t *testing.T) { expectErr bool messageRound int32 messageLastCommitRound int32 - messageHeight int64 + messageHeight uint64 testName string messageStep cstypes.RoundStepType }{ {false, 0, 0, 0, "Valid Message", cstypes.RoundStepNewHeight}, {true, -1, 0, 0, "Negative round", cstypes.RoundStepNewHeight}, - {true, 0, 0, -1, "Negative height", cstypes.RoundStepNewHeight}, {true, 0, 0, 0, "Invalid Step", cstypes.RoundStepCommit + 1}, // The following cases will be handled by ValidateHeight {false, 0, 0, 1, "H == 1 but LCR != -1 ", cstypes.RoundStepNewHeight}, @@ -706,15 +705,14 @@ func TestNewRoundStepMessageValidateBasic(t *testing.T) { } func TestNewRoundStepMessageValidateHeight(t *testing.T) { - initialHeight := int64(10) + initialHeight := uint64(10) testCases := []struct { // nolint: maligned expectErr bool messageLastCommitRound int32 - messageHeight int64 + messageHeight uint64 testName string }{ {false, 0, 11, "Valid Message"}, - {true, 0, -1, "Negative height"}, {true, 0, 0, "Zero height"}, {true, 0, 10, "Initial height but LCR != -1 "}, {true, -1, 11, "Normal height but LCR < 0"}, @@ -746,7 +744,6 @@ func TestNewValidBlockMessageValidateBasic(t *testing.T) { expErr string }{ {func(msg *NewValidBlockMessage) {}, ""}, - {func(msg *NewValidBlockMessage) { msg.Height = -1 }, "negative Height"}, {func(msg *NewValidBlockMessage) { msg.Round = -1 }, "negative Round"}, { func(msg *NewValidBlockMessage) { msg.BlockPartSetHeader.Total = 2 }, @@ -792,7 +789,6 @@ func TestProposalPOLMessageValidateBasic(t *testing.T) { expErr string }{ {func(msg *ProposalPOLMessage) {}, ""}, - {func(msg *ProposalPOLMessage) { msg.Height = -1 }, "negative Height"}, {func(msg *ProposalPOLMessage) { msg.ProposalPOLRound = -1 }, "negative ProposalPOLRound"}, {func(msg *ProposalPOLMessage) { msg.ProposalPOL = bits.NewBitArray(0) }, "empty ProposalPOL bit array"}, {func(msg *ProposalPOLMessage) { msg.ProposalPOL = bits.NewBitArray(types.MaxVotesCount + 1) }, @@ -822,13 +818,12 @@ func TestBlockPartMessageValidateBasic(t *testing.T) { testPart.Proof.LeafHash = tmhash.Sum([]byte("leaf")) testCases := []struct { testName string - messageHeight int64 + messageHeight uint64 messageRound int32 messagePart *types.Part expectErr bool }{ {"Valid Message", 0, 0, testPart, false}, - {"Invalid Message", -1, 0, testPart, true}, {"Invalid Message", 0, -1, testPart, true}, } @@ -861,7 +856,7 @@ func TestHasVoteMessageValidateBasic(t *testing.T) { expectErr bool messageRound int32 messageIndex int32 - messageHeight int64 + messageHeight uint64 testName string messageType tmproto.SignedMsgType }{ @@ -869,7 +864,6 @@ func TestHasVoteMessageValidateBasic(t *testing.T) { {true, -1, 0, 0, "Invalid Message", validSignedMsgType}, {true, 0, -1, 0, "Invalid Message", validSignedMsgType}, {true, 0, 0, 0, "Invalid Message", invalidSignedMsgType}, - {true, 0, 0, -1, "Invalid Message", validSignedMsgType}, } for _, tc := range testCases { @@ -905,14 +899,13 @@ func TestVoteSetMaj23MessageValidateBasic(t *testing.T) { testCases := []struct { // nolint: maligned expectErr bool messageRound int32 - messageHeight int64 + messageHeight uint64 testName string messageType tmproto.SignedMsgType messageBlockID types.BlockID }{ {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}, } @@ -938,7 +931,6 @@ func TestVoteSetBitsMessageValidateBasic(t *testing.T) { expErr string }{ {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{ diff --git a/consensus/replay.go b/consensus/replay.go index 154cc27b4..9bbbfe906 100644 --- a/consensus/replay.go +++ b/consensus/replay.go @@ -171,7 +171,7 @@ LOOP: // Parses marker lines of the form: // #ENDHEIGHT: 12345 /* -func makeHeightSearchFunc(height int64) auto.SearchFunc { +func makeHeightSearchFunc(height uint64) auto.SearchFunc { return func(line string) (int, error) { line = strings.TrimRight(line, "\n") parts := strings.Split(line, " ") @@ -285,7 +285,7 @@ func (h *Handshaker) Handshake(proxyApp proxy.AppConns) error { func (h *Handshaker) ReplayBlocks( state sm.State, appHash []byte, - appBlockHeight int64, + appBlockHeight uint64, proxyApp proxy.AppConns, ) ([]byte, error) { storeBlockBase := h.store.Base() @@ -439,7 +439,7 @@ func (h *Handshaker) replayBlocks( state sm.State, proxyApp proxy.AppConns, appBlockHeight, - storeBlockHeight int64, + storeBlockHeight uint64, mutateState bool) ([]byte, error) { // App is further behind than it should be, so we need to replay blocks. // We replay all blocks from appBlockHeight+1. @@ -491,7 +491,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) { +func (h *Handshaker) replayBlock(state sm.State, height uint64, proxyApp proxy.AppConnConsensus) (sm.State, error) { block := h.store.LoadBlock(height) meta := h.store.LoadBlockMeta(height) diff --git a/consensus/replay_test.go b/consensus/replay_test.go index 90ee084ca..8c24febb2 100644 --- a/consensus/replay_test.go +++ b/consensus/replay_test.go @@ -65,7 +65,7 @@ func TestMain(m *testing.M) { // wal writer when we need to, instead of with every message. func startNewStateAndWaitForBlock(t *testing.T, consensusReplayConfig *cfg.Config, - lastBlockHeight int64, blockDB dbm.DB, stateStore sm.Store) { + lastBlockHeight uint64, blockDB dbm.DB, stateStore sm.Store) { logger := log.TestingLogger() state, _ := stateStore.LoadFromDBOrGenesisFile(consensusReplayConfig.GenesisFile()) privValidator := loadPrivValidator(consensusReplayConfig) @@ -124,7 +124,7 @@ func TestWALCrash(t *testing.T) { testCases := []struct { name string initFn func(dbm.DB, *State, context.Context) - heightToStop int64 + heightToStop uint64 }{ {"empty block", func(stateDB dbm.DB, cs *State, ctx context.Context) {}, @@ -146,7 +146,7 @@ func TestWALCrash(t *testing.T) { } func crashWALandCheckLiveness(t *testing.T, consensusReplayConfig *cfg.Config, - initFn func(dbm.DB, *State, context.Context), heightToStop int64) { + initFn func(dbm.DB, *State, context.Context), heightToStop uint64) { walPanicked := make(chan error) crashingWal := &crashingWAL{panicCh: walPanicked, heightToStop: heightToStop} @@ -222,7 +222,7 @@ LOOP: type crashingWAL struct { next WAL panicCh chan error - heightToStop int64 + heightToStop uint64 msgIndex int // current message index lastPanickedForMsgIndex int // last message for which we panicked @@ -242,7 +242,7 @@ func (e WALWriteError) Error() string { // ReachedHeightToStopError indicates we've reached the required consensus // height and may exit. type ReachedHeightToStopError struct { - height int64 + height uint64 } func (e ReachedHeightToStopError) Error() string { @@ -281,7 +281,7 @@ func (w *crashingWAL) WriteSync(m WALMessage) error { func (w *crashingWAL) FlushAndSync() error { return w.next.FlushAndSync() } func (w *crashingWAL) SearchForEndHeight( - height int64, + height uint64, options *WALSearchOptions) (rd io.ReadCloser, found bool, err error) { return w.next.SearchForEndHeight(height, options) } @@ -537,8 +537,8 @@ func TestSimulateValidatorsChange(t *testing.T) { sim.Chain = make([]*types.Block, 0) sim.Commits = make([]*types.Commit, 0) for i := 1; i <= numBlocks; i++ { - sim.Chain = append(sim.Chain, css[0].blockStore.LoadBlock(int64(i))) - sim.Commits = append(sim.Commits, css[0].blockStore.LoadBlockCommit(int64(i))) + sim.Chain = append(sim.Chain, css[0].blockStore.LoadBlock(uint64(i))) + sim.Commits = append(sim.Commits, css[0].blockStore.LoadBlockCommit(uint64(i))) } } @@ -958,7 +958,7 @@ func makeBlocks(n int, state *sm.State, privVal types.PrivValidator) []*types.Bl appHeight := byte(0x01) for i := 0; i < n; i++ { - height := int64(i + 1) + height := uint64(i + 1) block, parts := makeBlock(*state, prevBlock, prevBlockMeta, privVal, height) blocks = append(blocks, block) @@ -976,7 +976,7 @@ 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) { + privVal types.PrivValidator, height uint64) (*types.Block, *types.PartSet) { lastCommit := types.NewCommit(height-1, 0, types.BlockID{}, nil) if height > 1 { @@ -1020,7 +1020,7 @@ func (app *badApp) Commit() abci.ResponseCommit { // utils for making blocks func makeBlockchainFromWAL(wal WAL) ([]*types.Block, []*types.Commit, error) { - var height int64 + var height uint64 // Search for height marker gr, found, err := wal.SearchForEndHeight(height, &WALSearchOptions{}) @@ -1167,7 +1167,7 @@ type mockBlockStore struct { params types.ConsensusParams chain []*types.Block commits []*types.Commit - base int64 + base uint64 } // TODO: NewBlockStore(db.NewMemDB) ... @@ -1175,34 +1175,34 @@ func newMockBlockStore(config *cfg.Config, params types.ConsensusParams) *mockBl return &mockBlockStore{config, params, nil, nil, 0} } -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) Height() uint64 { return uint64(len(bs.chain)) } +func (bs *mockBlockStore) Base() uint64 { return bs.base } +func (bs *mockBlockStore) Size() uint64 { return bs.Height() - bs.Base() + 1 } +func (bs *mockBlockStore) LoadBaseMeta() *types.BlockMeta { return bs.LoadBlockMeta(bs.base) } +func (bs *mockBlockStore) LoadBlock(height uint64) *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 { +func (bs *mockBlockStore) LoadBlockMeta(height uint64) *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, } } -func (bs *mockBlockStore) LoadBlockPart(height int64, index int) *types.Part { return nil } +func (bs *mockBlockStore) LoadBlockPart(height uint64, index int) *types.Part { return nil } func (bs *mockBlockStore) SaveBlock(block *types.Block, blockParts *types.PartSet, seenCommit *types.Commit) { } -func (bs *mockBlockStore) LoadBlockCommit(height int64) *types.Commit { +func (bs *mockBlockStore) LoadBlockCommit(height uint64) *types.Commit { return bs.commits[height-1] } -func (bs *mockBlockStore) LoadSeenCommit(height int64) *types.Commit { +func (bs *mockBlockStore) LoadSeenCommit(height uint64) *types.Commit { return bs.commits[height-1] } -func (bs *mockBlockStore) PruneBlocks(height int64) (uint64, error) { +func (bs *mockBlockStore) PruneBlocks(height uint64) (uint64, error) { pruned := uint64(0) - for i := int64(0); i < height-1; i++ { + for i := uint64(0); i < height-1; i++ { bs.chain[i] = nil bs.commits[i] = nil pruned++ diff --git a/consensus/state.go b/consensus/state.go index 849af62d0..db754c2b9 100644 --- a/consensus/state.go +++ b/consensus/state.go @@ -234,7 +234,7 @@ func (cs *State) GetState() sm.State { // GetLastHeight returns the last height committed. // If there were no blocks, returns 0. -func (cs *State) GetLastHeight() int64 { +func (cs *State) GetLastHeight() uint64 { cs.mtx.RLock() defer cs.mtx.RUnlock() return cs.RoundState.Height - 1 @@ -507,7 +507,7 @@ func (cs *State) SetProposalAndBlock( //------------------------------------------------------------ // internal functions for managing the state -func (cs *State) updateHeight(height int64) { +func (cs *State) updateHeight(height uint64) { cs.metrics.Height.Set(float64(height)) cs.Height = height } @@ -1485,7 +1485,7 @@ func (cs *State) tryFinalizeCommit(height uint64) { } // Increment height and goto cstypes.RoundStepNewHeight -func (cs *State) finalizeCommit(height int64) { +func (cs *State) finalizeCommit(height uint64) { if cs.Height != height || cs.Step != cstypes.RoundStepCommit { cs.Logger.Debug(fmt.Sprintf( "finalizeCommit(%v): Invalid args. Current step: %v/%v/%v", @@ -1625,7 +1625,7 @@ func (cs *State) pruneBlocks(retainHeight uint64) (uint64, error) { return pruned, nil } -func (cs *State) recordMetrics(height int64, block *types.Block) { +func (cs *State) recordMetrics(height uint64, block *types.Block) { cs.metrics.Validators.Set(float64(cs.Validators.Size())) cs.metrics.ValidatorsPower.Set(float64(cs.Validators.TotalVotingPower())) @@ -2187,7 +2187,7 @@ func (cs *State) checkDoubleSigningRisk(height uint64) error { //--------------------------------------------------------- -func CompareHRS(h1 int64, r1 int32, s1 cstypes.RoundStepType, h2 int64, r2 int32, s2 cstypes.RoundStepType) int { +func CompareHRS(h1 uint64, r1 int32, s1 cstypes.RoundStepType, h2 uint64, r2 int32, s2 cstypes.RoundStepType) int { if h1 < h2 { return -1 } else if h1 > h2 { diff --git a/consensus/types/height_vote_set.go b/consensus/types/height_vote_set.go index a9d65a457..27b7a2215 100644 --- a/consensus/types/height_vote_set.go +++ b/consensus/types/height_vote_set.go @@ -40,7 +40,7 @@ One for their LastCommit round, and another for the official commit round. */ type HeightVoteSet struct { chainID string - height int64 + height uint64 valSet *types.ValidatorSet mtx sync.Mutex @@ -49,7 +49,7 @@ type HeightVoteSet struct { peerCatchupRounds map[p2p.NodeID][]int32 // keys: peer.ID; values: at most 2 rounds } -func NewHeightVoteSet(chainID string, height int64, valSet *types.ValidatorSet) *HeightVoteSet { +func NewHeightVoteSet(chainID string, height uint64, valSet *types.ValidatorSet) *HeightVoteSet { hvs := &HeightVoteSet{ chainID: chainID, } @@ -57,7 +57,7 @@ func NewHeightVoteSet(chainID string, height int64, valSet *types.ValidatorSet) return hvs } -func (hvs *HeightVoteSet) Reset(height int64, valSet *types.ValidatorSet) { +func (hvs *HeightVoteSet) Reset(height uint64, valSet *types.ValidatorSet) { hvs.mtx.Lock() defer hvs.mtx.Unlock() @@ -70,7 +70,7 @@ func (hvs *HeightVoteSet) Reset(height int64, valSet *types.ValidatorSet) { hvs.round = 0 } -func (hvs *HeightVoteSet) Height() int64 { +func (hvs *HeightVoteSet) Height() uint64 { hvs.mtx.Lock() defer hvs.mtx.Unlock() return hvs.height diff --git a/consensus/types/height_vote_set_test.go b/consensus/types/height_vote_set_test.go index 68c4d98c0..8951ad1b1 100644 --- a/consensus/types/height_vote_set_test.go +++ b/consensus/types/height_vote_set_test.go @@ -55,7 +55,7 @@ func TestPeerCatchupRounds(t *testing.T) { } -func makeVoteHR(t *testing.T, height int64, valIndex, round int32, privVals []types.PrivValidator) *types.Vote { +func makeVoteHR(t *testing.T, height uint64, valIndex, round int32, privVals []types.PrivValidator) *types.Vote { privVal := privVals[valIndex] pubKey, err := privVal.GetPubKey() if err != nil { diff --git a/consensus/types/peer_round_state.go b/consensus/types/peer_round_state.go index 07283c5b4..f4b3fad96 100644 --- a/consensus/types/peer_round_state.go +++ b/consensus/types/peer_round_state.go @@ -13,7 +13,7 @@ import ( // PeerRoundState contains the known state of a peer. // NOTE: Read-only when returned by PeerState.GetRoundState(). type PeerRoundState struct { - Height int64 `json:"height"` // Height peer is at + Height uint64 `json:"height"` // Height peer is at Round int32 `json:"round"` // Round peer is at, -1 if unknown. Step RoundStepType `json:"step"` // Step peer is at diff --git a/proto/tendermint/consensus/wal.pb.go b/proto/tendermint/consensus/wal.pb.go index fd80819cd..b41669606 100644 --- a/proto/tendermint/consensus/wal.pb.go +++ b/proto/tendermint/consensus/wal.pb.go @@ -85,7 +85,7 @@ func (m *MsgInfo) GetPeerID() string { // TimeoutInfo internally generated messages which may update the state type TimeoutInfo struct { Duration time.Duration `protobuf:"bytes,1,opt,name=duration,proto3,stdduration" json:"duration"` - Height int64 `protobuf:"varint,2,opt,name=height,proto3" json:"height,omitempty"` + Height uint64 `protobuf:"varint,2,opt,name=height,proto3" json:"height,omitempty"` Round int32 `protobuf:"varint,3,opt,name=round,proto3" json:"round,omitempty"` Step uint32 `protobuf:"varint,4,opt,name=step,proto3" json:"step,omitempty"` } @@ -130,7 +130,7 @@ func (m *TimeoutInfo) GetDuration() time.Duration { return 0 } -func (m *TimeoutInfo) GetHeight() int64 { +func (m *TimeoutInfo) GetHeight() uint64 { if m != nil { return m.Height } @@ -154,7 +154,7 @@ func (m *TimeoutInfo) GetStep() uint32 { // EndHeight marks the end of the given height inside WAL. // @internal used by scripts/wal2json util. type EndHeight struct { - Height int64 `protobuf:"varint,1,opt,name=height,proto3" json:"height,omitempty"` + Height uint64 `protobuf:"varint,1,opt,name=height,proto3" json:"height,omitempty"` } func (m *EndHeight) Reset() { *m = EndHeight{} } @@ -190,7 +190,7 @@ func (m *EndHeight) XXX_DiscardUnknown() { var xxx_messageInfo_EndHeight proto.InternalMessageInfo -func (m *EndHeight) GetHeight() int64 { +func (m *EndHeight) GetHeight() uint64 { if m != nil { return m.Height } @@ -372,41 +372,41 @@ func init() { func init() { proto.RegisterFile("tendermint/consensus/wal.proto", fileDescriptor_ed0b60c2d348ab09) } var fileDescriptor_ed0b60c2d348ab09 = []byte{ - // 539 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x53, 0xdd, 0x8a, 0xd3, 0x40, - 0x14, 0xce, 0x6c, 0xff, 0x4f, 0x15, 0x21, 0x96, 0xa5, 0x16, 0x36, 0x8d, 0x5d, 0x84, 0x5e, 0x25, - 0xb0, 0x22, 0x88, 0x5e, 0xa8, 0xa5, 0x2b, 0x2d, 0xb8, 0x20, 0xe3, 0x8a, 0x20, 0x42, 0x48, 0x37, - 0xa7, 0x69, 0x60, 0x33, 0x53, 0x32, 0x13, 0xc5, 0x2b, 0x5f, 0xa1, 0x97, 0xbe, 0x89, 0xaf, 0xb0, - 0x97, 0x7b, 0xe9, 0xd5, 0x2a, 0xed, 0x8b, 0x48, 0x66, 0xd2, 0x36, 0xb8, 0xd9, 0xbb, 0x39, 0x73, - 0xbe, 0x73, 0xbe, 0x73, 0xbe, 0x6f, 0x06, 0x2c, 0x89, 0x2c, 0xc0, 0x24, 0x8e, 0x98, 0x74, 0x2f, - 0x38, 0x13, 0xc8, 0x44, 0x2a, 0xdc, 0x6f, 0xfe, 0xa5, 0xb3, 0x4c, 0xb8, 0xe4, 0x66, 0x67, 0x9f, - 0x77, 0x76, 0xf9, 0x5e, 0x27, 0xe4, 0x21, 0x57, 0x00, 0x37, 0x3b, 0x69, 0x6c, 0xcf, 0x2e, 0xed, - 0x25, 0xbf, 0x2f, 0x51, 0xe4, 0x88, 0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, 0xf7, 0xc6, 0x32, 0x3e, 0xbf, 0x0c, 0x23, 0xb9, 0x48, 0x67, 0xce, 0x05, 0x8f, 0xdd, - 0xe2, 0xf7, 0xda, 0x1f, 0xf5, 0x47, 0x2d, 0xfb, 0x9c, 0xb3, 0xba, 0xca, 0x3d, 0xfd, 0x17, 0x00, - 0x00, 0xff, 0xff, 0x0b, 0xad, 0x1c, 0x1b, 0x07, 0x04, 0x00, 0x00, + // 542 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x53, 0xdf, 0x8a, 0xd3, 0x4e, + 0x14, 0xce, 0x6c, 0xb3, 0xfd, 0x73, 0xfa, 0xfb, 0x21, 0xc4, 0xb2, 0xd4, 0xc2, 0xa6, 0xb1, 0x8b, + 0xd0, 0xab, 0x04, 0x56, 0x04, 0xd1, 0x0b, 0xb5, 0x74, 0xa5, 0x05, 0x17, 0x64, 0x5c, 0x11, 0x44, + 0x08, 0xe9, 0xe6, 0x34, 0x0d, 0x6c, 0x66, 0x4a, 0x66, 0xa2, 0x78, 0xe5, 0x2b, 0xf4, 0xd2, 0x37, + 0xf1, 0x15, 0xf6, 0x72, 0x2f, 0xbd, 0x5a, 0xa5, 0x7d, 0x11, 0xc9, 0x4c, 0xda, 0x06, 0x37, 0xde, + 0xcd, 0x99, 0xf3, 0x9d, 0xf3, 0x9d, 0xf3, 0x7d, 0x33, 0x60, 0x4b, 0x64, 0x21, 0xa6, 0x49, 0xcc, + 0xa4, 0x77, 0xc9, 0x99, 0x40, 0x26, 0x32, 0xe1, 0x7d, 0x09, 0xae, 0xdc, 0x65, 0xca, 0x25, 0xb7, + 0x3a, 0xfb, 0xbc, 0xbb, 0xcb, 0xf7, 0x3a, 0x11, 0x8f, 0xb8, 0x02, 0x78, 0xf9, 0x49, 0x63, 0x7b, + 0x4e, 0x65, 0x2f, 0xf9, 0x75, 0x89, 0xa2, 0x40, 0x1c, 0x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cb, 0xf6, 0xed, 0x48, 0xb9, 0xdd, 0xe0, 0xc7, 0x01, 0xc0, 0x87, 0x57, 0x6f, 0x8a, 0xb5, 0xad, + 0x4f, 0x70, 0xa4, 0xe4, 0xf7, 0xc3, 0x40, 0x06, 0xbe, 0xea, 0xed, 0x0b, 0x19, 0x48, 0x2c, 0x96, + 0x78, 0x54, 0x56, 0x4d, 0xdb, 0x78, 0x96, 0xe3, 0xc7, 0x81, 0x0c, 0x68, 0x8e, 0x7e, 0x97, 0x83, + 0x27, 0x06, 0xbd, 0x8f, 0x77, 0xaf, 0xad, 0x67, 0xd0, 0x4c, 0x44, 0xe4, 0xc7, 0x6c, 0xce, 0xd5, + 0x56, 0xff, 0x76, 0x41, 0x3b, 0x36, 0x31, 0x68, 0x23, 0x29, 0xcc, 0x7b, 0x0d, 0xff, 0x49, 0xad, + 0xaf, 0xae, 0xaf, 0xa9, 0xfa, 0x87, 0xd5, 0xf5, 0x25, 0x27, 0x26, 0x06, 0x6d, 0xcb, 0x92, 0x31, + 0x2f, 0x01, 0x90, 0x85, 0x7e, 0x21, 0x86, 0xa9, 0xba, 0xf4, 0xab, 0xbb, 0xec, 0xd4, 0x9b, 0x18, + 0xb4, 0x85, 0xdb, 0x60, 0x74, 0x08, 0x35, 0x91, 0x25, 0x83, 0x6f, 0x70, 0x2f, 0xa7, 0x09, 0x4b, + 0xea, 0x3d, 0x05, 0x33, 0xa7, 0x2a, 0xb4, 0xea, 0xdd, 0x31, 0xfc, 0x62, 0xfb, 0x36, 0xb5, 0xe3, + 0xab, 0xdc, 0x71, 0x55, 0x61, 0x9d, 0xea, 0xa7, 0xa9, 0x45, 0x71, 0xaa, 0xc7, 0xd9, 0x13, 0xa9, + 0x77, 0x39, 0x7a, 0x7f, 0xbd, 0xb6, 0xc9, 0xcd, 0xda, 0x26, 0xbf, 0xd7, 0x36, 0x59, 0x6d, 0x6c, + 0xe3, 0x66, 0x63, 0x1b, 0x3f, 0x37, 0xb6, 0xf1, 0xf1, 0x79, 0x14, 0xcb, 0x45, 0x36, 0x73, 0x2f, + 0x79, 0xe2, 0x95, 0xbf, 0xd7, 0xfe, 0xa8, 0x3f, 0x6a, 0xd5, 0xe7, 0x9c, 0xd5, 0x55, 0xee, 0xf1, + 0x9f, 0x00, 0x00, 0x00, 0xff, 0xff, 0xb6, 0x58, 0x0a, 0xd9, 0x07, 0x04, 0x00, 0x00, } func (m *MsgInfo) Marshal() (dAtA []byte, err error) { @@ -1012,7 +1012,7 @@ func (m *TimeoutInfo) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Height |= int64(b&0x7F) << shift + m.Height |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -1119,7 +1119,7 @@ func (m *EndHeight) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Height |= int64(b&0x7F) << shift + m.Height |= uint64(b&0x7F) << shift if b < 0x80 { break } diff --git a/proto/tendermint/consensus/wal.proto b/proto/tendermint/consensus/wal.proto index 44afa2c0c..adc012bd8 100644 --- a/proto/tendermint/consensus/wal.proto +++ b/proto/tendermint/consensus/wal.proto @@ -19,7 +19,7 @@ message MsgInfo { message TimeoutInfo { google.protobuf.Duration duration = 1 [(gogoproto.nullable) = false, (gogoproto.stdduration) = true]; - int64 height = 2; + uint64 height = 2; int32 round = 3; uint32 step = 4; } @@ -27,7 +27,7 @@ message TimeoutInfo { // EndHeight marks the end of the given height inside WAL. // @internal used by scripts/wal2json util. message EndHeight { - int64 height = 1; + uint64 height = 1; } message WALMessage {