mirror of
https://github.com/tendermint/tendermint.git
synced 2026-09-11 18:46:12 +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:
@@ -4,8 +4,9 @@ package mocks
|
||||
|
||||
import (
|
||||
mock "github.com/stretchr/testify/mock"
|
||||
abcitypes "github.com/tendermint/tendermint/abci/types"
|
||||
|
||||
state "github.com/tendermint/tendermint/internal/state"
|
||||
tendermintstate "github.com/tendermint/tendermint/proto/tendermint/state"
|
||||
|
||||
types "github.com/tendermint/tendermint/types"
|
||||
)
|
||||
@@ -64,17 +65,15 @@ func (_m *Store) Load() (state.State, error) {
|
||||
return r0, r1
|
||||
}
|
||||
|
||||
// LoadABCIResponses provides a mock function with given fields: _a0
|
||||
func (_m *Store) LoadABCIResponses(_a0 int64) (*tendermintstate.ABCIResponses, error) {
|
||||
// LoadConsensusParams provides a mock function with given fields: _a0
|
||||
func (_m *Store) LoadConsensusParams(_a0 int64) (types.ConsensusParams, error) {
|
||||
ret := _m.Called(_a0)
|
||||
|
||||
var r0 *tendermintstate.ABCIResponses
|
||||
if rf, ok := ret.Get(0).(func(int64) *tendermintstate.ABCIResponses); ok {
|
||||
var r0 types.ConsensusParams
|
||||
if rf, ok := ret.Get(0).(func(int64) types.ConsensusParams); ok {
|
||||
r0 = rf(_a0)
|
||||
} else {
|
||||
if ret.Get(0) != nil {
|
||||
r0 = ret.Get(0).(*tendermintstate.ABCIResponses)
|
||||
}
|
||||
r0 = ret.Get(0).(types.ConsensusParams)
|
||||
}
|
||||
|
||||
var r1 error
|
||||
@@ -87,15 +86,17 @@ func (_m *Store) LoadABCIResponses(_a0 int64) (*tendermintstate.ABCIResponses, e
|
||||
return r0, r1
|
||||
}
|
||||
|
||||
// LoadConsensusParams provides a mock function with given fields: _a0
|
||||
func (_m *Store) LoadConsensusParams(_a0 int64) (types.ConsensusParams, error) {
|
||||
// LoadFinalizeBlockResponses provides a mock function with given fields: _a0
|
||||
func (_m *Store) LoadFinalizeBlockResponses(_a0 int64) (*abcitypes.ResponseFinalizeBlock, error) {
|
||||
ret := _m.Called(_a0)
|
||||
|
||||
var r0 types.ConsensusParams
|
||||
if rf, ok := ret.Get(0).(func(int64) types.ConsensusParams); ok {
|
||||
var r0 *abcitypes.ResponseFinalizeBlock
|
||||
if rf, ok := ret.Get(0).(func(int64) *abcitypes.ResponseFinalizeBlock); ok {
|
||||
r0 = rf(_a0)
|
||||
} else {
|
||||
r0 = ret.Get(0).(types.ConsensusParams)
|
||||
if ret.Get(0) != nil {
|
||||
r0 = ret.Get(0).(*abcitypes.ResponseFinalizeBlock)
|
||||
}
|
||||
}
|
||||
|
||||
var r1 error
|
||||
@@ -159,12 +160,12 @@ func (_m *Store) Save(_a0 state.State) error {
|
||||
return r0
|
||||
}
|
||||
|
||||
// SaveABCIResponses provides a mock function with given fields: _a0, _a1
|
||||
func (_m *Store) SaveABCIResponses(_a0 int64, _a1 *tendermintstate.ABCIResponses) error {
|
||||
// SaveFinalizeBlockResponses provides a mock function with given fields: _a0, _a1
|
||||
func (_m *Store) SaveFinalizeBlockResponses(_a0 int64, _a1 *abcitypes.ResponseFinalizeBlock) error {
|
||||
ret := _m.Called(_a0, _a1)
|
||||
|
||||
var r0 error
|
||||
if rf, ok := ret.Get(0).(func(int64, *tendermintstate.ABCIResponses) error); ok {
|
||||
if rf, ok := ret.Get(0).(func(int64, *abcitypes.ResponseFinalizeBlock) error); ok {
|
||||
r0 = rf(_a0, _a1)
|
||||
} else {
|
||||
r0 = ret.Error(0)
|
||||
|
||||
Reference in New Issue
Block a user