From 426d656e74dc2114c289612f58cb98022193eb19 Mon Sep 17 00:00:00 2001 From: Alon Haramati <91828241+alonh5@users.noreply.github.com> Date: Tue, 18 Apr 2023 20:16:17 +0300 Subject: [PATCH] Add _builtin suffix to builtin names. (#1005) * Add _builtin suffix to builtin names. * fix unit tests * Update CHANGELOG.md * Update CHANGELOG.md --------- Co-authored-by: Pedro Fontana --- CHANGELOG.md | 2 ++ src/vm/runners/builtin_runner/mod.rs | 18 +++++++++--------- src/vm/runners/cairo_runner.rs | 2 +- src/vm/vm_core.rs | 4 ++-- 4 files changed, 14 insertions(+), 12 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 095db26230..9547c94333 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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: diff --git a/src/vm/runners/builtin_runner/mod.rs b/src/vm/runners/builtin_runner/mod.rs index 25a449cdc1..a79baf413c 100644 --- a/src/vm/runners/builtin_runner/mod.rs +++ b/src/vm/runners/builtin_runner/mod.rs @@ -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 diff --git a/src/vm/runners/cairo_runner.rs b/src/vm/runners/cairo_runner.rs index 40769b912b..7410b7a6f3 100644 --- a/src/vm/runners/cairo_runner.rs +++ b/src/vm/runners/cairo_runner.rs @@ -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); diff --git a/src/vm/vm_core.rs b/src/vm/vm_core.rs index 480703e4bd..b9376bbd36 100644 --- a/src/vm/vm_core.rs +++ b/src/vm/vm_core.rs @@ -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( @@ -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!(