@@ -3,7 +3,7 @@ set -Eeuo pipefail
3
3
4
4
# pin-params.sh
5
5
#
6
- # - Add the directory of params to the local ipfs node
6
+ # - Post the directory of params to cluster. ipfs.io
7
7
# - Grab the CID for the previous params from proofs.filecoin.io
8
8
# - Add the old params as a `prev` dir to the new params dir to keep them around.
9
9
# - Pin the new cid on cluster
54
54
fi
55
55
56
56
CLUSTER_HOST=" /dnsaddr/cluster.ipfs.io"
57
- CLUSTER_PRIMARY=" /dns4/cluster0.fsn.dwebops.pub/udp/4001/quic/p2p/QmUEMvxS2e7iDrereVYc5SWPauXPyNwxcy9BXZrC1QTcHE"
58
57
CLUSTER_PIN_NAME=" filecoin-proof-parameters-$VERSION "
59
58
DNSLINK_DOMAIN=" proofs.filecoin.io"
60
59
61
- # Pin to ipfs
62
- ROOT_CID=$( ipfs add --quieter --recursive $INPUT_DIR )
63
- echo " ok! root cid is $ROOT_CID "
64
-
65
- echo " linking to previous version..."
66
- # trim off the /ipfs prefix, so it's consistent with the other vars
67
- PREV_CID=$( ipfs dns $DNSLINK_DOMAIN | cut -c 7-)
68
-
69
- # Add a `prev` dir to the new params dir that links back to the older params
70
- LINKED_CID=$( ipfs object patch add-link $ROOT_CID prev $PREV_CID )
71
-
72
- # guard against multiple runs with no change...
73
- # if we remove the `prev` dir from the last published PREV_CID and it matches
74
- # the current ROOT_DIR, then dont nest it inside itself again.
75
- if ipfs object stat $PREV_CID /prev > /dev/null; then
76
- PREV_ROOT_CID=$( ipfs object patch rm-link $PREV_CID prev)
77
- if [[ $PREV_ROOT_CID == " $ROOT_CID " ]]; then
78
- LINKED_CID=$PREV_CID
79
- echo " linked cid is already published, re-using $PREV_CID "
80
- echo " continuing to ensure $PREV_CID is pinned to cluster"
81
- fi
82
- fi
83
-
84
- echo " ok! linked cid is $LINKED_CID "
85
- echo " pinning linked cid to cluster..."
86
-
87
- # Connect to cluster to speed up discovery
88
- ipfs swarm connect $CLUSTER_PRIMARY
89
-
90
- # Ask cluster to fetch the linked cid from us
91
- ipfs-cluster-ctl \
60
+ # Pin to cluster
61
+ ROOT_CID=$( ipfs-cluster-ctl \
92
62
--host $CLUSTER_HOST \
93
63
--basic-auth $CLUSTER_TOKEN \
94
- pin add $LINKED_CID \
64
+ add --quieter \
95
65
--name $CLUSTER_PIN_NAME \
96
- --wait
66
+ --recursive $INPUT_DIR )
67
+
68
+ echo " ok! root cid is $ROOT_CID "
97
69
98
70
# Publist the new cid to the dnslink
99
- npx dnslink-dnsimple --domain proofs.filecoin.io --link " /ipfs/$LINKED_CID "
71
+ npx dnslink-dnsimple --domain $DNSLINK_DOMAIN --link " /ipfs/$ROOT_CID "
100
72
101
73
echo " done!"
0 commit comments