|
1 | | -use std::collections::HashMap; |
| 1 | +use std::collections::BTreeMap; |
2 | 2 |
|
3 | 3 | use cairo_vm::types::builtin_name::BuiltinName; |
4 | 4 | use cairo_vm::types::errors::math_errors::MathError; |
@@ -77,7 +77,7 @@ impl From<CairoPieLoaderError> for HintError { |
77 | 77 | /// a pointer in the VM memory, or to an integer in case the segment is uninitialized. |
78 | 78 | /// Those will be wrapped by the appropriate `MaybeRelocatable` variant. |
79 | 79 | pub struct RelocationTable { |
80 | | - relocations: HashMap<isize, MaybeRelocatable>, |
| 80 | + relocations: BTreeMap<isize, MaybeRelocatable>, |
81 | 81 | } |
82 | 82 |
|
83 | 83 | impl RelocationTable { |
@@ -156,11 +156,11 @@ pub fn extract_segment(maybe_relocatable: MaybeRelocatable) -> Result<isize, Rel |
156 | 156 | } |
157 | 157 | } |
158 | 158 |
|
159 | | -/// Builds a hashmap of address -> value from the `CairoPieMemory` vector. |
| 159 | +/// Builds a BTreeMap of address -> value from the `CairoPieMemory` vector. |
160 | 160 | /// |
161 | 161 | /// Makes it more convenient to access values in the Cairo PIE memory. |
162 | | -fn build_cairo_pie_memory_map(memory: &CairoPieMemory) -> HashMap<Relocatable, &MaybeRelocatable> { |
163 | | - let mut memory_map: HashMap<Relocatable, &MaybeRelocatable> = HashMap::new(); |
| 162 | +fn build_cairo_pie_memory_map(memory: &CairoPieMemory) -> BTreeMap<Relocatable, &MaybeRelocatable> { |
| 163 | + let mut memory_map: BTreeMap<Relocatable, &MaybeRelocatable> = BTreeMap::new(); |
164 | 164 |
|
165 | 165 | for ((segment_index, offset), value) in memory.0.iter() { |
166 | 166 | let address = Relocatable::from((*segment_index as isize, *offset)); |
@@ -203,7 +203,7 @@ pub fn build_cairo_pie_relocation_table( |
203 | 203 | offset: 0, |
204 | 204 | }; |
205 | 205 |
|
206 | | - // Create a hashmap of the program memory for easier searching. |
| 206 | + // Create a BTreeMap of the program memory for easier searching. |
207 | 207 | // If this turns out to be too expensive, consider building it directly |
208 | 208 | // when building the CairoPie object. |
209 | 209 | let memory_map = build_cairo_pie_memory_map(&cairo_pie.memory); |
@@ -231,7 +231,7 @@ pub fn build_cairo_pie_relocation_table( |
231 | 231 |
|
232 | 232 | fn extend_additional_data( |
233 | 233 | builtin: &mut SignatureBuiltinRunner, |
234 | | - data: &HashMap<Relocatable, (Felt252, Felt252)>, |
| 234 | + data: &BTreeMap<Relocatable, (Felt252, Felt252)>, |
235 | 235 | relocation_table: &RelocationTable, |
236 | 236 | ) -> Result<(), SignatureRelocationError> { |
237 | 237 | for (addr, signature) in data { |
|
0 commit comments