Skip to content

Commit 6988ac0

Browse files
Add snapshot test of privacy bootloader program hash
1 parent 14490bf commit 6988ac0

File tree

3 files changed

+21
-0
lines changed

3 files changed

+21
-0
lines changed

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ tracing = "0.1.40"
4242
tracing-subscriber = { version = "0.3", features = ["env-filter"] }
4343
mockall = "0.13.1"
4444
rstest = "0.21"
45+
expect-test = "1.4"
4546

4647
# cairo-vm
4748
cairo-vm = { version = "=3.2.0", features = [

crates/privacy_prove/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ stwo = { git = "https://github.com/starkware-libs/stwo", rev = "aeceb74c", featu
5656

5757
[dev-dependencies]
5858
ctor.workspace = true
59+
expect-test.workspace = true
5960
mockall.workspace = true
6061
rstest.workspace = true
6162
tracing-subscriber.workspace = true

crates/privacy_prove/src/tests.rs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,22 @@
1+
#[test]
2+
fn test_privacy_bootloader_program_hash_snapshot() {
3+
use cairo_program_runner_lib::compute_program_hash_chain;
4+
use cairo_program_runner_lib::types::HashFunc;
5+
use expect_test::expect;
6+
use privacy_circuit_verify::get_privacy_bootloader_program;
7+
8+
let bootloader_program = get_privacy_bootloader_program().unwrap();
9+
let stripped_program = bootloader_program.get_stripped_program().unwrap();
10+
let program_hash = compute_program_hash_chain(&stripped_program, 0, HashFunc::Blake)
11+
.expect("Failed to compute program hash.");
12+
13+
// Source code for the compiled privacy bootloader producing the following hash can be found at
14+
// Starkware's internal main repo at commit "f65af209cc2a245a7d1c90711b49555ade65dd8c".
15+
let expected_hash_str =
16+
expect!["1890025921478295787236140635548238999754587527337379830429702962129599171727"];
17+
expected_hash_str.assert_eq(&program_hash.to_string());
18+
}
19+
120
#[cfg(feature = "slow-tests")]
221
pub mod slow_tests {
322
use std::path::PathBuf;

0 commit comments

Comments
 (0)