Skip to content

Commit d811d3f

Browse files
authored
Add ability to generate recipes in YAML and override (#323)
- New ability to override recipes based on YAML files - New recipe custom recipes based on base recipes - New `generate` command to spit out base and custom recipes as YAML files (along with e.g. `rbuilder.toml` config) - New `recipes` command to list available base and custom recipes - `start` command now takes recipe files as argument in addition to still accepting base recipes - New `test` command which sends a test tx to EL running locally TODOs: - [x] Docs - [x] Unit tests
1 parent ceadfcb commit d811d3f

17 files changed

+3430
-13
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,5 @@ e2e-test/
66
playground/cache
77
playground/utils/op-deployer*
88
playground/utils/state.json
9+
recipe/
10+
/playground.yaml

README.md

Lines changed: 37 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,49 @@ builder-playground start l1
2222
builder-playground start opstack --external-builder http://localhost:4444
2323
```
2424

25+
## Installation
26+
27+
```
28+
$ go install github.com/flashbots/builder-playground@latest
29+
```
30+
31+
or clone the repository and do:
32+
33+
```
34+
$ go install .
35+
```
36+
37+
or do `go build .` and run from the repository like `./builder-playground`.
38+
2539
## Getting started
2640

27-
Clone the repository and use the `start` command to deploy a specific recipe:
41+
See the available recipes from the `recipes` command:
42+
43+
```
44+
Base Recipes:
45+
l1
46+
Deploy a full L1 stack with mev-boost
47+
reth, lighthouse-beacon-node, lighthouse-validator-node, mev-boost-relay
48+
49+
... (more base and custom recipes available in the original output)
50+
```
51+
52+
Use the `start` command to deploy a specific recipe:
53+
54+
```bash
55+
$ builder-playground start l1
56+
```
57+
58+
and you can send a test transaction from prefunded accounts by using:
2859

2960
```bash
30-
$ builder-playground start <recipe>
61+
$ builder-playground test
3162
```
3263

64+
If you need to modify a recipe or build your own, make sure to check out the [custom recipes](docs/custom_recipes.md) documentation!
65+
66+
Base recipes are also runnable with some flags and you can check out the documentation [here](docs/recipes) do find out.
67+
3368
Currently available recipes:
3469

3570
### L1 Recipe

custom-recipes/rbuilder/bin.yaml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
base: l1
2+
description: Use reth and rbuilder binaries from GitHub releases
3+
4+
recipe:
5+
reth:
6+
services:
7+
el:
8+
release:
9+
name: "reth"
10+
org: "paradigmxyz"
11+
version: "v1.10.1"
12+
13+
builder:
14+
services:
15+
rbuilder:
16+
release:
17+
name: "rbuilder"
18+
org: "flashbots"
19+
version: "v1.3.4"
20+
format: "binary"
21+
args:
22+
- "run"
23+
- "rbuilder.toml"
24+
files:
25+
"rbuilder.toml": "rbuilder.toml"
26+
depends_on:
27+
- "el:healthy"
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
base: l1
2+
description: Use custom local reth and rbuilder binaries
3+
4+
recipe:
5+
reth:
6+
services:
7+
el:
8+
# Use a custom local reth binary - specify relative or absolute path
9+
host_path: "reth"
10+
11+
builder:
12+
services:
13+
rbuilder:
14+
# Use a custom local rbuilder binary - specify relative or absolute path
15+
host_path: "rbuilder"
16+
args:
17+
- "run"
18+
- "rbuilder.toml"
19+
files:
20+
"rbuilder.toml": "rbuilder.toml"
21+
depends_on:
22+
- "el:healthy"
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
log_json = false
2+
log_level = "info,rbuilder=debug"
3+
redacted_telemetry_server_port = 6061
4+
redacted_telemetry_server_ip = "0.0.0.0"
5+
full_telemetry_server_port = 6060
6+
full_telemetry_server_ip = "0.0.0.0"
7+
8+
# Paths relative to artifacts directory
9+
chain = "genesis.json"
10+
reth_datadir = "volume-el-data"
11+
el_node_ipc_path = "volume-el-data/reth.ipc"
12+
13+
# Ethereum private key for coinbase (receives builder fees)
14+
# This is the first prefunded account (0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266)
15+
coinbase_secret_key = "0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80"
16+
17+
# BLS secret key for signing relay submissions
18+
relay_secret_key = "0x25295f0d1d592a90b333e26e85149708208e9f8e8bc18f6c77bd62f8ad7a6866"
19+
20+
cl_node_url = ["http://localhost:3500"]
21+
jsonrpc_server_port = 8645
22+
jsonrpc_server_ip = "0.0.0.0"
23+
extra_data = "Playground Builder ⚡🤖"
24+
25+
ignore_cancellable_orders = true
26+
27+
# Required sparse trie settings
28+
root_hash_use_sparse_trie = true
29+
root_hash_compare_sparse_trie = false
30+
31+
# Start bidding immediately
32+
slot_delta_to_start_bidding_ms = -20000
33+
34+
live_builders = ["mp-ordering"]
35+
36+
enabled_relays = ["playground"]
37+
38+
# Local mev-boost-relay for slot info and block submission
39+
[[relays]]
40+
name = "playground"
41+
url = "http://localhost:5555"
42+
priority = 0
43+
use_ssz_for_submit = false
44+
use_gzip_for_submit = false
45+
mode = "full"
46+
47+
[[builders]]
48+
name = "mp-ordering"
49+
algo = "ordering-builder"
50+
discard_txs = true
51+
sorting = "max-profit"
52+
failed_order_retries = 1
53+
drop_failed_orders = true

docs/custom_recipes.md

Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
# Custom Recipes
2+
3+
> **Important:** This is yet an experimental feature and sometimes might not always work as intended. Please submit issues with your use cases if you find any problems.
4+
5+
Custom recipes let you build on top of existing base recipes (like `l1`, `opstack`, or `buildernet`) by adding, removing, or modifying components and services. Instead of duplicating entire configurations, you write a small YAML file that describes only the changes you want to make.
6+
7+
## How Custom Recipes Work
8+
9+
A custom recipe is a YAML file with two main parts:
10+
11+
- **`base`**: The name of the base recipe to extend (e.g., `l1`)
12+
- **`recipe`**: A map of components and services to add, modify, or remove
13+
14+
The playground merges your customizations with the base recipe at runtime. You can:
15+
16+
- Change container images and versions
17+
- Add new services or components
18+
- Remove existing services or components
19+
- Override arguments, environment variables, and configuration files
20+
21+
## Quick Start: Writing a Simple Custom Recipe
22+
23+
Let's create a custom recipe that uses a specific version of reth. Create a file called `playground.yaml`:
24+
25+
```yaml
26+
base: l1
27+
28+
recipe:
29+
reth:
30+
services:
31+
el:
32+
tag: v1.9.0
33+
```
34+
35+
This tells the playground to start with the `l1` recipe but override the `el` service in the `reth` component to use tag `v1.9.0`.
36+
37+
You can also change the image entirely:
38+
39+
```yaml
40+
base: l1
41+
42+
recipe:
43+
reth:
44+
services:
45+
el:
46+
image: ghcr.io/my-org/my-reth-fork-image
47+
tag: v1.9.0
48+
```
49+
50+
## Running Your Custom Recipe
51+
52+
Once you have a `playground.yaml` file, run it with:
53+
54+
```bash
55+
playground start playground.yaml
56+
```
57+
58+
The playground will load the base recipe, apply your modifications, and start all the services.
59+
60+
---
61+
62+
# Browsing Available Recipes
63+
64+
To see all available base recipes and pre-built custom recipes:
65+
66+
```bash
67+
playground recipes
68+
```
69+
70+
This shows:
71+
72+
- **Base Recipes**: Core recipes like `l1`, `opstack`, `buildernet`
73+
- **Custom Recipes**: Pre-built configurations like `rbuilder/bin` and `rbuilder/custom`
74+
75+
Each recipe displays a description and the components it includes.
76+
77+
## Running a Pre-Built Custom Recipe
78+
79+
You can run any custom recipe directly by name:
80+
81+
```bash
82+
playground start rbuilder/bin
83+
```
84+
85+
This is equivalent to generating the custom recipe files and running them when you don't need to modify the recipe.
86+
87+
## Generating a Custom Recipe
88+
89+
If you want to inspect or modify a pre-built custom recipe, generate it to your current directory:
90+
91+
```bash
92+
playground generate rbuilder/bin
93+
```
94+
95+
This creates:
96+
97+
- `playground.yaml` - The recipe configuration
98+
- Any additional files the recipe needs (e.g., `rbuilder.toml`)
99+
100+
You can then edit these files and run:
101+
102+
```bash
103+
playground start playground.yaml
104+
```
105+
106+
---
107+
108+
# Generating a Full Base Recipe
109+
110+
Sometimes you want to see the complete configuration of a base recipe, modify it extensively, and run your own version. You can generate the full YAML representation of any base recipe:
111+
112+
```bash
113+
playground generate l1
114+
```
115+
116+
This creates a `playground.yaml` file with the complete `l1` recipe, showing all components, services, images, arguments, and configuration.
117+
118+
Then edit `playground.yaml` to make any changes you need, and run it:
119+
120+
```bash
121+
playground start playground.yaml
122+
```
123+
124+
This approach gives you full control over every aspect of the recipe while still benefiting from the playground's orchestration.

0 commit comments

Comments
 (0)