Skip to content

Commit 910d7bd

Browse files
committed
fix: get_validity_proof order
1 parent 1cd8216 commit 910d7bd

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

sdk-libs/program-test/src/indexer/test_indexer.rs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -555,14 +555,12 @@ impl Indexer for TestIndexer {
555555
}
556556
}
557557

558-
// reverse so that we can pop elements.
559-
proof_inputs.reverse();
560-
// Reinsert.
561-
for index in indices_to_remove.iter().rev() {
562-
if root_indices.len() <= *index {
563-
root_indices.push(proof_inputs.pop().unwrap());
558+
// Reinsert proof_inputs at their original positions in forward order
559+
for (proof_input, &index) in proof_inputs.iter().zip(indices_to_remove.iter()) {
560+
if root_indices.len() <= index {
561+
root_indices.push(proof_input.clone());
564562
} else {
565-
root_indices.insert(*index, proof_inputs.pop().unwrap());
563+
root_indices.insert(index, proof_input.clone());
566564
}
567565
}
568566
root_indices

0 commit comments

Comments
 (0)