@ocap/resolver 1.31.9 → 1.32.0

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.
Files changed (42) hide show
  1. package/esm/_virtual/rolldown_runtime.mjs +7 -0
  2. package/esm/api.d.mts +33 -5
  3. package/esm/api.mjs +939 -53
  4. package/esm/dashboard.d.mts +199 -0
  5. package/esm/dashboard.mjs +2481 -0
  6. package/esm/explorer.d.mts +29 -0
  7. package/esm/explorer.mjs +227 -0
  8. package/esm/follower.d.mts +277 -0
  9. package/esm/follower.mjs +2428 -0
  10. package/esm/hooks.mjs +1 -1
  11. package/esm/hotstuff-runtime.d.mts +271 -0
  12. package/esm/hotstuff-runtime.mjs +2668 -0
  13. package/esm/index.d.mts +79 -4
  14. package/esm/index.mjs +911 -174
  15. package/esm/node-preferences.d.mts +203 -0
  16. package/esm/node-preferences.mjs +1021 -0
  17. package/esm/replayer.d.mts +74 -0
  18. package/esm/replayer.mjs +394 -0
  19. package/esm/token-distribution.mjs +2 -2
  20. package/esm/token-flow.mjs +1 -1
  21. package/esm/types.d.mts +25 -2
  22. package/lib/api.cjs +941 -52
  23. package/lib/api.d.cts +33 -5
  24. package/lib/dashboard.cjs +2491 -0
  25. package/lib/dashboard.d.cts +199 -0
  26. package/lib/explorer.cjs +227 -0
  27. package/lib/explorer.d.cts +29 -0
  28. package/lib/follower.cjs +2434 -0
  29. package/lib/follower.d.cts +277 -0
  30. package/lib/hooks.cjs +1 -1
  31. package/lib/hotstuff-runtime.cjs +2671 -0
  32. package/lib/hotstuff-runtime.d.cts +271 -0
  33. package/lib/index.cjs +945 -174
  34. package/lib/index.d.cts +79 -4
  35. package/lib/node-preferences.cjs +1043 -0
  36. package/lib/node-preferences.d.cts +203 -0
  37. package/lib/replayer.cjs +395 -0
  38. package/lib/replayer.d.cts +74 -0
  39. package/lib/token-distribution.cjs +2 -2
  40. package/lib/token-flow.cjs +1 -1
  41. package/lib/types.d.cts +25 -2
  42. package/package.json +20 -14
