diff --git a/.github/workflows/local-testnet.yml b/.github/workflows/local-testnet.yml index 7f367821c..13c1af7ab 100644 --- a/.github/workflows/local-testnet.yml +++ b/.github/workflows/local-testnet.yml @@ -19,7 +19,7 @@ jobs: - uses: actions/checkout@v1 - name: Install ganache - run: npm install ganache-cli@latest --global + run: npm install ganache@latest --global # https://github.com/actions/cache/blob/main/examples.md#rust---cargo - uses: actions/cache@v2 diff --git a/.github/workflows/test-suite.yml b/.github/workflows/test-suite.yml index b19fc1e0b..16f1db0ab 100644 --- a/.github/workflows/test-suite.yml +++ b/.github/workflows/test-suite.yml @@ -50,8 +50,8 @@ jobs: - uses: actions/checkout@v1 - name: Get latest version of stable Rust run: rustup update stable - - name: Install ganache-cli - run: sudo npm install -g ganache-cli + - name: Install ganache + run: sudo npm install -g ganache - name: Run tests in release run: make test-release release-tests-windows: @@ -62,8 +62,18 @@ jobs: - uses: actions/checkout@v1 - name: Get latest version of stable Rust run: rustup update stable - - name: Install ganache-cli - run: npm install -g ganache-cli + - name: Add msbuild to PATH + uses: microsoft/setup-msbuild@v1.0.2 + - name: Use Python 2.7 + uses: actions/setup-python@v2 + with: + python-version: "2.7" + - name: Set node config to use python2.7 + run: npm config set python %pythonLocation% + - name: Set msvs_version to 2019 + run: npm config set msvs_version 2019 --global + - name: Install ganache + run: npm install -g ganache - name: Install make run: choco install -y make - uses: KyleMayes/install-llvm-action@v1 @@ -102,8 +112,8 @@ jobs: - uses: actions/checkout@v1 - name: Get latest version of stable Rust run: rustup update stable - - name: Install ganache-cli - run: sudo npm install -g ganache-cli + - name: Install ganache + run: sudo npm install -g ganache - name: Run tests in debug run: make test-debug state-transition-vectors-ubuntu: @@ -146,8 +156,8 @@ jobs: - uses: actions/checkout@v1 - name: Get latest version of stable Rust run: rustup update stable - - name: Install ganache-cli - run: sudo npm install -g ganache-cli + - name: Install ganache + run: sudo npm install -g ganache - name: Run the beacon chain sim that starts from an eth1 contract run: cargo run --release --bin simulator eth1-sim no-eth1-simulator-ubuntu: @@ -158,8 +168,8 @@ jobs: - uses: actions/checkout@v1 - name: Get latest version of stable Rust run: rustup update stable - - name: Install ganache-cli - run: sudo npm install -g ganache-cli + - name: Install ganache + run: sudo npm install -g ganache - name: Run the beacon chain sim without an eth1 connection run: cargo run --release --bin simulator no-eth1-sim syncing-simulator-ubuntu: @@ -170,8 +180,8 @@ jobs: - uses: actions/checkout@v1 - name: Get latest version of stable Rust run: rustup update stable - - name: Install ganache-cli - run: sudo npm install -g ganache-cli + - name: Install ganache + run: sudo npm install -g ganache - name: Run the syncing simulator run: cargo run --release --bin simulator syncing-sim doppelganger-protection-test: @@ -182,8 +192,8 @@ jobs: - uses: actions/checkout@v1 - name: Get latest version of stable Rust run: rustup update stable - - name: Install ganache-cli - run: sudo npm install -g ganache-cli + - name: Install ganache + run: sudo npm install -g ganache - name: Install lighthouse and lcli run: | make diff --git a/beacon_node/genesis/tests/tests.rs b/beacon_node/genesis/tests/tests.rs index 0fbe15871..8b77c8947 100644 --- a/beacon_node/genesis/tests/tests.rs +++ b/beacon_node/genesis/tests/tests.rs @@ -1,4 +1,4 @@ -//! NOTE: These tests will not pass unless ganache-cli is running on `ENDPOINT` (see below). +//! NOTE: These tests will not pass unless ganache is running on `ENDPOINT` (see below). //! //! You can start a suitable instance using the `ganache_test_node.sh` script in the `scripts` //! dir in the root of the `lighthouse` repo. diff --git a/book/src/setup.md b/book/src/setup.md index cd9bce803..dfff9290e 100644 --- a/book/src/setup.md +++ b/book/src/setup.md @@ -9,9 +9,9 @@ particularly useful for development but still a good way to ensure you have the base dependencies. The additional requirements for developers are: -- [`ganache-cli`](https://github.com/trufflesuite/ganache-cli). This is used to +- [`ganache v7`](https://github.com/trufflesuite/ganache). This is used to simulate the execution chain during tests. You'll get failures during tests if you - don't have `ganache-cli` available on your `PATH`. + don't have `ganache` available on your `PATH` or if ganache is older than v7. - [`cmake`](https://cmake.org/cmake/help/latest/command/install.html). Used by some dependencies. See [`Installation Guide`](./installation.md) for more info. - [`java 11 runtime`](https://openjdk.java.net/projects/jdk/). 11 is the minimum, diff --git a/lighthouse/tests/account_manager.rs b/lighthouse/tests/account_manager.rs index fcc1d2aee..06b0303c6 100644 --- a/lighthouse/tests/account_manager.rs +++ b/lighthouse/tests/account_manager.rs @@ -30,7 +30,7 @@ use validator_dir::ValidatorDir; // TODO: create tests for the `lighthouse account validator deposit` command. This involves getting // access to an IPC endpoint during testing or adding support for deposit submission via HTTP and -// using ganache-cli. +// using ganache. /// Returns the `lighthouse account` command. fn account_cmd() -> Command { diff --git a/scripts/local_testnet/ganache_test_node.sh b/scripts/local_testnet/ganache_test_node.sh index 69edc1e77..7d97f2196 100755 --- a/scripts/local_testnet/ganache_test_node.sh +++ b/scripts/local_testnet/ganache_test_node.sh @@ -4,7 +4,7 @@ set -Eeuo pipefail source ./vars.env -exec ganache-cli \ +exec ganache \ --defaultBalanceEther 1000000000 \ --gasLimit 1000000000 \ --accounts 10 \ @@ -12,4 +12,4 @@ exec ganache-cli \ --port 8545 \ --blockTime $SECONDS_PER_ETH1_BLOCK \ --networkId "$NETWORK_ID" \ - --chainId "$NETWORK_ID" + --chain.chainId "$NETWORK_ID" diff --git a/scripts/local_testnet/start_local_testnet.sh b/scripts/local_testnet/start_local_testnet.sh index 69d55660f..a5c6c0b5e 100755 --- a/scripts/local_testnet/start_local_testnet.sh +++ b/scripts/local_testnet/start_local_testnet.sh @@ -86,10 +86,10 @@ execute_command_add_PID() { echo "$!" >> $PID_FILE } -# Start ganache-cli, setup things up and start the bootnode. +# Start ganache, setup things up and start the bootnode. # The delays are necessary, hopefully there is a better way :( -# Delay to let ganache-cli to get started +# Delay to let ganache to get started execute_command_add_PID ganache_test_node.log ./ganache_test_node.sh sleeping 10 diff --git a/scripts/tests/doppelganger_protection.sh b/scripts/tests/doppelganger_protection.sh index d10249bdc..b0f9ce826 100755 --- a/scripts/tests/doppelganger_protection.sh +++ b/scripts/tests/doppelganger_protection.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash -# Requires `lighthouse`, ``lcli`, `ganache-cli`, `curl`, `jq` +# Requires `lighthouse`, ``lcli`, `ganache`, `curl`, `jq` BEHAVIOR=$1 diff --git a/testing/eth1_test_rig/src/ganache.rs b/testing/eth1_test_rig/src/ganache.rs index 505c01043..c82277dc7 100644 --- a/testing/eth1_test_rig/src/ganache.rs +++ b/testing/eth1_test_rig/src/ganache.rs @@ -36,14 +36,14 @@ impl GanacheInstance { loop { if start + Duration::from_millis(GANACHE_STARTUP_TIMEOUT_MILLIS) <= Instant::now() { break Err( - "Timed out waiting for ganache to start. Is ganache-cli installed?".to_string(), + "Timed out waiting for ganache to start. Is ganache installed?".to_string(), ); } let mut line = String::new(); if let Err(e) = reader.read_line(&mut line) { break Err(format!("Failed to read line from ganache process: {:?}", e)); - } else if line.starts_with("Listening on") { + } else if line.starts_with("RPC Listening on") { break Ok(()); } else { continue; @@ -69,13 +69,13 @@ impl GanacheInstance { }) } - /// Start a new `ganache-cli` process, waiting until it indicates that it is ready to accept + /// Start a new `ganache` process, waiting until it indicates that it is ready to accept /// RPC connections. pub fn new(network_id: u64, chain_id: u64) -> Result { let port = unused_tcp_port()?; let binary = match cfg!(windows) { - true => "ganache-cli.cmd", - false => "ganache-cli", + true => "ganache.cmd", + false => "ganache", }; let child = Command::new(binary) .stdout(Stdio::piped()) @@ -85,15 +85,13 @@ impl GanacheInstance { .arg("1000000000") .arg("--accounts") .arg("10") - .arg("--keepAliveTimeout") - .arg("0") .arg("--port") .arg(format!("{}", port)) .arg("--mnemonic") .arg("\"vast thought differ pull jewel broom cook wrist tribe word before omit\"") .arg("--networkId") .arg(format!("{}", network_id)) - .arg("--chainId") + .arg("--chain.chainId") .arg(format!("{}", chain_id)) .spawn() .map_err(|e| { @@ -110,8 +108,8 @@ impl GanacheInstance { pub fn fork(&self) -> Result { let port = unused_tcp_port()?; let binary = match cfg!(windows) { - true => "ganache-cli.cmd", - false => "ganache-cli", + true => "ganache.cmd", + false => "ganache", }; let child = Command::new(binary) .stdout(Stdio::piped()) @@ -119,9 +117,7 @@ impl GanacheInstance { .arg(self.endpoint()) .arg("--port") .arg(format!("{}", port)) - .arg("--keepAliveTimeout") - .arg("0") - .arg("--chainId") + .arg("--chain.chainId") .arg(format!("{}", self.chain_id)) .spawn() .map_err(|e| { @@ -178,8 +174,7 @@ impl GanacheInstance { .await .map(|_| ()) .map_err(|_| { - "utils should mine new block with evm_mine (only works with ganache-cli!)" - .to_string() + "utils should mine new block with evm_mine (only works with ganache!)".to_string() }) } } diff --git a/testing/eth1_test_rig/src/lib.rs b/testing/eth1_test_rig/src/lib.rs index fd4fc8ad5..1b80097cc 100644 --- a/testing/eth1_test_rig/src/lib.rs +++ b/testing/eth1_test_rig/src/lib.rs @@ -1,6 +1,6 @@ //! Provides utilities for deploying and manipulating the eth2 deposit contract on the eth1 chain. //! -//! Presently used with [`ganache-cli`](https://github.com/trufflesuite/ganache-cli) to simulate +//! Presently used with [`ganache`](https://github.com/trufflesuite/ganache) to simulate //! the deposit contract for testing beacon node eth1 integration. //! //! Not tested to work with actual clients (e.g., geth). It should work fine, however there may be @@ -23,7 +23,7 @@ use web3::Web3; pub const DEPLOYER_ACCOUNTS_INDEX: usize = 0; pub const DEPOSIT_ACCOUNTS_INDEX: usize = 0; -/// Provides a dedicated ganache-cli instance with the deposit contract already deployed. +/// Provides a dedicated ganache instance with the deposit contract already deployed. pub struct GanacheEth1Instance { pub ganache: GanacheInstance, pub deposit_contract: DepositContract, diff --git a/testing/simulator/src/cli.rs b/testing/simulator/src/cli.rs index e0b2a3726..28f1a2562 100644 --- a/testing/simulator/src/cli.rs +++ b/testing/simulator/src/cli.rs @@ -10,7 +10,7 @@ pub fn cli_app<'a, 'b>() -> App<'a, 'b> { .about( "Lighthouse Beacon Chain Simulator creates `n` beacon node and validator clients, \ each with `v` validators. A deposit contract is deployed at the start of the \ - simulation using a local `ganache-cli` instance (you must have `ganache-cli` \ + simulation using a local `ganache` instance (you must have `ganache` \ installed and avaliable on your path). All beacon nodes independently listen \ for genesis from the deposit contract, then start operating. \ \ diff --git a/testing/simulator/src/main.rs b/testing/simulator/src/main.rs index 4fb9a235b..9e05a539c 100644 --- a/testing/simulator/src/main.rs +++ b/testing/simulator/src/main.rs @@ -2,7 +2,7 @@ //! This crate provides a simluation that creates `n` beacon node and validator clients, each with //! `v` validators. A deposit contract is deployed at the start of the simulation using a local -//! `ganache-cli` instance (you must have `ganache-cli` installed and avaliable on your path). All +//! `ganache` instance (you must have `ganache` installed and avaliable on your path). All //! beacon nodes independently listen for genesis from the deposit contract, then start operating. //! //! As the simulation runs, there are checks made to ensure that all components are running