-
Notifications
You must be signed in to change notification settings - Fork 150
fix(exporter): populate dutyStore in all modes — stop blackholing exit/proposer/sync-contribution messages #2892
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: stage
Are you sure you want to change the base?
Changes from 6 commits
c50df37
d104430
9527b05
863bc11
0eae766
f927ae0
651052b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -78,10 +78,6 @@ type Node struct { | |
| exporterRead *exporter2.Exporter | ||
| } | ||
|
|
||
| func shouldRunDutyScheduler(exporterOpts exporter.Options) bool { | ||
| return !exporterOpts.Enabled || exporterOpts.Mode == exporter.ModeArchive | ||
| } | ||
|
|
||
| // New is the constructor of Node | ||
| func New(logger *zap.Logger, opts Options, exporterOpts exporter.Options, slotTickerProvider slotticker.Provider, qbftStorage *qbftstorage.ParticipantStores) *Node { | ||
| selfValidatorStore := opts.ValidatorStore.WithOperatorID(opts.ValidatorOptions.OperatorDataStore.GetOperatorID) | ||
|
|
@@ -103,38 +99,36 @@ func New(logger *zap.Logger, opts Options, exporterOpts exporter.Options, slotTi | |
| proposalPreparationsFn = feeRecipientController.GetProposalPreparations | ||
| } | ||
|
|
||
| var dutyScheduler *duties.Scheduler | ||
| if shouldRunDutyScheduler(exporterOpts) { | ||
| // Prepare scheduler wiring; in exporter archive mode we swap to AllShares provider, | ||
| // a prefetching beacon adapter, and a no-op executor. | ||
| schedulerBeacon := duties.BeaconNode(opts.BeaconNode) | ||
| validatorProvider := duties.ValidatorProvider(selfValidatorStore) | ||
| dutyExecutor := duties.DutyExecutor(opts.ValidatorController) | ||
|
|
||
| if exporterOpts.Enabled { | ||
| validatorProvider = duties.NewAllSharesProvider(opts.ValidatorStore) | ||
| dutyExecutor = duties.NewNoopExecutor() | ||
| schedulerBeacon = duties.NewPrefetchingBeacon(logger, opts.BeaconNode, opts.NetworkConfig.Beacon, opts.ValidatorStore) | ||
| } | ||
| // All node modes run the duty scheduler. In exporter mode swap to AllShares provider, | ||
| // a prefetching beacon adapter, and a no-op executor. | ||
| schedulerBeacon := duties.BeaconNode(opts.BeaconNode) | ||
| validatorProvider := duties.ValidatorProvider(selfValidatorStore) | ||
| dutyExecutor := duties.DutyExecutor(opts.ValidatorController) | ||
|
|
||
| dutyScheduler = duties.NewScheduler(logger, &duties.SchedulerOptions{ | ||
| Ctx: opts.Context, | ||
| BeaconNode: schedulerBeacon, | ||
| ExecutionClient: opts.ExecutionClient, | ||
| BeaconConfig: opts.NetworkConfig.Beacon, | ||
| ValidatorProvider: validatorProvider, | ||
| ValidatorController: opts.ValidatorController, | ||
| DutyExecutor: dutyExecutor, | ||
| IndicesChgCh: opts.ValidatorController.IndicesChangeChan(), | ||
| ValidatorRegistrationCh: opts.ValidatorController.ValidatorRegistrationChan(), | ||
| ValidatorExitCh: opts.ValidatorController.ValidatorExitChan(), | ||
| DutyStore: opts.DutyStore, | ||
| SlotTickerProvider: slotTickerProvider, | ||
| P2PNetwork: opts.P2PNetwork, | ||
| ExporterMode: exporterOpts.Enabled, | ||
| }) | ||
| if exporterOpts.Enabled { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Non-blocking (behavior change + docs). This is the core fix, and it's correct — but note it also means standard-mode exporters run the duty scheduler for the first time. Beyond unblocking forwarding, they'll now fetch proposer (per-epoch) and sync-committee (per-period, all indices) duties via the
|
||
| validatorProvider = duties.NewAllSharesProvider(opts.ValidatorStore) | ||
| dutyExecutor = duties.NewNoopExecutor() | ||
| schedulerBeacon = duties.NewPrefetchingBeacon(logger, opts.BeaconNode, opts.NetworkConfig.Beacon, opts.ValidatorStore) | ||
| } | ||
|
|
||
| dutyScheduler := duties.NewScheduler(logger, &duties.SchedulerOptions{ | ||
| Ctx: opts.Context, | ||
| BeaconNode: schedulerBeacon, | ||
| ExecutionClient: opts.ExecutionClient, | ||
| BeaconConfig: opts.NetworkConfig.Beacon, | ||
| ValidatorProvider: validatorProvider, | ||
| ValidatorController: opts.ValidatorController, | ||
| DutyExecutor: dutyExecutor, | ||
| IndicesChgCh: opts.ValidatorController.IndicesChangeChan(), | ||
| ValidatorRegistrationCh: opts.ValidatorController.ValidatorRegistrationChan(), | ||
| ValidatorExitCh: opts.ValidatorController.ValidatorExitChan(), | ||
| DutyStore: opts.DutyStore, | ||
| SlotTickerProvider: slotTickerProvider, | ||
| P2PNetwork: opts.P2PNetwork, | ||
| ExporterMode: exporterOpts.Enabled, | ||
| ArchiveMode: exporterOpts.Mode == exporter.ModeArchive, | ||
| }) | ||
|
|
||
| node := &Node{ | ||
| logger: logger.Named(log.NameOperator), | ||
| validatorsCtrl: opts.ValidatorController, | ||
|
|
@@ -174,13 +168,8 @@ func (n *Node) Start(ctx context.Context) error { | |
| return fmt.Errorf("start WS server: %w", err) | ||
| } | ||
|
|
||
| // Start the duty scheduler in modes that use it. | ||
| if n.dutyScheduler != nil { | ||
| if err := n.dutyScheduler.Start(ctx); err != nil { | ||
| return fmt.Errorf("failed to run duty scheduler: %w", err) | ||
| } | ||
| } else { | ||
| n.logger.Info("exporter standard mode: skipping duty scheduler") | ||
| if err := n.dutyScheduler.Start(ctx); err != nil { | ||
| return fmt.Errorf("failed to run duty scheduler: %w", err) | ||
| } | ||
|
|
||
| n.validatorsCtrl.StartNetworkHandlers() | ||
|
|
@@ -248,15 +237,8 @@ func (n *Node) Start(ctx context.Context) error { | |
|
|
||
| n.logger.Info("operator node has been started", fields.OperatorID(n.validatorOptions.OperatorDataStore.GetOperatorID())) | ||
|
|
||
| if n.dutyScheduler != nil { | ||
| if err := n.dutyScheduler.Wait(); err != nil { | ||
| n.logger.Fatal("duty scheduler exited with error", zap.Error(err)) | ||
| } | ||
| } else { | ||
| if !n.exporterOptions.Enabled || n.exporterOptions.Mode != exporter.ModeStandard { | ||
| n.logger.Fatal("duty scheduler is nil for non-exporter-standard node") | ||
| } | ||
| <-ctx.Done() | ||
| if err := n.dutyScheduler.Wait(); err != nil { | ||
| n.logger.Fatal("duty scheduler exited with error", zap.Error(err)) | ||
| } | ||
|
|
||
| // The p2p network is owned by its creator (cli/operator), which closes it via defer. | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you think about extending this to cover the safety invariant, not just registration?
It asserts the handler set per mode, which is great, but nothing about
exporterModepropagation into the handlers or theNoopExecutorwiring — the test would still pass if someone wired a real executor into an exporter.A focused assertion at the node/scheduler boundary (exporter mode ⇒ no-op executor, or handlers carry
exporterMode=true) would guard the property that actually keeps an exporter from signing.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Extended the test to assert exporterMode propagates into each handler type and that Scheduler.exporterMode is set correctly.