@bsv/wallet-toolbox 2.4.21 → 2.5.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 (83) hide show
  1. package/CHANGELOG.md +53 -0
  2. package/README.md +56 -1
  3. package/docs/authentication-observability.md +21 -9
  4. package/out/src/CWIStyleWalletManager.d.ts +31 -3
  5. package/out/src/CWIStyleWalletManager.d.ts.map +1 -1
  6. package/out/src/CWIStyleWalletManager.js +164 -56
  7. package/out/src/CWIStyleWalletManager.js.map +1 -1
  8. package/out/src/Wallet.d.ts +3 -3
  9. package/out/src/Wallet.d.ts.map +1 -1
  10. package/out/src/Wallet.js +45 -6
  11. package/out/src/Wallet.js.map +1 -1
  12. package/out/src/sdk/WalletStorage.interfaces.d.ts +1 -0
  13. package/out/src/sdk/WalletStorage.interfaces.d.ts.map +1 -1
  14. package/out/src/signer/methods/completeSignedTransaction.d.ts.map +1 -1
  15. package/out/src/signer/methods/completeSignedTransaction.js +54 -13
  16. package/out/src/signer/methods/completeSignedTransaction.js.map +1 -1
  17. package/out/src/signer/methods/createAction.d.ts.map +1 -1
  18. package/out/src/signer/methods/createAction.js +14 -10
  19. package/out/src/signer/methods/createAction.js.map +1 -1
  20. package/out/src/signer/methods/verifyUnlockScripts.d.ts.map +1 -1
  21. package/out/src/signer/methods/verifyUnlockScripts.js +257 -21
  22. package/out/src/signer/methods/verifyUnlockScripts.js.map +1 -1
  23. package/out/src/storage/StorageIdb.d.ts +14 -1
  24. package/out/src/storage/StorageIdb.d.ts.map +1 -1
  25. package/out/src/storage/StorageIdb.js +128 -17
  26. package/out/src/storage/StorageIdb.js.map +1 -1
  27. package/out/src/storage/StorageKnex.d.ts +11 -2
  28. package/out/src/storage/StorageKnex.d.ts.map +1 -1
  29. package/out/src/storage/StorageKnex.js +196 -5
  30. package/out/src/storage/StorageKnex.js.map +1 -1
  31. package/out/src/storage/StorageProvider.d.ts +30 -1
  32. package/out/src/storage/StorageProvider.d.ts.map +1 -1
  33. package/out/src/storage/StorageProvider.js +94 -2
  34. package/out/src/storage/StorageProvider.js.map +1 -1
  35. package/out/src/storage/idbHelpers.d.ts.map +1 -1
  36. package/out/src/storage/idbHelpers.js +2 -0
  37. package/out/src/storage/idbHelpers.js.map +1 -1
  38. package/out/src/storage/methods/actionBatch.d.ts.map +1 -1
  39. package/out/src/storage/methods/actionBatch.js +2 -14
  40. package/out/src/storage/methods/actionBatch.js.map +1 -1
  41. package/out/src/storage/methods/actionPlanning.d.ts +14 -0
  42. package/out/src/storage/methods/actionPlanning.d.ts.map +1 -1
  43. package/out/src/storage/methods/actionPlanning.js +55 -0
  44. package/out/src/storage/methods/actionPlanning.js.map +1 -1
  45. package/out/src/storage/methods/availableManagedChange.d.ts +11 -0
  46. package/out/src/storage/methods/availableManagedChange.d.ts.map +1 -0
  47. package/out/src/storage/methods/availableManagedChange.js +25 -0
  48. package/out/src/storage/methods/availableManagedChange.js.map +1 -0
  49. package/out/src/storage/methods/createAction.d.ts.map +1 -1
  50. package/out/src/storage/methods/createAction.js +521 -173
  51. package/out/src/storage/methods/createAction.js.map +1 -1
  52. package/out/src/storage/methods/generateChange.d.ts.map +1 -1
  53. package/out/src/storage/methods/generateChange.js +29 -14
  54. package/out/src/storage/methods/generateChange.js.map +1 -1
  55. package/out/src/storage/methods/getBeefForTransaction.d.ts +7 -0
  56. package/out/src/storage/methods/getBeefForTransaction.d.ts.map +1 -1
  57. package/out/src/storage/methods/getBeefForTransaction.js +219 -20
  58. package/out/src/storage/methods/getBeefForTransaction.js.map +1 -1
  59. package/out/src/storage/methods/processAction.d.ts.map +1 -1
  60. package/out/src/storage/methods/processAction.js +36 -15
  61. package/out/src/storage/methods/processAction.js.map +1 -1
  62. package/out/src/storage/remoting/KnexSessionManager.d.ts +20 -0
  63. package/out/src/storage/remoting/KnexSessionManager.d.ts.map +1 -1
  64. package/out/src/storage/remoting/KnexSessionManager.js +74 -16
  65. package/out/src/storage/remoting/KnexSessionManager.js.map +1 -1
  66. package/out/src/storage/schema/KnexMigrations.d.ts +1 -0
  67. package/out/src/storage/schema/KnexMigrations.d.ts.map +1 -1
  68. package/out/src/storage/schema/KnexMigrations.js +39 -1
  69. package/out/src/storage/schema/KnexMigrations.js.map +1 -1
  70. package/out/src/storage/schema/StorageIdbSchema.d.ts +2 -0
  71. package/out/src/storage/schema/StorageIdbSchema.d.ts.map +1 -1
  72. package/out/src/storage/schema/entities/EntityProvenTx.d.ts +2 -1
  73. package/out/src/storage/schema/entities/EntityProvenTx.d.ts.map +1 -1
  74. package/out/src/storage/schema/entities/EntityProvenTx.js +8 -3
  75. package/out/src/storage/schema/entities/EntityProvenTx.js.map +1 -1
  76. package/out/src/storage/storageProviderHelpers.d.ts.map +1 -1
  77. package/out/src/storage/storageProviderHelpers.js +8 -2
  78. package/out/src/storage/storageProviderHelpers.js.map +1 -1
  79. package/out/src/utility/ScriptTemplateBRC29.d.ts +3 -2
  80. package/out/src/utility/ScriptTemplateBRC29.d.ts.map +1 -1
  81. package/out/src/utility/ScriptTemplateBRC29.js +13 -5
  82. package/out/src/utility/ScriptTemplateBRC29.js.map +1 -1
  83. package/package.json +5 -2
