Skip to content

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, ceyonur, darioush 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