Closed ashutoshvarma closed 1 year ago
@microsoft-github-policy-service agree
@ashutoshvarma thanks for the PR! It looks great!
From the CI, it looks like there is a minor issue. I don't seem to have the write access to fix this in the PR branch. Can you add a commit to fix this?
error: this impl can be derived
--> src/errors.rs:26:1 |
26 | / impl Default for ProofVerifyError { 27 | fn default() -> Self { 28 | ProofVerifyError::InternalError 29 | } 30 | } | _^ |
---|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#derivable_impls
= note: -D clippy::derivable-impls implied by -D warnings
= help: remove the manual implementation...
help: ...and instead derive it... |
7 | #[derive(Default)] |
---|
help: ...and mark the default variant | 8 ~ #[default] 9 ~ InternalError, |
---|
I don't seem to have the write access to fix this in the PR branch.
That's weird, "Allow edits and access to secrets by maintainers" checkbox is checked for this PR.
Can you add a commit to fix this?
Sure.
@srinathsetty fix pushed!
Motivation
Use Spartan in WASM environment (browser or WASM runtimes,
wasm32-unknown-unknown
). Ref #54Things changed
std
features behind new featurestd
(a58ddef8a0377ee7f97ca62c2fbb1a553d68fff9) Previously there was no way to disable the std features if someone wants to build it inno_std
or partial std target. Now the same can be done by simply disabling the default feature.rand_core
dependency asrand
re-exports it.XofReader
instead ofio::Read
for no_std compatibility (f63812b35961d8602b3d0660f269675ee7ac57d4)How to use Spartan in
wasm32-unknown-unknown
?When adding Spartan to
wasm-bindgen
projects or any project that targetwasm32-unknown-unknown
, simply disable the default features and addgetrandom
(v0.1) as a dependency withwasm-bindgen
feature enabled.Details for
getrandom
Spartan uses
rand
v0.7 (Why not latest rand v0.8? becausecurve25519-dalek
v3'sScalar::random
will break as it uses rand v0.7). Therand::rngs::OsRng
depends upongetrandom
(v0.1) crate which silently fails inwasm32-unknown-unknown
during runtime, see the discussion https://github.com/rust-random/getrandom/issues/87#issuecomment-522138650 unlesswasm-bindgen
feature is enabled.