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

feat: adds account configuration options #388

Merged
merged 12 commits into from
Nov 20, 2024
Merged

Conversation

dutterbutter
Copy link
Collaborator

@dutterbutter dutterbutter commented Nov 19, 2024

What 💻

Dependencies:

  • Added alloy-signer-local and alloy-signer dependencies to support account generation and signing.
  • Added rand dependency to support random number generation for account mnemonics.

Configuration and CLI:

  • Updates on-start display to show all relevant config values, including relevant fork details
  • Removed the examples/config.toml file and the ability to set config value via toml file. When users attempt to use --config a warning is displayed indicating its deprecated.
  • Updated the Cli struct in src/config/cli.rs to include options for generating and configuring accounts, such as accounts, balance, mnemonic, mnemonic_random, mnemonic_seed, and derivation_path.
  • Keeps legacy rich wallets so not to break any existing tooling dependent on these addresses

TestNodeConfig:

  • Updated TestNodeConfig in src/config/mod.rs to include fields for account generation and management, such as genesis_accounts, signer_accounts, and account_generator.
  • Added methods to TestNodeConfig for setting genesis accounts, signer accounts, and account generator
  • Removes fn override_with_opts in favour of to_test_node_config

Main Function:

  • Refactored the main function in src/main.rs to use the new to_test_node_config method from the Cli struct

Why ✋

  • Continuation of achieving CLI parity with anvil

Evidence 📷

Include screenshots, screen recordings, or console output here demonstrating that your changes work as intended

./target/release/era_test_node --port 8012 fork --network mainnet
                      _  _         _____ _  __
  __ _  _ __  __   __(_)| |       |__  /| |/ / ___  _   _  _ __    ___
 / _` || '_ \ \ \ / /| || | _____   / / | ' / / __|| | | || '_ \  / __|
| (_| || | | | \ V / | || ||_____| / /_ | . \ \__ \| |_| || | | || (__
 \__,_||_| |_|  \_/  |_||_|       /____||_|\_\|___/ \__, ||_| |_| \___|
                                                    |___/

19:19:06  INFO Version:        0.1.0-alpha.32
19:19:06  INFO Repository:     https://github.com/matter-labs/era-test-node


19:19:06  INFO Rich Accounts
19:19:06  INFO ========================
19:19:06  INFO (0) 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 (100 ETH)
19:19:06  INFO (1) 0x70997970C51812dc3A010C7d01b50e0d17dc79C8 (100 ETH)
19:19:06  INFO (2) 0x3C44CdDdB6a900fa2b585dd299e03d12FA4293BC (100 ETH)
19:19:06  INFO (3) 0x90F79bf6EB2c4f870365E785982E1f101E93b906 (100 ETH)
19:19:06  INFO (4) 0x15d34AAf54267DB7D7c367839AAf71A00a2C6A65 (100 ETH)
19:19:06  INFO (5) 0x9965507D1a55bcC2695C58ba16FB37d819B0A4dc (100 ETH)
19:19:06  INFO (6) 0x976EA74026E726554dB657fA54763abd0C3a0aa9 (100 ETH)
19:19:06  INFO (7) 0x14dC79964da2C08b23698B3D3cc7Ca32193d9955 (100 ETH)
19:19:06  INFO (8) 0x23618e81E3f5cdF7f54C3d65f7FBc0aBf5B21E8f (100 ETH)
19:19:06  INFO (9) 0xa0Ee7A142d267C1f36714E4a8F75612F20a79720 (100 ETH)


19:19:06  INFO Private Keys
19:19:06  INFO ========================
19:19:06  INFO (0) 0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80
19:19:06  INFO (1) 0x59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d
19:19:06  INFO (2) 0x5de4111afa1a4b94908f83103eb1f1706367c2e68ca870fc3fb9a804cdab365a
19:19:06  INFO (3) 0x7c852118294e51e653712a81e05800f419141751be58f605c371e15141b007a6
19:19:06  INFO (4) 0x47e179ec197488593b187f80a00eb0da91f1b9d0b13f8733639f19c30a34926a
19:19:06  INFO (5) 0x8b3a350cf5c34c9194ca85829a2df0ec3153be0318b5e2d3348e872092edffba
19:19:06  INFO (6) 0x92db14e403b83dfe3df233f83dfa3a0d7096f21ca9b0d6d6b8d88b2b4ec1564e
19:19:06  INFO (7) 0x4bbbf85ce3377467afe5d46f804f221813b2bb87f24d81f60f1fcdbf7cbf4356
19:19:06  INFO (8) 0xdbda1821b80551c9d65939329250298aa3472ba22feea921c0cf5d620ea67b97
19:19:06  INFO (9) 0x2a871d0798f97d79848a013d4936a73bf4cc922c825d33c1cf7073dff6d409c6


19:19:06  INFO Wallet
19:19:06  INFO ========================
19:19:06  INFO Mnemonic:            test test test test test test test test test test test junk
19:19:06  INFO Derivation path:     m/44'/60'/0'/0/0


19:19:06  INFO Fork Details
19:19:06  INFO ========================
19:19:06  INFO Network RPC:               https://mainnet.era.zksync.io:443
19:19:06  INFO Chain ID:                  324
19:19:06  INFO L1 Batch #:                494219
19:19:06  INFO L2 Block #:                49338163
19:19:06  INFO Block Timestamp:           1732043941
19:19:06  INFO Fork Block Hash:           0x1d69642db1da801cfe80cbcc02a8af6de24fee12bae842b26b95684acfac82a0
19:19:06  INFO Compute Overhead Part:     0
19:19:06  INFO Pubdata Overhead Part:     1
19:19:06  INFO Batch Overhead L1 Gas:     800000
19:19:06  INFO Max Gas Per Batch:         200000000
19:19:06  INFO Max Pubdata Per Batch:     500000


19:19:06  INFO Gas Configuration
19:19:06  INFO ========================
19:19:06  INFO L1 Gas Price (gwei):               23.01175245 gwei
19:19:06  INFO L2 Gas Price (gwei):               0.04525000 gwei
19:19:06  INFO L1 Pubdata Price (gwei):           36.89225891 gwei
19:19:06  INFO Estimated Gas Price Scale Factor:  1.5
19:19:06  INFO Estimated Gas Limit Scale Factor:  1.4


19:19:06  INFO Node Configuration
19:19:06  INFO ========================
19:19:06  INFO Port:               8012
19:19:06  INFO EVM Emulator:       Disabled


19:19:06  INFO ========================================
19:19:06  INFO   Listening on 127.0.0.1:8012
19:19:06  INFO ========================================

@dutterbutter dutterbutter requested a review from a team as a code owner November 19, 2024 01:45
@dutterbutter dutterbutter marked this pull request as draft November 19, 2024 04:05
Copy link
Member

@popzxc popzxc left a comment

Choose a reason for hiding this comment

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

Generally looks really good!

src/config/cli.rs Show resolved Hide resolved
src/config/mod.rs Outdated Show resolved Hide resolved
src/config/mod.rs Outdated Show resolved Hide resolved
@dutterbutter dutterbutter marked this pull request as ready for review November 19, 2024 19:39
@dutterbutter dutterbutter added the needs review 👓 PR requires a review label Nov 19, 2024
@dutterbutter dutterbutter merged commit febc5e2 into main Nov 20, 2024
11 checks passed
@dutterbutter dutterbutter deleted the db/add-account-cli-options branch November 20, 2024 13:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs review 👓 PR requires a review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants