@ocap/tx-protocols 1.18.154 → 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 -8
- 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,8 +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('Tx finalized', {
|
|
103
|
+
txHash: context.txHash,
|
|
104
|
+
txStatus: err ? err.code || 'INTERNAL' : 'OK',
|
|
105
|
+
txState,
|
|
106
|
+
error: err,
|
|
107
|
+
});
|
|
102
108
|
} catch (e) {
|
|
103
|
-
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
|
+
});
|
|
104
114
|
return reject(e);
|
|
105
115
|
}
|
|
106
116
|
|
|
@@ -109,7 +119,7 @@ module.exports = ({ filter, runAsLambda }) => {
|
|
|
109
119
|
|
|
110
120
|
// after executing the transaction
|
|
111
121
|
if (err) {
|
|
112
|
-
context.logger?.error('Failed to execute transaction', err);
|
|
122
|
+
context.logger?.error('Failed to execute transaction', { error: err, txHash: context.txHash });
|
|
113
123
|
return reject(err);
|
|
114
124
|
}
|
|
115
125
|
|
|
@@ -126,7 +136,7 @@ module.exports = ({ filter, runAsLambda }) => {
|
|
|
126
136
|
try {
|
|
127
137
|
await runAsLambda((txn) => {
|
|
128
138
|
// create a new context each time in case we are retrying
|
|
129
|
-
ctx = pick(context, ['txBase64', 'statedb', 'indexdb', 'config', 'states', 'filter', 'extra']);
|
|
139
|
+
ctx = pick(context, ['txBase64', 'statedb', 'indexdb', 'config', 'states', 'filter', 'extra', 'logger']);
|
|
130
140
|
Object.defineProperty(ctx, 'txn', { value: txn });
|
|
131
141
|
return execute(ctx, protocols, true);
|
|
132
142
|
});
|
|
@@ -147,13 +157,22 @@ module.exports = ({ filter, runAsLambda }) => {
|
|
|
147
157
|
await context.statedb.tx.create(txState.hash, txState, newCtx);
|
|
148
158
|
flushEvents(newCtx, { txState });
|
|
149
159
|
});
|
|
150
|
-
ctx
|
|
160
|
+
ctx?.logger?.info('Tx finalized', {
|
|
161
|
+
txHash: ctx.txHash,
|
|
162
|
+
txStatus: error ? error.code || 'INTERNAL' : 'OK',
|
|
163
|
+
txState,
|
|
164
|
+
error,
|
|
165
|
+
});
|
|
151
166
|
} catch (err) {
|
|
152
167
|
const txState = context.states.tx.create(ctx, error ? error.code || 'INTERNAL' : 'OK', false);
|
|
153
|
-
ctx
|
|
168
|
+
ctx?.logger?.error('Failed to save invalid transaction to statedb', {
|
|
169
|
+
error: err,
|
|
170
|
+
txHash: ctx.txHash,
|
|
171
|
+
txState,
|
|
172
|
+
});
|
|
154
173
|
}
|
|
155
174
|
} else {
|
|
156
|
-
ctx
|
|
175
|
+
ctx?.logger?.error('Failed to execute transaction', { error, txHash: ctx.txHash });
|
|
157
176
|
}
|
|
158
177
|
}
|
|
159
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
|
}
|