Skip to content

Commit

Permalink
add fix of pie serialization
Browse files Browse the repository at this point in the history
  • Loading branch information
HermanObst committed Oct 28, 2024
1 parent 70998c5 commit 7387e9d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ cairo-lang-starknet-classes = { version = "=2.8.2" }
cairo-lang-utils = { version = "=2.8.2" }
cairo-lang-casm = { version = "=2.8.2" }
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", branch = "herman/fix-pie-serialization", 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"
Expand Down
Binary file added tests/integration/common/data/173404.zip
Binary file not shown.
14 changes: 8 additions & 6 deletions tests/integration/pie.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,21 +94,23 @@ fn convert_b64_to_raw(os_pie_string: String) {

#[rstest]
fn deserialize_serialize_pie() {
let path_read = Path::new(env!("CARGO_MANIFEST_DIR")).join("..").join("build").join("pie").join("173404.zip");
let path_read = Path::new(env!("CARGO_MANIFEST_DIR")).join("integration").join("common").join("data").join("173404.zip");
let pie_read = CairoPie::read_zip_file(&path_read).unwrap();
pie_read.run_validity_checks().expect("Valid reference PIE");
log::info!("SNOS output is valid");
println!("SNOS output is valid");

let path_write = Path::new(env!("CARGO_MANIFEST_DIR")).join("..").join("build").join("pie").join("test_173404.zip");
let path_write = Path::new(env!("CARGO_MANIFEST_DIR")).join("integration").join("common").join("data").join("173404_test.zip");
pie_read.write_zip_file(&path_write).expect("Could not write pie");
let pie_write = CairoPie::read_zip_file(&path_write).unwrap();

// This currently fails
pie_write.check_pie_compatibility(&pie_read).expect("Compatible pies");

// This also fail (pies are not compatible)
// pie_write.run_validity_checks().expect("Valid reference PIE");
println!("Pies are compatibles");

pie_write.run_validity_checks().expect("Valid reference PIE");

println!("Written file is valid");
// Remove zip file created by the test
// std::fs::remove_file(path_write).unwrap();
std::fs::remove_file(path_write).unwrap();
}

0 comments on commit 7387e9d

Please sign in to comment.