Skip to content

Quadrupling embedded curve points produces infinite result only in Brillig w/ inliner aggressiveness 0 #7749

@michaeljklein

Description

@michaeljklein

Aim

Attempted to test quadrupling EmbeddedCurvePoint's in ACIR and Brillig:

fn main() {
    // // also fails with these points
    // let pt = std::embedded_curve_ops::EmbeddedCurvePoint {
    //     x: 0x111223493147f6785514b1c195bb37a2589f22a6596d30bb2bb145fdc9ca8f1e,
    //     y: 0x273bbffd678edce8fe30e0deafc4f66d58357c06fd4a820285294b9746c3be95,
    //     is_infinite: false,
    // };
    // let pt = std::embedded_curve_ops::EmbeddedCurvePoint {
    //     x: 0x1d8eb4378a3bde41e0b6a9a8dcbd21b7ff9c51bdd6ca13ce989abbbf90df3666,
    //     y: 0x06075b63354f2504f9cddba0b94ed0cef35fc88615e69ec1f853b51eb79a24a0,
    //     is_infinite: false,
    // };

    let pt_y = 17631683881184975370165255887551781615748388533673675138860;
    let pt = std::embedded_curve_ops::EmbeddedCurvePoint { x: 1, y: pt_y, is_infinite: false };
    let pt_2x = pt.double();
    let pt_4x = pt_2x.double();
    assert(pt_2x != pt_4x);
}

Expected Behavior

Expected nargo execute --pedantic-solving to execute successfully

Bug

--pedantic-solving rejects an infinite EmbeddedCurvePoint, but only when both --force-brillig and --inliner-aggressiveness 0 are enabled:

~/.nargo/bin/nargo execute --pedantic-solving
[regression_5045_pedantic_solving] Circuit witness successfully solved
[regression_5045_pedantic_solving] Witness saved to ..
~/.nargo/bin/nargo execute --pedantic-solving --force-brillig
[regression_5045_pedantic_solving] Circuit witness successfully solved
[regression_5045_pedantic_solving] Witness saved to ..
~/.nargo/bin/nargo execute --pedantic-solving --force-brillig --inliner-aggressiveness 0
error: Assertion failed: 'failed to solve blackbox function: embedded_curve_add, reason: Infinite input: embedded_curve_add(infinity, (1, 17631683881184975370165255887551781615748388533673675138860))'
    ┌─ std/embedded_curve_ops.nr:202:23
    │
202 │     let point_array = embedded_curve_add_array_return(point1, point2);
    │                       -----------------------------------------------
    │
    = Call stack:
      1. /home/michael/coding/noir/regression_5045_pedantic_solving/src/main.nr:16:17
      2. std/embedded_curve_ops.nr:17:9
      3. std/embedded_curve_ops.nr:152:22
      4. std/embedded_curve_ops.nr:202:23

Failed assertion

To Reproduce

Workaround

None

Workaround Description

No response

Additional Context

No response

Project Impact

Blocker

Blocker Context

Blocking #7701

Nargo Version

nargo version = 1.0.0-beta.3 noirc version = 1.0.0-beta.3+24e2217347cf8a0021d419fa992e1c09316e77b0 (git version hash: 24e2217, is dirty: false)

NoirJS Version

No response

Proving Backend Tooling & Version

No response

Would you like to submit a PR for this Issue?

None

Support Needs

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions