Skip to content
This repository has been archived by the owner on Jul 22, 2024. It is now read-only.

Commit

Permalink
update syscall request
Browse files Browse the repository at this point in the history
  • Loading branch information
edg-l committed Jun 5, 2024
1 parent 8e182f7 commit 11a58fa
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 35 deletions.
40 changes: 20 additions & 20 deletions src/syscalls/deprecated_syscall_request.rs
Original file line number Diff line number Diff line change
Expand Up @@ -261,10 +261,10 @@ impl DeprecatedFromPtr for DeprecatedEmitEventRequest {
syscall_ptr: Relocatable,
) -> Result<DeprecatedSyscallRequest, SyscallHandlerError> {
let selector = get_big_int(vm, syscall_ptr)?;
let keys_len = get_integer(vm, &syscall_ptr + 1)?;
let keys = get_relocatable(vm, &syscall_ptr + 2)?;
let data_len = get_integer(vm, &syscall_ptr + 3)?;
let data = get_relocatable(vm, &syscall_ptr + 4)?;
let keys_len = get_integer(vm, (syscall_ptr + 1)?)?;
let keys = get_relocatable(vm, (syscall_ptr + 2)?)?;
let data_len = get_integer(vm, (syscall_ptr + 3)?)?;
let data = get_relocatable(vm, (syscall_ptr + 4)?)?;

Ok(DeprecatedEmitEventRequest {
selector,
Expand Down Expand Up @@ -294,10 +294,10 @@ impl DeprecatedFromPtr for DeprecatedLibraryCallRequest {
syscall_ptr: Relocatable,
) -> Result<DeprecatedSyscallRequest, SyscallHandlerError> {
let selector = get_big_int(vm, syscall_ptr)?;
let class_hash = get_big_int(vm, &syscall_ptr + 1)?;
let function_selector = get_big_int(vm, &syscall_ptr + 2)?;
let calldata_size = get_integer(vm, &syscall_ptr + 3)?;
let calldata = get_relocatable(vm, &syscall_ptr + 4)?;
let class_hash = get_big_int(vm, (syscall_ptr + 1)?)?;
let function_selector = get_big_int(vm, (syscall_ptr + 2)?)?;
let calldata_size = get_integer(vm, (syscall_ptr + 3)?)?;
let calldata = get_relocatable(vm, (syscall_ptr + 4)?)?;
Ok(DeprecatedLibraryCallRequest {
selector,
class_hash,
Expand All @@ -315,10 +315,10 @@ impl DeprecatedFromPtr for DeprecatedCallContractRequest {
syscall_ptr: Relocatable,
) -> Result<DeprecatedSyscallRequest, SyscallHandlerError> {
let selector = get_big_int(vm, syscall_ptr)?;
let contract_address = Address(get_big_int(vm, &syscall_ptr + 1)?);
let function_selector = get_big_int(vm, &syscall_ptr + 2)?;
let calldata_size = get_integer(vm, &syscall_ptr + 3)?;
let calldata = get_relocatable(vm, &syscall_ptr + 4)?;
let contract_address = Address(get_big_int(vm, (syscall_ptr + 1)?)?);
let function_selector = get_big_int(vm, (syscall_ptr + 2)?)?;
let calldata_size = get_integer(vm, (syscall_ptr + 3)?)?;
let calldata = get_relocatable(vm, (syscall_ptr + 4)?)?;
Ok(DeprecatedCallContractRequest {
selector,
contract_address,
Expand All @@ -337,11 +337,11 @@ impl DeprecatedFromPtr for DeprecatedDeployRequest {
) -> Result<DeprecatedSyscallRequest, SyscallHandlerError> {
// Get syscall parameters from the Virtual Machine
let _selector = get_big_int(vm, syscall_ptr)?;
let class_hash = get_big_int(vm, &syscall_ptr + 1)?;
let contract_address_salt = get_big_int(vm, &syscall_ptr + 2)?;
let constructor_calldata_size = get_big_int(vm, &syscall_ptr + 3)?;
let constructor_calldata = get_relocatable(vm, &syscall_ptr + 4)?;
let deploy_from_zero = get_integer(vm, &syscall_ptr + 5)?;
let class_hash = get_big_int(vm, (syscall_ptr + 1)?)?;
let contract_address_salt = get_big_int(vm, (syscall_ptr + 2)?)?;
let constructor_calldata_size = get_big_int(vm, (syscall_ptr + 3)?)?;
let constructor_calldata = get_relocatable(vm, (syscall_ptr + 4)?)?;
let deploy_from_zero = get_integer(vm, (syscall_ptr + 5)?)?;

Ok(DeprecatedSyscallRequest::Deploy(DeprecatedDeployRequest {
_selector,
Expand All @@ -360,9 +360,9 @@ impl DeprecatedFromPtr for DeprecatedSendMessageToL1SysCallRequest {
syscall_ptr: Relocatable,
) -> Result<DeprecatedSyscallRequest, SyscallHandlerError> {
let _selector = get_big_int(vm, syscall_ptr)?;
let to_address = Address(get_big_int(vm, &syscall_ptr + 1)?);
let payload_size = get_integer(vm, &syscall_ptr + 2)?;
let payload_ptr = get_relocatable(vm, &syscall_ptr + 3)?;
let to_address = Address(get_big_int(vm, (syscall_ptr + 1)?)?);
let payload_size = get_integer(vm, (syscall_ptr + 2)?)?;
let payload_ptr = get_relocatable(vm, (syscall_ptr + 3)?)?;

Ok(DeprecatedSyscallRequest::SendMessageToL1(
DeprecatedSendMessageToL1SysCallRequest {
Expand Down
30 changes: 15 additions & 15 deletions src/syscalls/syscall_request.rs
Original file line number Diff line number Diff line change
Expand Up @@ -304,9 +304,9 @@ impl FromPtr for EmitEventRequest {
syscall_ptr: Relocatable,
) -> Result<SyscallRequest, SyscallHandlerError> {
let keys_start = get_relocatable(vm, syscall_ptr)?;
let keys_end = get_relocatable(vm, &syscall_ptr + 1)?;
let data_start = get_relocatable(vm, &syscall_ptr + 2)?;
let data_end = get_relocatable(vm, &syscall_ptr + 3)?;
let keys_end = get_relocatable(vm, (syscall_ptr + 1)?)?;
let data_start = get_relocatable(vm, (syscall_ptr + 2)?)?;
let data_end = get_relocatable(vm, (syscall_ptr + 3)?)?;

Ok(EmitEventRequest {
keys_start,
Expand All @@ -324,7 +324,7 @@ impl FromPtr for StorageReadRequest {
syscall_ptr: Relocatable,
) -> Result<SyscallRequest, SyscallHandlerError> {
let reserved = get_big_int(vm, syscall_ptr)?;
let key = get_big_int(vm, &syscall_ptr + 1)?.to_bytes_be();
let key = get_big_int(vm, (syscall_ptr + 1)?)?.to_bytes_be();
Ok(StorageReadRequest { key, reserved }.into())
}
}
Expand Down Expand Up @@ -356,9 +356,9 @@ impl FromPtr for CallContractRequest {
syscall_ptr: Relocatable,
) -> Result<SyscallRequest, SyscallHandlerError> {
let contract_address = Address(get_big_int(vm, syscall_ptr)?);
let selector = get_big_int(vm, &syscall_ptr + 1)?;
let calldata_start = get_relocatable(vm, &syscall_ptr + 2)?;
let calldata_end = get_relocatable(vm, &syscall_ptr + 3)?;
let selector = get_big_int(vm, (syscall_ptr + 1)?)?;
let calldata_start = get_relocatable(vm, (syscall_ptr + 2)?)?;
let calldata_end = get_relocatable(vm, (syscall_ptr + 3)?)?;
Ok(CallContractRequest {
selector,
contract_address,
Expand All @@ -375,9 +375,9 @@ impl FromPtr for LibraryCallRequest {
syscall_ptr: Relocatable,
) -> Result<SyscallRequest, SyscallHandlerError> {
let class_hash = get_big_int(vm, syscall_ptr)?;
let selector = get_big_int(vm, &syscall_ptr + 1)?;
let calldata_start = get_relocatable(vm, &syscall_ptr + 2)?;
let calldata_end = get_relocatable(vm, &syscall_ptr + 3)?;
let selector = get_big_int(vm, (syscall_ptr + 1)?)?;
let calldata_start = get_relocatable(vm, (syscall_ptr + 2)?)?;
let calldata_end = get_relocatable(vm, (syscall_ptr + 3)?)?;

Ok(LibraryCallRequest {
class_hash,
Expand All @@ -395,8 +395,8 @@ impl FromPtr for SendMessageToL1Request {
syscall_ptr: Relocatable,
) -> Result<SyscallRequest, SyscallHandlerError> {
let to_address = Address(get_big_int(vm, syscall_ptr)?);
let payload_start = get_relocatable(vm, &syscall_ptr + 1)?;
let payload_end = get_relocatable(vm, &syscall_ptr + 2)?;
let payload_start = get_relocatable(vm, (syscall_ptr + 1)?)?;
let payload_end = get_relocatable(vm, (syscall_ptr + 2)?)?;

Ok(SendMessageToL1Request {
to_address,
Expand All @@ -413,8 +413,8 @@ impl FromPtr for StorageWriteRequest {
syscall_ptr: Relocatable,
) -> Result<SyscallRequest, SyscallHandlerError> {
let reserved = get_big_int(vm, syscall_ptr)?;
let key = get_big_int(vm, &syscall_ptr + 1)?;
let value = get_big_int(vm, &syscall_ptr + 2)?;
let key = get_big_int(vm, (syscall_ptr + 1)?)?;
let value = get_big_int(vm, (syscall_ptr + 2)?)?;

Ok(StorageWriteRequest {
reserved,
Expand All @@ -431,7 +431,7 @@ impl FromPtr for KeccakRequest {
syscall_ptr: Relocatable,
) -> Result<SyscallRequest, SyscallHandlerError> {
let input_start = get_relocatable(vm, syscall_ptr)?;
let input_end = get_relocatable(vm, &syscall_ptr + 1)?;
let input_end = get_relocatable(vm, (syscall_ptr + 1)?)?;

Ok(KeccakRequest {
input_start,
Expand Down

0 comments on commit 11a58fa

Please sign in to comment.