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

jacobian_scalar_mul issues in terms of performance and data type #40

Open
FoodChain1028 opened this issue Jan 17, 2025 · 0 comments
Open

Comments

@FoodChain1028
Copy link
Collaborator

Problem

There might be several issues in jacobian_scalar_mul().

Details

current scalar is a uint

Jacobian jacobian_scalar_mul(
    Jacobian point,
    uint scalar
) {
///...
}

The scalar used here is constrained by the default GPU word size, which is 32-bit. Note that this function is suitable for MSM use cases because the scalar fragments involved in MSM are relatively small. However, for larger scalars, this may produce incorrect results. Thus, for now we expect ppl to NOT send a large scalar (BigInt as input) in scalar_mul.

probably we should add a BigInt scalar as the input if there's necessary.

conditional lock in jacobian_scalar_mul

    // Handle special cases first
    if (scalar == 0 || is_bigint_zero(point.z)) {
        return get_bn254_zero_mont();
    }
    if (scalar == 1) {
        return point;
    }

Potential acceleration can be achieved by moving the condition checks directly into the MSM logic.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant