Skip to content

Commit

Permalink
fix: lint
Browse files Browse the repository at this point in the history
  • Loading branch information
Romsters committed Oct 30, 2023
1 parent dfcb5cd commit 370aa98
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 19 deletions.
22 changes: 12 additions & 10 deletions src/node/in_memory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1464,7 +1464,7 @@ impl<S: ForkSource + std::fmt::Debug + Clone> InMemoryNode<S> {
return Err(e);
}
};

tracing::info!("");
tracing::info!("Executing {}", format!("{:?}", tx_hash).bold());

Expand Down Expand Up @@ -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() {
Expand All @@ -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()));
}

Expand All @@ -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]
Expand All @@ -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())
);
}
}
13 changes: 4 additions & 9 deletions src/testing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -422,7 +419,7 @@ impl TransactionBuilder {
)
.unwrap();
tx.set_input(vec![], self.tx_hash);
return tx;
tx
}
}

Expand All @@ -438,9 +435,7 @@ pub fn apply_tx<T: ForkSource + std::fmt::Debug + Clone>(
.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");

Expand Down

0 comments on commit 370aa98

Please sign in to comment.