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

Convert evm::evm_verify to be fallible #69

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion snark-verifier-sdk/benches/standard_plonk.rs
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ fn bench(c: &mut Criterion) {
None,
);
#[cfg(feature = "revm")]
evm_verify(_deployment_code, instances, _proof);
evm_verify(_deployment_code, instances, _proof).expect("evm_verify should succeed");
}
}

Expand Down
4 changes: 2 additions & 2 deletions snark-verifier-sdk/benches/zkevm_plus_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ fn bench(c: &mut Criterion) {
None,
);

evm_verify(deployment_code, instances.clone(), proof);
evm_verify(deployment_code, instances.clone(), proof).expect("evm_verify should succeed");

let start2 = start_timer!(|| "Create EVM GWC proof");
let agg_circuit = AggregationCircuit::new::<SHPLONK>(
Expand All @@ -143,7 +143,7 @@ fn bench(c: &mut Criterion) {
None,
);

evm_verify(deployment_code, instances, proof);
evm_verify(deployment_code, instances, proof).expect("evm_verify should succeed");
}

// run benches
Expand Down
2 changes: 1 addition & 1 deletion snark-verifier-sdk/examples/standard_plonk.rs
Original file line number Diff line number Diff line change
Expand Up @@ -215,5 +215,5 @@ fn main() {
Some(Path::new("examples/StandardPlonkVerifier.sol")),
);
#[cfg(feature = "revm")]
evm_verify(_deployment_code, instances, _proof);
evm_verify(_deployment_code, instances, _proof).expect("evm_verify should succeed");
}
9 changes: 7 additions & 2 deletions snark-verifier-sdk/src/evm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -175,10 +175,15 @@ pub fn gen_evm_verifier_shplonk<C: CircuitExt<Fr>>(
}

#[cfg(feature = "revm")]
pub fn evm_verify(deployment_code: Vec<u8>, instances: Vec<Vec<Fr>>, proof: Vec<u8>) {
pub fn evm_verify(
deployment_code: Vec<u8>,
instances: Vec<Vec<Fr>>,
proof: Vec<u8>,
) -> Result<u64, String> {
let calldata = encode_calldata(&instances, &proof);
let gas_cost = snark_verifier::loader::evm::deploy_and_call(deployment_code, calldata).unwrap();
let gas_cost = snark_verifier::loader::evm::deploy_and_call(deployment_code, calldata)?;
dbg!(gas_cost);
Ok(gas_cost)
}

pub fn write_calldata(instances: &[Vec<Fr>], proof: &[u8], path: &Path) -> io::Result<String> {
Expand Down
Loading