@parity/product-deploy 0.10.1-dev.0 → 0.11.0-rc.0

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.
Files changed (36) hide show
  1. package/dist/auth-config.js +3 -3
  2. package/dist/bug-report.js +4 -4
  3. package/dist/{chunk-J63XPPZW.js → chunk-5LAKX4AB.js} +1 -1
  4. package/dist/chunk-A2JFMAG3.js +78 -0
  5. package/dist/{chunk-LSZEHAFU.js → chunk-BKEXG2QF.js} +1 -1
  6. package/dist/{chunk-HX6BOXMG.js → chunk-D3NJNDEW.js} +14 -1
  7. package/dist/{chunk-QIMAKL3Z.js → chunk-HN3YZDX4.js} +1 -1
  8. package/dist/{chunk-4GDFP7XR.js → chunk-MDS7T32B.js} +1 -1
  9. package/dist/{chunk-FMUO4UBG.js → chunk-QNXFKFJD.js} +2 -2
  10. package/dist/{chunk-NBBV3IS3.js → chunk-RBTRQH32.js} +10 -5
  11. package/dist/{chunk-ZNZOAGMR.js → chunk-VJITD6HN.js} +115 -71
  12. package/dist/{chunk-QGGISN4D.js → chunk-X2BEJT4V.js} +1 -1
  13. package/dist/{chunk-VMQDFI4D.js → chunk-XQTDSVJG.js} +5 -10
  14. package/dist/chunk-probe.js +3 -3
  15. package/dist/commands/login.js +22 -21
  16. package/dist/commands/logout.js +7 -7
  17. package/dist/commands/transfer.js +3 -3
  18. package/dist/commands/whoami.js +3 -3
  19. package/dist/deploy-actors.d.ts +84 -3
  20. package/dist/deploy-actors.js +12 -35
  21. package/dist/deploy.d.ts +4 -3
  22. package/dist/deploy.js +13 -9
  23. package/dist/dotns.js +3 -3
  24. package/dist/index.js +14 -10
  25. package/dist/manifest/publish.js +14 -10
  26. package/dist/memory-report.js +2 -2
  27. package/dist/merkle.js +13 -9
  28. package/dist/personhood/bootstrap.js +3 -3
  29. package/dist/personhood/people-client.js +3 -3
  30. package/dist/run-state.js +1 -1
  31. package/dist/sss-allowance-cache.js +4 -4
  32. package/dist/storage-signer.js +13 -9
  33. package/dist/telemetry.d.ts +9 -1
  34. package/dist/telemetry.js +6 -2
  35. package/dist/version-check.js +3 -3
  36. package/package.json +5 -10
@@ -9,10 +9,10 @@ import {
9
9
  getPeopleChainEndpoints,
10
10
  hasPersistedSession,
11
11
  resolveBulletinEndpoints
12
- } from "./chunk-QGGISN4D.js";
12
+ } from "./chunk-X2BEJT4V.js";
13
13
  import "./chunk-TSPERKUS.js";
14
- import "./chunk-HX6BOXMG.js";
15
- import "./chunk-VMQDFI4D.js";
14
+ import "./chunk-D3NJNDEW.js";
15
+ import "./chunk-XQTDSVJG.js";
16
16
  import "./chunk-QRKI6MMK.js";
17
17
  import "./chunk-ZOC4GITL.js";
18
18
  export {
@@ -9,10 +9,10 @@ import {
9
9
  offerBugReport,
10
10
  scrubSecrets,
11
11
  setDeployContext
12
- } from "./chunk-NBBV3IS3.js";
13
- import "./chunk-J63XPPZW.js";
14
- import "./chunk-HX6BOXMG.js";
15
- import "./chunk-VMQDFI4D.js";
12
+ } from "./chunk-RBTRQH32.js";
13
+ import "./chunk-5LAKX4AB.js";
14
+ import "./chunk-D3NJNDEW.js";
15
+ import "./chunk-XQTDSVJG.js";
16
16
  export {
17
17
  buildCliFlagsSummary,
18
18
  buildLabels,
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  VERSION
3
- } from "./chunk-HX6BOXMG.js";
3
+ } from "./chunk-D3NJNDEW.js";
4
4
 
5
5
  // src/version-check.ts
6
6
  import { execSync, execFileSync } from "child_process";
