@prosopo/provider 0.2.13 → 0.2.15
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/api/admin.js +0 -56
- package/dist/api/admin.js.map +1 -1
- package/dist/api/captcha.d.ts +0 -6
- package/dist/api/captcha.d.ts.map +1 -1
- package/dist/api/captcha.js +24 -83
- package/dist/api/captcha.js.map +1 -1
- package/dist/batch/commitments.d.ts +2 -2
- package/dist/batch/commitments.d.ts.map +1 -1
- package/dist/batch/commitments.js +2 -20
- package/dist/batch/commitments.js.map +1 -1
- package/dist/batch/index.js +0 -13
- package/dist/batch/index.js.map +1 -1
- package/dist/cjs/api/captcha.cjs +23 -31
- package/dist/cjs/batch/commitments.cjs +12 -12
- package/dist/cjs/tasks/tasks.cjs +22 -21
- package/dist/cjs/util.cjs +9 -8
- package/dist/index.js +0 -13
- package/dist/index.js.map +1 -1
- package/dist/scheduler.js +0 -15
- package/dist/scheduler.js.map +1 -1
- package/dist/tasks/calculateSolutions.d.ts +0 -3
- package/dist/tasks/calculateSolutions.d.ts.map +1 -1
- package/dist/tasks/calculateSolutions.js +0 -27
- package/dist/tasks/calculateSolutions.js.map +1 -1
- package/dist/tasks/index.js +0 -13
- package/dist/tasks/index.js.map +1 -1
- package/dist/tasks/tasks.d.ts +3 -66
- package/dist/tasks/tasks.d.ts.map +1 -1
- package/dist/tasks/tasks.js +6 -87
- package/dist/tasks/tasks.js.map +1 -1
- package/dist/tests/accounts.d.ts.map +1 -1
- package/dist/tests/accounts.js +2 -16
- package/dist/tests/accounts.js.map +1 -1
- package/dist/tests/batch/commitments.test.d.ts.map +1 -1
- package/dist/tests/batch/commitments.test.js +12 -77
- package/dist/tests/batch/commitments.test.js.map +1 -1
- package/dist/tests/contract/helpers.test.d.ts.map +1 -1
- package/dist/tests/contract/helpers.test.js +3 -3
- package/dist/tests/contract/helpers.test.js.map +1 -1
- package/dist/tests/dataUtils/DatabaseAccounts.js +0 -1
- package/dist/tests/dataUtils/DatabaseAccounts.js.map +1 -1
- package/dist/tests/dataUtils/DatabasePopulator.d.ts +1 -1
- package/dist/tests/dataUtils/DatabasePopulator.d.ts.map +1 -1
- package/dist/tests/dataUtils/DatabasePopulator.js +10 -16
- package/dist/tests/dataUtils/DatabasePopulator.js.map +1 -1
- package/dist/tests/dataUtils/dapp-example-contract/loadFiles.d.ts +1 -1
- package/dist/tests/dataUtils/dapp-example-contract/loadFiles.d.ts.map +1 -1
- package/dist/tests/dataUtils/dapp-example-contract/loadFiles.js +3 -17
- package/dist/tests/dataUtils/dapp-example-contract/loadFiles.js.map +1 -1
- package/dist/tests/dataUtils/funds.d.ts +1 -16
- package/dist/tests/dataUtils/funds.d.ts.map +1 -1
- package/dist/tests/dataUtils/funds.js +2 -25
- package/dist/tests/dataUtils/funds.js.map +1 -1
- package/dist/tests/dataUtils/populateDatabase.d.ts +1 -1
- package/dist/tests/dataUtils/populateDatabase.d.ts.map +1 -1
- package/dist/tests/dataUtils/populateDatabase.js +0 -1
- package/dist/tests/dataUtils/populateDatabase.js.map +1 -1
- package/dist/tests/tasks/tasks.test.d.ts.map +1 -1
- package/dist/tests/tasks/tasks.test.js +15 -221
- package/dist/tests/tasks/tasks.test.js.map +1 -1
- package/dist/tests/util.test.js +0 -14
- package/dist/tests/util.test.js.map +1 -1
- package/dist/util.d.ts +0 -11
- package/dist/util.d.ts.map +1 -1
- package/dist/util.js +3 -33
- package/dist/util.js.map +1 -1
- package/package.json +10 -11
- package/dist/cjs/contracts/captcha/dist/build-extrinsic/captcha.cjs +0 -339
- package/dist/cjs/contracts/captcha/dist/contract-info/captcha.cjs +0 -6
- package/dist/cjs/contracts/captcha/dist/contracts/captcha.cjs +0 -79
- package/dist/cjs/contracts/captcha/dist/data/captcha.json.cjs +0 -3374
- package/dist/cjs/contracts/captcha/dist/event-data/captcha.json.cjs +0 -3
- package/dist/cjs/contracts/captcha/dist/events/captcha.cjs +0 -23
- package/dist/cjs/contracts/captcha/dist/index.cjs +0 -44
- package/dist/cjs/contracts/captcha/dist/mixed-methods/captcha.cjs +0 -470
- package/dist/cjs/contracts/captcha/dist/query/captcha.cjs +0 -468
- package/dist/cjs/contracts/captcha/dist/shared/utils.cjs +0 -31
- package/dist/cjs/contracts/captcha/dist/tx-sign-and-send/captcha.cjs +0 -426
- package/dist/cjs/contracts/captcha/dist/types-arguments/captcha.cjs +0 -62
- package/dist/tests/data/captchas.d.ts +0 -37
- package/dist/tests/data/captchas.d.ts.map +0 -1
- package/dist/tests/data/captchas.js +0 -902
- package/dist/tests/data/captchas.js.map +0 -1
- package/dist/tests/data/captchas1.json +0 -53
- package/dist/tests/data/captchas2.json +0 -69
- package/dist/tests/data/captchas3.json +0 -54
- package/dist/tests/data/captchas4.json +0 -53
package/dist/cjs/tasks/tasks.cjs
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const datasets = require("@prosopo/datasets");
|
|
4
|
-
require("
|
|
4
|
+
const typesReturns = require("@prosopo/captcha-contract/types-returns");
|
|
5
5
|
const common = require("@prosopo/common");
|
|
6
6
|
const contract = require("@prosopo/contract");
|
|
7
|
-
const util$
|
|
8
|
-
const
|
|
9
|
-
const
|
|
7
|
+
const util$1 = require("@prosopo/util");
|
|
8
|
+
const hex = require("@polkadot/util/hex");
|
|
9
|
+
const random = require("@polkadot/util-crypto/random");
|
|
10
10
|
const util = require("../util.cjs");
|
|
11
|
-
const
|
|
11
|
+
const signature = require("@polkadot/util-crypto/signature");
|
|
12
|
+
const string = require("@polkadot/util/string");
|
|
12
13
|
class Tasks {
|
|
13
14
|
constructor(env) {
|
|
14
15
|
if (!env.contractInterface) {
|
|
@@ -36,7 +37,7 @@ class Tasks {
|
|
|
36
37
|
if (datasetRaw.captchas.length < this.config.captchas.solved.count + this.config.captchas.unsolved.count) {
|
|
37
38
|
throw new common.ProsopoEnvError("DATASET.CAPTCHAS_COUNT_LESS_THAN_CONFIGURED", this.providerSetDataset.name);
|
|
38
39
|
}
|
|
39
|
-
const solutions = datasetRaw.captchas.map((
|
|
40
|
+
const solutions = datasetRaw.captchas.map((captcha) => captcha.solution ? 1 : 0).reduce((partialSum, b) => partialSum + b, 0);
|
|
40
41
|
if (solutions < this.config.captchas.solved.count) {
|
|
41
42
|
throw new common.ProsopoEnvError("DATASET.SOLUTIONS_COUNT_LESS_THAN_CONFIGURED", this.providerSetDataset.name);
|
|
42
43
|
}
|
|
@@ -68,15 +69,15 @@ class Tasks {
|
|
|
68
69
|
const captchaDocs = await this.db.getRandomCaptcha(solved, datasetId, size);
|
|
69
70
|
if (captchaDocs) {
|
|
70
71
|
const captchas = [];
|
|
71
|
-
for (const
|
|
72
|
+
for (const captcha of captchaDocs) {
|
|
72
73
|
const datasetDetails = await this.db.getDatasetDetails(datasetId);
|
|
73
74
|
const tree = new datasets.CaptchaMerkleTree();
|
|
74
75
|
if (datasetDetails.contentTree) {
|
|
75
76
|
tree.layers = datasetDetails.contentTree;
|
|
76
|
-
const proof = tree.proof(
|
|
77
|
-
delete
|
|
78
|
-
|
|
79
|
-
captchas.push({ captcha
|
|
77
|
+
const proof = tree.proof(captcha.captchaContentId);
|
|
78
|
+
delete captcha.solution;
|
|
79
|
+
captcha.items = util.shuffleArray(captcha.items);
|
|
80
|
+
captchas.push({ captcha, proof });
|
|
80
81
|
}
|
|
81
82
|
}
|
|
82
83
|
return captchas;
|
|
@@ -97,11 +98,11 @@ class Tasks {
|
|
|
97
98
|
* @param {string} signature
|
|
98
99
|
* @return {Promise<DappUserSolutionResult>} result containing the contract event
|
|
99
100
|
*/
|
|
100
|
-
async dappUserSolution(userAccount, dappAccount, requestHash, captchas, signature) {
|
|
101
|
+
async dappUserSolution(userAccount, dappAccount, requestHash, captchas, signature$1) {
|
|
101
102
|
if (!await this.dappIsActive(dappAccount)) {
|
|
102
103
|
throw new common.ProsopoEnvError("CONTRACT.DAPP_NOT_ACTIVE", this.getPaymentInfo.name, {}, { dappAccount });
|
|
103
104
|
}
|
|
104
|
-
const verification =
|
|
105
|
+
const verification = signature.signatureVerify(string.stringToHex(requestHash), signature$1, userAccount);
|
|
105
106
|
if (!verification.isValid) {
|
|
106
107
|
throw new common.ProsopoEnvError("GENERAL.INVALID_SIGNATURE", this.dappUserSolution.name, {}, { userAccount });
|
|
107
108
|
}
|
|
@@ -119,7 +120,7 @@ class Tasks {
|
|
|
119
120
|
userAccount,
|
|
120
121
|
captchaIds
|
|
121
122
|
);
|
|
122
|
-
const userSignature =
|
|
123
|
+
const userSignature = hex.hexToU8a(signature$1);
|
|
123
124
|
const blockNumber = (await contract.getBlockNumber(this.contract.api)).toNumber();
|
|
124
125
|
if (pendingRequest) {
|
|
125
126
|
const commit = {
|
|
@@ -128,7 +129,7 @@ class Tasks {
|
|
|
128
129
|
dappContract: dappAccount,
|
|
129
130
|
providerAccount: this.contract.pair.address,
|
|
130
131
|
datasetId: provider.datasetId.toString(),
|
|
131
|
-
status:
|
|
132
|
+
status: typesReturns.CaptchaStatus.pending,
|
|
132
133
|
userSignature: Array.from(userSignature),
|
|
133
134
|
requestedAt: pendingRecord.requestedAtBlock,
|
|
134
135
|
// TODO is this correct or should it be block number?
|
|
@@ -185,7 +186,7 @@ class Tasks {
|
|
|
185
186
|
*/
|
|
186
187
|
async validateReceivedCaptchasAgainstStoredCaptchas(captchas) {
|
|
187
188
|
const receivedCaptchas = datasets.parseAndSortCaptchaSolutions(captchas);
|
|
188
|
-
const captchaIds = receivedCaptchas.map((
|
|
189
|
+
const captchaIds = receivedCaptchas.map((captcha) => captcha.captchaId);
|
|
189
190
|
const storedCaptchas = await this.db.getCaptchaById(captchaIds);
|
|
190
191
|
if (!storedCaptchas || receivedCaptchas.length !== storedCaptchas.length) {
|
|
191
192
|
throw new common.ProsopoEnvError(
|
|
@@ -195,7 +196,7 @@ class Tasks {
|
|
|
195
196
|
captchas
|
|
196
197
|
);
|
|
197
198
|
}
|
|
198
|
-
if (!storedCaptchas.every((
|
|
199
|
+
if (!storedCaptchas.every((captcha) => captcha.datasetId === util$1.at(storedCaptchas, 0).datasetId)) {
|
|
199
200
|
throw new common.ProsopoEnvError(
|
|
200
201
|
"CAPTCHA.DIFFERENT_DATASET_IDS",
|
|
201
202
|
this.validateReceivedCaptchasAgainstStoredCaptchas.name,
|
|
@@ -213,7 +214,7 @@ class Tasks {
|
|
|
213
214
|
async buildTreeAndGetCommitmentId(captchaSolutions) {
|
|
214
215
|
var _a;
|
|
215
216
|
const tree = new datasets.CaptchaMerkleTree();
|
|
216
|
-
const solutionsHashed = captchaSolutions.map((
|
|
217
|
+
const solutionsHashed = captchaSolutions.map((captcha) => datasets.computeCaptchaSolutionHash(captcha));
|
|
217
218
|
tree.build(solutionsHashed);
|
|
218
219
|
const commitmentId = (_a = tree.root) == null ? void 0 : _a.hash;
|
|
219
220
|
if (!commitmentId) {
|
|
@@ -266,14 +267,14 @@ class Tasks {
|
|
|
266
267
|
unsolved = await this.getCaptchaWithProof(datasetId, false, unsolvedCount);
|
|
267
268
|
}
|
|
268
269
|
const captchas = util.shuffleArray([...solved, ...unsolved]);
|
|
269
|
-
const salt =
|
|
270
|
+
const salt = random.randomAsHex();
|
|
270
271
|
const requestHash = datasets.computePendingRequestHash(
|
|
271
272
|
captchas.map((c) => c.captcha.captchaId),
|
|
272
273
|
userAccount,
|
|
273
274
|
salt
|
|
274
275
|
);
|
|
275
276
|
const currentTime = Date.now();
|
|
276
|
-
const timeLimit = captchas.map((
|
|
277
|
+
const timeLimit = captchas.map((captcha) => captcha.captcha.timeLimitMs || 3e4).reduce((a, b) => a + b, 0);
|
|
277
278
|
const deadlineTs = timeLimit + currentTime;
|
|
278
279
|
const currentBlockNumber = await contract.getBlockNumber(this.contract.api);
|
|
279
280
|
await this.db.storeDappUserPending(userAccount, requestHash, salt, deadlineTs, currentBlockNumber.toNumber());
|
|
@@ -381,7 +382,7 @@ class Tasks {
|
|
|
381
382
|
const dappUserSolutions = await this.db.getDappUserCommitmentByAccount(userAccount);
|
|
382
383
|
if (dappUserSolutions.length > 0) {
|
|
383
384
|
for (const dappUserSolution of dappUserSolutions) {
|
|
384
|
-
if (dappUserSolution.status ===
|
|
385
|
+
if (dappUserSolution.status === typesReturns.CaptchaStatus.approved) {
|
|
385
386
|
return dappUserSolution;
|
|
386
387
|
}
|
|
387
388
|
}
|
package/dist/cjs/util.cjs
CHANGED
|
@@ -2,22 +2,23 @@
|
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const types = require("@prosopo/types");
|
|
4
4
|
const common = require("@prosopo/common");
|
|
5
|
-
const util
|
|
6
|
-
const
|
|
7
|
-
const
|
|
5
|
+
const util = require("@prosopo/util");
|
|
6
|
+
const address = require("@polkadot/util-crypto/address");
|
|
7
|
+
const hex = require("@polkadot/util/hex");
|
|
8
|
+
const is = require("@polkadot/util/is");
|
|
8
9
|
const pl = require("nodejs-polars");
|
|
9
|
-
function encodeStringAddress(address) {
|
|
10
|
+
function encodeStringAddress(address$1) {
|
|
10
11
|
try {
|
|
11
|
-
return
|
|
12
|
+
return address.encodeAddress(is.isHex(address$1) ? hex.hexToU8a(address$1) : address.decodeAddress(address$1));
|
|
12
13
|
} catch (error) {
|
|
13
|
-
throw new common.ProsopoEnvError(error, "CONTRACT.INVALID_ADDRESS", {}, address);
|
|
14
|
+
throw new common.ProsopoEnvError(error, "CONTRACT.INVALID_ADDRESS", {}, address$1);
|
|
14
15
|
}
|
|
15
16
|
}
|
|
16
17
|
function shuffleArray(array) {
|
|
17
18
|
for (let arrayIndex = array.length - 1; arrayIndex > 0; arrayIndex--) {
|
|
18
19
|
const randIndex = Math.floor(Math.random() * (arrayIndex + 1));
|
|
19
|
-
const tmp = util
|
|
20
|
-
array[randIndex] = util
|
|
20
|
+
const tmp = util.at(array, randIndex, { optional: true });
|
|
21
|
+
array[randIndex] = util.at(array, arrayIndex, { optional: true });
|
|
21
22
|
array[arrayIndex] = tmp;
|
|
22
23
|
}
|
|
23
24
|
return array;
|
package/dist/index.js
CHANGED
|
@@ -1,16 +1,3 @@
|
|
|
1
|
-
// Copyright 2021-2023 Prosopo (UK) Ltd.
|
|
2
|
-
//
|
|
3
|
-
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
-
// you may not use this file except in compliance with the License.
|
|
5
|
-
// You may obtain a copy of the License at
|
|
6
|
-
//
|
|
7
|
-
// http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
-
//
|
|
9
|
-
// Unless required by applicable law or agreed to in writing, software
|
|
10
|
-
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
-
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
-
// See the License for the specific language governing permissions and
|
|
13
|
-
// limitations under the License.
|
|
14
1
|
export * from './tasks/index.js';
|
|
15
2
|
export * from './util.js';
|
|
16
3
|
export * from './batch/index.js';
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAaA,cAAc,kBAAkB,CAAA;AAChC,cAAc,WAAW,CAAA;AACzB,cAAc,kBAAkB,CAAA;AAChC,cAAc,kBAAkB,CAAA"}
|
package/dist/scheduler.js
CHANGED
|
@@ -1,18 +1,3 @@
|
|
|
1
|
-
// Copyright 2021-2022 Prosopo (UK) Ltd.
|
|
2
|
-
//
|
|
3
|
-
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
-
// you may not use this file except in compliance with the License.
|
|
5
|
-
// You may obtain a copy of the License at
|
|
6
|
-
//
|
|
7
|
-
// http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
-
//
|
|
9
|
-
// Unless required by applicable law or agreed to in writing, software
|
|
10
|
-
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
-
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
-
// See the License for the specific language governing permissions and
|
|
13
|
-
// limitations under the License.
|
|
14
|
-
// [object Object]
|
|
15
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
16
1
|
import { BatchCommitmentsTask } from './batch/commitments.js';
|
|
17
2
|
import { CalculateSolutionsTask } from './tasks/calculateSolutions.js';
|
|
18
3
|
import { CronJob } from 'cron';
|
package/dist/scheduler.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scheduler.js","sourceRoot":"","sources":["../src/scheduler.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"scheduler.js","sourceRoot":"","sources":["../src/scheduler.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAA;AAC7D,OAAO,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAA;AACtE,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAA;AAG9B,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AACjD,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAA;AAClD,OAAO,EAAE,EAAE,EAAE,MAAM,eAAe,CAAA;AAElC,MAAM,CAAC,KAAK,UAAU,2BAA2B,CAAC,IAAiB,EAAE,MAA2B;IAC5F,MAAM,GAAG,GAAG,IAAI,mBAAmB,CAAC,MAAM,EAAE,IAAI,CAAC,CAAA;IACjD,MAAM,GAAG,CAAC,OAAO,EAAE,CAAA;IACnB,MAAM,KAAK,GAAG,IAAI,sBAAsB,CAAC,GAAG,CAAC,CAAA;IAC7C,MAAM,GAAG,GAAG,IAAI,OAAO,CAAC,EAAE,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC,EAAE,GAAG,EAAE;QAC9C,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,4BAA4B,CAAC,CAAA;QAC9C,KAAK,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;YACtB,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;QACzB,CAAC,CAAC,CAAA;IACN,CAAC,CAAC,CAAA;IAEF,GAAG,CAAC,KAAK,EAAE,CAAA;AACf,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,oBAAoB,CAAC,IAAiB,EAAE,MAA2B;IACrF,MAAM,GAAG,GAAG,IAAI,mBAAmB,CAAC,MAAM,EAAE,IAAI,CAAC,CAAA;IACjD,MAAM,GAAG,CAAC,OAAO,EAAE,CAAA;IACnB,IAAI,GAAG,CAAC,EAAE,KAAK,SAAS,EAAE;QACtB,MAAM,IAAI,eAAe,CAAC,6BAA6B,CAAC,CAAA;KAC3D;IAED,MAAM,KAAK,GAAG,IAAI,oBAAoB,CAAC,MAAM,CAAC,WAAW,EAAE,GAAG,CAAC,oBAAoB,EAAE,EAAE,GAAG,CAAC,EAAE,EAAE,EAAE,EAAE,GAAG,CAAC,MAAM,CAAC,CAAA;IAC9G,MAAM,GAAG,GAAG,IAAI,OAAO,CAAC,EAAE,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC,EAAE,GAAG,EAAE;QAC9C,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,0BAA0B,CAAC,CAAA;QAC5C,KAAK,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;YACtB,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;QACzB,CAAC,CAAC,CAAA;IACN,CAAC,CAAC,CAAA;IAEF,GAAG,CAAC,KAAK,EAAE,CAAA;AACf,CAAC"}
|
|
@@ -2,9 +2,6 @@ import { ProviderEnvironment } from '@prosopo/types-env';
|
|
|
2
2
|
import { Tasks } from './tasks.js';
|
|
3
3
|
export declare class CalculateSolutionsTask extends Tasks {
|
|
4
4
|
constructor(env: ProviderEnvironment);
|
|
5
|
-
/**
|
|
6
|
-
* Apply new captcha solutions to captcha dataset and recalculate merkle tree
|
|
7
|
-
*/
|
|
8
5
|
run(): Promise<number>;
|
|
9
6
|
}
|
|
10
7
|
//# sourceMappingURL=calculateSolutions.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"calculateSolutions.d.ts","sourceRoot":"","sources":["../../src/tasks/calculateSolutions.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAA;AAExD,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AAGlC,qBAAa,sBAAuB,SAAQ,KAAK;gBACjC,GAAG,EAAE,mBAAmB;
|
|
1
|
+
{"version":3,"file":"calculateSolutions.d.ts","sourceRoot":"","sources":["../../src/tasks/calculateSolutions.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAA;AAExD,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AAGlC,qBAAa,sBAAuB,SAAQ,KAAK;gBACjC,GAAG,EAAE,mBAAmB;IAQ9B,GAAG,IAAI,OAAO,CAAC,MAAM,CAAC;CAqE/B"}
|
|
@@ -1,16 +1,3 @@
|
|
|
1
|
-
// Copyright 2021-2023 Prosopo (UK) Ltd.
|
|
2
|
-
//
|
|
3
|
-
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
-
// you may not use this file except in compliance with the License.
|
|
5
|
-
// You may obtain a copy of the License at
|
|
6
|
-
//
|
|
7
|
-
// http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
-
//
|
|
9
|
-
// Unless required by applicable law or agreed to in writing, software
|
|
10
|
-
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
-
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
-
// See the License for the specific language governing permissions and
|
|
13
|
-
// limitations under the License.
|
|
14
1
|
import { CaptchaStates } from '@prosopo/types';
|
|
15
2
|
import { ProsopoEnvError, getLogger } from '@prosopo/common';
|
|
16
3
|
import { ScheduledTaskNames } from '@prosopo/types';
|
|
@@ -22,27 +9,19 @@ export class CalculateSolutionsTask extends Tasks {
|
|
|
22
9
|
super(env);
|
|
23
10
|
this.logger = getLogger(env.config.logLevel, 'CalculateSolutionsTask');
|
|
24
11
|
}
|
|
25
|
-
/**
|
|
26
|
-
* Apply new captcha solutions to captcha dataset and recalculate merkle tree
|
|
27
|
-
*/
|
|
28
12
|
async run() {
|
|
29
13
|
try {
|
|
30
14
|
const taskRunning = await checkIfTaskIsRunning(ScheduledTaskNames.CalculateSolution, this.db);
|
|
31
15
|
if (!taskRunning) {
|
|
32
|
-
// Get the current datasetId from the contract
|
|
33
16
|
const provider = (await this.contract.methods.getProvider(this.contract.pair.address, {})).value
|
|
34
17
|
.unwrap()
|
|
35
18
|
.unwrap();
|
|
36
|
-
// Get any unsolved CAPTCHA challenges from the database for this datasetId
|
|
37
19
|
const unsolvedCaptchas = await this.db.getAllCaptchasByDatasetId(provider.datasetId.toString(), CaptchaStates.Unsolved);
|
|
38
|
-
// edge case when a captcha dataset contains no unsolved CAPTCHA challenges
|
|
39
20
|
if (!unsolvedCaptchas) {
|
|
40
21
|
return 0;
|
|
41
22
|
}
|
|
42
|
-
// Sort the unsolved CAPTCHA challenges by their captchaId
|
|
43
23
|
const unsolvedSorted = unsolvedCaptchas.sort(captchaSort);
|
|
44
24
|
this.logger.info(`There are ${unsolvedSorted.length} unsolved CAPTCHA challenges`);
|
|
45
|
-
// Get the solution configuration from the config file
|
|
46
25
|
const requiredNumberOfSolutions = this.captchaSolutionConfig.requiredNumberOfSolutions;
|
|
47
26
|
const winningPercentage = this.captchaSolutionConfig.solutionWinningPercentage;
|
|
48
27
|
const winningNumberOfSolutions = Math.round(requiredNumberOfSolutions * (winningPercentage / 100));
|
|
@@ -53,20 +32,15 @@ export class CalculateSolutionsTask extends Tasks {
|
|
|
53
32
|
if (solutionsToUpdate.rows().length > 0) {
|
|
54
33
|
this.logger.info(`There are ${solutionsToUpdate.rows().length} CAPTCHA challenges to update with solutions`);
|
|
55
34
|
try {
|
|
56
|
-
// TODO polars doesn't have the captchaId field in the type
|
|
57
35
|
const captchaIdsToUpdate = [...solutionsToUpdate['captchaId'].values()];
|
|
58
36
|
const commitmentIds = solutions
|
|
59
37
|
.filter((s) => captchaIdsToUpdate.indexOf(s.captchaId) > -1)
|
|
60
38
|
.map((s) => s.commitmentId);
|
|
61
39
|
const dataset = await this.db.getDataset(provider.datasetId.toString());
|
|
62
40
|
dataset.captchas = updateSolutions(solutionsToUpdate, dataset.captchas, this.logger);
|
|
63
|
-
// store new solutions in database
|
|
64
41
|
await this.providerSetDataset(dataset);
|
|
65
|
-
// mark user solutions as used to calculate new solutions
|
|
66
42
|
await this.db.flagProcessedDappUserSolutions(captchaIdsToUpdate);
|
|
67
|
-
// mark user commitments as used to calculate new solutions
|
|
68
43
|
await this.db.flagProcessedDappUserCommitments(commitmentIds);
|
|
69
|
-
// remove old captcha challenges from database
|
|
70
44
|
await this.db.removeCaptchas(captchaIdsToUpdate);
|
|
71
45
|
return solutionsToUpdate.rows().length;
|
|
72
46
|
}
|
|
@@ -84,7 +58,6 @@ export class CalculateSolutionsTask extends Tasks {
|
|
|
84
58
|
return 0;
|
|
85
59
|
}
|
|
86
60
|
catch (error) {
|
|
87
|
-
// TODO fix error handling
|
|
88
61
|
throw new ProsopoEnvError(error, 'GENERAL.CALCULATE_CAPTCHA_SOLUTION');
|
|
89
62
|
}
|
|
90
63
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"calculateSolutions.js","sourceRoot":"","sources":["../../src/tasks/calculateSolutions.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"calculateSolutions.js","sourceRoot":"","sources":["../../src/tasks/calculateSolutions.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAA;AAC9C,OAAO,EAAE,eAAe,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,EAAE,CAAC,CAAA;4BACvE,OAAO,CAAC,QAAQ,GAAG,eAAe,CAAC,iBAAiB,EAAE,OAAO,CAAC,QAAQ,EAAE,IAAI,CAAC,MAAM,CAAC,CAAA;4BAEpF,MAAM,IAAI,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAAA;4BAEtC,MAAM,IAAI,CAAC,EAAE,CAAC,8BAA8B,CAAC,kBAAkB,CAAC,CAAA;4BAEhE,MAAM,IAAI,CAAC,EAAE,CAAC,gCAAgC,CAAC,aAAa,CAAC,CAAA;4BAE7D,MAAM,IAAI,CAAC,EAAE,CAAC,cAAc,CAAC,kBAAkB,CAAC,CAAA;4BAChD,OAAO,iBAAiB,CAAC,IAAI,EAAE,CAAC,MAAM,CAAA;yBACzC;wBAAC,OAAO,KAAK,EAAE;4BACZ,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAA;yBAC3B;qBACJ;oBACD,OAAO,CAAC,CAAA;iBACX;qBAAM;oBACH,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,4EAA4E,CAAC,CAAA;oBAC9F,OAAO,CAAC,CAAA;iBACX;aACJ;YACD,OAAO,CAAC,CAAA;SACX;QAAC,OAAO,KAAK,EAAE;YAEZ,MAAM,IAAI,eAAe,CAAC,KAAc,EAAE,oCAAoC,CAAC,CAAA;SAClF;IACL,CAAC;CACJ"}
|
package/dist/tasks/index.js
CHANGED
|
@@ -1,16 +1,3 @@
|
|
|
1
|
-
// Copyright 2021-2023 Prosopo (UK) Ltd.
|
|
2
|
-
//
|
|
3
|
-
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
-
// you may not use this file except in compliance with the License.
|
|
5
|
-
// You may obtain a copy of the License at
|
|
6
|
-
//
|
|
7
|
-
// http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
-
//
|
|
9
|
-
// Unless required by applicable law or agreed to in writing, software
|
|
10
|
-
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
-
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
-
// See the License for the specific language governing permissions and
|
|
13
|
-
// limitations under the License.
|
|
14
1
|
export * from './tasks.js';
|
|
15
2
|
export * from './calculateSolutions.js';
|
|
16
3
|
//# sourceMappingURL=index.js.map
|
package/dist/tasks/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/tasks/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/tasks/index.ts"],"names":[],"mappings":"AAaA,cAAc,YAAY,CAAA;AAC1B,cAAc,yBAAyB,CAAA"}
|
package/dist/tasks/tasks.d.ts
CHANGED
|
@@ -1,16 +1,13 @@
|
|
|
1
1
|
import { Header } from '@polkadot/types/interfaces';
|
|
2
2
|
import { Captcha, CaptchaConfig, CaptchaSolution, CaptchaSolutionConfig, CaptchaWithProof, DappUserSolutionResult, DatasetRaw, DatasetWithIds, Hash, PendingCaptchaRequest, ProsopoConfigOutput, ProviderRegistered } from '@prosopo/types';
|
|
3
3
|
import { CaptchaMerkleTree } from '@prosopo/datasets';
|
|
4
|
-
import { Provider } from '@prosopo/captcha-contract';
|
|
5
|
-
import { ContractPromise } from '@polkadot/api-contract';
|
|
4
|
+
import { Provider } from '@prosopo/captcha-contract/types-returns';
|
|
5
|
+
import { ContractPromise } from '@polkadot/api-contract/promise';
|
|
6
6
|
import { Database, UserCommitmentRecord } from '@prosopo/types-database';
|
|
7
7
|
import { Logger } from '@prosopo/common';
|
|
8
8
|
import { ProsopoCaptchaContract } from '@prosopo/contract';
|
|
9
9
|
import { ProviderEnvironment } from '@prosopo/types-env';
|
|
10
|
-
import { SubmittableResult } from '@polkadot/api';
|
|
11
|
-
/**
|
|
12
|
-
* @description Tasks that are shared by the API and CLI
|
|
13
|
-
*/
|
|
10
|
+
import { SubmittableResult } from '@polkadot/api/submittable';
|
|
14
11
|
export declare class Tasks {
|
|
15
12
|
contract: ProsopoCaptchaContract;
|
|
16
13
|
db: Database;
|
|
@@ -21,90 +18,30 @@ export declare class Tasks {
|
|
|
21
18
|
constructor(env: ProviderEnvironment);
|
|
22
19
|
providerSetDatasetFromFile(file: JSON): Promise<SubmittableResult | undefined>;
|
|
23
20
|
providerSetDataset(datasetRaw: DatasetRaw): Promise<SubmittableResult | undefined>;
|
|
24
|
-
/**
|
|
25
|
-
* @description Get random captchas that are solved or not solved, along with the merkle proof for each
|
|
26
|
-
* @param {string} datasetId the id of the data set
|
|
27
|
-
* @param {boolean} solved `true` when captcha is solved
|
|
28
|
-
* @param {number} size the number of records to be returned
|
|
29
|
-
*/
|
|
30
21
|
getCaptchaWithProof(datasetId: Hash, solved: boolean, size: number): Promise<CaptchaWithProof[]>;
|
|
31
|
-
/**
|
|
32
|
-
* Validate and store the text captcha solution(s) from the Dapp User in a web2 environment
|
|
33
|
-
* @param {string} userAccount
|
|
34
|
-
* @param {string} dappAccount
|
|
35
|
-
* @param {string} requestHash
|
|
36
|
-
* @param {JSON} captchas
|
|
37
|
-
* @param {string} signature
|
|
38
|
-
* @return {Promise<DappUserSolutionResult>} result containing the contract event
|
|
39
|
-
*/
|
|
40
22
|
dappUserSolution(userAccount: string, dappAccount: string, requestHash: string, captchas: CaptchaSolution[], signature: string): Promise<DappUserSolutionResult>;
|
|
41
|
-
/**
|
|
42
|
-
* Validate that the dapp is active in the contract
|
|
43
|
-
*/
|
|
44
23
|
dappIsActive(dappAccount: string): Promise<boolean>;
|
|
45
|
-
/**
|
|
46
|
-
* Gets provider status in contract
|
|
47
|
-
*/
|
|
48
24
|
providerStatus(): Promise<ProviderRegistered>;
|
|
49
|
-
/**
|
|
50
|
-
* Validate length of received captchas array matches length of captchas found in database
|
|
51
|
-
* Validate that the datasetId is the same for all captchas and is equal to the datasetId on the stored captchas
|
|
52
|
-
*/
|
|
53
25
|
validateReceivedCaptchasAgainstStoredCaptchas(captchas: CaptchaSolution[]): Promise<{
|
|
54
26
|
storedCaptchas: Captcha[];
|
|
55
27
|
receivedCaptchas: CaptchaSolution[];
|
|
56
28
|
captchaIds: string[];
|
|
57
29
|
}>;
|
|
58
|
-
/**
|
|
59
|
-
* Build merkle tree and get commitment from contract, returning the tree, commitment, and commitmentId
|
|
60
|
-
* @param {CaptchaSolution[]} captchaSolutions
|
|
61
|
-
* @returns {Promise<{ tree: CaptchaMerkleTree, commitment: CaptchaSolutionCommitment, commitmentId: string }>}
|
|
62
|
-
*/
|
|
63
30
|
buildTreeAndGetCommitmentId(captchaSolutions: CaptchaSolution[]): Promise<{
|
|
64
31
|
tree: CaptchaMerkleTree;
|
|
65
32
|
commitmentId: string;
|
|
66
33
|
}>;
|
|
67
|
-
/**
|
|
68
|
-
* Validate that a Dapp User is responding to their own pending captcha request
|
|
69
|
-
* @param {string} requestHash
|
|
70
|
-
* @param {PendingCaptchaRequest} pendingRecord
|
|
71
|
-
* @param {string} userAccount
|
|
72
|
-
* @param {string[]} captchaIds
|
|
73
|
-
*/
|
|
74
34
|
validateDappUserSolutionRequestIsPending(requestHash: string, pendingRecord: PendingCaptchaRequest, userAccount: string, captchaIds: string[]): Promise<boolean>;
|
|
75
|
-
/**
|
|
76
|
-
* Get two random captchas from specified dataset, create the response and store a hash of it, marked as pending
|
|
77
|
-
* @param {string} datasetId
|
|
78
|
-
* @param {string} userAccount
|
|
79
|
-
*/
|
|
80
35
|
getRandomCaptchasAndRequestHash(datasetId: string, userAccount: string): Promise<{
|
|
81
36
|
captchas: CaptchaWithProof[];
|
|
82
37
|
requestHash: string;
|
|
83
38
|
}>;
|
|
84
|
-
/**
|
|
85
|
-
* Block by block search for blockNo
|
|
86
|
-
*/
|
|
87
39
|
isRecentBlock(contract: ContractPromise, header: Header, blockNo: number, depth?: number): Promise<boolean>;
|
|
88
|
-
/**
|
|
89
|
-
* Validate that provided `datasetId` was a result of calling `get_random_provider` method
|
|
90
|
-
* @param {string} userAccount - Same user that called `get_random_provider`
|
|
91
|
-
* @param {string} dappContractAccount - account of dapp that is requesting captcha
|
|
92
|
-
* @param {string} datasetId - `captcha_dataset_id` from the result of `get_random_provider`
|
|
93
|
-
* @param {string} blockNumber - Block on which `get_random_provider` was called
|
|
94
|
-
*/
|
|
95
40
|
validateProviderWasRandomlyChosen(userAccount: string, dappContractAccount: string, datasetId: string | Hash, blockNumber: number): Promise<void>;
|
|
96
|
-
/**
|
|
97
|
-
* Get payment info for a transaction
|
|
98
|
-
* @param {string} userAccount
|
|
99
|
-
* @param {string} blockHash
|
|
100
|
-
* @param {string} txHash
|
|
101
|
-
* @returns {Promise<RuntimeDispatchInfo|null>}
|
|
102
|
-
*/
|
|
103
41
|
private getPaymentInfo;
|
|
104
42
|
getDappUserCommitmentById(commitmentId: string): Promise<UserCommitmentRecord>;
|
|
105
43
|
getDappUserCommitmentByAccount(userAccount: string): Promise<UserCommitmentRecord | undefined>;
|
|
106
44
|
getProviderDetails(): Promise<Provider>;
|
|
107
|
-
/** Get the dataset from the databse */
|
|
108
45
|
getProviderDataset(datasetId: string): Promise<DatasetWithIds>;
|
|
109
46
|
}
|
|
110
47
|
//# sourceMappingURL=tasks.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tasks.d.ts","sourceRoot":"","sources":["../../src/tasks/tasks.ts"],"names":[],"mappings":"AAaA,OAAO,EAAa,MAAM,EAAsC,MAAM,4BAA4B,CAAA;AAClG,OAAO,EACH,OAAO,EACP,aAAa,EACb,eAAe,EACf,qBAAqB,EACrB,gBAAgB,EAChB,sBAAsB,EAEtB,UAAU,EACV,cAAc,EACd,IAAI,EACJ,qBAAqB,EACrB,mBAAmB,EACnB,kBAAkB,EACrB,MAAM,gBAAgB,CAAA;AACvB,OAAO,EACH,iBAAiB,EAOpB,MAAM,mBAAmB,CAAA;AAC1B,OAAO,EAAuB,QAAQ,EAAkB,MAAM,
|
|
1
|
+
{"version":3,"file":"tasks.d.ts","sourceRoot":"","sources":["../../src/tasks/tasks.ts"],"names":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