make explicity BlobsUnavailable error and handle it directly
This commit is contained in:
parent
f7f64eb007
commit
e1ce4e5b78
@ -1063,12 +1063,12 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
|
||||
Some(blobs) => Ok(Some(blobs)),
|
||||
None => {
|
||||
// Check for the corresponding block to understand whether we *should* have blobs.
|
||||
self
|
||||
.get_blinded_block(block_root)?
|
||||
self.get_blinded_block(block_root)?
|
||||
.map(|block| {
|
||||
// If there are no KZG commitments in the block, we know the sidecar should
|
||||
// be empty.
|
||||
let expected_kzg_commitments = block.message().body().blob_kzg_commitments()?;
|
||||
let expected_kzg_commitments =
|
||||
block.message().body().blob_kzg_commitments()?;
|
||||
if expected_kzg_commitments.is_empty() {
|
||||
Ok(Some(BlobsSidecar::empty_from_parts(
|
||||
*block_root,
|
||||
@ -1078,10 +1078,7 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
|
||||
if let Some(boundary) = self.data_availability_boundary() {
|
||||
// We should have blobs for all blocks after the boundary.
|
||||
if boundary <= block.epoch() {
|
||||
return Err(Error::DBInconsistent(format!(
|
||||
"Expected kzg commitments but no blobs stored for block root {}",
|
||||
block_root
|
||||
)))
|
||||
return Err(Error::BlobsUnavailable);
|
||||
}
|
||||
}
|
||||
Ok(None)
|
||||
|
@ -209,6 +209,7 @@ pub enum BeaconChainError {
|
||||
BlsToExecutionChangeBadFork(ForkName),
|
||||
InconsistentFork(InconsistentFork),
|
||||
ProposerHeadForkChoiceError(fork_choice::Error<proto_array::Error>),
|
||||
BlobsUnavailable,
|
||||
}
|
||||
|
||||
easy_from_to!(SlotProcessingError, BeaconChainError);
|
||||
|
@ -293,6 +293,21 @@ impl<T: BeaconChainTypes> Worker<T> {
|
||||
"request_root" => ?root
|
||||
);
|
||||
}
|
||||
Err(BeaconChainError::BlobsUnavailable) => {
|
||||
error!(
|
||||
self.log,
|
||||
"No blobs in the store for block root";
|
||||
"block_root" => ?root
|
||||
);
|
||||
self.send_error_response(
|
||||
peer_id,
|
||||
RPCResponseErrorCode::ResourceUnavailable,
|
||||
"Blobs unavailable".into(),
|
||||
request_id,
|
||||
);
|
||||
send_response = false;
|
||||
break;
|
||||
}
|
||||
Err(BeaconChainError::BlockHashMissingFromExecutionLayer(_)) => {
|
||||
debug!(
|
||||
self.log,
|
||||
@ -747,6 +762,21 @@ impl<T: BeaconChainTypes> Worker<T> {
|
||||
send_response = false;
|
||||
break;
|
||||
}
|
||||
Err(BeaconChainError::BlobsUnavailable) => {
|
||||
error!(
|
||||
self.log,
|
||||
"No blobs in the store for block root";
|
||||
"block_root" => ?root
|
||||
);
|
||||
self.send_error_response(
|
||||
peer_id,
|
||||
RPCResponseErrorCode::ResourceUnavailable,
|
||||
"Blobs unavailable".into(),
|
||||
request_id,
|
||||
);
|
||||
send_response = false;
|
||||
break;
|
||||
}
|
||||
Err(e) => {
|
||||
error!(
|
||||
self.log,
|
||||
|
Loading…
Reference in New Issue
Block a user