From 02b604d86b029080cc729a0ce15a5f65f5a096e1 Mon Sep 17 00:00:00 2001 From: Filip Krawczyk Date: Wed, 27 Dec 2023 11:56:48 +0100 Subject: [PATCH] Refactor compute_coset_elements --- src/fri/fri_layer.cairo | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/src/fri/fri_layer.cairo b/src/fri/fri_layer.cairo index f8794b251..2136b27de 100644 --- a/src/fri/fri_layer.cairo +++ b/src/fri/fri_layer.cairo @@ -54,17 +54,13 @@ fn compute_coset_elements( break; } - match queries.get(0) { - Option::Some(q) => { - if *q.unbox().index == coset_start_index + offset_within_coset { - let query = *queries.pop_front().unwrap(); - coset_elements.append(query.y_value); - coset_x_inv = (query.x_inv_value) * (*fri_group.at(i)); - } else { - coset_elements.append(*sibling_witness.pop_front().unwrap()); - } - }, - Option::None => { coset_elements.append(*sibling_witness.pop_front().unwrap()); }, + let q = queries.get(0); + if q.is_some() && *q.unwrap().unbox().index == coset_start_index + offset_within_coset { + let query = *queries.pop_front().unwrap(); + coset_elements.append(query.y_value); + coset_x_inv = (query.x_inv_value) * (*fri_group.at(i)); + } else { + coset_elements.append(*sibling_witness.pop_front().unwrap()); } i += 1;