Skip to content

Commit

Permalink
- disabled un-necessary components
Browse files Browse the repository at this point in the history
  • Loading branch information
iulianpascalau committed Oct 25, 2024
1 parent b531c6c commit c0d4dea
Show file tree
Hide file tree
Showing 7 changed files with 44 additions and 29 deletions.
7 changes: 7 additions & 0 deletions cmd/node/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -617,6 +617,13 @@ func applyCompatibleConfigs(log logger.Logger, configs *config.Configs) error {
configs.FlagsConfig.DisableConsensusWatchdog = true
}

// JLS: 2024.10.25: force operation mode to be historical balances, by default
configs.FlagsConfig.OperationMode = operationmodes.OperationModeHistoricalBalances
// JLS: 2024.10.25: p2p tweaks
configs.FullArchiveP2pConfig.Node.ThresholdMinConnectedPeers = 0
configs.FullArchiveP2pConfig.KadDhtPeerDiscovery.Enabled = false
configs.MainP2pConfig.Node.ThresholdMinConnectedPeers = 0
configs.MainP2pConfig.KadDhtPeerDiscovery.Enabled = false
operationModes, err := operationmodes.ParseOperationModes(configs.FlagsConfig.OperationMode)
if err != nil {
return err
Expand Down
7 changes: 4 additions & 3 deletions consensus/chronology/chronology.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,10 @@ func (chr *chronology) StartRounds() {
watchdogAlarmDuration := chr.roundHandler.TimeDuration() * numRoundsToWaitBeforeSignalingChronologyStuck
chr.watchdog.SetDefault(watchdogAlarmDuration, chronologyAlarmID)

var ctx context.Context
ctx, chr.cancelFunc = context.WithCancel(context.Background())
go chr.startRounds(ctx)
//var ctx context.Context
_, chr.cancelFunc = context.WithCancel(context.Background())
// JLS: 2024.10.25: disable chronology sender go routine
//go chr.startRounds(ctx)
}

func (chr *chronology) startRounds(ctx context.Context) {
Expand Down
7 changes: 4 additions & 3 deletions consensus/spos/worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -179,9 +179,10 @@ func NewWorker(args *WorkerArgs) (*Worker, error) {

// StartWorking actually starts the consensus working mechanism
func (wrk *Worker) StartWorking() {
var ctx context.Context
ctx, wrk.cancelFunc = context.WithCancel(context.Background())
go wrk.checkChannels(ctx)
// var ctx context.Context
_, wrk.cancelFunc = context.WithCancel(context.Background())
// JLS: 2024.10.25: disable consensus sender go routine
// go wrk.checkChannels(ctx)
}

func checkNewWorkerParams(args *WorkerArgs) error {
Expand Down
18 changes: 10 additions & 8 deletions factory/core/coreComponents.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,9 @@ import (
"time"

"github.com/multiversx/mx-chain-core-go/core"
"github.com/multiversx/mx-chain-core-go/core/alarm"
"github.com/multiversx/mx-chain-core-go/core/check"
"github.com/multiversx/mx-chain-core-go/core/nodetype"
"github.com/multiversx/mx-chain-core-go/core/versioning"
"github.com/multiversx/mx-chain-core-go/core/watchdog"
"github.com/multiversx/mx-chain-core-go/data/endProcess"
"github.com/multiversx/mx-chain-core-go/data/typeConverters"
"github.com/multiversx/mx-chain-core-go/data/typeConverters/uint64ByteSlice"
Expand All @@ -25,6 +23,7 @@ import (
"github.com/multiversx/mx-chain-go/common/forking"
"github.com/multiversx/mx-chain-go/config"
"github.com/multiversx/mx-chain-go/consensus"
"github.com/multiversx/mx-chain-go/consensus/mock"
"github.com/multiversx/mx-chain-go/consensus/round"
"github.com/multiversx/mx-chain-go/epochStart/notifier"
"github.com/multiversx/mx-chain-go/errors"
Expand Down Expand Up @@ -223,12 +222,15 @@ func (ccf *coreComponentsFactory) Create() (*coreComponents, error) {
return nil, err
}

alarmScheduler := alarm.NewAlarmScheduler()
// TODO: disable watchdog if block processing cutoff is enabled
watchdogTimer, err := watchdog.NewWatchdog(alarmScheduler, ccf.chanStopNodeProcess, log)
if err != nil {
return nil, err
}
//alarmScheduler := alarm.NewAlarmScheduler()
//// TODO: disable watchdog if block processing cutoff is enabled
//watchdogTimer, err := watchdog.NewWatchdog(alarmScheduler, ccf.chanStopNodeProcess, log)
//if err != nil {
// return nil, err
//}
// JLS: 2024.10.25: no real alarm scheduler, no watchdog
alarmScheduler := &mock.AlarmSchedulerStub{}
watchdogTimer := &mock.WatchdogMock{}

roundNotifier := forking.NewGenericRoundNotifier()
enableRoundsHandler, err := enablers.NewEnableRoundsHandler(ccf.roundConfig, roundNotifier)
Expand Down
23 changes: 12 additions & 11 deletions factory/network/networkComponents.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,17 +148,18 @@ func (ncf *networkComponentsFactory) Create() (*networkComponents, error) {
return nil, err
}

err = mainNetworkComp.netMessenger.Bootstrap()
if err != nil {
return nil, err
}

mainNetworkComp.netMessenger.WaitForConnections(ncf.bootstrapWaitTime, ncf.mainP2PConfig.Node.MinNumPeersToWaitForOnBootstrap)

err = fullArchiveNetworkComp.netMessenger.Bootstrap()
if err != nil {
return nil, err
}
// JLS: 2024.10.25: we do not need to bootstrap the p2p components, nor wait for p2p connections
//err = mainNetworkComp.netMessenger.Bootstrap()
//if err != nil {
// return nil, err
//}
//
//mainNetworkComp.netMessenger.WaitForConnections(ncf.bootstrapWaitTime, ncf.mainP2PConfig.Node.MinNumPeersToWaitForOnBootstrap)
//
//err = fullArchiveNetworkComp.netMessenger.Bootstrap()
//if err != nil {
// return nil, err
//}

return &networkComponents{
mainNetworkHolder: mainNetworkComp,
Expand Down
7 changes: 4 additions & 3 deletions heartbeat/sender/routineHandler.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,10 @@ func newRoutineHandler(peerAuthenticationSender senderHandler, heartbeatSender s
delayAfterHardforkMessageBroadcast: time.Minute,
}

var ctx context.Context
ctx, handler.cancel = context.WithCancel(context.Background())
go handler.processLoop(ctx)
// var ctx context.Context
_, handler.cancel = context.WithCancel(context.Background())
// JLS: 2024.10.25: disable heartbeat sender go routine
// go handler.processLoop(ctx)

return handler
}
Expand Down
4 changes: 3 additions & 1 deletion node/nodeRunner.go
Original file line number Diff line number Diff line change
Expand Up @@ -534,7 +534,9 @@ func (nr *nodeRunner) executeOneComponentCreationCycle(
return true, err
}

log.Info("application is now running")
log.Info("Application is now running")
log.Info("Since this node is running in deep history mode, the consensus, heartbeat, p2p components are disabled!")
log.Info("Waiting to respond on API requests...")

delayInSecBeforeAllowingVmQueries := configs.GeneralConfig.WebServerAntiflood.VmQueryDelayAfterStartInSec
if delayInSecBeforeAllowingVmQueries == 0 {
Expand Down

0 comments on commit c0d4dea

Please sign in to comment.