-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
feat: get BlockMeta
table values from static file or database
#13844
Conversation
8589272
to
a5080e2
Compare
@@ -171,7 +173,7 @@ where | |||
let ommers = if chain_spec.final_paris_total_difficulty(header.number).is_some() { | |||
Vec::new() | |||
} else { | |||
ommers_cursor.seek_exact(header.number)?.map(|(_, o)| o.ommers).unwrap_or_default() | |||
provider.ommers(header.number.into())?.unwrap_or_default() |
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.
smol perf hit since it's no longer using a cursor, but since it's just ommers i'd be okay with it. The alternative is to implement Provider::ommers_range
.
I do plan to add withdrawals_range
since it's actually used today
BlockMeta
tables from static file or databaseBlockMeta
table values from static file or database
Provider: DBProvider + ChainSpecProvider<ChainSpec: EthereumHardforks>, | ||
Provider: DBProvider | ||
+ ChainSpecProvider<ChainSpec: EthereumHardforks> | ||
+ OmmersProvider<Header = Header>, |
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.
necessary since BlockBody
expects Vec<Header>
as Ommers
@@ -562,14 +562,29 @@ impl<N: ProviderNodeTypes> BlockBodyIndicesProvider for ProviderFactory<N> { | |||
&self, | |||
number: BlockNumber, | |||
) -> ProviderResult<Option<StoredBlockBodyIndices>> { | |||
self.provider()?.block_body_indices(number) | |||
self.static_file_provider.get_with_static_file_or_database( |
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 should still delegate to the self.provider()
I think? given that it already does get_with_static_file_or_database
internally
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 way a database transaction wont get opened unless truly necessary
Uses
get_with_static_file_or_database
andget_range_with_static_file_or_database
in provider implementations forOmmers
,Withdrawals
andBlockBodyIndices
.Since the block meta static file isn't being written to yet, it shouldn't have any meaningful effect. Just spreading out the change into smaller PRs.