@argonprotocol/testing 1.4.9 → 1.4.10-dev.459cb75f

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.
@@ -1,6 +1,6 @@
1
1
  ## Shared configs
2
2
  x-oracle-config: &oracle
3
- image: ghcr.io/argonprotocol/argon-oracle:${VERSION:-latest}
3
+ image: ghcr.io/argonprotocol/argon-oracle:${VERSION:-dev}
4
4
  user: root
5
5
  build:
6
6
  context: .
@@ -8,7 +8,7 @@ x-oracle-config: &oracle
8
8
  target: oracle
9
9
  restart: on-failure
10
10
  x-notary-config: &notary
11
- image: ghcr.io/argonprotocol/argon-notary:${VERSION:-latest}
11
+ image: ghcr.io/argonprotocol/argon-notary:${VERSION:-dev}
12
12
  user: root
13
13
  build:
14
14
  context: .
@@ -16,7 +16,7 @@ x-notary-config: &notary
16
16
  target: argon-notary
17
17
  restart: on-failure
18
18
  x-node-config: &node
19
- image: ghcr.io/argonprotocol/argon-miner:${VERSION:-latest}
19
+ image: ghcr.io/argonprotocol/argon-miner:${VERSION:-dev}
20
20
  build:
21
21
  context: .
22
22
  dockerfile: dev.Dockerfile
@@ -212,7 +212,7 @@ services:
212
212
  --validator
213
213
  --pruning=archive
214
214
  ports:
215
- - "${RPC_PORT:-9944}:9944"
215
+ - "${ARCHIVE_NODE_RPC_PORT:-0}:9944"
216
216
  - "0:30334"
217
217
  volumes:
218
218
  - archive-data:/data
@@ -230,6 +230,50 @@ services:
230
230
  start_period: 30s
231
231
  retries: 12
232
232
 
233
+ archive-rpc:
234
+ image: ghcr.io/argonprotocol/argon-rpc:dev
235
+ build:
236
+ context: .
237
+ dockerfile: docker/argon-rpc/Containerfile
238
+ restart: on-failure
239
+ depends_on:
240
+ archive-node:
241
+ condition: service_healthy
242
+ # Forward optional host overrides; config.yml defaults still apply when values are unset or blank.
243
+ environment:
244
+ - RUST_LOG=${ARGON_RPC_RUST_LOG:-info,subway=debug}
245
+ - LOG_FORMAT=${ARGON_RPC_LOG_FORMAT:-compact}
246
+ - ARGON_RPC_ENDPOINTS
247
+ - ARGON_RPC_UPSTREAM_REQUEST_TIMEOUT_SECONDS
248
+ - ARGON_RPC_UPSTREAM_CONNECTION_TIMEOUT_SECONDS
249
+ - ARGON_RPC_UPSTREAM_RETRIES
250
+ - ARGON_RPC_STALE_TIMEOUT_SECONDS
251
+ - ARGON_RPC_CACHE_TTL_SECONDS
252
+ - ARGON_RPC_CACHE_SIZE
253
+ - ARGON_RPC_KEEP_ALIVE_SECONDS
254
+ - ARGON_RPC_MAX_CONNECTIONS
255
+ - ARGON_RPC_MAX_BATCH_SIZE
256
+ - ARGON_RPC_CONNECTION_BURST
257
+ - ARGON_RPC_CONNECTION_PERIOD_SECS
258
+ - ARGON_RPC_IP_BURST
259
+ - ARGON_RPC_IP_PERIOD_SECS
260
+ - ARGON_RPC_USE_XFF
261
+ - ARGON_RPC_PROMETHEUS_LABEL
262
+ ports:
263
+ - "${RPC_PORT:-9944}:9944"
264
+ healthcheck:
265
+ test:
266
+ - CMD-SHELL
267
+ - >
268
+ bash -lc 'exec 3<>/dev/tcp/127.0.0.1/9944 &&
269
+ printf "GET /liveness HTTP/1.1\r\nHost: 127.0.0.1\r\nConnection: close\r\n\r\n" >&3 &&
270
+ IFS= read -r status <&3 &&
271
+ [[ $$status == *"200 OK"* ]]'
272
+ interval: 5s
273
+ timeout: 5s
274
+ start_period: 10s
275
+ retries: 12
276
+
233
277
  miner-1:
