@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,17 +1,17 @@
1
1
  const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
2
2
  let _ocap_mcrypto = require("@ocap/mcrypto");
3
3
  let _ocap_util = require("@ocap/util");
4
- let _ocap_message = require("@ocap/message");
5
4
  let _ocap_util_lib_get_list_field = require("@ocap/util/lib/get-list-field");
6
5
 
7
6
  //#region src/helpers/bridge-withdraw.ts
8
7
  /**
9
- * Withdraw rule for a `transfer_v2` into a bridge reserve (#1465, bridge/docs/ocap-protocols.md §2 and §v2.4).
8
+ * Withdraw rule for the bridge branch of `withdraw_token_v2` (#1691, bridge/docs/deposit-withdraw-v2-unification.md §2.4),
9
+ * the only way to move funds into a bridge reserve.
10
10
  *
11
- * Pure function of (tx, itx, resolved bridge, master switch): no state, no clock. The caller resolves the bridge that
12
- * owns `itx.to` with `resolveBridgeForReserve` (pre-tx flags); this module validates what a withdraw must look like and
13
- * takes every parameter from that bridge's body. It is used twice on purpose:
14
- * - by the `transfer_v2` protocol, which rejects with the returned code;
11
+ * Pure function of (tx, itx, resolved bridge, master switch): no state, no clock. The caller resolves the bridge `itx.rollup`
12
+ * names (pre-tx flags); this module validates what a withdraw must look like and takes every parameter from that bridge's
13
+ * body. It is used twice on purpose:
14
+ * - by the `withdraw_token_v2` protocol, which rejects with the returned code;
15
15
  * - by the post-execution invariant gate (rule R2), as defence in depth against any other path that credits a reserve.
16
16
  */
17
17
  const BRIDGE_DISABLED = "BRIDGE_DISABLED";
@@ -23,102 +23,82 @@ const BRIDGE_WITHDRAW_AMOUNT = "BRIDGE_WITHDRAW_AMOUNT";
23
23
  const BRIDGE_WITHDRAW_RECIPIENT = "BRIDGE_WITHDRAW_RECIPIENT";
24
24
  const BRIDGE_WITHDRAW_DELEGATED = "BRIDGE_WITHDRAW_DELEGATED";
25
25
  const BRIDGE_WITHDRAW_FEE = "BRIDGE_WITHDRAW_FEE";
26
+ /** `withdraw_token_v2` into a v2 bridge carrying `tx.signatures` (§2.4 step 5, D3: same as `VerifyMultiSig(0)`). */
27
+ const BRIDGE_WITHDRAW_MULTISIG = "BRIDGE_WITHDRAW_MULTISIG";
26
28
  const fail = (code, message) => ({
27
29
  code,
28
30
  message
29
31
  });
30
32
  const DECIMAL = /^(0|[1-9][0-9]*)$/;
