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 a0ac8bf commit 4b2090d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,18 +59,12 @@ func run_contract_bootloader{
);
let builtin_encodings = &local_builtin_encodings;

local calldata = 0x0;
local execution_info: ExecutionInfo = ExecutionInfo(
block_info=0,
tx_info=0,

// Entry-point-specific info.
local calldata: felt*;
%{
ids.calldata = segments.add()
%}

caller_address=0,
// The execution is done in the context of the contract at this address.
// It controls the storage being used, messages sent to L1, calling contracts, etc.
contract_address=0,
// The entry point selector.
local execution_info: ExecutionInfo = ExecutionInfo(
selector=0,
);

Expand All @@ -85,14 +79,10 @@ func run_contract_bootloader{

local execution_context: ExecutionContext = ExecutionContext(
entry_point_type=ENTRY_POINT_TYPE_EXTERNAL,
// The hash of the contract class to execute.
class_hash=0,
calldata_size=0,
calldata=0,
calldata=calldata,
// Additional information about the execution.
execution_info=&execution_info,
// Information about the transaction that triggered the execution.
deprecated_tx_info=0,
);

with builtin_ptrs, builtin_encodings {
Expand Down
20 changes: 8 additions & 12 deletions cairo0-bootloader/execution/execute_entry_point.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -48,25 +48,16 @@ struct BuiltinData {
}

struct ExecutionInfo {
caller_address: felt,
// The execution is done in the context of the contract at this address.
// It controls the storage being used, messages sent to L1, calling contracts, etc.
contract_address: felt,
// The entry point selector.
selector: felt,
}

// Represents the execution context during the execution of contract code.
struct ExecutionContext {
entry_point_type: felt,
// The hash of the contract class to execute.
class_hash: felt,
calldata_size: felt,
calldata: felt*,
// Additional information about the execution.
execution_info: ExecutionInfo*,
// Information about the transaction that triggered the execution.
deprecated_tx_info: DeprecatedTxInfo*,
}

// Represents the arguments pushed to the stack before calling an entry point.
Expand Down Expand Up @@ -182,8 +173,13 @@ 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 @@ -220,11 +216,11 @@ func execute_entry_point{
print(ids.syscall_ptr)
%}

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


// Retrieve returned_builtin_ptrs_subset.
// Note that returned_builtin_ptrs_subset cannot be set in a hint because doing so will allow a
// malicious prover to lie about the storage changes of a valid contract.
Expand Down

0 comments on commit 4b2090d

Please sign in to comment.