Replace ganache-cli with anvil (#3555)

## Issue Addressed

N/A

## Proposed Changes

Replace ganache-cli with anvil https://github.com/foundry-rs/foundry/blob/master/anvil/README.md
We can lose all js dependencies in CI as a consequence.

## Additional info
Also changes the ethers-rs version used in the execution layer (for the transaction reconstruction) to a newer one. This was necessary to get use the ethers utils for anvil. The fixed execution engine integration tests should catch any potential issues with the payload reconstruction after #3592 


Co-authored-by: Michael Sproul <michael@sigmaprime.io>
This commit is contained in:
Pawan Dhananjay
2023-05-15 07:22:02 +00:00
parent 3c029d48bf
commit 8a3eb4df9c
24 changed files with 465 additions and 506 deletions

View File

@@ -17,7 +17,7 @@ make install-lcli
Modify `vars.env` as desired.
Start a local eth1 ganache server plus boot node along with `BN_COUNT`
Start a local eth1 anvil server plus boot node along with `BN_COUNT`
number of beacon nodes and `VC_COUNT` validator clients.
The `start_local_testnet.sh` script takes four options `-v VC_COUNT`, `-d DEBUG_LEVEL`, `-p` to enable builder proposals and `-h` for help.
@@ -41,9 +41,9 @@ This is not necessary before `start_local_testnet.sh` as it invokes `stop_local_
These scripts are used by ./start_local_testnet.sh and may be used to manually
Start a local eth1 ganache server
Start a local eth1 anvil server
```bash
./ganache_test_node.sh
./anvil_test_node.sh
```
Assuming you are happy with the configuration in `vars.env`, deploy the deposit contract, make deposits,

View File

@@ -0,0 +1,14 @@
#!/usr/bin/env bash
set -Eeuo pipefail
source ./vars.env
exec anvil \
--balance 1000000000 \
--gas-limit 1000000000 \
--accounts 10 \
--mnemonic "$ETH1_NETWORK_MNEMONIC" \
--block-time $SECONDS_PER_ETH1_BLOCK \
--port 8545 \
--chain-id "$CHAIN_ID"

View File

@@ -1,14 +0,0 @@
#!/usr/bin/env bash
set -Eeuo pipefail
source ./vars.env
exec ganache \
--defaultBalanceEther 1000000000 \
--gasLimit 1000000000 \
--accounts 10 \
--mnemonic "$ETH1_NETWORK_MNEMONIC" \
--port 8545 \
--blockTime $SECONDS_PER_ETH1_BLOCK \
--chain.chainId "$CHAIN_ID"

View File

@@ -92,11 +92,11 @@ execute_command_add_PID() {
echo "$!" >> $PID_FILE
}
# Start ganache, setup things up and start the bootnode.
# Start anvil, setup things up and start the bootnode.
# The delays are necessary, hopefully there is a better way :(
# Delay to let ganache to get started
execute_command_add_PID ganache_test_node.log ./ganache_test_node.sh
# Delay to let anvil to get started
execute_command_add_PID anvil_test_node.log ./anvil_test_node.sh
sleeping 10
# Setup data

View File

@@ -4,7 +4,7 @@ DATADIR=~/.lighthouse/local-testnet
# Directory for the eth2 config
TESTNET_DIR=$DATADIR/testnet
# Mnemonic for the ganache test network
# Mnemonic for the anvil test network
ETH1_NETWORK_MNEMONIC="vast thought differ pull jewel broom cook wrist tribe word before omit"
# Hardcoded deposit contract based on ETH1_NETWORK_MNEMONIC