Added Assertoor tests to the local-testnet CI. - The assertoor logs are included in the `logs-local-testnet` that is uploaded to GitHub Artifacts. - Use `start_local_testnet.sh` so that we can also easily run the test locally.
Simple Local Testnet
These scripts allow for running a small local testnet with a default of 4 beacon nodes, 4 validator clients and 4 Geth execution clients using Kurtosis. This setup can be useful for testing and development.
Installation
-
Install Docker. Verify that Docker has been successfully installed by running
sudo docker run hello-world. -
Install Kurtosis. Verify that Kurtosis has been successfully installed by running
kurtosis versionwhich should display the version. -
Install
yq. If you are on Ubuntu, you can installyqby runningsnap install yq.
Starting the testnet
To start a testnet, from the Lighthouse root repository:
cd ./scripts/local_testnet
./start_local_testnet.sh
It will build a Lighthouse docker image from the root of the directory and will take an approximately 12 minutes to complete. Once built, the testing will be started automatically. You will see a list of services running and "Started!" at the end.
You can also select your own Lighthouse docker image to use by specifying it in network_params.yml under the cl_image key.
Full configuration reference for Kurtosis is specified here.
To view all running services:
kurtosis enclave inspect local-testnet
To view the logs:
kurtosis service logs local-testnet $SERVICE_NAME
where $SERVICE_NAME is obtained by inspecting the running services above. For example, to view the logs of the first beacon node, validator client and Geth:
kurtosis service logs local-testnet -f cl-1-lighthouse-geth
kurtosis service logs local-testnet -f vc-1-geth-lighthouse
kurtosis service logs local-testnet -f el-1-geth-lighthouse
If you would like to save the logs, use the command:
kurtosis dump $OUTPUT_DIRECTORY
This will create a folder named $OUTPUT_DIRECTORY in the present working directory that contains all logs and other information. If you want the logs for a particular service and saved to a file named logs.txt:
kurtosis service logs local-testnet $SERVICE_NAME -a > logs.txt
where $SERVICE_NAME can be viewed by running kurtosis enclave inspect local-testnet.
Kurtosis comes with a Dora explorer which can be opened with:
open $(kurtosis port print local-testnet dora http)
Some testnet parameters can be varied by modifying the network_params.yaml file. Kurtosis also comes with a web UI which can be open with kurtosis web.
Stopping the testnet
To stop the testnet, from the Lighthouse root repository:
cd ./scripts/local_testnet
./stop_local_testnet.sh
You will see "Local testnet stopped." at the end.
CLI options
The script comes with some CLI options, which can be viewed with ./start_local_testnet.sh --help. One of the CLI options is to avoid rebuilding Lighthouse each time the testnet starts, which can be configured with the command:
./start_local_testnet.sh -b false
Further reading about Kurtosis
You may refer to this article for information about Kurtosis.