mirror of
https://github.com/tendermint/tendermint.git
synced 2026-01-08 06:15:33 +00:00
Remove the abci responses type - prune legacy responses (#8673)
Closes #8069 * Type `ABCIResponses` was just wrapping type `ResponseFinalizeBlock`. This patch removes the former. * Did some renaming to avoid confusion on the data structure we are working with. * We also remove any stale ABCIResponses we may have in the state store at the time of pruning **IMPORTANT**: There is an undesirable side-effect of the unwrapping. An empty `ResponseFinalizeBlock` yields a 0-length proto-buf serialized buffer. This was not the case with `ABCIResponses`. I have added an interim solution, but open for suggestions on more elegant ones.
This commit is contained in:
@@ -14,7 +14,6 @@ import (
|
||||
"github.com/tendermint/tendermint/internal/eventbus"
|
||||
"github.com/tendermint/tendermint/internal/mempool"
|
||||
"github.com/tendermint/tendermint/libs/log"
|
||||
tmstate "github.com/tendermint/tendermint/proto/tendermint/state"
|
||||
tmtypes "github.com/tendermint/tendermint/proto/tendermint/types"
|
||||
"github.com/tendermint/tendermint/types"
|
||||
)
|
||||
@@ -233,12 +232,11 @@ func (blockExec *BlockExecutor) ApplyBlock(
|
||||
"block_app_hash", fmt.Sprintf("%X", fBlockRes.AppHash),
|
||||
)
|
||||
|
||||
abciResponses := &tmstate.ABCIResponses{
|
||||
FinalizeBlock: fBlockRes,
|
||||
}
|
||||
|
||||
// Save the results before we commit.
|
||||
if err := blockExec.store.SaveABCIResponses(block.Height, abciResponses); err != nil {
|
||||
err = blockExec.store.SaveFinalizeBlockResponses(block.Height, fBlockRes)
|
||||
if err != nil && !errors.Is(err, ErrNoFinalizeBlockResponsesForHeight{block.Height}) {
|
||||
// It is correct to have an empty ResponseFinalizeBlock for ApplyBlock,
|
||||
// but not for saving it to the state store
|
||||
return state, err
|
||||
}
|
||||
|
||||
@@ -538,7 +536,7 @@ func (state State) Update(
|
||||
// and update s.LastValidators and s.Validators.
|
||||
nValSet := state.NextValidators.Copy()
|
||||
|
||||
// Update the validator set with the latest abciResponses.
|
||||
// Update the validator set with the latest responses to FinalizeBlock.
|
||||
lastHeightValsChanged := state.LastHeightValidatorsChanged
|
||||
if len(validatorUpdates) > 0 {
|
||||
err := nValSet.UpdateWithChangeSet(validatorUpdates)
|
||||
@@ -552,7 +550,7 @@ func (state State) Update(
|
||||
// Update validator proposer priority and set state variables.
|
||||
nValSet.IncrementProposerPriority(1)
|
||||
|
||||
// Update the params with the latest abciResponses.
|
||||
// Update the params with the latest responses to FinalizeBlock.
|
||||
nextParams := state.ConsensusParams
|
||||
lastHeightParamsChanged := state.LastHeightConsensusParamsChanged
|
||||
if consensusParamUpdates != nil {
|
||||
|
||||
Reference in New Issue
Block a user