Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

snarkJS: Error: Scalar size does not match #301

Open
nihaoqingtuan opened this issue Jan 31, 2023 · 2 comments
Open

snarkJS: Error: Scalar size does not match #301

nihaoqingtuan opened this issue Jan 31, 2023 · 2 comments

Comments

@nihaoqingtuan
Copy link

nihaoqingtuan commented Jan 31, 2023

No description provided.

@mostwanted7
Copy link

Probably too many outputs (signal c size), try reducing. But I have this error and I only have a couple of outputs so... Very strange bug

@vinhtrand8
Copy link

I got the same error and then I tried to debug snarkjs. I found the problem caused by ffjavascript libraby, this code in buildMultiexp > _multiExp function in ffjavascript/build/main.cjs:

const nPoints = Math.floor(buffBases.byteLength / sGIn);
const sScalar = Math.floor(buffScalars.byteLength / nPoints);

They don't check condition when nPoints is 0, so sScalar will become NaN.
I've fixed it by add this code:

const nPoints = Math.floor(buffBases.byteLength / sGIn);

if (nPoints == 0) return G.zero; // add new here

const sScalar = Math.floor(buffScalars.byteLength / nPoints);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants