Skip to content
This repository has been archived by the owner on Aug 21, 2024. It is now read-only.

refacto: cleanup state traits, CachedState interior mutability #1232

Conversation

tdelabro
Copy link
Contributor

@tdelabro tdelabro commented Dec 8, 2023

In this PR:

  • StateReader doesn't require a mutable reference to self anymore
  • therefore, CachedState uses a Cell to have interior mutability for it's cache
  • All state traits arguments are given by value, not ref, as they all impl Copy
  • All state traits methods return a StateResult as we don't know for sure all impl will be infallible
  • The method to compute state diff is taken out of the state traits, and into impl CachedState

This change is Reviewable

@tdelabro tdelabro force-pushed the state-method-apply-state-diff branch 2 times, most recently from 72c23c6 to c177efd Compare December 8, 2023 10:51
@tdelabro tdelabro force-pushed the state-method-apply-state-diff branch from c177efd to 67e3575 Compare January 3, 2024 15:16
@codecov-commenter
Copy link

codecov-commenter commented Jan 3, 2024

Codecov Report

Attention: 93 lines in your changes are missing coverage. Please review.

Comparison is base (44832c1) 70.97% compared to head (9c11469) 70.65%.

Files Patch % Lines
crates/blockifier/src/state/cached_state.rs 69.42% 81 Missing and 4 partials ⚠️
...ve_blockifier/src/state_readers/py_state_reader.rs 0.00% 5 Missing ⚠️
...tive_blockifier/src/state_readers/papyrus_state.rs 60.00% 2 Missing ⚠️
...tes/blockifier/src/test_utils/dict_state_reader.rs 80.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1232      +/-   ##
==========================================
- Coverage   70.97%   70.65%   -0.32%     
==========================================
  Files          59       59              
  Lines        7341     7473     +132     
  Branches     7341     7473     +132     
==========================================
+ Hits         5210     5280      +70     
- Misses       1717     1782      +65     
+ Partials      414      411       -3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@tdelabro tdelabro force-pushed the state-method-apply-state-diff branch from 8b3644e to 9c11469 Compare January 4, 2024 10:08
@tdelabro
Copy link
Contributor Author

superseded by #1325

@tdelabro tdelabro closed this Jan 10, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants