apply the renames to LastCommitInfo

This commit is contained in:
William Banfield
2022-03-04 16:21:27 -05:00
parent b6a42d5d4e
commit ab9963acb3
4 changed files with 270 additions and 268 deletions
+6 -6
View File
@@ -162,7 +162,7 @@ func (blockExec *BlockExecutor) ProcessProposal(
Hash: block.Header.Hash(),
Header: *block.Header.ToProto(),
Txs: block.Data.Txs.ToSliceOfBytes(),
LastCommitInfo: buildLastCommitInfo(block, blockExec.store, state.InitialHeight),
ProposedLastCommit: buildLastCommitInfo(block, blockExec.store, state.InitialHeight),
ByzantineValidators: block.Evidence.ToABCI(),
}
@@ -220,7 +220,7 @@ func (blockExec *BlockExecutor) ApplyBlock(
Hash: block.Hash(),
Header: *pbh,
Txs: block.Txs.ToSliceOfBytes(),
LastCommitInfo: buildLastCommitInfo(block, blockExec.store, state.InitialHeight),
DecidedLastCommit: buildLastCommitInfo(block, blockExec.store, state.InitialHeight),
ByzantineValidators: block.Evidence.ToABCI(),
},
)
@@ -374,11 +374,11 @@ func (blockExec *BlockExecutor) Commit(
return res.Data, res.RetainHeight, err
}
func buildLastCommitInfo(block *types.Block, store Store, initialHeight int64) abci.LastCommitInfo {
func buildLastCommitInfo(block *types.Block, store Store, initialHeight int64) abci.CommitInfo {
if block.Height == initialHeight {
// there is no last commmit for the initial height.
// return an empty value.
return abci.LastCommitInfo{}
return abci.CommitInfo{}
}
lastValSet, err := store.LoadValidators(block.Height - 1)
@@ -409,7 +409,7 @@ func buildLastCommitInfo(block *types.Block, store Store, initialHeight int64) a
}
}
return abci.LastCommitInfo{
return abci.CommitInfo{
Round: block.LastCommit.Round,
Votes: votes,
}
@@ -594,7 +594,7 @@ func ExecCommitBlock(
Hash: block.Hash(),
Header: *pbh,
Txs: block.Txs.ToSliceOfBytes(),
LastCommitInfo: buildLastCommitInfo(block, store, initialHeight),
DecidedLastCommit: buildLastCommitInfo(block, store, initialHeight),
ByzantineValidators: block.Evidence.ToABCI(),
},
)
+4 -4
View File
@@ -67,10 +67,10 @@ func TestApplyBlock(t *testing.T) {
assert.EqualValues(t, 1, state.Version.Consensus.App, "App version wasn't updated")
}
// TestFinalizeBlockLastCommitInfo ensures we correctly send the LastCommitInfo to the
// application. The test ensures that the LastCommitInfo properly reflects
// TestFinalizeBlockDecidedLastCommit ensures we correctly send the DecidedLastCommit to the
// application. The test ensures that the DecidedLastCommit properly reflects
// which validators signed the preceding block.
func TestFinalizeBlockLastCommitInfo(t *testing.T) {
func TestFinalizeBlockDecidedLastCommit(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
@@ -291,7 +291,7 @@ func TestProcessProposal(t *testing.T) {
Header: *block1.Header.ToProto(),
Txs: block1.Txs.ToSliceOfBytes(),
ByzantineValidators: block1.Evidence.ToABCI(),
LastCommitInfo: abci.LastCommitInfo{
ProposedLastCommit: abci.CommitInfo{
Round: 0,
Votes: voteInfos,
},
+1 -1
View File
@@ -293,7 +293,7 @@ func (app *testApp) Info(req abci.RequestInfo) (resInfo abci.ResponseInfo) {
}
func (app *testApp) FinalizeBlock(req abci.RequestFinalizeBlock) abci.ResponseFinalizeBlock {
app.CommitVotes = req.LastCommitInfo.Votes
app.CommitVotes = req.DecidedLastCommit.Votes
app.ByzantineValidators = req.ByzantineValidators
resTxs := make([]*abci.ExecTxResult, len(req.Txs))