@ocap/tx-pipeline 1.31.4 → 1.31.6

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 (57) hide show
  1. package/esm/bridge-release-keys.d.mts +17 -1
  2. package/esm/bridge-release-keys.mjs +35 -20
  3. package/esm/bridge-reserves.d.mts +48 -9
  4. package/esm/bridge-reserves.mjs +66 -16
  5. package/esm/helpers/bridge-withdraw.d.mts +22 -38
  6. package/esm/helpers/bridge-withdraw.mjs +57 -77
  7. package/esm/helpers/replay-guard.d.mts +29 -12
  8. package/esm/helpers/replay-guard.mjs +68 -22
  9. package/esm/index.d.mts +3 -3
  10. package/esm/index.mjs +3 -3
  11. package/esm/legacy-protocol-sunset.d.mts +35 -21
  12. package/esm/legacy-protocol-sunset.mjs +124 -70
  13. package/esm/legacy-rollup-archive.d.mts +44 -7
  14. package/esm/legacy-rollup-archive.mjs +78 -13
  15. package/esm/library.d.mts +3 -3
  16. package/esm/library.mjs +3 -3
  17. package/esm/pipes/bridge-release-gate.d.mts +3 -2
  18. package/esm/pipes/bridge-release-gate.mjs +90 -35
  19. package/esm/pipes/bridge-reserve-v2-gate.d.mts +2 -0
  20. package/esm/pipes/bridge-reserve-v2-gate.mjs +31 -13
  21. package/esm/pipes/decode-tx.mjs +1 -1
  22. package/esm/pipes/post-execution-invariant-gate.mjs +5 -4
  23. package/esm/pipes/pre-flight-waf.mjs +6 -3
  24. package/esm/pipes/verify-multisig-v2.mjs +1 -1
  25. package/esm/pipes/verify-multisig.mjs +1 -1
  26. package/esm/pipes/verify-tx-size.mjs +8 -2
  27. package/esm/pipes/verify-tx.mjs +1 -1
  28. package/esm/transaction-block.mjs +11 -0
  29. package/lib/bridge-release-keys.cjs +35 -18
  30. package/lib/bridge-release-keys.d.cts +17 -1
  31. package/lib/bridge-reserves.cjs +73 -18
  32. package/lib/bridge-reserves.d.cts +48 -9
  33. package/lib/helpers/bridge-withdraw.cjs +60 -80
  34. package/lib/helpers/bridge-withdraw.d.cts +22 -38
  35. package/lib/helpers/replay-guard.cjs +64 -17
  36. package/lib/helpers/replay-guard.d.cts +29 -12
  37. package/lib/index.cjs +2 -2
  38. package/lib/index.d.cts +3 -3
  39. package/lib/legacy-protocol-sunset.cjs +122 -69
  40. package/lib/legacy-protocol-sunset.d.cts +35 -21
  41. package/lib/legacy-rollup-archive.cjs +82 -14
  42. package/lib/legacy-rollup-archive.d.cts +44 -7
  43. package/lib/library.cjs +1 -2
  44. package/lib/library.d.cts +3 -3
  45. package/lib/pipes/bridge-release-gate.cjs +89 -33
  46. package/lib/pipes/bridge-release-gate.d.cts +3 -2
  47. package/lib/pipes/bridge-reserve-v2-gate.cjs +30 -12
  48. package/lib/pipes/bridge-reserve-v2-gate.d.cts +2 -0
  49. package/lib/pipes/decode-tx.cjs +1 -1
  50. package/lib/pipes/post-execution-invariant-gate.cjs +3 -2
  51. package/lib/pipes/pre-flight-waf.cjs +6 -3
  52. package/lib/pipes/verify-multisig-v2.cjs +1 -1
  53. package/lib/pipes/verify-multisig.cjs +1 -1
  54. package/lib/pipes/verify-tx-size.cjs +8 -2
  55. package/lib/pipes/verify-tx.cjs +1 -1
  56. package/lib/transaction-block.cjs +11 -0
  57. package/package.json +10 -10
@@ -1,4 +1,4 @@
1
- import { DEFAULT_ROLLUP_SUNSET_ACTIVATION_HEIGHT, parseLegacyRollupReadOnlyRecord } from "./legacy-rollup-archive.mjs";
1
+ import { assertNoBlockHeightParams, assertRollupBranchInfo, isBridgeBranch, parseLegacyRollupReadOnlyRecord } from "./legacy-rollup-archive.mjs";
2
2
  import { executeTransactionBlock, extractStateFootprint } from "./transaction-block.mjs";
3
3
  import { CustomError } from "@ocap/util/lib/error";
4
4
 
@@ -7,7 +7,6 @@ const ErrorCode = {
7
7
  InvalidSunset: "INVALID_LEGACY_PROTOCOL_SUNSET",
8
8
  ForbiddenSunset: "FORBIDDEN_LEGACY_PROTOCOL_SUNSET"
9
9
  };
10
- const DEFAULT_LEGACY_PROTOCOL_SUNSET_HEIGHT = DEFAULT_ROLLUP_SUNSET_ACTIVATION_HEIGHT;
11
10
  const MAX_LEGACY_MIOTX_PARTICIPANTS = 64;
12
11
  const MAX_LEGACY_MIOTX_TOKENS_PER_ENTRY = 32;
13
12
  const MAX_LEGACY_MIOTX_ASSETS_PER_ENTRY = 64;
@@ -64,7 +63,7 @@ const DEPRECATED_ROLLUP_AND_BRIDGE_TYPE_URLS = Object.freeze([
64
63
  ]);
65
64
  /**
66
65
  * Complete list of all 27 deprecated legacy `V1/V2/V3`, `miotx`, and Rollup write protocols
67
- * frozen into `READ_ONLY_LEGACY_ARCHIVE` mode after `sunsetActivationHeight`.
66
+ * frozen into `READ_ONLY_LEGACY_ARCHIVE` mode once the sunset is switched on.
68
67
  */