31
- /**
32
- * Total amount of `token` carried by `tokens`.
33
- * Returns null when a value is not a non-negative integer; `extraTokens` is set when any other token is present.
34
- */
35
- function bridgeTokenAmount(context, itx, token) {
36
- const tokens = context.tokens ?? ((0, _ocap_util_lib_get_list_field.getListField)(itx, "tokens") || []);
37
- let amount = new _ocap_util.BN(0);
38
- let extraTokens = !!itx.value && !context.tokens;
39
- for (const t of tokens) {
40
- if (t.address !== token) {
41
- extraTokens = true;
42
- continue;
43
- }
44
- if (typeof t.value !== "string" || !DECIMAL.test(t.value)) return null;
45
- amount = amount.add(new _ocap_util.BN(t.value));
46
- }
47
- return {
48
- amount,
49
- extraTokens
50
- };
33
+ function isBridgeWithdrawFailure(x) {
34
+ return "code" in x;
51
35
  }
52
- /**
53
- * Token inputs of a `transfer_v2` itx the way the protocol sees them after its merge step: a positive primary-token
54
- * `itx.value` is added to the OFFICIAL token entry, a zero or absent value changes nothing. The envelope expectation
55
- * and the withdraw rule both read the itx through this function, so they can not disagree about what is being sent.
56
- */
57
- function mergedTransferTokens(itx, officialToken) {
58
- const tokens = ((0, _ocap_util_lib_get_list_field.getListField)(itx, "tokens") || []).map((t) => ({ ...t }));
59
- if (itx.value) {
60
- const amount = new _ocap_util.BN((0, _ocap_message.decodeBigInt)(itx.value));
61
- if (amount.gt(new _ocap_util.BN(0))) {
62
- const existing = tokens.find((t) => t.address === officialToken);
63
- if (existing) existing.value = new _ocap_util.BN(existing.value).add(amount).toString(10);
64
- else tokens.push({
65
- address: officialToken,
66
- value: amount.toString(10)
67
- });
68
- }
69
- }
70
- return tokens;
36
+ /** A fee field of the bridge branch: empty or exactly `'0'`. */
37
+ const isNoFee = (x) => x === void 0 || x === null || x === "" || x === "0";
38
+ /** `itx.data` of the bridge branch must be empty: absent, or an `Any` with no type and no value. */
39
+ function isEmptyData(data) {
40
+ if (data === void 0 || data === null) return true;
41
+ if (typeof data !== "object") return false;
42
+ const d = data;
43
+ for (const k of Object.keys(d)) if (k !== "typeUrl" && k !== "type" && k !== "value") return false;
44
+ if (d.typeUrl || d.type) return false;
45
+ const v = d.value;
46
+ if (v === void 0 || v === null || v === "") return true;
47
+ return typeof v.length === "number" && v.length === 0;
71
48
  }
72
49
  /**
73
- * The amount and recipient a withdraw into `bridge` carries, decoded exactly like `checkBridgeWithdraw` does (same token
74
- * rule, same strict parser input), without the policy checks. `null` when the itx is not shaped like a withdraw of the
75
- * bridge token. `ethRecipient` is the raw value as written (the envelope must show that), `''` when absent.
50
+ * The amount and recipient a `withdraw_token_v2` into a bridge of token `bridgeToken` carries (§4): `amount` is
51
+ * `itx.token.value`, `ethRecipient` is `itx.to` exactly as written (the envelope must show that). `null` when
52
+ * `itx.token.address` is not the bridge token or the amount is not a decimal string. The clear-signing expectation and
53
+ * the in-branch envelope re-check both read the itx through this function.
76
54
  */
77
- function decodeBridgeWithdrawFields(itx, bridgeToken, officialToken) {
78
- if (((0, _ocap_util_lib_get_list_field.getListField)(itx, "assets") || []).length > 0) return null;
79
- const total = bridgeTokenAmount({ tokens: mergedTransferTokens(itx, officialToken) }, itx, bridgeToken);
80
- if (!total || total.extraTokens) return null;
81
- const data = itx.data;
82
- const ethRecipient = data && data.typeUrl === "fg:x:address" && typeof data.value === "string" ? data.value : "";
55
+ function decodeBridgeWithdrawV2Fields(itx, bridgeToken) {
56
+ const x = itx || {};
57
+ const token = x.token;
58
+ if (!token || typeof token !== "object") return null;
59
+ if (!bridgeToken || token.address !== bridgeToken) return null;
60
+ if (typeof token.value !== "string" || !DECIMAL.test(token.value)) return null;
83
61
  return {
84
- amount: total.amount.toString(10),
85
- ethRecipient
62
+ amount: token.value,
63
+ ethRecipient: typeof x.to === "string" ? x.to : ""
86
64
  };
87
65
  }
88
66
  /**
89
- * Validate a transfer into the reserve of `bridge`. Returns the parsed withdraw, or the first failing check.
90
- * Order follows the design: 1 accepting, 2 token set and amount range, 3 recipient, 4 delegator, 5 fee.
67
+ * The bridge branch of `withdraw_token_v2` (§2.4 steps 1-5): pure function of (tx, itx, resolved bridge, config).
68
+ * `bridge` is the v2 row `itx.rollup` resolves to (pre-tx flags); the reserve is never read from the itx, it is
69
+ * `toBridgeReserveAddress(itx.rollup)`. Used by the protocol and by gate R2.
91
70
  */
92
- function checkBridgeWithdraw(context, bridge) {
71
+ function checkBridgeWithdrawV2(context, bridge) {
93
72
  const { tx } = context;
94
73
  const itx = context.itx || {};
95
74
  const body = bridge.body;
75
+ if (typeof itx.rollup !== "string" || itx.rollup !== bridge.address) return fail(BRIDGE_WITHDRAW_RESERVE, `itx.rollup must be the canonical address of the bridge ${bridge.address}`);
76
+ const token = itx.token;
77
+ if (!token || typeof token !== "object" || typeof token.address !== "string" || !token.address) return fail(BRIDGE_WITHDRAW_TOKEN, "Bridge withdraw requires itx.token = { address, value }");
78
+ if (typeof token.value !== "string" || !DECIMAL.test(token.value)) return fail(BRIDGE_WITHDRAW_AMOUNT, "Bridge withdraw amount must be a decimal string");
79
+ const parsed = (0, _ocap_mcrypto.parseStrictEthAddress)(itx.to);
80
+ if (!parsed.ok) return fail(BRIDGE_WITHDRAW_RECIPIENT, `Bridge withdraw recipient is not a valid Ethereum address (${parsed.reason})`);
81
+ if (itx.proposer !== void 0 && itx.proposer !== null && itx.proposer !== "") return fail(BRIDGE_WITHDRAW_FEE, "Bridge withdraw has no proposer");
82
+ if (!isNoFee(itx.maxFee) || !isNoFee(itx.actualFee)) return fail(BRIDGE_WITHDRAW_FEE, "Bridge withdraw carries no maxFee or actualFee");
83
+ if (!isEmptyData(itx.data)) return fail(BRIDGE_WITHDRAW_RECIPIENT, "Bridge withdraw carries no itx.data: the recipient is itx.to");
96
84
  if (!context.config?.transaction?.bridge?.enabled) return fail(BRIDGE_DISABLED, "Bridge withdraw is not available: transaction.bridge.enabled is off");
97
85
  if (bridge.closing || bridge.final || bridge.migrated) return fail(BRIDGE_CLOSED, `Bridge ${bridge.address} does not accept withdraws (closing, final or migrated)`);
98
86
  if (bridge.paused) return fail(BRIDGE_PAUSED, `Bridge ${bridge.address} is paused`);
99
- const token = bridge.token;
100
- if (!token) return fail(BRIDGE_WITHDRAW_TOKEN, "Bridge has no token");
101
- if ((context.assets ?? ((0, _ocap_util_lib_get_list_field.getListField)(itx, "assets") || [])).length > 0) return fail(BRIDGE_WITHDRAW_TOKEN, "Bridge withdraw can not carry assets");
102
- const total = bridgeTokenAmount(context, itx, token);
103
- if (!total || total.extraTokens) return fail(BRIDGE_WITHDRAW_TOKEN, `Bridge withdraw must carry the bridge token ${token} only`);
104
- if (total.amount.lte(new _ocap_util.BN(0))) return fail(BRIDGE_WITHDRAW_AMOUNT, "Bridge withdraw amount must be positive");
87
+ if (!bridge.token) return fail(BRIDGE_WITHDRAW_TOKEN, "Bridge has no token");
88
+ if (token.address !== bridge.token) return fail(BRIDGE_WITHDRAW_TOKEN, `Bridge withdraw must carry the bridge token ${bridge.token}`);
89
+ const amount = new _ocap_util.BN(token.value);
90
+ if (amount.lte(new _ocap_util.BN(0))) return fail(BRIDGE_WITHDRAW_AMOUNT, "Bridge withdraw amount must be positive");
105
91
  if (!DECIMAL.test(String(body.minWithdraw)) || !DECIMAL.test(String(body.maxWithdraw))) return fail(BRIDGE_WITHDRAW_AMOUNT, "Bridge withdraw limits are not configured");
106
- if (total.amount.lt(new _ocap_util.BN(String(body.minWithdraw)))) return fail(BRIDGE_WITHDRAW_AMOUNT, `Bridge withdraw amount is below minWithdraw ${body.minWithdraw}`);
107
- if (total.amount.gt(new _ocap_util.BN(String(body.maxWithdraw)))) return fail(BRIDGE_WITHDRAW_AMOUNT, `Bridge withdraw amount is above maxWithdraw ${body.maxWithdraw}`);
108
- const data = itx.data;
109
- if (!data || data.typeUrl !== "fg:x:address" || typeof data.value !== "string") return fail(BRIDGE_WITHDRAW_RECIPIENT, "Bridge withdraw requires itx.data = { typeUrl: \"fg:x:address\", value }");
110
- const parsed = (0, _ocap_mcrypto.parseStrictEthAddress)(data.value);
111
- if (!parsed.ok) return fail(BRIDGE_WITHDRAW_RECIPIENT, `Bridge withdraw recipient is not a valid Ethereum address (${parsed.reason})`);
112
- if (tx?.delegator) return fail(BRIDGE_WITHDRAW_DELEGATED, "Bridge withdraw can not be delegated");
92
+ if (amount.lt(new _ocap_util.BN(String(body.minWithdraw)))) return fail(BRIDGE_WITHDRAW_AMOUNT, `Bridge withdraw amount is below minWithdraw ${body.minWithdraw}`);
93
+ if (amount.gt(new _ocap_util.BN(String(body.maxWithdraw)))) return fail(BRIDGE_WITHDRAW_AMOUNT, `Bridge withdraw amount is above maxWithdraw ${body.maxWithdraw}`);
113
94
  if (!/^0+$/.test(String(body.withdrawFee ?? "0"))) return fail(BRIDGE_WITHDRAW_FEE, "Bridge withdrawFee must be 0");
95
+ if (tx?.delegator) return fail(BRIDGE_WITHDRAW_DELEGATED, "Bridge withdraw can not be delegated");
96
+ if (((0, _ocap_util_lib_get_list_field.getListField)(tx || {}, "signatures") || []).length > 0) return fail(BRIDGE_WITHDRAW_MULTISIG, "Bridge withdraw can not carry tx.signatures");
114
97
  return {
115
- amount: total.amount.toString(10),
98
+ amount: amount.toString(10),
116
99
  ethRecipient: parsed.lowercase
117
100
  };
118
101
  }
119
- function isBridgeWithdrawFailure(x) {
120
- return "code" in x;
121
- }
122
102
 
123
103
  //#endregion
124
104
  exports.BRIDGE_CLOSED = BRIDGE_CLOSED;
@@ -127,10 +107,10 @@ exports.BRIDGE_PAUSED = BRIDGE_PAUSED;
127
107
  exports.BRIDGE_WITHDRAW_AMOUNT = BRIDGE_WITHDRAW_AMOUNT;
128
108
  exports.BRIDGE_WITHDRAW_DELEGATED = BRIDGE_WITHDRAW_DELEGATED;
129
109
  exports.BRIDGE_WITHDRAW_FEE = BRIDGE_WITHDRAW_FEE;
110
+ exports.BRIDGE_WITHDRAW_MULTISIG = BRIDGE_WITHDRAW_MULTISIG;
130
111
  exports.BRIDGE_WITHDRAW_RECIPIENT = BRIDGE_WITHDRAW_RECIPIENT;
131
112
  exports.BRIDGE_WITHDRAW_RESERVE = BRIDGE_WITHDRAW_RESERVE;
132
113
  exports.BRIDGE_WITHDRAW_TOKEN = BRIDGE_WITHDRAW_TOKEN;
133
- exports.checkBridgeWithdraw = checkBridgeWithdraw;
134
- exports.decodeBridgeWithdrawFields = decodeBridgeWithdrawFields;
135
- exports.isBridgeWithdrawFailure = isBridgeWithdrawFailure;
136
- exports.mergedTransferTokens = mergedTransferTokens;
114
+ exports.checkBridgeWithdrawV2 = checkBridgeWithdrawV2;
115
+ exports.decodeBridgeWithdrawV2Fields = decodeBridgeWithdrawV2Fields;
116
+ exports.isBridgeWithdrawFailure = isBridgeWithdrawFailure;
@@ -3,12 +3,13 @@ import { ResolvedBridge } from "../bridge-reserves.cjs";
3
3
  //#region src/helpers/bridge-withdraw.d.ts
4
4
 
5
5
  /**
6
- * Withdraw rule for a `transfer_v2` into a bridge reserve (#1465, bridge/docs/ocap-protocols.md §2 and §v2.4).
6
+ * Withdraw rule for the bridge branch of `withdraw_token_v2` (#1691, bridge/docs/deposit-withdraw-v2-unification.md §2.4),
7
+ * the only way to move funds into a bridge reserve.
7
8
  *
8
- * Pure function of (tx, itx, resolved bridge, master switch): no state, no clock. The caller resolves the bridge that
9
- * owns `itx.to` with `resolveBridgeForReserve` (pre-tx flags); this module validates what a withdraw must look like and
10
- * takes every parameter from that bridge's body. It is used twice on purpose:
11
- * - by the `transfer_v2` protocol, which rejects with the returned code;
9
+ * Pure function of (tx, itx, resolved bridge, master switch): no state, no clock. The caller resolves the bridge `itx.rollup`
10
+ * names (pre-tx flags); this module validates what a withdraw must look like and takes every parameter from that bridge's
11
+ * body. It is used twice on purpose:
12
+ * - by the `withdraw_token_v2` protocol, which rejects with the returned code;
12
13
  * - by the post-execution invariant gate (rule R2), as defence in depth against any other path that credits a reserve.
13
14
  */
14
15
  declare const BRIDGE_DISABLED = "BRIDGE_DISABLED";
@@ -20,7 +21,9 @@ declare const BRIDGE_WITHDRAW_AMOUNT = "BRIDGE_WITHDRAW_AMOUNT";
20
21
  declare const BRIDGE_WITHDRAW_RECIPIENT = "BRIDGE_WITHDRAW_RECIPIENT";
21
22
  declare const BRIDGE_WITHDRAW_DELEGATED = "BRIDGE_WITHDRAW_DELEGATED";
22
23
  declare const BRIDGE_WITHDRAW_FEE = "BRIDGE_WITHDRAW_FEE";
23
- type BridgeWithdrawErrorCode = typeof BRIDGE_DISABLED | typeof BRIDGE_PAUSED | typeof BRIDGE_CLOSED | typeof BRIDGE_WITHDRAW_RESERVE | typeof BRIDGE_WITHDRAW_TOKEN | typeof BRIDGE_WITHDRAW_AMOUNT | typeof BRIDGE_WITHDRAW_RECIPIENT | typeof BRIDGE_WITHDRAW_DELEGATED | typeof BRIDGE_WITHDRAW_FEE;
24
+ /** `withdraw_token_v2` into a v2 bridge carrying `tx.signatures` (§2.4 step 5, D3: same as `VerifyMultiSig(0)`). */
25
+ declare const BRIDGE_WITHDRAW_MULTISIG = "BRIDGE_WITHDRAW_MULTISIG";
26
+ type BridgeWithdrawErrorCode = typeof BRIDGE_DISABLED | typeof BRIDGE_PAUSED | typeof BRIDGE_CLOSED | typeof BRIDGE_WITHDRAW_RESERVE | typeof BRIDGE_WITHDRAW_TOKEN | typeof BRIDGE_WITHDRAW_AMOUNT | typeof BRIDGE_WITHDRAW_RECIPIENT | typeof BRIDGE_WITHDRAW_DELEGATED | typeof BRIDGE_WITHDRAW_FEE | typeof BRIDGE_WITHDRAW_MULTISIG;
24
27
  interface BridgeWithdrawFailure {
25
28
  code: BridgeWithdrawErrorCode;
26
29
  message: string;
@@ -41,46 +44,27 @@ interface WithdrawContext {
41
44
  } | null;
42
45
  tx?: {
43
46
  delegator?: string;
47
+ signatures?: unknown;
48
+ signaturesList?: unknown;
44
49
  } | null;
45
50
  itx?: unknown;
46
- /** Token inputs after `transfer_v2` merged `itx.value` into them. Falls back to `itx` when absent. */
47
- tokens?: Array<{
48
- address: string;
49
- value: string;
50
- }>;
51
- assets?: string[];
52
51
  }
52
+ declare function isBridgeWithdrawFailure(x: BridgeWithdrawOk | BridgeWithdrawFailure): x is BridgeWithdrawFailure;
53
53
  /**
54
- * Token inputs of a `transfer_v2` itx the way the protocol sees them after its merge step: a positive primary-token
55
- * `itx.value` is added to the OFFICIAL token entry, a zero or absent value changes nothing. The envelope expectation
56
- * and the withdraw rule both read the itx through this function, so they can not disagree about what is being sent.
57
- */
58
- declare function mergedTransferTokens(itx: {
59
- value?: unknown;
60
- }, officialToken: string | undefined): Array<{
61
- address: string;
62
- value: string;
63
- }>;
64
- /**
65
- * The amount and recipient a withdraw into `bridge` carries, decoded exactly like `checkBridgeWithdraw` does (same token
66
- * rule, same strict parser input), without the policy checks. `null` when the itx is not shaped like a withdraw of the
67
- * bridge token. `ethRecipient` is the raw value as written (the envelope must show that), `''` when absent.
54
+ * The amount and recipient a `withdraw_token_v2` into a bridge of token `bridgeToken` carries (§4): `amount` is
55
+ * `itx.token.value`, `ethRecipient` is `itx.to` exactly as written (the envelope must show that). `null` when
56
+ * `itx.token.address` is not the bridge token or the amount is not a decimal string. The clear-signing expectation and
57
+ * the in-branch envelope re-check both read the itx through this function.
68
58
  */
69
- declare function decodeBridgeWithdrawFields(itx: {
70
- value?: unknown;
71
- data?: {
72
- typeUrl?: string;
73
- value?: unknown;
74
- } | null;
75
- }, bridgeToken: string, officialToken: string | undefined): {
59
+ declare function decodeBridgeWithdrawV2Fields(itx: unknown, bridgeToken: string): {
76
60
  amount: string;
77
61
  ethRecipient: string;
78
62
  } | null;
79
63
  /**
80
- * Validate a transfer into the reserve of `bridge`. Returns the parsed withdraw, or the first failing check.
81
- * Order follows the design: 1 accepting, 2 token set and amount range, 3 recipient, 4 delegator, 5 fee.
64
+ * The bridge branch of `withdraw_token_v2` (§2.4 steps 1-5): pure function of (tx, itx, resolved bridge, config).
65
+ * `bridge` is the v2 row `itx.rollup` resolves to (pre-tx flags); the reserve is never read from the itx, it is
66
+ * `toBridgeReserveAddress(itx.rollup)`. Used by the protocol and by gate R2.
82
67
  */
83
- declare function checkBridgeWithdraw(context: WithdrawContext, bridge: ResolvedBridge): BridgeWithdrawOk | BridgeWithdrawFailure;
84
- declare function isBridgeWithdrawFailure(x: BridgeWithdrawOk | BridgeWithdrawFailure): x is BridgeWithdrawFailure;
68
+ declare function checkBridgeWithdrawV2(context: WithdrawContext, bridge: ResolvedBridge): BridgeWithdrawOk | BridgeWithdrawFailure;
85
69
  //#endregion
86
- export { BRIDGE_CLOSED, BRIDGE_DISABLED, BRIDGE_PAUSED, BRIDGE_WITHDRAW_AMOUNT, BRIDGE_WITHDRAW_DELEGATED, BRIDGE_WITHDRAW_FEE, BRIDGE_WITHDRAW_RECIPIENT, BRIDGE_WITHDRAW_RESERVE, BRIDGE_WITHDRAW_TOKEN, BridgeWithdrawErrorCode, BridgeWithdrawFailure, BridgeWithdrawOk, checkBridgeWithdraw, decodeBridgeWithdrawFields, isBridgeWithdrawFailure, mergedTransferTokens };
70
+ export { BRIDGE_CLOSED, BRIDGE_DISABLED, BRIDGE_PAUSED, BRIDGE_WITHDRAW_AMOUNT, BRIDGE_WITHDRAW_DELEGATED, BRIDGE_WITHDRAW_FEE, BRIDGE_WITHDRAW_MULTISIG, BRIDGE_WITHDRAW_RECIPIENT, BRIDGE_WITHDRAW_RESERVE, BRIDGE_WITHDRAW_TOKEN, BridgeWithdrawErrorCode, BridgeWithdrawFailure, BridgeWithdrawOk, checkBridgeWithdrawV2, decodeBridgeWithdrawV2Fields, isBridgeWithdrawFailure };
@@ -2,6 +2,7 @@ const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
2
2
  const require_bridge_reserves = require('../bridge-reserves.cjs');
3
3
  const require_helpers_bridge_withdraw = require('./bridge-withdraw.cjs');
4
4
  let _ocap_mcrypto = require("@ocap/mcrypto");
5
+ let _arcblock_did = require("@arcblock/did");
5
6
  let _ocap_state = require("@ocap/state");
6
7
 
7
8
  //#region src/helpers/replay-guard.ts
@@ -28,37 +29,83 @@ const WITHDRAW_NONE = {
28
29
  ethRecipient: ""
29
30
  };
30
31
  /**
31
- * Clear-signing expectation for a wallet envelope (#1465, bridge/docs/ocap-protocols.md §2, §v2.4).
32
- *
33
- * Returns the decoded `{ bridge, amount, token, ethRecipient }` when the tx is a `transfer_v2` whose `itx.to` has the bridge
34
- * reserve role, and `null` for every other tx. `token` is the TOKEN OF THE BRIDGE that owns the reserve. A withdraw whose
35
- * itx is not even shaped like one (other tokens, assets, missing recipient), or whose reserve maps to no bridge, returns
36
- * empty fields, which no envelope can match: the withdraw rule rejects it anyway, this keeps the signature stage from
37
- * blessing it first.
32
+ * Clear-signing expectation of a `withdraw_token_v2` (#1691, bridge/docs/deposit-withdraw-v2-unification.md §4).
33
+ * Whether it is a withdraw depends on the version of the row `itx.rollup` names, so this reads state, outside the
34
+ * transaction (pre-flight) and possibly from a snapshot that execution later trusts. Fail closed:
35
+ * - `null` (not a withdraw, an ordinary tx) ONLY when the row was read and is a v1 rollup;
36
+ * - a missing `itx.rollup`, a missing row, a read error, or a v2 row that does not decode return empty fields, which
37
+ * no envelope can match. A v1 withdraw to a missing rollup signed with a wallet envelope is therefore rejected at the
38
+ * signature stage (the one difference §2.7 allows); raw-signed v1 withdraws never get here.
39
+ * The bridge branch re-checks the envelope against the row it executes on (`assertBridgeWithdrawEnvelopeInBranch`).
38
40
  */
39
- async function getBridgeWithdrawEnvelopeContext(context) {
40
- if (String(context.txType || "").replace(/^fg:t:/, "") !== "transfer_v2") return null;
41
+ async function getWithdrawTokenV2EnvelopeContext(context) {
41
42
  const itx = context.itx || {};
42
- if (!itx.to || !require_bridge_reserves.isBridgeReserveRole(itx.to)) return null;
43
43
  try {
44
- const bridge = await require_bridge_reserves.resolveBridgeForReserve(context, itx.to);
45
- if (!bridge?.token) return { ...WITHDRAW_NONE };
46
- const official = context.config?.token?.address;
47
- const fields = require_helpers_bridge_withdraw.decodeBridgeWithdrawFields(itx, bridge.token, official);
44
+ if (typeof itx.rollup !== "string" || !itx.rollup) return { ...WITHDRAW_NONE };
45
+ const row = await context.statedb.rollup.get(itx.rollup, context);
46
+ if (!row) return { ...WITHDRAW_NONE };
47
+ if (!_ocap_state.rollup.isBridgeV2(row)) return null;
48
+ if (!_ocap_state.rollup.getBridgeBody(row) || typeof row.address !== "string" || row.address !== itx.rollup) return { ...WITHDRAW_NONE };
49
+ const token = typeof row.tokenAddress === "string" ? row.tokenAddress : "";
50
+ const fields = require_helpers_bridge_withdraw.decodeBridgeWithdrawV2Fields(itx, token);
48
51
  if (!fields) return { ...WITHDRAW_NONE };
49
52
  return {
50
- bridge: bridge.address,
53
+ bridge: row.address,
51
54
  amount: fields.amount,
52
- token: bridge.token,
55
+ token,
53
56
  ethRecipient: fields.ethRecipient
54
57
  };
55
58
  } catch (err) {
56
- console.warn(`bridge withdraw envelope expectation failed for ${String(itx.to).slice(0, 12)}...: ${String(err?.message || err).slice(0, 120)}`);
59
+ console.warn(`bridge withdraw envelope expectation failed for rollup ${String(itx.rollup).slice(0, 12)}...: ${String(err?.message || err).slice(0, 120)}`);
57
60
  return { ...WITHDRAW_NONE };
58
61
  }
59
62
  }
63
+ /**
64
+ * Clear-signing expectation for a wallet envelope (#1465, bridge/docs/ocap-protocols.md §2, §v2.4).
65
+ *
66
+ * Returns the decoded `{ bridge, amount, token, ethRecipient }` when the tx is a bridge withdraw (`withdraw_token_v2` into
67
+ * a v2 bridge, `getWithdrawTokenV2EnvelopeContext`, fail closed) and `null` for every other tx.
68
+ */
69
+ async function getBridgeWithdrawEnvelopeContext(context) {
70
+ if (require_bridge_reserves.stripTxTypePrefix(context.txType) !== require_bridge_reserves.BRIDGE_WITHDRAW_V2_TX_TYPE) return null;
71
+ return getWithdrawTokenV2EnvelopeContext(context);
72
+ }
73
+ /**
74
+ * §2.4 step 6: inside the bridge branch, check the wallet envelope again against the bridge row read by THIS execution.
75
+ * The signature stage may have run on a pre-flight snapshot (execute.ts skips VerifySignature then), with a row read
76
+ * outside the transaction. Returns an error message, or null when there is no wallet envelope or it matches. The
77
+ * signature itself was verified over `extra` by VerifySignature; only the shown fields are compared here.
78
+ */
79
+ function assertBridgeWithdrawEnvelopeInBranch(context, withdraw) {
80
+ const tx = context.tx || {};
81
+ const rawTxExtra = context.extra?.txExtra;
82
+ if (typeof rawTxExtra !== "string" || !rawTxExtra) return null;
83
+ const signer = tx.delegator || tx.from;
84
+ if (!signer) return "Bridge withdraw has no signer";
85
+ let type;
86
+ try {
87
+ type = (0, _arcblock_did.toTypeInfo)(signer);
88
+ } catch {
89
+ return "Bridge withdraw signer is not a valid DID";
90
+ }
91
+ if (type.role === _ocap_mcrypto.types.RoleType.ROLE_PASSKEY || type.pk === _ocap_mcrypto.types.KeyType.PASSKEY || !(0, _ocap_mcrypto.isCanonicalWalletEnvelopeExtra)(rawTxExtra, type.pk)) return null;
92
+ try {
93
+ (0, _ocap_mcrypto.assertEnvelopeMatchesTxContext)(rawTxExtra, {
94
+ chainId: tx.chainId,
95
+ signer,
96
+ from: tx.from,
97
+ nonce: tx.nonce,
98
+ action: context.txType,
99
+ withdraw
100
+ });
101
+ return null;
102
+ } catch (err) {
103
+ return String(err?.message || err);
104
+ }
105
+ }
60
106
 
61
107
  //#endregion
108
+ exports.assertBridgeWithdrawEnvelopeInBranch = assertBridgeWithdrawEnvelopeInBranch;
62
109
  exports.assertEnvelopeMatchesTxContext = _ocap_mcrypto.assertEnvelopeMatchesTxContext;
63
110
  exports.getBridgeWithdrawEnvelopeContext = getBridgeWithdrawEnvelopeContext;
64
111
  exports.isCanonicalPasskeyExtra = isCanonicalPasskeyExtra;
@@ -11,23 +11,40 @@ import { assertEnvelopeMatchesTxContext, isCanonicalWalletEnvelopeExtra } from "
11
11
  * deduplication and `nonce > 0` for replay protection.
12
12
  */
13
13
  declare function isCanonicalPasskeyExtra(extra: string): boolean;
14
+ type WithdrawExpectation = {
15
+ bridge: string;
16
+ amount: string;
17
+ token: string;
18
+ ethRecipient: string;
19
+ };
14
20
  /**
15
21
  * Clear-signing expectation for a wallet envelope (#1465, bridge/docs/ocap-protocols.md §2, §v2.4).
16
22
  *
17
- * Returns the decoded `{ bridge, amount, token, ethRecipient }` when the tx is a `transfer_v2` whose `itx.to` has the bridge
18
- * reserve role, and `null` for every other tx. `token` is the TOKEN OF THE BRIDGE that owns the reserve. A withdraw whose
19
- * itx is not even shaped like one (other tokens, assets, missing recipient), or whose reserve maps to no bridge, returns
20
- * empty fields, which no envelope can match: the withdraw rule rejects it anyway, this keeps the signature stage from
21
- * blessing it first.
23
+ * Returns the decoded `{ bridge, amount, token, ethRecipient }` when the tx is a bridge withdraw (`withdraw_token_v2` into
24
+ * a v2 bridge, `getWithdrawTokenV2EnvelopeContext`, fail closed) and `null` for every other tx.
22
25
  */
23
26
  declare function getBridgeWithdrawEnvelopeContext(context: {
24
27
  txType?: string;
25
28
  itx?: unknown;
26
- }): Promise<{
27
- bridge: string;
28
- amount: string;
29
- token: string;
30
- ethRecipient: string;
31
- } | null>;
29
+ }): Promise<WithdrawExpectation | null>;
30
+ /**
31
+ * §2.4 step 6: inside the bridge branch, check the wallet envelope again against the bridge row read by THIS execution.
32
+ * The signature stage may have run on a pre-flight snapshot (execute.ts skips VerifySignature then), with a row read
33
+ * outside the transaction. Returns an error message, or null when there is no wallet envelope or it matches. The
34
+ * signature itself was verified over `extra` by VerifySignature; only the shown fields are compared here.
35
+ */
36
+ declare function assertBridgeWithdrawEnvelopeInBranch(context: {
37
+ tx?: {
38
+ from?: string;
39
+ delegator?: string;
40
+ pk?: string;
41
+ chainId?: string;
42
+ nonce?: unknown;
43
+ } | null;
44
+ txType?: string;
45
+ extra?: {
46
+ txExtra?: unknown;
47
+ } | null;
48
+ }, withdraw: WithdrawExpectation): string | null;
32
49
  //#endregion
33
- export { assertEnvelopeMatchesTxContext, getBridgeWithdrawEnvelopeContext, isCanonicalPasskeyExtra, isCanonicalWalletEnvelopeExtra, parseNonceBn };
50
+ export { assertBridgeWithdrawEnvelopeInBranch, assertEnvelopeMatchesTxContext, getBridgeWithdrawEnvelopeContext, isCanonicalPasskeyExtra, isCanonicalWalletEnvelopeExtra, parseNonceBn };
package/lib/index.cjs CHANGED
@@ -77,10 +77,8 @@ var src_default = {
77
77
  exports.AntiLandAttack = require_pipes_anti_land_attack.default;
78
78
  exports.BRIDGE_MAX_MIGRATION_HOPS = require_bridge_reserves.BRIDGE_MAX_MIGRATION_HOPS;
79
79
  exports.BRIDGE_RECONCILE_TX_TYPES = require_bridge_reserves.BRIDGE_RECONCILE_TX_TYPES;
80
- exports.BRIDGE_RELEASE_TX_TYPE = require_bridge_reserves.BRIDGE_RELEASE_TX_TYPE;
81
80
  exports.BRIDGE_RESERVE_CREDIT_TX_TYPES = require_bridge_reserves.BRIDGE_RESERVE_CREDIT_TX_TYPES;
82
81
  exports.BRIDGE_RESERVE_DEBIT_TX_TYPES = require_bridge_reserves.BRIDGE_RESERVE_DEBIT_TX_TYPES;
83
- exports.BRIDGE_WITHDRAW_TX_TYPE = require_bridge_reserves.BRIDGE_WITHDRAW_TX_TYPE;
84
82
  exports.DecodeItx = require_pipes_decode_itx.default;
85
83
  exports.DecodeTx = require_pipes_decode_tx.default;
86
84
  exports.ENCRYPTED_NFT_SCHEMA_VERSION = require_encrypted_nft_envelope.ENCRYPTED_NFT_SCHEMA_VERSION;
@@ -107,6 +105,7 @@ exports.Runner = require_runner.default;
107
105
  exports.TRACKED_STATE_TABLES = require_pipes_post_execution_invariant_gate.TRACKED_STATE_TABLES;
108
106
  exports.TakeStateSnapshot = require_pipes_take_state_snapshot.default;
109
107
  exports.UpdateOwner = require_pipes_update_owner.default;
108
+ exports.V1_EVIDENCE_DATA = require_bridge_release_keys.V1_EVIDENCE_DATA;
110
109
  exports.VALID_ENCRYPTED_NFT_ALGORITHMS = require_encrypted_nft_envelope.VALID_ENCRYPTED_NFT_ALGORITHMS;
111
110
  exports.VerifyAccountMigration = require_pipes_verify_account_migration.default;
112
111
  exports.VerifyBlocked = require_pipes_verify_blocked.default;
@@ -145,6 +144,7 @@ exports.installStateWriteInterceptor = require_pipes_post_execution_invariant_ga
145
144
  exports.isBridgeReserveRole = require_bridge_reserves.isBridgeReserveRole;
146
145
  exports.isCanonicalPasskeyExtra = require_helpers_replay_guard.isCanonicalPasskeyExtra;
147
146
  exports.isDelegationSufficient = require_pipes_verify_delegation.isDelegationSufficient;
147
+ exports.isV1EvidenceRow = require_bridge_release_keys.isV1EvidenceRow;
148
148
  exports.normalizeEntityKey = require_pipes_post_execution_invariant_gate.normalizeEntityKey;
149
149
  exports.openEncryptedNftAsOwner = require_encrypted_nft_envelope.openEncryptedNftAsOwner;
150
150
  exports.parseBucketData = require_bridge_release_keys.parseBucketData;
package/lib/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
- import { RELEASE_RING_SLOTS, ReleaseRing, formatBucketData, getReleaseBucketKey, getReleaseTombstoneKey, parseBucketData } from "./bridge-release-keys.cjs";
2
- import { BRIDGE_MAX_MIGRATION_HOPS, BRIDGE_RECONCILE_TX_TYPES, BRIDGE_RELEASE_TX_TYPE, BRIDGE_RESERVE_CREDIT_TX_TYPES, BRIDGE_RESERVE_DEBIT_TX_TYPES, BRIDGE_WITHDRAW_TX_TYPE, BridgeReserveResolution, ReleaseResolution, ResolvedBridge, describeBridge, isBridgeReserveRole, prepareBridgeReserveGate, reserveIndexKey, resolveBridge, resolveBridgeForRelease, resolveBridgeForReserve } from "./bridge-reserves.cjs";
1
+ import { RELEASE_RING_SLOTS, ReleaseRing, V1_EVIDENCE_DATA, formatBucketData, getReleaseBucketKey, getReleaseTombstoneKey, isV1EvidenceRow, parseBucketData } from "./bridge-release-keys.cjs";
2
+ import { BRIDGE_MAX_MIGRATION_HOPS, BRIDGE_RECONCILE_TX_TYPES, BRIDGE_RESERVE_CREDIT_TX_TYPES, BRIDGE_RESERVE_DEBIT_TX_TYPES, BridgeReserveResolution, ReleaseResolution, ResolvedBridge, describeBridge, isBridgeReserveRole, prepareBridgeReserveGate, reserveIndexKey, resolveBridge, resolveBridgeForRelease, resolveBridgeForReserve } from "./bridge-reserves.cjs";
3
3
  import { ENCRYPTED_NFT_SCHEMA_VERSION, EncryptedAssetEnvelope, EncryptedNftAlgorithm, EncryptedNftOwnerCipherEnvelope, EncryptedNftPrivateMetadata, EncryptedNftPublicDiscoveryHeader, MAX_ENCRYPTED_NFT_CATEGORY_LENGTH, MAX_ENCRYPTED_NFT_CIPHERTEXT_HEX_CHARS, MAX_ENCRYPTED_NFT_SUMMARY_LENGTH, MAX_ENCRYPTED_NFT_TAGS, MAX_ENCRYPTED_NFT_TAG_LENGTH, MAX_ENCRYPTED_NFT_URI_LENGTH, OpenEncryptedNftAsOwnerInput, OpenEncryptedNftAsOwnerResult, RewrapEncryptedNftForNewOwnerInput, SealEncryptedNftForOwnerInput, VALID_ENCRYPTED_NFT_ALGORITHMS, VerifyEncryptedNftHandoverInput, canonicalizeEncryptedNftMetadata, computeEncryptedNftCekCommitmentHash, computeEncryptedNftPlaintextHash, computeEncryptedNftPublicHeaderAad, deriveOwnerPublicKeyHexFromSecretKey, openEncryptedNftAsOwner, rewrapEncryptedNftForNewOwner, sealEncryptedNftForOwner, validateEncryptedAssetEnvelope, verifyEncryptedNftHandover } from "./encrypted-nft-envelope.cjs";
4
4
  import { isCanonicalPasskeyExtra, parseNonceBn } from "./helpers/replay-guard.cjs";
5
5
  import PipelineRunner, { ErrorPipeFunction, PipeFunction, PipeNext, PipeOptions } from "./runner.cjs";
@@ -101,4 +101,4 @@ declare const _default: {
101
101
  };
102
102
  };
103
103
  //#endregion
104
- export { CreateAntiLandAttackPipe as AntiLandAttack, BRIDGE_MAX_MIGRATION_HOPS, BRIDGE_RECONCILE_TX_TYPES, BRIDGE_RELEASE_TX_TYPE, BRIDGE_RESERVE_CREDIT_TX_TYPES, BRIDGE_RESERVE_DEBIT_TX_TYPES, BRIDGE_WITHDRAW_TX_TYPE, type BridgeReserveResolution, DecodeItx, DecodeTx, ENCRYPTED_NFT_SCHEMA_VERSION, type EncryptedAssetEnvelope, type EncryptedNftAlgorithm, type EncryptedNftOwnerCipherEnvelope, type EncryptedNftPrivateMetadata, type EncryptedNftPublicDiscoveryHeader, type ErrorPipeFunction, CreateExtractReceiverPipe as ExtractReceiver, CreateExtractSignerPipe as ExtractSigner, CreateExtractStatePipe as ExtractState, type IAccountUpdate, type IBaseContext, type IDecodedContext, type IDecodedTransaction, type IExecutedContext, type IGasContext, type IReadyContext, type IStateWriteTracker, type ITxOnlyContext, type IWithAsset, type IWithAssets, type IWithDelegation, type IWithDelegator, type IWithEvidence, type IWithFactory, type IWithLocked, type IWithOwner, type IWithReceiver, type IWithRollup, type IWithRollupBlock, type IWithSender, type IWithStake, type IWithStakes, type IWithToken, type IWithTokenFactory, type IWithTokens, MAX_DELEGATE_TYPE_URLS_LIST_SIZE, MAX_ENCRYPTED_NFT_CATEGORY_LENGTH, MAX_ENCRYPTED_NFT_CIPHERTEXT_HEX_CHARS, MAX_ENCRYPTED_NFT_SUMMARY_LENGTH, MAX_ENCRYPTED_NFT_TAGS, MAX_ENCRYPTED_NFT_TAG_LENGTH, MAX_ENCRYPTED_NFT_URI_LENGTH, MAX_POST_EXECUTION_WRITE_SET_ENTRIES, MAX_PREFLIGHT_JSON_DEPTH, MAX_PREFLIGHT_JSON_KEYS, MAX_PREFLIGHT_STRING_FIELD_BYTES, MAX_PREFLIGHT_WIRE_BYTES_FALLBACK, MAX_ROLLUP_TXS_LIST_SIZE, type OpenEncryptedNftAsOwnerInput, type OpenEncryptedNftAsOwnerResult, type PipeFunction, type PipeNext, type PipeOptions, CreatePostExecutionInvariantGatePipe as PostExecutionInvariantGate, PreFlightWaf, RELEASE_RING_SLOTS, type ReleaseResolution, type ReleaseRing, type ResolvedBridge, type RewrapEncryptedNftForNewOwnerInput, PipelineRunner as Runner, type SealEncryptedNftForOwnerInput, TRACKED_STATE_TABLES, type TTransactionReceipt, CreateTakeStateSnapshotPipe as TakeStateSnapshot, type TrackedStateTable, CreateUpdateOwnerPipe as UpdateOwner, VALID_ENCRYPTED_NFT_ALGORITHMS, CreateVerifyAccountMigrationPipe as VerifyAccountMigration, CreatedVerifyBlockedPipe as VerifyBlocked, CreateVerifyDelegationPipe as VerifyDelegation, type VerifyEncryptedNftHandoverInput, CreateVerifyInfoPipe as VerifyInfo, CreateVerifyListSizePipe as VerifyListSize, CreateVerifyMultiSigPipe as VerifyMultiSig, CreateVerifyMultiSigV2Pipe as VerifyMultiSigV2, CreateVerifySenderPipe as VerifySender, VerifyServiceFee, VerifySignature, CreateVerifySignerPipe as VerifySigner, CreateVerifyStateDiffPipe as VerifyStateDiff, CreateVerifyTokenBalancePipe as VerifyTokenBalance, CreateVerifyTransferrablePipe as VerifyTransferrable, VerifyTx, CreateVerifyTxInputPipe as VerifyTxInput, VerifyTxSize, CreateVerifyUpdaterPipe as VerifyUpdater, assertKnownItxFields, assertRawWireEnvelope, canonicalizeEncryptedNftMetadata, computeEncryptedNftCekCommitmentHash, computeEncryptedNftPlaintextHash, computeEncryptedNftPublicHeaderAad, _default as default, deriveOwnerPublicKeyHexFromSecretKey, describeBridge, formatBucketData, getReleaseBucketKey, getReleaseTombstoneKey, groupStatesByAddress, inspectPostExecutionInvariants, inspectTransactionPreFlight, installStateWriteInterceptor, isBridgeReserveRole, isCanonicalPasskeyExtra, isDelegationSufficient, normalizeEntityKey, openEncryptedNftAsOwner, parseBucketData, parseNonceBn, pipes, prepareBridgeReserveGate, reserveIndexKey, resolveBridge, resolveBridgeForRelease, resolveBridgeForReserve, rewrapEncryptedNftForNewOwner, rollbackTrackedStateWrites, scanItxPayloadAnomalies, sealEncryptedNftForOwner, validateEncryptedAssetEnvelope, verifyAssetHierarchy, verifyEncryptedNftHandover, verifyImplicitAssetOwnership, CreateVerifyTokenAccessPipe as verifyTokenAccess };
104
+ export { CreateAntiLandAttackPipe as AntiLandAttack, BRIDGE_MAX_MIGRATION_HOPS, BRIDGE_RECONCILE_TX_TYPES, BRIDGE_RESERVE_CREDIT_TX_TYPES, BRIDGE_RESERVE_DEBIT_TX_TYPES, type BridgeReserveResolution, DecodeItx, DecodeTx, ENCRYPTED_NFT_SCHEMA_VERSION, type EncryptedAssetEnvelope, type EncryptedNftAlgorithm, type EncryptedNftOwnerCipherEnvelope, type EncryptedNftPrivateMetadata, type EncryptedNftPublicDiscoveryHeader, type ErrorPipeFunction, CreateExtractReceiverPipe as ExtractReceiver, CreateExtractSignerPipe as ExtractSigner, CreateExtractStatePipe as ExtractState, type IAccountUpdate, type IBaseContext, type IDecodedContext, type IDecodedTransaction, type IExecutedContext, type IGasContext, type IReadyContext, type IStateWriteTracker, type ITxOnlyContext, type IWithAsset, type IWithAssets, type IWithDelegation, type IWithDelegator, type IWithEvidence, type IWithFactory, type IWithLocked, type IWithOwner, type IWithReceiver, type IWithRollup, type IWithRollupBlock, type IWithSender, type IWithStake, type IWithStakes, type IWithToken, type IWithTokenFactory, type IWithTokens, MAX_DELEGATE_TYPE_URLS_LIST_SIZE, MAX_ENCRYPTED_NFT_CATEGORY_LENGTH, MAX_ENCRYPTED_NFT_CIPHERTEXT_HEX_CHARS, MAX_ENCRYPTED_NFT_SUMMARY_LENGTH, MAX_ENCRYPTED_NFT_TAGS, MAX_ENCRYPTED_NFT_TAG_LENGTH, MAX_ENCRYPTED_NFT_URI_LENGTH, MAX_POST_EXECUTION_WRITE_SET_ENTRIES, MAX_PREFLIGHT_JSON_DEPTH, MAX_PREFLIGHT_JSON_KEYS, MAX_PREFLIGHT_STRING_FIELD_BYTES, MAX_PREFLIGHT_WIRE_BYTES_FALLBACK, MAX_ROLLUP_TXS_LIST_SIZE, type OpenEncryptedNftAsOwnerInput, type OpenEncryptedNftAsOwnerResult, type PipeFunction, type PipeNext, type PipeOptions, CreatePostExecutionInvariantGatePipe as PostExecutionInvariantGate, PreFlightWaf, RELEASE_RING_SLOTS, type ReleaseResolution, type ReleaseRing, type ResolvedBridge, type RewrapEncryptedNftForNewOwnerInput, PipelineRunner as Runner, type SealEncryptedNftForOwnerInput, TRACKED_STATE_TABLES, type TTransactionReceipt, CreateTakeStateSnapshotPipe as TakeStateSnapshot, type TrackedStateTable, CreateUpdateOwnerPipe as UpdateOwner, V1_EVIDENCE_DATA, VALID_ENCRYPTED_NFT_ALGORITHMS, CreateVerifyAccountMigrationPipe as VerifyAccountMigration, CreatedVerifyBlockedPipe as VerifyBlocked, CreateVerifyDelegationPipe as VerifyDelegation, type VerifyEncryptedNftHandoverInput, CreateVerifyInfoPipe as VerifyInfo, CreateVerifyListSizePipe as VerifyListSize, CreateVerifyMultiSigPipe as VerifyMultiSig, CreateVerifyMultiSigV2Pipe as VerifyMultiSigV2, CreateVerifySenderPipe as VerifySender, VerifyServiceFee, VerifySignature, CreateVerifySignerPipe as VerifySigner, CreateVerifyStateDiffPipe as VerifyStateDiff, CreateVerifyTokenBalancePipe as VerifyTokenBalance, CreateVerifyTransferrablePipe as VerifyTransferrable, VerifyTx, CreateVerifyTxInputPipe as VerifyTxInput, VerifyTxSize, CreateVerifyUpdaterPipe as VerifyUpdater, assertKnownItxFields, assertRawWireEnvelope, canonicalizeEncryptedNftMetadata, computeEncryptedNftCekCommitmentHash, computeEncryptedNftPlaintextHash, computeEncryptedNftPublicHeaderAad, _default as default, deriveOwnerPublicKeyHexFromSecretKey, describeBridge, formatBucketData, getReleaseBucketKey, getReleaseTombstoneKey, groupStatesByAddress, inspectPostExecutionInvariants, inspectTransactionPreFlight, installStateWriteInterceptor, isBridgeReserveRole, isCanonicalPasskeyExtra, isDelegationSufficient, isV1EvidenceRow, normalizeEntityKey, openEncryptedNftAsOwner, parseBucketData, parseNonceBn, pipes, prepareBridgeReserveGate, reserveIndexKey, resolveBridge, resolveBridgeForRelease, resolveBridgeForReserve, rewrapEncryptedNftForNewOwner, rollbackTrackedStateWrites, scanItxPayloadAnomalies, sealEncryptedNftForOwner, validateEncryptedAssetEnvelope, verifyAssetHierarchy, verifyEncryptedNftHandover, verifyImplicitAssetOwnership, CreateVerifyTokenAccessPipe as verifyTokenAccess };