MCPcopy Create free account
hub / github.com/DeAI-Artist/Linkis / setupStateStore

Function setupStateStore

state/rollback_test.go:120–150  ·  view source on GitHub ↗
(t *testing.T, height int64)

Source from the content-addressed store, hash-verified

118}
119
120func setupStateStore(t *testing.T, height int64) state.Store {
121 stateStore := state.NewStore(dbm.NewMemDB(), state.StoreOptions{DiscardABCIResponses: false})
122 valSet, _ := types.RandValidatorSet(5, 10)
123
124 params := types.DefaultConsensusParams()
125 params.Version.AppVersion = 10
126
127 initialState := state.State{
128 Version: tmstate.Version{
129 Consensus: tmversion.Consensus{
130 Block: version.BlockProtocol,
131 App: 10,
132 },
133 Software: version.TMCoreSemVer,
134 },
135 ChainID: "test-chain",
136 InitialHeight: 10,
137 LastBlockID: makeBlockIDRandom(),
138 AppHash: tmhash.Sum([]byte("app_hash")),
139 LastResultsHash: tmhash.Sum([]byte("last_results_hash")),
140 LastBlockHeight: height,
141 LastValidators: valSet,
142 Validators: valSet.CopyIncrementProposerPriority(1),
143 NextValidators: valSet.CopyIncrementProposerPriority(2),
144 LastHeightValidatorsChanged: height + 1,
145 ConsensusParams: *params,
146 LastHeightConsensusParamsChanged: height + 1,
147 }
148 require.NoError(t, stateStore.Bootstrap(initialState))
149 return stateStore
150}
151
152func makeBlockIDRandom() types.BlockID {
153 var (

Callers 3

TestRollbackFunction · 0.85
TestRollbackNoBlocksFunction · 0.85

Calls 7

BootstrapMethod · 0.95
NewStoreFunction · 0.92
RandValidatorSetFunction · 0.92
DefaultConsensusParamsFunction · 0.92
SumFunction · 0.92
makeBlockIDRandomFunction · 0.70

Tested by

no test coverage detected