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.SnapshotTree interface for drop-in replacement #77

Merged
merged 5 commits into from
Nov 26, 2024

Conversation

ARR4N
Copy link
Collaborator

@ARR4N ARR4N commented Nov 26, 2024

Why this should be merged

Allows for a drop-in replacement of snapshot.Tree (i.e. one that uses block hashes instead of state roots). This is intended as a temporary solution while we investigate having the state root affected by the block hash to remove path ambiguity.

How this works

Introduction of:

  1. state.SnapshotTree interface to match methods required on snapshot.Tree as used by state.StateDB; and
  2. stateconf package for variadic options plumbed by StateDB.Commit() through to SnapshotTree.Update().

Although variadic (to maintain function call-signature compatibility) only the stateconf.WithUpdatePayload(any) is expected to be used. Recipients of the options can access the payload with stateconf.ExtractUpdatePayload().

How this was tested

Unit test demonstrating propagation of stateconf.UpdateOption payload.

@ARR4N ARR4N marked this pull request as ready for review November 26, 2024 11:36
@ARR4N ARR4N merged commit 3a75409 into main Nov 26, 2024
3 checks passed
@ARR4N ARR4N deleted the arr4n/state-snapshot-interface branch November 26, 2024 17:22
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