Refactor consensus/types (#7827)

Organize and categorize `consensus/types` into modules based on their relation to key consensus structures/concepts.
This is a precursor to a sensible public interface.

While this refactor is very opinionated, I am open to suggestions on module names, or type groupings if my current ones are inappropriate.


Co-Authored-By: Mac L <mjladson@pm.me>
This commit is contained in:
Mac L
2025-12-04 13:28:52 +04:00
committed by GitHub
parent 51d0336020
commit 4e958a92d3
167 changed files with 2117 additions and 1751 deletions

View File

@@ -2,6 +2,7 @@ use crate::version::inconsistent_fork_rejection;
use crate::{ExecutionOptimistic, state_id::checkpoint_slot_and_execution_optimistic};
use beacon_chain::kzg_utils::reconstruct_blobs;
use beacon_chain::{BeaconChain, BeaconChainError, BeaconChainTypes, WhenSlotSkipped};
use eth2::beacon_response::{ExecutionOptimisticFinalizedMetadata, UnversionedResponse};
use eth2::types::BlockId as CoreBlockId;
use eth2::types::DataColumnIndicesQuery;
use eth2::types::{BlobIndicesQuery, BlobWrapper, BlobsVersionedHashesQuery};
@@ -10,8 +11,7 @@ use std::str::FromStr;
use std::sync::Arc;
use types::{
BlobSidecarList, DataColumnSidecarList, EthSpec, FixedBytesExtended, ForkName, Hash256,
SignedBeaconBlock, SignedBlindedBeaconBlock, Slot, UnversionedResponse,
beacon_response::ExecutionOptimisticFinalizedMetadata,
SignedBeaconBlock, SignedBlindedBeaconBlock, Slot,
};
use warp::Rejection;

View File

@@ -3,13 +3,14 @@ use crate::version::{
beacon_response,
};
use beacon_chain::{BeaconChain, BeaconChainError, BeaconChainTypes};
use eth2::beacon_response::BeaconResponse;
use eth2::types::{
self as api_types, LightClientUpdate, LightClientUpdateResponseChunk,
LightClientUpdateResponseChunkInner, LightClientUpdatesQuery,
};
use ssz::Encode;
use std::sync::Arc;
use types::{BeaconResponse, EthSpec, ForkName, Hash256, LightClientBootstrap};
use types::{EthSpec, ForkName, Hash256, LightClientBootstrap};
use warp::{
Rejection,
hyper::{Body, Response},

View File

@@ -9,6 +9,7 @@ use crate::{
use beacon_chain::{
BeaconBlockResponseWrapper, BeaconChain, BeaconChainTypes, ProduceBlockVerification,
};
use eth2::beacon_response::ForkVersionedResponse;
use eth2::types::{self as api_types, ProduceBlockV3Metadata, SkipRandaoVerification};
use lighthouse_tracing::{SPAN_PRODUCE_BLOCK_V2, SPAN_PRODUCE_BLOCK_V3};
use ssz::Encode;

View File

@@ -1,16 +1,14 @@
use crate::api_types::EndpointVersion;
use eth2::beacon_response::{
BeaconResponse, ExecutionOptimisticFinalizedBeaconResponse,
ExecutionOptimisticFinalizedMetadata, ForkVersionedResponse, UnversionedResponse,
};
use eth2::{
CONSENSUS_BLOCK_VALUE_HEADER, CONSENSUS_VERSION_HEADER, CONTENT_TYPE_HEADER,
EXECUTION_PAYLOAD_BLINDED_HEADER, EXECUTION_PAYLOAD_VALUE_HEADER, SSZ_CONTENT_TYPE_HEADER,
};
use serde::Serialize;
use types::{
BeaconResponse, ForkName, ForkVersionedResponse, InconsistentFork, Uint256,
UnversionedResponse,
beacon_response::{
ExecutionOptimisticFinalizedBeaconResponse, ExecutionOptimisticFinalizedMetadata,
},
};
use types::{ForkName, InconsistentFork, Uint256};
use warp::reply::{self, Reply, Response};
pub const V1: EndpointVersion = EndpointVersion(1);