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

refactor: use DBProvider in HistoricalStateProvider #12556

Merged
merged 2 commits into from
Nov 14, 2024
Merged

Conversation

klkvr
Copy link
Collaborator

@klkvr klkvr commented Nov 14, 2024

Right now HistoricalStateProvider accepts both database transactions and a StaticFileProvider. StaticFileProvider is used twice: in BlockHashReader impl which is identical to the one we have for DatabaseProvider and to fetch chain tip which is identical to DatabaseProvider::last_block_number

This PR replaces tx and static_file_provider in HistoricalStateProvider with a single provider generic which is required to implement DBProvider, BlockHashReader and BlockNumReader.

The motivation here is that we'll need to add NodePrimitives generic to StaticFilesProvider and there's no need to introduce those generics to state providers.

@klkvr klkvr changed the title refactor: use DBProvider in HistoricalStateProvider refactor: use DBProvider in HistoricalStateProvider Nov 14, 2024
@klkvr klkvr added C-debt Refactor of code section that is hard to understand or maintain A-db Related to the database A-sdk Related to reth's use as a library labels Nov 14, 2024
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.

nice, this is a good simplification

@klkvr klkvr enabled auto-merge November 14, 2024 20:44
@klkvr klkvr added this pull request to the merge queue Nov 14, 2024
Merged via the queue into main with commit a534db8 Nov 14, 2024
40 checks passed
@klkvr klkvr deleted the klkvr/historical-use-db branch November 14, 2024 21:14
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 A-sdk Related to reth's use as a library C-debt Refactor of code section that is hard to understand or maintain
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants