-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this 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
yeah, many code change, I have stuck here -> https://github.com/paradigmxyz/reth/pull/13646/files#diff-d46aefacdec3af127f81279bde35fd79e85096a6908f26df1ae2afcb84d1fe68R198 |
There was a problem hiding this 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
|
||
/// 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 | ||
} |
There was a problem hiding this comment.
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()), |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
makes sense
Closes #13640