From ddd02395932ccc51709a0cd830b232e21022bfcf Mon Sep 17 00:00:00 2001 From: Dustin Brickwood Date: Fri, 29 Nov 2024 11:02:02 -0600 Subject: [PATCH] chore: minor fixes --- src/config/mod.rs | 36 +++++------------------------------- src/node/in_memory.rs | 11 ++--------- 2 files changed, 7 insertions(+), 40 deletions(-) diff --git a/src/config/mod.rs b/src/config/mod.rs index f141458c..58bc84ad 100644 --- a/src/config/mod.rs +++ b/src/config/mod.rs @@ -77,8 +77,6 @@ pub struct TestNodeConfig { pub show_vm_details: ShowVMDetails, /// Level of detail for gas usage logs pub show_gas_details: ShowGasDetails, - /// Whether to show event logs - pub show_event_logs: bool, /// Whether to resolve hash references pub resolve_hashes: bool, /// Don’t print anything on startup if true @@ -153,7 +151,6 @@ impl Default for TestNodeConfig { show_storage_logs: Default::default(), show_vm_details: Default::default(), show_gas_details: Default::default(), - show_event_logs: false, resolve_hashes: false, silent: false, system_contracts_options: Default::default(), @@ -670,6 +667,11 @@ impl TestNodeConfig { self } + /// Get the visibility of event logs + pub fn get_show_event_logs(&self) -> bool { + self.show_event_logs + } + // Enable or disable printing of `console.log` invocations to stdout #[must_use] pub fn with_disable_console_log(mut self, disable_console_log: Option) -> Self { @@ -726,20 +728,6 @@ impl TestNodeConfig { self.show_gas_details } - /// Set the visibility of event logs - #[must_use] - pub fn with_show_event_logs(mut self, show_event_logs: Option) -> Self { - if let Some(show_event_logs) = show_event_logs { - self.show_event_logs = show_event_logs; - } - self - } - - /// Get the visibility of event logs - pub fn get_show_event_logs(&self) -> bool { - self.show_event_logs - } - /// Set show outputs #[must_use] pub fn with_show_outputs(mut self, show_outputs: Option) -> Self { @@ -796,20 +784,6 @@ impl TestNodeConfig { self } - /// Set the detail level of VM execution logs - #[must_use] - pub fn with_vm_log_detail(mut self, detail: Option) -> Self { - if let Some(detail) = detail { - self.show_vm_details = detail; - } - self - } - - /// Get the detail level of VM execution logs - pub fn get_vm_log_detail(&self) -> ShowVMDetails { - self.show_vm_details - } - /// Sets the balance of the genesis accounts in the genesis block #[must_use] pub fn with_genesis_balance>(mut self, balance: U) -> Self { diff --git a/src/node/in_memory.rs b/src/node/in_memory.rs index 79bdf4cf..40fb53f6 100644 --- a/src/node/in_memory.rs +++ b/src/node/in_memory.rs @@ -1426,6 +1426,7 @@ impl InMemoryNode { // TODO: improve call traces if inner.config.show_calls != ShowCalls::None { + tracing::info!(""); tracing::info!( "[Transaction Execution] ({} calls)", call_traces[0].calls.len() @@ -1447,6 +1448,7 @@ impl InMemoryNode { } // Print event logs if enabled if inner.config.show_event_logs { + tracing::info!(""); tracing::info!("[Events] ({} events)", tx_result.logs.events.len()); for (i, event) in tx_result.logs.events.iter().enumerate() { let is_last = i == tx_result.logs.events.len() - 1; @@ -1456,15 +1458,6 @@ impl InMemoryNode { } tracing::info!(""); - // TODO: Properly handle console logs. Consider adding a flag to enable console logs. - // Maybe related to issue: https://github.com/matter-labs/era-test-node/issues/205 - tracing::info!(""); - tracing::info!("==== Console logs: "); - for call in call_traces { - inner.console_log_handler.handle_call_recursive(call); - } - tracing::info!(""); - let mut bytecodes = HashMap::new(); for b in &*compressed_bytecodes { let (hash, bytecode) = bytecode_to_factory_dep(b.original.clone()).map_err(|err| {