Skip to content

Commit

Permalink
renaming
Browse files Browse the repository at this point in the history
  • Loading branch information
greged93 committed Sep 19, 2023
1 parent 2f7a7ca commit bba378c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 13 deletions.
17 changes: 6 additions & 11 deletions crates/ef-testing/src/models/case.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,23 +42,18 @@ async fn handle_pre_state(
) -> Result<(), RunnerError> {
let kakarot_address = kakarot.kakarot_address;

let mut starknet_state = env.sequencer().sequencer.backend.state.write().await;
let db = starknet_state
let mut starknet = env.sequencer().sequencer.backend.state.write().await;
let starknet_db = starknet
.maybe_as_cached_db()
.ok_or_else(|| RunnerError::Other("failed to get Katana database".to_string()))?;

let eoa_class_hash = get_eoa_class_hash(env, &db)?;
let eoa_class_hash = get_eoa_class_hash(env, &starknet_db)?;
let class_hashes = ClassHashes::new(
kakarot.proxy_class_hash,
eoa_class_hash,
kakarot.contract_account_class_hash,
);
write_test_state(
pre_state,
kakarot_address,
class_hashes,
&mut starknet_state,
)?;
write_test_state(pre_state, kakarot_address, class_hashes, &mut starknet)?;
Ok(())
}

Expand Down Expand Up @@ -178,10 +173,10 @@ impl BlockchainTestCase {
let starknet_contract_address =
StarknetContractAddress(Into::<StarkFelt>::into(starknet_address).try_into()?);

let db = starknet
let starknet_db = starknet
.maybe_as_cached_db()
.ok_or_else(|| RunnerError::Other("failed to get Katana database".to_string()))?;
let actual_state = db.storage.get(&starknet_contract_address);
let actual_state = starknet_db.storage.get(&starknet_contract_address);
match actual_state {
None => {
// if no state, check post state is empty
Expand Down
4 changes: 2 additions & 2 deletions crates/ef-testing/src/storage/eoa.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@ use super::{
/// Returns the class hash used for the EOA contract.
pub fn get_eoa_class_hash(
ctx: &KakarotTestEnvironmentContext,
starknet: &AsCachedDb,
starknet_db: &AsCachedDb,
) -> Result<FieldElement, RunnerError> {
let eoa = &ctx.kakarot().eoa_addresses;

let eoa_address =
StarknetContractAddress(Into::<StarkFelt>::into(eoa.starknet_address).try_into()?);

// deriving the eao class hash this way so things are always based off the katana dump file
let eoa_class_hash: FieldElement = (*starknet
let eoa_class_hash: FieldElement = (*starknet_db
.storage
.get(&eoa_address)
.ok_or_else(|| {
Expand Down

0 comments on commit bba378c

Please sign in to comment.