Skip to content

Commit 8c25dca

Browse files
authored
Replace Sepolia Erigon archive with pruned Reth (#722)
1 parent 582e986 commit 8c25dca

11 files changed

Lines changed: 203 additions & 120 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ ui/ts/**/*.d.ts.map
3232
# Coverage reports generated by local or CI runs
3333
/coverage
3434
/solidity/coverage
35+
/reth/.env
3536
/trading/artifacts
3637
/trading/node_modules
3738
/trading/ts/artifacts/contractArtifact.ts

augurScan/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ On Windows, run `start.bat` from this directory to start the same Compose comman
2121

2222
Open <http://localhost:3000>. PostgreSQL is included and stored in the `augurscan-data` named volume. The website is available while historical backfill is running and reports the indexed block, its timestamp/age, observed head, lag, percentage complete, estimated time remaining, and network errors. Completion is measured from the effective start block stored for the index to the latest observed head. The ETA appears after the indexer or browser has observed enough forward progress to measure throughput.
2323

24-
The Compose services join the shared external `zoltar` network. When this repository's Erigon Compose project is running, set `SEPOLIA_RPC_URL=http://erigon:8545` to use it without exposing RPC beyond the host.
24+
The Compose services join the shared external `zoltar` network. When this repository's Reth Compose project is running, set `SEPOLIA_RPC_URL=http://reth:8545` to use it without exposing RPC beyond the host.
2525

2626
Set private or higher-capacity RPC endpoints in `.env` for reliable historical indexing. The included public defaults are convenient for evaluation but can rate-limit large backfills. On a fresh database, augurScan searches from `MAINNET_START_BLOCK` or `SEPOLIA_START_BLOCK` through the observed head for the earliest deployment whose history it tracks, then begins indexing at that deployment instead of walking earlier empty blocks. If none of those contracts is deployed yet, indexing waits at the block after the observed head. The conservative default floor of block `0` cannot omit protocol history; a later verified floor reduces historical bytecode reads. Before accepting a manifest change, augurScan verifies that every newly tracked deployment is within the stored index range. An earlier deployment stops with a rebuild error and leaves the current canonical index unchanged. An accepted address, label, or kind change resets that network to its stored effective start and durably replays the current manifest.
2727

erigon/Dockerfile

Lines changed: 0 additions & 6 deletions
This file was deleted.

erigon/Dockerfile.dockerignore

Lines changed: 0 additions & 2 deletions
This file was deleted.

erigon/README.md

Lines changed: 0 additions & 52 deletions
This file was deleted.

erigon/compose.yaml

Lines changed: 0 additions & 42 deletions
This file was deleted.

erigon/docker-entrypoint.sh

Lines changed: 0 additions & 16 deletions
This file was deleted.

reth/.env.example

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Decimal Sepolia block number of the first block whose receipts must be kept.
2+
# Resolve this once for the required UTC cutoff; do not advance it on restarts.
3+
RETH_RECEIPTS_START_BLOCK=
4+
5+
# Host-only JSON-RPC ports. Compose services use reth:8545 and reth:8546.
6+
RETH_RPC_PORT=8545
7+
RETH_WS_PORT=8546

reth/README.md

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
# Sepolia Reth node
2+
3+
This Compose project runs Reth as the Sepolia execution client and Lighthouse as its consensus client. Reth prunes execution history before a fixed boundary while preserving every block body, receipt, and transaction lookup from that block onward. Consequently, `eth_getLogs` remains available from that block even as the node continues running.
4+
5+
## Choose the retention boundary
6+
7+
Copy the environment template before the first start:
8+
9+
```bash
10+
cp .env.example .env
11+
```
12+
13+
Resolve the first Sepolia block whose timestamp is at or after the required UTC boundary—for example, `2026-08-01T00:00:00Z`—using a trusted Sepolia RPC or block explorer. With Foundry installed, the lookup for that example is:
14+
15+
```bash
16+
cast find-block --rpc-url https://your-trusted-sepolia-rpc.example 1785542400
17+
```
18+
19+
Confirm whether the closest block is immediately before or after the cutoff, adjust to the first block at or after it, and put that decimal block number in `.env`:
20+
21+
```dotenv
22+
RETH_RECEIPTS_START_BLOCK=12345678
23+
```
24+
25+
The number above is an example, not the August 2026 Sepolia boundary. Verify the selected block and its parent before starting:
26+
27+
```bash
28+
curl --fail-with-body \
29+
--header 'content-type: application/json' \
30+
--data '{"jsonrpc":"2.0","id":1,"method":"eth_getBlockByNumber","params":["0xbc614e",false]}' \
31+
https://your-trusted-sepolia-rpc.example
32+
```
33+
34+
The selected block's timestamp must be at or after the cutoff, and the preceding block's timestamp must be before it.
35+
36+
> [!WARNING]
37+
> Keep `RETH_RECEIPTS_START_BLOCK` fixed on every restart. Raising it authorizes Reth to permanently delete additional block bodies, receipts, and transaction lookups.
38+
39+
## Start
40+
41+
From this directory, run:
42+
43+
```bash
44+
docker network inspect zoltar >/dev/null 2>&1 || docker network create zoltar
45+
docker compose config
46+
docker compose up -d
47+
docker compose logs -f reth lighthouse
48+
```
49+
50+
On Windows, copy `.env.example` to `.env`, set the retention block, and run `start.bat`.
51+
52+
Applications on the host use `http://localhost:8545` or `ws://localhost:8546`. Other repository Compose services on the external `zoltar` network use `http://reth:8545` or `ws://reth:8546`. Both host ports bind only to loopback; use an authenticated TLS reverse proxy if remote access is required.
53+
54+
Set `RETH_RPC_PORT` or `RETH_WS_PORT` in `.env` to change the host ports without changing the container endpoints.
55+
56+
Allow inbound TCP/UDP `30303` and UDP `9200` for Reth peer discovery, plus TCP/UDP `9000` and UDP `9001` for Lighthouse discovery and QUIC. The JSON-RPC ports do not need public firewall rules because they bind only to host loopback.
57+
58+
## Data and pruning
59+
60+
The `reth-sepolia-data` volume contains execution data and bounded Reth process logs. `lighthouse-sepolia-data` contains consensus data. The `engine-jwt` volume contains the randomly generated Engine API secret shared by both clients. A normal `docker compose down` preserves all three volumes.
61+
62+
The pruning configuration:
63+
64+
- retains block bodies, receipts, and transaction-hash lookups from `RETH_RECEIPTS_START_BLOCK` forward;
65+
- discards sender-recovery data after it is no longer required;
66+
- retains a rolling 10,064-block window of account and storage history;
67+
- retains current state, so current RPC reads and transaction submission continue working.
68+
69+
This supports historical `eth_getLogs` and receipt lookup from the configured boundary. It does not support old state queries or traces outside the rolling state-history window. Block, transaction, and receipt storage will continue growing because the requested event history is retained permanently.
70+
71+
> [!WARNING]
72+
> Never run `docker compose down --volumes` unless all Reth and Lighthouse data may be deleted. Never move the retention boundary forward unless the additional block, transaction, and receipt history may be irreversibly deleted.
73+
74+
## Migration from Erigon
75+
76+
The old Erigon database cannot be reused by Reth. Bring this project up with its new volumes and leave the old Erigon Compose project and volume stopped but intact until Reth is fully synchronized and verified.
77+
78+
During migration, only one execution client can publish host port `8545` and P2P port `30303`. Either stop Erigon before starting this project or temporarily assign different host/P2P ports. Because the checked-in deployment uses fixed P2P ports, the simplest safe sequence is:
79+
80+
1. Stop Erigon with `docker compose down` from the old checkout. Do not pass `--volumes`.
81+
2. Start this Reth project.
82+
3. Wait for both clients to synchronize.
83+
4. Verify the chain ID, sync status, and logs spanning the retention boundary.
84+
5. Point dependent services from `http://erigon:8545` to `http://reth:8545`.
85+
6. Delete the old Erigon volume only after an explicit backup/rollback decision.
86+
87+
Verify the execution endpoint:
88+
89+
```bash
90+
curl --fail-with-body \
91+
--header 'content-type: application/json' \
92+
--data '{"jsonrpc":"2.0","id":1,"method":"eth_chainId","params":[]}' \
93+
http://localhost:8545
94+
```
95+
96+
Sepolia returns `0xaa36a7`. Then query `eth_getLogs` once from the configured start block through a small known range and again across recent blocks. Do not retire Erigon until both return the expected events and `eth_syncing` reports that Reth has reached the head.

reth/compose.yaml

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
services:
2+
jwt-init:
3+
image: busybox:1.37.0
4+
command:
5+
- sh
6+
- -ec
7+
- |
8+
if [ ! -s /jwt/jwt.hex ]; then
9+
umask 077
10+
head -c 32 /dev/urandom | od -An -tx1 | tr -d ' \n' > /jwt/jwt.hex
11+
fi
12+
volumes:
13+
- engine-jwt:/jwt
14+
restart: "no"
15+
16+
reth:
17+
image: ghcr.io/paradigmxyz/reth:v2.2.0
18+
restart: unless-stopped
19+
depends_on:
20+
jwt-init:
21+
condition: service_completed_successfully
22+
command:
23+
- node
24+
- --chain=sepolia
25+
- --datadir=/data
26+
- --prune.sender-recovery.full
27+
- --prune.transaction-lookup.before=${RETH_RECEIPTS_START_BLOCK:?Set RETH_RECEIPTS_START_BLOCK in reth/.env}
28+
- --prune.receipts.before=${RETH_RECEIPTS_START_BLOCK:?Set RETH_RECEIPTS_START_BLOCK in reth/.env}
29+
- --prune.account-history.distance=10064
30+
- --prune.storage-history.distance=10064
31+
- --prune.bodies.before=${RETH_RECEIPTS_START_BLOCK:?Set RETH_RECEIPTS_START_BLOCK in reth/.env}
32+
- --http
33+
- --http.addr=0.0.0.0
34+
- --http.port=8545
35+
- --http.api=eth,web3,net,debug,trace,txpool
36+
- --ws
37+
- --ws.addr=0.0.0.0
38+
- --ws.port=8546
39+
- --ws.api=eth,web3,net,debug,trace,txpool
40+
- --authrpc.addr=0.0.0.0
41+
- --authrpc.port=8551
42+
- --authrpc.jwtsecret=/jwt/jwt.hex
43+
- --log.file.directory=/data/logs
44+
- --log.file.name=sepolia.log
45+
ports:
46+
- "127.0.0.1:${RETH_RPC_PORT:-8545}:8545"
47+
- "127.0.0.1:${RETH_WS_PORT:-8546}:8546"
48+
- "30303:30303/tcp"
49+
- "30303:30303/udp"
50+
- "9200:9200/udp"
51+
volumes:
52+
- reth-sepolia-data:/data
53+
- engine-jwt:/jwt:ro
54+
stop_grace_period: 2m
55+
56+
lighthouse:
57+
image: sigp/lighthouse:v8.2.1
58+
restart: unless-stopped
59+
depends_on:
60+
jwt-init:
61+
condition: service_completed_successfully
62+
reth:
63+
condition: service_started
64+
command:
65+
- lighthouse
66+
- bn
67+
- --network=sepolia
68+
- --datadir=/data
69+
- --execution-endpoint=http://reth:8551
70+
- --execution-jwt=/jwt/jwt.hex
71+
- --checkpoint-sync-url=https://sepolia.checkpoint-sync.ethpandaops.io
72+
- --http
73+
- --http-address=0.0.0.0
74+
ports:
75+
- "9000:9000/tcp"
76+
- "9000:9000/udp"
77+
- "9001:9001/udp"
78+
volumes:
79+
- lighthouse-sepolia-data:/data
80+
- engine-jwt:/jwt:ro
81+
stop_grace_period: 2m
82+
83+
volumes:
84+
engine-jwt:
85+
lighthouse-sepolia-data:
86+
reth-sepolia-data:
87+
88+
networks:
89+
default:
90+
name: zoltar
91+
external: true

0 commit comments

Comments
 (0)