grandinetech / rust-kzg

Parallelized multi-backend KZG library for Ethereum Data Sharding (aka Proto-Danksharding, EIP-4844)
Apache License 2.0
112 stars 48 forks source link

recover_poly_from_samples doesn't return errors when too many samples are missing #195

Closed nazar-pc closed 1 year ago

nazar-pc commented 1 year ago

I tried version from blst_from_scratch and it returned success, but recovered nothing.

Is this expected behavior or a bug?

sauliusgrigaitis commented 1 year ago

My general attitude is that a cryptography library should return meaningful errors in such situations. So if possible the library should check the input and return a meaningful error instead of "successfully" calculating some junk.

nazar-pc commented 1 year ago

It already collects missing indices into a vector, we can check the vector length and if it is too big return an error. WDYT?

sauliusgrigaitis commented 1 year ago

This could work. If you would like to open a PR for this please also add a test here and hook it to at least blst-from-scratch crate here