Skip to content

Commit 2e6b9ff

Browse files
committed
Adding p2p configuration based on release channel
1 parent b24db0b commit 2e6b9ff

File tree

1 file changed

+41
-34
lines changed
  • lib/sui/lib/assets/user-data

1 file changed

+41
-34
lines changed

lib/sui/lib/assets/user-data/node.sh

Lines changed: 41 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ sudo apt-get -qq update && sudo apt upgrade -y
9292
sudo apt-get -qq install -y build-essential
9393
sudo apt-get -qq install -y libclang-dev
9494
sudo apt-get -qq install -y pkg-config libssl-dev
95+
sudo apt-get install -y libpq-dev # dependency of sui-tool
9596

9697
# emitting cfn-signal event
9798
sudo apt-get -qq install -y python3-pip
@@ -136,9 +137,8 @@ sudo mv ./sui-node /usr/local/bin/
136137
sudo mv ./sui /usr/local/bin/
137138
sudo mv ./sui-tool /usr/local/bin/
138139

139-
# 4. Download Sui repository
140140
cd $HOME
141-
git clone https://github.com/MystenLabs/sui.git --branch testnet --single-branch
141+
git clone https://github.com/MystenLabs/sui.git --branch $NETWORK_ID --single-branch
142142
cd sui
143143
# git remote add upstream https://github.com/MystenLabs/sui
144144
# git fetch upstream
@@ -160,24 +160,50 @@ echo "[LOG] update configs"
160160
mkdir -p $HOME/.sui/
161161
cd $HOME/.sui/
162162

163-
# Genesis for Testnet
164-
wget -O genesis.blob https://github.com/MystenLabs/sui-genesis/raw/main/testnet/genesis.blob
165-
166-
# Genesis for Mainnet
167-
# wget -O genesis.blob https://github.com/MystenLabs/sui-genesis/raw/main/mainnet/genesis.blob
168-
169-
# Genesis for Devnet
170-
# wget -O genesis.blob https://github.com/MystenLabs/sui-genesis/raw/main/devnet/genesis.blob
163+
# Genesis for release channel (testnet|mainnet|devnet)
164+
wget -O genesis.blob https://github.com/MystenLabs/sui-genesis/raw/main/$NETWORK_ID/genesis.blob
171165

172166
cp $HOME/sui/crates/sui-config/data/fullnode-template.yaml $HOME/.sui/fullnode.yaml
173167
sed -i 's/127.0.0.1/0.0.0.0/' $HOME/.sui/fullnode.yaml
174168
sed -i "s|db-path:.*|db-path: $HOME/.sui/db|g" $HOME/.sui/fullnode.yaml
175169
sed -i "s|genesis-file-location:.*|genesis-file-location: $HOME/.sui/genesis.blob|g" $HOME/.sui/fullnode.yaml
176170

177171
# Testnet p2p peers
178-
echo "[LOG] testnet p2p peers"
172+
echo "[LOG] Adding p2p peers to corresponding release channel"
179173

