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

[BUG] Proof composition fails when env::verify() is invoked twice #1299

Closed
intoverflow opened this issue Jan 8, 2024 · 2 comments · Fixed by #1274
Closed

[BUG] Proof composition fails when env::verify() is invoked twice #1299

intoverflow opened this issue Jan 8, 2024 · 2 comments · Fixed by #1274
Assignees
Labels
bug Something isn't working

Comments

@intoverflow
Copy link
Member

Bug Report

If the guest depends on more than 1 assumption, the prover fails with invalid receipt format.

Steps to Reproduce

  1. Checkout the branch tcarstens/victor/composition-example
  2. Navigate to examples/composition
  3. Convince yourself that the host and guest are using the add_assumption() and verify() functions correctly, respectively.
  4. Run the example in "dev mode" to convince yourself it works:
$ RUST_LOG=info RISC0_DEV_MODE=true cargo run --release
  1. Run the example with proving enabled and note that the host fails when it calls default_prover().prove():
$ RUST_LOG=info RISC0_DEV_MODE=false cargo run --release

Expected behavior

Expected a receipt to be generated with no outstanding assumptions.

Your Environment

  • risc0-zkvm version: cargo-risczero 0.21.0-alpha.1 (installed from this branch using cargo install --path risc0/cargo-risczero)
  • Rust version: rustc 1.73.0 (cc66ad468 2023-10-03)
  • Platform/OS: Linux pop-os 5.19.0-76051900-generic #202207312230~1663791054~22.04~28340d4 SMP PREEMPT_DYNAMIC Wed S x86_64 x86_64 x86_64 GNU/Linux

Additional context

This issue has also been observed in zkVM v0.20.0-rc.1.

@intoverflow intoverflow added the bug Something isn't working label Jan 8, 2024
@intoverflow
Copy link
Member Author

@nategraf
Copy link
Contributor

nategraf commented Jan 9, 2024

Ok, I've fixed this in a867e0d. The issue is that the assumptions list as tracked by the executor was in reverse order compared to how it is tracked assembled by the guest. I'll make sure to add a test that checks functionality with two or more assumptions, as this is a clear gap in coverage. (Update: test added in 85b9c43)

nategraf added a commit that referenced this issue Jan 10, 2024
This PR adds a basic example of composition. Building upon the proof of
known factors, this example exponentiates a number mod a composite with
known factors. This takes inspiration from RSA encryption, and is kind
of a stripped down (and insecure) version of verifiable encryption such
that the message is provably decrypt-able by some party.

Resolves: #1299

---------

Co-authored-by: Frank Laub <flaub@risc0.com>
flaub added a commit that referenced this issue Jan 17, 2024
This PR adds a basic example of composition. Building upon the proof of
known factors, this example exponentiates a number mod a composite with
known factors. This takes inspiration from RSA encryption, and is kind
of a stripped down (and insecure) version of verifiable encryption such
that the message is provably decrypt-able by some party.

Resolves: #1299

---------

Co-authored-by: Frank Laub <flaub@risc0.com>
flaub added a commit that referenced this issue Jan 17, 2024
This PR adds a basic example of composition. Building upon the proof of
known factors, this example exponentiates a number mod a composite with
known factors. This takes inspiration from RSA encryption, and is kind
of a stripped down (and insecure) version of verifiable encryption such
that the message is provably decrypt-able by some party.

Resolves: #1299

---------

Co-authored-by: Frank Laub <flaub@risc0.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants