-
Notifications
You must be signed in to change notification settings - Fork 1k
Drop block data from BlockError and BlobError #5735
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -22,7 +22,7 @@ use types::{ | |
|
|
||
| /// An error occurred while validating a gossip blob. | ||
| #[derive(Debug)] | ||
| pub enum GossipBlobError<E: EthSpec> { | ||
| pub enum GossipBlobError { | ||
| /// The blob sidecar is from a slot that is later than the current slot (with respect to the | ||
| /// gossip clock disparity). | ||
| /// | ||
|
|
@@ -95,7 +95,7 @@ pub enum GossipBlobError<E: EthSpec> { | |
| /// ## Peer scoring | ||
| /// | ||
| /// We cannot process the blob without validating its parent, the peer isn't necessarily faulty. | ||
| BlobParentUnknown(Arc<BlobSidecar<E>>), | ||
| BlobParentUnknown { parent_root: Hash256 }, | ||
|
|
||
| /// Invalid kzg commitment inclusion proof | ||
| /// ## Peer scoring | ||
|
|
@@ -145,28 +145,19 @@ pub enum GossipBlobError<E: EthSpec> { | |
| NotFinalizedDescendant { block_parent_root: Hash256 }, | ||
| } | ||
|
|
||
| impl<E: EthSpec> std::fmt::Display for GossipBlobError<E> { | ||
| impl std::fmt::Display for GossipBlobError { | ||
| fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | ||
| match self { | ||
| GossipBlobError::BlobParentUnknown(blob_sidecar) => { | ||
| write!( | ||
| f, | ||
| "BlobParentUnknown(parent_root:{})", | ||
| blob_sidecar.block_parent_root() | ||
| ) | ||
| } | ||
| other => write!(f, "{:?}", other), | ||
| } | ||
| write!(f, "{:?}", self) | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Kept this implementation of Display as some release tests assert the full error description. I'm not sure of which consumers expect the full error details in Display formatting. If we switch to |
||
| } | ||
| } | ||
|
|
||
| impl<E: EthSpec> From<BeaconChainError> for GossipBlobError<E> { | ||
| impl From<BeaconChainError> for GossipBlobError { | ||
| fn from(e: BeaconChainError) -> Self { | ||
| GossipBlobError::BeaconChainError(e) | ||
| } | ||
| } | ||
|
|
||
| impl<E: EthSpec> From<BeaconStateError> for GossipBlobError<E> { | ||
| impl From<BeaconStateError> for GossipBlobError { | ||
| fn from(e: BeaconStateError) -> Self { | ||
| GossipBlobError::BeaconChainError(BeaconChainError::BeaconStateError(e)) | ||
| } | ||
|
|
@@ -190,12 +181,12 @@ impl<T: BeaconChainTypes> GossipVerifiedBlob<T> { | |
| blob: Arc<BlobSidecar<T::EthSpec>>, | ||
| subnet_id: u64, | ||
| chain: &BeaconChain<T>, | ||
| ) -> Result<Self, GossipBlobError<T::EthSpec>> { | ||
| ) -> Result<Self, GossipBlobError> { | ||
| let header = blob.signed_block_header.clone(); | ||
| // We only process slashing info if the gossip verification failed | ||
| // since we do not process the blob any further in that case. | ||
| validate_blob_sidecar_for_gossip(blob, subnet_id, chain).map_err(|e| { | ||
| process_block_slash_info::<_, GossipBlobError<T::EthSpec>>( | ||
| process_block_slash_info::<_, GossipBlobError>( | ||
| chain, | ||
| BlockSlashInfo::from_early_error_blob(header, e), | ||
| ) | ||
|
|
@@ -384,7 +375,7 @@ pub fn validate_blob_sidecar_for_gossip<T: BeaconChainTypes>( | |
| blob_sidecar: Arc<BlobSidecar<T::EthSpec>>, | ||
| subnet: u64, | ||
| chain: &BeaconChain<T>, | ||
| ) -> Result<GossipVerifiedBlob<T>, GossipBlobError<T::EthSpec>> { | ||
| ) -> Result<GossipVerifiedBlob<T>, GossipBlobError> { | ||
| let blob_slot = blob_sidecar.slot(); | ||
| let blob_index = blob_sidecar.index; | ||
| let block_parent_root = blob_sidecar.block_parent_root(); | ||
|
|
@@ -466,7 +457,9 @@ pub fn validate_blob_sidecar_for_gossip<T: BeaconChainTypes>( | |
| // We have already verified that the blob is past finalization, so we can | ||
| // just check fork choice for the block's parent. | ||
| let Some(parent_block) = fork_choice.get_block(&block_parent_root) else { | ||
| return Err(GossipBlobError::BlobParentUnknown(blob_sidecar)); | ||
| return Err(GossipBlobError::BlobParentUnknown { | ||
| parent_root: block_parent_root, | ||
| }); | ||
| }; | ||
|
|
||
| // Do not process a blob that does not descend from the finalized root. | ||
|
|
@@ -516,7 +509,7 @@ pub fn validate_blob_sidecar_for_gossip<T: BeaconChainTypes>( | |
| )) | ||
| })?; | ||
|
|
||
| let state = cheap_state_advance_to_obtain_committees::<_, GossipBlobError<T::EthSpec>>( | ||
| let state = cheap_state_advance_to_obtain_committees::<_, GossipBlobError>( | ||
| &mut parent_state, | ||
| Some(parent_state_root), | ||
| blob_slot, | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.