234
278
  <<: *node
235
279
  depends_on:
@@ -357,7 +401,7 @@ services:
357
401
  condition: service_completed_successfully
358
402
  notary-migrate:
359
403
  condition: service_completed_successfully
360
- archive-node:
404
+ archive-rpc:
361
405
  condition: service_healthy
362
406
  minio:
363
407
  condition: service_healthy
@@ -380,7 +424,7 @@ services:
380
424
  aliases:
381
425
  - notary.localhost
382
426
  environment:
383
- - TRUSTED_RPC_URL=ws://archive-node:9944
427
+ - TRUSTED_RPC_URL=ws://archive-rpc:9944
384
428
 
385
429
  oracle-btc-insert-key:
386
430
  <<: *oracle
@@ -397,7 +441,7 @@ services:
397
441
  depends_on:
398
442
  oracle-btc-insert-key:
399
443
  condition: service_completed_successfully
400
- archive-node:
444
+ archive-rpc:
401
445
  condition: service_healthy
402
446
  command:
403
447
  - bitcoin
@@ -408,7 +452,7 @@ services:
408
452
  volumes:
409
453
  - oracle-btc-keystore:/keystore
410
454
  environment:
411
- - TRUSTED_RPC_URL=ws://archive-node:9944
455
+ - TRUSTED_RPC_URL=ws://archive-rpc:9944
412
456
 
413
457
  oracle-price-insert-key:
414
458
  <<: *oracle
@@ -428,7 +472,7 @@ services:
428
472
  depends_on:
429
473
  oracle-price-insert-key:
430
474
  condition: service_completed_successfully
431
- archive-node:
475
+ archive-rpc:
432
476
  condition: service_healthy
433
477
  command: >
434
478
  price-index
@@ -441,7 +485,7 @@ services:
441
485
  - /tmp/oracle/data/:/tmp/oracle/data/
442
486
  - ${PRICE_INDEX_FILE_PATH:-./oracle/test-price-index.json}:/price_index.json:ro
443
487
  environment:
444
- - TRUSTED_RPC_URL=ws://archive-node:9944
488
+ - TRUSTED_RPC_URL=ws://archive-rpc:9944
445
489
  profiles:
446
490
  - price-oracle
447
491
  - all
@@ -453,7 +497,7 @@ services:
453
497
  depends_on:
454
498
  oracle-price-insert-key:
455
499
  condition: service_completed_successfully
456
- archive-node:
500
+ archive-rpc:
457
501
  condition: service_healthy
458
502
  command: >
459
503
  price-index
@@ -464,7 +508,7 @@ services:
464
508
  - oracle-price-keystore:/keystore
465
509
  - /tmp/oracle/data/:/tmp/oracle/data/
466
510
  environment:
467
- - TRUSTED_RPC_URL=ws://archive-node:9944
511
+ - TRUSTED_RPC_URL=ws://archive-rpc:9944
468
512
  - ARGON_TOKEN_ADDRESS=${ARGON_TOKEN_ADDRESS:-3e622317f8C93f7328350cF0B56d9eD4C620C5d6}
469
513
  - ARGONOT_TOKEN_ADDRESS=${ARGONOT_TOKEN_ADDRESS:-3e622317f8C93f7328350cF0B56d9eD4C620C5d6}
470
514
  - BLS_API_KEY=${BLS_API_KEY}
