Skip to content

Commit

Permalink
Add local eth+suave devnet setup (#33)
Browse files Browse the repository at this point in the history
* [feat] add local eth+suave devnet setup

* drop the need to clone `kurtosis-ethereum-package`

..now that ethpandaops/ethereum-package#489
is merged

* fix: pin the dependencies

* fix the typo

* fix the volume name
  • Loading branch information
0x416e746f6e authored Mar 14, 2024
1 parent c73e161 commit 7a2feb5
Show file tree
Hide file tree
Showing 7 changed files with 389 additions and 15 deletions.
16 changes: 8 additions & 8 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"[solidity]": {
"editor.defaultFormatter": "JuanBlanco.solidity",
"editor.formatOnSave": true,
"[solidity]": {
"editor.defaultFormatter": "JuanBlanco.solidity"
},
"solidity.compileUsingRemoteVersion": "v0.8.16",
"solidity.formatter": "forge",
"solidity.packageDefaultDependenciesContractsDirectory": "src",
"solidity.packageDefaultDependenciesDirectory": "lib"
}
},
"solidity.compileUsingRemoteVersion": "v0.8.16",
"solidity.formatter": "forge",
"solidity.packageDefaultDependenciesContractsDirectory": "src",
"solidity.packageDefaultDependenciesDirectory": "lib",
}
23 changes: 20 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,29 @@ fmt:
.PHONY: lt
lt: lint test

.PHONY: devnet-up
devnet-up:
@kurtosis run \
--enclave eth-devnet \
github.com/kurtosis-tech/[email protected] \
"$$( cat ./devnet/kurtosis.yaml )"
@kurtosis service stop eth-devnet mev-flood
@docker compose --file ./devnet/docker-compose.yaml up --detach

.PHONY: devnet-down
devnet-down:
@docker compose --file ./devnet/docker-compose.yaml down
@docker volume rm devnet_suave-blockscout-db-data || true
@kurtosis enclave stop eth-devnet
@kurtosis enclave rm eth-devnet
@kurtosis engine stop

.PHONY: run-integration
run-integration:
go run examples/build-eth-block/main.go
go run examples/mevm-confidential-store/main.go
go run examples/mevm-is-confidential/main.go
go run examples/onchain-callback/main.go
go run examples/mevm-confidential-store/main.go
go run examples/mevm-is-confidential/main.go
go run examples/onchain-callback/main.go
go run examples/onchain-state/main.go
go run examples/offchain-logs/main.go
go run examples/mevm-context/main.go
48 changes: 47 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,53 @@ forge build

## Start the local devnet