@@ -0,0 +1,78 @@
1
+ import {
2
+ BULLETIN_RESOURCE,
3
+ resolveSigner
4
+ } from "./chunk-5FLTDWWP.js";
5
+ import {
6
+ DOT_PRODUCT_ID
7
+ } from "./chunk-X2BEJT4V.js";
8
+ import {
9
+ DEFAULT_MNEMONIC
10
+ } from "./chunk-MDS7T32B.js";
11
+
12
+ // src/deploy-actors.ts
13
+ var DEFAULT_WORKER_SURI = DEFAULT_MNEMONIC;
14
+ var MainnetDefaultWorkerError = class extends Error {
15
+ constructor() {
16
+ super(
17
+ "Refusing to default the deploy worker to Alice on a non-testnet environment. Pass --mnemonic <a funded, sufficiently-verified key> to do the transfer flow, or --no-transfer-to-signedin-user to sign directly with your mobile session."
18
+ );
19
+ this.name = "MainnetDefaultWorkerError";
20
+ }
21
+ };
22
+ async function resolveDeployActors(authClient, { suri, transferEnabled, isTestnet, sessionPresent }) {
23
+ if (sessionPresent && transferEnabled) {
24
+ if (!suri && !isTestnet) throw new MainnetDefaultWorkerError();
25
+ const worker2 = await resolveSigner(authClient, { suri: suri ?? DEFAULT_WORKER_SURI });
26
+ const handle = await authClient.getSessionSigner();
27
+ if (!handle) throw new Error("transfer mode active but no session resolved; pass --no-transfer-to-signedin-user.");
28
+ try {
29
+ return { worker: worker2, recipientH160: handle.addresses.productH160 };
30
+ } finally {
31
+ handle.destroy();
32
+ }
33
+ }
34
+ const worker = await resolveSigner(authClient, { suri });
35
+ return { worker };
36
+ }
37
+ async function resolveStorageSigner(session, deps) {
38
+ if (!session?.userSession || !session?.adapter) return null;
39
+ const { userSession, adapter } = session;
40
+ try {
41
+ const signerResult = await deps.getBulletinSigner(userSession.id, DOT_PRODUCT_ID, adapter);
42
+ if (signerResult.isOk() && signerResult.value) {
43
+ const signer = signerResult.value;
44
+ const slotAddress = deps.ss58Encode(signer.publicKey);
45
+ return { signer, slotAddress, owned: true };
46
+ }
47
+ const reason = signerResult.error?.reason;
48
+ if (reason === "NoSession") {
49
+ return null;
50
+ }
51
+ deps.promptBeforeAllocation();
52
+ const outcomes = await deps.requestResourceAllocation(
53
+ userSession,
54
+ adapter,
55
+ [BULLETIN_RESOURCE]
56
+ );
57
+ const outcome = outcomes[0];
58
+ if (!outcome || outcome.tag !== "Allocated") {
59
+ return null;
60
+ }
61
+ if (deps.createSlotAccountSigner) {
62
+ const slotSigner = await deps.createSlotAccountSigner(adapter, BULLETIN_RESOURCE);
63
+ if (slotSigner) {
64
+ const slotAddress = deps.ss58Encode(slotSigner.publicKey);
65
+ return { signer: slotSigner, slotAddress, owned: true };
66
+ }
67
+ }
68
+ return null;
69
+ } catch {
70
+ return null;
71
+ }
72
+ }
73
+
74
+ export {
75
+ MainnetDefaultWorkerError,
76
+ resolveDeployActors,
77
+ resolveStorageSigner
78
+ };
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  captureWarning
3
- } from "./chunk-HX6BOXMG.js";
3
+ } from "./chunk-D3NJNDEW.js";
4
4
 
5
5
  // src/chunk-probe.ts
6
6
  import { Twox128, Blake2128Concat, decAnyMetadata, unifyMetadata } from "@polkadot-api/substrate-bindings";
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  package_default,
3
3
  writeRunState
4
- } from "./chunk-VMQDFI4D.js";
4
+ } from "./chunk-XQTDSVJG.js";
5
5
 
6
6
  // src/memory-report.ts
7
7
  import * as fs2 from "fs";
@@ -22,6 +22,17 @@ var PARITY_HOST_APPS = /* @__PURE__ */ new Set(["playground-cli"]);
22
22
  function extractRepoSlug(url) {
23
23
  return url.replace(/.*github\.com[:/]/, "").replace(/\.git$/, "");
24
24
  }
