Files
lighthouse/beacon_node/beacon_chain/src/lib.rs
Pawan Dhananjay 6698872f8a Improve error types for envelopes (#9414)
N/A


  Currently, we have `EnvelopeError` having a `ImportError` wrapping a `BlockError`. I feel this is extremely unintuitive because most of the envelope processing functions can simply return an `EnvelopeError` that makes sense in the function's context. It revealed further ugliness when implementing range sync in #9362

This PR does 2 main things:
1. Removes `ImportError(BlockError)` variant
2. Adds `EnvelopeError(EnvelopeError)` variant to a `BlockError`.

I feel this is more natural as there can be envelope errors when we try importing a Block but envelope errors can be contained to just envelope related errors.

The main blocker to doing this was `PayloadVerificationHandle` returning a `BlockError`. It uses a very small subset of `BlockError` which I extracted to its own error type which can be converted into both a BlockError and EnvelopeError.

This allows us to keep most of the pure envelope processing functions to just return EnvelopeErrors while we convert it to a `BlockError` only in import paths where we need to return a consolidated `BlockError`.


Co-Authored-By: Pawan Dhananjay <pawandhananjay@gmail.com>
2026-06-05 13:57:28 +00:00

111 lines
3.9 KiB
Rust

pub mod attestation_rewards;
pub mod attestation_simulator;
pub mod attestation_verification;
pub mod beacon_block_reward;
mod beacon_block_streamer;
mod beacon_chain;
mod beacon_fork_choice_store;
pub mod beacon_proposer_cache;
mod beacon_snapshot;
pub mod bellatrix_readiness;
pub mod blob_verification;
mod block_production;
mod block_times_cache;
mod block_verification;
pub mod block_verification_types;
pub mod builder;
pub mod canonical_head;
pub mod chain_config;
pub mod custody_context;
pub mod data_availability_checker;
pub mod data_column_verification;
mod early_attester_cache;
pub mod envelope_times_cache;
mod errors;
pub mod events;
pub mod execution_payload;
pub mod fetch_blobs;
pub mod fork_choice_signal;
pub mod graffiti_calculator;
pub mod historical_blocks;
pub mod historical_data_columns;
pub mod invariants;
pub mod kzg_utils;
pub mod light_client_finality_update_verification;
pub mod light_client_optimistic_update_verification;
mod light_client_server_cache;
pub mod metrics;
pub mod migrate;
mod naive_aggregation_pool;
pub mod observed_aggregates;
mod observed_attesters;
pub mod observed_block_producers;
pub mod observed_data_sidecars;
pub mod observed_operations;
mod observed_slashable;
pub mod partial_data_column_assembler;
pub mod payload_attestation_verification;
pub mod payload_bid_verification;
pub mod payload_envelope_streamer;
pub mod payload_envelope_verification;
pub mod pending_payload_cache;
pub mod pending_payload_envelopes;
pub mod persisted_beacon_chain;
pub mod persisted_custody;
mod persisted_fork_choice;
mod pre_finalization_cache;
pub mod proposer_preferences_verification;
pub mod proposer_prep_service;
pub mod schema_change;
pub mod shuffling_cache;
pub mod single_attestation;
pub mod state_advance_timer;
pub mod summaries_dag;
pub mod sync_committee_rewards;
pub mod sync_committee_verification;
pub mod test_utils;
pub mod validator_monitor;
pub mod validator_pubkey_cache;
pub use self::beacon_chain::{
AttestationProcessingOutcome, AvailabilityProcessingStatus, BeaconBlockResponse,
BeaconBlockResponseWrapper, BeaconChain, BeaconChainTypes, BeaconStore, BlockProcessStatus,
ChainSegmentResult, ForkChoiceError, INVALID_FINALIZED_MERGE_TRANSITION_BLOCK_SHUTDOWN_REASON,
INVALID_JUSTIFIED_PAYLOAD_SHUTDOWN_REASON, LightClientProducerEvent, OverrideForkchoiceUpdate,
ProduceBlockVerification, StateSkipConfig, WhenSlotSkipped,
};
pub use self::beacon_snapshot::BeaconSnapshot;
pub use self::chain_config::ChainConfig;
pub use self::errors::{BeaconChainError, BlockProductionError};
pub use self::historical_blocks::HistoricalBlockError;
pub use attestation_verification::Error as AttestationError;
pub use beacon_fork_choice_store::{
BeaconForkChoiceStore, Error as ForkChoiceStoreError, PersistedForkChoiceStore,
PersistedForkChoiceStoreV28,
};
pub use block_verification::{
BlockError, ExecutionPayloadError, ExecutionPendingBlock, GossipVerifiedBlock,
IntoExecutionPendingBlock, IntoGossipVerifiedBlock, InvalidSignature, ParentImportStatus,
PayloadVerificationError, PayloadVerificationOutcome, PayloadVerificationStatus,
build_blob_data_column_sidecars, get_block_root, signature_verify_chain_segment,
};
pub use block_verification_types::AvailabilityPendingExecutedBlock;
pub use block_verification_types::ExecutedBlock;
pub use canonical_head::{CachedHead, CanonicalHead, CanonicalHeadRwLock};
pub use custody_context::CustodyContext;
pub use events::ServerSentEventHandler;
pub use execution_layer::EngineState;
pub use execution_payload::NotifyExecutionLayer;
pub use fork_choice::{ExecutionStatus, ForkchoiceUpdateParameters};
pub use kzg::{Kzg, TrustedSetup};
pub use metrics::scrape_for_metrics;
pub use migrate::MigratorConfig;
pub use parking_lot;
pub use slot_clock;
pub use state_processing::per_block_processing::errors::{
AttestationValidationError, AttesterSlashingValidationError, DepositValidationError,
ExitValidationError, ProposerSlashingValidationError,
};
pub use store;
pub use types;