Skip to content

Mod Builtin Constraints #1835

@JulianGCalderon

Description

@JulianGCalderon

Right now, modulo builtin constraints are not always fulfilled.

  • Given a sub mod gate (for example: x3 = x2 - x1), then it must always be true that x3 + x1 - x2 = 0 or p.

Take, for example, x2 = p + 1 and x1 = 1. Our current implementation will calculate x3 = 0 as a result of the operation (x2 - x1) % p. The expected output is p, as it's the minimum value that meets the constraint (p + 1 - (p + 1) = 0). (the other possible value is 2p.

See starkware-libs/cairo-lang#196 and cairo-lang implementation as reference.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions