Skip to content

feat: always write receipts to static files on new nodes#19399

Merged
joshieDo merged 22 commits intomainfrom
joshie/receipts-always-sf
Nov 13, 2025
Merged

feat: always write receipts to static files on new nodes#19399
joshieDo merged 22 commits intomainfrom
joshie/receipts-always-sf

Conversation

@joshieDo
Copy link
Collaborator

@joshieDo joshieDo commented Oct 29, 2025

On top of #19384

On old nodes we are writing receipts to database if pruning is enabled, otherwise to static files.

Moving forward and using StorageSettings the new logic should be:

if `old_node` & `any_receipt_pruning` -> mdbx
else if `new_node` & `receipt_log_filter` -> mdbx
else -> SF

For now, only enabled through --static-files.receipts when launching the node

@joshieDo joshieDo self-assigned this Oct 29, 2025
@joshieDo joshieDo added the A-static-files Related to static files label Oct 29, 2025
@github-project-automation github-project-automation bot moved this to Backlog in Reth Tracker Oct 29, 2025
@joshieDo joshieDo force-pushed the joshie/storage-settings branch from 012a482 to 0a784c1 Compare October 30, 2025 17:38
@joshieDo joshieDo force-pushed the joshie/receipts-always-sf branch from d1a52cc to 8590a0f Compare October 30, 2025 17:38
@joshieDo joshieDo force-pushed the joshie/storage-settings branch from 0a784c1 to 4c15c75 Compare October 30, 2025 17:47
@joshieDo joshieDo force-pushed the joshie/receipts-always-sf branch 2 times, most recently from 1e3d5b8 to 309d1d2 Compare October 31, 2025 12:27
@joshieDo joshieDo force-pushed the joshie/storage-settings branch 2 times, most recently from e5d730d to eea160a Compare October 31, 2025 12:48
@joshieDo joshieDo force-pushed the joshie/receipts-always-sf branch from 309d1d2 to 894b411 Compare October 31, 2025 12:48
@joshieDo joshieDo force-pushed the joshie/receipts-always-sf branch from 894b411 to cca09b0 Compare October 31, 2025 12:54
@joshieDo joshieDo force-pushed the joshie/storage-settings branch from eea160a to 6429250 Compare October 31, 2025 12:54
@joshieDo joshieDo force-pushed the joshie/receipts-always-sf branch from cca09b0 to 57ba2fb Compare October 31, 2025 15:43
Base automatically changed from joshie/storage-settings to main November 6, 2025 00:56

// Behaviour reserved only for new nodes should be set here.
let storage_settings = StorageSettings::new();
let storage_settings = StorageSettings::new().with_receipts_in_static_files();
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

ensures that only new nodes will do it

@joshieDo joshieDo marked this pull request as ready for review November 6, 2025 17:08
@joshieDo joshieDo force-pushed the joshie/receipts-always-sf branch from 1d6d85d to ffa9181 Compare November 13, 2025 10:40
/// - If the node should always write receipts to static files, but receipt log filter pruning
/// is enabled, write to the database.
/// - Otherwise, write to static files.
pub fn receipts_destination<P: DBProvider + StorageSettingsCache>(
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

taken from #19630

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.

pending @shekhirin

Comment on lines +1652 to +1653
// files yet. Once receipts exist in static files, we must continue writing to maintain
// continuity and have no gaps.
Copy link
Collaborator

Choose a reason for hiding this comment

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

I see

@joshieDo joshieDo requested a review from gakonst as a code owner November 13, 2025 13:26
shekhirin
shekhirin approved these changes Nov 13, 2025
Comment on lines +50 to +54
if self.receipts {
StorageSettings::new().with_receipts_in_static_files()
} else {
StorageSettings::legacy()
}
Copy link
Member

Choose a reason for hiding this comment

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

nit: think it's nicer to be able to do

Suggested change
if self.receipts {
StorageSettings::new().with_receipts_in_static_files()
} else {
StorageSettings::legacy()
}
StorageSettings::legacy().with_receipts_in_static_files(self.receipts)

@joshieDo joshieDo added this pull request to the merge queue Nov 13, 2025
Merged via the queue into main with commit 88d853e Nov 13, 2025
43 checks passed
@joshieDo joshieDo deleted the joshie/receipts-always-sf branch November 13, 2025 16:53
@github-project-automation github-project-automation bot moved this from In Progress to Done in Reth Tracker Nov 13, 2025
emhane pushed a commit to op-rs/op-reth that referenced this pull request Nov 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-static-files Related to static files

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

4 participants