Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .github/workflows/op_rbuilder_checks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -74,3 +74,13 @@ jobs:
run: make test
env:
TESTS_TEMP_DIR: ${{ github.workspace }}

- name: Run op-rbuilder with builder-playground
uses: flashbots/builder-playground-action@v1
with:
version: v0.3.2-alpha.4
recipe: playground.yaml
args: --skip-setup

- name: Send test tx to op-rbuilder
run: builder-playground test http://localhost:2222 --timeout 30s --retries 10
64 changes: 8 additions & 56 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,75 +128,27 @@ cargo test --package op-rbuilder --lib

## Local Devnet

1. Clone [flashbots/builder-playground](https://github.com/flashbots/builder-playground) and start an OPStack chain.
1. Install [flashbots/builder-playground](https://github.com/flashbots/builder-playground).

```bash
git clone https://github.com/flashbots/builder-playground.git
cd builder-playground
go run main.go cook opstack --external-builder http://host.docker.internal:4444
```

2. Remove any existing `reth` chain db. The following are the default data directories:

- Linux: `$XDG_DATA_HOME/reth/` or `$HOME/.local/share/reth/`
- Windows: `{FOLDERID_RoamingAppData}/reth/`
- macOS: `$HOME/Library/Application Support/reth/`

3. Run `op-rbuilder` in the `rbuilder` repo on port 4444:

```bash
cargo run -p op-rbuilder --bin op-rbuilder -- node \
--chain $HOME/.playground/devnet/l2-genesis.json \
--http --http.port 2222 \
--authrpc.addr 0.0.0.0 --authrpc.port 4444 --authrpc.jwtsecret $HOME/.playground/devnet/jwtsecret \
--port 30333 --disable-discovery \
--metrics 127.0.0.1:9011 \
--rollup.builder-secret-key ac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80 \
--trusted-peers enode://79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8@127.0.0.1:30304
```
2. `builder-playground start playground.yaml` (use `--skip-setup` if you need to skip `cargo build` every time).

4. Run `contender`:
3. Run `contender`:

```bash
cargo run -- spam --tps 10 -r http://localhost:2222 --optimism --min-balance 0.14
```

And you should start to see blocks being built and landed on-chain with `contender` transactions.

## Builder playground

You can quickly spin up an op-stack devnet using [builder-playground](https://github.com/flashbots/builder-playground). The quickest workflow to get op-stack running against your local `op-rbuilder` instance is:

1. Check out the builder playground repo

```
git clone git@github.com:flashbots/builder-playground.git
```
Alternatively, you can send a single test transaction like:

2. In the builder-playgound spin up an l2 opstack setup specifying that it should use an external block builder:

```
go run main.go cook opstack --external-builder http://host.docker.internal:4444
```

3. Run rbuilder in playground mode:

```
cargo run --bin op-rbuilder -- node --builder.playground
```

You could also run it using:

```
just run-playground
```bash
builder-playground test http://localhost:2222 --timeout 30s --retries 10
```

This will automatically try to detect all settings and ports from the currently running playground. Sometimes you might need to clean up the builder-playground state between runs. This can be done using:
op-rbuilder will automatically try to detect all settings and ports from the currently running playground thanks to the `--builder.playground` flag.

```
rm -rf ~/.local/share/reth
sudo rm -rf ~/.playground
```
Make sure to check out `playground.yaml` if you need to inspect or modify the configuration for your local test environment!

## Running GitHub actions locally

Expand Down
2 changes: 1 addition & 1 deletion crates/op-rbuilder/src/args/op.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ pub struct OpRbuilderArgs {
#[arg(
long = "builder.playground",
num_args = 0..=1,
default_missing_value = "$HOME/.playground/devnet/",
default_missing_value = "$HOME/.local/state/builder-playground/devnet",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we take into account $XDG_STATE_HOME? Maybe if not defined fallback to $HOME/.local/state in expand_path?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I thought the same but I was a little afraid of everyone having to do that. It's a small piece of complexity from the playground itself so maybe playground could tell it from builder-playground dir and we could rely on that here? (which should also allow a user to do cd $(builder-playground dir) easily.)

value_parser = expand_path,
env = "PLAYGROUND_DIR",
)]
Expand Down
54 changes: 54 additions & 0 deletions playground.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
base: opstack
base_args:
- --external-builder
- op-rbuilder

setup:
- make op-rbuilder

recipe:
op-rbuilder:
services:
op-rbuilder:
host_path: ./target/debug/op-rbuilder
args:
- node
- --builder.playground # enabling op-rbuilder to detect playground environment and service configurations
- --authrpc.port
- '{{Port "authrpc" 8551}}'
- --authrpc.addr
- 0.0.0.0
- --authrpc.jwtsecret
- /data/jwtsecret
- --http
- --http.addr
- 0.0.0.0
- --http.port
- '{{Port "http" 8545}}'
- --chain
- /data/l2-genesis.json
- --datadir
- /data_op_rbuilder
- --disable-discovery
- --color
- never
- --metrics
- 0.0.0.0:{{Port "metrics" 9090}}
- --port
- '{{Port "rpc" 30303}}'
- --builder.enable-revert-protection
- --rollup.builder-secret-key
- 0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80
- --bootnodes
- '{{Service "bootnode" "rpc" "enode" "79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8"}}'
ports:
authrpc: 4444
http: 2222
metrics: 9011
rpc: 30303
files:
/data/jwtsecret: artifact:jwtsecret
/data/l2-genesis.json: artifact:l2-genesis.json
volumes:
/data_op_rbuilder:
name: data # $HOME/.local/state/builder-playground/devnet/volume-op-rbuilder-data
Loading