@argonprotocol/testing 1.3.6 → 1.3.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/docker-compose.yml +467 -0
- package/lib/index.cjs +56 -18
- package/lib/index.cjs.map +1 -1
- package/lib/index.d.cts +9 -1
- package/lib/index.d.ts +9 -1
- package/lib/index.js +76 -39
- package/lib/index.js.map +1 -1
- package/package.json +10 -9
|
@@ -0,0 +1,467 @@
|
|
|
1
|
+
## Shared configs
|
|
2
|
+
x-oracle-config: &oracle
|
|
3
|
+
image: ghcr.io/argonprotocol/argon-oracle:${VERSION:-latest}
|
|
4
|
+
user: root
|
|
5
|
+
build:
|
|
6
|
+
context: .
|
|
7
|
+
dockerfile: dev.Dockerfile
|
|
8
|
+
target: oracle
|
|
9
|
+
restart: on-failure
|
|
10
|
+
x-notary-config: ¬ary
|
|
11
|
+
image: ghcr.io/argonprotocol/argon-notary:${VERSION:-latest}
|
|
12
|
+
user: root
|
|
13
|
+
build:
|
|
14
|
+
context: .
|
|
15
|
+
dockerfile: dev.Dockerfile
|
|
16
|
+
target: argon-notary
|
|
17
|
+
restart: on-failure
|
|
18
|
+
x-node-config: &node
|
|
19
|
+
image: ghcr.io/argonprotocol/argon-miner:${VERSION:-latest}
|
|
20
|
+
build:
|
|
21
|
+
context: .
|
|
22
|
+
dockerfile: dev.Dockerfile
|
|
23
|
+
target: argon-node
|
|
24
|
+
restart: on-failure
|
|
25
|
+
x-bitcoin-config: &bitcoin
|
|
26
|
+
image: ghcr.io/argonprotocol/bitcoin-unverified-node:latest
|
|
27
|
+
build:
|
|
28
|
+
context: .
|
|
29
|
+
dockerfile: docker/bitcoin.Dockerfile
|
|
30
|
+
user: "0:0"
|
|
31
|
+
restart: on-failure
|
|
32
|
+
volumes:
|
|
33
|
+
- bitcoin-data:/bitcoin
|
|
34
|
+
|
|
35
|
+
services:
|
|
36
|
+
minio:
|
|
37
|
+
image: minio/minio
|
|
38
|
+
environment:
|
|
39
|
+
MINIO_ROOT_USER: minioadmin
|
|
40
|
+
MINIO_ROOT_PASSWORD: minioadmin
|
|
41
|
+
command: server /data --console-address ":9001"
|
|
42
|
+
ports:
|
|
43
|
+
- "0:9000"
|
|
44
|
+
- "0:9001"
|
|
45
|
+
volumes:
|
|
46
|
+
- minio-data:/data
|
|
47
|
+
healthcheck:
|
|
48
|
+
test: >
|
|
49
|
+
curl -f "http://localhost:9000/minio/health/live" || exit 1
|
|
50
|
+
interval: 5s
|
|
51
|
+
retries: 10
|
|
52
|
+
|
|
53
|
+
postgres:
|
|
54
|
+
image: postgres:15
|
|
55
|
+
environment:
|
|
56
|
+
POSTGRES_USER: postgres
|
|
57
|
+
POSTGRES_PASSWORD: password
|
|
58
|
+
POSTGRES_DB: notary
|
|
59
|
+
ports:
|
|
60
|
+
- "0:5432"
|
|
61
|
+
volumes:
|
|
62
|
+
- pgdata:/var/lib/postgresql/data
|
|
63
|
+
healthcheck:
|
|
64
|
+
test: ["CMD", "pg_isready", "-U", "postgres"]
|
|
65
|
+
interval: 5s
|
|
66
|
+
retries: 10
|
|
67
|
+
|
|
68
|
+
bitcoin:
|
|
69
|
+
<<: *bitcoin
|
|
70
|
+
entrypoint: ["bitcoind"]
|
|
71
|
+
command:
|
|
72
|
+
- --chain=regtest
|
|
73
|
+
- --rpcport=18443
|
|
74
|
+
- --rpcauth=bitcoin:7042dd0e1fd98669067098457a9f0859$95bc3e06d791b3c56e5fa17665cb341e35f1e48a7b5f43ad88a39d5b211327b5
|
|
75
|
+
- --rpcbind=0.0.0.0
|
|
76
|
+
- --rpcallowip=0.0.0.0/0
|
|
77
|
+
- --port=18444
|
|
78
|
+
- --listen=1
|
|
79
|
+
- --fallbackfee=0.0001
|
|
80
|
+
- --datadir=/bitcoin
|
|
81
|
+
- --blockfilterindex
|
|
82
|
+
- --txindex
|
|
83
|
+
- --wallet=mining
|
|
84
|
+
ports:
|
|
85
|
+
- "0:18443"
|
|
86
|
+
- "0:18444"
|
|
87
|
+
healthcheck:
|
|
88
|
+
test: >
|
|
89
|
+
echo '{"jsonrpc":"1.0","id":"curltest","method":"getblockchaininfo","params":[]}' | curl --fail -s --user bitcoin:bitcoin -H "content-type: text/plain;" --data-binary @- http://localhost:18443/
|
|
90
|
+
interval: 5s
|
|
91
|
+
retries: 10
|
|
92
|
+
|
|
93
|
+
bitcoin-electrs:
|
|
94
|
+
image: mempool/electrs:v3.2.0
|
|
95
|
+
restart: on-failure
|
|
96
|
+
user: "0:0"
|
|
97
|
+
ports:
|
|
98
|
+
- "0:50001" # Electrum server protocol
|
|
99
|
+
- "${ESPLORA_PORT:-0}:3002" # Esplora HTTP API
|
|
100
|
+
volumes:
|
|
101
|
+
- bitcoin-data:/bitcoin
|
|
102
|
+
- electrs-data:/electrs
|
|
103
|
+
command: |
|
|
104
|
+
--network regtest
|
|
105
|
+
--db-dir /electrs
|
|
106
|
+
--daemon-dir /bitcoin
|
|
107
|
+
--daemon-rpc-addr bitcoin:18443
|
|
108
|
+
--cookie bitcoin:bitcoin
|
|
109
|
+
--electrum-rpc-addr 0.0.0.0:50001
|
|
110
|
+
--http-addr 0.0.0.0:3002
|
|
111
|
+
--cors "*"
|
|
112
|
+
depends_on:
|
|
113
|
+
bitcoin-miner:
|
|
114
|
+
condition: service_started
|
|
115
|
+
|
|
116
|
+
bitcoin-wallet-init:
|
|
117
|
+
<<: *bitcoin
|
|
118
|
+
command: >
|
|
119
|
+
sh -c '
|
|
120
|
+
set -e
|
|
121
|
+
# if the conf file does not exist, create it
|
|
122
|
+
if [ ! -f /bitcoin/bitcoin.conf ]; then
|
|
123
|
+
mkdir -p /bitcoin
|
|
124
|
+
echo "[regtest]" > /bitcoin/bitcoin.conf
|
|
125
|
+
echo "rpcuser=bitcoin" >> /bitcoin/bitcoin.conf
|
|
126
|
+
echo "rpcpassword=bitcoin" >> /bitcoin/bitcoin.conf
|
|
127
|
+
echo "rpcconnect=bitcoin" >> /bitcoin/bitcoin.conf
|
|
128
|
+
echo "rpcport=18443" >> /bitcoin/bitcoin.conf
|
|
129
|
+
echo "txindex=1" >> /bitcoin/bitcoin.conf
|
|
130
|
+
echo "blockfilterindex=1" >> /bitcoin/bitcoin.conf
|
|
131
|
+
echo "wallet=mining" >> /bitcoin/bitcoin.conf
|
|
132
|
+
fi
|
|
133
|
+
echo "Bitcoin conf created at /bitcoin/bitcoin.conf"
|
|
134
|
+
echo $(bitcoin-cli -regtest -datadir=/bitcoin -conf=/bitcoin/bitcoin.conf getwalletinfo)
|
|
135
|
+
if ! bitcoin-cli -regtest -datadir=/bitcoin -conf=/bitcoin/bitcoin.conf getwalletinfo >/dev/null 2>&1; then
|
|
136
|
+
echo "Creating Bitcoin wallet..."
|
|
137
|
+
bitcoin-cli -regtest -datadir=/bitcoin -conf=/bitcoin/bitcoin.conf createwallet mining 2>/dev/null \
|
|
138
|
+
|| bitcoin-cli -regtest -datadir=/bitcoin -conf=/bitcoin/bitcoin.conf loadwallet mining
|
|
139
|
+
fi
|
|
140
|
+
echo "Bitcoin wallet initialized"
|
|
141
|
+
'
|
|
142
|
+
depends_on:
|
|
143
|
+
bitcoin:
|
|
144
|
+
condition: service_healthy
|
|
145
|
+
|
|
146
|
+
bitcoin-init:
|
|
147
|
+
<<: *bitcoin
|
|
148
|
+
command: /scripts/bitcoin-init.sh
|
|
149
|
+
environment:
|
|
150
|
+
BITCOIN_CLI_ARGS: >-
|
|
151
|
+
-regtest
|
|
152
|
+
-datadir=/bitcoin
|
|
153
|
+
-conf=/bitcoin/bitcoin.conf
|
|
154
|
+
-rpcwallet=mining
|
|
155
|
+
depends_on:
|
|
156
|
+
bitcoin-wallet-init:
|
|
157
|
+
condition: service_completed_successfully
|
|
158
|
+
|
|
159
|
+
bitcoin-miner:
|
|
160
|
+
<<: *bitcoin
|
|
161
|
+
command: /scripts/bitcoin-mine.sh
|
|
162
|
+
environment:
|
|
163
|
+
BITCOIN_CLI_ARGS: >-
|
|
164
|
+
-regtest
|
|
165
|
+
-datadir=/bitcoin
|
|
166
|
+
-conf=/bitcoin/bitcoin.conf
|
|
167
|
+
-rpcwallet=mining
|
|
168
|
+
INTERVAL_SECONDS: ${BITCOIN_BLOCK_SECS:-100} # needs to be 10 ticks, which are 10 seconds in local net
|
|
169
|
+
depends_on:
|
|
170
|
+
bitcoin-init:
|
|
171
|
+
condition: service_completed_successfully
|
|
172
|
+
|
|
173
|
+
# send 2 BTC to an arbitrary address
|
|
174
|
+
# docker compose --profile tooling run --rm btc-cli sendtoaddress bcrt1q... 2.0
|
|
175
|
+
#
|
|
176
|
+
## mine 15 blocks to the given address
|
|
177
|
+
# docker compose --profile tooling run --rm btc-cli generatetoaddress 15 bcrt1q...
|
|
178
|
+
btc-cli:
|
|
179
|
+
<<: *bitcoin
|
|
180
|
+
entrypoint:
|
|
181
|
+
- bitcoin-cli
|
|
182
|
+
- -regtest
|
|
183
|
+
- -datadir=/bitcoin
|
|
184
|
+
- -conf=/bitcoin/bitcoin.conf
|
|
185
|
+
- -rpcwallet=mining
|
|
186
|
+
profiles: [tooling] # keeps it out of the default `up`
|
|
187
|
+
|
|
188
|
+
archive-node:
|
|
189
|
+
<<: *node
|
|
190
|
+
depends_on:
|
|
191
|
+
bitcoin:
|
|
192
|
+
condition: service_healthy
|
|
193
|
+
bitcoin-init:
|
|
194
|
+
condition: service_completed_successfully
|
|
195
|
+
command: >
|
|
196
|
+
--alice
|
|
197
|
+
--compute-miners=1
|
|
198
|
+
--port=30334
|
|
199
|
+
--rpc-port=9944
|
|
200
|
+
--node-key=16ec4f460237d066d15d09a44959a7d49ea6405e98429826f1c28b9087bd60ea
|
|
201
|
+
--base-path=/data
|
|
202
|
+
--chain=${ARGON_CHAIN:-local}
|
|
203
|
+
--bitcoin-rpc-url=http://bitcoin:bitcoin@bitcoin:18443
|
|
204
|
+
--notebook-archive-hosts=http://minio:9000
|
|
205
|
+
--no-mdns
|
|
206
|
+
--network-backend=libp2p
|
|
207
|
+
--no-telemetry
|
|
208
|
+
--detailed-log-output
|
|
209
|
+
--rpc-cors=all
|
|
210
|
+
--rpc-methods=unsafe
|
|
211
|
+
--unsafe-rpc-external
|
|
212
|
+
--validator
|
|
213
|
+
--pruning=archive
|
|
214
|
+
ports:
|
|
215
|
+
- "${RPC_PORT:-9944}:9944"
|
|
216
|
+
- "0:30334"
|
|
217
|
+
volumes:
|
|
218
|
+
- archive-data:/data
|
|
219
|
+
environment:
|
|
220
|
+
RUST_LOG: info,argon=info,pallet=trace
|
|
221
|
+
healthcheck:
|
|
222
|
+
test:
|
|
223
|
+
- CMD-SHELL
|
|
224
|
+
- >
|
|
225
|
+
curl -fsS -H 'Content-Type: application/json' \
|
|
226
|
+
-d '{"id":1,"jsonrpc":"2.0","method":"system_health","params":[]}' \
|
|
227
|
+
http://127.0.0.1:9944 > /dev/null || exit 1
|
|
228
|
+
interval: 5s
|
|
229
|
+
timeout: 5s
|
|
230
|
+
start_period: 30s
|
|
231
|
+
retries: 12
|
|
232
|
+
|
|
233
|
+
miner-1:
|
|
234
|
+
<<: *node
|
|
235
|
+
depends_on:
|
|
236
|
+
bitcoin:
|
|
237
|
+
condition: service_healthy
|
|
238
|
+
bitcoin-init:
|
|
239
|
+
condition: service_completed_successfully
|
|
240
|
+
archive-node:
|
|
241
|
+
condition: service_healthy
|
|
242
|
+
command: >
|
|
243
|
+
--bob
|
|
244
|
+
--compute-miners=1
|
|
245
|
+
--port=30335
|
|
246
|
+
--rpc-port=9944
|
|
247
|
+
--node-key=f1425b14b3333b7e20bead4d3c3bcc35c908609c843194bb9753e2af6374a87f
|
|
248
|
+
--base-path=/data
|
|
249
|
+
--bootnodes=/dns/archive-node/tcp/30334/p2p/12D3KooWMdmKGEuFPVvwSd92jCQJgX9aFCp45E8vV2X284HQjwnn
|
|
250
|
+
--chain=${ARGON_CHAIN:-local}
|
|
251
|
+
--bitcoin-rpc-url=http://bitcoin:bitcoin@bitcoin:18443
|
|
252
|
+
--notebook-archive-hosts=http://minio:9000
|
|
253
|
+
--no-mdns
|
|
254
|
+
--network-backend=libp2p
|
|
255
|
+
--no-telemetry
|
|
256
|
+
--detailed-log-output
|
|
257
|
+
--rpc-cors=all
|
|
258
|
+
--rpc-methods=unsafe
|
|
259
|
+
--unsafe-rpc-external
|
|
260
|
+
--validator
|
|
261
|
+
--pruning=archive
|
|
262
|
+
ports:
|
|
263
|
+
- "0:9944"
|
|
264
|
+
- "0:30335"
|
|
265
|
+
volumes:
|
|
266
|
+
- miner1-data:/data
|
|
267
|
+
environment:
|
|
268
|
+
RUST_LOG: info,argon=info,pallet=trace
|
|
269
|
+
healthcheck:
|
|
270
|
+
test:
|
|
271
|
+
- CMD-SHELL
|
|
272
|
+
- >
|
|
273
|
+
curl -fsS -H 'Content-Type: application/json' \
|
|
274
|
+
-d '{"id":1,"jsonrpc":"2.0","method":"system_health","params":[]}' \
|
|
275
|
+
http://127.0.0.1:9944 | jq -e '.result.peers > 0' > /dev/null || exit 1
|
|
276
|
+
interval: 5s
|
|
277
|
+
timeout: 3s
|
|
278
|
+
start_period: 30s # allow sync & libp2p dial time
|
|
279
|
+
retries: 12
|
|
280
|
+
profiles:
|
|
281
|
+
- miners
|
|
282
|
+
- bob
|
|
283
|
+
- all
|
|
284
|
+
|
|
285
|
+
miner-2:
|
|
286
|
+
<<: *node
|
|
287
|
+
depends_on:
|
|
288
|
+
bitcoin:
|
|
289
|
+
condition: service_healthy
|
|
290
|
+
bitcoin-init:
|
|
291
|
+
condition: service_completed_successfully
|
|
292
|
+
archive-node:
|
|
293
|
+
condition: service_healthy
|
|
294
|
+
command: >
|
|
295
|
+
--dave
|
|
296
|
+
--compute-miners=1
|
|
297
|
+
--port=30336
|
|
298
|
+
--rpc-port=9944
|
|
299
|
+
--node-key=7e730d590cea52bc2219249da8647147ef53d5dbd00840ea8ed6d00d5f747935
|
|
300
|
+
--public-addr=/dns/miner-2/tcp/30336/p2p/12D3KooWJSbmepuSKfkxNq8aPeqr3oRQsN3E7SyprkzSuqR1nu23
|
|
301
|
+
--base-path=/data
|
|
302
|
+
--bootnodes=/dns/archive-node/tcp/30334/p2p/12D3KooWMdmKGEuFPVvwSd92jCQJgX9aFCp45E8vV2X284HQjwnn
|
|
303
|
+
--chain=${ARGON_CHAIN:-local}
|
|
304
|
+
--bitcoin-rpc-url=http://bitcoin:bitcoin@bitcoin:18443
|
|
305
|
+
--notebook-archive-hosts=http://minio:9000
|
|
306
|
+
--no-mdns
|
|
307
|
+
--network-backend=libp2p
|
|
308
|
+
--no-telemetry
|
|
309
|
+
--detailed-log-output
|
|
310
|
+
--rpc-cors=all
|
|
311
|
+
--rpc-methods=unsafe
|
|
312
|
+
--unsafe-rpc-external
|
|
313
|
+
--validator
|
|
314
|
+
--pruning=archive
|
|
315
|
+
ports:
|
|
316
|
+
- "0:9944"
|
|
317
|
+
- "0:30336"
|
|
318
|
+
volumes:
|
|
319
|
+
- miner2-data:/data
|
|
320
|
+
environment:
|
|
321
|
+
RUST_LOG: info,argon=info,pallet=trace
|
|
322
|
+
healthcheck:
|
|
323
|
+
test:
|
|
324
|
+
- CMD-SHELL
|
|
325
|
+
- >
|
|
326
|
+
curl -fsS -H 'Content-Type: application/json' \
|
|
327
|
+
-d '{"id":1,"jsonrpc":"2.0","method":"system_health","params":[]}' \
|
|
328
|
+
http://127.0.0.1:9944 | jq -e '.result.peers > 0' > /dev/null || exit 1
|
|
329
|
+
interval: 5s
|
|
330
|
+
timeout: 3s
|
|
331
|
+
start_period: 30s # allow sync & libp2p dial time
|
|
332
|
+
retries: 12
|
|
333
|
+
profiles:
|
|
334
|
+
- miners
|
|
335
|
+
- dave
|
|
336
|
+
- all
|
|
337
|
+
|
|
338
|
+
notary-insert-key:
|
|
339
|
+
<<: *notary
|
|
340
|
+
command: insert-key --keystore-path=/keystore --suri=//Ferdie//notary
|
|
341
|
+
volumes:
|
|
342
|
+
- notary-keystore:/keystore
|
|
343
|
+
|
|
344
|
+
notary-migrate:
|
|
345
|
+
<<: *notary
|
|
346
|
+
environment:
|
|
347
|
+
RUST_LOG: info
|
|
348
|
+
command: migrate --db-url=postgres://postgres:password@postgres:5432/notary
|
|
349
|
+
depends_on:
|
|
350
|
+
postgres:
|
|
351
|
+
condition: service_healthy
|
|
352
|
+
|
|
353
|
+
notary:
|
|
354
|
+
<<: *notary
|
|
355
|
+
depends_on:
|
|
356
|
+
notary-insert-key:
|
|
357
|
+
condition: service_completed_successfully
|
|
358
|
+
notary-migrate:
|
|
359
|
+
condition: service_completed_successfully
|
|
360
|
+
archive-node:
|
|
361
|
+
condition: service_healthy
|
|
362
|
+
minio:
|
|
363
|
+
condition: service_healthy
|
|
364
|
+
postgres:
|
|
365
|
+
condition: service_healthy
|
|
366
|
+
command:
|
|
367
|
+
- run
|
|
368
|
+
- --operator-address=5CiPPseXPECbkjWCa6MnjNokrgYjMqmKndv2rSnekmSK2DjL
|
|
369
|
+
- --db-url=postgres://postgres:password@postgres:5432/notary
|
|
370
|
+
- --keystore-path=/keystore
|
|
371
|
+
- --archive-endpoint=http://minio:9000
|
|
372
|
+
- --dev
|
|
373
|
+
- --bind-addr=0.0.0.0:9925
|
|
374
|
+
ports:
|
|
375
|
+
- "0:9925"
|
|
376
|
+
volumes:
|
|
377
|
+
- notary-keystore:/keystore
|
|
378
|
+
networks:
|
|
379
|
+
default:
|
|
380
|
+
aliases:
|
|
381
|
+
- notary.localhost
|
|
382
|
+
environment:
|
|
383
|
+
- TRUSTED_RPC_URL=ws://archive-node:9944
|
|
384
|
+
|
|
385
|
+
oracle-btc-insert-key:
|
|
386
|
+
<<: *oracle
|
|
387
|
+
command:
|
|
388
|
+
- insert-key
|
|
389
|
+
- --keystore-path=/keystore
|
|
390
|
+
- --suri=//Dave//oracle
|
|
391
|
+
- --crypto-type=sr25519
|
|
392
|
+
volumes:
|
|
393
|
+
- oracle-btc-keystore:/keystore
|
|
394
|
+
|
|
395
|
+
oracle-btc:
|
|
396
|
+
<<: *oracle
|
|
397
|
+
depends_on:
|
|
398
|
+
oracle-btc-insert-key:
|
|
399
|
+
condition: service_completed_successfully
|
|
400
|
+
archive-node:
|
|
401
|
+
condition: service_healthy
|
|
402
|
+
command:
|
|
403
|
+
- bitcoin
|
|
404
|
+
- --keystore-path=/keystore
|
|
405
|
+
- --signer-crypto=sr25519
|
|
406
|
+
- --signer-address=5HKyaEJY4P4yAixU7pBDsnacNBNSmRGR7hkqgRnC9msvxecj
|
|
407
|
+
- --bitcoin-rpc-url=http://bitcoin:bitcoin@bitcoin:18443
|
|
408
|
+
volumes:
|
|
409
|
+
- oracle-btc-keystore:/keystore
|
|
410
|
+
environment:
|
|
411
|
+
- TRUSTED_RPC_URL=ws://archive-node:9944
|
|
412
|
+
|
|
413
|
+
oracle-price-insert-key:
|
|
414
|
+
<<: *oracle
|
|
415
|
+
command:
|
|
416
|
+
- insert-key
|
|
417
|
+
- --keystore-path=/keystore
|
|
418
|
+
- --suri=//Eve//oracle
|
|
419
|
+
- --crypto-type=sr25519
|
|
420
|
+
volumes:
|
|
421
|
+
- oracle-price-keystore:/keystore
|
|
422
|
+
profiles:
|
|
423
|
+
- price-oracle
|
|
424
|
+
- all
|
|
425
|
+
|
|
426
|
+
oracle-price:
|
|
427
|
+
<<: *oracle
|
|
428
|
+
depends_on:
|
|
429
|
+
oracle-price-insert-key:
|
|
430
|
+
condition: service_completed_successfully
|
|
431
|
+
archive-node:
|
|
432
|
+
condition: service_healthy
|
|
433
|
+
command:
|
|
434
|
+
- price-index
|
|
435
|
+
- --keystore-path=/keystore
|
|
436
|
+
- --signer-crypto=sr25519
|
|
437
|
+
- --signer-address=5Hn1p9jNYatcvcyugRc3TRyfC6zvFGTAX4qe14RhqBYcfrkE
|
|
438
|
+
- --simulate-prices
|
|
439
|
+
volumes:
|
|
440
|
+
- oracle-price-keystore:/keystore
|
|
441
|
+
- /tmp/oracle/data/:/tmp/oracle/data/
|
|
442
|
+
environment:
|
|
443
|
+
- TRUSTED_RPC_URL=ws://archive-node:9944
|
|
444
|
+
- ARGON_TOKEN_ADDRESS=${ARGON_TOKEN_ADDRESS:-3e622317f8C93f7328350cF0B56d9eD4C620C5d6}
|
|
445
|
+
- ARGONOT_TOKEN_ADDRESS=${ARGONOT_TOKEN_ADDRESS:-3e622317f8C93f7328350cF0B56d9eD4C620C5d6}
|
|
446
|
+
- BLS_API_KEY=${BLS_API_KEY}
|
|
447
|
+
- INFURA_PROJECT_ID=${INFURA_PROJECT_ID}
|
|
448
|
+
- ORACLE_CPI_CACHE_PATH=/tmp/oracle/data/US_CPI_State.json
|
|
449
|
+
profiles:
|
|
450
|
+
- price-oracle
|
|
451
|
+
- all
|
|
452
|
+
|
|
453
|
+
networks:
|
|
454
|
+
default:
|
|
455
|
+
name: ${COMPOSE_PROJECT_NAME:-argon}-net
|
|
456
|
+
|
|
457
|
+
volumes:
|
|
458
|
+
minio-data:
|
|
459
|
+
pgdata:
|
|
460
|
+
bitcoin-data:
|
|
461
|
+
electrs-data:
|
|
462
|
+
archive-data:
|
|
463
|
+
miner1-data:
|
|
464
|
+
miner2-data:
|
|
465
|
+
notary-keystore:
|
|
466
|
+
oracle-btc-keystore:
|
|
467
|
+
oracle-price-keystore:
|
package/lib/index.cjs
CHANGED
|
@@ -45,6 +45,7 @@ __export(index_exports, {
|
|
|
45
45
|
projectRoot: () => projectRoot,
|
|
46
46
|
runOnTeardown: () => runOnTeardown,
|
|
47
47
|
runTestScript: () => runTestScript,
|
|
48
|
+
startNetwork: () => startNetwork,
|
|
48
49
|
stringifyExt: () => stringifyExt,
|
|
49
50
|
sudo: () => sudo,
|
|
50
51
|
teardown: () => teardown
|
|
@@ -57,7 +58,7 @@ var import_http_proxy = __toESM(require("http-proxy"), 1);
|
|
|
57
58
|
var child_process4 = __toESM(require("child_process"), 1);
|
|
58
59
|
var http = __toESM(require("http"), 1);
|
|
59
60
|
var url = __toESM(require("url"), 1);
|
|
60
|
-
var
|
|
61
|
+
var Path6 = __toESM(require("path"), 1);
|
|
61
62
|
|
|
62
63
|
// src/TestNotary.ts
|
|
63
64
|
var import_nanoid = require("nanoid");
|
|
@@ -131,7 +132,7 @@ var TestNotary = class {
|
|
|
131
132
|
} finally {
|
|
132
133
|
await client.end();
|
|
133
134
|
}
|
|
134
|
-
|
|
135
|
+
const result = child_process.execSync(
|
|
135
136
|
`${notaryPath} migrate --db-url ${this.#dbConnectionString}/${this.#dbName}`,
|
|
136
137
|
{
|
|
137
138
|
encoding: "utf-8"
|
|
@@ -177,13 +178,13 @@ var TestNotary = class {
|
|
|
177
178
|
this.#childProcess.once("error", onProcessError);
|
|
178
179
|
this.#childProcess.stderr.on("data", (data) => {
|
|
179
180
|
console.warn("Notary >> %s", data);
|
|
180
|
-
if (data.startsWith("WARNING")) return;
|
|
181
|
+
if (typeof data === "string" && data.startsWith("WARNING")) return;
|
|
181
182
|
this.#childProcess.off("error", onProcessError);
|
|
182
183
|
reject(data);
|
|
183
184
|
});
|
|
184
185
|
this.#stdioInterface = readline.createInterface({ input: this.#childProcess.stdout }).on("line", (line) => {
|
|
185
186
|
console.log("Notary >> %s", line);
|
|
186
|
-
|
|
187
|
+
const match = line.match(/Listening on ([ws:/\d.]+)/);
|
|
187
188
|
if (match?.length ?? 0 > 0) {
|
|
188
189
|
resolve3(match[1].split(":").pop());
|
|
189
190
|
}
|
|
@@ -199,7 +200,7 @@ var TestNotary = class {
|
|
|
199
200
|
return this.address;
|
|
200
201
|
}
|
|
201
202
|
async register(client) {
|
|
202
|
-
|
|
203
|
+
const address = new URL(this.address);
|
|
203
204
|
await new import_mainchain.TxSubmitter(
|
|
204
205
|
client,
|
|
205
206
|
client.tx.notaries.propose({
|
|
@@ -295,7 +296,7 @@ var TestMainchain = class {
|
|
|
295
296
|
*/
|
|
296
297
|
async launch(options) {
|
|
297
298
|
const { miningThreads = 1, bootnodes, author = "alice", launchBitcoin = false } = options ?? {};
|
|
298
|
-
let
|
|
299
|
+
let port2 = 0;
|
|
299
300
|
let rpcPort = 0;
|
|
300
301
|
let execArgs = [];
|
|
301
302
|
let containerName;
|
|
@@ -303,13 +304,13 @@ var TestMainchain = class {
|
|
|
303
304
|
containerName = "miner_" + nanoid2();
|
|
304
305
|
this.containerName = containerName;
|
|
305
306
|
this.#binPath = "docker";
|
|
306
|
-
|
|
307
|
+
port2 = 33344;
|
|
307
308
|
rpcPort = 9944;
|
|
308
309
|
execArgs = [
|
|
309
310
|
"run",
|
|
310
311
|
"--rm",
|
|
311
312
|
`--name=${containerName}`,
|
|
312
|
-
`-p=0:${
|
|
313
|
+
`-p=0:${port2}`,
|
|
313
314
|
`-p=0:${rpcPort}`,
|
|
314
315
|
"-e",
|
|
315
316
|
`RUST_LOG=${this.loglevel},sc_rpc_server=info`,
|
|
@@ -325,7 +326,7 @@ var TestMainchain = class {
|
|
|
325
326
|
"--validator",
|
|
326
327
|
`--${author}`,
|
|
327
328
|
`--compute-miners=${miningThreads}`,
|
|
328
|
-
`--port=${
|
|
329
|
+
`--port=${port2}`,
|
|
329
330
|
`--rpc-port=${rpcPort}`,
|
|
330
331
|
"--rpc-external",
|
|
331
332
|
"--no-mdns",
|
|
@@ -359,9 +360,9 @@ var TestMainchain = class {
|
|
|
359
360
|
});
|
|
360
361
|
const int2 = readline2.createInterface({ input: this.#process.stderr }).on("line", (line) => {
|
|
361
362
|
console.log("Main >> %s", line);
|
|
362
|
-
|
|
363
|
+
const match = line.match(/Running JSON-RPC server: addr=([\d.:]+)/);
|
|
363
364
|
if (match) {
|
|
364
|
-
|
|
365
|
+
const ipv4 = match[1].split(",").at(0);
|
|
365
366
|
resolve3(ipv4.split(":").pop());
|
|
366
367
|
}
|
|
367
368
|
});
|
|
@@ -547,6 +548,42 @@ var TestOracle = class _TestOracle {
|
|
|
547
548
|
}
|
|
548
549
|
};
|
|
549
550
|
|
|
551
|
+
// src/TestNetwork.ts
|
|
552
|
+
var docker = __toESM(require("docker-compose"), 1);
|
|
553
|
+
var Path5 = __toESM(require("path"), 1);
|
|
554
|
+
async function startNetwork(testName, options) {
|
|
555
|
+
const config = Path5.join(__dirname, `docker-compose.yml`);
|
|
556
|
+
const env4 = {
|
|
557
|
+
VERSION: "dev",
|
|
558
|
+
ARGON_CHAIN: "dev-docker",
|
|
559
|
+
BITCOIN_BLOCK_SECS: "20",
|
|
560
|
+
PATH: `${process.env.PATH}:/opt/homebrew/bin:/usr/local/bin`,
|
|
561
|
+
COMPOSE_PROJECT_NAME: `argon-test-${testName}`,
|
|
562
|
+
...options?.dockerEnv ?? {}
|
|
563
|
+
};
|
|
564
|
+
runOnTeardown(async () => {
|
|
565
|
+
await docker.downAll({
|
|
566
|
+
log: options?.shouldLog ?? false,
|
|
567
|
+
commandOptions: [`--volumes`],
|
|
568
|
+
env: env4,
|
|
569
|
+
config
|
|
570
|
+
});
|
|
571
|
+
});
|
|
572
|
+
await docker.upAll({
|
|
573
|
+
log: options?.shouldLog ?? false,
|
|
574
|
+
commandOptions: [`--force-recreate`, `--remove-orphans`],
|
|
575
|
+
config,
|
|
576
|
+
env: env4
|
|
577
|
+
});
|
|
578
|
+
const portResult = await docker.port("archive-node", "9944", { config, env: env4 });
|
|
579
|
+
const notaryPortResult = await docker.port("notary", "9925", { config, env: env4 });
|
|
580
|
+
const port2 = portResult.data.port;
|
|
581
|
+
return {
|
|
582
|
+
archiveUrl: `ws://localhost:${port2}`,
|
|
583
|
+
notaryUrl: `ws://localhost:${notaryPortResult.data.port}`
|
|
584
|
+
};
|
|
585
|
+
}
|
|
586
|
+
|
|
550
587
|
// src/index.ts
|
|
551
588
|
var toTeardown = [];
|
|
552
589
|
var proxy = null;
|
|
@@ -593,8 +630,8 @@ async function getProxy() {
|
|
|
593
630
|
})
|
|
594
631
|
});
|
|
595
632
|
}
|
|
596
|
-
const
|
|
597
|
-
return `ws://host.docker.internal:${
|
|
633
|
+
const port2 = proxyServer.address().port;
|
|
634
|
+
return `ws://host.docker.internal:${port2}`;
|
|
598
635
|
}
|
|
599
636
|
function stringifyExt(obj) {
|
|
600
637
|
return JSON.stringify(
|
|
@@ -613,16 +650,16 @@ function stringifyExt(obj) {
|
|
|
613
650
|
}
|
|
614
651
|
function projectRoot() {
|
|
615
652
|
if (process4.env.ARGON_PROJECT_ROOT) {
|
|
616
|
-
return
|
|
653
|
+
return Path6.join(process4.env.ARGON_PROJECT_ROOT);
|
|
617
654
|
}
|
|
618
|
-
return
|
|
655
|
+
return Path6.join(__dirname, `../../..`);
|
|
619
656
|
}
|
|
620
657
|
async function runTestScript(relativePath) {
|
|
621
|
-
const scriptPath =
|
|
658
|
+
const scriptPath = Path6.resolve(projectRoot(), relativePath);
|
|
622
659
|
return child_process4.execSync(scriptPath, { encoding: "utf8" }).trim();
|
|
623
660
|
}
|
|
624
|
-
async function getDockerPortMapping(containerName,
|
|
625
|
-
return child_process4.execSync(`docker port ${containerName} ${
|
|
661
|
+
async function getDockerPortMapping(containerName, port2) {
|
|
662
|
+
return child_process4.execSync(`docker port ${containerName} ${port2}`, { encoding: "utf8" }).trim().split(":").pop();
|
|
626
663
|
}
|
|
627
664
|
async function teardown() {
|
|
628
665
|
for (const t of toTeardown) {
|
|
@@ -681,6 +718,7 @@ async function activateNotary(sudo2, client, notary) {
|
|
|
681
718
|
projectRoot,
|
|
682
719
|
runOnTeardown,
|
|
683
720
|
runTestScript,
|
|
721
|
+
startNetwork,
|
|
684
722
|
stringifyExt,
|
|
685
723
|
sudo,
|
|
686
724
|
teardown
|