Skip to content

Commit 5641434

Browse files
authored
Merge pull request #1595 from eqlabs/krisztian/disable-global-class-cache
fix(executor): disable global class cache
2 parents b7ec709 + 88736d0 commit 5641434

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

crates/executor/src/execution_state.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
use super::state_reader::PathfinderStateReader;
2-
use crate::{state_reader::LruCachedReader, IntoStarkFelt};
2+
use crate::IntoStarkFelt;
33
use anyhow::Context;
44
use blockifier::{
55
block_context::BlockContext,
6-
state::{cached_state::CachedState, state_api::State},
6+
state::{
7+
cached_state::{CachedState, GlobalContractCache},
8+
state_api::State,
9+
},
710
};
811
use pathfinder_common::{BlockHeader, ChainId, StateUpdate};
912

@@ -18,10 +21,7 @@ pub struct ExecutionState<'tx> {
1821
impl<'tx> ExecutionState<'tx> {
1922
pub(super) fn starknet_state(
2023
&mut self,
21-
) -> anyhow::Result<(
22-
CachedState<LruCachedReader<PathfinderStateReader<'_>>>,
23-
BlockContext,
24-
)> {
24+
) -> anyhow::Result<(CachedState<PathfinderStateReader<'_>>, BlockContext)> {
2525
let block_context = super::block_context::construct_block_context(self)?;
2626

2727
let block_number = if self.execute_on_parent_state {
@@ -35,7 +35,7 @@ impl<'tx> ExecutionState<'tx> {
3535
block_number,
3636
self.pending_state.is_some(),
3737
);
38-
let mut cached_state = LruCachedReader::new_cached_state(raw_reader)?;
38+
let mut cached_state = CachedState::new(raw_reader, GlobalContractCache::default());
3939

4040
// Perform system contract updates if we are executing ontop of a parent block.
4141
// Currently this is only the block hash from 10 blocks ago.

crates/executor/src/state_reader.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,19 +36,19 @@ where
3636
R: StateReader,
3737
{
3838
/// Build a `CachedState` on top of an `LruCachedReader`, sharing the same underlying cache.
39-
pub fn new_cached_state(inner_reader: R) -> anyhow::Result<CachedState<LruCachedReader<R>>> {
39+
pub fn _new_cached_state(inner_reader: R) -> anyhow::Result<CachedState<LruCachedReader<R>>> {
4040
// `CachedState` already has a [move_classes_to_global_cache](https://docs.rs/blockifier/0.3.0-rc0/blockifier/state/cached_state/struct.CachedState.html#method.move_classes_to_global_cache)
4141
// method that we might want to use instead, but relying on it would make this cache much
4242
// less self-contained as these calls would have to be made in various places.
4343
// One of the reasons for this is that we can't wrap the `CachedReader` in another layer of
4444
// the `State` trait as `blockifier` explicitly requires a `CachedReader` in the signature
4545
// of some methods we use.
46-
let reader = Self::new(inner_reader)?;
46+
let reader = Self::_new(inner_reader)?;
4747
let cache = reader.compiled_class_cache.clone();
4848
Ok(CachedState::new(reader, cache))
4949
}
5050

51-
fn new(inner_reader: R) -> anyhow::Result<Self> {
51+
fn _new(inner_reader: R) -> anyhow::Result<Self> {
5252
lazy_static::lazy_static!(
5353
static ref CONTRACT_CACHE: GlobalContractCache = {
5454
let inner = SizedCache::with_size(128);

0 commit comments

Comments
 (0)