Skip to content

Commit

Permalink
dev: work on comments from fred
Browse files Browse the repository at this point in the history
  • Loading branch information
Harsh Bajpai authored and Harsh Bajpai committed Sep 13, 2023
1 parent 423cb6f commit 23ac17d
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
8 changes: 4 additions & 4 deletions crates/hive-utils/src/hive/genesis.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ pub struct HiveGenesisConfig {

impl HiveGenesisConfig {
pub fn from_file(path: &str) -> Result<Self> {
let hive_genesis_file = File::open(path).unwrap();
Ok(serde_json::from_reader(hive_genesis_file).unwrap())
let hive_genesis_file = File::open(path)?;
Ok(serde_json::from_reader(hive_genesis_file)?)
}
}

Expand Down Expand Up @@ -226,8 +226,8 @@ pub async fn serialize_hive_to_madara_genesis_config(
});

let combined_genesis_file =
File::options().create_new(true).write(true).append(true).open(combined_genesis_path).unwrap();
// Serialize the loader to a string and then write to a file
File::options().create_new(true).write(true).append(false).open(combined_genesis_path).unwrap();
// Serialize the loader to a file
serde_json::to_writer_pretty(combined_genesis_file, &madara_loader)?;

Ok(())
Expand Down
15 changes: 12 additions & 3 deletions crates/test-utils/src/bin/dump-katana.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use std::collections::HashMap;
use std::fs::File;
use std::path::PathBuf;

Check failure on line 3 in crates/test-utils/src/bin/dump-katana.rs

View workflow job for this annotation

GitHub Actions / Linters / clippy

unused import: `std::path::PathBuf`

use ethers::abi::Token;
use git2::{Repository, SubmoduleIgnore};
Expand Down Expand Up @@ -38,9 +39,17 @@ async fn main() {

// Dump the state
std::fs::create_dir_all(".katana/").expect("Failed to create Kakata dump dir");
let katana_dump_file =
File::options().create_new(true).read(true).write(true).append(true).open(".katana/dump.json").unwrap();
serde_json::to_writer(katana_dump_file, &dump_state);

let katana_dump_path = String::from(".katana/dump.json");
let katana_dump_file = File::options()
.create_new(true)
.read(true)
.write(true)
.append(false)
.open(katana_dump_path)
.expect(format!("Failed to open file {}", katana_dump_path));

Check failure on line 50 in crates/test-utils/src/bin/dump-katana.rs

View workflow job for this annotation

GitHub Actions / Linters / clippy

mismatched types
serde_json::to_writer_pretty(katana_dump_file, &dump_state)
.expect(format!("Failed to write to the file {}", katana_dump_path));

Check failure on line 52 in crates/test-utils/src/bin/dump-katana.rs

View workflow job for this annotation

GitHub Actions / Linters / clippy

mismatched types

let deployer_account = DeployerAccount {
address: test_context.client().deployer_account().address(),
Expand Down

0 comments on commit 23ac17d

Please sign in to comment.