Skip to content

Commit 37a9c76

Browse files
authored
Snapsync makefile (#4119)
**Motivation** <!-- Why does this pull request exist? What are its goals? --> **Description** Add a makefile target to run snapsync on the servers easily <!-- A clear and concise general description of the changes this PR introduces --> <!-- Link to issues: Resolves #111, Resolves #222 -->
1 parent ea08b12 commit 37a9c76

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

tooling/sync/Makefile

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,3 +186,39 @@ start-ethrex: ## Start ethrex for the network given by NETWORK.
186186
--authrpc.jwtsecret $(DATA_PATH)/${NETWORK}_data/jwt.hex \
187187
$(BOOTNODES_FLAG) \
188188
--evm $(EVM)
189+
190+
SERVER_SYNC_BRANCH ?= snap_sync
191+
SERVER_SYNC_NETWORK ?= hoodi
192+
193+
ifeq ($(SERVER_SYNC_NETWORK),hoodi)
194+
CHECKPOINT_URL = https://hoodi-checkpoint-sync.attestant.io/
195+
else ifeq ($(SERVER_SYNC_NETWORK),sepolia)
196+
CHECKPOINT_URL = https://checkpoint-sync.sepolia.ethpandaops.io
197+
else ifeq ($(SERVER_SYNC_NETWORK),mainnet)
198+
CHECKPOINT_URL = https://mainnet-checkpoint-sync.attestant.io
199+
else
200+
$(error Unknown network $(SERVER_SYNC_NETWORK))
201+
endif
202+
203+
LOGS_FILE ?= output.log
204+
205+
# Use make server-sync SERVER_SYNC_BRANCH=branch_name SERVER_SYNC_NETWORK=network_name LOGS_FILE=logs_file_name HEALING=1 MEMORY=1 SNAP=1
206+
# SERVER_SYNC_BRANCH is the branch to checkout before syncing, SERVER_SYNC_NETWORK is the network to sync, LOGS_FILE is the file to output logs to, HEALING enables healing mode, MEMORY uses memory datadir, SNAP enables snap sync mode.
207+
server-sync:
208+
git fetch --all
209+
210+
git checkout $(SERVER_SYNC_BRANCH)
211+
212+
git pull
213+
214+
tmux kill-server || true
215+
216+
sleep 5
217+
218+
tmux new-session -d -s sync -n htop "htop"
219+
220+
tmux new-window -t sync:1 -n lighthouse "cd ../.. && ./lighthouse bn --network $(SERVER_SYNC_NETWORK) --execution-endpoint http://localhost:8551 --execution-jwt ~/secrets/jwt.hex --http --checkpoint-sync-url $(CHECKPOINT_URL) --purge-db-force "
221+
222+
sleep 0.2
223+
224+
tmux new-window -t sync:2 -n ethrex "cd ../.. && ulimit -n 65000 && rm -rf ../.local/share/ethrex && RUST_LOG=ethrex_p2p::rlpx::eth::blocks=off,ethrex_p2p::sync=debug,ethrex_p2p::network=info,ethrex_p2p::discv4=off,spawned_concurrency::tasks::gen_server=off $(if $(HEALING),SKIP_START_SNAP_SYNC=1) cargo run --release --bin ethrex -- --http.addr 0.0.0.0 --network $(SERVER_SYNC_NETWORK) $(if $(MEMORY),--datadir memory) --authrpc.jwtsecret ~/secrets/jwt.hex $(if $(or $(SNAP),$(HEALING)),--syncmode snap) 2>&1 | tee $(LOGS_FILE)"

0 commit comments

Comments
 (0)