keep-starknet-strange / garaga

State-of-the-art Elliptic Curve operations and SNARKS verification for Cairo & Starknet 🐺.
https://garaga.gitbook.io/
MIT License
195 stars 50 forks source link

bug: garaga declare cli command gives false positive error. #220

Open feltroidprime opened 3 weeks ago

feltroidprime commented 3 weeks ago

see https://github.com/keep-starknet-strange/garaga/discussions/217

I have a snarkjs generated artifacts (verification_key.json, public_inputs.json, proof.json, etc).

I generate cairo contract using garaga gen --system groth16 --vk verification_key.json, which created 3 files, as expected, but when I trying to declare project (garaga declare-project --project-path my/project/path --env-file .secrets --network sepolia --fee strk), i get an error: class hash not found - deploying Error during declaration: Client failed with code 20. Message: Contract not found.

Im sure that path to project is correct. I didnt changed autogenerated cairo files too.

Thank you in advance.

there is an issue in the flow here, when the class hash doesn't exists it still declares it but an error is raised in python.

https://github.com/keep-starknet-strange/garaga/blob/47efa2272528c966535c75be7ac19042f8161ab0/hydra/garaga/starknet/cli/smart_contract_project.py#L72 https://github.com/keep-starknet-strange/garaga/blob/47efa2272528c966535c75be7ac19042f8161ab0/hydra/garaga/starknet/cli/declare.py#L93

it seems the error is wrongly raised up to the calling function despite being caught :thinking:

When running the command for a 2nd time, it correctly detects that the class hash exists and prints it.

bruhhgnik commented 1 day ago

I'd be grateful to work on this @feltroidprime