@ocap/resolver 1.13.67 → 1.13.71
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/hooks.js +20 -1
- package/package.json +12 -12
package/lib/hooks.js
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
// Purpose of these hooks: update indexdb to speed up subsequent queries
|
|
3
3
|
// RULE: do not try to update statedb in these hooks
|
|
4
4
|
|
|
5
|
+
const merge = require('lodash/merge');
|
|
6
|
+
const pick = require('lodash/pick');
|
|
5
7
|
const { BN } = require('@ocap/util');
|
|
6
8
|
const { toStakeAddress } = require('@arcblock/did-util');
|
|
7
9
|
|
|
@@ -105,7 +107,8 @@ const ensureRollupValidator = async (address, rollupAddress, ctx, indexdb, upser
|
|
|
105
107
|
|
|
106
108
|
const onCreateRollupBlock = async (block, ctx, indexdb) => {
|
|
107
109
|
const { validators, proposer } = block;
|
|
108
|
-
const { rollupState } = ctx;
|
|
110
|
+
const { rollupState, txStates } = ctx;
|
|
111
|
+
|
|
109
112
|
validators.forEach(async (address) => {
|
|
110
113
|
try {
|
|
111
114
|
const doc = await ensureRollupValidator(address, rollupState.address, ctx, indexdb);
|
|
@@ -125,6 +128,22 @@ const onCreateRollupBlock = async (block, ctx, indexdb) => {
|
|
|
125
128
|
console.error('update rollup validator error', err);
|
|
126
129
|
}
|
|
127
130
|
});
|
|
131
|
+
|
|
132
|
+
// Withdraw tx.actualFee needs to be reindexed
|
|
133
|
+
if (Array.isArray(txStates)) {
|
|
134
|
+
txStates
|
|
135
|
+
.filter((x) => x.type === 'withdraw_token_v2')
|
|
136
|
+
.forEach(async (x) => {
|
|
137
|
+
try {
|
|
138
|
+
const doc = await indexdb.tx.get(x.hash);
|
|
139
|
+
const updates = merge(doc, pick(x, ['tx.itxJson.actualFee']));
|
|
140
|
+
await indexdb.tx.update(x.hash, updates);
|
|
141
|
+
debug('update tx on new block', x.hash);
|
|
142
|
+
} catch (err) {
|
|
143
|
+
console.error('update tx on new block error', err);
|
|
144
|
+
}
|
|
145
|
+
});
|
|
146
|
+
}
|
|
128
147
|
};
|
|
129
148
|
|
|
130
149
|
const updateRollupStats = async (address, value, key, indexdb) => {
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "1.13.
|
|
6
|
+
"version": "1.13.71",
|
|
7
7
|
"description": "GraphQL resolver built upon ocap statedb and GQL layer",
|
|
8
8
|
"main": "lib/index.js",
|
|
9
9
|
"files": [
|
|
@@ -22,18 +22,18 @@
|
|
|
22
22
|
"jest": "^27.3.1"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@arcblock/did": "1.13.
|
|
26
|
-
"@arcblock/did-util": "1.13.
|
|
27
|
-
"@ocap/config": "1.13.
|
|
28
|
-
"@ocap/indexdb": "1.13.
|
|
29
|
-
"@ocap/mcrypto": "1.13.
|
|
30
|
-
"@ocap/message": "1.13.
|
|
31
|
-
"@ocap/state": "1.13.
|
|
32
|
-
"@ocap/tx-protocols": "1.13.
|
|
33
|
-
"@ocap/util": "1.13.
|
|
34
|
-
"@ocap/validator": "1.13.
|
|
25
|
+
"@arcblock/did": "1.13.71",
|
|
26
|
+
"@arcblock/did-util": "1.13.71",
|
|
27
|
+
"@ocap/config": "1.13.71",
|
|
28
|
+
"@ocap/indexdb": "1.13.71",
|
|
29
|
+
"@ocap/mcrypto": "1.13.71",
|
|
30
|
+
"@ocap/message": "1.13.71",
|
|
31
|
+
"@ocap/state": "1.13.71",
|
|
32
|
+
"@ocap/tx-protocols": "1.13.71",
|
|
33
|
+
"@ocap/util": "1.13.71",
|
|
34
|
+
"@ocap/validator": "1.13.71",
|
|
35
35
|
"debug": "^4.3.2",
|
|
36
36
|
"lodash": "^4.17.21"
|
|
37
37
|
},
|
|
38
|
-
"gitHead": "
|
|
38
|
+
"gitHead": "82321f1dcd59ae272e87372bafaacc562e99c9ee"
|
|
39
39
|
}
|