prysm-pulse/beacon-chain/forkchoice/doubly-linked-tree
Potuz 79bb7efbf8
Check init sync before getting payload attributes (#13479)
* Check init sync before getting payload attributes

This PR adds a helper to forkchoice to return the delay of the latest
imported block. It also adds a helper with an heuristic to check if the
node is during init sync. If the highest imported node was imported with
a delay of less than an epoch then the node is considered in regular
sync. If on the other hand, in addition the highest imported node is
more than two epochs old, then the node is considered in init Sync.

The helper to check this only uses forkchoice and therefore requires a
read lock. There are four paths to call this

1) During regular block processing, we defer a function to send the
   second FCU call with attributes. This function may not be called at
all if we are not regularly syncing
2) During regular block processing, we check in the path
   `postBlockProces->getFCUArgs->computePayloadAttributes` the payload
attributes if we are syncing a late block. In this case forkchoice is
already locked and we add a call in `getFCUArgs` to return early if not
regularly syncing
3) During handling of late blocks on `lateBlockTasks` we simply return
   early if not in regular sync (This is the biggest change as it takes
a longer FC lock for lateBlockTasks)
4) On Attestation processing, in UpdateHead, we are already locked so we
   just add a check to not update head on this path if not regularly
syncing.

* fix build

* Fix mocks
2024-01-17 15:39:28 +00:00
..
BUILD.bazel Make Reorging Of Late Blocks The Permanent Default (#13405) 2024-01-03 14:46:58 +00:00
doc.go Forkchoice featureflag (#10299) 2022-03-09 03:05:51 +00:00
errors.go Do not error if the LVH is bogus (#10996) 2022-07-06 17:37:15 +00:00
ffg_update_test.go Update to V4 🚀 (#12134) 2023-03-17 18:52:56 +00:00
forkchoice_test.go Fix forkchoice pkg's comments grammar (#13217) 2023-11-22 17:27:42 -08:00
forkchoice.go Allow requests for old target roots (#13281) 2023-12-06 17:11:34 +00:00
last_root_test.go Tweak LastRoot to return head root (#12985) 2023-10-03 02:22:52 +00:00
last_root.go Tweak LastRoot to return head root (#12985) 2023-10-03 02:22:52 +00:00
metrics.go fix help message of metric doublylinkedtree_node_count (#11705) 2022-11-29 11:29:48 +00:00
no_vote_test.go Update to V4 🚀 (#12134) 2023-03-17 18:52:56 +00:00
node_test.go Don't hardcode 4 seconds in forkchoice (#13416) 2024-01-04 16:49:16 +00:00
node.go Don't hardcode 4 seconds in forkchoice (#13416) 2024-01-04 16:49:16 +00:00
on_tick_test.go Update to V4 🚀 (#12134) 2023-03-17 18:52:56 +00:00
on_tick.go remove trivial helper (#12443) 2023-05-22 15:59:16 +00:00
optimistic_sync_test.go Update to V4 🚀 (#12134) 2023-03-17 18:52:56 +00:00
optimistic_sync.go Rename payloadHash to lastValidHash in setOptimisticToInvalid (#12592) 2023-07-04 17:03:45 +00:00
proposer_boost_test.go Fix forkchoice pkg's comments grammar (#13217) 2023-11-22 17:27:42 -08:00
proposer_boost.go remove trivial helper (#12443) 2023-05-22 15:59:16 +00:00
reorg_late_blocks_test.go Don't hardcode 4 seconds in forkchoice (#13416) 2024-01-04 16:49:16 +00:00
reorg_late_blocks.go Make Reorging Of Late Blocks The Permanent Default (#13405) 2024-01-03 14:46:58 +00:00
store_test.go Check init sync before getting payload attributes (#13479) 2024-01-17 15:39:28 +00:00
store.go Check init sync before getting payload attributes (#13479) 2024-01-17 15:39:28 +00:00
types.go track target in forkchoice (#13249) 2023-12-01 16:30:34 +00:00
unrealized_justification_test.go Fix forkchoice pkg's comments grammar (#13217) 2023-11-22 17:27:42 -08:00
unrealized_justification.go Update to V4 🚀 (#12134) 2023-03-17 18:52:56 +00:00
vote_test.go Update to V4 🚀 (#12134) 2023-03-17 18:52:56 +00:00