@@ -0,0 +1,74 @@
1
+ import { IChainConfig, IIndexDB, ILedger, ILedgerEntry, IPipelineLogger, IStateDB } from "@ocap/types";
2
+
3
+ //#region src/replayer.d.ts
4
+
5
+ interface IReplayerResolverTarget {
6
+ statedb: IStateDB;
7
+ indexdb: IIndexDB;
8
+ ledger: ILedger;
9
+ config: IChainConfig;
10
+ logger: IPipelineLogger;
11
+ _indexRejectedLedgerTx(ctx: Record<string, unknown>, err: unknown): Promise<void>;
12
+ flushIndexWrites(): Promise<void>;
13
+ }
14
+ interface IReplayEntryOptions {
15
+ /** Whether to append the entry into `resolver.ledger` after `statedb` verification (default: `true`). */
16
+ appendToLedger?: boolean;
17
+ /** Optional upstream `entryHashV2From` policy cutoff passed to `ledger.appendVerifiedEntries`. */
18
+ entryHashV2From?: number | 'infinity';
19
+ }
20
+ interface IReplayEntryResult {
21
+ status: 'applied' | 'persisted-failed' | 'orphan-indexed' | 'already-applied';
22
+ sequence: number;
23
+ hash: string;
24
+ code: string;
25
+ stateCommitHash: string | null;
26
+ }
27
+ interface IDryRunVerifyEntriesOptions {
28
+ expectedPrevSequence?: number;
29
+ prevStateRoot?: string | null;
30
+ entryHashV2From?: number | 'infinity';
31
+ }
32
+ interface IDryRunVerifyEntriesResult {
33
+ derivedStateRoot: string;
34
+ entryHashes: string[];
35
+ }
36
+ declare class LedgerEntryReplayer {
37
+ private readonly resolver;
38
+ private readonly emptyFilter;
39
+ private readonly executor;
40
+ private activeExpectedCommitHash;
41
+ private activeSubLambdaOverride;
42
+ private lastCommittedHash;
43
+ private lastCommitMismatchError;
44
+ private lastStorageError;
45
+ private mutex;
46
+ constructor(resolver: IReplayerResolverTarget);
47
+ private runExclusive;
48
+ private appendVerifiedEntryToLedger;
49
+ private verifyRawTxHashMatchesEntry;
50
+ /**
51
+ * Pre-replay wire & primitive validation for untrusted network hot-tail / cold-segment payloads (#1710).
52
+ * Throws `INVALID_LEDGER_ENTRY` (peer-disqualifying, non-halting) on any malformed wire field or lossy JSON coercion.
53
+ */
54
+ validateWireEntry(entry: ILedgerEntry): void;
55
+ private authenticateAndDecodeEntry;
56
+ private indexOrphanEntry;
57
+ /**
58
+ * Replay a single finalized `ILedgerEntry` sequentially (`concurrency = 1`).
59
+ */
60
+ replayEntry(entry: ILedgerEntry, options?: IReplayEntryOptions): Promise<IReplayEntryResult>;
61
+ /**
62
+ * Dry-run verify a proposed batch of `1..N` finalized entries inside a single rolled-back SQLite
63
+ * transaction (#1712 HotStuff-Lite replica voting), verifying every entry's wire format, `entryHash`,
64
+ * and post-execution `_state_commit` hash with zero mutations to `statedb`, `trusted`, `indexdb`, or `ledger`.
65
+ */
66
+ dryRunVerifyEntries(entries: ILedgerEntry[], options?: IDryRunVerifyEntriesOptions): Promise<IDryRunVerifyEntriesResult>;
67
+ /**
68
+ * Scan existing local ledger entries in `[fromSeq, toSeq]` and ensure any force-finalized
69
+ * orphan entries (`stateCommitHash === ''`) are indexed into `indexdb.tx` after `rebuildIndex()`.
70
+ */
71
+ indexExistingOrphanEntries(fromSeq?: number, toSeq?: number): Promise<number>;
72
+ }
73
+ //#endregion
74
+ export { IDryRunVerifyEntriesOptions, IDryRunVerifyEntriesResult, IReplayEntryOptions, IReplayEntryResult, IReplayerResolverTarget, LedgerEntryReplayer };
@@ -0,0 +1,394 @@
1
+ import { authenticateEntryDecodedFields, computeEntryHash } from "@arcblock/ledger-core";
2
+ import { toTxHash } from "@ocap/mcrypto";
3
+ import { createExecutor } from "@ocap/tx-protocols";
4
+ import { fromBase64 } from "@ocap/util";
5
+ import { CustomError } from "@ocap/util/lib/error";
6
+ import { Blacklist } from "@ocap/state";
7
+
8
+ //#region src/replayer.ts
9
+ /**
10
+ * Sequential Deterministic Ledger Entry Replayer (`concurrency = 1`, #1710)
11
+ *
12
+ * Replays finalized `ILedgerEntry` items from cold segments or hot-tail polling onto a Follower's
13
+ * local `statedb` + `indexdb` + `ledger`:
14
+ * - Always uses an isolated, empty `Blacklist` (never the follower's local `blocked.json`).
15
+ * - Pins `extra.txTime` to `entry.timestamp` and unpacks `entry.txExtra` (`{ txExtra, gasStakeHeaders }`).
16
+ * - Handles all 3 ledger entry classes:
17
+ * 1. `OK` committed transaction (`entry.stateCommitHash` non-empty)
18
+ * 2. `PERSISTED_FAILED` gas-charged transaction (`entry.stateCommitHash` non-empty)
19
+ * 3. Force-finalized orphan entry (`!entry.stateCommitHash`) — skips `runAsLambda` so `_state_commit`
20
+ * does NOT advance, verifies `toTxHash(txRaw) === entry.hash`, and indexes the rejected tx in `indexdb`.
21
+ * - Enforces pre-commit `expectedCommitHash` on `statedb.runAsLambda` so any state divergence rolls back
22
+ * SQLite atomically BEFORE `COMMIT` and before appending to `ledger.sqlite`.
23
+ */
24
+ function normalizeHexLower(raw) {
25
+ return String(raw ?? "").trim().replace(/^0x/i, "").toLowerCase();
26
+ }
27
+ function isLocalStorageEngineError(err, depth = 0) {
28
+ if (!err || typeof err !== "object" || depth > 3) return false;
29
+ if (err.upstreamTransportFailure === true) return false;
30
+ if (err.localStorageFailure === true) return true;
31
+ const rawCode = err.code;
32
+ const rawErrcode = err.errcode;
33
+ if (rawCode === 5 || rawCode === 6 || rawErrcode === 5 || rawErrcode === 6) return true;
34
+ if (typeof rawErrcode === "number" && Number.isFinite(rawErrcode)) {
35
+ const primaryErr = rawErrcode & 255;
36
+ if (primaryErr === 5 || primaryErr === 6 || primaryErr === 8 || primaryErr === 10 || primaryErr === 11 || primaryErr === 13 || primaryErr === 14 || primaryErr === 26) return true;
37
+ }
38
+ const code = String(rawCode ?? "");
39
+ const name = String(err.name ?? "");
40
+ const message = err instanceof Error ? err.message : String(err.message ?? "");
41
+ if (code === "INVALID_HASH" && /^Trusted hash verification failed\b/i.test(message) || /^SQLITE_/i.test(code) || code === "ERR_SQLITE_ERROR" || name === "SqliteError" || name === "SQLiteError" || !code && /^(?:Failed to verify signature of hash:|Failed to update hash, hash mismatch|database (?:table )?is locked\b)/i.test(message) || /^LEDGER_/i.test(code) && /(?:\bSQLITE_(?:CORRUPT|FULL|IOERR|BUSY|LOCKED|READONLY|CANTOPEN|NOTADB)\b|database disk image is malformed|file is not a database|database (?:table )?is locked)/i.test(message)) return true;
42
+ const cause = err.cause;
43
+ return cause !== void 0 && cause !== err ? isLocalStorageEngineError(cause, depth + 1) : false;
44
+ }
45
+ var LedgerEntryReplayer = class {
46
+ constructor(resolver) {
47
+ this.activeSubLambdaOverride = null;
48
+ this.lastCommittedHash = null;
49
+ this.lastCommitMismatchError = null;
50
+ this.lastStorageError = null;
51
+ this.mutex = Promise.resolve();
52
+ this.resolver = resolver;
53
+ this.emptyFilter = new Blacklist();
54
+ const statedb = resolver.statedb;
55
+ const runAsLambda = typeof statedb.runAsLambda === "function" ? async (fn, opts = {}) => {
56
+ const expectedCommitHash = this.activeExpectedCommitHash;
57
+ const targetLambda = this.activeSubLambdaOverride ?? statedb.runAsLambda.bind(statedb);
58
+ let fnThrew = false;
59
+ let fnErrRef;
60
+ const wrappedFn = async (txn) => {
61
+ fnThrew = false;
62
+ fnErrRef = void 0;
63
+ try {
64
+ return await fn(txn);
65
+ } catch (innerErr) {
66
+ fnThrew = true;
67
+ fnErrRef = innerErr;
68
+ if (isLocalStorageEngineError(innerErr)) innerErr.localStorageFailure = true;
69
+ throw innerErr;
70
+ }
71
+ };
72
+ try {
73
+ return await targetLambda(wrappedFn, {
74
+ ...opts,
75
+ ...expectedCommitHash !== void 0 ? { expectedCommitHash } : {},
76
+ onCommit: async (commitHash) => {
77
+ this.lastCommittedHash = commitHash ?? null;
78
+ this.lastStorageError = null;
79
+ this.lastCommitMismatchError = null;
80
+ const origOnCommit = opts.onCommit;
81
+ if (typeof origOnCommit === "function") await origOnCommit(commitHash);
82
+ }
83
+ });
84
+ } catch (err) {
85
+ if (err?.code === "STATE_COMMIT_MISMATCH") this.lastCommitMismatchError = err;
86
+ else if (!fnThrew || err !== fnErrRef || isLocalStorageEngineError(err)) {
87
+ if (err && typeof err === "object") {
88
+ err.localStorageFailure = true;
89
+ if (!this.lastStorageError) this.lastStorageError = err;
90
+ }
91
+ }
92
+ throw err;
93
+ }
94
+ } : void 0;
95
+ this.executor = createExecutor({
96
+ filter: this.emptyFilter,
97
+ runAsLambda
98
+ });
99
+ }
100
+ async runExclusive(fn) {
101
+ const prev = this.mutex;
102
+ let release;
103
+ this.mutex = new Promise((resolve) => {
104
+ release = resolve;
105
+ });
106
+ await prev;
107
+ try {
108
+ return await fn();
109
+ } finally {
110
+ release();
111
+ }
112
+ }
113
+ async appendVerifiedEntryToLedger(entry, entryHashV2From) {
114
+ if (typeof this.resolver.ledger.appendVerifiedEntries === "function") {
115
+ await this.resolver.ledger.appendVerifiedEntries([entry], {
116
+ ...entryHashV2From !== void 0 ? { entryHashV2From } : {},
117
+ verifyTxRawHash: true,
118
+ strictDecode: true,
119
+ requireWireOnly: true
120
+ });
121
+ return;
122
+ }
123
+ const storage = this.resolver.ledger.getStorage?.();
124
+ if (storage && typeof storage.appendEntries === "function") {
125
+ await storage.appendEntries([entry]);
126
+ return;
127
+ }
128
+ throw new CustomError("LEDGER_UNSUPPORTED", "Follower ledger does not support appendVerifiedEntries");
129
+ }
130
+ verifyRawTxHashMatchesEntry(entry, throwCodeOnMismatch = "TX_HASH_MISMATCH") {
131
+ if (typeof entry.txRaw !== "string" || !entry.txRaw) throw new CustomError("INVALID_LEDGER_ENTRY", `Ledger entry seq=${entry.sequence} is missing txRaw`);
132
+ if (typeof entry.hash !== "string" || !entry.hash) throw new CustomError("INVALID_LEDGER_ENTRY", `Ledger entry seq=${entry.sequence} is missing string hash`);
133
+ if (entry.txRaw !== entry.txRaw.trim() || entry.txRaw.startsWith("{")) throw new CustomError("INVALID_LEDGER_ENTRY", `Ledger entry seq=${entry.sequence} has non-canonical or non-wire txRaw`);
134
+ let computedTxHash;
135
+ try {
136
+ computedTxHash = toTxHash(fromBase64(entry.txRaw));
137
+ } catch (err) {
138
+ throw new CustomError("INVALID_LEDGER_ENTRY", `Failed to hash txRaw at seq=${entry.sequence}: ${err instanceof Error ? err.message : String(err)}`);
139
+ }
140
+ if (computedTxHash.toUpperCase() !== entry.hash.toUpperCase()) throw new CustomError(throwCodeOnMismatch, `Ledger entry txRaw hash mismatch at seq=${entry.sequence}: computed ${computedTxHash}, entry has ${entry.hash}`);
141
+ }
142
+ /**
143
+ * Pre-replay wire & primitive validation for untrusted network hot-tail / cold-segment payloads (#1710).
144
+ * Throws `INVALID_LEDGER_ENTRY` (peer-disqualifying, non-halting) on any malformed wire field or lossy JSON coercion.
145
+ */
146
+ validateWireEntry(entry) {
147
+ if (!entry || typeof entry !== "object" || !Number.isSafeInteger(entry.sequence) || entry.sequence < 1 || !Number.isSafeInteger(entry.nonce) || entry.nonce < 0 || !Number.isSafeInteger(entry.timestamp) || entry.timestamp < 0 || entry.timestamp > 864e13 || typeof entry.hash !== "string" || typeof entry.from !== "string" || typeof entry.pk !== "string" || typeof entry.signature !== "string" || typeof entry.txRaw !== "string" || typeof entry.txType !== "string" || typeof entry.chainId !== "string" || typeof entry.entryHash !== "string" || typeof entry.finalized !== "boolean" || entry.stateCommitHash !== void 0 && typeof entry.stateCommitHash !== "string" || entry.tx === null || typeof entry.tx !== "object" || Array.isArray(entry.tx)) throw new CustomError("INVALID_LEDGER_ENTRY", `Ledger entry seq=${String(entry?.sequence)} has invalid wire primitive types`);
148
+ this.verifyRawTxHashMatchesEntry(entry, "INVALID_LEDGER_ENTRY");
149
+ this.authenticateAndDecodeEntry(entry);
150
+ }
151
+ authenticateAndDecodeEntry(entry) {
152
+ const authRes = authenticateEntryDecodedFields(entry, true, { requireFullWireEntry: true });
153
+ if (!authRes.ok) throw new CustomError("INVALID_LEDGER_ENTRY", `Ledger entry seq=${entry.sequence} failed field authentication: ${authRes.reason}`);
154
+ return authRes.decodedTx;
155
+ }
156
+ async indexOrphanEntry(entry, decodedTx) {
157
+ const safeTx = decodedTx && typeof decodedTx === "object" ? decodedTx : {};
158
+ const rawItx = safeTx.itx && typeof safeTx.itx === "object" ? safeTx.itx : void 0;
159
+ const derivedTxType = rawItx && typeof rawItx.typeUrl === "string" && rawItx.typeUrl ? rawItx.typeUrl : rawItx && typeof rawItx.type === "string" && rawItx.type ? rawItx.type : typeof safeTx.txType === "string" && safeTx.txType ? safeTx.txType : entry.txType;
160
+ const txTimeIso = Number.isSafeInteger(entry.timestamp) && entry.timestamp >= 0 && entry.timestamp <= 864e13 ? new Date(entry.timestamp).toISOString() : (/* @__PURE__ */ new Date()).toISOString();
161
+ await this.resolver._indexRejectedLedgerTx({
162
+ ledgerSequence: entry.sequence,
163
+ txHash: entry.hash,
164
+ txType: derivedTxType,
165
+ txTime: txTimeIso,
166
+ tx: {
167
+ ...safeTx,
168
+ from: String(safeTx.from ?? safeTx.spenderDid ?? ""),
169
+ nonce: safeTx.nonce ?? 0,
170
+ pk: String(safeTx.pk ?? safeTx.spenderPublicKey ?? ""),
171
+ signature: String(safeTx.signature ?? safeTx.spenderSignature ?? ""),
172
+ chainId: String(safeTx.chainId ?? this.resolver.config.chainId ?? "")
173
+ },
174
+ ...rawItx ? { itxJson: rawItx } : {}
175
+ }, { code: "ORPHAN_LEDGER_ENTRY" });
176
+ await this.resolver.flushIndexWrites();
177
+ }
178
+ /**
179
+ * Replay a single finalized `ILedgerEntry` sequentially (`concurrency = 1`).
180
+ */
181
+ async replayEntry(entry, options = {}) {
182
+ return this.runExclusive(async () => {
183
+ if (!entry || typeof entry !== "object") throw new CustomError("INVALID_LEDGER_ENTRY", "Cannot replay null or non-object ledger entry");
184
+ if (!entry.finalized) throw new CustomError("UNFINALIZED_LEDGER_ENTRY", `Refusing to replay unfinalized entry seq=${entry.sequence}`);
185
+ if (!Number.isSafeInteger(entry.timestamp) || entry.timestamp < 0 || entry.timestamp > 864e13) throw new CustomError("INVALID_LEDGER_ENTRY", `Refusing to replay entry seq=${entry.sequence} with out-of-range timestamp: ${String(entry.timestamp)}`);
186
+ const expectedChainId = this.resolver.config.chainId || this.resolver.ledger.chainId;
187
+ if (entry.chainId !== expectedChainId) throw new CustomError("CHAIN_ID_MISMATCH", `Ledger entry chainId mismatch at seq=${entry.sequence}: expected ${expectedChainId}, got ${entry.chainId}`);
188
+ const appendToLedger = options.appendToLedger !== false;
189
+ if (options.entryHashV2From !== void 0 && options.entryHashV2From !== "infinity" && (!Number.isSafeInteger(options.entryHashV2From) || options.entryHashV2From < 1)) throw new CustomError("INVALID_LEDGER_ENTRY", `Invalid entryHashV2From replay option: ${String(options.entryHashV2From)}`);
190
+ if (!Number.isSafeInteger(entry.sequence) || entry.sequence < 1 || !Number.isSafeInteger(entry.nonce) || entry.nonce < 0 || typeof entry.entryHash !== "string" || !entry.entryHash || entry.stateCommitHash !== void 0 && typeof entry.stateCommitHash !== "string") throw new CustomError("INVALID_LEDGER_ENTRY", `Ledger entry seq=${String(entry.sequence)} has invalid sequence, nonce, or entryHash types`);
191
+ const localLatestSeq = await this.resolver.ledger.getLatestSequence();
192
+ if (appendToLedger) {
193
+ if (entry.sequence <= localLatestSeq) {
194
+ const existing = await this.resolver.ledger.getBySequence(entry.sequence);
195
+ if (existing && existing.entryHash === entry.entryHash && existing.hash === entry.hash) return {
196
+ status: "already-applied",
197
+ sequence: entry.sequence,
198
+ hash: entry.hash,
199
+ code: "ALREADY_APPLIED",
200
+ stateCommitHash: existing.stateCommitHash || null
201
+ };
202
+ throw new CustomError("LEDGER_DIVERGENCE", `Ledger divergence at seq=${entry.sequence}: local entryHash=${existing?.entryHash ?? "missing"} !== upstream ${entry.entryHash}`);
203
+ }
204
+ if (entry.sequence !== localLatestSeq + 1) throw new CustomError("SEQUENCE_GAP", `Non-contiguous replay sequence: localLatest=${localLatestSeq}, got seq=${entry.sequence}`);
205
+ }
206
+ this.verifyRawTxHashMatchesEntry(entry);
207
+ const decodedTx = this.authenticateAndDecodeEntry(entry);
208
+ const expectedStateCommit = (entry.stateCommitHash ?? "").trim();
209
+ if (appendToLedger) {
210
+ const v2Cutoff = options.entryHashV2From === "infinity" ? Number.POSITIVE_INFINITY : typeof options.entryHashV2From === "number" ? options.entryHashV2From : this.resolver.ledger.getEntryHashV2From?.() ?? 1;
211
+ const expectedEntryHash = computeEntryHash(entry.sequence, entry.txRaw, expectedStateCommit, entry.sequence >= v2Cutoff ? 2 : 1);
212
+ if (entry.entryHash !== expectedEntryHash) throw new CustomError("INVALID_LEDGER_ENTRY", `Ledger entryHash mismatch before execution at seq=${entry.sequence}: expected ${expectedEntryHash}, got ${entry.entryHash}`);
213
+ }
214
+ if (!expectedStateCommit) {
215
+ if (appendToLedger) await this.appendVerifiedEntryToLedger(entry, options.entryHashV2From);
216
+ await this.indexOrphanEntry(entry, decodedTx);
217
+ return {
218
+ status: "orphan-indexed",
219
+ sequence: entry.sequence,
220
+ hash: entry.hash,
221
+ code: "ORPHAN_LEDGER_ENTRY",
222
+ stateCommitHash: null
223
+ };
224
+ }
225
+ const unpackedExtra = entry.txExtra && typeof entry.txExtra === "object" ? { ...entry.txExtra } : {};
226
+ const execContext = {
227
+ txBase64: entry.txRaw,
228
+ statedb: this.resolver.statedb,
229
+ indexdb: this.resolver.indexdb,
230
+ ledger: void 0,
231
+ ledgerSequence: entry.sequence,
232
+ config: this.resolver.config,
233
+ filter: this.emptyFilter,
234
+ logger: this.resolver.logger,
235
+ extra: {
236
+ ...unpackedExtra,
237
+ txTime: entry.timestamp,
238
+ _isReplay: true
239
+ }
240
+ };
241
+ this.activeExpectedCommitHash = expectedStateCommit;
242
+ this.lastCommittedHash = null;
243
+ this.lastCommitMismatchError = null;
244
+ this.lastStorageError = null;
245
+ let execError = null;
246
+ try {
247
+ await this.executor.execute(execContext);
248
+ } catch (err) {
249
+ execError = err;
250
+ } finally {
251
+ this.activeExpectedCommitHash = void 0;
252
+ }
253
+ if (!this.lastCommittedHash && this.lastStorageError) throw this.lastStorageError;
254
+ if (this.lastCommitMismatchError) throw this.lastCommitMismatchError;
255
+ if (this.lastStorageError) throw this.lastStorageError;
256
+ if (execError?.code === "STATE_COMMIT_MISMATCH") throw execError;
257
+ if (execError && isLocalStorageEngineError(execError)) {
258
+ execError.localStorageFailure = true;
259
+ throw execError;
260
+ }
261
+ if (typeof this.resolver.statedb.runAsLambda === "function") {
262
+ if (!this.lastCommittedHash) throw new CustomError("STATE_COMMIT_MISMATCH", `Replay of seq=${entry.sequence} (${entry.hash}) did not commit state (expected ${expectedStateCommit}; error=${execError?.code || execError?.message || "none"})`);
263
+ if (normalizeHexLower(this.lastCommittedHash) !== normalizeHexLower(expectedStateCommit)) throw new CustomError("STATE_COMMIT_MISMATCH", `State commit mismatch at seq=${entry.sequence}: expected ${expectedStateCommit}, got ${this.lastCommittedHash}`);
264
+ }
265
+ const replayedHash = typeof execContext.txHash === "string" ? execContext.txHash : "";
266
+ if (replayedHash && replayedHash.toUpperCase() !== entry.hash.toUpperCase()) throw new CustomError("TX_HASH_MISMATCH", `Replayed txHash (${replayedHash}) !== ledger entry hash (${entry.hash}) at seq=${entry.sequence}`);
267
+ if (appendToLedger) await this.appendVerifiedEntryToLedger(entry, options.entryHashV2From);
268
+ await this.resolver.flushIndexWrites();
269
+ return {
270
+ status: execError ? "persisted-failed" : "applied",
271
+ sequence: entry.sequence,
272
+ hash: entry.hash,
273
+ code: execError ? execError.code || "FAILED" : "OK",
274
+ stateCommitHash: this.lastCommittedHash ?? expectedStateCommit
275
+ };
276
+ });
277
+ }
278
+ /**
279
+ * Dry-run verify a proposed batch of `1..N` finalized entries inside a single rolled-back SQLite
280
+ * transaction (#1712 HotStuff-Lite replica voting), verifying every entry's wire format, `entryHash`,
281
+ * and post-execution `_state_commit` hash with zero mutations to `statedb`, `trusted`, `indexdb`, or `ledger`.
282
+ */
283
+ async dryRunVerifyEntries(entries, options = {}) {
284
+ return this.runExclusive(async () => {
285
+ if (!Array.isArray(entries) || entries.length === 0) throw new CustomError("INVALID_LEDGER_ENTRY", "Cannot dry-run an empty proposal entry batch");
286
+ if (typeof this.resolver.statedb.runWithinDryRunSession !== "function") throw new CustomError("DRY_RUN_UNSUPPORTED", "StateDB adapter does not support runWithinDryRunSession for BFT replica dry-run verification");
287
+ const expectedChainId = this.resolver.config.chainId || this.resolver.ledger.chainId;
288
+ const baseSeq = options.expectedPrevSequence !== void 0 ? options.expectedPrevSequence : await this.resolver.ledger.getLatestSequence();
289
+ const v2Cutoff = options.entryHashV2From === "infinity" ? Number.POSITIVE_INFINITY : typeof options.entryHashV2From === "number" ? options.entryHashV2From : this.resolver.ledger.getEntryHashV2From?.() ?? 1;
290
+ const entryHashes = [];
291
+ for (let i = 0; i < entries.length; i++) {
292
+ const entry = entries[i];
293
+ if (!entry || typeof entry !== "object") throw new CustomError("INVALID_LEDGER_ENTRY", `Proposal entry at index ${i} is not an object`);
294
+ if (entry.finalized !== true) throw new CustomError("UNFINALIZED_LEDGER_ENTRY", `Proposal entry seq=${String(entry.sequence)} must be finalized`);
295
+ if (entry.chainId !== expectedChainId) throw new CustomError("CHAIN_ID_MISMATCH", `Proposal entry chainId mismatch at seq=${String(entry.sequence)}: expected ${expectedChainId}, got ${entry.chainId}`);
296
+ if (entry.sequence !== baseSeq + i + 1) throw new CustomError("SEQUENCE_GAP", `Proposal entry sequence mismatch at index ${i}: expected ${baseSeq + i + 1}, got ${entry.sequence}`);
297
+ this.validateWireEntry(entry);
298
+ const expectedStateCommit = (entry.stateCommitHash ?? "").trim();
299
+ const expectedEntryHash = computeEntryHash(entry.sequence, entry.txRaw, expectedStateCommit, entry.sequence >= v2Cutoff ? 2 : 1);
300
+ if (entry.entryHash !== expectedEntryHash) throw new CustomError("INVALID_LEDGER_ENTRY", `Proposal entryHash mismatch at seq=${entry.sequence}: expected ${expectedEntryHash}, got ${entry.entryHash}`);
301
+ entryHashes.push(entry.entryHash);
302
+ }
303
+ let derivedStateRoot = (options.prevStateRoot ?? "").trim();
304
+ const dryRunFilter = new Blacklist();
305
+ try {
306
+ await this.resolver.statedb.runWithinDryRunSession(async (runSubLambda) => {
307
+ this.activeSubLambdaOverride = runSubLambda;
308
+ try {
309
+ for (const entry of entries) {
310
+ const expectedStateCommit = (entry.stateCommitHash ?? "").trim();
311
+ if (!expectedStateCommit) continue;
312
+ const unpackedExtra = entry.txExtra && typeof entry.txExtra === "object" ? { ...entry.txExtra } : {};
313
+ const execContext = {
314
+ txBase64: entry.txRaw,
315
+ statedb: this.resolver.statedb,
316
+ indexdb: this.resolver.indexdb,
317
+ ledger: void 0,
318
+ ledgerSequence: entry.sequence,
319
+ config: this.resolver.config,
320
+ filter: dryRunFilter,
321
+ logger: this.resolver.logger,
322
+ extra: {
323
+ ...unpackedExtra,
324
+ txTime: entry.timestamp,
325
+ _isReplay: true,
326
+ _dryRun: true
327
+ }
328
+ };
329
+ this.activeExpectedCommitHash = expectedStateCommit;
330
+ this.lastCommittedHash = null;
331
+ this.lastCommitMismatchError = null;
332
+ this.lastStorageError = null;
333
+ let execError = null;
334
+ try {
335
+ await this.executor.execute(execContext);
336
+ } catch (err) {
337
+ execError = err;
338
+ } finally {
339
+ this.activeExpectedCommitHash = void 0;
340
+ }
341
+ if (!this.lastCommittedHash && this.lastStorageError) throw this.lastStorageError;
342
+ if (this.lastCommitMismatchError) throw this.lastCommitMismatchError;
343
+ if (this.lastStorageError) throw this.lastStorageError;
344
+ if (execError?.code === "STATE_COMMIT_MISMATCH") throw execError;
345
+ if (execError && isLocalStorageEngineError(execError)) {
346
+ execError.localStorageFailure = true;
347
+ throw execError;
348
+ }
349
+ if (!this.lastCommittedHash) throw new CustomError("STATE_COMMIT_MISMATCH", `Dry-run of seq=${entry.sequence} (${entry.hash}) did not commit state (expected ${expectedStateCommit}; error=${execError?.code || execError?.message || "none"})`);
350
+ if (normalizeHexLower(this.lastCommittedHash) !== normalizeHexLower(expectedStateCommit)) throw new CustomError("STATE_COMMIT_MISMATCH", `Dry-run state commit mismatch at seq=${entry.sequence}: expected ${expectedStateCommit}, got ${this.lastCommittedHash}`);
351
+ const replayedHash = typeof execContext.txHash === "string" ? execContext.txHash : "";
352
+ if (replayedHash && replayedHash.toUpperCase() !== entry.hash.toUpperCase()) throw new CustomError("TX_HASH_MISMATCH", `Dry-run txHash (${replayedHash}) !== proposal entry hash (${entry.hash}) at seq=${entry.sequence}`);
353
+ derivedStateRoot = this.lastCommittedHash;
354
+ }
355
+ } finally {
356
+ this.activeSubLambdaOverride = null;
357
+ this.activeExpectedCommitHash = void 0;
358
+ }
359
+ });
360
+ } catch (dryRunErr) {
361
+ if (dryRunErr && typeof dryRunErr === "object" && isLocalStorageEngineError(dryRunErr)) dryRunErr.localStorageFailure = true;
362
+ throw dryRunErr;
363
+ }
364
+ return {
365
+ derivedStateRoot,
366
+ entryHashes
367
+ };
368
+ });
369
+ }
370
+ /**
371
+ * Scan existing local ledger entries in `[fromSeq, toSeq]` and ensure any force-finalized
372
+ * orphan entries (`stateCommitHash === ''`) are indexed into `indexdb.tx` after `rebuildIndex()`.
373
+ */
374
+ async indexExistingOrphanEntries(fromSeq = 1, toSeq) {
375
+ const latestSeq = toSeq ?? await this.resolver.ledger.getLatestSequence();
376
+ if (latestSeq < fromSeq) return 0;
377
+ let indexedCount = 0;
378
+ const pageSize = 200;
379
+ for (let cursor = Math.max(1, fromSeq); cursor <= latestSeq; cursor += pageSize) {
380
+ const end = Math.min(latestSeq, cursor + pageSize - 1);
381
+ const entries = await this.resolver.ledger.getRange(cursor, end);
382
+ for (const entry of entries) if (!entry.stateCommitHash || !entry.stateCommitHash.trim()) {
383
+ this.verifyRawTxHashMatchesEntry(entry);
384
+ const decodedTx = this.authenticateAndDecodeEntry(entry);
385
+ await this.indexOrphanEntry(entry, decodedTx);
386
+ indexedCount++;
387
+ }
388
+ }
389
+ return indexedCount;
390
+ }
391
+ };
392
+
393
+ //#endregion
394
+ export { LedgerEntryReplayer };
@@ -1,6 +1,6 @@
1
- import { BN, fromTokenToUnit, isSameDid } from "@ocap/util";
2
- import { toTypeInfo } from "@arcblock/did";
3
1
  import { types } from "@ocap/mcrypto";
