Skip to content

Commit

Permalink
fix: rename show_calls_summary
Browse files Browse the repository at this point in the history
  • Loading branch information
Romsters committed Nov 29, 2024
1 parent ebae22c commit 8234d03
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 31 deletions.
10 changes: 5 additions & 5 deletions SUPPORTED_APIS.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ The `status` options are:
| [`CONFIG`](#config-namespace) | [`config_setShowVmDetails`](#config_setshowvmdetails) | `SUPPORTED` | Updates `show_vm_details` to print more detailed results from vm execution |
| [`CONFIG`](#config-namespace) | [`config_setShowGasDetails`](#config_setshowgasdetails) | `SUPPORTED` | Updates `show_gas_details` to print more details about gas estimation and usage |
| [`CONFIG`](#config-namespace) | [`config_setShowNodeConfig`](#config_setshownodeconfig) | `SUPPORTED` | Updates `show_node_config` to print node config on startup |
| [`CONFIG`](#config-namespace) | [`config_setShowCallsSummary`](#config_setshowcallssummary) | `SUPPORTED` | Updates `show_calls_summary` to print calls and transactions summary |
| [`CONFIG`](#config-namespace) | [`config_setShowTxSummary`](#config_setshowtxsummary) | `SUPPORTED` | Updates `show_tx_summary` to print transactions and calls summary |
| [`CONFIG`](#config-namespace) | [`config_setDisableConsoleLog`](#config_setdisableconsolelog) | `SUPPORTED` | Updates `disable_console_log` to disable printing of `console.log` invocations to stdout |
| [`CONFIG`](#config-namespace) | [`config_setShowEventLogs`](#config_setshowcallssummary) | `SUPPORTED` | Updates `show_event_logs` to log events |
| [`CONFIG`](#config-namespace) | [`config_setShowEventLogs`](#config_setshoweventlogs) | `SUPPORTED` | Updates `show_event_logs` to log events |
| [`CONFIG`](#config-namespace) | [`config_setLogLevel`](#config_setloglevel) | `SUPPORTED` | Sets the logging level for the node and only displays the node logs. |
| [`CONFIG`](#config-namespace) | [`config_setLogging`](#config_setlogging) | `SUPPORTED` | Sets the fine-tuned logging levels for the node and any of its dependencies |
| [`DEBUG`](#debug-namespace) | [`debug_traceCall`](#debug_tracecall) | `SUPPORTED` | Performs a call and returns structured traces of the execution |
Expand Down Expand Up @@ -394,11 +394,11 @@ curl --request POST \
--data '{"jsonrpc": "2.0","id": "1","method": "config_setShowNodeConfig","params": [true]}'
```

### `config_setShowCallsSummary`
### `config_setShowTxSummary`

[source](src/node/config_api.rs)

Updates `show_calls_summary` to print calls and transactions summary
Updates `show_tx_summary` to print transactions and calls summary
#### Arguments

+ `value: boolean`
Expand All @@ -413,7 +413,7 @@ Updates `show_calls_summary` to print calls and transactions summary
curl --request POST \
--url http://localhost:8011/ \
--header 'content-type: application/json' \
--data '{"jsonrpc": "2.0","id": "1","method": "config_setShowCallsSummary","params": [true]}'
--data '{"jsonrpc": "2.0","id": "1","method": "config_setShowTxSummary","params": [true]}'
```

### `config_setDisableConsoleLog`
Expand Down
8 changes: 4 additions & 4 deletions src/config/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,14 +71,14 @@ pub struct Cli {
pub show_node_config: Option<bool>,

#[arg(long, default_value = "true", default_missing_value = "true", num_args(0..=1), help_heading = "Debugging Options")]
/// If true, prints calls and transactions summary.
pub show_calls_summary: Option<bool>,
/// If true, prints transactions and calls summary.
pub show_tx_summary: Option<bool>,

#[arg(long, alias = "no-console-log", default_missing_value = "true", num_args(0..=1), help_heading = "Debugging Options")]
/// Disables printing of `console.log` invocations to stdout if true.
pub disable_console_log: Option<bool>,

#[arg(long, default_value = "true", default_missing_value = "true", num_args(0..=1), help_heading = "Debugging Options")]
#[arg(long, default_missing_value = "true", num_args(0..=1), help_heading = "Debugging Options")]
/// If true, logs events.
pub show_event_logs: Option<bool>,

Expand Down Expand Up @@ -345,7 +345,7 @@ impl Cli {
.with_l1_gas_price(self.l1_gas_price)
.with_l2_gas_price(self.l2_gas_price)
.with_l1_pubdata_price(self.l1_pubdata_price)
.with_show_calls_summary(self.show_calls_summary)
.with_show_tx_summary(self.show_tx_summary)
.with_show_event_logs(self.show_event_logs)
.with_disable_console_log(self.disable_console_log)
.with_show_calls(self.show_calls)
Expand Down
16 changes: 8 additions & 8 deletions src/config/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ pub struct TestNodeConfig {
pub port: u16,
/// Print node config on startup if true
pub show_node_config: bool,
/// Print calls and transactions summary if true
pub show_calls_summary: bool,
/// Print transactions and calls summary if true
pub show_tx_summary: bool,
/// If true, logs events.
pub show_event_logs: bool,
/// Disables printing of `console.log` invocations to stdout if true
Expand Down Expand Up @@ -143,8 +143,8 @@ impl Default for TestNodeConfig {
config_out: None,
port: NODE_PORT,
show_node_config: true,
show_calls_summary: true,
show_event_logs: true,
show_tx_summary: true,
show_event_logs: false,
disable_console_log: false,
show_calls: Default::default(),
show_outputs: false,
Expand Down Expand Up @@ -641,11 +641,11 @@ impl TestNodeConfig {
self
}

// Enable or disable printing calls and transactions summary
// Enable or disable printing transactions and calls summary
#[must_use]
pub fn with_show_calls_summary(mut self, show_calls_summary: Option<bool>) -> Self {
if let Some(show_calls_summary) = show_calls_summary {
self.show_calls_summary = show_calls_summary;
pub fn with_show_tx_summary(mut self, show_tx_summary: Option<bool>) -> Self {
if let Some(show_tx_summary) = show_tx_summary {
self.show_tx_summary = show_tx_summary;
}
self
}
Expand Down
10 changes: 5 additions & 5 deletions src/namespaces/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,15 +95,15 @@ pub trait ConfigurationApiNamespaceT {
#[rpc(name = "config_setShowNodeConfig", returns = "bool")]
fn config_set_show_node_config(&self, value: bool) -> Result<bool>;

/// Set show_calls_summary for the InMemoryNodeInner
/// Set show_tx_summary for the InMemoryNodeInner
///
/// # Parameters
/// - `value`: A bool to update show_calls_summary to
/// - `value`: A bool to update show_tx_summary to
///
/// # Returns
/// The updated/current `show_calls_summary` value for the InMemoryNodeInner.
#[rpc(name = "config_setShowCallsSummary", returns = "bool")]
fn config_set_show_calls_summary(&self, value: bool) -> Result<bool>;
/// The updated/current `show_tx_summary` value for the InMemoryNodeInner.
#[rpc(name = "config_setShowTxSummary", returns = "bool")]
fn config_set_show_tx_summary(&self, value: bool) -> Result<bool>;

/// Set show_event_logs for the InMemoryNodeInner
///
Expand Down
6 changes: 3 additions & 3 deletions src/node/config_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ impl<S: ForkSource + std::fmt::Debug + Clone + Send + Sync + 'static> Configurat
})
}

fn config_set_show_calls_summary(&self, value: bool) -> Result<bool> {
fn config_set_show_tx_summary(&self, value: bool) -> Result<bool> {
self.get_inner()
.write()
.map_err(|err| {
Expand All @@ -209,8 +209,8 @@ impl<S: ForkSource + std::fmt::Debug + Clone + Send + Sync + 'static> Configurat
)))
})
.map(|mut writer| {
writer.config.show_calls_summary = value;
writer.config.show_calls_summary
writer.config.show_tx_summary = value;
writer.config.show_tx_summary
})
}

Expand Down
12 changes: 6 additions & 6 deletions src/node/in_memory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1215,7 +1215,7 @@ impl<S: ForkSource + std::fmt::Debug + Clone> InMemoryNode<S> {
.take()
.unwrap_or_default();

if inner.config.show_calls_summary {
if inner.config.show_tx_summary {
match &tx_result.result {
ExecutionResult::Success { output } => {
tracing::info!("Call: {}", "SUCCESS".green());
Expand Down Expand Up @@ -1515,7 +1515,7 @@ impl<S: ForkSource + std::fmt::Debug + Clone> InMemoryNode<S> {
let spent_on_pubdata =
tx_result.statistics.gas_used - tx_result.statistics.computational_gas_used as u64;

if inner.config.show_calls_summary {
if inner.config.show_tx_summary {
tracing::info!("┌─────────────────────────┐");
tracing::info!("│ TRANSACTION SUMMARY │");
tracing::info!("└─────────────────────────┘");
Expand Down Expand Up @@ -1629,21 +1629,21 @@ impl<S: ForkSource + std::fmt::Debug + Clone> InMemoryNode<S> {
let tx_hash = l2_tx.hash();
let transaction_type = l2_tx.common_data.transaction_type;

let show_calls_summary = self
let show_tx_summary = self
.inner
.read()
.map_err(|_| anyhow::anyhow!("Failed to acquire read lock"))?
.config
.show_calls_summary;
.show_tx_summary;

if show_calls_summary {
if show_tx_summary {
tracing::info!("");
tracing::info!("Validating {}", format!("{:?}", tx_hash).bold());
}

self.validate_tx(&l2_tx)?;

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

Expand Down

0 comments on commit 8234d03

Please sign in to comment.