@obolnetwork/obol-sdk 2.12.2 → 2.12.4
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/browser/src/index.js +70 -11
- package/dist/browser/src/index.js.map +1 -1
- package/dist/cjs/src/index.js +71 -11
- package/dist/cjs/src/index.js.map +1 -1
- package/dist/cjs/src/verification/clusterLockValidationWorker.js +38 -7
- package/dist/cjs/src/verification/clusterLockValidationWorker.js.map +1 -1
- package/dist/cjs/src/verification/parallelPool.js +25 -5
- package/dist/cjs/src/verification/parallelPool.js.map +1 -1
- package/dist/esm/src/{chunk-YSXFCSVK.js → chunk-FGMJVLIN.js} +37 -6
- package/dist/esm/src/chunk-FGMJVLIN.js.map +1 -0
- package/dist/esm/src/{chunk-T74RX3N2.js → chunk-YZWJJHPO.js} +8 -4
- package/dist/esm/src/chunk-YZWJJHPO.js.map +1 -0
- package/dist/esm/src/index.js +33 -6
- package/dist/esm/src/index.js.map +1 -1
- package/dist/esm/src/verification/clusterLockValidationWorker.js +9 -3
- package/dist/esm/src/verification/clusterLockValidationWorker.js.map +1 -1
- package/dist/esm/src/verification/parallelPool.js +1 -1
- package/dist/types/src/errors.d.ts +17 -7
- package/dist/types/src/index.d.ts +1 -1
- package/dist/types/src/services.d.ts +6 -3
- package/dist/types/src/verification/parallelPool.d.ts +4 -0
- package/dist/types/src/verification/validationConcurrency.d.ts +11 -0
- package/dist/types/tsconfig.types.tsbuildinfo +1 -1
- package/package.json +2 -2
- package/dist/esm/src/chunk-T74RX3N2.js.map +0 -1
- package/dist/esm/src/chunk-YSXFCSVK.js.map +0 -1
- package/dist/types/test/client/ajv.spec.d.ts +0 -1
- package/dist/types/test/client/baseUrl.spec.d.ts +0 -1
- package/dist/types/test/client/methods.spec.d.ts +0 -18
- package/dist/types/test/eoa/eoa.spec.d.ts +0 -1
- package/dist/types/test/exit/ethUtils.spec.d.ts +0 -1
- package/dist/types/test/exit/exit.spec.d.ts +0 -1
- package/dist/types/test/exit/verificationHelpers.spec.d.ts +0 -1
- package/dist/types/test/fixtures.d.ts +0 -359
- package/dist/types/test/incentives/incentives.spec.d.ts +0 -1
- package/dist/types/test/splits/splits.spec.d.ts +0 -1
- package/dist/types/test/verification/parallelPool.spec.d.ts +0 -1
|
@@ -107,6 +107,22 @@ var __yieldStar = (value) => {
|
|
|
107
107
|
// src/verification/clusterLockValidationWorker.ts
|
|
108
108
|
var import_node_worker_threads = require("worker_threads");
|
|
109
109
|
|
|
110
|
+
// src/errors.ts
|
|
111
|
+
var ClusterLockValidationTimeoutError = class _ClusterLockValidationTimeoutError extends Error {
|
|
112
|
+
/**
|
|
113
|
+
* @param timeoutMs - Worker deadline that was exceeded (`VALIDATION_WORKER_TIMEOUT_MS`
|
|
114
|
+
* for the whole-lock worker, `WORKER_TIMEOUT_MS` for per-chunk BLS workers).
|
|
115
|
+
*/
|
|
116
|
+
constructor(timeoutMs) {
|
|
117
|
+
super(
|
|
118
|
+
`Cluster lock validation exceeded worker time limit (${timeoutMs} ms). Retry later; this does not imply invalid lock data.`
|
|
119
|
+
);
|
|
120
|
+
this.timeoutMs = timeoutMs;
|
|
121
|
+
this.name = "ClusterLockValidationTimeoutError";
|
|
122
|
+
Object.setPrototypeOf(this, _ClusterLockValidationTimeoutError.prototype);
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
|
|
110
126
|
// src/verification/common.ts
|
|
111
127
|
var import_ssz7 = require("@chainsafe/ssz");
|
|
112
128
|
var import_elliptic = __toESM(require("elliptic"));
|
|
@@ -138,7 +154,7 @@ var import_ethers = require("ethers");
|
|
|
138
154
|
// package.json
|
|
139
155
|
var package_default = {
|
|
140
156
|
name: "@obolnetwork/obol-sdk",
|
|
141
|
-
version: "2.12.
|
|
157
|
+
version: "2.12.4",
|
|
142
158
|
description: "A package for creating Distributed Validators using the Obol API.",
|
|
143
159
|
bugs: {
|
|
144
160
|
url: "https://github.com/obolnetwork/obol-sdk/issues"
|
|
@@ -153,7 +169,7 @@ var package_default = {
|
|
|
153
169
|
"build:clean": "rm -rf ./dist",
|
|
154
170
|
build: "npm-run-all build:clean build:tsup",
|
|
155
171
|
"build:tsup": "tsup && tsc -b ./tsconfig.types.json",
|
|
156
|
-
test: "NODE_OPTIONS=--experimental-vm-modules jest test/**/**.spec.ts --testPathIgnorePatterns=test/sdk-package/",
|
|
172
|
+
test: "NODE_OPTIONS=--experimental-vm-modules OBOL_SDK_MAX_CONCURRENT_LOCK_VALIDATIONS=0 jest test/**/**.spec.ts --testPathIgnorePatterns=test/sdk-package/",
|
|
157
173
|
"generate-typedoc": "typedoc",
|
|
158
174
|
"npm:publish": "npm publish --tag latest",
|
|
159
175
|
"npm:publish:next": "npm publish --tag next",
|
|
@@ -4954,7 +4970,7 @@ function verifySharesSync(shares, distributedKeys, threshold) {
|
|
|
4954
4970
|
}
|
|
4955
4971
|
function runWorkerAggregatePubkeys(wt, workerFile, data) {
|
|
4956
4972
|
return __async(this, null, function* () {
|
|
4957
|
-
return yield new Promise((resolve) => {
|
|
4973
|
+
return yield new Promise((resolve, reject) => {
|
|
4958
4974
|
let settled = false;
|
|
4959
4975
|
const worker = new wt.Worker(workerFile, { workerData: data });
|
|
4960
4976
|
const finish = (result) => {
|
|
@@ -4965,7 +4981,11 @@ function runWorkerAggregatePubkeys(wt, workerFile, data) {
|
|
|
4965
4981
|
resolve(result);
|
|
4966
4982
|
};
|
|
4967
4983
|
const timer = setTimeout(() => {
|
|
4968
|
-
|
|
4984
|
+
if (settled) return;
|
|
4985
|
+
settled = true;
|
|
4986
|
+
clearTimeout(timer);
|
|
4987
|
+
worker.terminate();
|
|
4988
|
+
reject(new ClusterLockValidationTimeoutError(WORKER_TIMEOUT_MS));
|
|
4969
4989
|
}, WORKER_TIMEOUT_MS);
|
|
4970
4990
|
worker.once("message", (msg) => {
|
|
4971
4991
|
finish(msg instanceof Uint8Array ? msg : null);
|
|
@@ -4981,7 +5001,7 @@ function runWorkerAggregatePubkeys(wt, workerFile, data) {
|
|
|
4981
5001
|
}
|
|
4982
5002
|
function runWorker(wt, workerFile, data) {
|
|
4983
5003
|
return __async(this, null, function* () {
|
|
4984
|
-
return yield new Promise((resolve) => {
|
|
5004
|
+
return yield new Promise((resolve, reject) => {
|
|
4985
5005
|
let settled = false;
|
|
4986
5006
|
const worker = new wt.Worker(workerFile, { workerData: data });
|
|
4987
5007
|
const finish = (result) => {
|
|
@@ -4992,7 +5012,11 @@ function runWorker(wt, workerFile, data) {
|
|
|
4992
5012
|
resolve(result);
|
|
4993
5013
|
};
|
|
4994
5014
|
const timer = setTimeout(() => {
|
|
4995
|
-
|
|
5015
|
+
if (settled) return;
|
|
5016
|
+
settled = true;
|
|
5017
|
+
clearTimeout(timer);
|
|
5018
|
+
worker.terminate();
|
|
5019
|
+
reject(new ClusterLockValidationTimeoutError(WORKER_TIMEOUT_MS));
|
|
4996
5020
|
}, WORKER_TIMEOUT_MS);
|
|
4997
5021
|
worker.once("message", (msg) => {
|
|
4998
5022
|
finish(msg === true);
|
|
@@ -14653,6 +14677,9 @@ var isValidClusterLock = (clusterLock, safeRpcUrl) => __async(null, null, functi
|
|
|
14653
14677
|
}
|
|
14654
14678
|
return true;
|
|
14655
14679
|
} catch (err) {
|
|
14680
|
+
if (err instanceof ClusterLockValidationTimeoutError) {
|
|
14681
|
+
throw err;
|
|
14682
|
+
}
|
|
14656
14683
|
return false;
|
|
14657
14684
|
}
|
|
14658
14685
|
});
|
|
@@ -14663,7 +14690,11 @@ if (import_node_worker_threads.parentPort) {
|
|
|
14663
14690
|
const port = import_node_worker_threads.parentPort;
|
|
14664
14691
|
void isValidClusterLock(input.lock, input.safeRpcUrl).then((ok) => {
|
|
14665
14692
|
port.postMessage(ok);
|
|
14666
|
-
}).catch(() => {
|
|
14693
|
+
}).catch((err) => {
|
|
14694
|
+
if (err instanceof ClusterLockValidationTimeoutError) {
|
|
14695
|
+
port.postMessage({ validationTimeoutMs: err.timeoutMs });
|
|
14696
|
+
return;
|
|
14697
|
+
}
|
|
14667
14698
|
port.postMessage(false);
|
|
14668
14699
|
});
|
|
14669
14700
|
}
|