When executing with the zokrates develop version, im getting an error that doesn't appear in the current master release. The program relies on using unconstrained variables in order to have a generalized zokrates program. I deactivated the unconstrained variable checks by setting zokrates_cli/src/ops/compile.rs#109
to true
(couldn't get it to work any other way, don't see how this would cause problems though), compiled and droped that build + the stdlib in my dir.
When compiling the multiMerkle.zok
with the hardcoded parameters (just to speed the compilation up, as it's very slow otherwise), version 0.6.3 works without any problems. When using the dev build, I get the following error:
thread 'main' panicked at 'internal error: entered unreachable code: out of bounds index (9 >= 9) found during static analysis', /Users/paul/Documents/projects/ZoKrates/zokrates_core/src/static_analysis/propagation.rs:969:29
.
When I compile the program without the hardcoded parameters, the compilation works, however with the dev version, the execution fails with the following error:
Execution failed: Expected 1 to equal 0
The compiled program without parameters can be executed with:
echo "[[{\"ethAmount\":\"0\",\"tokenAmount\":\"1000000000000000\",\"nonce\":\"1\",\"address\":[\"0x31b87891\",\"0x8679d9DA\",\"0x1DB277B1\",\"0xA2fD67Aa\",\"0x01032920\"]},{\"ethAmount\":\"1000000000000\",\"tokenAmount\":\"0\",\"nonce\":\"1\",\"address\":[\"0x1D539b71\",\"0x7035B802\",\"0x40d6e783\",\"0x6B2C752E\",\"0x204B7DD4\"]},{\"ethAmount\":\"5000000000000\",\"tokenAmount\":\"0\",\"nonce\":\"1\",\"address\":[\"0x4d9b01D7\",\"0x11c90883\",\"0x3f97ea78\",\"0xCF2AE0C7\",\"0x74607a4d\"]}],[{\"ethAmount\":\"4901960784314\",\"tokenAmount\":\"900000000000000\",\"nonce\":\"2\",\"address\":[\"0x31b87891\",\"0x8679d9DA\",\"0x1DB277B1\",\"0xA2fD67Aa\",\"0x01032920\"]},{\"ethAmount\":\"0\",\"tokenAmount\":\"20400000000000\",\"nonce\":\"2\",\"address\":[\"0x1D539b71\",\"0x7035B802\",\"0x40d6e783\",\"0x6B2C752E\",\"0x204B7DD4\"]},{\"ethAmount\":\"3000000000000\",\"tokenAmount\":\"40800000000000\",\"nonce\":\"2\",\"address\":[\"0x4d9b01D7\",\"0x11c90883\",\"0x3f97ea78\",\"0xCF2AE0C7\",\"0x74607a4d\"]}],[[\"0x38723a2e\",\"0x5e8a17aa\",\"0x7950dc00\",\"0x8209944e\",\"0x898f69a7\",\"0xbd10a23c\",\"0x839d341e\",\"0x935fd5ca\"],[\"0x477076ae\",\"0xafdb714b\",\"0x192777b7\",\"0x70ecb909\",\"0xea1a7fa9\",\"0xdb8dc3b5\",\"0x944eb392\",\"0xf23b6753\"],[\"0x96210185\",\"0xc14a51d9\",\"0xe128282b\",\"0xcae13d53\",\"0xbf1fd6db\",\"0x271c61ba\",\"0x2f55097f\",\"0x58ddc810\"],[\"0x61c2de2f\",\"0xbb276034\",\"0xf5d1eeb6\",\"0x1bf1ea40\",\"0x2265a19f\",\"0x666c1d1a\",\"0x723da1fd\",\"0xc61d0558\"],[\"0xed87d3b7\",\"0x63f55601\",\"0x8550be2b\",\"0xa92fa8a8\",\"0x7a43779f\",\"0x1b3ed7de\",\"0x7a4ba3d7\",\"0x0f1d8c8a\"],[\"0xa4bda860\",\"0xe599d115\",\"0x4e42ef9f\",\"0x191996aa\",\"0xd401752c\",\"0x26e89853\",\"0x3c43d625\",\"0x2da4b967\"],[\"0x16b6d44f\",\"0xceb9d925\",\"0xac4d1ba5\",\"0xae90d9a2\",\"0x50a5c7e1\",\"0xaf71501a\",\"0x31351408\",\"0x7fda6b19\"],[\"0x00000000\",\"0x00000000\",\"0x00000000\",\"0x00000000\",\"0x00000000\",\"0x00000000\",\"0x00000000\",\"0x00000000\"],[\"0x00000000\",\"0x00000000\",\"0x00000000\",\"0x00000000\",\"0x00000000\",\"0x00000000\",\"0x00000000\",\"0x00000000\"]],[false,true,true,false,false,false,false,false,false],[\"0x097dc8eb\",\"0x36b33e61\",\"0xd502f549\",\"0x5919d241\",\"0xe3a84c9c\",\"0x169ac017\",\"0xba227fd8\",\"0xda9a52ac\"]]"| zokrates compute-witness --light --abi --abi_spec abi.json --stdin
Interestingly, when I comment out line 42 and recompile, the error doen't show up anymore (though the output of the program is wrong). I suspect this has something to do with the unconstrained variable checks, but im not really sure.