See the instructions in [suave-geth](https://github.com/flashbots/suave-geth#starting-a-local-devnet).
### TL;DR

1. Install prerequisites:

- [Docker](https://docs.docker.com/engine/install/)
- [Kurtosis](https://docs.kurtosis.com/install/)

2. Run

```bash
# Launch kurtosis devnet + sidecar docker-compose with SUAVE
make devnet-up

# Point SUAVE examples to the devnet
export BUILDER_URL=http://el-4-geth-builder-lighthouse:8545
export L1_PRIVKEY=bcdf20249abf0ed6d944c0288fad489e33f66b3960d9e6229c1cd214ed3bbe31

# Run
go run examples/app-ofa-private/main.go

# Tear-down
make devnet-down
```

>
> **Notes:**
>
> 1. If you are Mac OS user, you might want to consider using
> [OrbStack](https://orbstack.dev/) instead of Docker Desktop.
>
> 2. Some of the tests (`app-ofa-private`, for example) will need Eth
> devnet to progress beyond dencun fork. Wait out ~5m after the
> start before running them (roughly slot 128).
>

### Details

Above setup will (among other things) deploy:

- SUAVE devnet RPC on `http://127.0.0.1:8545`
- Eth devnet RPC on `http://127.0.0.1:8555`
- SUAVE explorer on `http://127.0.0.1:8080`
- Eth explorer on `http://127.0.0.1:18080`
- MEV Boost Relay Overview on `http://127.0.0.1:9060`

All Eth components are provisioned by `ethereum-package` from kurtosis.
Please check `https://github.com/kurtosis-tech/ethereum-package` for more info.

---

Expand Down
167 changes: 167 additions & 0 deletions devnet/docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,167 @@
version: "3.9"

networks:
kt-eth-devnet:
name: kt-eth-devnet
external: true # created by ethereum-package from kurtosis

volumes:
suave-blockscout-db-data: null

services:
suave-mevm:
image: flashbots/suave-geth:v0.1.3
container_name: suave-mevm
command: [
"-dev",
"-http.addr", "0.0.0.0",
"-http.api", "debug,eth,net,txpool,web3",
"-http.corsdomain", "*",
"-http.vhosts", "*",
"-http",
"-suave.eth.external-whitelist", "*",
"-suave.eth.remote_endpoint", "http://el-1-geth-lighthouse:8545",
"-ws.addr", "0.0.0.0",
"-ws.origins", "*",
"-ws",
]
ports:
- 8545:8545
- 8546:8546
networks:
- kt-eth-devnet
volumes:
- ./keystore:/keystore

kt-eth-proxy:
image: nginx
container_name: kt-eth-proxy
depends_on:
- suave-blockscout-backend
- suave-blockscout-frontend
- suave-blockscout-stats
environment:
ETH_BOOST_RELAY_WEB_INTERNAL_URL: http://mev-relay-website:9060
ETH_BOOST_RELAY_WEB_PORT: "9060"
ETH_L1_BLOCKSCOUT_INTERNAL_URL: http://blockscout:4000
ETH_L1_BLOCKSCOUT_PROXY_PORT: "18080"
ETH_L1_RPC_INTERNAL_URL: http://el-1-geth-lighthouse:8545/
ETH_L1_RPC_PROXY_PORT: "8555"
SUAVE_BLOCKSCOUT_BACKEND_INTERNAL_URL: http://suave-blockscout-backend:4000
SUAVE_BLOCKSCOUT_FRONTEND_INTERNAL_URL: http://suave-blockscout-frontend:3000
SUAVE_BLOCKSCOUT_PROXY_PORT: "8080"
SUAVE_BLOCKSCOUT_STATS_INTERNAL_URL: http://suave-blockscout-stats:8050/
SUAVE_BLOCKSCOUT_STATS_PROXY_PORT: "8050"
SUAVE_BLOCKSCOUT_URL: http://localhost:3000
volumes:
- ./nginx:/etc/nginx/templates
ports:
- 8050:8050
- 8080:8080
- 8555:8555
- 9060:9060
- 18080:18080
networks:
- kt-eth-devnet

suave-blockscout-db:
image: postgres:14
restart: always
container_name: suave-blockscout-db
command: postgres -c 'max_connections=300'
environment:
POSTGRES_DB: blockscout
POSTGRES_USER: blockscout
POSTGRES_PASSWORD: ceWb1MeLBEeOIfk65gU8EjF8
networks:
- kt-eth-devnet
volumes:
- suave-blockscout-db-data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U blockscout -d blockscout"]
interval: 10s
timeout: 5s
retries: 5
start_period: 10s

suave-blockscout-backend:
image: flashbots/blockscout-backend:0.1.3-5.3.1
container_name: suave-blockscout-backend
restart: always
command: |-
sh -c "bin/blockscout eval \"Elixir.Explorer.ReleaseTasks.create_and_migrate()\" && bin/blockscout start"
environment:
API_V2_ENABLED: true
CHAIN_ID: "16813125"
CHAIN_TYPE: suave
COIN: sETH
DATABASE_URL: postgresql://blockscout:ceWb1MeLBEeOIfk65gU8EjF8@suave-blockscout-db:5432/blockscout?ssl=false
ECTO_USE_SSL: false
ETHEREUM_JSONRPC_HTTP_URL: http://suave-mevm:8545/
ETHEREUM_JSONRPC_TRACE_URL: http://suave-mevm:8545/
ETHEREUM_JSONRPC_TRANSPORT: http
ETHEREUM_JSONRPC_VARIANT: geth
ETHEREUM_JSONRPC_WS_URL: ws://suave-mevm:8546/
PORT: "4000"
POOL_SIZE: "10"
POOL_SIZE_API: "10"
SHOW_TESTNET_LABEL: true
SUBNETWORK: SUAVE Devnet
ports:
- 4000:4000
networks:
- kt-eth-devnet

suave-blockscout-stats:
image: flashbots/blockscout-stats:0.1.3-1.5.0
container_name: suave-blockscout-stats
restart: always
environment:
STATS__BLOCKSCOUT_DB_URL: postgresql://blockscout:ceWb1MeLBEeOIfk65gU8EjF8@suave-blockscout-db:5432/blockscout?ssl=false
STATS__CREATE_DATABASE: true
STATS__DB_URL: postgresql://blockscout:ceWb1MeLBEeOIfk65gU8EjF8@suave-blockscout-db:5432/stats?ssl=false
STATS__RUN_MIGRATIONS: true
STATS__SERVER__HTTP__ADDR: 0.0.0.0:8050
STATS__SERVER__HTTP__CORS__ALLOWED_ORIGIN: http://localhost:3000
STATS__SERVER__HTTP__ENABLED: true
STATS__SERVER__HTTP__MAX_BODY_SIZE: "2097152"
STATS_CHARTS__TEMPLATE_VALUES__NATIVE_COIN_SYMBOL: sETH
networks:
- kt-eth-devnet

suave-blockscout-frontend:
image: flashbots/blockscout-frontend:0.1.3-1.17.0
container_name: suave-blockscout-frontend
restart: always
environment:
NEXT_PUBLIC_AD_BANNER_PROVIDER: none
NEXT_PUBLIC_AD_TEXT_PROVIDER: none
NEXT_PUBLIC_API_HOST: localhost:8080
NEXT_PUBLIC_API_PROTOCOL: http
NEXT_PUBLIC_API_WEBSOCKET_PROTOCOL: ws
NEXT_PUBLIC_APP_HOST: localhost:8080
NEXT_PUBLIC_APP_PROTOCOL: http
NEXT_PUBLIC_IS_SUAVE_CHAIN: true
NEXT_PUBLIC_IS_TESTNET: true
NEXT_PUBLIC_NETWORK_CURRENCY_DECIMALS: "18"
NEXT_PUBLIC_NETWORK_CURRENCY_NAME: SUAVE Devnet Eth
NEXT_PUBLIC_NETWORK_CURRENCY_SYMBOL: sETH
NEXT_PUBLIC_NETWORK_ICON_DARK: https://raw.githubusercontent.com/blockscout/frontend-configs/main/configs/network-icons/suave-short.png
NEXT_PUBLIC_NETWORK_ICON: https://raw.githubusercontent.com/blockscout/frontend-configs/main/configs/network-icons/suave-short.png
NEXT_PUBLIC_NETWORK_ID: "16813125"
NEXT_PUBLIC_NETWORK_LOGO_DARK: https://raw.githubusercontent.com/blockscout/frontend-configs/main/configs/network-logos/suave-light.png
NEXT_PUBLIC_NETWORK_LOGO: https://raw.githubusercontent.com/blockscout/frontend-configs/main/configs/network-logos/suave-light.png
NEXT_PUBLIC_NETWORK_NAME: SUAVE Devnet
NEXT_PUBLIC_NETWORK_RPC_URL: http://suave-mevm:8545
NEXT_PUBLIC_NETWORK_SHORT_NAME: SUAVE
NEXT_PUBLIC_OG_IMAGE_URL: https://raw.githubusercontent.com/blockscout/frontend-configs/main/configs/og-images/suave-testnet.png
NEXT_PUBLIC_PROMOTE_BLOCKSCOUT_IN_TITLE: false
NEXT_PUBLIC_STATS_API_HOST: http://localhost:8050
NEXT_PUBLIC_OG_DESCRIPTION: >-
SUAVE - Single Unifying Auction for Value Expression - is a
platform for building MEV applications such as OFAs and block
builders in a decentralized and private way.
ports:
- 3000:3000
networks:
- kt-eth-devnet
27 changes: 27 additions & 0 deletions devnet/kurtosis.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
network_params:
seconds_per_slot: 3
capella_fork_epoch: 0
deneb_fork_epoch: 2

participants:
- el_client_type: geth
el_client_image: flashbots/suave-execution-geth:v0.0.1-alpha.1-dev-03
cl_client_type: lighthouse
cl_client_image: ""
count: 1
- el_client_type: reth
el_client_image: ""
cl_client_type: lighthouse
cl_client_image: ""
count: 2

mev_type: full

mev_params:
mev_boost_image: flashbots/mev-boost:1.7a1
mev_builder_image: flashbots/builder:1.13.11.4844.dev2
mev_flood_image: flashbots/mev-flood:0.0.9.dev2
mev_relay_image: flashbots/mev-boost-relay:0.29

additional_services:
- blockscout
Loading

0 comments on commit 7a2feb5

Please sign in to comment.