25
+ var FALLBACK_ISSUE_REPO = "paritytech/bulletin-deploy";
26
+ function resolveIssueRepoSlug(repository) {
27
+ try {
28
+ const raw = typeof repository === "string" ? repository : repository?.url;
29
+ if (!raw || typeof raw !== "string") return FALLBACK_ISSUE_REPO;
30
+ const slug = extractRepoSlug(raw.trim());
31
+ if (/^[^/\s]+\/[^/\s]+$/.test(slug)) return slug;
32
+ } catch {
33
+ }
34
+ return FALLBACK_ISSUE_REPO;
35
+ }
25
36
  function tryGitRemote() {
26
37
  try {
27
38
  return extractRepoSlug(execSync("git remote get-url origin", { encoding: "utf-8", stdio: ["pipe", "pipe", "pipe"] }).trim());
@@ -724,6 +735,8 @@ export {
724
735
  maybeWriteMemoryReport,
725
736
  sampleFromBytes,
726
737
  VERSION,
738
+ extractRepoSlug,
739
+ resolveIssueRepoSlug,
727
740
  isInternalContextFromSignals,
728
741
  isInternalContext,
729
742
  isTelemetryDisabled,
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-GRPLHUYC.js";
4
4
  import {
5
5
  DOT_DAPP_ID
6
- } from "./chunk-QGGISN4D.js";
6
+ } from "./chunk-X2BEJT4V.js";
7
7
 
8
8
  // src/sss-allowance-cache.ts
9
9
  import { mkdir, readFile, writeFile, unlink } from "fs/promises";
@@ -11,7 +11,7 @@ import {
11
11
  setDeploySentryTag,
12
12
  truncateAddress,
13
13
  withSpan
14
- } from "./chunk-HX6BOXMG.js";
14
+ } from "./chunk-D3NJNDEW.js";
15
15
  import {
16
16
  validateContractAddresses
17
17
  } from "./chunk-QRKI6MMK.js";
@@ -7,10 +7,10 @@ import {
7
7
  resolveDotnsConnectOptions,
8
8
  storeDirectory,
9
9
  storeFile
10
- } from "./chunk-ZNZOAGMR.js";
10
+ } from "./chunk-VJITD6HN.js";
11
11
  import {
12
12
  DotNS
13
- } from "./chunk-4GDFP7XR.js";
13
+ } from "./chunk-MDS7T32B.js";
14
14
  import {
15
15
  getPopSelfServeConfig,
16
16
  loadEnvironments,
@@ -2,15 +2,20 @@ import {
2
2
  classifyErrorArea,
3
3
  isInteractive,
4
4
  promptYesNo
5
- } from "./chunk-J63XPPZW.js";
5
+ } from "./chunk-5LAKX4AB.js";
6
6
  import {
7
7
  VERSION,
8
- getCurrentSentryTraceId
9
- } from "./chunk-HX6BOXMG.js";
8
+ getCurrentSentryTraceId,
9
+ resolveIssueRepoSlug
10
+ } from "./chunk-D3NJNDEW.js";
11
+ import {
12
+ package_default
13
+ } from "./chunk-XQTDSVJG.js";
10
14
 
11
15
  // src/bug-report.ts
12
16
  import { execSync, execFileSync } from "child_process";
13
17
  import * as os from "os";
18
+ var ISSUE_REPO = resolveIssueRepoSlug(package_default.repository);
14
19
  var _deployContext = {};
