Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Program.builtins_len() method #1194

Merged
merged 2 commits into from
May 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
6 changes: 6 additions & 0 deletions src/types/program.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down Expand Up @@ -351,6 +355,8 @@ mod tests {
program.iter_builtins().cloned().collect::<Vec<_>>(),
builtins
);

assert_eq!(program.builtins_len(), 2);
}

#[test]
Expand Down
Loading