Skip to content

Why is exports.p needed? #31

Description

@alinush

Not sure if this is an issue for others, but it is not clear why tests via circom_tester include a line like the following (e.g., here):

exports.p = Scalar.fromString("21888242871839275222246405745257275088548364400416034343698204186575808495617");

I understand that for some tests, knowing the prime is helpful when doing:

const Fr = new F1Field(exports.p);

...and later using Fr to manipulate field elements.

But why is the prime set as an export?

Why not just do:

const Fr = new F1Field("21888242871839275222246405745257275088548364400416034343698204186575808495617");

AFAICT, exports.p does not to serve to let circom_tester know what the prime is. This is done differently via:

it("basic viability test", async() => {
        const circuit = await wasm_tester(
            path.join(__dirname, "../_wrappers", "isequal.circom"),
            { 
                "prime": "bn128",
                "include": [ path.join(__dirname, "../../../src/circuits/") ],
            },
        );
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions