@ocap/tx-pipeline 1.20.1 → 1.20.3
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/README.md +1 -1
- package/lib/index.js +0 -2
- package/lib/pipes/verify-signature.js +1 -1
- package/package.json +21 -19
- package/lib/pipes/verify-gas-payer.js +0 -30
package/README.md
CHANGED
package/lib/index.js
CHANGED
@@ -24,7 +24,6 @@ const VerifyTxInput = require('./pipes/verify-tx-input');
|
|
24
24
|
const VerifyUpdater = require('./pipes/verify-updater');
|
25
25
|
const VerifyTokenBalance = require('./pipes/verify-token-balance');
|
26
26
|
const VerifyStateDiff = require('./pipes/verify-state-diff');
|
27
|
-
const VerifyGasPayer = require('./pipes/verify-gas-payer');
|
28
27
|
const TakeStateSnapshot = require('./pipes/take-state-snapshot');
|
29
28
|
|
30
29
|
module.exports = {
|
@@ -55,7 +54,6 @@ module.exports = {
|
|
55
54
|
VerifyTxInput,
|
56
55
|
VerifyTokenBalance,
|
57
56
|
VerifyStateDiff,
|
58
|
-
VerifyGasPayer,
|
59
57
|
TakeStateSnapshot,
|
60
58
|
},
|
61
59
|
};
|
@@ -35,7 +35,7 @@ module.exports = async function VerifySignature(context, next) {
|
|
35
35
|
return next(new Error('INVALID_SIGNATURE', 'tx.signature is invalid'));
|
36
36
|
}
|
37
37
|
} catch (err) {
|
38
|
-
console.error(err);
|
38
|
+
console.error('tx.signature verify failed', err);
|
39
39
|
return next(new Error('INVALID_SIGNATURE', 'tx.signature verify failed'));
|
40
40
|
}
|
41
41
|
|
package/package.json
CHANGED
@@ -3,20 +3,12 @@
|
|
3
3
|
"publishConfig": {
|
4
4
|
"access": "public"
|
5
5
|
},
|
6
|
-
"version": "1.20.
|
6
|
+
"version": "1.20.3",
|
7
7
|
"description": "Pipeline runner and common pipelines to process transactions",
|
8
8
|
"main": "lib/index.js",
|
9
9
|
"files": [
|
10
10
|
"lib"
|
11
11
|
],
|
12
|
-
"scripts": {
|
13
|
-
"lint": "eslint tests lib",
|
14
|
-
"lint:fix": "eslint --fix tests lib",
|
15
|
-
"start": "node tools/start-chain.js",
|
16
|
-
"test": "jest --forceExit --detectOpenHandles",
|
17
|
-
"test:ci": "jest --forceExit --detectOpenHandles --coverage",
|
18
|
-
"coverage": "start-server-and-test start http://127.0.0.1:4002 test:ci"
|
19
|
-
},
|
20
12
|
"keywords": [],
|
21
13
|
"author": "wangshijun <wangshijun2010@gmail.com> (http://github.com/wangshijun)",
|
22
14
|
"license": "MIT",
|
@@ -29,16 +21,26 @@
|
|
29
21
|
"elliptic": "6.5.3"
|
30
22
|
},
|
31
23
|
"dependencies": {
|
32
|
-
"@arcblock/did": "1.20.1",
|
33
|
-
"@arcblock/did-util": "1.20.1",
|
34
|
-
"@ocap/mcrypto": "1.20.1",
|
35
|
-
"@ocap/message": "1.20.1",
|
36
|
-
"@ocap/state": "1.20.1",
|
37
|
-
"@ocap/util": "1.20.1",
|
38
|
-
"@ocap/wallet": "1.20.1",
|
39
24
|
"debug": "^4.3.6",
|
40
25
|
"empty-value": "^1.0.1",
|
41
|
-
"lodash": "^4.17.21"
|
26
|
+
"lodash": "^4.17.21",
|
27
|
+
"@arcblock/did": "1.20.3",
|
28
|
+
"@ocap/mcrypto": "1.20.3",
|
29
|
+
"@ocap/message": "1.20.3",
|
30
|
+
"@arcblock/did-util": "1.20.3",
|
31
|
+
"@ocap/util": "1.20.3",
|
32
|
+
"@ocap/state": "1.20.3",
|
33
|
+
"@ocap/wallet": "1.20.3",
|
34
|
+
"@ocap/client": "1.20.3",
|
35
|
+
"@ocap/statedb-memory": "1.20.3",
|
36
|
+
"@ocap/e2e-test": "1.20.3"
|
42
37
|
},
|
43
|
-
"
|
44
|
-
|
38
|
+
"scripts": {
|
39
|
+
"lint": "eslint tests lib",
|
40
|
+
"lint:fix": "eslint --fix tests lib",
|
41
|
+
"start": "node tools/start-chain.js",
|
42
|
+
"test": "jest --forceExit --detectOpenHandles",
|
43
|
+
"test:ci": "jest --forceExit --detectOpenHandles --coverage",
|
44
|
+
"coverage": "start-server-and-test start http://127.0.0.1:4003 test:ci"
|
45
|
+
}
|
46
|
+
}
|
@@ -1,30 +0,0 @@
|
|
1
|
-
/* eslint-disable no-restricted-syntax */
|
2
|
-
const get = require('lodash/get');
|
3
|
-
const { CustomError: Error } = require('@ocap/util/lib/error');
|
4
|
-
const { BN } = require('@ocap/util');
|
5
|
-
|
6
|
-
module.exports = function CreateVerifyGasPayerPipe({ gasPayer = 'senderState' } = {}) {
|
7
|
-
return function VerifyGasPayer(context, next) {
|
8
|
-
// From ensureTxCost
|
9
|
-
// Pass if someone has staked for this tx
|
10
|
-
const { gasStake } = context;
|
11
|
-
if (gasStake?.valid) {
|
12
|
-
return next();
|
13
|
-
}
|
14
|
-
|
15
|
-
// From ensureTxCost
|
16
|
-
// Pass if gas is free
|
17
|
-
const { gasVaultChange } = context;
|
18
|
-
if (!gasVaultChange || new BN(gasVaultChange.value ?? 0).isZero()) {
|
19
|
-
return next();
|
20
|
-
}
|
21
|
-
|
22
|
-
// Pass if payer on chain
|
23
|
-
const gasPayerState = get(context, gasPayer);
|
24
|
-
if (gasPayerState) {
|
25
|
-
return next();
|
26
|
-
}
|
27
|
-
|
28
|
-
return next(new Error('INVALID_GAS_PAYER', 'Gas payer does not exist on chain'));
|
29
|
-
};
|
30
|
-
};
|