Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Assertion Failure in cairo_verifier When Verifying stone-prover zkSTARK Proofs #180

Closed
Okm165 opened this issue Dec 15, 2023 · 1 comment

Comments

@Okm165
Copy link

Okm165 commented Dec 15, 2023

Description:

Issue Summary:

I'm experiencing issues with running the cairo_verifier in the cairo-lang repository, version v0.12.3, using Python 3.9.0, specifically when verifying proofs generated by the stone-prover. Although the stone-prover generates zkSTARK proofs successfully, the cairo_verifier fails to verify these proofs, resulting in an error.

Steps to Reproduce:

  1. Generate a zkSTARK proof using the stone-prover from this repository, following the provided README instructions.
  2. Set up the cairo_verifier environment by cloning the cairo-lang repository from this branch, which includes a manually fixed bazel build as described in this related issue.
  3. Compile cairo_verifier with the following command:
    cairo-compile --cairo_path=./src src/starkware/cairo/cairo_verifier/layouts/starknet_with_keccak/cairo_verifier.cairo --output cairo_verifier.json
    This step takes about 8 minutes and 10GiB of RAM, resulting in a 12GiB cairo_verifier.json file.
  4. Run cairo_verifier using:
    cairo-run \
       --program=cairo_verifier.json \
       --layout=starknet_with_keccak \
       --program_input=cairo_verifier_input-stone.json \
       --trace_file=cairo_verifier_trace.json \
       --memory_file=cairo_verifier_memory.json \
       --print_output
    This step takes about 18 minutes requires about 96GiB of RAM.

Expected Result:

The cairo_verifier should successfully verify the zkSTARK proof generated by stone-prover without any errors.

Actual Result:

The verification process fails with an assertion error in the verify_oods function within stark.cairo. The specific error message is:

/home/bartosz/workshop/herodotusdev/cairo-lang-v0.13/src/starkware/cairo/stark_verifier/core/stark.cairo:322:5: Error at pc=0:31534:
An ASSERT_EQ instruction failed: 2418258407644728539863773216315436708774059961165242426841968140264143419574 != 3469875586945248988307846395884043418606990072452279991114910527692266491651.
Cairo traceback (most recent call last):
src/starkware/cairo/cairo_verifier/layouts/starknet_with_keccak/cairo_verifier.cairo:199:39: (pc=0:31899)
    let (program_hash, output_hash) = verify_cairo_proof(proof);
                                      ^***********************^
src/starkware/cairo/cairo_verifier/layouts/starknet_with_keccak/cairo_verifier.cairo:51:5: (pc=0:31706)
    verify_proof(proof=proof, security_bits=SECURITY_BITS);
    ^****************************************************^
/home/bartosz/workshop/herodotusdev/cairo-lang-v0.13/src/starkware/cairo/stark_verifier/air/layouts/starknet_with_keccak/verify.cairo:77:12: (pc=0:31675)
/home/bartosz/workshop/herodotusdev/cairo-lang-v0.13/src/starkware/cairo/stark_verifier/core/stark.cairo:172:34: (pc=0:31291)
/home/bartosz/workshop/herodotusdev/cairo-lang-v0.13/src/starkware/cairo/stark_verifier/core/stark.cairo:257:5: (pc=0:31433)

Additional Information:

  • Python version: 3.9.0
  • Tag: v0.12.3
  • The issue occurs specifically during the verify_oods function in the proof verification process.
  • The error appears to be an assertion failure within the stark.cairo file of the verifier.

Questions:

  • Why can't the stone-prover proof pass the verify_oods check in cairo_verifier?
  • What could be causing this assertion failure, and how might it be resolved?
@Okm165
Copy link
Author

Okm165 commented Dec 28, 2023

I created repository that has this issue solved
https://github.com/Okm165/stone-prover-cairo0-verifier

@Okm165 Okm165 closed this as completed Dec 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant