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

Commit ac4be10

Browse files
committed
debug native
1 parent 610ce0e commit ac4be10

File tree

4 files changed

+18
-3
lines changed

4 files changed

+18
-3
lines changed

crates/contracts/src/kakarot_core/kakarot.cairo

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,16 @@ const INVOKE_ETH_CALL_FORBIDDEN: felt252 = 'KKT: Cannot invoke eth_call';
33

44
#[starknet::contract]
55
pub mod KakarotCore {
6-
use contracts::components::ownable::{ownable_component};
6+
use starknet::storage::StorageAsPointer;
7+
use contracts::components::ownable::{ownable_component};
78
use contracts::components::upgradeable::{IUpgradeable, upgradeable_component};
89
use contracts::kakarot_core::eth_rpc;
910
use contracts::kakarot_core::interface::IKakarotCore;
1011
use core::num::traits::Zero;
1112
use core::starknet::event::EventEmitter;
1213
use core::starknet::storage::{
1314
Map, StorageMapReadAccess, StorageMapWriteAccess, StoragePointerReadAccess,
14-
StoragePointerWriteAccess
15+
StoragePointerWriteAccess, StoragePathEntry
1516
};
1617
use core::starknet::{EthAddress, ContractAddress, ClassHash, get_contract_address};
1718
use evm::backend::starknet_backend;
@@ -143,6 +144,9 @@ pub mod KakarotCore {
143144
}
144145

145146
fn address_registry(self: @ContractState, evm_address: EthAddress) -> ContractAddress {
147+
let storage_address = self.Kakarot_evm_to_starknet_address.entry(evm_address).as_ptr().__storage_pointer_address__;
148+
println!("evm_address: {:?}", evm_address);
149+
println!("storage_address: {:?}", storage_address);
146150
self.Kakarot_evm_to_starknet_address.read(evm_address)
147151
}
148152

crates/evm/src/instructions/push_operations.cairo

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,12 @@ fn exec_push_i(ref self: VM, i: u8) -> Result<(), EVMError> {
2020
if data.len() == 0 {
2121
self.stack.push(0)
2222
} else {
23-
self.stack.push(data.pad_right_with_zeroes(i).from_be_bytes_partial().unwrap())
23+
let data_to_push = data.pad_right_with_zeroes(i).from_be_bytes_partial().unwrap();
24+
if i == 2 {
25+
println!("data {:?}", data);
26+
println!("data_to_push {:?}", data_to_push);
27+
}
28+
self.stack.push(data_to_push)
2429
}
2530
}
2631

crates/evm/src/instructions/system_operations.cairo

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ pub impl SystemOperations of SystemOperationsTrait {
3333
let ret_offset = self.stack.pop_saturating_usize()?;
3434
let ret_size = self.stack.pop_usize()?;
3535

36+
println!("to {:?}", to);
37+
3638
// GAS
3739
let memory_expansion = gas::memory_expansion(
3840
self.memory.size(), [(args_offset, args_size), (ret_offset, ret_size)].span()

crates/evm/src/stack.cairo

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ impl StackImpl of StackTrait {
7676

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

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

9192
self.len -= 1;
9293
let item = self.items.get(self.len().into());
94+
println!("stack_pop top {:?}", item.deref());
9395
Result::Ok(item.deref())
9496
}
9597

@@ -200,7 +202,9 @@ impl StackImpl of StackTrait {
200202
#[inline(always)]
201203
fn pop_eth_address(ref self: Stack) -> Result<EthAddress, EVMError> {
202204
let item: u256 = self.pop()?;
205+
println!("item_u256 {:?}", item);
203206
let item: EthAddress = item.into();
207+
println!("item_eth_address {:?}", item);
204208
Result::Ok(item)
205209
}
206210

0 commit comments

Comments
 (0)