Skip to content

Commit

Permalink
feat: run locally script
Browse files Browse the repository at this point in the history
  • Loading branch information
Maddiaa0 committed Jan 21, 2025
1 parent 88f2947 commit d5df245
Show file tree
Hide file tree
Showing 8 changed files with 38 additions and 16 deletions.
4 changes: 2 additions & 2 deletions spartan/aztec-network/eth-devnet/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ services:
dockerfile: entrypoints/eth-validator.Dockerfile
volumes:
- "eth_validator_data:/data"
- "${PWD}/config/keys:/data/validators"
- "${PWD}/config/secrets:/data/secrets"
- "${PWD}/config/val-keys/data/keys:/validator_setup/validators"
- "${PWD}/config/val-keys/data/secrets:/validator_setup/secrets"
- "${PWD}/out/config.yaml:/genesis/config.yaml"
- "${PWD}/out/deposit_contract_block.txt:/genesis/deposit_contract_block.txt"
- "${PWD}/out/genesis.ssz:/genesis/genesis.ssz"
Expand Down
10 changes: 7 additions & 3 deletions spartan/aztec-network/eth-devnet/entrypoints/eth-beacon.sh
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
#! /bin/bash

if [ "$K8S_MODE" = "true" ]; then
if [ -n "$K8S_MODE" ] && [ "$K8S_MODE" = "true" ]; then
# In k8s config maps cannot contain ssz files
# Genesis information is copied such that we can write into it
# First serialize the ssz file
echo "running in k8s mode"
cp -r /genesis-template /genesis &&
base64 -d /genesis/genesis-ssz > /genesis/genesis.ssz
fi

echo "env vars: $BEACON_HTTP_PORT"
echo "env vars: $ETH_EXECUTION_URL"

lighthouse bn \
--disable-peer-scoring \
--disable-packet-filter \
Expand All @@ -16,13 +20,13 @@ lighthouse bn \
--staking \
--http \
--http-address=0.0.0.0 \
--http-port=$BEACON_HTTP_PORT \
--http-port=${BEACON_HTTP_PORT} \
--validator-monitor-auto \
--http-allow-origin='*' \
--listen-address=0.0.0.0 \
--target-peers=0 \
--testnet-dir=/genesis \
--execution-endpoints=$ETH_EXECUTION_URL \
--execution-endpoints=${ETH_EXECUTION_URL} \
--execution-jwt-secret-key="61e1dd9539e8cc37b3d71dcf8ce372f0e119cc1c73426ee80472a4214f2a41a1" \
--allow-insecure-genesis-sync \
--debug-level=info
4 changes: 2 additions & 2 deletions spartan/aztec-network/eth-devnet/entrypoints/eth-execution.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

reth node \
--http \
--http.port=$HTTP_PORT \
--http.port=${HTTP_PORT} \
--http.addr="0.0.0.0" \
--http.api="admin,net,eth,web3,debug,trace" \
--http.corsdomain="*" \
--txpool.max-tx-input-bytes=$MAX_TX_INPUT_SIZE_BYTES \
--txpool.max-tx-input-bytes=${MAX_TX_INPUT_SIZE_BYTES} \
--max-outbound-peers=0 \
--max-inbound-peers=0 \
--ipcdisable \
Expand Down
13 changes: 11 additions & 2 deletions spartan/aztec-network/eth-devnet/entrypoints/eth-validator.sh
Original file line number Diff line number Diff line change
@@ -1,19 +1,28 @@
#! /bin/bash

if [ "$K8S_MODE" = "true" ]; then
if [ -n "$K8S_MODE" ] && [ "$K8S_MODE" = "true" ]; then
cp -r /genesis-template /genesis &&
mkdir -p /data/validators &&
mkdir -p /data/secrets &&
cp -r /validator-setup/keys/* /data/validators &&
cp -r /validator-setup/secrets/* /data/secrets &&
base64 -d /genesis/genesis-ssz > /genesis/genesis.ssz
else
echo "making data folder"
mkdir -p /data/validators
mkdir -p /data/secrets
cp -r /validator_setup/validators/* /data/validators
cp -r /validator_setup/secrets/* /data/secrets
fi

echo "validators: $(ls -la /data/validators)"
echo "secrets: $(ls -la /data/secrets)"

echo $ETH_BEACON_URL

lighthouse vc \
--datadir="/data" \
--beacon-nodes=$ETH_BEACON_URL \
--beacon-nodes=${ETH_BEACON_URL} \
--testnet-dir=/genesis \
--init-slashing-protection \
--suggested-fee-recipient="0xff00000000000000000000000000000000c0ffee" \
Expand Down
6 changes: 6 additions & 0 deletions spartan/aztec-network/eth-devnet/run-locally.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#! /bin/bash

REPO_ROOT=$(git rev-parse --show-toplevel)

${REPO_ROOT}/spartan/aztec-network/eth-devnet/create.sh
(cd ${REPO_ROOT}/spartan/aztec-network/eth-devnet && docker compose up)
6 changes: 4 additions & 2 deletions spartan/aztec-network/templates/eth/eth-execution.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,10 @@ spec:
- name: ethereum
image: "{{ .Values.images.reth.image }}"
imagePullPolicy: {{ .Values.images.reth.pullPolicy }}
command: ["/bin/sh"]
args: ["/entrypoints/eth-execution.sh"]
command: ["/bin/sh", "-c"]
args:
- |
exec /entrypoints/eth-execution.sh
env:
- name: K8S_MODE
value: "true"
Expand Down
2 changes: 1 addition & 1 deletion spartan/aztec-network/templates/eth/eth-validator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ spec:
- name: shared-volume
mountPath: /data
- name: genesis
mountPath: /genesis
mountPath: /genesis-template
- name: validator-setup
mountPath: /validator-setup
- name: entrypoint-scripts
Expand Down
9 changes: 5 additions & 4 deletions spartan/aztec-network/values/exp-1.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,8 @@ jobs:
enable: false

ethereum:
resources:
requests:
memory: "5Gi"
cpu: "1.5"
execution:
resources:
requests:
memory: "5Gi"
cpu: "1.5"

0 comments on commit d5df245

Please sign in to comment.