Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
Okm165 committed May 24, 2024
1 parent 4b2090d commit 85cb872
Show file tree
Hide file tree
Showing 5 changed files with 79 additions and 31 deletions.
Empty file.
9 changes: 2 additions & 7 deletions cairo0-bootloader/execution/execute_entry_point.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -173,13 +173,8 @@ func execute_entry_point{

local syscall_ptr: felt*;

%{
from starkware.starknet.core.os.syscall_handler import SyscallHandlerBase
%{
ids.syscall_ptr = segments.add()
syscall_handler = SyscallHandlerBase(ids.syscall_ptr)
syscall_handler.set_syscall_ptr(syscall_ptr=ids.syscall_ptr)
%}

let builtin_ptrs: BuiltinPointers* = prepare_builtin_ptrs_for_execute(builtin_ptrs);
Expand Down Expand Up @@ -216,7 +211,7 @@ func execute_entry_point{
print(ids.syscall_ptr)
%}

%{ vm_enter_scope({'syscall_handler': syscall_handler}) %}
%{ vm_enter_scope() %}
call abs contract_entry_point;
%{ vm_exit_scope() %}

Expand Down
76 changes: 76 additions & 0 deletions cairo0-bootloader/execution/syscall_handler.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
from typing import Iterable
from starkware.starknet.core.os.syscall_handler import SyscallHandlerBase, OsExecutionHelper
from starkware.cairo.lang.vm.relocatable import RelocatableValue, MaybeRelocatable
from starkware.cairo.lang.vm.memory_segments import MemorySegmentManager

class SyscallHandler(SyscallHandlerBase):
"""
A handler for system calls; used by the BusinessLogic entry point execution.
"""

def __init__(
self,
segments: MemorySegmentManager,
):
super().__init__(segments=segments, initial_syscall_ptr=None)

def set_syscall_ptr(self, syscall_ptr: RelocatableValue):
assert self._syscall_ptr is None, "syscall_ptr is already set."
self._syscall_ptr = syscall_ptr

def allocate_segment(self, data: Iterable[MaybeRelocatable]) -> RelocatableValue:
segment_start = self.segments.add()
self.segments.write_arg(ptr=segment_start, arg=data)
return segment_start

def _allocate_segment_for_retdata(self):
# Implementation here
pass

def _call_contract_helper(self):
# Implementation here
pass

def _count_syscall(self):
# Implementation here
pass

def _deploy(self):
# Implementation here
pass

def _emit_event(self):
# Implementation here
pass

def _get_block_hash(self):
# Implementation here
pass

def _get_execution_info_ptr(self):
# Implementation here
pass

def _keccak(self):
# Implementation here
pass

def _replace_class(self):
# Implementation here
pass

def _send_message_to_l1(self):
# Implementation here
pass

def _storage_read(self):
# Implementation here
pass

def _storage_write(self):
# Implementation here
pass

def current_block_number(self):
# Implementation here
pass
24 changes: 0 additions & 24 deletions cairo0-bootloader/os/syscall_handler.py

This file was deleted.

1 change: 1 addition & 0 deletions cairo0-bootloader/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"builtin_selection": ["*.cairo", "*/*.cairo"],
"common.builtin_poseidon": ["*.cairo", "*/*.cairo"],
"common": ["*.cairo", "*/*.cairo"],
"execution": ["*.cairo", "*/*.cairo"],
"contract_class": ["*.cairo", "*/*.cairo"],
"lang.compiler": ["cairo.ebnf", "lib/*.cairo"],
},
Expand Down

0 comments on commit 85cb872

Please sign in to comment.