Skip to content

Commit

Permalink
fix: common test utils (#795)
Browse files Browse the repository at this point in the history
adapt structure

refactor: test organization
  • Loading branch information
enitrat committed May 27, 2024
1 parent e004fcc commit f6ffa5f
Show file tree
Hide file tree
Showing 65 changed files with 410 additions and 429 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.4
starknet-foundry 0.12.0
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
7 changes: 5 additions & 2 deletions crates/contracts/src/lib.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,11 @@ mod errors;
// Kakarot smart contract
mod kakarot_core;

#[cfg(test)]
mod tests;
#[cfg(target: 'test')]
mod test_data;

#[cfg(target: 'test')]
mod test_utils;

// Account transparent proxy
mod uninitialized_account;
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use core::result::ResultTrait;
use evm::backend::starknet_backend;
use evm::model::{Address};

use evm::tests::test_utils::{ca_address, other_starknet_address, chain_id, sequencer_evm_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::{
Expand Down
331 changes: 0 additions & 331 deletions crates/contracts/src/tests/test_eoa.cairo

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
mod test_cairo1_helpers;
mod test_contract_account;

mod test_data;

mod test_eoa;

Expand All @@ -10,5 +9,3 @@ mod test_kakarot_core;
mod test_ownable;

mod test_upgradeable;

mod test_utils;
Loading

0 comments on commit f6ffa5f

Please sign in to comment.