From 1bce7a02c8f85b712f41ad7cf563d53407450976 Mon Sep 17 00:00:00 2001 From: Paul Hauner Date: Tue, 21 Feb 2023 18:03:24 +1100 Subject: [PATCH] Fix post-Bellatrix checkpoint sync (#4014) * Recognise execution in post-merge blocks * Remove `.body()` * Fix typo * Use `is_default_with_empty_roots`. --- consensus/fork_choice/src/fork_choice.rs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/consensus/fork_choice/src/fork_choice.rs b/consensus/fork_choice/src/fork_choice.rs index 9ca9ef0cef..85e43945cd 100644 --- a/consensus/fork_choice/src/fork_choice.rs +++ b/consensus/fork_choice/src/fork_choice.rs @@ -413,18 +413,18 @@ where AttestationShufflingId::new(anchor_block_root, anchor_state, RelativeEpoch::Next) .map_err(Error::BeaconStateError)?; - // Default any non-merge execution block hashes to 0x000..000. - let execution_status = anchor_block.message_merge().map_or_else( - |()| ExecutionStatus::irrelevant(), - |message| { - let execution_payload = &message.body.execution_payload; - if execution_payload == &<_>::default() { + let execution_status = anchor_block.message().execution_payload().map_or_else( + // If the block doesn't have an execution payload then it can't have + // execution enabled. + |_| ExecutionStatus::irrelevant(), + |execution_payload| { + if execution_payload.is_default_with_empty_roots() { // A default payload does not have execution enabled. ExecutionStatus::irrelevant() } else { // Assume that this payload is valid, since the anchor should be a trusted block and // state. - ExecutionStatus::Valid(message.body.execution_payload.block_hash()) + ExecutionStatus::Valid(execution_payload.block_hash()) } }, );