package/CHANGELOG.md CHANGED
@@ -6,6 +6,58 @@ attention to changes that materially alter behavior or extend functionality.
6
6
 
7
7
  ## wallet-toolbox (unreleased)
8
8
 
9
+ - Preserve the default automatically negotiated in-memory `noSend` batching and
10
+ `sendWith` lifecycle introduced in #289. Expand inherited txid-only proof
11
+ ancestors for cold clients, preserve caller-declared known txids, report the
12
+ actual viable-change funding shortfall, and document aborting listed staged
13
+ actions by transaction ID.
14
+ - Collapse fragmented `createAction` storage work into one atomic write
15
+ transaction, batch proof retrieval and compound-proof validation, overlap
16
+ independent proof reads with persistence, bulk-insert untagged outputs, and
17
+ batch canonical P2PKH verification. The retained 153-input authenticated
18
+ remote PXC workload is below 500 ms at p95.
19
+ - Reuse parsed root and counterparty keys and one BRC-42 shared secret per
20
+ counterparty while signing managed BRC-29 inputs, keep funding selection and
21
+ transaction-size accounting linear, and avoid redundant BEEF validation,
22
+ unused process reads, and unconditional commission reads on the successful
23
+ path. Generated scripts, signatures, fees, input ordering, BEEF bytes, and
24
+ error diagnostics remain equivalence-tested.
25
+ - Add bounded-cardinality spans for proof decode/merge, persistence, signing,
26
+ verification, result assembly, serialization, and server-side processing.
27
+ No telemetry header or protocol field is added; BRC-103/104, AuthFetch, Auth
28
+ Express Middleware, AuthSocket, JSON-RPC, and wallet wire behavior are unchanged.
29
+ - Coalesce only recent timestamp-only touches for already-authenticated shared
30
+ Knex sessions, while immediately persisting every authentication and
31
+ certificate transition. This removes a synchronous replicated PXC write from
32
+ the normal RPC path; exact per-request persistence remains available with
33
+ `touchIntervalMs: 0`.
34
+ - Make expired action-batch reservations non-blocking in indexed queries and
35
+ repair MySQL rollback support indexes. Existing databases migrate through the
36
+ normal Knex path, and full PXC down-to-empty/re-upgrade is regression-tested.
37
+ - Make UMP account lookup resilient to stale SLAP advertisements and partial
38
+ overlay failure. One verified matching token establishes an existing account;
39
+ otherwise one clean empty response establishes a new account. Malformed,
40
+ rejected, empty, and unavailable peers cannot veto a verified token, and
41
+ malformed or unavailable peers cannot veto a clean empty response. Lookups
42
+ with no usable response remain errors; WAB existing-account continuity still
43
+ prevents replacement-wallet onboarding.
44
+ - Resolve competing verified UMP tokens on on-chain proof. A candidate spent
45
+ anywhere in another candidate's BEEF ancestry is superseded (evidence merged
46
+ across hosts serving different depths; ancestry walked iteratively so deep
47
+ update chains cannot exhaust the stack). Forked candidates resolve only when
48
+ exactly one provably consumed a same-identity predecessor token, which
49
+ requires the account's keys; anything less decisive stays an error so a
50
+ wrong token can never be chosen silently. Resolved conflicts report a
51
+ `supersededTokens` count in lookup telemetry.
52
+ - Plan legacy `createAction` funding against the exact unreserved managed-change
53
+ set before persistence, claim the selected inputs atomically in one storage
54
+ transaction, and fail economically impossible fragmented wallets before
55
+ inserting a transaction row. Add targeted Knex and IndexedDB indexes and
56
+ remove IndexedDB's per-output transaction-status lookup.
57
+ - Avoid building full known-txid indexes on the common single-proof path and
58
+ report privacy-safe createAction candidate, funding, proof-fetch, BEEF merge,
59
+ trim, serialization, and known-history timings. BRC-103/104, AuthFetch, Auth
60
+ Express Middleware, AuthSocket, JSON-RPC, and wallet wire behavior are unchanged.
9
61
  - Keep remote-storage trace correlation inside the telemetry sink instead of
