Skip to content

Commit

Permalink
fix(blockifier): finalize finalize to update the correct index
Browse files Browse the repository at this point in the history
  • Loading branch information
ilyalesokhin-starkware committed Dec 24, 2024
1 parent 440c12c commit 86ac7f8
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion crates/blockifier/src/execution/syscalls/syscall_base.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ pub struct SyscallHandlerBase<'state> {
// The original storage value of the executed contract.
// Should be moved back `context.revert_info` before executing an inner call.
pub original_values: HashMap<StorageKey, Felt>,

revert_info_idx: usize,
}

impl<'state> SyscallHandlerBase<'state> {
Expand All @@ -60,6 +62,7 @@ impl<'state> SyscallHandlerBase<'state> {
state: &'state mut dyn State,
context: &'state mut EntryPointExecutionContext,
) -> SyscallHandlerBase<'state> {
let revert_info_idx = context.revert_infos.0.len() - 1;
let original_values = std::mem::take(
&mut context
.revert_infos
Expand All @@ -80,6 +83,7 @@ impl<'state> SyscallHandlerBase<'state> {
read_class_hash_values: Vec::new(),
accessed_contract_addresses: HashSet::new(),
original_values,
revert_info_idx,
}
}

Expand Down Expand Up @@ -317,7 +321,7 @@ impl<'state> SyscallHandlerBase<'state> {
self.context
.revert_infos
.0
.last_mut()
.get_mut(self.revert_info_idx)
.expect("Missing contract revert info.")
.original_values = std::mem::take(&mut self.original_values);
}
Expand Down

0 comments on commit 86ac7f8

Please sign in to comment.