Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ impl<S: StateReader + Send + 'static> ConcurrentTransactionExecutor<S> {
&worker_executor.bouncer,
&mut state_after_block,
&self.worker_executor.block_context,
true,
)
}

Expand Down
17 changes: 15 additions & 2 deletions crates/blockifier/src/blockifier/transaction_executor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -213,15 +213,23 @@ impl<S: StateReader> TransactionExecutor<S> {
&self.bouncer,
self.block_state.as_mut().expect(BLOCK_STATE_ACCESS_ERR),
&self.block_context,
true,
)
}

/// `collect_os_initial_reads` must be false when replaying against a state recording only the
/// values the original execution read: collecting the OS read-set force-reads beyond that
/// record.
#[cfg(feature = "reexecution")]
pub fn non_consuming_finalize(&mut self) -> TransactionExecutorResult<BlockExecutionSummary> {
pub fn non_consuming_finalize(
&mut self,
collect_os_initial_reads: bool,
) -> TransactionExecutorResult<BlockExecutionSummary> {
finalize_block(
&self.bouncer,
self.block_state.as_mut().expect(BLOCK_STATE_ACCESS_ERR),
&self.block_context,
collect_os_initial_reads,
)
}
}
Expand All @@ -236,6 +244,7 @@ pub(crate) fn finalize_block<S: StateReader>(
bouncer: &Arc<Mutex<Bouncer>>,
block_state: &mut CachedState<S>,
block_context: &BlockContext,
collect_os_initial_reads: bool,
) -> TransactionExecutorResult<BlockExecutionSummary> {
let bouncer = lock_bouncer(bouncer);
log::info!(
Expand Down Expand Up @@ -273,7 +282,11 @@ pub(crate) fn finalize_block<S: StateReader>(

let state_diff = block_state.to_state_diff()?.state_maps;

let initial_reads = block_state.get_os_initial_reads()?;
let initial_reads = if collect_os_initial_reads {
block_state.get_os_initial_reads()?
} else {
StateMaps::default()
};

let compressed_state_diff = if block_context.versioned_constants.enable_stateful_compression {
Some(compress(&state_diff, block_state, alias_contract_address)?.into())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ pub trait BlockReexecutor<S: StateReader + Send + Sync + 'static>: Sized {

// Finalize block and read actual statediff; using non_consuming_finalize to keep the
// block_state.
let actual_state_diff = transaction_executor.non_consuming_finalize()?.state_diff;
let actual_state_diff = transaction_executor.non_consuming_finalize(false)?.state_diff;

Ok(ReexecuteBlockOutcome {
block_state: transaction_executor.block_state,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ impl BlobFactory {
transactions_with_receipts
.push(InternalTransactionWithReceipt { transaction: internal, execution_info });
}
let summary = executor.non_consuming_finalize().unwrap();
let summary = executor.non_consuming_finalize(true).unwrap();

// Apply changes to state and create the multitude of state-diff-like objects required...
// The [CommitterStateDiff] type is the blockifier representation of the committer's state
Expand Down
Loading