15
20
  function setDeployContext(ctx) {
16
21
  _deployContext = { ..._deployContext, ...ctx };
@@ -148,7 +153,7 @@ function createGhIssue(title, body, labels) {
148
153
  "issue",
149
154
  "create",
150
155
  "--repo",
151
- "paritytech/bulletin-deploy",
156
+ ISSUE_REPO,
152
157
  "--title",
153
158
  title,
154
159
  ...labels.flatMap((l) => ["--label", l]),
@@ -179,7 +184,7 @@ async function offerBugReport(error) {
179
184
  const labels = buildLabels(error);
180
185
  if (!hasGhCli()) {
181
186
  console.error("\n gh CLI not found. Debug info below \u2014 paste into a new issue:\n");
182
- console.error(` https://github.com/paritytech/bulletin-deploy/issues/new
187
+ console.error(` https://github.com/${ISSUE_REPO}/issues/new
183
188
  `);
184
189
  printFallback(title, body, labels);
185
190
  return;
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  preflightSssAllowance
3
- } from "./chunk-QIMAKL3Z.js";
3
+ } from "./chunk-HN3YZDX4.js";
4
4
  import {
5
5
  statementSigningAccount
6
6
  } from "./chunk-GRPLHUYC.js";
@@ -29,21 +29,27 @@ import {
29
29
  classifyFile,
30
30
  parseManifest
31
31
  } from "./chunk-S7EM5VMW.js";
32
- import {
33
- DOT_PRODUCT_ID,
34
- STALE_SESSION_MESSAGE,
35
- getPeopleChainEndpoints,
36
- hasPersistedSession
37
- } from "./chunk-QGGISN4D.js";
38
32
  import {
39
33
  setDeployContext
40
- } from "./chunk-NBBV3IS3.js";
34
+ } from "./chunk-RBTRQH32.js";
41
35
  import {
42
36
  probeChunks
43
- } from "./chunk-LSZEHAFU.js";
37
+ } from "./chunk-BKEXG2QF.js";
44
38
  import {
45
39
  packSection
46
40
  } from "./chunk-C2TS5MER.js";
41
+ import {
42
+ resolveStorageSigner
43
+ } from "./chunk-A2JFMAG3.js";
44
+ import {
45
+ createSlotAccountSigner,
46
+ requestResourceAllocation
47
+ } from "./chunk-5FLTDWWP.js";
48
+ import {
49
+ STALE_SESSION_MESSAGE,
50
+ getPeopleChainEndpoints,
51
+ hasPersistedSession
52
+ } from "./chunk-X2BEJT4V.js";
47
53
  import {
48
54
  CLI_NAME
49
55
  } from "./chunk-TSPERKUS.js";
@@ -56,7 +62,7 @@ import {
56
62
  parseDomainName,
57
63
  popStatusName,
58
64
  verifyNonceAdvanced
59
- } from "./chunk-4GDFP7XR.js";
65
+ } from "./chunk-MDS7T32B.js";
60
66
  import {
61
67
  derivePoolAccounts,
62
68
  detectTestnet,
@@ -78,7 +84,7 @@ import {
78
84
  truncateAddress,
79
85
  withDeploySpan,
80
86
  withSpan
81
- } from "./chunk-HX6BOXMG.js";
87
+ } from "./chunk-D3NJNDEW.js";
82
88
  import {
83
89
  DEFAULT_ENV_ID,
84
90
  getPopSelfServeConfig,
@@ -601,8 +607,11 @@ function isPhoneSignerActive(options) {
601
607
  function shouldHandoverName(opts) {
602
608
  return !!opts.transferTo && opts.registeredFresh;
603
609
  }
604
- function formatStorageSignerLine(slotAddress, failReason) {
605
- if (slotAddress) return ` Storage signer: allowance slot ${slotAddress}`;
610
+ function formatStorageSignerLine(slotAddress, failReason, owned) {
611
+ if (slotAddress) {
612
+ const prefix = owned ? "your allowance slot" : "allowance slot";
613
+ return ` Storage signer: ${prefix} ${slotAddress}`;
614
+ }
606
615
  return ` Storage signer: pool fallback (${failReason ?? "no session"})`;
607
616
  }
608
617
  function selectStorageReconnect(options) {
@@ -936,7 +945,18 @@ async function storeChunkedContent(chunks, { client: existingClient, unsafeApi:
936
945
  }
937
946
  console.log(` Cache check: ${confirmedCount} confirmed, ${tier2Fallback} missing${tier2Fallback > 0 ? " (will upload)" : ""}`);
938
947
  }
939
- const assignedNonces = assignDenseNonces(stored, startNonce);
948
+ let assignedNonces = assignDenseNonces(stored, startNonce);
949
+ const doReconnectAndRebase = async () => {
950
+ const prevSS58 = ss58;
951
+ await doReconnect();
952
+ const currentNonce = await _fetchNonce(BULLETIN_ENDPOINTS, ss58);
953
+ const changed = ss58 !== prevSS58;
954
+ if (changed) {
955
+ assignedNonces = assignDenseNonces(stored, currentNonce);
956
+ startNonce = currentNonce;
957
+ }
958
+ return { changed, currentNonce };
959
+ };
940
960
  const uploadTotal = stored.filter((s) => s === null).length;
941
961
  let uploadEmitted = 0;
942
962
  const nonceAdvanceIndices = /* @__PURE__ */ new Set();
@@ -979,18 +999,19 @@ async function storeChunkedContent(chunks, { client: existingClient, unsafeApi:
979
999
  const failures = results.map((r, j) => r.status === "rejected" ? { index: batchIndices[j], chunkData: batchChunks[j], error: r.reason } : null).filter(Boolean);
980
1000
  const needsReconnect = failures.some((f) => isConnectionError(f.error));
981
1001
  if (needsReconnect && reconnect && reconnectionsUsed < MAX_RECONNECTIONS) {
982
- await doReconnect();
983
- const currentNonce = await _fetchNonce(BULLETIN_ENDPOINTS, ss58);
984
- for (const idx of batchIndices) {
985
- const chunkNonce = assignedNonces.get(idx);
986
- if (chunkNonce !== void 0 && chunkNonce < currentNonce && stored[idx] === null) {
987
- console.log(` Chunk ${idx + 1}: nonce ${chunkNonce} consumed (current=${currentNonce}), treating as included`);
988
- stored[idx] = { cid: createCID(chunks[idx], CID_CONFIG.codec, 18), len: chunks[idx].length, viaFallback: true };
989
- nonceAdvanceIndices.add(idx);
990
- assignedNonces.delete(idx);
1002
+ const { changed, currentNonce } = await doReconnectAndRebase();
1003
+ if (!changed) {
1004
+ for (const idx of batchIndices) {
1005
+ const chunkNonce = assignedNonces.get(idx);
1006
+ if (chunkNonce !== void 0 && chunkNonce < currentNonce && stored[idx] === null) {
1007
+ console.log(` Chunk ${idx + 1}: nonce ${chunkNonce} consumed (current=${currentNonce}), treating as included`);
1008
+ stored[idx] = { cid: createCID(chunks[idx], CID_CONFIG.codec, 18), len: chunks[idx].length, viaFallback: true };
1009
+ nonceAdvanceIndices.add(idx);
1010
+ assignedNonces.delete(idx);
1011
+ }
991
1012
  }
1013
+ startNonce = Math.max(startNonce, currentNonce);
992
1014
  }
993
- startNonce = Math.max(startNonce, currentNonce);
994
1015
  if (failures.some((f) => stored[f.index] === null)) {
995
1016
  continue;
996
1017
  }
@@ -1017,9 +1038,10 @@ async function storeChunkedContent(chunks, { client: existingClient, unsafeApi:
1017
1038
  const retryDelay = Math.min(RETRY_BASE_DELAY_MS * Math.pow(2, attempt - 1), RETRY_MAX_DELAY_MS);
1018
1039
  console.log(` Retrying chunk ${fail.index + 1} (attempt ${attempt}/${MAX_CHUNK_RETRIES}) in ${(retryDelay / 1e3).toFixed(0)}s...`);
1019
1040
  await new Promise((r) => setTimeout(r, retryDelay));
1041
+ let perRetryChanged = false;
1020
1042
  if (isConnectionError(fail.error) && reconnect && reconnectionsUsed < MAX_RECONNECTIONS) {
1021
1043
  try {
1022
- await doReconnect();
1044
+ ({ changed: perRetryChanged } = await doReconnectAndRebase());
1023
1045
  } catch (reconnectErr) {
1024
1046
  console.log(` Reconnect failed: ${reconnectErr.message?.slice(0, 80)}`);
1025
1047
  break;
@@ -1028,7 +1050,7 @@ async function storeChunkedContent(chunks, { client: existingClient, unsafeApi:
1028
1050
  try {
1029
1051
  const currentNonce = await _fetchNonce(BULLETIN_ENDPOINTS, ss58);
1030
1052
  const originalNonce = assignedNonces.get(fail.index);
1031
- if (originalNonce !== void 0 && originalNonce < currentNonce) {
1053
+ if (!perRetryChanged && originalNonce !== void 0 && originalNonce < currentNonce) {
1032
1054
  console.log(` Chunk ${fail.index + 1}: nonce ${originalNonce} consumed (current=${currentNonce}), treating as included`);
1033
1055
  stored[fail.index] = { cid: createCID(fail.chunkData, CID_CONFIG.codec, 18), len: fail.chunkData.length, viaFallback: true };
1034
1056
  nonceAdvanceIndices.add(fail.index);
@@ -1083,6 +1105,10 @@ async function storeChunkedContent(chunks, { client: existingClient, unsafeApi:
1083
1105
  collision_count: missingResults.length
1084
1106
  });
1085
1107
  }
1108
+ if (wsHaltDetected && reconnect && reconnectionsUsed < MAX_RECONNECTIONS) {
1109
+ wsHaltDetected = false;
1110
+ await doReconnect();
1111
+ }
1086
1112
  let reuploadCount = 0;
1087
1113
  for (const m of missingResults) {
1088
1114
  const idx = cidToIndex.get(m.cid);
@@ -1095,6 +1121,12 @@ async function storeChunkedContent(chunks, { client: existingClient, unsafeApi:
1095
1121
  reuploadCount++;
1096
1122
  break;
1097
1123
  } catch (e) {
1124
+ if (isConnectionError(e) && reconnect && reconnectionsUsed < MAX_RECONNECTIONS) {
1125
+ try {
1126
+ await doReconnect();
1127
+ } catch {
1128
+ }
1129
+ }
1098
1130
  if (attempt === MAX_REPROBE_RETRIES) {
1099
1131
  throw new Error(`Nonce-collision re-upload of chunk ${idx + 1} failed after ${MAX_REPROBE_RETRIES} attempts: ${e.message?.slice(0, 100)}`);
1100
1132
  }
@@ -1652,33 +1684,46 @@ async function storeDirectoryV2(directoryPath, opts = {}) {
1652
1684
  const roundSuffix = round > 1 ? ` (round ${round}/${GRANDPA_REUPLOAD_MAX_ROUNDS}, retry after fork)` : "";
1653
1685
  console.log(` ${missingCids.size} chunks still missing after wait \u2014 re-uploading${roundSuffix}`);
1654
1686
  const reuploadList = [...missingCids];
1655
- for (let i = 0; i < reuploadList.length; i++) {
1656
- const cid = reuploadList[i];
1657
- const freshNonce = await fetchNonceFn(BULLETIN_ENDPOINTS, phaseALiveProvider.ss58);
1658
- if (cid === storageCid) {
1659
- const rootTx = phaseALiveProvider.unsafeApi.tx.TransactionStorage.store_with_cid_config({
1660
- cid: { codec: BigInt(112), hashing: toHashingEnum(rootHashCode) },
1661
- data: rootDagBytes
1662
- });
1663
- await watchTransaction(rootTx, phaseALiveProvider.signer, { mortality: { mortal: true, period: 256 }, nonce: freshNonce }, () => storageCid, {
1664
- label: "root-reupload",
1665
- rpc: BULLETIN_ENDPOINTS,
1666
- senderSS58: phaseALiveProvider.ss58,
1667
- expectedNonce: freshNonce,
1668
- timeoutMs: CHUNK_TIMEOUT_MS,
1669
- fetchNonce: phaseALiveProvider.fetchNonce
1670
- });
1671
- } else {
1672
- const chunkBytes = phaseBChunkByCid.get(cid);
1673
- if (!chunkBytes) {
1674
- throw new Error(
1675
- `Deploy verification failed: chunk ${cid.slice(0, 20)}\u2026 missing at finalised head and its bytes are not in phaseB.chunks (cannot re-upload). This indicates an internal state issue.`
1676
- );
1687
+ try {
1688
+ for (let i = 0; i < reuploadList.length; i++) {
1689
+ const cid = reuploadList[i];
1690
+ const freshNonce = await fetchNonceFn(BULLETIN_ENDPOINTS, phaseALiveProvider.ss58);
1691
+ if (cid === storageCid) {
1692
+ const rootTx = phaseALiveProvider.unsafeApi.tx.TransactionStorage.store_with_cid_config({
1693
+ cid: { codec: BigInt(112), hashing: toHashingEnum(rootHashCode) },
1694
+ data: rootDagBytes
1695
+ });
1696
+ await watchTransaction(rootTx, phaseALiveProvider.signer, { mortality: { mortal: true, period: 256 }, nonce: freshNonce }, () => storageCid, {
1697
+ label: "root-reupload",
1698
+ rpc: BULLETIN_ENDPOINTS,
1699
+ senderSS58: phaseALiveProvider.ss58,
1700
+ expectedNonce: freshNonce,
1701
+ timeoutMs: CHUNK_TIMEOUT_MS,
1702
+ fetchNonce: phaseALiveProvider.fetchNonce
1703
+ });
1704
+ } else {
1705
+ const chunkBytes = phaseBChunkByCid.get(cid);
1706
+ if (!chunkBytes) {
1707
+ throw new Error(
1708
+ `Deploy verification failed: chunk ${cid.slice(0, 20)}\u2026 missing at finalised head and its bytes are not in phaseB.chunks (cannot re-upload). This indicates an internal state issue.`
1709
+ );
1710
+ }
1711
+ await storeChunk(phaseALiveProvider.unsafeApi, phaseALiveProvider.signer, chunkBytes, freshNonce, phaseALiveProvider.ss58, { fetchNonce: phaseALiveProvider.fetchNonce });
1677
1712
  }
1678
- await storeChunk(phaseALiveProvider.unsafeApi, phaseALiveProvider.signer, chunkBytes, freshNonce, phaseALiveProvider.ss58, { fetchNonce: phaseALiveProvider.fetchNonce });
1713
+ reuploadCount++;
1714
+ console.log(` [${i + 1}/${reuploadList.length}] re-uploaded ${cid.slice(0, 20)}\u2026 (nonce ${freshNonce})`);
1679
1715
  }
1680
- reuploadCount++;
1681
- console.log(` [${i + 1}/${reuploadList.length}] re-uploaded ${cid.slice(0, 20)}\u2026 (nonce ${freshNonce})`);
1716
+ } catch (e) {
1717
+ if (isConnectionError(e) && phaseALiveProvider.reconnect) {
1718
+ try {
1719
+ phaseALiveProvider.client.destroy();
1720
+ } catch {
1721
+ }
1722
+ const fresh = await phaseALiveProvider.reconnect();
1723
+ phaseALiveProvider = { ...phaseALiveProvider, ...fresh };
1724
+ continue;
1725
+ }
1726
+ throw e;
1682
1727
  }
1683
1728
  const reuploadStart = Date.now();
1684
1729
  while (Date.now() - reuploadStart < GRANDPA_REUPLOAD_TIMEOUT_MS && missingCids.size > 0) {
@@ -2038,29 +2083,28 @@ async function deploy(content, domainName = null, options = {}) {
2038
2083
  }
2039
2084
  }
2040
2085
  if (!options.storageSigner) {
2041
- let storageLine = null;
2042
- try {
2043
- if (resolvedUserSession?.userSession && resolvedUserSession?.adapter) {
2044
- const { ss58Encode } = await import("@parity/product-sdk-address");
2045
- const signerResult = await resolvedUserSession.adapter.allowance.getBulletinSigner(
2046
- resolvedUserSession.userSession.id,
2047
- DOT_PRODUCT_ID
2048
- );
2049
- if (signerResult.isOk()) {
2050
- const slotSigner = signerResult.value;
2051
- const slotAddress = ss58Encode(slotSigner.publicKey);
2052
- options = { ...options, storageSigner: slotSigner, storageSignerAddress: slotAddress };
2053
- storageLine = formatStorageSignerLine(slotAddress);
2054
- } else {
2055
- storageLine = formatStorageSignerLine(null, signerResult.error.reason);
2086
+ const { ss58Encode } = await import("@parity/product-sdk-address");
2087
+ const slotResult = await resolveStorageSigner(
2088
+ resolvedUserSession ?? null,
2089
+ {
2090
+ getBulletinSigner: (sessionId, productId, adapter) => adapter.allowance.getBulletinSigner(sessionId, productId),
2091
+ requestResourceAllocation,
2092
+ createSlotAccountSigner,
2093
+ ss58Encode: (pk) => ss58Encode(pk),
2094
+ promptBeforeAllocation: () => {
2095
+ console.log(
2096
+ `
2097
+ \u26A0 Your account has no Bulletin allowance. Approve one on your phone to deploy with your own account, or press Ctrl-C to use the shared pool.`
2098
+ );
2056
2099
  }
2057
- } else {
2058
- storageLine = formatStorageSignerLine(null);
2059
2100
  }
2060
- } catch {
2061
- storageLine = formatStorageSignerLine(null, "error");
2101
+ );
2102
+ if (slotResult) {
2103
+ options = { ...options, storageSigner: slotResult.signer, storageSignerAddress: slotResult.slotAddress };
2104
+ console.log(formatStorageSignerLine(slotResult.slotAddress, void 0, slotResult.owned));
2105
+ } else {
2106
+ console.log(formatStorageSignerLine(null, resolvedUserSession ? "no allowance" : void 0));
2062
2107
  }
2063
- if (storageLine) console.log(storageLine);
2064
2108
  }
2065
2109
  initTelemetry();
2066
2110
  const randomSuffix = Math.floor(Math.random() * 100).toString().padStart(2, "0");
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-TSPERKUS.js";
4
4
  import {
5
5
  VERSION
6
- } from "./chunk-HX6BOXMG.js";
6
+ } from "./chunk-D3NJNDEW.js";
7
7
  import {
8
8
  loadEnvironments
9
9
  } from "./chunk-QRKI6MMK.js";
@@ -6,7 +6,7 @@ import * as path from "path";
6
6
  // package.json
7
7
  var package_default = {
8
8
  name: "@parity/product-deploy",
9
- version: "0.10.1-dev.0",
9
+ version: "0.11.0-rc.0",
10
10
  private: false,
11
11
  repository: {
12
12
  type: "git",
@@ -68,9 +68,9 @@ var package_default = {
68
68
  "@ipld/dag-pb": "^4.1.3",
69
69
  "@noble/hashes": "^1.7.2",
70
70
  "@parity/product-sdk-address": "^0.1.1",
71
- "@parity/product-sdk-keys": "^0.3.0",
72
- "@parity/product-sdk-terminal": "^0.4.0",
73
- "@parity/product-sdk-tx": "^0.2.4",
71
+ "@parity/product-sdk-keys": "^0.3.8",
72
+ "@parity/product-sdk-terminal": "^0.5.1",
73
+ "@parity/product-sdk-tx": "^0.2.12",
74
74
  "@polkadot-api/metadata-builders": "^0.14.2",
75
75
  "@polkadot-api/substrate-bindings": "^0.20.2",
76
76
  "@polkadot-labs/hdkd": "^0.0.28",
@@ -96,12 +96,7 @@ var package_default = {
96
96
  vitest: "^4.1.0"
97
97
  },
98
98
  overrides: {
99
- "@polkadot-api/json-rpc-provider": "^0.2.0",
100
- "@novasamatech/host-api": "0.8.6",
101
- "@novasamatech/host-papp": "0.8.6",
102
- "@novasamatech/scale": "0.8.6",
103
- "@novasamatech/statement-store": "0.8.6",
104
- "@novasamatech/storage-adapter": "0.8.6"
99
+ "@polkadot-api/json-rpc-provider": "^0.2.0"
105
100
  },
106
101
  minimumVersion: "0.5.6",
107
102
  engines: {
@@ -5,9 +5,9 @@ import {
5
5
  _decodeStorageValue,
6
6
  _resetProbeSession,
7
7
  probeChunks
8
- } from "./chunk-LSZEHAFU.js";
9
- import "./chunk-HX6BOXMG.js";
10
- import "./chunk-VMQDFI4D.js";
8
+ } from "./chunk-BKEXG2QF.js";
9
+ import "./chunk-D3NJNDEW.js";
10
+ import "./chunk-XQTDSVJG.js";
11
11
  export {
12
12
  ChainProbeCrossValidationError,
13
13
  ChainProbeMetadataError,
@@ -1,23 +1,12 @@
1
1
  import {
2
2
  startSpinner
3
3
  } from "../chunk-J7CYVTAW.js";
4
- import "../chunk-JQKKMUCT.js";
5
- import {
6
- BULLETIN_RESOURCE,
7
- DEFAULT_RESOURCES,
8
- createSlotAccountSigner,
9
- requestResourceAllocation,
10
- summarizeOutcomes
11
- } from "../chunk-5FLTDWWP.js";
12
- import {
13
- renderLoginStatus
14
- } from "../chunk-RIRDBSBG.js";
15
4
  import {
16
5
  waitForBulletinAuthorization
17
- } from "../chunk-ZNZOAGMR.js";
6
+ } from "../chunk-VJITD6HN.js";
18
7
  import {
19
8
  preflightSssAllowance
20
- } from "../chunk-QIMAKL3Z.js";
9
+ } from "../chunk-HN3YZDX4.js";
21
10
  import {
22
11
  statementSigningAccount
23
12
  } from "../chunk-GRPLHUYC.js";
@@ -26,24 +15,36 @@ import "../chunk-IW3X2MJF.js";
26
15
  import "../chunk-KOSF5FDO.js";
27
16
  import "../chunk-J3NIXHZZ.js";
28
17
  import "../chunk-S7EM5VMW.js";
18
+ import "../chunk-RBTRQH32.js";
19
+ import "../chunk-5LAKX4AB.js";
20
+ import "../chunk-BKEXG2QF.js";
21
+ import "../chunk-C2TS5MER.js";
22
+ import "../chunk-A2JFMAG3.js";
23
+ import "../chunk-JQKKMUCT.js";
24
+ import {
25
+ BULLETIN_RESOURCE,
26
+ DEFAULT_RESOURCES,
27
+ createSlotAccountSigner,
28
+ requestResourceAllocation,
29
+ summarizeOutcomes
30
+ } from "../chunk-5FLTDWWP.js";
31
+ import {
32
+ renderLoginStatus
33
+ } from "../chunk-RIRDBSBG.js";
29
34
  import {
30
35
  DOT_PRODUCT_ID,
31
36
  getAuthClient,
32
37
  getPeopleChainEndpoints,
33
38
  resolveBulletinEndpoints
34
- } from "../chunk-QGGISN4D.js";
35
- import "../chunk-NBBV3IS3.js";
36
- import "../chunk-J63XPPZW.js";
37
- import "../chunk-LSZEHAFU.js";
38
- import "../chunk-C2TS5MER.js";
39
+ } from "../chunk-X2BEJT4V.js";
39
40
  import {
40
41
  CLI_NAME
41
42
  } from "../chunk-TSPERKUS.js";
42
- import "../chunk-4GDFP7XR.js";
43
+ import "../chunk-MDS7T32B.js";
43
44
  import "../chunk-SI2ZUOYD.js";
44
45
  import "../chunk-4IUTMHVB.js";
45
- import "../chunk-HX6BOXMG.js";
46
- import "../chunk-VMQDFI4D.js";
46
+ import "../chunk-D3NJNDEW.js";
47
+ import "../chunk-XQTDSVJG.js";
47
48
  import {
48
49
  loadEnvironments
49
50
  } from "../chunk-QRKI6MMK.js";