Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

core/state, core/vm: set-based per-scope journalling #30500

Closed
wants to merge 3 commits into from

Conversation

holiman
Copy link
Contributor

@holiman holiman commented Sep 24, 2024

This PR introduces set-based journalling, where the journalling-events are basically stored in per-scoped maps.

Whenever we enter a new call scope, we create a new scoped journal. Changes within the same scoped journal overwrite eachother. For example: if a scope updates a balance to from 6 to 5 then 4, then 3, there will only be one preimage in the journal. As opposed to the old journal (linear_journal), which would have multiple entries: [ prev: 6, prev: 5, prev:4].

The linear / appending journal is wasteful on memory, and also slow on rollbacks, since each change is rolled back individually.

I'm planning to run some benchmarks to see if this amounts to any meaningful difference.

@holiman holiman force-pushed the journal_changes_pt2 branch 4 times, most recently from 08faaba to c3822c5 Compare September 25, 2024 09:16
@holiman holiman marked this pull request as ready for review September 25, 2024 12:04
@holiman holiman changed the title set-based journalling core/state, core/vm: set-based per-scope journalling Sep 25, 2024
@holiman
Copy link
Contributor Author

holiman commented Sep 25, 2024

This is running on 07 versus master on 08 now

core/state: add handling for DiscardSnapshot
core/state: use new journal
core/state, genesis: fix flaw re discard/commit.
	In case the state is committed, the journal is reset, thus it is not correct to Discard/Revert snapshots at that point.
core/state: fix nil defer in merge
core/state: fix bugs in setjournal
core/state: journal api changes
core/state: bugfixes in sparse journal
core/state: journal tests
core/state: improve post-state check in journal-fuzzing test
core/state: post-rebase fixups
miner: remove discard-snapshot call, it's not needed since journal will be reset in Finalize
core/state: fix tests
core/state: lint
core/state: supply origin-value when reverting storage change
@holiman
Copy link
Contributor Author

holiman commented Oct 3, 2024

Been benchmarking this, both block by block on head, aswell as sync from scratch up to around 11.5M range. Although this PR doesn't seem to do any harm, there's no tangible benefit seen.

Closing this 🥹

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.

1 participant