From 76109327bcb3865c85d6c346b188576c7560c09e Mon Sep 17 00:00:00 2001 From: Eitan Seri- Levi Date: Wed, 25 Feb 2026 23:45:42 -0800 Subject: [PATCH] address changes --- .../gossip_verified_envelope.rs | 2 +- .../payload_envelope_verification/import.rs | 4 ++ .../src/payload_envelope_verification/mod.rs | 53 +++++++------------ 3 files changed, 25 insertions(+), 34 deletions(-) diff --git a/beacon_node/beacon_chain/src/payload_envelope_verification/gossip_verified_envelope.rs b/beacon_node/beacon_chain/src/payload_envelope_verification/gossip_verified_envelope.rs index 8c8ee57fb4..7b33d519e5 100644 --- a/beacon_node/beacon_chain/src/payload_envelope_verification/gossip_verified_envelope.rs +++ b/beacon_node/beacon_chain/src/payload_envelope_verification/gossip_verified_envelope.rs @@ -248,7 +248,7 @@ impl BeaconChain { /// /// ## Errors /// - /// Returns an `Err` if the given envelope was invalid, or an error was encountered during + /// Returns an `Err` if the given envelope was invalid, or an error was encountered during verification. pub async fn verify_envelope_for_gossip( self: &Arc, envelope: Arc>, diff --git a/beacon_node/beacon_chain/src/payload_envelope_verification/import.rs b/beacon_node/beacon_chain/src/payload_envelope_verification/import.rs index 459af3609d..88ca66f7be 100644 --- a/beacon_node/beacon_chain/src/payload_envelope_verification/import.rs +++ b/beacon_node/beacon_chain/src/payload_envelope_verification/import.rs @@ -256,6 +256,9 @@ impl BeaconChain { return Err(EnvelopeError::BlockRootUnknown { block_root }); } + // TODO(gloas) when the code below is implemented we can delete this drop + drop(fork_choice_reader); + // TODO(gloas) no fork choice logic yet // Take an exclusive write-lock on fork choice. It's very important to prevent deadlocks by // avoiding taking other locks whilst holding this lock. @@ -323,6 +326,7 @@ impl BeaconChain { error = ?e, "Database write failed!" ); + return Err(e.into()); // TODO(gloas) handle db write failure // return Err(self // .handle_import_block_db_write_error(fork_choice) diff --git a/beacon_node/beacon_chain/src/payload_envelope_verification/mod.rs b/beacon_node/beacon_chain/src/payload_envelope_verification/mod.rs index 97cf952d11..dbb5d2faf6 100644 --- a/beacon_node/beacon_chain/src/payload_envelope_verification/mod.rs +++ b/beacon_node/beacon_chain/src/payload_envelope_verification/mod.rs @@ -54,7 +54,7 @@ pub struct AvailableEnvelope { execution_block_hash: ExecutionBlockHash, envelope: Arc>, columns: DataColumnSidecarList, - /// Timestamp at which this block first became available (UNIX timestamp, time since 1970). + /// Timestamp at which this envelope first became available (UNIX timestamp, time since 1970). columns_available_timestamp: Option, pub spec: Arc, } @@ -86,7 +86,7 @@ pub enum MaybeAvailableEnvelope { }, } -/// This snapshot is to be used for verifying a envelope of the block. +/// This snapshot is to be used for verifying a payload envelope. #[derive(Debug, Clone)] pub struct EnvelopeProcessingSnapshot { /// This state is equivalent to the `self.beacon_block.state_root()` before applying the envelope. @@ -158,54 +158,41 @@ impl AvailableExecutedEnvelope { #[derive(Debug)] pub enum EnvelopeError { /// The envelope's block root is unknown. - BlockRootUnknown { - block_root: Hash256, - }, + BlockRootUnknown { block_root: Hash256 }, /// The signature is invalid. BadSignature, /// The builder index doesn't match the committed bid - BuilderIndexMismatch { - committed_bid: u64, - envelope: u64, - }, - // The envelope slot doesn't match the block - SlotMismatch { - block: Slot, - envelope: Slot, - }, - // The validator index is unknown - UnknownValidator { - builder_index: u64, - }, - // The block hash doesn't match the committed bid + BuilderIndexMismatch { committed_bid: u64, envelope: u64 }, + /// The envelope slot doesn't match the block + SlotMismatch { block: Slot, envelope: Slot }, + /// The validator index is unknown + UnknownValidator { builder_index: u64 }, + /// The block hash doesn't match the committed bid BlockHashMismatch { committed_bid: ExecutionBlockHash, envelope: ExecutionBlockHash, }, - // The block's proposer_index does not match the locally computed proposer - IncorrectBlockProposer { - block: u64, - local_shuffling: u64, - }, - // The slot belongs to a block that is from a slot prior than - // the most recently finalized slot + /// The block's proposer_index does not match the locally computed proposer + IncorrectBlockProposer { block: u64, local_shuffling: u64 }, + /// The slot belongs to a block that is from a slot prior than + /// to most recently finalized slot PriorToFinalization { payload_slot: Slot, latest_finalized_slot: Slot, }, - // Some Beacon Chain Error + /// Some Beacon Chain Error BeaconChainError(Arc), - // Some Beacon State error + /// Some Beacon State error BeaconStateError(BeaconStateError), - // Some BlockProcessingError (for electra operations) + /// Some BlockProcessingError (for electra operations) BlockProcessingError(BlockProcessingError), - // Some EnvelopeProcessingError + /// Some EnvelopeProcessingError EnvelopeProcessingError(EnvelopeProcessingError), - // Error verifying the execution payload + /// Error verifying the execution payload ExecutionPayloadError(ExecutionPayloadError), - // An error from block-level checks reused during envelope import + /// An error from block-level checks reused during envelope import BlockError(BlockError), - // Internal error + /// Internal error InternalError(String), }