filecoin-project / blstrs

Other
58 stars 37 forks source link

Error in multi-exponentiation basic tests #57

Closed sourav1547 closed 1 year ago

sourav1547 commented 1 year ago

Hi! I am getting an assertion error in the following basic case. Is it a bug in the mult_exp implementation or is there anything I am missing here? Will appreciate any help.

    let a = G1Projective::generator();
    let b = G1Projective::multi_exp([a].as_slice(), [Scalar::one()].as_slice());
    assert!(a.eq(&b))

I am using blstrs = { version = "0.6.1", features = ["serde"] } in my Cargo.toml file.

I am also on an Apple M2 pro machine.

vmx commented 1 year ago

Thanks for the bug report. It's a problem in an underlying library, I've opened a bug report there https://github.com/supranational/blst/issues/177.

alinush commented 1 year ago

Apparently, this bug has been fixed in the underling blst library here.

However, I don't think the fix got pulled into blstrs according to the commit history I see here and to the Cargo.toml which still uses blst version 0.3.10.

Any chance this can get pulled in?

I think this is a serious bug: if there was a sum_vector(v: Vec<T>) -> T function that returned an arbitrary value on vectors of size 1, nobody would agree that's expected behaviour. Furthermore, the fact that this is a cryptographic library means the stakes of unexpected behavior are even higher.

vmx commented 1 year ago

Once there's a new blst release with the fix, it will be pulled in.

vmx commented 1 year ago

This should be fixed with the blstrs 0.7.1 release. If you still see the issue, please re-open it.