@ocap/tx-protocols 1.20.4 → 1.20.6

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
@@ -173,7 +173,7 @@ module.exports = ({ filter, runAsLambda }) => {
173
173
 
174
174
  return state;
175
175
  },
176
- { cleanWorkingSet: true, verifyHash: true }
176
+ { cleanWorkingSet: true, verifyHash: true, context: ctx }
177
177
  );
178
178
 
179
179
  // update indexdb after statedb commit
@@ -192,18 +192,24 @@ module.exports = ({ filter, runAsLambda }) => {
192
192
  ctx.logger?.error('Failed to execute transaction', { error, txHash: ctx.txHash, txState });
193
193
 
194
194
  if (txState && shouldPersistTx(error)) {
195
+ // Avoid sync data in failed transactions to indexdb
196
+ ctx.events = [];
197
+
195
198
  try {
196
- txState = await runAsLambda(async (txn) => {
197
- ctx = Object.assign({}, ctx, { txn, cacheStates: null });
199
+ txState = await runAsLambda(
200
+ async (txn) => {
201
+ ctx = Object.assign({}, ctx, { txn, cacheStates: null });
198
202
 
199
- await ensureGasFeePaid(ctx);
203
+ await ensureGasFeePaid(ctx);
200
204
 
201
- // Recreate tx to pick up gas related fields
202
- const state = context.states.tx.create(ctx, txStatus);
203
- await ctx.statedb.tx.create(state.hash, state, ctx);
205
+ // Recreate tx to pick up gas related fields
206
+ const state = context.states.tx.create(ctx, txStatus);
207
+ await ctx.statedb.tx.create(state.hash, state, ctx);
204
208
 
205
- return state;
206
- });
209
+ return state;
210
+ },
211
+ { cleanWorkingSet: true, verifyHash: true, context: ctx }
212
+ );
207
213
 
208
214
  // update indexdb after statedb commit
209
215
  flushEvents(ctx, { txState });
@@ -260,7 +260,7 @@ runner.use(
260
260
  ),
261
261
 
262
262
  // create receiver if not exist: asset owner
263
- ownerState
263
+ ownerState || owner === tx.from
264
264
  ? Promise.resolve(ownerState)
265
265
  : statedb.account.create(owner, account.create({ address: owner }, context), context),
266
266
 
@@ -294,7 +294,7 @@ runner.use(
294
294
  await updateVaults();
295
295
 
296
296
  context.senderState = newSenderState;
297
- context.receiverState = newReceiverState;
297
+ context.receiverState = owner === tx.from ? newSenderState : newReceiverState;
298
298
  context.signerStates = isAlsoSigner ? newSignerStates.concat(newSenderState) : newSignerStates;
299
299
  context.assetState = assetState;
300
300
  context.factoryState = newFactoryState;
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "1.20.4",
6
+ "version": "1.20.6",
7
7
  "description": "Predefined tx pipeline sets to execute certain type of transactions",
8
8
  "main": "lib/index.js",
9
9
  "files": [
@@ -18,20 +18,20 @@
18
18
  "empty-value": "^1.0.1",
19
19
  "lodash": "^4.17.21",
20
20
  "url-join": "^4.0.1",
21
- "@arcblock/did": "1.20.4",
22
- "@arcblock/did-util": "1.20.4",
23
- "@arcblock/jwt": "1.20.4",
24
- "@arcblock/validator": "1.20.4",
25
- "@ocap/asset": "1.20.4",
26
- "@ocap/mcrypto": "1.20.4",
27
- "@ocap/merkle-tree": "1.20.4",
28
- "@ocap/state": "1.20.4",
29
- "@ocap/util": "1.20.4",
30
- "@ocap/message": "1.20.4",
31
- "@ocap/tx-pipeline": "1.20.4",
32
- "@ocap/wallet": "1.20.4",
33
- "@ocap/client": "1.20.4",
34
- "@ocap/statedb-memory": "1.20.4"
21
+ "@arcblock/did": "1.20.6",
22
+ "@arcblock/did-util": "1.20.6",
23
+ "@arcblock/jwt": "1.20.6",
24
+ "@arcblock/validator": "1.20.6",
25
+ "@ocap/asset": "1.20.6",
26
+ "@ocap/mcrypto": "1.20.6",
27
+ "@ocap/merkle-tree": "1.20.6",
28
+ "@ocap/message": "1.20.6",
29
+ "@ocap/state": "1.20.6",
30
+ "@ocap/tx-pipeline": "1.20.6",
31
+ "@ocap/util": "1.20.6",
32
+ "@ocap/wallet": "1.20.6",
33
+ "@ocap/client": "1.20.6",
34
+ "@ocap/statedb-memory": "1.20.6"
35
35
  },
36
36
  "resolutions": {
37
37
  "bn.js": "5.2.1",
@@ -40,7 +40,7 @@
40
40
  "devDependencies": {
41
41
  "jest": "^29.7.0",
42
42
  "start-server-and-test": "^1.14.0",
43
- "@ocap/e2e-test": "1.20.4"
43
+ "@ocap/e2e-test": "1.20.6"
44
44
  },
45
45
  "scripts": {
46
46
  "lint": "eslint tests lib",