180-
cat << EOF >> $HOME/.sui/fullnode.yaml
174+
case "$NETWORK_ID" in
175+
"mainnet")
176+
echo "Adding mainnet peer configuration"
177+
cat << EOF >> $HOME/.sui/fullnode.yaml
178+
179+
p2p-config:
180+
seed-peers:
181+
- address: /dns/mel-00.mainnet.sui.io/udp/8084
182+
peer-id: d32b55bdf1737ec415df8c88b3bf91e194b59ee3127e3f38ea46fd88ba2e7849
183+
- address: /dns/ewr-00.mainnet.sui.io/udp/8084
184+
peer-id: c7bf6cb93ca8fdda655c47ebb85ace28e6931464564332bf63e27e90199c50ee
185+
- address: /dns/ewr-01.mainnet.sui.io/udp/8084
186+
peer-id: 3227f8a05f0faa1a197c075d31135a366a1c6f3d4872cb8af66c14dea3e0eb66
187+
- address: /dns/lhr-00.mainnet.sui.io/udp/8084
188+
peer-id: c619a5e0f8f36eac45118c1f8bda28f0f508e2839042781f1d4a9818043f732c
189+
- address: /dns/sui-mainnet-ssfn-1.nodeinfra.com/udp/8084
190+
peer-id: 0c52ca8d2b9f51be4a50eb44ace863c05aadc940a7bd15d4d3f498deb81d7fc6
191+
- address: /dns/sui-mainnet-ssfn-2.nodeinfra.com/udp/8084
192+
peer-id: 1dbc28c105aa7eb9d1d3ac07ae663ea638d91f2b99c076a52bbded296bd3ed5c
193+
- address: /dns/sui-mainnet-ssfn-ashburn-na.overclock.run/udp/8084
194+
peer-id: 5ff8461ab527a8f241767b268c7aaf24d0312c7b923913dd3c11ee67ef181e45
195+
- address: /dns/sui-mainnet-ssfn-dallas-na.overclock.run/udp/8084
196+
peer-id: e1a4f40d66f1c89559a195352ba9ff84aec28abab1d3aa1c491901a252acefa6
197+
- address: /dns/ssn01.mainnet.sui.rpcpool.com/udp/8084
198+
peer-id: fadb7ccb0b7fc99223419176e707f5122fef4ea686eb8e80d1778588bf5a0bcd
199+
- address: /dns/ssn02.mainnet.sui.rpcpool.com/udp/8084
200+
peer-id: 13783584a90025b87d4604f1991252221e5fd88cab40001642f4b00111ae9b7e
201+
202+
EOF
203+
;;
204+
"testnet")
205+
echo "Adding testnet peer configuration"
206+
cat << EOF >> $HOME/.sui/fullnode.yaml
181207
182208
p2p-config:
183209
seed-peers:
@@ -197,30 +223,11 @@ p2p-config:
197223
peer-id: c88742f46e66a11cb8c84aca488065661401ef66f726cb9afeb8a5786d83456e
198224
199225
EOF
226+
;;
227+
esac
228+
200229

201230
# Mainnet peer configuration
202-
# p2p-config:
203-
# seed-peers:
204-
# - address: /dns/mel-00.mainnet.sui.io/udp/8084
205-
# peer-id: d32b55bdf1737ec415df8c88b3bf91e194b59ee3127e3f38ea46fd88ba2e7849
206-
# - address: /dns/ewr-00.mainnet.sui.io/udp/8084
207-
# peer-id: c7bf6cb93ca8fdda655c47ebb85ace28e6931464564332bf63e27e90199c50ee
208-
# - address: /dns/ewr-01.mainnet.sui.io/udp/8084
209-
# peer-id: 3227f8a05f0faa1a197c075d31135a366a1c6f3d4872cb8af66c14dea3e0eb66
210-
# - address: /dns/lhr-00.mainnet.sui.io/udp/8084
211-
# peer-id: c619a5e0f8f36eac45118c1f8bda28f0f508e2839042781f1d4a9818043f732c
212-
# - address: /dns/sui-mainnet-ssfn-1.nodeinfra.com/udp/8084
213-
# peer-id: 0c52ca8d2b9f51be4a50eb44ace863c05aadc940a7bd15d4d3f498deb81d7fc6
214-
# - address: /dns/sui-mainnet-ssfn-2.nodeinfra.com/udp/8084
215-
# peer-id: 1dbc28c105aa7eb9d1d3ac07ae663ea638d91f2b99c076a52bbded296bd3ed5c
216-
# - address: /dns/sui-mainnet-ssfn-ashburn-na.overclock.run/udp/8084
217-
# peer-id: 5ff8461ab527a8f241767b268c7aaf24d0312c7b923913dd3c11ee67ef181e45
218-
# - address: /dns/sui-mainnet-ssfn-dallas-na.overclock.run/udp/8084
219-
# peer-id: e1a4f40d66f1c89559a195352ba9ff84aec28abab1d3aa1c491901a252acefa6
220-
# - address: /dns/ssn01.mainnet.sui.rpcpool.com/udp/8084
221-
# peer-id: fadb7ccb0b7fc99223419176e707f5122fef4ea686eb8e80d1778588bf5a0bcd
222-
# - address: /dns/ssn02.mainnet.sui.rpcpool.com/udp/8084
223-
# peer-id: 13783584a90025b87d4604f1991252221e5fd88cab40001642f4b00111ae9b7e
224231

225232

226233
# Devnet peer configuration

0 commit comments

Comments
 (0)