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

fix(exex): do not finalize WAL with a block higher than finalized header #11420

Merged
merged 1 commit into from
Oct 2, 2024
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
11 changes: 7 additions & 4 deletions crates/exex/exex/src/manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -350,14 +350,17 @@ where
.collect::<Result<Vec<_>, _>>()?;
if exex_finished_heights.iter().all(|(_, _, is_canonical)| *is_canonical) {
// If there is a finalized header and all ExExs are on the canonical chain, finalize
// the WAL with the lowest finished height among all ExExes
// the WAL with either the lowest finished height among all ExExes, or finalized header
// – whichever is lower.
let lowest_finished_height = exex_finished_heights
.iter()
.copied()
.filter_map(|(_, num_hash, _)| num_hash)
.min_by_key(|num_hash| num_hash.number);
self.wal
.finalize(lowest_finished_height.expect("ExExManager has at least one ExEx"))?;
.chain([(finalized_header.num_hash())])
.min_by_key(|num_hash| num_hash.number)
.unwrap();

self.wal.finalize(lowest_finished_height)?;
} else {
let unfinalized_exexes = exex_finished_heights
.into_iter()
Expand Down
Loading