mirror of
https://github.com/sigp/lighthouse.git
synced 2026-05-31 13:17:09 +00:00
cleanup
This commit is contained in:
@@ -20,8 +20,10 @@ use crate::chain_config::ChainConfig;
|
|||||||
use crate::custody_context::CustodyContextSsz;
|
use crate::custody_context::CustodyContextSsz;
|
||||||
use crate::data_availability_checker::{
|
use crate::data_availability_checker::{
|
||||||
Availability as BlockAvailability, AvailabilityCheckError, AvailableBlock, AvailableBlockData,
|
Availability as BlockAvailability, AvailabilityCheckError, AvailableBlock, AvailableBlockData,
|
||||||
DataColumnReconstructionResult,
|
DataColumnReconstructionResult as DataColumnReconstructionResultV1,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
use crate::data_availability_checker_v2::DataColumnReconstructionResult as DataColumnReconstructionResultV2;
|
||||||
use crate::data_availability_router::{
|
use crate::data_availability_router::{
|
||||||
AvailabilityOutcome, DataAvailabilityRouter, ReconstructionOutcome,
|
AvailabilityOutcome, DataAvailabilityRouter, ReconstructionOutcome,
|
||||||
};
|
};
|
||||||
@@ -3337,7 +3339,7 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
|
|||||||
match result {
|
match result {
|
||||||
ReconstructionOutcome::Block(data_column_reconstruction_result) => {
|
ReconstructionOutcome::Block(data_column_reconstruction_result) => {
|
||||||
match data_column_reconstruction_result {
|
match data_column_reconstruction_result {
|
||||||
DataColumnReconstructionResult::Success((
|
DataColumnReconstructionResultV1::Success((
|
||||||
availability,
|
availability,
|
||||||
data_columns_to_publish,
|
data_columns_to_publish,
|
||||||
)) => {
|
)) => {
|
||||||
@@ -3356,8 +3358,8 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
|
|||||||
Some((availability_processing_status, data_columns_to_publish))
|
Some((availability_processing_status, data_columns_to_publish))
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
DataColumnReconstructionResult::NotStarted(reason)
|
DataColumnReconstructionResultV1::NotStarted(reason)
|
||||||
| DataColumnReconstructionResult::RecoveredColumnsNotImported(reason) => {
|
| DataColumnReconstructionResultV1::RecoveredColumnsNotImported(reason) => {
|
||||||
// We use metric here because logging this would be *very* noisy.
|
// We use metric here because logging this would be *very* noisy.
|
||||||
metrics::inc_counter_vec(
|
metrics::inc_counter_vec(
|
||||||
&metrics::KZG_DATA_COLUMN_RECONSTRUCTION_INCOMPLETE_TOTAL,
|
&metrics::KZG_DATA_COLUMN_RECONSTRUCTION_INCOMPLETE_TOTAL,
|
||||||
@@ -3368,9 +3370,38 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// TODO(gloas) handle data column reconstruction for gloas.
|
// TODO(gloas) handle data column reconstruction for gloas.
|
||||||
ReconstructionOutcome::Payload(_data_column_reconstruction_result) => Err(
|
ReconstructionOutcome::Payload(data_column_reconstruction_result) => {
|
||||||
BlockError::InternalError("Not yet implemented for gloas".to_owned()),
|
match data_column_reconstruction_result {
|
||||||
),
|
DataColumnReconstructionResultV2::Success((
|
||||||
|
availability,
|
||||||
|
data_columns_to_publish,
|
||||||
|
)) => {
|
||||||
|
let Some(slot) = data_columns_to_publish.first().map(|d| d.slot()) else {
|
||||||
|
// This should be unreachable because empty result would return `RecoveredColumnsNotImported` instead of success.
|
||||||
|
return Ok(None);
|
||||||
|
};
|
||||||
|
|
||||||
|
self.process_availability(
|
||||||
|
slot,
|
||||||
|
AvailabilityOutcome::Payload(availability),
|
||||||
|
|| Ok(()),
|
||||||
|
)
|
||||||
|
.await
|
||||||
|
.map(|availability_processing_status| {
|
||||||
|
Some((availability_processing_status, data_columns_to_publish))
|
||||||
|
})
|
||||||
|
}
|
||||||
|
DataColumnReconstructionResultV2::NotStarted(reason)
|
||||||
|
| DataColumnReconstructionResultV2::RecoveredColumnsNotImported(reason) => {
|
||||||
|
// We use metric here because logging this would be *very* noisy.
|
||||||
|
metrics::inc_counter_vec(
|
||||||
|
&metrics::KZG_DATA_COLUMN_RECONSTRUCTION_INCOMPLETE_TOTAL,
|
||||||
|
&[reason],
|
||||||
|
);
|
||||||
|
Ok(None)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -829,6 +829,10 @@ mod data_availability_checker_tests {
|
|||||||
assert_eq!(cache.block_cache_size(), 0);
|
assert_eq!(cache.block_cache_size(), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO(gloas): Add tests for `put_rpc_custody_columns` and `put_gossip_verified_data_columns`
|
||||||
|
// once the Gloas harness can produce KZG-valid columns. These wrappers add KZG verification
|
||||||
|
// and custody column filtering on top of `put_kzg_verified_custody_data_columns`.
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
async fn test_put_columns_creates_pending_components() {
|
async fn test_put_columns_creates_pending_components() {
|
||||||
if !is_gloas_enabled() {
|
if !is_gloas_enabled() {
|
||||||
|
|||||||
@@ -169,7 +169,7 @@ impl<T: BeaconChainTypes> DataAvailabilityRouter<T> {
|
|||||||
self.v1.custody_context()
|
self.v1.custody_context()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Query data columns from the appropriate checker based on slot.
|
/// Query data columns from the appropriate checker based on fork.
|
||||||
pub fn get_data_columns(
|
pub fn get_data_columns(
|
||||||
&self,
|
&self,
|
||||||
block_root: Hash256,
|
block_root: Hash256,
|
||||||
@@ -208,7 +208,7 @@ impl<T: BeaconChainTypes> DataAvailabilityRouter<T> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Insert RPC custody columns, routing to the correct checker based on fork.
|
/// Insert RPC custody columns, routing to the correct checker based on slot.
|
||||||
pub fn put_rpc_custody_columns(
|
pub fn put_rpc_custody_columns(
|
||||||
&self,
|
&self,
|
||||||
block_root: Hash256,
|
block_root: Hash256,
|
||||||
@@ -226,7 +226,7 @@ impl<T: BeaconChainTypes> DataAvailabilityRouter<T> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Insert gossip-verified data columns, routing to the correct checker based on fork.
|
/// Insert gossip-verified data columns, routing to the correct checker based on slot.
|
||||||
pub fn put_gossip_verified_data_columns<O: ObservationStrategy>(
|
pub fn put_gossip_verified_data_columns<O: ObservationStrategy>(
|
||||||
&self,
|
&self,
|
||||||
block_root: Hash256,
|
block_root: Hash256,
|
||||||
@@ -244,7 +244,7 @@ impl<T: BeaconChainTypes> DataAvailabilityRouter<T> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Insert KZG-verified custody data columns, routing to the correct checker based on fork.
|
/// Insert KZG-verified custody data columns, routing to the correct checker based on slot.
|
||||||
pub fn put_kzg_verified_custody_data_columns(
|
pub fn put_kzg_verified_custody_data_columns(
|
||||||
&self,
|
&self,
|
||||||
block_root: Hash256,
|
block_root: Hash256,
|
||||||
@@ -262,7 +262,7 @@ impl<T: BeaconChainTypes> DataAvailabilityRouter<T> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Attempt to reconstruct missing data columns, routing to the correct checker based on fork.
|
/// Attempt to reconstruct missing data columns, routing to the correct checker based on slot.
|
||||||
pub fn reconstruct_data_columns(
|
pub fn reconstruct_data_columns(
|
||||||
&self,
|
&self,
|
||||||
block_root: &Hash256,
|
block_root: &Hash256,
|
||||||
|
|||||||
@@ -1897,12 +1897,6 @@ pub static DATA_AVAILABILITY_OVERFLOW_MEMORY_BLOCK_CACHE_SIZE: LazyLock<Result<I
|
|||||||
"Number of entries in the data availability overflow block memory cache.",
|
"Number of entries in the data availability overflow block memory cache.",
|
||||||
)
|
)
|
||||||
});
|
});
|
||||||
pub static DATA_AVAILABILITY_PAYLOAD_CACHE_SIZE: LazyLock<Result<IntGauge>> = LazyLock::new(|| {
|
|
||||||
try_create_int_gauge(
|
|
||||||
"data_availability_payload_cache_size",
|
|
||||||
"Number of entries in the data availability payload envelope cache.",
|
|
||||||
)
|
|
||||||
});
|
|
||||||
pub static DATA_AVAILABILITY_RECONSTRUCTION_TIME: LazyLock<Result<Histogram>> =
|
pub static DATA_AVAILABILITY_RECONSTRUCTION_TIME: LazyLock<Result<Histogram>> =
|
||||||
LazyLock::new(|| {
|
LazyLock::new(|| {
|
||||||
try_create_histogram(
|
try_create_histogram(
|
||||||
|
|||||||
Reference in New Issue
Block a user