Skip to content

Stav/use btmap #2023

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 27, 2025
Merged
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
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
## Cairo-VM Changelog

#### Upcoming Changes
* Refactor: Replaced HashMap with BTreeMap to guarantee deterministic ordering of the data [#2023] (https://github.com/lambdaclass/cairo-vm/pull/2023)

* fix: Updated the logic for collecting builtin segment data for prover input info, removing dependency on the existence of stop pointers. [#2022](https://github.com/lambdaclass/cairo-vm/pull/2022)

* fix: Keep None values in memory segments for the prover input info [#2021](https://github.com/lambdaclass/cairo-vm/pull/2021)
Expand Down
10 changes: 5 additions & 5 deletions vm/src/vm/runners/cairo_runner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use crate::{
math_utils::safe_div_usize,
stdlib::{
any::Any,
collections::{HashMap, HashSet},
collections::{BTreeMap, HashMap, HashSet},
ops::{Add, AddAssign, Mul, MulAssign, Sub, SubAssign},
prelude::*,
},
Expand Down Expand Up @@ -1516,7 +1516,7 @@ impl CairoRunner {
})
.collect();

let builtins_segments: HashMap<usize, BuiltinName> = self
let builtins_segments: BTreeMap<usize, BuiltinName> = self
.vm
.builtin_runners
.iter()
Expand Down Expand Up @@ -1554,9 +1554,9 @@ pub struct ProverInputInfo {
/// A vector of segments, where each segment is a vector of maybe relocatable values or holes (`None`).
pub relocatable_memory: Vec<Vec<Option<MaybeRelocatable>>>,
/// A map from segment index to a vector of offsets within the segment, representing the public memory addresses.
pub public_memory_offsets: HashMap<usize, Vec<usize>>,
pub public_memory_offsets: BTreeMap<usize, Vec<usize>>,
/// A map from the builtin segment index into its name.
pub builtins_segments: HashMap<usize, BuiltinName>,
pub builtins_segments: BTreeMap<usize, BuiltinName>,
}

#[derive(Clone, Debug, Eq, PartialEq)]
Expand Down Expand Up @@ -5603,7 +5603,7 @@ mod tests {
assert!(prover_info.public_memory_offsets.is_empty());
assert_eq!(
prover_info.builtins_segments,
HashMap::from([(2, BuiltinName::ecdsa)])
BTreeMap::from([(2, BuiltinName::ecdsa)])
);
}

Expand Down
Loading