Skip to content

Commit 7503f37

Browse files
authored
fix: remove warning from std::verify_proof_with_type (#9474)
1 parent 450ad5b commit 7503f37

File tree

3 files changed

+4
-66
lines changed

3 files changed

+4
-66
lines changed

compiler/noirc_evaluator/src/acir/mod.rs

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ use std::collections::{BTreeMap, HashSet};
1212
use types::{AcirDynamicArray, AcirValue};
1313

1414
use acvm::acir::{
15-
BlackBoxFunc,
1615
circuit::{
1716
AssertionPayload, ExpressionWidth, OpcodeLocation, brillig::BrilligFunctionId,
1817
opcodes::AcirFunctionId,
@@ -675,7 +674,7 @@ impl<'a> Context<'a> {
675674
ssa: &Ssa,
676675
result_ids: &[ValueId],
677676
) -> Result<Vec<SsaReport>, RuntimeError> {
678-
let mut warnings = Vec::new();
677+
let warnings = Vec::new();
679678

680679
match instruction {
681680
Instruction::Call { func, arguments } => {
@@ -795,14 +794,6 @@ impl<'a> Context<'a> {
795794
}
796795
}
797796
Value::Intrinsic(intrinsic) => {
798-
if matches!(
799-
intrinsic,
800-
Intrinsic::BlackBox(BlackBoxFunc::RecursiveAggregation)
801-
) {
802-
warnings.push(SsaReport::Warning(InternalWarning::VerifyProof {
803-
call_stack: self.acir_context.get_call_stack(),
804-
}));
805-
}
806797
let outputs = self
807798
.convert_ssa_intrinsic_call(*intrinsic, arguments, dfg, result_ids)?;
808799

compiler/noirc_evaluator/src/errors.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -102,9 +102,6 @@ impl From<SsaReport> for CustomDiagnostic {
102102
InternalWarning::ReturnConstant { call_stack } => {
103103
("This variable contains a value which is constrained to be a constant. Consider removing this value as additional return values increase proving/verification time".to_string(), call_stack)
104104
},
105-
InternalWarning::VerifyProof { call_stack } => {
106-
("The validity of the proof passed to verify_proof(...) can only be checked by the proving backend, so witness execution will defer checking of these proofs to the proving backend. Passing an invalid proof is expected to cause the proving backend to either fail to generate a proof or generate a proof which fails verification".to_string(), call_stack)
107-
},
108105
};
109106
let call_stack = vecmap(call_stack, |location| location);
110107
let location = call_stack.last().expect("Expected RuntimeError to have a location");
@@ -142,8 +139,6 @@ impl From<SsaReport> for CustomDiagnostic {
142139
pub enum InternalWarning {
143140
#[error("Return variable contains a constant value")]
144141
ReturnConstant { call_stack: CallStack },
145-
#[error("Calling std::verify_proof(...) does not check that the provided proof is valid")]
146-
VerifyProof { call_stack: CallStack },
147142
}
148143

149144
#[derive(Debug, PartialEq, Eq, Clone, Error, Serialize, Deserialize, Hash)]

docs/docs/noir/standard_library/recursion.mdx

Lines changed: 3 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -8,60 +8,12 @@ import BlackBoxInfo from '@site/src/components/Notes/_blackbox';
88

99
Noir supports recursively verifying proofs, meaning you verify the proof of a Noir program in another Noir program. This enables creating proofs of arbitrary size by doing step-wise verification of smaller components of a large proof.
1010

11-
Read [the explainer on recursion](../../explainers/explainer-recursion.md) to know more about this function and the [guide on how to use it.](../../how_to/how-to-recursion.md)
12-
13-
## Verifying Recursive Proofs
11+
Noir cannot check internally whether a recursive proof is valid or not as this can only be checked by the proving backend. This means that witness execution can still succeed in the case where an invalid proof is used, however an invalid proof is expected to cause the proving backend to fail to generate a valid proof.
1412

15-
```rust
16-
#[foreign(recursive_aggregation)]
17-
pub fn verify_proof(verification_key: [Field], proof: [Field], public_inputs: [Field], key_hash: Field) {}
18-
```
13+
In order to verify recursive proofs from Barretenberg, it's recommended to use the [bb_proof_verification](https://github.com/AztecProtocol/aztec-packages/tree/next/barretenberg/noir/bb_proof_verification) library which is published by the Barretenberg team.
1914

2015
<BlackBoxInfo to="black_box_fns"/>
2116

22-
## Example usage
23-
24-
```rust
25-
26-
fn main(
27-
verification_key : [Field; 114],
28-
proof : [Field; 93],
29-
public_inputs : [Field; 1],
30-
key_hash : Field,
31-
proof_b : [Field; 93],
32-
) {
33-
std::verify_proof(
34-
verification_key,
35-
proof,
36-
public_inputs,
37-
key_hash
38-
);
39-
40-
std::verify_proof(
41-
verification_key,
42-
proof_b,
43-
public_inputs,
44-
key_hash
45-
);
46-
}
47-
```
17+
Read [the explainer on recursion](../../explainers/explainer-recursion.md) to know more about this function and the [guide on how to use it.](../../how_to/how-to-recursion.md)
4818

4919
You can see a full example of recursive proofs in [this example recursion demo repo](https://github.com/noir-lang/noir-examples/tree/master/recursion).
50-
51-
## Parameters
52-
53-
### `verification_key`
54-
55-
The verification key for the zk program that is being verified.
56-
57-
### `proof`
58-
59-
The proof for the zk program that is being verified.
60-
61-
### `public_inputs`
62-
63-
These represent the public inputs of the proof we are verifying.
64-
65-
### `key_hash`
66-
67-
A key hash is used to check the validity of the verification key. The circuit implementing this opcode can use this hash to ensure that the key provided to the circuit matches the key produced by the circuit creator.

0 commit comments

Comments
 (0)