Skip to content

Commit

Permalink
Changed to match previous format
Browse files Browse the repository at this point in the history
  • Loading branch information
Eagle941 committed Aug 12, 2024
1 parent a8a651a commit 43a1576
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 4 deletions.
6 changes: 3 additions & 3 deletions crates/blockifier/src/blockifier/transaction_executor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ use crate::bouncer::{Bouncer, BouncerWeights};
#[cfg(feature = "concurrency")]
use crate::concurrency::worker_logic::WorkerExecutor;
use crate::context::BlockContext;
use crate::state::cached_state::{
CachedState, CommitmentStateDiff, TransactionalState, VisitedPcs,
};
#[cfg(feature = "concurrency")]
use crate::state::cached_state::VisitedPcs;
use crate::state::cached_state::{CachedState, CommitmentStateDiff, TransactionalState};
use crate::state::errors::StateError;
use crate::state::state_api::StateReader;
use crate::transaction::errors::TransactionExecutionError;
Expand Down
22 changes: 21 additions & 1 deletion crates/blockifier/src/state/cached_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,28 @@ impl<S: StateReader> CachedState<S> {
}

pub fn update_visited_pcs_cache(&mut self, visited_pcs: &VisitedPcs) {
#[cfg(not(feature = "vector_of_visited_program_counters"))]
fn from_set<S: StateReader>(
cached_state: &mut CachedState<S>,
class_hash: &ClassHash,
visited_pcs: &Pcs,
) {
cached_state.add_visited_pcs(*class_hash, visited_pcs);
}

#[cfg(feature = "vector_of_visited_program_counters")]
fn from_set<S: StateReader>(
cached_state: &mut CachedState<S>,
class_hash: &ClassHash,
visited_pcs: &Vec<Vec<usize>>,
) {
for pcs in visited_pcs {
cached_state.add_visited_pcs(*class_hash, pcs);
}
}

for (class_hash, class_visited_pcs) in visited_pcs {
self.visited_pcs.entry(*class_hash).or_default().extend(class_visited_pcs.clone());
from_set(self, class_hash, class_visited_pcs);
}
}

Expand Down

0 comments on commit 43a1576

Please sign in to comment.