-
Notifications
You must be signed in to change notification settings - Fork 77
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
Remove circomlibjs dependency in favor of zk-kit #1911
Conversation
@@ -19,6 +19,23 @@ | |||
"port": 4321, | |||
"restart": true, | |||
"cwd": "${workspaceRoot}" | |||
}, | |||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Borrowed this from #1790.
It doesn't work for all utests (it depends on the path depth between the test file and package.json) but it works on many of them, and it's only useful if it's in the repo, so I think it's worth merging.
Note that there is still a devDependency on circomlibjs in @pcd/pod's unit tests, for the set of compatibility tests which validates that zk-kit and circomlibjs remain compatible with each other. I think it's good that these remain so we don't accidentally introduce any incompatibilities, and so we have the option to switch back should we ever decide it's worth it (e.g. for higher performance). |
Looks good to me! The bundle size impact will be great for new users. |
Minimalist approach to switching away from circomlibjs in order to eliminate its massive poseidon_constants from our bundle size. This drops the bundle size in my measurements from 9.4MB to 6.4MB. Functionality remains unchanged (validated by pre-existing backward compatibility tests), with one known exception. The EdDSA PCD now only supports "messages" (bigint arrays) of sizes in the set {1, 2, 3, 12, 13}. Other sizes will throw an error at proving time. This is because poseidon-lite also has a set of constants (albeit much smaller than circomlibjs) needed for each size. There are comments in the code explaining why each size was selected. Two things explicitly not done, given the minimalist approach: - This PR doesn't attempt to unify/centralize uses of zk-kit/poseidon-lite into a single package. Instead the old EdDSA PCDs use the appropriate zk-kit/poseidon-lite libraries directly. - This PR also doesn't change the format (in code, or in serialization) of EdDSA keys to match the new form used by PODs. All externally-visible formats are kept unchanged.
Minimalist approach to switching away from circomlibjs in order to eliminate its massive poseidon_constants from our bundle size. This drops the bundle size in my measurements from 9.4MB to 6.4MB.
Functionality remains unchanged (validated by pre-existing backward compatibility tests), with one known exception. The EdDSA PCD now only supports "messages" (bigint arrays) of sizes in the set {1, 2, 3, 12, 13}. Other sizes will throw an error at proving time. This is because poseidon-lite also has a set of constants (albeit much smaller than circomlibjs) needed for each size. There are comments in the code explaining why each size was selected.
Two things explicitly not done, given the minimalist approach: