@ocap/tx-protocols 1.18.131 → 1.18.133

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 CHANGED
@@ -30,7 +30,7 @@ module.exports = ({ filter, runAsLambda }) => {
30
30
  // pipeline before executing the transaction
31
31
  const pre = new Runner();
32
32
  pre.use(pipes.DecodeTx);
33
- pre.use(pipes.VerifyBlocked(filter));
33
+ pre.use(pipes.VerifyBlocked({ filter, stateKeys: ['tx.from'] }));
34
34
  pre.use(pipes.DecodeItx);
35
35
  pre.use(pipes.VerifyTx);
36
36
  pre.use(pipes.VerifyServiceFee);
@@ -127,7 +127,7 @@ module.exports = ({ filter, runAsLambda }) => {
127
127
  try {
128
128
  await runAsLambda((txn) => {
129
129
  // create a new context each time in case we are retrying
130
- ctx = pick(context, ['txBase64', 'statedb', 'indexdb', 'config', 'states', 'extra']);
130
+ ctx = pick(context, ['txBase64', 'statedb', 'indexdb', 'config', 'states', 'filter', 'extra']);
131
131
  Object.defineProperty(ctx, 'txn', { value: txn });
132
132
  return execute(ctx, protocols, true);
133
133
  });
@@ -99,6 +99,7 @@ runner.use(pipes.VerifyAccountMigration({ stateKey: 'senderState', addressKey: '
99
99
 
100
100
  // Ensure receiver exist and not migrated
101
101
  runner.use(pipes.ExtractState({ from: 'itx.to', to: 'receiverState', status: 'OK', table: 'account' }));
102
+ runner.use(pipes.VerifyBlocked({ stateKeys: ['receiverState'] }));
102
103
  runner.use(pipes.VerifyAccountMigration({ stateKey: 'receiverState', addressKey: 'itx.to' }));
103
104
 
104
105
  // Ensure sender and receiver are not the same
@@ -110,6 +110,7 @@ runner.use(pipes.ExtractState({ from: 'tokenAddress', to: 'tokenStates', status:
110
110
  runner.use(verifyMintLimit);
111
111
  runner.use(verifyItxVariables);
112
112
  runner.use(verifyItxAddress('acquire-v2'));
113
+ runner.use(pipes.VerifyBlocked({ stateKeys: ['assetOwner'] }));
113
114
  runner.use(async (context, next) => {
114
115
  const { factoryTokens, senderState } = context;
115
116
  const condition = {
@@ -137,6 +137,7 @@ runner.use(pipes.ExtractState({ from: 'tx.from', to: 'senderState', status: 'OK'
137
137
  runner.use(pipes.ExtractState({ from: 'senders', to: 'signerStates', status: 'INVALID_SIGNER_STATE', table: 'account' })); // prettier-ignore
138
138
  runner.use(pipes.ExtractState({ from: 'itx.owner', to: 'ownerState', status: 'OK', table: 'account' }));
139
139
  runner.use(pipes.VerifyAccountMigration({ signerKey: 'signerStates', stateKey: 'senderState', addressKey: 'tx.from' }));
140
+ runner.use(pipes.VerifyBlocked({ stateKeys: ['signerStates', 'ownerState'] }));
140
141
 
141
142
  // 6. verify token state and balance
142
143
  runner.use(pipes.ExtractState({ from: 'tokens', to: 'tokenStates', status: 'INVALID_TOKEN', table: 'token' }));
@@ -61,6 +61,7 @@ runner.use(pipes.ExtractState({ from: 'factoryState.owner', to: 'factoryOwnerSta
61
61
  runner.use(pipes.ExtractState({ from: 'factoryState.trustedIssuers', to: 'issuerStates', status: 'INVALID_ISSUER_STATE' , table: 'account'})); // prettier-ignore
62
62
 
63
63
  runner.use(pipes.ExtractState({ from: 'itx.owner', to: 'ownerState', status: 'OK', table: 'account' }));
64
+ runner.use(pipes.VerifyBlocked({ stateKeys: ['ownerState'] }));
64
65
  runner.use(
65
66
  pipes.VerifyInfo([
66
67
  {
@@ -57,6 +57,7 @@ runner.use(pipes.VerifyListSize({ listKey: ['outputs', 'receivers', 'tokens', 'a
57
57
  // 4. verify sender & receiver
58
58
  runner.use(pipes.ExtractState({ from: 'tx.from', to: 'senderState', status: 'INVALID_SENDER_STATE', table: 'account' })); // prettier-ignore
59
59
  runner.use(pipes.ExtractState({ from: 'receivers', to: 'receiverStates', status: 'INVALID_RECEIVER_STATE', table: 'account' })); // prettier-ignore
60
+ runner.use(pipes.VerifyBlocked({ stateKeys: ['receiverStates'] }));
60
61
  runner.use(pipes.VerifyAccountMigration({ stateKey: 'senderState', addressKey: 'tx.from' }));
61
62
 
62
63
  // 5. verify stake state
@@ -56,6 +56,7 @@ runner.use(pipes.VerifyListSize({ listKey: ['outputs', 'receivers', 'tokens', 'a
56
56
  // 4. verify sender & receiver
57
57
  runner.use(pipes.ExtractState({ from: 'tx.from', to: 'senderState', status: 'INVALID_SENDER_STATE', table: 'account' })); // prettier-ignore
58
58
  runner.use(pipes.ExtractState({ from: 'receivers', to: 'receiverStates', status: 'INVALID_RECEIVER_STATE', table: 'account' })); // prettier-ignore
59
+ runner.use(pipes.VerifyBlocked({ stateKeys: ['receiverStates'] }));
59
60
  runner.use(pipes.VerifyAccountMigration({ stateKey: 'senderState', addressKey: 'tx.from' }));
60
61
 
61
62
  // 5. verify stake state
@@ -57,6 +57,7 @@ runner.use(pipes.VerifyListSize({ listKey: ['outputs', 'receivers', 'tokens', 'a
57
57
  // 4. verify sender & receiver
58
58
  runner.use(pipes.ExtractState({ from: 'tx.from', to: 'senderState', status: 'INVALID_SENDER_STATE', table: 'account' })); // prettier-ignore
59
59
  runner.use(pipes.ExtractState({ from: 'receivers', to: 'receiverStates', status: 'INVALID_RECEIVER_STATE', table: 'account' })); // prettier-ignore
60
+ runner.use(pipes.VerifyBlocked({ stateKeys: ['receiverStates'] }));
60
61
  runner.use(pipes.VerifyAccountMigration({ stateKey: 'senderState', addressKey: 'tx.from' }));
61
62
 
62
63
  // 5. verify stake state
@@ -81,6 +81,7 @@ runner.use(pipes.ExtractState({ from: 'tx.from', to: 'senderState', status: 'OK'
81
81
  runner.use(pipes.ExtractState({ from: 'senders', to: 'signerStates', status: 'INVALID_SIGNER_STATE', table: 'account' })); // prettier-ignore
82
82
  runner.use(pipes.VerifyAccountMigration({ signerKey: 'signerStates', stateKey: 'senderState', addressKey: 'tx.from' }));
83
83
  runner.use(pipes.ExtractState({ from: 'itx.receiver', to: 'receiverState', status: 'INVALID_RECEIVER_STATE' })); // can by any type
84
+ runner.use(pipes.VerifyBlocked({ stateKeys: ['signerStates', 'receiverState'] }));
84
85
  runner.use(pipes.VerifyAccountMigration({ stateKey: 'receiverState', addressKey: 'itx.receiver' }));
85
86
 
86
87
  // 6. verify token state and balance
@@ -121,6 +121,7 @@ runner.use(pipes.VerifyTokenBalance({ ownerKey: 'senderState', conditionKey: 'se
121
121
  runner.use(pipes.VerifyTokenBalance({ ownerKey: 'receiverState', conditionKey: 'receiverTokenConditions' }));
122
122
 
123
123
  runner.use(pipes.AntiLandAttack({ senderState: 'senderState', receiverState: 'receiverState' }));
124
+ runner.use(pipes.VerifyBlocked({ stateKeys: ['senderState', 'receiverState'] }));
124
125
 
125
126
  runner.use(pipes.ExtractState({ from: 'senderAssets', to: 'priv.senderAssets', status: 'INVALID_ASSET', table: 'asset' })); // prettier-ignore
126
127
  runner.use(pipes.VerifyTransferrable({ assets: 'priv.senderAssets' }));
@@ -112,6 +112,7 @@ runner.use(
112
112
  runner.use(pipes.ExtractReceiver({ from: 'itx.to', to: 'receiver' }));
113
113
  runner.use(pipes.ExtractState({ from: 'receiver', to: 'receiverState', status: 'OK', table: 'account' }));
114
114
  runner.use(pipes.AntiLandAttack({ senderState: 'senderState', receiverState: 'receiverState' }));
115
+ runner.use(pipes.VerifyBlocked({ stateKeys: ['senderState', 'receiverState'] }));
115
116
 
116
117
  runner.use(pipes.ExtractState({ from: 'assets', to: 'assetStates', status: 'INVALID_ASSET', table: 'asset' }));
117
118
  runner.use(pipes.VerifyTransferrable({ assets: 'assetStates' }));
@@ -127,6 +127,7 @@ runner.use(pipes.VerifyMultiSigV2({ signersKey: 'senders' }));
127
127
  runner.use(pipes.ExtractState({ from: 'tx.from', to: 'senderState', status: 'OK', table: 'account' }));
128
128
  runner.use(pipes.ExtractState({ from: 'senders', to: 'signerStates', status: 'INVALID_SIGNER_STATE', table: 'account' })); // prettier-ignore
129
129
  runner.use(pipes.ExtractState({ from: 'receivers', to: 'receiverStates', status: 'OK', table: 'account' }));
130
+ runner.use(pipes.VerifyBlocked({ stateKeys: ['signerStates', 'receiverStates'] }));
130
131
  runner.use(pipes.AntiLandAttack({ senderState: 'signerStates', receiverState: 'receiverStates' }));
131
132
  runner.use(pipes.VerifyAccountMigration({ signerKey: 'signerStates', stateKey: 'senderState', addressKey: 'tx.from' }));
132
133
 
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "1.18.131",
6
+ "version": "1.18.133",
7
7
  "description": "Predefined tx pipeline sets to execute certain type of transactions",
8
8
  "main": "lib/index.js",
9
9
  "files": [
@@ -21,19 +21,19 @@
21
21
  "author": "wangshijun <wangshijun2010@gmail.com> (http://github.com/wangshijun)",
22
22
  "license": "MIT",
23
23
  "dependencies": {
24
- "@arcblock/did": "1.18.131",
25
- "@arcblock/did-util": "1.18.131",
26
- "@arcblock/jwt": "1.18.131",
27
- "@arcblock/validator": "1.18.131",
28
- "@ocap/asset": "1.18.131",
29
- "@ocap/mcrypto": "1.18.131",
30
- "@ocap/merkle-tree": "1.18.131",
31
- "@ocap/message": "1.18.131",
32
- "@ocap/state": "1.18.131",
33
- "@ocap/tx-pipeline": "1.18.131",
34
- "@ocap/util": "1.18.131",
35
- "@ocap/wallet": "1.18.131",
36
- "debug": "^4.3.4",
24
+ "@arcblock/did": "1.18.133",
25
+ "@arcblock/did-util": "1.18.133",
26
+ "@arcblock/jwt": "1.18.133",
27
+ "@arcblock/validator": "1.18.133",
28
+ "@ocap/asset": "1.18.133",
29
+ "@ocap/mcrypto": "1.18.133",
30
+ "@ocap/merkle-tree": "1.18.133",
31
+ "@ocap/message": "1.18.133",
32
+ "@ocap/state": "1.18.133",
33
+ "@ocap/tx-pipeline": "1.18.133",
34
+ "@ocap/util": "1.18.133",
35
+ "@ocap/wallet": "1.18.133",
36
+ "debug": "^4.3.6",
37
37
  "deep-diff": "^1.0.2",
38
38
  "empty-value": "^1.0.1",
39
39
  "lodash": "^4.17.21",
@@ -44,8 +44,8 @@
44
44
  "elliptic": "6.5.3"
45
45
  },
46
46
  "devDependencies": {
47
- "jest": "^27.5.1",
47
+ "jest": "^29.7.0",
48
48
  "start-server-and-test": "^1.14.0"
49
49
  },
50
- "gitHead": "1e07d8baecba883a20db0a1ab44aeba211e97b30"
50
+ "gitHead": "cd4b69aef69b4e30265c3897a22fb63c902c5d4e"
51
51
  }