ZenGo-X / multi-party-ecdsa

Rust implementation of {t,n}-threshold ECDSA (elliptic curve digital signature algorithm).
GNU General Public License v3.0
982 stars 313 forks source link

Signing "randomly" fail on the verify signature assertion #31

Closed gbenattar closed 6 years ago

gbenattar commented 6 years ago

After writing benches which execute signing many times, here is what I see:

thread 'main' panicked at 'assertion failed: party_one::verify(&ec_context, &signature, &pubkey, &message).is_ok()', benches/two_party_ecdsa/lindell_2017/signing.rs:68:13
stack backtrace:
   0: std::sys::unix::backtrace::tracing::imp::unwind_backtrace
   1: std::sys_common::backtrace::print
   2: std::panicking::default_hook::{{closure}}
   3: std::panicking::default_hook
   4: std::panicking::rust_panic_with_hook
   5: std::panicking::begin_panic
   6: bencher::Bencher::iter
   7: bencher::Bencher::auto_bench
   8: bencher::run_tests_console
   9: signing::main
  10: std::rt::lang_start::{{closure}}
  11: std::panicking::try::do_call
  12: __rust_maybe_catch_panic
  13: std::rt::lang_start_internal
  14: main
romanz commented 6 years ago

IIUC, this happened again on Travis:

 Running `/home/travis/build/KZen-networks/multi-party-ecdsa/target/debug/deps/multi_party_ecdsa-7b6107004683704d`
running 3 tests
test protocols::two_party_ecdsa::lindell_2017::test::tests::test_d_log_proof_party_two_party_one ... ok
test protocols::two_party_ecdsa::lindell_2017::test::tests::test_two_party_sign ... FAILED
test protocols::two_party_ecdsa::lindell_2017::test::tests::test_two_party_keygen ... ok
failures:
---- protocols::two_party_ecdsa::lindell_2017::test::tests::test_two_party_sign stdout ----
thread 'protocols::two_party_ecdsa::lindell_2017::test::tests::test_two_party_sign' panicked at 'called `Result::unwrap()` on an `Err` value: ProofError', libcore/result.rs:945:5
note: Run with `RUST_BACKTRACE=1` for a backtrace.
failures:
    protocols::two_party_ecdsa::lindell_2017::test::tests::test_two_party_sign
test result: FAILED. 2 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out
error: test failed, to rerun pass '--lib'
The command "cargo test --verbose" exited with 101.

https://travis-ci.com/KZen-networks/multi-party-ecdsa/builds/80099054#L558

omershlo commented 6 years ago

It's more than that - the d_log_proof_party_two_party test failed as well. This makes sense because both of this tests are using the same code and only afterwards we implemented the full key gen. I suggest to update the tests with the code from keygen test

gbenattar commented 6 years ago

Fixed by: https://github.com/KZen-networks/cryptography-utils/commit/d6eefa46a8d46ede5ada1684edaf85e88d1502f1.