@ocap/tx-protocols 1.31.9 → 1.32.1

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 (43) hide show
  1. package/esm/execute.d.mts +6 -1
  2. package/esm/execute.mjs +151 -9
  3. package/esm/gas-security-guard.d.mts +19 -1
  4. package/esm/gas-security-guard.mjs +44 -1
  5. package/esm/index.d.mts +8 -2
  6. package/esm/index.mjs +2 -2
  7. package/esm/pipes/ensure-cost.mjs +39 -2
  8. package/esm/pipes/write-ledger.mjs +18 -3
  9. package/esm/protocols/rollup/bridge-create.mjs +10 -4
  10. package/esm/protocols/rollup/bridge-governance-tx-binding.d.mts +7 -0
  11. package/esm/protocols/rollup/bridge-governance-tx-binding.mjs +212 -0
  12. package/esm/protocols/rollup/bridge-governance-vote.d.mts +49 -0
  13. package/esm/protocols/rollup/bridge-governance-vote.mjs +563 -0
  14. package/esm/protocols/rollup/bridge-migrate.mjs +9 -9
  15. package/esm/protocols/rollup/bridge-v2.d.mts +6 -0
  16. package/esm/protocols/rollup/bridge-v2.mjs +5 -0
  17. package/esm/protocols/rollup/create.mjs +5 -4
  18. package/esm/protocols/rollup/token-authority.d.mts +17 -0
  19. package/esm/protocols/rollup/token-authority.mjs +40 -0
  20. package/esm/protocols/rollup/update.d.mts +2 -0
  21. package/esm/protocols/rollup/update.mjs +28 -6
  22. package/lib/execute.cjs +151 -9
  23. package/lib/execute.d.cts +6 -1
  24. package/lib/gas-security-guard.cjs +44 -0
  25. package/lib/gas-security-guard.d.cts +19 -1
  26. package/lib/index.cjs +1 -0
  27. package/lib/index.d.cts +8 -2
  28. package/lib/pipes/ensure-cost.cjs +39 -2
  29. package/lib/pipes/write-ledger.cjs +18 -3
  30. package/lib/protocols/rollup/bridge-create.cjs +10 -4
  31. package/lib/protocols/rollup/bridge-governance-tx-binding.cjs +213 -0
  32. package/lib/protocols/rollup/bridge-governance-tx-binding.d.cts +7 -0
  33. package/lib/protocols/rollup/bridge-governance-vote.cjs +572 -0
  34. package/lib/protocols/rollup/bridge-governance-vote.d.cts +49 -0
  35. package/lib/protocols/rollup/bridge-migrate.cjs +9 -9
  36. package/lib/protocols/rollup/bridge-v2.cjs +5 -0
  37. package/lib/protocols/rollup/bridge-v2.d.cts +6 -0
  38. package/lib/protocols/rollup/create.cjs +5 -4
  39. package/lib/protocols/rollup/token-authority.cjs +42 -0
  40. package/lib/protocols/rollup/token-authority.d.cts +17 -0
  41. package/lib/protocols/rollup/update.cjs +28 -6
  42. package/lib/protocols/rollup/update.d.cts +2 -0
  43. package/package.json +16 -16
@@ -0,0 +1,17 @@
1
+ //#region src/protocols/rollup/token-authority.d.ts
2
+ type Ctx = any;
3
+ /** Whether `tokenAddress` is the chain's official token. */
4
+ declare const isOfficialToken: (config: Ctx, tokenAddress: string) => boolean;
5
+ /**
6
+ * The configured authority (`config.moderator.address` or `tokenState.issuer`) resolved along the account migration
7
+ * chain to its TERMINAL account (#1795). The configured address stays the old one after `account_migrate`, so only the
8
+ * account it migrated to (transitively) may act; the old address and any intermediate address of the chain are never
9
+ * an authority, and neither are the related addresses of the account.
10
+ *
11
+ * - not migrated: the configured address, unchanged;
12
+ * - no account at all: the configured address, unchanged (an account that does not exist was never migrated);
13
+ * - the chain is broken (cycle or a missing target): no authority, fail closed.
14
+ */
15
+ declare function resolveTokenAuthority(context: Ctx, tokenAddress: string, tokenState?: Ctx): Promise<string | undefined>;
16
+ //#endregion
17
+ export { isOfficialToken, resolveTokenAuthority };
@@ -0,0 +1,40 @@
1
+ import { isSameDid } from "@ocap/util";
2
+
3
+ //#region src/protocols/rollup/token-authority.ts
4
+ /**
5
+ * The token authority of a rollup / bridge (#1411): the chain moderator for the official token, the token issuer for
6
+ * any other token. Shared by create_rollup, the v2 bridge create, and the reserve migration cancel (direct and by
7
+ * governance vote).
8
+ */
9
+ /** Whether `tokenAddress` is the chain's official token. */
10
+ const isOfficialToken = (config, tokenAddress) => !!config?.token?.address && isSameDid(tokenAddress, config.token.address);
11
+ /**
12
+ * The configured authority (`config.moderator.address` or `tokenState.issuer`) resolved along the account migration
13
+ * chain to its TERMINAL account (#1795). The configured address stays the old one after `account_migrate`, so only the
14
+ * account it migrated to (transitively) may act; the old address and any intermediate address of the chain are never
15
+ * an authority, and neither are the related addresses of the account.
16
+ *
17
+ * - not migrated: the configured address, unchanged;
18
+ * - no account at all: the configured address, unchanged (an account that does not exist was never migrated);
19
+ * - the chain is broken (cycle or a missing target): no authority, fail closed.
20
+ */
21
+ async function resolveTokenAuthority(context, tokenAddress, tokenState) {
22
+ const { config, statedb } = context;
23
+ const configured = isOfficialToken(config, tokenAddress) ? config?.moderator?.address : tokenState?.issuer;
24
+ if (!configured) return void 0;
25
+ const terminal = await statedb.account.get(configured, {
26
+ ...context,
27
+ traceMigration: true
28
+ });
29
+ if (terminal) {
30
+ if (!terminal.address) return void 0;
31
+ return isSameDid(terminal.address, configured) ? configured : terminal.address;
32
+ }
33
+ return await statedb.account.get(configured, {
34
+ ...context,
35
+ traceMigration: false
36
+ }) ? void 0 : configured;
37
+ }
38
+
39
+ //#endregion
40
+ export { isOfficialToken, resolveTokenAuthority };
@@ -1,4 +1,5 @@
1
1
  import { BridgeCtxMixin } from "./bridge-v2.mjs";
