Skip to content

Commit

Permalink
chore: linting, fix formatting. Remove uneeded colorize
Browse files Browse the repository at this point in the history
  • Loading branch information
dutterbutter committed Feb 10, 2025
1 parent 85d5c9e commit 5508301
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 14 deletions.
5 changes: 3 additions & 2 deletions crates/api_server/src/impls/anvil.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use crate::error::RpcError;
use anvil_zksync_api_decl::AnvilNamespaceServer;
use anvil_zksync_common::sh_warn;
use anvil_zksync_core::node::InMemoryNode;
use anvil_zksync_types::api::{DetailedTransaction, ResetRequest};
use anvil_zksync_types::Numeric;
Expand Down Expand Up @@ -101,7 +100,9 @@ impl AnvilNamespaceServer for AnvilNamespace {
}

async fn set_min_gas_price(&self, _gas: U256) -> RpcResult<()> {
sh_warn!("Setting minimum gas price is unsupported as ZKsync is a post-EIP1559 chain");
tracing::info!(
"Setting minimum gas price is unsupported as ZKsync is a post-EIP1559 chain"
);
Err(RpcError::Unsupported.into())
}

Expand Down
1 change: 0 additions & 1 deletion crates/common/src/shell.rs
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,6 @@ macro_rules! sh_err {
mod tests {
#[test]
fn test_shell_macros() {
// These calls use the global shell instance.
sh_print!("Hello, ");
sh_println!("world!");
sh_eprint!("Error: ");
Expand Down
3 changes: 1 addition & 2 deletions crates/core/src/formatter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -826,13 +826,12 @@ pub fn print_transaction_summary(
tx_result: &VmExecutionResultAndLogs,
status: &str,
) {
// Calculate used and refunded gas.
// Calculate used and refunded gas
let used_gas = tx.gas_limit() - tx_result.refunds.gas_refunded;
let paid_in_eth = calculate_eth_cost(l2_gas_price, used_gas.as_u64());
let refunded_gas = tx_result.refunds.gas_refunded;
let refunded_in_eth = calculate_eth_cost(l2_gas_price, refunded_gas);

// Select an emoji based on the status.
let emoji = match status {
"SUCCESS" => "✅",
"FAILED" => "❌",
Expand Down
5 changes: 2 additions & 3 deletions crates/core/src/node/eth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ use std::collections::HashSet;

use anvil_zksync_common::{sh_eprintln, sh_err};
use anyhow::Context as _;
use colored::Colorize;
use zksync_multivm::interface::ExecutionResult;
use zksync_multivm::vm_latest::constants::ETH_CALL_GAS_LIMIT;
use zksync_types::h256_to_u256;
Expand Down Expand Up @@ -56,7 +55,7 @@ impl InMemoryNode {
message
);

sh_eprintln!("\n{}", pretty_message.on_red());
sh_eprintln!("\n{}", pretty_message);
Err(Web3Error::SubmitTransactionError(
pretty_message,
output.encoded_data(),
Expand All @@ -70,7 +69,7 @@ impl InMemoryNode {
message
);

sh_eprintln!("\n{}", pretty_message.on_red());
sh_eprintln!("\n{}", pretty_message);
Err(Web3Error::SubmitTransactionError(pretty_message, vec![]))
}
}
Expand Down
9 changes: 4 additions & 5 deletions crates/core/src/node/inner/in_memory_inner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ use anvil_zksync_config::constants::{
use anvil_zksync_config::TestNodeConfig;
use anvil_zksync_types::{ShowCalls, ShowGasDetails, ShowStorageLogs, ShowVMDetails};
use anyhow::Context;
use colored::Colorize;
use indexmap::IndexMap;
use once_cell::sync::OnceCell;
use std::collections::{HashMap, HashSet};
Expand Down Expand Up @@ -381,7 +380,7 @@ impl InMemoryNodeInner {
if self.config.show_gas_details != ShowGasDetails::None {
self.display_detailed_gas_info(bootloader_debug_result.get(), spent_on_pubdata)
.unwrap_or_else(|err| {
sh_err!("{}", format!("Cannot display gas details: {err}").on_red());
sh_err!("{}", format!("Cannot display gas details: {err}"));
});
}
// Print storage logs if enabled
Expand Down Expand Up @@ -924,7 +923,7 @@ impl InMemoryNodeInner {
message
);
let data = output.encoded_data();
sh_eprintln!("\n{}", pretty_message.on_red());
sh_eprintln!("\n{}", pretty_message);
Err(Web3Error::SubmitTransactionError(pretty_message, data))
}
ExecutionResult::Halt { reason } => {
Expand All @@ -948,7 +947,7 @@ impl InMemoryNodeInner {
message
);

sh_eprintln!("\n{}", pretty_message.on_red());
sh_eprintln!("\n{}", pretty_message);
Err(Web3Error::SubmitTransactionError(pretty_message, vec![]))
}
ExecutionResult::Success { .. } => {
Expand Down Expand Up @@ -1212,7 +1211,7 @@ impl InMemoryNodeInner {
.get(&o.block_hash)
.map(|block| block.number)
.ok_or_else(|| {
sh_err!("unable to map block number to hash #{:#x}", o.block_hash);
tracing::error!("unable to map block number to hash #{:#x}", o.block_hash);
Web3Error::InternalError(anyhow::Error::msg(
"Failed to map block number to hash.",
))
Expand Down
1 change: 0 additions & 1 deletion crates/core/src/node/pool.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use crate::node::impersonate::ImpersonationManager;
use anvil_zksync_common::sh_warn;
use anvil_zksync_types::{TransactionOrder, TransactionPriority};
use futures::channel::mpsc::{channel, Receiver, Sender};
use std::cmp::Ordering;
Expand Down

0 comments on commit 5508301

Please sign in to comment.