Skip to content

Commit

Permalink
enha: always enable test-accounts in dev mode
Browse files Browse the repository at this point in the history
  • Loading branch information
dinhani-cw committed Jul 29, 2024
1 parent 474d316 commit b34ae21
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 19 deletions.
1 change: 0 additions & 1 deletion chaos/experiments/main.sh
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@ start_instance() {

RUST_LOG=info RUST_BACKTRACE=1 cargo run --release --bin $binary --features dev -- \
--block-mode=1s \
--enable-test-accounts \
--candidate-peers="$candidate_peers" \
-a=$address \
--grpc-server-address=$grpc_address \
Expand Down
1 change: 0 additions & 1 deletion docker/Dockerfile.run_with_importer_cached
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ COPY Cargo.lock /app/Cargo.lock
ENV CARGO_PROFILE_RELEASE_DEBUG=1
ENV TRACING_LOG_FORMAT=json
ENV NO_COLOR=1
ENV ENABLE_TEST_ACCOUNTS=1
RUN --mount=type=cache,target=/usr/local/cargo/registry \
--mount=type=cache,target=/app/target \
cargo build --release --bin run-with-importer --features dev
Expand Down
6 changes: 3 additions & 3 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ wait_service_timeout := env("WAIT_SERVICE_TIMEOUT", "60")

# Cargo flags.
build_flags := nightly_flag + " " + release_flag + " --bin stratus --features " + feature_flags
run_flags := "--enable-genesis --enable-test-accounts"
run_flags := "--enable-genesis"

# Project: Show available tasks
default:
Expand Down Expand Up @@ -319,13 +319,13 @@ e2e-importer-online-up:
mkdir e2e_logs

# Start Stratus binary
RUST_LOG=info cargo run --release --bin stratus --features dev -- --block-mode 1s --enable-genesis --enable-test-accounts --perm-storage=rocks --rocks-path-prefix=temp_3000 --tokio-console-address=0.0.0.0:6668 --metrics-exporter-address=0.0.0.0:9000 -a 0.0.0.0:3000 > e2e_logs/stratus.log &
RUST_LOG=info cargo run --release --bin stratus --features dev -- --block-mode 1s --enable-genesis --perm-storage=rocks --rocks-path-prefix=temp_3000 --tokio-console-address=0.0.0.0:6668 --metrics-exporter-address=0.0.0.0:9000 -a 0.0.0.0:3000 > e2e_logs/stratus.log &

# Wait for Stratus to start
wait-service --tcp 0.0.0.0:3000 -t {{ wait_service_timeout }} -- echo

# Start Run With Importer binary
RUST_LOG=info cargo run --release --bin run-with-importer --features dev -- --block-mode 1s --enable-test-accounts --perm-storage=rocks --rocks-path-prefix=temp_3001 --tokio-console-address=0.0.0.0:6669 --metrics-exporter-address=0.0.0.0:9001 -a 0.0.0.0:3001 -r http://0.0.0.0:3000/ -w ws://0.0.0.0:3000/ > e2e_logs/run_with_importer.log &
RUST_LOG=info cargo run --release --bin run-with-importer --features dev -- --block-mode 1s --perm-storage=rocks --rocks-path-prefix=temp_3001 --tokio-console-address=0.0.0.0:6669 --metrics-exporter-address=0.0.0.0:9001 -a 0.0.0.0:3001 -r http://0.0.0.0:3000/ -w ws://0.0.0.0:3000/ > e2e_logs/run_with_importer.log &

# Wait for Run With Importer to start
wait-service --tcp 0.0.0.0:3001 -t {{ wait_service_timeout }} -- echo
Expand Down
7 changes: 1 addition & 6 deletions src/eth/miner/miner_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,6 @@ pub struct MinerConfig {
/// Generates genesis block on startup when it does not exist.
#[arg(long = "enable-genesis", env = "ENABLE_GENESIS", default_value = "false")]
pub enable_genesis: bool,

/// Enables test accounts with max wei on startup.
#[cfg(feature = "dev")]
#[arg(long = "enable-test-accounts", env = "ENABLE_TEST_ACCOUNTS", default_value = "false")]
pub enable_test_accounts: bool,
}

impl MinerConfig {
Expand Down Expand Up @@ -63,7 +58,7 @@ impl MinerConfig {

// enable test accounts
#[cfg(feature = "dev")]
if self.enable_test_accounts {
{
let test_accounts = test_accounts();
tracing::info!(accounts = ?test_accounts, "enabling test accounts");
storage.save_accounts(test_accounts)?;
Expand Down
16 changes: 8 additions & 8 deletions src/eth/primitives/account.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,18 +99,18 @@ impl From<&Account> for RevmAccountInfo {
// Utilities
// -----------------------------------------------------------------------------

/// Retrieves test accounts.
/// Test accounts.
pub fn test_accounts() -> Vec<Account> {
use hex_literal::hex;

[
hex!("f39fd6e51aad88f6f4ce6ab8827279cfffb92266"),
hex!("70997970c51812dc3a010c7d01b50e0d17dc79c8"),
hex!("3c44cdddb6a900fa2b585dd299e03d12fa4293bc"),
hex!("15d34aaf54267db7d7c367839aaf71a00a2c6a65"),
hex!("9965507d1a55bcc2695c58ba16fb37d819b0a4dc"),
hex!("976ea74026e726554db657fa54763abd0c3a0aa9"),
hex!("e45b176cad7090a5cf70b69a73b6def9296ba6a2"),
hex!("f39fd6e51aad88f6f4ce6ab8827279cfffb92266"), // ALICE
hex!("70997970c51812dc3a010c7d01b50e0d17dc79c8"), // BOB
hex!("3c44cdddb6a900fa2b585dd299e03d12fa4293bc"), // CHARLIE
hex!("15d34aaf54267db7d7c367839aaf71a00a2c6a65"), // DAVE
hex!("9965507d1a55bcc2695c58ba16fb37d819b0a4dc"), // EVE
hex!("976ea74026e726554db657fa54763abd0c3a0aa9"), // FERDIE
hex!("e45b176cad7090a5cf70b69a73b6def9296ba6a2"), // ?
]
.into_iter()
.map(|address| Account {
Expand Down

0 comments on commit b34ae21

Please sign in to comment.