Completed the existing FinalizeBlock PR and rebased to master (#7798)

* Rebased and git-squashed the commits in PR #6546

migrate abci to finalizeBlock

work on abci, proxy and mempool

abciresponse, blok events, indexer, some tests

fix some tests

fix errors

fix errors in abci

fix tests amd errors

* Fixes after rebasing PR#6546

* Restored height to RequestFinalizeBlock & other

* Fixed more UTs

* Fixed kvstore

* More UT fixes

* last TC fixed

* make format

* Update internal/consensus/mempool_test.go

Co-authored-by: William Banfield <4561443+williambanfield@users.noreply.github.com>

* Addressed @williambanfield's comments

* Fixed UTs

* Addressed last comments from @williambanfield

* make format

Co-authored-by: marbar3778 <marbar3778@yahoo.com>
Co-authored-by: William Banfield <4561443+williambanfield@users.noreply.github.com>
This commit is contained in:
Sergio Mena
2022-02-14 23:41:28 +01:00
committed by GitHub
co-authored by William Banfield marbar3778
parent 7e09c2ef43
commit d3548eb706
103 changed files with 1932 additions and 3062 deletions
+1
View File
@@ -6,6 +6,7 @@ import (
"github.com/stretchr/testify/mock"
"github.com/stretchr/testify/require"
"github.com/tendermint/tendermint/crypto"
"github.com/tendermint/tendermint/crypto/ed25519"
"github.com/tendermint/tendermint/crypto/tmhash"
+5 -13
View File
@@ -446,27 +446,19 @@ func (c *Client) BlockResults(ctx context.Context, height *int64) (*coretypes.Re
return nil, err
}
// proto-encode BeginBlock events
bbeBytes, err := proto.Marshal(&abci.ResponseBeginBlock{
Events: res.BeginBlockEvents,
// proto-encode FinalizeBlock events
bbeBytes, err := proto.Marshal(&abci.ResponseFinalizeBlock{
Events: res.FinalizeBlockEvents,
})
if err != nil {
return nil, err
}
// Build a Merkle tree of proto-encoded DeliverTx results and get a hash.
// Build a Merkle tree of proto-encoded FinalizeBlock tx results and get a hash.
results := types.NewResults(res.TxsResults)
// proto-encode EndBlock events.
ebeBytes, err := proto.Marshal(&abci.ResponseEndBlock{
Events: res.EndBlockEvents,
})
if err != nil {
return nil, err
}
// Build a Merkle tree out of the above 3 binary slices.
rH := merkle.HashFromByteSlices([][]byte{bbeBytes, results.Hash(), ebeBytes})
rH := merkle.HashFromByteSlices([][]byte{bbeBytes, results.Hash()})
// Verify block results.
if !bytes.Equal(rH, trustedBlock.LastResultsHash) {