Closed simsekgokhan closed 3 years ago
paging @zmanian and @tarcieri
ASSERT_RELEASE(..)
macro in oods.cc
in ethSTARK code.
https://github.com/simsekgokhan/ethSTARK/commit/a9bd62f5640072490b75c3b0a04c1a38521e8b6c#diff-26eb06651941ec7cfbe57050732a0ae7f1e0ffbeb23ab86a63a33fb6094b5f7bL151 Invalid proof triggers ThrowStarkwareException()
function (by ASSERT_RELEASE(..)
macro) which causes the long wait probably due to some things go very wrong inside that function - might be investigated more if needed.
https://github.com/simsekgokhan/ethSTARK/blob/master/src/starkware/error_handling/error_handling.cc#L26
zkp::verify()
from Move----------- unsafe C++ call -----------
WARNING: Logging before InitGoogleLogging() is written to STDERR
E0225 20:07:09.778414 218725 verifier_main_helper.cc:65] --- oods.cc: Out of domain sampling verification failed.
-------
--- time_elapsed: 1 msec
-------
E0225 20:07:09.778749 218725 rescue_verifier.cc:48] Invalid proof.
----------- end of unsafe C++ -----------
test functional_testsuite::0L/zkp/zkp_verify_invalid_proof_hex.move ... ok
----------- unsafe C++ call -----------
-------
--- time_elapsed: 3 msec
-------
WARNING: Logging before InitGoogleLogging() is written to STDERR
I0225 20:09:25.202208 220013 rescue_verifier.cc:46] Proof verified successfully.
----------- end of unsafe C++ -----------
test functional_testsuite::0L/zkp/zkp_verify_valid_proof.move ... ok
zkp::verify()
from Rust----------- unsafe C++ call -----------
WARNING: Logging before InitGoogleLogging() is written to STDERR
E0225 20:05:29.171983 216599 verifier_main_helper.cc:65] --- oods.cc: Out of domain sampling verification failed.
-------
--- time_elapsed: 1 msec
-------
E0225 20:05:29.172487 216599 rescue_verifier.cc:48] Invalid proof.
----------- end of unsafe C++ -----------
----------- unsafe C++ call -----------
-------
--- time_elapsed: 2 msec
-------
WARNING: Logging before InitGoogleLogging() is written to STDERR
I0225 20:13:19.480569 220229 rescue_verifier.cc:46] Proof verified successfully.
----------- end of unsafe C++ -----------
ASSERT_RELEASE(..)
macro or ThrowStarkwareException()
. But this more generic fix might be done in the future. New issue: https://github.com/OLSF/libra/issues/372closed with f4c3f42
Problem Description
Calling zkp::verify() from Move with invalid proof is 1000 times slower than calling from Rust. (And with valid proof 6 times slower.)
After initial short investigation, the line where the long wait happens is here: https://github.com/simsekgokhan/ethSTARK/blob/bdccf92425cabe9de435f730f85a0313b93a4ddd/src/starkware/stark/stark.cc#L391
Details
1. Using
zkp::verify()
from Movea. Invalid proof: (Problematic case)
language/move-lang/functional-tests/tests/0L/zkp/zkp_verify_invalid_proof_hex.move
b. Valid proof (Ok - but still 6 times slower than Rust):
language/move-lang/functional-tests/tests/0L/zkp/zkp_verify_valid_proof_hex.move
2. Using
zkp::verify()
from Rust - All good hereUsing
zkp::verify()
fromminer/main.rs
a. Invalid proof:
b. Valid proof:
Next Actions
verify()
is called from Move (e.g. heavy thread usage?, green-threading?)