Skip to content

Commit f3fcca2

Browse files
committed
fix
1 parent e8f33fd commit f3fcca2

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

lightclient-circuits/src/poseidon.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,9 @@ const R_F: usize = 8;
3636
///
3737
/// Each Poseidon sponge absorbs `POSEIDON_SIZE`-2 elements and previos sponge output if it's not the first batch, ie. onion commitment.
3838
///
39-
/// Assumes that LIMB_BITS * 2 < 254 (BN254).
39+
/// Assumes that:
40+
/// - `LIMB_BITS` * 2 < 254 (BN254)
41+
/// - `x_coords` and `y_signs_packed` are not zero length
4042
pub fn g1_array_poseidon<F: Field>(
4143
ctx: &mut Context<F>,
4244
fp_chip: &FpChip<F>,
@@ -69,6 +71,8 @@ pub fn g1_array_poseidon<F: Field>(
6971
})
7072
.collect_vec();
7173

74+
assert!(!limbs.is_empty(), "No G1 affines to hash");
75+
7276
let mut poseidon = PoseidonSponge::<F, T, POSEIDON_SIZE>::new::<R_F, R_P, 0>(ctx);
7377

7478
let mut current_poseidon_hash = None;

0 commit comments

Comments
 (0)