From 09df212c8feb99aeee5136ff3cc783c55c393346 Mon Sep 17 00:00:00 2001 From: Sergi Rene Date: Thu, 2 Jan 2025 13:49:03 +0100 Subject: [PATCH] rollback refactor --- block/block.go | 4 +- block/executor.go | 2 +- block/executor_test.go | 4 +- block/manager.go | 12 ++-- block/state.go | 9 +-- .../dymint/block/mock_ExecutorI.go | 21 ++++--- .../dymint/block/mock_FraudHandler.go | 2 +- .../dymint/da/avail/mock_SubstrateApiI.go | 2 +- .../celestia/types/mock_CelestiaRPCClient.go | 41 +++++++++---- .../da/mock_DataAvailabilityLayerClient.go | 2 +- .../dymint/p2p/mock_StateGetter.go | 2 +- .../settlement/dymension/mock_CosmosClient.go | 2 +- .../dymint/settlement/mock_ClientI.go | 2 +- .../dymensionxyz/dymint/store/mock_Store.go | 60 ++++++++++++++++++- .../dymension/rollapp/mock_QueryClient.go | 2 +- .../dymension/sequencer/mock_QueryClient.go | 2 +- .../tendermint/abci/types/mock_Application.go | 2 +- .../tendermint/proxy/mock_AppConnConsensus.go | 2 +- .../tendermint/proxy/mock_AppConns.go | 2 +- store/pruning.go | 4 +- store/storeIface.go | 2 + 21 files changed, 131 insertions(+), 50 deletions(-) diff --git a/block/block.go b/block/block.go index 75f935322..3adc83a12 100644 --- a/block/block.go +++ b/block/block.go @@ -68,7 +68,7 @@ func (m *Manager) applyBlock(block *types.Block, commit *types.Commit, blockMeta // In case the following true, it means we crashed after the app commit but before updating the state // In that case we'll want to align the state with the app commit result, as if the block was applied. if isBlockAlreadyApplied { - err := m.UpdateStateFromApp(block.Header.Hash()) + err := m.UpdateStateFromApp(block) if err != nil { return fmt.Errorf("update state from app: %w", err) } @@ -125,7 +125,7 @@ func (m *Manager) applyBlock(block *types.Block, commit *types.Commit, blockMeta } // Update the state with the new app hash, and store height from the commit. // Every one of those, if happens before commit, prevents us from re-executing the block in case failed during commit. - m.Executor.UpdateStateAfterCommit(m.State, responses, appHash, block.Header.Height, block.Header.Hash()) + m.Executor.UpdateStateAfterCommit(m.State, responses, appHash, block) } diff --git a/block/executor.go b/block/executor.go index ae04398d9..dfb4d0af3 100644 --- a/block/executor.go +++ b/block/executor.go @@ -30,7 +30,7 @@ type ExecutorI interface { ExecuteBlock(block *types.Block) (*tmstate.ABCIResponses, error) UpdateStateAfterInitChain(s *types.State, res *abci.ResponseInitChain) UpdateMempoolAfterInitChain(s *types.State) - UpdateStateAfterCommit(s *types.State, resp *tmstate.ABCIResponses, appHash []byte, height uint64, lastHeaderHash [32]byte) + UpdateStateAfterCommit(s *types.State, resp *tmstate.ABCIResponses, appHash []byte, block *types.Block) UpdateProposerFromBlock(s *types.State, seqSet *types.SequencerSet, block *types.Block) bool /* Consensus Messages */ diff --git a/block/executor_test.go b/block/executor_test.go index 369b38016..ab377c7b9 100644 --- a/block/executor_test.go +++ b/block/executor_test.go @@ -340,7 +340,7 @@ func TestApplyBlock(t *testing.T) { require.NotNil(resp) appHash, _, err := executor.Commit(state, block, resp) require.NoError(err) - executor.UpdateStateAfterCommit(state, resp, appHash, block.Header.Height, block.Header.Hash()) + executor.UpdateStateAfterCommit(state, resp, appHash, block) assert.Equal(uint64(1), state.Height()) assert.Equal(mockAppHash, state.AppHash) @@ -390,7 +390,7 @@ func TestApplyBlock(t *testing.T) { require.NotNil(resp) _, _, err = executor.Commit(state, block, resp) require.NoError(err) - executor.UpdateStateAfterCommit(state, resp, appHash, block.Header.Height, block.Header.Hash()) + executor.UpdateStateAfterCommit(state, resp, appHash, block) assert.Equal(uint64(2), state.Height()) // check rollapp params update diff --git a/block/manager.go b/block/manager.go index 00407c122..b4d2170fa 100644 --- a/block/manager.go +++ b/block/manager.go @@ -192,12 +192,6 @@ func NewManager( return nil, err } - // update dymint state with next revision info - err = m.updateStateForNextRevision() - if err != nil { - return nil, err - } - // validate configuration params and rollapp consensus params are in line err = m.ValidateConfigWithRollappParams() if err != nil { @@ -222,6 +216,12 @@ func (m *Manager) Start(ctx context.Context) error { } } + // update dymint state with next revision info + err := m.updateStateForNextRevision() + if err != nil { + return err + } + // Check if a proposer on the rollapp is set. In case no proposer is set on the Rollapp, fallback to the hub proposer (If such exists). // No proposer on the rollapp means that at some point there was no available proposer. // In case there is also no proposer on the hub to our current height, it means that the chain is halted. diff --git a/block/state.go b/block/state.go index 7b1991bc2..5c39dc915 100644 --- a/block/state.go +++ b/block/state.go @@ -74,7 +74,7 @@ func NewStateFromGenesis(genDoc *tmtypes.GenesisDoc) (*types.State, error) { } // UpdateStateFromApp is responsible for aligning the state of the store from the abci app -func (m *Manager) UpdateStateFromApp(blockHeaderHash [32]byte) error { +func (m *Manager) UpdateStateFromApp(block *types.Block) error { proxyAppInfo, err := m.Executor.GetAppInfo() if err != nil { return errorsmod.Wrap(err, "get app info") @@ -87,7 +87,7 @@ func (m *Manager) UpdateStateFromApp(blockHeaderHash [32]byte) error { } // update the state with the app hashes created on the app commit - m.Executor.UpdateStateAfterCommit(m.State, resp, proxyAppInfo.LastBlockAppHash, appHeight, blockHeaderHash) + m.Executor.UpdateStateAfterCommit(m.State, resp, proxyAppInfo.LastBlockAppHash, block) return nil } @@ -116,12 +116,13 @@ func (e *Executor) UpdateMempoolAfterInitChain(s *types.State) { } // UpdateStateAfterCommit updates the state with the app hash and last results hash -func (e *Executor) UpdateStateAfterCommit(s *types.State, resp *tmstate.ABCIResponses, appHash []byte, height uint64, lastHeaderHash [32]byte) { +func (e *Executor) UpdateStateAfterCommit(s *types.State, resp *tmstate.ABCIResponses, appHash []byte, block *types.Block) { copy(s.AppHash[:], appHash[:]) copy(s.LastResultsHash[:], tmtypes.NewResults(resp.DeliverTxs).Hash()) + lastHeaderHash := block.Header.Hash() copy(s.LastHeaderHash[:], lastHeaderHash[:]) - s.SetHeight(height) + s.SetHeight(block.Header.Height) if resp.EndBlock.ConsensusParamUpdates != nil { s.ConsensusParams.Block.MaxGas = resp.EndBlock.ConsensusParamUpdates.Block.MaxGas s.ConsensusParams.Block.MaxBytes = resp.EndBlock.ConsensusParamUpdates.Block.MaxBytes diff --git a/mocks/github.com/dymensionxyz/dymint/block/mock_ExecutorI.go b/mocks/github.com/dymensionxyz/dymint/block/mock_ExecutorI.go index 2ba9eee27..9b44e8280 100644 --- a/mocks/github.com/dymensionxyz/dymint/block/mock_ExecutorI.go +++ b/mocks/github.com/dymensionxyz/dymint/block/mock_ExecutorI.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.42.3. DO NOT EDIT. +// Code generated by mockery v2.49.0. DO NOT EDIT. package block @@ -498,9 +498,9 @@ func (_c *MockExecutorI_UpdateProposerFromBlock_Call) RunAndReturn(run func(*typ return _c } -// UpdateStateAfterCommit provides a mock function with given fields: s, resp, appHash, height, lastHeaderHash -func (_m *MockExecutorI) UpdateStateAfterCommit(s *types.State, resp *state.ABCIResponses, appHash []byte, height uint64, lastHeaderHash [32]byte) { - _m.Called(s, resp, appHash, height, lastHeaderHash) +// UpdateStateAfterCommit provides a mock function with given fields: s, resp, appHash, _a3 +func (_m *MockExecutorI) UpdateStateAfterCommit(s *types.State, resp *state.ABCIResponses, appHash []byte, _a3 *types.Block) { + _m.Called(s, resp, appHash, _a3) } // MockExecutorI_UpdateStateAfterCommit_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateStateAfterCommit' @@ -512,15 +512,14 @@ type MockExecutorI_UpdateStateAfterCommit_Call struct { // - s *types.State // - resp *state.ABCIResponses // - appHash []byte -// - height uint64 -// - lastHeaderHash [32]byte -func (_e *MockExecutorI_Expecter) UpdateStateAfterCommit(s interface{}, resp interface{}, appHash interface{}, height interface{}, lastHeaderHash interface{}) *MockExecutorI_UpdateStateAfterCommit_Call { - return &MockExecutorI_UpdateStateAfterCommit_Call{Call: _e.mock.On("UpdateStateAfterCommit", s, resp, appHash, height, lastHeaderHash)} +// - _a3 *types.Block +func (_e *MockExecutorI_Expecter) UpdateStateAfterCommit(s interface{}, resp interface{}, appHash interface{}, _a3 interface{}) *MockExecutorI_UpdateStateAfterCommit_Call { + return &MockExecutorI_UpdateStateAfterCommit_Call{Call: _e.mock.On("UpdateStateAfterCommit", s, resp, appHash, _a3)} } -func (_c *MockExecutorI_UpdateStateAfterCommit_Call) Run(run func(s *types.State, resp *state.ABCIResponses, appHash []byte, height uint64, lastHeaderHash [32]byte)) *MockExecutorI_UpdateStateAfterCommit_Call { +func (_c *MockExecutorI_UpdateStateAfterCommit_Call) Run(run func(s *types.State, resp *state.ABCIResponses, appHash []byte, _a3 *types.Block)) *MockExecutorI_UpdateStateAfterCommit_Call { _c.Call.Run(func(args mock.Arguments) { - run(args[0].(*types.State), args[1].(*state.ABCIResponses), args[2].([]byte), args[3].(uint64), args[4].([32]byte)) + run(args[0].(*types.State), args[1].(*state.ABCIResponses), args[2].([]byte), args[3].(*types.Block)) }) return _c } @@ -530,7 +529,7 @@ func (_c *MockExecutorI_UpdateStateAfterCommit_Call) Return() *MockExecutorI_Upd return _c } -func (_c *MockExecutorI_UpdateStateAfterCommit_Call) RunAndReturn(run func(*types.State, *state.ABCIResponses, []byte, uint64, [32]byte)) *MockExecutorI_UpdateStateAfterCommit_Call { +func (_c *MockExecutorI_UpdateStateAfterCommit_Call) RunAndReturn(run func(*types.State, *state.ABCIResponses, []byte, *types.Block)) *MockExecutorI_UpdateStateAfterCommit_Call { _c.Call.Return(run) return _c } diff --git a/mocks/github.com/dymensionxyz/dymint/block/mock_FraudHandler.go b/mocks/github.com/dymensionxyz/dymint/block/mock_FraudHandler.go index 932c51a2e..ab08feb5c 100644 --- a/mocks/github.com/dymensionxyz/dymint/block/mock_FraudHandler.go +++ b/mocks/github.com/dymensionxyz/dymint/block/mock_FraudHandler.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.42.3. DO NOT EDIT. +// Code generated by mockery v2.49.0. DO NOT EDIT. package block diff --git a/mocks/github.com/dymensionxyz/dymint/da/avail/mock_SubstrateApiI.go b/mocks/github.com/dymensionxyz/dymint/da/avail/mock_SubstrateApiI.go index 6a52c1df8..b5ced55f6 100644 --- a/mocks/github.com/dymensionxyz/dymint/da/avail/mock_SubstrateApiI.go +++ b/mocks/github.com/dymensionxyz/dymint/da/avail/mock_SubstrateApiI.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.42.3. DO NOT EDIT. +// Code generated by mockery v2.49.0. DO NOT EDIT. package avail diff --git a/mocks/github.com/dymensionxyz/dymint/da/celestia/types/mock_CelestiaRPCClient.go b/mocks/github.com/dymensionxyz/dymint/da/celestia/types/mock_CelestiaRPCClient.go index f80184e4f..ebcf34b80 100644 --- a/mocks/github.com/dymensionxyz/dymint/da/celestia/types/mock_CelestiaRPCClient.go +++ b/mocks/github.com/dymensionxyz/dymint/da/celestia/types/mock_CelestiaRPCClient.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.42.3. DO NOT EDIT. +// Code generated by mockery v2.49.0. DO NOT EDIT. package types @@ -9,9 +9,9 @@ import ( header "github.com/celestiaorg/celestia-openrpc/types/header" - mock "github.com/stretchr/testify/mock" + math "cosmossdk.io/math" - sdk "github.com/celestiaorg/celestia-openrpc/types/sdk" + mock "github.com/stretchr/testify/mock" share "github.com/celestiaorg/celestia-openrpc/types/share" ) @@ -271,23 +271,38 @@ func (_c *MockCelestiaRPCClient_GetProof_Call) RunAndReturn(run func(context.Con } // GetSignerBalance provides a mock function with given fields: ctx -func (_m *MockCelestiaRPCClient) GetSignerBalance(ctx context.Context) (*sdk.Coin, error) { +func (_m *MockCelestiaRPCClient) GetSignerBalance(ctx context.Context) (*struct { + Denom string `protobuf:"bytes,1,opt,name=denom,proto3" json:"denom,omitempty"` + Amount math.Int `protobuf:"bytes,2,opt,name=amount,proto3,customtype=Int" json:"amount"` +}, error) { ret := _m.Called(ctx) if len(ret) == 0 { panic("no return value specified for GetSignerBalance") } - var r0 *sdk.Coin + var r0 *struct { + Denom string `protobuf:"bytes,1,opt,name=denom,proto3" json:"denom,omitempty"` + Amount math.Int `protobuf:"bytes,2,opt,name=amount,proto3,customtype=Int" json:"amount"` + } var r1 error - if rf, ok := ret.Get(0).(func(context.Context) (*sdk.Coin, error)); ok { + if rf, ok := ret.Get(0).(func(context.Context) (*struct { + Denom string `protobuf:"bytes,1,opt,name=denom,proto3" json:"denom,omitempty"` + Amount math.Int `protobuf:"bytes,2,opt,name=amount,proto3,customtype=Int" json:"amount"` + }, error)); ok { return rf(ctx) } - if rf, ok := ret.Get(0).(func(context.Context) *sdk.Coin); ok { + if rf, ok := ret.Get(0).(func(context.Context) *struct { + Denom string `protobuf:"bytes,1,opt,name=denom,proto3" json:"denom,omitempty"` + Amount math.Int `protobuf:"bytes,2,opt,name=amount,proto3,customtype=Int" json:"amount"` + }); ok { r0 = rf(ctx) } else { if ret.Get(0) != nil { - r0 = ret.Get(0).(*sdk.Coin) + r0 = ret.Get(0).(*struct { + Denom string `protobuf:"bytes,1,opt,name=denom,proto3" json:"denom,omitempty"` + Amount math.Int `protobuf:"bytes,2,opt,name=amount,proto3,customtype=Int" json:"amount"` + }) } } @@ -318,12 +333,18 @@ func (_c *MockCelestiaRPCClient_GetSignerBalance_Call) Run(run func(ctx context. return _c } -func (_c *MockCelestiaRPCClient_GetSignerBalance_Call) Return(_a0 *sdk.Coin, _a1 error) *MockCelestiaRPCClient_GetSignerBalance_Call { +func (_c *MockCelestiaRPCClient_GetSignerBalance_Call) Return(_a0 *struct { + Denom string `protobuf:"bytes,1,opt,name=denom,proto3" json:"denom,omitempty"` + Amount math.Int `protobuf:"bytes,2,opt,name=amount,proto3,customtype=Int" json:"amount"` +}, _a1 error) *MockCelestiaRPCClient_GetSignerBalance_Call { _c.Call.Return(_a0, _a1) return _c } -func (_c *MockCelestiaRPCClient_GetSignerBalance_Call) RunAndReturn(run func(context.Context) (*sdk.Coin, error)) *MockCelestiaRPCClient_GetSignerBalance_Call { +func (_c *MockCelestiaRPCClient_GetSignerBalance_Call) RunAndReturn(run func(context.Context) (*struct { + Denom string `protobuf:"bytes,1,opt,name=denom,proto3" json:"denom,omitempty"` + Amount math.Int `protobuf:"bytes,2,opt,name=amount,proto3,customtype=Int" json:"amount"` +}, error)) *MockCelestiaRPCClient_GetSignerBalance_Call { _c.Call.Return(run) return _c } diff --git a/mocks/github.com/dymensionxyz/dymint/da/mock_DataAvailabilityLayerClient.go b/mocks/github.com/dymensionxyz/dymint/da/mock_DataAvailabilityLayerClient.go index 9c20b8b5c..bd817f65f 100644 --- a/mocks/github.com/dymensionxyz/dymint/da/mock_DataAvailabilityLayerClient.go +++ b/mocks/github.com/dymensionxyz/dymint/da/mock_DataAvailabilityLayerClient.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.42.3. DO NOT EDIT. +// Code generated by mockery v2.49.0. DO NOT EDIT. package da diff --git a/mocks/github.com/dymensionxyz/dymint/p2p/mock_StateGetter.go b/mocks/github.com/dymensionxyz/dymint/p2p/mock_StateGetter.go index 4377638cb..f34eeab9f 100644 --- a/mocks/github.com/dymensionxyz/dymint/p2p/mock_StateGetter.go +++ b/mocks/github.com/dymensionxyz/dymint/p2p/mock_StateGetter.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.42.3. DO NOT EDIT. +// Code generated by mockery v2.49.0. DO NOT EDIT. package p2p diff --git a/mocks/github.com/dymensionxyz/dymint/settlement/dymension/mock_CosmosClient.go b/mocks/github.com/dymensionxyz/dymint/settlement/dymension/mock_CosmosClient.go index ade8efe9b..1ca161696 100644 --- a/mocks/github.com/dymensionxyz/dymint/settlement/dymension/mock_CosmosClient.go +++ b/mocks/github.com/dymensionxyz/dymint/settlement/dymension/mock_CosmosClient.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.42.3. DO NOT EDIT. +// Code generated by mockery v2.49.0. DO NOT EDIT. package dymension diff --git a/mocks/github.com/dymensionxyz/dymint/settlement/mock_ClientI.go b/mocks/github.com/dymensionxyz/dymint/settlement/mock_ClientI.go index a609b4d42..d1cb2c2ec 100644 --- a/mocks/github.com/dymensionxyz/dymint/settlement/mock_ClientI.go +++ b/mocks/github.com/dymensionxyz/dymint/settlement/mock_ClientI.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.42.3. DO NOT EDIT. +// Code generated by mockery v2.49.0. DO NOT EDIT. package settlement diff --git a/mocks/github.com/dymensionxyz/dymint/store/mock_Store.go b/mocks/github.com/dymensionxyz/dymint/store/mock_Store.go index 5035e135f..de31f66f0 100644 --- a/mocks/github.com/dymensionxyz/dymint/store/mock_Store.go +++ b/mocks/github.com/dymensionxyz/dymint/store/mock_Store.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.42.3. DO NOT EDIT. +// Code generated by mockery v2.49.0. DO NOT EDIT. package store @@ -966,6 +966,64 @@ func (_c *MockStore_NewBatch_Call) RunAndReturn(run func() store.KVBatch) *MockS return _c } +// PruneHeights provides a mock function with given fields: from, to, logger +func (_m *MockStore) PruneHeights(from uint64, to uint64, logger types.Logger) (uint64, error) { + ret := _m.Called(from, to, logger) + + if len(ret) == 0 { + panic("no return value specified for PruneHeights") + } + + var r0 uint64 + var r1 error + if rf, ok := ret.Get(0).(func(uint64, uint64, types.Logger) (uint64, error)); ok { + return rf(from, to, logger) + } + if rf, ok := ret.Get(0).(func(uint64, uint64, types.Logger) uint64); ok { + r0 = rf(from, to, logger) + } else { + r0 = ret.Get(0).(uint64) + } + + if rf, ok := ret.Get(1).(func(uint64, uint64, types.Logger) error); ok { + r1 = rf(from, to, logger) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockStore_PruneHeights_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'PruneHeights' +type MockStore_PruneHeights_Call struct { + *mock.Call +} + +// PruneHeights is a helper method to define mock.On call +// - from uint64 +// - to uint64 +// - logger types.Logger +func (_e *MockStore_Expecter) PruneHeights(from interface{}, to interface{}, logger interface{}) *MockStore_PruneHeights_Call { + return &MockStore_PruneHeights_Call{Call: _e.mock.On("PruneHeights", from, to, logger)} +} + +func (_c *MockStore_PruneHeights_Call) Run(run func(from uint64, to uint64, logger types.Logger)) *MockStore_PruneHeights_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(uint64), args[1].(uint64), args[2].(types.Logger)) + }) + return _c +} + +func (_c *MockStore_PruneHeights_Call) Return(_a0 uint64, _a1 error) *MockStore_PruneHeights_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockStore_PruneHeights_Call) RunAndReturn(run func(uint64, uint64, types.Logger) (uint64, error)) *MockStore_PruneHeights_Call { + _c.Call.Return(run) + return _c +} + // PruneStore provides a mock function with given fields: to, logger func (_m *MockStore) PruneStore(to uint64, logger types.Logger) (uint64, error) { ret := _m.Called(to, logger) diff --git a/mocks/github.com/dymensionxyz/dymint/types/pb/dymensionxyz/dymension/rollapp/mock_QueryClient.go b/mocks/github.com/dymensionxyz/dymint/types/pb/dymensionxyz/dymension/rollapp/mock_QueryClient.go index 80d7ab986..40cc251f5 100644 --- a/mocks/github.com/dymensionxyz/dymint/types/pb/dymensionxyz/dymension/rollapp/mock_QueryClient.go +++ b/mocks/github.com/dymensionxyz/dymint/types/pb/dymensionxyz/dymension/rollapp/mock_QueryClient.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.42.3. DO NOT EDIT. +// Code generated by mockery v2.49.0. DO NOT EDIT. package rollapp diff --git a/mocks/github.com/dymensionxyz/dymint/types/pb/dymensionxyz/dymension/sequencer/mock_QueryClient.go b/mocks/github.com/dymensionxyz/dymint/types/pb/dymensionxyz/dymension/sequencer/mock_QueryClient.go index af5bcaf4b..de9943b14 100644 --- a/mocks/github.com/dymensionxyz/dymint/types/pb/dymensionxyz/dymension/sequencer/mock_QueryClient.go +++ b/mocks/github.com/dymensionxyz/dymint/types/pb/dymensionxyz/dymension/sequencer/mock_QueryClient.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.42.3. DO NOT EDIT. +// Code generated by mockery v2.49.0. DO NOT EDIT. package sequencer diff --git a/mocks/github.com/tendermint/tendermint/abci/types/mock_Application.go b/mocks/github.com/tendermint/tendermint/abci/types/mock_Application.go index 7393ef94e..5a400da62 100644 --- a/mocks/github.com/tendermint/tendermint/abci/types/mock_Application.go +++ b/mocks/github.com/tendermint/tendermint/abci/types/mock_Application.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.42.3. DO NOT EDIT. +// Code generated by mockery v2.49.0. DO NOT EDIT. package types diff --git a/mocks/github.com/tendermint/tendermint/proxy/mock_AppConnConsensus.go b/mocks/github.com/tendermint/tendermint/proxy/mock_AppConnConsensus.go index 9ec6b2d18..64fc64665 100644 --- a/mocks/github.com/tendermint/tendermint/proxy/mock_AppConnConsensus.go +++ b/mocks/github.com/tendermint/tendermint/proxy/mock_AppConnConsensus.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.42.3. DO NOT EDIT. +// Code generated by mockery v2.49.0. DO NOT EDIT. package proxy diff --git a/mocks/github.com/tendermint/tendermint/proxy/mock_AppConns.go b/mocks/github.com/tendermint/tendermint/proxy/mock_AppConns.go index affc90a4e..096a335eb 100644 --- a/mocks/github.com/tendermint/tendermint/proxy/mock_AppConns.go +++ b/mocks/github.com/tendermint/tendermint/proxy/mock_AppConns.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.42.3. DO NOT EDIT. +// Code generated by mockery v2.49.0. DO NOT EDIT. package proxy diff --git a/store/pruning.go b/store/pruning.go index 5940f8ae9..cac5dca6b 100644 --- a/store/pruning.go +++ b/store/pruning.go @@ -17,7 +17,7 @@ func (s *DefaultStore) PruneStore(to uint64, logger types.Logger) (uint64, error } else if err != nil { return pruned, err } - pruned, err = s.pruneHeights(from, to, logger) + pruned, err = s.PruneHeights(from, to, logger) if err != nil { return pruned, fmt.Errorf("pruning blocks. from: %d to: %d: err:%w", from, to, err) } @@ -30,7 +30,7 @@ func (s *DefaultStore) PruneStore(to uint64, logger types.Logger) (uint64, error } // pruneHeights prunes all store entries that are stored along blocks (blocks,commit,proposer, etc) -func (s *DefaultStore) pruneHeights(from, to uint64, logger types.Logger) (uint64, error) { +func (s *DefaultStore) PruneHeights(from, to uint64, logger types.Logger) (uint64, error) { pruneBlocks := func(batch KVBatch, height uint64) error { hash, err := s.loadHashFromIndex(height) if err != nil { diff --git a/store/storeIface.go b/store/storeIface.go index 8220b25ad..bcb8019bf 100644 --- a/store/storeIface.go +++ b/store/storeIface.go @@ -76,6 +76,8 @@ type Store interface { PruneStore(to uint64, logger types.Logger) (uint64, error) + PruneHeights(from, to uint64, logger types.Logger) (uint64, error) + SaveBlockCid(height uint64, cid cid.Cid, batch KVBatch) (KVBatch, error) LoadBlockCid(height uint64) (cid.Cid, error)