HarryR / ethsnarks

A toolkit for viable zk-SNARKS on Ethereum, Web, Mobile and Desktop
GNU Lesser General Public License v3.0
241 stars 57 forks source link

Error when loading proving_key from pk_file #167

Open plyu3 opened 2 years ago

plyu3 commented 2 years ago

Hello, after generating keypair, I am trying to store pk and vk into file and users can prove or verify by using pk_file or vk_file. Everything works with vk but fails when doing proving_key. I tried to use function: stub_prove_from_pb in stubs.cpp but there is an error: Assertion failed: (limbs_written <= n), function operator>>, file bigint.tcc, line 218. Abort trap: 6

I then go into deeper and find the error happens when calling loadFromFile in utils.hpp. The system cannot convert the stringstream into ethsnarks::ProvingKeyT type. I fetched lines related to writing proving_key to file and load proving_key from file here. Last line is where cause the error. To be more specific, error happens in loadFromFile:

T obj; ss >> obj;

The program fail to convert the input stringstream into a ProvingKeyT.

Is there anyway to resolve it?

截屏2022-02-11 下午5 45 20 截屏2022-02-11 下午5 47 09