Skip to content

Commit

Permalink
chore: bump cairo (#794)
Browse files Browse the repository at this point in the history
* chore: bump cairo

* refactor: tests structure

* move test_utils to tests/

* refactor test utils

* fmt

* fix tests utils
  • Loading branch information
enitrat authored May 24, 2024
1 parent a2c8179 commit 8cf7aeb
Show file tree
Hide file tree
Showing 70 changed files with 720 additions and 216 deletions.
2 changes: 1 addition & 1 deletion .tool-versions
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
scarb 2.5.3
scarb 2.6.3
starknet-foundry 0.12.0
4 changes: 2 additions & 2 deletions Scarb.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ members = ["crates/*"]
[workspace.package]
description = "Kakarot is an (zk)-Ethereum Virtual Machine implementation written in Cairo."
documentation = "https://www.kakarot.org/"
cairo-version = "2.4.0"
cairo-version = "2.6.3"
version = "0.1.0"
readme = "README.md"
repository = "https://github.com/kkrt-labs/kakarot-ssj/"
license-file = "LICENSE"

[workspace.dependencies]
starknet = "2.4.0-rc6"
starknet = "2.6.3"

[workspace.tool.fmt]
sort-module-level-items = true
1 change: 1 addition & 0 deletions crates/contracts/Scarb.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ openzeppelin = { path = "../openzeppelin" }
utils = { path = "../utils" }
alexandria_storage = { path = "../alexandria_storage" }


[tool]
fmt.workspace = true

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
Expand Up @@ -165,7 +165,7 @@ pub mod KakarotCore {

let origin = Address { evm: origin, starknet: self.compute_starknet_address(origin) };

let TransactionResult{success, return_data, gas_used, state: _ } = self
let TransactionResult { success, return_data, gas_used, state: _ } = self
.process_transaction(origin, tx);

(success, return_data, gas_used)
Expand All @@ -180,7 +180,7 @@ pub mod KakarotCore {
evm: account.get_evm_address(), starknet: starknet_caller_address
};

let TransactionResult{success, return_data, gas_used, mut state } = self
let TransactionResult { success, return_data, gas_used, mut state } = self
.process_transaction(origin, tx);
starknet_backend::commit(ref state).expect('Committing state failed');
(success, return_data, gas_used)
Expand Down Expand Up @@ -323,7 +323,7 @@ pub mod KakarotCore {
loop {
match access_list.pop_front() {
Option::Some(access_list_item) => {
let AccessListItem{ethereum_address, storage_keys: _ } =
let AccessListItem { ethereum_address, storage_keys: _ } =
*access_list_item;
let storage_keys = access_list_item.to_storage_keys();

Expand Down
4 changes: 1 addition & 3 deletions crates/contracts/src/lib.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@ mod errors;

// Kakarot smart contract
mod kakarot_core;

#[cfg(test)]
mod tests;
mod test_data;

// Account transparent proxy
mod uninitialized_account;
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
mod test_cairo1_helpers;
mod test_contract_account;

mod test_data;

mod test_eoa;

mod test_kakarot_core;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
use contracts::account_contract::{AccountContract, IAccountDispatcher, IAccountDispatcherTrait};
use contracts::tests::test_data::counter_evm_bytecode;
use contracts::tests::test_utils::{setup_contracts_for_testing, deploy_contract_account};
use evm::tests::test_utils::{ca_address, native_token};
use contracts::test_data::counter_evm_bytecode;
use contracts_tests::test_utils::contracts_utils::{
setup_contracts_for_testing, deploy_contract_account
};
use contracts_tests::test_utils::evm_utils::{ca_address, native_token};

#[test]
fn test_ca_deploy() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,24 @@ mod test_external_owned_account {
IKakarotCore, KakarotCore, KakarotCore::KakarotCoreInternal,
interface::IExtendedKakarotCoreDispatcherTrait
};
use contracts::tests::test_data::{counter_evm_bytecode, eip_2930_rlp_encoded_counter_inc_tx,};
use contracts::tests::test_upgradeable::{
IMockContractUpgradeableDispatcher, IMockContractUpgradeableDispatcherTrait,
MockContractUpgradeableV1
use contracts::test_data::{counter_evm_bytecode, eip_2930_rlp_encoded_counter_inc_tx,};
use contracts_test::test_utils::evm_utils::{
kakarot_address, evm_address, other_evm_address, other_starknet_address, eoa_address,
chain_id, tx_gas_limit, gas_price, VMBuilderTrait
};
use contracts::tests::test_utils::{
use contracts_test::test_utils::evm_utils::{
setup_contracts_for_testing, deploy_eoa, deploy_contract_account, pop_log, pop_log_debug,
fund_account_with_native_token, call_transaction
};
use contracts_tests::test_upgradeable::{
IMockContractUpgradeableDispatcher, IMockContractUpgradeableDispatcherTrait,
MockContractUpgradeableV1
};
use core::array::SpanTrait;
use core::box::BoxTrait;
use core::starknet::account::{Call};

use evm::model::{Address, AddressTrait};
use evm::tests::test_utils::{
kakarot_address, evm_address, other_evm_address, other_starknet_address, eoa_address,
chain_id, 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};
Expand All @@ -36,7 +36,7 @@ mod test_external_owned_account {
};
use utils::helpers::{U8SpanExTrait, u256_to_bytes_array};
use utils::serialization::{serialize_bytes, serialize_transaction_signature};
use utils::tests::test_data::{legacy_rlp_encoded_tx, eip_2930_encoded_tx, eip_1559_encoded_tx};
use utils::test_data::{legacy_rlp_encoded_tx, eip_2930_encoded_tx, eip_1559_encoded_tx};


#[test]
Expand Down
Loading

0 comments on commit 8cf7aeb

Please sign in to comment.