From ffcec330debce66945071162ff2c307a560cb7bc Mon Sep 17 00:00:00 2001 From: Alon Haramati Date: Tue, 18 Apr 2023 15:16:35 +0300 Subject: [PATCH 1/4] Add _builtin suffix to builtin names. --- src/vm/runners/builtin_runner/mod.rs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) 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 From 8ebbbf4703f739255ecb58ad68f8b8ae956d1b92 Mon Sep 17 00:00:00 2001 From: Pedro Fontana Date: Tue, 18 Apr 2023 12:42:34 -0300 Subject: [PATCH 2/4] fix unit tests --- src/vm/runners/cairo_runner.rs | 2 +- src/vm/vm_core.rs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) 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!( From 5402b4986201d50d7b6be0823b843abb92cb3d8e Mon Sep 17 00:00:00 2001 From: Pedro Fontana Date: Tue, 18 Apr 2023 12:45:00 -0300 Subject: [PATCH 3/4] Update CHANGELOG.md --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index e6e11d7e2d..99089e4f7d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ #### Upcoming Changes +* Add _builtin suffix to builtin names e.g.: output -> output_builtin [#1005](https://github.com/lambdaclass/cairo-rs/pull/1005) + * Add missing `\n` character in traceback string [#997](https://github.com/lambdaclass/cairo-rs/pull/997) * BugFix: Add missing `\n` character after traceback lines when the filename is missing ("Unknown Location") From 43071257e313440c1d272890badbbfaf08b439d8 Mon Sep 17 00:00:00 2001 From: Pedro Fontana Date: Tue, 18 Apr 2023 13:44:26 -0300 Subject: [PATCH 4/4] Update CHANGELOG.md --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3733aaa27d..9547c94333 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ #### Upcoming Changes -* Add _builtin suffix to builtin names e.g.: output -> output_builtin [#1005](https://github.com/lambdaclass/cairo-rs/pull/1005) +* 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)