@xyo-network/xl1-protocol 5.2.0 → 5.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/neutral/modules/network-model/staticRest/layout/admissionShadow.d.ts +181 -0
- package/dist/neutral/modules/network-model/staticRest/layout/admissionShadow.d.ts.map +1 -0
- package/dist/neutral/modules/network-model/staticRest/layout/chainParams.d.ts +16 -10
- package/dist/neutral/modules/network-model/staticRest/layout/chainParams.d.ts.map +1 -1
- package/dist/neutral/modules/network-model/staticRest/layout/chainParamsRules.d.ts +15 -0
- package/dist/neutral/modules/network-model/staticRest/layout/chainParamsRules.d.ts.map +1 -1
- package/dist/neutral/modules/network-model/staticRest/layout/index.d.ts +2 -0
- package/dist/neutral/modules/network-model/staticRest/layout/index.d.ts.map +1 -1
- package/dist/neutral/modules/network-model/staticRest/layout/slashIndex.d.ts +160 -0
- package/dist/neutral/modules/network-model/staticRest/layout/slashIndex.d.ts.map +1 -0
- package/dist/neutral/modules/network-model/staticRest/paths/index.d.ts +1 -0
- package/dist/neutral/modules/network-model/staticRest/paths/index.d.ts.map +1 -1
- package/dist/neutral/modules/network-model/staticRest/paths/slashIndex.d.ts +31 -0
- package/dist/neutral/modules/network-model/staticRest/paths/slashIndex.d.ts.map +1 -0
- package/dist/neutral/modules/protocol-model/model/RuleActivation.d.ts +1 -1
- package/dist/neutral/modules/protocol-model/model/RuleActivation.d.ts.map +1 -1
- package/dist/neutral/network-model.mjs +406 -188
- package/dist/neutral/network-model.mjs.map +4 -4
- package/dist/neutral/protocol-model.mjs +3 -0
- package/dist/neutral/protocol-model.mjs.map +2 -2
- package/package.json +1 -1
|
@@ -106,34 +106,89 @@ var initNetworkNode = async (activeNetwork, wallet) => {
|
|
|
106
106
|
return activeNetworkNode;
|
|
107
107
|
};
|
|
108
108
|
|
|
109
|
+
// src/modules/network-model/staticRest/layout/admissionShadow.ts
|
|
110
|
+
import { zodAsFactory, zodIsFactory } from "@ariestools/sdk";
|
|
111
|
+
import { asSchema as asSchema2 } from "@xyo-network/sdk";
|
|
112
|
+
import { z } from "zod";
|
|
113
|
+
var AdmissionShadowReportSchema = asSchema2("network.xyo.s3.admission.shadow", true);
|
|
114
|
+
var AdmissionShadowAssessmentZod = z.object({
|
|
115
|
+
/** Seasoned active stake measured at the evaluation point, hex atto, when it could be. */
|
|
116
|
+
activeStake: z.optional(z.string()),
|
|
117
|
+
/** Whether the allow-list admits it. */
|
|
118
|
+
admittedByAllowList: z.boolean(),
|
|
119
|
+
/** The candidate's height. */
|
|
120
|
+
block: z.int().nonnegative(),
|
|
121
|
+
/** The candidate's signed identity. */
|
|
122
|
+
dataHash: z.string(),
|
|
123
|
+
/** The EVM height stake was measured at, when it could be. */
|
|
124
|
+
eStar: z.optional(z.int().nonnegative()),
|
|
125
|
+
/** Whether participation admits it, when that could be established. */
|
|
126
|
+
eligible: z.optional(z.boolean()),
|
|
127
|
+
/** Whether the address held a current intent, when that could be established. */
|
|
128
|
+
intentValid: z.optional(z.boolean()),
|
|
129
|
+
/** The producer. */
|
|
130
|
+
producer: z.string(),
|
|
131
|
+
/** Why participation refused, when it did. */
|
|
132
|
+
reason: z.optional(z.string()),
|
|
133
|
+
/** False when the participation question could not be put at all. */
|
|
134
|
+
resolvable: z.boolean(),
|
|
135
|
+
/** The seasoned portion staked by the address on itself, hex atto, when it could be. */
|
|
136
|
+
selfBond: z.optional(z.string())
|
|
137
|
+
});
|
|
138
|
+
var AdmissionShadowReportZod = z.object({
|
|
139
|
+
/** Every candidate considered this round. */
|
|
140
|
+
assessments: z.array(AdmissionShadowAssessmentZod),
|
|
141
|
+
/** Only those where the two gates disagreed. */
|
|
142
|
+
divergent: z.array(AdmissionShadowAssessmentZod),
|
|
143
|
+
/** The finalized height this round was selected against. */
|
|
144
|
+
head: z.int().nonnegative(),
|
|
145
|
+
/** The admission posture that produced the round; reports keep flowing when gating starts. */
|
|
146
|
+
mode: z.optional(z.enum(["shadow", "enforce"])),
|
|
147
|
+
/** Height of the previous published report, so the series can be walked backwards. */
|
|
148
|
+
previous: z.optional(z.int().nonnegative()),
|
|
149
|
+
schema: z.literal(AdmissionShadowReportSchema)
|
|
150
|
+
});
|
|
151
|
+
var isAdmissionShadowReport = zodIsFactory(AdmissionShadowReportZod);
|
|
152
|
+
var asAdmissionShadowReport = zodAsFactory(AdmissionShadowReportZod, "asAdmissionShadowReport");
|
|
153
|
+
function createAdmissionShadowReport(head, assessments, divergent, previous, mode) {
|
|
154
|
+
return AdmissionShadowReportZod.parse({
|
|
155
|
+
assessments,
|
|
156
|
+
divergent,
|
|
157
|
+
head,
|
|
158
|
+
mode,
|
|
159
|
+
previous,
|
|
160
|
+
schema: AdmissionShadowReportSchema
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
|
|
109
164
|
// src/modules/network-model/staticRest/layout/chainContractManifest.ts
|
|
110
165
|
import {
|
|
111
|
-
zodAsFactory,
|
|
112
|
-
zodIsFactory,
|
|
166
|
+
zodAsFactory as zodAsFactory2,
|
|
167
|
+
zodIsFactory as zodIsFactory2,
|
|
113
168
|
zodToFactory
|
|
114
169
|
} from "@ariestools/sdk";
|
|
115
|
-
import { z } from "zod";
|
|
170
|
+
import { z as z2 } from "zod";
|
|
116
171
|
import {
|
|
117
172
|
ChainIdZod,
|
|
118
173
|
NumberishZod
|
|
119
174
|
} from "#protocol-lib";
|
|
120
|
-
var ChainContractBlockNumberZod = NumberishZod.pipe(
|
|
175
|
+
var ChainContractBlockNumberZod = NumberishZod.pipe(z2.int().nonnegative()).transform((value) => value);
|
|
121
176
|
var ChainContractManifestSchema = "network.xyo.s3.chain.contract";
|
|
122
177
|
var CHAIN_CONTRACT_MANIFEST_VERSION = 1;
|
|
123
|
-
var ChainContractManifestZod =
|
|
178
|
+
var ChainContractManifestZod = z2.object({
|
|
124
179
|
/** Self-identifying chain id (matches the path key). Optional for older fixtures. */
|
|
125
|
-
chainId:
|
|
180
|
+
chainId: z2.optional(ChainIdZod),
|
|
126
181
|
forkedAtBlockNumber: ChainContractBlockNumberZod.nullable().optional(),
|
|
127
|
-
forkedAtHash:
|
|
128
|
-
forkedChainId:
|
|
129
|
-
minWithdrawalBlocks: NumberishZod.pipe(
|
|
130
|
-
rewardsContract:
|
|
131
|
-
schema:
|
|
132
|
-
stakingTokenAddress:
|
|
133
|
-
version:
|
|
182
|
+
forkedAtHash: z2.string().nullable().optional(),
|
|
183
|
+
forkedChainId: z2.nullable(ChainIdZod).optional(),
|
|
184
|
+
minWithdrawalBlocks: NumberishZod.pipe(z2.int().nonnegative()),
|
|
185
|
+
rewardsContract: z2.string(),
|
|
186
|
+
schema: z2.literal(ChainContractManifestSchema),
|
|
187
|
+
stakingTokenAddress: z2.string(),
|
|
188
|
+
version: z2.int().positive()
|
|
134
189
|
});
|
|
135
|
-
var isChainContractManifest =
|
|
136
|
-
var asChainContractManifest =
|
|
190
|
+
var isChainContractManifest = zodIsFactory2(ChainContractManifestZod);
|
|
191
|
+
var asChainContractManifest = zodAsFactory2(ChainContractManifestZod, "asChainContractManifest");
|
|
137
192
|
var toChainContractManifest = zodToFactory(ChainContractManifestZod, "toChainContractManifest");
|
|
138
193
|
function createChainContractManifest(config) {
|
|
139
194
|
return ChainContractManifestZod.parse({
|
|
@@ -145,11 +200,11 @@ function createChainContractManifest(config) {
|
|
|
145
200
|
|
|
146
201
|
// src/modules/network-model/staticRest/layout/chainManifest.ts
|
|
147
202
|
import {
|
|
148
|
-
zodAsFactory as
|
|
149
|
-
zodIsFactory as
|
|
203
|
+
zodAsFactory as zodAsFactory3,
|
|
204
|
+
zodIsFactory as zodIsFactory3,
|
|
150
205
|
zodToFactory as zodToFactory2
|
|
151
206
|
} from "@ariestools/sdk";
|
|
152
|
-
import { z as
|
|
207
|
+
import { z as z3 } from "zod";
|
|
153
208
|
|
|
154
209
|
// src/modules/network-model/staticRest/templates.ts
|
|
155
210
|
import { asHash } from "@ariestools/sdk";
|
|
@@ -234,23 +289,23 @@ function transactionInclusionPathTemplate() {
|
|
|
234
289
|
// src/modules/network-model/staticRest/layout/chainManifest.ts
|
|
235
290
|
var CHAIN_LAYOUT_VERSION = 1;
|
|
236
291
|
var ChainManifestSchema = "network.xyo.s3.chain.manifest";
|
|
237
|
-
var ChainManifestPathsZod =
|
|
238
|
-
blockByHash:
|
|
239
|
-
blockByNumber:
|
|
240
|
-
head:
|
|
241
|
-
payload:
|
|
292
|
+
var ChainManifestPathsZod = z3.object({
|
|
293
|
+
blockByHash: z3.string(),
|
|
294
|
+
blockByNumber: z3.string(),
|
|
295
|
+
head: z3.string(),
|
|
296
|
+
payload: z3.string()
|
|
242
297
|
});
|
|
243
|
-
var ChainManifestZod =
|
|
298
|
+
var ChainManifestZod = z3.object({
|
|
244
299
|
/** Lowest block number available in the bucket (genesis until pruning exists). */
|
|
245
|
-
earliestBlock:
|
|
300
|
+
earliestBlock: z3.int().nonnegative(),
|
|
246
301
|
/** Storage/wire encoding of the published files (also on each object's Content-Encoding). */
|
|
247
|
-
encoding:
|
|
302
|
+
encoding: z3.string(),
|
|
248
303
|
paths: ChainManifestPathsZod,
|
|
249
|
-
schema:
|
|
250
|
-
version:
|
|
304
|
+
schema: z3.literal(ChainManifestSchema),
|
|
305
|
+
version: z3.int().positive()
|
|
251
306
|
});
|
|
252
|
-
var isChainManifest =
|
|
253
|
-
var asChainManifest =
|
|
307
|
+
var isChainManifest = zodIsFactory3(ChainManifestZod);
|
|
308
|
+
var asChainManifest = zodAsFactory3(ChainManifestZod, "asChainManifest");
|
|
254
309
|
var toChainManifest = zodToFactory2(ChainManifestZod, "toChainManifest");
|
|
255
310
|
function createChainManifest(encoding, earliestBlock = 0) {
|
|
256
311
|
return asChainManifest({
|
|
@@ -264,98 +319,98 @@ function createChainManifest(encoding, earliestBlock = 0) {
|
|
|
264
319
|
|
|
265
320
|
// src/modules/network-model/staticRest/layout/chainParams.ts
|
|
266
321
|
import {
|
|
267
|
-
zodAsFactory as
|
|
268
|
-
zodIsFactory as
|
|
322
|
+
zodAsFactory as zodAsFactory4,
|
|
323
|
+
zodIsFactory as zodIsFactory4,
|
|
269
324
|
zodToFactory as zodToFactory3
|
|
270
325
|
} from "@ariestools/sdk";
|
|
271
|
-
import { asSchema as
|
|
272
|
-
import { z as
|
|
326
|
+
import { asSchema as asSchema3 } from "@xyo-network/sdk";
|
|
327
|
+
import { z as z4 } from "zod";
|
|
273
328
|
import { ChainIdZod as ChainIdZod2, NumberishZod as NumberishZod2 } from "#protocol-lib";
|
|
274
329
|
import { OffenseCodes, RuleIds } from "#protocol-model";
|
|
275
|
-
var ChainParamsSchema =
|
|
330
|
+
var ChainParamsSchema = asSchema3("network.xyo.s3.chain.params", true);
|
|
276
331
|
var CHAIN_PARAMS_VERSION = 1;
|
|
277
|
-
var offenseCodeZod =
|
|
278
|
-
var RuleIdZod =
|
|
279
|
-
var HeightZod = NumberishZod2.pipe(
|
|
280
|
-
var HexAmountZod =
|
|
281
|
-
var ChainParamsZod =
|
|
332
|
+
var offenseCodeZod = z4.enum(OffenseCodes);
|
|
333
|
+
var RuleIdZod = z4.enum(RuleIds);
|
|
334
|
+
var HeightZod = NumberishZod2.pipe(z4.int().nonnegative());
|
|
335
|
+
var HexAmountZod = z4.string();
|
|
336
|
+
var ChainParamsZod = z4.object({
|
|
282
337
|
/** Rule id to the height it takes effect. */
|
|
283
|
-
activations:
|
|
338
|
+
activations: z4.partialRecord(RuleIdZod, HeightZod),
|
|
284
339
|
/** Address whose adjudication records are honored. */
|
|
285
|
-
arbiter:
|
|
340
|
+
arbiter: z4.string(),
|
|
286
341
|
/** Share of a step's reward pool paid to attestors, in basis points. */
|
|
287
|
-
attestationRewardBps:
|
|
342
|
+
attestationRewardBps: z4.int().nonnegative(),
|
|
288
343
|
/** Absolute ceiling on any single bounty, in the smallest unit. */
|
|
289
344
|
bountyCapAtto: HexAmountZod,
|
|
290
345
|
/** Share of a slash offered as a bounty, in basis points. */
|
|
291
|
-
bountyShareBps:
|
|
346
|
+
bountyShareBps: z4.int().nonnegative(),
|
|
292
347
|
/** Minimum share of every slash that must be burned, in basis points. */
|
|
293
|
-
burnFloorBps:
|
|
348
|
+
burnFloorBps: z4.int().positive(),
|
|
294
349
|
/** Version of the offense catalog these parameters describe. */
|
|
295
|
-
catalogVersion:
|
|
350
|
+
catalogVersion: z4.int().positive(),
|
|
296
351
|
/** Chain these parameters govern. */
|
|
297
352
|
chainId: ChainIdZod2,
|
|
298
353
|
/** Window during which counter-evidence may be filed, in EVM blocks. */
|
|
299
|
-
challengeWindowEvmBlocks:
|
|
354
|
+
challengeWindowEvmBlocks: z4.int().positive(),
|
|
300
355
|
/** Rule id to the height it stops taking effect; re-activation needs a later version. */
|
|
301
|
-
deactivations:
|
|
356
|
+
deactivations: z4.optional(z4.partialRecord(RuleIdZod, HeightZod)),
|
|
302
357
|
/** Maximum age of an offense at report time, in EVM blocks. */
|
|
303
|
-
evidenceFreshnessEvmBlocks:
|
|
358
|
+
evidenceFreshnessEvmBlocks: z4.int().positive(),
|
|
304
359
|
/** Operational floor on how long evidence is kept, in XL1 blocks. */
|
|
305
|
-
evidenceRetentionXl1Blocks:
|
|
360
|
+
evidenceRetentionXl1Blocks: z4.int().positive(),
|
|
306
361
|
/** Delay between a certificate being queued and executable, in EVM blocks. */
|
|
307
|
-
executionDelayEvmBlocks:
|
|
362
|
+
executionDelayEvmBlocks: z4.int().positive(),
|
|
308
363
|
/** How far behind its own anchor a block's stake measurement may sit, in EVM blocks. */
|
|
309
|
-
freshnessBandEvmBlocks:
|
|
364
|
+
freshnessBandEvmBlocks: z4.int().positive(),
|
|
310
365
|
/** Blocks after an activation during which the rule is observed but not enforced. */
|
|
311
|
-
graceBandXl1Blocks:
|
|
366
|
+
graceBandXl1Blocks: z4.int().nonnegative(),
|
|
312
367
|
/** Confirmation depth an anchor must sit behind the EVM head, in EVM blocks. */
|
|
313
|
-
maturityEvmBlocks:
|
|
368
|
+
maturityEvmBlocks: z4.int().positive(),
|
|
314
369
|
/** Minimum stake a producer must place on itself, in the smallest unit. */
|
|
315
370
|
minProducerSelfBondAtto: HexAmountZod,
|
|
316
371
|
/** Minimum stake on a producer address, in the smallest unit. */
|
|
317
372
|
minProducerStakeAtto: HexAmountZod,
|
|
318
373
|
/** Minimum age stake must reach before it counts toward participation, in EVM blocks. */
|
|
319
|
-
minStakeAgeEvmBlocks:
|
|
374
|
+
minStakeAgeEvmBlocks: z4.int().nonnegative(),
|
|
320
375
|
/** Minimum stake a validator must hold, in the smallest unit. */
|
|
321
376
|
minValidatorStakeAtto: HexAmountZod,
|
|
322
377
|
/** Slack the timing budget carries for operations and stalls, in EVM blocks. */
|
|
323
|
-
opsAllowanceEvmBlocks:
|
|
378
|
+
opsAllowanceEvmBlocks: z4.int().positive(),
|
|
324
379
|
/** Lowest protocol version a block may declare. */
|
|
325
|
-
protocolMin:
|
|
380
|
+
protocolMin: z4.int().positive(),
|
|
326
381
|
/** Refundable deposit a report must escrow, in the smallest unit. */
|
|
327
382
|
reporterDepositAtto: HexAmountZod,
|
|
328
383
|
/** Blocks a reveal must wait after its commitment. */
|
|
329
|
-
revealDelayEvmBlocks:
|
|
384
|
+
revealDelayEvmBlocks: z4.int().positive(),
|
|
330
385
|
/** Blocks a reveal must wait after its commitment, on the XL1 clock. */
|
|
331
|
-
revealDelayXl1Blocks:
|
|
386
|
+
revealDelayXl1Blocks: z4.int().positive(),
|
|
332
387
|
/** Blocks after which an unrevealed commitment expires. */
|
|
333
|
-
revealWindowEvmBlocks:
|
|
388
|
+
revealWindowEvmBlocks: z4.int().positive(),
|
|
334
389
|
/** Blocks after which an unrevealed commitment expires, on the XL1 clock. */
|
|
335
|
-
revealWindowXl1Blocks:
|
|
390
|
+
revealWindowXl1Blocks: z4.int().positive(),
|
|
336
391
|
/** Where the allowed block reward comes from. */
|
|
337
|
-
rewardSource:
|
|
338
|
-
schema:
|
|
392
|
+
rewardSource: z4.enum(["schedule", "contract"]),
|
|
393
|
+
schema: z4.literal(ChainParamsSchema),
|
|
339
394
|
/** Offense code to the share of at-risk stake it slashes, in basis points. */
|
|
340
|
-
slashFractionsBps:
|
|
395
|
+
slashFractionsBps: z4.partialRecord(offenseCodeZod, z4.int().nonnegative()),
|
|
341
396
|
/** Distinct validator signatures a slash certificate needs. */
|
|
342
|
-
slashQuorumCount:
|
|
397
|
+
slashQuorumCount: z4.int().positive(),
|
|
343
398
|
/** Version of this register document. */
|
|
344
|
-
version:
|
|
399
|
+
version: z4.int().positive()
|
|
345
400
|
});
|
|
346
|
-
var isChainParams =
|
|
347
|
-
var asChainParams =
|
|
401
|
+
var isChainParams = zodIsFactory4(ChainParamsZod);
|
|
402
|
+
var asChainParams = zodAsFactory4(ChainParamsZod, "asChainParams");
|
|
348
403
|
var toChainParams = zodToFactory3(ChainParamsZod, "toChainParams");
|
|
349
|
-
var ChainParamsHeadSchema =
|
|
350
|
-
var ChainParamsHeadZod =
|
|
404
|
+
var ChainParamsHeadSchema = asSchema3("network.xyo.s3.chain.params.head", true);
|
|
405
|
+
var ChainParamsHeadZod = z4.object({
|
|
351
406
|
/** Hash of the version document, so a reader can tell it got the one the head meant. */
|
|
352
|
-
hash:
|
|
353
|
-
schema:
|
|
407
|
+
hash: z4.string(),
|
|
408
|
+
schema: z4.literal(ChainParamsHeadSchema),
|
|
354
409
|
/** Version number the pointer names. */
|
|
355
|
-
version:
|
|
410
|
+
version: z4.int().positive()
|
|
356
411
|
});
|
|
357
|
-
var isChainParamsHead =
|
|
358
|
-
var asChainParamsHead =
|
|
412
|
+
var isChainParamsHead = zodIsFactory4(ChainParamsHeadZod);
|
|
413
|
+
var asChainParamsHead = zodAsFactory4(ChainParamsHeadZod, "asChainParamsHead");
|
|
359
414
|
function createChainParams(config) {
|
|
360
415
|
return ChainParamsZod.parse({ ...config, schema: ChainParamsSchema });
|
|
361
416
|
}
|
|
@@ -392,111 +447,154 @@ function chainParamsSuccessionErrors(previous, next, finalizedHeight) {
|
|
|
392
447
|
if (next.chainId !== previous.chainId) {
|
|
393
448
|
errors.push(`chainId must not change: ${previous.chainId} -> ${next.chainId}`);
|
|
394
449
|
}
|
|
450
|
+
if (next.protocolMin < previous.protocolMin) {
|
|
451
|
+
errors.push(`protocolMin must not lower: ${previous.protocolMin} -> ${next.protocolMin}`);
|
|
452
|
+
}
|
|
453
|
+
const previousDeactivations = previous.deactivations ?? {};
|
|
454
|
+
const nextDeactivations = next.deactivations ?? {};
|
|
455
|
+
const isReactivation = (ruleId) => {
|
|
456
|
+
const deactivation = previousDeactivations[ruleId];
|
|
457
|
+
const nextActivation = next.activations[ruleId];
|
|
458
|
+
return deactivation !== void 0 && deactivation <= finalizedHeight && nextActivation !== void 0 && nextActivation > finalizedHeight && nextDeactivations[ruleId] === void 0;
|
|
459
|
+
};
|
|
395
460
|
for (const [ruleId, height] of Object.entries(previous.activations)) {
|
|
396
461
|
if (height > finalizedHeight) continue;
|
|
397
|
-
if (next.activations[ruleId]
|
|
398
|
-
|
|
399
|
-
}
|
|
462
|
+
if (next.activations[ruleId] === height) continue;
|
|
463
|
+
if (isReactivation(ruleId)) continue;
|
|
464
|
+
errors.push(`activation for '${ruleId}' is already in force at ${height} and must not move`);
|
|
400
465
|
}
|
|
401
|
-
for (const [ruleId, height] of Object.entries(
|
|
402
|
-
if (height
|
|
466
|
+
for (const [ruleId, height] of Object.entries(previousDeactivations)) {
|
|
467
|
+
if (height > finalizedHeight) continue;
|
|
468
|
+
if (nextDeactivations[ruleId] === height) continue;
|
|
469
|
+
if (isReactivation(ruleId)) continue;
|
|
470
|
+
errors.push(`deactivation for '${ruleId}' is already in force at ${height} and must not move`);
|
|
471
|
+
}
|
|
472
|
+
for (const [ruleId, height] of Object.entries(nextDeactivations)) {
|
|
473
|
+
if (height < finalizedHeight && previousDeactivations[ruleId] !== height) {
|
|
403
474
|
errors.push(`deactivation for '${ruleId}' at ${height} is in the past`);
|
|
404
475
|
}
|
|
405
476
|
}
|
|
406
477
|
return errors;
|
|
407
478
|
}
|
|
479
|
+
function chainParamsInvariantErrors(params) {
|
|
480
|
+
const errors = [];
|
|
481
|
+
if (params.burnFloorBps + params.bountyShareBps > 1e4) {
|
|
482
|
+
errors.push(`burnFloorBps + bountyShareBps must not exceed 10000: ${params.burnFloorBps} + ${params.bountyShareBps}`);
|
|
483
|
+
}
|
|
484
|
+
const minValidatorStake = tryBigInt(params.minValidatorStakeAtto);
|
|
485
|
+
const bountyCap = tryBigInt(params.bountyCapAtto);
|
|
486
|
+
if (minValidatorStake === void 0 || bountyCap === void 0) {
|
|
487
|
+
errors.push("minValidatorStakeAtto and bountyCapAtto must be parseable amounts");
|
|
488
|
+
return errors;
|
|
489
|
+
}
|
|
490
|
+
const counterSlashBps = BigInt(params.slashFractionsBps["invalid-slash-request"] ?? 0);
|
|
491
|
+
const counterSlashMin = minValidatorStake * counterSlashBps / 10000n;
|
|
492
|
+
if (counterSlashMin < bountyCap * 2n) {
|
|
493
|
+
errors.push(
|
|
494
|
+
`the counter-slash at minimum validator stake (${counterSlashMin}) must be at least twice bountyCapAtto (${bountyCap})`
|
|
495
|
+
);
|
|
496
|
+
}
|
|
497
|
+
return errors;
|
|
498
|
+
}
|
|
499
|
+
function tryBigInt(value) {
|
|
500
|
+
try {
|
|
501
|
+
return BigInt(value.startsWith("0x") ? value : `0x${value}`);
|
|
502
|
+
} catch {
|
|
503
|
+
return void 0;
|
|
504
|
+
}
|
|
505
|
+
}
|
|
408
506
|
|
|
409
507
|
// src/modules/network-model/staticRest/layout/evmEventIndex.ts
|
|
410
508
|
import {
|
|
411
509
|
EthAddressZod,
|
|
412
510
|
HexRegExMinMaxMixedCaseWithPrefix,
|
|
413
|
-
zodAsFactory as
|
|
511
|
+
zodAsFactory as zodAsFactory5
|
|
414
512
|
} from "@ariestools/sdk";
|
|
415
|
-
import { z as
|
|
416
|
-
var EvmHashZod =
|
|
417
|
-
var EvmDataZod =
|
|
418
|
-
var EvmEventIndexLogZod =
|
|
513
|
+
import { z as z5 } from "zod/mini";
|
|
514
|
+
var EvmHashZod = z5.string().check(z5.regex(HexRegExMinMaxMixedCaseWithPrefix(32, 32)));
|
|
515
|
+
var EvmDataZod = z5.string().check(z5.regex(/^0x[\dA-Fa-f]*$/));
|
|
516
|
+
var EvmEventIndexLogZod = z5.object({
|
|
419
517
|
address: EthAddressZod,
|
|
420
518
|
blockHash: EvmHashZod,
|
|
421
|
-
blockNumber:
|
|
519
|
+
blockNumber: z5.number(),
|
|
422
520
|
data: EvmDataZod,
|
|
423
|
-
index:
|
|
424
|
-
topics:
|
|
521
|
+
index: z5.number(),
|
|
522
|
+
topics: z5.array(EvmHashZod),
|
|
425
523
|
transactionHash: EvmHashZod,
|
|
426
|
-
transactionIndex:
|
|
524
|
+
transactionIndex: z5.number()
|
|
427
525
|
});
|
|
428
|
-
var EvmEventIndexFrameZod =
|
|
429
|
-
fromBlock:
|
|
430
|
-
logs:
|
|
431
|
-
toBlock:
|
|
526
|
+
var EvmEventIndexFrameZod = z5.object({
|
|
527
|
+
fromBlock: z5.number(),
|
|
528
|
+
logs: z5.array(EvmEventIndexLogZod),
|
|
529
|
+
toBlock: z5.number()
|
|
432
530
|
});
|
|
433
|
-
var EvmEventIndexManifestZod =
|
|
531
|
+
var EvmEventIndexManifestZod = z5.object({
|
|
434
532
|
address: EthAddressZod,
|
|
435
|
-
chainId:
|
|
436
|
-
deploymentBlock:
|
|
437
|
-
frameSize:
|
|
438
|
-
layout:
|
|
533
|
+
chainId: z5.string(),
|
|
534
|
+
deploymentBlock: z5.number(),
|
|
535
|
+
frameSize: z5.number(),
|
|
536
|
+
layout: z5.literal("evm-contract-events-v1")
|
|
439
537
|
});
|
|
440
|
-
var EvmEventIndexHeadZod =
|
|
538
|
+
var EvmEventIndexHeadZod = z5.object({
|
|
441
539
|
address: EthAddressZod,
|
|
442
|
-
block:
|
|
443
|
-
chainId:
|
|
540
|
+
block: z5.number(),
|
|
541
|
+
chainId: z5.string(),
|
|
444
542
|
hash: EvmHashZod
|
|
445
543
|
});
|
|
446
|
-
var asEvmEventIndexFrame =
|
|
447
|
-
var asEvmEventIndexHead =
|
|
448
|
-
var asEvmEventIndexManifest =
|
|
544
|
+
var asEvmEventIndexFrame = zodAsFactory5(EvmEventIndexFrameZod, "asEvmEventIndexFrame");
|
|
545
|
+
var asEvmEventIndexHead = zodAsFactory5(EvmEventIndexHeadZod, "asEvmEventIndexHead");
|
|
546
|
+
var asEvmEventIndexManifest = zodAsFactory5(EvmEventIndexManifestZod, "asEvmEventIndexManifest");
|
|
449
547
|
|
|
450
548
|
// src/modules/network-model/staticRest/layout/indexManifest.ts
|
|
451
549
|
import {
|
|
452
|
-
zodAsFactory as
|
|
453
|
-
zodIsFactory as
|
|
550
|
+
zodAsFactory as zodAsFactory6,
|
|
551
|
+
zodIsFactory as zodIsFactory5,
|
|
454
552
|
zodToFactory as zodToFactory4
|
|
455
553
|
} from "@ariestools/sdk";
|
|
456
|
-
import { z as
|
|
554
|
+
import { z as z6 } from "zod";
|
|
457
555
|
var INDEX_LAYOUT_VERSION = 1;
|
|
458
556
|
var IndexManifestSchema = "network.xyo.s3.index.manifest";
|
|
459
557
|
var IndexHeadSchema = "network.xyo.s3.index.head";
|
|
460
|
-
var IndexManifestFamilyZod =
|
|
558
|
+
var IndexManifestFamilyZod = z6.object({
|
|
461
559
|
/** Highest step level published for this family. */
|
|
462
|
-
maxStep:
|
|
560
|
+
maxStep: z6.int().nonnegative(),
|
|
463
561
|
/** Path template for the family's frames, e.g. `blocks/{level}/{index}.json`. */
|
|
464
|
-
path:
|
|
562
|
+
path: z6.string()
|
|
465
563
|
});
|
|
466
|
-
var indexFamiliesZod =
|
|
564
|
+
var indexFamiliesZod = z6.object({
|
|
467
565
|
balances: IndexManifestFamilyZod,
|
|
468
566
|
blocks: IndexManifestFamilyZod,
|
|
469
567
|
schemas: IndexManifestFamilyZod,
|
|
470
568
|
transfers: IndexManifestFamilyZod
|
|
471
569
|
});
|
|
472
|
-
var IndexManifestZod =
|
|
570
|
+
var IndexManifestZod = z6.object({
|
|
473
571
|
families: indexFamiliesZod,
|
|
474
|
-
schema:
|
|
475
|
-
version:
|
|
572
|
+
schema: z6.literal(IndexManifestSchema),
|
|
573
|
+
version: z6.int().positive()
|
|
476
574
|
});
|
|
477
|
-
var isIndexManifest =
|
|
478
|
-
var asIndexManifest =
|
|
575
|
+
var isIndexManifest = zodIsFactory5(IndexManifestZod);
|
|
576
|
+
var asIndexManifest = zodAsFactory6(IndexManifestZod, "asIndexManifest");
|
|
479
577
|
var toIndexManifest = zodToFactory4(IndexManifestZod, "toIndexManifest");
|
|
480
|
-
var IndexHeadFamiliesZod =
|
|
481
|
-
balances:
|
|
482
|
-
blocks:
|
|
483
|
-
schemas:
|
|
484
|
-
transfers:
|
|
578
|
+
var IndexHeadFamiliesZod = z6.object({
|
|
579
|
+
balances: z6.int().nonnegative(),
|
|
580
|
+
blocks: z6.int().nonnegative(),
|
|
581
|
+
schemas: z6.int().nonnegative(),
|
|
582
|
+
transfers: z6.int().nonnegative()
|
|
485
583
|
});
|
|
486
|
-
var IndexHeadZod =
|
|
584
|
+
var IndexHeadZod = z6.object({
|
|
487
585
|
/** Highest block the index is complete through. */
|
|
488
|
-
block:
|
|
586
|
+
block: z6.int().nonnegative(),
|
|
489
587
|
/** Completed frame counts per family. */
|
|
490
588
|
families: IndexHeadFamiliesZod,
|
|
491
589
|
/** Hash of that block. */
|
|
492
|
-
hash:
|
|
493
|
-
schema:
|
|
590
|
+
hash: z6.string(),
|
|
591
|
+
schema: z6.literal(IndexHeadSchema),
|
|
494
592
|
/** ISO-8601 timestamp of the last update. */
|
|
495
|
-
updatedAt:
|
|
496
|
-
version:
|
|
593
|
+
updatedAt: z6.string(),
|
|
594
|
+
version: z6.int().positive()
|
|
497
595
|
});
|
|
498
|
-
var isIndexHead =
|
|
499
|
-
var asIndexHead =
|
|
596
|
+
var isIndexHead = zodIsFactory5(IndexHeadZod);
|
|
597
|
+
var asIndexHead = zodAsFactory6(IndexHeadZod, "asIndexHead");
|
|
500
598
|
var toIndexHead = zodToFactory4(IndexHeadZod, "toIndexHead");
|
|
501
599
|
function createIndexManifestFamilies(maxSteps) {
|
|
502
600
|
return {
|
|
@@ -529,107 +627,162 @@ function createIndexHead(watermark, updatedAt) {
|
|
|
529
627
|
// src/modules/network-model/staticRest/layout/networkStakeRewardsIndex.ts
|
|
530
628
|
import {
|
|
531
629
|
HashZod,
|
|
532
|
-
zodAsFactory as
|
|
533
|
-
zodIsFactory as
|
|
630
|
+
zodAsFactory as zodAsFactory7,
|
|
631
|
+
zodIsFactory as zodIsFactory6
|
|
534
632
|
} from "@ariestools/sdk";
|
|
535
|
-
import { asSchema as
|
|
536
|
-
import { z as
|
|
633
|
+
import { asSchema as asSchema4 } from "@xyo-network/sdk";
|
|
634
|
+
import { z as z7 } from "zod";
|
|
537
635
|
var NETWORK_STAKE_REWARDS_INDEX_LAYOUT = "network-stake-rewards-v1";
|
|
538
636
|
var NETWORK_STAKE_REWARDS_UNMULTIPLIED_POLICY = "unmultiplied-v1";
|
|
539
637
|
var NETWORK_STAKE_REWARDS_BASE_POLICY = NETWORK_STAKE_REWARDS_UNMULTIPLIED_POLICY;
|
|
540
|
-
var NetworkStakeRewardsIndexSnapshotSchema =
|
|
541
|
-
var DecimalBigIntZod =
|
|
542
|
-
var NetworkStakeRewardsPolicyIdZod =
|
|
543
|
-
var PositionRewardsZod =
|
|
544
|
-
var BlockRangeZod =
|
|
545
|
-
var StepIdentityJsonZod =
|
|
546
|
-
block:
|
|
547
|
-
step:
|
|
638
|
+
var NetworkStakeRewardsIndexSnapshotSchema = asSchema4("network.xyo.chain.stake.rewards.snapshot", true);
|
|
639
|
+
var DecimalBigIntZod = z7.string().regex(/^(?:0|[1-9]\d*)$/);
|
|
640
|
+
var NetworkStakeRewardsPolicyIdZod = z7.string().regex(/^[a-z0-9][a-z0-9._-]*$/);
|
|
641
|
+
var PositionRewardsZod = z7.record(z7.string().regex(/^(?:0|[1-9]\d*)$/), DecimalBigIntZod);
|
|
642
|
+
var BlockRangeZod = z7.tuple([z7.number().int().nonnegative(), z7.number().int().nonnegative()]);
|
|
643
|
+
var StepIdentityJsonZod = z7.object({
|
|
644
|
+
block: z7.number().int().nonnegative(),
|
|
645
|
+
step: z7.number().int().nonnegative()
|
|
548
646
|
});
|
|
549
|
-
var NetworkStakeRewardsIndexManifestZod =
|
|
550
|
-
evmAddress:
|
|
551
|
-
evmChainId:
|
|
552
|
-
layout:
|
|
647
|
+
var NetworkStakeRewardsIndexManifestZod = z7.object({
|
|
648
|
+
evmAddress: z7.string(),
|
|
649
|
+
evmChainId: z7.string(),
|
|
650
|
+
layout: z7.literal(NETWORK_STAKE_REWARDS_INDEX_LAYOUT),
|
|
553
651
|
policyId: NetworkStakeRewardsPolicyIdZod,
|
|
554
|
-
stepLevels:
|
|
555
|
-
timeAnchor:
|
|
556
|
-
externalGenesisTime:
|
|
557
|
-
maxScanBlocks:
|
|
652
|
+
stepLevels: z7.array(z7.number().int().nonnegative()),
|
|
653
|
+
timeAnchor: z7.object({
|
|
654
|
+
externalGenesisTime: z7.number().optional(),
|
|
655
|
+
maxScanBlocks: z7.number().optional()
|
|
558
656
|
}).optional()
|
|
559
657
|
});
|
|
560
|
-
var NetworkStakeRewardsIndexStepZod =
|
|
658
|
+
var NetworkStakeRewardsIndexStepZod = z7.object({
|
|
561
659
|
denominator: DecimalBigIntZod,
|
|
562
660
|
externalRange: BlockRangeZod,
|
|
563
|
-
layout:
|
|
661
|
+
layout: z7.literal(NETWORK_STAKE_REWARDS_INDEX_LAYOUT),
|
|
564
662
|
policyId: NetworkStakeRewardsPolicyIdZod,
|
|
565
663
|
positionRewards: PositionRewardsZod,
|
|
566
664
|
step: StepIdentityJsonZod,
|
|
567
665
|
totalReward: DecimalBigIntZod,
|
|
568
666
|
xl1Range: BlockRangeZod
|
|
569
667
|
});
|
|
570
|
-
var NetworkStakeRewardsIndexSnapshotZod =
|
|
571
|
-
layout:
|
|
668
|
+
var NetworkStakeRewardsIndexSnapshotZod = z7.object({
|
|
669
|
+
layout: z7.literal(NETWORK_STAKE_REWARDS_INDEX_LAYOUT),
|
|
572
670
|
policyId: NetworkStakeRewardsPolicyIdZod,
|
|
573
671
|
positionRewards: PositionRewardsZod,
|
|
574
|
-
schema:
|
|
575
|
-
stepCount:
|
|
672
|
+
schema: z7.literal(NetworkStakeRewardsIndexSnapshotSchema),
|
|
673
|
+
stepCount: z7.number().int().nonnegative(),
|
|
576
674
|
totalReward: DecimalBigIntZod
|
|
577
675
|
});
|
|
578
|
-
var NetworkStakeRewardsIndexHeadZod =
|
|
579
|
-
layout:
|
|
676
|
+
var NetworkStakeRewardsIndexHeadZod = z7.object({
|
|
677
|
+
layout: z7.literal(NETWORK_STAKE_REWARDS_INDEX_LAYOUT),
|
|
580
678
|
policyId: NetworkStakeRewardsPolicyIdZod,
|
|
581
|
-
positionCount:
|
|
582
|
-
processedThroughBlock:
|
|
679
|
+
positionCount: z7.number().int().nonnegative(),
|
|
680
|
+
processedThroughBlock: z7.number().int().nonnegative(),
|
|
583
681
|
snapshotHash: HashZod,
|
|
584
|
-
source:
|
|
585
|
-
evm:
|
|
586
|
-
block:
|
|
587
|
-
hash:
|
|
682
|
+
source: z7.object({
|
|
683
|
+
evm: z7.object({
|
|
684
|
+
block: z7.number().int().nonnegative(),
|
|
685
|
+
hash: z7.string()
|
|
588
686
|
}),
|
|
589
|
-
xl1:
|
|
590
|
-
block:
|
|
591
|
-
hash:
|
|
687
|
+
xl1: z7.object({
|
|
688
|
+
block: z7.number().int().nonnegative(),
|
|
689
|
+
hash: z7.string()
|
|
592
690
|
})
|
|
593
691
|
}),
|
|
594
|
-
stepCount:
|
|
692
|
+
stepCount: z7.number().int().nonnegative()
|
|
595
693
|
});
|
|
596
|
-
var isNetworkStakeRewardsIndexManifest =
|
|
597
|
-
var asNetworkStakeRewardsIndexManifest =
|
|
694
|
+
var isNetworkStakeRewardsIndexManifest = zodIsFactory6(NetworkStakeRewardsIndexManifestZod);
|
|
695
|
+
var asNetworkStakeRewardsIndexManifest = zodAsFactory7(
|
|
598
696
|
NetworkStakeRewardsIndexManifestZod,
|
|
599
697
|
"asNetworkStakeRewardsIndexManifest"
|
|
600
698
|
);
|
|
601
|
-
var asNetworkStakeRewardsIndexStep =
|
|
699
|
+
var asNetworkStakeRewardsIndexStep = zodAsFactory7(
|
|
602
700
|
NetworkStakeRewardsIndexStepZod,
|
|
603
701
|
"asNetworkStakeRewardsIndexStep"
|
|
604
702
|
);
|
|
605
|
-
var asNetworkStakeRewardsIndexSnapshot =
|
|
703
|
+
var asNetworkStakeRewardsIndexSnapshot = zodAsFactory7(
|
|
606
704
|
NetworkStakeRewardsIndexSnapshotZod,
|
|
607
705
|
"asNetworkStakeRewardsIndexSnapshot"
|
|
608
706
|
);
|
|
609
|
-
var asNetworkStakeRewardsIndexHead =
|
|
707
|
+
var asNetworkStakeRewardsIndexHead = zodAsFactory7(
|
|
610
708
|
NetworkStakeRewardsIndexHeadZod,
|
|
611
709
|
"asNetworkStakeRewardsIndexHead"
|
|
612
710
|
);
|
|
613
711
|
|
|
712
|
+
// src/modules/network-model/staticRest/layout/slashIndex.ts
|
|
713
|
+
import {
|
|
714
|
+
zodAsFactory as zodAsFactory8,
|
|
715
|
+
zodIsFactory as zodIsFactory7,
|
|
716
|
+
zodToFactory as zodToFactory5
|
|
717
|
+
} from "@ariestools/sdk";
|
|
718
|
+
import { asSchema as asSchema5 } from "@xyo-network/sdk";
|
|
719
|
+
import { z as z8 } from "zod";
|
|
720
|
+
import { OffenseCodes as OffenseCodes2 } from "#protocol-model";
|
|
721
|
+
var SlashIndexHeadSchema = asSchema5("network.xyo.s3.slash.index.head", true);
|
|
722
|
+
var SLASH_INDEX_VERSION = 1;
|
|
723
|
+
var offenseCodeZod2 = z8.enum(OffenseCodes2);
|
|
724
|
+
var SlashIndexHeadZod = z8.object({
|
|
725
|
+
/** Highest finalized height the index has folded in. */
|
|
726
|
+
height: z8.int().nonnegative(),
|
|
727
|
+
/** Layout version of the objects this head points at. */
|
|
728
|
+
indexVersion: z8.int().positive(),
|
|
729
|
+
schema: z8.literal(SlashIndexHeadSchema),
|
|
730
|
+
/** When the pass that wrote this ran, on the EVM clock, when it was known. */
|
|
731
|
+
anchor: z8.optional(z8.int().nonnegative())
|
|
732
|
+
});
|
|
733
|
+
var isSlashIndexHead = zodIsFactory7(SlashIndexHeadZod);
|
|
734
|
+
var asSlashIndexHead = zodAsFactory8(SlashIndexHeadZod, "asSlashIndexHead");
|
|
735
|
+
var toSlashIndexHead = zodToFactory5(SlashIndexHeadZod, "toSlashIndexHead");
|
|
736
|
+
var SlashIndexKeyRecordSchema = asSchema5("network.xyo.s3.slash.index.key", true);
|
|
737
|
+
var SlashIndexKeyRecordZod = z8.object({
|
|
738
|
+
/** Who is accused. */
|
|
739
|
+
accused: z8.string(),
|
|
740
|
+
/** Hash of the adjudication that closed it, when one has. */
|
|
741
|
+
adjudication: z8.optional(z8.string()),
|
|
742
|
+
/** The canonical height the offense is located at. */
|
|
743
|
+
block: z8.int().nonnegative(),
|
|
744
|
+
/** Hashes of challenges filed against reports of it. */
|
|
745
|
+
challenges: z8.array(z8.string()),
|
|
746
|
+
/** The chain it happened on. */
|
|
747
|
+
chain: z8.string(),
|
|
748
|
+
/** How it was resolved, when it has been. */
|
|
749
|
+
outcome: z8.optional(z8.enum(["confirmed", "refuted", "indeterminate", "invalid"])),
|
|
750
|
+
/** Which offense class. */
|
|
751
|
+
offense: offenseCodeZod2,
|
|
752
|
+
/** Hashes of every report filed for it, earliest first. */
|
|
753
|
+
requests: z8.array(z8.string()),
|
|
754
|
+
schema: z8.literal(SlashIndexKeyRecordSchema)
|
|
755
|
+
});
|
|
756
|
+
var isSlashIndexKeyRecord = zodIsFactory7(SlashIndexKeyRecordZod);
|
|
757
|
+
var asSlashIndexKeyRecord = zodAsFactory8(SlashIndexKeyRecordZod, "asSlashIndexKeyRecord");
|
|
758
|
+
function createSlashIndexHead(height, anchor) {
|
|
759
|
+
return SlashIndexHeadZod.parse({
|
|
760
|
+
anchor,
|
|
761
|
+
height,
|
|
762
|
+
indexVersion: SLASH_INDEX_VERSION,
|
|
763
|
+
schema: SlashIndexHeadSchema
|
|
764
|
+
});
|
|
765
|
+
}
|
|
766
|
+
|
|
614
767
|
// src/modules/network-model/staticRest/layout/transactionInclusionIndex.ts
|
|
615
768
|
import {
|
|
616
769
|
HashZod as HashZod2,
|
|
617
|
-
zodAsFactory as
|
|
618
|
-
zodIsFactory as
|
|
619
|
-
zodToFactory as
|
|
770
|
+
zodAsFactory as zodAsFactory9,
|
|
771
|
+
zodIsFactory as zodIsFactory8,
|
|
772
|
+
zodToFactory as zodToFactory6
|
|
620
773
|
} from "@ariestools/sdk";
|
|
621
|
-
import { z as
|
|
774
|
+
import { z as z9 } from "zod";
|
|
622
775
|
import { ChainIdZod as ChainIdZod3, XL1BlockNumberZod } from "#protocol-model";
|
|
623
776
|
var TRANSACTION_INCLUSION_INDEX_LAYOUT = "transaction-inclusions-v1";
|
|
624
|
-
var TransactionInclusionManifestZod =
|
|
777
|
+
var TransactionInclusionManifestZod = z9.object({
|
|
625
778
|
/** XL1 chain whose finalized transactions are indexed. */
|
|
626
779
|
chain: ChainIdZod3,
|
|
627
780
|
/** Versioned layout identifier. */
|
|
628
|
-
layout:
|
|
781
|
+
layout: z9.literal(TRANSACTION_INCLUSION_INDEX_LAYOUT),
|
|
629
782
|
/** Hash-addressed path template, for example `transactions/by-hash/{hash}.json`. */
|
|
630
|
-
path:
|
|
783
|
+
path: z9.string()
|
|
631
784
|
});
|
|
632
|
-
var TransactionInclusionHeadZod =
|
|
785
|
+
var TransactionInclusionHeadZod = z9.object({
|
|
633
786
|
/** Highest finalized block fully represented by the lookup. */
|
|
634
787
|
block: XL1BlockNumberZod,
|
|
635
788
|
/** Hash of the highest finalized block fully represented by the lookup. */
|
|
@@ -637,25 +790,25 @@ var TransactionInclusionHeadZod = z7.object({
|
|
|
637
790
|
/** XL1 chain whose finalized transactions are indexed. */
|
|
638
791
|
chain: ChainIdZod3,
|
|
639
792
|
/** Number of transaction-inclusion records represented through `block`. */
|
|
640
|
-
entries:
|
|
793
|
+
entries: z9.int().nonnegative(),
|
|
641
794
|
/** Versioned layout identifier. */
|
|
642
|
-
layout:
|
|
795
|
+
layout: z9.literal(TRANSACTION_INCLUSION_INDEX_LAYOUT)
|
|
643
796
|
});
|
|
644
|
-
var isTransactionInclusionManifest =
|
|
645
|
-
var asTransactionInclusionManifest =
|
|
797
|
+
var isTransactionInclusionManifest = zodIsFactory8(TransactionInclusionManifestZod);
|
|
798
|
+
var asTransactionInclusionManifest = zodAsFactory9(
|
|
646
799
|
TransactionInclusionManifestZod,
|
|
647
800
|
"asTransactionInclusionManifest"
|
|
648
801
|
);
|
|
649
|
-
var toTransactionInclusionManifest =
|
|
802
|
+
var toTransactionInclusionManifest = zodToFactory6(
|
|
650
803
|
TransactionInclusionManifestZod,
|
|
651
804
|
"toTransactionInclusionManifest"
|
|
652
805
|
);
|
|
653
|
-
var isTransactionInclusionHead =
|
|
654
|
-
var asTransactionInclusionHead =
|
|
806
|
+
var isTransactionInclusionHead = zodIsFactory8(TransactionInclusionHeadZod);
|
|
807
|
+
var asTransactionInclusionHead = zodAsFactory9(
|
|
655
808
|
TransactionInclusionHeadZod,
|
|
656
809
|
"asTransactionInclusionHead"
|
|
657
810
|
);
|
|
658
|
-
var toTransactionInclusionHead =
|
|
811
|
+
var toTransactionInclusionHead = zodToFactory6(
|
|
659
812
|
TransactionInclusionHeadZod,
|
|
660
813
|
"toTransactionInclusionHead"
|
|
661
814
|
);
|
|
@@ -754,6 +907,42 @@ function networkStakeRewardsIndexStepPath(policyId, step) {
|
|
|
754
907
|
return `${root2(policyId)}/steps/${step.step}/${step.block}.json`;
|
|
755
908
|
}
|
|
756
909
|
|
|
910
|
+
// src/modules/network-model/staticRest/paths/slashIndex.ts
|
|
911
|
+
var ROOT = "slash/v1";
|
|
912
|
+
function slashIndexHeadPath() {
|
|
913
|
+
return `${ROOT}/head.json`;
|
|
914
|
+
}
|
|
915
|
+
function slashIndexManifestPath() {
|
|
916
|
+
return `${ROOT}/manifest.json`;
|
|
917
|
+
}
|
|
918
|
+
function slashIndexRequestPath(hash) {
|
|
919
|
+
return `${ROOT}/requests/by-hash/${hash}.json`;
|
|
920
|
+
}
|
|
921
|
+
function slashIndexCommitPath(hash) {
|
|
922
|
+
return `${ROOT}/commits/by-hash/${hash}.json`;
|
|
923
|
+
}
|
|
924
|
+
function slashIndexChallengePath(hash) {
|
|
925
|
+
return `${ROOT}/challenges/by-hash/${hash}.json`;
|
|
926
|
+
}
|
|
927
|
+
function slashIndexAdjudicationPath(hash) {
|
|
928
|
+
return `${ROOT}/adjudications/by-hash/${hash}.json`;
|
|
929
|
+
}
|
|
930
|
+
function slashIndexKeyPath(accused, offense, block) {
|
|
931
|
+
return `${ROOT}/keys/${accused.toLowerCase()}/${offense}/${block}.json`;
|
|
932
|
+
}
|
|
933
|
+
function slashIndexAccusedPath(address) {
|
|
934
|
+
return `${ROOT}/accused/${address.toLowerCase()}.json`;
|
|
935
|
+
}
|
|
936
|
+
function slashIndexClaimantPath(address) {
|
|
937
|
+
return `${ROOT}/claimants/${address.toLowerCase()}.json`;
|
|
938
|
+
}
|
|
939
|
+
function admissionShadowPath(height) {
|
|
940
|
+
return `admission/shadow/${height}.json`;
|
|
941
|
+
}
|
|
942
|
+
function admissionShadowHeadPath() {
|
|
943
|
+
return "admission/shadow/head.json";
|
|
944
|
+
}
|
|
945
|
+
|
|
757
946
|
// src/modules/network-model/utils/ExplorerLinks.ts
|
|
758
947
|
var ExplorerLinks = class {
|
|
759
948
|
/** Explorer origin with trailing slashes removed. */
|
|
@@ -814,6 +1003,9 @@ var ExplorerLinks = class {
|
|
|
814
1003
|
}
|
|
815
1004
|
};
|
|
816
1005
|
export {
|
|
1006
|
+
AdmissionShadowAssessmentZod,
|
|
1007
|
+
AdmissionShadowReportSchema,
|
|
1008
|
+
AdmissionShadowReportZod,
|
|
817
1009
|
CHAIN_CONTRACT_MANIFEST_VERSION,
|
|
818
1010
|
CHAIN_LAYOUT_VERSION,
|
|
819
1011
|
CHAIN_PARAMS_VERSION,
|
|
@@ -856,11 +1048,19 @@ export {
|
|
|
856
1048
|
NetworkStakeRewardsIndexStepZod,
|
|
857
1049
|
NetworkStakeRewardsPolicyIdZod,
|
|
858
1050
|
RuleIdZod,
|
|
1051
|
+
SLASH_INDEX_VERSION,
|
|
859
1052
|
SequenceNetwork,
|
|
860
1053
|
testnet_default as SequenceNetworkIconString,
|
|
1054
|
+
SlashIndexHeadSchema,
|
|
1055
|
+
SlashIndexHeadZod,
|
|
1056
|
+
SlashIndexKeyRecordSchema,
|
|
1057
|
+
SlashIndexKeyRecordZod,
|
|
861
1058
|
TRANSACTION_INCLUSION_INDEX_LAYOUT,
|
|
862
1059
|
TransactionInclusionHeadZod,
|
|
863
1060
|
TransactionInclusionManifestZod,
|
|
1061
|
+
admissionShadowHeadPath,
|
|
1062
|
+
admissionShadowPath,
|
|
1063
|
+
asAdmissionShadowReport,
|
|
864
1064
|
asChainContractManifest,
|
|
865
1065
|
asChainManifest,
|
|
866
1066
|
asChainParams,
|
|
@@ -875,6 +1075,8 @@ export {
|
|
|
875
1075
|
asNetworkStakeRewardsIndexSnapshot,
|
|
876
1076
|
asNetworkStakeRewardsIndexStep,
|
|
877
1077
|
asOptionalNetwork,
|
|
1078
|
+
asSlashIndexHead,
|
|
1079
|
+
asSlashIndexKeyRecord,
|
|
878
1080
|
asTransactionInclusionHead,
|
|
879
1081
|
asTransactionInclusionManifest,
|
|
880
1082
|
blockHashPath,
|
|
@@ -884,8 +1086,10 @@ export {
|
|
|
884
1086
|
chainContractByIdPath,
|
|
885
1087
|
chainManifestPathTemplates,
|
|
886
1088
|
chainParamsHeadPath,
|
|
1089
|
+
chainParamsInvariantErrors,
|
|
887
1090
|
chainParamsSuccessionErrors,
|
|
888
1091
|
chainParamsVersionPath,
|
|
1092
|
+
createAdmissionShadowReport,
|
|
889
1093
|
createChainContractManifest,
|
|
890
1094
|
createChainManifest,
|
|
891
1095
|
createChainParams,
|
|
@@ -893,6 +1097,7 @@ export {
|
|
|
893
1097
|
createIndexHead,
|
|
894
1098
|
createIndexManifest,
|
|
895
1099
|
createIndexManifestFamilies,
|
|
1100
|
+
createSlashIndexHead,
|
|
896
1101
|
createTransactionInclusionHead,
|
|
897
1102
|
createTransactionInclusionManifest,
|
|
898
1103
|
createTrustedPostureParams,
|
|
@@ -909,6 +1114,7 @@ export {
|
|
|
909
1114
|
indexSummaryPathTemplate,
|
|
910
1115
|
initNetworkNode,
|
|
911
1116
|
interpolatePathTemplate,
|
|
1117
|
+
isAdmissionShadowReport,
|
|
912
1118
|
isChainContractManifest,
|
|
913
1119
|
isChainManifest,
|
|
914
1120
|
isChainParams,
|
|
@@ -918,6 +1124,8 @@ export {
|
|
|
918
1124
|
isNetworkBootstrap,
|
|
919
1125
|
isNetworkStakeRewardsIndexManifest,
|
|
920
1126
|
isOffenseReportableAt,
|
|
1127
|
+
isSlashIndexHead,
|
|
1128
|
+
isSlashIndexKeyRecord,
|
|
921
1129
|
isTransactionInclusionHead,
|
|
922
1130
|
isTransactionInclusionManifest,
|
|
923
1131
|
manifestPath,
|
|
@@ -929,12 +1137,22 @@ export {
|
|
|
929
1137
|
payloadPath,
|
|
930
1138
|
payloadPathTemplate,
|
|
931
1139
|
protocolMinAt,
|
|
1140
|
+
slashIndexAccusedPath,
|
|
1141
|
+
slashIndexAdjudicationPath,
|
|
1142
|
+
slashIndexChallengePath,
|
|
1143
|
+
slashIndexClaimantPath,
|
|
1144
|
+
slashIndexCommitPath,
|
|
1145
|
+
slashIndexHeadPath,
|
|
1146
|
+
slashIndexKeyPath,
|
|
1147
|
+
slashIndexManifestPath,
|
|
1148
|
+
slashIndexRequestPath,
|
|
932
1149
|
toChainContractManifest,
|
|
933
1150
|
toChainManifest,
|
|
934
1151
|
toChainParams,
|
|
935
1152
|
toIndexHead,
|
|
936
1153
|
toIndexManifest,
|
|
937
1154
|
toPathTemplate,
|
|
1155
|
+
toSlashIndexHead,
|
|
938
1156
|
toTransactionInclusionHead,
|
|
939
1157
|
toTransactionInclusionManifest,
|
|
940
1158
|
transactionInclusionHeadPath,
|