Skip to content

feat: refactor ssload/sstore to JournaledAccount#3145

Closed
rakita wants to merge 20 commits intomainfrom
rakita/journaled-account-storage
Closed

feat: refactor ssload/sstore to JournaledAccount#3145
rakita wants to merge 20 commits intomainfrom
rakita/journaled-account-storage

Conversation

@rakita
Copy link
Member

@rakita rakita commented Nov 6, 2025

This will help with perf as condition for account to be loaded will be not needed.

sload/sstore are moved to JournaledAccount for better accesss to it.

This does not solve foundry API problem where they need to directly inject storage into account. Maybe doing unsafe_sstore would be a solution, but will leave this for later.

@codspeed-hq
Copy link

codspeed-hq bot commented Nov 6, 2025

CodSpeed Performance Report

Merging #3145 will improve performances by 25.77%

Comparing rakita/journaled-account-storage (d3582b7) with main (77abd37)

Summary

⚡ 1 improvement
✅ 172 untouched

Benchmarks breakdown

Benchmark BASE HEAD Change
SSTORE_50 49.3 µs 39.2 µs +25.77%

Comment on lines 39 to 42
impl<'a, 'b, ENTRY: JournalEntryTr, DB: Database> JournaledAccount<'a, 'b, ENTRY, DB> {
/// Creates a new journaled account.
#[inline(never)]
pub fn sload(
Copy link
Collaborator

@mattsse mattsse Nov 21, 2025

Choose a reason for hiding this comment

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

from precompile pov this doesn't provide any additional benefits because in there we can not contrain any types, so we'd need to write additioal dyn compat wrappers for this I believe @klkvr

Copy link
Member Author

Choose a reason for hiding this comment

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

Copy link
Collaborator

Choose a reason for hiding this comment

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

yeah for EvmInternals we don't propagate any context about DB generic so we'd need to somehow erase it

Copy link
Member Author

Choose a reason for hiding this comment

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

Have added JournaledAccountTr that hides generic except for the Error. I see that Error type is fixed so it should be okay.

Comment on lines 24 to 26
'b,
<JOURNAL as JournalTr>::JournalEntry,
<JOURNAL as JournalTr>::Database,
Copy link
Collaborator

Choose a reason for hiding this comment

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

if these types are both coming from the JournalTr itself, shouldnt the JournaledAccount then just be generic over that?

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 would be problematic as JournalInner is used in a foundry that does not contain JournalTr

Copy link
Member Author

Choose a reason for hiding this comment

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

I can probably drop one lifetime from structure, and restrict it directly in where it is used

@rakita rakita force-pushed the rakita/journaled-account-storage branch from f1dbaaf to 9a1585a Compare November 25, 2025 17:21
@rakita
Copy link
Member Author

rakita commented Dec 8, 2025

Superseeded by #3201

@rakita rakita closed this Dec 8, 2025
@rakita rakita deleted the rakita/journaled-account-storage branch December 8, 2025 16:57
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