@ocap/resolver 1.31.1 → 1.31.2
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/esm/hooks.d.mts +6 -0
- package/esm/hooks.mjs +5 -0
- package/esm/index.mjs +6 -1
- package/lib/hooks.cjs +5 -0
- package/lib/hooks.d.cts +6 -0
- package/lib/index.cjs +5 -0
- package/package.json +14 -14
package/esm/hooks.d.mts
CHANGED
|
@@ -9,6 +9,12 @@ interface IHooksRollupState {
|
|
|
9
9
|
address: string;
|
|
10
10
|
tokenAddress: string;
|
|
11
11
|
genesisTime: string;
|
|
12
|
+
/** v2 bridges carry `data.value.version == 2` (bridge/docs/ocap-protocols.md §v2.1) */
|
|
13
|
+
data?: {
|
|
14
|
+
value?: {
|
|
15
|
+
version?: unknown;
|
|
16
|
+
};
|
|
17
|
+
} | null;
|
|
12
18
|
seedValidators: IRollupValidator[];
|
|
13
19
|
validators: IRollupValidator[];
|
|
14
20
|
totalDepositAmount?: string;
|
package/esm/hooks.mjs
CHANGED
|
@@ -7,7 +7,10 @@ import pick from "lodash/pick.js";
|
|
|
7
7
|
|
|
8
8
|
//#region src/hooks.ts
|
|
9
9
|
const debug = createDebug(name);
|
|
10
|
+
/** A v2 bridge has no stake-backed validator records: its operators live in the bridge body (epochs). */
|
|
11
|
+
const isBridgeV2Doc = (doc) => doc?.data?.value?.version === 2;
|
|
10
12
|
const onCreateRollup = (rollup, _ctx, indexdb) => {
|
|
13
|
+
if (isBridgeV2Doc(rollup)) return;
|
|
11
14
|
rollup.seedValidators.forEach(async (x) => {
|
|
12
15
|
const { pk, address, endpoint } = x;
|
|
13
16
|
try {
|
|
@@ -166,6 +169,7 @@ const onClaimBlockReward = async (tx, ctx, indexdb) => {
|
|
|
166
169
|
};
|
|
167
170
|
const onJoinRollup = async (tx, ctx, indexdb) => {
|
|
168
171
|
try {
|
|
172
|
+
if (isBridgeV2Doc(await indexdb.rollup.get(tx.tx.itxJson.rollup))) return;
|
|
169
173
|
const address = tx.tx.from;
|
|
170
174
|
const doc = await ensureRollupValidator(address, tx.tx.itxJson.rollup, ctx, indexdb);
|
|
171
175
|
doc.endpoint = tx.tx.itxJson.endpoint;
|
|
@@ -180,6 +184,7 @@ const onJoinRollup = async (tx, ctx, indexdb) => {
|
|
|
180
184
|
};
|
|
181
185
|
const onLeaveRollup = async (tx, ctx, indexdb) => {
|
|
182
186
|
try {
|
|
187
|
+
if (isBridgeV2Doc(await indexdb.rollup.get(tx.tx.itxJson.rollup))) return;
|
|
183
188
|
const address = tx.tx.from;
|
|
184
189
|
const doc = await ensureRollupValidator(address, tx.tx.itxJson.rollup, ctx, indexdb);
|
|
185
190
|
doc.leaveTime = tx.time;
|
package/esm/index.mjs
CHANGED
|
@@ -16,7 +16,7 @@ import { formatSearchResult, rebuildIndexFromState } from "@ocap/indexdb";
|
|
|
16
16
|
import { types } from "@ocap/mcrypto";
|
|
17
17
|
import { fromTypeUrl } from "@ocap/message";
|
|
18
18
|
import * as states from "@ocap/state";
|
|
19
|
-
import { TxTimer, assertRawWireEnvelope, assertTxAdmission, classifyErrorStrikeCategory, createExecutor, getTxSecurityWarningByHash, inspectTransactionPreFlight, recordActorSecurityStrike, resolveVerifiedStrikeActors, setTxSecurityWarningForHash } from "@ocap/tx-protocols";
|
|
19
|
+
import { TxTimer, assertRawWireEnvelope, assertStatelessTxRules, assertTxAdmission, classifyErrorStrikeCategory, createExecutor, getTxSecurityWarningByHash, inspectTransactionPreFlight, recordActorSecurityStrike, resolveVerifiedStrikeActors, setTxSecurityWarningForHash } from "@ocap/tx-protocols";
|
|
20
20
|
import { decodeAnySafe } from "@ocap/tx-protocols/lib/util";
|
|
21
21
|
import { DEFAULT_TOKEN_DECIMAL } from "@ocap/util/lib/constant";
|
|
22
22
|
import { CustomError } from "@ocap/util/lib/error";
|
|
@@ -135,6 +135,10 @@ const maxGasOps = {
|
|
|
135
135
|
create: 2,
|
|
136
136
|
update: 13
|
|
137
137
|
},
|
|
138
|
+
"fg:t:release_bridge_token": {
|
|
139
|
+
create: 3,
|
|
140
|
+
update: 20
|
|
141
|
+
},
|
|
138
142
|
"fg:t:create_rollup": {
|
|
139
143
|
create: 2,
|
|
140
144
|
update: 2
|
|
@@ -330,6 +334,7 @@ var OCAPResolver = class {
|
|
|
330
334
|
try {
|
|
331
335
|
await this.initializationPromise;
|
|
332
336
|
await inspectTransactionPreFlight(context);
|
|
337
|
+
await assertStatelessTxRules(context);
|
|
333
338
|
const preTx = context.tx;
|
|
334
339
|
const preTxHash = context.txHash;
|
|
335
340
|
if (preTx) await assertTxAdmission({
|
package/lib/hooks.cjs
CHANGED
|
@@ -11,7 +11,10 @@ lodash_pick = require_rolldown_runtime.__toESM(lodash_pick);
|
|
|
11
11
|
|
|
12
12
|
//#region src/hooks.ts
|
|
13
13
|
const debug$1 = (0, debug.default)(require_package.name);
|
|
14
|
+
/** A v2 bridge has no stake-backed validator records: its operators live in the bridge body (epochs). */
|
|
15
|
+
const isBridgeV2Doc = (doc) => doc?.data?.value?.version === 2;
|
|
14
16
|
const onCreateRollup = (rollup, _ctx, indexdb) => {
|
|
17
|
+
if (isBridgeV2Doc(rollup)) return;
|
|
15
18
|
rollup.seedValidators.forEach(async (x) => {
|
|
16
19
|
const { pk, address, endpoint } = x;
|
|
17
20
|
try {
|
|
@@ -170,6 +173,7 @@ const onClaimBlockReward = async (tx, ctx, indexdb) => {
|
|
|
170
173
|
};
|
|
171
174
|
const onJoinRollup = async (tx, ctx, indexdb) => {
|
|
172
175
|
try {
|
|
176
|
+
if (isBridgeV2Doc(await indexdb.rollup.get(tx.tx.itxJson.rollup))) return;
|
|
173
177
|
const address = tx.tx.from;
|
|
174
178
|
const doc = await ensureRollupValidator(address, tx.tx.itxJson.rollup, ctx, indexdb);
|
|
175
179
|
doc.endpoint = tx.tx.itxJson.endpoint;
|
|
@@ -184,6 +188,7 @@ const onJoinRollup = async (tx, ctx, indexdb) => {
|
|
|
184
188
|
};
|
|
185
189
|
const onLeaveRollup = async (tx, ctx, indexdb) => {
|
|
186
190
|
try {
|
|
191
|
+
if (isBridgeV2Doc(await indexdb.rollup.get(tx.tx.itxJson.rollup))) return;
|
|
187
192
|
const address = tx.tx.from;
|
|
188
193
|
const doc = await ensureRollupValidator(address, tx.tx.itxJson.rollup, ctx, indexdb);
|
|
189
194
|
doc.leaveTime = tx.time;
|
package/lib/hooks.d.cts
CHANGED
|
@@ -9,6 +9,12 @@ interface IHooksRollupState {
|
|
|
9
9
|
address: string;
|
|
10
10
|
tokenAddress: string;
|
|
11
11
|
genesisTime: string;
|
|
12
|
+
/** v2 bridges carry `data.value.version == 2` (bridge/docs/ocap-protocols.md §v2.1) */
|
|
13
|
+
data?: {
|
|
14
|
+
value?: {
|
|
15
|
+
version?: unknown;
|
|
16
|
+
};
|
|
17
|
+
} | null;
|
|
12
18
|
seedValidators: IRollupValidator[];
|
|
13
19
|
validators: IRollupValidator[];
|
|
14
20
|
totalDepositAmount?: string;
|
package/lib/index.cjs
CHANGED
|
@@ -149,6 +149,10 @@ const maxGasOps = {
|
|
|
149
149
|
create: 2,
|
|
150
150
|
update: 13
|
|
151
151
|
},
|
|
152
|
+
"fg:t:release_bridge_token": {
|
|
153
|
+
create: 3,
|
|
154
|
+
update: 20
|
|
155
|
+
},
|
|
152
156
|
"fg:t:create_rollup": {
|
|
153
157
|
create: 2,
|
|
154
158
|
update: 2
|
|
@@ -344,6 +348,7 @@ var OCAPResolver = class {
|
|
|
344
348
|
try {
|
|
345
349
|
await this.initializationPromise;
|
|
346
350
|
await (0, _ocap_tx_protocols.inspectTransactionPreFlight)(context);
|
|
351
|
+
await (0, _ocap_tx_protocols.assertStatelessTxRules)(context);
|
|
347
352
|
const preTx = context.tx;
|
|
348
353
|
const preTxHash = context.txHash;
|
|
349
354
|
if (preTx) await (0, _ocap_tx_protocols.assertTxAdmission)({
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "1.31.
|
|
6
|
+
"version": "1.31.2",
|
|
7
7
|
"description": "GraphQL resolver built upon ocap statedb and GQL layer",
|
|
8
8
|
"type": "module",
|
|
9
9
|
"main": "./lib/index.cjs",
|
|
@@ -49,20 +49,20 @@
|
|
|
49
49
|
"tsdown": "^0.18.4"
|
|
50
50
|
},
|
|
51
51
|
"dependencies": {
|
|
52
|
-
"@arcblock/did": "1.31.
|
|
53
|
-
"@arcblock/did-ext": "1.31.
|
|
54
|
-
"@arcblock/did-util": "1.31.
|
|
52
|
+
"@arcblock/did": "1.31.2",
|
|
53
|
+
"@arcblock/did-ext": "1.31.2",
|
|
54
|
+
"@arcblock/did-util": "1.31.2",
|
|
55
55
|
"@arcblock/nft-display": "^3.2.3",
|
|
56
|
-
"@arcblock/validator": "1.31.
|
|
57
|
-
"@ocap/config": "1.31.
|
|
58
|
-
"@ocap/indexdb": "1.31.
|
|
59
|
-
"@ocap/mcrypto": "1.31.
|
|
60
|
-
"@ocap/message": "1.31.
|
|
61
|
-
"@ocap/state": "1.31.
|
|
62
|
-
"@ocap/tx-protocols": "1.31.
|
|
63
|
-
"@ocap/types": "1.31.
|
|
64
|
-
"@ocap/util": "1.31.
|
|
65
|
-
"@ocap/wallet": "1.31.
|
|
56
|
+
"@arcblock/validator": "1.31.2",
|
|
57
|
+
"@ocap/config": "1.31.2",
|
|
58
|
+
"@ocap/indexdb": "1.31.2",
|
|
59
|
+
"@ocap/mcrypto": "1.31.2",
|
|
60
|
+
"@ocap/message": "1.31.2",
|
|
61
|
+
"@ocap/state": "1.31.2",
|
|
62
|
+
"@ocap/tx-protocols": "1.31.2",
|
|
63
|
+
"@ocap/types": "1.31.2",
|
|
64
|
+
"@ocap/util": "1.31.2",
|
|
65
|
+
"@ocap/wallet": "1.31.2",
|
|
66
66
|
"debug": "^4.4.3",
|
|
67
67
|
"express": "^4.22.1",
|
|
68
68
|
"lodash": "^4.17.23",
|