@ocap/tx-pipeline 1.30.26 → 1.31.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm/appchain-sovereign-hub.d.mts +160 -0
- package/esm/appchain-sovereign-hub.mjs +348 -0
- package/esm/arcvault-external-adapter.d.mts +166 -0
- package/esm/arcvault-external-adapter.mjs +376 -0
- package/esm/encrypted-nft-envelope.d.mts +172 -0
- package/esm/encrypted-nft-envelope.mjs +458 -0
- package/esm/evm-simplified-bridge.d.mts +1370 -0
- package/esm/evm-simplified-bridge.mjs +3875 -0
- package/esm/give-to-mint-karma.d.mts +472 -0
- package/esm/give-to-mint-karma.mjs +1057 -0
- package/esm/helpers/replay-guard.d.mts +15 -0
- package/esm/helpers/replay-guard.mjs +23 -0
- package/esm/index.d.mts +10 -5
- package/esm/index.mjs +14 -10
- package/esm/legacy-protocol-sunset.d.mts +251 -0
- package/esm/legacy-protocol-sunset.mjs +1519 -0
- package/esm/library.d.mts +16 -0
- package/esm/library.mjs +17 -0
- package/esm/native-abt-exchange.d.mts +2055 -0
- package/esm/native-abt-exchange.mjs +7250 -0
- package/esm/ofac-screening.d.mts +17 -0
- package/esm/ofac-screening.mjs +39 -0
- package/esm/pipes/anti-land-attack.mjs +1 -1
- package/esm/pipes/decode-itx.mjs +43 -4
- package/esm/pipes/decode-tx.d.mts +2 -3
- package/esm/pipes/decode-tx.mjs +53 -115
- package/esm/pipes/extract-signer.mjs +2 -2
- package/esm/pipes/extract-state.mjs +14 -3
- package/esm/pipes/post-execution-invariant-gate.d.mts +61 -0
- package/esm/pipes/post-execution-invariant-gate.mjs +789 -0
- package/esm/pipes/pre-flight-waf.d.mts +34 -0
- package/esm/pipes/pre-flight-waf.mjs +603 -0
- package/esm/pipes/take-state-snapshot.mjs +3 -2
- package/esm/pipes/update-owner.mjs +39 -4
- package/esm/pipes/verify-account-migration.mjs +14 -4
- package/esm/pipes/verify-blocked.mjs +1 -1
- package/esm/pipes/verify-delegation.d.mts +22 -3
- package/esm/pipes/verify-delegation.mjs +259 -36
- package/esm/pipes/verify-list-size.mjs +1 -1
- package/esm/pipes/verify-multisig-v2.mjs +15 -7
- package/esm/pipes/verify-multisig.mjs +15 -7
- package/esm/pipes/verify-sender.mjs +1 -1
- package/esm/pipes/verify-signature.mjs +35 -6
- package/esm/pipes/verify-signer.mjs +2 -2
- package/esm/pipes/verify-state-diff.mjs +3 -3
- package/esm/pipes/verify-token-access.mjs +1 -1
- package/esm/pipes/verify-token-balance.mjs +13 -5
- package/esm/pipes/verify-transferrable.d.mts +8 -1
- package/esm/pipes/verify-transferrable.mjs +3 -3
- package/esm/pipes/verify-tx-input.mjs +2 -2
- package/esm/pipes/verify-tx-size.mjs +46 -2
- package/esm/pipes/verify-tx.mjs +5 -7
- package/esm/pipes/verify-updater.mjs +1 -1
- package/esm/social-economy-factories.d.mts +346 -0
- package/esm/social-economy-factories.mjs +845 -0
- package/esm/super-suites-foundation.d.mts +513 -0
- package/esm/super-suites-foundation.mjs +1241 -0
- package/esm/transaction-block.d.mts +471 -0
- package/esm/transaction-block.mjs +1906 -0
- package/esm/uniswap-erc7683-solver.d.mts +201 -0
- package/esm/uniswap-erc7683-solver.mjs +321 -0
- package/esm/uniswap-lp-copilot.d.mts +113 -0
- package/esm/uniswap-lp-copilot.mjs +320 -0
- package/esm/uniswap-router.d.mts +335 -0
- package/esm/uniswap-router.mjs +578 -0
- package/esm/uniswap-token-factory-graduation.d.mts +187 -0
- package/esm/uniswap-token-factory-graduation.mjs +426 -0
- package/esm/uniswap-v4-hook.d.mts +173 -0
- package/esm/uniswap-v4-hook.mjs +517 -0
- package/lib/appchain-sovereign-hub.cjs +352 -0
- package/lib/appchain-sovereign-hub.d.cts +160 -0
- package/lib/arcvault-external-adapter.cjs +383 -0
- package/lib/arcvault-external-adapter.d.cts +166 -0
- package/lib/encrypted-nft-envelope.cjs +477 -0
- package/lib/encrypted-nft-envelope.d.cts +172 -0
- package/lib/evm-simplified-bridge.cjs +3943 -0
- package/lib/evm-simplified-bridge.d.cts +1370 -0
- package/lib/give-to-mint-karma.cjs +1084 -0
- package/lib/give-to-mint-karma.d.cts +472 -0
- package/lib/helpers/replay-guard.cjs +27 -0
- package/lib/helpers/replay-guard.d.cts +15 -0
- package/lib/index.cjs +49 -16
- package/lib/index.d.cts +10 -5
- package/lib/legacy-protocol-sunset.cjs +1543 -0
- package/lib/legacy-protocol-sunset.d.cts +251 -0
- package/lib/library.cjs +303 -0
- package/lib/library.d.cts +16 -0
- package/lib/native-abt-exchange.cjs +7322 -0
- package/lib/native-abt-exchange.d.cts +2055 -0
- package/lib/ofac-screening.cjs +42 -0
- package/lib/ofac-screening.d.cts +17 -0
- package/lib/pipes/anti-land-attack.cjs +2 -2
- package/lib/pipes/decode-itx.cjs +43 -4
- package/lib/pipes/decode-itx.d.cts +1 -1
- package/lib/pipes/decode-tx.cjs +52 -116
- package/lib/pipes/decode-tx.d.cts +3 -4
- package/lib/pipes/extract-signer.cjs +2 -2
- package/lib/pipes/extract-state.cjs +14 -3
- package/lib/pipes/post-execution-invariant-gate.cjs +800 -0
- package/lib/pipes/post-execution-invariant-gate.d.cts +61 -0
- package/lib/pipes/pre-flight-waf.cjs +616 -0
- package/lib/pipes/pre-flight-waf.d.cts +34 -0
- package/lib/pipes/take-state-snapshot.cjs +3 -2
- package/lib/pipes/update-owner.cjs +40 -5
- package/lib/pipes/update-owner.d.cts +1 -1
- package/lib/pipes/verify-account-migration.cjs +14 -4
- package/lib/pipes/verify-blocked.cjs +1 -1
- package/lib/pipes/verify-delegation.cjs +259 -36
- package/lib/pipes/verify-delegation.d.cts +22 -3
- package/lib/pipes/verify-list-size.cjs +1 -1
- package/lib/pipes/verify-multisig-v2.cjs +15 -7
- package/lib/pipes/verify-multisig.cjs +15 -7
- package/lib/pipes/verify-sender.cjs +1 -1
- package/lib/pipes/verify-service-fee.d.cts +1 -1
- package/lib/pipes/verify-signature.cjs +35 -6
- package/lib/pipes/verify-signature.d.cts +1 -1
- package/lib/pipes/verify-signer.cjs +2 -2
- package/lib/pipes/verify-state-diff.cjs +4 -4
- package/lib/pipes/verify-token-access.cjs +2 -2
- package/lib/pipes/verify-token-balance.cjs +13 -5
- package/lib/pipes/verify-transferrable.cjs +3 -3
- package/lib/pipes/verify-transferrable.d.cts +8 -1
- package/lib/pipes/verify-tx-input.cjs +3 -3
- package/lib/pipes/verify-tx-size.cjs +46 -2
- package/lib/pipes/verify-tx-size.d.cts +1 -1
- package/lib/pipes/verify-tx.cjs +6 -8
- package/lib/pipes/verify-tx.d.cts +1 -1
- package/lib/pipes/verify-updater.cjs +1 -1
- package/lib/social-economy-factories.cjs +852 -0
- package/lib/social-economy-factories.d.cts +346 -0
- package/lib/super-suites-foundation.cjs +1257 -0
- package/lib/super-suites-foundation.d.cts +513 -0
- package/lib/transaction-block.cjs +1941 -0
- package/lib/transaction-block.d.cts +471 -0
- package/lib/uniswap-erc7683-solver.cjs +327 -0
- package/lib/uniswap-erc7683-solver.d.cts +201 -0
- package/lib/uniswap-lp-copilot.cjs +328 -0
- package/lib/uniswap-lp-copilot.d.cts +113 -0
- package/lib/uniswap-router.cjs +593 -0
- package/lib/uniswap-router.d.cts +335 -0
- package/lib/uniswap-token-factory-graduation.cjs +431 -0
- package/lib/uniswap-token-factory-graduation.d.cts +187 -0
- package/lib/uniswap-v4-hook.cjs +527 -0
- package/lib/uniswap-v4-hook.d.cts +173 -0
- package/package.json +11 -10
- package/esm/helpers/dedup-height.d.mts +0 -16
- package/esm/helpers/dedup-height.mjs +0 -61
- package/lib/helpers/dedup-height.cjs +0 -72
- package/lib/helpers/dedup-height.d.cts +0 -16
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { PipeFunction } from "../runner.cjs";
|
|
2
|
+
import { IBaseContext, IReadyContext } from "@ocap/types";
|
|
3
|
+
|
|
4
|
+
//#region src/pipes/post-execution-invariant-gate.d.ts
|
|
5
|
+
declare const MAX_POST_EXECUTION_WRITE_SET_ENTRIES = 256;
|
|
6
|
+
declare const TRACKED_STATE_TABLES: readonly ["account", "stake", "token", "tokenFactory", "asset", "factory", "delegation", "rollup", "rollupBlock", "evidence", "balance"];
|
|
7
|
+
type TrackedStateTable = (typeof TRACKED_STATE_TABLES)[number];
|
|
8
|
+
interface IStateWriteTracker {
|
|
9
|
+
beforeStates: Map<TrackedStateTable, Map<string, Record<string, unknown> | null>>;
|
|
10
|
+
afterStates: Map<TrackedStateTable, Map<string, Record<string, unknown>>>;
|
|
11
|
+
writtenKeys: Map<TrackedStateTable, Set<string>>;
|
|
12
|
+
addressAliases: Map<string, string>;
|
|
13
|
+
totalWriteOps: number;
|
|
14
|
+
unauthorizedDeletions: number;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Canonicalizes a DID or hex address key so that `did:abt:` prefixes and
|
|
18
|
+
* Ethereum hex casing (`0xabc...` vs EIP-55 `0xAbC...`) always map to a single
|
|
19
|
+
* deterministic key across `beforeStates`, `afterStates`, `stateSnapshot`,
|
|
20
|
+
* and token balance maps.
|
|
21
|
+
*/
|
|
22
|
+
declare function normalizeEntityKey(rawKey: unknown): string;
|
|
23
|
+
/**
|
|
24
|
+
* Installs a non-mutating Proxy interceptor over `context.statedb` so every
|
|
25
|
+
* state read (`get`) and state write (`create`, `update`, `updateOrCreate`)
|
|
26
|
+
* during protocol execution is captured in `context._stateWriteTracker`.
|
|
27
|
+
*
|
|
28
|
+
* Even if a protocol mutates a state record in `statedb` without assigning the
|
|
29
|
+
* resulting object back onto `context`, the interceptor captures both the
|
|
30
|
+
* pre-mutation snapshot and the post-mutation state for Gate 2 verification.
|
|
31
|
+
*/
|
|
32
|
+
declare function installStateWriteInterceptor<TContext extends IBaseContext = IBaseContext>(context: TContext): IStateWriteTracker;
|
|
33
|
+
/**
|
|
34
|
+
* Rolls back all tracked `statedb` writes recorded in `context._stateWriteTracker`
|
|
35
|
+
* to their pre-execution `beforeStates` (or deletes newly created records).
|
|
36
|
+
*
|
|
37
|
+
* Used by the non-`runAsLambda` execution fallback path in `execute.ts` when a
|
|
38
|
+
* protocol or Gate 2 (`inspectPostExecutionInvariants`) fails after partial or
|
|
39
|
+
* complete `statedb` writes, guaranteeing that no invariant-violating state
|
|
40
|
+
* remains in `statedb` before `ensureGasFeePaid` runs.
|
|
41
|
+
*/
|
|
42
|
+
declare function rollbackTrackedStateWrites<TContext extends IBaseContext = IBaseContext>(context: TContext): Promise<void>;
|
|
43
|
+
/**
|
|
44
|
+
* Synchronous/stateless Post-Execution Invariant Gate (Gate 2) verifier.
|
|
45
|
+
*
|
|
46
|
+
* Enforces the 5 Hard Invariants across the transaction's before/after state set:
|
|
47
|
+
* 1. Token Zero-Sum Conservation across `account.tokens + stake.tokens + stake.revokedTokens + tokenFactory.reserveBalance`
|
|
48
|
+
* 2. Official Token (`config.token.address`) Immutable Supply & Non-Negative Canonical Balances
|
|
49
|
+
* 3. Asset Conservation, Non-Destruction (`readonly: true`, `transferrable: false`, `consumedTime`) & Stake Asset Bijection
|
|
50
|
+
* 4. Protocol Stake Protection (`revocable === false` cannot be unlocked or drained)
|
|
51
|
+
* 5. Tombstone Account Protection (`migratedTo.length > 0`), Sender Nonce Monotonicity & RW-Set Containment
|
|
52
|
+
*/
|
|
53
|
+
declare function inspectPostExecutionInvariants(context: IBaseContext): void;
|
|
54
|
+
/**
|
|
55
|
+
* Pipeline pipe wrapper around `inspectPostExecutionInvariants`.
|
|
56
|
+
* Can be used directly in a `Runner` pipeline or invoked by `execute.ts`
|
|
57
|
+
* immediately after `protocol.run` and before `statedb.tx.create`.
|
|
58
|
+
*/
|
|
59
|
+
declare function CreatePostExecutionInvariantGatePipe<TContext extends IReadyContext = IReadyContext>(): PipeFunction<TContext>;
|
|
60
|
+
//#endregion
|
|
61
|
+
export { CreatePostExecutionInvariantGatePipe, CreatePostExecutionInvariantGatePipe as default, IStateWriteTracker, MAX_POST_EXECUTION_WRITE_SET_ENTRIES, TRACKED_STATE_TABLES, TrackedStateTable, inspectPostExecutionInvariants, installStateWriteInterceptor, normalizeEntityKey, rollbackTrackedStateWrites };
|