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