mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-03 00:31:50 +00:00
Make max_blobs_per_block a config parameter (#6329)
* First pass
* Add restrictions to RuntimeVariableList api
* Use empty_uninitialized and fix warnings
* Fix some todos
* Merge branch 'unstable' into max-blobs-preset
* Fix take impl on RuntimeFixedList
* cleanup
* Fix test compilations
* Fix some more tests
* Fix test from unstable
* Merge branch 'unstable' into max-blobs-preset
* Merge remote-tracking branch 'origin/unstable' into max-blobs-preset
* Remove footgun function
* Minor simplifications
* Move from preset to config
* Fix typo
* Revert "Remove footgun function"
This reverts commit de01f923c7.
* Try fixing tests
* Thread through ChainSpec
* Fix release tests
* Move RuntimeFixedVector into module and rename
* Add test
* Remove empty RuntimeVarList awefullness
* Fix tests
* Simplify BlobSidecarListFromRoot
* Merge remote-tracking branch 'origin/unstable' into max-blobs-preset
* Bump quota to account for new target (6)
* Remove clone
* Fix issue from review
* Try to remove ugliness
* Merge branch 'unstable' into max-blobs-preset
* Fix max value
* Fix doctest
* Fix formatting
* Fix max check
* Delete hardcoded max_blobs_per_block in RPC limits
* Merge remote-tracking branch 'origin/unstable' into max-blobs-preset
This commit is contained in:
@@ -287,14 +287,16 @@ impl BlockId {
|
||||
})?;
|
||||
|
||||
// Return the `BlobSidecarList` identified by `self`.
|
||||
let max_blobs_per_block = chain.spec.max_blobs_per_block(block.epoch()) as usize;
|
||||
let blob_sidecar_list = if !blob_kzg_commitments.is_empty() {
|
||||
if chain.spec.is_peer_das_enabled_for_epoch(block.epoch()) {
|
||||
Self::get_blobs_from_data_columns(chain, root, query.indices, &block)?
|
||||
} else {
|
||||
Self::get_blobs(chain, root, query.indices)?
|
||||
Self::get_blobs(chain, root, query.indices, max_blobs_per_block)?
|
||||
}
|
||||
} else {
|
||||
BlobSidecarList::default()
|
||||
BlobSidecarList::new(vec![], max_blobs_per_block)
|
||||
.map_err(|e| warp_utils::reject::custom_server_error(format!("{:?}", e)))?
|
||||
};
|
||||
|
||||
Ok((block, blob_sidecar_list, execution_optimistic, finalized))
|
||||
@@ -304,22 +306,25 @@ impl BlockId {
|
||||
chain: &BeaconChain<T>,
|
||||
root: Hash256,
|
||||
indices: Option<Vec<u64>>,
|
||||
max_blobs_per_block: usize,
|
||||
) -> Result<BlobSidecarList<T::EthSpec>, Rejection> {
|
||||
let blob_sidecar_list = chain
|
||||
.store
|
||||
.get_blobs(&root)
|
||||
.map_err(|e| warp_utils::reject::beacon_chain_error(e.into()))?
|
||||
.blobs()
|
||||
.ok_or_else(|| {
|
||||
warp_utils::reject::custom_not_found(format!("no blobs stored for block {root}"))
|
||||
})?;
|
||||
|
||||
let blob_sidecar_list_filtered = match indices {
|
||||
Some(vec) => {
|
||||
let list = blob_sidecar_list
|
||||
let list: Vec<_> = blob_sidecar_list
|
||||
.into_iter()
|
||||
.filter(|blob_sidecar| vec.contains(&blob_sidecar.index))
|
||||
.collect();
|
||||
BlobSidecarList::new(list)
|
||||
|
||||
BlobSidecarList::new(list, max_blobs_per_block)
|
||||
.map_err(|e| warp_utils::reject::custom_server_error(format!("{:?}", e)))?
|
||||
}
|
||||
None => blob_sidecar_list,
|
||||
@@ -356,11 +361,13 @@ impl BlockId {
|
||||
)
|
||||
.collect::<Result<Vec<_>, _>>()?;
|
||||
|
||||
reconstruct_blobs(&chain.kzg, &data_columns, blob_indices, block).map_err(|e| {
|
||||
warp_utils::reject::custom_server_error(format!(
|
||||
"Error reconstructing data columns: {e:?}"
|
||||
))
|
||||
})
|
||||
reconstruct_blobs(&chain.kzg, &data_columns, blob_indices, block, &chain.spec).map_err(
|
||||
|e| {
|
||||
warp_utils::reject::custom_server_error(format!(
|
||||
"Error reconstructing data columns: {e:?}"
|
||||
))
|
||||
},
|
||||
)
|
||||
} else {
|
||||
Err(warp_utils::reject::custom_server_error(
|
||||
format!("Insufficient data columns to reconstruct blobs: required {num_required_columns}, but only {num_found_column_keys} were found.")
|
||||
|
||||
@@ -1460,7 +1460,8 @@ pub async fn block_seen_on_gossip_with_some_blobs() {
|
||||
let blobs = blobs.expect("should have some blobs");
|
||||
assert!(
|
||||
blobs.0.len() >= 2,
|
||||
"need at least 2 blobs for partial reveal"
|
||||
"need at least 2 blobs for partial reveal, got: {}",
|
||||
blobs.0.len()
|
||||
);
|
||||
|
||||
let partial_kzg_proofs = vec![*blobs.0.first().unwrap()];
|
||||
|
||||
Reference in New Issue
Block a user