From b3492356e64600aec2615604d66cba5029384d0c Mon Sep 17 00:00:00 2001 From: Anton Kaliaev Date: Thu, 30 Nov 2017 13:08:38 -0600 Subject: [PATCH] uint64 height (Refs #911) --- blockchain/pool.go | 43 +++++++++++--------- blockchain/pool_test.go | 10 ++--- blockchain/reactor.go | 8 ++-- blockchain/reactor_test.go | 16 ++++---- blockchain/store.go | 28 ++++++------- consensus/byzantine_test.go | 10 ++--- consensus/common_test.go | 6 +-- consensus/reactor.go | 28 ++++++------- consensus/replay.go | 16 ++++---- consensus/replay_test.go | 14 +++---- consensus/state.go | 50 ++++++++++++------------ consensus/test_data/many_blocks.cswal | Bin 14982 -> 16661 bytes consensus/types/height_vote_set.go | 8 ++-- consensus/types/height_vote_set_test.go | 2 +- consensus/types/reactor.go | 2 +- consensus/types/state.go | 2 +- lite/client/provider.go | 6 +-- lite/commit.go | 2 +- lite/dynamic.go | 6 +-- lite/dynamic_test.go | 6 +-- lite/errors/errors.go | 4 +- lite/files/commit_test.go | 2 +- lite/files/provider.go | 6 +-- lite/files/provider_test.go | 4 +- lite/helpers.go | 6 +-- lite/inquirer.go | 6 +-- lite/inquirer_test.go | 6 +-- lite/memprovider.go | 2 +- lite/performance_test.go | 2 +- lite/provider.go | 4 +- lite/provider_test.go | 10 ++--- lite/static_test.go | 2 +- mempool/mempool.go | 20 +++++----- mempool/mempool_test.go | 4 +- mempool/reactor.go | 2 +- rpc/client/event_test.go | 4 +- rpc/client/helpers.go | 4 +- rpc/client/helpers_test.go | 4 +- rpc/client/httpclient.go | 8 ++-- rpc/client/interface.go | 8 ++-- rpc/client/localclient.go | 8 ++-- rpc/client/mock/client.go | 8 ++-- rpc/core/blocks.go | 12 +++--- rpc/core/consensus.go | 2 +- rpc/core/pipe.go | 2 +- rpc/core/tx.go | 2 +- rpc/core/types/responses.go | 6 +-- state/errors.go | 12 +++--- state/execution.go | 21 ++++++++++ state/execution_test.go | 8 ++-- state/state.go | 16 ++++---- state/state_test.go | 10 ++--- types/block.go | 8 ++-- types/canonical_json.go | 6 +-- types/events.go | 2 +- types/heartbeat.go | 2 +- types/priv_validator.go | 4 +- types/priv_validator_test.go | 10 ++--- types/proposal.go | 4 +- types/services.go | 20 +++++----- types/validator_set.go | 4 +- types/vote.go | 2 +- types/vote_set.go | 8 ++-- types/vote_set_test.go | 18 ++++----- 64 files changed, 296 insertions(+), 270 deletions(-) diff --git a/blockchain/pool.go b/blockchain/pool.go index 933089cf..8b932531 100644 --- a/blockchain/pool.go +++ b/blockchain/pool.go @@ -52,22 +52,22 @@ type BlockPool struct { mtx sync.Mutex // block requests - requesters map[int]*bpRequester - height int // the lowest key in requesters. - numPending int32 // number of requests pending assignment or block response + requesters map[uint64]*bpRequester + height uint64 // the lowest key in requesters. + numPending int32 // number of requests pending assignment or block response // peers peers map[string]*bpPeer - maxPeerHeight int + maxPeerHeight uint64 requestsCh chan<- BlockRequest timeoutsCh chan<- string } -func NewBlockPool(start int, requestsCh chan<- BlockRequest, timeoutsCh chan<- string) *BlockPool { +func NewBlockPool(start uint64, requestsCh chan<- BlockRequest, timeoutsCh chan<- string) *BlockPool { bp := &BlockPool{ peers: make(map[string]*bpPeer), - requesters: make(map[int]*bpRequester), + requesters: make(map[uint64]*bpRequester), height: start, numPending: 0, @@ -132,7 +132,7 @@ func (pool *BlockPool) removeTimedoutPeers() { } } -func (pool *BlockPool) GetStatus() (height int, numPending int32, lenRequesters int) { +func (pool *BlockPool) GetStatus() (height uint64, numPending int32, lenRequesters int) { pool.mtx.Lock() defer pool.mtx.Unlock() @@ -195,7 +195,7 @@ func (pool *BlockPool) PopRequest() { // Invalidates the block at pool.height, // Remove the peer and redo request from others. -func (pool *BlockPool) RedoRequest(height int) { +func (pool *BlockPool) RedoRequest(height uint64) { pool.mtx.Lock() defer pool.mtx.Unlock() @@ -233,14 +233,14 @@ func (pool *BlockPool) AddBlock(peerID string, block *types.Block, blockSize int } // MaxPeerHeight returns the highest height reported by a peer. -func (pool *BlockPool) MaxPeerHeight() int { +func (pool *BlockPool) MaxPeerHeight() uint64 { pool.mtx.Lock() defer pool.mtx.Unlock() return pool.maxPeerHeight } // Sets the peer's alleged blockchain height. -func (pool *BlockPool) SetPeerHeight(peerID string, height int) { +func (pool *BlockPool) SetPeerHeight(peerID string, height uint64) { pool.mtx.Lock() defer pool.mtx.Unlock() @@ -279,7 +279,7 @@ func (pool *BlockPool) removePeer(peerID string) { // Pick an available peer with at least the given minHeight. // If no peers are available, returns nil. -func (pool *BlockPool) pickIncrAvailablePeer(minHeight int) *bpPeer { +func (pool *BlockPool) pickIncrAvailablePeer(minHeight uint64) *bpPeer { pool.mtx.Lock() defer pool.mtx.Unlock() @@ -304,7 +304,7 @@ func (pool *BlockPool) makeNextRequester() { pool.mtx.Lock() defer pool.mtx.Unlock() - nextHeight := pool.height + len(pool.requesters) + nextHeight := pool.height + pool.requestersLen() request := newBPRequester(pool, nextHeight) // request.SetLogger(pool.Logger.With("height", nextHeight)) @@ -317,7 +317,11 @@ func (pool *BlockPool) makeNextRequester() { } } -func (pool *BlockPool) sendRequest(height int, peerID string) { +func (pool *BlockPool) requestersLen() uint64 { + return uint64(len(pool.requesters)) +} + +func (pool *BlockPool) sendRequest(height uint64, peerID string) { if !pool.IsRunning() { return } @@ -337,7 +341,8 @@ func (pool *BlockPool) debug() string { defer pool.mtx.Unlock() str := "" - for h := pool.height; h < pool.height+len(pool.requesters); h++ { + nextHeight := pool.height + pool.requestersLen() + for h := pool.height; h < nextHeight; h++ { if pool.requesters[h] == nil { str += cmn.Fmt("H(%v):X ", h) } else { @@ -355,7 +360,7 @@ type bpPeer struct { id string recvMonitor *flow.Monitor - height int + height uint64 numPending int32 timeout *time.Timer didTimeout bool @@ -363,7 +368,7 @@ type bpPeer struct { logger log.Logger } -func newBPPeer(pool *BlockPool, peerID string, height int) *bpPeer { +func newBPPeer(pool *BlockPool, peerID string, height uint64) *bpPeer { peer := &bpPeer{ pool: pool, id: peerID, @@ -424,7 +429,7 @@ func (peer *bpPeer) onTimeout() { type bpRequester struct { cmn.BaseService pool *BlockPool - height int + height uint64 gotBlockCh chan struct{} redoCh chan struct{} @@ -433,7 +438,7 @@ type bpRequester struct { block *types.Block } -func newBPRequester(pool *BlockPool, height int) *bpRequester { +func newBPRequester(pool *BlockPool, height uint64) *bpRequester { bpr := &bpRequester{ pool: pool, height: height, @@ -545,6 +550,6 @@ OUTER_LOOP: //------------------------------------- type BlockRequest struct { - Height int + Height uint64 PeerID string } diff --git a/blockchain/pool_test.go b/blockchain/pool_test.go index 42454307..6f9a43b1 100644 --- a/blockchain/pool_test.go +++ b/blockchain/pool_test.go @@ -16,21 +16,21 @@ func init() { type testPeer struct { id string - height int + height uint64 } -func makePeers(numPeers int, minHeight, maxHeight int) map[string]testPeer { +func makePeers(numPeers int, minHeight, maxHeight uint64) map[string]testPeer { peers := make(map[string]testPeer, numPeers) for i := 0; i < numPeers; i++ { peerID := cmn.RandStr(12) - height := minHeight + rand.Intn(maxHeight-minHeight) + height := minHeight + uint64(rand.Intn(int(maxHeight-minHeight))) peers[peerID] = testPeer{peerID, height} } return peers } func TestBasic(t *testing.T) { - start := 42 + start := uint64(42) peers := makePeers(10, start+1, 1000) timeoutsCh := make(chan string, 100) requestsCh := make(chan BlockRequest, 100) @@ -87,7 +87,7 @@ func TestBasic(t *testing.T) { } func TestTimeout(t *testing.T) { - start := 42 + start := uint64(42) peers := makePeers(10, start+1, 1000) timeoutsCh := make(chan string, 100) requestsCh := make(chan BlockRequest, 100) diff --git a/blockchain/reactor.go b/blockchain/reactor.go index 2646f6d8..828ec73e 100644 --- a/blockchain/reactor.go +++ b/blockchain/reactor.go @@ -347,7 +347,7 @@ func DecodeMessage(bz []byte, maxSize int) (msgType byte, msg BlockchainMessage, //------------------------------------- type bcBlockRequestMessage struct { - Height int + Height uint64 } func (m *bcBlockRequestMessage) String() string { @@ -355,7 +355,7 @@ func (m *bcBlockRequestMessage) String() string { } type bcNoBlockResponseMessage struct { - Height int + Height uint64 } func (brm *bcNoBlockResponseMessage) String() string { @@ -376,7 +376,7 @@ func (m *bcBlockResponseMessage) String() string { //------------------------------------- type bcStatusRequestMessage struct { - Height int + Height uint64 } func (m *bcStatusRequestMessage) String() string { @@ -386,7 +386,7 @@ func (m *bcStatusRequestMessage) String() string { //------------------------------------- type bcStatusResponseMessage struct { - Height int + Height uint64 } func (m *bcStatusResponseMessage) String() string { diff --git a/blockchain/reactor_test.go b/blockchain/reactor_test.go index 584aadf3..d4ada4f7 100644 --- a/blockchain/reactor_test.go +++ b/blockchain/reactor_test.go @@ -14,7 +14,7 @@ import ( "github.com/tendermint/tendermint/types" ) -func newBlockchainReactor(maxBlockHeight int) *BlockchainReactor { +func newBlockchainReactor(maxBlockHeight uint64) *BlockchainReactor { logger := log.TestingLogger() config := cfg.ResetTestRoot("blockchain_reactor_test") @@ -34,7 +34,7 @@ func newBlockchainReactor(maxBlockHeight int) *BlockchainReactor { bcReactor.Switch = p2p.NewSwitch(cfg.DefaultP2PConfig()) // Lastly: let's add some blocks in - for blockHeight := 1; blockHeight <= maxBlockHeight; blockHeight++ { + for blockHeight := uint64(1); blockHeight <= maxBlockHeight; blockHeight++ { firstBlock := makeBlock(blockHeight, state) secondBlock := makeBlock(blockHeight+1, state) firstParts := firstBlock.MakePartSet(state.Params.BlockGossipParams.BlockPartSizeBytes) @@ -45,7 +45,7 @@ func newBlockchainReactor(maxBlockHeight int) *BlockchainReactor { } func TestNoBlockMessageResponse(t *testing.T) { - maxBlockHeight := 20 + maxBlockHeight := uint64(20) bcr := newBlockchainReactor(maxBlockHeight) bcr.Start() @@ -58,7 +58,7 @@ func TestNoBlockMessageResponse(t *testing.T) { chID := byte(0x01) tests := []struct { - height int + height uint64 existent bool }{ {maxBlockHeight + 2, false}, @@ -93,19 +93,19 @@ func TestNoBlockMessageResponse(t *testing.T) { //---------------------------------------------- // utility funcs -func makeTxs(blockNumber int) (txs []types.Tx) { +func makeTxs(height uint64) (txs []types.Tx) { for i := 0; i < 10; i++ { - txs = append(txs, types.Tx([]byte{byte(blockNumber), byte(i)})) + txs = append(txs, types.Tx([]byte{byte(height), byte(i)})) } return txs } -func makeBlock(blockNumber int, state *sm.State) *types.Block { +func makeBlock(height uint64, state *sm.State) *types.Block { prevHash := state.LastBlockID.Hash prevParts := types.PartSetHeader{} valHash := state.Validators.Hash() prevBlockID := types.BlockID{prevHash, prevParts} - block, _ := types.MakeBlock(blockNumber, "test_chain", makeTxs(blockNumber), + block, _ := types.MakeBlock(height, "test_chain", makeTxs(height), new(types.Commit), prevBlockID, valHash, state.AppHash, state.Params.BlockGossipParams.BlockPartSizeBytes) return block } diff --git a/blockchain/store.go b/blockchain/store.go index bcd10856..8ab16748 100644 --- a/blockchain/store.go +++ b/blockchain/store.go @@ -7,7 +7,7 @@ import ( "io" "sync" - "github.com/tendermint/go-wire" + wire "github.com/tendermint/go-wire" "github.com/tendermint/tendermint/types" cmn "github.com/tendermint/tmlibs/common" dbm "github.com/tendermint/tmlibs/db" @@ -32,7 +32,7 @@ type BlockStore struct { db dbm.DB mtx sync.RWMutex - height int + height uint64 } func NewBlockStore(db dbm.DB) *BlockStore { @@ -44,7 +44,7 @@ func NewBlockStore(db dbm.DB) *BlockStore { } // Height() returns the last known contiguous block height. -func (bs *BlockStore) Height() int { +func (bs *BlockStore) Height() uint64 { bs.mtx.RLock() defer bs.mtx.RUnlock() return bs.height @@ -58,7 +58,7 @@ func (bs *BlockStore) GetReader(key []byte) io.Reader { return bytes.NewReader(bytez) } -func (bs *BlockStore) LoadBlock(height int) *types.Block { +func (bs *BlockStore) LoadBlock(height uint64) *types.Block { var n int var err error r := bs.GetReader(calcBlockMetaKey(height)) @@ -81,7 +81,7 @@ func (bs *BlockStore) LoadBlock(height int) *types.Block { return block } -func (bs *BlockStore) LoadBlockPart(height int, index int) *types.Part { +func (bs *BlockStore) LoadBlockPart(height uint64, index int) *types.Part { var n int var err error r := bs.GetReader(calcBlockPartKey(height, index)) @@ -95,7 +95,7 @@ func (bs *BlockStore) LoadBlockPart(height int, index int) *types.Part { return part } -func (bs *BlockStore) LoadBlockMeta(height int) *types.BlockMeta { +func (bs *BlockStore) LoadBlockMeta(height uint64) *types.BlockMeta { var n int var err error r := bs.GetReader(calcBlockMetaKey(height)) @@ -111,7 +111,7 @@ func (bs *BlockStore) LoadBlockMeta(height int) *types.BlockMeta { // The +2/3 and other Precommit-votes for block at `height`. // This Commit comes from block.LastCommit for `height+1`. -func (bs *BlockStore) LoadBlockCommit(height int) *types.Commit { +func (bs *BlockStore) LoadBlockCommit(height uint64) *types.Commit { var n int var err error r := bs.GetReader(calcBlockCommitKey(height)) @@ -126,7 +126,7 @@ func (bs *BlockStore) LoadBlockCommit(height int) *types.Commit { } // NOTE: the Precommit-vote heights are for the block at `height` -func (bs *BlockStore) LoadSeenCommit(height int) *types.Commit { +func (bs *BlockStore) LoadSeenCommit(height uint64) *types.Commit { var n int var err error r := bs.GetReader(calcSeenCommitKey(height)) @@ -185,7 +185,7 @@ func (bs *BlockStore) SaveBlock(block *types.Block, blockParts *types.PartSet, s bs.db.SetSync(nil, nil) } -func (bs *BlockStore) saveBlockPart(height int, index int, part *types.Part) { +func (bs *BlockStore) saveBlockPart(height uint64, index int, part *types.Part) { if height != bs.Height()+1 { cmn.PanicSanity(cmn.Fmt("BlockStore can only save contiguous blocks. Wanted %v, got %v", bs.Height()+1, height)) } @@ -195,19 +195,19 @@ func (bs *BlockStore) saveBlockPart(height int, index int, part *types.Part) { //----------------------------------------------------------------------------- -func calcBlockMetaKey(height int) []byte { +func calcBlockMetaKey(height uint64) []byte { return []byte(fmt.Sprintf("H:%v", height)) } -func calcBlockPartKey(height int, partIndex int) []byte { +func calcBlockPartKey(height uint64, partIndex int) []byte { return []byte(fmt.Sprintf("P:%v:%v", height, partIndex)) } -func calcBlockCommitKey(height int) []byte { +func calcBlockCommitKey(height uint64) []byte { return []byte(fmt.Sprintf("C:%v", height)) } -func calcSeenCommitKey(height int) []byte { +func calcSeenCommitKey(height uint64) []byte { return []byte(fmt.Sprintf("SC:%v", height)) } @@ -216,7 +216,7 @@ func calcSeenCommitKey(height int) []byte { var blockStoreKey = []byte("blockStore") type BlockStoreStateJSON struct { - Height int + Height uint64 } func (bsj BlockStoreStateJSON) Save(db dbm.DB) { diff --git a/consensus/byzantine_test.go b/consensus/byzantine_test.go index 5d0d3b55..6f73fd56 100644 --- a/consensus/byzantine_test.go +++ b/consensus/byzantine_test.go @@ -48,12 +48,12 @@ func TestByzantine(t *testing.T) { if i == 0 { css[i].privValidator = NewByzantinePrivValidator(css[i].privValidator) // make byzantine - css[i].decideProposal = func(j int) func(int, int) { - return func(height, round int) { + css[i].decideProposal = func(j int) func(uint64, int) { + return func(height uint64, round int) { byzantineDecideProposalFunc(t, height, round, css[j], switches[j]) } }(i) - css[i].doPrevote = func(height, round int) {} + css[i].doPrevote = func(height uint64, round int) {} } eventBus := types.NewEventBus() @@ -162,7 +162,7 @@ func TestByzantine(t *testing.T) { //------------------------------- // byzantine consensus functions -func byzantineDecideProposalFunc(t *testing.T, height, round int, cs *ConsensusState, sw *p2p.Switch) { +func byzantineDecideProposalFunc(t *testing.T, height uint64, round int, cs *ConsensusState, sw *p2p.Switch) { // byzantine user should create two proposals and try to split the vote. // Avoid sending on internalMsgQueue and running consensus state. @@ -197,7 +197,7 @@ func byzantineDecideProposalFunc(t *testing.T, height, round int, cs *ConsensusS } } -func sendProposalAndParts(height, round int, cs *ConsensusState, peer p2p.Peer, proposal *types.Proposal, blockHash []byte, parts *types.PartSet) { +func sendProposalAndParts(height uint64, round int, cs *ConsensusState, peer p2p.Peer, proposal *types.Proposal, blockHash []byte, parts *types.PartSet) { // proposal msg := &ProposalMessage{Proposal: proposal} peer.Send(DataChannel, struct{ ConsensusMessage }{msg}) diff --git a/consensus/common_test.go b/consensus/common_test.go index 8d2fafbb..67a72075 100644 --- a/consensus/common_test.go +++ b/consensus/common_test.go @@ -54,7 +54,7 @@ func ResetConfig(name string) *cfg.Config { type validatorStub struct { Index int // Validator index. NOTE: we don't assume validator set changes. - Height int + Height uint64 Round int types.PrivValidator } @@ -113,13 +113,13 @@ func incrementRound(vss ...*validatorStub) { //------------------------------------------------------------------------------- // Functions for transitioning the consensus state -func startTestRound(cs *ConsensusState, height, round int) { +func startTestRound(cs *ConsensusState, height uint64, round int) { cs.enterNewRound(height, round) cs.startRoutines(0) } // Create proposal block from cs1 but sign it with vs -func decideProposal(cs1 *ConsensusState, vs *validatorStub, height, round int) (proposal *types.Proposal, block *types.Block) { +func decideProposal(cs1 *ConsensusState, vs *validatorStub, height uint64, round int) (proposal *types.Proposal, block *types.Block) { block, blockParts := cs1.createProposalBlock() if block == nil { // on error panic("error creating proposal block") diff --git a/consensus/reactor.go b/consensus/reactor.go index 38cf8b94..3502f573 100644 --- a/consensus/reactor.go +++ b/consensus/reactor.go @@ -861,7 +861,7 @@ func (ps *PeerState) GetRoundState() *cstypes.PeerRoundState { // 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() int { +func (ps *PeerState) GetHeight() uint64 { ps.mtx.Lock() defer ps.mtx.Unlock() return ps.PeerRoundState.Height @@ -900,7 +900,7 @@ func (ps *PeerState) InitProposalBlockParts(partsHeader types.PartSetHeader) { } // SetHasProposalBlockPart sets the given block part index as known for the peer. -func (ps *PeerState) SetHasProposalBlockPart(height int, round int, index int) { +func (ps *PeerState) SetHasProposalBlockPart(height uint64, round int, index int) { ps.mtx.Lock() defer ps.mtx.Unlock() @@ -951,7 +951,7 @@ func (ps *PeerState) PickVoteToSend(votes types.VoteSetReader) (vote *types.Vote return nil, false } -func (ps *PeerState) getVoteBitArray(height, round int, type_ byte) *cmn.BitArray { +func (ps *PeerState) getVoteBitArray(height uint64, round int, type_ byte) *cmn.BitArray { if !types.IsVoteTypeValid(type_) { return nil } @@ -998,7 +998,7 @@ func (ps *PeerState) getVoteBitArray(height, round int, type_ byte) *cmn.BitArra } // 'round': A round for which we have a +2/3 commit. -func (ps *PeerState) ensureCatchupCommitRound(height, round int, numValidators int) { +func (ps *PeerState) ensureCatchupCommitRound(height uint64, round int, numValidators int) { if ps.Height != height { return } @@ -1024,13 +1024,13 @@ func (ps *PeerState) ensureCatchupCommitRound(height, round int, numValidators i // 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 int, 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 int, numValidators int) { +func (ps *PeerState) ensureVoteBitArrays(height uint64, numValidators int) { if ps.Height == height { if ps.Prevotes == nil { ps.Prevotes = cmn.NewBitArray(numValidators) @@ -1059,7 +1059,7 @@ func (ps *PeerState) SetHasVote(vote *types.Vote) { ps.setHasVote(vote.Height, vote.Round, vote.Type, vote.ValidatorIndex) } -func (ps *PeerState) setHasVote(height int, round int, type_ byte, index int) { +func (ps *PeerState) setHasVote(height uint64, round int, type_ byte, index int) { logger := ps.logger.With("peerH/R", cmn.Fmt("%d/%d", ps.Height, ps.Round), "H/R", cmn.Fmt("%d/%d", height, round)) logger.Debug("setHasVote", "type", type_, "index", index) @@ -1253,7 +1253,7 @@ func DecodeMessage(bz []byte) (msgType byte, msg ConsensusMessage, err error) { // NewRoundStepMessage is sent for every step taken in the ConsensusState. // For every height/round/step transition type NewRoundStepMessage struct { - Height int + Height uint64 Round int Step cstypes.RoundStepType SecondsSinceStartTime int @@ -1270,7 +1270,7 @@ func (m *NewRoundStepMessage) String() string { // CommitStepMessage is sent when a block is committed. type CommitStepMessage struct { - Height int + Height uint64 BlockPartsHeader types.PartSetHeader BlockParts *cmn.BitArray } @@ -1296,7 +1296,7 @@ func (m *ProposalMessage) String() string { // ProposalPOLMessage is sent when a previous proposal is re-proposed. type ProposalPOLMessage struct { - Height int + Height uint64 ProposalPOLRound int ProposalPOL *cmn.BitArray } @@ -1310,7 +1310,7 @@ func (m *ProposalPOLMessage) String() string { // BlockPartMessage is sent when gossipping a piece of the proposed block. type BlockPartMessage struct { - Height int + Height uint64 Round int Part *types.Part } @@ -1336,7 +1336,7 @@ func (m *VoteMessage) String() string { // HasVoteMessage is sent to indicate that a particular vote has been received. type HasVoteMessage struct { - Height int + Height uint64 Round int Type byte Index int @@ -1351,7 +1351,7 @@ func (m *HasVoteMessage) String() string { // VoteSetMaj23Message is sent to indicate that a given BlockID has seen +2/3 votes. type VoteSetMaj23Message struct { - Height int + Height uint64 Round int Type byte BlockID types.BlockID @@ -1366,7 +1366,7 @@ func (m *VoteSetMaj23Message) String() string { // VoteSetBitsMessage is sent to communicate the bit-array of votes seen for the BlockID. type VoteSetBitsMessage struct { - Height int + Height uint64 Round int Type byte BlockID types.BlockID diff --git a/consensus/replay.go b/consensus/replay.go index da68df51..8f7f99f1 100644 --- a/consensus/replay.go +++ b/consensus/replay.go @@ -90,7 +90,7 @@ func (cs *ConsensusState) readReplayMessage(msg *TimedWALMessage, newStepCh chan // replay only those messages since the last block. // timeoutRoutine should run concurrently to read off tickChan -func (cs *ConsensusState) catchupReplay(csHeight int) error { +func (cs *ConsensusState) catchupReplay(csHeight uint64) error { // set replayMode cs.replayMode = true defer func() { cs.replayMode = false }() @@ -98,7 +98,7 @@ func (cs *ConsensusState) catchupReplay(csHeight int) error { // Ensure that ENDHEIGHT for this height doesn't exist // NOTE: This is just a sanity check. As far as we know things work fine without it, // and Handshake could reuse ConsensusState if it weren't for this check (since we can crash after writing ENDHEIGHT). - gr, found, err := cs.wal.SearchForEndHeight(uint64(csHeight)) + gr, found, err := cs.wal.SearchForEndHeight(csHeight) if err != nil { return err } @@ -112,7 +112,7 @@ func (cs *ConsensusState) catchupReplay(csHeight int) error { } // Search for last height marker - gr, found, err = cs.wal.SearchForEndHeight(uint64(csHeight - 1)) + gr, found, err = cs.wal.SearchForEndHeight(csHeight - 1) if err == io.EOF { cs.Logger.Error("Replay: wal.group.Search returned EOF", "#ENDHEIGHT", csHeight-1) } else if err != nil { @@ -151,7 +151,7 @@ func (cs *ConsensusState) catchupReplay(csHeight int) error { // Parses marker lines of the form: // #ENDHEIGHT: 12345 /* -func makeHeightSearchFunc(height int) auto.SearchFunc { +func makeHeightSearchFunc(height uint64) auto.SearchFunc { return func(line string) (int, error) { line = strings.TrimRight(line, "\n") parts := strings.Split(line, " ") @@ -205,7 +205,7 @@ func (h *Handshaker) Handshake(proxyApp proxy.AppConns) error { return errors.New(cmn.Fmt("Error calling Info: %v", err)) } - blockHeight := int(res.LastBlockHeight) // XXX: beware overflow + blockHeight := res.LastBlockHeight appHash := res.LastBlockAppHash h.logger.Info("ABCI Handshake", "appHeight", blockHeight, "appHash", fmt.Sprintf("%X", appHash)) @@ -227,7 +227,7 @@ func (h *Handshaker) Handshake(proxyApp proxy.AppConns) error { // Replay all blocks since appBlockHeight and ensure the result matches the current state. // Returns the final AppHash or an error -func (h *Handshaker) ReplayBlocks(appHash []byte, appBlockHeight int, proxyApp proxy.AppConns) ([]byte, error) { +func (h *Handshaker) ReplayBlocks(appHash []byte, appBlockHeight uint64, proxyApp proxy.AppConns) ([]byte, error) { storeBlockHeight := h.store.Height() stateBlockHeight := h.state.LastBlockHeight @@ -302,7 +302,7 @@ func (h *Handshaker) ReplayBlocks(appHash []byte, appBlockHeight int, proxyApp p return nil, nil } -func (h *Handshaker) replayBlocks(proxyApp proxy.AppConns, appBlockHeight, storeBlockHeight int, mutateState bool) ([]byte, error) { +func (h *Handshaker) replayBlocks(proxyApp proxy.AppConns, appBlockHeight, 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. // @@ -338,7 +338,7 @@ func (h *Handshaker) replayBlocks(proxyApp proxy.AppConns, appBlockHeight, store } // ApplyBlock on the proxyApp with the last block. -func (h *Handshaker) replayBlock(height int, proxyApp proxy.AppConnConsensus) ([]byte, error) { +func (h *Handshaker) replayBlock(height uint64, proxyApp proxy.AppConnConsensus) ([]byte, error) { mempool := types.MockMempool{} block := h.store.LoadBlock(height) diff --git a/consensus/replay_test.go b/consensus/replay_test.go index 25fdf4db..1588142d 100644 --- a/consensus/replay_test.go +++ b/consensus/replay_test.go @@ -58,7 +58,7 @@ var data_dir = path.Join(cmn.GoPath(), "src/github.com/tendermint/tendermint/con // and which ones we need the wal for - then we'd also be able to only flush the // wal writer when we need to, instead of with every message. -func startNewConsensusStateAndWaitForBlock(t *testing.T, lastBlockHeight int, blockDB dbm.DB, stateDB dbm.DB) { +func startNewConsensusStateAndWaitForBlock(t *testing.T, lastBlockHeight uint64, blockDB dbm.DB, stateDB dbm.DB) { logger := log.TestingLogger() state, _ := sm.GetState(stateDB, consensusReplayConfig.GenesisFile()) state.SetLogger(logger.With("module", "state")) @@ -590,21 +590,21 @@ func NewMockBlockStore(config *cfg.Config, params types.ConsensusParams) *mockBl return &mockBlockStore{config, params, nil, nil} } -func (bs *mockBlockStore) Height() int { return len(bs.chain) } -func (bs *mockBlockStore) LoadBlock(height int) *types.Block { return bs.chain[height-1] } -func (bs *mockBlockStore) LoadBlockMeta(height int) *types.BlockMeta { +func (bs *mockBlockStore) Height() uint64 { return uint64(len(bs.chain)) } +func (bs *mockBlockStore) LoadBlock(height uint64) *types.Block { return bs.chain[height-1] } +func (bs *mockBlockStore) LoadBlockMeta(height uint64) *types.BlockMeta { block := bs.chain[height-1] return &types.BlockMeta{ BlockID: types.BlockID{block.Hash(), block.MakePartSet(bs.params.BlockPartSizeBytes).Header()}, Header: block.Header, } } -func (bs *mockBlockStore) LoadBlockPart(height int, 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 int) *types.Commit { +func (bs *mockBlockStore) LoadBlockCommit(height uint64) *types.Commit { return bs.commits[height-1] } -func (bs *mockBlockStore) LoadSeenCommit(height int) *types.Commit { +func (bs *mockBlockStore) LoadSeenCommit(height uint64) *types.Commit { return bs.commits[height-1] } diff --git a/consensus/state.go b/consensus/state.go index d53453bd..8bd31654 100644 --- a/consensus/state.go +++ b/consensus/state.go @@ -54,7 +54,7 @@ type msgInfo struct { // internally generated messages which may update the state type timeoutInfo struct { Duration time.Duration `json:"duration"` - Height int `json:"height"` + Height uint64 `json:"height"` Round int `json:"round"` Step cstypes.RoundStepType `json:"step"` } @@ -104,8 +104,8 @@ type ConsensusState struct { nSteps int // some functions can be overwritten for testing - decideProposal func(height, round int) - doPrevote func(height, round int) + decideProposal func(height uint64, round int) + doPrevote func(height uint64, round int) setProposal func(proposal *types.Proposal) error // closed when we finish shutting down @@ -179,7 +179,7 @@ func (cs *ConsensusState) getRoundState() *cstypes.RoundState { } // GetValidators returns a copy of the current validators. -func (cs *ConsensusState) GetValidators() (int, []*types.Validator) { +func (cs *ConsensusState) GetValidators() (uint64, []*types.Validator) { cs.mtx.Lock() defer cs.mtx.Unlock() return cs.state.LastBlockHeight, cs.state.Validators.Copy().Validators @@ -200,7 +200,7 @@ func (cs *ConsensusState) SetTimeoutTicker(timeoutTicker TimeoutTicker) { } // LoadCommit loads the commit for a given height. -func (cs *ConsensusState) LoadCommit(height int) *types.Commit { +func (cs *ConsensusState) LoadCommit(height uint64) *types.Commit { cs.mtx.Lock() defer cs.mtx.Unlock() if height == cs.blockStore.Height() { @@ -331,7 +331,7 @@ func (cs *ConsensusState) SetProposal(proposal *types.Proposal, peerKey string) } // AddProposalBlockPart inputs a part of the proposal block. -func (cs *ConsensusState) AddProposalBlockPart(height, round int, part *types.Part, peerKey string) error { +func (cs *ConsensusState) AddProposalBlockPart(height uint64, round int, part *types.Part, peerKey string) error { if peerKey == "" { cs.internalMsgQueue <- msgInfo{&BlockPartMessage{height, round, part}, ""} @@ -360,7 +360,7 @@ func (cs *ConsensusState) SetProposalAndBlock(proposal *types.Proposal, block *t //------------------------------------------------------------ // internal functions for managing the state -func (cs *ConsensusState) updateHeight(height int) { +func (cs *ConsensusState) updateHeight(height uint64) { cs.Height = height } @@ -377,7 +377,7 @@ func (cs *ConsensusState) scheduleRound0(rs *cstypes.RoundState) { } // Attempt to schedule a timeout (by sending timeoutInfo on the tickChan) -func (cs *ConsensusState) scheduleTimeout(duration time.Duration, height, round int, step cstypes.RoundStepType) { +func (cs *ConsensusState) scheduleTimeout(duration time.Duration, height uint64, round int, step cstypes.RoundStepType) { cs.timeoutTicker.ScheduleTimeout(timeoutInfo{duration, height, round, step}) } @@ -627,7 +627,7 @@ func (cs *ConsensusState) handleTimeout(ti timeoutInfo, rs cstypes.RoundState) { } -func (cs *ConsensusState) handleTxsAvailable(height int) { +func (cs *ConsensusState) handleTxsAvailable(height uint64) { cs.mtx.Lock() defer cs.mtx.Unlock() // we only need to do this for round 0 @@ -644,7 +644,7 @@ func (cs *ConsensusState) handleTxsAvailable(height int) { // Enter: +2/3 precommits for nil at (height,round-1) // Enter: +2/3 prevotes any or +2/3 precommits for block or any from (height, round) // NOTE: cs.StartTime was already set for height. -func (cs *ConsensusState) enterNewRound(height int, round int) { +func (cs *ConsensusState) enterNewRound(height uint64, round int) { if cs.Height != height || round < cs.Round || (cs.Round == round && cs.Step != cstypes.RoundStepNewHeight) { cs.Logger.Debug(cmn.Fmt("enterNewRound(%v/%v): Invalid args. Current step: %v/%v/%v", height, round, cs.Height, cs.Round, cs.Step)) return @@ -697,7 +697,7 @@ func (cs *ConsensusState) enterNewRound(height int, round int) { // needProofBlock returns true on the first height (so the genesis app hash is signed right away) // and where the last block (height-1) caused the app hash to change -func (cs *ConsensusState) needProofBlock(height int) bool { +func (cs *ConsensusState) needProofBlock(height uint64) bool { if height == 1 { return true } @@ -706,7 +706,7 @@ func (cs *ConsensusState) needProofBlock(height int) bool { return !bytes.Equal(cs.state.AppHash, lastBlockMeta.Header.AppHash) } -func (cs *ConsensusState) proposalHeartbeat(height, round int) { +func (cs *ConsensusState) proposalHeartbeat(height uint64, round int) { counter := 0 addr := cs.privValidator.GetAddress() valIndex, v := cs.Validators.GetByAddress(addr) @@ -738,7 +738,7 @@ func (cs *ConsensusState) proposalHeartbeat(height, round int) { // Enter (CreateEmptyBlocks): from enterNewRound(height,round) // Enter (CreateEmptyBlocks, CreateEmptyBlocksInterval > 0 ): after enterNewRound(height,round), after timeout of CreateEmptyBlocksInterval // Enter (!CreateEmptyBlocks) : after enterNewRound(height,round), once txs are in the mempool -func (cs *ConsensusState) enterPropose(height int, round int) { +func (cs *ConsensusState) enterPropose(height uint64, round int) { if cs.Height != height || round < cs.Round || (cs.Round == round && cstypes.RoundStepPropose <= cs.Step) { cs.Logger.Debug(cmn.Fmt("enterPropose(%v/%v): Invalid args. Current step: %v/%v/%v", height, round, cs.Height, cs.Round, cs.Step)) return @@ -785,7 +785,7 @@ func (cs *ConsensusState) isProposer() bool { return bytes.Equal(cs.Validators.GetProposer().Address, cs.privValidator.GetAddress()) } -func (cs *ConsensusState) defaultDecideProposal(height, round int) { +func (cs *ConsensusState) defaultDecideProposal(height uint64, round int) { var block *types.Block var blockParts *types.PartSet @@ -873,7 +873,7 @@ func (cs *ConsensusState) createProposalBlock() (block *types.Block, blockParts // Enter: any +2/3 prevotes for future round. // Prevote for LockedBlock if we're locked, or ProposalBlock if valid. // Otherwise vote nil. -func (cs *ConsensusState) enterPrevote(height int, round int) { +func (cs *ConsensusState) enterPrevote(height uint64, round int) { if cs.Height != height || round < cs.Round || (cs.Round == round && cstypes.RoundStepPrevote <= cs.Step) { cs.Logger.Debug(cmn.Fmt("enterPrevote(%v/%v): Invalid args. Current step: %v/%v/%v", height, round, cs.Height, cs.Round, cs.Step)) return @@ -902,7 +902,7 @@ func (cs *ConsensusState) enterPrevote(height int, round int) { // (so we have more time to try and collect +2/3 prevotes for a single block) } -func (cs *ConsensusState) defaultDoPrevote(height int, round int) { +func (cs *ConsensusState) defaultDoPrevote(height uint64, round int) { logger := cs.Logger.With("height", height, "round", round) // If a block is locked, prevote that. if cs.LockedBlock != nil { @@ -935,7 +935,7 @@ func (cs *ConsensusState) defaultDoPrevote(height int, round int) { } // Enter: any +2/3 prevotes at next round. -func (cs *ConsensusState) enterPrevoteWait(height int, round int) { +func (cs *ConsensusState) enterPrevoteWait(height uint64, round int) { if cs.Height != height || round < cs.Round || (cs.Round == round && cstypes.RoundStepPrevoteWait <= cs.Step) { cs.Logger.Debug(cmn.Fmt("enterPrevoteWait(%v/%v): Invalid args. Current step: %v/%v/%v", height, round, cs.Height, cs.Round, cs.Step)) return @@ -961,7 +961,7 @@ func (cs *ConsensusState) enterPrevoteWait(height int, round int) { // Lock & precommit the ProposalBlock if we have enough prevotes for it (a POL in this round) // else, unlock an existing lock and precommit nil if +2/3 of prevotes were nil, // else, precommit nil otherwise. -func (cs *ConsensusState) enterPrecommit(height int, round int) { +func (cs *ConsensusState) enterPrecommit(height uint64, round int) { if cs.Height != height || round < cs.Round || (cs.Round == round && cstypes.RoundStepPrecommit <= cs.Step) { cs.Logger.Debug(cmn.Fmt("enterPrecommit(%v/%v): Invalid args. Current step: %v/%v/%v", height, round, cs.Height, cs.Round, cs.Step)) return @@ -1054,7 +1054,7 @@ func (cs *ConsensusState) enterPrecommit(height int, round int) { } // Enter: any +2/3 precommits for next round. -func (cs *ConsensusState) enterPrecommitWait(height int, round int) { +func (cs *ConsensusState) enterPrecommitWait(height uint64, round int) { if cs.Height != height || round < cs.Round || (cs.Round == round && cstypes.RoundStepPrecommitWait <= cs.Step) { cs.Logger.Debug(cmn.Fmt("enterPrecommitWait(%v/%v): Invalid args. Current step: %v/%v/%v", height, round, cs.Height, cs.Round, cs.Step)) return @@ -1076,7 +1076,7 @@ func (cs *ConsensusState) enterPrecommitWait(height int, round int) { } // Enter: +2/3 precommits for block -func (cs *ConsensusState) enterCommit(height int, commitRound int) { +func (cs *ConsensusState) enterCommit(height uint64, commitRound int) { if cs.Height != height || cstypes.RoundStepCommit <= cs.Step { cs.Logger.Debug(cmn.Fmt("enterCommit(%v/%v): Invalid args. Current step: %v/%v/%v", height, commitRound, cs.Height, cs.Round, cs.Step)) return @@ -1122,7 +1122,7 @@ func (cs *ConsensusState) enterCommit(height int, commitRound int) { } // If we have the block AND +2/3 commits for it, finalize. -func (cs *ConsensusState) tryFinalizeCommit(height int) { +func (cs *ConsensusState) tryFinalizeCommit(height uint64) { if cs.Height != height { cmn.PanicSanity(cmn.Fmt("tryFinalizeCommit() cs.Height: %v vs height: %v", cs.Height, height)) } @@ -1144,7 +1144,7 @@ func (cs *ConsensusState) tryFinalizeCommit(height int) { } // Increment height and goto cstypes.RoundStepNewHeight -func (cs *ConsensusState) finalizeCommit(height int) { +func (cs *ConsensusState) finalizeCommit(height uint64) { if cs.Height != height || cs.Step != cstypes.RoundStepCommit { cs.Logger.Debug(cmn.Fmt("finalizeCommit(%v): Invalid args. Current step: %v/%v/%v", height, cs.Height, cs.Round, cs.Step)) return @@ -1193,7 +1193,7 @@ func (cs *ConsensusState) finalizeCommit(height int) { // WAL replay for blocks with an #ENDHEIGHT // As is, ConsensusState should not be started again // until we successfully call ApplyBlock (ie. here or in Handshake after restart) - cs.wal.Save(EndHeightMessage{uint64(height)}) + cs.wal.Save(EndHeightMessage{height}) fail.Fail() // XXX @@ -1285,7 +1285,7 @@ func (cs *ConsensusState) defaultSetProposal(proposal *types.Proposal) error { // NOTE: block is not necessarily valid. // Asynchronously triggers either enterPrevote (before we timeout of propose) or tryFinalizeCommit, once we have the full block. -func (cs *ConsensusState) addProposalBlockPart(height int, part *types.Part, verify bool) (added bool, err error) { +func (cs *ConsensusState) addProposalBlockPart(height uint64, part *types.Part, verify bool) (added bool, err error) { // Blocks might be reused, so round mismatch is OK if cs.Height != height { return false, nil @@ -1494,7 +1494,7 @@ func (cs *ConsensusState) signAddVote(type_ byte, hash []byte, header types.Part //--------------------------------------------------------- -func CompareHRS(h1, r1 int, s1 cstypes.RoundStepType, h2, r2 int, s2 cstypes.RoundStepType) int { +func CompareHRS(h1 uint64, r1 int, s1 cstypes.RoundStepType, h2 uint64, r2 int, s2 cstypes.RoundStepType) int { if h1 < h2 { return -1 } else if h1 > h2 { diff --git a/consensus/test_data/many_blocks.cswal b/consensus/test_data/many_blocks.cswal index ab486b5a17786e5a79eb2cec03a621095e50930d..2af0c3cc747862ba378c18b1a157d13e589bdd1e 100644 GIT binary patch literal 16661 zcmc(`c|29?-~Zn-pMy>2AskWW%CL=XLxZ9+rlgcPB}3*ADw0A`M93UTRLYb@<}^?V z6=@(slro0zYv*&S`+l5$=hHvGd;jC{Tx(x@Kd<*%uIsg~wf3I5-O~#eEZ`uxrYCp~ z%69z%7=#2F>5l zP!tIk-rVOQ&xPoEw96<;1WRkaui6tq^$7D=3YlOeaof8n1fD0DYi>6!i>)h2lcT5* z%!ARVT+bOKJRPE_5-bk9`(!OOy5ox91>Ns(6|Shv2QCygDg_13Yc$SV@8O4X|eT7726TTf8rl?YbC z#_3)-U9RLdJ&HV;VBMfC6aTSwga3OLio7zxx^pa;sA+6Crk+NTS0Pwu=#LAKHBwvM z4pZb+3D#=Wqw-E1G93@cDDr9q%eBF%n#C0Y0c$7AH_}PbDTA$C_w6wRh3m( z$p_|M3Pk}@M{0*%!&r0l9_vsPAT{yaSfxkHv}}@|q5vtOAT=faWwG`9$|wqCf?@Vd z%<6nog7wh0t45djLh5D?P!wQO-ePg5%ub;F^$CgsY~&kQzBF(yoQ_weD4<57op&6) zh(k+L)G3N92%0km1k*t)iC5xlM(GGvHpXq)7I%}&7M-Oi;_Gku-yQGQku2TZL{U^C z=%nQxv?6!G2ZC#@!A19^D(6DW%K?o}6u z6ql*FU570&q<0B zO0go|mSwa5Q=y4P6eYN9dM=)HzlwW?{uxCHr8ui!{K(uY>&UY_iV}{`ec_(ZjS6+< zD{CoAI6ht#<<~dm7?SleC`u{>|1Z!O*-)EPwS1x=?6eakiH0+SiI{K2; zFqcAx&jYKj+~+yg!gQ4svOGbz(b`F$U_Dr1dbCb#^;p(Z3K<$^M|Us>9C&7W$b>>x zA{a8>SXSQ)Cs@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-_u<&`aTd(gzuh z#d0*IQ@Q)_8I;alG`AN}Ci49zz)-Rk3RO1k3nD+3fuR&JQK)7c>|}B=0Su)Fw%xrO zL$-^a^aMkxe_nr9+r3N~BL*;(Rwg^$KN5AAJwgS4h(o=V@>@$3)r5bZM*a_$yP5Ud zbXaxA-wTUd3D$}Kv9SC|BfYAtEHHF7jgRF>IJ< z+i;4y)&A3Eh^Vrd@4VF}DqgdPe&>3g-R7UWB|D!gf3X_6uas>tp)>b4R zX0g8I>-T=0c@vXDl}*W^F)g`M@=us&SMLG05I-mi&aOaNm9w+?#q*w*XS|O7J)bg` zf1eN1$ZySueLUuH==14Ooru3qmP^Do%~yW#x_Mh*?glb$-S>t29{pK3*5>irsroiu w$gAO;^ZfG54ffrb)1ZG>H@G;dJaG1{l;f#2H=sD1M#|c78-O}GKT9M351=|XL;wH) diff --git a/consensus/types/height_vote_set.go b/consensus/types/height_vote_set.go index 18c1c78a..42541861 100644 --- a/consensus/types/height_vote_set.go +++ b/consensus/types/height_vote_set.go @@ -29,7 +29,7 @@ One for their LastCommit round, and another for the official commit round. */ type HeightVoteSet struct { chainID string - height int + height uint64 valSet *types.ValidatorSet mtx sync.Mutex @@ -38,7 +38,7 @@ type HeightVoteSet struct { peerCatchupRounds map[string][]int // keys: peer.Key; values: at most 2 rounds } -func NewHeightVoteSet(chainID string, height int, valSet *types.ValidatorSet) *HeightVoteSet { +func NewHeightVoteSet(chainID string, height uint64, valSet *types.ValidatorSet) *HeightVoteSet { hvs := &HeightVoteSet{ chainID: chainID, } @@ -46,7 +46,7 @@ func NewHeightVoteSet(chainID string, height int, valSet *types.ValidatorSet) *H return hvs } -func (hvs *HeightVoteSet) Reset(height int, valSet *types.ValidatorSet) { +func (hvs *HeightVoteSet) Reset(height uint64, valSet *types.ValidatorSet) { hvs.mtx.Lock() defer hvs.mtx.Unlock() @@ -59,7 +59,7 @@ func (hvs *HeightVoteSet) Reset(height int, valSet *types.ValidatorSet) { hvs.round = 0 } -func (hvs *HeightVoteSet) Height() int { +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 d5797368..14f66b6a 100644 --- a/consensus/types/height_vote_set_test.go +++ b/consensus/types/height_vote_set_test.go @@ -47,7 +47,7 @@ func TestPeerCatchupRounds(t *testing.T) { } -func makeVoteHR(t *testing.T, height, round int, privVals []*types.PrivValidatorFS, valIndex int) *types.Vote { +func makeVoteHR(t *testing.T, height uint64, round int, privVals []*types.PrivValidatorFS, valIndex int) *types.Vote { privVal := privVals[valIndex] vote := &types.Vote{ ValidatorAddress: privVal.GetAddress(), diff --git a/consensus/types/reactor.go b/consensus/types/reactor.go index 2306ee38..dac2bf4e 100644 --- a/consensus/types/reactor.go +++ b/consensus/types/reactor.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 int // Height peer is at + Height uint64 // Height peer is at Round int // Round peer is at, -1 if unknown. Step RoundStepType // Step peer is at StartTime time.Time // Estimated start of round 0 at this height diff --git a/consensus/types/state.go b/consensus/types/state.go index 905f7961..c4c91ada 100644 --- a/consensus/types/state.go +++ b/consensus/types/state.go @@ -58,7 +58,7 @@ func (rs RoundStepType) String() string { // NOTE: Not thread safe. Should only be manipulated by functions downstream // of the cs.receiveRoutine type RoundState struct { - Height int // Height we are working on + Height uint64 // Height we are working on Round int Step RoundStepType StartTime time.Time diff --git a/lite/client/provider.go b/lite/client/provider.go index 9adcc082..2e54ed55 100644 --- a/lite/client/provider.go +++ b/lite/client/provider.go @@ -24,7 +24,7 @@ type SignStatusClient interface { type provider struct { node SignStatusClient - lastHeight int + lastHeight uint64 } // NewProvider can wrap any rpcclient to expose it as @@ -68,7 +68,7 @@ func (p *provider) GetByHash(hash []byte) (lite.FullCommit, error) { } // GetByHeight gets the validator set by height -func (p *provider) GetByHeight(h int) (fc lite.FullCommit, err error) { +func (p *provider) GetByHeight(h uint64) (fc lite.FullCommit, err error) { commit, err := p.node.Commit(&h) if err != nil { return fc, err @@ -134,7 +134,7 @@ func (p *provider) seedFromCommit(commit *ctypes.ResultCommit) (fc lite.FullComm return fc, nil } -func (p *provider) updateHeight(h int) { +func (p *provider) updateHeight(h uint64) { if h > p.lastHeight { p.lastHeight = h } diff --git a/lite/commit.go b/lite/commit.go index 20eda8f8..2198bbb2 100644 --- a/lite/commit.go +++ b/lite/commit.go @@ -42,7 +42,7 @@ func NewFullCommit(commit Commit, vals *types.ValidatorSet) FullCommit { } // Height returns the height of the header. -func (c Commit) Height() int { +func (c Commit) Height() uint64 { if c.Header == nil { return 0 } diff --git a/lite/dynamic.go b/lite/dynamic.go index e05c284d..a9bea700 100644 --- a/lite/dynamic.go +++ b/lite/dynamic.go @@ -19,11 +19,11 @@ var _ Certifier = &Dynamic{} // going forward. type Dynamic struct { cert *Static - lastHeight int + lastHeight uint64 } // NewDynamic returns a new dynamic certifier. -func NewDynamic(chainID string, vals *types.ValidatorSet, height int) *Dynamic { +func NewDynamic(chainID string, vals *types.ValidatorSet, height uint64) *Dynamic { return &Dynamic{ cert: NewStatic(chainID, vals), lastHeight: height, @@ -46,7 +46,7 @@ func (c *Dynamic) Hash() []byte { } // LastHeight returns the last height of this certifier. -func (c *Dynamic) LastHeight() int { +func (c *Dynamic) LastHeight() uint64 { return c.lastHeight } diff --git a/lite/dynamic_test.go b/lite/dynamic_test.go index 87df3f67..998a8a21 100644 --- a/lite/dynamic_test.go +++ b/lite/dynamic_test.go @@ -28,7 +28,7 @@ func TestDynamicCert(t *testing.T) { cases := []struct { keys lite.ValKeys vals *types.ValidatorSet - height int + height uint64 first, last int // who actually signs proper bool // true -> expect no error changed bool // true -> expect validator change error @@ -70,7 +70,7 @@ func TestDynamicUpdate(t *testing.T) { cert := lite.NewDynamic(chainID, vals, 40) // one valid block to give us a sense of time - h := 100 + h := uint64(100) good := keys.GenCommit(chainID, h, nil, vals, []byte("foo"), 0, len(keys)) err := cert.Certify(good) require.Nil(err, "%+v", err) @@ -83,7 +83,7 @@ func TestDynamicUpdate(t *testing.T) { cases := []struct { keys lite.ValKeys vals *types.ValidatorSet - height int + height uint64 first, last int // who actually signs proper bool // true -> expect no error changed bool // true -> expect too much change error diff --git a/lite/errors/errors.go b/lite/errors/errors.go index 96c07539..9b1d5334 100644 --- a/lite/errors/errors.go +++ b/lite/errors/errors.go @@ -70,7 +70,7 @@ func ErrNoPathFound() error { //-------------------------------------------- type errHeightMismatch struct { - h1, h2 int + h1, h2 uint64 } func (e errHeightMismatch) Error() string { @@ -87,6 +87,6 @@ func IsHeightMismatchErr(err error) bool { } // ErrHeightMismatch returns an mismatch error with stack-trace -func ErrHeightMismatch(h1, h2 int) error { +func ErrHeightMismatch(h1, h2 uint64) error { return errors.WithStack(errHeightMismatch{h1, h2}) } diff --git a/lite/files/commit_test.go b/lite/files/commit_test.go index 97603281..586393e2 100644 --- a/lite/files/commit_test.go +++ b/lite/files/commit_test.go @@ -24,7 +24,7 @@ func TestSerializeFullCommits(t *testing.T) { // some constants appHash := []byte("some crazy thing") chainID := "ser-ial" - h := 25 + h := uint64(25) // build a fc keys := lite.GenValKeys(5) diff --git a/lite/files/provider.go b/lite/files/provider.go index faa68dd9..8eb869ba 100644 --- a/lite/files/provider.go +++ b/lite/files/provider.go @@ -60,7 +60,7 @@ func (p *provider) encodeHash(hash []byte) string { return hex.EncodeToString(hash) + Ext } -func (p *provider) encodeHeight(h int) string { +func (p *provider) encodeHeight(h uint64) string { // pad up to 10^12 for height... return fmt.Sprintf("%012d%s", h, Ext) } @@ -88,7 +88,7 @@ func (p *provider) StoreCommit(fc lite.FullCommit) error { } // GetByHeight returns the closest commit with height <= h. -func (p *provider) GetByHeight(h int) (lite.FullCommit, error) { +func (p *provider) GetByHeight(h uint64) (lite.FullCommit, error) { // first we look for exact match, then search... path := filepath.Join(p.checkDir, p.encodeHeight(h)) fc, err := LoadFullCommit(path) @@ -109,7 +109,7 @@ func (p *provider) LatestCommit() (fc lite.FullCommit, err error) { // search for height, looks for a file with highest height < h // return certifiers.ErrCommitNotFound() if not there... -func (p *provider) searchForHeight(h int) (string, error) { +func (p *provider) searchForHeight(h uint64) (string, error) { d, err := os.Open(p.checkDir) if err != nil { return "", errors.WithStack(err) diff --git a/lite/files/provider_test.go b/lite/files/provider_test.go index 23743bfc..7faf7c5e 100644 --- a/lite/files/provider_test.go +++ b/lite/files/provider_test.go @@ -45,7 +45,7 @@ func TestFileProvider(t *testing.T) { // two seeds for each validator, to check how we handle dups // (10, 0), (10, 1), (10, 1), (10, 2), (10, 2), ... vals := keys.ToValidators(10, int64(count/2)) - h := 20 + 10*i + h := uint64(20 + 10*i) check := keys.GenCommit(chainID, h, nil, vals, appHash, 0, 5) seeds[i] = lite.NewFullCommit(check, vals) } @@ -86,7 +86,7 @@ func TestFileProvider(t *testing.T) { seed, err = p.GetByHeight(47) if assert.Nil(err, "%+v", err) { // we only step by 10, so 40 must be the one below this - assert.Equal(40, seed.Height()) + assert.EqualValues(40, seed.Height()) } // and proper error for too low diff --git a/lite/helpers.go b/lite/helpers.go index e68460be..e12f087f 100644 --- a/lite/helpers.go +++ b/lite/helpers.go @@ -108,7 +108,7 @@ func makeVote(header *types.Header, vals *types.ValidatorSet, key crypto.PrivKey // Silences warning that vals can also be merkle.Hashable // nolint: interfacer -func genHeader(chainID string, height int, txs types.Txs, +func genHeader(chainID string, height uint64, txs types.Txs, vals *types.ValidatorSet, appHash []byte) *types.Header { return &types.Header{ @@ -125,7 +125,7 @@ func genHeader(chainID string, height int, txs types.Txs, } // GenCommit calls genHeader and signHeader and combines them into a Commit. -func (v ValKeys) GenCommit(chainID string, height int, txs types.Txs, +func (v ValKeys) GenCommit(chainID string, height uint64, txs types.Txs, vals *types.ValidatorSet, appHash []byte, first, last int) Commit { header := genHeader(chainID, height, txs, vals, appHash) @@ -137,7 +137,7 @@ func (v ValKeys) GenCommit(chainID string, height int, txs types.Txs, } // GenFullCommit calls genHeader and signHeader and combines them into a Commit. -func (v ValKeys) GenFullCommit(chainID string, height int, txs types.Txs, +func (v ValKeys) GenFullCommit(chainID string, height uint64, txs types.Txs, vals *types.ValidatorSet, appHash []byte, first, last int) FullCommit { header := genHeader(chainID, height, txs, vals, appHash) diff --git a/lite/inquirer.go b/lite/inquirer.go index 39aa62b3..4c2655f6 100644 --- a/lite/inquirer.go +++ b/lite/inquirer.go @@ -46,7 +46,7 @@ func (c *Inquiring) Validators() *types.ValidatorSet { } // LastHeight returns the last height. -func (c *Inquiring) LastHeight() int { +func (c *Inquiring) LastHeight() uint64 { return c.cert.lastHeight } @@ -95,7 +95,7 @@ func (c *Inquiring) Update(fc FullCommit) error { return err } -func (c *Inquiring) useClosestTrust(h int) error { +func (c *Inquiring) useClosestTrust(h uint64) error { closest, err := c.trusted.GetByHeight(h) if err != nil { return err @@ -126,7 +126,7 @@ func (c *Inquiring) updateToHash(vhash []byte) error { } // updateToHeight will use divide-and-conquer to find a path to h -func (c *Inquiring) updateToHeight(h int) error { +func (c *Inquiring) updateToHeight(h uint64) error { // try to update to this height (with checks) fc, err := c.Source.GetByHeight(h) if err != nil { diff --git a/lite/inquirer_test.go b/lite/inquirer_test.go index 82c97f0a..4e315e14 100644 --- a/lite/inquirer_test.go +++ b/lite/inquirer_test.go @@ -28,7 +28,7 @@ func TestInquirerValidPath(t *testing.T) { // extend the keys by 1 each time keys = keys.Extend(1) vals := keys.ToValidators(vote, 0) - h := 20 + 10*i + h := uint64(20 + 10*i) appHash := []byte(fmt.Sprintf("h=%d", h)) commits[i] = keys.GenFullCommit(chainID, h, nil, vals, appHash, 0, len(keys)) } @@ -75,7 +75,7 @@ func TestInquirerMinimalPath(t *testing.T) { // extend the validators, so we are just below 2/3 keys = keys.Extend(len(keys)/2 - 1) vals := keys.ToValidators(vote, 0) - h := 5 + 10*i + h := uint64(5 + 10*i) appHash := []byte(fmt.Sprintf("h=%d", h)) commits[i] = keys.GenFullCommit(chainID, h, nil, vals, appHash, 0, len(keys)) } @@ -122,7 +122,7 @@ func TestInquirerVerifyHistorical(t *testing.T) { // extend the keys by 1 each time keys = keys.Extend(1) vals := keys.ToValidators(vote, 0) - h := 20 + 10*i + h := uint64(20 + 10*i) appHash := []byte(fmt.Sprintf("h=%d", h)) commits[i] = keys.GenFullCommit(chainID, h, nil, vals, appHash, 0, len(keys)) } diff --git a/lite/memprovider.go b/lite/memprovider.go index ead043e9..03c99630 100644 --- a/lite/memprovider.go +++ b/lite/memprovider.go @@ -52,7 +52,7 @@ func (m *memStoreProvider) StoreCommit(fc FullCommit) error { } // GetByHeight returns the FullCommit for height h or an error if the commit is not found. -func (m *memStoreProvider) GetByHeight(h int) (FullCommit, error) { +func (m *memStoreProvider) GetByHeight(h uint64) (FullCommit, error) { // search from highest to lowest for i := len(m.byHeight) - 1; i >= 0; i-- { fc := m.byHeight[i] diff --git a/lite/performance_test.go b/lite/performance_test.go index fe4b927a..da571d0e 100644 --- a/lite/performance_test.go +++ b/lite/performance_test.go @@ -31,7 +31,7 @@ func benchmarkGenCommit(b *testing.B, keys lite.ValKeys) { chainID := fmt.Sprintf("bench-%d", len(keys)) vals := keys.ToValidators(20, 10) for i := 0; i < b.N; i++ { - h := 1 + i + h := uint64(1 + i) appHash := []byte(fmt.Sprintf("h=%d", h)) keys.GenCommit(chainID, h, nil, vals, appHash, 0, len(keys)) } diff --git a/lite/provider.go b/lite/provider.go index 0084fb35..d3364ff1 100644 --- a/lite/provider.go +++ b/lite/provider.go @@ -9,7 +9,7 @@ type Provider interface { // store of trusted commits. StoreCommit(fc FullCommit) error // GetByHeight returns the closest commit with height <= h. - GetByHeight(h int) (FullCommit, error) + GetByHeight(h uint64) (FullCommit, error) // GetByHash returns a commit exactly matching this validator hash. GetByHash(hash []byte) (FullCommit, error) // LatestCommit returns the newest commit stored. @@ -55,7 +55,7 @@ func (c cacheProvider) StoreCommit(fc FullCommit) (err error) { // Thus, we query each provider in order until we find an exact match // or we finished querying them all. If at least one returned a non-error, // then this returns the best match (minimum h-h'). -func (c cacheProvider) GetByHeight(h int) (fc FullCommit, err error) { +func (c cacheProvider) GetByHeight(h uint64) (fc FullCommit, err error) { for _, p := range c.Providers { var tfc FullCommit tfc, err = p.GetByHeight(h) diff --git a/lite/provider_test.go b/lite/provider_test.go index 67754a69..9b8ac15f 100644 --- a/lite/provider_test.go +++ b/lite/provider_test.go @@ -21,7 +21,7 @@ func NewMissingProvider() lite.Provider { } func (missingProvider) StoreCommit(lite.FullCommit) error { return nil } -func (missingProvider) GetByHeight(int) (lite.FullCommit, error) { +func (missingProvider) GetByHeight(uint64) (lite.FullCommit, error) { return lite.FullCommit{}, liteErr.ErrCommitNotFound() } func (missingProvider) GetByHash([]byte) (lite.FullCommit, error) { @@ -57,7 +57,7 @@ func checkProvider(t *testing.T, p lite.Provider, chainID, app string) { // two commits for each validator, to check how we handle dups // (10, 0), (10, 1), (10, 1), (10, 2), (10, 2), ... vals := keys.ToValidators(10, int64(count/2)) - h := 20 + 10*i + h := uint64(20 + 10*i) commits[i] = keys.GenFullCommit(chainID, h, nil, vals, appHash, 0, 5) } @@ -95,13 +95,13 @@ func checkProvider(t *testing.T, p lite.Provider, chainID, app string) { fc, err = p.GetByHeight(47) if assert.Nil(err) { // we only step by 10, so 40 must be the one below this - assert.Equal(40, fc.Height()) + assert.EqualValues(40, fc.Height()) } } // this will make a get height, and if it is good, set the data as well -func checkGetHeight(t *testing.T, p lite.Provider, ask, expect int) { +func checkGetHeight(t *testing.T, p lite.Provider, ask, expect uint64) { fc, err := p.GetByHeight(ask) require.Nil(t, err, "%+v", err) if assert.Equal(t, expect, fc.Height()) { @@ -128,7 +128,7 @@ func TestCacheGetsBestHeight(t *testing.T) { // set a bunch of commits for i := 0; i < count; i++ { vals := keys.ToValidators(10, int64(count/2)) - h := 10 * (i + 1) + h := uint64(10 * (i + 1)) fc := keys.GenFullCommit(chainID, h, nil, vals, appHash, 0, 5) err := p2.StoreCommit(fc) require.NoError(err) diff --git a/lite/static_test.go b/lite/static_test.go index c043dea8..4ee7cc03 100644 --- a/lite/static_test.go +++ b/lite/static_test.go @@ -26,7 +26,7 @@ func TestStaticCert(t *testing.T) { cases := []struct { keys lite.ValKeys vals *types.ValidatorSet - height int + height uint64 first, last int // who actually signs proper bool // true -> expect no error changed bool // true -> expect validator change error diff --git a/mempool/mempool.go b/mempool/mempool.go index 7ccea410..3bf946be 100644 --- a/mempool/mempool.go +++ b/mempool/mempool.go @@ -61,12 +61,12 @@ type Mempool struct { proxyAppConn proxy.AppConnMempool txs *clist.CList // concurrent linked-list of good txs counter int64 // simple incrementing counter - height int // the last block Update()'d to + height uint64 // the last block Update()'d to rechecking int32 // for re-checking filtered txs on Update() recheckCursor *clist.CElement // next expected response recheckEnd *clist.CElement // re-checking stops here notifiedTxsAvailable bool // true if fired on txsAvailable for this height - txsAvailable chan int // fires the next height once for each height, when the mempool is not empty + txsAvailable chan uint64 // fires the next height once for each height, when the mempool is not empty // Keep a cache of already-seen txs. // This reduces the pressure on the proxyApp. @@ -80,7 +80,7 @@ type Mempool struct { // NewMempool returns a new Mempool with the given configuration and connection to an application. // TODO: Extract logger into arguments. -func NewMempool(config *cfg.MempoolConfig, proxyAppConn proxy.AppConnMempool, height int) *Mempool { +func NewMempool(config *cfg.MempoolConfig, proxyAppConn proxy.AppConnMempool, height uint64) *Mempool { mempool := &Mempool{ config: config, proxyAppConn: proxyAppConn, @@ -102,7 +102,7 @@ func NewMempool(config *cfg.MempoolConfig, proxyAppConn proxy.AppConnMempool, he // ensuring it will trigger once every height when transactions are available. // NOTE: not thread safe - should only be called once, on startup func (mem *Mempool) EnableTxsAvailable() { - mem.txsAvailable = make(chan int, 1) + mem.txsAvailable = make(chan uint64, 1) } // SetLogger sets the Logger. @@ -249,7 +249,7 @@ func (mem *Mempool) resCbNormal(req *abci.Request, res *abci.Response) { mem.counter++ memTx := &mempoolTx{ counter: mem.counter, - height: int64(mem.height), + height: mem.height, tx: tx, } mem.txs.PushBack(memTx) @@ -310,7 +310,7 @@ func (mem *Mempool) resCbRecheck(req *abci.Request, res *abci.Response) { // TxsAvailable returns a channel which fires once for every height, // and only when transactions are available in the mempool. // NOTE: the returned channel may be nil if EnableTxsAvailable was not called. -func (mem *Mempool) TxsAvailable() <-chan int { +func (mem *Mempool) TxsAvailable() <-chan uint64 { return mem.txsAvailable } @@ -357,7 +357,7 @@ func (mem *Mempool) collectTxs(maxTxs int) types.Txs { // Update informs the mempool that the given txs were committed and can be discarded. // NOTE: this should be called *after* block is committed by consensus. // NOTE: unsafe; Lock/Unlock must be managed by caller -func (mem *Mempool) Update(height int, txs types.Txs) error { +func (mem *Mempool) Update(height uint64, txs types.Txs) error { if err := mem.proxyAppConn.FlushSync(); err != nil { // To flush async resCb calls e.g. from CheckTx return err } @@ -427,13 +427,13 @@ func (mem *Mempool) recheckTxs(goodTxs []types.Tx) { // mempoolTx is a transaction that successfully ran type mempoolTx struct { counter int64 // a simple incrementing counter - height int64 // height that this tx had been validated in + height uint64 // height that this tx had been validated in tx types.Tx // } // Height returns the height for this transaction -func (memTx *mempoolTx) Height() int { - return int(atomic.LoadInt64(&memTx.height)) +func (memTx *mempoolTx) Height() uint64 { + return uint64(atomic.LoadUint64(&memTx.height)) } //-------------------------------------------------------------------------------- diff --git a/mempool/mempool_test.go b/mempool/mempool_test.go index e26ef966..4db76107 100644 --- a/mempool/mempool_test.go +++ b/mempool/mempool_test.go @@ -37,7 +37,7 @@ func newMempoolWithApp(cc proxy.ClientCreator) *Mempool { return mempool } -func ensureNoFire(t *testing.T, ch <-chan int, timeoutMS int) { +func ensureNoFire(t *testing.T, ch <-chan uint64, timeoutMS int) { timer := time.NewTimer(time.Duration(timeoutMS) * time.Millisecond) select { case <-ch: @@ -46,7 +46,7 @@ func ensureNoFire(t *testing.T, ch <-chan int, timeoutMS int) { } } -func ensureFire(t *testing.T, ch <-chan int, timeoutMS int) { +func ensureFire(t *testing.T, ch <-chan uint64, timeoutMS int) { timer := time.NewTimer(time.Duration(timeoutMS) * time.Millisecond) select { case <-ch: diff --git a/mempool/reactor.go b/mempool/reactor.go index 9e51d2df..d22ffcda 100644 --- a/mempool/reactor.go +++ b/mempool/reactor.go @@ -97,7 +97,7 @@ func (memR *MempoolReactor) BroadcastTx(tx types.Tx, cb func(*abci.Response)) er // PeerState describes the state of a peer. type PeerState interface { - GetHeight() int + GetHeight() uint64 } // Peer describes a peer. diff --git a/rpc/client/event_test.go b/rpc/client/event_test.go index 96328229..44a1410d 100644 --- a/rpc/client/event_test.go +++ b/rpc/client/event_test.go @@ -53,7 +53,7 @@ func TestBlockEvents(t *testing.T) { } // listen for a new block; ensure height increases by 1 - var firstBlockHeight int + var firstBlockHeight uint64 for j := 0; j < 3; j++ { evtTyp := types.EventNewBlock evt, err := client.WaitForOneEvent(c, evtTyp, waitForEventTimeout) @@ -67,7 +67,7 @@ func TestBlockEvents(t *testing.T) { continue } - require.Equal(block.Header.Height, firstBlockHeight+j) + require.Equal(block.Header.Height, firstBlockHeight+uint64(j)) } } } diff --git a/rpc/client/helpers.go b/rpc/client/helpers.go index c2f06c00..c2925393 100644 --- a/rpc/client/helpers.go +++ b/rpc/client/helpers.go @@ -32,7 +32,7 @@ func DefaultWaitStrategy(delta int) (abort error) { // // If waiter is nil, we use DefaultWaitStrategy, but you can also // provide your own implementation -func WaitForHeight(c StatusClient, h int, waiter Waiter) error { +func WaitForHeight(c StatusClient, h uint64, waiter Waiter) error { if waiter == nil { waiter = DefaultWaitStrategy } @@ -42,7 +42,7 @@ func WaitForHeight(c StatusClient, h int, waiter Waiter) error { if err != nil { return err } - delta = h - s.LatestBlockHeight + delta = int(h - s.LatestBlockHeight) // wait for the time, or abort early if err := waiter(delta); err != nil { return err diff --git a/rpc/client/helpers_test.go b/rpc/client/helpers_test.go index fe186122..ca0884e6 100644 --- a/rpc/client/helpers_test.go +++ b/rpc/client/helpers_test.go @@ -66,11 +66,11 @@ func TestWaitForHeight(t *testing.T) { require.Nil(pre.Error) prer, ok := pre.Response.(*ctypes.ResultStatus) require.True(ok) - assert.Equal(10, prer.LatestBlockHeight) + assert.Equal(uint64(10), prer.LatestBlockHeight) post := r.Calls[4] require.Nil(post.Error) postr, ok := post.Response.(*ctypes.ResultStatus) require.True(ok) - assert.Equal(15, postr.LatestBlockHeight) + assert.Equal(uint64(15), postr.LatestBlockHeight) } diff --git a/rpc/client/httpclient.go b/rpc/client/httpclient.go index 5ceace97..9fcaec54 100644 --- a/rpc/client/httpclient.go +++ b/rpc/client/httpclient.go @@ -123,7 +123,7 @@ func (c *HTTP) DumpConsensusState() (*ctypes.ResultDumpConsensusState, error) { return result, nil } -func (c *HTTP) BlockchainInfo(minHeight, maxHeight int) (*ctypes.ResultBlockchainInfo, error) { +func (c *HTTP) BlockchainInfo(minHeight, maxHeight uint64) (*ctypes.ResultBlockchainInfo, error) { result := new(ctypes.ResultBlockchainInfo) _, err := c.rpc.Call("blockchain", map[string]interface{}{"minHeight": minHeight, "maxHeight": maxHeight}, @@ -143,7 +143,7 @@ func (c *HTTP) Genesis() (*ctypes.ResultGenesis, error) { return result, nil } -func (c *HTTP) Block(height *int) (*ctypes.ResultBlock, error) { +func (c *HTTP) Block(height *uint64) (*ctypes.ResultBlock, error) { result := new(ctypes.ResultBlock) _, err := c.rpc.Call("block", map[string]interface{}{"height": height}, result) if err != nil { @@ -152,7 +152,7 @@ func (c *HTTP) Block(height *int) (*ctypes.ResultBlock, error) { return result, nil } -func (c *HTTP) Commit(height *int) (*ctypes.ResultCommit, error) { +func (c *HTTP) Commit(height *uint64) (*ctypes.ResultCommit, error) { result := new(ctypes.ResultCommit) _, err := c.rpc.Call("commit", map[string]interface{}{"height": height}, result) if err != nil { @@ -187,7 +187,7 @@ func (c *HTTP) TxSearch(query string, prove bool) ([]*ctypes.ResultTx, error) { return *results, nil } -func (c *HTTP) Validators(height *int) (*ctypes.ResultValidators, error) { +func (c *HTTP) Validators(height *uint64) (*ctypes.ResultValidators, error) { result := new(ctypes.ResultValidators) _, err := c.rpc.Call("validators", map[string]interface{}{"height": height}, result) if err != nil { diff --git a/rpc/client/interface.go b/rpc/client/interface.go index c0d7e052..b154312c 100644 --- a/rpc/client/interface.go +++ b/rpc/client/interface.go @@ -46,9 +46,9 @@ type ABCIClient interface { // SignClient groups together the interfaces need to get valid // signatures and prove anything about the chain type SignClient interface { - Block(height *int) (*ctypes.ResultBlock, error) - Commit(height *int) (*ctypes.ResultCommit, error) - Validators(height *int) (*ctypes.ResultValidators, error) + Block(height *uint64) (*ctypes.ResultBlock, error) + Commit(height *uint64) (*ctypes.ResultCommit, error) + Validators(height *uint64) (*ctypes.ResultValidators, error) Tx(hash []byte, prove bool) (*ctypes.ResultTx, error) TxSearch(query string, prove bool) ([]*ctypes.ResultTx, error) } @@ -56,7 +56,7 @@ type SignClient interface { // HistoryClient shows us data from genesis to now in large chunks. type HistoryClient interface { Genesis() (*ctypes.ResultGenesis, error) - BlockchainInfo(minHeight, maxHeight int) (*ctypes.ResultBlockchainInfo, error) + BlockchainInfo(minHeight, maxHeight uint64) (*ctypes.ResultBlockchainInfo, error) } type StatusClient interface { diff --git a/rpc/client/localclient.go b/rpc/client/localclient.go index d5444007..123d82f8 100644 --- a/rpc/client/localclient.go +++ b/rpc/client/localclient.go @@ -100,7 +100,7 @@ func (Local) DialSeeds(seeds []string) (*ctypes.ResultDialSeeds, error) { return core.UnsafeDialSeeds(seeds) } -func (Local) BlockchainInfo(minHeight, maxHeight int) (*ctypes.ResultBlockchainInfo, error) { +func (Local) BlockchainInfo(minHeight, maxHeight uint64) (*ctypes.ResultBlockchainInfo, error) { return core.BlockchainInfo(minHeight, maxHeight) } @@ -108,15 +108,15 @@ func (Local) Genesis() (*ctypes.ResultGenesis, error) { return core.Genesis() } -func (Local) Block(height *int) (*ctypes.ResultBlock, error) { +func (Local) Block(height *uint64) (*ctypes.ResultBlock, error) { return core.Block(height) } -func (Local) Commit(height *int) (*ctypes.ResultCommit, error) { +func (Local) Commit(height *uint64) (*ctypes.ResultCommit, error) { return core.Commit(height) } -func (Local) Validators(height *int) (*ctypes.ResultValidators, error) { +func (Local) Validators(height *uint64) (*ctypes.ResultValidators, error) { return core.Validators(height) } diff --git a/rpc/client/mock/client.go b/rpc/client/mock/client.go index 7fc45206..9eb0150c 100644 --- a/rpc/client/mock/client.go +++ b/rpc/client/mock/client.go @@ -111,7 +111,7 @@ func (c Client) DialSeeds(seeds []string) (*ctypes.ResultDialSeeds, error) { return core.UnsafeDialSeeds(seeds) } -func (c Client) BlockchainInfo(minHeight, maxHeight int) (*ctypes.ResultBlockchainInfo, error) { +func (c Client) BlockchainInfo(minHeight, maxHeight uint64) (*ctypes.ResultBlockchainInfo, error) { return core.BlockchainInfo(minHeight, maxHeight) } @@ -119,14 +119,14 @@ func (c Client) Genesis() (*ctypes.ResultGenesis, error) { return core.Genesis() } -func (c Client) Block(height *int) (*ctypes.ResultBlock, error) { +func (c Client) Block(height *uint64) (*ctypes.ResultBlock, error) { return core.Block(height) } -func (c Client) Commit(height *int) (*ctypes.ResultCommit, error) { +func (c Client) Commit(height *uint64) (*ctypes.ResultCommit, error) { return core.Commit(height) } -func (c Client) Validators(height *int) (*ctypes.ResultValidators, error) { +func (c Client) Validators(height *uint64) (*ctypes.ResultValidators, error) { return core.Validators(height) } diff --git a/rpc/core/blocks.go b/rpc/core/blocks.go index 6b5e2166..0b785828 100644 --- a/rpc/core/blocks.go +++ b/rpc/core/blocks.go @@ -61,16 +61,16 @@ import ( // ``` // // -func BlockchainInfo(minHeight, maxHeight int) (*ctypes.ResultBlockchainInfo, error) { +func BlockchainInfo(minHeight, maxHeight uint64) (*ctypes.ResultBlockchainInfo, error) { if maxHeight == 0 { maxHeight = blockStore.Height() } else { - maxHeight = cmn.MinInt(blockStore.Height(), maxHeight) + maxHeight = cmn.MinUint64(blockStore.Height(), maxHeight) } if minHeight == 0 { - minHeight = cmn.MaxInt(1, maxHeight-20) + minHeight = cmn.MaxUint64(1, maxHeight-20) } else { - minHeight = cmn.MaxInt(minHeight, maxHeight-20) + minHeight = cmn.MaxUint64(minHeight, maxHeight-20) } logger.Debug("BlockchainInfoHandler", "maxHeight", maxHeight, "minHeight", minHeight) @@ -184,7 +184,7 @@ func BlockchainInfo(minHeight, maxHeight int) (*ctypes.ResultBlockchainInfo, err // "jsonrpc": "2.0" // } // ``` -func Block(heightPtr *int) (*ctypes.ResultBlock, error) { +func Block(heightPtr *uint64) (*ctypes.ResultBlock, error) { if heightPtr == nil { height := blockStore.Height() blockMeta := blockStore.LoadBlockMeta(height) @@ -275,7 +275,7 @@ func Block(heightPtr *int) (*ctypes.ResultBlock, error) { // "jsonrpc": "2.0" // } // ``` -func Commit(heightPtr *int) (*ctypes.ResultCommit, error) { +func Commit(heightPtr *uint64) (*ctypes.ResultCommit, error) { if heightPtr == nil { height := blockStore.Height() header := blockStore.LoadBlockMeta(height).Header diff --git a/rpc/core/consensus.go b/rpc/core/consensus.go index 75ce08a9..11767d5e 100644 --- a/rpc/core/consensus.go +++ b/rpc/core/consensus.go @@ -42,7 +42,7 @@ import ( // "jsonrpc": "2.0" // } // ``` -func Validators(heightPtr *int) (*ctypes.ResultValidators, error) { +func Validators(heightPtr *uint64) (*ctypes.ResultValidators, error) { if heightPtr == nil { blockHeight, validators := consensusState.GetValidators() return &ctypes.ResultValidators{blockHeight, validators}, nil diff --git a/rpc/core/pipe.go b/rpc/core/pipe.go index 0f3f7472..ae89da8b 100644 --- a/rpc/core/pipe.go +++ b/rpc/core/pipe.go @@ -21,7 +21,7 @@ var subscribeTimeout = 5 * time.Second type Consensus interface { GetState() *sm.State - GetValidators() (int, []*types.Validator) + GetValidators() (uint64, []*types.Validator) GetRoundState() *cstypes.RoundState } diff --git a/rpc/core/tx.go b/rpc/core/tx.go index b6973591..3ebb0d11 100644 --- a/rpc/core/tx.go +++ b/rpc/core/tx.go @@ -84,7 +84,7 @@ func Tx(hash []byte, prove bool) (*ctypes.ResultTx, error) { } height := r.Height - index := r.Index + index := int(r.Index) // XXX:overflow var proof types.TxProof if prove { diff --git a/rpc/core/types/responses.go b/rpc/core/types/responses.go index a1b7e36f..983d1383 100644 --- a/rpc/core/types/responses.go +++ b/rpc/core/types/responses.go @@ -12,7 +12,7 @@ import ( ) type ResultBlockchainInfo struct { - LastHeight int `json:"last_height"` + LastHeight uint64 `json:"last_height"` BlockMetas []*types.BlockMeta `json:"block_metas"` } @@ -51,7 +51,7 @@ type ResultStatus struct { PubKey crypto.PubKey `json:"pub_key"` LatestBlockHash data.Bytes `json:"latest_block_hash"` LatestAppHash data.Bytes `json:"latest_app_hash"` - LatestBlockHeight int `json:"latest_block_height"` + LatestBlockHeight uint64 `json:"latest_block_height"` LatestBlockTime int64 `json:"latest_block_time"` // nano Syncing bool `json:"syncing"` } @@ -86,7 +86,7 @@ type Peer struct { } type ResultValidators struct { - BlockHeight int `json:"block_height"` + BlockHeight uint64 `json:"block_height"` Validators []*types.Validator `json:"validators"` } diff --git a/state/errors.go b/state/errors.go index 4a87384a..16f1a4e6 100644 --- a/state/errors.go +++ b/state/errors.go @@ -9,22 +9,22 @@ type ( ErrProxyAppConn error ErrUnknownBlock struct { - Height int + Height uint64 } ErrBlockHashMismatch struct { CoreHash []byte AppHash []byte - Height int + Height uint64 } ErrAppBlockHeightTooHigh struct { - CoreHeight int - AppHeight int + CoreHeight uint64 + AppHeight uint64 } ErrLastStateMismatch struct { - Height int + Height uint64 Core []byte App []byte } @@ -35,7 +35,7 @@ type ( } ErrNoValSetForHeight struct { - Height int + Height uint64 } ) diff --git a/state/execution.go b/state/execution.go index 3622a663..42d940db 100644 --- a/state/execution.go +++ b/state/execution.go @@ -8,6 +8,7 @@ import ( abci "github.com/tendermint/abci/types" crypto "github.com/tendermint/go-crypto" "github.com/tendermint/tendermint/proxy" + "github.com/tendermint/tendermint/state/txindex" "github.com/tendermint/tendermint/types" cmn "github.com/tendermint/tmlibs/common" "github.com/tendermint/tmlibs/log" @@ -270,6 +271,26 @@ func (s *State) CommitStateUpdateMempool(proxyAppConn proxy.AppConnConsensus, bl return mempool.Update(block.Height, block.Txs) } +func (s *State) indexTxs(abciResponses *ABCIResponses) { + // save the tx results using the TxIndexer + // NOTE: these may be overwriting, but the values should be the same. + batch := txindex.NewBatch(len(abciResponses.DeliverTx)) + for i, d := range abciResponses.DeliverTx { + tx := abciResponses.txs[i] + if err := batch.Add(types.TxResult{ + Height: abciResponses.Height, + Index: uint32(i), + Tx: tx, + Result: *d, + }); err != nil { + s.logger.Error("Error with batch.Add", "err", err) + } + } + if err := s.TxIndexer.AddBatch(batch); err != nil { + s.logger.Error("Error adding batch", "err", err) + } +} + // ExecCommitBlock executes and commits a block on the proxyApp without validating or mutating the state. // It returns the application root hash (result of abci.Commit). func ExecCommitBlock(appConnConsensus proxy.AppConnConsensus, block *types.Block, logger log.Logger) ([]byte, error) { diff --git a/state/execution_test.go b/state/execution_test.go index e54d983d..bb239fe4 100644 --- a/state/execution_test.go +++ b/state/execution_test.go @@ -43,9 +43,9 @@ func TestApplyBlock(t *testing.T) { //---------------------------------------------------------------------------- // make some bogus txs -func makeTxs(blockNum int) (txs []types.Tx) { +func makeTxs(height uint64) (txs []types.Tx) { for i := 0; i < nTxsPerBlock; i++ { - txs = append(txs, types.Tx([]byte{byte(blockNum), byte(i)})) + txs = append(txs, types.Tx([]byte{byte(height), byte(i)})) } return txs } @@ -61,12 +61,12 @@ func state() *State { return s } -func makeBlock(num int, state *State) *types.Block { +func makeBlock(height uint64, state *State) *types.Block { prevHash := state.LastBlockID.Hash prevParts := types.PartSetHeader{} valHash := state.Validators.Hash() prevBlockID := types.BlockID{prevHash, prevParts} - block, _ := types.MakeBlock(num, chainID, makeTxs(num), new(types.Commit), + block, _ := types.MakeBlock(height, chainID, makeTxs(height), new(types.Commit), prevBlockID, valHash, state.AppHash, testPartSize) return block } diff --git a/state/state.go b/state/state.go index e1f16835..aa2566f0 100644 --- a/state/state.go +++ b/state/state.go @@ -23,7 +23,7 @@ var ( abciResponsesKey = []byte("abciResponsesKey") ) -func calcValidatorsKey(height int) []byte { +func calcValidatorsKey(height uint64) []byte { return []byte(cmn.Fmt("validatorsKey:%v", height)) } @@ -45,7 +45,7 @@ type State struct { // These fields are updated by SetBlockAndValidators. // LastBlockHeight=0 at genesis (ie. block(H=0) does not exist) // LastValidators is used to validate block.LastCommit. - LastBlockHeight int + LastBlockHeight uint64 LastBlockID types.BlockID LastBlockTime time.Time Validators *types.ValidatorSet @@ -54,7 +54,7 @@ type State struct { // the change only applies to the next block. // So, if s.LastBlockHeight causes a valset change, // we set s.LastHeightValidatorsChanged = s.LastBlockHeight + 1 - LastHeightValidatorsChanged int + LastHeightValidatorsChanged uint64 // AppHash is updated after Commit AppHash []byte @@ -163,7 +163,7 @@ func (s *State) LoadABCIResponses() *ABCIResponses { } // LoadValidators loads the ValidatorSet for a given height. -func (s *State) LoadValidators(height int) (*types.ValidatorSet, error) { +func (s *State) LoadValidators(height uint64) (*types.ValidatorSet, error) { valInfo := s.loadValidators(height) if valInfo == nil { return nil, ErrNoValSetForHeight{height} @@ -180,7 +180,7 @@ func (s *State) LoadValidators(height int) (*types.ValidatorSet, error) { return valInfo.ValidatorSet, nil } -func (s *State) loadValidators(height int) *ValidatorsInfo { +func (s *State) loadValidators(height uint64) *ValidatorsInfo { buf := s.db.Get(calcValidatorsKey(height)) if len(buf) == 0 { return nil @@ -256,7 +256,7 @@ func (s *State) SetBlockAndValidators(header *types.Header, blockPartsHeader typ } -func (s *State) setBlockAndValidators(height int, blockID types.BlockID, blockTime time.Time, +func (s *State) setBlockAndValidators(height uint64, blockID types.BlockID, blockTime time.Time, prevValSet, nextValSet *types.ValidatorSet) { s.LastBlockHeight = height @@ -276,7 +276,7 @@ func (s *State) GetValidators() (last *types.ValidatorSet, current *types.Valida // ABCIResponses retains the responses of the various ABCI calls during block processing. // It is persisted to disk before calling Commit. type ABCIResponses struct { - Height int + Height uint64 DeliverTx []*abci.ResponseDeliverTx EndBlock *abci.ResponseEndBlock @@ -303,7 +303,7 @@ func (a *ABCIResponses) Bytes() []byte { // ValidatorsInfo represents the latest validator set, or the last height it changed type ValidatorsInfo struct { ValidatorSet *types.ValidatorSet - LastHeightChanged int + LastHeightChanged uint64 } // Bytes serializes the ValidatorsInfo using go-wire diff --git a/state/state_test.go b/state/state_test.go index 7fff0774..cccfc8b6 100644 --- a/state/state_test.go +++ b/state/state_test.go @@ -138,7 +138,7 @@ func TestValidatorChangesSaveLoad(t *testing.T) { assert := assert.New(t) // change vals at these heights - changeHeights := []int{1, 2, 4, 5, 10, 15, 16, 17, 20} + changeHeights := []uint64{1, 2, 4, 5, 10, 15, 16, 17, 20} N := len(changeHeights) // each valset is just one validator. @@ -155,7 +155,7 @@ func TestValidatorChangesSaveLoad(t *testing.T) { highestHeight := changeHeights[N-1] + 5 changeIndex := 0 pubkey := pubkeys[changeIndex] - for i := 1; i < highestHeight; i++ { + for i := uint64(1); i < highestHeight; i++ { // when we get to a change height, // use the next pubkey if changeIndex < len(changeHeights) && i == changeHeights[changeIndex] { @@ -171,7 +171,7 @@ func TestValidatorChangesSaveLoad(t *testing.T) { testCases := make([]valChangeTestCase, highestHeight) changeIndex = 0 pubkey = pubkeys[changeIndex] - for i := 1; i < highestHeight+1; i++ { + for i := uint64(1); i < highestHeight+1; i++ { // we we get to the height after a change height // use the next pubkey (note our counter starts at 0 this time) if changeIndex < len(changeHeights) && i == changeHeights[changeIndex]+1 { @@ -192,7 +192,7 @@ func TestValidatorChangesSaveLoad(t *testing.T) { } } -func makeHeaderPartsResponses(state *State, height int, +func makeHeaderPartsResponses(state *State, height uint64, pubkey crypto.PubKey) (*types.Header, types.PartSetHeader, *ABCIResponses) { block := makeBlock(height, state) @@ -216,6 +216,6 @@ func makeHeaderPartsResponses(state *State, height int, } type valChangeTestCase struct { - height int + height uint64 vals crypto.PubKey } diff --git a/types/block.go b/types/block.go index 738e5a00..eb14fc6c 100644 --- a/types/block.go +++ b/types/block.go @@ -23,7 +23,7 @@ type Block struct { // MakeBlock returns a new block and corresponding partset from the given information. // TODO: Add version information to the Block struct. -func MakeBlock(height int, chainID string, txs []Tx, commit *Commit, +func MakeBlock(height uint64, chainID string, txs []Tx, commit *Commit, prevBlockID BlockID, valHash, appHash []byte, partSize int) (*Block, *PartSet) { block := &Block{ Header: &Header{ @@ -45,7 +45,7 @@ func MakeBlock(height int, chainID string, txs []Tx, commit *Commit, } // ValidateBasic performs basic validation that doesn't involve state data. -func (b *Block) ValidateBasic(chainID string, lastBlockHeight int, lastBlockID BlockID, +func (b *Block) ValidateBasic(chainID string, lastBlockHeight uint64, lastBlockID BlockID, lastBlockTime time.Time, appHash []byte) error { if b.ChainID != chainID { return errors.New(cmn.Fmt("Wrong Block.Header.ChainID. Expected %v, got %v", chainID, b.ChainID)) @@ -158,7 +158,7 @@ func (b *Block) StringShort() string { // Header defines the structure of a Tendermint block header type Header struct { ChainID string `json:"chain_id"` - Height int `json:"height"` + Height uint64 `json:"height"` Time time.Time `json:"time"` NumTxs int `json:"num_txs"` // XXX: Can we get rid of this? LastBlockID BlockID `json:"last_block_id"` @@ -250,7 +250,7 @@ func (commit *Commit) FirstPrecommit() *Vote { } // Height returns the height of the commit -func (commit *Commit) Height() int { +func (commit *Commit) Height() uint64 { if len(commit.Precommits) == 0 { return 0 } diff --git a/types/canonical_json.go b/types/canonical_json.go index 5f1a0aca..f50c5461 100644 --- a/types/canonical_json.go +++ b/types/canonical_json.go @@ -18,7 +18,7 @@ type CanonicalJSONPartSetHeader struct { type CanonicalJSONProposal struct { BlockPartsHeader CanonicalJSONPartSetHeader `json:"block_parts_header"` - Height int `json:"height"` + Height uint64 `json:"height"` POLBlockID CanonicalJSONBlockID `json:"pol_block_id"` POLRound int `json:"pol_round"` Round int `json:"round"` @@ -26,13 +26,13 @@ type CanonicalJSONProposal struct { type CanonicalJSONVote struct { BlockID CanonicalJSONBlockID `json:"block_id"` - Height int `json:"height"` + Height uint64 `json:"height"` Round int `json:"round"` Type byte `json:"type"` } type CanonicalJSONHeartbeat struct { - Height int `json:"height"` + Height uint64 `json:"height"` Round int `json:"round"` Sequence int `json:"sequence"` ValidatorAddress data.Bytes `json:"validator_address"` diff --git a/types/events.go b/types/events.go index 9bf7a5a4..7d161540 100644 --- a/types/events.go +++ b/types/events.go @@ -118,7 +118,7 @@ type EventDataProposalHeartbeat struct { // NOTE: This goes into the replay WAL type EventDataRoundState struct { - Height int `json:"height"` + Height uint64 `json:"height"` Round int `json:"round"` Step string `json:"step"` diff --git a/types/heartbeat.go b/types/heartbeat.go index 64676ea6..8d825453 100644 --- a/types/heartbeat.go +++ b/types/heartbeat.go @@ -18,7 +18,7 @@ import ( type Heartbeat struct { ValidatorAddress data.Bytes `json:"validator_address"` ValidatorIndex int `json:"validator_index"` - Height int `json:"height"` + Height uint64 `json:"height"` Round int `json:"round"` Sequence int `json:"sequence"` Signature crypto.Signature `json:"signature"` diff --git a/types/priv_validator.go b/types/priv_validator.go index 8834eb7c..493efa26 100644 --- a/types/priv_validator.go +++ b/types/priv_validator.go @@ -51,7 +51,7 @@ type PrivValidator interface { type PrivValidatorFS struct { Address data.Bytes `json:"address"` PubKey crypto.PubKey `json:"pub_key"` - LastHeight int `json:"last_height"` + LastHeight uint64 `json:"last_height"` LastRound int `json:"last_round"` LastStep int8 `json:"last_step"` LastSignature crypto.Signature `json:"last_signature,omitempty"` // so we dont lose signatures @@ -222,7 +222,7 @@ func (privVal *PrivValidatorFS) SignProposal(chainID string, proposal *Proposal) // signBytesHRS signs the given signBytes if the height/round/step (HRS) // are greater than the latest state. If the HRS are equal, // it returns the privValidator.LastSignature. -func (privVal *PrivValidatorFS) signBytesHRS(height, round int, step int8, signBytes []byte) (crypto.Signature, error) { +func (privVal *PrivValidatorFS) signBytesHRS(height uint64, round int, step int8, signBytes []byte) (crypto.Signature, error) { sig := crypto.Signature{} // If height regression, err diff --git a/types/priv_validator_test.go b/types/priv_validator_test.go index cd2dfc13..4e1636c0 100644 --- a/types/priv_validator_test.go +++ b/types/priv_validator_test.go @@ -20,7 +20,7 @@ func TestGenLoadValidator(t *testing.T) { _, tempFilePath := cmn.Tempfile("priv_validator_") privVal := GenPrivValidatorFS(tempFilePath) - height := 100 + height := uint64(100) privVal.LastHeight = height privVal.Save() addr := privVal.GetAddress() @@ -99,7 +99,7 @@ func TestSignVote(t *testing.T) { block1 := BlockID{[]byte{1, 2, 3}, PartSetHeader{}} block2 := BlockID{[]byte{3, 2, 1}, PartSetHeader{}} - height, round := 10, 1 + height, round := uint64(10), 1 voteType := VoteTypePrevote // sign a vote for first time @@ -133,7 +133,7 @@ func TestSignProposal(t *testing.T) { block1 := PartSetHeader{5, []byte{1, 2, 3}} block2 := PartSetHeader{10, []byte{3, 2, 1}} - height, round := 10, 1 + height, round := uint64(10), 1 // sign a proposal for first time proposal := newProposal(height, round, block1) @@ -158,7 +158,7 @@ func TestSignProposal(t *testing.T) { } } -func newVote(addr data.Bytes, idx, height, round int, typ byte, blockID BlockID) *Vote { +func newVote(addr data.Bytes, idx int, height uint64, round int, typ byte, blockID BlockID) *Vote { return &Vote{ ValidatorAddress: addr, ValidatorIndex: idx, @@ -169,7 +169,7 @@ func newVote(addr data.Bytes, idx, height, round int, typ byte, blockID BlockID) } } -func newProposal(height, round int, partsHeader PartSetHeader) *Proposal { +func newProposal(height uint64, round int, partsHeader PartSetHeader) *Proposal { return &Proposal{ Height: height, Round: round, diff --git a/types/proposal.go b/types/proposal.go index 8efa91b6..21e169b5 100644 --- a/types/proposal.go +++ b/types/proposal.go @@ -20,7 +20,7 @@ var ( // to be considered valid. It may depend on votes from a previous round, // a so-called Proof-of-Lock (POL) round, as noted in the POLRound and POLBlockID. type Proposal struct { - Height int `json:"height"` + Height uint64 `json:"height"` Round int `json:"round"` BlockPartsHeader PartSetHeader `json:"block_parts_header"` POLRound int `json:"pol_round"` // -1 if null. @@ -30,7 +30,7 @@ type Proposal struct { // NewProposal returns a new Proposal. // If there is no POLRound, polRound should be -1. -func NewProposal(height int, round int, blockPartsHeader PartSetHeader, polRound int, polBlockID BlockID) *Proposal { +func NewProposal(height uint64, round int, blockPartsHeader PartSetHeader, polRound int, polBlockID BlockID) *Proposal { return &Proposal{ Height: height, Round: round, diff --git a/types/services.go b/types/services.go index f025de79..a7d39172 100644 --- a/types/services.go +++ b/types/services.go @@ -25,10 +25,10 @@ type Mempool interface { Size() int CheckTx(Tx, func(*abci.Response)) error Reap(int) Txs - Update(height int, txs Txs) error + Update(height uint64, txs Txs) error Flush() - TxsAvailable() <-chan int + TxsAvailable() <-chan uint64 EnableTxsAvailable() } @@ -42,9 +42,9 @@ func (m MockMempool) Unlock() {} func (m MockMempool) Size() int { return 0 } func (m MockMempool) CheckTx(tx Tx, cb func(*abci.Response)) error { return nil } func (m MockMempool) Reap(n int) Txs { return Txs{} } -func (m MockMempool) Update(height int, txs Txs) error { return nil } +func (m MockMempool) Update(height uint64, txs Txs) error { return nil } func (m MockMempool) Flush() {} -func (m MockMempool) TxsAvailable() <-chan int { return make(chan int) } +func (m MockMempool) TxsAvailable() <-chan uint64 { return make(chan uint64) } func (m MockMempool) EnableTxsAvailable() {} //------------------------------------------------------ @@ -53,14 +53,14 @@ func (m MockMempool) EnableTxsAvailable() {} // BlockStoreRPC is the block store interface used by the RPC. // UNSTABLE type BlockStoreRPC interface { - Height() int + Height() uint64 - LoadBlockMeta(height int) *BlockMeta - LoadBlock(height int) *Block - LoadBlockPart(height int, index int) *Part + LoadBlockMeta(height uint64) *BlockMeta + LoadBlock(height uint64) *Block + LoadBlockPart(height uint64, index int) *Part - LoadBlockCommit(height int) *Commit - LoadSeenCommit(height int) *Commit + LoadBlockCommit(height uint64) *Commit + LoadSeenCommit(height uint64) *Commit } // BlockStore defines the BlockStore interface. diff --git a/types/validator_set.go b/types/validator_set.go index 60376a32..97e12ce9 100644 --- a/types/validator_set.go +++ b/types/validator_set.go @@ -223,7 +223,7 @@ func (valSet *ValidatorSet) Iterate(fn func(index int, val *Validator) bool) { } // Verify that +2/3 of the set had signed the given signBytes -func (valSet *ValidatorSet) VerifyCommit(chainID string, blockID BlockID, height int, commit *Commit) error { +func (valSet *ValidatorSet) VerifyCommit(chainID string, blockID BlockID, height uint64, commit *Commit) error { if valSet.Size() != len(commit.Precommits) { return fmt.Errorf("Invalid commit -- wrong set size: %v vs %v", valSet.Size(), len(commit.Precommits)) } @@ -283,7 +283,7 @@ func (valSet *ValidatorSet) VerifyCommit(chainID string, blockID BlockID, height // * 10% of the valset can't just declare themselves kings // * If the validator set is 3x old size, we need more proof to trust func (valSet *ValidatorSet) VerifyCommitAny(newSet *ValidatorSet, chainID string, - blockID BlockID, height int, commit *Commit) error { + blockID BlockID, height uint64, commit *Commit) error { if newSet.Size() != len(commit.Precommits) { return errors.Errorf("Invalid commit -- wrong set size: %v vs %v", newSet.Size(), len(commit.Precommits)) diff --git a/types/vote.go b/types/vote.go index d5de6348..544cf67a 100644 --- a/types/vote.go +++ b/types/vote.go @@ -51,7 +51,7 @@ func IsVoteTypeValid(type_ byte) bool { type Vote struct { ValidatorAddress data.Bytes `json:"validator_address"` ValidatorIndex int `json:"validator_index"` - Height int `json:"height"` + Height uint64 `json:"height"` Round int `json:"round"` Type byte `json:"type"` BlockID BlockID `json:"block_id"` // zero if vote is nil. diff --git a/types/vote_set.go b/types/vote_set.go index 85a839db..579a7e9b 100644 --- a/types/vote_set.go +++ b/types/vote_set.go @@ -45,7 +45,7 @@ import ( */ type VoteSet struct { chainID string - height int + height uint64 round int type_ byte @@ -60,7 +60,7 @@ type VoteSet struct { } // Constructs a new VoteSet struct used to accumulate votes for given height/round. -func NewVoteSet(chainID string, height int, round int, type_ byte, valSet *ValidatorSet) *VoteSet { +func NewVoteSet(chainID string, height uint64, round int, type_ byte, valSet *ValidatorSet) *VoteSet { if height == 0 { cmn.PanicSanity("Cannot make VoteSet for height == 0, doesn't make sense.") } @@ -83,7 +83,7 @@ func (voteSet *VoteSet) ChainID() string { return voteSet.chainID } -func (voteSet *VoteSet) Height() int { +func (voteSet *VoteSet) Height() uint64 { if voteSet == nil { return 0 } else { @@ -523,7 +523,7 @@ func (vs *blockVotes) getByIndex(index int) *Vote { // Common interface between *consensus.VoteSet and types.Commit type VoteSetReader interface { - Height() int + Height() uint64 Round() int Type() byte Size() int diff --git a/types/vote_set_test.go b/types/vote_set_test.go index ebead3ee..713ebbf9 100644 --- a/types/vote_set_test.go +++ b/types/vote_set_test.go @@ -4,13 +4,13 @@ import ( "bytes" "testing" - "github.com/tendermint/go-crypto" + crypto "github.com/tendermint/go-crypto" cmn "github.com/tendermint/tmlibs/common" tst "github.com/tendermint/tmlibs/test" ) // NOTE: privValidators are in order -func randVoteSet(height int, round int, type_ byte, numValidators int, votingPower int64) (*VoteSet, *ValidatorSet, []*PrivValidatorFS) { +func randVoteSet(height uint64, round int, type_ byte, numValidators int, votingPower int64) (*VoteSet, *ValidatorSet, []*PrivValidatorFS) { valSet, privValidators := RandValidatorSet(numValidators, votingPower) return NewVoteSet("test_chain_id", height, round, type_, valSet), valSet, privValidators } @@ -24,7 +24,7 @@ func withValidator(vote *Vote, addr []byte, idx int) *Vote { } // Convenience: Return new vote with different height -func withHeight(vote *Vote, height int) *Vote { +func withHeight(vote *Vote, height uint64) *Vote { vote = vote.Copy() vote.Height = height return vote @@ -69,7 +69,7 @@ func signAddVote(privVal *PrivValidatorFS, vote *Vote, voteSet *VoteSet) (bool, } func TestAddVote(t *testing.T) { - height, round := 1, 0 + height, round := uint64(1), 0 voteSet, _, privValidators := randVoteSet(height, round, VoteTypePrevote, 10, 1) val0 := privValidators[0] @@ -112,7 +112,7 @@ func TestAddVote(t *testing.T) { } func Test2_3Majority(t *testing.T) { - height, round := 1, 0 + height, round := uint64(1), 0 voteSet, _, privValidators := randVoteSet(height, round, VoteTypePrevote, 10, 1) voteProto := &Vote{ @@ -164,7 +164,7 @@ func Test2_3Majority(t *testing.T) { } func Test2_3MajorityRedux(t *testing.T) { - height, round := 1, 0 + height, round := uint64(1), 0 voteSet, _, privValidators := randVoteSet(height, round, VoteTypePrevote, 100, 1) blockHash := crypto.CRandBytes(32) @@ -262,7 +262,7 @@ func Test2_3MajorityRedux(t *testing.T) { } func TestBadVotes(t *testing.T) { - height, round := 1, 0 + height, round := uint64(1), 0 voteSet, _, privValidators := randVoteSet(height, round, VoteTypePrevote, 10, 1) voteProto := &Vote{ @@ -321,7 +321,7 @@ func TestBadVotes(t *testing.T) { } func TestConflicts(t *testing.T) { - height, round := 1, 0 + height, round := uint64(1), 0 voteSet, _, privValidators := randVoteSet(height, round, VoteTypePrevote, 4, 1) blockHash1 := cmn.RandBytes(32) blockHash2 := cmn.RandBytes(32) @@ -450,7 +450,7 @@ func TestConflicts(t *testing.T) { } func TestMakeCommit(t *testing.T) { - height, round := 1, 0 + height, round := uint64(1), 0 voteSet, _, privValidators := randVoteSet(height, round, VoteTypePrecommit, 10, 1) blockHash, blockPartsHeader := crypto.CRandBytes(32), PartSetHeader{123, crypto.CRandBytes(32)}