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

Cairo 1 example? #128

Closed
delaaxe opened this issue May 31, 2024 · 1 comment · Fixed by #130 or #133
Closed

Cairo 1 example? #128

delaaxe opened this issue May 31, 2024 · 1 comment · Fixed by #130 or #133
Labels
Cairo enhancement New feature or request

Comments

@delaaxe
Copy link
Contributor

delaaxe commented May 31, 2024

Is cairo 1 currently supported? If so can you show an example for verifying a proof obtained here?

https://github.com/starkware-libs/stone-prover/blob/main/README.md?plain=1#L72-L77
https://github.com/starkware-libs/stone-prover/blob/main/e2e_test/Cairo/fibonacci.cairo

Using small layout, error in verifier:

Currently trying to verify such proof panics with:

thread 'main' panicked at runner/src/main.rs:78:13:
[155785504329508738615720351733824384887]

Where 155785504329508738615720351733824384887 = u32_sub Overflow

Using recursive layout

thread 'main' panicked at runner/src/main.rs:78:13:
[97607197389754475647955493984074166371]

97607197389754475647955493984074166371 = Invalid final_pc

Verification command:

./integrity/target/release/runner integrity/target/dev/cairo_verifier.sierra.json < result/proof.json

@Okm165
Copy link
Collaborator

Okm165 commented Jun 6, 2024

@delaaxe Regarding proving recursive layout pls change the cpu_air_params.json and cpu_air_prover_config.json
into following one:

{
    "cached_lde_config": {
        "store_full_lde": false,
        "use_fft_for_eval": false
    },
    "constraint_polynomial_task_size": 256,
    "n_out_of_memory_merkle_layers": 0,
    "table_prover_n_tasks_per_segment": 32
}
{
    "field": "PrimeField0",
    "channel_hash": "poseidon3",
    "commitment_hash": "keccak256_masked160_lsb",
    "n_verifier_friendly_commitment_layers": 9999,
    "pow_hash": "keccak256",
    "statement": {
        "page_hash": "pedersen"
    },
    "stark": {
        "fri": {
            "fri_step_list": [
                0,
                4,
                4,
                3
            ],
            "last_layer_degree_bound": 128,
            "n_queries": 10,
            "proof_of_work_bits": 30
        },
        "log_n_cosets": 2
    },

    "use_extension_field": false,
    "verifier_friendly_channel_updates": true,
    "verifier_friendly_commitment_hash": "poseidon3"
}

There is more detail regarding verification of cairo1-run generated trace
The trace generated by cairo1-run has a different fingerprint ( changes in bytecode CASM instructions ) so in order to run it in integrity u need to do changes in public_input.verify()

let (program_hash, output_hash) = stark_proof.public_input.verify();
onchain

Doing it the cairo1-cairo0bootloader way is compatible coz it will have expected cairo0 CASM bytecode fingerprint.

@Okm165 Okm165 linked a pull request Jun 6, 2024 that will close this issue
@Okm165 Okm165 added enhancement New feature or request Cairo labels Jun 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Cairo enhancement New feature or request
Projects
None yet
2 participants