@ocap/types 1.30.26 → 1.31.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.
- package/interfaces/config.ts +44 -2
- package/interfaces/index.ts +3 -0
- package/interfaces/ledger.ts +52 -5
- package/interfaces/resolver.ts +1 -0
- package/interfaces/state.ts +20 -0
- package/lib/trace-type_pb.d.ts +3 -0
- package/lib/type_pb.d.ts +11 -0
- package/package.json +1 -1
package/interfaces/config.ts
CHANGED
|
@@ -49,6 +49,47 @@ export interface IAccountConfig extends Omit<TAccountConfig, 'pk' | 'balance'> {
|
|
|
49
49
|
export interface ITxGasConfig extends Omit<TTxGasConfig, 'minStake' | 'maxStake'> {
|
|
50
50
|
minStake: number;
|
|
51
51
|
maxStake: number;
|
|
52
|
+
/** Max tx size (bytes) eligible for the Stake-for-Gas waiver (default 4096) */
|
|
53
|
+
maxFreeGasTxSize?: number;
|
|
54
|
+
/** Max state ops eligible for the Stake-for-Gas waiver (default 6) */
|
|
55
|
+
maxFreeGasStateOps?: number;
|
|
56
|
+
enforceSponsor3DEligibility?: boolean;
|
|
57
|
+
/** Burst quota sliding window in ms (default 60000) */
|
|
58
|
+
burstWindowMs?: number;
|
|
59
|
+
/** Burst quota: tx per window per sender before stake multiple (default 10) */
|
|
60
|
+
baseBurstAllowance?: number;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Gas security guard configuration (`transaction.security`).
|
|
65
|
+
* Outcomes of executed txs never depend on these process-local counters; they only drive pre-queue admission.
|
|
66
|
+
*/
|
|
67
|
+
export interface ITxSecurityConfig {
|
|
68
|
+
/** Master switch (default true) */
|
|
69
|
+
enabled?: boolean;
|
|
70
|
+
/** Strike-based expiring admission cooldown (default true) */
|
|
71
|
+
throttle?: boolean;
|
|
72
|
+
/** Per-sender burst quota enforced at admission; never reprices gas (default true) */
|
|
73
|
+
burstEscalation?: boolean;
|
|
74
|
+
/** Experimental auto-slash inside a queued tx's own write set (default false) */
|
|
75
|
+
autoSlash?: boolean;
|
|
76
|
+
/** Process-local gas pass nullifier registry (default false, non-deterministic across processes) */
|
|
77
|
+
gasPassNullifierCheck?: boolean;
|
|
78
|
+
strikeOnAllErrors?: boolean;
|
|
79
|
+
/** Admission rejects above baseBurstAllowance x stakeMultiple x this (default 6) */
|
|
80
|
+
burstRejectMultiple?: number;
|
|
81
|
+
/** Aggregate per-delegatee cap across principals = hard limit x this (default 20) */
|
|
82
|
+
delegatedBurstMultiple?: number;
|
|
83
|
+
strikeWindowMs?: number;
|
|
84
|
+
warningThreshold?: number;
|
|
85
|
+
throttleThreshold?: number;
|
|
86
|
+
slashThreshold?: number;
|
|
87
|
+
throttleCooldownMs?: number;
|
|
88
|
+
gasPassEpochSeconds?: number;
|
|
89
|
+
fishermanBountyBps?: number;
|
|
90
|
+
fishermanAddress?: string;
|
|
91
|
+
/** Addresses never struck, throttled or burst-limited (operator infrastructure allowlist) */
|
|
92
|
+
exemptActors?: string[];
|
|
52
93
|
}
|
|
53
94
|
|
|
54
95
|
/**
|
|
@@ -75,8 +116,9 @@ export interface ITransactionConfig extends Omit<TTransactionConfig, 'txFee' | '
|
|
|
75
116
|
delegate: TDelegateConfig;
|
|
76
117
|
supportedTxs: string[];
|
|
77
118
|
multiSignV2Txs: string[];
|
|
78
|
-
/**
|
|
79
|
-
|
|
119
|
+
/** Post-execution write-set ceiling (entries) */
|
|
120
|
+
maxWriteSetSize?: number;
|
|
121
|
+
security?: ITxSecurityConfig;
|
|
80
122
|
}
|
|
81
123
|
|
|
82
124
|
/**
|
package/interfaces/index.ts
CHANGED
|
@@ -67,6 +67,7 @@ export type {
|
|
|
67
67
|
IAccountConfig,
|
|
68
68
|
ITxGasConfig,
|
|
69
69
|
ITxStakeConfig,
|
|
70
|
+
ITxSecurityConfig,
|
|
70
71
|
ITransactionConfig,
|
|
71
72
|
ITokenConfig,
|
|
72
73
|
IVaultsConfig,
|
|
@@ -270,6 +271,8 @@ export type {
|
|
|
270
271
|
ISignedTransactionInput,
|
|
271
272
|
// Storage interface
|
|
272
273
|
ILedgerStorage,
|
|
274
|
+
EntryHashVersion,
|
|
275
|
+
IEntryHashPolicy,
|
|
273
276
|
// Main interface
|
|
274
277
|
ILedger,
|
|
275
278
|
// Factory interface
|
package/interfaces/ledger.ts
CHANGED
|
@@ -42,7 +42,11 @@ export interface ILedgerEntry {
|
|
|
42
42
|
/** Chain DID this entry belongs to */
|
|
43
43
|
chainId: string;
|
|
44
44
|
|
|
45
|
-
/**
|
|
45
|
+
/**
|
|
46
|
+
* Versioned hash of (sequence, txRaw, stateCommitHash) for the Merkle Tree leaf.
|
|
47
|
+
* v1 (legacy, <= 1.30.26): sha256(seq || txRaw || stateCommitHash); v2: length-prefixed framing.
|
|
48
|
+
* The version is a function of `sequence` (see IEntryHashPolicy), never stored per entry.
|
|
49
|
+
*/
|
|
46
50
|
entryHash: string;
|
|
47
51
|
|
|
48
52
|
/** Transaction verification context (passkey, gasStakeHeaders, etc.) */
|
|
@@ -261,10 +265,27 @@ export interface ISignedTransactionInput {
|
|
|
261
265
|
// Storage Interface
|
|
262
266
|
// ============================================================================
|
|
263
267
|
|
|
268
|
+
/** Entry hash format version. 1 = legacy concatenation, 2 = length-prefixed framing. */
|
|
269
|
+
export type EntryHashVersion = 1 | 2;
|
|
270
|
+
|
|
271
|
+
/**
|
|
272
|
+
* Per-chain entry hash policy. Entries with `sequence >= v2From` are hashed with v2, earlier ones with v1.
|
|
273
|
+
* `v2From = Infinity` means the chain is still fully legacy (v2 not activated).
|
|
274
|
+
*/
|
|
275
|
+
export interface IEntryHashPolicy {
|
|
276
|
+
readonly v2From: number;
|
|
277
|
+
versionFor(sequence: number): EntryHashVersion;
|
|
278
|
+
/** Re-derive the policy from stored data (after bulk imports / reset). */
|
|
279
|
+
resolve?(storage: ILedgerStorage): Promise<unknown>;
|
|
280
|
+
}
|
|
281
|
+
|
|
264
282
|
/**
|
|
265
283
|
* Storage adapter interface - SQLite/Dolt implement this
|
|
266
284
|
*/
|
|
267
285
|
export interface ILedgerStorage {
|
|
286
|
+
/** Entry hash policy used by this storage for append/finalize (optional; absent = v2 everywhere). */
|
|
287
|
+
getEntryHashPolicy?(): IEntryHashPolicy;
|
|
288
|
+
|
|
268
289
|
// Entry operations
|
|
269
290
|
appendEntries(entries: ILedgerEntry[]): Promise<void>;
|
|
270
291
|
|
|
@@ -395,7 +416,10 @@ export interface IVerifyTxInclusionParams {
|
|
|
395
416
|
txHash?: string;
|
|
396
417
|
|
|
397
418
|
/** Ledger entry returned by getLedgerEntry */
|
|
398
|
-
entry: Pick<ILedgerEntry, 'sequence' | 'hash' | 'txRaw' | 'entryHash' | 'stateCommitHash' | 'finalized'
|
|
419
|
+
entry: Pick<ILedgerEntry, 'sequence' | 'hash' | 'txRaw' | 'entryHash' | 'stateCommitHash' | 'finalized'> &
|
|
420
|
+
Partial<Pick<ILedgerEntry, 'from' | 'pk' | 'signature' | 'tx' | 'txType' | 'chainId'>> & {
|
|
421
|
+
nonce?: number | string;
|
|
422
|
+
};
|
|
399
423
|
|
|
400
424
|
/** Merkle inclusion proof returned by getMerkleProof */
|
|
401
425
|
proof: IMerkleProof;
|
|
@@ -429,6 +453,28 @@ export interface IVerifyTxInclusionParams {
|
|
|
429
453
|
*/
|
|
430
454
|
verifyTxRawHash?: boolean;
|
|
431
455
|
|
|
456
|
+
/**
|
|
457
|
+
* Controls verification of decoded entry fields (`entry.tx`, `from`, `pk`, `nonce`, `signature`,
|
|
458
|
+
* `txType`, `chainId`) against `entry.txRaw` (#1139).
|
|
459
|
+
* - `undefined` (default): automatically decodes `txRaw` when it is an OCAP wire transaction
|
|
460
|
+
* (CBOR/Protobuf) or a canonical JSON payload (`EmbeddedLedger`/`WalletLedger`) and rejects any
|
|
461
|
+
* mismatch on present `entry` fields.
|
|
462
|
+
* - `true`: strictly requires `txRaw` to be decodable and rejects if decoding fails or any present
|
|
463
|
+
* field mismatches.
|
|
464
|
+
* - `false`: skips decoded-field comparison.
|
|
465
|
+
*/
|
|
466
|
+
verifyDecodedEntry?: boolean;
|
|
467
|
+
|
|
468
|
+
/**
|
|
469
|
+
* Entry hash versioning (#1337). Entries with `sequence >= entryHashV2From` must be v2
|
|
470
|
+
* (length-prefixed) and earlier ones v1 (legacy, <= 1.30.26). When omitted the verifier accepts
|
|
471
|
+
* either format (v2 first, then legacy v1), which keeps historical proofs verifying.
|
|
472
|
+
*/
|
|
473
|
+
entryHashV2From?: number;
|
|
474
|
+
|
|
475
|
+
/** Set false to refuse legacy v1 entry hashes when `entryHashV2From` is unknown (default true). */
|
|
476
|
+
allowLegacyEntryHash?: boolean;
|
|
477
|
+
|
|
432
478
|
/** Optional k-of-n witness cosigning threshold (default 0) */
|
|
433
479
|
witnessQuorum?: number;
|
|
434
480
|
|
|
@@ -442,13 +488,14 @@ export interface IVerifyTxInclusionParams {
|
|
|
442
488
|
/**
|
|
443
489
|
* Result of `verifyTxInclusion`.
|
|
444
490
|
*
|
|
445
|
-
*
|
|
446
|
-
* `entry.tx`, `from`, `pk`, `nonce
|
|
447
|
-
* fields
|
|
491
|
+
* When `txRaw` is an OCAP wire transaction (CBOR/Protobuf) or canonical JSON payload, `verifyTxInclusion`
|
|
492
|
+
* decodes `txRaw`, verifies any present `entry.tx`, `from`, `pk`, `nonce`, `signature`, `txType`, and
|
|
493
|
+
* `chainId` fields against the decoded payload (#1139), and exposes the verified payload on `decodedTx`.
|
|
448
494
|
*/
|
|
449
495
|
export interface IVerifyTxInclusionResult {
|
|
450
496
|
verified: boolean;
|
|
451
497
|
reason?: string;
|
|
498
|
+
decodedTx?: Record<string, unknown>;
|
|
452
499
|
}
|
|
453
500
|
|
|
454
501
|
/**
|
package/interfaces/resolver.ts
CHANGED
package/interfaces/state.ts
CHANGED
|
@@ -23,10 +23,19 @@ import type {
|
|
|
23
23
|
TVariableInput,
|
|
24
24
|
} from '../lib/type_pb';
|
|
25
25
|
|
|
26
|
+
/** Per-revoke accounting entry for stake state (#1352) */
|
|
27
|
+
export interface IStakeRevokeEntry {
|
|
28
|
+
txTime: string;
|
|
29
|
+
tokens?: TokenBalanceMap;
|
|
30
|
+
assets?: string[];
|
|
31
|
+
}
|
|
32
|
+
|
|
26
33
|
/** Storage format with ISO 8601 string timestamps */
|
|
27
34
|
export interface IStateContext extends Omit<TStateContext, 'genesisTime' | 'renaissanceTime'> {
|
|
28
35
|
genesisTime: string;
|
|
29
36
|
renaissanceTime: string;
|
|
37
|
+
/** Per-revoke accounting keyed by revoke tx hash (#1352) */
|
|
38
|
+
revokes?: Record<string, IStakeRevokeEntry>;
|
|
30
39
|
}
|
|
31
40
|
|
|
32
41
|
export interface IStateContextInput {
|
|
@@ -213,6 +222,16 @@ export interface IDelegationTokenLimit {
|
|
|
213
222
|
txSent?: number;
|
|
214
223
|
lastTx?: number;
|
|
215
224
|
spentAllowance?: string;
|
|
225
|
+
maxPerTx?: string;
|
|
226
|
+
windowLimit?: string;
|
|
227
|
+
windowSeconds?: number;
|
|
228
|
+
windowStart?: number;
|
|
229
|
+
windowSpent?: string;
|
|
230
|
+
coSignAllowance?: string;
|
|
231
|
+
coSignRequired?: boolean;
|
|
232
|
+
requirePinnedPayee?: boolean;
|
|
233
|
+
notifyBeforeDebit?: boolean;
|
|
234
|
+
notifyLeadSeconds?: number;
|
|
216
235
|
}
|
|
217
236
|
|
|
218
237
|
/** Asset limit in delegation ops */
|
|
@@ -230,6 +249,7 @@ export interface IDelegationAssetLimit {
|
|
|
230
249
|
export interface IDelegationOpLimit {
|
|
231
250
|
tokens?: IDelegationTokenLimit[];
|
|
232
251
|
assets?: IDelegationAssetLimit[];
|
|
252
|
+
unlimited?: boolean;
|
|
233
253
|
}
|
|
234
254
|
|
|
235
255
|
/** Delegation ops: typeUrl -> operation with limits */
|
package/lib/trace-type_pb.d.ts
CHANGED
|
@@ -48,6 +48,7 @@ export type TAccountFilter = {
|
|
|
48
48
|
|
|
49
49
|
export type TTxFilter = {
|
|
50
50
|
txs: Array<string>,
|
|
51
|
+
gasPayer?: string,
|
|
51
52
|
}
|
|
52
53
|
|
|
53
54
|
export type TRollupFilter = {
|
|
@@ -72,6 +73,7 @@ export type TAddressFilter = {
|
|
|
72
73
|
sender: string,
|
|
73
74
|
receiver: string,
|
|
74
75
|
direction: DirectionMap[keyof DirectionMap],
|
|
76
|
+
gasPayer?: string,
|
|
75
77
|
}
|
|
76
78
|
|
|
77
79
|
export type TPageInfo = {
|
|
@@ -124,6 +126,7 @@ export type TIndexedTransaction = {
|
|
|
124
126
|
code: enum_pb.StatusCodeMap[keyof enum_pb.StatusCodeMap],
|
|
125
127
|
tokenSymbols: Array<TTokenMeta>,
|
|
126
128
|
receipts: Array<type_pb.TTransactionReceipt>,
|
|
129
|
+
gasPayer?: string,
|
|
127
130
|
}
|
|
128
131
|
|
|
129
132
|
export type TIndexedAccountState = {
|
package/lib/type_pb.d.ts
CHANGED
|
@@ -459,6 +459,16 @@ export type TTokenLimit = {
|
|
|
459
459
|
lastTx: number,
|
|
460
460
|
decimal: number,
|
|
461
461
|
symbol: string,
|
|
462
|
+
maxPerTx?: string,
|
|
463
|
+
windowLimit?: string,
|
|
464
|
+
windowSeconds?: number,
|
|
465
|
+
windowStart?: number,
|
|
466
|
+
windowSpent?: string,
|
|
467
|
+
coSignAllowance?: string,
|
|
468
|
+
coSignRequired?: boolean,
|
|
469
|
+
requirePinnedPayee?: boolean,
|
|
470
|
+
notifyBeforeDebit?: boolean,
|
|
471
|
+
notifyLeadSeconds?: number,
|
|
462
472
|
}
|
|
463
473
|
|
|
464
474
|
export type TAssetLimit = {
|
|
@@ -474,6 +484,7 @@ export type TAssetLimit = {
|
|
|
474
484
|
export type TDelegateLimit = {
|
|
475
485
|
tokens: Array<TTokenLimit>,
|
|
476
486
|
assets: Array<TAssetLimit>,
|
|
487
|
+
unlimited?: boolean,
|
|
477
488
|
}
|
|
478
489
|
|
|
479
490
|
export type TCurveConfig = {
|