Skip to content

Commit

Permalink
reorg syscall_handler
Browse files Browse the repository at this point in the history
  • Loading branch information
Okm165 committed Nov 25, 2024
1 parent c21003b commit e2c5cf1
Show file tree
Hide file tree
Showing 15 changed files with 43 additions and 41 deletions.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 0 additions & 2 deletions cairo_vm_hints/src/hints/lib/contract_bootloader/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,9 @@ use cairo_vm::{
Felt252,
};

pub mod cairo_types;
pub mod dict_manager;
pub mod program;
pub mod scopes;
pub mod syscall;

pub fn run_hint(
vm: &mut VirtualMachine,
Expand Down
5 changes: 4 additions & 1 deletion cairo_vm_hints/src/hints/lib/contract_bootloader/program.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
use super::{cairo_types::structs::CompiledClass, scopes::CONTRACT_CLASS};
use cairo_lang_starknet_classes::casm_contract_class::CasmContractClass;
use cairo_vm::{
any_box,
Expand All @@ -14,6 +13,10 @@ use cairo_vm::{
};
use std::collections::HashMap;

use crate::cairo_types::structs::CompiledClass;

use super::scopes::CONTRACT_CLASS;

pub const LOAD_PROGRAM: &str = "vm_load_program(\n compiled_class.get_runnable_program(entrypoint_builtins=[]),\n ids.compiled_class.bytecode_ptr\n)";

pub fn load_program(
Expand Down
3 changes: 1 addition & 2 deletions cairo_vm_hints/src/hints/lib/contract_bootloader/scopes.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
use std::{any::Any, collections::HashMap};

use crate::syscall_handler::SyscallHandlerWrapper;
use cairo_vm::{
hint_processor::builtin_hint_processor::builtin_hint_processor_definition::HintProcessorData,
types::exec_scope::ExecutionScopes,
vm::{errors::hint_errors::HintError, vm_core::VirtualMachine},
Felt252,
};

use super::syscall::syscall_handler::SyscallHandlerWrapper;

pub const DICT_MANAGER: &str = "dict_manager";
pub const SYSCALL_HANDLER: &str = "syscall_handler";
pub const CONTRACT_CLASS: &str = "syscall_handler";
Expand Down

This file was deleted.

Empty file.
2 changes: 2 additions & 0 deletions cairo_vm_hints/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#![forbid(unsafe_code)]
pub mod cairo_types;
pub mod hint_processor;
pub mod hints;
pub mod syscall_handler;

pub use hint_processor::CustomHintProcessor;

Expand Down
2 changes: 2 additions & 0 deletions cairo_vm_hints/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#![forbid(unsafe_code)]
pub mod cairo_types;
pub mod hint_processor;
pub mod hints;
pub mod syscall_handler;

use bincode::enc::write::Writer;
use cairo_vm::air_public_input::PublicInputError;
Expand Down
29 changes: 29 additions & 0 deletions cairo_vm_hints/src/syscall_handler/call_contract.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
use super::utils::{SyscallHandler, SyscallResult, WriteResponseResult};
use crate::cairo_types::new_syscalls::{CallContractRequest, CallContractResponse};
use cairo_vm::{types::relocatable::Relocatable, vm::vm_core::VirtualMachine};

pub struct CallContractHandler;

impl SyscallHandler for CallContractHandler {
type Request = CallContractRequest;
type Response = CallContractResponse;

fn read_request(_vm: &VirtualMachine, ptr: &mut Relocatable) -> SyscallResult<Self::Request> {
todo!()
}

async fn execute(
request: Self::Request,
vm: &mut VirtualMachine,
) -> SyscallResult<Self::Response> {
todo!()
}

fn write_response(
response: Self::Response,
vm: &mut VirtualMachine,
ptr: &mut Relocatable,
) -> WriteResponseResult {
todo!()
}
}
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
use super::utils::{ReadOnlySegment, SyscallResult, WriteResponseResult};
use crate::hints::lib::contract_bootloader::syscall::utils::{
felt_from_ptr, run_handler, SyscallSelector,
};
use crate::hints::lib::contract_bootloader::{
cairo_types::new_syscalls::{CallContractRequest, CallContractResponse},
syscall::utils::SyscallHandler,
};
pub mod call_contract;
pub mod utils;

use cairo_vm::{
types::relocatable::Relocatable,
vm::{errors::hint_errors::HintError, vm_core::VirtualMachine},
};
use call_contract::CallContractHandler;
use std::{rc::Rc, sync::RwLock};
use utils::{felt_from_ptr, run_handler, ReadOnlySegment, SyscallSelector};

/// Represents read-only segments dynamically allocated during execution.
#[derive(Debug, Default)]
Expand Down Expand Up @@ -83,29 +80,3 @@ impl SyscallHandlerWrapper {
Ok(())
}
}

struct CallContractHandler;

impl SyscallHandler for CallContractHandler {
type Request = CallContractRequest;
type Response = CallContractResponse;

fn read_request(_vm: &VirtualMachine, ptr: &mut Relocatable) -> SyscallResult<Self::Request> {
todo!()
}

async fn execute(
request: Self::Request,
vm: &mut VirtualMachine,
) -> SyscallResult<Self::Response> {
todo!()
}

fn write_response(
response: Self::Response,
vm: &mut VirtualMachine,
ptr: &mut Relocatable,
) -> WriteResponseResult {
todo!()
}
}
File renamed without changes.

0 comments on commit e2c5cf1

Please sign in to comment.