Skip to content

Commit

Permalink
chore: minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
dutterbutter committed Nov 29, 2024
1 parent 848581f commit ddd0239
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 40 deletions.
36 changes: 5 additions & 31 deletions src/config/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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(),
Expand Down Expand Up @@ -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<bool>) -> Self {
Expand Down Expand Up @@ -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<bool>) -> 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<bool>) -> Self {
Expand Down Expand Up @@ -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<ShowVMDetails>) -> 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<U: Into<U256>>(mut self, balance: U) -> Self {
Expand Down
11 changes: 2 additions & 9 deletions src/node/in_memory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1426,6 +1426,7 @@ impl<S: ForkSource + std::fmt::Debug + Clone> InMemoryNode<S> {

// TODO: improve call traces
if inner.config.show_calls != ShowCalls::None {
tracing::info!("");
tracing::info!(
"[Transaction Execution] ({} calls)",
call_traces[0].calls.len()
Expand All @@ -1447,6 +1448,7 @@ impl<S: ForkSource + std::fmt::Debug + Clone> InMemoryNode<S> {
}
// 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;
Expand All @@ -1456,15 +1458,6 @@ impl<S: ForkSource + std::fmt::Debug + Clone> InMemoryNode<S> {
}
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| {
Expand Down

0 comments on commit ddd0239

Please sign in to comment.