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