Skip to content

Commit

Permalink
Merge pull request #69 from ethpandaops/skylenet/local-setup
Browse files Browse the repository at this point in the history
  • Loading branch information
skylenet authored Jun 26, 2024
2 parents 66f7089 + ea329e8 commit e60703c
Show file tree
Hide file tree
Showing 5 changed files with 98 additions and 1 deletion.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,6 @@ config.yaml
test-config.yaml
config-*.yaml
log-*
tmp-*
tmp-*

.hack/devnet/generated-**.yaml
7 changes: 7 additions & 0 deletions .hack/devnet/cleanup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash
__dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
ENCLAVE_NAME="${ENCLAVE_NAME:-dora}"
kurtosis enclave rm -f "$ENCLAVE_NAME"

echo "Cleaning up generated files..."
rm -f "${__dir}/generated-*.yaml"
10 changes: 10 additions & 0 deletions .hack/devnet/kurtosis.devnet.config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
participants:
- el_type: geth
el_image: ethereum/client-go:stable
cl_type: lighthouse
cl_image: sigp/lighthouse:latest
count: 4
network_params:
seconds_per_slot: 12
additional_services: []
snooper_enabled: false
69 changes: 69 additions & 0 deletions .hack/devnet/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
#!/bin/bash
__dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"

## Run devnet using kurtosis
ENCLAVE_NAME="${ENCLAVE_NAME:-dora}"
if kurtosis enclave inspect "$ENCLAVE_NAME" > /dev/null; then
echo "Kurtosis enclave '$ENCLAVE_NAME' is already up."
else
kurtosis run github.com/ethpandaops/ethereum-package --enclave "$ENCLAVE_NAME" --args-file "${__dir}/kurtosis.devnet.config.yaml"
fi

# Get chain config
kurtosis files inspect dora el_cl_genesis_data ./config.yaml | tail -n +2 > "${__dir}/generated-chain-config.yaml"

## Generate Dora config
ENCLAVE_UUID=$(kurtosis enclave inspect "$ENCLAVE_NAME" --full-uuids | grep 'UUID:' | awk '{print $2}')

BEACON_NODDES=$(docker ps -aq -f "label=enclave_uuid=$ENCLAVE_UUID" \
-f "label=com.kurtosistech.app-id=kurtosis" \
-f "label=com.kurtosistech.custom.ethereum-package.client-type=beacon" | tac)

EXECUTION_NODES=$(docker ps -aq -f "label=enclave_uuid=$ENCLAVE_UUID" \
-f "label=com.kurtosistech.app-id=kurtosis" \
-f "label=com.kurtosistech.custom.ethereum-package.client-type=execution" | tac)

cat <<EOF > "${__dir}/generated-dora-config.yaml"
logging:
outputLevel: "info"
chain:
name: $ENCLAVE_NAME
configPath: "${__dir}/generated-chain-config.yaml"
server:
host: "0.0.0.0"
port: "8080"
frontend:
enabled: true
debug: false
minimize: false
siteName: "Dora the Explorer"
siteSubtitle: "$ENCLAVE_NAME - Kurtosis"
ethExplorerLink: ""
beaconapi:
localCacheSize: 10
redisCacheAddr: ""
redisCachePrefix: ""
endpoints:
$(docker inspect -f " - { name: {{ with index .Config.Labels \"com.kurtosistech.id\"}}{{.}}{{end}}, url: http://{{ with index .NetworkSettings.Networks \"kt-$ENCLAVE_NAME\"}}{{.IPAddress }}:4000{{end}} }" $BEACON_NODDES)
executionapi:
depositLogBatchSize: 1000
endpoints:
$(docker inspect -f " - { name: {{ with index .Config.Labels \"com.kurtosistech.id\"}}{{.}}{{end}}, url: http://{{ with index .NetworkSettings.Networks \"kt-$ENCLAVE_NAME\"}}{{.IPAddress }}:8545{{end}} }" $EXECUTION_NODES)
indexer:
inMemoryEpochs: 8
cachePersistenceDelay: 8
disableIndexWriter: false
syncEpochCooldown: 1
database:
engine: "sqlite"
sqlite:
file: "./tmp-database.sqlite"
EOF


cat <<EOF
============================================================================================================
Dora config at ${__dir}/generated-dora-config.yaml
Chain config at ${__dir}/generated-chain-config.yaml
============================================================================================================
EOF
9 changes: 9 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,12 @@ build:

clean:
rm -f bin/*

devnet:
.hack/devnet/run.sh

devnet-run: devnet
go run cmd/dora-explorer/main.go --config .hack/devnet/generated-dora-config.yaml

devnet-clean:
.hack/devnet/cleanup.sh

0 comments on commit e60703c

Please sign in to comment.