Skip to content

Error on negative witness inputs  #6

@ZenGround0

Description

@ZenGround0

Using snarkjs to prove a circuit I set -1 as an input and generated a witness.json using snarkjs calculatewitness. I then tried to use websnark's buildwitness.json on this input.
This led to the following error:

buildwitness.js:38
        const v = bi.shiftRight(i*32).and(0xFFFFFFFF).toJSNumber();
                     ^

TypeError: bi.shiftRight is not a function
    at writeBigInt (/Users/zenground0/Ground/IC3/websnark/tools/buildwitness.js:38:22)
    at Object.<anonymous> (/Users/zenground0/Ground/IC3/websnark/tools/buildwitness.js:68:5)
    at Module._compile (internal/modules/cjs/loader.js:689:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
    at Module.load (internal/modules/cjs/loader.js:599:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
    at Function.Module._load (internal/modules/cjs/loader.js:530:3)
    at Function.Module.runMain (internal/modules/cjs/loader.js:742:12)
    at startup (internal/bootstrap/node.js:282:19)
    at bootstrapNodeJSCore (internal/bootstrap/node.js:743:3)

Apologies if having negative inputs in a witness.json is invalid for other reasons and should not be supported.

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