From 4a4f9b29f63206a29df5e631408ec9593c133e13 Mon Sep 17 00:00:00 2001 From: ssd04 Date: Fri, 10 Jan 2025 01:10:04 +0200 Subject: [PATCH] remove unused code --- integrationTests/testConsensusNode.go | 67 --------------------------- integrationTests/testInitializer.go | 20 -------- integrationTests/testProcessorNode.go | 21 --------- 3 files changed, 108 deletions(-) diff --git a/integrationTests/testConsensusNode.go b/integrationTests/testConsensusNode.go index a16d01a2f4b..b62c7f869be 100644 --- a/integrationTests/testConsensusNode.go +++ b/integrationTests/testConsensusNode.go @@ -449,14 +449,6 @@ func (tcn *TestConsensusNode) initInterceptors( blockBlackListHandler := cache.NewTimeCache(TimeSpanForBadHeaders) - // argsNewEconomicsData := economics.ArgsNewEconomicsData{ - // Economics: &config.EconomicsConfig{}, - // EpochNotifier: genericEpochNotifier, - // EnableEpochsHandler: enableEpochsHandler, - // TxVersionChecker: &testscommon.TxVersionCheckerStub{}, - // } - // economicsData, _ := economics.NewEconomicsData(argsNewEconomicsData) - genesisBlocks := make(map[uint32]data.HeaderHandler) blockTracker := processMock.NewBlockTrackerMock(tcn.ShardCoordinator, genesisBlocks) @@ -466,8 +458,6 @@ func (tcn *TestConsensusNode) initInterceptors( cacheVerified, _ := storageunit.NewCache(cacherVerifiedCfg) whiteListerVerifiedTxs, _ := interceptors.NewWhiteListDataVerifier(cacheVerified) - tcn.initRequesters() - if tcn.ShardCoordinator.SelfId() == core.MetachainShardId { metaInterceptorContainerFactoryArgs := interceptorscontainer.CommonInterceptorsContainerFactoryArgs{ CoreComponents: coreComponents, @@ -580,66 +570,9 @@ func (tcn *TestConsensusNode) initInterceptors( if err != nil { fmt.Println(err.Error()) } - // interceptorsContainer := &testscommon.InterceptorsContainerStub{ - // GetCalled: func(topic string) (process.Interceptor, error) { - // var hdl func(handler func(topic string, hash []byte, data interface{})) - // switch topic { - // case "shardBlocks_0_META": - // hdl = registerHandlerHeaders - // case "txBlockBodies_0_1": - // case "txBlockBodies_0_META": - // hdl = registerHandlerMiniblocks - // default: - // return nil, errors.New("unexpected topic") - // } - - // return &testscommon.InterceptorStub{ - // RegisterHandlerCalled: hdl, - // }, nil - // }, - // } } } -func (tcn *TestConsensusNode) initRequesters() { - // whiteListHandler, _ := disabledInterceptors.NewDisabledWhiteListDataVerifier() - - // requestersContainerFactoryArgs := requesterscontainer.FactoryArgs{ - // RequesterConfig: config.RequesterConfig{ - // NumCrossShardPeers: 2, - // NumTotalPeers: 3, - // NumFullHistoryPeers: 3, - // }, - // ShardCoordinator: tcn.ShardCoordinator, - // MainMessenger: tcn.MainMessenger, - // FullArchiveMessenger: tcn.FullArchiveMessenger, - // Marshaller: TestMarshaller, - // Uint64ByteSliceConverter: TestUint64Converter, - // OutputAntifloodHandler: &mock.NilAntifloodHandler{}, - // CurrentNetworkEpochProvider: tcn.EpochProvider, - // MainPreferredPeersHolder: &p2pmocks.PeersHolderStub{}, - // FullArchivePreferredPeersHolder: &p2pmocks.PeersHolderStub{}, - // PeersRatingHandler: tpn.PeersRatingHandler, - // SizeCheckDelta: 0, - // } - - // if tpn.ShardCoordinator.SelfId() == core.MetachainShardId { - // tpn.createMetaRequestersContainer(requestersContainerFactoryArgs) - // } else { - // tpn.createShardRequestersContainer(requestersContainerFactoryArgs) - // } - - // requestersFinder, _ = containers.NewRequestersFinder(tpn.RequestersContainer, tpn.ShardCoordinator) - // tpn.RequestHandler, _ = requestHandlers.NewResolverRequestHandler( - // requestersFinder, - // cache.NewTimeCache(time.Second), - // whiteListHandler, - // 100, - // tcn.ShardCoordinator.SelfId(), - // time.Second, - // ) -} - func (tcn *TestConsensusNode) initNodesCoordinator( consensusSize int, hasher hashing.Hasher, diff --git a/integrationTests/testInitializer.go b/integrationTests/testInitializer.go index aeebb9f74af..57af859a8df 100644 --- a/integrationTests/testInitializer.go +++ b/integrationTests/testInitializer.go @@ -1161,26 +1161,6 @@ func ProposeBlock(nodes []*TestProcessorNode, leaders []*TestProcessorNode, roun log.Info("Proposed block\n" + MakeDisplayTable(nodes)) } -// ProposeEpochStartBlock proposes a block for every shard -func ProposeEpochStartBlock(nodes []*TestProcessorNode, leaders []*TestProcessorNode, round uint64, nonce uint64) { - log.Info("All shards propose blocks...") - - stepDelayAdjustment := StepDelay * time.Duration(1+len(nodes)/3) - - for _, n := range leaders { - body, header, _ := n.ProposeEpochStartBlock(round, nonce) - - n.WhiteListBody(nodes, body) - pk := n.NodeKeys.MainKey.Pk - n.BroadcastBlock(body, header, pk) - n.CommitBlock(body, header) - } - - log.Info("Delaying for disseminating headers and miniblocks...") - time.Sleep(stepDelayAdjustment) - log.Info("Proposed block\n" + MakeDisplayTable(nodes)) -} - // SyncBlock synchronizes the proposed block in all the other shard nodes func SyncBlock( t *testing.T, diff --git a/integrationTests/testProcessorNode.go b/integrationTests/testProcessorNode.go index 6dfcbef13fc..6416f8b6c7c 100644 --- a/integrationTests/testProcessorNode.go +++ b/integrationTests/testProcessorNode.go @@ -2808,27 +2808,6 @@ func (tpn *TestProcessorNode) ProposeBlock(round uint64, nonce uint64) (data.Bod return blockBody, blockHeader, txHashes } -// ProposeEpochStartBlock proposes a new block -func (tpn *TestProcessorNode) ProposeEpochStartBlock(round uint64, nonce uint64) (data.BodyHandler, data.HeaderHandler, [][]byte) { - body, header, txHashes := tpn.ProposeBlock(round, nonce) - - metaBlock, ok := header.(*dataBlock.MetaBlock) - if !ok { - return nil, nil, nil - } - - metaBlock.GetEpochStartHandler().SetLastFinalizedHeaders( - []data.EpochStartShardDataHandler{ - &dataBlock.EpochStartShardData{ - ShardID: 0, - Epoch: 1, - }, - }, - ) - - return body, metaBlock, txHashes -} - // BroadcastBlock broadcasts the block and body to the connected peers func (tpn *TestProcessorNode) BroadcastBlock(body data.BodyHandler, header data.HeaderHandler, publicKey crypto.PublicKey) { _ = tpn.BroadcastMessenger.BroadcastBlock(body, header)