mirror of
https://gitlab.com/pulsechaincom/lighthouse-pulse.git
synced 2024-12-22 03:30:38 +00:00
Updates to tests and local testnet for Ganache 7 (#3056)
## Issue Addressed #2961 ## Proposed Changes -- update `--chainId` -> `--chain.chainId` -- remove `--keepAliveTimeout` -- fix log to listen for -- rename `ganache-cli` to `ganache` everywhere Co-authored-by: realbigsean <sean@sigmaprime.io>
This commit is contained in:
parent
9bc9527998
commit
ae5b141dc4
2
.github/workflows/local-testnet.yml
vendored
2
.github/workflows/local-testnet.yml
vendored
@ -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
|
||||
|
38
.github/workflows/test-suite.yml
vendored
38
.github/workflows/test-suite.yml
vendored
@ -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
|
||||
|
@ -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.
|
||||
|
@ -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,
|
||||
|
@ -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 {
|
||||
|
@ -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"
|
||||
|
@ -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
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Requires `lighthouse`, ``lcli`, `ganache-cli`, `curl`, `jq`
|
||||
# Requires `lighthouse`, ``lcli`, `ganache`, `curl`, `jq`
|
||||
|
||||
BEHAVIOR=$1
|
||||
|
||||
|
@ -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<Self, String> {
|
||||
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<Self, String> {
|
||||
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()
|
||||
})
|
||||
}
|
||||
}
|
||||
|
@ -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,
|
||||
|
@ -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. \
|
||||
\
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user