69
68
  const DEPRECATED_LEGACY_PROTOCOL_TYPE_URLS = Object.freeze([
70
69
  ...DEPRECATED_MIOTX_AND_TRADE_TYPE_URLS,
@@ -450,35 +449,99 @@ function getLegacyProtocolReplacementSpec(typeUrl) {
450
449
  }
451
450
  /**
452
451
  * Active Write Pipeline Sunset Gate (`assertLegacyProtocolNotSunset`):
453
- * - When `readOnlyArchiveMode === true` or `currentBlockHeight < sunsetActivationHeight`, allows historical read/replay.
454
- * - When `currentBlockHeight >= sunsetActivationHeight`, fails closed (`FORBIDDEN_LEGACY_PROTOCOL_SUNSET`) on all
455
- * 27 deprecated `V1/V2/V3`, `miotx`, and Rollup write protocols with actionable VNext migration guidance.
452
+ * - When `readOnlyArchiveMode === true`, allows historical read/replay.
453
+ * - Otherwise fails closed (`FORBIDDEN_LEGACY_PROTOCOL_SUNSET`) on all 27 deprecated `V1/V2/V3`, `miotx`, and Rollup
454
+ * write protocols of the v1 branch with actionable VNext migration guidance.
455
+ *
456
+ * #1720 (S4b, bridge/docs/deposit-withdraw-v2-unification.md §7.1): `branch` is required (missing throws, whatever the
457
+ * type) and the blockHeight parameters are gone (CHAIN_DESIGN §1 item 2): the sunset is switched on by wiring the guard
458
+ * (or the add-on's `SUNSET_READ_ONLY_ARCHIVE` mode), not by a height.
456
459
  */
457
460
  function assertLegacyProtocolNotSunset(params) {
458
461
  if (!params || typeof params !== "object") throw new CustomError(ErrorCode.InvalidSunset, "LegacyProtocolSunset: params must be an object");
462
+ assertNoBlockHeightParams(params, "LegacyProtocolSunset");
459
463
  const rawTypeUrl = assertCleanString(params.typeUrl, "typeUrl");
460
- if (!Number.isSafeInteger(params.currentBlockHeight) || params.currentBlockHeight < 0) throw new CustomError(ErrorCode.InvalidSunset, "LegacyProtocolSunset: currentBlockHeight must be a non-negative safe integer");
461
- const activationHeight = params.sunsetActivationHeight ?? DEFAULT_LEGACY_PROTOCOL_SUNSET_HEIGHT;
462
- if (!Number.isSafeInteger(activationHeight) || activationHeight < 1) throw new CustomError(ErrorCode.InvalidSunset, "LegacyProtocolSunset: sunsetActivationHeight must be a positive safe integer (>= 1)");
464
+ assertRollupBranchInfo(params.branch);
463
465
  if (params.readOnlyArchiveMode === true) return;
464
466
  const spec = getLegacyProtocolReplacementSpec(rawTypeUrl);
465
- if (spec && params.currentBlockHeight >= activationHeight) throw new CustomError(ErrorCode.ForbiddenSunset, `LegacyProtocolSunset: legacy write protocol ${spec.legacyTypeUrl} (${spec.category}${spec.isMiotx ? ", miotx" : ""}) is sunset and read-only at block height ${params.currentBlockHeight} (>= activation height ${activationHeight}). Replacement: ${spec.vnextReplacementTypeUrl} (${spec.migrationGuidance})`);
467
+ if (spec && isBridgeBranch(spec.legacyTypeUrl, params.branch)) return;
468
+ if (spec) throw new CustomError(ErrorCode.ForbiddenSunset, `LegacyProtocolSunset: legacy write protocol ${spec.legacyTypeUrl} (${spec.category}${spec.isMiotx ? ", miotx" : ""}) is sunset and read-only. Replacement: ${spec.vnextReplacementTypeUrl} (${spec.migrationGuidance})`);
469
+ }
470
+ /**
471
+ * #1720 (S4b): the rollup-family types. Each names a rollup row (`itx.rollup`), whose version decides the branch: the
472
+ * sunset outcome of `deposit_token_v2` / `withdraw_token_v2` / governance, and whether a record is a legacy rollup
473
+ * record at all. Every other type has no rollup row and so no bridge branch.
474
+ */
475
+ const ROLLUP_FAMILY_TYPE_URLS = new Set([
476
+ ...DEPRECATED_ROLLUP_AND_BRIDGE_TYPE_URLS,
477
+ "fg:t:rollup_state",
478
+ "fg:t:rollup_block"
479
+ ]);
480
+ /** Canonical type URL -> legacy rollup record kind (the archive delegates these to `parseLegacyRollupReadOnlyRecord`). */
481
+ const ROLLUP_RECORD_KIND_MAP = Object.freeze({
482
+ "fg:t:rollup_state": "RollupState",
483
+ "fg:t:rollup_block": "RollupBlock",
484
+ "fg:t:create_rollup_block": "RollupBlock",
485
+ "fg:t:deposit_token": "deposit_token_v2",
486
+ "fg:t:deposit_token_v2": "deposit_token_v2",
487
+ "fg:t:withdraw_token": "withdraw_token_v2",
488
+ "fg:t:withdraw_token_v2": "withdraw_token_v2"
489
+ });
490
+ const hasName = (value) => value !== void 0 && value !== null && String(value).trim() !== "";
491
+ /** The names a record / statement gives for its type (`typeUrl`, `type`, `recordKind`), each normalized. */
492
+ function namedTypeUrls(stmt) {
493
+ return [
494
+ "typeUrl",
495
+ "type",
496
+ "recordKind"
497
+ ].filter((k) => hasName(stmt[k])).map((k) => normalizeProtocolTypeUrl(String(stmt[k])));
498
+ }
499
+ /**
500
+ * #1720 review: a record whose `recordKind` names another type than its `typeUrl` / `type` is refused, like the
501
+ * typeUrl-vs-type conflict. The archive reads `recordKind` first and the add-on `typeUrl` first: a disagreement would
502
+ * let one name pick the branch (or skip it) and the other pick what is archived / compiled. Aliases of one legacy rollup
503
+ * record kind (`RollupBlock` / `create_rollup_block`) agree.
504
+ */
505
+ function assertRecordKindAgrees(stmt, label) {
506
+ if (!hasName(stmt.recordKind)) return;
507
+ const identity = (canonical) => ROLLUP_RECORD_KIND_MAP[canonical] ?? canonical;
508
+ const recordKind = identity(normalizeProtocolTypeUrl(String(stmt.recordKind)));
509
+ for (const k of ["typeUrl", "type"]) {
510
+ if (!hasName(stmt[k])) continue;
511
+ const other = identity(normalizeProtocolTypeUrl(String(stmt[k])));
512
+ if (other !== recordKind) throw new CustomError(ErrorCode.ForbiddenSunset, `LegacyProtocolSunset: ${label} has conflicting recordKind (${recordKind}) and typeUrl / type (${other})`);
513
+ }
466
514
  }
467
- function validateVNextStatementOrTemplate(stmt, label, currentBlockHeight, sunsetActivationHeight, requireStrictWhitelist, depth = 0) {
515
+ /** The v1 branch of a type that names no rollup row (not a rollup-family type). */
516
+ const NO_ROLLUP_BRANCH = Object.freeze({
517
+ isBridgeV2: false,
518
+ itx: null
519
+ });
520
+ /**
521
+ * #1720 (S4b): the branch of one statement / record for the statement-level helpers. A rollup-family type needs the
522
+ * caller's resolver (missing throws: never a default); any other type has no rollup row and is the v1 branch.
523
+ */
524
+ function resolveStatementBranch(stmt, canonicalTypeUrl, resolveBranch, label) {
525
+ if (![canonicalTypeUrl, ...namedTypeUrls(stmt)].some((name) => ROLLUP_FAMILY_TYPE_URLS.has(name))) return NO_ROLLUP_BRANCH;
526
+ if (typeof resolveBranch !== "function") throw new CustomError(ErrorCode.InvalidSunset, `LegacyProtocolSunset: ${label} (${canonicalTypeUrl}) needs branch information: pass resolveBranch (rollupBranchOf)`);
527
+ const branch = resolveBranch(stmt);
528
+ assertRollupBranchInfo(branch);
529
+ return branch;
530
+ }
531
+ function validateVNextStatementOrTemplate(stmt, label, resolveBranch, requireStrictWhitelist, depth = 0) {
468
532
  if (depth > 8) throw new CustomError(ErrorCode.ForbiddenSunset, `LegacyProtocolSunset: ${label} exceeds maximum nested statementTemplates depth`);
469
533
  if (!stmt || typeof stmt !== "object" || Array.isArray(stmt)) throw new CustomError(ErrorCode.InvalidSunset, `LegacyProtocolSunset: ${label} must be an object`);
470
534
  const hasTypeUrl = stmt.typeUrl !== void 0 && stmt.typeUrl !== null && String(stmt.typeUrl).trim() !== "";
471
535
  const hasType = stmt.type !== void 0 && stmt.type !== null && String(stmt.type).trim() !== "";
472
536
  if (!hasTypeUrl && !hasType) throw new CustomError(ErrorCode.InvalidSunset, `LegacyProtocolSunset: ${label} is missing type or typeUrl`);
537
+ assertRecordKindAgrees(stmt, label);
473
538
  if (hasTypeUrl) assertLegacyProtocolNotSunset({
474
539
  typeUrl: String(stmt.typeUrl),
475
- currentBlockHeight,
476
- sunsetActivationHeight
540
+ branch: resolveStatementBranch(stmt, normalizeProtocolTypeUrl(String(stmt.typeUrl)), resolveBranch, label)
477
541
  });
478
542
  if (hasType) assertLegacyProtocolNotSunset({
479
543
  typeUrl: String(stmt.type),
480
- currentBlockHeight,
481
- sunsetActivationHeight
544
+ branch: resolveStatementBranch(stmt, normalizeProtocolTypeUrl(String(stmt.type)), resolveBranch, label)
482
545
  });
483
546
  const canonicalFromTypeUrl = hasTypeUrl ? normalizeProtocolTypeUrl(String(stmt.typeUrl)) : "";
484
547
  const canonicalFromType = hasType ? normalizeProtocolTypeUrl(String(stmt.type)) : "";
@@ -506,7 +569,7 @@ function validateVNextStatementOrTemplate(stmt, label, currentBlockHeight, sunse
506
569
  ];
507
570
  for (const candidate of candidateTemplateArrays) if (candidate.templates !== void 0 && candidate.templates !== null) {
508
571
  if (!Array.isArray(candidate.templates)) throw new CustomError(ErrorCode.InvalidSunset, `LegacyProtocolSunset: ${candidate.path} must be an array when present`);
509
- for (let tIdx = 0; tIdx < candidate.templates.length; tIdx++) validateVNextStatementOrTemplate(candidate.templates[tIdx], `${candidate.path}[${tIdx}]`, currentBlockHeight, sunsetActivationHeight, requireStrictWhitelist, depth + 1);
572
+ for (let tIdx = 0; tIdx < candidate.templates.length; tIdx++) validateVNextStatementOrTemplate(candidate.templates[tIdx], `${candidate.path}[${tIdx}]`, resolveBranch, requireStrictWhitelist, depth + 1);
510
573
  }
511
574
  }
512
575
  }
@@ -516,12 +579,11 @@ function validateVNextStatementOrTemplate(stmt, label, currentBlockHeight, sunse
516
579
  * or nested `ContractNFT` `statementTemplates`.
517
580
  */
518
581
  function assertTransactionBlockVNextPure(block, options) {
582
+ assertNoBlockHeightParams(options, "LegacyProtocolSunset");
519
583
  if (!block || typeof block !== "object") throw new CustomError(ErrorCode.InvalidSunset, "LegacyProtocolSunset: block must be an object");
520
584
  if (!Array.isArray(block.statements) || block.statements.length === 0) throw new CustomError(ErrorCode.InvalidSunset, "LegacyProtocolSunset: TransactionBlock must contain at least one statement");
521
- const currentBlockHeight = options?.currentBlockHeight ?? DEFAULT_LEGACY_PROTOCOL_SUNSET_HEIGHT;
522
- const sunsetActivationHeight = options?.sunsetActivationHeight ?? DEFAULT_LEGACY_PROTOCOL_SUNSET_HEIGHT;
523
585
  const requireStrictWhitelist = options?.requireStrictCanonicalWhitelist ?? true;
524
- for (let i = 0; i < block.statements.length; i++) validateVNextStatementOrTemplate(block.statements[i], `statement[${i}]`, currentBlockHeight, sunsetActivationHeight, requireStrictWhitelist, 0);
586
+ for (let i = 0; i < block.statements.length; i++) validateVNextStatementOrTemplate(block.statements[i], `statement[${i}]`, options?.resolveBranch, requireStrictWhitelist, 0);
525
587
  }
526
588
  function parseTokenList(rawTokens, primaryTokenAddress, primaryValue, label = "tokens") {
527
589
  const entries = /* @__PURE__ */ new Map();
@@ -585,23 +647,14 @@ function parseMiotxParticipantList(rawList, label) {
585
647
  * and Rollup records into a deeply frozen (`Object.freeze`) read-only archive summary (`mode: 'READ_ONLY_LEGACY_ARCHIVE'`).
586
648
  * Enforces strict zero-sum token and asset conservation for historical `transfer_v3` `miotx` records.
587
649
  */
588
- function parseLegacyTxReadOnlyArchiveRecord(rawRecord) {
650
+ function parseLegacyTxReadOnlyArchiveRecord(rawRecord, branch) {
589
651
  if (!rawRecord || typeof rawRecord !== "object" || Array.isArray(rawRecord)) throw new CustomError(ErrorCode.InvalidSunset, "LegacyProtocolSunset: rawRecord must be a plain object");
590
652
  assertNoProtoPollutionKeys(rawRecord, "rawRecord");
653
+ assertRecordKindAgrees(rawRecord, "rawRecord");
591
654
  const rawKind = String(rawRecord.recordKind ?? rawRecord.typeUrl ?? rawRecord.type ?? "").trim();
592
655
  if (!rawKind) throw new CustomError(ErrorCode.InvalidSunset, "LegacyProtocolSunset: recordKind or typeUrl is required");
593
656
  const canonicalTypeUrl = normalizeProtocolTypeUrl(rawKind);
594
- const resolvedRollupKind = rawKind === "RollupState" || rawKind === "RollupBlock" ? rawKind : {
595
- "fg:t:rollup_state": "RollupState",
596
- "fg:t:rollup_block": "RollupBlock",
597
- "fg:t:create_rollup_block": "RollupBlock",
598
- "fg:t:deposit_token": "deposit_token_v2",
599
- "fg:t:deposit_token_v1": "deposit_token_v2",
600
- "fg:t:deposit_token_v2": "deposit_token_v2",
601
- "fg:t:withdraw_token": "withdraw_token_v2",
602
- "fg:t:withdraw_token_v1": "withdraw_token_v2",
603
- "fg:t:withdraw_token_v2": "withdraw_token_v2"
604
- }[canonicalTypeUrl];
657
+ const resolvedRollupKind = rawKind === "RollupState" || rawKind === "RollupBlock" ? rawKind : ROLLUP_RECORD_KIND_MAP[canonicalTypeUrl];
605
658
  if (resolvedRollupKind) {
606
659
  const nestedItx = rawRecord.itx && typeof rawRecord.itx === "object" && !Array.isArray(rawRecord.itx) ? rawRecord.itx : {};
607
660
  assertNoProtoPollutionKeys(nestedItx, "itx");
@@ -609,7 +662,7 @@ function parseLegacyTxReadOnlyArchiveRecord(rawRecord) {
609
662
  ...nestedItx,
610
663
  ...rawRecord,
611
664
  recordKind: resolvedRollupKind
612
- });
665
+ }, branch);
613
666
  const canonicalLegacyTypeUrl = rollupSummary.recordKind === "RollupState" || rollupSummary.recordKind === "RollupBlock" ? rollupSummary.recordKind : `fg:t:${rollupSummary.recordKind}`;
614
667
  return Object.freeze({
615
668
  recordKind: rollupSummary.recordKind,
@@ -870,8 +923,8 @@ function parseLegacyTxReadOnlyArchiveRecord(rawRecord) {
870
923
  * containing only versionless atomic statements (`fg:t:transfer`, `fg:t:acquire_asset`) with explicit
871
924
  * `readSet` / `writeSet` footprints and zero-sum conservation.
872
925
  */
873
- function compileLegacyTxToVNextTransactionBlock(rawRecord) {
874
- const summary = parseLegacyTxReadOnlyArchiveRecord(rawRecord);
926
+ function compileLegacyTxToVNextTransactionBlock(rawRecord, branch) {
927
+ const summary = parseLegacyTxReadOnlyArchiveRecord(rawRecord, branch);
875
928
  const blockId = summary.txHash ? `vnext:${summary.txHash}` : `vnext:${summary.recordKind}`;
876
929
  if (summary.recordKind === "transfer_v2") {
877
930
  const inp = summary.inputs[0];
@@ -1172,12 +1225,12 @@ function compileLegacyTxToVNextTransactionBlock(rawRecord) {
1172
1225
  }
1173
1226
  /**
1174
1227
  * Executes a VNext `TransactionBlockInput` after enforcing `assertTransactionBlockVNextPure`
1175
- * (guaranteeing no deprecated `V1/V2/V3`, `miotx`, or Rollup protocol can execute at or after `sunsetActivationHeight`).
1228
+ * (guaranteeing no deprecated `V1/V2/V3`, `miotx`, or Rollup protocol of the v1 branch can execute).
1176
1229
  */
1177
1230
  async function executeVNextTransactionBlock(block, options) {
1231
+ assertNoBlockHeightParams(options, "LegacyProtocolSunset");
1178
1232
  assertTransactionBlockVNextPure(block, {
1179
- currentBlockHeight: options.currentBlockHeight,
1180
- sunsetActivationHeight: options.sunsetActivationHeight,
1233
+ resolveBranch: options.resolveBranch,
1181
1234
  requireStrictCanonicalWhitelist: true
1182
1235
  });
1183
1236
  return executeTransactionBlock(block, {
@@ -1205,14 +1258,12 @@ var LegacyProtocolCompatibilityAddon = class {
1205
1258
  this.totalPassthroughVNextTxs = 0;
1206
1259
  this.rejectedAfterSunsetCount = 0;
1207
1260
  this.translatedCounts = /* @__PURE__ */ new Map();
1261
+ assertNoBlockHeightParams(options, "LegacyProtocolCompatibilityAddon");
1208
1262
  const mode = options?.mode ?? "ADDON_TRANSLATE_AND_EXECUTE";
1209
1263
  if (mode !== "ADDON_TRANSLATE_AND_EXECUTE" && mode !== "SUNSET_READ_ONLY_ARCHIVE") throw new CustomError(ErrorCode.InvalidSunset, `LegacyProtocolCompatibilityAddon: invalid mode ${String(mode)}`);
1210
1264
  const targetRemovalRelease = assertCleanString(options?.targetRemovalRelease ?? "v2.0-major", "targetRemovalRelease", 64);
1211
- const sunsetActivationHeight = options?.sunsetActivationHeight ?? DEFAULT_LEGACY_PROTOCOL_SUNSET_HEIGHT;
1212
- if (!Number.isSafeInteger(sunsetActivationHeight) || sunsetActivationHeight < 1) throw new CustomError(ErrorCode.InvalidSunset, "LegacyProtocolCompatibilityAddon: sunsetActivationHeight must be a positive safe integer (>= 1)");
1213
1265
  this.mode = mode;
1214
1266
  this.targetRemovalRelease = targetRemovalRelease;
1215
- this.sunsetActivationHeight = sunsetActivationHeight;
1216
1267
  }
1217
1268
  getMode() {
1218
1269
  return this.mode;
@@ -1260,7 +1311,7 @@ var LegacyProtocolCompatibilityAddon = class {
1260
1311
  }
1261
1312
  return value;
1262
1313
  }
1263
- translateStatementTemplateRecursively(stmt, warnings, currentBlockHeight, depth = 0) {
1314
+ translateStatementTemplateRecursively(stmt, warnings, resolveBranch, depth = 0) {
1264
1315
  if (depth > 8) throw new CustomError(ErrorCode.ForbiddenSunset, "LegacyProtocolCompatibilityAddon: maximum nested statementTemplates depth exceeded");
1265
1316
  if (!stmt || typeof stmt !== "object" || Array.isArray(stmt)) throw new CustomError(ErrorCode.InvalidSunset, "LegacyProtocolCompatibilityAddon: statement must be an object");
1266
1317
  assertNoProtoPollutionKeys(stmt, "statement");
@@ -1273,20 +1324,19 @@ var LegacyProtocolCompatibilityAddon = class {
1273
1324
  const canonicalInputUrl = normUrl || normType;
1274
1325
  let resolvedTypeUrl = canonicalInputUrl;
1275
1326
  if (isDomainCoupledProtocolAlias(canonicalInputUrl)) {
1276
- if (this.mode === "SUNSET_READ_ONLY_ARCHIVE" && currentBlockHeight >= this.sunsetActivationHeight) {
1327
+ if (this.mode === "SUNSET_READ_ONLY_ARCHIVE") {
1277
1328
  this.rejectedAfterSunsetCount += 1;
1278
- throw new CustomError(ErrorCode.ForbiddenSunset, `LegacyProtocolCompatibilityAddon: domain-coupled protocol alias ${canonicalInputUrl} is disabled in SUNSET_READ_ONLY_ARCHIVE mode at height ${currentBlockHeight}`);
1329
+ throw new CustomError(ErrorCode.ForbiddenSunset, `LegacyProtocolCompatibilityAddon: domain-coupled protocol alias ${canonicalInputUrl} is disabled in SUNSET_READ_ONLY_ARCHIVE mode`);
1279
1330
  }
1280
1331
  const mapped = resolveDomainAgnosticVNextProtocol(canonicalInputUrl);
1281
1332
  this.recordTranslation(warnings, canonicalInputUrl, mapped, "DOMAIN_COUPLED_ALIAS", `Use domain-agnostic L1 primitive ${mapped}`);
1282
1333
  resolvedTypeUrl = mapped;
1283
1334
  } else if (isDeprecatedLegacyWriteProtocol(canonicalInputUrl)) {
1284
- if (this.mode === "SUNSET_READ_ONLY_ARCHIVE" && currentBlockHeight >= this.sunsetActivationHeight) {
1335
+ if (this.mode === "SUNSET_READ_ONLY_ARCHIVE") {
1285
1336
  this.rejectedAfterSunsetCount += 1;
1286
1337
  assertLegacyProtocolNotSunset({
1287
1338
  typeUrl: canonicalInputUrl,
1288
- currentBlockHeight,
1289
- sunsetActivationHeight: this.sunsetActivationHeight
1339
+ branch: resolveStatementBranch(stmt, canonicalInputUrl, resolveBranch, "statement")
1290
1340
  });
1291
1341
  }
1292
1342
  const spec = getLegacyProtocolReplacementSpec(canonicalInputUrl);
@@ -1296,12 +1346,12 @@ var LegacyProtocolCompatibilityAddon = class {
1296
1346
  }
1297
1347
  const rawItx = stmt.itx && typeof stmt.itx === "object" && !Array.isArray(stmt.itx) ? { ...stmt.itx } : {};
1298
1348
  assertNoProtoPollutionKeys(rawItx, "stmt.itx");
1299
- if (Array.isArray(rawItx.statementTemplates)) rawItx.statementTemplates = rawItx.statementTemplates.map((tpl) => this.translateStatementTemplateRecursively(tpl, warnings, currentBlockHeight, depth + 1));
1349
+ if (Array.isArray(rawItx.statementTemplates)) rawItx.statementTemplates = rawItx.statementTemplates.map((tpl) => this.translateStatementTemplateRecursively(tpl, warnings, resolveBranch, depth + 1));
1300
1350
  if (rawItx.data?.value && Array.isArray(rawItx.data.value.statementTemplates)) rawItx.data = {
1301
1351
  ...rawItx.data,
1302
1352
  value: {
1303
1353
  ...rawItx.data.value,
1304
- statementTemplates: rawItx.data.value.statementTemplates.map((tpl) => this.translateStatementTemplateRecursively(tpl, warnings, currentBlockHeight, depth + 1))
1354
+ statementTemplates: rawItx.data.value.statementTemplates.map((tpl) => this.translateStatementTemplateRecursively(tpl, warnings, resolveBranch, depth + 1))
1305
1355
  }
1306
1356
  };
1307
1357
  if (rawItx.contractAsset?.data?.value && Array.isArray(rawItx.contractAsset.data.value.statementTemplates)) rawItx.contractAsset = {
@@ -1310,7 +1360,7 @@ var LegacyProtocolCompatibilityAddon = class {
1310
1360
  ...rawItx.contractAsset.data,
1311
1361
  value: {
1312
1362
  ...rawItx.contractAsset.data.value,
1313
- statementTemplates: rawItx.contractAsset.data.value.statementTemplates.map((tpl) => this.translateStatementTemplateRecursively(tpl, warnings, currentBlockHeight, depth + 1))
1363
+ statementTemplates: rawItx.contractAsset.data.value.statementTemplates.map((tpl) => this.translateStatementTemplateRecursively(tpl, warnings, resolveBranch, depth + 1))
1314
1364
  }
1315
1365
  }
1316
1366
  };
@@ -1331,17 +1381,16 @@ var LegacyProtocolCompatibilityAddon = class {
1331
1381
  translateToVNextTransactionBlock(txOrBlock, options) {
1332
1382
  if (!txOrBlock || typeof txOrBlock !== "object" || Array.isArray(txOrBlock)) throw new CustomError(ErrorCode.InvalidSunset, "LegacyProtocolCompatibilityAddon: txOrBlock must be a plain object");
1333
1383
  assertNoProtoPollutionKeys(txOrBlock, "txOrBlock");
1334
- const currentBlockHeight = options?.currentBlockHeight ?? DEFAULT_LEGACY_PROTOCOL_SUNSET_HEIGHT;
1335
- if (!Number.isSafeInteger(currentBlockHeight) || currentBlockHeight < 0) throw new CustomError(ErrorCode.InvalidSunset, "LegacyProtocolCompatibilityAddon: currentBlockHeight must be a non-negative safe integer");
1384
+ assertNoBlockHeightParams(options, "LegacyProtocolCompatibilityAddon");
1385
+ const resolveBranch = options?.resolveBranch;
1336
1386
  const warnings = [];
1337
1387
  if ("statements" in txOrBlock && Array.isArray(txOrBlock.statements)) {
1338
1388
  const inputBlock = txOrBlock;
1339
1389
  if (inputBlock.statements.length === 0) throw new CustomError(ErrorCode.InvalidSunset, "LegacyProtocolCompatibilityAddon: TransactionBlock must contain at least one statement");
1340
- if (this.mode === "SUNSET_READ_ONLY_ARCHIVE" && currentBlockHeight >= this.sunsetActivationHeight) {
1390
+ if (this.mode === "SUNSET_READ_ONLY_ARCHIVE") {
1341
1391
  try {
1342
1392
  assertTransactionBlockVNextPure(inputBlock, {
1343
- currentBlockHeight,
1344
- sunsetActivationHeight: this.sunsetActivationHeight,
1393
+ resolveBranch,
1345
1394
  requireStrictCanonicalWhitelist: true
1346
1395
  });
1347
1396
  } catch (err) {
@@ -1368,6 +1417,7 @@ var LegacyProtocolCompatibilityAddon = class {
1368
1417
  const normType$1 = hasType$1 ? normalizeProtocolTypeUrl(String(rawStmt.type)) : "";
1369
1418
  if (hasTypeUrl$1 && hasType$1 && normUrl$1 !== normType$1) throw new CustomError(ErrorCode.ForbiddenSunset, `LegacyProtocolCompatibilityAddon: statement[${i}] has conflicting typeUrl (${normUrl$1}) and type (${normType$1})`);
1370
1419
  const stmtTypeUrl = normUrl$1 || normType$1;
1420
+ assertRecordKindAgrees(rawStmt, `statement[${i}]`);
1371
1421
  const baseOffset = expandedStatements.length;
1372
1422
  if (isDeprecatedLegacyWriteProtocol(stmtTypeUrl)) {
1373
1423
  const spec = getLegacyProtocolReplacementSpec(stmtTypeUrl);
@@ -1375,7 +1425,7 @@ var LegacyProtocolCompatibilityAddon = class {
1375
1425
  ...rawStmt,
1376
1426
  from: rawStmt.from ?? inputBlock.from,
1377
1427
  typeUrl: stmtTypeUrl
1378
- });
1428
+ }, resolveStatementBranch(rawStmt, stmtTypeUrl, resolveBranch, `statement[${i}]`));
1379
1429
  this.recordTranslation(warnings, spec.legacyTypeUrl, spec.vnextReplacementTypeUrl, spec.category, spec.migrationGuidance);
1380
1430
  for (const subStmt of compiledSub.transactionBlock.statements) {
1381
1431
  const shiftedItx = baseOffset > 0 ? this.remapStepReferencesInValue(subStmt.itx, (localIdx) => baseOffset + localIdx) : subStmt.itx;
@@ -1387,7 +1437,7 @@ var LegacyProtocolCompatibilityAddon = class {
1387
1437
  }
1388
1438
  origStepLastExpandedIndex.push(expandedStatements.length - 1);
1389
1439
  } else {
1390
- const translatedStmt = this.translateStatementTemplateRecursively(rawStmt, warnings, currentBlockHeight, 0);
1440
+ const translatedStmt = this.translateStatementTemplateRecursively(rawStmt, warnings, resolveBranch, 0);
1391
1441
  const remappedItx = this.remapStepReferencesInValue(translatedStmt.itx, (origIdx) => origIdx < origStepLastExpandedIndex.length ? origStepLastExpandedIndex[origIdx] : origIdx);
1392
1442
  expandedStatements.push({
1393
1443
  ...translatedStmt,
@@ -1408,8 +1458,7 @@ var LegacyProtocolCompatibilityAddon = class {
1408
1458
  writeSet: footprint$1.writeSet
1409
1459
  };
1410
1460
  assertTransactionBlockVNextPure(finalBlock$1, {
1411
- currentBlockHeight,
1412
- sunsetActivationHeight: this.sunsetActivationHeight,
1461
+ resolveBranch,
1413
1462
  requireStrictCanonicalWhitelist: true
1414
1463
  });
1415
1464
  const wasTranslated$1 = warnings.length > 0;
@@ -1430,16 +1479,22 @@ var LegacyProtocolCompatibilityAddon = class {
1430
1479
  const normUrl = hasTypeUrl ? normalizeProtocolTypeUrl(String(rawRecord.typeUrl)) : "";
1431
1480
  const normType = hasType ? normalizeProtocolTypeUrl(String(rawRecord.type)) : "";
1432
1481
  if (hasTypeUrl && hasType && normUrl !== normType) {
1433
- if (this.mode === "SUNSET_READ_ONLY_ARCHIVE" && currentBlockHeight >= this.sunsetActivationHeight) this.rejectedAfterSunsetCount += 1;
1482
+ if (this.mode === "SUNSET_READ_ONLY_ARCHIVE") this.rejectedAfterSunsetCount += 1;
1434
1483
  throw new CustomError(ErrorCode.ForbiddenSunset, `LegacyProtocolCompatibilityAddon: transaction has conflicting typeUrl (${normUrl}) and type (${normType})`);
1435
1484
  }
1485
+ try {
1486
+ assertRecordKindAgrees(rawRecord, "transaction");
1487
+ } catch (err) {
1488
+ if (this.mode === "SUNSET_READ_ONLY_ARCHIVE") this.rejectedAfterSunsetCount += 1;
1489
+ throw err;
1490
+ }
1436
1491
  const rawKind = String(rawRecord.typeUrl ?? rawRecord.type ?? rawRecord.recordKind ?? "").trim();
1437
1492
  const canonicalUrl = normUrl || normType || normalizeProtocolTypeUrl(rawKind);
1438
- if (this.mode === "SUNSET_READ_ONLY_ARCHIVE" && currentBlockHeight >= this.sunsetActivationHeight) try {
1493
+ const recordBranch = resolveStatementBranch(rawRecord, canonicalUrl, resolveBranch, "transaction");
1494
+ if (this.mode === "SUNSET_READ_ONLY_ARCHIVE") try {
1439
1495
  assertLegacyProtocolNotSunset({
1440
1496
  typeUrl: canonicalUrl,
1441
- currentBlockHeight,
1442
- sunsetActivationHeight: this.sunsetActivationHeight
1497
+ branch: recordBranch
1443
1498
  });
1444
1499
  if (isDomainCoupledProtocolAlias(canonicalUrl)) throw new CustomError(ErrorCode.ForbiddenSunset, `LegacyProtocolCompatibilityAddon: domain-coupled protocol alias ${canonicalUrl} is disabled in SUNSET_READ_ONLY_ARCHIVE mode`);
1445
1500
  } catch (err) {
@@ -1448,7 +1503,7 @@ var LegacyProtocolCompatibilityAddon = class {
1448
1503
  }
1449
1504
  if (isDeprecatedLegacyWriteProtocol(canonicalUrl)) {
1450
1505
  const spec = getLegacyProtocolReplacementSpec(canonicalUrl);
1451
- const compiled = compileLegacyTxToVNextTransactionBlock(rawRecord);
1506
+ const compiled = compileLegacyTxToVNextTransactionBlock(rawRecord, recordBranch);
1452
1507
  this.recordTranslation(warnings, spec.legacyTypeUrl, spec.vnextReplacementTypeUrl, spec.category, spec.migrationGuidance);
1453
1508
  this.totalTranslatedTxs += 1;
1454
1509
  return Object.freeze({
@@ -1466,7 +1521,7 @@ var LegacyProtocolCompatibilityAddon = class {
1466
1521
  from: fromDid,
1467
1522
  delegator: typeof rawRecord.delegator === "string" ? rawRecord.delegator : void 0,
1468
1523
  itx: rawRecord.itx && typeof rawRecord.itx === "object" && !Array.isArray(rawRecord.itx) ? rawRecord.itx : rawRecord
1469
- }, warnings, currentBlockHeight, 0);
1524
+ }, warnings, resolveBranch, 0);
1470
1525
  const rawBlock = {
1471
1526
  id: typeof rawRecord.txHash === "string" ? `vnext:${rawRecord.txHash}` : void 0,
1472
1527
  from: fromDid,
@@ -1480,8 +1535,7 @@ var LegacyProtocolCompatibilityAddon = class {
1480
1535
  writeSet: footprint.writeSet
1481
1536
  };
1482
1537
  assertTransactionBlockVNextPure(finalBlock, {
1483
- currentBlockHeight,
1484
- sunsetActivationHeight: this.sunsetActivationHeight,
1538
+ resolveBranch,
1485
1539
  requireStrictCanonicalWhitelist: true
1486
1540
  });
1487
1541
  const wasTranslated = warnings.length > 0;
@@ -1501,13 +1555,13 @@ var LegacyProtocolCompatibilityAddon = class {
1501
1555
  * 2. Executes the resulting pure VNext `TransactionBlockInput` on the VNext `OverlayStateDB` engine.
1502
1556
  */
1503
1557
  async executeWithCompatibilityAddon(txOrBlock, options) {
1504
- const translationResult = this.translateToVNextTransactionBlock(txOrBlock, { currentBlockHeight: options.currentBlockHeight });
1558
+ assertNoBlockHeightParams(options, "LegacyProtocolCompatibilityAddon");
1559
+ const translationResult = this.translateToVNextTransactionBlock(txOrBlock, { resolveBranch: options.resolveBranch });
1505
1560
  return {
1506
1561
  executionResult: await executeVNextTransactionBlock(translationResult.transactionBlock, {
1507
1562
  statedb: options.statedb,
1508
1563
  executeStatement: options.executeStatement,
1509
- currentBlockHeight: options.currentBlockHeight,
1510
- sunsetActivationHeight: this.sunsetActivationHeight,
1564
+ resolveBranch: options.resolveBranch,
1511
1565
  dryRun: options.dryRun
1512
1566
  }),
1513
1567
  translationResult
@@ -1516,4 +1570,4 @@ var LegacyProtocolCompatibilityAddon = class {
1516
1570
  };
1517
1571
 
1518
1572
  //#endregion
1519
- export { DEFAULT_LEGACY_PROTOCOL_SUNSET_HEIGHT, DEPRECATED_LEGACY_PROTOCOL_TYPE_URLS, DEPRECATED_MIOTX_AND_TRADE_TYPE_URLS, DEPRECATED_MIOTX_PROTOCOL_TYPE_URLS, DEPRECATED_ROLLUP_AND_BRIDGE_TYPE_URLS, DEPRECATED_VERSIONED_ASSET_TYPE_URLS, DOMAIN_COUPLED_PROTOCOL_ALIAS_MAP, LegacyProtocolCompatibilityAddon, MAX_LEGACY_MIOTX_ASSETS_PER_ENTRY, MAX_LEGACY_MIOTX_PARTICIPANTS, MAX_LEGACY_MIOTX_TOKENS_PER_ENTRY, VNEXT_CANONICAL_WRITE_PROTOCOL_TYPE_URLS, assertLegacyProtocolNotSunset, assertTransactionBlockVNextPure, compileLegacyTxToVNextTransactionBlock, executeVNextTransactionBlock, getLegacyProtocolReplacementSpec, isDeprecatedLegacyWriteProtocol, isDomainCoupledProtocolAlias, isMiotxLegacyProtocol, isVNextCanonicalWriteProtocol, normalizeProtocolTypeUrl, parseLegacyTxReadOnlyArchiveRecord, resolveDomainAgnosticVNextProtocol };
1573
+ export { DEPRECATED_LEGACY_PROTOCOL_TYPE_URLS, DEPRECATED_MIOTX_AND_TRADE_TYPE_URLS, DEPRECATED_MIOTX_PROTOCOL_TYPE_URLS, DEPRECATED_ROLLUP_AND_BRIDGE_TYPE_URLS, DEPRECATED_VERSIONED_ASSET_TYPE_URLS, DOMAIN_COUPLED_PROTOCOL_ALIAS_MAP, LegacyProtocolCompatibilityAddon, MAX_LEGACY_MIOTX_ASSETS_PER_ENTRY, MAX_LEGACY_MIOTX_PARTICIPANTS, MAX_LEGACY_MIOTX_TOKENS_PER_ENTRY, VNEXT_CANONICAL_WRITE_PROTOCOL_TYPE_URLS, assertLegacyProtocolNotSunset, assertTransactionBlockVNextPure, compileLegacyTxToVNextTransactionBlock, executeVNextTransactionBlock, getLegacyProtocolReplacementSpec, isDeprecatedLegacyWriteProtocol, isDomainCoupledProtocolAlias, isMiotxLegacyProtocol, isVNextCanonicalWriteProtocol, normalizeProtocolTypeUrl, parseLegacyTxReadOnlyArchiveRecord, resolveDomainAgnosticVNextProtocol };
@@ -1,7 +1,40 @@
1
1
  //#region src/legacy-rollup-archive.d.ts
2
2
  declare const DEFAULT_MAX_ROLLUP_BLOCK_SIZE = 256;
3
- declare const DEFAULT_ROLLUP_SUNSET_ACTIVATION_HEIGHT = 1;
4
3
  declare const DEPRECATED_ROLLUP_PROTOCOL_TYPE_URLS: readonly ["fg:t:create_rollup", "fg:t:update_rollup", "fg:t:join_rollup", "fg:t:leave_rollup", "fg:t:create_rollup_block", "fg:t:claim_block_reward", "fg:t:pause_rollup", "fg:t:resume_rollup"];
4
+ /**
5
+ * Branch information of a `deposit_token_v2` / `withdraw_token_v2` / rollup governance tx (#1692,
6
+ * bridge/docs/deposit-withdraw-v2-unification.md §7.1): whether the row `itx.rollup` names is a v2 bridge, and the itx
7
+ * (a deposit is a bridge release only with `kind ∈ {1,2,3}`). The bridge branch reuses the tx type names but none of
8
+ * the retired rollup-block mechanism, so it is never sunset and never archived as a legacy rollup record.
9
+ */
10
+ interface RollupBranchInfo {
11
+ isBridgeV2: boolean;
12
+ itx?: Record<string, unknown> | null;
13
+ }
14
+ /**
15
+ * #1720 (S4b): resolves the branch of one statement / record (`{ typeUrl | type, itx, ... }`) for the statement-level
16
+ * helpers. It is called only for the rollup-family types, whose outcome depends on the row `itx.rollup` names. It is
17
+ * synchronous: the caller reads the rows first, and builds each result with `rollupBranchOf`.
18
+ */
19
+ type RollupBranchResolver = (stmt: Record<string, unknown>) => RollupBranchInfo;
20
+ /**
21
+ * #1720 (S4b): the branch of a tx whose `itx.rollup` names `rollupRow`, derived exactly as the protocols do
22
+ * (`peekBridgeFailClosed` -> `rollup.isBridgeV2(row)`, `data.value.version == 2`). No row is the v1 branch: the
23
+ * protocols refuse a bridge kind on a v1 row or on no row.
24
+ */
25
+ declare function rollupBranchOf(rollupRow: unknown, itx: Record<string, unknown> | null | undefined): RollupBranchInfo;
26
+ /**
27
+ * #1720 (S4b): the branch information every guard call must carry. Missing or malformed is a programming error, never a
28
+ * default: allowing would skip the sunset, treating it as v1 would turn the bridge off once a guard is wired (§7.1, M-5).
29
+ */
30
+ declare function assertRollupBranchInfo(branch: unknown): asserts branch is RollupBranchInfo;
31
+ declare function assertNoBlockHeightParams(params: unknown, label: string): void;
32
+ /**
33
+ * Whether a tx of `canonicalTypeUrl` (`fg:t:...`) with `branch` is the bridge branch: a deposit with a bridge kind on a
34
+ * v2 row, a withdraw on a v2 row, or bridge governance on a v2 row. Both keys must agree for a deposit (the protocol
35
+ * refuses any other pairing). Throws on malformed branch information (a programming error, never a default).
36
+ */
37
+ declare function isBridgeBranch(canonicalTypeUrl: string, branch: RollupBranchInfo): boolean;
5
38
  declare const ZERO_BYTES32_HASH = "0x0000000000000000000000000000000000000000000000000000000000000000";
6
39
  type DeprecatedRollupProtocolTypeUrl = (typeof DEPRECATED_ROLLUP_PROTOCOL_TYPE_URLS)[number];
7
40
  type LegacyRollupRecordKind = 'RollupState' | 'RollupBlock' | 'deposit_token_v2' | 'withdraw_token_v2';
@@ -48,13 +81,17 @@ declare function isDeprecatedRollupWriteProtocol(typeUrl: string): boolean;
48
81
  /**
49
82
  * Issue #1245:
50
83
  * Sunset guard for active transaction pipeline execution:
51
- * - Blocks all 8 deprecated Rollup write protocols when `currentBlockHeight >= rollupSunsetActivationHeight`.
52
- * - Allows historical block replay when `currentBlockHeight < rollupSunsetActivationHeight`.
84
+ * - Blocks all 8 deprecated Rollup write protocols of the v1 branch.
85
+ * - Allows historical block replay when `readOnlyArchiveMode === true`.
86
+ *
87
+ * #1720 (S4b, bridge/docs/deposit-withdraw-v2-unification.md §7.1): `branch` is required (missing throws) and the
88
+ * blockHeight parameters are gone (CHAIN_DESIGN §1 item 2): the switch is whether the guard is wired, plus
89
+ * `readOnlyArchiveMode` for replay. Governance of a v2 bridge is bridge governance, never sunset.
53
90
  */
54
91
  declare function assertRollupProtocolNotSunset(params: {
55
92
  typeUrl: string;
56
- currentBlockHeight: number;
57
- rollupSunsetActivationHeight?: number;
93
+ branch: RollupBranchInfo;
94
+ readOnlyArchiveMode?: boolean;
58
95
  }): void;
59
96
  /**
60
97
  * Issue #1245:
@@ -62,6 +99,6 @@ declare function assertRollupProtocolNotSunset(params: {
62
99
  * and `withdraw_token_v2` records so block explorers, indexers, and audit tools can inspect historical
63
100
  * chain data after the active Rollup write protocols are removed.
64
101
  */
65
- declare function parseLegacyRollupReadOnlyRecord(rawRecord: Record<string, unknown>): LegacyRollupReadOnlySummary;
102
+ declare function parseLegacyRollupReadOnlyRecord(rawRecord: Record<string, unknown>, branch: RollupBranchInfo): LegacyRollupReadOnlySummary;
66
103
  //#endregion
67
- export { DEFAULT_MAX_ROLLUP_BLOCK_SIZE, DEFAULT_ROLLUP_SUNSET_ACTIVATION_HEIGHT, DEPRECATED_ROLLUP_PROTOCOL_TYPE_URLS, DeprecatedRollupProtocolTypeUrl, LegacyRollupReadOnlySummary, LegacyRollupRecordKind, ZERO_BYTES32_HASH, assertRollupProtocolNotSunset, computeEvmBridgeBlockHash, computeEvmBridgeTxsHash, isDeprecatedRollupWriteProtocol, parseLegacyRollupReadOnlyRecord };
104
+ export { DEFAULT_MAX_ROLLUP_BLOCK_SIZE, DEPRECATED_ROLLUP_PROTOCOL_TYPE_URLS, DeprecatedRollupProtocolTypeUrl, LegacyRollupReadOnlySummary, LegacyRollupRecordKind, RollupBranchInfo, RollupBranchResolver, ZERO_BYTES32_HASH, assertNoBlockHeightParams, assertRollupBranchInfo, assertRollupProtocolNotSunset, computeEvmBridgeBlockHash, computeEvmBridgeTxsHash, isBridgeBranch, isDeprecatedRollupWriteProtocol, parseLegacyRollupReadOnlyRecord, rollupBranchOf };