github.com/okex/exchain@v1.8.0/libs/tendermint/state/export_test.go (about)

     1  package state
     2  
     3  import (
     4  	dbm "github.com/okex/exchain/libs/tm-db"
     5  
     6  	abci "github.com/okex/exchain/libs/tendermint/abci/types"
     7  	"github.com/okex/exchain/libs/tendermint/types"
     8  )
     9  
    10  //
    11  // TODO: Remove dependence on all entities exported from this file.
    12  //
    13  // Every entity exported here is dependent on a private entity from the `state`
    14  // package. Currently, these functions are only made available to tests in the
    15  // `state_test` package, but we should not be relying on them for our testing.
    16  // Instead, we should be exclusively relying on exported entities for our
    17  // testing, and should be refactoring exported entities to make them more
    18  // easily testable from outside of the package.
    19  //
    20  
    21  const ValSetCheckpointInterval = valSetCheckpointInterval
    22  
    23  // UpdateState is an alias for updateState exported from execution.go,
    24  // exclusively and explicitly for testing.
    25  func UpdateState(
    26  	state State,
    27  	blockID types.BlockID,
    28  	header *types.Header,
    29  	abciResponses *ABCIResponses,
    30  	validatorUpdates []*types.Validator,
    31  ) (State, error) {
    32  	return updateState(state, blockID, header, abciResponses, validatorUpdates)
    33  }
    34  
    35  // ValidateValidatorUpdates is an alias for validateValidatorUpdates exported
    36  // from execution.go, exclusively and explicitly for testing.
    37  func ValidateValidatorUpdates(abciUpdates []abci.ValidatorUpdate, params types.ValidatorParams) error {
    38  	return validateValidatorUpdates(abciUpdates, params)
    39  }
    40  
    41  // SaveConsensusParamsInfo is an alias for the private saveConsensusParamsInfo
    42  // method in store.go, exported exclusively and explicitly for testing.
    43  func SaveConsensusParamsInfo(db dbm.DB, nextHeight, changeHeight int64, params types.ConsensusParams) {
    44  	saveConsensusParamsInfo(db, nextHeight, changeHeight, params)
    45  }
    46  
    47  // SaveValidatorsInfo is an alias for the private saveValidatorsInfo method in
    48  // store.go, exported exclusively and explicitly for testing.
    49  func SaveValidatorsInfo(db dbm.DB, height, lastHeightChanged int64, valSet *types.ValidatorSet) {
    50  	saveValidatorsInfo(db, height, lastHeightChanged, valSet)
    51  }