Browse Source

internal/libs: delete unused functionality (#7569)

pull/7577/head
Sam Kleinman 3 years ago
committed by GitHub
parent
commit
25e665df17
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 0 additions and 75 deletions
  1. +0
    -19
      internal/consensus/state.go
  2. +0
    -40
      internal/libs/fail/fail.go
  3. +0
    -7
      internal/libs/timer/throttle_timer.go
  4. +0
    -9
      internal/state/execution.go

+ 0
- 19
internal/consensus/state.go View File

@ -18,7 +18,6 @@ import (
"github.com/tendermint/tendermint/crypto"
cstypes "github.com/tendermint/tendermint/internal/consensus/types"
"github.com/tendermint/tendermint/internal/eventbus"
"github.com/tendermint/tendermint/internal/libs/fail"
sm "github.com/tendermint/tendermint/internal/state"
tmevents "github.com/tendermint/tendermint/libs/events"
"github.com/tendermint/tendermint/libs/log"
@ -866,14 +865,6 @@ func (cs *State) receiveRoutine(ctx context.Context, maxSteps int) {
))
}
if _, ok := mi.Msg.(*VoteMessage); ok {
// we actually want to simulate failing during
// the previous WriteSync, but this isn't easy to do.
// Equivalent would be to fail here and manually remove
// some bytes from the end of the wal.
fail.Fail() // XXX
}
// handles proposals, block parts, votes
cs.handleMsg(ctx, mi)
@ -1705,8 +1696,6 @@ func (cs *State) finalizeCommit(ctx context.Context, height int64) {
)
logger.Debug(fmt.Sprintf("%v", block))
fail.Fail() // XXX
// Save to blockStore.
if cs.blockStore.Height() < block.Height {
// NOTE: the seenCommit is local justification to commit this block,
@ -1719,8 +1708,6 @@ func (cs *State) finalizeCommit(ctx context.Context, height int64) {
logger.Debug("calling finalizeCommit on already stored block", "height", block.Height)
}
fail.Fail() // XXX
// Write EndHeightMessage{} for this height, implying that the blockstore
// has saved the block.
//
@ -1742,8 +1729,6 @@ func (cs *State) finalizeCommit(ctx context.Context, height int64) {
))
}
fail.Fail() // XXX
// Create a copy of the state for staging and an event cache for txs.
stateCopy := cs.state.Copy()
@ -1762,16 +1747,12 @@ func (cs *State) finalizeCommit(ctx context.Context, height int64) {
return
}
fail.Fail() // XXX
// must be called before we update state
cs.RecordMetrics(height, block)
// NewHeightStep!
cs.updateToState(ctx, stateCopy)
fail.Fail() // XXX
// Private validator might have changed it's key pair => refetch pubkey.
if err := cs.updatePrivValidatorPubKey(ctx); err != nil {
logger.Error("failed to get private validator pubkey", "err", err)


+ 0
- 40
internal/libs/fail/fail.go View File

@ -1,40 +0,0 @@
package fail
import (
"fmt"
"os"
"strconv"
)
func envSet() int {
callIndexToFailS := os.Getenv("FAIL_TEST_INDEX")
if callIndexToFailS == "" {
return -1
}
var err error
callIndexToFail, err := strconv.Atoi(callIndexToFailS)
if err != nil {
return -1
}
return callIndexToFail
}
// Fail when FAIL_TEST_INDEX == callIndex
var callIndex int // indexes Fail calls
func Fail() {
callIndexToFail := envSet()
if callIndexToFail < 0 {
return
}
if callIndex == callIndexToFail {
fmt.Printf("*** fail-test %d ***\n", callIndex)
os.Exit(1)
}
callIndex++
}

+ 0
- 7
internal/libs/timer/throttle_timer.go View File

@ -55,13 +55,6 @@ func (t *ThrottleTimer) Set() {
}
}
func (t *ThrottleTimer) Unset() {
t.mtx.Lock()
defer t.mtx.Unlock()
t.isSet = false
t.timer.Stop()
}
// For ease of .Stop()'ing services before .Start()'ing them,
// we ignore .Stop()'s on nil ThrottleTimers
func (t *ThrottleTimer) Stop() bool {


+ 0
- 9
internal/state/execution.go View File

@ -9,7 +9,6 @@ import (
abci "github.com/tendermint/tendermint/abci/types"
"github.com/tendermint/tendermint/crypto/encoding"
"github.com/tendermint/tendermint/internal/eventbus"
"github.com/tendermint/tendermint/internal/libs/fail"
"github.com/tendermint/tendermint/internal/mempool"
"github.com/tendermint/tendermint/internal/proxy"
"github.com/tendermint/tendermint/libs/log"
@ -171,15 +170,11 @@ func (blockExec *BlockExecutor) ApplyBlock(
return state, ErrProxyAppConn(err)
}
fail.Fail() // XXX
// Save the results before we commit.
if err := blockExec.store.SaveABCIResponses(block.Height, abciResponses); err != nil {
return state, err
}
fail.Fail() // XXX
// validate the validator updates and convert to tendermint types
abciValUpdates := abciResponses.EndBlock.ValidatorUpdates
err = validateValidatorUpdates(abciValUpdates, state.ConsensusParams.Validator)
@ -210,16 +205,12 @@ func (blockExec *BlockExecutor) ApplyBlock(
// Update evpool with the latest state.
blockExec.evpool.Update(state, block.Evidence.Evidence)
fail.Fail() // XXX
// Update the app hash and save the state.
state.AppHash = appHash
if err := blockExec.store.Save(state); err != nil {
return state, err
}
fail.Fail() // XXX
// Prune old heights, if requested by ABCI app.
if retainHeight > 0 {
pruned, err := blockExec.pruneBlocks(retainHeight)


Loading…
Cancel
Save