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

guest side proof fail #1653

Open
wants to merge 5 commits into
base: nightly
Choose a base branch
from
Open

guest side proof fail #1653

wants to merge 5 commits into from

Conversation

eyusufatik
Copy link
Member

Description

since risc0 guest side proof verification APIs only support proofs that are verifiable, we need to verify failing of proofs with host side verification API.

TODO:

  • figure out how to test this in e2e

Linked Issues

Fixes #1643

@eyusufatik eyusufatik marked this pull request as ready for review December 26, 2024 18:12
@auto-assign auto-assign bot requested a review from yaziciahmet December 26, 2024 18:12
Copy link

codecov bot commented Dec 26, 2024

@eyusufatik eyusufatik changed the title Esad/guest side proof fail guest side proof fail Dec 26, 2024
Comment on lines +171 to +182
if current_proof_index
!= expected_to_fail_hints.peek().copied().unwrap_or(u32::MAX)
{
// if index is not in the expected to fail hints, then it should pass
G::verify(&journal, &batch_proof_method_id.into())
.expect("Proof hinted to pass failed");
} else {
// if index is in the expected to fail hints, then it should fail
G::verify_expected_to_fail(&proof, &batch_proof_method_id.into())
.expect_err("Proof hinted to fail passed");
expected_to_fail_hints.next();
current_proof_index += 1;
Copy link
Contributor

@jfldde jfldde Jan 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if current_proof_index
!= expected_to_fail_hints.peek().copied().unwrap_or(u32::MAX)
{
// if index is not in the expected to fail hints, then it should pass
G::verify(&journal, &batch_proof_method_id.into())
.expect("Proof hinted to pass failed");
} else {
// if index is in the expected to fail hints, then it should fail
G::verify_expected_to_fail(&proof, &batch_proof_method_id.into())
.expect_err("Proof hinted to fail passed");
expected_to_fail_hints.next();
current_proof_index += 1;
if expected_to_fail_hints.next_if(|&x| x == current_proof_index).is_none() {
// if index is not in the expected to fail hints, then it should pass
G::verify(&journal, &batch_proof_method_id.into())
.expect("Proof hinted to pass failed");
} else {
// if index is in the expected to fail hints, then it should fail
G::verify_expected_to_fail(&proof, &batch_proof_method_id.into())
.expect_err("Proof hinted to fail passed");
current_proof_index += 1;
continue;
}

Can use next_if so we don't need to unwrap to u32::MAX.

Copy link
Contributor

@jfldde jfldde left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM but for the small nit above

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

Successfully merging this pull request may close these issues.

Guest verify should not panic
2 participants