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

Add append_receipts function #8466

Closed
mattsse opened this issue May 29, 2024 · 1 comment · Fixed by #8718
Closed

Add append_receipts function #8466

mattsse opened this issue May 29, 2024 · 1 comment · Fixed by #8718
Assignees
Labels
A-db Related to the database C-debt A section of code is hard to understand or change D-good-first-issue Nice and easy! A great choice to get started

Comments

@mattsse
Copy link
Collaborator

mattsse commented May 29, 2024

Describe the feature

The static file writer currently only has a function for single receipts:

pub fn append_receipt(
&mut self,
tx_num: TxNumber,
receipt: Receipt,
) -> ProviderResult<TxNumber> {

resulting in code like this:

for entry in receipts_walker {
let (tx_number, receipt) = entry?;
static_file_writer.append_receipt(tx_number, receipt)?;
}

and

.expect("receipt should not be filtered when saving to static files.");
static_file_producer.append_receipt(first_tx_index + tx_idx as u64, receipt)?;
}
} else if !receipts.is_empty() {
for (tx_idx, receipt) in receipts.into_iter().enumerate() {

the append_receipt always does two syscalls for the clock
https://github.com/paradigmxyz/reth/blob/main/crates/storage/provider/src/providers/static_file/writer.rs#L460-L460

we can optimize this by using a append_receipts function that accepts an iterator instead and only update the metrics once

Additional context

No response

@mattsse mattsse added C-enhancement New feature or request D-good-first-issue Nice and easy! A great choice to get started C-debt A section of code is hard to understand or change A-db Related to the database labels May 29, 2024
@leontiad
Copy link
Contributor

I can look at that

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-db Related to the database C-debt A section of code is hard to understand or change D-good-first-issue Nice and easy! A great choice to get started
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants