fix(database): make DatabaseCommit dyn-compatible#3264
Merged
rakita merged 3 commits intobluealloy:mainfrom Jan 8, 2026
Merged
fix(database): make DatabaseCommit dyn-compatible#3264rakita merged 3 commits intobluealloy:mainfrom
rakita merged 3 commits intobluealloy:mainfrom
Conversation
CodSpeed Performance ReportMerging #3264 will not alter performanceComparing Summary
|
rakita
reviewed
Dec 30, 2025
90ba596 to
373c38a
Compare
rakita
reviewed
Jan 5, 2026
crates/database/interface/src/lib.rs
Outdated
Comment on lines
116
to
118
| fn commit_iter(&mut self, changes: impl IntoIterator<Item = (Address, Account)>) | ||
| where | ||
| Self: Sized, |
Member
There was a problem hiding this comment.
This should be a &mut dyn IntoIterator so we can remove Self: Sized and allow usage of this function in parent traits
Contributor
Author
There was a problem hiding this comment.
Do u mean here &mut dyn Iterator ?
rakita
reviewed
Jan 5, 2026
crates/database/interface/src/lib.rs
Outdated
| }) | ||
| // Unfortunately must collect here to short circuit on error | ||
| .collect::<Result<Vec<_>, _>>()?; | ||
| .collect::<Result<_, _>>()?; |
Member
There was a problem hiding this comment.
We should revert this to vec, collecting to HashMap is a lot more expensive than collecting Vec.
I would try using commit_from_iter or figure out what needs to be changed here
Contributor
Author
|
@rakita Lmk if the below is a good path, will update the PR description later:
|
…iter to use &mut dyn Iterator
f769ed3 to
4feef37
Compare
rakita
reviewed
Jan 6, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR fixes dyn-compatibility of DatabaseCommit for downstream users like Foundry that use dyn DatabaseExt (which extends DatabaseCommit).
Problem
While integrating recent revm codebase with Foundry, I discovered that DatabaseCommit is not dyn-compatible due to how #[auto_impl] generates implementations.
Foundry defines DatabaseExt which extends DatabaseCommit:
And uses it as a trait object throughout the codebase:
The issue is that
#[auto_impl(&mut, Box)]generates implementations like:This fails because
commit_iterusesimplTrait in argument position (which requires Self: Sized). When T is ?Sized (like dyn DatabaseCommit), the generated code tries to call a method that requires Sized on a ?Sized type.Solution
&mut dyn Iterator: this keeps the method in the vtable and callable on trait objects