@ocap/tx-protocols 1.18.155 → 1.18.156
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 +27 -9
- package/package.json +14 -14
package/lib/execute.js
CHANGED
|
@@ -68,7 +68,7 @@ module.exports = ({ filter, runAsLambda }) => {
|
|
|
68
68
|
updateVaults(),
|
|
69
69
|
]);
|
|
70
70
|
} catch (err) {
|
|
71
|
-
context.logger?.error('Failed to charge gas fee for errored tx', err);
|
|
71
|
+
context.logger?.error('Failed to charge gas fee for errored tx', { error: err, txHash: context.txHash });
|
|
72
72
|
}
|
|
73
73
|
};
|
|
74
74
|
|
|
@@ -76,7 +76,7 @@ module.exports = ({ filter, runAsLambda }) => {
|
|
|
76
76
|
new Promise((resolve, reject) => {
|
|
77
77
|
pre.run(context, (err) => {
|
|
78
78
|
if (err) {
|
|
79
|
-
context.logger?.error('Failed to prepare transaction', err);
|
|
79
|
+
context.logger?.error('Failed to prepare transaction', { error: err, txHash: context.txHash });
|
|
80
80
|
return reject(err);
|
|
81
81
|
}
|
|
82
82
|
|
|
@@ -99,9 +99,18 @@ module.exports = ({ filter, runAsLambda }) => {
|
|
|
99
99
|
try {
|
|
100
100
|
txState = context.states.tx.create(context, err ? err.code || 'INTERNAL' : 'OK');
|
|
101
101
|
await context.statedb.tx.create(txState.hash, txState, context);
|
|
102
|
-
context.logger?.info('
|
|
102
|
+
context.logger?.info('Tx finalized', {
|
|
103
|
+
txHash: context.txHash,
|
|
104
|
+
txStatus: err ? err.code || 'INTERNAL' : 'OK',
|
|
105
|
+
txState,
|
|
106
|
+
error: err,
|
|
107
|
+
});
|
|
103
108
|
} catch (e) {
|
|
104
|
-
context.logger?.error('Failed to save transaction to statedb',
|
|
109
|
+
context.logger?.error('Failed to save invalid transaction to statedb', {
|
|
110
|
+
error: e,
|
|
111
|
+
txHash: context.txHash,
|
|
112
|
+
txState,
|
|
113
|
+
});
|
|
105
114
|
return reject(e);
|
|
106
115
|
}
|
|
107
116
|
|
|
@@ -110,7 +119,7 @@ module.exports = ({ filter, runAsLambda }) => {
|
|
|
110
119
|
|
|
111
120
|
// after executing the transaction
|
|
112
121
|
if (err) {
|
|
113
|
-
context.logger?.error('Failed to execute transaction', err);
|
|
122
|
+
context.logger?.error('Failed to execute transaction', { error: err, txHash: context.txHash });
|
|
114
123
|
return reject(err);
|
|
115
124
|
}
|
|
116
125
|
|
|
@@ -127,7 +136,7 @@ module.exports = ({ filter, runAsLambda }) => {
|
|
|
127
136
|
try {
|
|
128
137
|
await runAsLambda((txn) => {
|
|
129
138
|
// create a new context each time in case we are retrying
|
|
130
|
-
ctx = pick(context, ['txBase64', 'statedb', 'indexdb', 'config', 'states', 'filter', 'extra']);
|
|
139
|
+
ctx = pick(context, ['txBase64', 'statedb', 'indexdb', 'config', 'states', 'filter', 'extra', 'logger']);
|
|
131
140
|
Object.defineProperty(ctx, 'txn', { value: txn });
|
|
132
141
|
return execute(ctx, protocols, true);
|
|
133
142
|
});
|
|
@@ -148,13 +157,22 @@ module.exports = ({ filter, runAsLambda }) => {
|
|
|
148
157
|
await context.statedb.tx.create(txState.hash, txState, newCtx);
|
|
149
158
|
flushEvents(newCtx, { txState });
|
|
150
159
|
});
|
|
151
|
-
ctx
|
|
160
|
+
ctx?.logger?.info('Tx finalized', {
|
|
161
|
+
txHash: ctx.txHash,
|
|
162
|
+
txStatus: error ? error.code || 'INTERNAL' : 'OK',
|
|
163
|
+
txState,
|
|
164
|
+
error,
|
|
165
|
+
});
|
|
152
166
|
} catch (err) {
|
|
153
167
|
const txState = context.states.tx.create(ctx, error ? error.code || 'INTERNAL' : 'OK', false);
|
|
154
|
-
ctx
|
|
168
|
+
ctx?.logger?.error('Failed to save invalid transaction to statedb', {
|
|
169
|
+
error: err,
|
|
170
|
+
txHash: ctx.txHash,
|
|
171
|
+
txState,
|
|
172
|
+
});
|
|
155
173
|
}
|
|
156
174
|
} else {
|
|
157
|
-
ctx
|
|
175
|
+
ctx?.logger?.error('Failed to execute transaction', { error, txHash: ctx.txHash });
|
|
158
176
|
}
|
|
159
177
|
}
|
|
160
178
|
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "1.18.
|
|
6
|
+
"version": "1.18.156",
|
|
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.18.
|
|
25
|
-
"@arcblock/did-util": "1.18.
|
|
26
|
-
"@arcblock/jwt": "1.18.
|
|
27
|
-
"@arcblock/validator": "1.18.
|
|
28
|
-
"@ocap/asset": "1.18.
|
|
29
|
-
"@ocap/mcrypto": "1.18.
|
|
30
|
-
"@ocap/merkle-tree": "1.18.
|
|
31
|
-
"@ocap/message": "1.18.
|
|
32
|
-
"@ocap/state": "1.18.
|
|
33
|
-
"@ocap/tx-pipeline": "1.18.
|
|
34
|
-
"@ocap/util": "1.18.
|
|
35
|
-
"@ocap/wallet": "1.18.
|
|
24
|
+
"@arcblock/did": "1.18.156",
|
|
25
|
+
"@arcblock/did-util": "1.18.156",
|
|
26
|
+
"@arcblock/jwt": "1.18.156",
|
|
27
|
+
"@arcblock/validator": "1.18.156",
|
|
28
|
+
"@ocap/asset": "1.18.156",
|
|
29
|
+
"@ocap/mcrypto": "1.18.156",
|
|
30
|
+
"@ocap/merkle-tree": "1.18.156",
|
|
31
|
+
"@ocap/message": "1.18.156",
|
|
32
|
+
"@ocap/state": "1.18.156",
|
|
33
|
+
"@ocap/tx-pipeline": "1.18.156",
|
|
34
|
+
"@ocap/util": "1.18.156",
|
|
35
|
+
"@ocap/wallet": "1.18.156",
|
|
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": "955c3e7ae8e06fc037e6591267babaae1623ef23"
|
|
51
51
|
}
|