2
+ import { toTypeInfo } from "@arcblock/did";
3
+ import { BN, fromTokenToUnit, isSameDid } from "@ocap/util";
4
4
  import { isGasStakeAddress } from "@ocap/tx-protocols/lib/util";
5
5
  import omit from "lodash/omit.js";
6
6
  import { createIndexedTokenDistribution } from "@ocap/indexdb/lib/util";
@@ -1,6 +1,6 @@
1
1
  import { BN, fromTokenToUnit, isSameDid } from "@ocap/util";
2
- import { schemas, v, vDID, vValidate } from "@arcblock/validator";
3
2
  import { CustomError } from "@ocap/util/lib/error";
3
+ import { schemas, v, vDID, vValidate } from "@arcblock/validator";
4
4
  import uniq from "lodash/uniq.js";
5
5
  import { FORGE_TOKEN_HOLDER } from "@ocap/state/lib/states/tx";
6
6
 
package/esm/types.d.mts CHANGED
@@ -1,4 +1,5 @@
1
- import { Address, BN, DirectionMap, Hash, IAccountState, IAddressArgs, IAny, IAssetFactoryState, IAssetState, IBalanceTable, IChainConfig, IChainConfig as IChainConfig$1, IChainState, IDelegateState, IEvidenceState, IExecutedContext, IForeignToken, IGetAccountStateArgs, IGetAccountTokensArgs, IIndexDB, IIndexDB as IIndexDB$1, IIndexTable, IIndexTable as IIndexTable$1, ILedger, IListAccountsResult, IListAssetsResult, IListDelegationsResult, IListFactoriesResult, IListRollupBlocksResult, IListRollupValidatorsResult, IListRollupsResult, IListStakesResult, IListTokenFactoriesResult, IListTokensResult, IListTransactionsResult, IOperationContext, IPipelineLogger, IPipelineLogger as IPipelineLogger$1, IResolver, IResolverAccountState, IResolverChainInfo, IResolverContext, IResolverContext as IResolverContext$1, IResolverFactoryState, IResolverForgeStats, IResolverListAccountsResult, IResolverListAssetsResult, IResolverListDelegationsResult, IResolverListFactoriesResult, IResolverListRollupBlocksResult, IResolverListRollupValidatorsResult, IResolverListRollupsResult, IResolverListStakesResult, IResolverListTokenFactoriesResult, IResolverListTokensResult, IResolverListTransactionsResult, IResolverNetInfo, IResolverNodeInfo, IResolverPaging, IResolverPaging as IResolverPaging$1, IResolverRollupState, IResolverStakeState, IResolverTransaction, IResolverTxItxJson, IResolverValidatorsInfo, IRollupBlock, IRollupState, IRollupValidator, IStakeState, IStateContext, IStateDB, IStateDB as IStateDB$1, IStateTable, IStateTable as IStateTable$1, ITokenConfig, ITokenFactoryState, ITokenFlowsResult, ITokenInfo, ITokenInfo as ITokenInfo$1, ITokenMetadata, ITokenState, ITransactionConfig, ITxGasConfig, ITxStakeConfig, ITxState, IVaultsConfig, IndexTableTypeMap, Promisable, TAccountFilter, TAccountToken, TAddressFilter, TAssetFilter, TDelegationFilter, TFactoryFilter, TIndexedAccountState, TIndexedAssetState, TIndexedDelegationState, TIndexedFactoryState, TIndexedRollupBlock, TIndexedRollupState, TIndexedRollupValidator, TIndexedStakeState, TIndexedTokenFactoryState, TIndexedTokenState, TIndexedTokenState as TIndexedTokenState$1, TIndexedTransaction, TPage, TPageInfo, TPageOrder, TRangeFilter, TReceiptChange, TRequestEstimateGas, TRequestGetEvidenceState, TRequestGetRollupBlock, TRequestGetTokenDistribution, TRequestGetTx, TRequestListAssetTransactions, TRequestListAssets, TRequestListDelegations, TRequestListFactories, TRequestListRollupBlocks, TRequestListRollupValidators, TRequestListRollups, TRequestListStakes, TRequestListTokenFactories, TRequestListTokenFlows, TRequestListTokens, TRequestListTopAccounts, TRequestListTransactions, TRequestSearch, TRequestVerifyAccountRisk, TRollupFilter, TSearchResult, TStakeFilter, TTimeFilter, TTokenDistribution, TTokenFactoryFilter, TTokenFilter, TTokenMeta, TTransactionReceipt, TTxFilter, TTypeFilter, TValidatorFilter, TValidityFilter, TVerifyAccountRiskResult, TokenBalanceMap, ValidityMap } from "@ocap/types";
1
+ import * as _ocap_types0 from "@ocap/types";
2
+ import { Address, BN, DirectionMap, Hash, IAccountState, IAddressArgs, IAny, IAssetFactoryState, IAssetState, IBalanceTable, IChainConfig, IChainConfig as IChainConfig$1, IChainState, IDelegateState, IEvidenceState, IExecutedContext, IFollowerStatusResponse, IForeignToken, IGetAccountStateArgs, IGetAccountTokensArgs, IIndexDB, IIndexDB as IIndexDB$1, IIndexTable, IIndexTable as IIndexTable$1, ILedger, IListAccountsResult, IListAssetsResult, IListDelegationsResult, IListFactoriesResult, IListRollupBlocksResult, IListRollupValidatorsResult, IListRollupsResult, IListStakesResult, IListTokenFactoriesResult, IListTokensResult, IListTransactionsResult, INodeRuntimeAdapter, IOperationContext, IPipelineLogger, IPipelineLogger as IPipelineLogger$1, IResolver, IResolverAccountState, IResolverChainInfo, IResolverContext, IResolverContext as IResolverContext$1, IResolverFactoryState, IResolverForgeStats, IResolverListAccountsResult, IResolverListAssetsResult, IResolverListDelegationsResult, IResolverListFactoriesResult, IResolverListRollupBlocksResult, IResolverListRollupValidatorsResult, IResolverListRollupsResult, IResolverListStakesResult, IResolverListTokenFactoriesResult, IResolverListTokensResult, IResolverListTransactionsResult, IResolverNetInfo, IResolverNodeInfo, IResolverPaging, IResolverPaging as IResolverPaging$1, IResolverRollupState, IResolverStakeState, IResolverTransaction, IResolverTxItxJson, IResolverValidatorsInfo, IRollupBlock, IRollupState, IRollupValidator, IStakeState, IStateContext, IStateDB, IStateDB as IStateDB$1, IStateTable, IStateTable as IStateTable$1, ITokenConfig, ITokenFactoryState, ITokenFlowsResult, ITokenInfo, ITokenInfo as ITokenInfo$1, ITokenMetadata, ITokenState, ITransactionConfig, ITxGasConfig, ITxStakeConfig, ITxState, IVaultsConfig, IndexTableTypeMap, Promisable, TAccountFilter, TAccountToken, TAddressFilter, TAssetFilter, TDelegationFilter, TFactoryFilter, TFollowerSyncMode, TIndexedAccountState, TIndexedAssetState, TIndexedDelegationState, TIndexedFactoryState, TIndexedRollupBlock, TIndexedRollupState, TIndexedRollupValidator, TIndexedStakeState, TIndexedTokenFactoryState, TIndexedTokenState, TIndexedTokenState as TIndexedTokenState$1, TIndexedTransaction, TNodeRole, TNodeWritePolicy, TPage, TPageInfo, TPageOrder, TRangeFilter, TReceiptChange, TRequestEstimateGas, TRequestGetEvidenceState, TRequestGetRollupBlock, TRequestGetTokenDistribution, TRequestGetTx, TRequestListAssetTransactions, TRequestListAssets, TRequestListDelegations, TRequestListFactories, TRequestListRollupBlocks, TRequestListRollupValidators, TRequestListRollups, TRequestListStakes, TRequestListTokenFactories, TRequestListTokenFlows, TRequestListTokens, TRequestListTopAccounts, TRequestListTransactions, TRequestSearch, TRequestVerifyAccountRisk, TRollupFilter, TSearchResult, TStakeFilter, TTimeFilter, TTokenDistribution, TTokenFactoryFilter, TTokenFilter, TTokenMeta, TTransactionReceipt, TTxFilter, TTypeFilter, TValidatorFilter, TValidityFilter, TVerifyAccountRiskResult, TokenBalanceMap, ValidityMap } from "@ocap/types";
2
3
 
