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

feat: state.{Get,Set}Extra[SA any](*StateDB,types.ExtraPayloads,...) #48

Merged
merged 4 commits into from
Oct 9, 2024

Conversation

ARR4N
Copy link
Collaborator

@ARR4N ARR4N commented Oct 4, 2024

Why this should be merged

Provides access to types.StateAccountExtra payloads for actual state persistence (i.e. where it's needed).

How this works

The state.SetExtra() function mirrors the behaviour of existing mutators of state.stateObject fields. As they need to be generic, neither SetExtra() nor GetExtra() could be methods on state.StateDB.

How this was tested

Integration test of types.RegisterExtras() with state.StateDB via (a) the new functions; (b) direct access to a snapshot.AccountIterator; (c) StateDB.Snapshot() and revert; and (d) StateDB.Copy().

Although the StateDB.Copy() test passes, I'm still a little uncomfortable about the risk of shallow copying so will send a follow-up PR with an explicit cloning path.

@ARR4N ARR4N marked this pull request as ready for review October 4, 2024 12:40
@ARR4N ARR4N requested review from a team, darioush, ceyonur and michaelkaplan13 and removed request for a team October 4, 2024 12:40
@ARR4N ARR4N enabled auto-merge (squash) October 4, 2024 14:23
@ARR4N ARR4N merged commit 77c5571 into libevm Oct 9, 2024
3 checks passed
@ARR4N ARR4N deleted the arr4n/state-db-extra-payload-handling branch October 9, 2024 14:06
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.

2 participants