From 370aa986eeb08a8bf9e30d6df71104447e36ff7b Mon Sep 17 00:00:00 2001 From: Roman Petriv Date: Mon, 30 Oct 2023 22:53:08 +0200 Subject: [PATCH] fix: lint --- src/node/in_memory.rs | 22 ++++++++++++---------- src/testing.rs | 13 ++++--------- 2 files changed, 16 insertions(+), 19 deletions(-) diff --git a/src/node/in_memory.rs b/src/node/in_memory.rs index 94fe1bbf..d8576f0d 100644 --- a/src/node/in_memory.rs +++ b/src/node/in_memory.rs @@ -1464,7 +1464,7 @@ impl InMemoryNode { return Err(e); } }; - + tracing::info!(""); tracing::info!("Executing {}", format!("{:?}", tx_hash).bold()); @@ -1683,11 +1683,7 @@ impl BlockContext { #[cfg(test)] mod tests { use super::*; - use crate::{ - testing, - http_fork_source::HttpForkSource, - node::InMemoryNode, - }; + use crate::{http_fork_source::HttpForkSource, node::InMemoryNode, testing}; #[tokio::test] async fn test_run_l2_tx_validates_tx_gas_limit_too_high() { @@ -1698,7 +1694,7 @@ mod tests { node.set_rich_account(tx.common_data.initiator_address); let result = node.run_l2_tx(tx, TxExecutionMode::VerifyExecute); - + assert_eq!(result.err(), Some("exceeds block gas limit".into())); } @@ -1711,8 +1707,11 @@ mod tests { node.set_rich_account(tx.common_data.initiator_address); let result = node.run_l2_tx(tx, TxExecutionMode::VerifyExecute); - - assert_eq!(result.err(), Some("block base fee higher than max fee per gas".into())); + + assert_eq!( + result.err(), + Some("block base fee higher than max fee per gas".into()) + ); } #[tokio::test] @@ -1725,6 +1724,9 @@ mod tests { let result = node.run_l2_tx(tx, TxExecutionMode::VerifyExecute); - assert_eq!(result.err(), Some("max priority fee per gas higher than max fee per gas".into())); + assert_eq!( + result.err(), + Some("max priority fee per gas higher than max fee per gas".into()) + ); } } diff --git a/src/testing.rs b/src/testing.rs index f67e3073..07346be5 100644 --- a/src/testing.rs +++ b/src/testing.rs @@ -19,10 +19,7 @@ use multivm::interface::{ExecutionResult, VmExecutionResultAndLogs}; use std::str::FromStr; use zksync_basic_types::{H160, U64}; use zksync_types::api::{BridgeAddresses, DebugCall, DebugCallType, Log}; -use zksync_types::{ - fee::Fee, l2::L2Tx, Address, L2ChainId, Nonce, ProtocolVersionId, H256, - U256, -}; +use zksync_types::{fee::Fee, l2::L2Tx, Address, L2ChainId, Nonce, ProtocolVersionId, H256, U256}; /// Configuration for the [MockServer]'s initial block. #[derive(Default, Debug, Clone)] @@ -363,7 +360,7 @@ pub struct TransactionBuilder { from_account_private_key: H256, gas_limit: U256, max_fee_per_gas: U256, - max_priority_fee_per_gas: U256 + max_priority_fee_per_gas: U256, } impl Default for TransactionBuilder { @@ -422,7 +419,7 @@ impl TransactionBuilder { ) .unwrap(); tx.set_input(vec![], self.tx_hash); - return tx; + tx } } @@ -438,9 +435,7 @@ pub fn apply_tx( .expect("failed getting current batch number"); let produced_block_hash = compute_hash(next_miniblock, tx_hash); - let tx = TransactionBuilder::new() - .set_hash(tx_hash) - .build(); + let tx = TransactionBuilder::new().set_hash(tx_hash).build(); node.set_rich_account(tx.common_data.initiator_address); node.apply_txs(vec![tx]).expect("failed applying tx");