Skip to content

Commit

Permalink
fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
kariy committed Sep 23, 2024
1 parent 4c3fd65 commit 16913d4
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 17 deletions.
6 changes: 1 addition & 5 deletions crates/katana/executor/tests/executor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,7 @@ fn test_executor_with_valid_blocks_impl<EF: ExecutorFactory>(

// ensure that all transactions succeeded, if not panic with the error message and tx index
let has_failed = transactions.iter().enumerate().find_map(|(i, (_, res))| {
if let ExecutionResult::Failed { error } = res {
Some((i, error))
} else {
None
}
if let ExecutionResult::Failed { error } = res { Some((i, error)) } else { None }
});

if let Some((pos, error)) = has_failed {
Expand Down
17 changes: 9 additions & 8 deletions crates/katana/primitives/src/genesis/json.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1215,10 +1215,12 @@ mod tests {
fn genesis_from_json_with_unresolved_paths() {
let file = File::open("./src/genesis/test-genesis.json").unwrap();
let json: GenesisJson = serde_json::from_reader(file).unwrap();
assert!(Genesis::try_from(json)
.unwrap_err()
.to_string()
.contains("Unresolved class artifact path"));
assert!(
Genesis::try_from(json)
.unwrap_err()
.to_string()
.contains("Unresolved class artifact path")
);
}

#[test]
Expand Down Expand Up @@ -1262,9 +1264,8 @@ mod tests {
.expect("failed to load genesis file");

let res = Genesis::try_from(json);
assert!(res
.unwrap_err()
.to_string()
.contains(&format!("Class name '{name}' already exists")))
assert!(
res.unwrap_err().to_string().contains(&format!("Class name '{name}' already exists"))
)
}
}
3 changes: 2 additions & 1 deletion crates/katana/primitives/src/genesis/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,8 @@ impl Default for Genesis {

#[cfg(test)]
mod tests {
use std::{collections::HashMap, str::FromStr};
use std::collections::HashMap;
use std::str::FromStr;

use allocation::GenesisAccount;
use starknet::macros::felt;
Expand Down
6 changes: 3 additions & 3 deletions crates/katana/primitives/src/state.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use std::collections::BTreeMap;
use std::collections::BTreeSet;
use std::collections::{BTreeMap, BTreeSet};

use crate::class::{ClassHash, CompiledClass, CompiledClassHash, FlattenedSierraClass};
use crate::contract::{ContractAddress, Nonce, StorageKey, StorageValue};
Expand All @@ -20,7 +19,8 @@ pub struct StateUpdates {
pub declared_classes: BTreeMap<ClassHash, CompiledClassHash>,
/// A mapping of newly declared legacy class hashes.
pub deprecated_declared_classes: BTreeSet<ClassHash>,
/// A mapping of replaced contract addresses to their new class hashes ie using `replace_class` syscall.
/// A mapping of replaced contract addresses to their new class hashes ie using `replace_class`
/// syscall.
pub replaced_classes: BTreeMap<ContractAddress, ClassHash>,
}

Expand Down

0 comments on commit 16913d4

Please sign in to comment.