Skip to content

Improve error types for envelopes#9414

Open
pawanjay176 wants to merge 5 commits into
sigp:unstablefrom
pawanjay176:improve-errors
Open

Improve error types for envelopes#9414
pawanjay176 wants to merge 5 commits into
sigp:unstablefrom
pawanjay176:improve-errors

Conversation

@pawanjay176
Copy link
Copy Markdown
Member

Issue Addressed

N/A

Proposed Changes

Currently, we have EnvelopeError having a ImportError wrapping a BlockError. I feel this is extremely unintuitive because most of the envelope processing functions can simply return an EnvelopeError that makes sense in the function's context. It revealed further ugliness when implementing range sync in #9362

This PR does 2 main things:

  1. Removes ImportError(BlockError) variant
  2. Adds EnvelopeError(EnvelopeError) variant to a BlockError.

I feel this is more natural as there can be envelope errors when we try importing a Block but envelope errors can be contained to just envelope related errors.

The main blocker to doing this was PayloadVerificationHandle returning a BlockError. It uses a very small subset of BlockError which I extracted to its own error type which can be converted into both a BlockError and EnvelopeError.

This allows us to keep most of the pure envelope processing functions to just return EnvelopeErrors while we convert it to a BlockError only in import paths where we need to return a consolidated BlockError.

},
/// Some Beacon Chain Error
BeaconChainError(Arc<BeaconChainError>),
BeaconChainError(Box<BeaconChainError>),
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did this Arc->Box just to stay consistent with BlockError::BeaconChainError.

/// It's unclear if this block is valid, but it cannot be processed without already knowing
/// its parent.
ParentUnknown { parent_root: Hash256 },
ParentUnknown {
Copy link
Copy Markdown
Member Author

@pawanjay176 pawanjay176 Jun 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure why formatting for these changed, but the code is the same

/// In the future, we could make the import error types more generic and then
/// this function could return an `EnvelopeError` as well.
#[instrument(skip_all, fields(block_root = ?block_root, envelope_source = %envelope_source))]
pub async fn process_execution_payload_envelope(
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the top level function where we need to return a BlockError to stay consistent across the other block + data import function signatures.

@pawanjay176 pawanjay176 mentioned this pull request Jun 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants