Skip to content

feat: Restrict Database::Error. JournaledAccountTr#3199

Merged
rakita merged 3 commits intomainfrom
rakita/journaled-account-tr
Dec 3, 2025
Merged

feat: Restrict Database::Error. JournaledAccountTr#3199
rakita merged 3 commits intomainfrom
rakita/journaled-account-tr

Conversation

@rakita
Copy link
Member

@rakita rakita commented Dec 1, 2025

Few changes in here, Database::Error now is restricted to Sync+Send+core::error::Error, it is a breaking change, but usage of this type should not be very disruptive.

Additionally, JournaledAccountTr is added that wraps JournaledAccount and removes JournalEntryTr from JournalTr

Adds ErasedError to JournaledAccount functions, which allows erasing Database::Error from it and simplifying the usage in alloy/evm. Have tried propagating ErasedError even more from Journal, but this change will be a lot bigger, so i skipped it.

@codspeed-hq
Copy link

codspeed-hq bot commented Dec 1, 2025

CodSpeed Performance Report

Merging #3199 will not alter performance

Comparing rakita/journaled-account-tr (e6410e5) with main (77abd37)

Summary

✅ 173 untouched

@rakita rakita requested review from klkvr and mattsse December 1, 2025 18:30
Copy link
Collaborator

@klkvr klkvr left a comment

Choose a reason for hiding this comment

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

lgtm, though would be cool to avoid manual drops

acc.bump_nonce();
acc.incr_balance(U256::from(mint.unwrap_or_default()));

drop(acc); // Drop acc to avoid borrow checker issues.
Copy link
Collaborator

Choose a reason for hiding this comment

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

hmm which change triggered this to cause issues with lifetimes?

Copy link
Member Author

Choose a reason for hiding this comment

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

It is with the introduction of GAT in JournalTr::JournaledAccount, the problem here is that for a generic JournaledAccount compiler does not know if manual drop is implemented, so it can't free the acc before the end of the function (NLL Non-Lexical Lifetimes) as objects are freed/dropped in the end.

It sucks a little, but this is an idiomatic solution for this problem.

@rakita rakita merged commit 6cf44ef into main Dec 3, 2025
31 checks passed
@github-actions github-actions bot mentioned this pull request Dec 2, 2025
Comment on lines +50 to +58
/// Increments the balance of the account.
///
/// Touches the account in all cases.
fn incr_balance(&mut self, balance: U256) -> bool;

/// Decrements the balance of the account.
///
/// Touches the account in all cases.
fn decr_balance(&mut self, balance: U256) -> bool;
Copy link
Collaborator

Choose a reason for hiding this comment

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

what's the bool that this returns?

theochap pushed a commit to ethereum-optimism/optimism that referenced this pull request Jan 21, 2026
* feat: Restrict Database::Error. JournaledAccountTr

* nits

* nits std
@rakita rakita deleted the rakita/journaled-account-tr branch February 16, 2026 10:12
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