@ocap/tx-protocols 1.18.166 → 1.19.1
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/lib/execute.js +1 -0
- package/lib/pipes/ensure-gas.js +1 -1
- package/lib/protocols/asset/calls/transfer-token.js +1 -1
- package/lib/protocols/asset/calls/transfer.js +1 -1
- package/lib/protocols/asset/update.js +1 -1
- package/lib/protocols/governance/stake.js +1 -1
- package/lib/protocols/rollup/claim-reward.js +1 -1
- package/lib/protocols/rollup/pipes/verify-evidence.js +3 -2
- package/package.json +14 -14
package/lib/execute.js
CHANGED
package/lib/pipes/ensure-gas.js
CHANGED
|
@@ -10,7 +10,7 @@ const debug = require('debug')(`${require('../../package.json').name}:pipes:ensu
|
|
|
10
10
|
// - update: state updating ops
|
|
11
11
|
// - payment: sender payment amount of the gas token
|
|
12
12
|
module.exports = function CreateGasEnsureFn(estimateTxGas) {
|
|
13
|
-
return
|
|
13
|
+
return function EnsureTxGas(context, next) {
|
|
14
14
|
const { txHash, config } = context;
|
|
15
15
|
|
|
16
16
|
// total gas in native token
|
|
@@ -9,7 +9,7 @@ const runner = new Runner();
|
|
|
9
9
|
|
|
10
10
|
runner.use(pipes.ExtractState({ from: 'args.to', to: 'receiverState', status: 'INVALID_RECEIVER_STATE' }));
|
|
11
11
|
|
|
12
|
-
runner.use(
|
|
12
|
+
runner.use((context, next) => {
|
|
13
13
|
const { states, receiverState, args } = context;
|
|
14
14
|
const { tokenAddress, amount } = args;
|
|
15
15
|
|
|
@@ -8,7 +8,7 @@ const runner = new Runner();
|
|
|
8
8
|
|
|
9
9
|
runner.use(pipes.ExtractState({ from: 'args.to', to: 'receiverState', status: 'INVALID_RECEIVER_STATE' }));
|
|
10
10
|
|
|
11
|
-
runner.use(
|
|
11
|
+
runner.use((context, next) => {
|
|
12
12
|
const { states, receiverState, args } = context;
|
|
13
13
|
|
|
14
14
|
const old = new BN(receiverState.balance);
|
|
@@ -65,7 +65,7 @@ runner.use(
|
|
|
65
65
|
);
|
|
66
66
|
|
|
67
67
|
// Ensure we are in append-only mode update proposed by issuer
|
|
68
|
-
runner.use(
|
|
68
|
+
runner.use((context, next) => {
|
|
69
69
|
const { itx, newData, senderState, assetState, issuerState } = context;
|
|
70
70
|
if (issuerState && senderState.address === issuerState.address) {
|
|
71
71
|
if (itx.moniker !== assetState.moniker) {
|
|
@@ -114,7 +114,7 @@ runner.use(pipes.ExtractState({ from: 'itx.slashersList', to: 'slasherStates', s
|
|
|
114
114
|
runner.use(pipes.VerifyAccountMigration({ stateKey: 'slasherStates', addressKey: 'itx.slashersList' }));
|
|
115
115
|
|
|
116
116
|
// 8. handle tx gas stakes
|
|
117
|
-
runner.use(
|
|
117
|
+
runner.use((context, next) => {
|
|
118
118
|
const { tx, itx, inputs, config } = context;
|
|
119
119
|
const { token, transaction } = config;
|
|
120
120
|
const { minStake, maxStake } = transaction.txGas;
|
|
@@ -104,7 +104,7 @@ runner.use(pipes.ExtractState({ from: 'rollupState.tokenAddress', to: 'tokenStat
|
|
|
104
104
|
|
|
105
105
|
// 8. split and aggregate block reward for each tx and the block
|
|
106
106
|
runner.use(pipes.ExtractState({ from: 'blockState.txs', to: 'txs', status: 'INVALID_TX', table: 'tx' }));
|
|
107
|
-
runner.use(
|
|
107
|
+
runner.use((context, next) => {
|
|
108
108
|
const { itx, txs, rollupState, blockState, lockerState, tokenState, stakeState } = context;
|
|
109
109
|
const { proposerFeeShare, publisherFeeShare } = rollupState;
|
|
110
110
|
|
|
@@ -9,7 +9,7 @@ module.exports = function CreateVerifyEvidencePipe({ evidenceKey, signaturesKey,
|
|
|
9
9
|
throw new Error(`Invalid verify method: ${verifyMethod}, supported methods are: verify, ethVerify`);
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
return (context, next) => {
|
|
12
|
+
return async (context, next) => {
|
|
13
13
|
const evidence = get(context, evidenceKey);
|
|
14
14
|
const signatures = get(context, signaturesKey);
|
|
15
15
|
|
|
@@ -22,7 +22,8 @@ module.exports = function CreateVerifyEvidencePipe({ evidenceKey, signaturesKey,
|
|
|
22
22
|
const wallet = fromPublicKey(pk, toTypeInfo(address));
|
|
23
23
|
|
|
24
24
|
try {
|
|
25
|
-
|
|
25
|
+
// eslint-disable-next-line no-await-in-loop
|
|
26
|
+
if ((await wallet[verifyMethod](toHex(evidence), toHex(signature))) === false) {
|
|
26
27
|
return next(new Error('INVALID_SIGNATURE', `Signature for evidence from ${address} is not valid`));
|
|
27
28
|
}
|
|
28
29
|
} catch (err) {
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "1.
|
|
6
|
+
"version": "1.19.1",
|
|
7
7
|
"description": "Predefined tx pipeline sets to execute certain type of transactions",
|
|
8
8
|
"main": "lib/index.js",
|
|
9
9
|
"files": [
|
|
@@ -21,18 +21,18 @@
|
|
|
21
21
|
"author": "wangshijun <wangshijun2010@gmail.com> (http://github.com/wangshijun)",
|
|
22
22
|
"license": "MIT",
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@arcblock/did": "1.
|
|
25
|
-
"@arcblock/did-util": "1.
|
|
26
|
-
"@arcblock/jwt": "1.
|
|
27
|
-
"@arcblock/validator": "1.
|
|
28
|
-
"@ocap/asset": "1.
|
|
29
|
-
"@ocap/mcrypto": "1.
|
|
30
|
-
"@ocap/merkle-tree": "1.
|
|
31
|
-
"@ocap/message": "1.
|
|
32
|
-
"@ocap/state": "1.
|
|
33
|
-
"@ocap/tx-pipeline": "1.
|
|
34
|
-
"@ocap/util": "1.
|
|
35
|
-
"@ocap/wallet": "1.
|
|
24
|
+
"@arcblock/did": "1.19.1",
|
|
25
|
+
"@arcblock/did-util": "1.19.1",
|
|
26
|
+
"@arcblock/jwt": "1.19.1",
|
|
27
|
+
"@arcblock/validator": "1.19.1",
|
|
28
|
+
"@ocap/asset": "1.19.1",
|
|
29
|
+
"@ocap/mcrypto": "1.19.1",
|
|
30
|
+
"@ocap/merkle-tree": "1.19.1",
|
|
31
|
+
"@ocap/message": "1.19.1",
|
|
32
|
+
"@ocap/state": "1.19.1",
|
|
33
|
+
"@ocap/tx-pipeline": "1.19.1",
|
|
34
|
+
"@ocap/util": "1.19.1",
|
|
35
|
+
"@ocap/wallet": "1.19.1",
|
|
36
36
|
"debug": "^4.3.6",
|
|
37
37
|
"deep-diff": "^1.0.2",
|
|
38
38
|
"empty-value": "^1.0.1",
|
|
@@ -47,5 +47,5 @@
|
|
|
47
47
|
"jest": "^29.7.0",
|
|
48
48
|
"start-server-and-test": "^1.14.0"
|
|
49
49
|
},
|
|
50
|
-
"gitHead": "
|
|
50
|
+
"gitHead": "21184488172c6c824ebd1714f728ff2aee4a3ac0"
|
|
51
51
|
}
|