Skip to content

Commit 850f06c

Browse files
authored
poseidon-air: simplify horizen_round_consts impl (#1362)
1 parent 0057b78 commit 850f06c

File tree

1 file changed

+4
-12
lines changed

1 file changed

+4
-12
lines changed

crates/circuits/poseidon2-air/src/babybear.rs

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ pub(crate) fn horizen_to_p3_babybear(horizen_babybear: HorizenBabyBear) -> BabyB
1818
}
1919

2020
pub(crate) fn horizen_round_consts() -> Poseidon2Constants<BabyBear> {
21-
let p3_rc16: Vec<Vec<BabyBear>> = RC16
21+
let p3_rc16: Vec<Vec<_>> = RC16
2222
.iter()
2323
.map(|round| {
2424
round
@@ -29,18 +29,10 @@ pub(crate) fn horizen_round_consts() -> Poseidon2Constants<BabyBear> {
2929
.collect();
3030
let p_end = BABY_BEAR_POSEIDON2_HALF_FULL_ROUNDS + BABY_BEAR_POSEIDON2_PARTIAL_ROUNDS;
3131

32-
let beginning_full_round_constants: [[BabyBear; POSEIDON2_WIDTH];
33-
BABY_BEAR_POSEIDON2_HALF_FULL_ROUNDS] = from_fn(|i| p3_rc16[i].clone().try_into().unwrap());
34-
let partial_round_constants: [BabyBear; BABY_BEAR_POSEIDON2_PARTIAL_ROUNDS] =
35-
from_fn(|i| p3_rc16[i + BABY_BEAR_POSEIDON2_HALF_FULL_ROUNDS][0]);
36-
let ending_full_round_constants: [[BabyBear; POSEIDON2_WIDTH];
37-
BABY_BEAR_POSEIDON2_HALF_FULL_ROUNDS] =
38-
from_fn(|i| p3_rc16[i + p_end].clone().try_into().unwrap());
39-
4032
Poseidon2Constants {
41-
beginning_full_round_constants,
42-
partial_round_constants,
43-
ending_full_round_constants,
33+
beginning_full_round_constants: from_fn(|i| p3_rc16[i].clone().try_into().unwrap()),
34+
partial_round_constants: from_fn(|i| p3_rc16[i + BABY_BEAR_POSEIDON2_HALF_FULL_ROUNDS][0]),
35+
ending_full_round_constants: from_fn(|i| p3_rc16[i + p_end].clone().try_into().unwrap()),
4436
}
4537
}
4638

0 commit comments

Comments
 (0)