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: refactors configuration and cli structure / usage #384

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

dutterbutter
Copy link
Collaborator

What ✋

  • Updated the CLI with categorized options for better usability, including new headings for network, gas, system, debug, logging, and cache configurations.
  • Reorganized constants, show_details, and cache into separate files under /config for cleaner structure and better accessibility.

Why ✋

  • This makes it much easier to add / refactor for anvil-cli parity in subsequent PRs
  • Improved CLI readability and user experience by categorizing and grouping related options

Evidence 📷

Updated CLI Output:

Era Test Node

A developer-friendly ZKsync local node for testing.

Usage: era_test_node [OPTIONS] [COMMAND]

Commands:
  run        Starts a new empty local network
  fork       Starts a local network that is a fork of another network
  replay_tx  Starts a local network that is a fork of another network, and replays a given TX on it
  help       Print this message or the help of the given subcommand(s)

Options:
  -h, --help
          Print help (see a summary with '-h')

  -V, --version
          Print version

General Options:
  -c, --config <CONFIG>
          Path to the configuration file. If not supplied, defaults will be used

      --offline
          Run in offline mode (disables all network requests)

Network Options:
      --port <PORT>
          Port to listen on (default: 8011)

          [default: 8011]

      --chain-id <CHAIN_ID>
          Specify chain ID (default: 260)

Debugging Options:
  -d, --debug-mode
          Enable default settings for debugging contracts

      --show-calls <SHOW_CALLS>
          Show call debug information

          [possible values: none, user, system, all]

      --show-outputs <SHOW_OUTPUTS>
          Show call output information

          [possible values: true, false]

      --show-storage-logs <SHOW_STORAGE_LOGS>
          Show storage log information

          [possible values: none, read, write, paid, all]

      --show-vm-details <SHOW_VM_DETAILS>
          Show VM details information

          [possible values: none, all]

      --show-gas-details <SHOW_GAS_DETAILS>
          Show gas details information

          [possible values: none, all]

      --resolve-hashes <RESOLVE_HASHES>
          If true, the tool will try to resolve ABI and topic names for better readability. May decrease performance

          [possible values: true, false]

Gas Configuration:
      --l1-gas-price <L1_GAS_PRICE>
          Custom L1 gas price (in wei)

      --l2-gas-price <L2_GAS_PRICE>
          Custom L2 gas price (in wei)

      --l1-pubdata-price <L1_PUBDATA_PRICE>
          Custom L1 pubdata price (in wei)

      --price-scale-factor <PRICE_SCALE_FACTOR>
          Gas price estimation scale factor

      --limit-scale-factor <LIMIT_SCALE_FACTOR>
          Gas limit estimation scale factor

System Configuration:
      --override-bytecodes-dir <OVERRIDE_BYTECODES_DIR>
          Directory to override bytecodes

      --dev-system-contracts <DEV_SYSTEM_CONTRACTS>
          Option for system contracts (default: built-in)

          [possible values: built-in, local, built-in-without-security]

      --emulate-evm
          Enables EVM emulation. Requires local system contracts

Logging Configuration:
      --log <LOG>
          Log level (default: info)

          [possible values: trace, debug, info, warn, error]

      --log-file-path <LOG_FILE_PATH>
          Log file path (default: era_test_node.log)

Cache Options:
      --cache <CACHE>
          Cache type (none, memory, or disk). Default: "disk"

          [possible values: none, memory, disk]

      --reset-cache <RESET_CACHE>
          Reset the local disk cache

          [possible values: true, false]

      --cache-dir <CACHE_DIR>
          Cache directory location for disk cache (default: .cache)

@dutterbutter dutterbutter requested a review from a team as a code owner November 15, 2024 20:15

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot reviewed 6 out of 17 changed files in this pull request and generated no suggestions.

Files not reviewed (11)
  • src/node/storage_logs.rs: Evaluated as low risk
  • src/system_contracts.rs: Evaluated as low risk
  • src/node/net.rs: Evaluated as low risk
  • src/node/fee_model.rs: Evaluated as low risk
  • src/node/config_api.rs: Evaluated as low risk
  • src/formatter.rs: Evaluated as low risk
  • src/fork.rs: Evaluated as low risk
  • src/node/eth.rs: Evaluated as low risk
  • src/lib.rs: Evaluated as low risk
  • src/node/in_memory.rs: Evaluated as low risk
  • src/node/zks.rs: Evaluated as low risk
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant