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: make SealedBlock.header field private #13646

Open
wants to merge 12 commits into
base: main
Choose a base branch
from

Conversation

hoank101
Copy link
Contributor

@hoank101 hoank101 commented Jan 4, 2025

Closes #13640

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.

good start but there are a few more things that still need fixing hehe

@hoank101
Copy link
Contributor Author

hoank101 commented Jan 4, 2025

good start but there are a few more things that still need fixing hehe

yeah, many code change, I have stuck here -> https://github.com/paradigmxyz/reth/pull/13646/files#diff-d46aefacdec3af127f81279bde35fd79e85096a6908f26df1ae2afcb84d1fe68R198
can you give a feedback

Copy link
Member

@Rjected Rjected left a comment

Choose a reason for hiding this comment

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

I think I know why this is not building, have to work around deref coercion

Comment on lines 61 to 67

/// Returns a reference to self.
/// This is useful when you need to convert from a dereferenced header back to SealedHeader.
#[inline]
pub const fn as_sealed_header(&self) -> &SealedHeader<H> {
self
}
Copy link
Member

Choose a reason for hiding this comment

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

This method doesn't seem necessary, since it's just returning self?

@@ -705,7 +705,7 @@ impl<N: ProviderNodeTypes> HeaderProvider for ConsistentProvider<N> {
self.get_in_memory_or_storage_by_block_range_while(
range,
|db_provider, range, _| db_provider.sealed_headers_range(range),
|block_state, _| Some(block_state.block_ref().block().header.clone()),
|block_state, _| Some(block_state.block_ref().block().header().clone()),
Copy link
Member

Choose a reason for hiding this comment

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

it looks like the deref coercion causes this to call the SealedHeader::header method, which returns an unsealed header. To fix this we could add a method called header_ref to our SealedBlock type, and then clone.

Copy link
Collaborator

Choose a reason for hiding this comment

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

makes sense

@mattsse mattsse added the A-sdk Related to reth's use as a library label Jan 6, 2025
@mattsse mattsse marked this pull request as ready for review January 7, 2025 18:55
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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make SealedBlock.header field private
3 participants