@ocap/tx-protocols 1.31.1 → 1.31.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (161) hide show
  1. package/esm/bridge-release-crypto.d.mts +39 -0
  2. package/esm/bridge-release-crypto.mjs +88 -0
  3. package/esm/bridge-release-window.d.mts +47 -0
  4. package/esm/bridge-release-window.mjs +62 -0
  5. package/esm/bridge-reserve.d.mts +24 -0
  6. package/esm/bridge-reserve.mjs +41 -0
  7. package/esm/execute.d.mts +1 -1
  8. package/esm/execute.mjs +58 -5
  9. package/esm/gas-security-guard.d.mts +6 -2
  10. package/esm/gas-security-guard.mjs +16 -9
  11. package/esm/index.d.mts +37 -18
  12. package/esm/index.mjs +6 -2
  13. package/esm/pipes/ensure-cost.mjs +7 -1
  14. package/esm/pipes/write-ledger.d.mts +2 -2
  15. package/esm/pipes/write-ledger.mjs +6 -3
  16. package/esm/protocols/account/delegate.mjs +6 -4
  17. package/esm/protocols/account/migrate.mjs +5 -3
  18. package/esm/protocols/account/revoke-delegate.mjs +5 -3
  19. package/esm/protocols/asset/acquire-v2.mjs +3 -1
  20. package/esm/protocols/asset/acquire-v3.mjs +4 -2
  21. package/esm/protocols/asset/consume.mjs +3 -1
  22. package/esm/protocols/asset/create.mjs +4 -2
  23. package/esm/protocols/asset/mint.mjs +4 -2
  24. package/esm/protocols/asset/pipes/exec-mint-hook.mjs +1 -1
  25. package/esm/protocols/asset/pipes/verify-itx-address.mjs +1 -1
  26. package/esm/protocols/asset/pipes/verify-itx-assets.mjs +1 -1
  27. package/esm/protocols/asset/update.mjs +4 -2
  28. package/esm/protocols/bridge/release.d.mts +34 -0
  29. package/esm/protocols/bridge/release.mjs +385 -0
  30. package/esm/protocols/factory/create.mjs +4 -2
  31. package/esm/protocols/governance/claim-stake.mjs +4 -2
  32. package/esm/protocols/governance/return-stake.mjs +4 -2
  33. package/esm/protocols/governance/revoke-ledger.mjs +1 -1
  34. package/esm/protocols/governance/revoke-stake.d.mts +7 -2
  35. package/esm/protocols/governance/revoke-stake.mjs +49 -28
  36. package/esm/protocols/governance/slash-stake.mjs +5 -3
  37. package/esm/protocols/governance/stake.mjs +6 -4
  38. package/esm/protocols/rollup/bridge-create.d.mts +13 -0
  39. package/esm/protocols/rollup/bridge-create.mjs +206 -0
  40. package/esm/protocols/rollup/bridge-membership.d.mts +10 -0
  41. package/esm/protocols/rollup/bridge-membership.mjs +154 -0
  42. package/esm/protocols/rollup/bridge-migrate.d.mts +10 -0
  43. package/esm/protocols/rollup/bridge-migrate.mjs +208 -0
  44. package/esm/protocols/rollup/bridge-v2.d.mts +113 -0
  45. package/esm/protocols/rollup/bridge-v2.mjs +219 -0
  46. package/esm/protocols/rollup/claim-reward.mjs +4 -2
  47. package/esm/protocols/rollup/close.d.mts +2 -1
  48. package/esm/protocols/rollup/close.mjs +59 -6
  49. package/esm/protocols/rollup/create-block.mjs +4 -2
  50. package/esm/protocols/rollup/create.d.mts +3 -0
  51. package/esm/protocols/rollup/create.mjs +45 -6
  52. package/esm/protocols/rollup/join.d.mts +2 -1
  53. package/esm/protocols/rollup/join.mjs +31 -23
  54. package/esm/protocols/rollup/leave.d.mts +2 -1
  55. package/esm/protocols/rollup/leave.mjs +32 -24
  56. package/esm/protocols/rollup/migrate.d.mts +2 -1
  57. package/esm/protocols/rollup/migrate.mjs +19 -10
  58. package/esm/protocols/rollup/pause.d.mts +4 -1
  59. package/esm/protocols/rollup/pause.mjs +50 -6
  60. package/esm/protocols/rollup/pipes/verify-evidence.mjs +2 -2
  61. package/esm/protocols/rollup/resume.d.mts +2 -1
  62. package/esm/protocols/rollup/resume.mjs +26 -6
  63. package/esm/protocols/rollup/update.d.mts +5 -1
  64. package/esm/protocols/rollup/update.mjs +56 -9
  65. package/esm/protocols/token/create.mjs +4 -2
  66. package/esm/protocols/token/deposit-v2.mjs +5 -3
  67. package/esm/protocols/token/withdraw-v2.mjs +5 -3
  68. package/esm/protocols/token-factory/burn.mjs +4 -2
  69. package/esm/protocols/token-factory/create.mjs +8 -4
  70. package/esm/protocols/token-factory/mint.mjs +4 -2
  71. package/esm/protocols/token-factory/update.mjs +20 -5
  72. package/esm/protocols/trade/exchange-v2.d.mts +5 -1
  73. package/esm/protocols/trade/exchange-v2.mjs +89 -4
  74. package/esm/protocols/trade/transfer-v2.mjs +15 -4
  75. package/esm/protocols/trade/transfer-v3.mjs +5 -3
  76. package/esm/stateless-prefix.d.mts +16 -0
  77. package/esm/stateless-prefix.mjs +82 -0
  78. package/esm/tx-timer.d.mts +1 -1
  79. package/esm/tx-timer.mjs +1 -1
  80. package/esm/util.mjs +2 -2
  81. package/lib/bridge-release-crypto.cjs +93 -0
  82. package/lib/bridge-release-crypto.d.cts +39 -0
  83. package/lib/bridge-release-window.cjs +69 -0
  84. package/lib/bridge-release-window.d.cts +47 -0
  85. package/lib/bridge-reserve.cjs +45 -0
  86. package/lib/bridge-reserve.d.cts +24 -0
  87. package/lib/execute.cjs +58 -5
  88. package/lib/gas-security-guard.cjs +16 -9
  89. package/lib/gas-security-guard.d.cts +6 -2
  90. package/lib/index.cjs +8 -1
  91. package/lib/index.d.cts +36 -17
  92. package/lib/pipes/ensure-cost.cjs +7 -1
  93. package/lib/pipes/write-ledger.cjs +6 -3
  94. package/lib/pipes/write-ledger.d.cts +2 -2
  95. package/lib/protocols/account/delegate.cjs +6 -4
  96. package/lib/protocols/account/migrate.cjs +5 -3
  97. package/lib/protocols/account/revoke-delegate.cjs +5 -3
  98. package/lib/protocols/asset/acquire-v2.cjs +3 -1
  99. package/lib/protocols/asset/acquire-v3.cjs +4 -2
  100. package/lib/protocols/asset/consume.cjs +3 -1
  101. package/lib/protocols/asset/create.cjs +4 -2
  102. package/lib/protocols/asset/mint.cjs +4 -2
  103. package/lib/protocols/asset/pipes/exec-mint-hook.cjs +1 -1
  104. package/lib/protocols/asset/pipes/verify-itx-address.cjs +1 -1
  105. package/lib/protocols/asset/pipes/verify-itx-assets.cjs +1 -1
  106. package/lib/protocols/asset/update.cjs +4 -2
  107. package/lib/protocols/bridge/release.cjs +390 -0
  108. package/lib/protocols/bridge/release.d.cts +34 -0
  109. package/lib/protocols/factory/create.cjs +4 -2
  110. package/lib/protocols/governance/claim-stake.cjs +4 -2
  111. package/lib/protocols/governance/return-stake.cjs +4 -2
  112. package/lib/protocols/governance/revoke-ledger.cjs +1 -1
  113. package/lib/protocols/governance/revoke-stake.cjs +49 -28
  114. package/lib/protocols/governance/revoke-stake.d.cts +7 -2
  115. package/lib/protocols/governance/slash-stake.cjs +5 -3
  116. package/lib/protocols/governance/stake.cjs +6 -4
  117. package/lib/protocols/rollup/bridge-create.cjs +209 -0
  118. package/lib/protocols/rollup/bridge-create.d.cts +13 -0
  119. package/lib/protocols/rollup/bridge-membership.cjs +157 -0
  120. package/lib/protocols/rollup/bridge-membership.d.cts +10 -0
  121. package/lib/protocols/rollup/bridge-migrate.cjs +212 -0
  122. package/lib/protocols/rollup/bridge-migrate.d.cts +10 -0
  123. package/lib/protocols/rollup/bridge-v2.cjs +244 -0
  124. package/lib/protocols/rollup/bridge-v2.d.cts +113 -0
  125. package/lib/protocols/rollup/claim-reward.cjs +4 -2
  126. package/lib/protocols/rollup/close.cjs +59 -6
  127. package/lib/protocols/rollup/close.d.cts +2 -1
  128. package/lib/protocols/rollup/create-block.cjs +4 -2
  129. package/lib/protocols/rollup/create.cjs +45 -6
  130. package/lib/protocols/rollup/create.d.cts +3 -0
  131. package/lib/protocols/rollup/join.cjs +31 -23
  132. package/lib/protocols/rollup/join.d.cts +2 -1
  133. package/lib/protocols/rollup/leave.cjs +32 -24
  134. package/lib/protocols/rollup/leave.d.cts +2 -1
  135. package/lib/protocols/rollup/migrate.cjs +19 -10
  136. package/lib/protocols/rollup/migrate.d.cts +2 -1
  137. package/lib/protocols/rollup/pause.cjs +50 -6
  138. package/lib/protocols/rollup/pause.d.cts +4 -1
  139. package/lib/protocols/rollup/pipes/verify-evidence.cjs +2 -2
  140. package/lib/protocols/rollup/resume.cjs +26 -6
  141. package/lib/protocols/rollup/resume.d.cts +2 -1
  142. package/lib/protocols/rollup/update.cjs +56 -9
  143. package/lib/protocols/rollup/update.d.cts +5 -1
  144. package/lib/protocols/token/create.cjs +4 -2
  145. package/lib/protocols/token/deposit-v2.cjs +5 -3
  146. package/lib/protocols/token/withdraw-v2.cjs +5 -3
  147. package/lib/protocols/token-factory/burn.cjs +4 -2
  148. package/lib/protocols/token-factory/create.cjs +8 -4
  149. package/lib/protocols/token-factory/mint.cjs +4 -2
  150. package/lib/protocols/token-factory/update.cjs +20 -5
  151. package/lib/protocols/trade/exchange-v2.cjs +90 -3
  152. package/lib/protocols/trade/exchange-v2.d.cts +5 -1
  153. package/lib/protocols/trade/transfer-v2.cjs +15 -4
  154. package/lib/protocols/trade/transfer-v3.cjs +5 -3
  155. package/lib/stateless-prefix.cjs +88 -0
  156. package/lib/stateless-prefix.d.cts +16 -0
  157. package/lib/tx-timer.cjs +1 -1
  158. package/lib/tx-timer.d.cts +1 -1
  159. package/lib/util.cjs +2 -2
  160. package/package.json +16 -16
  161. package/tools/fixtures.ts +9 -4
package/esm/index.d.mts CHANGED
@@ -12,17 +12,20 @@ import { TokenInput as TokenInput$4 } from "./protocols/token/withdraw-v2.mjs";
12
12
  import { TokenInfoForVerification } from "./protocols/token-factory/update.mjs";
13
13
  import { MultiInput as MultiInput$2 } from "./protocols/token-factory/mint.mjs";
14
14
  import { MultiInput as MultiInput$3 } from "./protocols/token-factory/burn.mjs";
15
+ import { Context } from "./protocols/bridge/release.mjs";
15
16
  import { MultiInput as MultiInput$4 } from "./protocols/governance/stake.mjs";
16
17
  import { MultiOutput, TokenCondition } from "./protocols/governance/revoke-stake.mjs";
17
18
  import { MultiOutput as MultiOutput$1, TokenCondition as TokenCondition$1, TokenInput as TokenInput$5 } from "./protocols/governance/claim-stake.mjs";
18
19
  import { MultiOutput as MultiOutput$2 } from "./protocols/governance/slash-stake.mjs";
19
20
  import { MultiInput as MultiInput$5, TokenCondition as TokenCondition$2 } from "./protocols/governance/return-stake.mjs";
21
+ import { BridgeCtxMixin } from "./protocols/rollup/bridge-v2.mjs";
20
22
  import { TokenChange as TokenChange$1 } from "./protocols/rollup/create-block.mjs";
21
23
  import { TokenChange as TokenChange$2 } from "./protocols/rollup/claim-reward.mjs";
22
24
  import { WriteLedger } from "./pipes/write-ledger.mjs";
23
- import * as states from "@ocap/state";
25
+ import { assertStatelessTxRules, getStatelessPrefixLength, markStatelessPrefix } from "./stateless-prefix.mjs";
24
26
  import * as _ocap_tx_pipeline0 from "@ocap/tx-pipeline";
25
27
  import { MAX_POST_EXECUTION_WRITE_SET_ENTRIES, MAX_PREFLIGHT_JSON_DEPTH, MAX_PREFLIGHT_JSON_KEYS, PostExecutionInvariantGate, PreFlightWaf, TRACKED_STATE_TABLES, assertKnownItxFields, assertRawWireEnvelope, inspectPostExecutionInvariants, inspectTransactionPreFlight, installStateWriteInterceptor, normalizeEntityKey, rollbackTrackedStateWrites, scanItxPayloadAnomalies } from "@ocap/tx-pipeline";
28
+ import * as states from "@ocap/state";
26
29
  import * as _ocap_util0 from "@ocap/util";
27
30
  import * as _ocap_message0 from "@ocap/message";
28
31
  import * as _ocap_types0 from "@ocap/types";
@@ -300,6 +303,7 @@ declare const createExecutor: ({
300
303
  delta: string;
301
304
  }[];
302
305
  }>;
