Skip to content
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

feat(engine): require VALID latest FCU status before pruning #3954

Merged
merged 5 commits into from
Aug 2, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions crates/consensus/beacon/src/engine/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1710,10 +1710,15 @@ where
// we're pending if both engine messages and sync events are pending (fully drained)
let is_pending = engine_messages_pending && sync_pending;

// check prune events if pipeline is idle AND (pruning is running and we need to
// prioritize checking its events OR no engine and sync messages are pending and we may
// start pruning)
if this.sync.is_pipeline_idle() && (this.is_prune_active() || is_pending) {
// Poll prune controller if all conditions are met:
// 1. Pipeline is idle
// 2. Pruning is running and we need to prioritize checking its events OR no engine and
// sync messages are pending and we may start pruning
// 3. Latest FCU status is VALID
if this.sync.is_pipeline_idle() &&
(this.is_prune_active() || is_pending) &&
this.forkchoice_state_tracker.is_latest_valid()
{
if let Some(ref mut prune) = this.prune {
match prune.poll(cx, this.blockchain.canonical_tip().number) {
Poll::Ready(prune_event) => {
Expand Down