2
+ import { BridgeGovVotePlan } from "./bridge-governance-vote.mjs";
2
3
  import { Runner } from "@ocap/tx-pipeline";
3
4
  import { rollup } from "@ocap/state";
4
5
  import { IReadyContext, IWithRollup, IWithSender, IWithSigners, TUpdateRollupTx } from "@ocap/types";
@@ -12,6 +13,7 @@ import { IReadyContext, IWithRollup, IWithSender, IWithSigners, TUpdateRollupTx
12
13
  */
13
14
  type Context = IReadyContext<TUpdateRollupTx> & IWithRollup & IWithSender & IWithSigners & BridgeCtxMixin & {
14
15
  bridgePlan?: rollup.BridgePatchPlan;
16
+ govVotePlan?: BridgeGovVotePlan;
15
17
  };
16
18
  declare const runner: Runner<Context>;
17
19
  //#endregion
@@ -5,6 +5,7 @@ import { VerifyBridgeAuthority, bridgeUpdates, ifV1, loadBridge, peekBridge, rea
5
5
  import ensure_validator_default from "./pipes/ensure-validator.mjs";
6
6
  import verify_signers_default from "./pipes/verify-signers.mjs";
7
7
  import verify_status_default from "./pipes/verify-status.mjs";
8
+ import { commitBridgeGovProposalVote, isGovProposalVotePayload, planBridgeGovProposalVote } from "./bridge-governance-vote.mjs";
8
9
  import { Runner, pipes } from "@ocap/tx-pipeline";
9
10
  import { CustomError } from "@ocap/util/lib/error";
10
11
  import { account, rollup } from "@ocap/state";
@@ -64,13 +65,24 @@ runner.use(loadBridge);
64
65
  runner.use(rejectRollupV1IfDisabled("update_rollup"));
65
66
  runner.use(ifV1(ensure_validator_default(true)));
66
67
  runner.use(ifV1(verify_status_default({ paused: false })));
67
- runner.use((context, next) => {
68
+ runner.use(async (context, next) => {
68
69
  if (!context.isBridgeV2) return next();
69
70
  try {
70
71
  rollup.assertV1FieldsUnused(context.itx, "INVALID_ROLLUP_UPDATE");
71
- context.bridgePlan = rollup.planBridgePatch(context.bridgeBody, readItxData(context.itx), context.txSec);
72
+ const rawData = readItxData(context.itx);
73
+ if (isGovProposalVotePayload(rawData)) {
74
+ context.govVotePlan = await planBridgeGovProposalVote(context, rawData);
75
+ return next();
76
+ }
77
+ context.bridgePlan = rollup.planBridgePatch(context.bridgeBody, rawData, context.txSec, {
78
+ ocapChainId: context.config.chainId,
79
+ bridge: context.itx.rollup,
80
+ vaultAddress: context.rollupState.vaultAddress
81
+ });
72
82
  } catch (err) {
73
- return next(new CustomError("INVALID_TX", err.message));
83
+ const e = err;
84
+ if (e?.code === "INVALID_SIGNATURE") return next(new CustomError("INVALID_SIGNATURE", e.message || "Invalid governance signature"));
85
+ return next(new CustomError("INVALID_TX", e?.message || "Invalid rollup update"));
74
86
  }
75
87
  return next();
76
88
  });
@@ -86,7 +98,13 @@ runner.use(ifV1(verify_signers_default({
86
98
  allowSender: true
87
99
  })));
88
100
  runner.use(VerifyBridgeAuthority((context) => {
89
- const kind = context.bridgePlan?.kind;
101
+ const ctx = context;
102
+ if (ctx.govVotePlan || ctx.bridgePlan?.kind === "evm-governance-sync") return {
103
+ owner: "none",
104
+ quorum: "none",
105
+ externalAuth: true
106
+ };
107
+ const kind = ctx.bridgePlan?.kind;
90
108
  if (kind === "propose-owner") return {
91
109
  owner: "none",
92
110
  quorum: "twoThirds"
@@ -118,16 +136,20 @@ runner.use(pipes.VerifyAccountMigration({
118
136
  stateKey: "senderState",
119
137
  addressKey: "tx.from"
120
138
  }));
121
- runner.use(ensure_gas_default(() => ({
139
+ runner.use(ensure_gas_default((context) => context.govVotePlan ? context.govVotePlan.gasEstimate : {
122
140
  create: 0,
123
141
  update: 2,
124
142
  payment: 0
125
- })));
143
+ }));
126
144
  runner.use(ensure_cost_default({ attachSenderChanges: true }));
127
145
  runner.use(pipes.TakeStateSnapshot());
128
146
  runner.use(async (context, next) => {
129
147
  const { tx: tx$1, itx, rollupState, statedb, senderState, senderUpdates, updateVaults } = context;
130
148
  if (context.isBridgeV2) {
149
+ if (context.govVotePlan) {
150
+ await commitBridgeGovProposalVote(context, context.govVotePlan);
151
+ return next();
152
+ }
131
153
  const updates = bridgeUpdates(context, context.bridgePlan.body);
132
154
  const [newSenderState$1, newRollupState$1] = await Promise.all([statedb.account.update(senderState.address, account.update(senderState, {
133
155
  nonce: tx$1.nonce,
package/lib/execute.cjs CHANGED
@@ -61,6 +61,7 @@ const getStates = (context) => {
61
61
  return context.states;
62
62
  };
63
63
  const flushEvents = (context, extra = {}) => {
64
+ if (context.extra?._dryRun === true) return;
64
65
  const events = context.events || [];
65
66
  if (events.length) context.timer?.incrCounter("indexEvents", events.length);
66
67
  events.forEach((e) => {
@@ -427,9 +428,8 @@ const createExecute = ({ filter, runAsLambda }) => {
427
428
  }
428
429
  }
429
430
  const extra = context.extra || {};
430
- const txExtra = extra.txExtra && typeof extra.txExtra === "object" ? extra.txExtra : void 0;
431
431
  const { token, pk } = extra.gasStakeHeaders || {};
432
- const rawGasPass = extra.gasPass || txExtra?.gasPass;
432
+ const rawGasPass = extra.gasPass;
433
433
  const txHash = context.txHash || "";
434
434
  const txTime = context.txTime;
435
435
  const nowMs = txTime ? +new Date(txTime) : Date.now();
@@ -754,7 +754,10 @@ const createExecute = ({ filter, runAsLambda }) => {
754
754
  return _ocap_tx_pipeline.pipes.DecodeItx(context, next);
755
755
  });
756
756
  pre.use((context, next) => {
757
- if (context._preFlightSnapshotApplied) return next();
757
+ if (context._preFlightSnapshotApplied) {
758
+ if (context.extra?.txTime !== void 0 && (Boolean(context.tx?.delegator) || context.txType === "fg:t:exchange_v2")) return _ocap_tx_pipeline.pipes.VerifyTx(context, next);
759
+ return next();
760
+ }
758
761
  return _ocap_tx_pipeline.pipes.VerifyTx(context, next);
759
762
  });
760
763
  pre.use((context, next) => {
@@ -898,6 +901,7 @@ const createExecute = ({ filter, runAsLambda }) => {
898
901
  };
899
902
  const attachSecurityStrikeToError = async (err, ctx) => {
900
903
  if (!err || err._strikeRecorded || err._unauthenticatedExtraFailure === true) return;
904
+ if (ctx.extra?._isReplay === true) return;
901
905
  const classified = require_gas_security_guard.classifyErrorStrikeCategory(err);
902
906
  if (!classified.shouldRecordStrike) return;
903
907
  const secCfg = ctx.config?.transaction?.security;
@@ -908,6 +912,7 @@ const createExecute = ({ filter, runAsLambda }) => {
908
912
  err._strikeRecorded = true;
909
913
  const fishermanAddress = secCfg?.fishermanAddress;
910
914
  const nowMs = ctx.txTime ? +new Date(ctx.txTime) : Date.now();
915
+ const allowStateDbAutoSlash = !ctx.consensusCommitter && ctx.extra?.txTime === void 0;
911
916
  const { primaryWarning, slashEvidence } = await require_gas_security_guard.recordActorSecurityStrike({
912
917
  actors,
913
918
  category: classified.category,
@@ -915,7 +920,7 @@ const createExecute = ({ filter, runAsLambda }) => {
915
920
  txHash: ctx.txHash,
916
921
  config: ctx.config,
917
922
  statedb: ctx.statedb,
918
- txn: ctx.txn,
923
+ txn: allowStateDbAutoSlash ? ctx.txn : void 0,
919
924
  fishermanAddress,
920
925
  nowMs,
921
926
  telemetry: ctx.gasQuotaTelemetry
@@ -1021,20 +1026,58 @@ const createExecute = ({ filter, runAsLambda }) => {
1021
1026
  });
1022
1027
  });
1023
1028
  });
1029
+ const createStagingLedgerProxy = (baseLedger, slot, onStage) => {
1030
+ const proxy = Object.create(baseLedger || Object.prototype);
1031
+ proxy.append = async (txInput) => {
1032
+ const normalizedInput = {
1033
+ ...txInput,
1034
+ timestamp: slot.timestampMs
1035
+ };
1036
+ onStage({
1037
+ txInput: normalizedInput,
1038
+ sequence: slot.sequence
1039
+ });
1040
+ return {
1041
+ sequence: slot.sequence,
1042
+ hash: normalizedInput.txHash,
1043
+ tx: normalizedInput.tx,
1044
+ txRaw: normalizedInput.txRaw,
1045
+ txType: normalizedInput.txType,
1046
+ from: normalizedInput.from,
1047
+ nonce: normalizedInput.nonce,
1048
+ pk: normalizedInput.pk,
1049
+ signature: normalizedInput.signature,
1050
+ chainId: normalizedInput.chainId,
1051
+ timestamp: slot.timestampMs,
1052
+ txExtra: normalizedInput.txExtra,
1053
+ entryHash: "",
1054
+ finalized: false
1055
+ };
1056
+ };
1057
+ return proxy;
1058
+ };
1024
1059
  if (typeof runAsLambda === "function") return async (context, protocols) => {
1025
1060
  const executionId = Symbol("tx-exec");
1026
1061
  context.executionId = executionId;
1027
1062
  let ctx = context;
1028
1063
  context.timer = context.timer || new require_tx_timer.TxTimer();
1064
+ const consensusCommitter = context.consensusCommitter;
1065
+ let proposalSlot = null;
1066
+ let stagedCapture = null;
1067
+ let committedConsensusEntry = null;
1029
1068
  let entryFinalized = false;
1030
1069
  let savedLedgerSequence;
1031
1070
  try {
1071
+ if (consensusCommitter) proposalSlot = await consensusCommitter.prepareProposalSlot();
1032
1072
  const txState = await runAsLambda(async (txn) => {
1073
+ stagedCapture = null;
1074
+ committedConsensusEntry = null;
1033
1075
  ctx = (0, lodash_pick.default)(context, [
1034
1076
  "txBase64",
1035
1077
  "statedb",
1036
1078
  "indexdb",
1037
1079
  "ledger",
1080
+ "consensusCommitter",
1038
1081
  "config",
1039
1082
  "states",
1040
1083
  "filter",
@@ -1044,20 +1087,33 @@ const createExecute = ({ filter, runAsLambda }) => {
1044
1087
  "timer",
1045
1088
  "executionId"
1046
1089
  ]);
1090
+ if (consensusCommitter && proposalSlot) {
1091
+ ctx.extra = {
1092
+ ...context.extra || {},
1093
+ txTime: proposalSlot.timestampMs
1094
+ };
1095
+ ctx.ledger = createStagingLedgerProxy(context.ledger, proposalSlot, (staged) => {
1096
+ stagedCapture = staged;
1097
+ });
1098
+ }
1047
1099
  const preFlightSnapshot = context[PREFLIGHT_VERIFIED_SNAPSHOT_SYMBOL];
1048
1100
  if (preFlightSnapshot !== void 0) ctx[PREFLIGHT_VERIFIED_SNAPSHOT_SYMBOL] = preFlightSnapshot;
1049
1101
  ctx.txn = txn;
1050
- if (savedLedgerSequence !== void 0) ctx.ledgerSequence = savedLedgerSequence;
1102
+ if (savedLedgerSequence !== void 0 && !consensusCommitter) ctx.ledgerSequence = savedLedgerSequence;
1051
1103
  ctx.timer?.mark("lockWait");
1052
1104
  try {
1053
1105
  await execute(ctx, protocols, true);
1054
1106
  await appendLedgerEntry(ctx);
1055
1107
  } finally {
1056
- if (ctx.ledgerSequence && !savedLedgerSequence) {
1108
+ if (ctx.ledgerSequence && !savedLedgerSequence && !consensusCommitter) {
1057
1109
  savedLedgerSequence = ctx.ledgerSequence;
1058
1110
  context.ledgerSequence = ctx.ledgerSequence;
1059
1111
  }
1060
1112
  }
1113
+ if (consensusCommitter && ctx.ledgerSequence) {
1114
+ savedLedgerSequence = ctx.ledgerSequence;
1115
+ context.ledgerSequence = ctx.ledgerSequence;
1116
+ }
1061
1117
  const state = getStates(context).tx.create(ctx, "OK");
1062
1118
  await context.statedb.tx.create(state.hash, state, ctx);
1063
1119
  await recordUnsignedTxInStateDb(ctx, state.hash);
@@ -1067,7 +1123,27 @@ const createExecute = ({ filter, runAsLambda }) => {
1067
1123
  cleanWorkingSet: true,
1068
1124
  verifyHash: true,
1069
1125
  context: ctx,
1126
+ ...consensusCommitter && proposalSlot ? { beforeCommit: async ({ commitHash }) => {
1127
+ if (!stagedCapture || !proposalSlot) {
1128
+ const abortErr = new _ocap_util_lib_error.CustomError("CONSENSUS_ABORTED", "Missing staged ledger entry before consensus commit");
1129
+ abortErr.isConsensusAbort = true;
1130
+ throw abortErr;
1131
+ }
1132
+ committedConsensusEntry = await consensusCommitter.commitStagedEntry({
1133
+ txInput: stagedCapture.txInput,
1134
+ sequence: stagedCapture.sequence,
1135
+ stateCommitHash: commitHash || "",
1136
+ timestampMs: proposalSlot.timestampMs
1137
+ });
1138
+ ctx.stateCommitHash = commitHash || "";
1139
+ entryFinalized = true;
1140
+ } } : {},
1070
1141
  onCommit: async (stateCommitHash) => {
1142
+ if (consensusCommitter) {
1143
+ ctx.stateCommitHash = stateCommitHash || "";
1144
+ entryFinalized = true;
1145
+ return;
1146
+ }
1071
1147
  if (ctx.txHash && ctx.ledger && ctx.ledgerSequence && ctx.txBase64) try {
1072
1148
  await ctx.ledger.finalizeEntry(ctx.txHash, stateCommitHash || "", ctx.ledgerSequence, ctx.txBase64);
1073
1149
  ctx.stateCommitHash = stateCommitHash || "";
@@ -1082,10 +1158,13 @@ const createExecute = ({ filter, runAsLambda }) => {
1082
1158
  }
1083
1159
  }
1084
1160
  });
1161
+ if (consensusCommitter) ctx.ledger = context.ledger;
1085
1162
  ctx.timer?.mark("commit");
1086
1163
  flushEvents(ctx, { txState });
1087
1164
  ctx.timer?.mark("indexdb");
1088
- ctx.ledger?.createCheckpointIfNeeded()?.catch((err) => {
1165
+ if (consensusCommitter) {
1166
+ if (committedConsensusEntry && typeof consensusCommitter.afterStateCommitted === "function") await consensusCommitter.afterStateCommitted(committedConsensusEntry);
1167
+ } else ctx.ledger?.createCheckpointIfNeeded()?.catch((err) => {
1089
1168
  ctx.logger?.error("Background checkpoint creation failed", {
1090
1169
  txHash: ctx.txHash,
1091
1170
  error: err
@@ -1110,6 +1189,18 @@ const createExecute = ({ filter, runAsLambda }) => {
1110
1189
  });
1111
1190
  } catch (error) {
1112
1191
  const err = error;
1192
+ if (consensusCommitter && !entryFinalized) {
1193
+ ctx.ledger = context.ledger;
1194
+ ctx.ledgerSequence = void 0;
1195
+ savedLedgerSequence = void 0;
1196
+ context.ledgerSequence = void 0;
1197
+ }
1198
+ if (err?.isConsensusAbort === true) {
1199
+ ctx.ledgerSequence = void 0;
1200
+ savedLedgerSequence = void 0;
1201
+ context.ledgerSequence = void 0;
1202
+ throw error;
1203
+ }
1113
1204
  const txStatus = err.code || "INTERNAL";
1114
1205
  let txState = ctx.tx ? getStates(context).tx.create(ctx, txStatus, false) : null;
1115
1206
  ctx.logger?.error("Failed to execute transaction", {
@@ -1122,10 +1213,22 @@ const createExecute = ({ filter, runAsLambda }) => {
1122
1213
  ctx.events = [];
1123
1214
  try {
1124
1215
  txState = await runAsLambda(async (txn) => {
1216
+ stagedCapture = null;
1217
+ committedConsensusEntry = null;
1125
1218
  ctx = Object.assign({}, ctx, {
1126
1219
  txn,
1127
1220
  cacheStates: null
1128
1221
  });
1222
+ if (consensusCommitter && proposalSlot) {
1223
+ ctx.ledgerSequence = void 0;
1224
+ ctx.extra = {
1225
+ ...ctx.extra || {},
1226
+ txTime: proposalSlot.timestampMs
1227
+ };
1228
+ ctx.ledger = createStagingLedgerProxy(context.ledger, proposalSlot, (staged) => {
1229
+ stagedCapture = staged;
1230
+ });
1231
+ }
1129
1232
  ctx.timer?.mark("lockWait");
1130
1233
  const strikeSnapshot = require_gas_security_guard.snapshotActorSecurityRecords([
1131
1234
  ctx.tx?.delegator || "",
@@ -1160,7 +1263,27 @@ const createExecute = ({ filter, runAsLambda }) => {
1160
1263
  cleanWorkingSet: true,
1161
1264
  verifyHash: true,
1162
1265
  context: ctx,
1266
+ ...consensusCommitter && proposalSlot ? { beforeCommit: async ({ commitHash }) => {
1267
+ if (!stagedCapture || !proposalSlot) {
1268
+ const abortErr = new _ocap_util_lib_error.CustomError("CONSENSUS_ABORTED", "Missing staged ledger entry before failed-tx consensus commit");
1269
+ abortErr.isConsensusAbort = true;
1270
+ throw abortErr;
1271
+ }
1272
+ committedConsensusEntry = await consensusCommitter.commitStagedEntry({
1273
+ txInput: stagedCapture.txInput,
1274
+ sequence: stagedCapture.sequence,
1275
+ stateCommitHash: commitHash || "",
1276
+ timestampMs: proposalSlot.timestampMs
1277
+ });
1278
+ ctx.stateCommitHash = commitHash || "";
1279
+ entryFinalized = true;
1280
+ } } : {},
1163
1281
  onCommit: async (stateCommitHash) => {
1282
+ if (consensusCommitter) {
1283
+ ctx.stateCommitHash = stateCommitHash || "";
1284
+ entryFinalized = true;
1285
+ return;
1286
+ }
1164
1287
  if (ctx.txHash && ctx.ledger && ctx.ledgerSequence && ctx.txBase64) try {
1165
1288
  await ctx.ledger.finalizeEntry(ctx.txHash, stateCommitHash || "", ctx.ledgerSequence, ctx.txBase64);
1166
1289
  ctx.stateCommitHash = stateCommitHash || "";
@@ -1175,10 +1298,13 @@ const createExecute = ({ filter, runAsLambda }) => {
1175
1298
  }
1176
1299
  }
1177
1300
  });
1301
+ if (consensusCommitter) ctx.ledger = context.ledger;
1178
1302
  ctx.timer?.mark("commit");
1179
1303
  flushEvents(ctx, { txState });
1180
1304
  ctx.timer?.mark("indexdb");
1181
- ctx.ledger?.createCheckpointIfNeeded()?.catch((err$1) => {
1305
+ if (consensusCommitter) {
1306
+ if (committedConsensusEntry && typeof consensusCommitter.afterStateCommitted === "function") await consensusCommitter.afterStateCommitted(committedConsensusEntry);
1307
+ } else ctx.ledger?.createCheckpointIfNeeded()?.catch((err$1) => {
1182
1308
  ctx.logger?.error("Background checkpoint creation failed", {
1183
1309
  txHash: ctx.txHash,
1184
1310
  error: err$1
@@ -1203,6 +1329,20 @@ const createExecute = ({ filter, runAsLambda }) => {
1203
1329
  perf: ctx.timer?.summaryV2()
1204
1330
  });
1205
1331
  } catch (innerErr) {
1332
+ if (consensusCommitter) {
1333
+ ctx.ledger = context.ledger;
1334
+ if (!entryFinalized) {
1335
+ ctx.ledgerSequence = void 0;
1336
+ savedLedgerSequence = void 0;
1337
+ context.ledgerSequence = void 0;
1338
+ }
1339
+ }
1340
+ if (innerErr?.isConsensusAbort === true) {
1341
+ ctx.ledgerSequence = void 0;
1342
+ savedLedgerSequence = void 0;
1343
+ context.ledgerSequence = void 0;
1344
+ throw innerErr;
1345
+ }
1206
1346
  await attachSecurityStrikeToError(err, Object.assign({}, ctx, { txn: void 0 }));
1207
1347
  ctx.logger?.error("Failed to save invalid transaction to statedb", {
1208
1348
  error: innerErr,
@@ -1214,6 +1354,7 @@ const createExecute = ({ filter, runAsLambda }) => {
1214
1354
  throw error;
1215
1355
  }
1216
1356
  } else {
1357
+ if (consensusCommitter) ctx.ledger = context.ledger;
1217
1358
  await attachSecurityStrikeToError(err, Object.assign({}, ctx, { txn: void 0 }));
1218
1359
  ctx.timer?.setMeta({
1219
1360
  txType: ctx.txType,
@@ -1235,7 +1376,8 @@ const createExecute = ({ filter, runAsLambda }) => {
1235
1376
  }
1236
1377
  throw error;
1237
1378
  } finally {
1238
- if (!entryFinalized) {
1379
+ if (consensusCommitter) ctx.ledger = context.ledger;
1380
+ if (!entryFinalized && !consensusCommitter) {
1239
1381
  const ledger = ctx.ledger || context.ledger;
1240
1382
  const txHash = ctx.txHash || context.txHash;
1241
1383
  const txBase64 = ctx.txBase64 || context.txBase64;
package/lib/execute.d.cts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { ITxGasQuotaTelemetry, ITxSecurityWarning } from "./gas-security-guard.cjs";
2
2
  import { TxTimer } from "./tx-timer.cjs";
3
3
  import { Blacklist } from "@ocap/state";
4
- import { IAccountState, IBaseContext, IGasContext } from "@ocap/types";
4
+ import { IAccountState, IBaseContext, IConsensusCommitter, IGasContext } from "@ocap/types";
5
5
  import { CustomError } from "@ocap/util/lib/error";
6
6
 
7
7
  //#region src/execute.d.ts
@@ -45,6 +45,8 @@ interface IExecutionContext extends IGasContext {
45
45
  gasQuotaTelemetry?: ITxGasQuotaTelemetry;
46
46
  /** Structured progressive strike warning */
47
47
  securityWarning?: ITxSecurityWarning;
48
+ /** Optional BFT consensus committer (#1712) */
49
+ consensusCommitter?: IConsensusCommitter;
48
50
  }
49
51
  /** Protocol runner interface */
50
52
  interface IProtocolRunner {
@@ -59,6 +61,9 @@ interface IExecuteOptions {
59
61
  cleanWorkingSet: boolean;
60
62
  verifyHash: boolean;
61
63
  context: IExecutionContext;
64
+ beforeCommit?: (params: {
65
+ commitHash: string;
66
+ }) => void | Promise<void>;
62
67
  onCommit?: (commitHash?: string) => void | Promise<void>;
63
68
  }) => Promise<T>;
64
69
  }
@@ -1122,6 +1122,49 @@ function setTxSecurityWarningForHash(txHash, warning, statedb) {
1122
1122
  }
1123
1123
  reg.txWarningsByHash.set(normKey, warning);
1124
1124
  }
1125
+ /**
1126
+ * Pure, side-effect-free read-only telemetry summary of process-local gas security counters (#1756).
1127
+ *
1128
+ * INVARIANT (`AGENTS.md` Axiom #4): Never mutates registry maps, LRU order, burst windows, or strike
1129
+ * records, never returns individual actor DIDs on public endpoints, and MUST NEVER be called inside
1130
+ * `execute` or transaction pipeline stages.
1131
+ */
1132
+ function getGasSecuritySummary(statedb, config, nowMs = Date.now()) {
1133
+ const cfg = resolveGasSecurityConfig(config);
1134
+ const reg = getGasSecurityRegistry(statedb);
1135
+ const strikeCutoff = nowMs - cfg.strikeWindowMs;
1136
+ const burstCutoff = nowMs - cfg.burstWindowMs;
1137
+ let trackedActors = 0;
1138
+ let warningActors = 0;
1139
+ let throttledActors = 0;
1140
+ let slashTriggeredActors = 0;
1141
+ let activeBurstsInWindow = 0;
1142
+ for (const [key, rec] of reg.actors.entries()) {
1143
+ if (key.endsWith(">*")) continue;
1144
+ trackedActors += 1;
1145
+ let activeBursts = 0;
1146
+ for (const b of rec.bursts) if (b.t >= burstCutoff) activeBursts += 1;
1147
+ activeBurstsInWindow += activeBursts;
1148
+ if (!cfg.enabled) continue;
1149
+ let strikeCount = 0;
1150
+ for (const s of rec.strikes) if (s.timestampMs >= strikeCutoff) strikeCount += s.weight;
1151
+ const isCoolingDown = cfg.throttle && rec.cooldownUntilMs > nowMs;
1152
+ const tier = computeActorTier(strikeCount, isCoolingDown, cfg);
1153
+ if (tier === "WARNING") warningActors += 1;
1154
+ else if (tier === "THROTTLED") throttledActors += 1;
1155
+ else if (tier === "SLASH_TRIGGERED") slashTriggeredActors += 1;
1156
+ }
1157
+ return {
1158
+ enabled: cfg.enabled,
1159
+ trackedActors,
1160
+ warningActors,
1161
+ throttledActors,
1162
+ slashTriggeredActors,
1163
+ activeBurstsInWindow,
1164
+ strikeWindowMs: cfg.strikeWindowMs,
1165
+ burstWindowMs: cfg.burstWindowMs
1166
+ };
1167
+ }
1125
1168
 
1126
1169
  //#endregion
1127
1170
  exports.DEFAULT_BASE_BURST_ALLOWANCE = DEFAULT_BASE_BURST_ALLOWANCE;
@@ -1150,6 +1193,7 @@ exports.executeAutoGasStakeSlash = executeAutoGasStakeSlash;
1150
1193
  exports.extractTransactionTargets = extractTransactionTargets;
1151
1194
  exports.getActorSecurityStatus = getActorSecurityStatus;
1152
1195
  exports.getGasSecurityRegistry = getGasSecurityRegistry;
1196
+ exports.getGasSecuritySummary = getGasSecuritySummary;
1153
1197
  exports.getTxSecurityWarningByHash = getTxSecurityWarningByHash;
1154
1198
  exports.normalizeActorAddress = normalizeActorAddress;
1155
1199
  exports.normalizeShortTxType = normalizeShortTxType;
@@ -369,5 +369,23 @@ declare function assertTxAdmission(params: {
369
369
  }>;
370
370
  declare function getTxSecurityWarningByHash(txHash: string, statedb?: unknown): ITxSecurityWarning | undefined;
371
371
  declare function setTxSecurityWarningForHash(txHash: string, warning: ITxSecurityWarning, statedb?: unknown): void;
372
+ interface IGasSecuritySummary {
373
+ enabled: boolean;
374
+ trackedActors: number;
375
+ warningActors: number;
376
+ throttledActors: number;
377
+ slashTriggeredActors: number;
378
+ activeBurstsInWindow: number;
379
+ strikeWindowMs: number;
380
+ burstWindowMs: number;
381
+ }
382
+ /**
383
+ * Pure, side-effect-free read-only telemetry summary of process-local gas security counters (#1756).
384
+ *
385
+ * INVARIANT (`AGENTS.md` Axiom #4): Never mutates registry maps, LRU order, burst windows, or strike
386
+ * records, never returns individual actor DIDs on public endpoints, and MUST NEVER be called inside
387
+ * `execute` or transaction pipeline stages.
388
+ */
389
+ declare function getGasSecuritySummary(statedb?: unknown, config?: Partial<IChainConfig>, nowMs?: number): IGasSecuritySummary;
372
390
  //#endregion
373
- export { DEFAULT_BASE_BURST_ALLOWANCE, DEFAULT_BURST_REJECT_MULTIPLE, DEFAULT_BURST_WINDOW_MS, DEFAULT_DELEGATED_BURST_MULTIPLE, 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, IAbuseSlashEvidence, IActorSecuritySnapshot, IGasSecurityConfig, IPaymasterDecodedClaims, IStakeForGasEligibilityResult, ITxGasQuotaTelemetry, ITxSecurityWarning, IUnlinkableGasPass, SecurityStrikeTier, StrikeReasonCategory, assertTxAdmission, classifyErrorStrikeCategory, computeActorTier, computeUnlinkableGasPassCommitment, computeUnlinkableGasPassSecretHash, evaluateBurstQuota, evaluateStakeForGasEligibility, executeAutoGasStakeSlash, extractTransactionTargets, getActorSecurityStatus, getGasSecurityRegistry, getTxSecurityWarningByHash, normalizeActorAddress, normalizeShortTxType, recordActorSecurityStrike, resetGasSecurityState, resolveGasSecurityConfig, resolveVerifiedStrikeActors, restoreActorSecurityRecords, setTxSecurityWarningForHash, snapshotActorSecurityRecords, verifyAndConsumeUnlinkableGasPass, verifyPaymasterConstraints };
391
+ export { DEFAULT_BASE_BURST_ALLOWANCE, DEFAULT_BURST_REJECT_MULTIPLE, DEFAULT_BURST_WINDOW_MS, DEFAULT_DELEGATED_BURST_MULTIPLE, 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, IAbuseSlashEvidence, IActorSecuritySnapshot, IGasSecurityConfig, IGasSecuritySummary, IPaymasterDecodedClaims, IStakeForGasEligibilityResult, ITxGasQuotaTelemetry, ITxSecurityWarning, IUnlinkableGasPass, SecurityStrikeTier, StrikeReasonCategory, assertTxAdmission, classifyErrorStrikeCategory, computeActorTier, computeUnlinkableGasPassCommitment, computeUnlinkableGasPassSecretHash, evaluateBurstQuota, evaluateStakeForGasEligibility, executeAutoGasStakeSlash, extractTransactionTargets, getActorSecurityStatus, getGasSecurityRegistry, getGasSecuritySummary, getTxSecurityWarningByHash, normalizeActorAddress, normalizeShortTxType, recordActorSecurityStrike, resetGasSecurityState, resolveGasSecurityConfig, resolveVerifiedStrikeActors, restoreActorSecurityRecords, setTxSecurityWarningForHash, snapshotActorSecurityRecords, verifyAndConsumeUnlinkableGasPass, verifyPaymasterConstraints };
package/lib/index.cjs CHANGED
@@ -189,6 +189,7 @@ exports.executeAutoGasStakeSlash = require_gas_security_guard.executeAutoGasStak
189
189
  exports.extractTransactionTargets = require_gas_security_guard.extractTransactionTargets;
190
190
  exports.getActorSecurityStatus = require_gas_security_guard.getActorSecurityStatus;
191
191
  exports.getGasSecurityRegistry = require_gas_security_guard.getGasSecurityRegistry;
192
+ exports.getGasSecuritySummary = require_gas_security_guard.getGasSecuritySummary;
192
193
  exports.getStatelessPrefixLength = require_stateless_prefix.getStatelessPrefixLength;
193
194
  exports.getTxSecurityWarningByHash = require_gas_security_guard.getTxSecurityWarningByHash;
194
195
  Object.defineProperty(exports, 'inspectPostExecutionInvariants', {
package/lib/index.d.cts CHANGED
@@ -1,4 +1,4 @@
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, IAbuseSlashEvidence, IGasSecurityConfig, IPaymasterDecodedClaims, IStakeForGasEligibilityResult, ITxGasQuotaTelemetry, ITxSecurityWarning, IUnlinkableGasPass, SecurityStrikeTier, StrikeReasonCategory, 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.cjs";
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, IAbuseSlashEvidence, IGasSecurityConfig, IGasSecuritySummary, IPaymasterDecodedClaims, IStakeForGasEligibilityResult, ITxGasQuotaTelemetry, ITxSecurityWarning, IUnlinkableGasPass, SecurityStrikeTier, StrikeReasonCategory, assertTxAdmission, classifyErrorStrikeCategory, computeActorTier, computeUnlinkableGasPassCommitment, computeUnlinkableGasPassSecretHash, evaluateBurstQuota, evaluateStakeForGasEligibility, executeAutoGasStakeSlash, extractTransactionTargets, getActorSecurityStatus, getGasSecurityRegistry, getGasSecuritySummary, getTxSecurityWarningByHash, normalizeActorAddress, normalizeShortTxType, recordActorSecurityStrike, resetGasSecurityState, resolveGasSecurityConfig, resolveVerifiedStrikeActors, setTxSecurityWarningForHash, verifyAndConsumeUnlinkableGasPass, verifyPaymasterConstraints } from "./gas-security-guard.cjs";
2
2
  import { COUNTER_NAMES, CounterName, QueueState, STAGE_LABELS, StageLabel, TxMeta, TxStatus, TxTimer, TxTimerSummaryV2 } from "./tx-timer.cjs";
3
3
  import { PREFLIGHT_VERIFIED_SNAPSHOT_SYMBOL, UNSIGNED_TX_EVIDENCE_DATA_PREFIX, toUnsignedEvidenceKey, tryApplyPreFlightVerifiedSnapshot } from "./execute.cjs";
4
4
  import { TokenInput } from "./protocols/trade/transfer-v2.cjs";
@@ -18,6 +18,7 @@ import { MultiOutput as MultiOutput$1, TokenCondition as TokenCondition$1, Token
18
18
  import { MultiOutput as MultiOutput$2 } from "./protocols/governance/slash-stake.cjs";
19
19
  import { MultiInput as MultiInput$5, TokenCondition as TokenCondition$2 } from "./protocols/governance/return-stake.cjs";
20
20
  import { BridgeCtxMixin } from "./protocols/rollup/bridge-v2.cjs";
21
+ import { BridgeGovVotePlan } from "./protocols/rollup/bridge-governance-vote.cjs";
21
22
  import { TokenChange as TokenChange$1 } from "./protocols/rollup/create-block.cjs";
22
23
  import { TokenChange as TokenChange$2 } from "./protocols/rollup/claim-reward.cjs";
23
24
  import { WriteLedger } from "./pipes/write-ledger.cjs";
@@ -36,6 +37,9 @@ interface ICreateExecutorOptions {
36
37
  cleanWorkingSet: boolean;
37
38
  verifyHash: boolean;
38
39
  context: unknown;
40
+ beforeCommit?: (params: {
41
+ commitHash: string;
42
+ }) => void | Promise<void>;
39
43
  onCommit?: (commitHash: string) => void | Promise<void>;
40
44
  }) => Promise<T>;
41
45
  }
@@ -373,6 +377,7 @@ declare const createExecutor: ({
373
377
  }>;
374
378
  updateRollup: _ocap_tx_pipeline0.Runner<_ocap_types0.IReadyContext<_ocap_types0.TUpdateRollupTx> & _ocap_types0.IWithRollup & _ocap_types0.IWithSender & _ocap_types0.IWithSigners & BridgeCtxMixin & {
375
379
  bridgePlan?: states.rollup.BridgePatchPlan;
380
+ govVotePlan?: BridgeGovVotePlan;
376
381
  }>;
377
382
  joinRollup: _ocap_tx_pipeline0.Runner<_ocap_types0.IReadyContext<_ocap_types0.TJoinRollupTx> & _ocap_types0.IWithRollup & _ocap_types0.IWithSender & _ocap_types0.IWithSigners & _ocap_types0.IWithStake & BridgeCtxMixin & {
378
383
  evidenceState?: _ocap_types0.IEvidenceState | null;
@@ -772,6 +777,7 @@ declare const defaultExecutor: {
772
777
  }>;
773
778
  updateRollup: _ocap_tx_pipeline0.Runner<_ocap_types0.IReadyContext<_ocap_types0.TUpdateRollupTx> & _ocap_types0.IWithRollup & _ocap_types0.IWithSender & _ocap_types0.IWithSigners & BridgeCtxMixin & {
774
779
  bridgePlan?: states.rollup.BridgePatchPlan;
780
+ govVotePlan?: BridgeGovVotePlan;
775
781
  }>;
776
782
  joinRollup: _ocap_tx_pipeline0.Runner<_ocap_types0.IReadyContext<_ocap_types0.TJoinRollupTx> & _ocap_types0.IWithRollup & _ocap_types0.IWithSender & _ocap_types0.IWithSigners & _ocap_types0.IWithStake & BridgeCtxMixin & {
777
783
  evidenceState?: _ocap_types0.IEvidenceState | null;
@@ -842,4 +848,4 @@ declare const defaultExecutor: {
842
848
  };
843
849
  declare const execute: (context: unknown, done?: (err: Error | null, res?: unknown) => void) => any;
844
850
  //#endregion
845
- 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 };
851
+ 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 IGasSecuritySummary, 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, getGasSecuritySummary, getStatelessPrefixLength, getTxSecurityWarningByHash, inspectPostExecutionInvariants, inspectTransactionPreFlight, installStateWriteInterceptor, markStatelessPrefix, normalizeActorAddress, normalizeEntityKey, normalizeShortTxType, recordActorSecurityStrike, resetGasSecurityState, resolveGasSecurityConfig, resolveVerifiedStrikeActors, rollbackTrackedStateWrites, scanItxPayloadAnomalies, setTxSecurityWarningForHash, toUnsignedEvidenceKey, tryApplyPreFlightVerifiedSnapshot, verifyAndConsumeUnlinkableGasPass, verifyPaymasterConstraints };