Skip to content

feat: complete migration to StateDB#236

Merged
klkvr merged 2 commits intoalloy-rs:mainfrom
0xForerunner:state-db
Feb 25, 2026
Merged

feat: complete migration to StateDB#236
klkvr merged 2 commits intoalloy-rs:mainfrom
0xForerunner:state-db

Conversation

@0xForerunner
Copy link
Contributor

See #234 for context

This PR completes the transition from the concrete State<DB> to StateDB. We must introduce the fn drain_balances to accomplish this. Both drain_balances and increment_balances should be implementable with DatabaseCommit + Database which is why I have this PR open in revm. If this is accepted then it should be possible to remove these methods. Alternatively, DatabaseCommitExt could be moved here.

PR Checklist

  • Added Tests
  • Added Documentation
  • No Breaking changes from latest release.

Copy link
Member

@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.

@klkvr I believe all of this is okay

@0xForerunner
Copy link
Contributor Author

@klkvr am I able to get a review here?

where
DB: Database + 'a,
I: Inspector<EvmF::Context<&'a mut State<DB>>> + 'a,
DB: Database + DatabaseCommit + StateDB + 'a,
Copy link
Member

Choose a reason for hiding this comment

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

should both extra traits be supertraits of StateDB?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I was prioritizing flexibility here. I wasn't 100% sure that all consumers would intend for all StateDB to also be DatabaseCommit.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

For my personal use case, I am okay with StateDB: DatabaseCommit + Database.

@klkvr klkvr merged commit be87970 into alloy-rs:main Feb 25, 2026
27 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants