-
Notifications
You must be signed in to change notification settings - Fork 222
refactor(state): split the old state into state reader and state writer structs #3291
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
base: main
Are you sure you want to change the base?
Conversation
| return fmt.Errorf("get contract nonce: %v", err) | ||
| } | ||
| p.stateDiff.Nonces[*contractAddress] = currentNonce.Add(¤tNonce, feltOne) | ||
| p.stateDiff.Nonces[*contractAddress] = currentNonce.Add(¤tNonce, &felt.One) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we're unsure if the felt is eventually modified, we should consider copying it.
fa90bb4 to
7141eaa
Compare
7141eaa to
b9b068f
Compare
| *felt.NewFromUint64[felt.Felt](1): {}, | ||
| *felt.NewFromUint64[felt.Felt](2): {}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| *felt.NewFromUint64[felt.Felt](1): {}, | |
| *felt.NewFromUint64[felt.Felt](2): {}, | |
| felt.FromUint64[felt.Felt](1): {}, | |
| felt.FromUint64[felt.Felt](2): {}, |
b9b068f to
2ad7d63
Compare
…thermindEth/juno into maksym/state-refactor-2-clean
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3291 +/- ##
==========================================
+ Coverage 76.20% 76.26% +0.06%
==========================================
Files 346 347 +1
Lines 32690 32722 +32
==========================================
+ Hits 24912 24957 +45
+ Misses 5987 5977 -10
+ Partials 1791 1788 -3 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This PR introduces the following change. The current implementation of the
Stategets split into two structs:StateReader- a structure, which sole purpose is reading the state. It's fed withdb.KeyValueReaderto enforce read-only mode for the state. Eventually we want to feed it only with thedb.Snapshot. It is going to be mainly used during the RPC requests.State- a structure which purpose is reading and writing. TheStateReaderis a part of it. It is used during the synchronisation and execution. Currently it runs using anIndexedBatch, but eventually we want to feed it with anIndexedBatch-like structure, which will contain a write layer anddb.Snapshotfor reads.