zkwebauthn / webauthn-halo2

94 stars 14 forks source link

Verification result is wrong #15

Open DCMMC opened 11 months ago

DCMMC commented 11 months ago

Commit 97723aa47f25b06f5dbef379dedca6aa567ab10d.

Without any change of the code, I run test_secp256r1_ecdsa and found the ecdsa result is 0 not the expected 1. And I tried to modify msghash or signature to any wrong value, I always got 0.

rrrliu commented 11 months ago

@DCMMC - test_secp256r1_ecdsa only checks that the MockProver for the circuit is satisfied with the given inputs, not that the inputs match up to any expected inputs. Are you running the tests as specified in the README?

# Test P-256 circuit correctness
cd halo2-circuits/
cargo test -- --nocapture test_secp256r1_ecdsa

Here's the output (with compile logs/warnings elided) when I run the above on the latest commit https://github.com/zkwebauthn/webauthn-halo2/commit/97723aa47f25b06f5dbef379dedca6aa567ab10d.

Screenshot 2023-11-30 at 5 52 03 PM
DCMMC commented 11 months ago

@rrrliu Although test result appears ok, the output of ecdsa_verify_no_pubkey_check is 0 for this test. You can check it by printing the output or use my fork (only enabledisplay feature). The expected output is 1 not 0. You can also check the unit test in axiom's halo2-lib.

It might be some issues in the implementation. Would greatly appreciate if you can help troubleshoot this issue.