From a3d8c7ed1832662c7ff44c15afe0744056b4fdcc Mon Sep 17 00:00:00 2001 From: William Banfield Date: Tue, 8 Mar 2022 12:38:42 -0500 Subject: [PATCH] initial test for prepare proposal --- internal/state/execution_test.go | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/internal/state/execution_test.go b/internal/state/execution_test.go index 451a9e2bb..700d0e73f 100644 --- a/internal/state/execution_test.go +++ b/internal/state/execution_test.go @@ -566,6 +566,35 @@ func TestFinalizeBlockValidatorUpdatesResultingInEmptySet(t *testing.T) { assert.NotEmpty(t, state.NextValidators.Validators) } +func TestEmptyPrepareProposal(t *testing.T) { + const height = 2 + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() + + app := abcimocks.NewBaseMock() + cc := abciclient.NewLocalCreator(app) + logger := log.TestingLogger() + proxyApp := proxy.NewAppConns(cc, logger, proxy.NopMetrics()) + err := proxyApp.Start(ctx) + require.NoError(t, err) + + state, stateDB, privVals := makeState(t, 1, height) + stateStore := sm.NewStore(stateDB) + + blockExec := sm.NewBlockExecutor( + stateStore, + logger, + proxyApp.Consensus(), + mmock.Mempool{}, + sm.EmptyEvidencePool{}, + nil, + ) + pa, _ := state.Validators.GetByIndex(0) + commit := makeValidCommit(ctx, t, height, types.BlockID{}, state.Validators, privVals) + _, err = blockExec.CreateProposalBlock(ctx, height, state, commit, pa, nil) + require.NoError(t, err) +} + func makeBlockID(hash []byte, partSetSize uint32, partSetHash []byte) types.BlockID { var ( h = make([]byte, tmhash.Size)