@ocap/config 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/esm/default.d.mts +37 -1
- package/esm/default.mjs +37 -1
- package/esm/index.d.mts +3 -2
- package/esm/index.mjs +2 -2
- package/esm/schema.d.mts +25 -1
- package/esm/schema.mjs +26 -2
- package/esm/types.d.mts +2 -2
- package/lib/default.cjs +38 -1
- package/lib/default.d.cts +37 -1
- package/lib/index.cjs +1 -0
- package/lib/index.d.cts +3 -2
- package/lib/schema.cjs +26 -2
- package/lib/schema.d.cts +25 -1
- package/lib/types.d.cts +2 -2
- package/package.json +6 -6
package/esm/default.d.mts
CHANGED
|
@@ -2,5 +2,41 @@ import { IDefaultConfig } from "./types.mjs";
|
|
|
2
2
|
|
|
3
3
|
//#region src/default.d.ts
|
|
4
4
|
declare const defaultConfig: IDefaultConfig;
|
|
5
|
+
/**
|
|
6
|
+
* Documented defaults for the gas security knobs (`transaction.txGas.*` free-gas/burst limits and
|
|
7
|
+
* `transaction.security.*`). They are deliberately NOT merged into `defaultConfig` so `create()` output (and
|
|
8
|
+
* therefore existing chain config snapshots) stays unchanged; the guard in `@ocap/tx-protocols`
|
|
9
|
+
* (`resolveGasSecurityConfig`) applies these exact values when a key is absent. A parity test pins both copies.
|
|
10
|
+
*
|
|
11
|
+
* Everything here is either a pure function of the tx or an ADMISSION-only (pre-queue) decision; none of it
|
|
12
|
+
* changes gas, waivers or receipts of an admitted tx.
|
|
13
|
+
*/
|
|
14
|
+
declare const defaultGasSecurityKnobs: {
|
|
15
|
+
readonly txGas: {
|
|
16
|
+
readonly maxFreeGasTxSize: 4096;
|
|
17
|
+
readonly maxFreeGasStateOps: 6;
|
|
18
|
+
readonly enforceSponsor3DEligibility: false;
|
|
19
|
+
readonly burstWindowMs: 60000;
|
|
20
|
+
readonly baseBurstAllowance: 10;
|
|
21
|
+
};
|
|
22
|
+
readonly security: {
|
|
23
|
+
readonly enabled: true;
|
|
24
|
+
readonly throttle: true;
|
|
25
|
+
readonly burstEscalation: true;
|
|
26
|
+
readonly autoSlash: false;
|
|
27
|
+
readonly gasPassNullifierCheck: false;
|
|
28
|
+
readonly strikeOnAllErrors: false;
|
|
29
|
+
readonly burstRejectMultiple: 100;
|
|
30
|
+
readonly delegatedBurstMultiple: 20;
|
|
31
|
+
readonly strikeWindowMs: 600000;
|
|
32
|
+
readonly warningThreshold: 2;
|
|
33
|
+
readonly throttleThreshold: 5;
|
|
34
|
+
readonly slashThreshold: 10;
|
|
35
|
+
readonly throttleCooldownMs: 15000;
|
|
36
|
+
readonly gasPassEpochSeconds: 60;
|
|
37
|
+
readonly fishermanBountyBps: 1000;
|
|
38
|
+
readonly exemptActors: string[];
|
|
39
|
+
};
|
|
40
|
+
};
|
|
5
41
|
//#endregion
|
|
6
|
-
export { defaultConfig as default };
|
|
42
|
+
export { defaultConfig as default, defaultGasSecurityKnobs };
|
package/esm/default.mjs
CHANGED
|
@@ -173,7 +173,43 @@ const defaultConfig = {
|
|
|
173
173
|
inflationRate: 0
|
|
174
174
|
}
|
|
175
175
|
};
|
|
176
|
+
/**
|
|
177
|
+
* Documented defaults for the gas security knobs (`transaction.txGas.*` free-gas/burst limits and
|
|
178
|
+
* `transaction.security.*`). They are deliberately NOT merged into `defaultConfig` so `create()` output (and
|
|
179
|
+
* therefore existing chain config snapshots) stays unchanged; the guard in `@ocap/tx-protocols`
|
|
180
|
+
* (`resolveGasSecurityConfig`) applies these exact values when a key is absent. A parity test pins both copies.
|
|
181
|
+
*
|
|
182
|
+
* Everything here is either a pure function of the tx or an ADMISSION-only (pre-queue) decision; none of it
|
|
183
|
+
* changes gas, waivers or receipts of an admitted tx.
|
|
184
|
+
*/
|
|
185
|
+
const defaultGasSecurityKnobs = {
|
|
186
|
+
txGas: {
|
|
187
|
+
maxFreeGasTxSize: 4096,
|
|
188
|
+
maxFreeGasStateOps: 6,
|
|
189
|
+
enforceSponsor3DEligibility: false,
|
|
190
|
+
burstWindowMs: 6e4,
|
|
191
|
+
baseBurstAllowance: 10
|
|
192
|
+
},
|
|
193
|
+
security: {
|
|
194
|
+
enabled: true,
|
|
195
|
+
throttle: true,
|
|
196
|
+
burstEscalation: true,
|
|
197
|
+
autoSlash: false,
|
|
198
|
+
gasPassNullifierCheck: false,
|
|
199
|
+
strikeOnAllErrors: false,
|
|
200
|
+
burstRejectMultiple: 100,
|
|
201
|
+
delegatedBurstMultiple: 20,
|
|
202
|
+
strikeWindowMs: 6e5,
|
|
203
|
+
warningThreshold: 2,
|
|
204
|
+
throttleThreshold: 5,
|
|
205
|
+
slashThreshold: 10,
|
|
206
|
+
throttleCooldownMs: 15e3,
|
|
207
|
+
gasPassEpochSeconds: 60,
|
|
208
|
+
fishermanBountyBps: 1e3,
|
|
209
|
+
exemptActors: []
|
|
210
|
+
}
|
|
211
|
+
};
|
|
176
212
|
var default_default = defaultConfig;
|
|
177
213
|
|
|
178
214
|
//#endregion
|
|
179
|
-
export { default_default as default };
|
|
215
|
+
export { default_default as default, defaultGasSecurityKnobs };
|
package/esm/index.d.mts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { ChainMode, IAccountConfig, IChainConfig, IChainConfigInput, IDefaultConfig, ITokenConfig, ITokenItx, ITransactionConfig, ITxGasConfig, ITxStakeConfig, IVaultsConfig, TDelegateConfig, TForeignToken, TxTypeMap, TxTypeUrl } from "./types.mjs";
|
|
1
|
+
import { ChainMode, IAccountConfig, IChainConfig, IChainConfigInput, IDefaultConfig, ITokenConfig, ITokenItx, ITransactionConfig, ITxGasConfig, ITxSecurityConfig, ITxStakeConfig, IVaultsConfig, TDelegateConfig, TForeignToken, TxTypeMap, TxTypeUrl } from "./types.mjs";
|
|
2
|
+
import { defaultGasSecurityKnobs } from "./default.mjs";
|
|
2
3
|
|
|
3
4
|
//#region src/index.d.ts
|
|
4
5
|
declare const validate: (config: Partial<IChainConfig>) => IChainConfig;
|
|
5
6
|
declare const create: (props: IChainConfigInput) => IChainConfig;
|
|
6
7
|
declare const genTokenItx: (config: IChainConfig) => ITokenItx;
|
|
7
8
|
//#endregion
|
|
8
|
-
export { ChainMode, IAccountConfig, IChainConfig, IChainConfigInput, IDefaultConfig, ITokenConfig, ITokenItx, ITransactionConfig, ITxGasConfig, ITxStakeConfig, IVaultsConfig, TDelegateConfig, TForeignToken, TxTypeMap, TxTypeUrl, create, genTokenItx, validate };
|
|
9
|
+
export { ChainMode, IAccountConfig, IChainConfig, IChainConfigInput, IDefaultConfig, ITokenConfig, ITokenItx, ITransactionConfig, ITxGasConfig, ITxSecurityConfig, ITxStakeConfig, IVaultsConfig, TDelegateConfig, TForeignToken, TxTypeMap, TxTypeUrl, create, defaultGasSecurityKnobs, genTokenItx, validate };
|
package/esm/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import default_default from "./default.mjs";
|
|
1
|
+
import default_default, { defaultGasSecurityKnobs } from "./default.mjs";
|
|
2
2
|
import schema_default, { decodePublicKeyCandidates } from "./schema.mjs";
|
|
3
3
|
import { isFromPublicKey, isValid, toTypeInfoStr } from "@arcblock/did";
|
|
4
4
|
import { toTokenAddress } from "@arcblock/did-util";
|
|
@@ -74,4 +74,4 @@ const genTokenItx = (config) => {
|
|
|
74
74
|
};
|
|
75
75
|
|
|
76
76
|
//#endregion
|
|
77
|
-
export { create, genTokenItx, validate };
|
|
77
|
+
export { create, defaultGasSecurityKnobs, genTokenItx, validate };
|
package/esm/schema.d.mts
CHANGED
|
@@ -18,7 +18,6 @@ declare const configSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
|
18
18
|
}, undefined>;
|
|
19
19
|
readonly supportedTxs: v.SchemaWithPipe<readonly [v.ArraySchema<v.StringSchema<undefined>, undefined>, v.MinLengthAction<string[], 1, undefined>]>;
|
|
20
20
|
readonly multiSignV2Txs: v.SchemaWithPipe<readonly [v.ArraySchema<v.StringSchema<undefined>, undefined>, v.MinLengthAction<string[], 1, undefined>]>;
|
|
21
|
-
readonly unsignedTxHashDedupHeight: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>, undefined>;
|
|
22
21
|
readonly txFee: v.RecordSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, undefined>]>, v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, 0, undefined>]>, undefined>;
|
|
23
22
|
readonly txGas: v.OptionalSchema<v.ObjectSchema<{
|
|
24
23
|
readonly price: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
@@ -28,6 +27,31 @@ declare const configSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
|
28
27
|
readonly minStake: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 1, undefined>]>;
|
|
29
28
|
readonly maxStake: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 1, undefined>]>;
|
|
30
29
|
readonly stakeLockPeriod: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 1, undefined>]>;
|
|
30
|
+
readonly maxFreeGasTxSize: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 1, undefined>]>, undefined>;
|
|
31
|
+
readonly maxFreeGasStateOps: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 1, undefined>]>, undefined>;
|
|
32
|
+
readonly enforceSponsor3DEligibility: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
|
|
33
|
+
readonly burstWindowMs: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 1, undefined>]>, undefined>;
|
|
34
|
+
readonly baseBurstAllowance: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 1, undefined>]>, undefined>;
|
|
35
|
+
}, undefined>, undefined>;
|
|
36
|
+
readonly maxWriteSetSize: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 1, undefined>]>, undefined>;
|
|
37
|
+
readonly security: v.OptionalSchema<v.ObjectSchema<{
|
|
38
|
+
readonly enabled: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
|
|
39
|
+
readonly throttle: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
|
|
40
|
+
readonly burstEscalation: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
|
|
41
|
+
readonly autoSlash: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
|
|
42
|
+
readonly gasPassNullifierCheck: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
|
|
43
|
+
readonly strikeOnAllErrors: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
|
|
44
|
+
readonly burstRejectMultiple: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, 1, undefined>]>, undefined>;
|
|
45
|
+
readonly delegatedBurstMultiple: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, 1, undefined>]>, undefined>;
|
|
46
|
+
readonly strikeWindowMs: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 1, undefined>]>, undefined>;
|
|
47
|
+
readonly warningThreshold: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 1, undefined>]>, undefined>;
|
|
48
|
+
readonly throttleThreshold: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 1, undefined>]>, undefined>;
|
|
49
|
+
readonly slashThreshold: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 1, undefined>]>, undefined>;
|
|
50
|
+
readonly throttleCooldownMs: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 1, undefined>]>, undefined>;
|
|
51
|
+
readonly gasPassEpochSeconds: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 1, undefined>]>, undefined>;
|
|
52
|
+
readonly fishermanBountyBps: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>, v.MaxValueAction<number, 5000, undefined>]>, undefined>;
|
|
53
|
+
readonly fishermanAddress: v.OptionalSchema<any, undefined>;
|
|
54
|
+
readonly exemptActors: v.OptionalSchema<v.ArraySchema<any, undefined>, undefined>;
|
|
31
55
|
}, undefined>, undefined>;
|
|
32
56
|
readonly txStake: v.OptionalSchema<v.ObjectSchema<{
|
|
33
57
|
readonly createToken: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 1, undefined>]>;
|
package/esm/schema.mjs
CHANGED
|
@@ -60,7 +60,6 @@ const configSchema = v.pipe(v.object({
|
|
|
60
60
|
}),
|
|
61
61
|
supportedTxs: v.pipe(v.array(v.string()), v.minLength(1)),
|
|
62
62
|
multiSignV2Txs: v.pipe(v.array(v.string()), v.minLength(1)),
|
|
63
|
-
unsignedTxHashDedupHeight: v.optional(v.pipe(v.number(), v.integer(), v.minValue(0))),
|
|
64
63
|
txFee: v.record(txKeyPattern, v.pipe(v.number(), v.minValue(0))),
|
|
65
64
|
txGas: v.optional(v.object({
|
|
66
65
|
price: v.pipe(v.number(), v.integer(), v.minValue(0)),
|
|
@@ -69,7 +68,32 @@ const configSchema = v.pipe(v.object({
|
|
|
69
68
|
dataStorage: v.pipe(v.number(), v.integer(), v.minValue(1)),
|
|
70
69
|
minStake: v.pipe(v.number(), v.integer(), v.minValue(1)),
|
|
71
70
|
maxStake: v.pipe(v.number(), v.integer(), v.minValue(1)),
|
|
72
|
-
stakeLockPeriod: v.pipe(v.number(), v.integer(), v.minValue(1))
|
|
71
|
+
stakeLockPeriod: v.pipe(v.number(), v.integer(), v.minValue(1)),
|
|
72
|
+
maxFreeGasTxSize: v.optional(v.pipe(v.number(), v.integer(), v.minValue(1))),
|
|
73
|
+
maxFreeGasStateOps: v.optional(v.pipe(v.number(), v.integer(), v.minValue(1))),
|
|
74
|
+
enforceSponsor3DEligibility: v.optional(v.boolean()),
|
|
75
|
+
burstWindowMs: v.optional(v.pipe(v.number(), v.integer(), v.minValue(1))),
|
|
76
|
+
baseBurstAllowance: v.optional(v.pipe(v.number(), v.integer(), v.minValue(1)))
|
|
77
|
+
})),
|
|
78
|
+
maxWriteSetSize: v.optional(v.pipe(v.number(), v.integer(), v.minValue(1))),
|
|
79
|
+
security: v.optional(v.object({
|
|
80
|
+
enabled: v.optional(v.boolean()),
|
|
81
|
+
throttle: v.optional(v.boolean()),
|
|
82
|
+
burstEscalation: v.optional(v.boolean()),
|
|
83
|
+
autoSlash: v.optional(v.boolean()),
|
|
84
|
+
gasPassNullifierCheck: v.optional(v.boolean()),
|
|
85
|
+
strikeOnAllErrors: v.optional(v.boolean()),
|
|
86
|
+
burstRejectMultiple: v.optional(v.pipe(v.number(), v.minValue(1))),
|
|
87
|
+
delegatedBurstMultiple: v.optional(v.pipe(v.number(), v.minValue(1))),
|
|
88
|
+
strikeWindowMs: v.optional(v.pipe(v.number(), v.integer(), v.minValue(1))),
|
|
89
|
+
warningThreshold: v.optional(v.pipe(v.number(), v.integer(), v.minValue(1))),
|
|
90
|
+
throttleThreshold: v.optional(v.pipe(v.number(), v.integer(), v.minValue(1))),
|
|
91
|
+
slashThreshold: v.optional(v.pipe(v.number(), v.integer(), v.minValue(1))),
|
|
92
|
+
throttleCooldownMs: v.optional(v.pipe(v.number(), v.integer(), v.minValue(1))),
|
|
93
|
+
gasPassEpochSeconds: v.optional(v.pipe(v.number(), v.integer(), v.minValue(1))),
|
|
94
|
+
fishermanBountyBps: v.optional(v.pipe(v.number(), v.integer(), v.minValue(0), v.maxValue(5e3))),
|
|
95
|
+
fishermanAddress: v.optional(vDID({ prefix: true })),
|
|
96
|
+
exemptActors: v.optional(v.array(vDID({ prefix: true })))
|
|
73
97
|
})),
|
|
74
98
|
txStake: v.optional(v.object({
|
|
75
99
|
createToken: v.pipe(v.number(), v.integer(), v.minValue(1)),
|
package/esm/types.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { ChainMode, IAccountConfig, IChainConfig, IChainConfigInput, IDefaultConfig, ITokenConfig, ITokenItx, ITransactionConfig, ITxGasConfig, ITxStakeConfig, IVaultsConfig, TDelegateConfig, TForeignToken, TxTypeMap, TxTypeUrl } from "@ocap/types";
|
|
2
|
-
export { type ChainMode, type IAccountConfig, type IChainConfig, type IChainConfigInput, type IDefaultConfig, type ITokenConfig, type ITokenItx, type ITransactionConfig, type ITxGasConfig, type ITxStakeConfig, type IVaultsConfig, type TDelegateConfig, type TForeignToken, type TxTypeMap, type TxTypeUrl };
|
|
1
|
+
import { ChainMode, IAccountConfig, IChainConfig, IChainConfigInput, IDefaultConfig, ITokenConfig, ITokenItx, ITransactionConfig, ITxGasConfig, ITxSecurityConfig, ITxStakeConfig, IVaultsConfig, TDelegateConfig, TForeignToken, TxTypeMap, TxTypeUrl } from "@ocap/types";
|
|
2
|
+
export { type ChainMode, type IAccountConfig, type IChainConfig, type IChainConfigInput, type IDefaultConfig, type ITokenConfig, type ITokenItx, type ITransactionConfig, type ITxGasConfig, type ITxSecurityConfig, type ITxStakeConfig, type IVaultsConfig, type TDelegateConfig, type TForeignToken, type TxTypeMap, type TxTypeUrl };
|
package/lib/default.cjs
CHANGED
|
@@ -175,7 +175,44 @@ const defaultConfig = {
|
|
|
175
175
|
inflationRate: 0
|
|
176
176
|
}
|
|
177
177
|
};
|
|
178
|
+
/**
|
|
179
|
+
* Documented defaults for the gas security knobs (`transaction.txGas.*` free-gas/burst limits and
|
|
180
|
+
* `transaction.security.*`). They are deliberately NOT merged into `defaultConfig` so `create()` output (and
|
|
181
|
+
* therefore existing chain config snapshots) stays unchanged; the guard in `@ocap/tx-protocols`
|
|
182
|
+
* (`resolveGasSecurityConfig`) applies these exact values when a key is absent. A parity test pins both copies.
|
|
183
|
+
*
|
|
184
|
+
* Everything here is either a pure function of the tx or an ADMISSION-only (pre-queue) decision; none of it
|
|
185
|
+
* changes gas, waivers or receipts of an admitted tx.
|
|
186
|
+
*/
|
|
187
|
+
const defaultGasSecurityKnobs = {
|
|
188
|
+
txGas: {
|
|
189
|
+
maxFreeGasTxSize: 4096,
|
|
190
|
+
maxFreeGasStateOps: 6,
|
|
191
|
+
enforceSponsor3DEligibility: false,
|
|
192
|
+
burstWindowMs: 6e4,
|
|
193
|
+
baseBurstAllowance: 10
|
|
194
|
+
},
|
|
195
|
+
security: {
|
|
196
|
+
enabled: true,
|
|
197
|
+
throttle: true,
|
|
198
|
+
burstEscalation: true,
|
|
199
|
+
autoSlash: false,
|
|
200
|
+
gasPassNullifierCheck: false,
|
|
201
|
+
strikeOnAllErrors: false,
|
|
202
|
+
burstRejectMultiple: 100,
|
|
203
|
+
delegatedBurstMultiple: 20,
|
|
204
|
+
strikeWindowMs: 6e5,
|
|
205
|
+
warningThreshold: 2,
|
|
206
|
+
throttleThreshold: 5,
|
|
207
|
+
slashThreshold: 10,
|
|
208
|
+
throttleCooldownMs: 15e3,
|
|
209
|
+
gasPassEpochSeconds: 60,
|
|
210
|
+
fishermanBountyBps: 1e3,
|
|
211
|
+
exemptActors: []
|
|
212
|
+
}
|
|
213
|
+
};
|
|
178
214
|
var default_default = defaultConfig;
|
|
179
215
|
|
|
180
216
|
//#endregion
|
|
181
|
-
exports.default = default_default;
|
|
217
|
+
exports.default = default_default;
|
|
218
|
+
exports.defaultGasSecurityKnobs = defaultGasSecurityKnobs;
|
package/lib/default.d.cts
CHANGED
|
@@ -2,5 +2,41 @@ import { IDefaultConfig } from "./types.cjs";
|
|
|
2
2
|
|
|
3
3
|
//#region src/default.d.ts
|
|
4
4
|
declare const defaultConfig: IDefaultConfig;
|
|
5
|
+
/**
|
|
6
|
+
* Documented defaults for the gas security knobs (`transaction.txGas.*` free-gas/burst limits and
|
|
7
|
+
* `transaction.security.*`). They are deliberately NOT merged into `defaultConfig` so `create()` output (and
|
|
8
|
+
* therefore existing chain config snapshots) stays unchanged; the guard in `@ocap/tx-protocols`
|
|
9
|
+
* (`resolveGasSecurityConfig`) applies these exact values when a key is absent. A parity test pins both copies.
|
|
10
|
+
*
|
|
11
|
+
* Everything here is either a pure function of the tx or an ADMISSION-only (pre-queue) decision; none of it
|
|
12
|
+
* changes gas, waivers or receipts of an admitted tx.
|
|
13
|
+
*/
|
|
14
|
+
declare const defaultGasSecurityKnobs: {
|
|
15
|
+
readonly txGas: {
|
|
16
|
+
readonly maxFreeGasTxSize: 4096;
|
|
17
|
+
readonly maxFreeGasStateOps: 6;
|
|
18
|
+
readonly enforceSponsor3DEligibility: false;
|
|
19
|
+
readonly burstWindowMs: 60000;
|
|
20
|
+
readonly baseBurstAllowance: 10;
|
|
21
|
+
};
|
|
22
|
+
readonly security: {
|
|
23
|
+
readonly enabled: true;
|
|
24
|
+
readonly throttle: true;
|
|
25
|
+
readonly burstEscalation: true;
|
|
26
|
+
readonly autoSlash: false;
|
|
27
|
+
readonly gasPassNullifierCheck: false;
|
|
28
|
+
readonly strikeOnAllErrors: false;
|
|
29
|
+
readonly burstRejectMultiple: 100;
|
|
30
|
+
readonly delegatedBurstMultiple: 20;
|
|
31
|
+
readonly strikeWindowMs: 600000;
|
|
32
|
+
readonly warningThreshold: 2;
|
|
33
|
+
readonly throttleThreshold: 5;
|
|
34
|
+
readonly slashThreshold: 10;
|
|
35
|
+
readonly throttleCooldownMs: 15000;
|
|
36
|
+
readonly gasPassEpochSeconds: 60;
|
|
37
|
+
readonly fishermanBountyBps: 1000;
|
|
38
|
+
readonly exemptActors: string[];
|
|
39
|
+
};
|
|
40
|
+
};
|
|
5
41
|
//#endregion
|
|
6
|
-
export { defaultConfig as default };
|
|
42
|
+
export { defaultConfig as default, defaultGasSecurityKnobs };
|
package/lib/index.cjs
CHANGED
package/lib/index.d.cts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { ChainMode, IAccountConfig, IChainConfig, IChainConfigInput, IDefaultConfig, ITokenConfig, ITokenItx, ITransactionConfig, ITxGasConfig, ITxStakeConfig, IVaultsConfig, TDelegateConfig, TForeignToken, TxTypeMap, TxTypeUrl } from "./types.cjs";
|
|
1
|
+
import { ChainMode, IAccountConfig, IChainConfig, IChainConfigInput, IDefaultConfig, ITokenConfig, ITokenItx, ITransactionConfig, ITxGasConfig, ITxSecurityConfig, ITxStakeConfig, IVaultsConfig, TDelegateConfig, TForeignToken, TxTypeMap, TxTypeUrl } from "./types.cjs";
|
|
2
|
+
import { defaultGasSecurityKnobs } from "./default.cjs";
|
|
2
3
|
|
|
3
4
|
//#region src/index.d.ts
|
|
4
5
|
declare const validate: (config: Partial<IChainConfig>) => IChainConfig;
|
|
5
6
|
declare const create: (props: IChainConfigInput) => IChainConfig;
|
|
6
7
|
declare const genTokenItx: (config: IChainConfig) => ITokenItx;
|
|
7
8
|
//#endregion
|
|
8
|
-
export { ChainMode, IAccountConfig, IChainConfig, IChainConfigInput, IDefaultConfig, ITokenConfig, ITokenItx, ITransactionConfig, ITxGasConfig, ITxStakeConfig, IVaultsConfig, TDelegateConfig, TForeignToken, TxTypeMap, TxTypeUrl, create, genTokenItx, validate };
|
|
9
|
+
export { ChainMode, IAccountConfig, IChainConfig, IChainConfigInput, IDefaultConfig, ITokenConfig, ITokenItx, ITransactionConfig, ITxGasConfig, ITxSecurityConfig, ITxStakeConfig, IVaultsConfig, TDelegateConfig, TForeignToken, TxTypeMap, TxTypeUrl, create, defaultGasSecurityKnobs, genTokenItx, validate };
|
package/lib/schema.cjs
CHANGED
|
@@ -62,7 +62,6 @@ const configSchema = _arcblock_validator.v.pipe(_arcblock_validator.v.object({
|
|
|
62
62
|
}),
|
|
63
63
|
supportedTxs: _arcblock_validator.v.pipe(_arcblock_validator.v.array(_arcblock_validator.v.string()), _arcblock_validator.v.minLength(1)),
|
|
64
64
|
multiSignV2Txs: _arcblock_validator.v.pipe(_arcblock_validator.v.array(_arcblock_validator.v.string()), _arcblock_validator.v.minLength(1)),
|
|
65
|
-
unsignedTxHashDedupHeight: _arcblock_validator.v.optional(_arcblock_validator.v.pipe(_arcblock_validator.v.number(), _arcblock_validator.v.integer(), _arcblock_validator.v.minValue(0))),
|
|
66
65
|
txFee: _arcblock_validator.v.record(txKeyPattern, _arcblock_validator.v.pipe(_arcblock_validator.v.number(), _arcblock_validator.v.minValue(0))),
|
|
67
66
|
txGas: _arcblock_validator.v.optional(_arcblock_validator.v.object({
|
|
68
67
|
price: _arcblock_validator.v.pipe(_arcblock_validator.v.number(), _arcblock_validator.v.integer(), _arcblock_validator.v.minValue(0)),
|
|
@@ -71,7 +70,32 @@ const configSchema = _arcblock_validator.v.pipe(_arcblock_validator.v.object({
|
|
|
71
70
|
dataStorage: _arcblock_validator.v.pipe(_arcblock_validator.v.number(), _arcblock_validator.v.integer(), _arcblock_validator.v.minValue(1)),
|
|
72
71
|
minStake: _arcblock_validator.v.pipe(_arcblock_validator.v.number(), _arcblock_validator.v.integer(), _arcblock_validator.v.minValue(1)),
|
|
73
72
|
maxStake: _arcblock_validator.v.pipe(_arcblock_validator.v.number(), _arcblock_validator.v.integer(), _arcblock_validator.v.minValue(1)),
|
|
74
|
-
stakeLockPeriod: _arcblock_validator.v.pipe(_arcblock_validator.v.number(), _arcblock_validator.v.integer(), _arcblock_validator.v.minValue(1))
|
|
73
|
+
stakeLockPeriod: _arcblock_validator.v.pipe(_arcblock_validator.v.number(), _arcblock_validator.v.integer(), _arcblock_validator.v.minValue(1)),
|
|
74
|
+
maxFreeGasTxSize: _arcblock_validator.v.optional(_arcblock_validator.v.pipe(_arcblock_validator.v.number(), _arcblock_validator.v.integer(), _arcblock_validator.v.minValue(1))),
|
|
75
|
+
maxFreeGasStateOps: _arcblock_validator.v.optional(_arcblock_validator.v.pipe(_arcblock_validator.v.number(), _arcblock_validator.v.integer(), _arcblock_validator.v.minValue(1))),
|
|
76
|
+
enforceSponsor3DEligibility: _arcblock_validator.v.optional(_arcblock_validator.v.boolean()),
|
|
77
|
+
burstWindowMs: _arcblock_validator.v.optional(_arcblock_validator.v.pipe(_arcblock_validator.v.number(), _arcblock_validator.v.integer(), _arcblock_validator.v.minValue(1))),
|
|
78
|
+
baseBurstAllowance: _arcblock_validator.v.optional(_arcblock_validator.v.pipe(_arcblock_validator.v.number(), _arcblock_validator.v.integer(), _arcblock_validator.v.minValue(1)))
|
|
79
|
+
})),
|
|
80
|
+
maxWriteSetSize: _arcblock_validator.v.optional(_arcblock_validator.v.pipe(_arcblock_validator.v.number(), _arcblock_validator.v.integer(), _arcblock_validator.v.minValue(1))),
|
|
81
|
+
security: _arcblock_validator.v.optional(_arcblock_validator.v.object({
|
|
82
|
+
enabled: _arcblock_validator.v.optional(_arcblock_validator.v.boolean()),
|
|
83
|
+
throttle: _arcblock_validator.v.optional(_arcblock_validator.v.boolean()),
|
|
84
|
+
burstEscalation: _arcblock_validator.v.optional(_arcblock_validator.v.boolean()),
|
|
85
|
+
autoSlash: _arcblock_validator.v.optional(_arcblock_validator.v.boolean()),
|
|
86
|
+
gasPassNullifierCheck: _arcblock_validator.v.optional(_arcblock_validator.v.boolean()),
|
|
87
|
+
strikeOnAllErrors: _arcblock_validator.v.optional(_arcblock_validator.v.boolean()),
|
|
88
|
+
burstRejectMultiple: _arcblock_validator.v.optional(_arcblock_validator.v.pipe(_arcblock_validator.v.number(), _arcblock_validator.v.minValue(1))),
|
|
89
|
+
delegatedBurstMultiple: _arcblock_validator.v.optional(_arcblock_validator.v.pipe(_arcblock_validator.v.number(), _arcblock_validator.v.minValue(1))),
|
|
90
|
+
strikeWindowMs: _arcblock_validator.v.optional(_arcblock_validator.v.pipe(_arcblock_validator.v.number(), _arcblock_validator.v.integer(), _arcblock_validator.v.minValue(1))),
|
|
91
|
+
warningThreshold: _arcblock_validator.v.optional(_arcblock_validator.v.pipe(_arcblock_validator.v.number(), _arcblock_validator.v.integer(), _arcblock_validator.v.minValue(1))),
|
|
92
|
+
throttleThreshold: _arcblock_validator.v.optional(_arcblock_validator.v.pipe(_arcblock_validator.v.number(), _arcblock_validator.v.integer(), _arcblock_validator.v.minValue(1))),
|
|
93
|
+
slashThreshold: _arcblock_validator.v.optional(_arcblock_validator.v.pipe(_arcblock_validator.v.number(), _arcblock_validator.v.integer(), _arcblock_validator.v.minValue(1))),
|
|
94
|
+
throttleCooldownMs: _arcblock_validator.v.optional(_arcblock_validator.v.pipe(_arcblock_validator.v.number(), _arcblock_validator.v.integer(), _arcblock_validator.v.minValue(1))),
|
|
95
|
+
gasPassEpochSeconds: _arcblock_validator.v.optional(_arcblock_validator.v.pipe(_arcblock_validator.v.number(), _arcblock_validator.v.integer(), _arcblock_validator.v.minValue(1))),
|
|
96
|
+
fishermanBountyBps: _arcblock_validator.v.optional(_arcblock_validator.v.pipe(_arcblock_validator.v.number(), _arcblock_validator.v.integer(), _arcblock_validator.v.minValue(0), _arcblock_validator.v.maxValue(5e3))),
|
|
97
|
+
fishermanAddress: _arcblock_validator.v.optional((0, _arcblock_validator.vDID)({ prefix: true })),
|
|
98
|
+
exemptActors: _arcblock_validator.v.optional(_arcblock_validator.v.array((0, _arcblock_validator.vDID)({ prefix: true })))
|
|
75
99
|
})),
|
|
76
100
|
txStake: _arcblock_validator.v.optional(_arcblock_validator.v.object({
|
|
77
101
|
createToken: _arcblock_validator.v.pipe(_arcblock_validator.v.number(), _arcblock_validator.v.integer(), _arcblock_validator.v.minValue(1)),
|
package/lib/schema.d.cts
CHANGED
|
@@ -18,7 +18,6 @@ declare const configSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
|
18
18
|
}, undefined>;
|
|
19
19
|
readonly supportedTxs: v.SchemaWithPipe<readonly [v.ArraySchema<v.StringSchema<undefined>, undefined>, v.MinLengthAction<string[], 1, undefined>]>;
|
|
20
20
|
readonly multiSignV2Txs: v.SchemaWithPipe<readonly [v.ArraySchema<v.StringSchema<undefined>, undefined>, v.MinLengthAction<string[], 1, undefined>]>;
|
|
21
|
-
readonly unsignedTxHashDedupHeight: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>, undefined>;
|
|
22
21
|
readonly txFee: v.RecordSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, undefined>]>, v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, 0, undefined>]>, undefined>;
|
|
23
22
|
readonly txGas: v.OptionalSchema<v.ObjectSchema<{
|
|
24
23
|
readonly price: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
@@ -28,6 +27,31 @@ declare const configSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
|
28
27
|
readonly minStake: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 1, undefined>]>;
|
|
29
28
|
readonly maxStake: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 1, undefined>]>;
|
|
30
29
|
readonly stakeLockPeriod: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 1, undefined>]>;
|
|
30
|
+
readonly maxFreeGasTxSize: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 1, undefined>]>, undefined>;
|
|
31
|
+
readonly maxFreeGasStateOps: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 1, undefined>]>, undefined>;
|
|
32
|
+
readonly enforceSponsor3DEligibility: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
|
|
33
|
+
readonly burstWindowMs: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 1, undefined>]>, undefined>;
|
|
34
|
+
readonly baseBurstAllowance: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 1, undefined>]>, undefined>;
|
|
35
|
+
}, undefined>, undefined>;
|
|
36
|
+
readonly maxWriteSetSize: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 1, undefined>]>, undefined>;
|
|
37
|
+
readonly security: v.OptionalSchema<v.ObjectSchema<{
|
|
38
|
+
readonly enabled: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
|
|
39
|
+
readonly throttle: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
|
|
40
|
+
readonly burstEscalation: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
|
|
41
|
+
readonly autoSlash: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
|
|
42
|
+
readonly gasPassNullifierCheck: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
|
|
43
|
+
readonly strikeOnAllErrors: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
|
|
44
|
+
readonly burstRejectMultiple: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, 1, undefined>]>, undefined>;
|
|
45
|
+
readonly delegatedBurstMultiple: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, 1, undefined>]>, undefined>;
|
|
46
|
+
readonly strikeWindowMs: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 1, undefined>]>, undefined>;
|
|
47
|
+
readonly warningThreshold: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 1, undefined>]>, undefined>;
|
|
48
|
+
readonly throttleThreshold: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 1, undefined>]>, undefined>;
|
|
49
|
+
readonly slashThreshold: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 1, undefined>]>, undefined>;
|
|
50
|
+
readonly throttleCooldownMs: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 1, undefined>]>, undefined>;
|
|
51
|
+
readonly gasPassEpochSeconds: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 1, undefined>]>, undefined>;
|
|
52
|
+
readonly fishermanBountyBps: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>, v.MaxValueAction<number, 5000, undefined>]>, undefined>;
|
|
53
|
+
readonly fishermanAddress: v.OptionalSchema<any, undefined>;
|
|
54
|
+
readonly exemptActors: v.OptionalSchema<v.ArraySchema<any, undefined>, undefined>;
|
|
31
55
|
}, undefined>, undefined>;
|
|
32
56
|
readonly txStake: v.OptionalSchema<v.ObjectSchema<{
|
|
33
57
|
readonly createToken: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 1, undefined>]>;
|
package/lib/types.d.cts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { ChainMode, IAccountConfig, IChainConfig, IChainConfigInput, IDefaultConfig, ITokenConfig, ITokenItx, ITransactionConfig, ITxGasConfig, ITxStakeConfig, IVaultsConfig, TDelegateConfig, TForeignToken, TxTypeMap, TxTypeUrl } from "@ocap/types";
|
|
2
|
-
export { type ChainMode, type IAccountConfig, type IChainConfig, type IChainConfigInput, type IDefaultConfig, type ITokenConfig, type ITokenItx, type ITransactionConfig, type ITxGasConfig, type ITxStakeConfig, type IVaultsConfig, type TDelegateConfig, type TForeignToken, type TxTypeMap, type TxTypeUrl };
|
|
1
|
+
import { ChainMode, IAccountConfig, IChainConfig, IChainConfigInput, IDefaultConfig, ITokenConfig, ITokenItx, ITransactionConfig, ITxGasConfig, ITxSecurityConfig, ITxStakeConfig, IVaultsConfig, TDelegateConfig, TForeignToken, TxTypeMap, TxTypeUrl } from "@ocap/types";
|
|
2
|
+
export { type ChainMode, type IAccountConfig, type IChainConfig, type IChainConfigInput, type IDefaultConfig, type ITokenConfig, type ITokenItx, type ITransactionConfig, type ITxGasConfig, type ITxSecurityConfig, type ITxStakeConfig, type IVaultsConfig, type TDelegateConfig, type TForeignToken, type TxTypeMap, type TxTypeUrl };
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "1.
|
|
6
|
+
"version": "1.31.1",
|
|
7
7
|
"description": "OCAP config parsing/validation and default",
|
|
8
8
|
"type": "module",
|
|
9
9
|
"main": "./lib/index.cjs",
|
|
@@ -47,11 +47,11 @@
|
|
|
47
47
|
"license": "MIT",
|
|
48
48
|
"devDependencies": {},
|
|
49
49
|
"dependencies": {
|
|
50
|
-
"@arcblock/did": "1.
|
|
51
|
-
"@arcblock/did-util": "1.
|
|
52
|
-
"@arcblock/validator": "1.
|
|
53
|
-
"@ocap/types": "1.
|
|
54
|
-
"@ocap/util": "1.
|
|
50
|
+
"@arcblock/did": "1.31.1",
|
|
51
|
+
"@arcblock/did-util": "1.31.1",
|
|
52
|
+
"@arcblock/validator": "1.31.1",
|
|
53
|
+
"@ocap/types": "1.31.1",
|
|
54
|
+
"@ocap/util": "1.31.1",
|
|
55
55
|
"lodash": "^4.17.23"
|
|
56
56
|
}
|
|
57
57
|
}
|