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: use BlockWithParent for StageError #13198

Merged
merged 5 commits into from
Dec 10, 2024
Merged

chore: use BlockWithParent for StageError #13198

merged 5 commits into from
Dec 10, 2024

Conversation

Rjected
Copy link
Member

@Rjected Rjected commented Dec 6, 2024

This fixes #13197, changing to BlockWithParent for all of the fields that are currently SealedHeader in StageError

@Rjected Rjected added C-enhancement New feature or request A-staged-sync Related to staged sync (pipelines and stages) A-sdk Related to reth's use as a library labels Dec 6, 2024
Copy link
Collaborator

@mattsse mattsse left a comment

Choose a reason for hiding this comment

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

this doesn't solve the header type in stageerror issue yet.

looking at the stageerror error messages, looks like we can simply use the BlockWithParent type that is hash+number+parent_hash instead of the header?

@Rjected
Copy link
Member Author

Rjected commented Dec 7, 2024

looking at the stageerror error messages, looks like we can simply use the BlockWithParent type that is hash+number+parent_hash instead of the header?

Actually yeah that would be better, will change stageerror to use that

@Rjected Rjected force-pushed the dan/boxed-stage-error branch from 568e404 to 661e06c Compare December 9, 2024 22:16
@Rjected
Copy link
Member Author

Rjected commented Dec 9, 2024

this doesn't solve the header type in stageerror issue yet.

looking at the stageerror error messages, looks like we can simply use the BlockWithParent type that is hash+number+parent_hash instead of the header?

Had to change the InvalidHeadersCache to use this type as well, and other invalid / bad block handling.

Copy link
Collaborator

@klkvr klkvr left a comment

Choose a reason for hiding this comment

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

great! this should unblock abstraction of header stage which is the only reason pipeline needs concrete header generic right now

just a nit on unneeded generic

crates/consensus/beacon/src/engine/invalid_headers.rs Outdated Show resolved Hide resolved
@Rjected Rjected changed the title chore: Box StageError variant in PipelineError chore: use BlockWithParent for StageError Dec 9, 2024
@Rjected Rjected requested a review from klkvr December 9, 2024 23:51
Copy link
Collaborator

@klkvr klkvr left a comment

Choose a reason for hiding this comment

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

lgtm

crates/consensus/beacon/src/engine/invalid_headers.rs Outdated Show resolved Hide resolved
Copy link
Collaborator

@mattsse mattsse left a comment

Choose a reason for hiding this comment

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

makes sense,

nits

crates/consensus/beacon/src/engine/mod.rs Outdated Show resolved Hide resolved
crates/primitives-traits/src/header/sealed.rs Show resolved Hide resolved
Comment on lines +147 to +150
block: Box::new(BlockWithParent::new(
header.parent_hash,
NumHash::new(header.number, header_hash),
)),
Copy link
Collaborator

Choose a reason for hiding this comment

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

this can use the trait function I assume?

Comment on lines +102 to +109
/// Generate a random [`BlockWithParent`].
pub fn random_block_with_parent<R: Rng>(
rng: &mut R,
number: u64,
parent: Option<B256>,
) -> BlockWithParent {
BlockWithParent { parent: parent.unwrap_or_default(), block: NumHash::new(number, rng.gen()) }
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

@Rjected Rjected requested a review from mattsse December 10, 2024 00:13
@Rjected Rjected enabled auto-merge December 10, 2024 00:21
@Rjected Rjected added this pull request to the merge queue Dec 10, 2024
Merged via the queue into main with commit c9bd640 Dec 10, 2024
42 checks passed
@Rjected Rjected deleted the dan/boxed-stage-error branch December 10, 2024 00:36
lean-apple pushed a commit to lean-apple/reth that referenced this pull request Dec 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-sdk Related to reth's use as a library A-staged-sync Related to staged sync (pipelines and stages) C-enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Introduce header-erased StageError
3 participants