Refactor data column reconstruction and avoid blocking processing (#6403)

* Move reconstruction logic out of `overflow_lru_cache` to simplify the code and avoids having to pass `DataColumnsToPublish` around and blocking other processing.

* Publish reconstructed cells before recomputing head. Remove duplicate functions.

* Merge branch 'unstable' into non-blocking-reconstruction

* Merge branch 'unstable' into non-blocking-reconstruction

# Conflicts:
#	beacon_node/beacon_chain/src/beacon_chain.rs
#	beacon_node/beacon_chain/src/data_availability_checker.rs
#	beacon_node/beacon_chain/src/data_availability_checker/overflow_lru_cache.rs
#	beacon_node/network/src/network_beacon_processor/sync_methods.rs

* Spawn a blocking task for reconstruction.

* Merge branch 'unstable' into non-blocking-reconstruction

# Conflicts:
#	beacon_node/network/src/network_beacon_processor/mod.rs

* Fix fmt

* Merge branch 'unstable' into non-blocking-reconstruction

# Conflicts:
#	beacon_node/beacon_chain/src/data_availability_checker/overflow_lru_cache.rs

* Fix race condition by making check and mutation atomic as suggested by Lion. Also added error handling to reconstruction failure.

* Add reconstruction reason metric and more debug logging to da checker.

* Add comment and logging.

* Rename `NotRequired` to `NotStarted`.

* Remove extra character added.
This commit is contained in:
Jimmy Chen
2024-10-17 15:56:25 +11:00
committed by GitHub
parent 772929fae2
commit ee7fca3ebd
9 changed files with 454 additions and 246 deletions

View File

@@ -313,10 +313,7 @@ impl<E: EthSpec> KzgVerifiedCustodyDataColumn<E> {
kzg: &Kzg,
partial_set_of_columns: &[Self],
spec: &ChainSpec,
) -> Result<Vec<Self>, KzgError> {
// Will only return an error if:
// - < 50% of columns
// - There are duplicates
) -> Result<Vec<KzgVerifiedCustodyDataColumn<E>>, KzgError> {
let all_data_columns = reconstruct_data_columns(
kzg,
&partial_set_of_columns
@@ -328,10 +325,8 @@ impl<E: EthSpec> KzgVerifiedCustodyDataColumn<E> {
Ok(all_data_columns
.into_iter()
.map(|d| {
KzgVerifiedCustodyDataColumn::from_asserted_custody(KzgVerifiedDataColumn {
data: d,
})
.map(|data| {
KzgVerifiedCustodyDataColumn::from_asserted_custody(KzgVerifiedDataColumn { data })
})
.collect::<Vec<_>>())
}