From f3fcca2b727c003d6a0955d12bb7dd6974c8a790 Mon Sep 17 00:00:00 2001 From: Timofey Luin Date: Wed, 6 Mar 2024 12:38:57 +0100 Subject: [PATCH] fix --- lightclient-circuits/src/poseidon.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lightclient-circuits/src/poseidon.rs b/lightclient-circuits/src/poseidon.rs index 9a07764..7e2e14d 100644 --- a/lightclient-circuits/src/poseidon.rs +++ b/lightclient-circuits/src/poseidon.rs @@ -36,7 +36,9 @@ const R_F: usize = 8; /// /// Each Poseidon sponge absorbs `POSEIDON_SIZE`-2 elements and previos sponge output if it's not the first batch, ie. onion commitment. /// -/// Assumes that LIMB_BITS * 2 < 254 (BN254). +/// Assumes that: +/// - `LIMB_BITS` * 2 < 254 (BN254) +/// - `x_coords` and `y_signs_packed` are not zero length pub fn g1_array_poseidon( ctx: &mut Context, fp_chip: &FpChip, @@ -69,6 +71,8 @@ pub fn g1_array_poseidon( }) .collect_vec(); + assert!(!limbs.is_empty(), "No G1 affines to hash"); + let mut poseidon = PoseidonSponge::::new::(ctx); let mut current_poseidon_hash = None;