diff --git a/common/constants.go b/common/constants.go index 3bba5c1fa4b..e610cff773c 100644 --- a/common/constants.go +++ b/common/constants.go @@ -363,9 +363,6 @@ const MetricTotalFees = "erd_total_fees" // MetricEpochForEconomicsData holds the epoch for which economics data are computed const MetricEpochForEconomicsData = "erd_epoch_for_economics_data" -// MetricOldestKeptEpoch holds the earliest epoch that exists in the node's configuration -const MetricOldestKeptEpoch = "erd_oldest_kept_epoch" - // MetachainShardId will be used to identify a shard ID as metachain const MetachainShardId = uint32(0xFFFFFFFF) diff --git a/epochStart/bootstrap/metaStorageHandler.go b/epochStart/bootstrap/metaStorageHandler.go index 46bf84a3a73..a4be4789f91 100644 --- a/epochStart/bootstrap/metaStorageHandler.go +++ b/epochStart/bootstrap/metaStorageHandler.go @@ -36,7 +36,6 @@ func NewMetaStorageHandler( currentEpoch uint32, uint64Converter typeConverters.Uint64ByteSliceConverter, nodeTypeProvider NodeTypeProviderHandler, - statusHandler core.AppStatusHandler, ) (*metaStorageHandler, error) { epochStartNotifier := &disabled.EpochStartNotifier{} storageFactory, err := factory.NewStorageServiceFactory( @@ -48,7 +47,6 @@ func NewMetaStorageHandler( EpochStartNotifier: epochStartNotifier, NodeTypeProvider: nodeTypeProvider, CurrentEpoch: currentEpoch, - StatusHandler: statusHandler, CreateTrieEpochRootHashStorer: false, }, ) diff --git a/epochStart/bootstrap/metaStorageHandler_test.go b/epochStart/bootstrap/metaStorageHandler_test.go index 9fafe1930b8..30006cb7955 100644 --- a/epochStart/bootstrap/metaStorageHandler_test.go +++ b/epochStart/bootstrap/metaStorageHandler_test.go @@ -14,7 +14,6 @@ import ( "github.com/ElrondNetwork/elrond-go/testscommon" "github.com/ElrondNetwork/elrond-go/testscommon/hashingMocks" "github.com/ElrondNetwork/elrond-go/testscommon/nodeTypeProviderMock" - "github.com/ElrondNetwork/elrond-go/testscommon/statusHandler" "github.com/stretchr/testify/assert" ) @@ -27,9 +26,8 @@ func TestNewMetaStorageHandler_InvalidConfigErr(t *testing.T) { hasher := &hashingMocks.HasherMock{} uit64Cvt := &mock.Uint64ByteSliceConverterMock{} nodeTypeProvider := &nodeTypeProviderMock.NodeTypeProviderStub{} - statusHandlerMock := &statusHandler.AppStatusHandlerMock{} - mtStrHandler, err := NewMetaStorageHandler(gCfg, prefsConfig, coordinator, pathManager, marshalizer, hasher, 1, uit64Cvt, nodeTypeProvider, statusHandlerMock) + mtStrHandler, err := NewMetaStorageHandler(gCfg, prefsConfig, coordinator, pathManager, marshalizer, hasher, 1, uit64Cvt, nodeTypeProvider) assert.True(t, check.IfNil(mtStrHandler)) assert.NotNil(t, err) } @@ -47,9 +45,7 @@ func TestNewMetaStorageHandler_CreateForMetaErr(t *testing.T) { hasher := &hashingMocks.HasherMock{} uit64Cvt := &mock.Uint64ByteSliceConverterMock{} nodeTypeProvider := &nodeTypeProviderMock.NodeTypeProviderStub{} - statusHandlerMock := &statusHandler.AppStatusHandlerMock{} - - mtStrHandler, err := NewMetaStorageHandler(gCfg, prefsConfig, coordinator, pathManager, marshalizer, hasher, 1, uit64Cvt, nodeTypeProvider, statusHandlerMock) + mtStrHandler, err := NewMetaStorageHandler(gCfg, prefsConfig, coordinator, pathManager, marshalizer, hasher, 1, uit64Cvt, nodeTypeProvider) assert.False(t, check.IfNil(mtStrHandler)) assert.Nil(t, err) } @@ -67,9 +63,8 @@ func TestMetaStorageHandler_saveLastHeader(t *testing.T) { hasher := &hashingMocks.HasherMock{} uit64Cvt := &mock.Uint64ByteSliceConverterMock{} nodeTypeProvider := &nodeTypeProviderMock.NodeTypeProviderStub{} - statusHandlerMock := &statusHandler.AppStatusHandlerMock{} - mtStrHandler, _ := NewMetaStorageHandler(gCfg, prefsConfig, coordinator, pathManager, marshalizer, hasher, 1, uit64Cvt, nodeTypeProvider, statusHandlerMock) + mtStrHandler, _ := NewMetaStorageHandler(gCfg, prefsConfig, coordinator, pathManager, marshalizer, hasher, 1, uit64Cvt, nodeTypeProvider) header := &block.MetaBlock{Nonce: 0} @@ -96,9 +91,8 @@ func TestMetaStorageHandler_saveLastCrossNotarizedHeaders(t *testing.T) { hasher := &hashingMocks.HasherMock{} uit64Cvt := &mock.Uint64ByteSliceConverterMock{} nodeTypeProvider := &nodeTypeProviderMock.NodeTypeProviderStub{} - statusHandlerMock := &statusHandler.AppStatusHandlerMock{} - mtStrHandler, _ := NewMetaStorageHandler(gCfg, prefsConfig, coordinator, pathManager, marshalizer, hasher, 1, uit64Cvt, nodeTypeProvider, statusHandlerMock) + mtStrHandler, _ := NewMetaStorageHandler(gCfg, prefsConfig, coordinator, pathManager, marshalizer, hasher, 1, uit64Cvt, nodeTypeProvider) hdr1 := &block.Header{Nonce: 1} hdr2 := &block.Header{Nonce: 2} @@ -131,9 +125,8 @@ func TestMetaStorageHandler_saveTriggerRegistry(t *testing.T) { hasher := &hashingMocks.HasherMock{} uit64Cvt := &mock.Uint64ByteSliceConverterMock{} nodeTypeProvider := &nodeTypeProviderMock.NodeTypeProviderStub{} - statusHandlerMock := &statusHandler.AppStatusHandlerMock{} - mtStrHandler, _ := NewMetaStorageHandler(gCfg, prefsConfig, coordinator, pathManager, marshalizer, hasher, 1, uit64Cvt, nodeTypeProvider, statusHandlerMock) + mtStrHandler, _ := NewMetaStorageHandler(gCfg, prefsConfig, coordinator, pathManager, marshalizer, hasher, 1, uit64Cvt, nodeTypeProvider) components := &ComponentsNeededForBootstrap{ EpochStartMetaBlock: &block.MetaBlock{Nonce: 3}, @@ -157,9 +150,8 @@ func TestMetaStorageHandler_saveDataToStorage(t *testing.T) { hasher := &hashingMocks.HasherMock{} uit64Cvt := &mock.Uint64ByteSliceConverterMock{} nodeTypeProvider := &nodeTypeProviderMock.NodeTypeProviderStub{} - statusHandlerMock := &statusHandler.AppStatusHandlerMock{} - mtStrHandler, _ := NewMetaStorageHandler(gCfg, prefsConfig, coordinator, pathManager, marshalizer, hasher, 1, uit64Cvt, nodeTypeProvider, statusHandlerMock) + mtStrHandler, _ := NewMetaStorageHandler(gCfg, prefsConfig, coordinator, pathManager, marshalizer, hasher, 1, uit64Cvt, nodeTypeProvider) components := &ComponentsNeededForBootstrap{ EpochStartMetaBlock: &block.MetaBlock{Nonce: 3}, diff --git a/epochStart/bootstrap/process.go b/epochStart/bootstrap/process.go index 5a9b582e6e2..c20c647d817 100644 --- a/epochStart/bootstrap/process.go +++ b/epochStart/bootstrap/process.go @@ -747,7 +747,6 @@ func (e *epochStartBootstrap) requestAndProcessForMeta(peerMiniBlocks []*block.M e.epochStartMeta.GetEpoch(), e.coreComponentsHolder.Uint64ByteSliceConverter(), e.coreComponentsHolder.NodeTypeProvider(), - e.coreComponentsHolder.StatusHandler(), ) if err != nil { return err @@ -914,7 +913,6 @@ func (e *epochStartBootstrap) requestAndProcessForShard(peerMiniBlocks []*block. e.baseData.lastEpoch, e.coreComponentsHolder.Uint64ByteSliceConverter(), e.coreComponentsHolder.NodeTypeProvider(), - e.coreComponentsHolder.StatusHandler(), ) if err != nil { return err @@ -1090,7 +1088,6 @@ func (e *epochStartBootstrap) createStorageService( EpochStartNotifier: epochStartNotifier, NodeTypeProvider: e.coreComponentsHolder.NodeTypeProvider(), CurrentEpoch: startEpoch, - StatusHandler: e.coreComponentsHolder.StatusHandler(), CreateTrieEpochRootHashStorer: createTrieEpochRootHashStorer, }) if err != nil { diff --git a/epochStart/bootstrap/shardStorageHandler.go b/epochStart/bootstrap/shardStorageHandler.go index c91261239f0..6ab02f6894d 100644 --- a/epochStart/bootstrap/shardStorageHandler.go +++ b/epochStart/bootstrap/shardStorageHandler.go @@ -40,7 +40,6 @@ func NewShardStorageHandler( currentEpoch uint32, uint64Converter typeConverters.Uint64ByteSliceConverter, nodeTypeProvider core.NodeTypeProviderHandler, - statusHandler core.AppStatusHandler, ) (*shardStorageHandler, error) { epochStartNotifier := &disabled.EpochStartNotifier{} storageFactory, err := factory.NewStorageServiceFactory( @@ -52,7 +51,6 @@ func NewShardStorageHandler( EpochStartNotifier: epochStartNotifier, NodeTypeProvider: nodeTypeProvider, CurrentEpoch: currentEpoch, - StatusHandler: statusHandler, CreateTrieEpochRootHashStorer: false, }, ) diff --git a/epochStart/bootstrap/shardStorageHandler_test.go b/epochStart/bootstrap/shardStorageHandler_test.go index 04bcd886623..16b6db91453 100644 --- a/epochStart/bootstrap/shardStorageHandler_test.go +++ b/epochStart/bootstrap/shardStorageHandler_test.go @@ -26,7 +26,6 @@ import ( epochStartMocks "github.com/ElrondNetwork/elrond-go/testscommon/bootstrapMocks/epochStart" "github.com/ElrondNetwork/elrond-go/testscommon/hashingMocks" "github.com/ElrondNetwork/elrond-go/testscommon/nodeTypeProviderMock" - "github.com/ElrondNetwork/elrond-go/testscommon/statusHandler" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) @@ -37,7 +36,7 @@ func TestNewShardStorageHandler_ShouldWork(t *testing.T) { }() args := createDefaultShardStorageArgs() - shardStorage, err := NewShardStorageHandler(args.generalConfig, args.prefsConfig, args.shardCoordinator, args.pathManagerHandler, args.marshalizer, args.hasher, 1, args.uint64Converter, args.nodeTypeProvider, args.statusHandler) + shardStorage, err := NewShardStorageHandler(args.generalConfig, args.prefsConfig, args.shardCoordinator, args.pathManagerHandler, args.marshalizer, args.hasher, 1, args.uint64Converter, args.nodeTypeProvider) assert.False(t, check.IfNil(shardStorage)) assert.Nil(t, err) @@ -49,7 +48,7 @@ func TestShardStorageHandler_SaveDataToStorageShardDataNotFound(t *testing.T) { }() args := createDefaultShardStorageArgs() - shardStorage, _ := NewShardStorageHandler(args.generalConfig, args.prefsConfig, args.shardCoordinator, args.pathManagerHandler, args.marshalizer, args.hasher, 1, args.uint64Converter, args.nodeTypeProvider, args.statusHandler) + shardStorage, _ := NewShardStorageHandler(args.generalConfig, args.prefsConfig, args.shardCoordinator, args.pathManagerHandler, args.marshalizer, args.hasher, 1, args.uint64Converter, args.nodeTypeProvider) components := &ComponentsNeededForBootstrap{ EpochStartMetaBlock: &block.MetaBlock{Epoch: 1}, @@ -67,7 +66,7 @@ func TestShardStorageHandler_SaveDataToStorageMissingHeader(t *testing.T) { }() args := createDefaultShardStorageArgs() - shardStorage, _ := NewShardStorageHandler(args.generalConfig, args.prefsConfig, args.shardCoordinator, args.pathManagerHandler, args.marshalizer, args.hasher, 1, args.uint64Converter, args.nodeTypeProvider, args.statusHandler) + shardStorage, _ := NewShardStorageHandler(args.generalConfig, args.prefsConfig, args.shardCoordinator, args.pathManagerHandler, args.marshalizer, args.hasher, 1, args.uint64Converter, args.nodeTypeProvider) components := &ComponentsNeededForBootstrap{ EpochStartMetaBlock: &block.MetaBlock{ @@ -92,7 +91,7 @@ func TestShardStorageHandler_SaveDataToStorage(t *testing.T) { }() args := createDefaultShardStorageArgs() - shardStorage, _ := NewShardStorageHandler(args.generalConfig, args.prefsConfig, args.shardCoordinator, args.pathManagerHandler, args.marshalizer, args.hasher, 1, args.uint64Converter, args.nodeTypeProvider, args.statusHandler) + shardStorage, _ := NewShardStorageHandler(args.generalConfig, args.prefsConfig, args.shardCoordinator, args.pathManagerHandler, args.marshalizer, args.hasher, 1, args.uint64Converter, args.nodeTypeProvider) hash1 := []byte("hash1") hdr1 := block.MetaBlock{ @@ -191,7 +190,7 @@ func TestShardStorageHandler_getCrossProcessedMiniBlockHeadersDestMe(t *testing. mbs := append(intraMbs, crossMbs...) args := createDefaultShardStorageArgs() - shardStorage, _ := NewShardStorageHandler(args.generalConfig, args.prefsConfig, args.shardCoordinator, args.pathManagerHandler, args.marshalizer, args.hasher, 1, args.uint64Converter, args.nodeTypeProvider, args.statusHandler) + shardStorage, _ := NewShardStorageHandler(args.generalConfig, args.prefsConfig, args.shardCoordinator, args.pathManagerHandler, args.marshalizer, args.hasher, 1, args.uint64Converter, args.nodeTypeProvider) shardHeader := &block.Header{ Nonce: 100, MiniBlockHeaders: mbs, @@ -211,7 +210,7 @@ func TestShardStorageHandler_getProcessedAndPendingMiniBlocksWithScheduledErrorG t.Parallel() args := createDefaultShardStorageArgs() - shardStorage, _ := NewShardStorageHandler(args.generalConfig, args.prefsConfig, args.shardCoordinator, args.pathManagerHandler, args.marshalizer, args.hasher, 1, args.uint64Converter, args.nodeTypeProvider, args.statusHandler) + shardStorage, _ := NewShardStorageHandler(args.generalConfig, args.prefsConfig, args.shardCoordinator, args.pathManagerHandler, args.marshalizer, args.hasher, 1, args.uint64Converter, args.nodeTypeProvider) meta := &block.MetaBlock{ Nonce: 100, EpochStart: block.EpochStart{}, @@ -229,7 +228,7 @@ func TestShardStorageHandler_getProcessedAndPendingMiniBlocksWithScheduledNoSche t.Parallel() args := createDefaultShardStorageArgs() - shardStorage, _ := NewShardStorageHandler(args.generalConfig, args.prefsConfig, args.shardCoordinator, args.pathManagerHandler, args.marshalizer, args.hasher, 1, args.uint64Converter, args.nodeTypeProvider, args.statusHandler) + shardStorage, _ := NewShardStorageHandler(args.generalConfig, args.prefsConfig, args.shardCoordinator, args.pathManagerHandler, args.marshalizer, args.hasher, 1, args.uint64Converter, args.nodeTypeProvider) scenario := createPendingAndProcessedMiniBlocksScenario() processedMiniBlocks, pendingMiniBlocks, err := shardStorage.getProcessedAndPendingMiniBlocksWithScheduled(scenario.metaBlock, scenario.headers, scenario.shardHeader, false) @@ -244,7 +243,7 @@ func TestShardStorageHandler_getProcessedAndPendingMiniBlocksWithScheduledWrongH t.Parallel() args := createDefaultShardStorageArgs() - shardStorage, _ := NewShardStorageHandler(args.generalConfig, args.prefsConfig, args.shardCoordinator, args.pathManagerHandler, args.marshalizer, args.hasher, 1, args.uint64Converter, args.nodeTypeProvider, args.statusHandler) + shardStorage, _ := NewShardStorageHandler(args.generalConfig, args.prefsConfig, args.shardCoordinator, args.pathManagerHandler, args.marshalizer, args.hasher, 1, args.uint64Converter, args.nodeTypeProvider) scenario := createPendingAndProcessedMiniBlocksScenario() wrongShardHeader := &block.MetaBlock{} @@ -266,7 +265,7 @@ func TestShardStorageHandler_getProcessedAndPendingMiniBlocksWithScheduled(t *te t.Parallel() args := createDefaultShardStorageArgs() - shardStorage, _ := NewShardStorageHandler(args.generalConfig, args.prefsConfig, args.shardCoordinator, args.pathManagerHandler, args.marshalizer, args.hasher, 1, args.uint64Converter, args.nodeTypeProvider, args.statusHandler) + shardStorage, _ := NewShardStorageHandler(args.generalConfig, args.prefsConfig, args.shardCoordinator, args.pathManagerHandler, args.marshalizer, args.hasher, 1, args.uint64Converter, args.nodeTypeProvider) scenario := createPendingAndProcessedMiniBlocksScenario() processedMiniBlocks, pendingMiniBlocks, err := shardStorage.getProcessedAndPendingMiniBlocksWithScheduled(scenario.metaBlock, scenario.headers, scenario.shardHeader, true) @@ -434,7 +433,7 @@ func TestShardStorageHandler_getProcessedAndPendingMiniBlocksErrorGettingEpochSt }() args := createDefaultShardStorageArgs() - shardStorage, _ := NewShardStorageHandler(args.generalConfig, args.prefsConfig, args.shardCoordinator, args.pathManagerHandler, args.marshalizer, args.hasher, 1, args.uint64Converter, args.nodeTypeProvider, args.statusHandler) + shardStorage, _ := NewShardStorageHandler(args.generalConfig, args.prefsConfig, args.shardCoordinator, args.pathManagerHandler, args.marshalizer, args.hasher, 1, args.uint64Converter, args.nodeTypeProvider) meta := &block.MetaBlock{ Nonce: 100, EpochStart: block.EpochStart{}, @@ -457,7 +456,7 @@ func TestShardStorageHandler_getProcessedAndPendingMiniBlocksMissingHeader(t *te lastFinishedMetaBlock := "last finished meta block" args := createDefaultShardStorageArgs() - shardStorage, _ := NewShardStorageHandler(args.generalConfig, args.prefsConfig, args.shardCoordinator, args.pathManagerHandler, args.marshalizer, args.hasher, 1, args.uint64Converter, args.nodeTypeProvider, args.statusHandler) + shardStorage, _ := NewShardStorageHandler(args.generalConfig, args.prefsConfig, args.shardCoordinator, args.pathManagerHandler, args.marshalizer, args.hasher, 1, args.uint64Converter, args.nodeTypeProvider) meta := &block.MetaBlock{ Nonce: 100, EpochStart: block.EpochStart{ @@ -483,7 +482,7 @@ func TestShardStorageHandler_getProcessedAndPendingMiniBlocksWrongHeader(t *test lastFinishedMetaBlockHash := "last finished meta block" firstPendingMeta := "first pending meta" args := createDefaultShardStorageArgs() - shardStorage, _ := NewShardStorageHandler(args.generalConfig, args.prefsConfig, args.shardCoordinator, args.pathManagerHandler, args.marshalizer, args.hasher, 1, args.uint64Converter, args.nodeTypeProvider, args.statusHandler) + shardStorage, _ := NewShardStorageHandler(args.generalConfig, args.prefsConfig, args.shardCoordinator, args.pathManagerHandler, args.marshalizer, args.hasher, 1, args.uint64Converter, args.nodeTypeProvider) lastFinishedHeaders := createDefaultEpochStartShardData([]byte(lastFinishedMetaBlockHash), []byte("headerHash")) lastFinishedHeaders[0].FirstPendingMetaBlock = []byte(firstPendingMeta) meta := &block.MetaBlock{ @@ -514,7 +513,7 @@ func TestShardStorageHandler_getProcessedAndPendingMiniBlocksNilMetaBlock(t *tes lastFinishedMetaBlockHash := "last finished meta block" firstPendingMeta := "first pending meta" args := createDefaultShardStorageArgs() - shardStorage, _ := NewShardStorageHandler(args.generalConfig, args.prefsConfig, args.shardCoordinator, args.pathManagerHandler, args.marshalizer, args.hasher, 1, args.uint64Converter, args.nodeTypeProvider, args.statusHandler) + shardStorage, _ := NewShardStorageHandler(args.generalConfig, args.prefsConfig, args.shardCoordinator, args.pathManagerHandler, args.marshalizer, args.hasher, 1, args.uint64Converter, args.nodeTypeProvider) lastFinishedHeaders := createDefaultEpochStartShardData([]byte(lastFinishedMetaBlockHash), []byte("headerHash")) lastFinishedHeaders[0].FirstPendingMetaBlock = []byte(firstPendingMeta) meta := &block.MetaBlock{ @@ -547,7 +546,7 @@ func TestShardStorageHandler_getProcessedAndPendingMiniBlocksNoProcessedNoPendin lastFinishedMetaBlockHash := "last finished meta block" firstPendingMeta := "first pending meta" args := createDefaultShardStorageArgs() - shardStorage, _ := NewShardStorageHandler(args.generalConfig, args.prefsConfig, args.shardCoordinator, args.pathManagerHandler, args.marshalizer, args.hasher, 1, args.uint64Converter, args.nodeTypeProvider, args.statusHandler) + shardStorage, _ := NewShardStorageHandler(args.generalConfig, args.prefsConfig, args.shardCoordinator, args.pathManagerHandler, args.marshalizer, args.hasher, 1, args.uint64Converter, args.nodeTypeProvider) lastFinishedHeaders := createDefaultEpochStartShardData([]byte(lastFinishedMetaBlockHash), []byte("headerHash")) lastFinishedHeaders[0].FirstPendingMetaBlock = []byte(firstPendingMeta) lastFinishedHeaders[0].PendingMiniBlockHeaders = nil @@ -576,7 +575,7 @@ func TestShardStorageHandler_getProcessedAndPendingMiniBlocksWithProcessedAndPen t.Parallel() args := createDefaultShardStorageArgs() - shardStorage, _ := NewShardStorageHandler(args.generalConfig, args.prefsConfig, args.shardCoordinator, args.pathManagerHandler, args.marshalizer, args.hasher, 1, args.uint64Converter, args.nodeTypeProvider, args.statusHandler) + shardStorage, _ := NewShardStorageHandler(args.generalConfig, args.prefsConfig, args.shardCoordinator, args.pathManagerHandler, args.marshalizer, args.hasher, 1, args.uint64Converter, args.nodeTypeProvider) scenario := createPendingAndProcessedMiniBlocksScenario() processedMiniBlocks, pendingMiniBlocks, firstPendingMetaBlockHash, err := shardStorage.getProcessedAndPendingMiniBlocks(scenario.metaBlock, scenario.headers) @@ -594,7 +593,7 @@ func TestShardStorageHandler_saveLastCrossNotarizedHeadersWithoutScheduledGetSha }() args := createDefaultShardStorageArgs() - shardStorage, _ := NewShardStorageHandler(args.generalConfig, args.prefsConfig, args.shardCoordinator, args.pathManagerHandler, args.marshalizer, args.hasher, 1, args.uint64Converter, args.nodeTypeProvider, args.statusHandler) + shardStorage, _ := NewShardStorageHandler(args.generalConfig, args.prefsConfig, args.shardCoordinator, args.pathManagerHandler, args.marshalizer, args.hasher, 1, args.uint64Converter, args.nodeTypeProvider) headers := map[string]data.HeaderHandler{} meta := &block.MetaBlock{ @@ -615,7 +614,7 @@ func TestShardStorageHandler_saveLastCrossNotarizedHeadersWithoutScheduledMissin }() args := createDefaultShardStorageArgs() - shardStorage, _ := NewShardStorageHandler(args.generalConfig, args.prefsConfig, args.shardCoordinator, args.pathManagerHandler, args.marshalizer, args.hasher, 1, args.uint64Converter, args.nodeTypeProvider, args.statusHandler) + shardStorage, _ := NewShardStorageHandler(args.generalConfig, args.prefsConfig, args.shardCoordinator, args.pathManagerHandler, args.marshalizer, args.hasher, 1, args.uint64Converter, args.nodeTypeProvider) shard0HeaderHash := "shard0 header hash" lastFinishedMetaBlock := "last finished meta block" @@ -644,7 +643,7 @@ func TestShardStorageHandler_saveLastCrossNotarizedHeadersWithoutScheduledWrongT }() args := createDefaultShardStorageArgs() - shardStorage, _ := NewShardStorageHandler(args.generalConfig, args.prefsConfig, args.shardCoordinator, args.pathManagerHandler, args.marshalizer, args.hasher, 1, args.uint64Converter, args.nodeTypeProvider, args.statusHandler) + shardStorage, _ := NewShardStorageHandler(args.generalConfig, args.prefsConfig, args.shardCoordinator, args.pathManagerHandler, args.marshalizer, args.hasher, 1, args.uint64Converter, args.nodeTypeProvider) shard0HeaderHash := "shard0 header hash" lastFinishedMetaBlock := "last finished meta block" @@ -680,7 +679,7 @@ func TestShardStorageHandler_saveLastCrossNotarizedHeadersWithoutScheduledErrorW args.marshalizer = &testscommon.MarshalizerStub{MarshalCalled: func(obj interface{}) ([]byte, error) { return nil, expectedErr }} - shardStorage, _ := NewShardStorageHandler(args.generalConfig, args.prefsConfig, args.shardCoordinator, args.pathManagerHandler, args.marshalizer, args.hasher, 1, args.uint64Converter, args.nodeTypeProvider, args.statusHandler) + shardStorage, _ := NewShardStorageHandler(args.generalConfig, args.prefsConfig, args.shardCoordinator, args.pathManagerHandler, args.marshalizer, args.hasher, 1, args.uint64Converter, args.nodeTypeProvider) shard0HeaderHash := "shard0 header hash" lastFinishedMetaBlock := "last finished meta block" @@ -711,7 +710,7 @@ func TestShardStorageHandler_saveLastCrossNotarizedHeadersWithoutScheduled(t *te }() args := createDefaultShardStorageArgs() - shardStorage, _ := NewShardStorageHandler(args.generalConfig, args.prefsConfig, args.shardCoordinator, args.pathManagerHandler, args.marshalizer, args.hasher, 1, args.uint64Converter, args.nodeTypeProvider, args.statusHandler) + shardStorage, _ := NewShardStorageHandler(args.generalConfig, args.prefsConfig, args.shardCoordinator, args.pathManagerHandler, args.marshalizer, args.hasher, 1, args.uint64Converter, args.nodeTypeProvider) shard0HeaderHash := "shard0 header hash" lastFinishedMetaBlock := "last finished meta block" @@ -747,7 +746,7 @@ func TestShardStorageHandler_saveLastCrossNotarizedHeadersWithScheduledErrorUpda }() args := createDefaultShardStorageArgs() - shardStorage, _ := NewShardStorageHandler(args.generalConfig, args.prefsConfig, args.shardCoordinator, args.pathManagerHandler, args.marshalizer, args.hasher, 1, args.uint64Converter, args.nodeTypeProvider, args.statusHandler) + shardStorage, _ := NewShardStorageHandler(args.generalConfig, args.prefsConfig, args.shardCoordinator, args.pathManagerHandler, args.marshalizer, args.hasher, 1, args.uint64Converter, args.nodeTypeProvider) shard0HeaderHash := "shard0 header hash" lastFinishedMetaBlock := "last finished meta block" @@ -777,7 +776,7 @@ func TestShardStorageHandler_saveLastCrossNotarizedHeadersWithScheduled(t *testi }() args := createDefaultShardStorageArgs() - shardStorage, _ := NewShardStorageHandler(args.generalConfig, args.prefsConfig, args.shardCoordinator, args.pathManagerHandler, args.marshalizer, args.hasher, 1, args.uint64Converter, args.nodeTypeProvider, args.statusHandler) + shardStorage, _ := NewShardStorageHandler(args.generalConfig, args.prefsConfig, args.shardCoordinator, args.pathManagerHandler, args.marshalizer, args.hasher, 1, args.uint64Converter, args.nodeTypeProvider) shard0HeaderHash := "shard0 header hash" lastFinishedMetaBlock := "last finished meta block" prevMetaHash := "prev metaHlock hash" @@ -999,7 +998,6 @@ type shardStorageArgs struct { currentEpoch uint32 uint64Converter typeConverters.Uint64ByteSliceConverter nodeTypeProvider core.NodeTypeProviderHandler - statusHandler core.AppStatusHandler } func createDefaultShardStorageArgs() shardStorageArgs { @@ -1013,7 +1011,6 @@ func createDefaultShardStorageArgs() shardStorageArgs { currentEpoch: 0, uint64Converter: &mock.Uint64ByteSliceConverterMock{}, nodeTypeProvider: &nodeTypeProviderMock.NodeTypeProviderStub{}, - statusHandler: &statusHandler.AppStatusHandlerMock{}, } } diff --git a/factory/dataComponents.go b/factory/dataComponents.go index ed35c492fc0..5caefe57039 100644 --- a/factory/dataComponents.go +++ b/factory/dataComponents.go @@ -152,7 +152,6 @@ func (dcf *dataComponentsFactory) createDataStoreFromConfig() (dataRetriever.Sto EpochStartNotifier: dcf.epochStartNotifier, NodeTypeProvider: dcf.core.NodeTypeProvider(), CurrentEpoch: dcf.currentEpoch, - StatusHandler: dcf.core.StatusHandler(), CreateTrieEpochRootHashStorer: dcf.createTrieEpochRootHashStorer, }, ) diff --git a/factory/processComponents.go b/factory/processComponents.go index 356ee4245e9..792d617f7c0 100644 --- a/factory/processComponents.go +++ b/factory/processComponents.go @@ -1211,7 +1211,6 @@ func (pcf *processComponentsFactory) newStorageResolver() (dataRetriever.Resolve EpochStartNotifier: manualEpochStartNotifier, NodeTypeProvider: pcf.coreData.NodeTypeProvider(), CurrentEpoch: pcf.bootstrapComponents.EpochBootstrapParams().Epoch(), - StatusHandler: pcf.coreData.StatusHandler(), CreateTrieEpochRootHashStorer: false, }, ) diff --git a/integrationTests/multiShard/endOfEpoch/startInEpoch/startInEpoch_test.go b/integrationTests/multiShard/endOfEpoch/startInEpoch/startInEpoch_test.go index 1d7f667a5ea..aea43867e7a 100644 --- a/integrationTests/multiShard/endOfEpoch/startInEpoch/startInEpoch_test.go +++ b/integrationTests/multiShard/endOfEpoch/startInEpoch/startInEpoch_test.go @@ -267,7 +267,6 @@ func testNodeStartsInEpoch(t *testing.T, shardID uint32, expectedHighestRound ui EpochStartNotifier: notifier.NewEpochStartSubscriptionHandler(), NodeTypeProvider: &nodeTypeProviderMock.NodeTypeProviderStub{}, CurrentEpoch: 0, - StatusHandler: &statusHandlerMock.AppStatusHandlerStub{}, CreateTrieEpochRootHashStorer: false, }, ) diff --git a/storage/factory/pruningStorerFactory.go b/storage/factory/pruningStorerFactory.go index 670e771b375..fb1d84645fb 100644 --- a/storage/factory/pruningStorerFactory.go +++ b/storage/factory/pruningStorerFactory.go @@ -33,7 +33,6 @@ type StorageServiceFactory struct { pathManager storage.PathManagerHandler epochStartNotifier storage.EpochStartNotifier oldDataCleanerProvider clean.OldDataCleanerProvider - statusHandler core.AppStatusHandler createTrieEpochRootHashStorer bool currentEpoch uint32 } @@ -47,7 +46,6 @@ type StorageServiceFactoryArgs struct { EpochStartNotifier storage.EpochStartNotifier NodeTypeProvider NodeTypeProviderHandler CurrentEpoch uint32 - StatusHandler core.AppStatusHandler CreateTrieEpochRootHashStorer bool } @@ -78,7 +76,6 @@ func NewStorageServiceFactory(args StorageServiceFactoryArgs) (*StorageServiceFa currentEpoch: args.CurrentEpoch, createTrieEpochRootHashStorer: args.CreateTrieEpochRootHashStorer, oldDataCleanerProvider: oldDataCleanProvider, - statusHandler: args.StatusHandler, }, nil } @@ -95,9 +92,6 @@ func checkArgs(args StorageServiceFactoryArgs) error { if check.IfNil(args.EpochStartNotifier) { return storage.ErrNilEpochStartNotifier } - if check.IfNil(args.StatusHandler) { - return storage.ErrNilStatusHandler - } return nil } @@ -622,7 +616,6 @@ func (psf *StorageServiceFactory) createPruningStorerArgs( Notifier: psf.epochStartNotifier, MaxBatchSize: storageConfig.DB.MaxBatchSize, EnabledDbLookupExtensions: psf.generalConfig.DbLookupExtensions.Enabled, - StatusHandler: psf.statusHandler, } return args diff --git a/storage/pruning/pruningStorer.go b/storage/pruning/pruningStorer.go index 1ed57b05563..23ceacdfefc 100644 --- a/storage/pruning/pruningStorer.go +++ b/storage/pruning/pruningStorer.go @@ -188,9 +188,6 @@ func checkArgs(args *StorerArgs) error { if check.IfNil(args.OldDataCleanerProvider) { return storage.ErrNilOldDataCleanerProvider } - if check.IfNil(args.StatusHandler) { - return storage.ErrNilStatusHandler - } if args.MaxBatchSize > int(args.CacheConf.Capacity) { return storage.ErrCacheSizeIsLowerThanBatchSize } @@ -211,7 +208,6 @@ func initPersistersInEpoch( } oldestEpochActive, oldestEpochKeep := computeOldestEpochActiveAndToKeep(args) - args.StatusHandler.SetUInt64Value(common.MetricOldestKeptEpoch, uint64(oldestEpochKeep)) var persisters []*persisterData persistersMapByEpoch := make(map[uint32]*persisterData) diff --git a/storage/pruning/pruningStorerArgs.go b/storage/pruning/pruningStorerArgs.go index 3b9ac73bc7a..f9ce10f36ee 100644 --- a/storage/pruning/pruningStorerArgs.go +++ b/storage/pruning/pruningStorerArgs.go @@ -1,7 +1,6 @@ package pruning import ( - "github.com/ElrondNetwork/elrond-go-core/core" "github.com/ElrondNetwork/elrond-go/storage" "github.com/ElrondNetwork/elrond-go/storage/clean" "github.com/ElrondNetwork/elrond-go/storage/storageUnit" @@ -18,7 +17,6 @@ type StorerArgs struct { Notifier EpochStartNotifier OldDataCleanerProvider clean.OldDataCleanerProvider CustomDatabaseRemover storage.CustomDatabaseRemoverHandler - StatusHandler core.AppStatusHandler MaxBatchSize int NumOfEpochsToKeep uint32 NumOfActivePersisters uint32 diff --git a/storage/pruning/pruningStorer_test.go b/storage/pruning/pruningStorer_test.go index d207999414e..d8e4502444f 100644 --- a/storage/pruning/pruningStorer_test.go +++ b/storage/pruning/pruningStorer_test.go @@ -29,7 +29,6 @@ import ( "github.com/ElrondNetwork/elrond-go/storage/pruning" "github.com/ElrondNetwork/elrond-go/storage/storageUnit" "github.com/ElrondNetwork/elrond-go/testscommon" - "github.com/ElrondNetwork/elrond-go/testscommon/statusHandler" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) @@ -84,7 +83,6 @@ func getDefaultArgs() *pruning.StorerArgs { Notifier: &mock.EpochStartNotifierStub{}, OldDataCleanerProvider: &testscommon.OldDataCleanerProviderStub{}, CustomDatabaseRemover: &testscommon.CustomDatabaseRemoverStub{}, - StatusHandler: &statusHandler.AppStatusHandlerStub{}, MaxBatchSize: 10, } } @@ -113,7 +111,6 @@ func getDefaultArgsSerialDB() *pruning.StorerArgs { Notifier: &mock.EpochStartNotifierStub{}, OldDataCleanerProvider: &testscommon.OldDataCleanerProviderStub{}, CustomDatabaseRemover: &testscommon.CustomDatabaseRemoverStub{}, - StatusHandler: &statusHandler.AppStatusHandlerStub{}, MaxBatchSize: 20, } } diff --git a/testscommon/state/testTriePruningStorer.go b/testscommon/state/testTriePruningStorer.go index d4164b23aca..6c7a0a6bf8f 100644 --- a/testscommon/state/testTriePruningStorer.go +++ b/testscommon/state/testTriePruningStorer.go @@ -10,7 +10,6 @@ import ( "github.com/ElrondNetwork/elrond-go/storage/pruning" "github.com/ElrondNetwork/elrond-go/storage/storageUnit" "github.com/ElrondNetwork/elrond-go/testscommon" - "github.com/ElrondNetwork/elrond-go/testscommon/statusHandler" ) // CreateTestingTriePruningStorer creates a new trie pruning storer that is used for testing @@ -47,7 +46,6 @@ func CreateTestingTriePruningStorer(coordinator sharding.Coordinator, notifier p Notifier: notifier, OldDataCleanerProvider: &testscommon.OldDataCleanerProviderStub{}, CustomDatabaseRemover: &testscommon.CustomDatabaseRemoverStub{}, - StatusHandler: &statusHandler.AppStatusHandlerMock{}, MaxBatchSize: 10, }