Skip to content

feat: DatabaseCommitExt + increment_balances#3195

Merged
rakita merged 3 commits intobluealloy:mainfrom
0xForerunner:DatabaseCommitExt
Dec 3, 2025
Merged

feat: DatabaseCommitExt + increment_balances#3195
rakita merged 3 commits intobluealloy:mainfrom
0xForerunner:DatabaseCommitExt

Conversation

@0xForerunner
Copy link
Contributor

@0xForerunner 0xForerunner commented Nov 27, 2025

closes #3194

It would be nice for some utility functions like State::increment_balances to be implemented for all types that are DatabaseCommit.

Happy to add some more State methods into this trait as well once I've gotten some initial feedback.

@codspeed-hq
Copy link

codspeed-hq bot commented Nov 27, 2025

CodSpeed Performance Report

Merging #3195 will not alter performance

Comparing 0xForerunner:DatabaseCommitExt (94134a0) with main (1cc86f7)

Summary

✅ 173 untouched

@mattsse
Copy link
Collaborator

mattsse commented Dec 1, 2025

ref alloy-rs/evm#234

let mut transitions: HashMap<Address, Account> = HashMap::default();
transitions.reserve(balances.size_hint().0);
for (address, balance) in balances {
if balance == 0 {
Copy link
Member

@rakita rakita Dec 2, 2025

Choose a reason for hiding this comment

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

It would be good to skip this condition, there is assumption (that maybe can not relevant in this case, but it is true to internal evm) that even if balance is zero the account will get touched and read (in case of bal added to reads).

This is just to align that logic.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Gotcha, so just to be clear, I should remove if balance == 0?

Copy link
Member

Choose a reason for hiding this comment

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

yes, lets remove that condition

Copy link
Contributor Author

Choose a reason for hiding this comment

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

removed!

Copy link
Member

@rakita rakita left a comment

Choose a reason for hiding this comment

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

One nit, otherwise lgtm

@0xForerunner 0xForerunner requested a review from rakita December 3, 2025 19:38
@0xForerunner
Copy link
Contributor Author

Should be good to go!

Copy link
Member

@rakita rakita left a comment

Choose a reason for hiding this comment

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

lgtm

@rakita rakita merged commit eb37a15 into bluealloy:main Dec 3, 2025
31 checks passed
@github-actions github-actions bot mentioned this pull request Dec 3, 2025
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.

[feature] Create DatabaseCommitExt trait with reusable utility functions

3 participants