github.com/aakash4dev/cometbft@v0.38.2/state/export_test.go (about) 1 package state 2 3 import ( 4 dbm "github.com/aakash4dev/cometbft-db" 5 6 abci "github.com/aakash4dev/cometbft/abci/types" 7 "github.com/aakash4dev/cometbft/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 resp *abci.ResponseFinalizeBlock, 30 validatorUpdates []*types.Validator, 31 ) (State, error) { 32 return updateState(state, blockID, header, resp, 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 // SaveValidatorsInfo is an alias for the private saveValidatorsInfo method in 42 // store.go, exported exclusively and explicitly for testing. 43 func SaveValidatorsInfo(db dbm.DB, height, lastHeightChanged int64, valSet *types.ValidatorSet) error { 44 stateStore := dbStore{db, StoreOptions{DiscardABCIResponses: false}} 45 return stateStore.saveValidatorsInfo(height, lastHeightChanged, valSet) 46 }