grandinetech/rust-kzg

Incorrect input to batch verification causes panic

nazar-pc opened this issue · 3 comments

This happened when I created polynomial from 8 scalars and then created proof with compute_proof_multi, but then during verification only sent a single value and n == 1 when calling check_proof_multi. Library must detect incorrect input and returning error rather than panicking

thread 'X' panicked at 'index out of bounds: the len is 1 but the index is 1', ../.cargo/git/checkouts/rust-kzg-f871e5172d08c353/49e7b60/blst-from-scratch/src/types/kzg_settings.rs:143:32

This line specifically: https://github.com/sifraitech/rust-kzg/blob/f014df818fbb3e4f45d66c4224fe000975fdee41/blst-from-scratch/src/types/kzg_settings.rs#L143

It could simply call a single proof check function if n == 1. Feel free to open PR.

It panics the same way with n == 2 🙂

Then it needs more love :)