@@ -512,7 +512,13 @@ proc storeBlock*(
512512 #
513513 # Three general scenarios: (1) pre-merge; (2) merge, already `VALID` by way
514514 # of `newPayload`; (3) optimistically imported, need to call fcU before DAG
515- # updateHead. Handle each with as little async latency as feasible.
515+ # updateHead. Because in a non-finalizing network, completing sync isn't as
516+ # useful because regular reorgs likely still occur, and when finalizing the
517+ # EL is only called every SLOTS_PER_PAYLOAD slots regardless, await, rather
518+ # than asyncSpawn forkchoiceUpdated calls.
519+ #
520+ # This reduces in-flight fcU spam, which both reduces EL load and decreases
521+ # otherwise somewhat unpredictable CL head movement.
516522
517523 if payloadValid:
518524 self.consensusManager.dag.markBlockVerified (
@@ -543,7 +549,7 @@ proc storeBlock*(
543549 # - "Beacon chain gapped" from DAG head to optimistic head,
544550 # - followed by "Beacon chain reorged" from optimistic head back to DAG.
545551 self.consensusManager[].updateHead (newHead.get.blck)
546- asyncSpawn eth1Monitor.runForkchoiceUpdatedDiscardResult (
552+ await eth1Monitor.runForkchoiceUpdatedDiscardResult (
547553 headBlockHash = self.consensusManager[].optimisticExecutionPayloadHash,
548554 safeBlockHash = newHead.get.safeExecutionPayloadHash,
549555 finalizedBlockHash = newHead.get.finalizedExecutionPayloadHash)
@@ -563,7 +569,7 @@ proc storeBlock*(
563569
564570 if self.consensusManager.checkNextProposer (wallSlot).isNone:
565571 # No attached validator is next proposer, so use non-proposal fcU
566- asyncSpawn eth1Monitor.expectValidForkchoiceUpdated (
572+ await eth1Monitor.expectValidForkchoiceUpdated (
567573 headBlockHash = headExecutionPayloadHash,
568574 safeBlockHash = newHead.get.safeExecutionPayloadHash,
569575 finalizedBlockHash = newHead.get.finalizedExecutionPayloadHash,
@@ -572,10 +578,10 @@ proc storeBlock*(
572578 # Some attached validator is next proposer, so prepare payload. As
573579 # updateHead() updated the DAG head, runProposalForkchoiceUpdated,
574580 # which needs the state corresponding to that head block, can run.
575- asyncSpawn self.consensusManager.runProposalForkchoiceUpdated (
581+ await self.consensusManager.runProposalForkchoiceUpdated (
576582 wallSlot)
577583 else :
578- asyncSpawn self.consensusManager.updateHeadWithExecution (
584+ await self.consensusManager.updateHeadWithExecution (
579585 newHead.get, self.getBeaconTime)
580586 else :
581587 warn " Head selection failed, using previous head" ,
0 commit comments