Skip to content

Commit

Permalink
remove unused code
Browse files Browse the repository at this point in the history
  • Loading branch information
ssd04 committed Jan 9, 2025
1 parent 30f6c12 commit 4a4f9b2
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 108 deletions.
67 changes: 0 additions & 67 deletions integrationTests/testConsensusNode.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand All @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
20 changes: 0 additions & 20 deletions integrationTests/testInitializer.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
21 changes: 0 additions & 21 deletions integrationTests/testProcessorNode.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 4a4f9b2

Please sign in to comment.