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:
Sergio Mena
2022-06-02 19:13:08 +00:00
committed by GitHub
parent 08099ff669
commit ce6485fa70
21 changed files with 293 additions and 461 deletions
+6 -3
View File
@@ -1979,7 +1979,8 @@ func TestFinalizeBlockCalled(t *testing.T) {
Status: abci.ResponseVerifyVoteExtension_ACCEPT,
}, nil)
}
m.On("FinalizeBlock", mock.Anything, mock.Anything).Return(&abci.ResponseFinalizeBlock{}, nil).Maybe()
r := &abci.ResponseFinalizeBlock{AppHash: []byte("the_hash")}
m.On("FinalizeBlock", mock.Anything, mock.Anything).Return(r, nil).Maybe()
m.On("Commit", mock.Anything).Return(&abci.ResponseCommit{}, nil).Maybe()
cs1, vss := makeState(ctx, t, makeStateArgs{config: config, application: m})
@@ -2060,7 +2061,8 @@ func TestExtendVoteCalledWhenEnabled(t *testing.T) {
}, nil)
}
m.On("Commit", mock.Anything).Return(&abci.ResponseCommit{}, nil).Maybe()
m.On("FinalizeBlock", mock.Anything, mock.Anything).Return(&abci.ResponseFinalizeBlock{}, nil).Maybe()
r := &abci.ResponseFinalizeBlock{AppHash: []byte("myHash")}
m.On("FinalizeBlock", mock.Anything, mock.Anything).Return(r, nil).Maybe()
c := factory.ConsensusParams()
if !testCase.enabled {
c.ABCI.VoteExtensionsEnableHeight = 0
@@ -2357,7 +2359,8 @@ func TestVoteExtensionEnableHeight(t *testing.T) {
Status: abci.ResponseVerifyVoteExtension_ACCEPT,
}, nil).Times(numValidators - 1)
}
m.On("FinalizeBlock", mock.Anything, mock.Anything).Return(&abci.ResponseFinalizeBlock{}, nil).Maybe()
r := &abci.ResponseFinalizeBlock{AppHash: []byte("hashyHash")}
m.On("FinalizeBlock", mock.Anything, mock.Anything).Return(r, nil).Maybe()
m.On("Commit", mock.Anything).Return(&abci.ResponseCommit{}, nil).Maybe()
c := factory.ConsensusParams()
c.ABCI.VoteExtensionsEnableHeight = testCase.enableHeight