Skip to content
This repository has been archived by the owner on Jan 9, 2025. It is now read-only.

Commit

Permalink
wip fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ClementWalter committed Nov 22, 2023
1 parent c3d8a97 commit 7780b4d
Showing 1 changed file with 10 additions and 14 deletions.
24 changes: 10 additions & 14 deletions tests/src/kakarot/instructions/test_system_operations.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,9 @@
from starkware.cairo.common.alloc import alloc
from starkware.cairo.common.bool import TRUE, FALSE
from starkware.cairo.common.cairo_builtins import HashBuiltin, BitwiseBuiltin
from starkware.cairo.common.default_dict import default_dict_new
from starkware.cairo.common.math import split_felt, assert_not_zero, assert_le
from starkware.cairo.common.math import split_felt, assert_not_zero
from starkware.cairo.common.uint256 import Uint256, uint256_sub
from starkware.starknet.common.syscalls import deploy, get_contract_address

// Third party dependencies
from openzeppelin.token.erc20.library import ERC20
from starkware.starknet.common.syscalls import get_contract_address

// Local dependencies
from data_availability.starknet import Starknet
Expand All @@ -25,8 +21,6 @@ from kakarot.storages import (
from kakarot.execution_context import ExecutionContext
from kakarot.instructions.memory_operations import MemoryOperations
from kakarot.instructions.system_operations import SystemOperations, CallHelper, CreateHelper
from kakarot.interfaces.interfaces import IContractAccount, IKakarot, IAccount, IERC20
from kakarot.library import Kakarot
from kakarot.account import Account
from kakarot.model import model
from kakarot.stack import Stack
Expand Down Expand Up @@ -61,7 +55,8 @@ func constructor{
func get_native_token{syscall_ptr: felt*, pedersen_ptr: HashBuiltin*, range_check_ptr}() -> (
native_token_address: felt
) {
return Kakarot.get_native_token();
let (native_token) = native_token_address.read();
return (native_token,);
}

// @dev mock function that returns the computed starknet address from an evm address
Expand Down Expand Up @@ -290,7 +285,7 @@ func test__exec_call__should_transfer_value{
let stack = Stack.push(stack, value);
let stack = Stack.push(stack, address);
let stack = Stack.push(stack, gas);
tempvar memory_word = new Uint256(low=0, high=22774453838368691922685013100469420032);
tempvar memory_word = new Uint256(low=0, high=0x11223344556677880000000000000000);
tempvar memory_offset = new Uint256(0, 0);
let stack = Stack.push(stack, memory_word);
let stack = Stack.push(stack, memory_offset);
Expand All @@ -300,6 +295,7 @@ func test__exec_call__should_transfer_value{
caller_starknet_contract_address, caller_evm_contract_address, bytecode_len, bytecode, stack
);
let ctx = MemoryOperations.exec_mstore(ctx);

// Get the balance of caller pre-call
let (state, caller_balance_prev) = State.read_balance(ctx.state, caller_address);
let ctx = ExecutionContext.update_state(ctx, state);
Expand Down Expand Up @@ -354,7 +350,7 @@ func test__exec_callcode__should_return_a_new_context_based_on_calling_ctx_stack
// Put some value in memory as it is used for calldata with args_size and args_offset
// Word is 0x 11 22 33 44 55 66 77 88 00 00 ... 00
// calldata should be 0x 44 55 66 77
tempvar memory_word = new Uint256(low=0, high=22774453838368691922685013100469420032);
tempvar memory_word = new Uint256(low=0, high=0x11223344556677880000000000000000);
tempvar memory_offset = new Uint256(0, 0);
let stack = Stack.push(stack, memory_word);
let stack = Stack.push(stack, memory_offset);
Expand Down Expand Up @@ -439,7 +435,7 @@ func test__exec_callcode__should_transfer_value{
let stack = Stack.push(stack, value);
let stack = Stack.push(stack, address);
let stack = Stack.push(stack, gas);
tempvar memory_word = new Uint256(low=0, high=22774453838368691922685013100469420032);
tempvar memory_word = new Uint256(low=0, high=0x11223344556677880000000000000000);
tempvar memory_offset = new Uint256(0, 0);
let stack = Stack.push(stack, memory_word);
let stack = Stack.push(stack, memory_offset);
Expand Down Expand Up @@ -499,7 +495,7 @@ func test__exec_staticcall__should_return_a_new_context_based_on_calling_ctx_sta
// Put some value in memory as it is used for calldata with args_size and args_offset
// Word is 0x 11 22 33 44 55 66 77 88 00 00 ... 00
// calldata should be 0x 44 55 66 77
tempvar memory_word = new Uint256(low=0, high=22774453838368691922685013100469420032);
tempvar memory_word = new Uint256(low=0, high=0x11223344556677880000000000000000);
tempvar memory_offset = new Uint256(0, 0);
let stack = Stack.push(stack, memory_word);
let stack = Stack.push(stack, memory_offset);
Expand Down Expand Up @@ -573,7 +569,7 @@ func test__exec_delegatecall__should_return_a_new_context_based_on_calling_ctx_s
// Put some value in memory as it is used for calldata with args_size and args_offset
// Word is 0x 11 22 33 44 55 66 77 88 00 00 ... 00
// calldata should be 0x 44 55 66 77
tempvar memory_word = new Uint256(low=0, high=22774453838368691922685013100469420032);
tempvar memory_word = new Uint256(low=0, high=0x11223344556677880000000000000000);
tempvar memory_offset = new Uint256(0, 0);
let stack = Stack.push(stack, memory_word);
let stack = Stack.push(stack, memory_offset);
Expand Down

0 comments on commit 7780b4d

Please sign in to comment.