Skip to content

Commit

Permalink
feat: Add debug-mode flag (#343)
Browse files Browse the repository at this point in the history
* feat: Add debug-mode flag

* update README
  • Loading branch information
MexicanAce committed Sep 11, 2024
1 parent 25b9eed commit 8978a21
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,12 @@ Example:
era_test_node --show-storage-logs=all --show-vm-details=all --show-gas-details=all run
```

This is now even easier with a single flag (`--debug-mode` or `-d`):

```bash
era_test_node -d
```

## 💰 Using Rich Wallets

For testing and development purposes, the `era-test-node` comes pre-configured with a set of 'rich' wallets. These wallets are loaded with test funds, allowing you to simulate transactions and interactions without the need for real assets.
Expand Down
4 changes: 4 additions & 0 deletions src/config/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ pub struct Cli {
/// The file path to the config file. If not supplied, defaults will be used.
pub config: Option<String>,

#[arg(short, long)]
/// Enable default settings for debugging contracts
pub debug_mode: bool,

#[arg(long)]
/// Port to listen on - default: 8011
pub port: Option<u16>,
Expand Down
8 changes: 7 additions & 1 deletion src/config/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use cache::CacheConfig;
use cli::{CacheType, Cli, DevSystemContracts};
use gas::GasConfig;
use log::LogConfig;
use node::InMemoryNodeConfig;
use node::{InMemoryNodeConfig, ShowCalls, ShowGasDetails};
use serde::Deserialize;

use crate::system_contracts;
Expand Down Expand Up @@ -54,6 +54,12 @@ impl TestNodeConfig {
self.node.port = *port;
}

if opt.debug_mode {
self.node.show_calls = ShowCalls::All;
self.node.show_outputs = true;
self.node.show_gas_details = ShowGasDetails::All;
self.node.resolve_hashes = true;
}
if let Some(show_calls) = &opt.show_calls {
self.node.show_calls = *show_calls;
}
Expand Down

0 comments on commit 8978a21

Please sign in to comment.