From ff2189f520244eb439cf573698ff9967dd587f24 Mon Sep 17 00:00:00 2001 From: Pedro Fontana Date: Wed, 31 May 2023 11:58:03 -0300 Subject: [PATCH 1/2] Add Program.builtins_len() method --- src/types/program.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/types/program.rs b/src/types/program.rs index a9677e4259..8bb7ffdf87 100644 --- a/src/types/program.rs +++ b/src/types/program.rs @@ -125,6 +125,10 @@ impl Program { self.shared_program_data.data.len() } + pub fn builtins_len(&self) -> usize { + self.builtins.len() + } + pub fn get_identifier(&self, id: &str) -> Option<&Identifier> { self.shared_program_data.identifiers.get(id) } @@ -351,6 +355,8 @@ mod tests { program.iter_builtins().cloned().collect::>(), builtins ); + + assert_eq!(program.builtins_len(), 2); } #[test] From 5f798e9509f764884ba157f4f84c39406d07fd15 Mon Sep 17 00:00:00 2001 From: Pedro Fontana Date: Wed, 31 May 2023 11:59:38 -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 49f3e07dec..e6caa98552 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,8 @@ ## Cairo-VM Changelog #### Upcoming Changes +* Add `Program::builtins_len method` [#1194](https://github.com/lambdaclass/cairo-rs/pull/1194) + * fix: Handle the deserialization of serde_json::Number with scientific notation (e.g.: Number(1e27)) in felt_from_number function [#1188](https://github.com/lambdaclass/cairo-rs/pull/1188) * bugfix: Use cairo constants in `ASSERT_250_BIT` hint [#1187](https://github.com/lambdaclass/cairo-rs/pull/1187)