Skip to content

Commit

Permalink
Add _builtin suffix to builtin names. (lambdaclass#1005)
Browse files Browse the repository at this point in the history
* Add _builtin suffix to builtin names.

* fix unit tests

* Update CHANGELOG.md

* Update CHANGELOG.md

---------

Co-authored-by: Pedro Fontana <pedro.fontana@lamdaclass.com>
  • Loading branch information
2 people authored and kariy committed Jun 23, 2023
1 parent a3834bb commit 324dd11
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 12 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

#### Upcoming Changes

* BREAKING CHANGE: Add _builtin suffix to builtin names e.g.: output -> output_builtin [#1005](https://github.com/lambdaclass/cairo-rs/pull/1005)

* Implement hint on uint384_extension lib [#983](https://github.com/lambdaclass/cairo-rs/pull/983)

`BuiltinHintProcessor` now supports the following hint:
Expand Down
18 changes: 9 additions & 9 deletions src/vm/runners/builtin_runner/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,15 @@ pub use output::OutputBuiltinRunner;
pub use range_check::RangeCheckBuiltinRunner;
pub use signature::SignatureBuiltinRunner;

pub const OUTPUT_BUILTIN_NAME: &str = "output";
pub const HASH_BUILTIN_NAME: &str = "pedersen";
pub const RANGE_CHECK_BUILTIN_NAME: &str = "range_check";
pub const SIGNATURE_BUILTIN_NAME: &str = "ecdsa";
pub const BITWISE_BUILTIN_NAME: &str = "bitwise";
pub const EC_OP_BUILTIN_NAME: &str = "ec_op";
pub const KECCAK_BUILTIN_NAME: &str = "keccak";
pub const POSEIDON_BUILTIN_NAME: &str = "poseidon";
pub const SEGMENT_ARENA_BUILTIN_NAME: &str = "segment_arena";
pub const OUTPUT_BUILTIN_NAME: &str = "output_builtin";
pub const HASH_BUILTIN_NAME: &str = "pedersen_builtin";
pub const RANGE_CHECK_BUILTIN_NAME: &str = "range_check_builtin";
pub const SIGNATURE_BUILTIN_NAME: &str = "ecdsa_builtin";
pub const BITWISE_BUILTIN_NAME: &str = "bitwise_builtin";
pub const EC_OP_BUILTIN_NAME: &str = "ec_op_builtin";
pub const KECCAK_BUILTIN_NAME: &str = "keccak_builtin";
pub const POSEIDON_BUILTIN_NAME: &str = "poseidon_builtin";
pub const SEGMENT_ARENA_BUILTIN_NAME: &str = "segment_arena_builtin";

/* NB: this enum is no accident: we may need (and cairo-rs-py *does* need)
* structs containing this to be `Send`. The only two ways to achieve that
Expand Down
2 changes: 1 addition & 1 deletion src/vm/runners/cairo_runner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4692,7 +4692,7 @@ mod tests {
vm.segments.compute_effective_sizes();
let mut exec = runner.get_execution_resources(&vm).unwrap();
exec.builtin_instance_counter
.insert("output_builtin".to_string(), 0);
.insert("unused_builtin".to_string(), 0);
assert_eq!(exec.builtin_instance_counter.len(), 5);
let rsc = exec.filter_unused_builtins();
assert_eq!(rsc.builtin_instance_counter.len(), 4);
Expand Down
4 changes: 2 additions & 2 deletions src/vm/vm_core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3558,7 +3558,7 @@ mod tests {
)
];
let error = vm.verify_auto_deductions();
assert_eq!(error.as_ref().unwrap_err().to_string(), "Inconsistent auto-deduction for builtin ec_op, expected 2739017437753868763038285897969098325279422804143820990343394856167768859289, got Some(Int(2778063437308421278851140253538604815869848682781135193774472480292420096757))");
assert_eq!(error.as_ref().unwrap_err().to_string(), "Inconsistent auto-deduction for builtin ec_op_builtin, expected 2739017437753868763038285897969098325279422804143820990343394856167768859289, got Some(Int(2778063437308421278851140253538604815869848682781135193774472480292420096757))");
assert_matches!(
error,
Err(VirtualMachineError::InconsistentAutoDeduction(
Expand Down Expand Up @@ -4317,7 +4317,7 @@ mod tests {
.get(0)
.unwrap()
.name(),
"pedersen"
"pedersen_builtin"
);
assert_eq!(virtual_machine_from_builder.run_context.ap, 18,);
assert_eq!(
Expand Down

0 comments on commit 324dd11

Please sign in to comment.