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

[BUG]: Inconsistent results for BN256 G1 MSMs #504

Open
xornotx opened this issue May 6, 2024 · 0 comments
Open

[BUG]: Inconsistent results for BN256 G1 MSMs #504

xornotx opened this issue May 6, 2024 · 0 comments
Assignees
Labels
type:bug Something isn't working

Comments

@xornotx
Copy link

xornotx commented May 6, 2024

Description

When using the provided example script to compute the same MSM multiple times (with the same size, scalars, and points) on BN256, the results for G1 vary and sometimes yield points that are not on the curve.

Reproduce

Change

for i in lower_bound..=upper_bound {
let log_size = i;
to

    for i in 0..10 {
        let log_size = 10;

Expected Behavior

The 10 MSMs over G1 and G2, respectively, return consistent values.

Observed Behavior

The 10 MSMs over G1 return different values, sometimes points not on the curve.
The 10 MSMs over G2 return consistent values.

Environment

OS + Version: Ubuntu 22.04.1

Cargo Version: 1.77.2

GPU type: NVIDIA A10G

Additional context

  • The first G1 MSM execution always appears to return the correct result; results become inconsistent from the second iteration onward.
  • The example script does not destroy the g2_stream, but only doing so does not solve the issue;
  • Setting configs' is_async to false solves the issue.
  • Moving the G1 stream.synchronize()
    stream
    .synchronize()
    .unwrap();
    to after the G1 MSM and before the G2 MSM execution solves the issue.
  • When using log_size = 16 results seem to be consistent, even if none of the above fixes is implemented;
  • The bug does not appear to be present when using bls12377.
@xornotx xornotx added the type:bug Something isn't working label May 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants