Browse Source

initial test for prepare proposal

wb/txrset
William Banfield 3 years ago
parent
commit
a3d8c7ed18
No known key found for this signature in database GPG Key ID: EFAD3442BF29E3AC
1 changed files with 29 additions and 0 deletions
  1. +29
    -0
      internal/state/execution_test.go

+ 29
- 0
internal/state/execution_test.go View File

@ -566,6 +566,35 @@ func TestFinalizeBlockValidatorUpdatesResultingInEmptySet(t *testing.T) {
assert.NotEmpty(t, state.NextValidators.Validators) 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 { func makeBlockID(hash []byte, partSetSize uint32, partSetHash []byte) types.BlockID {
var ( var (
h = make([]byte, tmhash.Size) h = make([]byte, tmhash.Size)


Loading…
Cancel
Save