Caution
This is not stable or complete yet! Don't use it yet in any production or testing environments.
Implemented using rblib.
Here we will start builder playground, configure it to use unichain-builder as an external builder, configure prometheus and grafana, start unichain-builder and spam the node with transactions using contender. This will give us an end-to-end manual testing environment.
cargo build --releasegit clone https://github.com/flashbots/builder-playground.gitcargo install --git https://github.com/flashbots/contender --lockedCreate the following yaml files (in any directory) that will spin up grafana and prometheus servers:
docker-compose.yml
services:
prometheus:
image: prom/prometheus
ports:
- "19090:9090"
volumes:
- ./prometheus.yml:/etc/prometheus/prometheus.yml
command:
- '--config.file=/etc/prometheus/prometheus.yml'
grafana:
image: grafana/grafana
ports:
- "3000:3000"
environment:
- GF_SECURITY_ADMIN_USER=admin
- GF_SECURITY_ADMIN_PASSWORD=admin
depends_on:
- prometheusprometheus.yml
global:
scrape_interval: 5s
scrape_configs:
- job_name: 'my_exporter'
static_configs:
- targets: [ 'host.docker.internal:5559' ]Remember to delete temporary directories created by builder-playground and unichain-builder between runs, otherwise
you will get errors about mismatched genesis block hashes.
For example on macOS use those commands:
rm -rf "~/Library/Caches/reth"
rm -rf "~/Library/Application\ Support/reth"
rm -rf "~/.playground"On other platforms you can figure out the equivalent paths from the logs emitted by builder-playground and
unichain-builder.
Inside the cloned builder-playground repo from setup step 3 run:
./builder-playground cook opstack --with-prometheus --external-builder http://host.docker.internal:7891Run the release version of unichain-builder binary from this repo with --builder.playground flag.
debugbuilds will work too but builder's performance will be severely degraded.
RUST_LOG=debug ./target/release/unichain-builder node --builder.playground --metrics=localhost:5559Go to the directory where files from setup step 4 were created and run
docker compose upOpen http://localhost:3000 in your browser to navigate to Grafana (note that the default credentials are admin for username and password), then:
- Add a new Prometheus data source that points to
http://prometheus:9090 - Create a new dashboard by importing the
grafana/classic.jsonfile from this repo.
Non-reverting transactions:
contender spam --tps=150 -l -r http://localhost:2222 --min-balance 1000.5etherReverting transactions:
contender spam --tps 30 -l -r http://localhost:2222 --min-balance 1000.5ether reverttokio-console can be optionally enabled under the debug feature flag:
RUSTFLAGS="--cfg tokio_unstable" cargo build --release --features debug