From 2c2b828614c80a292fe5a637ab816c599f62730c Mon Sep 17 00:00:00 2001 From: Pedro Fontana Date: Fri, 5 May 2023 12:17:44 -0300 Subject: [PATCH 1/2] Add CairoRunner.get_program --- src/vm/runners/cairo_runner.rs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/vm/runners/cairo_runner.rs b/src/vm/runners/cairo_runner.rs index c783b3181b..428e7d5ae4 100644 --- a/src/vm/runners/cairo_runner.rs +++ b/src/vm/runners/cairo_runner.rs @@ -1061,6 +1061,11 @@ impl CairoRunner { } Ok(stack_ptr) } + + /// Return CairoRunner.program + pub fn get_program(&self) -> &Program { + &self.program + } } #[derive(Clone, Debug, Eq, PartialEq)] @@ -4826,4 +4831,15 @@ mod tests { } ); } + + #[test] + fn test_get_program() { + let program = program!( + builtins = vec![BuiltinName::output], + data = vec_data!((4), (6)), + ); + let runner = cairo_runner!(program); + + assert_eq!(runner.get_program().data_len(), 2) + } } From 5dc60754747742a6af851289ac11b20a729e8a67 Mon Sep 17 00:00:00 2001 From: Pedro Fontana Date: Fri, 5 May 2023 12:20:06 -0300 Subject: [PATCH 2/2] Update CHANGELOG.md --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6bdf3d7166..149ea37828 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ #### Upcoming Changes +* Add `CairoRunner::get_program method` [#1123](https://github.com/lambdaclass/cairo-rs/pull/1123): + * Use to_signed_felt as function for felt252 as BigInt within [-P/2, P/2] range and use to_bigint as function for representation as BigInt. [#1100](https://github.com/lambdaclass/cairo-rs/pull/1100) * Implement hint on field_arithmetic lib [#1090](https://github.com/lambdaclass/cairo-rs/pull/1090)