10
62
  adding unsupported headers to AuthFetch requests. BRC-103/104, AuthFetch,
11
63
  Auth Express Middleware, AuthSocket, JSON-RPC, and storage wire behavior are
@@ -188,6 +240,7 @@ attention to changes that materially alter behavior or extend functionality.
188
240
 
189
241
  - audit fix
190
242
 
243
+
191
244
  ## wallet-toolbox 2.1.14
192
245
 
193
246
  - fix update timestamp on all updated currencies
package/README.md CHANGED
@@ -85,6 +85,52 @@ See [In-memory action batch planning](./docs/action-batch-planning.md) for
85
85
  capability-negotiated `noSend` planning, compact manifests, compressed binary
86
86
  pack transport, atomic commit, compatibility behavior, and retained benchmarks.
87
87
 
88
+ ### `createAction` performance telemetry
89
+
90
+ With the optional SDK telemetry sink enabled, legacy `createAction` reports
91
+ bounded-cardinality spans for input validation, record/output persistence,
92
+ funding candidate selection, fee-aware planning, atomic input claiming, input
93
+ assembly, proof fetch, BEEF merge, and final trim/serialization.
94
+ Only counts, byte sizes, fee totals, retry counts, and durations are reported;
95
+ transaction IDs, scripts, payloads, keys, and identities are not attributes.
96
+
97
+ The planner uses the same exact / least-over / largest-under selection policy
98
+ as the historical allocator, but proves economic sufficiency before writing a
99
+ transaction and claims every selected input in one database transaction. Knex
100
+ storage automatically adds a composite funding-selection index on migration;
101
+ IndexedDB schema version 3 adds corresponding user/basket and outpoint indexes
102
+ and resolves transaction-status eligibility in one indexed pass.
103
+
104
+ The retained fragmented-funding benchmark is runnable with:
105
+
106
+ ```bash
107
+ pnpm bench:create-action-funding
108
+ pnpm bench:create-action-beef
109
+ ```
110
+
111
+ Against unmodified commit `c212b5ee7`, a representative 102-input SQLite plan
112
+ fell from 622 queries, 102 database transactions, and 107.3 ms to 17 queries,
113
+ one transaction, and 8.8 ms. Query and transaction counts remain flat when the
114
+ selected input count grows; networked database deployments should benefit most.
115
+
116
+ The proof-bearing benchmark also exercises the authenticated remote wallet,
117
+ real BRC-103 storage RPC, BRC-29 signing, packed WASM digest verification, and
118
+ 24-level proofs grouped by block. On the PXC staging topology, 20 independent
119
+ 153-input samples measured 376.0 ms p50 and 461.6 ms p95; the corresponding
120
+ direct storage cohort measured 99.3 ms p50 and 137.4 ms p95. A normal one-input
121
+ authenticated cohort measured 78.6 ms p50 and 105.6 ms p95. All 3,080 signature
122
+ verdicts passed. A selective production-shaped database copy with 110 fragmented
123
+ inputs measured 75.5 ms p50 and 155.4 ms p95 for direct storage. The benchmark
124
+ captures client, server HTTP, authentication, RPC, storage, signing,
125
+ verification, and serialization spans and retains gates of 100 ms p50 / 150 ms
126
+ p95 for the normal cohort and 500 ms p95 for the 153-input cohort. These are
127
+ regression gates, not universal hardware guarantees.
128
+
129
+ Trace context remains local to the telemetry carrier and sink. Wallet Toolbox
130
+ does not add telemetry headers to AuthFetch, so BRC-103/104, Auth Express
131
+ Middleware, AuthSocket, JSON-RPC, and mixed-version remote storage behavior are
132
+ unchanged.
133
+
88
134
  The codebase has detailed JSDoc annotations throughout — these will surface inline in editors like VS Code.
