From a0cfee54e70c7c6eb93d03c0844bac29914b86df Mon Sep 17 00:00:00 2001 From: Yuval Goldberg Date: Sun, 7 Jul 2024 17:43:38 +0300 Subject: [PATCH] Fixed version reading when no version is supplied --- vm/src/vm/runners/cairo_pie.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/vm/src/vm/runners/cairo_pie.rs b/vm/src/vm/runners/cairo_pie.rs index 371b6de82f..83f215b02f 100644 --- a/vm/src/vm/runners/cairo_pie.rs +++ b/vm/src/vm/runners/cairo_pie.rs @@ -322,8 +322,13 @@ impl CairoPie { ) -> Result { use std::io::Read; - let reader = std::io::BufReader::new(zip_reader.by_name("version.json")?); - let version: CairoPieVersion = serde_json::from_reader(reader)?; + let version = match zip_reader.by_name("version.json") { + Ok(version_buffer) => { + let reader = std::io::BufReader::new(version_buffer); + serde_json::from_reader(reader)? + } + Err(_) => CairoPieVersion { cairo_pie: () }, + }; let reader = std::io::BufReader::new(zip_reader.by_name("metadata.json")?); let metadata: CairoPieMetadata = serde_json::from_reader(reader)?;