From 28544a954fc41724249436afdc7502d047683e5a Mon Sep 17 00:00:00 2001 From: Olivier Desenfans Date: Mon, 17 Jun 2024 13:43:58 +0200 Subject: [PATCH 1/2] fix: revert breaking change on public input serialization Problem: The 0x prefix was removed from public memory hex values in fe72ee0e95cf9f1761cfdc0759af12a68294c081. This is incompatible with the Stone prover and causes an exception. Solution: revert the change. --- vm/src/air_public_input.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/vm/src/air_public_input.rs b/vm/src/air_public_input.rs index a2e19f56b7..dc33457cb1 100644 --- a/vm/src/air_public_input.rs +++ b/vm/src/air_public_input.rs @@ -34,7 +34,7 @@ mod mem_value_serde { serializer: S, ) -> Result { if let Some(value) = value { - serializer.serialize_str(&format!("{:x}", value)) + serializer.serialize_str(&format!("0x{:x}", value)) } else { serializer.serialize_none() } @@ -66,6 +66,7 @@ mod mem_value_serde { where E: de::Error, { + let value = value.strip_prefix("0x").unwrap_or(value); Felt252::from_hex(value) .map_err(de::Error::custom) .map(Some) From fdf3fee0eab32db0e55aeaba63ee581a55c16c58 Mon Sep 17 00:00:00 2001 From: Olivier Desenfans Date: Mon, 17 Jun 2024 13:47:46 +0200 Subject: [PATCH 2/2] changelog --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index b0e1be6218..2e9ff54e72 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ #### Upcoming Changes +* fix: revert breaking change on public input serialization [#1790](https://github.com/lambdaclass/cairo-vm/pull/1790) + * fix: Handle `GasBuiltin` in cairo1-run crate [#1789](https://github.com/lambdaclass/cairo-vm/pull/1789) * Load `initial_gas` into vm instead of creating it via instructions. * Fix bug affecting programs with input arguments and gas builtin.