89
135
 
90
136
  ### Horizontal Storage scaling
@@ -101,7 +147,9 @@ await storage.migrate(storageName, storageIdentityKey)
101
147
  await storage.makeAvailable()
102
148
 
103
149
  const sessionManager = new KnexSessionManager(storage.knex, {
104
- ttlMs: 24 * 60 * 60 * 1000
150
+ ttlMs: 24 * 60 * 60 * 1000,
151
+ // Optional. Set to 0 when every authenticated use must update the row.
152
+ touchIntervalMs: 60 * 1000
105
153
  })
106
154
 
107
155
  const server = new StorageServer(storage, {
@@ -126,6 +174,13 @@ const server = new StorageServer(storage, {
126
174
  server.start()
127
175
  ```
128
176
 
177
+ Shared Knex sessions immediately persist authentication, nonce, identity, and
178
+ certificate-state transitions. For an already-authenticated row, the default
179
+ manager coalesces only timestamp-only usage touches for up to one minute. This
180
+ avoids a synchronous replicated write on every RPC while keeping durable expiry
181
+ within a bounded minute of the most recent use. Use `touchIntervalMs: 0` to
182
+ retain exact per-request timestamp persistence.
183
+
129
184
  Both stages return HTTP 429 with `ERR_RATE_LIMITED`. For multi-process or
130
185
  multi-replica deployments, configure a shared `express-rate-limit` store in
131
186
  both options so limits are aggregate rather than per process. Never use a
@@ -58,20 +58,32 @@ not affect authentication or wallet behavior.
58
58
  `authenticationFlow` starts as `unknown`. A password cannot create a wallet
59
59
  until account lookup has completed.
60
60
 
61
- An empty UMP answer means `new-user` only when every selected overlay host
62
- settled successfully and returned an empty output list. Timeout, host failure,
63
- malformed response, semantic rejection, or a malformed UMP token raises
64
- `UMPTokenLookupError`. Multiple distinct valid UMP tokens are also treated as
65
- ambiguous instead of choosing one by response order. Applications should
66
- present retry and account-recovery options for these errors, never a
67
- new-password prompt.
61
+ UMP account lookup prefers usable evidence over peer unanimity. Exactly one
62
+ verified token matching the requested presentation or recovery hash means
63
+ `existing-user`, regardless of empty, malformed, rejected, or unavailable peer
64
+ responses. When no token verifies, one host's valid empty output list is enough
65
+ to mean `new-user`; malformed and unavailable peers cannot veto that result.
66
+ Multiple distinct verified UMP tokens resolve on on-chain proof alone. A token
67
+ update spends its predecessor's outpoint, so a candidate spent anywhere in
68
+ another candidate's transaction ancestry (walked through each candidate's BEEF,
69
+ with evidence merged across hosts serving different depths) is superseded.
70
+ Forked candidates with no spend relationship resolve only when exactly one of
71
+ them provably consumed a same-identity UMP token — spending a token requires
72
+ the account's keys, so this demonstrates continuity of control, whereas an
73
+ independently minted competitor is typically the residue of an erroneous
74
+ re-onboarding. A resolved conflict reports `supersededTokens` in the completed
75
+ event. Anything less decisive — true forks, competing proven continuations, or
76
+ candidates without examinable evidence — remains ambiguous, and a lookup with
77
+ neither a verified token nor a clean empty response raises
78
+ `UMPTokenLookupError`. Applications should present retry and account-recovery
79
+ options for these errors, never a new-password prompt.
68
80
 
69
81
  WAB completion uses an explicit `accountStatus` or `existingUser` response when
70
82
  available. For older WAB servers it derives the status from the established
71
83
  protocol: a new account returns the temporary presentation key, while an
72
84
  existing account returns its stored key. If WAB identifies an existing account
73
- but UMP authoritatively appears absent, `WABAccountContinuityError` prevents
74
- new-wallet creation.
85
+ but UMP lookup returns no verified token, `WABAccountContinuityError` prevents
86
+ new-wallet creation even when an overlay host returned a clean empty result.
75
87
 
76
88
  Temporary WAB authentication state expires after ten minutes by default and is
77
89
  cleared when authentication is cancelled, completed, or destroyed.
@@ -154,7 +154,7 @@ export interface UMPTokenInteractor {
154
154
  *
155
155
  * @param hash The hash of the presentation key.
156
156
  * @returns The UMP token if found; otherwise, undefined.
157
- * @throws Implementations should throw when absence cannot be established authoritatively.
157
+ * @throws Implementations should throw when no verified token or clean empty response is available.
158
158
  */
159
159
  findByPresentationKeyHash: (hash: number[]) => Promise<UMPToken | undefined>;
160
160
  /**
@@ -163,7 +163,7 @@ export interface UMPTokenInteractor {
163
163
  *
164
164
  * @param hash The hash of the recovery key.
165
165
  * @returns The UMP token if found; otherwise, undefined.
166
- * @throws Implementations should throw when absence cannot be established authoritatively.
166
+ * @throws Implementations should throw when no verified token or clean empty response is available.
167
167
  */
168
168
  findByRecoveryKeyHash: (hash: number[]) => Promise<UMPToken | undefined>;
169
169
  /**
@@ -191,7 +191,7 @@ export interface UMPTokenLookupDiagnostics {
191
191
  }
192
192
  export type UMPTokenLookupFailureReason = 'lookup-unavailable' | 'lookup-incomplete' | 'token-malformed' | 'token-ambiguous';
193
193
  /**
194
- * Raised when UMP absence cannot be established authoritatively.
194
+ * Raised when a UMP lookup yields neither a verified token nor a clean empty response.
195
195
  *
196
196
  * Callers must offer retry/recovery rather than treating this error as a new
197
197
  * account. Diagnostics contain counts only and never hashes, keys, or tokens.
@@ -251,9 +251,37 @@ export declare class OverlayUMPTokenInteractor implements UMPTokenInteractor {
251
251
  */
252
252
  findByRecoveryKeyHash(hash: number[]): Promise<UMPToken | undefined>;
253
253
  private findToken;
254
+ /**
255
+ * Picks the newest rendition among distinct verified tokens, when possible.
256
+ *
257
+ * The on-chain UMP protocol expresses token updates by consumption: the
258
+ * transaction creating a new rendition spends the previous rendition's
259
+ * outpoint (there is no rendition counter field in the current format).
260
+ * A candidate is therefore superseded when any other candidate's ancestry
261
+ * (available from its BEEF) spends the candidate's outpoint.
262
+ *
263
+ * @returns The single unsuperseded candidate, or undefined when supersession
264
+ * cannot be established for every stale candidate (e.g. forked tokens).
265
+ */
266
+ private resolveNewestToken;
267
+ /**
268
+ * Whether `tx` spends an input whose source output (available in the BEEF)
269
+ * decodes as a UMP token sharing the candidate's presentation or recovery
270
+ * hash — on-chain proof that the candidate is an update of a same-identity
271
+ * predecessor rather than an independently minted token.
272
+ */
273
+ private consumesSameIdentityToken;
274
+ /**
275
+ * Accumulates every outpoint spent by `tx` and by the ancestor transactions
276
+ * embedded in its BEEF, so supersession is detected even when intermediate
277
+ * renditions are absent from the lookup answer. Iterative so arbitrarily
278
+ * long update chains cannot exhaust the call stack.
279
+ */
280
+ private collectSpentOutpoints;
254
281
  private emptyLookupDiagnostics;
255
282
  private toLookupDiagnostics;
256
283
  private lookupDiagnosticAttributes;
284
+ private captureLookupCompleted;
257
285
  private captureLookupFailure;
258
286
  /**
259
287
  * Creates or updates (replaces) a UMP token on-chain. If `oldTokenToConsume` is provided,
@@ -1 +1 @@
1
- {"version":3,"file":"CWIStyleWalletManager.d.ts","sourceRoot":"","sources":["../../src/CWIStyleWalletManager.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,eAAe,EACf,iBAAiB,EACjB,sBAAsB,EACtB,wBAAwB,EACxB,mBAAmB,EACnB,gBAAgB,EAChB,kBAAkB,EAClB,cAAc,EACd,gBAAgB,EAChB,mBAAmB,EACnB,qBAAqB,EACrB,wBAAwB,EACxB,yBAAyB,EACzB,0BAA0B,EAC1B,aAAa,EACb,eAAe,EACf,eAAe,EACf,gBAAgB,EAChB,gBAAgB,EAChB,kBAAk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UAAU,CAAC,EAAE,uCAAuC,GACnD,OAAO,CAAC,2BAA2B,CAAC,CAGtC;IAEK,qBAAqB,CACzB,IAAI,EAAE,yBAAyB,EAC/B,UAAU,CAAC,EAAE,uCAAuC,GACnD,OAAO,CAAC,0BAA0B,CAAC,CAGrC;IAEK,oBAAoB,CACxB,IAAI,EAAE,wBAAwB,EAC9B,UAAU,CAAC,EAAE,uCAAuC,GACnD,OAAO,CAAC,0BAA0B,CAAC,CAGrC;IAEK,eAAe,CAAC,CAAC,EAAE,EAAE,EAAE,UAAU,CAAC,EAAE,uCAAuC,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAQ/G;IAEK,qBAAqB,CACzB,CAAC,EAAE,EAAE,EACL,UAAU,CAAC,EAAE,uCAAuC,GACnD,OAAO,CAAC,mBAAmB,CAAC,CAQ9B;IAEK,SAAS,CAAC,CAAC,EAAE,EAAE,EAAE,UAAU,CAAC,EAAE,uCAAuC,GAAG,OAAO,CAAC,eAAe,CAAC,CAGrG;IAEK,kBAAkB,CACtB,IAAI,EAAE,aAAa,EACnB,UAAU,CAAC,EAAE,uCAAuC,GACnD,OAAO,CAAC,eAAe,CAAC,CAG1B;IAEK,UAAU,CAAC,CAAC,EAAE,EAAE,EAAE,UAAU,CAAC,EAAE,uCAAuC,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAGvG;IAEK,UAAU,CAAC,CAAC,EAAE,EAAE,EAAE,UAAU,CAAC,EAAE,uCAAuC,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAGvG;CACF"}
@@ -226,7 +226,7 @@ function isValidProfile(value) {
226
226
  profile.createdAt >= 0);
227
227
  }
228
228
  /**
229
- * Raised when UMP absence cannot be established authoritatively.
229
+ * Raised when a UMP lookup yields neither a verified token nor a clean empty response.
230
230
  *
231
231
  * Callers must offer retry/recovery rather than treating this error as a new
232
232
  * account. Diagnostics contain counts only and never hashes, keys, or tokens.
@@ -326,60 +326,161 @@ class OverlayUMPTokenInteractor {
326
326
  throw new UMPTokenLookupError('lookup-unavailable', diagnostics, { cause: error });
327
327
  }
328
328
  const diagnostics = this.toLookupDiagnostics(resolution);
329
- if (resolution.answer.outputs.length === 0) {
330
- const authoritative = resolution.progress.isFinal &&
331
- resolution.progress.hostCount > 0 &&
332
- resolution.progress.completedHosts === resolution.progress.hostCount &&
333
- resolution.progress.successfulHosts === resolution.progress.hostCount &&
334
- resolution.progress.emptyHosts === resolution.progress.hostCount &&
335
- resolution.progress.failedHosts === 0 &&
336
- resolution.progress.rejectedHosts === 0 &&
337
- resolution.progress.freeformHosts === 0;
338
- if (!authoritative) {
339
- this.captureLookupFailure(lookupKind, 'lookup-incomplete', diagnostics, startedAt);
340
- throw new UMPTokenLookupError('lookup-incomplete', diagnostics);
341
- }
342
- this.telemetry.capture({
343
- name: 'wallet-toolbox.ump.lookup.completed',
344
- component: 'wallet-toolbox.ump',
345
- severity: 'info',
346
- correlationId: diagnostics.correlationId,
347
- attributes: {
348
- lookupKind,
349
- result: 'not-found',
350
- durationMs: Date.now() - startedAt,
351
- ...this.lookupDiagnosticAttributes(diagnostics)
352
- }
353
- });
354
- return undefined;
355
- }
356
329
  const tokens = this.parseLookupAnswers(resolution.answer);
357
330
  const expectedHash = question.query[lookupKind === 'presentation' ? 'presentationHash' : 'recoveryHash'].toLowerCase();
358
- const everyOutputValidAndMatching = tokens.length === resolution.answer.outputs.length &&
359
- tokens.every(token => sdk_1.Utils.toHex(lookupKind === 'presentation' ? token.presentationHash : token.recoveryHash).toLowerCase() ===
360
- expectedHash);
361
- if (!everyOutputValidAndMatching || tokens.length === 0) {
362
- this.captureLookupFailure(lookupKind, 'token-malformed', diagnostics, startedAt);
363
- throw new UMPTokenLookupError('token-malformed', diagnostics);
364
- }
365
- if (tokens.length !== 1) {
331
+ const matchingTokens = tokens.filter(token => sdk_1.Utils.toHex(lookupKind === 'presentation' ? token.presentationHash : token.recoveryHash).toLowerCase() ===
332
+ expectedHash);
333
+ // A verified token is positive account-existence evidence. Empty, malformed,
334
+ // rejected, or unavailable peers cannot override it. The resolver de-duplicates
335
+ // identical outputs, so multiple matching tokens represent distinct records.
336
+ // Competing records are usually stale renditions: a token update spends its
337
+ // predecessor's outpoint, so the newest rendition is the sole candidate not
338
+ // spent by another candidate's transaction history. Only unrelated (forked)
339
+ // tokens remain indeterminate.
340
+ if (matchingTokens.length > 1) {
341
+ const newest = this.resolveNewestToken(matchingTokens, resolution.answer.outputs);
342
+ if (newest != null) {
343
+ this.captureLookupCompleted(lookupKind, 'found', diagnostics, startedAt, {
344
+ supersededTokens: matchingTokens.length - 1
345
+ });
346
+ return newest;
347
+ }
366
348
  const reason = 'token-ambiguous';
367
349
  this.captureLookupFailure(lookupKind, reason, diagnostics, startedAt);
368
350
  throw new UMPTokenLookupError(reason, diagnostics);
369
351
  }
370
- this.telemetry.capture({
371
- name: 'wallet-toolbox.ump.lookup.completed',
372
- component: 'wallet-toolbox.ump',
373
- severity: 'info',
374
- correlationId: diagnostics.correlationId,
375
- attributes: {
376
- lookupKind,
377
- result: 'found',
378
- durationMs: Date.now() - startedAt,
379
- ...this.lookupDiagnosticAttributes(diagnostics)
352
+ if (matchingTokens.length === 1) {
353
+ this.captureLookupCompleted(lookupKind, 'found', diagnostics, startedAt);
354
+ return matchingTokens[0];
355
+ }
356
+ // A clean empty response is sufficient negative evidence once no verified
357
+ // token exists. Malformed outputs and failed peers are ignored so they cannot
358
+ // deny onboarding by advertising corrupt data or remaining unavailable.
359
+ if (resolution.progress.emptyHosts > 0) {
360
+ this.captureLookupCompleted(lookupKind, 'not-found', diagnostics, startedAt);
361
+ return undefined;
362
+ }
363
+ const reason = resolution.answer.outputs.length > 0 ? 'token-malformed' : 'lookup-incomplete';
364
+ this.captureLookupFailure(lookupKind, reason, diagnostics, startedAt);
365
+ throw new UMPTokenLookupError(reason, diagnostics);
366
+ }
367
+ /**
368
+ * Picks the newest rendition among distinct verified tokens, when possible.
369
+ *
370
+ * The on-chain UMP protocol expresses token updates by consumption: the
371
+ * transaction creating a new rendition spends the previous rendition's
372
+ * outpoint (there is no rendition counter field in the current format).
373
+ * A candidate is therefore superseded when any other candidate's ancestry
374
+ * (available from its BEEF) spends the candidate's outpoint.
375
+ *
376
+ * @returns The single unsuperseded candidate, or undefined when supersession
377
+ * cannot be established for every stale candidate (e.g. forked tokens).
378
+ */
379
+ resolveNewestToken(matchingTokens, outputs) {
380
+ const candidates = new Map();
381
+ for (const token of matchingTokens) {
382
+ if (token.currentOutpoint == null)
383
+ return undefined;
384
+ candidates.set(token.currentOutpoint, token);
385
+ }
386
+ // Hosts may serve the same token with different BEEF depth, so evidence
387
+ // for a candidate is merged across every copy rather than first-wins: a
388
+ // shallow copy must not mask the supersession proof a deeper copy carries.
389
+ const evidenceByCandidate = new Map();
390
+ for (const output of outputs) {
391
+ try {
392
+ const tx = sdk_1.Transaction.fromBEEF(output.beef);
393
+ const outpoint = `${tx.id('hex')}.${output.outputIndex}`;
394
+ if (!candidates.has(outpoint))
395
+ continue;
396
+ const evidence = evidenceByCandidate.get(outpoint) ?? { txs: [], spent: new Set() };
397
+ evidence.txs.push(tx);
398
+ this.collectSpentOutpoints(tx, evidence.spent, new Set());
399
+ evidenceByCandidate.set(outpoint, evidence);
400
+ }
401
+ catch {
402
+ // Malformed outputs never produced candidates; nothing to correlate.
380
403
  }
404
+ }
405
+ // Without an evidence transaction for every candidate, an unexamined
406
+ // candidate would trivially survive — refuse to guess.
407
+ if (evidenceByCandidate.size !== candidates.size)
408
+ return undefined;
409
+ const survivors = [...candidates.keys()].filter(outpoint => ![...evidenceByCandidate.entries()].some(([other, { spent }]) => other !== outpoint && spent.has(outpoint)));
410
+ if (survivors.length === 1)
411
+ return candidates.get(survivors[0]);
412
+ // Forked candidates: no spend relationship connects them. Updating a token
413
+ // requires unlocking its predecessor, so a candidate whose transaction
414
+ // provably consumed a same-identity token demonstrates continuity of key
415
+ // control; a freshly minted competitor (funding inputs only) is the anomaly
416
+ // — typically a historical erroneous re-onboarding. Prefer the sole proven
417
+ // continuation; anything less decisive stays indeterminate.
418
+ const provenContinuations = survivors.filter(outpoint => {
419
+ const evidence = evidenceByCandidate.get(outpoint);
420
+ const token = candidates.get(outpoint);
421
+ return (evidence != null && token != null && evidence.txs.some(tx => this.consumesSameIdentityToken(tx, token)));
381
422
  });
382
- return tokens[0];
423
+ if (provenContinuations.length !== 1)
424
+ return undefined;
425
+ return candidates.get(provenContinuations[0]);
426
+ }
427
+ /**
428
+ * Whether `tx` spends an input whose source output (available in the BEEF)
429
+ * decodes as a UMP token sharing the candidate's presentation or recovery
430
+ * hash — on-chain proof that the candidate is an update of a same-identity
431
+ * predecessor rather than an independently minted token.
432
+ */
433
+ consumesSameIdentityToken(tx, token) {
434
+ const presentationHash = sdk_1.Utils.toHex(token.presentationHash);
435
+ const recoveryHash = sdk_1.Utils.toHex(token.recoveryHash);
436
+ for (const input of tx.inputs) {
437
+ const source = input.sourceTransaction;
438
+ if (source == null || input.sourceOutputIndex == null)
439
+ continue;
440
+ const sourceOutput = source.outputs[input.sourceOutputIndex];
441
+ if (sourceOutput == null)
442
+ continue;
443
+ try {
444
+ const decoded = sdk_1.PushDrop.decode(sourceOutput.lockingScript);
445
+ if (decoded.fields == null)
446
+ continue;
447
+ const fields = stripVerifiedPushDropSignature(decoded.fields, decoded.lockingPublicKey);
448
+ if (fields.length < 11 || fields[6]?.length !== 32 || fields[7]?.length !== 32)
449
+ continue;
450
+ if (sdk_1.Utils.toHex(fields[6]) === presentationHash || sdk_1.Utils.toHex(fields[7]) === recoveryHash) {
451
+ return true;
452
+ }
453
+ }
454
+ catch {
455
+ continue;
456
+ }
457
+ }
458
+ return false;
459
+ }
460
+ /**
461
+ * Accumulates every outpoint spent by `tx` and by the ancestor transactions
462
+ * embedded in its BEEF, so supersession is detected even when intermediate
463
+ * renditions are absent from the lookup answer. Iterative so arbitrarily
464
+ * long update chains cannot exhaust the call stack.
465
+ */
466
+ collectSpentOutpoints(tx, spent, visited) {
467
+ const pending = [tx];
468
+ while (pending.length > 0) {
469
+ const current = pending.pop();
470
+ const txid = current.id('hex');
471
+ if (visited.has(txid))
472
+ continue;
473
+ visited.add(txid);
474
+ for (const input of current.inputs) {
475
+ const sourceTxid = input.sourceTXID ?? input.sourceTransaction?.id('hex');
476
+ if (sourceTxid == null || input.sourceOutputIndex == null)
477
+ continue;
478
+ spent.add(`${sourceTxid}.${input.sourceOutputIndex}`);
479
+ if (input.sourceTransaction != null) {
480
+ pending.push(input.sourceTransaction);
481
+ }
482
+ }
483
+ }
383
484
  }
384
485
  emptyLookupDiagnostics(correlationId) {
385
486
  return {
@@ -420,6 +521,21 @@ class OverlayUMPTokenInteractor {
420
521
  outputCount: diagnostics.outputCount
421
522
  };
422
523
  }
524
+ captureLookupCompleted(lookupKind, result, diagnostics, startedAt, extraAttributes = {}) {
525
+ this.telemetry.capture({
526
+ name: 'wallet-toolbox.ump.lookup.completed',
527
+ component: 'wallet-toolbox.ump',
528
+ severity: 'info',
529
+ correlationId: diagnostics.correlationId,
530
+ attributes: {
531
+ lookupKind,
532
+ result,
533
+ durationMs: Date.now() - startedAt,
534
+ ...this.lookupDiagnosticAttributes(diagnostics),
535
+ ...extraAttributes
536
+ }
537
+ });
538
+ }
423
539
  captureLookupFailure(lookupKind, reason, diagnostics, startedAt, error) {
424
540
  this.telemetry.capture({
425
541
  name: 'wallet-toolbox.ump.lookup.indeterminate',
@@ -690,15 +806,7 @@ class OverlayUMPTokenInteractor {
690
806
  }
691
807
  if (resolution.answer.outputs.length === 0) {
692
808
  const p = resolution.progress;
693
- const authoritative = p.isFinal &&
694
- p.hostCount > 0 &&
695
- p.completedHosts === p.hostCount &&
696
- p.successfulHosts === p.hostCount &&
697
- p.emptyHosts === p.hostCount &&
698
- p.failedHosts === 0 &&
699
- p.rejectedHosts === 0 &&
700
- p.freeformHosts === 0;
701
- if (!authoritative) {
809
+ if (p.emptyHosts === 0) {
702
810
  const diagnostics = this.toLookupDiagnostics(resolution);
703
811
  this.captureLookupFailure('outpoint', 'lookup-incomplete', diagnostics, startedAt);
704
812
  throw new UMPTokenLookupError('lookup-incomplete', diagnostics);