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 21:13:08 +02:00
committed by GitHub
parent 08099ff669
commit ce6485fa70
21 changed files with 293 additions and 461 deletions

View File

@@ -151,8 +151,10 @@ where example.file looks something like:
check_tx 0x00
check_tx 0xff
finalize_block 0x00
commit
check_tx 0x00
finalize_block 0x01 0x04 0xff
commit
info
`,
Args: cobra.ExactArgs(0),

View File

@@ -193,7 +193,7 @@ func eventReIndex(cmd *cobra.Command, args eventReIndexArgs) error {
return fmt.Errorf("not able to load block at height %d from the blockstore", i)
}
r, err := args.stateStore.LoadABCIResponses(i)
r, err := args.stateStore.LoadFinalizeBlockResponses(i)
if err != nil {
return fmt.Errorf("not able to load ABCI Response at height %d from the statestore", i)
}
@@ -201,7 +201,7 @@ func eventReIndex(cmd *cobra.Command, args eventReIndexArgs) error {
e := types.EventDataNewBlockHeader{
Header: b.Header,
NumTxs: int64(len(b.Txs)),
ResultFinalizeBlock: *r.FinalizeBlock,
ResultFinalizeBlock: *r,
}
var batch *indexer.Batch
@@ -213,7 +213,7 @@ func eventReIndex(cmd *cobra.Command, args eventReIndexArgs) error {
Height: b.Height,
Index: uint32(i),
Tx: b.Data.Txs[i],
Result: *(r.FinalizeBlock.TxResults[i]),
Result: *(r.TxResults[i]),
}
_ = batch.Add(&tr)

View File

@@ -16,7 +16,6 @@ import (
"github.com/tendermint/tendermint/internal/state/indexer"
"github.com/tendermint/tendermint/internal/state/mocks"
"github.com/tendermint/tendermint/libs/log"
prototmstate "github.com/tendermint/tendermint/proto/tendermint/state"
"github.com/tendermint/tendermint/types"
_ "github.com/lib/pq" // for the psql sink
@@ -154,16 +153,14 @@ func TestReIndexEvent(t *testing.T) {
On("IndexTxEvents", mock.AnythingOfType("[]*types.TxResult")).Return(nil)
dtx := abcitypes.ExecTxResult{}
abciResp := &prototmstate.ABCIResponses{
FinalizeBlock: &abcitypes.ResponseFinalizeBlock{
TxResults: []*abcitypes.ExecTxResult{&dtx},
},
abciResp := &abcitypes.ResponseFinalizeBlock{
TxResults: []*abcitypes.ExecTxResult{&dtx},
}
mockStateStore.
On("LoadABCIResponses", base).Return(nil, errors.New("")).Once().
On("LoadABCIResponses", base).Return(abciResp, nil).
On("LoadABCIResponses", height).Return(abciResp, nil)
On("LoadFinalizeBlockResponses", base).Return(nil, errors.New("")).Once().
On("LoadFinalizeBlockResponses", base).Return(abciResp, nil).
On("LoadFinalizeBlockResponses", height).Return(abciResp, nil)
testCases := []struct {
startHeight int64
@@ -171,7 +168,7 @@ func TestReIndexEvent(t *testing.T) {
reIndexErr bool
}{
{base, height, true}, // LoadBlock error
{base, height, true}, // LoadABCIResponses error
{base, height, true}, // LoadFinalizeBlockResponses error
{base, height, true}, // index block event error
{base, height, true}, // index tx event error
{base, base, false},

View File

@@ -424,11 +424,11 @@ func (h *Handshaker) ReplayBlocks(
case appBlockHeight == storeBlockHeight:
// We ran Commit, but didn't save the state, so replayBlock with mock app.
abciResponses, err := h.stateStore.LoadABCIResponses(storeBlockHeight)
finalizeBlockResponses, err := h.stateStore.LoadFinalizeBlockResponses(storeBlockHeight)
if err != nil {
return nil, err
}
mockApp, err := newMockProxyApp(h.logger, appHash, abciResponses)
mockApp, err := newMockProxyApp(h.logger, appHash, finalizeBlockResponses)
if err != nil {
return nil, err
}

View File

@@ -9,7 +9,6 @@ import (
"github.com/tendermint/tendermint/internal/mempool"
"github.com/tendermint/tendermint/internal/proxy"
"github.com/tendermint/tendermint/libs/log"
tmstate "github.com/tendermint/tendermint/proto/tendermint/state"
"github.com/tendermint/tendermint/types"
)
@@ -52,7 +51,7 @@ func (emptyMempool) InitWAL() error { return nil }
func (emptyMempool) CloseWAL() {}
//-----------------------------------------------------------------------------
// mockProxyApp uses ABCIResponses to give the right results.
// mockProxyApp uses Responses to FinalizeBlock to give the right results.
//
// Useful because we don't want to call Commit() twice for the same block on
// the real app.
@@ -60,24 +59,24 @@ func (emptyMempool) CloseWAL() {}
func newMockProxyApp(
logger log.Logger,
appHash []byte,
abciResponses *tmstate.ABCIResponses,
finalizeBlockResponses *abci.ResponseFinalizeBlock,
) (abciclient.Client, error) {
return proxy.New(abciclient.NewLocalClient(logger, &mockProxyApp{
appHash: appHash,
abciResponses: abciResponses,
appHash: appHash,
finalizeBlockResponses: finalizeBlockResponses,
}), logger, proxy.NopMetrics()), nil
}
type mockProxyApp struct {
abci.BaseApplication
appHash []byte
txCount int
abciResponses *tmstate.ABCIResponses
appHash []byte
txCount int
finalizeBlockResponses *abci.ResponseFinalizeBlock
}
func (mock *mockProxyApp) FinalizeBlock(_ context.Context, req *abci.RequestFinalizeBlock) (*abci.ResponseFinalizeBlock, error) {
r := mock.abciResponses.FinalizeBlock
r := mock.finalizeBlockResponses
mock.txCount++
if r == nil {
return &abci.ResponseFinalizeBlock{}, nil

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

View File

@@ -22,6 +22,16 @@ import (
"github.com/tendermint/tendermint/types"
)
// key prefixes
// NB: Before modifying these, cross-check them with those in
// * internal/store/store.go [0..4, 13]
// * internal/state/store.go [5..8, 14]
// * internal/evidence/pool.go [9..10]
// * light/store/db/db.go [11..12]
// TODO(sergio): Move all these to their own package.
// TODO: what about these (they already collide):
// * scripts/scmigrate/migrate.go [3]
// * internal/p2p/peermanager.go [1]
const (
// prefixes are unique across all tm db's
prefixCommitted = int64(9)

View File

@@ -23,7 +23,6 @@ import (
indexermocks "github.com/tendermint/tendermint/internal/state/indexer/mocks"
statemocks "github.com/tendermint/tendermint/internal/state/mocks"
"github.com/tendermint/tendermint/libs/log"
"github.com/tendermint/tendermint/proto/tendermint/state"
httpclient "github.com/tendermint/tendermint/rpc/client/http"
"github.com/tendermint/tendermint/types"
)
@@ -263,12 +262,10 @@ func TestBlockResults(t *testing.T) {
testGasUsed := int64(100)
stateStoreMock := &statemocks.Store{}
// tmstate "github.com/tendermint/tendermint/proto/tendermint/state"
stateStoreMock.On("LoadABCIResponses", testHeight).Return(&state.ABCIResponses{
FinalizeBlock: &abcitypes.ResponseFinalizeBlock{
TxResults: []*abcitypes.ExecTxResult{
{
GasUsed: testGasUsed,
},
stateStoreMock.On("LoadFinalizeBlockResponses", testHeight).Return(&abcitypes.ResponseFinalizeBlock{
TxResults: []*abcitypes.ExecTxResult{
{
GasUsed: testGasUsed,
},
},
}, nil)

View File

@@ -187,23 +187,23 @@ func (env *Environment) BlockResults(ctx context.Context, req *coretypes.Request
return nil, err
}
results, err := env.StateStore.LoadABCIResponses(height)
results, err := env.StateStore.LoadFinalizeBlockResponses(height)
if err != nil {
return nil, err
}
var totalGasUsed int64
for _, res := range results.FinalizeBlock.GetTxResults() {
for _, res := range results.GetTxResults() {
totalGasUsed += res.GetGasUsed()
}
return &coretypes.ResultBlockResults{
Height: height,
TxsResults: results.FinalizeBlock.TxResults,
TxsResults: results.TxResults,
TotalGasUsed: totalGasUsed,
FinalizeBlockEvents: results.FinalizeBlock.Events,
ValidatorUpdates: results.FinalizeBlock.ValidatorUpdates,
ConsensusParamUpdates: results.FinalizeBlock.ConsensusParamUpdates,
FinalizeBlockEvents: results.Events,
ValidatorUpdates: results.ValidatorUpdates,
ConsensusParamUpdates: results.ConsensusParamUpdates,
}, nil
}

View File

@@ -13,7 +13,6 @@ import (
abci "github.com/tendermint/tendermint/abci/types"
sm "github.com/tendermint/tendermint/internal/state"
"github.com/tendermint/tendermint/internal/state/mocks"
tmstate "github.com/tendermint/tendermint/proto/tendermint/state"
"github.com/tendermint/tendermint/rpc/coretypes"
)
@@ -70,19 +69,17 @@ func TestBlockchainInfo(t *testing.T) {
}
func TestBlockResults(t *testing.T) {
results := &tmstate.ABCIResponses{
FinalizeBlock: &abci.ResponseFinalizeBlock{
TxResults: []*abci.ExecTxResult{
{Code: 0, Data: []byte{0x01}, Log: "ok", GasUsed: 10},
{Code: 0, Data: []byte{0x02}, Log: "ok", GasUsed: 5},
{Code: 1, Log: "not ok", GasUsed: 0},
},
results := &abci.ResponseFinalizeBlock{
TxResults: []*abci.ExecTxResult{
{Code: 0, Data: []byte{0x01}, Log: "ok", GasUsed: 10},
{Code: 0, Data: []byte{0x02}, Log: "ok", GasUsed: 5},
{Code: 1, Log: "not ok", GasUsed: 0},
},
}
env := &Environment{}
env.StateStore = sm.NewStore(dbm.NewMemDB())
err := env.StateStore.SaveABCIResponses(100, results)
err := env.StateStore.SaveFinalizeBlockResponses(100, results)
require.NoError(t, err)
mockstore := &mocks.BlockStore{}
mockstore.On("Height").Return(int64(100))
@@ -99,11 +96,11 @@ func TestBlockResults(t *testing.T) {
{101, true, nil},
{100, false, &coretypes.ResultBlockResults{
Height: 100,
TxsResults: results.FinalizeBlock.TxResults,
TxsResults: results.TxResults,
TotalGasUsed: 15,
FinalizeBlockEvents: results.FinalizeBlock.Events,
ValidatorUpdates: results.FinalizeBlock.ValidatorUpdates,
ConsensusParamUpdates: results.FinalizeBlock.ConsensusParamUpdates,
FinalizeBlockEvents: results.Events,
ValidatorUpdates: results.ValidatorUpdates,
ConsensusParamUpdates: results.ConsensusParamUpdates,
}},
}

View File

@@ -46,7 +46,7 @@ type (
Height int64
}
ErrNoABCIResponsesForHeight struct {
ErrNoFinalizeBlockResponsesForHeight struct {
Height int64
}
)
@@ -102,6 +102,6 @@ func (e ErrNoConsensusParamsForHeight) Error() string {
return fmt.Sprintf("could not find consensus params for height #%d", e.Height)
}
func (e ErrNoABCIResponsesForHeight) Error() string {
return fmt.Sprintf("could not find results for height #%d", e.Height)
func (e ErrNoFinalizeBlockResponsesForHeight) Error() string {
return fmt.Sprintf("could not find FinalizeBlock responses for height #%d", e.Height)
}

View File

@@ -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 {

View File

@@ -19,7 +19,6 @@ import (
sf "github.com/tendermint/tendermint/internal/state/test/factory"
"github.com/tendermint/tendermint/internal/test/factory"
tmtime "github.com/tendermint/tendermint/libs/time"
tmstate "github.com/tendermint/tendermint/proto/tendermint/state"
tmproto "github.com/tendermint/tendermint/proto/tendermint/types"
"github.com/tendermint/tendermint/types"
)
@@ -148,10 +147,10 @@ func makeHeaderPartsResponsesValPubKeyChange(
t *testing.T,
state sm.State,
pubkey crypto.PubKey,
) (types.Header, types.BlockID, *tmstate.ABCIResponses) {
) (types.Header, types.BlockID, *abci.ResponseFinalizeBlock) {
block := sf.MakeBlock(state, state.LastBlockHeight+1, new(types.Commit))
abciResponses := &tmstate.ABCIResponses{}
finalizeBlockResponses := &abci.ResponseFinalizeBlock{}
// If the pubkey is new, remove the old and add the new.
_, val := state.NextValidators.GetByIndex(0)
if !bytes.Equal(pubkey.Bytes(), val.PubKey.Bytes()) {
@@ -160,58 +159,50 @@ func makeHeaderPartsResponsesValPubKeyChange(
pbPk, err := encoding.PubKeyToProto(pubkey)
require.NoError(t, err)
abciResponses.FinalizeBlock = &abci.ResponseFinalizeBlock{
ValidatorUpdates: []abci.ValidatorUpdate{
{PubKey: vPbPk, Power: 0},
{PubKey: pbPk, Power: 10},
},
finalizeBlockResponses.ValidatorUpdates = []abci.ValidatorUpdate{
{PubKey: vPbPk, Power: 0},
{PubKey: pbPk, Power: 10},
}
}
return block.Header, types.BlockID{Hash: block.Hash(), PartSetHeader: types.PartSetHeader{}}, abciResponses
return block.Header, types.BlockID{Hash: block.Hash(), PartSetHeader: types.PartSetHeader{}}, finalizeBlockResponses
}
func makeHeaderPartsResponsesValPowerChange(
t *testing.T,
state sm.State,
power int64,
) (types.Header, types.BlockID, *tmstate.ABCIResponses) {
) (types.Header, types.BlockID, *abci.ResponseFinalizeBlock) {
t.Helper()
block := sf.MakeBlock(state, state.LastBlockHeight+1, new(types.Commit))
finalizeBlockResponses := &abci.ResponseFinalizeBlock{}
abciResponses := &tmstate.ABCIResponses{}
abciResponses.FinalizeBlock = &abci.ResponseFinalizeBlock{}
// If the pubkey is new, remove the old and add the new.
_, val := state.NextValidators.GetByIndex(0)
if val.VotingPower != power {
vPbPk, err := encoding.PubKeyToProto(val.PubKey)
require.NoError(t, err)
abciResponses.FinalizeBlock = &abci.ResponseFinalizeBlock{
ValidatorUpdates: []abci.ValidatorUpdate{
{PubKey: vPbPk, Power: power},
},
finalizeBlockResponses.ValidatorUpdates = []abci.ValidatorUpdate{
{PubKey: vPbPk, Power: power},
}
}
return block.Header, types.BlockID{Hash: block.Hash(), PartSetHeader: types.PartSetHeader{}}, abciResponses
return block.Header, types.BlockID{Hash: block.Hash(), PartSetHeader: types.PartSetHeader{}}, finalizeBlockResponses
}
func makeHeaderPartsResponsesParams(
t *testing.T,
state sm.State,
params *types.ConsensusParams,
) (types.Header, types.BlockID, *tmstate.ABCIResponses) {
) (types.Header, types.BlockID, *abci.ResponseFinalizeBlock) {
t.Helper()
block := sf.MakeBlock(state, state.LastBlockHeight+1, new(types.Commit))
pbParams := params.ToProto()
abciResponses := &tmstate.ABCIResponses{
FinalizeBlock: &abci.ResponseFinalizeBlock{ConsensusParamUpdates: &pbParams},
}
return block.Header, types.BlockID{Hash: block.Hash(), PartSetHeader: types.PartSetHeader{}}, abciResponses
finalizeBlockResponses := &abci.ResponseFinalizeBlock{ConsensusParamUpdates: &pbParams}
return block.Header, types.BlockID{Hash: block.Hash(), PartSetHeader: types.PartSetHeader{}}, finalizeBlockResponses
}
func randomGenesisDoc() *types.GenesisDoc {

View File

@@ -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)

View File

@@ -21,7 +21,6 @@ import (
"github.com/tendermint/tendermint/crypto/merkle"
sm "github.com/tendermint/tendermint/internal/state"
statefactory "github.com/tendermint/tendermint/internal/state/test/factory"
tmstate "github.com/tendermint/tendermint/proto/tendermint/state"
"github.com/tendermint/tendermint/types"
)
@@ -102,8 +101,8 @@ func TestStateSaveLoad(t *testing.T) {
loadedState, state)
}
// TestABCIResponsesSaveLoad tests saving and loading ABCIResponses.
func TestABCIResponsesSaveLoad1(t *testing.T) {
// TestFinalizeBlockResponsesSaveLoad1 tests saving and loading responses to FinalizeBlock.
func TestFinalizeBlockResponsesSaveLoad1(t *testing.T) {
tearDown, stateDB, state := setupTestCase(t)
defer tearDown(t)
stateStore := sm.NewStore(stateDB)
@@ -113,28 +112,27 @@ func TestABCIResponsesSaveLoad1(t *testing.T) {
// Build mock responses.
block := statefactory.MakeBlock(state, 2, new(types.Commit))
abciResponses := new(tmstate.ABCIResponses)
dtxs := make([]*abci.ExecTxResult, 2)
abciResponses.FinalizeBlock = new(abci.ResponseFinalizeBlock)
abciResponses.FinalizeBlock.TxResults = dtxs
finalizeBlockResponses := new(abci.ResponseFinalizeBlock)
finalizeBlockResponses.TxResults = dtxs
abciResponses.FinalizeBlock.TxResults[0] = &abci.ExecTxResult{Data: []byte("foo"), Events: nil}
abciResponses.FinalizeBlock.TxResults[1] = &abci.ExecTxResult{Data: []byte("bar"), Log: "ok", Events: nil}
finalizeBlockResponses.TxResults[0] = &abci.ExecTxResult{Data: []byte("foo"), Events: nil}
finalizeBlockResponses.TxResults[1] = &abci.ExecTxResult{Data: []byte("bar"), Log: "ok", Events: nil}
pbpk, err := encoding.PubKeyToProto(ed25519.GenPrivKey().PubKey())
require.NoError(t, err)
abciResponses.FinalizeBlock.ValidatorUpdates = []abci.ValidatorUpdate{{PubKey: pbpk, Power: 10}}
finalizeBlockResponses.ValidatorUpdates = []abci.ValidatorUpdate{{PubKey: pbpk, Power: 10}}
err = stateStore.SaveABCIResponses(block.Height, abciResponses)
err = stateStore.SaveFinalizeBlockResponses(block.Height, finalizeBlockResponses)
require.NoError(t, err)
loadedABCIResponses, err := stateStore.LoadABCIResponses(block.Height)
loadedFinalizeBlockResponses, err := stateStore.LoadFinalizeBlockResponses(block.Height)
require.NoError(t, err)
assert.Equal(t, abciResponses, loadedABCIResponses,
"ABCIResponses don't match:\ngot: %v\nexpected: %v\n",
loadedABCIResponses, abciResponses)
assert.Equal(t, finalizeBlockResponses, loadedFinalizeBlockResponses,
"FinalizeBlockResponses don't match:\ngot: %v\nexpected: %v\n",
loadedFinalizeBlockResponses, finalizeBlockResponses)
}
// TestResultsSaveLoad tests saving and loading ABCI results.
func TestABCIResponsesSaveLoad2(t *testing.T) {
// TestFinalizeBlockResponsesSaveLoad2 tests saving and loading responses to FinalizeBlock.
func TestFinalizeBlockResponsesSaveLoad2(t *testing.T) {
tearDown, stateDB, _ := setupTestCase(t)
defer tearDown(t)
@@ -190,32 +188,31 @@ func TestABCIResponsesSaveLoad2(t *testing.T) {
// Query all before, this should return error.
for i := range cases {
h := int64(i + 1)
res, err := stateStore.LoadABCIResponses(h)
res, err := stateStore.LoadFinalizeBlockResponses(h)
assert.Error(t, err, "%d: %#v", i, res)
}
// Add all cases.
for i, tc := range cases {
h := int64(i + 1) // last block height, one below what we save
responses := &tmstate.ABCIResponses{
FinalizeBlock: &abci.ResponseFinalizeBlock{
TxResults: tc.added,
},
responses := &abci.ResponseFinalizeBlock{
TxResults: tc.added,
AppHash: []byte("a_hash"),
}
err := stateStore.SaveABCIResponses(h, responses)
err := stateStore.SaveFinalizeBlockResponses(h, responses)
require.NoError(t, err)
}
// Query all before, should return expected value.
// Query all after, should return expected value.
for i, tc := range cases {
h := int64(i + 1)
res, err := stateStore.LoadABCIResponses(h)
res, err := stateStore.LoadFinalizeBlockResponses(h)
if assert.NoError(t, err, "%d", i) {
t.Log(res)
e, err := abci.MarshalTxResults(tc.expected)
require.NoError(t, err)
he := merkle.HashFromByteSlices(e)
rs, err := abci.MarshalTxResults(res.FinalizeBlock.TxResults)
rs, err := abci.MarshalTxResults(res.TxResults)
hrs := merkle.HashFromByteSlices(rs)
require.NoError(t, err)
assert.Equal(t, he, hrs, "%d", i)
@@ -282,12 +279,12 @@ func TestOneValidatorChangesSaveLoad(t *testing.T) {
power++
}
header, blockID, responses := makeHeaderPartsResponsesValPowerChange(t, state, power)
validatorUpdates, err = types.PB2TM.ValidatorUpdates(responses.FinalizeBlock.ValidatorUpdates)
validatorUpdates, err = types.PB2TM.ValidatorUpdates(responses.ValidatorUpdates)
require.NoError(t, err)
rs, err := abci.MarshalTxResults(responses.FinalizeBlock.TxResults)
rs, err := abci.MarshalTxResults(responses.TxResults)
require.NoError(t, err)
h := merkle.HashFromByteSlices(rs)
state, err = state.Update(blockID, &header, h, responses.FinalizeBlock.ConsensusParamUpdates, validatorUpdates)
state, err = state.Update(blockID, &header, h, responses.ConsensusParamUpdates, validatorUpdates)
require.NoError(t, err)
err = stateStore.Save(state)
require.NoError(t, err)
@@ -1024,12 +1021,12 @@ func TestManyValidatorChangesSaveLoad(t *testing.T) {
// Save state etc.
var validatorUpdates []*types.Validator
validatorUpdates, err = types.PB2TM.ValidatorUpdates(responses.FinalizeBlock.ValidatorUpdates)
validatorUpdates, err = types.PB2TM.ValidatorUpdates(responses.ValidatorUpdates)
require.NoError(t, err)
rs, err := abci.MarshalTxResults(responses.FinalizeBlock.TxResults)
rs, err := abci.MarshalTxResults(responses.TxResults)
require.NoError(t, err)
h := merkle.HashFromByteSlices(rs)
state, err = state.Update(blockID, &header, h, responses.FinalizeBlock.ConsensusParamUpdates, validatorUpdates)
state, err = state.Update(blockID, &header, h, responses.ConsensusParamUpdates, validatorUpdates)
require.NoError(t, err)
nextHeight := state.LastBlockHeight + 1
err = stateStore.Save(state)
@@ -1104,12 +1101,12 @@ func TestConsensusParamsChangesSaveLoad(t *testing.T) {
cp = params[changeIndex]
}
header, blockID, responses := makeHeaderPartsResponsesParams(t, state, &cp)
validatorUpdates, err = types.PB2TM.ValidatorUpdates(responses.FinalizeBlock.ValidatorUpdates)
validatorUpdates, err = types.PB2TM.ValidatorUpdates(responses.ValidatorUpdates)
require.NoError(t, err)
rs, err := abci.MarshalTxResults(responses.FinalizeBlock.TxResults)
rs, err := abci.MarshalTxResults(responses.TxResults)
require.NoError(t, err)
h := merkle.HashFromByteSlices(rs)
state, err = state.Update(blockID, &header, h, responses.FinalizeBlock.ConsensusParamUpdates, validatorUpdates)
state, err = state.Update(blockID, &header, h, responses.ConsensusParamUpdates, validatorUpdates)
require.NoError(t, err)
err = stateStore.Save(state)

View File

@@ -26,15 +26,23 @@ const (
//------------------------------------------------------------------------
// key prefixes
// NB: Before modifying these, cross-check them with those in
// internal/store/store.go
// TODO(thane): Move these and the ones in internal/store/store.go to their own package.
// * internal/store/store.go [0..4, 13]
// * internal/state/store.go [5..8, 14]
// * internal/evidence/pool.go [9..10]
// * light/store/db/db.go [11..12]
// TODO(thane): Move all these to their own package.
// TODO: what about these (they already collide):
// * scripts/scmigrate/migrate.go [3]
// * internal/p2p/peermanager.go [1]
const (
// prefixes are unique across all tm db's
prefixValidators = int64(5)
prefixConsensusParams = int64(6)
prefixABCIResponses = int64(7)
prefixState = int64(8)
prefixValidators = int64(5)
prefixConsensusParams = int64(6)
prefixABCIResponses = int64(7) // deprecated in v0.36
prefixState = int64(8)
prefixFinalizeBlockResponses = int64(14)
)
func encodeKey(prefix int64, height int64) []byte {
@@ -57,6 +65,10 @@ func abciResponsesKey(height int64) []byte {
return encodeKey(prefixABCIResponses, height)
}
func finalizeBlockResponsesKey(height int64) []byte {
return encodeKey(prefixFinalizeBlockResponses, height)
}
// stateKey should never change after being set in init()
var stateKey []byte
@@ -81,14 +93,14 @@ type Store interface {
Load() (State, error)
// LoadValidators loads the validator set at a given height
LoadValidators(int64) (*types.ValidatorSet, error)
// LoadABCIResponses loads the abciResponse for a given height
LoadABCIResponses(int64) (*tmstate.ABCIResponses, error)
// LoadFinalizeBlockResponses loads the responses to FinalizeBlock for a given height
LoadFinalizeBlockResponses(int64) (*abci.ResponseFinalizeBlock, error)
// LoadConsensusParams loads the consensus params for a given height
LoadConsensusParams(int64) (types.ConsensusParams, error)
// Save overwrites the previous state with the updated one
Save(State) error
// SaveABCIResponses saves ABCIResponses for a given height
SaveABCIResponses(int64, *tmstate.ABCIResponses) error
// SaveFinalizeBlockResponses saves responses to FinalizeBlock for a given height
SaveFinalizeBlockResponses(int64, *abci.ResponseFinalizeBlock) error
// SaveValidatorSet saves the validator set at a given height
SaveValidatorSets(int64, int64, *types.ValidatorSet) error
// Bootstrap is used for bootstrapping state when not starting from a initial height.
@@ -247,7 +259,7 @@ func (store dbStore) PruneStates(retainHeight int64) error {
return err
}
if err := store.pruneABCIResponses(retainHeight); err != nil {
if err := store.pruneFinalizeBlockResponses(retainHeight); err != nil {
return err
}
@@ -338,10 +350,15 @@ func (store dbStore) pruneConsensusParams(retainHeight int64) error {
)
}
// pruneABCIResponses calls a reverse iterator from base height to retain height batch deleting
// all abci responses in between
func (store dbStore) pruneABCIResponses(height int64) error {
return store.pruneRange(abciResponsesKey(1), abciResponsesKey(height))
// pruneFinalizeBlockResponses calls a reverse iterator from base height to retain height
// batch deleting all responses to FinalizeBlock, and legacy ABCI responses, in between
func (store dbStore) pruneFinalizeBlockResponses(height int64) error {
err := store.pruneRange(finalizeBlockResponsesKey(1), finalizeBlockResponsesKey(height))
if err == nil {
// Remove any stale legacy ABCI responses
err = store.pruneRange(abciResponsesKey(1), abciResponsesKey(height))
}
return err
}
// pruneRange is a generic function for deleting a range of keys in reverse order.
@@ -408,60 +425,63 @@ func (store dbStore) reverseBatchDelete(batch dbm.Batch, start, end []byte) ([]b
//------------------------------------------------------------------------
// LoadABCIResponses loads the ABCIResponses for the given height from the
// database. If not found, ErrNoABCIResponsesForHeight is returned.
// LoadFinalizeBlockResponses loads the responses to FinalizeBlock for the
// given height from the database. If not found,
// ErrNoFinalizeBlockResponsesForHeight is returned.
//
// This is useful for recovering from crashes where we called app.Commit and
// before we called s.Save(). It can also be used to produce Merkle proofs of
// the result of txs.
func (store dbStore) LoadABCIResponses(height int64) (*tmstate.ABCIResponses, error) {
buf, err := store.db.Get(abciResponsesKey(height))
// This is useful for recovering from crashes where we called app.Commit
// and before we called s.Save(). It can also be used to produce Merkle
// proofs of the result of txs.
func (store dbStore) LoadFinalizeBlockResponses(height int64) (*abci.ResponseFinalizeBlock, error) {
buf, err := store.db.Get(finalizeBlockResponsesKey(height))
if err != nil {
return nil, err
}
if len(buf) == 0 {
return nil, ErrNoABCIResponsesForHeight{height}
return nil, ErrNoFinalizeBlockResponsesForHeight{height}
}
abciResponses := new(tmstate.ABCIResponses)
err = abciResponses.Unmarshal(buf)
finalizeBlockResponses := new(abci.ResponseFinalizeBlock)
err = finalizeBlockResponses.Unmarshal(buf)
if err != nil {
// DATA HAS BEEN CORRUPTED OR THE SPEC HAS CHANGED
panic(fmt.Sprintf("data has been corrupted or its spec has changed: %+v", err))
}
// TODO: ensure that buf is completely read.
return abciResponses, nil
return finalizeBlockResponses, nil
}
// SaveABCIResponses persists the ABCIResponses to the database.
// SaveFinalizeBlockResponses persists to the database the responses to FinalizeBlock.
// This is useful in case we crash after app.Commit and before s.Save().
// Responses are indexed by height so they can also be loaded later to produce
// Merkle proofs.
//
// Exposed for testing.
func (store dbStore) SaveABCIResponses(height int64, abciResponses *tmstate.ABCIResponses) error {
return store.saveABCIResponses(height, abciResponses)
func (store dbStore) SaveFinalizeBlockResponses(height int64, finalizeBlockResponses *abci.ResponseFinalizeBlock) error {
return store.saveFinalizeBlockResponses(height, finalizeBlockResponses)
}
func (store dbStore) saveABCIResponses(height int64, abciResponses *tmstate.ABCIResponses) error {
func (store dbStore) saveFinalizeBlockResponses(height int64, finalizeBlockResponses *abci.ResponseFinalizeBlock) error {
var dtxs []*abci.ExecTxResult
// strip nil values,
for _, tx := range abciResponses.FinalizeBlock.TxResults {
for _, tx := range finalizeBlockResponses.TxResults {
if tx != nil {
dtxs = append(dtxs, tx)
}
}
abciResponses.FinalizeBlock.TxResults = dtxs
finalizeBlockResponses.TxResults = dtxs
bz, err := abciResponses.Marshal()
bz, err := finalizeBlockResponses.Marshal()
if err != nil {
return err
}
if len(bz) == 0 {
return ErrNoFinalizeBlockResponsesForHeight{height}
}
return store.db.SetSync(abciResponsesKey(height), bz)
return store.db.SetSync(finalizeBlockResponsesKey(height), bz)
}
// SaveValidatorSets is used to save the validator set over multiple heights.

View File

@@ -17,7 +17,6 @@ import (
sm "github.com/tendermint/tendermint/internal/state"
"github.com/tendermint/tendermint/internal/test/factory"
tmrand "github.com/tendermint/tendermint/libs/rand"
tmstate "github.com/tendermint/tendermint/proto/tendermint/state"
"github.com/tendermint/tendermint/types"
)
@@ -236,15 +235,14 @@ func TestPruneStates(t *testing.T) {
err := stateStore.Save(state)
require.NoError(t, err)
err = stateStore.SaveABCIResponses(h, &tmstate.ABCIResponses{
FinalizeBlock: &abci.ResponseFinalizeBlock{
TxResults: []*abci.ExecTxResult{
{Data: []byte{1}},
{Data: []byte{2}},
{Data: []byte{3}},
},
err = stateStore.SaveFinalizeBlockResponses(h, &abci.ResponseFinalizeBlock{
TxResults: []*abci.ExecTxResult{
{Data: []byte{1}},
{Data: []byte{2}},
{Data: []byte{3}},
},
})
},
)
require.NoError(t, err)
}
@@ -265,9 +263,9 @@ func TestPruneStates(t *testing.T) {
require.NoError(t, err, h)
require.NotNil(t, params, h)
abci, err := stateStore.LoadABCIResponses(h)
finRes, err := stateStore.LoadFinalizeBlockResponses(h)
require.NoError(t, err, h)
require.NotNil(t, abci, h)
require.NotNil(t, finRes, h)
}
emptyParams := types.ConsensusParams{}
@@ -291,9 +289,9 @@ func TestPruneStates(t *testing.T) {
require.Equal(t, emptyParams, params, h)
}
abci, err := stateStore.LoadABCIResponses(h)
finRes, err := stateStore.LoadFinalizeBlockResponses(h)
require.Error(t, err, h)
require.Nil(t, abci, h)
require.Nil(t, finRes, h)
}
})
}

View File

@@ -650,8 +650,14 @@ func (bs *BlockStore) Close() error {
// key prefixes
// NB: Before modifying these, cross-check them with those in
// internal/state/store.go
// TODO(thane): Move these and the ones in internal/state/store.go to their own package.
// * internal/store/store.go [0..4, 13]
// * internal/state/store.go [5..8, 14]
// * internal/evidence/pool.go [9..10]
// * light/store/db/db.go [11..12]
// TODO(thane): Move all these to their own package.
// TODO: what about these (they already collide):
// * scripts/scmigrate/migrate.go [3] --> Looks OK, as it is also called "SeenCommit"
// * internal/p2p/peermanager.go [1]
const (
// prefixes are unique across all tm db's
prefixBlockMeta = int64(0)
@@ -659,7 +665,7 @@ const (
prefixBlockCommit = int64(2)
prefixSeenCommit = int64(3)
prefixBlockHash = int64(4)
prefixExtCommit = int64(9) // 5..8 are used by state/store
prefixExtCommit = int64(13)
)
func blockMetaKey(height int64) []byte {

View File

@@ -13,6 +13,16 @@ import (
"github.com/tendermint/tendermint/types"
)
// key prefixes
// NB: Before modifying these, cross-check them with those in
// * internal/store/store.go [0..4, 13]
// * internal/state/store.go [5..8, 14]
// * internal/evidence/pool.go [9..10]
// * light/store/db/db.go [11..12]
// TODO(sergio): Move all these to their own package.
// TODO: what about these (they already collide):
// * scripts/scmigrate/migrate.go [3]
// * internal/p2p/peermanager.go [1]
const (
prefixLightBlock = int64(11)
prefixSize = int64(12)

View File

@@ -9,8 +9,7 @@ import (
proto "github.com/gogo/protobuf/proto"
_ "github.com/gogo/protobuf/types"
github_com_gogo_protobuf_types "github.com/gogo/protobuf/types"
types "github.com/tendermint/tendermint/abci/types"
types1 "github.com/tendermint/tendermint/proto/tendermint/types"
types "github.com/tendermint/tendermint/proto/tendermint/types"
version "github.com/tendermint/tendermint/proto/tendermint/version"
io "io"
math "math"
@@ -30,64 +29,17 @@ var _ = time.Kitchen
// proto package needs to be updated.
const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
// ABCIResponses retains the responses
// of the various ABCI calls during block processing.
// It is persisted to disk for each height before calling Commit.
type ABCIResponses struct {
FinalizeBlock *types.ResponseFinalizeBlock `protobuf:"bytes,2,opt,name=finalize_block,json=finalizeBlock,proto3" json:"finalize_block,omitempty"`
}
func (m *ABCIResponses) Reset() { *m = ABCIResponses{} }
func (m *ABCIResponses) String() string { return proto.CompactTextString(m) }
func (*ABCIResponses) ProtoMessage() {}
func (*ABCIResponses) Descriptor() ([]byte, []int) {
return fileDescriptor_ccfacf933f22bf93, []int{0}
}
func (m *ABCIResponses) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *ABCIResponses) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_ABCIResponses.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *ABCIResponses) XXX_Merge(src proto.Message) {
xxx_messageInfo_ABCIResponses.Merge(m, src)
}
func (m *ABCIResponses) XXX_Size() int {
return m.Size()
}
func (m *ABCIResponses) XXX_DiscardUnknown() {
xxx_messageInfo_ABCIResponses.DiscardUnknown(m)
}
var xxx_messageInfo_ABCIResponses proto.InternalMessageInfo
func (m *ABCIResponses) GetFinalizeBlock() *types.ResponseFinalizeBlock {
if m != nil {
return m.FinalizeBlock
}
return nil
}
// ValidatorsInfo represents the latest validator set, or the last height it changed
type ValidatorsInfo struct {
ValidatorSet *types1.ValidatorSet `protobuf:"bytes,1,opt,name=validator_set,json=validatorSet,proto3" json:"validator_set,omitempty"`
LastHeightChanged int64 `protobuf:"varint,2,opt,name=last_height_changed,json=lastHeightChanged,proto3" json:"last_height_changed,omitempty"`
ValidatorSet *types.ValidatorSet `protobuf:"bytes,1,opt,name=validator_set,json=validatorSet,proto3" json:"validator_set,omitempty"`
LastHeightChanged int64 `protobuf:"varint,2,opt,name=last_height_changed,json=lastHeightChanged,proto3" json:"last_height_changed,omitempty"`
}
func (m *ValidatorsInfo) Reset() { *m = ValidatorsInfo{} }
func (m *ValidatorsInfo) String() string { return proto.CompactTextString(m) }
func (*ValidatorsInfo) ProtoMessage() {}
func (*ValidatorsInfo) Descriptor() ([]byte, []int) {
return fileDescriptor_ccfacf933f22bf93, []int{1}
return fileDescriptor_ccfacf933f22bf93, []int{0}
}
func (m *ValidatorsInfo) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -116,7 +68,7 @@ func (m *ValidatorsInfo) XXX_DiscardUnknown() {
var xxx_messageInfo_ValidatorsInfo proto.InternalMessageInfo
func (m *ValidatorsInfo) GetValidatorSet() *types1.ValidatorSet {
func (m *ValidatorsInfo) GetValidatorSet() *types.ValidatorSet {
if m != nil {
return m.ValidatorSet
}
@@ -132,15 +84,15 @@ func (m *ValidatorsInfo) GetLastHeightChanged() int64 {
// ConsensusParamsInfo represents the latest consensus params, or the last height it changed
type ConsensusParamsInfo struct {
ConsensusParams types1.ConsensusParams `protobuf:"bytes,1,opt,name=consensus_params,json=consensusParams,proto3" json:"consensus_params"`
LastHeightChanged int64 `protobuf:"varint,2,opt,name=last_height_changed,json=lastHeightChanged,proto3" json:"last_height_changed,omitempty"`
ConsensusParams types.ConsensusParams `protobuf:"bytes,1,opt,name=consensus_params,json=consensusParams,proto3" json:"consensus_params"`
LastHeightChanged int64 `protobuf:"varint,2,opt,name=last_height_changed,json=lastHeightChanged,proto3" json:"last_height_changed,omitempty"`
}
func (m *ConsensusParamsInfo) Reset() { *m = ConsensusParamsInfo{} }
func (m *ConsensusParamsInfo) String() string { return proto.CompactTextString(m) }
func (*ConsensusParamsInfo) ProtoMessage() {}
func (*ConsensusParamsInfo) Descriptor() ([]byte, []int) {
return fileDescriptor_ccfacf933f22bf93, []int{2}
return fileDescriptor_ccfacf933f22bf93, []int{1}
}
func (m *ConsensusParamsInfo) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -169,11 +121,11 @@ func (m *ConsensusParamsInfo) XXX_DiscardUnknown() {
var xxx_messageInfo_ConsensusParamsInfo proto.InternalMessageInfo
func (m *ConsensusParamsInfo) GetConsensusParams() types1.ConsensusParams {
func (m *ConsensusParamsInfo) GetConsensusParams() types.ConsensusParams {
if m != nil {
return m.ConsensusParams
}
return types1.ConsensusParams{}
return types.ConsensusParams{}
}
func (m *ConsensusParamsInfo) GetLastHeightChanged() int64 {
@@ -192,7 +144,7 @@ func (m *Version) Reset() { *m = Version{} }
func (m *Version) String() string { return proto.CompactTextString(m) }
func (*Version) ProtoMessage() {}
func (*Version) Descriptor() ([]byte, []int) {
return fileDescriptor_ccfacf933f22bf93, []int{3}
return fileDescriptor_ccfacf933f22bf93, []int{2}
}
func (m *Version) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -241,23 +193,23 @@ type State struct {
ChainID string `protobuf:"bytes,2,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"`
InitialHeight int64 `protobuf:"varint,14,opt,name=initial_height,json=initialHeight,proto3" json:"initial_height,omitempty"`
// LastBlockHeight=0 at genesis (ie. block(H=0) does not exist)
LastBlockHeight int64 `protobuf:"varint,3,opt,name=last_block_height,json=lastBlockHeight,proto3" json:"last_block_height,omitempty"`
LastBlockID types1.BlockID `protobuf:"bytes,4,opt,name=last_block_id,json=lastBlockId,proto3" json:"last_block_id"`
LastBlockTime time.Time `protobuf:"bytes,5,opt,name=last_block_time,json=lastBlockTime,proto3,stdtime" json:"last_block_time"`
LastBlockHeight int64 `protobuf:"varint,3,opt,name=last_block_height,json=lastBlockHeight,proto3" json:"last_block_height,omitempty"`
LastBlockID types.BlockID `protobuf:"bytes,4,opt,name=last_block_id,json=lastBlockId,proto3" json:"last_block_id"`
LastBlockTime time.Time `protobuf:"bytes,5,opt,name=last_block_time,json=lastBlockTime,proto3,stdtime" json:"last_block_time"`
// LastValidators is used to validate block.LastCommit.
// Validators are persisted to the database separately every time they change,
// so we can query for historical validator sets.
// Note that if s.LastBlockHeight causes a valset change,
// we set s.LastHeightValidatorsChanged = s.LastBlockHeight + 1 + 1
// Extra +1 due to nextValSet delay.
NextValidators *types1.ValidatorSet `protobuf:"bytes,6,opt,name=next_validators,json=nextValidators,proto3" json:"next_validators,omitempty"`
Validators *types1.ValidatorSet `protobuf:"bytes,7,opt,name=validators,proto3" json:"validators,omitempty"`
LastValidators *types1.ValidatorSet `protobuf:"bytes,8,opt,name=last_validators,json=lastValidators,proto3" json:"last_validators,omitempty"`
LastHeightValidatorsChanged int64 `protobuf:"varint,9,opt,name=last_height_validators_changed,json=lastHeightValidatorsChanged,proto3" json:"last_height_validators_changed,omitempty"`
NextValidators *types.ValidatorSet `protobuf:"bytes,6,opt,name=next_validators,json=nextValidators,proto3" json:"next_validators,omitempty"`
Validators *types.ValidatorSet `protobuf:"bytes,7,opt,name=validators,proto3" json:"validators,omitempty"`
LastValidators *types.ValidatorSet `protobuf:"bytes,8,opt,name=last_validators,json=lastValidators,proto3" json:"last_validators,omitempty"`
LastHeightValidatorsChanged int64 `protobuf:"varint,9,opt,name=last_height_validators_changed,json=lastHeightValidatorsChanged,proto3" json:"last_height_validators_changed,omitempty"`
// Consensus parameters used for validating blocks.
// Changes returned by EndBlock and updated after Commit.
ConsensusParams types1.ConsensusParams `protobuf:"bytes,10,opt,name=consensus_params,json=consensusParams,proto3" json:"consensus_params"`
LastHeightConsensusParamsChanged int64 `protobuf:"varint,11,opt,name=last_height_consensus_params_changed,json=lastHeightConsensusParamsChanged,proto3" json:"last_height_consensus_params_changed,omitempty"`
ConsensusParams types.ConsensusParams `protobuf:"bytes,10,opt,name=consensus_params,json=consensusParams,proto3" json:"consensus_params"`
LastHeightConsensusParamsChanged int64 `protobuf:"varint,11,opt,name=last_height_consensus_params_changed,json=lastHeightConsensusParamsChanged,proto3" json:"last_height_consensus_params_changed,omitempty"`
// Merkle root of the results from executing prev block
LastResultsHash []byte `protobuf:"bytes,12,opt,name=last_results_hash,json=lastResultsHash,proto3" json:"last_results_hash,omitempty"`
// the latest AppHash we've received from calling abci.Commit()
@@ -268,7 +220,7 @@ func (m *State) Reset() { *m = State{} }
func (m *State) String() string { return proto.CompactTextString(m) }
func (*State) ProtoMessage() {}
func (*State) Descriptor() ([]byte, []int) {
return fileDescriptor_ccfacf933f22bf93, []int{4}
return fileDescriptor_ccfacf933f22bf93, []int{3}
}
func (m *State) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@@ -325,11 +277,11 @@ func (m *State) GetLastBlockHeight() int64 {
return 0
}
func (m *State) GetLastBlockID() types1.BlockID {
func (m *State) GetLastBlockID() types.BlockID {
if m != nil {
return m.LastBlockID
}
return types1.BlockID{}
return types.BlockID{}
}
func (m *State) GetLastBlockTime() time.Time {
@@ -339,21 +291,21 @@ func (m *State) GetLastBlockTime() time.Time {
return time.Time{}
}
func (m *State) GetNextValidators() *types1.ValidatorSet {
func (m *State) GetNextValidators() *types.ValidatorSet {
if m != nil {
return m.NextValidators
}
return nil
}
func (m *State) GetValidators() *types1.ValidatorSet {
func (m *State) GetValidators() *types.ValidatorSet {
if m != nil {
return m.Validators
}
return nil
}
func (m *State) GetLastValidators() *types1.ValidatorSet {
func (m *State) GetLastValidators() *types.ValidatorSet {
if m != nil {
return m.LastValidators
}
@@ -367,11 +319,11 @@ func (m *State) GetLastHeightValidatorsChanged() int64 {
return 0
}
func (m *State) GetConsensusParams() types1.ConsensusParams {
func (m *State) GetConsensusParams() types.ConsensusParams {
if m != nil {
return m.ConsensusParams
}
return types1.ConsensusParams{}
return types.ConsensusParams{}
}
func (m *State) GetLastHeightConsensusParamsChanged() int64 {
@@ -396,7 +348,6 @@ func (m *State) GetAppHash() []byte {
}
func init() {
proto.RegisterType((*ABCIResponses)(nil), "tendermint.state.ABCIResponses")
proto.RegisterType((*ValidatorsInfo)(nil), "tendermint.state.ValidatorsInfo")
proto.RegisterType((*ConsensusParamsInfo)(nil), "tendermint.state.ConsensusParamsInfo")
proto.RegisterType((*Version)(nil), "tendermint.state.Version")
@@ -406,87 +357,49 @@ func init() {
func init() { proto.RegisterFile("tendermint/state/types.proto", fileDescriptor_ccfacf933f22bf93) }
var fileDescriptor_ccfacf933f22bf93 = []byte{
// 717 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x55, 0x4d, 0x6f, 0xd3, 0x4a,
0x14, 0x8d, 0x5f, 0x3f, 0x92, 0x4c, 0x9a, 0xa4, 0x6f, 0xfa, 0x16, 0x69, 0xfa, 0xea, 0xe4, 0x45,
0x8f, 0xaa, 0x62, 0xe1, 0x48, 0xb0, 0x40, 0x6c, 0x90, 0x9a, 0x54, 0x50, 0x4b, 0x05, 0x81, 0x8b,
0xba, 0x60, 0x81, 0x35, 0x71,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x13, 0xf6, 0xba, 0xda, 0xde, 0x2d, 0x0a, 0x65, 0x1e, 0xb3, 0x41, 0x4c, 0x31, 0x9d, 0x85, 0x8c,
0xba, 0x01, 0xa2, 0x41, 0x6b, 0xab, 0x6b, 0x1c, 0x6e, 0xc9, 0x41, 0x74, 0x64, 0xfc, 0x04, 0xd1,
0x00, 0xee, 0x82, 0x0a, 0x4a, 0x12, 0x49, 0xa9, 0x0b, 0x4a, 0x19, 0x25, 0x09, 0x87, 0x06, 0xaf,
0xae, 0xe6, 0xa6, 0x71, 0x3d, 0x37, 0x8d, 0xef, 0x73, 0xd3, 0xb8, 0xbc, 0x35, 0x4b, 0xd7, 0xb7,
0x66, 0xe9, 0xeb, 0xad, 0x59, 0x7a, 0xf3, 0xc8, 0x27, 0x2c, 0x98, 0x8d, 0x2c, 0x2f, 0x9e, 0xf6,
0xf5, 0xbf, 0xf5, 0xe2, 0xa7, 0xfc, 0xb6, 0x2c, 0x7f, 0x95, 0x46, 0x9b, 0x22, 0xfe, 0xf0, 0x67,
0x00, 0x00, 0x00, 0xff, 0xff, 0x88, 0xe8, 0x4c, 0x4d, 0xb0, 0x06, 0x00, 0x00,
}
func (m *ABCIResponses) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *ABCIResponses) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *ABCIResponses) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if m.FinalizeBlock != nil {
{
size, err := m.FinalizeBlock.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintTypes(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x12
}
return len(dAtA) - i, nil
// 662 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0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b7,
0x28, 0x94, 0x7b, 0xcc, 0x83, 0x98, 0x61, 0x36, 0x8b, 0x39, 0xf3, 0x23, 0xc4, 0x22, 0x7b, 0xab,
0x67, 0x1d, 0x6c, 0xa9, 0x20, 0x7a, 0xaa, 0x7e, 0x84, 0x58, 0x04, 0x77, 0x41, 0x0d, 0xa5, 0xa9,
0xa2, 0x34, 0x25, 0xa5, 0x8a, 0xd2, 0x54, 0x40, 0x83, 0xf7, 0x97, 0x73, 0xc7, 0xba, 0x9a, 0x3b,
0xd6, 0xaf, 0xb9, 0x63, 0x5d, 0xdc, 0x38, 0x95, 0xab, 0x1b, 0xa7, 0xf2, 0xe3, 0xc6, 0xa9, 0x7c,
0x7c, 0x11, 0x12, 0x1e, 0xcd, 0xc6, 0xee, 0x84, 0x4e, 0xfb, 0xe6, 0x67, 0xb7, 0xfc, 0xa9, 0x3e,
0xef, 0xcb, 0x7f, 0x0c, 0xe3, 0x4d, 0x59, 0x7f, 0xfe, 0x27, 0x00, 0x00, 0xff, 0xff, 0x3f, 0xca,
0x73, 0xb6, 0x33, 0x06, 0x00, 0x00,
}
func (m *ValidatorsInfo) Marshal() (dAtA []byte, err error) {
@@ -702,12 +615,12 @@ func (m *State) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i--
dAtA[i] = 0x32
}
n9, err9 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.LastBlockTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.LastBlockTime):])
if err9 != nil {
return 0, err9
n8, err8 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.LastBlockTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.LastBlockTime):])
if err8 != nil {
return 0, err8
}
i -= n9
i = encodeVarintTypes(dAtA, i, uint64(n9))
i -= n8
i = encodeVarintTypes(dAtA, i, uint64(n8))
i--
dAtA[i] = 0x2a
{
@@ -756,19 +669,6 @@ func encodeVarintTypes(dAtA []byte, offset int, v uint64) int {
dAtA[offset] = uint8(v)
return base
}
func (m *ABCIResponses) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
if m.FinalizeBlock != nil {
l = m.FinalizeBlock.Size()
n += 1 + l + sovTypes(uint64(l))
}
return n
}
func (m *ValidatorsInfo) Size() (n int) {
if m == nil {
return 0
@@ -873,92 +773,6 @@ func sovTypes(x uint64) (n int) {
func sozTypes(x uint64) (n int) {
return sovTypes(uint64((x << 1) ^ uint64((int64(x) >> 63))))
}
func (m *ABCIResponses) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTypes
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: ABCIResponses: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: ABCIResponses: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field FinalizeBlock", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTypes
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthTypes
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthTypes
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
if m.FinalizeBlock == nil {
m.FinalizeBlock = &types.ResponseFinalizeBlock{}
}
if err := m.FinalizeBlock.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipTypes(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthTypes
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *ValidatorsInfo) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
@@ -1018,7 +832,7 @@ func (m *ValidatorsInfo) Unmarshal(dAtA []byte) error {
return io.ErrUnexpectedEOF
}
if m.ValidatorSet == nil {
m.ValidatorSet = &types1.ValidatorSet{}
m.ValidatorSet = &types.ValidatorSet{}
}
if err := m.ValidatorSet.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
@@ -1490,7 +1304,7 @@ func (m *State) Unmarshal(dAtA []byte) error {
return io.ErrUnexpectedEOF
}
if m.NextValidators == nil {
m.NextValidators = &types1.ValidatorSet{}
m.NextValidators = &types.ValidatorSet{}
}
if err := m.NextValidators.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
@@ -1526,7 +1340,7 @@ func (m *State) Unmarshal(dAtA []byte) error {
return io.ErrUnexpectedEOF
}
if m.Validators == nil {
m.Validators = &types1.ValidatorSet{}
m.Validators = &types.ValidatorSet{}
}
if err := m.Validators.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
@@ -1562,7 +1376,7 @@ func (m *State) Unmarshal(dAtA []byte) error {
return io.ErrUnexpectedEOF
}
if m.LastValidators == nil {
m.LastValidators = &types1.ValidatorSet{}
m.LastValidators = &types.ValidatorSet{}
}
if err := m.LastValidators.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err

View File

@@ -4,20 +4,12 @@ package tendermint.state;
option go_package = "github.com/tendermint/tendermint/proto/tendermint/state";
import "gogoproto/gogo.proto";
import "tendermint/abci/types.proto";
import "tendermint/types/types.proto";
import "tendermint/types/validator.proto";
import "tendermint/types/params.proto";
import "tendermint/version/types.proto";
import "google/protobuf/timestamp.proto";
// ABCIResponses retains the responses
// of the various ABCI calls during block processing.
// It is persisted to disk for each height before calling Commit.
message ABCIResponses {
tendermint.abci.ResponseFinalizeBlock finalize_block = 2;
}
// ValidatorsInfo represents the latest validator set, or the last height it changed
message ValidatorsInfo {
tendermint.types.ValidatorSet validator_set = 1;