Skip to content

Commit 9197c91

Browse files
authored
refactor: use ipfs:// with cid instead of gateway (#173)
* use `ipfs://` with cid instead * change to online holesky rpc * start wavs with ipfs gateway set in env
1 parent f364bb5 commit 9197c91

File tree

6 files changed

+27
-17
lines changed

6 files changed

+27
-17
lines changed

.env.example

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ METADATA_URI=https://raw.githubusercontent.com/Lay3rLabs/wavs-foundry-template/r
33
LOCAL_ETHEREUM_RPC_URL=http://localhost:8545
44

55
CHAIN_ID=17000
6-
TESTNET_RPC_URL=https://ethereum-holesky-rpc.publicnode.com
6+
TESTNET_RPC_URL=https://holesky.drpc.org
77

88
# this key requires funds. used as the admin / deployer of contracts and core contracts.
99
FUNDED_KEY=

Makefile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ upload-component:
8787
fi
8888
@wget --post-file=./compiled/${COMPONENT_FILENAME} --header="Content-Type: application/wasm" -O - ${WAVS_ENDPOINT}/upload | jq -r .digest
8989

90+
IPFS_GATEWAY?="https://ipfs.io/ipfs"
9091
## deploy-service: deploying the WAVS component service json | SERVICE_URL, CREDENTIAL, WAVS_ENDPOINT
9192
deploy-service:
9293
# this wait is required to ensure the WAVS service has time to service check
@@ -97,11 +98,11 @@ deploy-service:
9798
fi
9899
@if [ -n "${WAVS_ENDPOINT}" ]; then \
99100
if [ "$$(curl -s -o /dev/null -w "%{http_code}" ${WAVS_ENDPOINT}/app)" != "200" ]; then \
100-
echo "Error: WAVS_ENDPOINT is not reachable. Please check the WAVS_ENDPOINT."; \
101+
echo "Error: WAVS_ENDPOINT is not reachable. Please check WAVS is online, or run this again in a few seconds."; \
101102
exit 1; \
102103
fi; \
103104
fi
104-
@$(WAVS_CMD) deploy-service --service-url ${SERVICE_URL} --log-level=debug --data /data/.docker --home /data $(if $(WAVS_ENDPOINT),--wavs-endpoint $(WAVS_ENDPOINT),)
105+
@$(WAVS_CMD) deploy-service --service-url ${SERVICE_URL} --log-level=debug --data /data/.docker --home /data $(if $(WAVS_ENDPOINT),--wavs-endpoint $(WAVS_ENDPOINT),) $(if $(IPFS_GATEWAY),--ipfs-gateway $(IPFS_GATEWAY),)
105106

106107
## get-trigger: get the trigger id | SERVICE_TRIGGER_ADDR, RPC_URL
107108
get-trigger:

README.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -302,16 +302,17 @@ export ipfs_cid=`SERVICE_FILE=${SERVICE_FILE} make upload-to-ipfs`
302302
# TESTNET: https://gateway.pinata.cloud/
303303
export IPFS_GATEWAY=$(sh script/get-ipfs-gateway.sh)
304304
305-
export SERVICE_URI="${IPFS_GATEWAY}/ipfs/${ipfs_cid}"
306-
curl ${SERVICE_URI}
305+
export IPFS_URI="ipfs://${ipfs_cid}"
306+
curl "${IPFS_GATEWAY}/ipfs/${ipfs_cid}"
307307
308-
cast send ${SERVICE_MANAGER_ADDRESS} 'setServiceURI(string)' "${SERVICE_URI}" -r ${RPC_URL} --private-key ${DEPLOYER_PK}
308+
cast send ${SERVICE_MANAGER_ADDRESS} 'setServiceURI(string)' "${IPFS_URI}" -r ${RPC_URL} --private-key ${DEPLOYER_PK}
309309
```
310310

311311
## Start Aggregator
312312

313313
```bash
314314
sh ./script/create-aggregator.sh 1
315+
315316
sh ./infra/aggregator-1/start.sh
316317
317318
wget -q --header="Content-Type: application/json" --post-data='{"service": '"$(jq -c . ${SERVICE_FILE})"'}' ${AGGREGATOR_URL}/register-service -O -
@@ -322,13 +323,13 @@ wget -q --header="Content-Type: application/json" --post-data='{"service": '"$(j
322323
```bash
323324
sh ./script/create-operator.sh 1
324325
325-
# [!] UPDATE PROPER VALUES FOR TESTNET HERE (`wavs.toml`: registry, ipfs_gateway)
326+
# [!] UPDATE PROPER VALUES FOR TESTNET HERE (`wavs.toml`: ipfs_gateway)
326327
327-
sh ./infra/wavs-1/start.sh
328+
IPFS_GATEWAY=${IPFS_GATEWAY}/ipfs/ sh ./infra/wavs-1/start.sh
328329
329330
# Deploy the service JSON to WAVS so it now watches and submits.
330331
# 'opt in' for WAVS to watch (this is before we register to Eigenlayer)
331-
WAVS_ENDPOINT=http://127.0.0.1:8000 SERVICE_URL=${SERVICE_URI} make deploy-service
332+
WAVS_ENDPOINT=http://127.0.0.1:8000 SERVICE_URL=${IPFS_URI} IPFS_GATEWAY=${IPFS_GATEWAY}/ipfs/ make deploy-service
332333
```
333334

