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

temp/debug native #973

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions crates/contracts/src/kakarot_core/kakarot.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,16 @@ const INVOKE_ETH_CALL_FORBIDDEN: felt252 = 'KKT: Cannot invoke eth_call';

#[starknet::contract]
pub mod KakarotCore {
use contracts::components::ownable::{ownable_component};
use starknet::storage::StorageAsPointer;
use contracts::components::ownable::{ownable_component};
use contracts::components::upgradeable::{IUpgradeable, upgradeable_component};
use contracts::kakarot_core::eth_rpc;
use contracts::kakarot_core::interface::IKakarotCore;
use core::num::traits::Zero;
use core::starknet::event::EventEmitter;
use core::starknet::storage::{
Map, StorageMapReadAccess, StorageMapWriteAccess, StoragePointerReadAccess,
StoragePointerWriteAccess
StoragePointerWriteAccess, StoragePathEntry
};
use core::starknet::{EthAddress, ContractAddress, ClassHash, get_contract_address};
use evm::backend::starknet_backend;
Expand Down Expand Up @@ -143,6 +144,9 @@ pub mod KakarotCore {
}

fn address_registry(self: @ContractState, evm_address: EthAddress) -> ContractAddress {
let storage_address = self.Kakarot_evm_to_starknet_address.entry(evm_address).as_ptr().__storage_pointer_address__;
println!("evm_address: {:?}", evm_address);
println!("storage_address: {:?}", storage_address);
self.Kakarot_evm_to_starknet_address.read(evm_address)
}

Expand Down
7 changes: 6 additions & 1 deletion crates/evm/src/instructions/push_operations.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,12 @@ fn exec_push_i(ref self: VM, i: u8) -> Result<(), EVMError> {
if data.len() == 0 {
self.stack.push(0)
} else {
self.stack.push(data.pad_right_with_zeroes(i).from_be_bytes_partial().unwrap())
let data_to_push = data.pad_right_with_zeroes(i).from_be_bytes_partial().unwrap();
if i == 2 {
println!("data {:?}", data);
println!("data_to_push {:?}", data_to_push);
}
self.stack.push(data_to_push)
}
}

Expand Down
2 changes: 2 additions & 0 deletions crates/evm/src/instructions/system_operations.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ pub impl SystemOperations of SystemOperationsTrait {
let ret_offset = self.stack.pop_saturating_usize()?;
let ret_size = self.stack.pop_usize()?;

println!("to {:?}", to);

// GAS
let memory_expansion = gas::memory_expansion(
self.memory.size(), [(args_offset, args_size), (ret_offset, ret_size)].span()
Expand Down
4 changes: 4 additions & 0 deletions crates/evm/src/stack.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ impl StackImpl of StackTrait {

self.items.insert(length.into(), NullableTrait::new(item));
self.len += 1;
println!("stack_push top {:?}", self.peek_at(0).unwrap());
Result::Ok(())
}

Expand All @@ -90,6 +91,7 @@ impl StackImpl of StackTrait {

self.len -= 1;
let item = self.items.get(self.len().into());
println!("stack_pop top {:?}", item.deref());
Result::Ok(item.deref())
}

Expand Down Expand Up @@ -200,7 +202,9 @@ impl StackImpl of StackTrait {
#[inline(always)]
fn pop_eth_address(ref self: Stack) -> Result<EthAddress, EVMError> {
let item: u256 = self.pop()?;
println!("item_u256 {:?}", item);
let item: EthAddress = item.into();
println!("item_eth_address {:?}", item);
Result::Ok(item)
}

Expand Down
Loading