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: add a snapshot field to model.State for original storage #166

Open
ClementWalter opened this issue Nov 28, 2024 · 0 comments
Open

Comments

@ClementWalter
Copy link
Member

Why

Some functions of the state.cairo require an access to the previous state. This is done with the definition of a _snapshots entry in the EELS state.

What

Add a _snapshots: State* to the state definition and use this state in fetch_original_storage

How

    struct State {
        accounts_start: DictAccess*,
        accounts: DictAccess*,
        events_len: felt,
        events: Event*,
        transfers_len: felt,
        transfers: Transfer*,
        _snapshots: State*,
    }
  • empty snapshot is just cast(0, State*)
  • add a get_storage_original in state.cairo similar to read_storage but applied to the snapshotted state
  • remove Account.fetch_original_storage and use this new method in sstore
@ClementWalter ClementWalter added this to the EF tests no state root milestone Nov 28, 2024
@github-project-automation github-project-automation bot moved this to Backlog in Keth Nov 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Backlog
Development

No branches or pull requests

1 participant