Skip to content
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

chore(provider): migrate providers to ProviderError #5473

Merged
merged 5 commits into from
Nov 17, 2023

Conversation

rkrasiuk
Copy link
Member

@rkrasiuk rkrasiuk commented Nov 17, 2023

Description

Providers must return a ProviderError. Otherwise, it is impossible to reuse them in other components without adding a large RethError variant.

The only other error variant that was ever returned by providers was SenderRecoveryError which is now added to ProviderError

@rkrasiuk rkrasiuk added the C-debt Refactor of code section that is hard to understand or maintain label Nov 17, 2023
@rkrasiuk rkrasiuk changed the title chore(provider): migrate providers to provider error chore(provider): migrate providers to ProviderError Nov 17, 2023
@rkrasiuk rkrasiuk marked this pull request as ready for review November 17, 2023 12:46
crates/consensus/beacon/src/engine/mod.rs Show resolved Hide resolved
crates/revm/src/processor.rs Outdated Show resolved Hide resolved
bin/reth/src/init.rs Outdated Show resolved Hide resolved
crates/interfaces/src/provider.rs Outdated Show resolved Hide resolved
crates/payload/builder/src/error.rs Outdated Show resolved Hide resolved
ProviderError::NippyJar(err.to_string())
}
}

/// Bundled errors variants thrown by various providers.
#[derive(Clone, Debug, Error, PartialEq, Eq)]
pub enum ProviderError {
Copy link
Collaborator

Choose a reason for hiding this comment

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

since this is the error type for all the provider traits, we should add an Other(box dyn error) variant so additional errors can be used by implementers

Copy link
Member Author

@rkrasiuk rkrasiuk Nov 17, 2023

Choose a reason for hiding this comment

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

shall we do the String instead? box dyn will require removing PartialEq & Eq which are useful in testing

Copy link
Collaborator

Choose a reason for hiding this comment

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

I see, let's skip for now, can always change later

@rkrasiuk rkrasiuk added this pull request to the merge queue Nov 17, 2023
Merged via the queue into main with commit 30dfc07 Nov 17, 2023
25 checks passed
@rkrasiuk rkrasiuk deleted the rkrasiuk/migrate-providers-to-provider-error branch November 17, 2023 14:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-debt Refactor of code section that is hard to understand or maintain
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants