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

Function TestApplyBlock

state/execution_test.go:35–60  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

33)
34
35func TestApplyBlock(t *testing.T) {
36 app := &testApp{}
37 cc := proxy.NewLocalClientCreator(app)
38 proxyApp := proxy.NewAppConns(cc)
39 err := proxyApp.Start()
40 require.Nil(t, err)
41 defer proxyApp.Stop() //nolint:errcheck // ignore for tests
42
43 state, stateDB, _ := makeState(1, 1)
44 stateStore := sm.NewStore(stateDB, sm.StoreOptions{
45 DiscardABCIResponses: false,
46 })
47
48 blockExec := sm.NewBlockExecutor(stateStore, log.TestingLogger(), proxyApp.Consensus(),
49 mmock.Mempool{}, sm.EmptyEvidencePool{})
50
51 block := makeBlock(state, 1)
52 blockID := types.BlockID{Hash: block.Hash(), PartSetHeader: block.MakePartSet(testPartSize).Header()}
53
54 state, retainHeight, err := blockExec.ApplyBlock(state, blockID, block)
55 require.Nil(t, err)
56 assert.EqualValues(t, retainHeight, 1)
57
58 // TODO check state and mempool
59 assert.EqualValues(t, 1, state.Version.Consensus.App, "App version wasn't updated")
60}
61
62// TestBeginBlockValidators ensures we send absent validators list.
63func TestBeginBlockValidators(t *testing.T) {

Callers

nothing calls this directly

Calls 12

ConsensusMethod · 0.95
ApplyBlockMethod · 0.95
NewLocalClientCreatorFunction · 0.92
NewAppConnsFunction · 0.92
TestingLoggerFunction · 0.92
MakePartSetMethod · 0.80
makeStateFunction · 0.70
makeBlockFunction · 0.70
StartMethod · 0.65
StopMethod · 0.65
HashMethod · 0.65
HeaderMethod · 0.45

Tested by

no test coverage detected