abci: Synchronize FinalizeBlock with the updated specification (#7983)

This change set implements the most recent version of `FinalizeBlock`.

* This change set is rather large but fear not! The majority of the files touched and changes are renaming `ResponseDeliverTx` to `ExecTxResult`. This should be a pretty inoffensive change since they're effectively the same type but with a different name.
* The `execBlockOnProxyApp` was totally removed since it served as just a wrapper around the logic that is now mostly encapsulated within `FinalizeBlock`
* The `updateState` helper function has been made a public method on `State`. It was being exposed as a shim through the testing infrastructure, so this seemed innocuous.
* Tests already existed to ensure that the application received the `ByzantineValidators` and the `ValidatorUpdates`, but one was fixed up to ensure that `LastCommitInfo` was being sent across.
* Tests were removed from the `psql` indexer that seemed to search for an event in the indexer that was not being created.

* We store this [ABCIResponses](https://github.com/tendermint/tendermint/blob/5721a13ab1f4479f9807f449f0bf5c536b9a05f2/proto/tendermint/state/types.pb.go#L37) type in the data base as the block results. This type has changed since v0.35 to contain the `FinalizeBlock` response. I'm wondering if we need to do any shimming to keep the old data retrieveable?
* Similarly, this change is exposed via the RPC through [ResultBlockResults](https://github.com/tendermint/tendermint/blob/5721a13ab1f4479f9807f449f0bf5c536b9a05f2/rpc/coretypes/responses.go#L69) changing. Should we somehow shim or notify for this change?

closes: #7658
This commit is contained in:
William Banfield
2022-11-18 12:21:51 +01:00
committed by Sergio Mena
parent d3548eb706
commit 2c3c64e8a0
59 changed files with 433 additions and 579 deletions
+5 -5
View File
@@ -147,7 +147,7 @@ func (app *Application) CheckTx(req abci.RequestCheckTx) abci.ResponseCheckTx {
// FinalizeBlock implements ABCI.
func (app *Application) FinalizeBlock(req abci.RequestFinalizeBlock) abci.ResponseFinalizeBlock {
var txs = make([]*abci.ResponseDeliverTx, len(req.Txs))
var txs = make([]*abci.ExecTxResult, len(req.Txs))
for i, tx := range req.Txs {
key, value, err := parseTx(tx)
@@ -156,16 +156,16 @@ func (app *Application) FinalizeBlock(req abci.RequestFinalizeBlock) abci.Respon
}
app.state.Set(key, value)
txs[i] = &abci.ResponseDeliverTx{Code: code.CodeTypeOK}
txs[i] = &abci.ExecTxResult{Code: code.CodeTypeOK}
}
valUpdates, err := app.validatorUpdates(uint64(req.Height))
valUpdates, err := app.validatorUpdates(uint64(req.Header.Height))
if err != nil {
panic(err)
}
return abci.ResponseFinalizeBlock{
Txs: txs,
TxResults: txs,
ValidatorUpdates: valUpdates,
Events: []abci.Event{
{
@@ -177,7 +177,7 @@ func (app *Application) FinalizeBlock(req abci.RequestFinalizeBlock) abci.Respon
},
{
Key: "height",
Value: strconv.Itoa(int(req.Height)),
Value: strconv.Itoa(int(req.Header.Height)),
},
},
},