Skip to content

jacobian_scalar_mul issues in terms of performance and data type #40

@jeffoodchain

Description

@jeffoodchain

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions