From e8f2fe2a4a7ca96d54577f19a0fa6cafe0a9dd97 Mon Sep 17 00:00:00 2001 From: Herman Obst Demaestri Date: Tue, 24 Sep 2024 15:51:07 -0300 Subject: [PATCH 1/5] add pie validity check to prove block --- Cargo.toml | 2 +- crates/bin/prove_block/tests/prove_block.rs | 4 +++- 2 files changed, 4 insertions(+), 2 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..e3ead85b 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"); + + assert!(pie.run_validity_checks().is_ok()); } From 791322341e80b80ad91cd9f52a0925234a23d997 Mon Sep 17 00:00:00 2001 From: Herman Obst Demaestri Date: Wed, 25 Sep 2024 11:07:52 -0300 Subject: [PATCH 2/5] use expect instead of assert --- crates/bin/prove_block/tests/prove_block.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/bin/prove_block/tests/prove_block.rs b/crates/bin/prove_block/tests/prove_block.rs index e3ead85b..44fcf64b 100644 --- a/crates/bin/prove_block/tests/prove_block.rs +++ b/crates/bin/prove_block/tests/prove_block.rs @@ -52,5 +52,5 @@ async fn test_prove_selected_blocks(#[case] block_number: u64) { .map_err(debug_prove_error) .expect("Block could not be proven"); - assert!(pie.run_validity_checks().is_ok()); + pie.run_validity_checks().expect("Cairo Pie run validity checks failed"); } From 5de5c12369190f7c32c14f07bb28b02127df0d86 Mon Sep 17 00:00:00 2001 From: Herman Obst Demaestri Date: Wed, 25 Sep 2024 11:09:34 -0300 Subject: [PATCH 3/5] fix error msg --- crates/bin/prove_block/tests/prove_block.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/bin/prove_block/tests/prove_block.rs b/crates/bin/prove_block/tests/prove_block.rs index 44fcf64b..112db50c 100644 --- a/crates/bin/prove_block/tests/prove_block.rs +++ b/crates/bin/prove_block/tests/prove_block.rs @@ -50,7 +50,7 @@ async fn test_prove_selected_blocks(#[case] block_number: u64) { 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"); } From 6da8648e5f30f5f3ea08ecb72adda6fd5697765e Mon Sep 17 00:00:00 2001 From: Herman Obst Demaestri Date: Wed, 25 Sep 2024 12:29:04 -0300 Subject: [PATCH 4/5] add pie validity check to all integration tests --- tests/integration/common/transaction_utils.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/integration/common/transaction_utils.rs b/tests/integration/common/transaction_utils.rs index c3bf1766..2f262e78 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 From 4744102a025ed7ff1795e9ad8e5e73c2a7839fa5 Mon Sep 17 00:00:00 2001 From: Herman Obst Demaestri Date: Wed, 25 Sep 2024 13:38:44 -0300 Subject: [PATCH 5/5] fix clippy --- tests/integration/common/transaction_utils.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/integration/common/transaction_utils.rs b/tests/integration/common/transaction_utils.rs index 2f262e78..f4ad6de7 100644 --- a/tests/integration/common/transaction_utils.rs +++ b/tests/integration/common/transaction_utils.rs @@ -920,7 +920,7 @@ where Err(_) => { println!("exception:\n{:#?}", result); } - Ok((pie, output)) => { + Ok((pie, _output)) => { pie.run_validity_checks().expect("Validity check failed"); } }