personaelabs / spartan-ecdsa

The fastest in-browser verification of ECDSA signatures in ZK, using Spartan on the secq256k1 curve
198 stars 28 forks source link

Embed spartan_wasm.wasm & Remove circuit artifacts from lib #20

Closed DanTehrani closed 1 year ago

DanTehrani commented 1 year ago
DanTehrani commented 1 year ago

@lsankar4033 Could u review the changes I wrote about here?
Easier/better designs and suggestions are welcome!

lsankar4033 commented 1 year ago

oh also just a note that the failing membership tests pass, but console.error in test logs:

console.error
  panicked at 'called `Result::unwrap()` on an `Err` value: Custom("elliptic curve point encoding error")', packages/spartan_wasm/
wasm.rs:60:23

  Stack:

  Error: 
      at imports.wbg.__wbg_new_abda76e883ba8a5f (/Users/lakshmansankar/src/spartan-ecdsa/packages/lib/src/wasm/wasm.js:361:21)
      at null.<anonymous> (wasm://wasm/001e7302:1:387360)
      at null.<anonymous> (wasm://wasm/001e7302:1:445282)
      at null.<anonymous> (wasm://wasm/001e7302:1:417454)
      at null.<anonymous> (wasm://wasm/001e7302:1:431450)
      at null.<anonymous> (wasm://wasm/001e7302:1:442714)
      at null.<anonymous> (wasm://wasm/001e7302:1:438764)
      at null.<anonymous> (wasm://wasm/001e7302:1:441875)
      at null.<anonymous> (wasm://wasm/001e7302:1:433946)
      at null.<anonymous> (wasm://wasm/001e7302:1:289649)
      at null.<anonymous> (wasm://wasm/001e7302:1:431007)
      at Object.verify (/Users/lakshmansankar/src/spartan-ecdsa/packages/lib/src/wasm/wasm.js:122:14)
      at MembershipVerifier.<anonymous> (/Users/lakshmansankar/src/spartan-ecdsa/packages/lib/src/core/membership_verifier.ts:46:2

      at Generator.next (<anonymous>)
      at fulfilled (/Users/lakshmansankar/src/spartan-ecdsa/packages/lib/src/core/membership_verifier.ts:28:58)

Think this is fine for now as tests properly pass, but we'll probably need to suppress these when we set up CI

DanTehrani commented 1 year ago

@lsankar4033 Good point on console.error. Logging can be controlled by calling/not calling wasm.init_panic_hook(). (We can later disable it for CI)

lsankar4033 commented 1 year ago

all lgtm!