abci++: synchronize PrepareProposal with the newest version of the spec (#8094)

This change implements the logic for the PrepareProposal ABCI++ method call. The main logic for creating and issuing the PrepareProposal request lives in execution.go and is tested in a set of new tests in execution_test.go. This change also updates the mempool mock to use a mockery generated version and removes much of the plumbing for the no longer used ABCIResponses.
This commit is contained in:
William Banfield
2022-03-15 15:37:30 -04:00
committed by GitHub
parent 4dce885994
commit 68c624f5de
36 changed files with 2895 additions and 834 deletions

View File

@@ -336,7 +336,7 @@ func TestCreateProposalBlock(t *testing.T) {
)
commit := types.NewCommit(height-1, 0, types.BlockID{}, nil)
block, _, err := blockExec.CreateProposalBlock(
block, err := blockExec.CreateProposalBlock(
ctx,
height,
state, commit,
@@ -415,7 +415,7 @@ func TestMaxTxsProposalBlockSize(t *testing.T) {
)
commit := types.NewCommit(height-1, 0, types.BlockID{}, nil)
block, _, err := blockExec.CreateProposalBlock(
block, err := blockExec.CreateProposalBlock(
ctx,
height,
state, commit,
@@ -497,10 +497,16 @@ func TestMaxProposalBlockSize(t *testing.T) {
},
}
// save the updated validator set for use by the block executor.
state.LastBlockHeight = math.MaxInt64 - 3
state.LastHeightValidatorsChanged = math.MaxInt64 - 1
state.NextValidators = state.Validators.Copy()
require.NoError(t, stateStore.Save(state))
timestamp := time.Date(math.MaxInt64, 0, 0, 0, 0, 0, math.MaxInt64, time.UTC)
// change state in order to produce the largest accepted header
state.LastBlockID = blockID
state.LastBlockHeight = math.MaxInt64 - 1
state.LastBlockHeight = math.MaxInt64 - 2
state.LastBlockTime = timestamp
state.LastResultsHash = tmhash.Sum([]byte("last_results_hash"))
state.AppHash = tmhash.Sum([]byte("app_hash"))
@@ -530,7 +536,7 @@ func TestMaxProposalBlockSize(t *testing.T) {
commit.Signatures = append(commit.Signatures, cs)
}
block, partSet, err := blockExec.CreateProposalBlock(
block, err := blockExec.CreateProposalBlock(
ctx,
math.MaxInt64,
state, commit,
@@ -538,6 +544,8 @@ func TestMaxProposalBlockSize(t *testing.T) {
nil,
)
require.NoError(t, err)
partSet, err := block.MakePartSet(types.BlockPartSizeBytes)
require.NoError(t, err)
// this ensures that the header is at max size
block.Header.Time = timestamp