package/lib/index.cjs CHANGED
@@ -1356,10 +1356,14 @@ async function delay2(ms) {
1356
1356
  var import_mainchain6 = require("@argonprotocol/mainchain");
1357
1357
  var import_viem3 = require("viem");
1358
1358
  var {
1359
+ encodeMintingGatewayGlobalIssuanceCouncilRotateTarget,
1359
1360
  encodeMintingGatewayMintingAuthorityActivationTarget,
1360
1361
  encodeMintingGatewayMintingAuthorityDeactivateTarget,
1361
1362
  hashMintingGatewayActivateMintingAuthority,
1362
1363
  hashMintingGatewayGatewayUpdateApproval,
1364
+ hashMintingGatewayGlobalIssuanceCouncil: hashMintingGatewayGlobalIssuanceCouncil2,
1365
+ hashMintingGatewayRotateGlobalIssuanceCouncil,
1366
+ hashMintingGatewayRotateGlobalIssuanceCouncilApproval,
1363
1367
  mintingGatewayAbi,
1364
1368
  MINTING_GATEWAY_UPDATE_KINDS
1365
1369
  } = import_mainchain6.EvmContracts;
@@ -1437,7 +1441,8 @@ async function getReadyEthereumGatewayUpdates(client, gatewayClient, options = {
1437
1441
  }
1438
1442
  const update = await buildGatewayUpdate(client, destinationChain, hashContext, queueNonce, {
1439
1443
  entry,
1440
- approvingCouncilHash
1444
+ approvingCouncilHash,
1445
+ councilCache
1441
1446
  });
1442
1447
  candidateUpdates.push(update);
1443
1448
  expectedPreviousApprovalHash = toHexValue(entry.approvalHash);
@@ -1468,7 +1473,42 @@ async function getReadyEthereumGatewayUpdates(client, gatewayClient, options = {
1468
1473
  };
1469
1474
  }
1470
1475
  async function buildGatewayUpdate(client, destinationChain, hashContext, queueNonce, queueItem) {
1471
- const { entry, approvingCouncilHash } = queueItem;
1476
+ const { entry, approvingCouncilHash, councilCache } = queueItem;
1477
+ if (entry.target.isGlobalIssuanceCouncilRotation) {
1478
+ const signatures = getSortedSignatures(entry.signatures);
1479
+ const nextCouncilHash = toHexValue(entry.target.asGlobalIssuanceCouncilRotation);
1480
+ const nextCouncil = await loadCouncilByHash(client, nextCouncilHash, councilCache);
1481
+ const target = {
1482
+ council: councilToSnapshot(nextCouncil),
1483
+ epochMicrogonsPerArgonot: nextCouncil.epochMicrogonsPerArgonot
1484
+ };
1485
+ const calculatedCouncilHash = hashMintingGatewayGlobalIssuanceCouncil2({
1486
+ ...target.council,
1487
+ epochMicrogonsPerArgonot: target.epochMicrogonsPerArgonot
1488
+ });
1489
+ const targetPayloadHash = hashMintingGatewayRotateGlobalIssuanceCouncil(hashContext, target);
1490
+ const approvalHash = hashMintingGatewayRotateGlobalIssuanceCouncilApproval(hashContext, {
1491
+ queueNonce,
1492
+ approvingCouncilHash,
1493
+ previousUpdateHash: toHexValue(entry.previousApprovalHash),
1494
+ target
1495
+ });
1496
+ if (calculatedCouncilHash !== nextCouncilHash) {
1497
+ throw new Error(`Queue nonce ${queueNonce} target council hash does not match council`);
1498
+ }
1499
+ if (toHexValue(entry.targetPayloadHash) !== targetPayloadHash) {
1500
+ throw new Error(`Queue nonce ${queueNonce} target payload hash does not match council`);
1501
+ }
1502
+ if (toHexValue(entry.approvalHash) !== approvalHash) {
1503
+ throw new Error(`Queue nonce ${queueNonce} approval hash does not match council rotation`);
1504
+ }
1505
+ return {
1506
+ queueNonce,
1507
+ kind: MINTING_GATEWAY_UPDATE_KINDS.globalIssuanceCouncilRotate,
1508
+ payload: encodeMintingGatewayGlobalIssuanceCouncilRotateTarget(target),
1509
+ signatures
1510
+ };
1511
+ }
1472
1512
  if (entry.target.isMintingAuthorityActivation) {
1473
1513
  const signatures = getSortedSignatures(entry.signatures);
1474
1514
  const signingKey = (0, import_viem3.getAddress)(toHexValue(entry.target.asMintingAuthorityActivation));
@@ -1554,6 +1594,7 @@ async function loadCouncilByHash(client, councilHash, cache) {
1554
1594
  }
1555
1595
  const council = councilOption.unwrap();
1556
1596
  const loaded = {
1597
+ epochMicrogonsPerArgonot: council.epochMicrogonsPerArgonot.toBigInt(),
1557
1598
  totalWeight: council.totalWeight.toBigInt(),
1558
1599
  members: [...council.members.entries()].map(([signer, member]) => ({
1559
1600
  signer: (0, import_viem3.getAddress)(toHexValue(signer)),