@tangle-network/agent-provider-tangle 3.6.4 → 3.6.5
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.
|
@@ -74,6 +74,17 @@ export function createTangleWorkspaceBranching(options) {
|
|
|
74
74
|
return recovered;
|
|
75
75
|
};
|
|
76
76
|
/** The fork equivalent of {@link resolveCheckpoint}. */
|
|
77
|
+
const resolveLocalFork = (request) => {
|
|
78
|
+
const local = forks.get(request.idempotencyKey);
|
|
79
|
+
if (!local)
|
|
80
|
+
return { state: "absent" };
|
|
81
|
+
return local.request.requestDigest === request.requestDigest
|
|
82
|
+
? { state: "known", record: local }
|
|
83
|
+
: {
|
|
84
|
+
state: "conflict",
|
|
85
|
+
existingRequestDigest: local.request.requestDigest,
|
|
86
|
+
};
|
|
87
|
+
};
|
|
77
88
|
const resolveFork = async (request, signal) => {
|
|
78
89
|
const local = forks.get(request.idempotencyKey);
|
|
79
90
|
if (local) {
|
|
@@ -280,7 +291,15 @@ export function createTangleWorkspaceBranching(options) {
|
|
|
280
291
|
typeof box.getTeeAttestation !== "function")) {
|
|
281
292
|
return forkUnknown(request, "Confidential fork requires a trusted verifier and Sandbox attestation support", false);
|
|
282
293
|
}
|
|
283
|
-
|
|
294
|
+
// A key this handle has not recorded is created again with the same key: Sandbox applies the
|
|
295
|
+
// key and replays the child it already created for it. Searching the account for the key's
|
|
296
|
+
// child first paged every sandbox in the account, which timed out or repeated rows on an
|
|
297
|
+
// account with thousands of them, so a fork answered unknown (agent-sdk#439 removed the same
|
|
298
|
+
// scan from deleteCheckpoint). This provider cannot create a confidential fork, only recover
|
|
299
|
+
// one, so that request still searches; lookupFork does too, for a key it must recover.
|
|
300
|
+
const known = request.confidential?.requested === true
|
|
301
|
+
? await resolveFork(request, operation?.signal)
|
|
302
|
+
: resolveLocalFork(request);
|
|
284
303
|
if (known.state === "conflict") {
|
|
285
304
|
return forkConflict(request, known.existingRequestDigest);
|
|
286
305
|
}
|