306
+ releaseBridgeToken: _ocap_tx_pipeline0.Runner<Context>;
303
307
  stake: _ocap_tx_pipeline0.Runner<_ocap_types0.IReadyContext<_ocap_types0.TStakeTx> & Partial<_ocap_types0.IWithSender> & Partial<_ocap_types0.IWithSigners> & Partial<_ocap_types0.IWithReceiver> & Partial<_ocap_types0.IWithStake> & Partial<_ocap_types0.IWithTokens> & Partial<_ocap_types0.IWithAssets> & {
304
308
  inputs?: MultiInput$4[];
305
309
  senders?: string[];
@@ -310,7 +314,8 @@ declare const createExecutor: ({
310
314
  revokeWaitingPeriod?: number;
311
315
  slashers?: string[];
312
316
  }>;
313
- revokeStake: _ocap_tx_pipeline0.Runner<_ocap_types0.IReadyContext<_ocap_types0.TRevokeStakeTx> & _ocap_types0.IWithSender & _ocap_types0.IWithStake & Partial<_ocap_types0.IWithReceivers> & Partial<_ocap_types0.IWithTokens> & Partial<_ocap_types0.IWithAssets> & {
317
+ revokeStake: _ocap_tx_pipeline0.Runner<_ocap_types0.IReadyContext<_ocap_types0.TRevokeStakeTx> & _ocap_types0.IWithSender & _ocap_types0.IWithStake & Partial<_ocap_types0.IWithReceivers> & Partial<_ocap_types0.IWithTokens> & Partial<_ocap_types0.IWithAssets> & Partial<Pick<_ocap_types0.IWithToken, "tokenState">> & Partial<_ocap_types0.IWithTokenFactory> & {
318
+ tokenStakeRelease?: "retire" | "retired";
314
319
  outputs?: MultiOutput[];
315
320
  receivers?: string[];
316
321
  tokens?: string[];
@@ -357,23 +362,29 @@ declare const createExecutor: ({
357
362
  tokenState?: _ocap_types0.ITokenState;
358
363
  rollupState?: _ocap_types0.IRollupState | null;
359
364
  isDelegationChanged?: boolean;
365
+ isBridgeV2?: boolean;
366
+ bridgeInput?: unknown;
367
+ }>;
368
+ updateRollup: _ocap_tx_pipeline0.Runner<_ocap_types0.IReadyContext<_ocap_types0.TUpdateRollupTx> & _ocap_types0.IWithRollup & _ocap_types0.IWithSender & _ocap_types0.IWithSigners & BridgeCtxMixin & {
369
+ bridgePlan?: states.rollup.BridgePatchPlan;
360
370
  }>;
361
- updateRollup: _ocap_tx_pipeline0.Runner<_ocap_types0.IReadyContext<_ocap_types0.TUpdateRollupTx> & _ocap_types0.IWithRollup & _ocap_types0.IWithSender & _ocap_types0.IWithSigners>;
362
- joinRollup: _ocap_tx_pipeline0.Runner<_ocap_types0.IReadyContext<_ocap_types0.TJoinRollupTx> & _ocap_types0.IWithRollup & _ocap_types0.IWithSender & _ocap_types0.IWithSigners & _ocap_types0.IWithStake & {
371
+ joinRollup: _ocap_tx_pipeline0.Runner<_ocap_types0.IReadyContext<_ocap_types0.TJoinRollupTx> & _ocap_types0.IWithRollup & _ocap_types0.IWithSender & _ocap_types0.IWithSigners & _ocap_types0.IWithStake & BridgeCtxMixin & {
363
372
  evidenceState?: _ocap_types0.IEvidenceState | null;
364
373
  newValidator?: _ocap_types0.IRollupValidator;
365
374
  validatorsHash?: string;
366
375
  }>;
367
- leaveRollup: _ocap_tx_pipeline0.Runner<_ocap_types0.IReadyContext<_ocap_types0.TLeaveRollupTx> & _ocap_types0.IWithRollup & _ocap_types0.IWithSender & _ocap_types0.IWithSigners & _ocap_types0.IWithStake & {
376
+ leaveRollup: _ocap_tx_pipeline0.Runner<_ocap_types0.IReadyContext<_ocap_types0.TLeaveRollupTx> & _ocap_types0.IWithRollup & _ocap_types0.IWithSender & _ocap_types0.IWithSigners & _ocap_types0.IWithStake & BridgeCtxMixin & {
368
377
  validatorsHash?: string;
369
378
  evidenceState?: _ocap_types0.IEvidenceState | null;
370
379
  }>;
371
- pauseRollup: _ocap_tx_pipeline0.Runner<_ocap_types0.IReadyContext<_ocap_types0.TPauseRollupTx> & _ocap_types0.IWithRollup & _ocap_types0.IWithSender & _ocap_types0.IWithSigners>;
372
- closeRollup: _ocap_tx_pipeline0.Runner<_ocap_types0.IReadyContext<_ocap_types0.TCloseRollupTx> & _ocap_types0.IWithRollup & _ocap_types0.IWithSender & _ocap_types0.IWithSigners & {
380
+ pauseRollup: _ocap_tx_pipeline0.Runner<_ocap_types0.IReadyContext<_ocap_types0.TPauseRollupTx> & _ocap_types0.IWithRollup & _ocap_types0.IWithSender & _ocap_types0.IWithSigners & BridgeCtxMixin & {
381
+ pauseKind?: "quorum" | "lone";
382
+ }>;
383
+ closeRollup: _ocap_tx_pipeline0.Runner<_ocap_types0.IReadyContext<_ocap_types0.TCloseRollupTx> & _ocap_types0.IWithRollup & _ocap_types0.IWithSender & _ocap_types0.IWithSigners & BridgeCtxMixin & {
373
384
  stakeAddresses?: string[];
374
385
  stakeStates?: _ocap_types0.IStakeState[];
375
386
  }>;
376
- resumeRollup: _ocap_tx_pipeline0.Runner<_ocap_types0.IReadyContext<_ocap_types0.TResumeRollupTx> & _ocap_types0.IWithRollup & _ocap_types0.IWithSender & _ocap_types0.IWithSigners>;
387
+ resumeRollup: _ocap_tx_pipeline0.Runner<_ocap_types0.IReadyContext<_ocap_types0.TResumeRollupTx> & _ocap_types0.IWithRollup & _ocap_types0.IWithSender & _ocap_types0.IWithSigners & BridgeCtxMixin>;
377
388
  createRollupBlock: _ocap_tx_pipeline0.Runner<_ocap_types0.IReadyContext<_ocap_types0.TCreateRollupBlockTx> & _ocap_types0.IWithRollup & _ocap_types0.IWithSender & _ocap_types0.IWithSigners & _ocap_types0.IWithStakes & {
378
389
  formattedItx?: Record<string, unknown>;
379
390
  previousBlock?: _ocap_types0.IRollupBlock | null;
@@ -422,7 +433,7 @@ declare const createExecutor: ({
422
433
  missingAccountStates?: _ocap_types0.IAccountState[];
423
434
  stakeStates?: _ocap_types0.IStakeState[];
424
435
  }>;
425
- migrateRollup: _ocap_tx_pipeline0.Runner<_ocap_types0.IReadyContext<_ocap_types0.TMigrateRollupTx> & _ocap_types0.IWithRollup & _ocap_types0.IWithSender & _ocap_types0.IWithSigners>;
436
+ migrateRollup: _ocap_tx_pipeline0.Runner<_ocap_types0.IReadyContext<_ocap_types0.TMigrateRollupTx> & _ocap_types0.IWithRollup & _ocap_types0.IWithSender & _ocap_types0.IWithSigners & BridgeCtxMixin>;
426
437
  };
427
438
  declare const defaultExecutor: {
428
439
  execute: (context: unknown, done?: (err: Error | null, res?: unknown) => void) => any;
@@ -684,6 +695,7 @@ declare const defaultExecutor: {
684
695
  delta: string;
685
696
  }[];
686
697
  }>;
698
+ releaseBridgeToken: _ocap_tx_pipeline0.Runner<Context>;
687
699
  stake: _ocap_tx_pipeline0.Runner<_ocap_types0.IReadyContext<_ocap_types0.TStakeTx> & Partial<_ocap_types0.IWithSender> & Partial<_ocap_types0.IWithSigners> & Partial<_ocap_types0.IWithReceiver> & Partial<_ocap_types0.IWithStake> & Partial<_ocap_types0.IWithTokens> & Partial<_ocap_types0.IWithAssets> & {
688
700
  inputs?: MultiInput$4[];
689
701
  senders?: string[];
@@ -694,7 +706,8 @@ declare const defaultExecutor: {
694
706
  revokeWaitingPeriod?: number;
695
707
  slashers?: string[];
696
708
  }>;
697
- revokeStake: _ocap_tx_pipeline0.Runner<_ocap_types0.IReadyContext<_ocap_types0.TRevokeStakeTx> & _ocap_types0.IWithSender & _ocap_types0.IWithStake & Partial<_ocap_types0.IWithReceivers> & Partial<_ocap_types0.IWithTokens> & Partial<_ocap_types0.IWithAssets> & {
709
+ revokeStake: _ocap_tx_pipeline0.Runner<_ocap_types0.IReadyContext<_ocap_types0.TRevokeStakeTx> & _ocap_types0.IWithSender & _ocap_types0.IWithStake & Partial<_ocap_types0.IWithReceivers> & Partial<_ocap_types0.IWithTokens> & Partial<_ocap_types0.IWithAssets> & Partial<Pick<_ocap_types0.IWithToken, "tokenState">> & Partial<_ocap_types0.IWithTokenFactory> & {
710
+ tokenStakeRelease?: "retire" | "retired";
698
711
  outputs?: MultiOutput[];
699
712
  receivers?: string[];
700
713
  tokens?: string[];
@@ -741,23 +754,29 @@ declare const defaultExecutor: {
741
754
  tokenState?: _ocap_types0.ITokenState;
742
755
  rollupState?: _ocap_types0.IRollupState | null;
743
756
  isDelegationChanged?: boolean;
757
+ isBridgeV2?: boolean;
758
+ bridgeInput?: unknown;
759
+ }>;
760
+ updateRollup: _ocap_tx_pipeline0.Runner<_ocap_types0.IReadyContext<_ocap_types0.TUpdateRollupTx> & _ocap_types0.IWithRollup & _ocap_types0.IWithSender & _ocap_types0.IWithSigners & BridgeCtxMixin & {
761
+ bridgePlan?: states.rollup.BridgePatchPlan;
744
762
  }>;
745
- updateRollup: _ocap_tx_pipeline0.Runner<_ocap_types0.IReadyContext<_ocap_types0.TUpdateRollupTx> & _ocap_types0.IWithRollup & _ocap_types0.IWithSender & _ocap_types0.IWithSigners>;
746
- joinRollup: _ocap_tx_pipeline0.Runner<_ocap_types0.IReadyContext<_ocap_types0.TJoinRollupTx> & _ocap_types0.IWithRollup & _ocap_types0.IWithSender & _ocap_types0.IWithSigners & _ocap_types0.IWithStake & {
763
+ joinRollup: _ocap_tx_pipeline0.Runner<_ocap_types0.IReadyContext<_ocap_types0.TJoinRollupTx> & _ocap_types0.IWithRollup & _ocap_types0.IWithSender & _ocap_types0.IWithSigners & _ocap_types0.IWithStake & BridgeCtxMixin & {
747
764
  evidenceState?: _ocap_types0.IEvidenceState | null;
748
765
  newValidator?: _ocap_types0.IRollupValidator;
749
766
  validatorsHash?: string;
750
767
  }>;
751
- leaveRollup: _ocap_tx_pipeline0.Runner<_ocap_types0.IReadyContext<_ocap_types0.TLeaveRollupTx> & _ocap_types0.IWithRollup & _ocap_types0.IWithSender & _ocap_types0.IWithSigners & _ocap_types0.IWithStake & {
768
+ leaveRollup: _ocap_tx_pipeline0.Runner<_ocap_types0.IReadyContext<_ocap_types0.TLeaveRollupTx> & _ocap_types0.IWithRollup & _ocap_types0.IWithSender & _ocap_types0.IWithSigners & _ocap_types0.IWithStake & BridgeCtxMixin & {
752
769
  validatorsHash?: string;
753
770
  evidenceState?: _ocap_types0.IEvidenceState | null;
754
771
  }>;
755
- pauseRollup: _ocap_tx_pipeline0.Runner<_ocap_types0.IReadyContext<_ocap_types0.TPauseRollupTx> & _ocap_types0.IWithRollup & _ocap_types0.IWithSender & _ocap_types0.IWithSigners>;
756
- closeRollup: _ocap_tx_pipeline0.Runner<_ocap_types0.IReadyContext<_ocap_types0.TCloseRollupTx> & _ocap_types0.IWithRollup & _ocap_types0.IWithSender & _ocap_types0.IWithSigners & {
772
+ pauseRollup: _ocap_tx_pipeline0.Runner<_ocap_types0.IReadyContext<_ocap_types0.TPauseRollupTx> & _ocap_types0.IWithRollup & _ocap_types0.IWithSender & _ocap_types0.IWithSigners & BridgeCtxMixin & {
773
+ pauseKind?: "quorum" | "lone";
774
+ }>;
775
+ closeRollup: _ocap_tx_pipeline0.Runner<_ocap_types0.IReadyContext<_ocap_types0.TCloseRollupTx> & _ocap_types0.IWithRollup & _ocap_types0.IWithSender & _ocap_types0.IWithSigners & BridgeCtxMixin & {
757
776
  stakeAddresses?: string[];
758
777
  stakeStates?: _ocap_types0.IStakeState[];
759
778
  }>;
760
- resumeRollup: _ocap_tx_pipeline0.Runner<_ocap_types0.IReadyContext<_ocap_types0.TResumeRollupTx> & _ocap_types0.IWithRollup & _ocap_types0.IWithSender & _ocap_types0.IWithSigners>;
779
+ resumeRollup: _ocap_tx_pipeline0.Runner<_ocap_types0.IReadyContext<_ocap_types0.TResumeRollupTx> & _ocap_types0.IWithRollup & _ocap_types0.IWithSender & _ocap_types0.IWithSigners & BridgeCtxMixin>;
761
780
  createRollupBlock: _ocap_tx_pipeline0.Runner<_ocap_types0.IReadyContext<_ocap_types0.TCreateRollupBlockTx> & _ocap_types0.IWithRollup & _ocap_types0.IWithSender & _ocap_types0.IWithSigners & _ocap_types0.IWithStakes & {
762
781
  formattedItx?: Record<string, unknown>;
763
782
  previousBlock?: _ocap_types0.IRollupBlock | null;
@@ -806,8 +825,8 @@ declare const defaultExecutor: {
806
825
  missingAccountStates?: _ocap_types0.IAccountState[];
807
826
  stakeStates?: _ocap_types0.IStakeState[];
808
827
  }>;
809
- migrateRollup: _ocap_tx_pipeline0.Runner<_ocap_types0.IReadyContext<_ocap_types0.TMigrateRollupTx> & _ocap_types0.IWithRollup & _ocap_types0.IWithSender & _ocap_types0.IWithSigners>;
828
+ migrateRollup: _ocap_tx_pipeline0.Runner<_ocap_types0.IReadyContext<_ocap_types0.TMigrateRollupTx> & _ocap_types0.IWithRollup & _ocap_types0.IWithSender & _ocap_types0.IWithSigners & BridgeCtxMixin>;
810
829
  };
811
830
  declare const execute: (context: unknown, done?: (err: Error | null, res?: unknown) => void) => any;
812
831
  //#endregion
813
- export { COUNTER_NAMES, type CounterName, DEFAULT_BASE_BURST_ALLOWANCE, DEFAULT_BURST_REJECT_MULTIPLE, DEFAULT_BURST_WINDOW_MS, DEFAULT_FISHERMAN_BOUNTY_BPS, DEFAULT_GAS_PASS_EPOCH_SECONDS, DEFAULT_MAX_FREE_GAS_STATE_OPS, DEFAULT_MAX_FREE_GAS_TX_SIZE, DEFAULT_SLASH_STRIKE_THRESHOLD, DEFAULT_STRIKE_WINDOW_MS, DEFAULT_THROTTLE_COOLDOWN_MS, DEFAULT_THROTTLE_STRIKE_THRESHOLD, DEFAULT_WARNING_STRIKE_THRESHOLD, DIRECT_GAS_REQUIRED_TX_TYPES, FREE_GAS_ELIGIBLE_TX_TYPES, type IAbuseSlashEvidence, type IGasSecurityConfig, type IPaymasterDecodedClaims, type IStakeForGasEligibilityResult, type ITxGasQuotaTelemetry, type ITxSecurityWarning, type IUnlinkableGasPass, MAX_POST_EXECUTION_WRITE_SET_ENTRIES, MAX_PREFLIGHT_JSON_DEPTH, MAX_PREFLIGHT_JSON_KEYS, PREFLIGHT_VERIFIED_SNAPSHOT_SYMBOL, PostExecutionInvariantGate, PreFlightWaf, type QueueState, STAGE_LABELS, type SecurityStrikeTier, type StageLabel, type StrikeReasonCategory, TRACKED_STATE_TABLES, type TxMeta, type TxStatus, TxTimer, type TxTimerSummaryV2, UNSIGNED_TX_EVIDENCE_DATA_PREFIX, WriteLedger, assertKnownItxFields, assertRawWireEnvelope, assertTxAdmission, classifyErrorStrikeCategory, computeActorTier, computeUnlinkableGasPassCommitment, computeUnlinkableGasPassSecretHash, createExecutor, defaultExecutor as default, evaluateBurstQuota, evaluateStakeForGasEligibility, execute, executeAutoGasStakeSlash, extractTransactionTargets, getActorSecurityStatus, getGasSecurityRegistry, getTxSecurityWarningByHash, inspectPostExecutionInvariants, inspectTransactionPreFlight, installStateWriteInterceptor, normalizeActorAddress, normalizeEntityKey, normalizeShortTxType, recordActorSecurityStrike, resetGasSecurityState, resolveGasSecurityConfig, resolveVerifiedStrikeActors, rollbackTrackedStateWrites, scanItxPayloadAnomalies, setTxSecurityWarningForHash, toUnsignedEvidenceKey, tryApplyPreFlightVerifiedSnapshot, verifyAndConsumeUnlinkableGasPass, verifyPaymasterConstraints };
832
+ export { COUNTER_NAMES, type CounterName, DEFAULT_BASE_BURST_ALLOWANCE, DEFAULT_BURST_REJECT_MULTIPLE, DEFAULT_BURST_WINDOW_MS, DEFAULT_FISHERMAN_BOUNTY_BPS, DEFAULT_GAS_PASS_EPOCH_SECONDS, DEFAULT_MAX_FREE_GAS_STATE_OPS, DEFAULT_MAX_FREE_GAS_TX_SIZE, DEFAULT_SLASH_STRIKE_THRESHOLD, DEFAULT_STRIKE_WINDOW_MS, DEFAULT_THROTTLE_COOLDOWN_MS, DEFAULT_THROTTLE_STRIKE_THRESHOLD, DEFAULT_WARNING_STRIKE_THRESHOLD, DIRECT_GAS_REQUIRED_TX_TYPES, FREE_GAS_ELIGIBLE_TX_TYPES, type IAbuseSlashEvidence, type IGasSecurityConfig, type IPaymasterDecodedClaims, type IStakeForGasEligibilityResult, type ITxGasQuotaTelemetry, type ITxSecurityWarning, type IUnlinkableGasPass, MAX_POST_EXECUTION_WRITE_SET_ENTRIES, MAX_PREFLIGHT_JSON_DEPTH, MAX_PREFLIGHT_JSON_KEYS, PREFLIGHT_VERIFIED_SNAPSHOT_SYMBOL, PostExecutionInvariantGate, PreFlightWaf, type QueueState, STAGE_LABELS, type SecurityStrikeTier, type StageLabel, type StrikeReasonCategory, TRACKED_STATE_TABLES, type TxMeta, type TxStatus, TxTimer, type TxTimerSummaryV2, UNSIGNED_TX_EVIDENCE_DATA_PREFIX, WriteLedger, assertKnownItxFields, assertRawWireEnvelope, assertStatelessTxRules, assertTxAdmission, classifyErrorStrikeCategory, computeActorTier, computeUnlinkableGasPassCommitment, computeUnlinkableGasPassSecretHash, createExecutor, defaultExecutor as default, evaluateBurstQuota, evaluateStakeForGasEligibility, execute, executeAutoGasStakeSlash, extractTransactionTargets, getActorSecurityStatus, getGasSecurityRegistry, getStatelessPrefixLength, getTxSecurityWarningByHash, inspectPostExecutionInvariants, inspectTransactionPreFlight, installStateWriteInterceptor, markStatelessPrefix, normalizeActorAddress, normalizeEntityKey, normalizeShortTxType, recordActorSecurityStrike, resetGasSecurityState, resolveGasSecurityConfig, resolveVerifiedStrikeActors, rollbackTrackedStateWrites, scanItxPayloadAnomalies, setTxSecurityWarningForHash, toUnsignedEvidenceKey, tryApplyPreFlightVerifiedSnapshot, verifyAndConsumeUnlinkableGasPass, verifyPaymasterConstraints };
package/esm/index.mjs CHANGED
@@ -1,5 +1,6 @@
1
1
  import { DEFAULT_BASE_BURST_ALLOWANCE, DEFAULT_BURST_REJECT_MULTIPLE, DEFAULT_BURST_WINDOW_MS, DEFAULT_FISHERMAN_BOUNTY_BPS, DEFAULT_GAS_PASS_EPOCH_SECONDS, DEFAULT_MAX_FREE_GAS_STATE_OPS, DEFAULT_MAX_FREE_GAS_TX_SIZE, DEFAULT_SLASH_STRIKE_THRESHOLD, DEFAULT_STRIKE_WINDOW_MS, DEFAULT_THROTTLE_COOLDOWN_MS, DEFAULT_THROTTLE_STRIKE_THRESHOLD, DEFAULT_WARNING_STRIKE_THRESHOLD, DIRECT_GAS_REQUIRED_TX_TYPES, FREE_GAS_ELIGIBLE_TX_TYPES, assertTxAdmission, classifyErrorStrikeCategory, computeActorTier, computeUnlinkableGasPassCommitment, computeUnlinkableGasPassSecretHash, evaluateBurstQuota, evaluateStakeForGasEligibility, executeAutoGasStakeSlash, extractTransactionTargets, getActorSecurityStatus, getGasSecurityRegistry, getTxSecurityWarningByHash, normalizeActorAddress, normalizeShortTxType, recordActorSecurityStrike, resetGasSecurityState, resolveGasSecurityConfig, resolveVerifiedStrikeActors, setTxSecurityWarningForHash, verifyAndConsumeUnlinkableGasPass, verifyPaymasterConstraints } from "./gas-security-guard.mjs";
2
2
  import { WriteLedger } from "./pipes/write-ledger.mjs";
3
+ import { assertStatelessTxRules, getStatelessPrefixLength, markStatelessPrefix, setDefaultStatelessProtocols } from "./stateless-prefix.mjs";
3
4
  import { COUNTER_NAMES, STAGE_LABELS, TxTimer } from "./tx-timer.mjs";
4
5
  import execute_default, { PREFLIGHT_VERIFIED_SNAPSHOT_SYMBOL, UNSIGNED_TX_EVIDENCE_DATA_PREFIX, toUnsignedEvidenceKey, tryApplyPreFlightVerifiedSnapshot } from "./execute.mjs";
5
6
  import delegate_default from "./protocols/account/delegate.mjs";
@@ -11,6 +12,7 @@ import consume_default from "./protocols/asset/consume.mjs";
11
12
  import create_default from "./protocols/asset/create.mjs";
12
13
  import mint_default from "./protocols/asset/mint.mjs";
13
14
  import update_default from "./protocols/asset/update.mjs";
15
+ import release_default from "./protocols/bridge/release.mjs";
14
16
  import create_default$1 from "./protocols/factory/create.mjs";
15
17
  import claim_stake_default from "./protocols/governance/claim-stake.mjs";
16
18
  import return_stake_default from "./protocols/governance/return-stake.mjs";
@@ -37,8 +39,8 @@ import withdraw_v2_default from "./protocols/token/withdraw-v2.mjs";
37
39
  import exchange_v2_default from "./protocols/trade/exchange-v2.mjs";
38
40
  import transfer_v2_default from "./protocols/trade/transfer-v2.mjs";
39
41
  import transfer_v3_default from "./protocols/trade/transfer-v3.mjs";
40
- import * as states from "@ocap/state";
41
42
  import { MAX_POST_EXECUTION_WRITE_SET_ENTRIES, MAX_PREFLIGHT_JSON_DEPTH, MAX_PREFLIGHT_JSON_KEYS, PostExecutionInvariantGate, PreFlightWaf, TRACKED_STATE_TABLES, assertKnownItxFields, assertRawWireEnvelope, inspectPostExecutionInvariants, inspectTransactionPreFlight, installStateWriteInterceptor, normalizeEntityKey, rollbackTrackedStateWrites, scanItxPayloadAnomalies } from "@ocap/tx-pipeline";
43
+ import * as states from "@ocap/state";
42
44
 
43
45
  //#region src/index.ts
44
46
  const createExecutor = ({ filter, runAsLambda }) => {
@@ -64,6 +66,7 @@ const createExecutor = ({ filter, runAsLambda }) => {
64
66
  updateTokenFactory: update_default$2,
65
67
  mintToken: mint_default$1,
66
68
  burnToken: burn_default,
69
+ releaseBridgeToken: release_default,
67
70
  stake: stake_default,
68
71
  revokeStake: revoke_stake_default,
69
72
  claimStake: claim_stake_default,
@@ -80,6 +83,7 @@ const createExecutor = ({ filter, runAsLambda }) => {
80
83
  claimBlockReward: claim_reward_default,
81
84
  migrateRollup: migrate_default$1
82
85
  };
86
+ setDefaultStatelessProtocols(protocols);
83
87
  const execute$1 = execute_default({
84
88
  filter,
85
89
  runAsLambda
@@ -101,4 +105,4 @@ const { execute } = defaultExecutor;
101
105
  var src_default = defaultExecutor;
102
106
 
103
107
  //#endregion
104
- export { COUNTER_NAMES, DEFAULT_BASE_BURST_ALLOWANCE, DEFAULT_BURST_REJECT_MULTIPLE, DEFAULT_BURST_WINDOW_MS, DEFAULT_FISHERMAN_BOUNTY_BPS, DEFAULT_GAS_PASS_EPOCH_SECONDS, DEFAULT_MAX_FREE_GAS_STATE_OPS, DEFAULT_MAX_FREE_GAS_TX_SIZE, DEFAULT_SLASH_STRIKE_THRESHOLD, DEFAULT_STRIKE_WINDOW_MS, DEFAULT_THROTTLE_COOLDOWN_MS, DEFAULT_THROTTLE_STRIKE_THRESHOLD, DEFAULT_WARNING_STRIKE_THRESHOLD, DIRECT_GAS_REQUIRED_TX_TYPES, FREE_GAS_ELIGIBLE_TX_TYPES, MAX_POST_EXECUTION_WRITE_SET_ENTRIES, MAX_PREFLIGHT_JSON_DEPTH, MAX_PREFLIGHT_JSON_KEYS, PREFLIGHT_VERIFIED_SNAPSHOT_SYMBOL, PostExecutionInvariantGate, PreFlightWaf, STAGE_LABELS, TRACKED_STATE_TABLES, TxTimer, UNSIGNED_TX_EVIDENCE_DATA_PREFIX, WriteLedger, assertKnownItxFields, assertRawWireEnvelope, assertTxAdmission, classifyErrorStrikeCategory, computeActorTier, computeUnlinkableGasPassCommitment, computeUnlinkableGasPassSecretHash, createExecutor, src_default as default, evaluateBurstQuota, evaluateStakeForGasEligibility, execute, executeAutoGasStakeSlash, extractTransactionTargets, getActorSecurityStatus, getGasSecurityRegistry, getTxSecurityWarningByHash, inspectPostExecutionInvariants, inspectTransactionPreFlight, installStateWriteInterceptor, normalizeActorAddress, normalizeEntityKey, normalizeShortTxType, recordActorSecurityStrike, resetGasSecurityState, resolveGasSecurityConfig, resolveVerifiedStrikeActors, rollbackTrackedStateWrites, scanItxPayloadAnomalies, setTxSecurityWarningForHash, toUnsignedEvidenceKey, tryApplyPreFlightVerifiedSnapshot, verifyAndConsumeUnlinkableGasPass, verifyPaymasterConstraints };
108
+ export { COUNTER_NAMES, DEFAULT_BASE_BURST_ALLOWANCE, DEFAULT_BURST_REJECT_MULTIPLE, DEFAULT_BURST_WINDOW_MS, DEFAULT_FISHERMAN_BOUNTY_BPS, DEFAULT_GAS_PASS_EPOCH_SECONDS, DEFAULT_MAX_FREE_GAS_STATE_OPS, DEFAULT_MAX_FREE_GAS_TX_SIZE, DEFAULT_SLASH_STRIKE_THRESHOLD, DEFAULT_STRIKE_WINDOW_MS, DEFAULT_THROTTLE_COOLDOWN_MS, DEFAULT_THROTTLE_STRIKE_THRESHOLD, DEFAULT_WARNING_STRIKE_THRESHOLD, DIRECT_GAS_REQUIRED_TX_TYPES, FREE_GAS_ELIGIBLE_TX_TYPES, MAX_POST_EXECUTION_WRITE_SET_ENTRIES, MAX_PREFLIGHT_JSON_DEPTH, MAX_PREFLIGHT_JSON_KEYS, PREFLIGHT_VERIFIED_SNAPSHOT_SYMBOL, PostExecutionInvariantGate, PreFlightWaf, STAGE_LABELS, TRACKED_STATE_TABLES, TxTimer, UNSIGNED_TX_EVIDENCE_DATA_PREFIX, WriteLedger, assertKnownItxFields, assertRawWireEnvelope, assertStatelessTxRules, assertTxAdmission, classifyErrorStrikeCategory, computeActorTier, computeUnlinkableGasPassCommitment, computeUnlinkableGasPassSecretHash, createExecutor, src_default as default, evaluateBurstQuota, evaluateStakeForGasEligibility, execute, executeAutoGasStakeSlash, extractTransactionTargets, getActorSecurityStatus, getGasSecurityRegistry, getStatelessPrefixLength, getTxSecurityWarningByHash, inspectPostExecutionInvariants, inspectTransactionPreFlight, installStateWriteInterceptor, markStatelessPrefix, normalizeActorAddress, normalizeEntityKey, normalizeShortTxType, recordActorSecurityStrike, resetGasSecurityState, resolveGasSecurityConfig, resolveVerifiedStrikeActors, rollbackTrackedStateWrites, scanItxPayloadAnomalies, setTxSecurityWarningForHash, toUnsignedEvidenceKey, tryApplyPreFlightVerifiedSnapshot, verifyAndConsumeUnlinkableGasPass, verifyPaymasterConstraints };
@@ -1,11 +1,12 @@
1
+ import { assertBridgeReserveNotSponsor } from "../bridge-reserve.mjs";
1
2
  import { evaluateStakeForGasEligibility, extractTransactionTargets, getActorSecurityStatus, resolveGasSecurityConfig, setTxSecurityWarningForHash, verifyAndConsumeUnlinkableGasPass, verifyPaymasterConstraints } from "../gas-security-guard.mjs";
2
3
  import { applyTokenUpdates, isGasStakeValid } from "../util.mjs";
4
+ import { CustomError } from "@ocap/util/lib/error";
3
5
  import { isFromPublicKey, toAddress } from "@arcblock/did";
4
6
  import { toStakeAddress } from "@arcblock/did-util";
5
7
  import * as JWT from "@arcblock/jwt";
6
8
  import { account } from "@ocap/state";
7
9
  import { BN, fromTokenToUnit, fromUnitToToken, hexToNumber, isSameDid, toBase58, toBase64, toBuffer } from "@ocap/util";
8
- import { CustomError } from "@ocap/util/lib/error";
9
10
  import { getRelatedAddresses } from "@ocap/util/lib/get-related-addr";
10
11
  import noop from "lodash/noop.js";
11
12
  import Debug from "debug";
@@ -112,6 +113,11 @@ function isMatchingAccountPublicKey(onChainPk, headerPk) {
112
113
  hdrErr._unauthenticatedExtraFailure = true;
113
114
  return next(hdrErr);
114
115
  }
116
+ try {
117
+ assertBridgeReserveNotSponsor(sponsorAddress);
118
+ } catch (err) {
119
+ return next(err);
120
+ }
115
121
  if (await JWT.verify(token$1, pk, {
116
122
  enforceTimestamp: !txTime,
117
123
  tolerance: 5
@@ -68,8 +68,8 @@ declare const LEDGER_ERRORS: {
68
68
  * ```typescript
69
69
  * import { WriteLedger } from '@ocap/tx-protocols/pipes/write-ledger';
70
70
  *
71
- * // In pipeline setup (after VerifySignature):
72
- * runner.use(WriteLedger);
71
+ * // After the protocol runner, right before the tx state is written:
72
+ * await runSinglePipe(WriteLedger, context);
73
73
  * ```
74
74
  */
75
75
  declare const WriteLedger: PipeFunction<IWriteLedgerContext>;
@@ -6,7 +6,10 @@ import { formatMessage } from "@ocap/message";
6
6
  * WriteLedger Pipe
7
7
  *
8
8
  * Writes verified transactions to the Ledger append-only log.
9
- * Must be placed AFTER VerifySignature to ensure only authenticated txs are recorded.
9
+ * Must run AFTER VerifySignature to ensure only authenticated txs are recorded, and (#1419) only at the point
10
+ * where the tx state is written: after the protocol accepted the tx, or after a failed tx was charged
11
+ * failed-tx gas. It still runs before `statedb.tx.create` and the statedb commit. See `appendLedgerEntry` in
12
+ * `execute.ts`.
10
13
  *
11
14
  * The ledger provides:
12
15
  * - Append-only immutable transaction log
@@ -32,8 +35,8 @@ const LEDGER_ERRORS = {
32
35
  * ```typescript
33
36
  * import { WriteLedger } from '@ocap/tx-protocols/pipes/write-ledger';
34
37
  *
35
- * // In pipeline setup (after VerifySignature):
36
- * runner.use(WriteLedger);
38
+ * // After the protocol runner, right before the tx state is written:
39
+ * await runSinglePipe(WriteLedger, context);
37
40
  * ```
38
41
  */
39
42
  const WriteLedger = async (context, next) => {
@@ -1,13 +1,14 @@
1
1
  import ensure_cost_default from "../../pipes/ensure-cost.mjs";
2
2
  import ensure_gas_default from "../../pipes/ensure-gas.mjs";
3
- import { toTypeInfo } from "@arcblock/did";
4
- import { toDelegateAddress } from "@arcblock/did-util";
3
+ import { markStatelessPrefix } from "../../stateless-prefix.mjs";
5
4
  import { types } from "@ocap/mcrypto";
6
- import { account, delegation } from "@ocap/state";
7
5
  import { Runner, pipes } from "@ocap/tx-pipeline";
8
- import { isSameDid, scopeMatchAny } from "@ocap/util";
9
6
  import { CustomError } from "@ocap/util/lib/error";
10
7
  import { getListField } from "@ocap/util/lib/get-list-field";
8
+ import { toTypeInfo } from "@arcblock/did";
9
+ import { toDelegateAddress } from "@arcblock/did-util";
10
+ import { account, delegation } from "@ocap/state";
11
+ import { isSameDid, scopeMatchAny } from "@ocap/util";
11
12
  import cloneDeep from "lodash/cloneDeep.js";
12
13
  import get from "lodash/get.js";
13
14
  import pick from "lodash/pick.js";
@@ -116,6 +117,7 @@ runner.use(pipes.VerifyInfo([{
116
117
  return (context.formattedItx?.ops || []).every((op) => scopeMatchAny(op.typeUrl, allowed));
117
118
  }
118
119
  }]));
120
+ markStatelessPrefix(runner);
119
121
  runner.use(pipes.ExtractState({
120
122
  from: "tx.from",
121
123
  to: "senderState",
@@ -1,13 +1,14 @@
1
1
  import { decodeAnySafe } from "../../util.mjs";
2
2
  import ensure_cost_default from "../../pipes/ensure-cost.mjs";
3
3
  import ensure_gas_default from "../../pipes/ensure-gas.mjs";
4
- import { MAX_ROTATION_CHAIN_LENGTH, createPreRotationCommitment, extractAccountPreRotationData, fromPublicKey, isSameEntity, isValidPreRotationCommitment, normalizePreRotationCommitment, normalizePublicKeyHex, toTypeInfo, verifyPreRotationCommitment, verifySingleKeyRotationEvent } from "@arcblock/did";
4
+ import { markStatelessPrefix } from "../../stateless-prefix.mjs";
5
5
  import { types } from "@ocap/mcrypto";
6
- import { account } from "@ocap/state";
7
6
  import { Runner, pipes } from "@ocap/tx-pipeline";
8
- import { toBN } from "@ocap/util";
9
7
  import { CustomError } from "@ocap/util/lib/error";
10
8
  import { getListField } from "@ocap/util/lib/get-list-field";
9
+ import { MAX_ROTATION_CHAIN_LENGTH, createPreRotationCommitment, extractAccountPreRotationData, fromPublicKey, isSameEntity, isValidPreRotationCommitment, normalizePreRotationCommitment, normalizePublicKeyHex, toTypeInfo, verifyPreRotationCommitment, verifySingleKeyRotationEvent } from "@arcblock/did";
10
+ import { account } from "@ocap/state";
11
+ import { toBN } from "@ocap/util";
11
12
  import { getRelatedAddresses } from "@ocap/util/lib/get-related-addr";
12
13
  import Debug from "debug";
13
14
  import { v, vDID, vStripUnknown, vValidate } from "@arcblock/validator";
@@ -66,6 +67,7 @@ runner.use(pipes.VerifyInfo([{
66
67
  return isSameEntity(fromPublicKey(typeof context.itx.pk === "string" ? `0x${pkHex}` : context.itx.pk, toTypeInfo(context.itx.address)), context.itx.address) && !isSameEntity(context.itx.address, context.tx.from);
67
68
  }
68
69
  }]));
70
+ markStatelessPrefix(runner);
69
71
  runner.use(pipes.ExtractState({
70
72
  from: "tx.from",
71
73
  to: "senderState",
@@ -1,11 +1,12 @@
1
1
  import ensure_cost_default from "../../pipes/ensure-cost.mjs";
2
2
  import ensure_gas_default from "../../pipes/ensure-gas.mjs";
3
- import { toDelegateAddress } from "@arcblock/did-util";
4
- import { account, delegation } from "@ocap/state";
3
+ import { markStatelessPrefix } from "../../stateless-prefix.mjs";
5
4
  import { Runner, pipes } from "@ocap/tx-pipeline";
6
- import { scopeMatch, scopeMatchAny } from "@ocap/util";
7
5
  import { CustomError } from "@ocap/util/lib/error";
8
6
  import { getListField } from "@ocap/util/lib/get-list-field";
7
+ import { toDelegateAddress } from "@arcblock/did-util";
8
+ import { account, delegation } from "@ocap/state";
9
+ import { scopeMatch, scopeMatchAny } from "@ocap/util";
9
10
  import { getRelatedAddresses } from "@ocap/util/lib/get-related-addr";
10
11
  import cloneDeep from "lodash/cloneDeep.js";
11
12
  import get from "lodash/get.js";
@@ -35,6 +36,7 @@ runner.use((context, next) => {
35
36
  if (error) return next(new CustomError("INVALID_TX", `Invalid itx: ${error.message}`));
36
37
  return next();
37
38
  });
39
+ markStatelessPrefix(runner);
38
40
  runner.use(pipes.ExtractState({
39
41
  from: "itx.to",
40
42
  to: "receiverState",
@@ -1,16 +1,17 @@
1
1
  import { applyTokenChange, applyTokenUpdates } from "../../util.mjs";
2
2
  import ensure_cost_default from "../../pipes/ensure-cost.mjs";
3
3
  import ensure_gas_default from "../../pipes/ensure-gas.mjs";
4
+ import { markStatelessPrefix } from "../../stateless-prefix.mjs";
4
5
  import exec_mint_hook_default, { getMintTokenPayLegs, verifyMintHook } from "./pipes/exec-mint-hook.mjs";
5
6
  import extract_factory_tokens_default from "./pipes/extract-factory-tokens.mjs";
6
7
  import verify_itx_address_default from "./pipes/verify-itx-address.mjs";
7
8
  import verify_itx_assets_default from "./pipes/verify-itx-assets.mjs";
8
9
  import verify_itx_variables_default from "./pipes/verify-itx-variables.mjs";
9
10
  import verify_mint_limit_default from "./pipes/verify-mint-limit.mjs";
10
- import { account, asset, delegation, factory } from "@ocap/state";
11
11
  import { Runner, pipes, verifyAssetHierarchy } from "@ocap/tx-pipeline";
12
12
  import { CustomError } from "@ocap/util/lib/error";
13
13
  import { getListField } from "@ocap/util/lib/get-list-field";
14
+ import { account, asset, delegation, factory } from "@ocap/state";
14
15
  import { getRelatedAddresses } from "@ocap/util/lib/get-related-addr";
15
16
  import Debug from "debug";
16
17
  import { schemas, v, vDID, vStripUnknown, vValidate } from "@arcblock/validator";
@@ -46,6 +47,7 @@ runner.use(({ itx }, next) => {
46
47
  if (error) return next(new CustomError("INVALID_TX", `Invalid itx: ${error.message}`));
47
48
  return next();
48
49
  });
50
+ markStatelessPrefix(runner);
49
51
  runner.use(pipes.ExtractState({
50
52
  from: "itx.address",
51
53
  to: "duplicateAsset",
@@ -1,17 +1,18 @@
1
1
  import { applyTokenChange, applyTokenUpdates, getDelegationRequirements } from "../../util.mjs";
2
2
  import ensure_cost_default from "../../pipes/ensure-cost.mjs";
3
3
  import ensure_gas_default from "../../pipes/ensure-gas.mjs";
4
+ import { markStatelessPrefix } from "../../stateless-prefix.mjs";
4
5
  import exec_mint_hook_default, { getMintTokenPayLegs, verifyMintHook } from "./pipes/exec-mint-hook.mjs";
5
6
  import extract_factory_tokens_default from "./pipes/extract-factory-tokens.mjs";
6
7
  import verify_itx_address_default from "./pipes/verify-itx-address.mjs";
7
8
  import verify_itx_assets_default from "./pipes/verify-itx-assets.mjs";
8
9
  import verify_itx_variables_default from "./pipes/verify-itx-variables.mjs";
9
10
  import verify_mint_limit_default from "./pipes/verify-mint-limit.mjs";
10
- import { account, asset, delegation, factory } from "@ocap/state";
11
11
  import { Runner, pipes, verifyAssetHierarchy } from "@ocap/tx-pipeline";
12
- import { BN, isSameDid } from "@ocap/util";
13
12
  import { CustomError } from "@ocap/util/lib/error";
14
13
  import { getListField } from "@ocap/util/lib/get-list-field";
14
+ import { account, asset, delegation, factory } from "@ocap/state";
15
+ import { BN, isSameDid } from "@ocap/util";
15
16
  import { getRelatedAddresses } from "@ocap/util/lib/get-related-addr";
16
17
  import Debug from "debug";
17
18
  import { schemas, v, vDID, vStripUnknown, vValidate } from "@arcblock/validator";
@@ -46,6 +47,7 @@ runner.use(({ itx }, next) => {
46
47
  if (error) return next(new CustomError("INVALID_TX", `Invalid itx: ${error.message}`));
47
48
  return next();
48
49
  });
50
+ markStatelessPrefix(runner);
49
51
  runner.use(pipes.ExtractState({
50
52
  from: "itx.address",
51
53
  to: "duplicateAsset",
@@ -1,8 +1,9 @@
1
1
  import ensure_cost_default from "../../pipes/ensure-cost.mjs";
2
2
  import ensure_gas_default from "../../pipes/ensure-gas.mjs";
3
- import { account, asset, token } from "@ocap/state";
3
+ import { markStatelessPrefix } from "../../stateless-prefix.mjs";
4
4
  import { Runner, pipes } from "@ocap/tx-pipeline";
5
5
  import { CustomError } from "@ocap/util/lib/error";
6
+ import { account, asset, token } from "@ocap/state";
6
7
  import Debug from "debug";
7
8
  import { v, vDID, vStripUnknown, vValidate } from "@arcblock/validator";
8
9
 
@@ -22,6 +23,7 @@ runner.use((context, next) => {
22
23
  if (error) return next(new CustomError("INVALID_TX", `Invalid itx: ${error.message}`));
23
24
  return next();
24
25
  });
26
+ markStatelessPrefix(runner);
25
27
  runner.use(pipes.ExtractState({
26
28
  from: "itx.address",
27
29
  to: "assetState",
@@ -1,11 +1,12 @@
1
1
  import { decodeAnySafe, getDelegationRequirements } from "../../util.mjs";
2
2
  import ensure_cost_default from "../../pipes/ensure-cost.mjs";
3
3
  import ensure_gas_default from "../../pipes/ensure-gas.mjs";
4
- import { toAssetAddress } from "@arcblock/did-util";
5
- import { account, asset, delegation } from "@ocap/state";
4
+ import { markStatelessPrefix } from "../../stateless-prefix.mjs";
6
5
  import { Runner, pipes } from "@ocap/tx-pipeline";
7
6
  import { CustomError } from "@ocap/util/lib/error";
8
7
  import { getListField } from "@ocap/util/lib/get-list-field";
8
+ import { toAssetAddress } from "@arcblock/did-util";
9
+ import { account, asset, delegation } from "@ocap/state";
9
10
  import cloneDeep from "lodash/cloneDeep.js";
10
11
  import Debug from "debug";
11
12
  import { formatMessage } from "@ocap/message";
@@ -34,6 +35,7 @@ runner.use(pipes.VerifyInfo([{
34
35
  return toAssetAddress(itx, context.txEncoding) === context.itx.address;
35
36
  }
36
37
  }]));
38
+ markStatelessPrefix(runner);
37
39
  runner.use(pipes.VerifyMultiSigV2({ signersKey: "signers" }));
38
40
  runner.use(pipes.ExtractState({
39
41
  from: "itx.address",
@@ -1,13 +1,14 @@
1
1
  import ensure_cost_default from "../../pipes/ensure-cost.mjs";
2
2
  import ensure_gas_default from "../../pipes/ensure-gas.mjs";
3
+ import { markStatelessPrefix } from "../../stateless-prefix.mjs";
3
4
  import verify_itx_address_default from "./pipes/verify-itx-address.mjs";
4
5
  import verify_itx_assets_default from "./pipes/verify-itx-assets.mjs";
5
6
  import verify_itx_variables_default from "./pipes/verify-itx-variables.mjs";
6
7
  import verify_mint_limit_default from "./pipes/verify-mint-limit.mjs";
7
- import { account, asset, factory } from "@ocap/state";
8
8
  import { Runner, pipes, verifyAssetHierarchy } from "@ocap/tx-pipeline";
9
- import { isSameDid } from "@ocap/util";
10
9
  import { CustomError } from "@ocap/util/lib/error";
10
+ import { account, asset, factory } from "@ocap/state";
11
+ import { isSameDid } from "@ocap/util";
11
12
  import { getRelatedAddresses } from "@ocap/util/lib/get-related-addr";
12
13
  import Debug from "debug";
13
14
  import { schemas, v, vDID, vStripUnknown, vValidate } from "@arcblock/validator";
@@ -38,6 +39,7 @@ runner.use(({ itx }, next) => {
38
39
  if (error) return next(new CustomError("INVALID_TX", `Invalid itx: ${error.message}`));
39
40
  return next();
40
41
  });
42
+ markStatelessPrefix(runner);
41
43
  runner.use(pipes.ExtractState({
42
44
  from: "itx.address",
43
45
  to: "duplicateAsset",
@@ -1,7 +1,7 @@
1
1
  import transfer_default from "../calls/transfer.mjs";
2
2
  import transfer_token_default from "../calls/transfer-token.mjs";
3
- import { BN } from "@ocap/util";
4
3
  import { CustomError } from "@ocap/util/lib/error";
4
+ import { BN } from "@ocap/util";
5
5
  import cloneDeep from "lodash/cloneDeep.js";
6
6
 
7
7
  //#region src/protocols/asset/pipes/exec-mint-hook.ts
@@ -1,5 +1,5 @@
1
- import { isFromPublicKey, normalizePublicKeyHex } from "@arcblock/did";
2
1
  import { CustomError } from "@ocap/util/lib/error";
2
+ import { isFromPublicKey, normalizePublicKeyHex } from "@arcblock/did";
3
3
  import Debug from "debug";
4
4
  import { mintFromFactory } from "@ocap/asset";
5
5
 
@@ -1,6 +1,6 @@
1
- import { token } from "@ocap/state";
2
1
  import { CustomError } from "@ocap/util/lib/error";
3
2
  import { getListField } from "@ocap/util/lib/get-list-field";
3
+ import { token } from "@ocap/state";
4
4
 
5
5
  //#region src/protocols/asset/pipes/verify-itx-assets.ts
6
6
  const verify_itx_assets = (context, next) => {
@@ -1,12 +1,13 @@
1
1
  import { decodeAnySafe, getDelegationRequirements } from "../../util.mjs";
2
2
  import ensure_cost_default from "../../pipes/ensure-cost.mjs";
3
3
  import ensure_gas_default from "../../pipes/ensure-gas.mjs";
4
+ import { markStatelessPrefix } from "../../stateless-prefix.mjs";
4
5
  import verify_ownership_default from "../token-factory/pipes/verify-ownership.mjs";
5
6
  import verify_url_default from "../token-factory/pipes/verify-url.mjs";
6
- import { account, asset, delegation, token } from "@ocap/state";
7
7
  import { Runner, pipes } from "@ocap/tx-pipeline";
8
- import { isSameDid } from "@ocap/util";
9
8
  import { CustomError } from "@ocap/util/lib/error";
9
+ import { account, asset, delegation, token } from "@ocap/state";
10
+ import { isSameDid } from "@ocap/util";
10
11
  import { getRelatedAddresses } from "@ocap/util/lib/get-related-addr";
11
12
  import Debug from "debug";
12
13
  import { v, vDID, vStripUnknown, vValidate } from "@arcblock/validator";
@@ -34,6 +35,7 @@ runner.use((context, next) => {
34
35
  context.newData = decodeAnySafe(itx.data ?? null);
35
36
  return next();
36
37
  });
38
+ markStatelessPrefix(runner);
37
39
  runner.use(pipes.ExtractState({
38
40
  from: "itx.address",
39
41
  to: "assetState",
@@ -0,0 +1,34 @@
1
+ import { ReleaseResolution, Runner } from "@ocap/tx-pipeline";
2
+
3
+ //#region src/protocols/bridge/release.d.ts
4
+ declare const RELEASE_KIND: {
5
+ readonly DEPOSIT: 1;
6
+ readonly REFUND: 2;
7
+ readonly DEPOSIT_B: 3;
8
+ };
9
+ /** `resolveMigrated` follows at most this many `migratedTo` links of an ACCOUNT (check 6) */
10
+ declare const MAX_MIGRATION_HOPS = 8;
11
+ interface ReleaseItx {
12
+ kind: number;
13
+ bridge: string;
14
+ evidence: string;
15
+ ordinal: number;
16
+ to: string;
17
+ amount: string;
18
+ ethChainId: string;
19
+ epoch: number;
20
+ ethSender: string;
21
+ claimSignature: string;
22
+ signaturesList: string[];
23
+ }
24
+ type Context = Record<string, any> & {
25
+ itx: ReleaseItx;
26
+ /** what `resolveBridgeForRelease` found: the bridge, its reserve and the reserves a refund may draw on */
27
+ release?: ReleaseResolution;
28
+ releaseAmount?: bigint;
29
+ releaseTimeMs?: number;
30
+ };
31
+ declare const runner: Runner<Context>;
32
+ declare function resolveMigrated(context: Context, address: string): Promise<string | null>;
33
+ //#endregion
34
+ export { Context, MAX_MIGRATION_HOPS, RELEASE_KIND, ReleaseItx, runner as default, resolveMigrated };