-
Notifications
You must be signed in to change notification settings - Fork 3
/
start-millau.sh
executable file
·312 lines (272 loc) · 9.47 KB
/
start-millau.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
#!/bin/bash
. ./prelude.sh
###############################################################################
### Millau (Substrate) chain startup ##########################################
###############################################################################
# TODO: Millau should use other authorities && other session management
RUST_LOG=runtime=trace,runtime::bridge=trace,txpool=trace,sc_basic_authorship=trace
export RUST_LOG
# remove Millau databases
rm -rf data/millau-alice.db
rm -rf data/millau-bob.db
rm -rf data/millau-charlie.db
rm -rf data/millau-dave.db
rm -rf data/millau-eve.db
if [ -z "$DISABLE_MILLAU" ]; then
# start Millau nodes
./run-with-log.sh millau-alice "./bin/millau-bridge-node\
--alice\
--base-path=data/millau-alice.db\
--bootnodes=/ip4/127.0.0.1/tcp/40334/p2p/12D3KooWM5LFR5ne4yTQ4sBSXJ75M4bDo2MAhAW2GhL3i8fe5aRb\
--node-key=0f900c89f4e626f4a217302ab8c7d213737d00627115f318ad6fb169717ac8e0\
--port=40333\
--prometheus-port=10615\
--rpc-port=10933\
--ws-port=10944\
--execution=Native\
--chain=local\
--rpc-cors=all\
--unsafe-rpc-external\
--unsafe-ws-external"&
./run-with-log.sh millau-bob "./bin/millau-bridge-node\
--bob\
--base-path=data/millau-bob.db\
--bootnodes=/ip4/127.0.0.1/tcp/40333/p2p/12D3KooWFqiV73ipQ1jpfVmCfLqBCp8G9PLH3zPkY9EhmdrSGA4H\
--node-key=db383639ff2905d79f8e936fd5dc4416ef46b514b2f83823ec3c42753d7557bb\
--port=40334\
--prometheus-port=10616\
--rpc-port=10934\
--ws-port=10945\
--execution=Native\
--chain=local\
--rpc-cors=all\
--unsafe-rpc-external\
--unsafe-ws-external"&
./run-with-log.sh millau-charlie "./bin/millau-bridge-node\
--charlie\
--base-path=data/millau-charlie.db\
--bootnodes=/ip4/127.0.0.1/tcp/40333/p2p/12D3KooWFqiV73ipQ1jpfVmCfLqBCp8G9PLH3zPkY9EhmdrSGA4H\
--port=40335\
--prometheus-port=10617\
--rpc-port=10935\
--ws-port=10946\
--execution=Native\
--chain=local\
--rpc-cors=all\
--unsafe-rpc-external\
--unsafe-ws-external"&
./run-with-log.sh millau-dave "./bin/millau-bridge-node\
--dave\
--base-path=data/millau-dave.db\
--bootnodes=/ip4/127.0.0.1/tcp/40333/p2p/12D3KooWFqiV73ipQ1jpfVmCfLqBCp8G9PLH3zPkY9EhmdrSGA4H\
--port=40336\
--prometheus-port=10618\
--rpc-port=10936\
--ws-port=10947\
--execution=Native\
--chain=local\
--rpc-cors=all\
--unsafe-rpc-external\
--unsafe-ws-external"&
./run-with-log.sh millau-eve "./bin/millau-bridge-node\
--eve\
--base-path=data/millau-eve.db\
--bootnodes=/ip4/127.0.0.1/tcp/40333/p2p/12D3KooWFqiV73ipQ1jpfVmCfLqBCp8G9PLH3zPkY9EhmdrSGA4H\
--port=40337\
--prometheus-port=10619\
--rpc-port=10937\
--ws-port=10948\
--execution=Native\
--chain=local\
--rpc-cors=all\
--unsafe-rpc-external\
--unsafe-ws-external"&
###############################################################################
### Give nodes some time to startup ###########################################
###############################################################################
sleep 20
###############################################################################
### Initialize header bridges #################################################
###############################################################################
# common variables
MILLAU_HOST=127.0.0.1
MILLAU_PORT=10944
RIALTO_HOST=127.0.0.1
RIALTO_PORT=9944
RELAY_BINARY_PATH=./bin/substrate-relay
RUST_LOG=bridge=trace,bridge-metrics=trace
export MILLAU_HOST MILLAU_PORT RIALTO_HOST RIALTO_PORT RELAY_BINARY_PATH RUST_LOG
# initialize Millau -> Rialto headers bridge
./run-with-log.sh initialize-millau-to-rialto "$RELAY_BINARY_PATH\
init-bridge millau-to-rialto\
--source-host=$MILLAU_HOST\
--source-port=$MILLAU_PORT\
--target-host=$RIALTO_HOST\
--target-port=$RIALTO_PORT\
--target-signer=//Alice"&
# initialize Rialto -> Millau headers bridge
./run-with-log.sh initialize-rialto-to-millau "$RELAY_BINARY_PATH\
init-bridge rialto-to-millau\
--source-host=$RIALTO_HOST\
--source-port=$RIALTO_PORT\
--target-host=$MILLAU_HOST\
--target-port=$MILLAU_PORT\
--target-signer=//Alice"&
# wait until transactions are mined
sleep 20
# just to test that second initialization transaction is not sent
# initialize Millau -> Rialto headers bridge
./run-with-log.sh initialize-millau-to-rialto-2 "$RELAY_BINARY_PATH\
init-bridge millau-to-rialto\
--source-host=$MILLAU_HOST\
--source-port=$MILLAU_PORT\
--target-host=$RIALTO_HOST\
--target-port=$RIALTO_PORT\
--target-signer=//Alice"&
# initialize Rialto -> Millau headers bridge
./run-with-log.sh initialize-rialto-to-millau-2 "$RELAY_BINARY_PATH\
init-bridge rialto-to-millau\
--source-host=$RIALTO_HOST\
--source-port=$RIALTO_PORT\
--target-host=$MILLAU_HOST\
--target-port=$MILLAU_PORT\
--target-signer=//Alice"&
###############################################################################
### Start generating messages on Millau <-> Rialto lanes ######################
###############################################################################
# start generating Millau -> Rialto messages
./run-with-log.sh \
millau-to-rialto-messages-generator\
./millau-to-rialto-messages-generator.sh&
# start generating Rialto -> Millau messages
./run-with-log.sh \
rialto-to-millau-messages-generator\
./rialto-to-millau-messages-generator.sh&
# start generating tokens swap
./run-with-log.sh \
token-swap-generator\
./token-swap-generator.sh&
# start millau transactions resubmitter
./run-with-log.sh millau-to-rialto-messages-resubmitter "$RELAY_BINARY_PATH\
resubmit-transactions millau\
--target-host=$MILLAU_HOST\
--target-port=10946\
--target-signer=//Dave\
--tip-limit 1000000000000\
--tip-step 1000000000"&
###############################################################################
### Starting Millau -> Rialto relays ##########################################
###############################################################################
if [ -z "$USE_COMPLEX_MILLAU_RIALTO_RELAY" ]; then
# start millau-headers-to-rialto relay
./run-with-log.sh relay-millau-to-rialto "$RELAY_BINARY_PATH\
relay-headers millau-to-rialto\
--source-host=$MILLAU_HOST\
--source-port=$MILLAU_PORT\
--target-host=$RIALTO_HOST\
--target-port=$RIALTO_PORT\
--target-signer=//Charlie\
--prometheus-port=9700"&
# start rialto-headers-to-millau relay
./run-with-log.sh relay-rialto-to-millau "$RELAY_BINARY_PATH\
relay-headers rialto-to-millau\
--source-host=$RIALTO_HOST\
--source-port=$RIALTO_PORT\
--target-host=$MILLAU_HOST\
--target-port=$MILLAU_PORT\
--target-signer=//Charlie\
--prometheus-port=9701"&
# start millau-messages-to-rialto relay
./run-with-log.sh relay-millau-to-rialto-messages "$RELAY_BINARY_PATH\
relay-messages millau-to-rialto\
--source-host=$MILLAU_HOST\
--source-port=$MILLAU_PORT\
--source-signer=//Eve\
--target-host=$RIALTO_HOST\
--target-port=$RIALTO_PORT\
--target-signer=//Eve\
--prometheus-port=9702\
--lane=00000000"&
# start rialto-messages-to-millau relay
./run-with-log.sh relay-rialto-to-millau-messages "$RELAY_BINARY_PATH\
relay-messages rialto-to-millau\
--source-host=$RIALTO_HOST\
--source-port=$RIALTO_PORT\
--source-signer=//Ferdie\
--target-host=$MILLAU_HOST\
--target-port=$MILLAU_PORT\
--target-signer=//Ferdie\
--prometheus-port=9703\
--lane=00000000"&
else
# start millau-rialto headers+messages relay
./run-with-log.sh relay-millau-rialto "$RELAY_BINARY_PATH\
relay-headers-and-messages millau-rialto\
--millau-host=$MILLAU_HOST\
--millau-port=$MILLAU_PORT\
--millau-signer=//Charlie\
--millau-transactions-mortality=64\
--rialto-host=$RIALTO_HOST\
--rialto-port=$RIALTO_PORT\
--rialto-signer=//Charlie\
--rialto-transactions-mortality=64\
--lane=00000000\
--lane=00000001\
--lane=73776170\
--prometheus-port=9700\
--millau-messages-pallet-owner=//RialtoMessagesOwner\
--rialto-messages-pallet-owner=//MillauMessagesOwner"&
# start rialto-to-millau messages relay for lane#2
./run-with-log.sh relay-rialto-to-millau-messages-00000002 "$RELAY_BINARY_PATH\
relay-messages rialto-to-millau\
--source-host=$RIALTO_HOST\
--source-port=$RIALTO_PORT\
--source-signer=//Eve\
--target-host=$MILLAU_HOST\
--target-port=$MILLAU_PORT\
--target-signer=//Eve\
--prometheus-port=9701\
--lane=00000002"&
# start millau-to-rialto messages relay for lane#2
./run-with-log.sh relay-millau-to-rialto-messages-00000002 "$RELAY_BINARY_PATH\
relay-messages millau-to-rialto\
--source-host=$MILLAU_HOST\
--source-port=$MILLAU_PORT\
--source-signer=//Ferdie\
--target-host=$RIALTO_HOST\
--target-port=$RIALTO_PORT\
--target-signer=//Ferdie\
--prometheus-port=9702\
--lane=00000002"&
fi
###############################################################################
### The rest is not executed if Westend -> Millau bridge is disabled ##########
###############################################################################
if [ -z "$DISABLE_WESTEND_TO_MILLAU" ]; then
# common variables
WESTEND_HOST=westend-rpc.polkadot.io
WESTEND_PORT=443
# initialize Westend -> Millau headers bridge
./run-with-log.sh initialize-westend-to-millau "$RELAY_BINARY_PATH\
init-bridge westend-to-millau\
--source-host=$WESTEND_HOST\
--source-port=$WESTEND_PORT\
--source-secure\
--target-host=$MILLAU_HOST\
--target-port=$MILLAU_PORT\
--target-signer=//George"&
# wait until transactions are mined
sleep 20
# start westend-headers-to-millau relay
./run-with-log.sh relay-westend-to-millau "$RELAY_BINARY_PATH\
relay-headers westend-to-millau\
--source-host=$WESTEND_HOST\
--source-port=$WESTEND_PORT\
--source-secure\
--target-host=$MILLAU_HOST\
--target-port=$MILLAU_PORT\
--target-signer=//George\
--prometheus-port=9704"&
# --target-transactions-mortality=4\
fi
fi