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

Add IIFE/ Minified Rollup Bundler #6

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

jp4g
Copy link

@jp4g jp4g commented Mar 18, 2022

Currently, the circomlibjs repository only offers a .cjs rollup build. We have added options to create minified IIFE builds of the circomlibjs library that are compatible with an import using a script tag in an index.html header. This fix has been tested and works under webpack production bundling.

@phated
Copy link

phated commented Mar 18, 2022

Thanks! I still don't completely understand how/why circomlibjs is supposed to be used? I've only seen it used for testing so far.

I'll take a look at this early next week.

@jp4g
Copy link
Author

jp4g commented Mar 18, 2022

@phated we use circomlibjs's hash functions, and will most likely rely on it for Ed25519 integration in the future. I'm sure we could have provided our own hash function implementation like dark forest does, but we didn't want to reinvent the wheel! If there is a better way to handle this I am certainly open your suggestions, but I have found this is an "easy" way to do things

@therealjmj
Copy link

therealjmj commented Apr 30, 2022

Are you using this in a repo? I get multiple errors loading circomlibjs.min.js in index.html on a static webpage.

  1. process is not defined (fixed)
  2. "Buffer" is not defined (fixed)
  3. rc.default.randomFillSync is not a function (stuck)

Ahh looks like the problem is that we're using an old version of circomlibjs... 0.0.8. Doesn't look like it's 1:1 compatible with this build scheme.

@therealjmj
Copy link

therealjmj commented Apr 30, 2022

Trying with the updated code (fully from your branch).
I'm seeing an error when running eddsa.prv2pub ...

Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'call')
    at Fi.Qt (circomlibjs.min.js:17932:8)
    at new li (circomlibjs.min.js:19060:8)
    at new Fi (circomlibjs.min.js:19214:7)
    at Wi (circomlibjs.min.js:19594:16)
    at Tn.prv2pub (circomlibjs.min.js:46036:9)

Unminified:

Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'call')
    at Fi.Qt (smt.js:307:47)
    at new li (smt.js:307:47)
    at new Fi (smt.js:307:47)
    at Wi (smt.js:307:47)
    at Tn.prv2pub (smt.js:307:47)

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

Successfully merging this pull request may close these issues.

3 participants