3
4
  //#region src/types.d.ts
4
5
 
@@ -84,7 +85,29 @@ interface IResolverParams {
84
85
  ledger: ILedger;
85
86
  config: IChainConfig$1;
86
87
  filter?: IFilter;
88
+ /**
89
+ * Optional pre-queue RPC admission blocklist callback (#1756).
90
+ * Enforces node-local `blockedAccounts` BEFORE consensus/queue entry without mutating
91
+ * deterministic `OCAPExecutor` `_state_commit` hashes across HotStuff replicas or Followers.
92
+ */
93
+ admissionBlockedCheck?: (address: string) => boolean | Promise<boolean>;
94
+ /**
95
+ * Optional pre-queue RPC admission reserved-symbol callback (#1756).
96
+ * Enforces node-local `reservedSymbols` BEFORE consensus/queue entry without mutating
97
+ * deterministic `OCAPExecutor` `_state_commit` hashes across HotStuff replicas or Followers.
98
+ */
99
+ admissionReservedSymbolCheck?: (symbol: string) => boolean | Promise<boolean>;
87
100
  validateTokenConfig?: boolean;
101
+ skipInitializeStateDB?: boolean;
102
+ deferInitialize?: boolean;
103
+ consensusMode?: 'single' | 'hotstuff';
104
+ txQueueConfig?: {
105
+ maxRequest?: number;
106
+ concurrent?: number;
107
+ timeoutMs?: number;
108
+ };
109
+ now?: () => number;
110
+ nodeRuntime?: _ocap_types0.INodeRuntimeAdapter;
88
111
  logger?: IPipelineLogger$1;
89
112
  }
