From fbb538ec9b773609a783ca8fc7484950e0d06911 Mon Sep 17 00:00:00 2001 From: Fabricio Robles Date: Sat, 4 May 2024 20:11:56 -0600 Subject: [PATCH] clippy and fmt --- crates/katana/rpc/rpc/tests/starknet.rs | 18 ++++++++++-------- crates/katana/runner/src/lib.rs | 23 +++++++++++------------ 2 files changed, 21 insertions(+), 20 deletions(-) diff --git a/crates/katana/rpc/rpc/tests/starknet.rs b/crates/katana/rpc/rpc/tests/starknet.rs index 3b568f2897..1935db28c8 100644 --- a/crates/katana/rpc/rpc/tests/starknet.rs +++ b/crates/katana/rpc/rpc/tests/starknet.rs @@ -5,12 +5,14 @@ use std::str::FromStr; use std::sync::Arc; use std::time::Duration; +use alloy::primitives::{Address, Uint, U256}; +use alloy::sol; use cainome::cairo_serde::EthAddress; use cainome::rs::abigen; - use dojo_test_utils::sequencer::{get_default_test_starknet_config, TestSequencer}; use dojo_world::utils::TransactionWaiter; use katana_core::sequencer::SequencerConfig; +use katana_runner::{AnvilRunner, KatanaRunner, KatanaRunnerConfig}; use serde_json::json; use starknet::accounts::{Account, Call, ConnectedAccount}; use starknet::contract::ContractFactory; @@ -24,10 +26,6 @@ use starknet::macros::felt; use starknet::providers::Provider; use tempfile::tempdir; -use alloy::primitives::{Address, Uint, U256}; -use alloy::sol; -use katana_runner::{AnvilRunner, KatanaRunner, KatanaRunnerConfig}; - mod common; const WAIT_TX_DELAY_MILLIS: u64 = 1000; @@ -203,7 +201,11 @@ sol!( "tests/test_data/solidity/Contract1Compiled.json" ); -abigen!(CairoMessagingContract, "/Users/fabrobles/Fab/dojo_fork/crates/katana/rpc/rpc/tests/test_data/cairo_l1_msg_contract.json"); +abigen!( + CairoMessagingContract, + "/Users/fabrobles/Fab/dojo_fork/crates/katana/rpc/rpc/tests/test_data/cairo_l1_msg_contract.\ + json" +); #[tokio::test(flavor = "multi_thread")] async fn test_messaging_l1_l2() { @@ -354,7 +356,7 @@ async fn test_messaging_l1_l2() { let tx = cairo_messaging_contract .send_message_value( &EthAddress::from( - FieldElement::from_str(&contract_c1.address().to_string().as_str()).unwrap(), + FieldElement::from_str(contract_c1.address().to_string().as_str()).unwrap(), ), &FieldElement::from(2u8), ) @@ -376,7 +378,7 @@ async fn test_messaging_l1_l2() { .gas(12000000) .nonce(4); - //Wait for the message to reach L1 + // Wait for the message to reach L1 tokio::time::sleep(Duration::from_millis(8000)).await; let tx_receipt = builder.send().await.unwrap().get_receipt().await.unwrap(); diff --git a/crates/katana/runner/src/lib.rs b/crates/katana/runner/src/lib.rs index 1c0e16fa58..b695fe558c 100644 --- a/crates/katana/runner/src/lib.rs +++ b/crates/katana/runner/src/lib.rs @@ -9,8 +9,18 @@ use std::sync::mpsc::{self}; use std::thread; use std::time::Duration; +use alloy::network::{Ethereum, EthereumSigner}; +use alloy::primitives::Address; +use alloy::providers::fillers::{ + ChainIdFiller, FillProvider, GasFiller, JoinFill, NonceFiller, SignerFiller, +}; +use alloy::providers::{Identity, ProviderBuilder, RootProvider}; +use alloy::signers::wallet::LocalWallet; +use alloy::transports::http::Http; use anyhow::{Context, Result}; use assert_fs::TempDir; +use hyper::http::request; +use hyper::{Client as HyperClient, Response, StatusCode}; use katana_primitives::contract::ContractAddress; use katana_primitives::genesis::allocation::{DevAllocationsGenerator, DevGenesisAccount}; use katana_primitives::FieldElement; @@ -23,17 +33,6 @@ use tokio::time; use url::Url; use utils::find_free_port; -use alloy::network::{Ethereum, EthereumSigner}; -use alloy::primitives::Address; -use alloy::providers::fillers::{ - ChainIdFiller, FillProvider, GasFiller, JoinFill, NonceFiller, SignerFiller, -}; -use alloy::providers::{Identity, ProviderBuilder, RootProvider}; -use alloy::signers::wallet::LocalWallet; -use alloy::transports::http::Http; -use hyper::http::request; -use hyper::{Client as HyperClient, Response, StatusCode}; - #[derive(Debug)] pub struct KatanaRunner { child: Child, @@ -115,7 +114,7 @@ impl KatanaRunner { } if let Some(messaging_file) = config.messaging { - command.args(["--messaging", &format!("{}", messaging_file)]); + command.args(["--messaging", messaging_file.as_str()]); } let mut child =