Repository: lambdaclass/cairo-vm (language: rust)

Issue:
Check if we should skip dynamic layout params when generating air public inputs
Looking at the cairo_lang code, when the public inputs are generated ([reference](https://github.com/starkware-libs/cairo-lang/blob/ab6d079f0265f903630aac9287e93d9e7cfb6fcf/src/starkware/cairo/lang/vm/cairo_run.py#L517)) the layout params are set to None by default even if the layout is dynamic. If we run a program using a dynamic layout and output the public inputs using cairo-lang we can see that the `dynamic_params` field is `null`.  In cairo-vm we write the layout params when the layout is dynamic.



Discussion / hints:

Fix patch:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 1bc76455b6..06ca7c5b0d 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,6 +2,9 @@
 
 #### Upcoming Changes
 
+* BREAKING: Set dynamic params as null by default on air public input [#1716](https://github.com/lambdaclass/cairo-vm/pull/1716)
+  * `PublicInput` field `layout_params` renamed to `dynamic_params` & type changed from`&'a CairoLayout` to `()`.
+
 * feat: `cairo1-run` accepts Sierra programs [#1719](https://github.com/lambdaclass/cairo-vm/pull/1719)
 
 * refactor(BREAKING): Use `BuiltinName` enum instead of string representation [#1722](https://github.com/lambdaclass/cairo-vm/pull/1722)
diff --git a/vm/src/air_public_input.rs b/vm/src/air_public_input.rs
index c8f48e3f6f..d40bfc6df7 100644
--- a/vm/src/air_public_input.rs
+++ b/vm/src/air_public_input.rs
@@ -7,7 +7,6 @@ use crate::{
         collections::HashMap,
         prelude::{String, Vec},
     },
-    types::layout::CairoLayout,
     vm::{
         errors::{trace_errors::TraceError, vm_errors::VirtualMachineError},
         trace::trace_entry::RelocatedTraceEntry,
@@ -98,16 +97,14 @@ pub struct PublicInput<'a> {
     pub n_steps: usize,
     pub memory_segments: HashMap<&'a str, MemorySegmentAddresses>,
     pub public_memory: Vec<PublicMemoryEntry>,
-    #[serde(rename = "dynamic_params")]
     #[serde(skip_deserializing)] // This is set to None by default so we can skip it
-    layout_params: Option<&'a CairoLayout>,
+    dynamic_params: (),
 }
 
 impl<'a> PublicInput<'a> {
     pub fn new(
         memory: &[Option<Felt252>],
         layout: &'a str,
-        dyn_layout_params: Option<&'a CairoLayout>,
         public_memory_addresses: &[(usize, usize)],
         memory_segment_addresses: HashMap<&'static str, (usize, usize)>,
         trace: &[RelocatedTraceEntry],
@@ -136,7 +133,7 @@ impl<'a> PublicInput<'a> {
 
         Ok(PublicInput {
             layout,
-            layout_params: dyn_layout_params,
+            dynamic_params: (),
             rc_min,
             rc_max,
             n_steps: trace.len(),
@@ -220,9 +217,5 @@ mod tests {
             public_input.public_memory,
             deserialized_public_input.public_memory
         );
-        assert!(
-            public_input.layout_params.is_none()
-                && deserialized_public_input.layout_params.is_none()
-        );
     }
 }
diff --git a/vm/src/vm/runners/cairo_runner.rs b/vm/src/vm/runners/cairo_runner.rs
index fdda4030f2..30d0270a4a 100644
--- a/vm/src/vm/runners/cairo_runner.rs
+++ b/vm/src/vm/runners/cairo_runner.rs
@@ -1432,24 +1432,13 @@ impl CairoRunner {
         })
     }
 
-    /// Return CairoRunner.layout
-    fn get_layout(&self) -> &CairoLayout {
-        &self.layout
-    }
-
     pub fn get_air_public_input(
         &self,
         vm: &VirtualMachine,
     ) -> Result<PublicInput, PublicInputError> {
-        let dyn_layout = match self.layout.name {
-            LayoutName::dynamic => Some(self.get_layout()),
-            _ => None,
-        };
-
         PublicInput::new(
             &self.relocated_memory,
             self.layout.name.to_str(),
-            dyn_layout,
             &vm.get_public_memory_addresses()?,
             self.get_memory_segment_addresses(vm)?,
             self.relocated_trace


Test patch: