You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+145Lines changed: 145 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -135,6 +135,151 @@ Then you run it with `docker run`, adding CLI flags as needed:
135
135
docker run consensus --checkpoint-sync <url> --network <network> ...
136
136
```
137
137
138
+
# Testing Environment with Kurtosis
139
+
140
+
To test the node locally, we can simulate other nodes and start from genesis using [`Kurtosis`](https://docs.kurtosis.com/) and the Lambda Class fork of [`ethereum-package`](https://github.com/lambdaclass/ethereum-package.git).
141
+
142
+
### Why Use Kurtosis
143
+
We can test the process and transition of the Beacon state and execution of the consensus rules by connecting the node to Sepolia or even Mainnet. However, testing validators requires at least 32 ETH, which is hard to acquire even in Testnet, and being selected as a block proposer can be a never-ending task. For these reasons, and especially the ability to test multiple validators and completely different scenarios, the best approach currently is to use [`Kurtosis`](https://docs.kurtosis.com/). In combination with the [`ethereum-package`](https://github.com/lambdaclass/ethereum-package.git), kurtosis is a great way to simulate local testnets with a high level of control over the network participants.
> This is a Kurtosis package that will spin up a private Ethereum testnet over Docker or Kubernetes with multi-client support, Flashbot's mev-boost infrastructure for PBS-related testing/validation, and other useful network tools (transaction spammer, monitoring tools, etc). Kurtosis packages are entirely reproducible and composable, so this will work the same way over Docker or Kubernetes, in the cloud or locally on your machine.
153
+
154
+
After kurtosis is installed, we need to do three setup steps.
155
+
156
+
1. Clone the lambdaclass ethereum-package fork and checkout a particular branch
157
+
2. Copy our Grafana custom dashboards to be able to look at them
# alternatively, you could build the repo without the node config and cookie just by running
180
+
# docker build -t lambda_ethereum_consensus .
181
+
```
182
+
183
+
After that, we will be ready to tweak the configuration.
184
+
185
+
```bash
186
+
# assumming you are still in the lambda_ethereum_consensus repo, you can modify the configuration through
187
+
vim network_params.yaml
188
+
```
189
+
190
+
We have some sensible defaults for a simple network of 3 clients with 64 Validators each (ethereum-package default) and a slight tweak to the memory limit. Here is an example of the doc; all parameters are explained in [their documentation](https://github.com/ethpandaops/ethereum-package?tab=readme-ov-file#configuration).
191
+
192
+
```yaml
193
+
participants:
194
+
- el_type: geth
195
+
cl_type: lighthouse
196
+
count: 2
197
+
- el_type: geth
198
+
cl_type: lambda
199
+
cl_image: lambda_ethereum_consensus:latest
200
+
use_separate_vc: false
201
+
count: 1
202
+
cl_max_mem: 4096
203
+
```
204
+
205
+
### Kurtosis Execution and Make tasks
206
+
207
+
For starting the local environment after the setup run:
208
+
209
+
```bash
210
+
# Using the make task
211
+
make kurtosis.start
212
+
213
+
# which executes
214
+
kurtosis run --enclave lambdanet ../ethereum-package --args-file network_params.yaml
215
+
```
216
+
217
+
Then, you can connect to the service (running docker instance) with the following:
218
+
219
+
```bash
220
+
# to connect to the instance
221
+
make kurtosis.connect
222
+
223
+
# you can specify the KURTOSIS_SERVICE if the config is different from the default provided:
224
+
make kurtosis.connect KURTOSIS_SERVICE=cl-6-lambda-geth
225
+
```
226
+
227
+
Once inside the service, you can connect to the node with a new IEX session running the following.
228
+
229
+
```bash
230
+
make kurtosis.connect.iex
231
+
232
+
# if you set a specific cookie, you can add it as an argument as before
233
+
make kurtosis.connect.iex KURTOSIS_COOKIE=my_secret
#Interactive Elixir (1.16.2) - press Ctrl+C to exit (type h() ENTER for help)
245
+
246
+
Constants.versioned_hash_version_kzg()
247
+
# <<1>>
248
+
```
249
+
250
+
### Kurtosis metrics
251
+
252
+
The [`ethereum-package`](https://github.com/lambdaclass/ethereum-package.git) has prometheus and grafana support built-in. Metrics are being picked up correctly by prometheus, and we have already copied our custom grafana dashboards during the setup step, so you can inspect all of that by accessing the home pages for any of the services (looking for the mapped docker ports). If you want to make changes to the dashboards and see them working with kurtosis afterward, you'll need to update them running again:
253
+
254
+
```bash
255
+
make kurtosis.setup.grafana
256
+
```
257
+
258
+
By default, `ethereum-package` shows it's dashboards in the home page, to see our custom dashboards it's needed to go to `Dashboards` in the left panel and then enter our own `lambdaconsensus` folder.
259
+
260
+
### Kurtosis cleanup
261
+
262
+
For a complete cleanup, you could execute the following task.
263
+
264
+
```bash
265
+
# Stop, remove and clean
266
+
make kurtosis.purge
267
+
```
268
+
269
+
Suppose the stop was made manually, the purge failed in some step, or the environment was inconsistent for other reasons. In that case, It is also possible to execute every cleanup task individually avoiding the ones not needed:
0 commit comments