Skip to content

Commit

Permalink
iterate over addr value pairs in add_pub_memory_in_public_input_secti…
Browse files Browse the repository at this point in the history
…on function
  • Loading branch information
entropidelic committed Dec 6, 2023
1 parent 65b8e09 commit a0b7612
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions provers/cairo/src/air.rs
Original file line number Diff line number Diff line change
Expand Up @@ -531,17 +531,17 @@ fn add_pub_memory_in_public_input_section(
let mut a_aux = addresses.to_owned();
let mut v_aux = values.to_owned();

let mut pub_addrs = public_input.public_memory.keys();
let mut pub_addrs = public_input.public_memory.iter();

// Iterate over addresses
for (i, a) in a_aux.iter_mut().enumerate() {
// When address `0` is found, it means it corresponds to a dummy access.
if a == &Felt252::zero() {
// While there are public memory addresses left, overwrite the dummy
// (addr, value) accesses with the real public memory pairs.
if let Some(pub_addr) = pub_addrs.next() {
if let Some((pub_addr, pub_value)) = pub_addrs.next() {
*a = *pub_addr;
v_aux[i] = *public_input.public_memory.get(pub_addr).unwrap();
v_aux[i] = *pub_value;
} else {
// When there are no public memory pairs left to write, break the
// loop and return the (addr, value) pairs with dummy accesses
Expand Down

0 comments on commit a0b7612

Please sign in to comment.