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

refactor(RLN:) Remove dependencies and add new APIs #45

Merged
merged 18 commits into from
Sep 15, 2022
Merged

Conversation

s1fr0
Copy link
Contributor

@s1fr0 s1fr0 commented Sep 14, 2022

This PR:

  • adds a feature fullmerkletree in order to easily select this MT implementation;
  • adds a new API new_with_params that allows to create an RLN object by passing the witness generator, the proving and verification key serialized as raw byte data;
  • removes unused, updates used and fixes commits of some dependencies;
  • minor style refactors and code semplifications.

This PR is currently based on the branch poseidon-integration (currently under review) and will be automatically rebased on master once the first is merged.

@s1fr0 s1fr0 added the track:zerokit Zerokit track (Applied ZK/Explorations) label Sep 14, 2022
@s1fr0 s1fr0 self-assigned this Sep 14, 2022
@s1fr0 s1fr0 mentioned this pull request Sep 14, 2022
10 tasks
@s1fr0 s1fr0 requested a review from oskarth September 14, 2022 18:53
Copy link
Contributor

@oskarth oskarth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can be rebased on master

(Strictly speaking new_with_params seems like a new feature, but we can have it as part of this commit/PR np)

Base automatically changed from poseidon-integration to master September 15, 2022 07:01
@s1fr0
Copy link
Contributor Author

s1fr0 commented Sep 15, 2022

@oskarth Done! You can have a last glance and eventually merge it

(Strictly speaking new_with_params seems like a new feature, but we can have it as part of this commit/PR np)

Noted!

Comment on lines +18 to +19
ark-circom = { git = "https://github.com/gakonst/ark-circom", rev = "06eb075", features = ["circom-2"] }
#ark-circom = { git = "https://github.com/vacp2p/ark-circom", branch = "no-ethers-core", features = ["circom-2"] }
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@oskarth The vacp2p fork is a subset of the original ark-circom, which is lighter in terms of dependencies while guaranteeing zerokit the functionalities it needs. I was unsure which dep activate by default (I have pros and cons for both), so I kept the original one. But feel free to change it (the difference is ~60 dependencies less compiled)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah original one is better unless our fork is a must. We should upstream change we make, or at least start discussion.

I feel like there should be some form of dead code compilation that can be done here? So it doesn't matter how many dependencies are in ark-circom for zerokit binary size.

Copy link
Contributor Author

@s1fr0 s1fr0 Sep 15, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can get a warning for unused functions/code (dead_code). To detect unused dependencies you need special tools like udeps, so I suspect the compiler doesn't figure it out automatically which one are unused and skips their compilation. But I might be wrong, I tried to search something like what you said but with no luck.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What matters here is the final compilation size, not if it is part of compilation process (CI isn't that slow). I could be wrong, but I think this gets remove with e.g. https://doc.rust-lang.org/rustc/codegen-options/index.html#link-dead-code

For wasm there are tools like https://rustwasm.github.io/docs/book/reference/code-size.html#the-twiggy-code-size-profiler

Can continue this discussion in relevant issue though

ark-circom = { git = "https://github.com/gakonst/ark-circom", features = ["circom-2"] }
wasmer = { version = "2.0" }
ark-circom = { git = "https://github.com/gakonst/ark-circom", rev = "06eb075", features = ["circom-2"] }
#ark-circom = { git = "https://github.com/vacp2p/ark-circom", branch = "no-ethers-core", features = ["circom-2"] }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we might want ethers in future anyway, so we can deal with ZK smart contracts etc from Zerokit too

@oskarth oskarth merged commit 4dc600d into master Sep 15, 2022
@s1fr0 s1fr0 deleted the minor-refactors branch October 17, 2022 10:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
track:zerokit Zerokit track (Applied ZK/Explorations)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants