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

Remove builtin names from VirtualMachine.builtin_runners #921

Merged
merged 5 commits into from
Mar 27, 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
19 changes: 6 additions & 13 deletions src/hint_processor/builtin_hint_processor/signature.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ pub fn verify_ecdsa_signature(
#[cfg(test)]
mod tests {
use super::*;
use crate::vm::runners::builtin_runner::SIGNATURE_BUILTIN_NAME;
use crate::vm::vm_memory::memory_segments::MemorySegmentManager;
use crate::{
any_box,
Expand Down Expand Up @@ -75,10 +74,8 @@ mod tests {
#[cfg_attr(target_arch = "wasm32", wasm_bindgen_test)]
fn verify_ecdsa_signature_valid() {
let mut vm = vm!();
vm.builtin_runners = vec![(
SIGNATURE_BUILTIN_NAME,
SignatureBuiltinRunner::new(&EcdsaInstanceDef::default(), true).into(),
)];
vm.builtin_runners =
vec![SignatureBuiltinRunner::new(&EcdsaInstanceDef::default(), true).into()];
vm.segments = segments![
((1, 0), (0, 0)),
(
Expand All @@ -104,10 +101,8 @@ mod tests {
#[test]
fn verify_ecdsa_signature_invalid_ecdsa_ptr() {
let mut vm = vm!();
vm.builtin_runners = vec![(
SIGNATURE_BUILTIN_NAME,
SignatureBuiltinRunner::new(&EcdsaInstanceDef::default(), true).into(),
)];
vm.builtin_runners =
vec![SignatureBuiltinRunner::new(&EcdsaInstanceDef::default(), true).into()];
vm.segments = segments![
((1, 0), (3, 0)),
(
Expand All @@ -133,10 +128,8 @@ mod tests {
#[test]
fn verify_ecdsa_signature_invalid_input_cell() {
let mut vm = vm!();
vm.builtin_runners = vec![(
SIGNATURE_BUILTIN_NAME,
SignatureBuiltinRunner::new(&EcdsaInstanceDef::default(), true).into(),
)];
vm.builtin_runners =
vec![SignatureBuiltinRunner::new(&EcdsaInstanceDef::default(), true).into()];
vm.segments = segments![
((1, 0), (0, 3)),
(
Expand Down
2 changes: 1 addition & 1 deletion src/serde/deserialize_program.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use serde::{de, de::MapAccess, de::SeqAccess, Deserialize, Deserializer, Seriali
use serde_json::Number;

// This enum is used to deserialize program builtins into &str and catch non-valid names
#[derive(Serialize, Deserialize, Debug, PartialEq, Copy, Clone, Eq)]
#[derive(Serialize, Deserialize, Debug, PartialEq, Copy, Clone, Eq, Hash)]
#[allow(non_camel_case_types)]
pub enum BuiltinName {
output,
Expand Down
5 changes: 1 addition & 4 deletions src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -214,10 +214,7 @@ pub mod test_utils {
macro_rules! vm_with_range_check {
() => {{
let mut vm = VirtualMachine::new(false);
vm.builtin_runners = vec![(
"range_check",
RangeCheckBuiltinRunner::new(8, 8, true).into(),
)];
vm.builtin_runners = vec![RangeCheckBuiltinRunner::new(8, 8, true).into()];
vm
}};
}
Expand Down
Loading