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