Skip to content

Commit

Permalink
chore: update import paths (#833)
Browse files Browse the repository at this point in the history
* chore: update import paths

* fix
  • Loading branch information
enitrat authored Aug 19, 2024
1 parent cd7aa4b commit 7318577
Show file tree
Hide file tree
Showing 36 changed files with 81 additions and 75 deletions.
12 changes: 7 additions & 5 deletions crates/contracts/src/cairo1_helpers.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -117,11 +117,13 @@ mod embeddable_impls {
use evm::precompiles::identity::Identity;
use evm::precompiles::modexp::ModExp;
use evm::precompiles::sha256::Sha256;
use starknet::EthAddress;
use starknet::eth_signature::{Signature, verify_eth_signature, public_key_point_to_eth_address};
use starknet::secp256_trait::{recover_public_key, Secp256PointTrait, is_valid_signature};
use starknet::secp256k1::Secp256k1Point;
use starknet::secp256r1::{secp256r1_new_syscall, Secp256r1Point};
use core::starknet::EthAddress;
use core::starknet::eth_signature::{
Signature, verify_eth_signature, public_key_point_to_eth_address
};
use core::starknet::secp256_trait::{recover_public_key, Secp256PointTrait, is_valid_signature};
use core::starknet::secp256k1::Secp256k1Point;
use core::starknet::secp256r1::{secp256r1_new_syscall, Secp256r1Point};
use utils::helpers::U256Trait;


Expand Down
6 changes: 3 additions & 3 deletions crates/contracts/src/components/ownable.cairo
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// This implementation of an Ownable is inspired by Openzeppelin's work on
// OpenZeppelin Contracts for Cairo available here: https://github.com/OpenZeppelin/cairo-contracts

use starknet::ContractAddress;
use core::starknet::ContractAddress;
pub mod Errors {
pub const NOT_OWNER: felt252 = 'Caller is not the owner';
pub const ZERO_ADDRESS_CALLER: felt252 = 'Caller is the zero address';
Expand All @@ -18,8 +18,8 @@ pub trait IOwnable<TContractState> {
#[starknet::component]
pub mod ownable_component {
use core::num::traits::Zero;
use starknet::ContractAddress;
use starknet::get_caller_address;
use core::starknet::ContractAddress;
use core::starknet::get_caller_address;
use super::Errors;

#[storage]
Expand Down
6 changes: 3 additions & 3 deletions crates/contracts/src/components/upgradeable.cairo
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use starknet::ClassHash;
use core::starknet::ClassHash;

#[starknet::interface]
pub trait IUpgradeable<TContractState> {
Expand All @@ -8,8 +8,8 @@ pub trait IUpgradeable<TContractState> {

#[starknet::component]
pub mod upgradeable_component {
use starknet::syscalls::{replace_class_syscall};
use starknet::{get_caller_address, ClassHash};
use core::starknet::syscalls::{replace_class_syscall};
use core::starknet::{get_caller_address, ClassHash};


#[storage]
Expand Down
2 changes: 1 addition & 1 deletion crates/contracts/src/kakarot_core/interface.cairo
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use starknet::{ContractAddress, EthAddress, ClassHash};
use core::starknet::{ContractAddress, EthAddress, ClassHash};
use utils::eth_transaction::EthereumTransaction;

#[starknet::interface]
Expand Down
6 changes: 3 additions & 3 deletions crates/contracts/src/kakarot_core/kakarot.cairo
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use starknet::{ContractAddress, EthAddress, ClassHash};
use core::starknet::{ContractAddress, EthAddress, ClassHash};

const INVOKE_ETH_CALL_FORBIDDEN: felt252 = 'KKT: Cannot invoke eth_call';

Expand Down Expand Up @@ -26,8 +26,8 @@ pub mod KakarotCore {
ExecutionSummaryTrait, Address, AddressTrait
};
use evm::state::{State, StateTrait};
use starknet::syscalls::deploy_syscall;
use starknet::{
use core::starknet::syscalls::deploy_syscall;
use core::starknet::{
EthAddress, ContractAddress, ClassHash, get_tx_info, get_contract_address,
get_caller_address
};
Expand Down
4 changes: 2 additions & 2 deletions crates/contracts/src/test_utils.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use evm::model::{Address};
use evm::test_utils::{ca_address, other_starknet_address, chain_id, sequencer_evm_address};
use openzeppelin::token::erc20::ERC20;
use openzeppelin::token::erc20::interface::{IERC20CamelDispatcher, IERC20CamelDispatcherTrait};
use starknet::{
use core::starknet::{
testing, contract_address_const, EthAddress, ContractAddress, deploy_syscall,
get_contract_address
};
Expand Down Expand Up @@ -60,7 +60,7 @@ fn assert_no_events_left(address: ContractAddress) {
}

mod constants {
use starknet::{EthAddress, testing, contract_address_const, ContractAddress};
use core::starknet::{EthAddress, testing, contract_address_const, ContractAddress};
fn ZERO() -> ContractAddress {
contract_address_const::<0>()
}
Expand Down
8 changes: 4 additions & 4 deletions crates/contracts/src/uninitialized_account.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
//! the contracts deployed by Kakarot, thus enforcing a unique and consistent address mapping Eth
//! Address <=> Starknet Address

use starknet::ClassHash;
use starknet::{ContractAddress, EthAddress};
use core::starknet::ClassHash;
use core::starknet::{ContractAddress, EthAddress};

#[starknet::interface]
trait IAccount<TContractState> {
Expand All @@ -21,8 +21,8 @@ trait IAccount<TContractState> {
pub mod UninitializedAccount {
use contracts::kakarot_core::interface::{IKakarotCoreDispatcher, IKakarotCoreDispatcherTrait};
use core::starknet::SyscallResultTrait;
use starknet::syscalls::replace_class_syscall;
use starknet::{ContractAddress, EthAddress, ClassHash, get_caller_address};
use core::starknet::syscalls::replace_class_syscall;
use core::starknet::{ContractAddress, EthAddress, ClassHash, get_caller_address};
use super::{IAccountLibraryDispatcher, IAccountDispatcherTrait};

#[storage]
Expand Down
8 changes: 5 additions & 3 deletions crates/contracts/tests/test_eoa.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,11 @@ use evm::test_utils::{
tx_gas_limit, gas_price, VMBuilderTrait
};
use openzeppelin::token::erc20::interface::IERC20CamelDispatcherTrait;
use starknet::class_hash::Felt252TryIntoClassHash;
use starknet::testing::{set_caller_address, set_contract_address, set_signature, set_chain_id};
use starknet::{
use core::starknet::class_hash::Felt252TryIntoClassHash;
use core::starknet::testing::{
set_caller_address, set_contract_address, set_signature, set_chain_id
};
use core::starknet::{
deploy_syscall, ContractAddress, ClassHash, VALIDATED, get_contract_address,
contract_address_const, EthAddress, eth_signature::{Signature}, get_tx_info
};
Expand Down
2 changes: 1 addition & 1 deletion crates/contracts/tests/test_kakarot_core.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ use core::traits::TryInto;
use evm::model::{Address};
use evm::test_utils::{sequencer_evm_address, chain_id};
use evm::test_utils;
use starknet::{testing, contract_address_const, ContractAddress, EthAddress, ClassHash};
use core::starknet::{testing, contract_address_const, ContractAddress, EthAddress, ClassHash};
use utils::eth_transaction::{EthereumTransaction, EthereumTransactionTrait, LegacyTransaction};
use utils::helpers::{EthAddressExTrait, u256_to_bytes_array};

Expand Down
4 changes: 2 additions & 2 deletions crates/contracts/tests/test_ownable.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ use core::num::traits::Zero;


use ownable_component::{InternalImpl, OwnableImpl};
use starknet::ContractAddress;
use starknet::testing;
use core::starknet::ContractAddress;
use core::starknet::testing;


#[starknet::contract]
Expand Down
2 changes: 1 addition & 1 deletion crates/contracts/tests/test_upgradeable.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use contracts::components::upgradeable::{IUpgradeableDispatcher, IUpgradeableDis
use contracts::components::upgradeable::{upgradeable_component};
use contracts::test_utils;
use core::serde::Serde;
use starknet::{deploy_syscall, ClassHash, ContractAddress, testing};
use core::starknet::{deploy_syscall, ClassHash, ContractAddress, testing};

use upgradeable_component::{UpgradeableImpl};

Expand Down
8 changes: 4 additions & 4 deletions crates/evm/src/backend/starknet_backend.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use evm::errors::{ensure, EVMError, EOA_EXISTS};
use evm::model::{Address, AddressTrait, Environment, Account, AccountTrait};
use evm::state::{State, StateTrait};
use openzeppelin::token::erc20::interface::{IERC20CamelDispatcher, IERC20CamelDispatcherTrait};
use starknet::{
use core::starknet::{
EthAddress, get_contract_address, deploy_syscall, get_tx_info, get_block_info,
SyscallResultTrait
};
Expand Down Expand Up @@ -129,8 +129,8 @@ mod internals {
use evm::model::account::{Account, AccountTrait};
use evm::model::{Address, AddressTrait, Transfer};
use openzeppelin::token::erc20::interface::{IERC20CamelDispatcher, IERC20CamelDispatcherTrait};
use starknet::SyscallResultTrait;
use starknet::syscalls::{emit_event_syscall};
use core::starknet::SyscallResultTrait;
use core::starknet::syscalls::{emit_event_syscall};
use super::{State, StateTrait, deploy};
use utils::constants::BURN_ADDRESS;
use utils::set::{Set, SetTrait};
Expand Down Expand Up @@ -282,7 +282,7 @@ mod tests {
use evm::errors::EVMErrorTrait;
use evm::test_utils::{chain_id, evm_address, VMBuilderTrait};
use openzeppelin::token::erc20::interface::IERC20CamelDispatcherTrait;
use starknet::testing::{set_contract_address, set_chain_id};
use core::starknet::testing::{set_contract_address, set_chain_id};


#[test]
Expand Down
2 changes: 1 addition & 1 deletion crates/evm/src/call_helpers.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use evm::model::vm::{VM, VMTrait};
use evm::model::{Transfer, Address, Message};
use evm::stack::StackTrait;
use evm::state::StateTrait;
use starknet::{EthAddress, get_contract_address};
use core::starknet::{EthAddress, get_contract_address};
use utils::constants;
use utils::helpers::compute_starknet_address;
use utils::set::SetTrait;
Expand Down
6 changes: 3 additions & 3 deletions crates/evm/src/create_helpers.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ use evm::model::{ExecutionResult, ExecutionResultTrait, ExecutionSummary, Enviro
use evm::model::{Message, Address, Transfer};
use evm::stack::StackTrait;
use evm::state::StateTrait;
use keccak::cairo_keccak;
use starknet::{EthAddress, get_tx_info};
use core::keccak::cairo_keccak;
use core::starknet::{EthAddress, get_tx_info};
use utils::address::{compute_contract_address, compute_create2_contract_address};
use utils::constants;
use utils::helpers::ArrayExtTrait;
Expand Down Expand Up @@ -179,7 +179,7 @@ mod tests {
use contracts::test_data::counter_evm_bytecode;
use evm::create_helpers::CreateHelpers;
use evm::test_utils::{VMBuilderTrait};
use starknet::EthAddress;
use core::starknet::EthAddress;
use utils::address::{compute_contract_address, compute_create2_contract_address};
//TODO: test create helpers

Expand Down
4 changes: 2 additions & 2 deletions crates/evm/src/gas.cairo
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use core::cmp::min;
use starknet::EthAddress;
use core::starknet::EthAddress;
use utils::eth_transaction::{AccessListItem, EthereumTransaction, EthereumTransactionTrait};
use utils::helpers;

Expand Down Expand Up @@ -242,7 +242,7 @@ mod tests {
ACCESS_LIST_STORAGE_KEY
};
use evm::test_utils::evm_address;
use starknet::EthAddress;
use core::starknet::EthAddress;
use utils::eth_transaction::{
EthereumTransaction, LegacyTransaction, AccessListTransaction, EthereumTransactionTrait,
AccessListItem
Expand Down
6 changes: 3 additions & 3 deletions crates/evm/src/instructions/block_information.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ use evm::stack::StackTrait;
use evm::state::StateTrait;

// Corelib imports
use starknet::info::get_block_number;
use starknet::{get_block_hash_syscall, EthAddress};
use core::starknet::info::get_block_number;
use core::starknet::{get_block_hash_syscall, EthAddress};

use utils::helpers::ResultExTrait;
use utils::traits::{EthAddressTryIntoResultContractAddress, EthAddressIntoU256};
Expand Down Expand Up @@ -142,7 +142,7 @@ mod tests {
use evm::stack::StackTrait;
use evm::test_utils::{evm_address, VMBuilderTrait, tx_gas_limit, gas_price};
use openzeppelin::token::erc20::interface::IERC20CamelDispatcherTrait;
use starknet::testing::{
use core::starknet::testing::{
set_block_timestamp, set_block_number, set_block_hash, set_contract_address,
set_sequencer_address, ContractAddress
};
Expand Down
8 changes: 5 additions & 3 deletions crates/evm/src/instructions/environmental_information.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,11 @@ use evm::model::vm::{VM, VMTrait};
use evm::model::{AddressTrait};
use evm::stack::StackTrait;
use evm::state::StateTrait;
use keccak::cairo_keccak;
use core::keccak::cairo_keccak;
use openzeppelin::token::erc20::interface::{IERC20CamelDispatcher, IERC20CamelDispatcherTrait};
use starknet::{Store, storage_base_address_from_felt252, ContractAddress, get_contract_address};
use core::starknet::{
Store, storage_base_address_from_felt252, ContractAddress, get_contract_address
};
use utils::constants::EMPTY_KECCAK;
use utils::helpers::ResultExTrait;
use utils::helpers::{ceil32, load_word, U256Trait, U8SpanExTrait};
Expand Down Expand Up @@ -340,7 +342,7 @@ mod tests {
};
use openzeppelin::token::erc20::interface::IERC20CamelDispatcherTrait;

use starknet::testing::set_contract_address;
use core::starknet::testing::set_contract_address;
use utils::helpers::{u256_to_bytes_array, ArrayExtTrait};
use utils::traits::{EthAddressIntoU256};

Expand Down
4 changes: 2 additions & 2 deletions crates/evm/src/instructions/memory_operations.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use evm::model::vm::{VM, VMTrait};
use evm::model::{AddressTrait};
use evm::stack::StackTrait;
use evm::state::{StateTrait, compute_state_key};
use starknet::{storage_base_address_from_felt252, Store};
use core::starknet::{storage_base_address_from_felt252, Store};
use utils::helpers::U256Trait;
use utils::set::SetTrait;

Expand Down Expand Up @@ -262,7 +262,7 @@ mod tests {
use evm::stack::StackTrait;
use evm::state::{StateTrait, compute_storage_address};
use evm::test_utils::{evm_address, VMBuilderTrait};
use starknet::get_contract_address;
use core::starknet::get_contract_address;

#[test]
fn test_pc_basic() {
Expand Down
2 changes: 1 addition & 1 deletion crates/evm/src/instructions/sha3.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use evm::gas;
use evm::memory::MemoryTrait;
use evm::model::vm::{VM, VMTrait};
use evm::stack::StackTrait;
use keccak::{cairo_keccak, u128_split};
use core::keccak::{cairo_keccak, u128_split};
use utils::helpers::{ArrayExtTrait, U256Trait, ceil32};

#[generate_trait]
Expand Down
4 changes: 2 additions & 2 deletions crates/evm/src/instructions/system_operations.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -431,8 +431,8 @@ mod tests {
other_evm_address,
};
use openzeppelin::token::erc20::interface::{IERC20CamelDispatcher, IERC20CamelDispatcherTrait};
use starknet::EthAddress;
use starknet::testing::set_contract_address;
use core::starknet::EthAddress;
use core::starknet::testing::set_contract_address;
use utils::helpers::load_word;
use utils::traits::{EthAddressIntoU256};

Expand Down
2 changes: 1 addition & 1 deletion crates/evm/src/interpreter.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ use evm::model::{
use evm::precompiles::Precompiles;
use evm::stack::{Stack, StackTrait};
use evm::state::{State, StateTrait};
use starknet::{EthAddress, ContractAddress};
use core::starknet::{EthAddress, ContractAddress};
use utils::constants;
use utils::helpers::{U256Trait, compute_starknet_address, EthAddressExTrait};

Expand Down
4 changes: 2 additions & 2 deletions crates/evm/src/model.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use core::num::traits::{CheckedAdd, CheckedSub, CheckedMul};
use evm::errors::{EVMError, CONTRACT_SYSCALL_FAILED};
use evm::model::account::{Account, AccountTrait};
use evm::state::State;
use starknet::{EthAddress, get_contract_address, ContractAddress};
use core::starknet::{EthAddress, get_contract_address, ContractAddress};
use utils::fmt::{TSpanSetDebug};
use utils::helpers::{ResultExTrait};
use utils::set::{Set, SpanSet};
Expand Down Expand Up @@ -168,7 +168,7 @@ mod tests {
use evm::state::{State, StateChangeLog, StateChangeLogTrait};
use evm::test_utils::{evm_address};
use openzeppelin::token::erc20::interface::IERC20CamelDispatcherTrait;
use starknet::testing::set_contract_address;
use core::starknet::testing::set_contract_address;

#[test]
fn test_is_deployed_eoa_exists() {
Expand Down
2 changes: 1 addition & 1 deletion crates/evm/src/model/account.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use evm::model::{Address, AddressTrait, Transfer};
use evm::state::State;
use evm::state::StateTrait;
use openzeppelin::token::erc20::interface::{IERC20CamelDispatcher, IERC20CamelDispatcherTrait};
use starknet::{
use core::starknet::{
ContractAddress, EthAddress, get_contract_address, deploy_syscall, get_tx_info,
SyscallResultTrait
};
Expand Down
2 changes: 1 addition & 1 deletion crates/evm/src/model/vm.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use evm::errors::{EVMError, ensure};
use evm::memory::{Memory, MemoryTrait};
use evm::model::{Message, Environment, ExecutionResult, AccountTrait};
use evm::stack::{Stack, StackTrait};
use starknet::EthAddress;
use core::starknet::EthAddress;
use utils::helpers::{SpanExtTrait, ArrayExtTrait};
use utils::set::{Set, SetTrait, SpanSet};
use utils::traits::{SpanDefault};
Expand Down
2 changes: 1 addition & 1 deletion crates/evm/src/precompiles.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use evm::precompiles::identity::Identity;
use evm::precompiles::modexp::ModExp;
use evm::precompiles::p256verify::P256Verify;
use evm::precompiles::sha256::Sha256;
use starknet::EthAddress;
use core::starknet::EthAddress;


trait Precompile {
Expand Down
4 changes: 2 additions & 2 deletions crates/evm/src/precompiles/blake2f.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use core::option::OptionTrait;
use evm::errors::{EVMError, ensure};
use evm::model::vm::{VM, VMTrait};
use evm::precompiles::Precompile;
use starknet::EthAddress;
use core::starknet::EthAddress;
use utils::crypto::blake2_compress::compress;
use utils::helpers::{FromBytes, ToBytes};

Expand Down Expand Up @@ -100,7 +100,7 @@ mod tests {
blake2_precompile_pass_0_test_case, blake2_precompile_pass_2_test_case
};
use evm::test_utils::{VMBuilderTrait, native_token, other_starknet_address};
use starknet::testing::set_contract_address;
use core::starknet::testing::set_contract_address;
use utils::helpers::FromBytes;

#[test]
Expand Down
2 changes: 1 addition & 1 deletion crates/evm/src/precompiles/ec_recover.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use evm::model::vm::VM;
use evm::model::vm::VMTrait;
use evm::precompiles::Precompile;
use evm::stack::StackTrait;
use starknet::{
use core::starknet::{
EthAddress, eth_signature::{recover_public_key, public_key_point_to_eth_address, Signature},
secp256k1::{Secp256k1Point}
};
Expand Down
Loading

0 comments on commit 7318577

Please sign in to comment.