Skip to content
This repository has been archived by the owner on Jul 5, 2024. It is now read-only.

Commit

Permalink
fix then some
Browse files Browse the repository at this point in the history
  • Loading branch information
ChihChengLiang committed Nov 10, 2023
1 parent 23add51 commit 1e273fd
Showing 1 changed file with 12 additions and 13 deletions.
25 changes: 12 additions & 13 deletions zkevm-circuits/src/keccak_circuit/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,17 +63,16 @@ fn verify<F: Field>(k: u32, inputs: Vec<Vec<u8>>, digests: Vec<String>, success:

// Keep the rows that are supposed to contain hash results.
izip!(is_enabled, input_rlc, input_len, output.lo(), output.hi())
.enumerate()
.filter_map(
|(idx, (enabled, input_rlc, input_len, output_lo, output_hi))| {
assigned_non_zero(enabled).then_some((
unwrap(idx, "rlc", input_rlc),
unwrap(idx, "len", input_len),
unwrap(idx, "lo", output_lo),
unwrap(idx, "hi", output_hi),
))
},
)
.filter_map(|(enabled, input_rlc, input_len, output_lo, output_hi)| {
assigned_non_zero(enabled).then(|| {
(
unwrap(input_rlc),
unwrap(input_len),
unwrap(output_lo),
unwrap(output_hi),
)
})
})
.collect::<Vec<(F, F, F, F)>>()
};

Expand Down Expand Up @@ -134,10 +133,10 @@ fn assigned_non_zero<F: Field>(cv: &CellValue<F>) -> bool {
}
}

fn unwrap<F: Field>(idx: usize, name: &str, cv: &CellValue<F>) -> F {
fn unwrap<F: Field>(cv: &CellValue<F>) -> F {
match *cv {
CellValue::Assigned(f) => f,
_ => panic!("#{idx} {name}: the cell should be assigned"),
_ => panic!("the cell should be assigned"),
}
}

Expand Down

0 comments on commit 1e273fd

Please sign in to comment.