334335
## Register service specific operator

script/create-operator.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,16 +57,17 @@ cd \$(dirname "\$0") || exit 1
5757
5858
IMAGE=ghcr.io/lay3rlabs/wavs:b45bee6
5959
WAVS_INSTANCE=wavs-${OPERATOR_INDEX}
60+
IPFS_GATEWAY=\${IPFS_GATEWAY:-"https://ipfs.io/ipfs/"}
6061
6162
docker kill \${WAVS_INSTANCE} > /dev/null 2>&1 || true
6263
docker rm \${WAVS_INSTANCE} > /dev/null 2>&1 || true
6364
64-
docker run -d --rm --name \${WAVS_INSTANCE} --network host --env-file .env -v \$(pwd):/root/wavs \${IMAGE} wavs --home /root/wavs --host 0.0.0.0 --log-level info
65+
docker run -d --rm --name \${WAVS_INSTANCE} --network host --env-file .env -v \$(pwd):/root/wavs \${IMAGE} wavs --home /root/wavs --ipfs-gateway \${IPFS_GATEWAY} --host 0.0.0.0 --log-level info
6566
sleep 0.25
6667
6768
if [ ! "\$(docker ps -q -f name=\${WAVS_INSTANCE})" ]; then
6869
echo "Container \${WAVS_INSTANCE} is not running. Reason:"
69-
docker run --rm --name \${WAVS_INSTANCE} --network host --env-file .env -v \$(pwd):/root/wavs \${IMAGE} wavs --home /root/wavs --host 0.0.0.0 --log-level info
70+
docker run --rm --name \${WAVS_INSTANCE} --network host --env-file .env -v \$(pwd):/root/wavs \${IMAGE} wavs --home /root/wavs --ipfs-gateway \${IPFS_GATEWAY} --host 0.0.0.0 --log-level info
7071
fi
7172
EOF
7273

script/start_all.sh

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,17 @@
22

33
set -e
44

5+
if [ -f .env ] && grep -q '^TESTNET_RPC_URL=' .env; then
6+
TESTNET_RPC_URL=$(grep -E '^TESTNET_RPC_URL=' .env | cut -d '=' -f2- | tr -d '"')
7+
else
8+
rpc_url="https://holesky.drpc.org"
9+
echo "No TESTNET_RPC_URL found in .env, using default ${rpc_url}"
10+
TESTNET_RPC_URL=${rpc_url}
11+
fi
12+
513
PORT=8545
614
MIDDLEWARE_IMAGE=ghcr.io/lay3rlabs/wavs-middleware:0.4.0-beta.5
7-
FORK_RPC_URL=${FORK_RPC_URL:-"https://ethereum-holesky-rpc.publicnode.com"}
15+
FORK_RPC_URL=${FORK_RPC_URL:-"${TESTNET_RPC_URL}"}
816
DEPLOY_ENV=$(sh ./script/get-deploy-status.sh)
917

1018
## == Start watcher ==

wavs.toml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,8 @@
2020
[default]
2121
log_level = ["info", "wavs=debug"]
2222

23-
# The IPFS gateway URL used to access IPFS content over HTTP.
24-
ipfs_gateway = "http://127.0.0.1:8080/ipfs/"
25-
# ipfs_gateway = "https://gateway.pinata.cloud/ipfs/" # testnet / production
23+
# The IPFS gateway URL used to access IPFS content over HTTP. (set in wavs start command for now)
24+
# ipfs_gateway = "https://gateway.pinata.cloud/ipfs/"
2625

2726
# Those configs are global and shared between wavs and aggregator
2827
# jaeger = "http://localhost:4317"
@@ -76,8 +75,8 @@ http_endpoint = "https://ethereum-sepolia-rpc.publicnode.com"
7675

7776
[default.chains.evm.holesky]
7877
chain_id = "17000"
79-
ws_endpoint = "wss://ethereum-holesky-rpc.publicnode.com"
80-
http_endpoint = "https://ethereum-holesky-rpc.publicnode.com"
78+
ws_endpoint = "wss://holesky.drpc.org"
79+
http_endpoint = "https://holesky.drpc.org"
8180

8281
[default.chains.evm.holesky-fork]
8382
chain_id = "17000"

0 commit comments

Comments
 (0)