Skip to content

Commit

Permalink
apply suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
enitrat committed Dec 6, 2024
1 parent d4a7dbd commit ce0516b
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 47 deletions.
15 changes: 2 additions & 13 deletions crates/ef-testing/src/evm_sequencer/sequencer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ use cairo_lang_starknet_classes::casm_contract_class::CasmContractClass;
use cairo_vm::types::errors::program_errors::ProgramError;
use sequencer::{sequencer::Sequencer, state::State};
use starknet::core::types::contract::{legacy::LegacyContractClass, CompiledClass};
use starknet_api::block::{BlockInfo, GasPriceVector, GasPrices};
use starknet_api::block::BlockInfo;
use starknet_api::{
block::{BlockNumber, BlockTimestamp},
core::{ChainId, ClassHash, ContractAddress},
Expand Down Expand Up @@ -109,18 +109,7 @@ impl KakarotSequencer {
)
.try_into()
.expect("Failed to convert to ContractAddress"),
gas_prices: GasPrices {
eth_gas_prices: GasPriceVector {
l1_gas_price: Default::default(),
l1_data_gas_price: Default::default(),
l2_gas_price: Default::default(),
},
strk_gas_prices: GasPriceVector {
l1_gas_price: Default::default(),
l1_data_gas_price: Default::default(),
l2_gas_price: Default::default(),
},
},
gas_prices: Default::default(),
use_kzg_da: false,
};

Expand Down
3 changes: 2 additions & 1 deletion crates/ef-testing/src/test_utils/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ pub fn setup() {
}

pub struct TestMonitor {
thresholds: Vec<u64>, // thresholds in seconds
/// thresholds in seconds
thresholds: Vec<u64>,
}

impl TestMonitor {
Expand Down
17 changes: 5 additions & 12 deletions crates/sequencer/src/native.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,14 @@ lazy_static! {
}

fn generate_library_path(class_hash: ClassHash) -> PathBuf {
let mut path = NATIVE_CACHE_DIR.clone();
path.push(class_hash.to_string().trim_start_matches("0x"));
path
NATIVE_CACHE_DIR.join(class_hash.to_string().trim_start_matches("0x"))
}

fn setup_native_cache_dir() -> PathBuf {
let path: PathBuf = match std::env::var("NATIVE_CACHE_DIR") {
Ok(path) => path.into(),
Err(_err) => {
let mut path = std::env::current_dir().unwrap();
path.push("native_cache");
path
}
};
let _ = fs::create_dir_all(&path);
let path = std::env::var("NATIVE_CACHE_DIR")
.map(PathBuf::from)
.unwrap_or_else(|_| std::env::current_dir().unwrap().join("native_cache"));
fs::create_dir_all(&path).ok();
path
}

Expand Down
22 changes: 5 additions & 17 deletions crates/sequencer/src/sequencer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,13 +132,13 @@ mod tests {
use starknet::core::types::Felt;
use starknet::macros::selector;
use starknet_api::abi::abi_utils::get_storage_var_address;
use starknet_api::block::{BlockInfo, GasPriceVector, GasPrices};
use starknet_api::block::BlockInfo;
use starknet_api::block::{BlockNumber, BlockTimestamp};
use starknet_api::core::{ChainId, ClassHash, ContractAddress, Nonce};
use starknet_api::core::{ChainId, ClassHash, ContractAddress};
use starknet_api::executable_transaction::{
AccountTransaction as AccountTransactionEnum, InvokeTransaction,
};
use starknet_api::transaction::fields::{Calldata, Fee, TransactionSignature};
use starknet_api::transaction::fields::{Calldata, Fee};
use starknet_api::transaction::{
InvokeTransaction as InvokeTransactionTypes, InvokeTransactionV1,
};
Expand Down Expand Up @@ -260,18 +260,7 @@ mod tests {
block_number: BlockNumber(1),
block_timestamp: BlockTimestamp(1),
sequencer_address: *SEQUENCER_ADDRESS,
gas_prices: GasPrices {
eth_gas_prices: GasPriceVector {
l1_gas_price: Default::default(),
l1_data_gas_price: Default::default(),
l2_gas_price: Default::default(),
},
strk_gas_prices: GasPriceVector {
l1_gas_price: Default::default(),
l1_data_gas_price: Default::default(),
l2_gas_price: Default::default(),
},
},
gas_prices: Default::default(),
use_kzg_da: false,
};

Expand Down Expand Up @@ -304,8 +293,7 @@ mod tests {
.into(),
),
max_fee: Fee(1_000_000),
signature: TransactionSignature(vec![]),
nonce: Nonce(Felt::ZERO),
..Default::default()
};
let transaction = InvokeTransaction::create(
InvokeTransactionTypes::V1(invoke_tx),
Expand Down
5 changes: 1 addition & 4 deletions crates/sequencer/src/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -247,10 +247,7 @@ mod tests {

// When
state
.set_contract_class(
ClassHash(Felt::ONE),
RunnableCompiledClass::V0(CompiledClassV0::default()),
)
.set_contract_class(ClassHash(Felt::ONE), CompiledClassV0::default().into())
.unwrap();

// Then
Expand Down

0 comments on commit ce0516b

Please sign in to comment.