@origintrail-official/dkg-agent 10.0.21 → 10.0.23
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/dist/approved-private-replica-proof-runs.d.ts +40 -0
- package/dist/approved-private-replica-proof-runs.d.ts.map +1 -0
- package/dist/approved-private-replica-proof-runs.js +49 -0
- package/dist/approved-private-replica-proof-runs.js.map +1 -0
- package/dist/approved-private-replica.d.ts +18 -1
- package/dist/approved-private-replica.d.ts.map +1 -1
- package/dist/approved-private-replica.js +9 -3
- package/dist/approved-private-replica.js.map +1 -1
- package/dist/context-graph-chain-discovery-binding.d.ts +2 -0
- package/dist/context-graph-chain-discovery-binding.d.ts.map +1 -1
- package/dist/context-graph-chain-discovery-binding.js +7 -0
- package/dist/context-graph-chain-discovery-binding.js.map +1 -1
- package/dist/context-graph-dormant-identity.d.ts +8 -0
- package/dist/context-graph-dormant-identity.d.ts.map +1 -0
- package/dist/context-graph-dormant-identity.js +48 -0
- package/dist/context-graph-dormant-identity.js.map +1 -0
- package/dist/context-graph-meta-projection.d.ts +19 -55
- package/dist/context-graph-meta-projection.d.ts.map +1 -1
- package/dist/context-graph-meta-projection.js +94 -46
- package/dist/context-graph-meta-projection.js.map +1 -1
- package/dist/context-graph-name-binding-target.d.ts +21 -0
- package/dist/context-graph-name-binding-target.d.ts.map +1 -0
- package/dist/context-graph-name-binding-target.js +68 -0
- package/dist/context-graph-name-binding-target.js.map +1 -0
- package/dist/context-graph-persisted-name-aliases.d.ts +47 -0
- package/dist/context-graph-persisted-name-aliases.d.ts.map +1 -0
- package/dist/context-graph-persisted-name-aliases.js +173 -0
- package/dist/context-graph-persisted-name-aliases.js.map +1 -0
- package/dist/context-graph-read-authority.d.ts +26 -11
- package/dist/context-graph-read-authority.d.ts.map +1 -1
- package/dist/context-graph-read-authority.js +26 -2
- package/dist/context-graph-read-authority.js.map +1 -1
- package/dist/context-graph-subscription-authority-recovery.d.ts +4 -0
- package/dist/context-graph-subscription-authority-recovery.d.ts.map +1 -1
- package/dist/context-graph-subscription-authority-recovery.js +8 -2
- package/dist/context-graph-subscription-authority-recovery.js.map +1 -1
- package/dist/context-graph-subscription-policy.d.ts +34 -1
- package/dist/context-graph-subscription-policy.d.ts.map +1 -1
- package/dist/context-graph-subscription-policy.js +143 -1
- package/dist/context-graph-subscription-policy.js.map +1 -1
- package/dist/curator-meta-refresh.d.ts.map +1 -1
- package/dist/curator-meta-refresh.js +31 -9
- package/dist/curator-meta-refresh.js.map +1 -1
- package/dist/dkg-agent-base.d.ts.map +1 -1
- package/dist/dkg-agent-base.js +0 -1
- package/dist/dkg-agent-base.js.map +1 -1
- package/dist/dkg-agent-cg-name-resolution.d.ts +6 -24
- package/dist/dkg-agent-cg-name-resolution.d.ts.map +1 -1
- package/dist/dkg-agent-cg-name-resolution.js +42 -58
- package/dist/dkg-agent-cg-name-resolution.js.map +1 -1
- package/dist/dkg-agent-cg-on-chain-id.d.ts +3 -3
- package/dist/dkg-agent-cg-on-chain-id.d.ts.map +1 -1
- package/dist/dkg-agent-cg-on-chain-id.js +7 -23
- package/dist/dkg-agent-cg-on-chain-id.js.map +1 -1
- package/dist/dkg-agent-cg-registry.d.ts +7 -3
- package/dist/dkg-agent-cg-registry.d.ts.map +1 -1
- package/dist/dkg-agent-cg-registry.js +30 -16
- package/dist/dkg-agent-cg-registry.js.map +1 -1
- package/dist/dkg-agent-cg-resolve.d.ts +10 -6
- package/dist/dkg-agent-cg-resolve.d.ts.map +1 -1
- package/dist/dkg-agent-cg-resolve.js +16 -19
- package/dist/dkg-agent-cg-resolve.js.map +1 -1
- package/dist/dkg-agent-context-graph.d.ts.map +1 -1
- package/dist/dkg-agent-context-graph.js +0 -4
- package/dist/dkg-agent-context-graph.js.map +1 -1
- package/dist/dkg-agent-crypto.d.ts.map +1 -1
- package/dist/dkg-agent-crypto.js +53 -57
- package/dist/dkg-agent-crypto.js.map +1 -1
- package/dist/dkg-agent-lifecycle.d.ts +5 -0
- package/dist/dkg-agent-lifecycle.d.ts.map +1 -1
- package/dist/dkg-agent-lifecycle.js +156 -133
- package/dist/dkg-agent-lifecycle.js.map +1 -1
- package/dist/dkg-agent-publish.d.ts.map +1 -1
- package/dist/dkg-agent-publish.js +2 -3
- package/dist/dkg-agent-publish.js.map +1 -1
- package/dist/dkg-agent-query.d.ts.map +1 -1
- package/dist/dkg-agent-query.js +12 -9
- package/dist/dkg-agent-query.js.map +1 -1
- package/dist/dkg-agent-registered-private-empty-vm.d.ts +8 -0
- package/dist/dkg-agent-registered-private-empty-vm.d.ts.map +1 -1
- package/dist/dkg-agent-registered-private-empty-vm.js +15 -0
- package/dist/dkg-agent-registered-private-empty-vm.js.map +1 -1
- package/dist/dkg-agent-rfc64-catalog-auto-publish.d.ts.map +1 -1
- package/dist/dkg-agent-rfc64-catalog-auto-publish.js +4 -0
- package/dist/dkg-agent-rfc64-catalog-auto-publish.js.map +1 -1
- package/dist/dkg-agent-rfc64-catalog-upsert.d.ts.map +1 -1
- package/dist/dkg-agent-rfc64-catalog-upsert.js +7 -0
- package/dist/dkg-agent-rfc64-catalog-upsert.js.map +1 -1
- package/dist/dkg-agent-rfc64-catalog.d.ts +4 -0
- package/dist/dkg-agent-rfc64-catalog.d.ts.map +1 -1
- package/dist/dkg-agent-rfc64-catalog.js +12 -2
- package/dist/dkg-agent-rfc64-catalog.js.map +1 -1
- package/dist/dkg-agent-rfc64-swm-catalog-projection-supervisor.d.ts +2 -1
- package/dist/dkg-agent-rfc64-swm-catalog-projection-supervisor.d.ts.map +1 -1
- package/dist/dkg-agent-rfc64-swm-catalog-projection-supervisor.js +23 -15
- package/dist/dkg-agent-rfc64-swm-catalog-projection-supervisor.js.map +1 -1
- package/dist/dkg-agent-rfc64-swm-catalog-projection.d.ts.map +1 -1
- package/dist/dkg-agent-rfc64-swm-catalog-projection.js +3 -0
- package/dist/dkg-agent-rfc64-swm-catalog-projection.js.map +1 -1
- package/dist/dkg-agent-swm-host.d.ts +13 -22
- package/dist/dkg-agent-swm-host.d.ts.map +1 -1
- package/dist/dkg-agent-swm-host.js +179 -81
- package/dist/dkg-agent-swm-host.js.map +1 -1
- package/dist/dkg-agent-swm-substrate.d.ts +2 -0
- package/dist/dkg-agent-swm-substrate.d.ts.map +1 -1
- package/dist/dkg-agent-swm-substrate.js +5 -9
- package/dist/dkg-agent-swm-substrate.js.map +1 -1
- package/dist/dkg-agent-types.d.ts +3 -2
- package/dist/dkg-agent-types.d.ts.map +1 -1
- package/dist/dkg-agent.d.ts +4 -10
- package/dist/dkg-agent.d.ts.map +1 -1
- package/dist/dkg-agent.js +43 -58
- package/dist/dkg-agent.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/internal/context-graph-authority/context-graph-agent-gate-authority.d.ts +6 -1
- package/dist/internal/context-graph-authority/context-graph-agent-gate-authority.d.ts.map +1 -1
- package/dist/internal/context-graph-authority/context-graph-agent-gate-authority.js +5 -5
- package/dist/internal/context-graph-authority/context-graph-agent-gate-authority.js.map +1 -1
- package/dist/internal/context-graph-authority/context-graph-authority.d.ts +14 -1
- package/dist/internal/context-graph-authority/context-graph-authority.d.ts.map +1 -1
- package/dist/internal/context-graph-authority/context-graph-authority.js +19 -0
- package/dist/internal/context-graph-authority/context-graph-authority.js.map +1 -1
- package/dist/internal/context-graph-cache-invalidating-store.d.ts +10 -2
- package/dist/internal/context-graph-cache-invalidating-store.d.ts.map +1 -1
- package/dist/internal/context-graph-cache-invalidating-store.js +67 -67
- package/dist/internal/context-graph-cache-invalidating-store.js.map +1 -1
- package/dist/internal/context-graph-meta-record-copy.d.ts +1 -1
- package/dist/internal/context-graph-meta-record-copy.d.ts.map +1 -1
- package/dist/internal/context-graph-meta-record.d.ts +40 -0
- package/dist/internal/context-graph-meta-record.d.ts.map +1 -0
- package/dist/internal/context-graph-meta-record.js +3 -0
- package/dist/internal/context-graph-meta-record.js.map +1 -0
- package/dist/internal/peer-gate-revision.d.ts +28 -0
- package/dist/internal/peer-gate-revision.d.ts.map +1 -0
- package/dist/internal/peer-gate-revision.js +46 -0
- package/dist/internal/peer-gate-revision.js.map +1 -0
- package/dist/internal/projection-mutation-observer.d.ts +5 -0
- package/dist/internal/projection-mutation-observer.d.ts.map +1 -0
- package/dist/internal/projection-mutation-observer.js +24 -0
- package/dist/internal/projection-mutation-observer.js.map +1 -0
- package/dist/internal/promote/assertion-promote-precommit.d.ts +8 -6
- package/dist/internal/promote/assertion-promote-precommit.d.ts.map +1 -1
- package/dist/internal/promote/assertion-promote-precommit.js +8 -6
- package/dist/internal/promote/assertion-promote-precommit.js.map +1 -1
- package/dist/internal/recipient-key-route-fence.d.ts +57 -0
- package/dist/internal/recipient-key-route-fence.d.ts.map +1 -0
- package/dist/internal/recipient-key-route-fence.js +169 -0
- package/dist/internal/recipient-key-route-fence.js.map +1 -0
- package/dist/internal/store-mutation.d.ts +28 -0
- package/dist/internal/store-mutation.d.ts.map +1 -0
- package/dist/internal/store-mutation.js +3 -0
- package/dist/internal/store-mutation.js.map +1 -0
- package/dist/main-thread-time-slice.d.ts +19 -0
- package/dist/main-thread-time-slice.d.ts.map +1 -0
- package/dist/main-thread-time-slice.js +32 -0
- package/dist/main-thread-time-slice.js.map +1 -0
- package/dist/p2p/storage-ack-registrar.d.ts.map +1 -1
- package/dist/p2p/storage-ack-registrar.js +3 -5
- package/dist/p2p/storage-ack-registrar.js.map +1 -1
- package/dist/registered-context-graph-authority.d.ts +17 -0
- package/dist/registered-context-graph-authority.d.ts.map +1 -1
- package/dist/registered-private-empty-vm-attempt-v1.d.ts.map +1 -1
- package/dist/registered-private-empty-vm-attempt-v1.js +8 -4
- package/dist/registered-private-empty-vm-attempt-v1.js.map +1 -1
- package/dist/rfc64/catalog-repair-retry-v1.d.ts +9 -3
- package/dist/rfc64/catalog-repair-retry-v1.d.ts.map +1 -1
- package/dist/rfc64/catalog-repair-retry-v1.js +22 -6
- package/dist/rfc64/catalog-repair-retry-v1.js.map +1 -1
- package/dist/rfc64/control-envelope-signer-v1.d.ts +8 -0
- package/dist/rfc64/control-envelope-signer-v1.d.ts.map +1 -1
- package/dist/rfc64/control-envelope-signer-v1.js +20 -0
- package/dist/rfc64/control-envelope-signer-v1.js.map +1 -1
- package/dist/rfc64/legacy-swm-boundary-fence-v1.d.ts +109 -0
- package/dist/rfc64/legacy-swm-boundary-fence-v1.d.ts.map +1 -0
- package/dist/rfc64/legacy-swm-boundary-fence-v1.js +236 -0
- package/dist/rfc64/legacy-swm-boundary-fence-v1.js.map +1 -0
- package/dist/rfc64/legacy-swm-boundary-v1.d.ts +28 -1
- package/dist/rfc64/legacy-swm-boundary-v1.d.ts.map +1 -1
- package/dist/rfc64/legacy-swm-boundary-v1.js +74 -145
- package/dist/rfc64/legacy-swm-boundary-v1.js.map +1 -1
- package/dist/rfc64/public-catalog-successor-producer-v1.d.ts +2 -0
- package/dist/rfc64/public-catalog-successor-producer-v1.d.ts.map +1 -1
- package/dist/rfc64/public-catalog-successor-producer-v1.js +77 -33
- package/dist/rfc64/public-catalog-successor-producer-v1.js.map +1 -1
- package/dist/rfc64/public-catalog-successor-row-binding-v1.d.ts +16 -0
- package/dist/rfc64/public-catalog-successor-row-binding-v1.d.ts.map +1 -0
- package/dist/rfc64/public-catalog-successor-row-binding-v1.js +28 -0
- package/dist/rfc64/public-catalog-successor-row-binding-v1.js.map +1 -0
- package/dist/rfc64/swm-inventory-catalog-reconciler-v1.d.ts +6 -0
- package/dist/rfc64/swm-inventory-catalog-reconciler-v1.d.ts.map +1 -1
- package/dist/rfc64/swm-inventory-catalog-reconciler-v1.js +9 -3
- package/dist/rfc64/swm-inventory-catalog-reconciler-v1.js.map +1 -1
- package/dist/rfc64/swm-inventory-settlement-outlook-v1.d.ts +8 -0
- package/dist/rfc64/swm-inventory-settlement-outlook-v1.d.ts.map +1 -0
- package/dist/rfc64/swm-inventory-settlement-outlook-v1.js +32 -0
- package/dist/rfc64/swm-inventory-settlement-outlook-v1.js.map +1 -0
- package/dist/sync/requester/swm-recovery-apply.d.ts +1 -1
- package/dist/sync/requester/swm-recovery-apply.d.ts.map +1 -1
- package/dist/sync/requester/swm-recovery-apply.js +0 -1
- package/dist/sync/requester/swm-recovery-apply.js.map +1 -1
- package/dist/sync/requester/swm-target-executor.d.ts +2 -2
- package/dist/sync/requester/swm-target-executor.d.ts.map +1 -1
- package/dist/sync/requester/swm-target-executor.js +1 -2
- package/dist/sync/requester/swm-target-executor.js.map +1 -1
- package/package.json +11 -8
|
@@ -7,6 +7,21 @@ import type { ApprovedPrivateReplicaAuthority } from './approved-private-replica
|
|
|
7
7
|
* is a failure whose error says neither.
|
|
8
8
|
*/
|
|
9
9
|
export type ContextGraphReadAuthorityDependency = 'store' | 'chain' | 'local-state' | 'unknown';
|
|
10
|
+
/**
|
|
11
|
+
* Which check of the recipient-authority stability loop refused a share or a
|
|
12
|
+
* publish (GH#3067), for server-side diagnostics only: a closed set, so a log
|
|
13
|
+
* can carry it without any free text.
|
|
14
|
+
*/
|
|
15
|
+
export type ContextGraphAuthorityFailureSite = 'transport-unavailable' | 'transport-changed' | 'revision-moved' | 'recipient-set-changed';
|
|
16
|
+
/**
|
|
17
|
+
* Why a name that is absent on chain has no accepted unregistered authority,
|
|
18
|
+
* for server-side diagnostics only: a closed set, so a log can carry it where
|
|
19
|
+
* the free-text `detail` may not go. The `replica-` codes belong to an approved
|
|
20
|
+
* member's local proof: it ran out of its time limit, failed, found no current
|
|
21
|
+
* proof, was discarded on every run because the graph's metadata moved, or was
|
|
22
|
+
* followed by a binding change or a registration its own metadata claims.
|
|
23
|
+
*/
|
|
24
|
+
export type ContextGraphFinalizedAbsenceDetailCode = 'no-accepted-authority' | 'replica-proof-timeout' | 'replica-proof-error' | 'replica-proof-absent' | 'replica-metadata-moved' | 'replica-binding-changed' | 'replica-registered-metadata';
|
|
10
25
|
export type LiveOnChainAccessPolicyUnavailableReason = 'chain-access-policy-timeout' | 'chain-access-policy-unknown';
|
|
11
26
|
export type LiveOnChainAccessPolicyUnavailable = {
|
|
12
27
|
kind: 'unavailable';
|
|
@@ -26,6 +41,8 @@ export type RegisteredContextGraphAuthorityUnavailable = (LiveOnChainAccessPolic
|
|
|
26
41
|
detail?: string;
|
|
27
42
|
/** Set where the failed read's own error says which dependency could not answer. */
|
|
28
43
|
dependency?: ContextGraphReadAuthorityDependency;
|
|
44
|
+
/** Set by the producers of `finalized-name-absence-unaccepted` that classify their `detail`. */
|
|
45
|
+
detailCode?: ContextGraphFinalizedAbsenceDetailCode;
|
|
29
46
|
};
|
|
30
47
|
/** Explicit non-applicability proof, separate from legacy read fallbacks. */
|
|
31
48
|
export type ContextGraphUnregisteredEvidence = 'local-create' | 'accepted-rfc64-finalized-absence' | 'approved-private-replica-finalized-absence';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registered-context-graph-authority.d.ts","sourceRoot":"","sources":["../src/registered-context-graph-authority.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,+BAA+B,CAAC;AAErF;;;;;;GAMG;AACH,MAAM,MAAM,mCAAmC,GAAG,OAAO,GAAG,OAAO,GAAG,aAAa,GAAG,SAAS,CAAC;AAEhG,MAAM,MAAM,wCAAwC,GAChD,6BAA6B,GAC7B,6BAA6B,CAAC;AAElC,MAAM,MAAM,kCAAkC,GAAG;IAC/C,IAAI,EAAE,aAAa,CAAC;IACpB,MAAM,EAAE,wCAAwC,CAAC;IACjD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,oFAAoF;IACpF,UAAU,CAAC,EAAE,mCAAmC,CAAC;CAClD,CAAC;AAEF,MAAM,MAAM,gDAAgD,GACxD,wCAAwC,GACxC,mCAAmC,GACnC,gCAAgC,GAIhC,wBAAwB,GACxB,iCAAiC,GACjC,6BAA6B,GAC7B,iCAAiC,GACjC,yCAAyC,GACzC,yCAAyC,GACzC,qCAAqC,CAAC;AAE1C,KAAK,yDAAyD,GAAG,OAAO,CACtE,gDAAgD,EAChD,wCAAwC,CACzC,CAAC;AAEF,MAAM,MAAM,0CAA0C,GAClD,CAAC,kCAAkC,GAAG;IAAE,SAAS,EAAE,MAAM,CAAA;CAAE,CAAC,GAC5D;IACE,IAAI,EAAE,aAAa,CAAC;IACpB,MAAM,EAAE,yDAAyD,CAAC;IAClE,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,oFAAoF;IACpF,UAAU,CAAC,EAAE,mCAAmC,CAAC;
|
|
1
|
+
{"version":3,"file":"registered-context-graph-authority.d.ts","sourceRoot":"","sources":["../src/registered-context-graph-authority.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,+BAA+B,CAAC;AAErF;;;;;;GAMG;AACH,MAAM,MAAM,mCAAmC,GAAG,OAAO,GAAG,OAAO,GAAG,aAAa,GAAG,SAAS,CAAC;AAEhG;;;;GAIG;AACH,MAAM,MAAM,gCAAgC,GACxC,uBAAuB,GACvB,mBAAmB,GACnB,gBAAgB,GAChB,uBAAuB,CAAC;AAE5B;;;;;;;GAOG;AACH,MAAM,MAAM,sCAAsC,GAC9C,uBAAuB,GACvB,uBAAuB,GACvB,qBAAqB,GACrB,sBAAsB,GACtB,wBAAwB,GACxB,yBAAyB,GACzB,6BAA6B,CAAC;AAElC,MAAM,MAAM,wCAAwC,GAChD,6BAA6B,GAC7B,6BAA6B,CAAC;AAElC,MAAM,MAAM,kCAAkC,GAAG;IAC/C,IAAI,EAAE,aAAa,CAAC;IACpB,MAAM,EAAE,wCAAwC,CAAC;IACjD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,oFAAoF;IACpF,UAAU,CAAC,EAAE,mCAAmC,CAAC;CAClD,CAAC;AAEF,MAAM,MAAM,gDAAgD,GACxD,wCAAwC,GACxC,mCAAmC,GACnC,gCAAgC,GAIhC,wBAAwB,GACxB,iCAAiC,GACjC,6BAA6B,GAC7B,iCAAiC,GACjC,yCAAyC,GACzC,yCAAyC,GACzC,qCAAqC,CAAC;AAE1C,KAAK,yDAAyD,GAAG,OAAO,CACtE,gDAAgD,EAChD,wCAAwC,CACzC,CAAC;AAEF,MAAM,MAAM,0CAA0C,GAClD,CAAC,kCAAkC,GAAG;IAAE,SAAS,EAAE,MAAM,CAAA;CAAE,CAAC,GAC5D;IACE,IAAI,EAAE,aAAa,CAAC;IACpB,MAAM,EAAE,yDAAyD,CAAC;IAClE,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,oFAAoF;IACpF,UAAU,CAAC,EAAE,mCAAmC,CAAC;IACjD,gGAAgG;IAChG,UAAU,CAAC,EAAE,sCAAsC,CAAC;CACrD,CAAC;AAEN,6EAA6E;AAC7E,MAAM,MAAM,gCAAgC,GACxC,cAAc,GACd,kCAAkC,GAClC,4CAA4C,CAAC;AAEjD,2EAA2E;AAC3E,MAAM,MAAM,+BAA+B,GACvC;IACE,IAAI,EAAE,cAAc,CAAC;IACrB,2EAA2E;IAC3E,oBAAoB,CAAC,EAAE,gCAAgC,CAAC;IACxD,0EAA0E;IAC1E,+BAA+B,CAAC,EAAE,+BAA+B,CAAC;CACnE,GACD;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,GACrC;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,SAAS,EAAE,MAAM,CAAC;IAAC,iBAAiB,EAAE,MAAM,EAAE,CAAA;CAAE,GACnE,0CAA0C,CAAC;AAE/C;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,MAAM,6BAA6B,GACrC,cAAc,GACd,iBAAiB,GACjB,yBAAyB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registered-private-empty-vm-attempt-v1.d.ts","sourceRoot":"","sources":["../src/registered-private-empty-vm-attempt-v1.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"registered-private-empty-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
|
|
1
1
|
// SPDX-License-Identifier: Apache-2.0
|
|
2
2
|
import { ethers } from 'ethers';
|
|
3
|
-
import { createStrictCurrentFinalizedEvmSnapshotScopeV1, isFinalizedChainAdmissionContention, resolveRpcUrls, } from '@origintrail-official/dkg-chain';
|
|
3
|
+
import { createStrictCurrentFinalizedEvmSnapshotScopeV1, isFinalizedChainAdmissionContention, numericChainIdOf, resolveRpcUrls, } from '@origintrail-official/dkg-chain';
|
|
4
4
|
import { assertCanonicalChainId, assertCanonicalEvmAddress, } from '@origintrail-official/dkg-core';
|
|
5
5
|
import { finalizedContextGraphSnapshotMismatchV1 } from './internal/context-graph-authority/finalized-context-graph-binding.js';
|
|
6
6
|
import { proveRegisteredPrivateEmptyVmV1 } from './rfc64/registered-private-empty-vm-proof-v1.js';
|
|
@@ -58,17 +58,21 @@ export async function attemptRegisteredPrivateEmptyVmV1(agent, bindings, context
|
|
|
58
58
|
tracePrivateEmptyVm('rpc-endpoints-absent');
|
|
59
59
|
return UNPROVEN_PRIVATE_EMPTY_VM;
|
|
60
60
|
}
|
|
61
|
-
|
|
61
|
+
// The adapter's own reading of a configured chain: a decimal id behind any
|
|
62
|
+
// namespace. The network files name theirs `base:8453`, `gnosis:100`, and
|
|
63
|
+
// so on; only a local chain is `evm:31337`.
|
|
64
|
+
const configuredChainId = numericChainIdOf(chainConfig.chainId);
|
|
62
65
|
if ((chainConfig.chainId !== undefined && configuredChainId === undefined)
|
|
63
66
|
|| !ethers.isAddress(chainConfig.hubAddress)) {
|
|
64
67
|
tracePrivateEmptyVm('chain-binding-absent');
|
|
65
68
|
return UNPROVEN_PRIVATE_EMPTY_VM;
|
|
66
69
|
}
|
|
67
|
-
const
|
|
68
|
-
if (configuredChainId !== undefined && configuredChainId !==
|
|
70
|
+
const adapterChainId = await bindings.readAdapterEvmChainId();
|
|
71
|
+
if (configuredChainId !== undefined && configuredChainId !== adapterChainId) {
|
|
69
72
|
tracePrivateEmptyVm('chain-binding-mismatch');
|
|
70
73
|
return UNPROVEN_PRIVATE_EMPTY_VM;
|
|
71
74
|
}
|
|
75
|
+
const chainId = adapterChainId.toString();
|
|
72
76
|
// Normalize external bindings once. The registry supplies the graph name;
|
|
73
77
|
// it is not restricted to the RFC-64 author-lane grammar.
|
|
74
78
|
const hubAddress = chainConfig.hubAddress.toLowerCase();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registered-private-empty-vm-attempt-v1.js","sourceRoot":"","sources":["../src/registered-private-empty-vm-attempt-v1.ts"],"names":[],"mappings":"AAAA,sCAAsC;AAEtC,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EACL,8CAA8C,EAC9C,mCAAmC,EACnC,cAAc,GACf,MAAM,iCAAiC,CAAC;AACzC,OAAO,EACL,sBAAsB,EAAE,yBAAyB,GAClD,MAAM,gCAAgC,CAAC;AAExC,OAAO,EAAE,uCAAuC,EAAE,MAAM,uEAAuE,CAAC;AAChI,OAAO,EAAE,+BAA+B,EAAE,MAAM,iDAAiD,CAAC;AAMlG,MAAM,CAAC,MAAM,yBAAyB,GAAG,EAAE,MAAM,EAAE,KAAK,EAAW,CAAC;AACpE,MAAM,CAAC,MAAM,0BAA0B,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,IAAI,EAAW,CAAC;AAiBtF,MAAM,UAAU,mBAAmB,CAAC,KAAa;IAC/C,IAAI,OAAO,CAAC,GAAG,CAAC,0BAA0B,KAAK,GAAG,EAAE,CAAC;QACnD,OAAO,CAAC,IAAI,CAAC,sBAAsB,KAAK,EAAE,CAAC,CAAC;IAC9C,CAAC;AACH,CAAC;AAED,gFAAgF;AAChF,MAAM,CAAC,KAAK,UAAU,iCAAiC,CACrD,KAAe,EACf,QAAuC,EACvC,cAAsB,EACtB,kBAA0B,EAC1B,MAAoB;IAEpB,IAAI,CAAC;QACH,IAAI,MAAM,EAAE,OAAO;YAAE,OAAO,yBAAyB,CAAC;QACtD,MAAM,MAAM,G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AAI,CAAC,mCAAmC,CAAC,KAAK,CAAC;YACnE,CAAC,CAAC,yBAAyB,CAAC,CAAC,CAAC,0BAA0B,CAAC;IAC7D,CAAC;AACH,CAAC"}
|
|
@@ -1,13 +1,19 @@
|
|
|
1
|
+
import type { CatalogRepairDiagnosticV1 } from './catalog-repair-diagnostics-v1.js';
|
|
2
|
+
/** Producer-owned identity separates inventory churn from an authoring-scope transition. */
|
|
3
|
+
export interface CatalogRepairRevisionHintV1 {
|
|
4
|
+
readonly scopeIdentity: string;
|
|
5
|
+
readonly headRevision: string | null;
|
|
6
|
+
}
|
|
1
7
|
/** Constant-size scheduling hint; canonical reconciliation remains authoritative. */
|
|
2
8
|
export declare class CatalogRepairRetryV1 {
|
|
3
9
|
#private;
|
|
4
10
|
generation: number;
|
|
5
11
|
consecutiveFailures: number;
|
|
6
12
|
nextAttemptAtMs: number | null;
|
|
7
|
-
observe(revision:
|
|
13
|
+
observe(revision: CatalogRepairRevisionHintV1 | null | undefined): boolean;
|
|
8
14
|
eligible(nowMs: number): boolean;
|
|
9
15
|
reset(): void;
|
|
10
|
-
/**
|
|
11
|
-
fail(attemptGeneration: number, nowMs: number, configuredIntervalMs?: number): boolean;
|
|
16
|
+
/** Integrity and store pressure survive head churn; lane changes and success reset them. */
|
|
17
|
+
fail(attemptGeneration: number, nowMs: number, configuredIntervalMs?: number, kind?: CatalogRepairDiagnosticV1['kind']): boolean;
|
|
12
18
|
}
|
|
13
19
|
//# sourceMappingURL=catalog-repair-retry-v1.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"catalog-repair-retry-v1.d.ts","sourceRoot":"","sources":["../../src/rfc64/catalog-repair-retry-v1.ts"],"names":[],"mappings":"AAEA,qFAAqF;AACrF,qBAAa,oBAAoB;;
|
|
1
|
+
{"version":3,"file":"catalog-repair-retry-v1.d.ts","sourceRoot":"","sources":["../../src/rfc64/catalog-repair-retry-v1.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,oCAAoC,CAAC;AAOpF,4FAA4F;AAC5F,MAAM,WAAW,2BAA2B;IAC1C,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;CACtC;AAED,qFAAqF;AACrF,qBAAa,oBAAoB;;IAI/B,UAAU,SAAK;IACf,mBAAmB,SAAK;IACxB,eAAe,EAAE,MAAM,GAAG,IAAI,CAAQ;IAEtC,OAAO,CAAC,QAAQ,EAAE,2BAA2B,GAAG,IAAI,GAAG,SAAS,GAAG,OAAO;IAmB1E,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO;IAIhC,KAAK,IAAI,IAAI;IAMb,4FAA4F;IAC5F,IAAI,CAAC,iBAAiB,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,oBAAoB,CAAC,EAAE,MAAM,EAAE,IAAI,GAAE,yBAAyB,CAAC,MAAM,CAAa,GAAG,OAAO;CAW5I"}
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
// SPDX-License-Identifier: Apache-2.0
|
|
2
|
+
const survivesInventoryChange = (kind) => (kind === 'integrity' || kind === 'queue_wait' || kind === 'queue_full'
|
|
3
|
+
|| kind === 'store_timeout_not_started' || kind === 'store_timeout_indeterminate');
|
|
2
4
|
/** Constant-size scheduling hint; canonical reconciliation remains authoritative. */
|
|
3
5
|
export class CatalogRepairRetryV1 {
|
|
4
6
|
#revision;
|
|
7
|
+
#retainCooldown = false;
|
|
8
|
+
#lastLaneGeneration = 0;
|
|
5
9
|
generation = 0;
|
|
6
10
|
consecutiveFailures = 0;
|
|
7
11
|
nextAttemptAtMs = null;
|
|
@@ -9,11 +13,20 @@ export class CatalogRepairRetryV1 {
|
|
|
9
13
|
// A failed local hint read is neither a mutation nor a lane transition.
|
|
10
14
|
if (revision === undefined)
|
|
11
15
|
return false;
|
|
12
|
-
const
|
|
13
|
-
|
|
16
|
+
const previous = this.#revision;
|
|
17
|
+
const changed = previous !== undefined && (previous === null || revision === null
|
|
18
|
+
? previous !== revision
|
|
19
|
+
: previous.scopeIdentity !== revision.scopeIdentity || previous.headRevision !== revision.headRevision);
|
|
20
|
+
const scopeChanged = previous != null && revision !== null
|
|
21
|
+
&& previous.scopeIdentity !== revision.scopeIdentity;
|
|
22
|
+
const laneChanged = previous === null || revision === null || scopeChanged;
|
|
23
|
+
this.#revision = revision === null ? null : { ...revision };
|
|
14
24
|
if (changed) {
|
|
15
25
|
this.generation += 1;
|
|
16
|
-
|
|
26
|
+
if (laneChanged)
|
|
27
|
+
this.#lastLaneGeneration = this.generation;
|
|
28
|
+
if (laneChanged || !this.#retainCooldown)
|
|
29
|
+
this.reset();
|
|
17
30
|
}
|
|
18
31
|
return changed;
|
|
19
32
|
}
|
|
@@ -21,13 +34,16 @@ export class CatalogRepairRetryV1 {
|
|
|
21
34
|
return this.nextAttemptAtMs === null || nowMs >= this.nextAttemptAtMs;
|
|
22
35
|
}
|
|
23
36
|
reset() {
|
|
37
|
+
this.#retainCooldown = false;
|
|
24
38
|
this.consecutiveFailures = 0;
|
|
25
39
|
this.nextAttemptAtMs = null;
|
|
26
40
|
}
|
|
27
|
-
/**
|
|
28
|
-
fail(attemptGeneration, nowMs, configuredIntervalMs) {
|
|
29
|
-
|
|
41
|
+
/** Integrity and store pressure survive head churn; lane changes and success reset them. */
|
|
42
|
+
fail(attemptGeneration, nowMs, configuredIntervalMs, kind = 'unknown') {
|
|
43
|
+
const retain = survivesInventoryChange(kind);
|
|
44
|
+
if (attemptGeneration !== this.generation && (!retain || this.#revision === null || attemptGeneration < this.#lastLaneGeneration))
|
|
30
45
|
return false;
|
|
46
|
+
this.#retainCooldown = retain;
|
|
31
47
|
this.consecutiveFailures = Math.min(Number.MAX_SAFE_INTEGER, this.consecutiveFailures + 1);
|
|
32
48
|
const base = configuredIntervalMs !== undefined && configuredIntervalMs > 0
|
|
33
49
|
? configuredIntervalMs : 5_000;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"catalog-repair-retry-v1.js","sourceRoot":"","sources":["../../src/rfc64/catalog-repair-retry-v1.ts"],"names":[],"mappings":"AAAA,sCAAsC;
|
|
1
|
+
{"version":3,"file":"catalog-repair-retry-v1.js","sourceRoot":"","sources":["../../src/rfc64/catalog-repair-retry-v1.ts"],"names":[],"mappings":"AAAA,sCAAsC;AAItC,MAAM,uBAAuB,GAAG,CAAC,IAAuC,EAAW,EAAE,CAAC,CACpF,IAAI,KAAK,WAAW,IAAI,IAAI,KAAK,YAAY,IAAI,IAAI,KAAK,YAAY;OACnE,IAAI,KAAK,2BAA2B,IAAI,IAAI,KAAK,6BAA6B,CAClF,CAAC;AAQF,qFAAqF;AACrF,MAAM,OAAO,oBAAoB;IAC/B,SAAS,CAAiD;IAC1D,eAAe,GAAG,KAAK,CAAC;IACxB,mBAAmB,GAAG,CAAC,CAAC;IACxB,UAAU,GAAG,CAAC,CAAC;IACf,mBAAmB,GAAG,CAAC,CAAC;IACxB,eAAe,GAAkB,IAAI,CAAC;IAEtC,OAAO,CAAC,QAAwD;QAC9D,wEAAwE;QACxE,IAAI,QAAQ,KAAK,SAAS;YAAE,OAAO,KAAK,CAAC;QACzC,MAAM,QAAQ,GAAG,IAAI,CAAC,SAAS,CAAC;QAChC,MAAM,OAAO,GAAG,QAAQ,KAAK,SAAS,IAAI,CAAC,QAAQ,KAAK,IAAI,IAAI,QAAQ,KAAK,IAAI;YAC/E,CAAC,CAAC,QAAQ,KAAK,QAAQ;YACvB,CAAC,CAAC,QAAQ,CAAC,aAAa,KAAK,QAAQ,CAAC,aAAa,IAAI,QAAQ,CAAC,YAAY,KAAK,QAAQ,CAAC,YAAY,CAAC,CAAC;QAC1G,MAAM,YAAY,GAAG,QAAQ,IAAI,IAAI,IAAI,QAAQ,KAAK,IAAI;eACrD,QAAQ,CAAC,aAAa,KAAK,QAAQ,CAAC,aAAa,CAAC;QACvD,MAAM,WAAW,GAAG,QAAQ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QAC3F,MAAM,IAAI,GAAG,oBAAoB,KAAK,SAAS,IAAI,oBAAoB,GAAG,CAAC;YACzE,CAAC,CAAC,oBAAoB,CAAC,CAAC,CAAC,KAAK,CAAC;QACjC,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,MAAM,CAAC,EAAE,IAAI,GAAG,CAAC,IAAI,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,IAAI,CAAC,mBAAmB,GAAG,CAAC,CAAC,CAAC,CAAC;QACvG,IAAI,CAAC,eAAe,GAAG,KAAK,GAAG,KAAK,CAAC;QACrC,OAAO,IAAI,CAAC;IACd,CAAC;CACF"}
|
|
@@ -9,6 +9,14 @@ export declare class Rfc64ControlEnvelopeSigningErrorV1 extends Error {
|
|
|
9
9
|
readonly phase: 'callback' | 'verification';
|
|
10
10
|
constructor(phase: 'callback' | 'verification', message: string, options?: ErrorOptions);
|
|
11
11
|
}
|
|
12
|
+
/**
|
|
13
|
+
* The same signer, awaiting `turn` before each signature. A producer that
|
|
14
|
+
* works on the main thread passes its time-slice checkpoint, so the work
|
|
15
|
+
* around each signature does not run back to back with the work before it.
|
|
16
|
+
* The callback is read once and called on a snapshot that holds the issuer,
|
|
17
|
+
* which is the receiver a producer's own signer snapshot gives it.
|
|
18
|
+
*/
|
|
19
|
+
export declare function rfc64SignerTakingTurnsV1(signer: Rfc64ControlEnvelopeEip191SignerV1, turn: () => Promise<void>): Rfc64ControlEnvelopeEip191SignerV1;
|
|
12
20
|
export interface SignedAndVerifiedRfc64ControlEnvelopeV1 {
|
|
13
21
|
readonly envelope: SignedControlEnvelopeV1;
|
|
14
22
|
readonly issuerSignature: VerifiedControlEnvelopeIssuerSignatureV1;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"control-envelope-signer-v1.d.ts","sourceRoot":"","sources":["../../src/rfc64/control-envelope-signer-v1.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAC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,qBAAa,kCAAmC,SAAQ,KAAK;IAEzD,QAAQ,CAAC,KAAK,EAAE,UAAU,GAAG,cAAc;gBAAlC,KAAK,EAAE,UAAU,GAAG,cAAc,EAC3C,OAAO,EAAE,MAAM,EACf,OAAO,GAAE,YAAiB;CAK7B;AAED;;;;;;GAMG;AACH,wBAAgB,wBAAwB,CACtC,MAAM,EAAE,kCAAkC,EAC1C,IAAI,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,GACxB,kCAAkC,CAWpC;AAED,MAAM,WAAW,uCAAuC;IACtD,QAAQ,CAAC,QAAQ,EAAE,uBAAuB,CAAC;IAC3C,QAAQ,CAAC,eAAe,EAAE,wCAAwC,CAAC;CACpE;AAED,mFAAmF;AACnF,wBAAsB,mCAAmC,CACvD,QAAQ,EAAE,yBAAyB,EACnC,YAAY,EAAE,UAAU,EACxB,MAAM,EAAE,kCAAkC,GACzC,OAAO,CAAC,uCAAuC,CAAC,CAsBlD"}
|
|
@@ -8,6 +8,26 @@ export class Rfc64ControlEnvelopeSigningErrorV1 extends Error {
|
|
|
8
8
|
this.name = 'Rfc64ControlEnvelopeSigningErrorV1';
|
|
9
9
|
}
|
|
10
10
|
}
|
|
11
|
+
/**
|
|
12
|
+
* The same signer, awaiting `turn` before each signature. A producer that
|
|
13
|
+
* works on the main thread passes its time-slice checkpoint, so the work
|
|
14
|
+
* around each signature does not run back to back with the work before it.
|
|
15
|
+
* The callback is read once and called on a snapshot that holds the issuer,
|
|
16
|
+
* which is the receiver a producer's own signer snapshot gives it.
|
|
17
|
+
*/
|
|
18
|
+
export function rfc64SignerTakingTurnsV1(signer, turn) {
|
|
19
|
+
const { issuer, signDigest } = signer;
|
|
20
|
+
if (typeof signDigest !== 'function')
|
|
21
|
+
return signer;
|
|
22
|
+
const snapshot = Object.freeze({ issuer, signDigest });
|
|
23
|
+
return Object.freeze({
|
|
24
|
+
issuer,
|
|
25
|
+
signDigest: async (objectDigest) => {
|
|
26
|
+
await turn();
|
|
27
|
+
return snapshot.signDigest(objectDigest);
|
|
28
|
+
},
|
|
29
|
+
});
|
|
30
|
+
}
|
|
11
31
|
/** Sign one prepared control object and recover its declared issuer before use. */
|
|
12
32
|
export async function signAndVerifyRfc64ControlEnvelopeV1(unsigned, objectDigest, signer) {
|
|
13
33
|
let signature;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"control-envelope-signer-v1.js","sourceRoot":"","sources":["../../src/rfc64/control-envelope-signer-v1.ts"],"names":[],"mappings":"AAMA,OAAO,EACL,sCAAsC,GAEvC,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAQhC,MAAM,OAAO,kCAAmC,SAAQ,KAAK;IAEhD;IADX,YACW,KAAkC,EAC3C,OAAe,EACf,UAAwB,EAAE;QAE1B,KAAK,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QAJf,UAAK,GAAL,KAAK,CAA6B;QAK3C,IAAI,CAAC,IAAI,GAAG,oCAAoC,CAAC;IACnD,CAAC;CACF;AAOD,mFAAmF;AACnF,MAAM,CAAC,KAAK,UAAU,mCAAmC,CACvD,QAAmC,EACnC,YAAwB,EACxB,MAA0C;IAE1C,IAAI,SAAiB,CAAC;IACtB,IAAI,CAAC;QACH,SAAS,GAAG,MAAM,MAAM,CAAC,UAAU,CAAC,MAAM,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC,CAAC;IACrE,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,IAAI,kCAAkC,CAC1C,UAAU,EACV,8BAA8B,QAAQ,CAAC,UAAU,EAAE,EACnD,EAAE,KAAK,EAAE,CACV,CAAC;IACJ,CAAC;IACD,MAAM,MAAM,GAAG,EAAE,GAAG,QAAQ,EAAE,YAAY,EAAE,SAAS,EAA6B,CAAC;IACnF,IAAI,CAAC;QACH,MAAM,eAAe,GAAG,MAAM,sCAAsC,CAAC,MAAM,CAAC,CAAC;QAC7E,OAAO,MAAM,CAAC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,KAAK,UAAU,mCAAmC,CACvD,QAAmC,EACnC,YAAwB,EACxB,MAA0C;IAE1C,IAAI,SAAiB,CAAC;IACtB,IAAI,CAAC;QACH,SAAS,GAAG,MAAM,MAAM,CAAC,UAAU,CAAC,MAAM,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC,CAAC;IACrE,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,IAAI,kCAAkC,CAC1C,UAAU,EACV,8BAA8B,QAAQ,CAAC,UAAU,EAAE,EACnD,EAAE,KAAK,EAAE,CACV,CAAC;IACJ,CAAC;IACD,MAAM,MAAM,GAAG,EAAE,GAAG,QAAQ,EAAE,YAAY,EAAE,SAAS,EAA6B,CAAC;IACnF,IAAI,CAAC;QACH,MAAM,eAAe,GAAG,MAAM,sCAAsC,CAAC,MAAM,CAAC,CAAC;QAC7E,OAAO,MAAM,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,eAAe,EAAE,CAAC,CAAC;IAC9D,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,IAAI,kCAAkC,CAC1C,cAAc,EACd,sCAAsC,QAAQ,CAAC,UAAU,mBAAmB,EAC5E,EAAE,KAAK,EAAE,CACV,CAAC;IACJ,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
/** Who raised a fence. Named in every refusal and in every fence event. */
|
|
2
|
+
export type Rfc64LegacySwmFenceSourceV1 = 'finalized-vm-retirement' | 'republish-retirement' | 'receiver-lease';
|
|
3
|
+
export type Rfc64LegacySwmFenceScopeV1 = 'graph' | 'asset';
|
|
4
|
+
/**
|
|
5
|
+
* A fence that is worth a log line: one that gave up waiting for its turn
|
|
6
|
+
* (`wait-exceeded`, the retirement did not run) or one that ran but was up for
|
|
7
|
+
* longer than {@link RFC64_LEGACY_SWM_FENCE_LONG_MS} (`long-fence`).
|
|
8
|
+
*/
|
|
9
|
+
export interface Rfc64LegacySwmFenceEventV1 {
|
|
10
|
+
readonly kind: 'wait-exceeded' | 'long-fence';
|
|
11
|
+
readonly source: Rfc64LegacySwmFenceSourceV1;
|
|
12
|
+
readonly scope: Rfc64LegacySwmFenceScopeV1;
|
|
13
|
+
readonly contextGraphId: string;
|
|
14
|
+
readonly kaUal?: string;
|
|
15
|
+
readonly elapsedMs: number;
|
|
16
|
+
/** What a `wait-exceeded` fence was still waiting for. */
|
|
17
|
+
readonly waitingOn?: 'mutation-chain' | 'preparations';
|
|
18
|
+
/** In-flight preparations of the scope when a `wait-exceeded` fence gave up. */
|
|
19
|
+
readonly activePreparations?: number;
|
|
20
|
+
}
|
|
21
|
+
/** One log line for a fence event. */
|
|
22
|
+
export declare function describeRfc64LegacySwmFenceEventV1(event: Readonly<Rfc64LegacySwmFenceEventV1>): string;
|
|
23
|
+
/**
|
|
24
|
+
* How long a retirement or a lease waits for its turn on the mutation chain
|
|
25
|
+
* and for the in-flight preparations of its scope before it gives up and drops
|
|
26
|
+
* its fence. Below the promote queue's first retry (48 to 72 s), so a share
|
|
27
|
+
* refused by a fence that never gets its turn is admitted on that retry.
|
|
28
|
+
*/
|
|
29
|
+
export declare const RFC64_LEGACY_SWM_FENCE_WAIT_LIMIT_MS = 30000;
|
|
30
|
+
/** A fence that was up for longer than this is reported when it drops. */
|
|
31
|
+
export declare const RFC64_LEGACY_SWM_FENCE_LONG_MS = 5000;
|
|
32
|
+
export interface Rfc64LegacySwmFenceOptionsV1 {
|
|
33
|
+
readonly waitLimitMs?: number;
|
|
34
|
+
readonly longFenceMs?: number;
|
|
35
|
+
readonly now?: () => number;
|
|
36
|
+
readonly onFenceEvent?: (event: Readonly<Rfc64LegacySwmFenceEventV1>) => void;
|
|
37
|
+
}
|
|
38
|
+
interface Rfc64LegacySwmFenceHolderV1 {
|
|
39
|
+
readonly source: Rfc64LegacySwmFenceSourceV1;
|
|
40
|
+
readonly raisedAt: number;
|
|
41
|
+
}
|
|
42
|
+
interface Rfc64LegacySwmFenceScopeStateV1 {
|
|
43
|
+
activePreparations: number;
|
|
44
|
+
preparationsDrained: Promise<void>;
|
|
45
|
+
resolvePreparationsDrained: (() => void) | undefined;
|
|
46
|
+
/** The retirements and leases that fence this scope, oldest first. */
|
|
47
|
+
readonly holders: Rfc64LegacySwmFenceHolderV1[];
|
|
48
|
+
fenceDropped: Promise<void>;
|
|
49
|
+
resolveFenceDropped: (() => void) | undefined;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* The preparation fences of one legacy SWM boundary and the chain that
|
|
53
|
+
* serializes its retirements. A preparation registers under its context graph
|
|
54
|
+
* id and under its asset key; a retirement fences one of the two.
|
|
55
|
+
*/
|
|
56
|
+
export interface Rfc64LegacySwmFenceCoordinatorV1 {
|
|
57
|
+
readonly scopes: Map<string, Rfc64LegacySwmFenceScopeStateV1>;
|
|
58
|
+
mutationTail: Promise<void>;
|
|
59
|
+
readonly waitLimitMs: number;
|
|
60
|
+
readonly longFenceMs: number;
|
|
61
|
+
readonly now: () => number;
|
|
62
|
+
readonly onFenceEvent: ((event: Readonly<Rfc64LegacySwmFenceEventV1>) => void) | undefined;
|
|
63
|
+
}
|
|
64
|
+
export declare function createRfc64LegacySwmFenceCoordinatorV1(options?: Rfc64LegacySwmFenceOptionsV1): Rfc64LegacySwmFenceCoordinatorV1;
|
|
65
|
+
/**
|
|
66
|
+
* Refuse a preparation that meets a fence, the graph's or its asset's. The
|
|
67
|
+
* refusal names the oldest holder, so a log line that carries the message
|
|
68
|
+
* says which caller raised the fence and for how long it has been up.
|
|
69
|
+
*/
|
|
70
|
+
export declare function assertRfc64LegacySwmPreparationAdmittedV1(fence: Rfc64LegacySwmFenceCoordinatorV1, contextGraphId: string, kaUal: string): void;
|
|
71
|
+
/**
|
|
72
|
+
* Register one in-flight preparation on both of its scopes. The returned
|
|
73
|
+
* function releases both and must be called exactly once.
|
|
74
|
+
*/
|
|
75
|
+
export declare function beginRfc64LegacySwmPreparationV1(fence: Rfc64LegacySwmFenceCoordinatorV1, contextGraphId: string, kaUal: string): () => void;
|
|
76
|
+
/**
|
|
77
|
+
* Resolve once neither the graph nor the asset is fenced, or after `limitMs`.
|
|
78
|
+
* It registers nothing and promises nothing: a fence raised after it resolves
|
|
79
|
+
* still refuses the preparation. A seam that can wait calls it right before
|
|
80
|
+
* the synchronous prepare, so a fence that is up for milliseconds costs those
|
|
81
|
+
* milliseconds instead of a refused attempt and its retry delay.
|
|
82
|
+
*/
|
|
83
|
+
export declare function waitForRfc64LegacySwmPreparationAdmissionV1(fence: Rfc64LegacySwmFenceCoordinatorV1, contextGraphId: string, kaUal: string, limitMs: number): Promise<void>;
|
|
84
|
+
export type Rfc64LegacySwmRetirementOutcomeV1<T> = {
|
|
85
|
+
readonly ran: true;
|
|
86
|
+
readonly value: T;
|
|
87
|
+
} | {
|
|
88
|
+
readonly ran: false;
|
|
89
|
+
};
|
|
90
|
+
/**
|
|
91
|
+
* Run `work` behind a fence: raise it, take a turn on the mutation chain, wait
|
|
92
|
+
* for the scope's in-flight preparations, then run. The fence drops when the
|
|
93
|
+
* work settles, or earlier when the work calls `dropFence`.
|
|
94
|
+
*
|
|
95
|
+
* The two waits share one bound. A retirement that does not get to run within
|
|
96
|
+
* it drops its fence, reports `wait-exceeded` and answers `ran: false`; when
|
|
97
|
+
* its turn on the chain comes later it does nothing. Leaving the markers in
|
|
98
|
+
* place is the conservative state, and the next pass retires them. Without the
|
|
99
|
+
* bound one preparation that never settles would hold the chain, and through
|
|
100
|
+
* it the fence of every graph that tries to retire, for as long as it hangs.
|
|
101
|
+
*/
|
|
102
|
+
export declare function runRfc64LegacySwmRetirementV1<T>(fence: Rfc64LegacySwmFenceCoordinatorV1, target: Readonly<{
|
|
103
|
+
source: Rfc64LegacySwmFenceSourceV1;
|
|
104
|
+
contextGraphId: string;
|
|
105
|
+
/** Present for an asset fence; absent for the graph's. */
|
|
106
|
+
kaUal?: string;
|
|
107
|
+
}>, work: (dropFence: () => void) => Promise<T>): Promise<Rfc64LegacySwmRetirementOutcomeV1<T>>;
|
|
108
|
+
export {};
|
|
109
|
+
//# sourceMappingURL=legacy-swm-boundary-fence-v1.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"legacy-swm-boundary-fence-v1.d.ts","sourceRoot":"","sources":["../../src/rfc64/legacy-swm-boundary-fence-v1.ts"],"names":[],"mappings":"AAIA,2EAA2E;AAC3E,MAAM,MAAM,2BAA2B,GACnC,yBAAyB,GACzB,sBAAsB,GACtB,gBAAgB,CAAC;AAErB,MAAM,MAAM,0BAA0B,GAAG,OAAO,GAAG,OAAO,CAAC;AAE3D;;;;GAIG;AACH,MAAM,WAAW,0BAA0B;IACzC,QAAQ,CAAC,IAAI,EAAE,eAAe,GAAG,YAAY,CAAC;IAC9C,QAAQ,CAAC,MAAM,EAAE,2BAA2B,CAAC;IAC7C,QAAQ,CAAC,KAAK,EAAE,0BAA0B,CAAC;IAC3C,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,0DAA0D;IAC1D,QAAQ,CAAC,SAAS,CAAC,EAAE,gBAAgB,GAAG,cAAc,CAAC;IACvD,gFAAgF;IAChF,QAAQ,CAAC,kBAAkB,CAAC,EAAE,MAAM,CAAC;CACtC;AAED,sCAAsC;AACtC,wBAAgB,kCAAkC,CAChD,KAAK,EAAE,QAAQ,CAAC,0BAA0B,CAAC,GAC1C,MAAM,CAOR;AAED;;;;;GAKG;AACH,eAAO,MAAM,oCAAoC,QAAS,CAAC;AAE3D,0EAA0E;AAC1E,eAAO,MAAM,8BAA8B,OAAQ,CAAC;AAEpD,MAAM,WAAW,4BAA4B;IAC3C,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,GAAG,CAAC,EAAE,M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;;;GAGG;AACH,wBAAgB,gCAAgC,CAC9C,KAAK,EAAE,gCAAgC,EACvC,cAAc,EAAE,MAAM,EACtB,KAAK,EAAE,MAAM,GACZ,MAAM,IAAI,CAyBZ;AAED;;;;;;GAMG;AACH,wBAAsB,2CAA2C,CAC/D,KAAK,EAAE,gCAAgC,EACvC,cAAc,EAAE,MAAM,EACtB,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,IAAI,CAAC,CAmBf;AAED,MAAM,MAAM,iCAAiC,CAAC,CAAC,IAC3C;IAAE,QAAQ,CAAC,GAAG,EAAE,IAAI,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,CAAC,CAAA;CAAE,GACzC;IAAE,QAAQ,CAAC,GAAG,EAAE,KAAK,CAAA;CAAE,CAAC;AAE5B;;;;;;;;;;;GAWG;AACH,wBAAsB,6BAA6B,CAAC,CAAC,EACnD,KAAK,EAAE,gCAAgC,EACvC,MAAM,EAAE,QAAQ,CAAC;IACf,MAAM,EAAE,2BAA2B,CAAC;IACpC,cAAc,EAAE,MAAM,CAAC;IACvB,0DAA0D;IAC1D,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC,EACF,IAAI,EAAE,CAAC,SAAS,EAAE,MAAM,IAAI,KAAK,OAAO,CAAC,CAAC,CAAC,GAC1C,OAAO,CAAC,iCAAiC,CAAC,CAAC,CAAC,CAAC,CAoE/C"}
|
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
2
|
+
import { RFC64_LEGACY_SWM_BOUNDARY_RETIREMENT_IN_PROGRESS_CODE } from '@origintrail-official/dkg-core';
|
|
3
|
+
/** One log line for a fence event. */
|
|
4
|
+
export function describeRfc64LegacySwmFenceEventV1(event) {
|
|
5
|
+
const where = `${event.source} on the ${event.scope} of ${event.contextGraphId}`
|
|
6
|
+
+ (event.kaUal === undefined ? '' : ` (${event.kaUal})`);
|
|
7
|
+
return event.kind === 'wait-exceeded'
|
|
8
|
+
? `RFC-64 legacy SWM fence raised by ${where} gave up after ${event.elapsedMs} ms waiting on `
|
|
9
|
+
+ `${event.waitingOn} (${event.activePreparations} preparation(s) in flight); nothing was retired`
|
|
10
|
+
: `RFC-64 legacy SWM fence raised by ${where} was up for ${event.elapsedMs} ms`;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* How long a retirement or a lease waits for its turn on the mutation chain
|
|
14
|
+
* and for the in-flight preparations of its scope before it gives up and drops
|
|
15
|
+
* its fence. Below the promote queue's first retry (48 to 72 s), so a share
|
|
16
|
+
* refused by a fence that never gets its turn is admitted on that retry.
|
|
17
|
+
*/
|
|
18
|
+
export const RFC64_LEGACY_SWM_FENCE_WAIT_LIMIT_MS = 30_000;
|
|
19
|
+
/** A fence that was up for longer than this is reported when it drops. */
|
|
20
|
+
export const RFC64_LEGACY_SWM_FENCE_LONG_MS = 5_000;
|
|
21
|
+
export function createRfc64LegacySwmFenceCoordinatorV1(options = {}) {
|
|
22
|
+
return {
|
|
23
|
+
scopes: new Map(),
|
|
24
|
+
mutationTail: Promise.resolve(),
|
|
25
|
+
waitLimitMs: options.waitLimitMs ?? RFC64_LEGACY_SWM_FENCE_WAIT_LIMIT_MS,
|
|
26
|
+
longFenceMs: options.longFenceMs ?? RFC64_LEGACY_SWM_FENCE_LONG_MS,
|
|
27
|
+
now: options.now ?? (() => performance.now()),
|
|
28
|
+
onFenceEvent: options.onFenceEvent,
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* The finalized-VM retirement reads and deletes the markers of ONE asset, so it fences and drains that
|
|
33
|
+
* asset's scope, not the graph's: a share of another asset is neither refused by it nor waited for.
|
|
34
|
+
* '#' is outside the context graph id grammar, so an asset key can never alias a graph key. The receiver
|
|
35
|
+
* lease and the republish retirement keep the graph key.
|
|
36
|
+
*/
|
|
37
|
+
function rfc64LegacySwmAssetScopeKeyV1(contextGraphId, kaUal) {
|
|
38
|
+
return `${contextGraphId}#${kaUal}`;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Refuse a preparation that meets a fence, the graph's or its asset's. The
|
|
42
|
+
* refusal names the oldest holder, so a log line that carries the message
|
|
43
|
+
* says which caller raised the fence and for how long it has been up.
|
|
44
|
+
*/
|
|
45
|
+
export function assertRfc64LegacySwmPreparationAdmittedV1(fence, contextGraphId, kaUal) {
|
|
46
|
+
const graphHolder = fence.scopes.get(contextGraphId)?.holders[0];
|
|
47
|
+
const holder = graphHolder
|
|
48
|
+
?? fence.scopes.get(rfc64LegacySwmAssetScopeKeyV1(contextGraphId, kaUal))?.holders[0];
|
|
49
|
+
if (holder === undefined)
|
|
50
|
+
return;
|
|
51
|
+
const scope = graphHolder === undefined ? 'asset' : 'graph';
|
|
52
|
+
const ageMs = Math.max(0, Math.round(fence.now() - holder.raisedAt));
|
|
53
|
+
throw Object.assign(new Error('RFC-64 legacy SWM boundary retirement is in progress; retry promotion '
|
|
54
|
+
+ `(fence raised by ${holder.source} on the ${scope}, up ${ageMs} ms)`), {
|
|
55
|
+
code: RFC64_LEGACY_SWM_BOUNDARY_RETIREMENT_IN_PROGRESS_CODE,
|
|
56
|
+
fenceSource: holder.source,
|
|
57
|
+
fenceScope: scope,
|
|
58
|
+
fenceAgeMs: ageMs,
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Register one in-flight preparation on both of its scopes. The returned
|
|
63
|
+
* function releases both and must be called exactly once.
|
|
64
|
+
*/
|
|
65
|
+
export function beginRfc64LegacySwmPreparationV1(fence, contextGraphId, kaUal) {
|
|
66
|
+
const keys = [contextGraphId, rfc64LegacySwmAssetScopeKeyV1(contextGraphId, kaUal)];
|
|
67
|
+
const scopes = keys.map((key) => {
|
|
68
|
+
const scope = fenceScope(fence, key);
|
|
69
|
+
if (scope.activePreparations === 0) {
|
|
70
|
+
scope.preparationsDrained = new Promise((resolve) => {
|
|
71
|
+
scope.resolvePreparationsDrained = resolve;
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
scope.activePreparations += 1;
|
|
75
|
+
return scope;
|
|
76
|
+
});
|
|
77
|
+
return () => {
|
|
78
|
+
if (scopes.some((scope) => scope.activePreparations < 1)) {
|
|
79
|
+
throw new Error('RFC-64 legacy SWM boundary preparation settlement is unbalanced');
|
|
80
|
+
}
|
|
81
|
+
scopes.forEach((scope, index) => {
|
|
82
|
+
scope.activePreparations -= 1;
|
|
83
|
+
if (scope.activePreparations !== 0)
|
|
84
|
+
return;
|
|
85
|
+
const resolve = scope.resolvePreparationsDrained;
|
|
86
|
+
scope.resolvePreparationsDrained = undefined;
|
|
87
|
+
resolve?.();
|
|
88
|
+
cleanFenceScope(fence, keys[index], scope);
|
|
89
|
+
});
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Resolve once neither the graph nor the asset is fenced, or after `limitMs`.
|
|
94
|
+
* It registers nothing and promises nothing: a fence raised after it resolves
|
|
95
|
+
* still refuses the preparation. A seam that can wait calls it right before
|
|
96
|
+
* the synchronous prepare, so a fence that is up for milliseconds costs those
|
|
97
|
+
* milliseconds instead of a refused attempt and its retry delay.
|
|
98
|
+
*/
|
|
99
|
+
export async function waitForRfc64LegacySwmPreparationAdmissionV1(fence, contextGraphId, kaUal, limitMs) {
|
|
100
|
+
const keys = [contextGraphId, rfc64LegacySwmAssetScopeKeyV1(contextGraphId, kaUal)];
|
|
101
|
+
const deadline = fence.now() + limitMs;
|
|
102
|
+
for (;;) {
|
|
103
|
+
const fenced = keys
|
|
104
|
+
.map((key) => fence.scopes.get(key))
|
|
105
|
+
.filter((scope) => scope !== undefined && scope.holders.length > 0);
|
|
106
|
+
const remainingMs = deadline - fence.now();
|
|
107
|
+
if (fenced.length === 0 || remainingMs <= 0)
|
|
108
|
+
return;
|
|
109
|
+
let timer;
|
|
110
|
+
try {
|
|
111
|
+
await Promise.race([
|
|
112
|
+
new Promise((resolve) => { timer = setTimeout(resolve, remainingMs); }),
|
|
113
|
+
...fenced.map((scope) => scope.fenceDropped),
|
|
114
|
+
]);
|
|
115
|
+
}
|
|
116
|
+
finally {
|
|
117
|
+
clearTimeout(timer);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Run `work` behind a fence: raise it, take a turn on the mutation chain, wait
|
|
123
|
+
* for the scope's in-flight preparations, then run. The fence drops when the
|
|
124
|
+
* work settles, or earlier when the work calls `dropFence`.
|
|
125
|
+
*
|
|
126
|
+
* The two waits share one bound. A retirement that does not get to run within
|
|
127
|
+
* it drops its fence, reports `wait-exceeded` and answers `ran: false`; when
|
|
128
|
+
* its turn on the chain comes later it does nothing. Leaving the markers in
|
|
129
|
+
* place is the conservative state, and the next pass retires them. Without the
|
|
130
|
+
* bound one preparation that never settles would hold the chain, and through
|
|
131
|
+
* it the fence of every graph that tries to retire, for as long as it hangs.
|
|
132
|
+
*/
|
|
133
|
+
export async function runRfc64LegacySwmRetirementV1(fence, target, work) {
|
|
134
|
+
const scopeKey = target.kaUal === undefined
|
|
135
|
+
? target.contextGraphId
|
|
136
|
+
: rfc64LegacySwmAssetScopeKeyV1(target.contextGraphId, target.kaUal);
|
|
137
|
+
const scope = fenceScope(fence, scopeKey);
|
|
138
|
+
const holder = { source: target.source, raisedAt: fence.now() };
|
|
139
|
+
const describe = (kind) => ({
|
|
140
|
+
kind,
|
|
141
|
+
source: target.source,
|
|
142
|
+
scope: target.kaUal === undefined ? 'graph' : 'asset',
|
|
143
|
+
contextGraphId: target.contextGraphId,
|
|
144
|
+
...(target.kaUal === undefined ? {} : { kaUal: target.kaUal }),
|
|
145
|
+
elapsedMs: Math.max(0, Math.round(fence.now() - holder.raisedAt)),
|
|
146
|
+
});
|
|
147
|
+
if (scope.holders.length === 0) {
|
|
148
|
+
scope.fenceDropped = new Promise((resolve) => { scope.resolveFenceDropped = resolve; });
|
|
149
|
+
}
|
|
150
|
+
scope.holders.push(holder);
|
|
151
|
+
let waitingOn = 'mutation-chain';
|
|
152
|
+
let workStarted = false;
|
|
153
|
+
let gaveUp = false;
|
|
154
|
+
let dropped = false;
|
|
155
|
+
const dropFence = () => {
|
|
156
|
+
if (dropped)
|
|
157
|
+
return;
|
|
158
|
+
dropped = true;
|
|
159
|
+
scope.holders.splice(scope.holders.indexOf(holder), 1);
|
|
160
|
+
if (scope.holders.length === 0) {
|
|
161
|
+
const resolve = scope.resolveFenceDropped;
|
|
162
|
+
scope.resolveFenceDropped = undefined;
|
|
163
|
+
resolve?.();
|
|
164
|
+
}
|
|
165
|
+
cleanFenceScope(fence, scopeKey, scope);
|
|
166
|
+
const event = describe('long-fence');
|
|
167
|
+
if (!gaveUp && event.elapsedMs > fence.longFenceMs)
|
|
168
|
+
reportFenceEvent(fence, event);
|
|
169
|
+
};
|
|
170
|
+
let resolveAbandoned;
|
|
171
|
+
const abandoned = new Promise((resolve) => { resolveAbandoned = resolve; });
|
|
172
|
+
const timer = setTimeout(() => {
|
|
173
|
+
if (workStarted)
|
|
174
|
+
return;
|
|
175
|
+
gaveUp = true;
|
|
176
|
+
reportFenceEvent(fence, {
|
|
177
|
+
...describe('wait-exceeded'),
|
|
178
|
+
waitingOn,
|
|
179
|
+
activePreparations: scope.activePreparations,
|
|
180
|
+
});
|
|
181
|
+
dropFence();
|
|
182
|
+
resolveAbandoned();
|
|
183
|
+
}, fence.waitLimitMs);
|
|
184
|
+
timer.unref?.();
|
|
185
|
+
const notRun = { ran: false };
|
|
186
|
+
const turn = fence.mutationTail.then(async () => {
|
|
187
|
+
if (gaveUp)
|
|
188
|
+
return notRun;
|
|
189
|
+
waitingOn = 'preparations';
|
|
190
|
+
await Promise.race([scope.preparationsDrained, abandoned]);
|
|
191
|
+
if (gaveUp)
|
|
192
|
+
return notRun;
|
|
193
|
+
workStarted = true;
|
|
194
|
+
clearTimeout(timer);
|
|
195
|
+
return { ran: true, value: await work(dropFence) };
|
|
196
|
+
});
|
|
197
|
+
fence.mutationTail = turn.then(() => undefined, () => undefined);
|
|
198
|
+
try {
|
|
199
|
+
return await Promise.race([turn, abandoned.then(() => notRun)]);
|
|
200
|
+
}
|
|
201
|
+
finally {
|
|
202
|
+
clearTimeout(timer);
|
|
203
|
+
dropFence();
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
function reportFenceEvent(fence, event) {
|
|
207
|
+
try {
|
|
208
|
+
fence.onFenceEvent?.(Object.freeze(event));
|
|
209
|
+
}
|
|
210
|
+
catch {
|
|
211
|
+
// A failing observer must not change what the fence does.
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
function fenceScope(fence, scopeKey) {
|
|
215
|
+
const existing = fence.scopes.get(scopeKey);
|
|
216
|
+
if (existing !== undefined)
|
|
217
|
+
return existing;
|
|
218
|
+
const created = {
|
|
219
|
+
activePreparations: 0,
|
|
220
|
+
preparationsDrained: Promise.resolve(),
|
|
221
|
+
resolvePreparationsDrained: undefined,
|
|
222
|
+
holders: [],
|
|
223
|
+
fenceDropped: Promise.resolve(),
|
|
224
|
+
resolveFenceDropped: undefined,
|
|
225
|
+
};
|
|
226
|
+
fence.scopes.set(scopeKey, created);
|
|
227
|
+
return created;
|
|
228
|
+
}
|
|
229
|
+
function cleanFenceScope(fence, scopeKey, scope) {
|
|
230
|
+
if (scope.activePreparations === 0
|
|
231
|
+
&& scope.holders.length === 0
|
|
232
|
+
&& fence.scopes.get(scopeKey) === scope) {
|
|
233
|
+
fence.scopes.delete(scopeKey);
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
//# sourceMappingURL=legacy-swm-boundary-fence-v1.js.map
|