diff --git a/ledger/store/src/program/finalize.rs b/ledger/store/src/program/finalize.rs index 972ed57397..1e227b7bfb 100644 --- a/ledger/store/src/program/finalize.rs +++ b/ledger/store/src/program/finalize.rs @@ -314,7 +314,7 @@ pub trait FinalizeStorage: 'static + Clone + Send + Sync { None => bail!("Illegal operation: program ID '{program_id}' is not initialized - cannot remove mapping."), }; // Remove the mapping name. - if !mapping_names.remove(&mapping_name) { + if !mapping_names.shift_remove(&mapping_name) { bail!("Illegal operation: mapping '{mapping_name}' does not exist in storage - cannot remove mapping."); } diff --git a/synthesizer/process/src/stack/mod.rs b/synthesizer/process/src/stack/mod.rs index 3c8ec34874..ae1a5b8f43 100644 --- a/synthesizer/process/src/stack/mod.rs +++ b/synthesizer/process/src/stack/mod.rs @@ -418,13 +418,13 @@ impl Stack { /// Removes the proving key for the given function name. #[inline] pub fn remove_proving_key(&self, function_name: &Identifier) { - self.proving_keys.write().remove(function_name); + self.proving_keys.write().shift_remove(function_name); } /// Removes the verifying key for the given function name. #[inline] pub fn remove_verifying_key(&self, function_name: &Identifier) { - self.verifying_keys.write().remove(function_name); + self.verifying_keys.write().shift_remove(function_name); } }