state: proto migration (#4972)

## Description

the second part of state proto migration

Closes: #XXX
This commit is contained in:
Marko
2020-06-08 12:16:35 +02:00
committed by GitHub
parent bd950c16ea
commit 7a8224f8a3
15 changed files with 335 additions and 147 deletions

View File

@@ -11,6 +11,7 @@ import (
"github.com/tendermint/tendermint/libs/fail"
"github.com/tendermint/tendermint/libs/log"
mempl "github.com/tendermint/tendermint/mempool"
tmstate "github.com/tendermint/tendermint/proto/state"
tmproto "github.com/tendermint/tendermint/proto/types"
"github.com/tendermint/tendermint/proxy"
"github.com/tendermint/tendermint/types"
@@ -252,11 +253,13 @@ func execBlockOnProxyApp(
proxyAppConn proxy.AppConnConsensus,
block *types.Block,
stateDB dbm.DB,
) (*ABCIResponses, error) {
) (*tmstate.ABCIResponses, error) {
var validTxs, invalidTxs = 0, 0
txIndex := 0
abciResponses := NewABCIResponses(block)
abciResponses := new(tmstate.ABCIResponses)
dtxs := make([]*abci.ResponseDeliverTx, len(block.Txs))
abciResponses.DeliverTxs = dtxs
// Execute transactions and get hash.
proxyCb := func(req *abci.Request, res *abci.Response) {
@@ -391,7 +394,7 @@ func updateState(
state State,
blockID types.BlockID,
header *types.Header,
abciResponses *ABCIResponses,
abciResponses *tmstate.ABCIResponses,
validatorUpdates []*types.Validator,
) (State, error) {
@@ -444,7 +447,7 @@ func updateState(
LastHeightValidatorsChanged: lastHeightValsChanged,
ConsensusParams: nextParams,
LastHeightConsensusParamsChanged: lastHeightParamsChanged,
LastResultsHash: abciResponses.ResultsHash(),
LastResultsHash: ABCIResponsesResultsHash(*abciResponses),
AppHash: nil,
}, nil
}
@@ -456,7 +459,7 @@ func fireEvents(
logger log.Logger,
eventBus types.BlockEventPublisher,
block *types.Block,
abciResponses *ABCIResponses,
abciResponses *tmstate.ABCIResponses,
validatorUpdates []*types.Validator,
) {
eventBus.PublishEventNewBlock(types.EventDataNewBlock{