Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: remove tracing::info usage #578

Merged
merged 22 commits into from
Feb 12, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
36767a6
chore: remove tracing::info in favour of pure stdout
dutterbutter Feb 4, 2025
debc56d
chore: linting
dutterbutter Feb 4, 2025
0d3b49f
chore: fix formatting
dutterbutter Feb 4, 2025
32abbd8
feat: move to use shell io
dutterbutter Feb 4, 2025
83e902d
feat: introduce shell io abstraction for logging
dutterbutter Feb 4, 2025
270831f
Merge branch 'main' into db/remove-tracing-info
dutterbutter Feb 4, 2025
8903105
chore: remove clippy unused println
dutterbutter Feb 4, 2025
df52cfc
Merge branch 'db/remove-tracing-info' of github.com:matter-labs/anvil…
dutterbutter Feb 4, 2025
89e04dd
chore: linting
dutterbutter Feb 4, 2025
edb2789
feat: make use of anstream and anystyle, remove use of atty
dutterbutter Feb 6, 2025
82af8fe
chore: linting
dutterbutter Feb 6, 2025
a1701ff
Merge branch 'main' into db/remove-tracing-info
dutterbutter Feb 6, 2025
5e2e87d
feat: turn tracing off by default, update messages
dutterbutter Feb 6, 2025
fcba826
Merge branch 'db/remove-tracing-info' of github.com:matter-labs/anvil…
dutterbutter Feb 6, 2025
649e492
chore: resolve conflicts
dutterbutter Feb 6, 2025
b6c9d62
Merge branch 'main' into db/remove-tracing-info
dutterbutter Feb 7, 2025
9a8de7f
chore: make requested changes
dutterbutter Feb 10, 2025
85d5c9e
chore: update pool_rs
dutterbutter Feb 10, 2025
5508301
chore: linting, fix formatting. Remove uneeded colorize
dutterbutter Feb 10, 2025
4908676
chore: make requested changes
dutterbutter Feb 11, 2025
5801503
chore: linting
dutterbutter Feb 11, 2025
ffba45a
chore: resolve conflicts
dutterbutter Feb 12, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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