Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle empty input for g1_array_poseidon #72

Merged
merged 1 commit into from
Mar 11, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion lightclient-circuits/src/poseidon.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<F: Field>(
ctx: &mut Context<F>,
fp_chip: &FpChip<F>,
Expand Down Expand Up @@ -69,6 +71,8 @@ pub fn g1_array_poseidon<F: Field>(
})
.collect_vec();

assert!(!limbs.is_empty(), "No G1 affines to hash");

let mut poseidon = PoseidonSponge::<F, T, POSEIDON_SIZE>::new::<R_F, R_P, 0>(ctx);

let mut current_poseidon_hash = None;
Expand Down
Loading