90
113
  /**
@@ -113,4 +136,4 @@ interface IMigrationChain {
113
136
  findAddressAtTime: (address: string, time: Date) => string;
114
137
  }
115
138
  //#endregion
116
- export { type Address, type BN, type DirectionMap, FlexibleIndexDB, FlexibleStateDB, type Hash, type IAccountState, type IAddressArgs, type IAny, type IAssetFactoryState, type IAssetState, type IBalanceTable, type IChainConfig, type IChainState, IChunkIterator, IDataObject, type IDelegateState, IDelegationOp, type IEvidenceState, type IExecutedContext, IFilter, type IForeignToken, type IGetAccountStateArgs, type IGetAccountTokensArgs, IGetStateParams, type IIndexDB, type IIndexTable, type IListAccountsResult, type IListAssetsResult, IListChunksParams, type IListDelegationsResult, type IListFactoriesResult, type IListRollupBlocksResult, type IListRollupValidatorsResult, type IListRollupsResult, type IListStakesResult, type IListTokenFactoriesResult, type IListTokensResult, type IListTransactionsResult, IMigrationChain, type IOperationContext, IPaginatedResult, type IPipelineLogger, type IResolver, type IResolverAccountState, type IResolverChainInfo, type IResolverContext, type IResolverFactoryState, type IResolverForgeStats, type IResolverListAccountsResult, type IResolverListAssetsResult, type IResolverListDelegationsResult, type IResolverListFactoriesResult, type IResolverListRollupBlocksResult, type IResolverListRollupValidatorsResult, type IResolverListRollupsResult, type IResolverListStakesResult, type IResolverListTokenFactoriesResult, type IResolverListTokensResult, type IResolverListTransactionsResult, type IResolverNetInfo, type IResolverNodeInfo, type IResolverPaging, IResolverParams, type IResolverRollupState, type IResolverStakeState, type IResolverTransaction, type IResolverTxItxJson, type IResolverValidatorsInfo, type IRollupBlock, type IRollupState, type IRollupValidator, type IStakeState, type IStateContext, type IStateDB, type IStateTable, ITokenCache, type ITokenConfig, type ITokenFactoryState, type ITokenFlowsResult, type ITokenInfo, type ITokenMetadata, type ITokenState, type ITransactionConfig, ITrustedAccountConfig, type ITxGasConfig, type ITxStakeConfig, type ITxState, type IVaultsConfig, type IndexTableTypeMap, type Promisable, type TAccountFilter, type TAccountToken, type TAddressFilter, type TAssetFilter, type TDelegationFilter, type TFactoryFilter, type TIndexedAccountState, type TIndexedAssetState, type TIndexedDelegationState, type TIndexedFactoryState, type TIndexedRollupBlock, type TIndexedRollupState, type TIndexedRollupValidator, type TIndexedStakeState, type TIndexedTokenFactoryState, type TIndexedTokenState, type TIndexedTransaction, type TPage, type TPageInfo, type TPageOrder, type TRangeFilter, type TReceiptChange, type TRequestEstimateGas, type TRequestGetEvidenceState, type TRequestGetRollupBlock, type TRequestGetTokenDistribution, type TRequestGetTx, type TRequestListAssetTransactions, type TRequestListAssets, type TRequestListDelegations, type TRequestListFactories, type TRequestListRollupBlocks, type TRequestListRollupValidators, type TRequestListRollups, type TRequestListStakes, type TRequestListTokenFactories, type TRequestListTokenFlows, type TRequestListTokens, type TRequestListTopAccounts, type TRequestListTransactions, type TRequestSearch, type TRequestVerifyAccountRisk, type TRollupFilter, type TSearchResult, type TStakeFilter, type TTimeFilter, type TTokenDistribution, type TTokenFactoryFilter, type TTokenFilter, type TTokenMeta, type TTransactionReceipt, type TTxFilter, type TTypeFilter, type TValidatorFilter, type TValidityFilter, type TVerifyAccountRiskResult, type TokenBalanceMap, type ValidityMap };
139
+ export { type Address, type BN, type DirectionMap, FlexibleIndexDB, FlexibleStateDB, type Hash, type IAccountState, type IAddressArgs, type IAny, type IAssetFactoryState, type IAssetState, type IBalanceTable, type IChainConfig, type IChainState, IChunkIterator, IDataObject, type IDelegateState, IDelegationOp, type IEvidenceState, type IExecutedContext, IFilter, type IFollowerStatusResponse, type IForeignToken, type IGetAccountStateArgs, type IGetAccountTokensArgs, IGetStateParams, type IIndexDB, type IIndexTable, type IListAccountsResult, type IListAssetsResult, IListChunksParams, type IListDelegationsResult, type IListFactoriesResult, type IListRollupBlocksResult, type IListRollupValidatorsResult, type IListRollupsResult, type IListStakesResult, type IListTokenFactoriesResult, type IListTokensResult, type IListTransactionsResult, IMigrationChain, type INodeRuntimeAdapter, type IOperationContext, IPaginatedResult, type IPipelineLogger, type IResolver, type IResolverAccountState, type IResolverChainInfo, type IResolverContext, type IResolverFactoryState, type IResolverForgeStats, type IResolverListAccountsResult, type IResolverListAssetsResult, type IResolverListDelegationsResult, type IResolverListFactoriesResult, type IResolverListRollupBlocksResult, type IResolverListRollupValidatorsResult, type IResolverListRollupsResult, type IResolverListStakesResult, type IResolverListTokenFactoriesResult, type IResolverListTokensResult, type IResolverListTransactionsResult, type IResolverNetInfo, type IResolverNodeInfo, type IResolverPaging, IResolverParams, type IResolverRollupState, type IResolverStakeState, type IResolverTransaction, type IResolverTxItxJson, type IResolverValidatorsInfo, type IRollupBlock, type IRollupState, type IRollupValidator, type IStakeState, type IStateContext, type IStateDB, type IStateTable, ITokenCache, type ITokenConfig, type ITokenFactoryState, type ITokenFlowsResult, type ITokenInfo, type ITokenMetadata, type ITokenState, type ITransactionConfig, ITrustedAccountConfig, type ITxGasConfig, type ITxStakeConfig, type ITxState, type IVaultsConfig, type IndexTableTypeMap, type Promisable, type TAccountFilter, type TAccountToken, type TAddressFilter, type TAssetFilter, type TDelegationFilter, type TFactoryFilter, type TFollowerSyncMode, type TIndexedAccountState, type TIndexedAssetState, type TIndexedDelegationState, type TIndexedFactoryState, type TIndexedRollupBlock, type TIndexedRollupState, type TIndexedRollupValidator, type TIndexedStakeState, type TIndexedTokenFactoryState, type TIndexedTokenState, type TIndexedTransaction, type TNodeRole, type TNodeWritePolicy, type TPage, type TPageInfo, type TPageOrder, type TRangeFilter, type TReceiptChange, type TRequestEstimateGas, type TRequestGetEvidenceState, type TRequestGetRollupBlock, type TRequestGetTokenDistribution, type TRequestGetTx, type TRequestListAssetTransactions, type TRequestListAssets, type TRequestListDelegations, type TRequestListFactories, type TRequestListRollupBlocks, type TRequestListRollupValidators, type TRequestListRollups, type TRequestListStakes, type TRequestListTokenFactories, type TRequestListTokenFlows, type TRequestListTokens, type TRequestListTopAccounts, type TRequestListTransactions, type TRequestSearch, type TRequestVerifyAccountRisk, type TRollupFilter, type TSearchResult, type TStakeFilter, type TTimeFilter, type TTokenDistribution, type TTokenFactoryFilter, type TTokenFilter, type TTokenMeta, type TTransactionReceipt, type TTxFilter, type TTypeFilter, type TValidatorFilter, type TValidityFilter, type TVerifyAccountRiskResult, type TokenBalanceMap, type ValidityMap };