From 92542ec499171b8b24501a72e2ecd4bde7647ad2 Mon Sep 17 00:00:00 2001 From: Herman Obst Demaestri <70286869+HermanObst@users.noreply.github.com> Date: Wed, 25 Sep 2024 15:02:19 -0300 Subject: [PATCH] Test: add pie validity check to prove block (#383) * add pie validity check to prove block * use expect instead of assert * fix error msg * add pie validity check to all integration tests * fix clippy --- Cargo.toml | 2 +- crates/bin/prove_block/tests/prove_block.rs | 6 ++++-- tests/integration/common/transaction_utils.rs | 4 +++- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index eec0b155..5ab27df0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -35,7 +35,7 @@ cairo-lang-starknet-classes = { version = "=2.7.1" } cairo-lang-utils = { version = "=2.7.1" } cairo-lang-casm = { version = "=2.7.1" } cairo-type-derive = { version = "0.1.0", path = "crates/cairo-type-derive" } -cairo-vm = { git = "https://github.com/Moonsong-Labs/cairo-vm", branch = "notlesh/segment-arena-relocation-fix", features = ["cairo-1-hints", "extensive_hints", "mod_builtin"] } +cairo-vm = { git = "https://github.com/Moonsong-Labs/cairo-vm", rev = "56b68b50944ecb3123a168218ea7b8b8e23f9be8", features = ["cairo-1-hints", "extensive_hints", "mod_builtin"] } clap = { version = "4.5.4", features = ["derive"] } c-kzg = { version = "1.0.3" } env_logger = "0.11.3" diff --git a/crates/bin/prove_block/tests/prove_block.rs b/crates/bin/prove_block/tests/prove_block.rs index 0e3e483b..112db50c 100644 --- a/crates/bin/prove_block/tests/prove_block.rs +++ b/crates/bin/prove_block/tests/prove_block.rs @@ -47,8 +47,10 @@ use rstest::rstest; #[tokio::test(flavor = "multi_thread")] async fn test_prove_selected_blocks(#[case] block_number: u64) { let endpoint = std::env::var("PATHFINDER_RPC_URL").expect("Missing PATHFINDER_RPC_URL in env"); - prove_block(block_number, &endpoint, LayoutName::all_cairo) + let (pie, _output) = prove_block(block_number, &endpoint, LayoutName::all_cairo) .await .map_err(debug_prove_error) - .expect("Block could not be proven"); + .expect("OS failed to generate Cairo Pie"); + + pie.run_validity_checks().expect("Cairo Pie run validity checks failed"); } diff --git a/tests/integration/common/transaction_utils.rs b/tests/integration/common/transaction_utils.rs index c3bf1766..f4ad6de7 100644 --- a/tests/integration/common/transaction_utils.rs +++ b/tests/integration/common/transaction_utils.rs @@ -920,7 +920,9 @@ where Err(_) => { println!("exception:\n{:#?}", result); } - _ => {} + Ok((pie, _output)) => { + pie.run_validity_checks().expect("Validity check failed"); + } } result