@xyo-network/xl1-protocol 5.1.4 → 5.2.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/dist/neutral/modules/network-model/staticRest/layout/admissionShadow.d.ts +147 -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 +371 -0
- package/dist/neutral/modules/network-model/staticRest/layout/chainParams.d.ts.map +1 -0
- package/dist/neutral/modules/network-model/staticRest/layout/chainParamsRules.d.ts +36 -0
- package/dist/neutral/modules/network-model/staticRest/layout/chainParamsRules.d.ts.map +1 -0
- package/dist/neutral/modules/network-model/staticRest/layout/index.d.ts +5 -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/layout/trustedPosture.d.ts +81 -0
- package/dist/neutral/modules/network-model/staticRest/layout/trustedPosture.d.ts.map +1 -0
- package/dist/neutral/modules/network-model/staticRest/paths/chainState.d.ts +7 -0
- package/dist/neutral/modules/network-model/staticRest/paths/chainState.d.ts.map +1 -1
- 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-lib/validation/payload/InBlockPayloadValidationFunction.d.ts +37 -3
- package/dist/neutral/modules/protocol-lib/validation/payload/InBlockPayloadValidationFunction.d.ts.map +1 -1
- package/dist/neutral/modules/protocol-lib/validation/payload/index.d.ts +1 -0
- package/dist/neutral/modules/protocol-lib/validation/payload/index.d.ts.map +1 -1
- package/dist/neutral/modules/protocol-lib/validation/payload/ruleGate.d.ts +29 -0
- package/dist/neutral/modules/protocol-lib/validation/payload/ruleGate.d.ts.map +1 -0
- package/dist/neutral/modules/protocol-lib/viewers/ChainParams.d.ts +26 -0
- package/dist/neutral/modules/protocol-lib/viewers/ChainParams.d.ts.map +1 -0
- package/dist/neutral/modules/protocol-lib/viewers/index.d.ts +1 -0
- package/dist/neutral/modules/protocol-lib/viewers/index.d.ts.map +1 -1
- package/dist/neutral/modules/protocol-model/block/AllowedBlockPayload.d.ts +14 -2
- package/dist/neutral/modules/protocol-model/block/AllowedBlockPayload.d.ts.map +1 -1
- package/dist/neutral/modules/protocol-model/block/BlockBoundWitness.d.ts +19 -0
- package/dist/neutral/modules/protocol-model/block/BlockBoundWitness.d.ts.map +1 -1
- package/dist/neutral/modules/protocol-model/block/HydratedBlock.d.ts +44 -0
- package/dist/neutral/modules/protocol-model/block/HydratedBlock.d.ts.map +1 -1
- package/dist/neutral/modules/protocol-model/block/signed/SignedBlockBoundWitness.d.ts +6 -0
- package/dist/neutral/modules/protocol-model/block/signed/SignedBlockBoundWitness.d.ts.map +1 -1
- package/dist/neutral/modules/protocol-model/block/signed/SignedBlockBoundWitnessWithHashMeta.d.ts +10 -0
- package/dist/neutral/modules/protocol-model/block/signed/SignedBlockBoundWitnessWithHashMeta.d.ts.map +1 -1
- package/dist/neutral/modules/protocol-model/block/signed/SignedBlockBoundWitnessWithStorageMeta.d.ts +12 -0
- package/dist/neutral/modules/protocol-model/block/signed/SignedBlockBoundWitnessWithStorageMeta.d.ts.map +1 -1
- package/dist/neutral/modules/protocol-model/block/unsigned/UnsignedBlockBoundWitness.d.ts +6 -0
- package/dist/neutral/modules/protocol-model/block/unsigned/UnsignedBlockBoundWitness.d.ts.map +1 -1
- package/dist/neutral/modules/protocol-model/evidence/EvidenceDisposition.d.ts +1 -1
- package/dist/neutral/modules/protocol-model/evidence/EvidenceNotePayload.d.ts +1 -1
- package/dist/neutral/modules/protocol-model/model/AccountBalance.d.ts +1 -0
- package/dist/neutral/modules/protocol-model/model/AccountBalance.d.ts.map +1 -1
- package/dist/neutral/modules/protocol-model/model/Context/ChainContext.zod.d.ts +3 -0
- package/dist/neutral/modules/protocol-model/model/Context/ChainContext.zod.d.ts.map +1 -1
- package/dist/neutral/modules/protocol-model/model/Context/HeadContext.zod.d.ts +2 -0
- package/dist/neutral/modules/protocol-model/model/Context/HeadContext.zod.d.ts.map +1 -1
- package/dist/neutral/modules/protocol-model/model/OffenseCode.d.ts +13 -0
- package/dist/neutral/modules/protocol-model/model/OffenseCode.d.ts.map +1 -0
- package/dist/neutral/modules/protocol-model/model/RuleActivation.d.ts +63 -0
- package/dist/neutral/modules/protocol-model/model/RuleActivation.d.ts.map +1 -0
- package/dist/neutral/modules/protocol-model/model/SyncStepSummary.d.ts +6 -0
- package/dist/neutral/modules/protocol-model/model/SyncStepSummary.d.ts.map +1 -1
- package/dist/neutral/modules/protocol-model/model/index.d.ts +2 -0
- package/dist/neutral/modules/protocol-model/model/index.d.ts.map +1 -1
- package/dist/neutral/modules/protocol-model/model/version.d.ts +2 -2
- package/dist/neutral/modules/protocol-model/payload/index.d.ts +1 -0
- package/dist/neutral/modules/protocol-model/payload/index.d.ts.map +1 -1
- package/dist/neutral/modules/protocol-model/payload/slash/SlashAdjudicationPayload.d.ts +51 -0
- package/dist/neutral/modules/protocol-model/payload/slash/SlashAdjudicationPayload.d.ts.map +1 -0
- package/dist/neutral/modules/protocol-model/payload/slash/SlashChallengePayload.d.ts +33 -0
- package/dist/neutral/modules/protocol-model/payload/slash/SlashChallengePayload.d.ts.map +1 -0
- package/dist/neutral/modules/protocol-model/payload/slash/SlashCommitPayload.d.ts +35 -0
- package/dist/neutral/modules/protocol-model/payload/slash/SlashCommitPayload.d.ts.map +1 -0
- package/dist/neutral/modules/protocol-model/payload/slash/SlashEvidencePayload.d.ts +33 -0
- package/dist/neutral/modules/protocol-model/payload/slash/SlashEvidencePayload.d.ts.map +1 -0
- package/dist/neutral/modules/protocol-model/payload/slash/SlashRequestPayload.d.ts +46 -0
- package/dist/neutral/modules/protocol-model/payload/slash/SlashRequestPayload.d.ts.map +1 -0
- package/dist/neutral/modules/protocol-model/payload/slash/index.d.ts +6 -0
- package/dist/neutral/modules/protocol-model/payload/slash/index.d.ts.map +1 -0
- package/dist/neutral/modules/protocol-model/rejection/BlockRejectionPayload.d.ts +4 -0
- package/dist/neutral/modules/protocol-model/rejection/BlockRejectionPayload.d.ts.map +1 -1
- package/dist/neutral/network-model.mjs +523 -144
- package/dist/neutral/network-model.mjs.map +4 -4
- package/dist/neutral/protocol-lib.mjs +19 -0
- package/dist/neutral/protocol-lib.mjs.map +3 -3
- package/dist/neutral/protocol-model.mjs +505 -296
- package/dist/neutral/protocol-model.mjs.map +4 -4
- package/package.json +3 -3
|
@@ -106,34 +106,80 @@ 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
|
+
/** Whether the allow-list admits it. */
|
|
116
|
+
admittedByAllowList: z.boolean(),
|
|
117
|
+
/** The candidate's height. */
|
|
118
|
+
block: z.int().nonnegative(),
|
|
119
|
+
/** The candidate's signed identity. */
|
|
120
|
+
dataHash: z.string(),
|
|
121
|
+
/** The EVM height stake was measured at, when it could be. */
|
|
122
|
+
eStar: z.optional(z.int().nonnegative()),
|
|
123
|
+
/** Whether participation admits it, when that could be established. */
|
|
124
|
+
eligible: z.optional(z.boolean()),
|
|
125
|
+
/** The producer. */
|
|
126
|
+
producer: z.string(),
|
|
127
|
+
/** Why participation refused, when it did. */
|
|
128
|
+
reason: z.optional(z.string()),
|
|
129
|
+
/** False when the participation question could not be put at all. */
|
|
130
|
+
resolvable: z.boolean()
|
|
131
|
+
});
|
|
132
|
+
var AdmissionShadowReportZod = z.object({
|
|
133
|
+
/** Every candidate considered this round. */
|
|
134
|
+
assessments: z.array(AdmissionShadowAssessmentZod),
|
|
135
|
+
/** Only those where the two gates disagreed. */
|
|
136
|
+
divergent: z.array(AdmissionShadowAssessmentZod),
|
|
137
|
+
/** The finalized height this round was selected against. */
|
|
138
|
+
head: z.int().nonnegative(),
|
|
139
|
+
/** Height of the previous published report, so the series can be walked backwards. */
|
|
140
|
+
previous: z.optional(z.int().nonnegative()),
|
|
141
|
+
schema: z.literal(AdmissionShadowReportSchema)
|
|
142
|
+
});
|
|
143
|
+
var isAdmissionShadowReport = zodIsFactory(AdmissionShadowReportZod);
|
|
144
|
+
var asAdmissionShadowReport = zodAsFactory(AdmissionShadowReportZod, "asAdmissionShadowReport");
|
|
145
|
+
function createAdmissionShadowReport(head, assessments, divergent, previous) {
|
|
146
|
+
return AdmissionShadowReportZod.parse({
|
|
147
|
+
assessments,
|
|
148
|
+
divergent,
|
|
149
|
+
head,
|
|
150
|
+
previous,
|
|
151
|
+
schema: AdmissionShadowReportSchema
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
|
|
109
155
|
// src/modules/network-model/staticRest/layout/chainContractManifest.ts
|
|
110
156
|
import {
|
|
111
|
-
zodAsFactory,
|
|
112
|
-
zodIsFactory,
|
|
157
|
+
zodAsFactory as zodAsFactory2,
|
|
158
|
+
zodIsFactory as zodIsFactory2,
|
|
113
159
|
zodToFactory
|
|
114
160
|
} from "@ariestools/sdk";
|
|
115
|
-
import { z } from "zod";
|
|
161
|
+
import { z as z2 } from "zod";
|
|
116
162
|
import {
|
|
117
163
|
ChainIdZod,
|
|
118
164
|
NumberishZod
|
|
119
165
|
} from "#protocol-lib";
|
|
120
|
-
var ChainContractBlockNumberZod = NumberishZod.pipe(
|
|
166
|
+
var ChainContractBlockNumberZod = NumberishZod.pipe(z2.int().nonnegative()).transform((value) => value);
|
|
121
167
|
var ChainContractManifestSchema = "network.xyo.s3.chain.contract";
|
|
122
168
|
var CHAIN_CONTRACT_MANIFEST_VERSION = 1;
|
|
123
|
-
var ChainContractManifestZod =
|
|
169
|
+
var ChainContractManifestZod = z2.object({
|
|
124
170
|
/** Self-identifying chain id (matches the path key). Optional for older fixtures. */
|
|
125
|
-
chainId:
|
|
171
|
+
chainId: z2.optional(ChainIdZod),
|
|
126
172
|
forkedAtBlockNumber: ChainContractBlockNumberZod.nullable().optional(),
|
|
127
|
-
forkedAtHash:
|
|
128
|
-
forkedChainId:
|
|
129
|
-
minWithdrawalBlocks: NumberishZod.pipe(
|
|
130
|
-
rewardsContract:
|
|
131
|
-
schema:
|
|
132
|
-
stakingTokenAddress:
|
|
133
|
-
version:
|
|
173
|
+
forkedAtHash: z2.string().nullable().optional(),
|
|
174
|
+
forkedChainId: z2.nullable(ChainIdZod).optional(),
|
|
175
|
+
minWithdrawalBlocks: NumberishZod.pipe(z2.int().nonnegative()),
|
|
176
|
+
rewardsContract: z2.string(),
|
|
177
|
+
schema: z2.literal(ChainContractManifestSchema),
|
|
178
|
+
stakingTokenAddress: z2.string(),
|
|
179
|
+
version: z2.int().positive()
|
|
134
180
|
});
|
|
135
|
-
var isChainContractManifest =
|
|
136
|
-
var asChainContractManifest =
|
|
181
|
+
var isChainContractManifest = zodIsFactory2(ChainContractManifestZod);
|
|
182
|
+
var asChainContractManifest = zodAsFactory2(ChainContractManifestZod, "asChainContractManifest");
|
|
137
183
|
var toChainContractManifest = zodToFactory(ChainContractManifestZod, "toChainContractManifest");
|
|
138
184
|
function createChainContractManifest(config) {
|
|
139
185
|
return ChainContractManifestZod.parse({
|
|
@@ -145,11 +191,11 @@ function createChainContractManifest(config) {
|
|
|
145
191
|
|
|
146
192
|
// src/modules/network-model/staticRest/layout/chainManifest.ts
|
|
147
193
|
import {
|
|
148
|
-
zodAsFactory as
|
|
149
|
-
zodIsFactory as
|
|
194
|
+
zodAsFactory as zodAsFactory3,
|
|
195
|
+
zodIsFactory as zodIsFactory3,
|
|
150
196
|
zodToFactory as zodToFactory2
|
|
151
197
|
} from "@ariestools/sdk";
|
|
152
|
-
import { z as
|
|
198
|
+
import { z as z3 } from "zod";
|
|
153
199
|
|
|
154
200
|
// src/modules/network-model/staticRest/templates.ts
|
|
155
201
|
import { asHash } from "@ariestools/sdk";
|
|
@@ -157,6 +203,8 @@ import { asHash } from "@ariestools/sdk";
|
|
|
157
203
|
// src/modules/network-model/staticRest/paths/chainState.ts
|
|
158
204
|
var headPath = () => "chain/head.json";
|
|
159
205
|
var chainContractByIdPath = (chainId) => `chain/contracts/${chainId.toLowerCase()}.json`;
|
|
206
|
+
var chainParamsVersionPath = (chainId, version) => `chain/params/${chainId.toLowerCase()}/v${version}.json`;
|
|
207
|
+
var chainParamsHeadPath = (chainId) => `chain/params/${chainId.toLowerCase()}/head.json`;
|
|
160
208
|
|
|
161
209
|
// src/modules/network-model/staticRest/paths/finalized.ts
|
|
162
210
|
var manifestPath = () => "manifest.json";
|
|
@@ -232,23 +280,23 @@ function transactionInclusionPathTemplate() {
|
|
|
232
280
|
// src/modules/network-model/staticRest/layout/chainManifest.ts
|
|
233
281
|
var CHAIN_LAYOUT_VERSION = 1;
|
|
234
282
|
var ChainManifestSchema = "network.xyo.s3.chain.manifest";
|
|
235
|
-
var ChainManifestPathsZod =
|
|
236
|
-
blockByHash:
|
|
237
|
-
blockByNumber:
|
|
238
|
-
head:
|
|
239
|
-
payload:
|
|
283
|
+
var ChainManifestPathsZod = z3.object({
|
|
284
|
+
blockByHash: z3.string(),
|
|
285
|
+
blockByNumber: z3.string(),
|
|
286
|
+
head: z3.string(),
|
|
287
|
+
payload: z3.string()
|
|
240
288
|
});
|
|
241
|
-
var ChainManifestZod =
|
|
289
|
+
var ChainManifestZod = z3.object({
|
|
242
290
|
/** Lowest block number available in the bucket (genesis until pruning exists). */
|
|
243
|
-
earliestBlock:
|
|
291
|
+
earliestBlock: z3.int().nonnegative(),
|
|
244
292
|
/** Storage/wire encoding of the published files (also on each object's Content-Encoding). */
|
|
245
|
-
encoding:
|
|
293
|
+
encoding: z3.string(),
|
|
246
294
|
paths: ChainManifestPathsZod,
|
|
247
|
-
schema:
|
|
248
|
-
version:
|
|
295
|
+
schema: z3.literal(ChainManifestSchema),
|
|
296
|
+
version: z3.int().positive()
|
|
249
297
|
});
|
|
250
|
-
var isChainManifest =
|
|
251
|
-
var asChainManifest =
|
|
298
|
+
var isChainManifest = zodIsFactory3(ChainManifestZod);
|
|
299
|
+
var asChainManifest = zodAsFactory3(ChainManifestZod, "asChainManifest");
|
|
252
300
|
var toChainManifest = zodToFactory2(ChainManifestZod, "toChainManifest");
|
|
253
301
|
function createChainManifest(encoding, earliestBlock = 0) {
|
|
254
302
|
return asChainManifest({
|
|
@@ -260,98 +308,242 @@ function createChainManifest(encoding, earliestBlock = 0) {
|
|
|
260
308
|
}, true);
|
|
261
309
|
}
|
|
262
310
|
|
|
311
|
+
// src/modules/network-model/staticRest/layout/chainParams.ts
|
|
312
|
+
import {
|
|
313
|
+
zodAsFactory as zodAsFactory4,
|
|
314
|
+
zodIsFactory as zodIsFactory4,
|
|
315
|
+
zodToFactory as zodToFactory3
|
|
316
|
+
} from "@ariestools/sdk";
|
|
317
|
+
import { asSchema as asSchema3 } from "@xyo-network/sdk";
|
|
318
|
+
import { z as z4 } from "zod";
|
|
319
|
+
import { ChainIdZod as ChainIdZod2, NumberishZod as NumberishZod2 } from "#protocol-lib";
|
|
320
|
+
import { OffenseCodes, RuleIds } from "#protocol-model";
|
|
321
|
+
var ChainParamsSchema = asSchema3("network.xyo.s3.chain.params", true);
|
|
322
|
+
var CHAIN_PARAMS_VERSION = 1;
|
|
323
|
+
var offenseCodeZod = z4.enum(OffenseCodes);
|
|
324
|
+
var RuleIdZod = z4.enum(RuleIds);
|
|
325
|
+
var HeightZod = NumberishZod2.pipe(z4.int().nonnegative());
|
|
326
|
+
var HexAmountZod = z4.string();
|
|
327
|
+
var ChainParamsZod = z4.object({
|
|
328
|
+
/** Rule id to the height it takes effect. */
|
|
329
|
+
activations: z4.partialRecord(RuleIdZod, HeightZod),
|
|
330
|
+
/** Address whose adjudication records are honored. */
|
|
331
|
+
arbiter: z4.string(),
|
|
332
|
+
/** Share of a step's reward pool paid to attestors, in basis points. */
|
|
333
|
+
attestationRewardBps: z4.int().nonnegative(),
|
|
334
|
+
/** Absolute ceiling on any single bounty, in the smallest unit. */
|
|
335
|
+
bountyCapAtto: HexAmountZod,
|
|
336
|
+
/** Share of a slash offered as a bounty, in basis points. */
|
|
337
|
+
bountyShareBps: z4.int().nonnegative(),
|
|
338
|
+
/** Minimum share of every slash that must be burned, in basis points. */
|
|
339
|
+
burnFloorBps: z4.int().positive(),
|
|
340
|
+
/** Version of the offense catalog these parameters describe. */
|
|
341
|
+
catalogVersion: z4.int().positive(),
|
|
342
|
+
/** Chain these parameters govern. */
|
|
343
|
+
chainId: ChainIdZod2,
|
|
344
|
+
/** Window during which counter-evidence may be filed, in EVM blocks. */
|
|
345
|
+
challengeWindowEvmBlocks: z4.int().positive(),
|
|
346
|
+
/** Rule id to the height it stops taking effect; re-activation needs a later version. */
|
|
347
|
+
deactivations: z4.optional(z4.partialRecord(RuleIdZod, HeightZod)),
|
|
348
|
+
/** Maximum age of an offense at report time, in EVM blocks. */
|
|
349
|
+
evidenceFreshnessEvmBlocks: z4.int().positive(),
|
|
350
|
+
/** Operational floor on how long evidence is kept, in XL1 blocks. */
|
|
351
|
+
evidenceRetentionXl1Blocks: z4.int().positive(),
|
|
352
|
+
/** Delay between a certificate being queued and executable, in EVM blocks. */
|
|
353
|
+
executionDelayEvmBlocks: z4.int().positive(),
|
|
354
|
+
/** How far behind its own anchor a block's stake measurement may sit, in EVM blocks. */
|
|
355
|
+
freshnessBandEvmBlocks: z4.int().positive(),
|
|
356
|
+
/** Blocks after an activation during which the rule is observed but not enforced. */
|
|
357
|
+
graceBandXl1Blocks: z4.int().nonnegative(),
|
|
358
|
+
/** Confirmation depth an anchor must sit behind the EVM head, in EVM blocks. */
|
|
359
|
+
maturityEvmBlocks: z4.int().positive(),
|
|
360
|
+
/** Minimum stake a producer must place on itself, in the smallest unit. */
|
|
361
|
+
minProducerSelfBondAtto: HexAmountZod,
|
|
362
|
+
/** Minimum stake on a producer address, in the smallest unit. */
|
|
363
|
+
minProducerStakeAtto: HexAmountZod,
|
|
364
|
+
/** Minimum age stake must reach before it counts toward participation, in EVM blocks. */
|
|
365
|
+
minStakeAgeEvmBlocks: z4.int().nonnegative(),
|
|
366
|
+
/** Minimum stake a validator must hold, in the smallest unit. */
|
|
367
|
+
minValidatorStakeAtto: HexAmountZod,
|
|
368
|
+
/** Slack the timing budget carries for operations and stalls, in EVM blocks. */
|
|
369
|
+
opsAllowanceEvmBlocks: z4.int().positive(),
|
|
370
|
+
/** Lowest protocol version a block may declare. */
|
|
371
|
+
protocolMin: z4.int().positive(),
|
|
372
|
+
/** Refundable deposit a report must escrow, in the smallest unit. */
|
|
373
|
+
reporterDepositAtto: HexAmountZod,
|
|
374
|
+
/** Blocks a reveal must wait after its commitment. */
|
|
375
|
+
revealDelayEvmBlocks: z4.int().positive(),
|
|
376
|
+
/** Blocks a reveal must wait after its commitment, on the XL1 clock. */
|
|
377
|
+
revealDelayXl1Blocks: z4.int().positive(),
|
|
378
|
+
/** Blocks after which an unrevealed commitment expires. */
|
|
379
|
+
revealWindowEvmBlocks: z4.int().positive(),
|
|
380
|
+
/** Blocks after which an unrevealed commitment expires, on the XL1 clock. */
|
|
381
|
+
revealWindowXl1Blocks: z4.int().positive(),
|
|
382
|
+
/** Where the allowed block reward comes from. */
|
|
383
|
+
rewardSource: z4.enum(["schedule", "contract"]),
|
|
384
|
+
schema: z4.literal(ChainParamsSchema),
|
|
385
|
+
/** Offense code to the share of at-risk stake it slashes, in basis points. */
|
|
386
|
+
slashFractionsBps: z4.partialRecord(offenseCodeZod, z4.int().nonnegative()),
|
|
387
|
+
/** Distinct validator signatures a slash certificate needs. */
|
|
388
|
+
slashQuorumCount: z4.int().positive(),
|
|
389
|
+
/** Version of this register document. */
|
|
390
|
+
version: z4.int().positive()
|
|
391
|
+
});
|
|
392
|
+
var isChainParams = zodIsFactory4(ChainParamsZod);
|
|
393
|
+
var asChainParams = zodAsFactory4(ChainParamsZod, "asChainParams");
|
|
394
|
+
var toChainParams = zodToFactory3(ChainParamsZod, "toChainParams");
|
|
395
|
+
var ChainParamsHeadSchema = asSchema3("network.xyo.s3.chain.params.head", true);
|
|
396
|
+
var ChainParamsHeadZod = z4.object({
|
|
397
|
+
/** Hash of the version document, so a reader can tell it got the one the head meant. */
|
|
398
|
+
hash: z4.string(),
|
|
399
|
+
schema: z4.literal(ChainParamsHeadSchema),
|
|
400
|
+
/** Version number the pointer names. */
|
|
401
|
+
version: z4.int().positive()
|
|
402
|
+
});
|
|
403
|
+
var isChainParamsHead = zodIsFactory4(ChainParamsHeadZod);
|
|
404
|
+
var asChainParamsHead = zodAsFactory4(ChainParamsHeadZod, "asChainParamsHead");
|
|
405
|
+
function createChainParams(config) {
|
|
406
|
+
return ChainParamsZod.parse({ ...config, schema: ChainParamsSchema });
|
|
407
|
+
}
|
|
408
|
+
function createChainParamsHead(version, hash) {
|
|
409
|
+
return ChainParamsHeadZod.parse({
|
|
410
|
+
hash,
|
|
411
|
+
schema: ChainParamsHeadSchema,
|
|
412
|
+
version
|
|
413
|
+
});
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
// src/modules/network-model/staticRest/layout/chainParamsRules.ts
|
|
417
|
+
import {
|
|
418
|
+
adjudicableRuleId,
|
|
419
|
+
isRuleObservedAt,
|
|
420
|
+
reportableRuleId,
|
|
421
|
+
ruleActivationStateAt
|
|
422
|
+
} from "#protocol-model";
|
|
423
|
+
function isOffenseReportableAt(params, offense, height) {
|
|
424
|
+
return isRuleObservedAt(params, reportableRuleId(offense), height);
|
|
425
|
+
}
|
|
426
|
+
function offenseAdjudicationStateAt(params, offense, height) {
|
|
427
|
+
return ruleActivationStateAt(params, adjudicableRuleId(offense), height);
|
|
428
|
+
}
|
|
429
|
+
function protocolMinAt(params, height) {
|
|
430
|
+
return isRuleObservedAt(params, "anchor-rules", height) ? params.protocolMin : void 0;
|
|
431
|
+
}
|
|
432
|
+
function chainParamsSuccessionErrors(previous, next, finalizedHeight) {
|
|
433
|
+
if (previous === void 0) return [];
|
|
434
|
+
const errors = [];
|
|
435
|
+
if (next.version <= previous.version) {
|
|
436
|
+
errors.push(`version must increase: ${previous.version} -> ${next.version}`);
|
|
437
|
+
}
|
|
438
|
+
if (next.chainId !== previous.chainId) {
|
|
439
|
+
errors.push(`chainId must not change: ${previous.chainId} -> ${next.chainId}`);
|
|
440
|
+
}
|
|
441
|
+
for (const [ruleId, height] of Object.entries(previous.activations)) {
|
|
442
|
+
if (height > finalizedHeight) continue;
|
|
443
|
+
if (next.activations[ruleId] !== height) {
|
|
444
|
+
errors.push(`activation for '${ruleId}' is already in force at ${height} and must not move`);
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
for (const [ruleId, height] of Object.entries(next.deactivations ?? {})) {
|
|
448
|
+
if (height < finalizedHeight) {
|
|
449
|
+
errors.push(`deactivation for '${ruleId}' at ${height} is in the past`);
|
|
450
|
+
}
|
|
451
|
+
}
|
|
452
|
+
return errors;
|
|
453
|
+
}
|
|
454
|
+
|
|
263
455
|
// src/modules/network-model/staticRest/layout/evmEventIndex.ts
|
|
264
456
|
import {
|
|
265
457
|
EthAddressZod,
|
|
266
458
|
HexRegExMinMaxMixedCaseWithPrefix,
|
|
267
|
-
zodAsFactory as
|
|
459
|
+
zodAsFactory as zodAsFactory5
|
|
268
460
|
} from "@ariestools/sdk";
|
|
269
|
-
import { z as
|
|
270
|
-
var EvmHashZod =
|
|
271
|
-
var EvmDataZod =
|
|
272
|
-
var EvmEventIndexLogZod =
|
|
461
|
+
import { z as z5 } from "zod/mini";
|
|
462
|
+
var EvmHashZod = z5.string().check(z5.regex(HexRegExMinMaxMixedCaseWithPrefix(32, 32)));
|
|
463
|
+
var EvmDataZod = z5.string().check(z5.regex(/^0x[\dA-Fa-f]*$/));
|
|
464
|
+
var EvmEventIndexLogZod = z5.object({
|
|
273
465
|
address: EthAddressZod,
|
|
274
466
|
blockHash: EvmHashZod,
|
|
275
|
-
blockNumber:
|
|
467
|
+
blockNumber: z5.number(),
|
|
276
468
|
data: EvmDataZod,
|
|
277
|
-
index:
|
|
278
|
-
topics:
|
|
469
|
+
index: z5.number(),
|
|
470
|
+
topics: z5.array(EvmHashZod),
|
|
279
471
|
transactionHash: EvmHashZod,
|
|
280
|
-
transactionIndex:
|
|
472
|
+
transactionIndex: z5.number()
|
|
281
473
|
});
|
|
282
|
-
var EvmEventIndexFrameZod =
|
|
283
|
-
fromBlock:
|
|
284
|
-
logs:
|
|
285
|
-
toBlock:
|
|
474
|
+
var EvmEventIndexFrameZod = z5.object({
|
|
475
|
+
fromBlock: z5.number(),
|
|
476
|
+
logs: z5.array(EvmEventIndexLogZod),
|
|
477
|
+
toBlock: z5.number()
|
|
286
478
|
});
|
|
287
|
-
var EvmEventIndexManifestZod =
|
|
479
|
+
var EvmEventIndexManifestZod = z5.object({
|
|
288
480
|
address: EthAddressZod,
|
|
289
|
-
chainId:
|
|
290
|
-
deploymentBlock:
|
|
291
|
-
frameSize:
|
|
292
|
-
layout:
|
|
481
|
+
chainId: z5.string(),
|
|
482
|
+
deploymentBlock: z5.number(),
|
|
483
|
+
frameSize: z5.number(),
|
|
484
|
+
layout: z5.literal("evm-contract-events-v1")
|
|
293
485
|
});
|
|
294
|
-
var EvmEventIndexHeadZod =
|
|
486
|
+
var EvmEventIndexHeadZod = z5.object({
|
|
295
487
|
address: EthAddressZod,
|
|
296
|
-
block:
|
|
297
|
-
chainId:
|
|
488
|
+
block: z5.number(),
|
|
489
|
+
chainId: z5.string(),
|
|
298
490
|
hash: EvmHashZod
|
|
299
491
|
});
|
|
300
|
-
var asEvmEventIndexFrame =
|
|
301
|
-
var asEvmEventIndexHead =
|
|
302
|
-
var asEvmEventIndexManifest =
|
|
492
|
+
var asEvmEventIndexFrame = zodAsFactory5(EvmEventIndexFrameZod, "asEvmEventIndexFrame");
|
|
493
|
+
var asEvmEventIndexHead = zodAsFactory5(EvmEventIndexHeadZod, "asEvmEventIndexHead");
|
|
494
|
+
var asEvmEventIndexManifest = zodAsFactory5(EvmEventIndexManifestZod, "asEvmEventIndexManifest");
|
|
303
495
|
|
|
304
496
|
// src/modules/network-model/staticRest/layout/indexManifest.ts
|
|
305
497
|
import {
|
|
306
|
-
zodAsFactory as
|
|
307
|
-
zodIsFactory as
|
|
308
|
-
zodToFactory as
|
|
498
|
+
zodAsFactory as zodAsFactory6,
|
|
499
|
+
zodIsFactory as zodIsFactory5,
|
|
500
|
+
zodToFactory as zodToFactory4
|
|
309
501
|
} from "@ariestools/sdk";
|
|
310
|
-
import { z as
|
|
502
|
+
import { z as z6 } from "zod";
|
|
311
503
|
var INDEX_LAYOUT_VERSION = 1;
|
|
312
504
|
var IndexManifestSchema = "network.xyo.s3.index.manifest";
|
|
313
505
|
var IndexHeadSchema = "network.xyo.s3.index.head";
|
|
314
|
-
var IndexManifestFamilyZod =
|
|
506
|
+
var IndexManifestFamilyZod = z6.object({
|
|
315
507
|
/** Highest step level published for this family. */
|
|
316
|
-
maxStep:
|
|
508
|
+
maxStep: z6.int().nonnegative(),
|
|
317
509
|
/** Path template for the family's frames, e.g. `blocks/{level}/{index}.json`. */
|
|
318
|
-
path:
|
|
510
|
+
path: z6.string()
|
|
319
511
|
});
|
|
320
|
-
var indexFamiliesZod =
|
|
512
|
+
var indexFamiliesZod = z6.object({
|
|
321
513
|
balances: IndexManifestFamilyZod,
|
|
322
514
|
blocks: IndexManifestFamilyZod,
|
|
323
515
|
schemas: IndexManifestFamilyZod,
|
|
324
516
|
transfers: IndexManifestFamilyZod
|
|
325
517
|
});
|
|
326
|
-
var IndexManifestZod =
|
|
518
|
+
var IndexManifestZod = z6.object({
|
|
327
519
|
families: indexFamiliesZod,
|
|
328
|
-
schema:
|
|
329
|
-
version:
|
|
520
|
+
schema: z6.literal(IndexManifestSchema),
|
|
521
|
+
version: z6.int().positive()
|
|
330
522
|
});
|
|
331
|
-
var isIndexManifest =
|
|
332
|
-
var asIndexManifest =
|
|
333
|
-
var toIndexManifest =
|
|
334
|
-
var IndexHeadFamiliesZod =
|
|
335
|
-
balances:
|
|
336
|
-
blocks:
|
|
337
|
-
schemas:
|
|
338
|
-
transfers:
|
|
523
|
+
var isIndexManifest = zodIsFactory5(IndexManifestZod);
|
|
524
|
+
var asIndexManifest = zodAsFactory6(IndexManifestZod, "asIndexManifest");
|
|
525
|
+
var toIndexManifest = zodToFactory4(IndexManifestZod, "toIndexManifest");
|
|
526
|
+
var IndexHeadFamiliesZod = z6.object({
|
|
527
|
+
balances: z6.int().nonnegative(),
|
|
528
|
+
blocks: z6.int().nonnegative(),
|
|
529
|
+
schemas: z6.int().nonnegative(),
|
|
530
|
+
transfers: z6.int().nonnegative()
|
|
339
531
|
});
|
|
340
|
-
var IndexHeadZod =
|
|
532
|
+
var IndexHeadZod = z6.object({
|
|
341
533
|
/** Highest block the index is complete through. */
|
|
342
|
-
block:
|
|
534
|
+
block: z6.int().nonnegative(),
|
|
343
535
|
/** Completed frame counts per family. */
|
|
344
536
|
families: IndexHeadFamiliesZod,
|
|
345
537
|
/** Hash of that block. */
|
|
346
|
-
hash:
|
|
347
|
-
schema:
|
|
538
|
+
hash: z6.string(),
|
|
539
|
+
schema: z6.literal(IndexHeadSchema),
|
|
348
540
|
/** ISO-8601 timestamp of the last update. */
|
|
349
|
-
updatedAt:
|
|
350
|
-
version:
|
|
541
|
+
updatedAt: z6.string(),
|
|
542
|
+
version: z6.int().positive()
|
|
351
543
|
});
|
|
352
|
-
var isIndexHead =
|
|
353
|
-
var asIndexHead =
|
|
354
|
-
var toIndexHead =
|
|
544
|
+
var isIndexHead = zodIsFactory5(IndexHeadZod);
|
|
545
|
+
var asIndexHead = zodAsFactory6(IndexHeadZod, "asIndexHead");
|
|
546
|
+
var toIndexHead = zodToFactory4(IndexHeadZod, "toIndexHead");
|
|
355
547
|
function createIndexManifestFamilies(maxSteps) {
|
|
356
548
|
return {
|
|
357
549
|
balances: { maxStep: maxSteps.balances, path: indexSummaryPathTemplate("balances") },
|
|
@@ -383,133 +575,188 @@ function createIndexHead(watermark, updatedAt) {
|
|
|
383
575
|
// src/modules/network-model/staticRest/layout/networkStakeRewardsIndex.ts
|
|
384
576
|
import {
|
|
385
577
|
HashZod,
|
|
386
|
-
zodAsFactory as
|
|
387
|
-
zodIsFactory as
|
|
578
|
+
zodAsFactory as zodAsFactory7,
|
|
579
|
+
zodIsFactory as zodIsFactory6
|
|
388
580
|
} from "@ariestools/sdk";
|
|
389
|
-
import { asSchema as
|
|
390
|
-
import { z as
|
|
581
|
+
import { asSchema as asSchema4 } from "@xyo-network/sdk";
|
|
582
|
+
import { z as z7 } from "zod";
|
|
391
583
|
var NETWORK_STAKE_REWARDS_INDEX_LAYOUT = "network-stake-rewards-v1";
|
|
392
584
|
var NETWORK_STAKE_REWARDS_UNMULTIPLIED_POLICY = "unmultiplied-v1";
|
|
393
585
|
var NETWORK_STAKE_REWARDS_BASE_POLICY = NETWORK_STAKE_REWARDS_UNMULTIPLIED_POLICY;
|
|
394
|
-
var NetworkStakeRewardsIndexSnapshotSchema =
|
|
395
|
-
var DecimalBigIntZod =
|
|
396
|
-
var NetworkStakeRewardsPolicyIdZod =
|
|
397
|
-
var PositionRewardsZod =
|
|
398
|
-
var BlockRangeZod =
|
|
399
|
-
var StepIdentityJsonZod =
|
|
400
|
-
block:
|
|
401
|
-
step:
|
|
586
|
+
var NetworkStakeRewardsIndexSnapshotSchema = asSchema4("network.xyo.chain.stake.rewards.snapshot", true);
|
|
587
|
+
var DecimalBigIntZod = z7.string().regex(/^(?:0|[1-9]\d*)$/);
|
|
588
|
+
var NetworkStakeRewardsPolicyIdZod = z7.string().regex(/^[a-z0-9][a-z0-9._-]*$/);
|
|
589
|
+
var PositionRewardsZod = z7.record(z7.string().regex(/^(?:0|[1-9]\d*)$/), DecimalBigIntZod);
|
|
590
|
+
var BlockRangeZod = z7.tuple([z7.number().int().nonnegative(), z7.number().int().nonnegative()]);
|
|
591
|
+
var StepIdentityJsonZod = z7.object({
|
|
592
|
+
block: z7.number().int().nonnegative(),
|
|
593
|
+
step: z7.number().int().nonnegative()
|
|
402
594
|
});
|
|
403
|
-
var NetworkStakeRewardsIndexManifestZod =
|
|
404
|
-
evmAddress:
|
|
405
|
-
evmChainId:
|
|
406
|
-
layout:
|
|
595
|
+
var NetworkStakeRewardsIndexManifestZod = z7.object({
|
|
596
|
+
evmAddress: z7.string(),
|
|
597
|
+
evmChainId: z7.string(),
|
|
598
|
+
layout: z7.literal(NETWORK_STAKE_REWARDS_INDEX_LAYOUT),
|
|
407
599
|
policyId: NetworkStakeRewardsPolicyIdZod,
|
|
408
|
-
stepLevels:
|
|
409
|
-
timeAnchor:
|
|
410
|
-
externalGenesisTime:
|
|
411
|
-
maxScanBlocks:
|
|
600
|
+
stepLevels: z7.array(z7.number().int().nonnegative()),
|
|
601
|
+
timeAnchor: z7.object({
|
|
602
|
+
externalGenesisTime: z7.number().optional(),
|
|
603
|
+
maxScanBlocks: z7.number().optional()
|
|
412
604
|
}).optional()
|
|
413
605
|
});
|
|
414
|
-
var NetworkStakeRewardsIndexStepZod =
|
|
606
|
+
var NetworkStakeRewardsIndexStepZod = z7.object({
|
|
415
607
|
denominator: DecimalBigIntZod,
|
|
416
608
|
externalRange: BlockRangeZod,
|
|
417
|
-
layout:
|
|
609
|
+
layout: z7.literal(NETWORK_STAKE_REWARDS_INDEX_LAYOUT),
|
|
418
610
|
policyId: NetworkStakeRewardsPolicyIdZod,
|
|
419
611
|
positionRewards: PositionRewardsZod,
|
|
420
612
|
step: StepIdentityJsonZod,
|
|
421
613
|
totalReward: DecimalBigIntZod,
|
|
422
614
|
xl1Range: BlockRangeZod
|
|
423
615
|
});
|
|
424
|
-
var NetworkStakeRewardsIndexSnapshotZod =
|
|
425
|
-
layout:
|
|
616
|
+
var NetworkStakeRewardsIndexSnapshotZod = z7.object({
|
|
617
|
+
layout: z7.literal(NETWORK_STAKE_REWARDS_INDEX_LAYOUT),
|
|
426
618
|
policyId: NetworkStakeRewardsPolicyIdZod,
|
|
427
619
|
positionRewards: PositionRewardsZod,
|
|
428
|
-
schema:
|
|
429
|
-
stepCount:
|
|
620
|
+
schema: z7.literal(NetworkStakeRewardsIndexSnapshotSchema),
|
|
621
|
+
stepCount: z7.number().int().nonnegative(),
|
|
430
622
|
totalReward: DecimalBigIntZod
|
|
431
623
|
});
|
|
432
|
-
var NetworkStakeRewardsIndexHeadZod =
|
|
433
|
-
layout:
|
|
624
|
+
var NetworkStakeRewardsIndexHeadZod = z7.object({
|
|
625
|
+
layout: z7.literal(NETWORK_STAKE_REWARDS_INDEX_LAYOUT),
|
|
434
626
|
policyId: NetworkStakeRewardsPolicyIdZod,
|
|
435
|
-
positionCount:
|
|
436
|
-
processedThroughBlock:
|
|
627
|
+
positionCount: z7.number().int().nonnegative(),
|
|
628
|
+
processedThroughBlock: z7.number().int().nonnegative(),
|
|
437
629
|
snapshotHash: HashZod,
|
|
438
|
-
source:
|
|
439
|
-
evm:
|
|
440
|
-
block:
|
|
441
|
-
hash:
|
|
630
|
+
source: z7.object({
|
|
631
|
+
evm: z7.object({
|
|
632
|
+
block: z7.number().int().nonnegative(),
|
|
633
|
+
hash: z7.string()
|
|
442
634
|
}),
|
|
443
|
-
xl1:
|
|
444
|
-
block:
|
|
445
|
-
hash:
|
|
635
|
+
xl1: z7.object({
|
|
636
|
+
block: z7.number().int().nonnegative(),
|
|
637
|
+
hash: z7.string()
|
|
446
638
|
})
|
|
447
639
|
}),
|
|
448
|
-
stepCount:
|
|
640
|
+
stepCount: z7.number().int().nonnegative()
|
|
449
641
|
});
|
|
450
|
-
var isNetworkStakeRewardsIndexManifest =
|
|
451
|
-
var asNetworkStakeRewardsIndexManifest =
|
|
642
|
+
var isNetworkStakeRewardsIndexManifest = zodIsFactory6(NetworkStakeRewardsIndexManifestZod);
|
|
643
|
+
var asNetworkStakeRewardsIndexManifest = zodAsFactory7(
|
|
452
644
|
NetworkStakeRewardsIndexManifestZod,
|
|
453
645
|
"asNetworkStakeRewardsIndexManifest"
|
|
454
646
|
);
|
|
455
|
-
var asNetworkStakeRewardsIndexStep =
|
|
647
|
+
var asNetworkStakeRewardsIndexStep = zodAsFactory7(
|
|
456
648
|
NetworkStakeRewardsIndexStepZod,
|
|
457
649
|
"asNetworkStakeRewardsIndexStep"
|
|
458
650
|
);
|
|
459
|
-
var asNetworkStakeRewardsIndexSnapshot =
|
|
651
|
+
var asNetworkStakeRewardsIndexSnapshot = zodAsFactory7(
|
|
460
652
|
NetworkStakeRewardsIndexSnapshotZod,
|
|
461
653
|
"asNetworkStakeRewardsIndexSnapshot"
|
|
462
654
|
);
|
|
463
|
-
var asNetworkStakeRewardsIndexHead =
|
|
655
|
+
var asNetworkStakeRewardsIndexHead = zodAsFactory7(
|
|
464
656
|
NetworkStakeRewardsIndexHeadZod,
|
|
465
657
|
"asNetworkStakeRewardsIndexHead"
|
|
466
658
|
);
|
|
467
659
|
|
|
660
|
+
// src/modules/network-model/staticRest/layout/slashIndex.ts
|
|
661
|
+
import {
|
|
662
|
+
zodAsFactory as zodAsFactory8,
|
|
663
|
+
zodIsFactory as zodIsFactory7,
|
|
664
|
+
zodToFactory as zodToFactory5
|
|
665
|
+
} from "@ariestools/sdk";
|
|
666
|
+
import { asSchema as asSchema5 } from "@xyo-network/sdk";
|
|
667
|
+
import { z as z8 } from "zod";
|
|
668
|
+
import { OffenseCodes as OffenseCodes2 } from "#protocol-model";
|
|
669
|
+
var SlashIndexHeadSchema = asSchema5("network.xyo.s3.slash.index.head", true);
|
|
670
|
+
var SLASH_INDEX_VERSION = 1;
|
|
671
|
+
var offenseCodeZod2 = z8.enum(OffenseCodes2);
|
|
672
|
+
var SlashIndexHeadZod = z8.object({
|
|
673
|
+
/** Highest finalized height the index has folded in. */
|
|
674
|
+
height: z8.int().nonnegative(),
|
|
675
|
+
/** Layout version of the objects this head points at. */
|
|
676
|
+
indexVersion: z8.int().positive(),
|
|
677
|
+
schema: z8.literal(SlashIndexHeadSchema),
|
|
678
|
+
/** When the pass that wrote this ran, on the EVM clock, when it was known. */
|
|
679
|
+
anchor: z8.optional(z8.int().nonnegative())
|
|
680
|
+
});
|
|
681
|
+
var isSlashIndexHead = zodIsFactory7(SlashIndexHeadZod);
|
|
682
|
+
var asSlashIndexHead = zodAsFactory8(SlashIndexHeadZod, "asSlashIndexHead");
|
|
683
|
+
var toSlashIndexHead = zodToFactory5(SlashIndexHeadZod, "toSlashIndexHead");
|
|
684
|
+
var SlashIndexKeyRecordSchema = asSchema5("network.xyo.s3.slash.index.key", true);
|
|
685
|
+
var SlashIndexKeyRecordZod = z8.object({
|
|
686
|
+
/** Who is accused. */
|
|
687
|
+
accused: z8.string(),
|
|
688
|
+
/** Hash of the adjudication that closed it, when one has. */
|
|
689
|
+
adjudication: z8.optional(z8.string()),
|
|
690
|
+
/** The canonical height the offense is located at. */
|
|
691
|
+
block: z8.int().nonnegative(),
|
|
692
|
+
/** Hashes of challenges filed against reports of it. */
|
|
693
|
+
challenges: z8.array(z8.string()),
|
|
694
|
+
/** The chain it happened on. */
|
|
695
|
+
chain: z8.string(),
|
|
696
|
+
/** How it was resolved, when it has been. */
|
|
697
|
+
outcome: z8.optional(z8.enum(["confirmed", "refuted", "indeterminate", "invalid"])),
|
|
698
|
+
/** Which offense class. */
|
|
699
|
+
offense: offenseCodeZod2,
|
|
700
|
+
/** Hashes of every report filed for it, earliest first. */
|
|
701
|
+
requests: z8.array(z8.string()),
|
|
702
|
+
schema: z8.literal(SlashIndexKeyRecordSchema)
|
|
703
|
+
});
|
|
704
|
+
var isSlashIndexKeyRecord = zodIsFactory7(SlashIndexKeyRecordZod);
|
|
705
|
+
var asSlashIndexKeyRecord = zodAsFactory8(SlashIndexKeyRecordZod, "asSlashIndexKeyRecord");
|
|
706
|
+
function createSlashIndexHead(height, anchor) {
|
|
707
|
+
return SlashIndexHeadZod.parse({
|
|
708
|
+
anchor,
|
|
709
|
+
height,
|
|
710
|
+
indexVersion: SLASH_INDEX_VERSION,
|
|
711
|
+
schema: SlashIndexHeadSchema
|
|
712
|
+
});
|
|
713
|
+
}
|
|
714
|
+
|
|
468
715
|
// src/modules/network-model/staticRest/layout/transactionInclusionIndex.ts
|
|
469
716
|
import {
|
|
470
717
|
HashZod as HashZod2,
|
|
471
|
-
zodAsFactory as
|
|
472
|
-
zodIsFactory as
|
|
473
|
-
zodToFactory as
|
|
718
|
+
zodAsFactory as zodAsFactory9,
|
|
719
|
+
zodIsFactory as zodIsFactory8,
|
|
720
|
+
zodToFactory as zodToFactory6
|
|
474
721
|
} from "@ariestools/sdk";
|
|
475
|
-
import { z as
|
|
476
|
-
import { ChainIdZod as
|
|
722
|
+
import { z as z9 } from "zod";
|
|
723
|
+
import { ChainIdZod as ChainIdZod3, XL1BlockNumberZod } from "#protocol-model";
|
|
477
724
|
var TRANSACTION_INCLUSION_INDEX_LAYOUT = "transaction-inclusions-v1";
|
|
478
|
-
var TransactionInclusionManifestZod =
|
|
725
|
+
var TransactionInclusionManifestZod = z9.object({
|
|
479
726
|
/** XL1 chain whose finalized transactions are indexed. */
|
|
480
|
-
chain:
|
|
727
|
+
chain: ChainIdZod3,
|
|
481
728
|
/** Versioned layout identifier. */
|
|
482
|
-
layout:
|
|
729
|
+
layout: z9.literal(TRANSACTION_INCLUSION_INDEX_LAYOUT),
|
|
483
730
|
/** Hash-addressed path template, for example `transactions/by-hash/{hash}.json`. */
|
|
484
|
-
path:
|
|
731
|
+
path: z9.string()
|
|
485
732
|
});
|
|
486
|
-
var TransactionInclusionHeadZod =
|
|
733
|
+
var TransactionInclusionHeadZod = z9.object({
|
|
487
734
|
/** Highest finalized block fully represented by the lookup. */
|
|
488
735
|
block: XL1BlockNumberZod,
|
|
489
736
|
/** Hash of the highest finalized block fully represented by the lookup. */
|
|
490
737
|
blockHash: HashZod2,
|
|
491
738
|
/** XL1 chain whose finalized transactions are indexed. */
|
|
492
|
-
chain:
|
|
739
|
+
chain: ChainIdZod3,
|
|
493
740
|
/** Number of transaction-inclusion records represented through `block`. */
|
|
494
|
-
entries:
|
|
741
|
+
entries: z9.int().nonnegative(),
|
|
495
742
|
/** Versioned layout identifier. */
|
|
496
|
-
layout:
|
|
743
|
+
layout: z9.literal(TRANSACTION_INCLUSION_INDEX_LAYOUT)
|
|
497
744
|
});
|
|
498
|
-
var isTransactionInclusionManifest =
|
|
499
|
-
var asTransactionInclusionManifest =
|
|
745
|
+
var isTransactionInclusionManifest = zodIsFactory8(TransactionInclusionManifestZod);
|
|
746
|
+
var asTransactionInclusionManifest = zodAsFactory9(
|
|
500
747
|
TransactionInclusionManifestZod,
|
|
501
748
|
"asTransactionInclusionManifest"
|
|
502
749
|
);
|
|
503
|
-
var toTransactionInclusionManifest =
|
|
750
|
+
var toTransactionInclusionManifest = zodToFactory6(
|
|
504
751
|
TransactionInclusionManifestZod,
|
|
505
752
|
"toTransactionInclusionManifest"
|
|
506
753
|
);
|
|
507
|
-
var isTransactionInclusionHead =
|
|
508
|
-
var asTransactionInclusionHead =
|
|
754
|
+
var isTransactionInclusionHead = zodIsFactory8(TransactionInclusionHeadZod);
|
|
755
|
+
var asTransactionInclusionHead = zodAsFactory9(
|
|
509
756
|
TransactionInclusionHeadZod,
|
|
510
757
|
"asTransactionInclusionHead"
|
|
511
758
|
);
|
|
512
|
-
var toTransactionInclusionHead =
|
|
759
|
+
var toTransactionInclusionHead = zodToFactory6(
|
|
513
760
|
TransactionInclusionHeadZod,
|
|
514
761
|
"toTransactionInclusionHead"
|
|
515
762
|
);
|
|
@@ -527,6 +774,53 @@ function createTransactionInclusionHead(head) {
|
|
|
527
774
|
}, true);
|
|
528
775
|
}
|
|
529
776
|
|
|
777
|
+
// src/modules/network-model/staticRest/layout/trustedPosture.ts
|
|
778
|
+
var DEFAULT_CHAIN_PARAMS = {
|
|
779
|
+
attestationRewardBps: 1e3,
|
|
780
|
+
bountyShareBps: 1e3,
|
|
781
|
+
burnFloorBps: 9e3,
|
|
782
|
+
catalogVersion: 1,
|
|
783
|
+
challengeWindowEvmBlocks: 14400,
|
|
784
|
+
evidenceFreshnessEvmBlocks: 21600,
|
|
785
|
+
evidenceRetentionXl1Blocks: 6e4,
|
|
786
|
+
executionDelayEvmBlocks: 7200,
|
|
787
|
+
freshnessBandEvmBlocks: 2048,
|
|
788
|
+
graceBandXl1Blocks: 1440,
|
|
789
|
+
maturityEvmBlocks: 32,
|
|
790
|
+
minStakeAgeEvmBlocks: 100800,
|
|
791
|
+
opsAllowanceEvmBlocks: 7200,
|
|
792
|
+
protocolMin: 1003e3,
|
|
793
|
+
revealDelayEvmBlocks: 60,
|
|
794
|
+
revealDelayXl1Blocks: 10,
|
|
795
|
+
revealWindowEvmBlocks: 7200,
|
|
796
|
+
revealWindowXl1Blocks: 1440,
|
|
797
|
+
slashFractionsBps: {
|
|
798
|
+
"equivocation": 1500,
|
|
799
|
+
"false-anchor": 750,
|
|
800
|
+
"false-attestation": 500,
|
|
801
|
+
"ineligible-production": 100,
|
|
802
|
+
"invalid-block": 500,
|
|
803
|
+
"invalid-slash-request": 750,
|
|
804
|
+
"reward-overmint": 1500
|
|
805
|
+
},
|
|
806
|
+
slashQuorumCount: 5
|
|
807
|
+
};
|
|
808
|
+
function createTrustedPostureParams(config) {
|
|
809
|
+
return createChainParams({
|
|
810
|
+
...DEFAULT_CHAIN_PARAMS,
|
|
811
|
+
activations: {},
|
|
812
|
+
arbiter: config.arbiter,
|
|
813
|
+
bountyCapAtto: config.bountyCapAtto ?? "00",
|
|
814
|
+
chainId: config.chainId,
|
|
815
|
+
minProducerSelfBondAtto: config.minProducerSelfBondAtto ?? "00",
|
|
816
|
+
minProducerStakeAtto: config.minProducerStakeAtto ?? "00",
|
|
817
|
+
minValidatorStakeAtto: config.minValidatorStakeAtto ?? "00",
|
|
818
|
+
reporterDepositAtto: config.reporterDepositAtto ?? "00",
|
|
819
|
+
rewardSource: config.rewardSource ?? "contract",
|
|
820
|
+
version: config.version ?? 1
|
|
821
|
+
});
|
|
822
|
+
}
|
|
823
|
+
|
|
530
824
|
// src/modules/network-model/staticRest/paths/evmEventIndex.ts
|
|
531
825
|
function root(address) {
|
|
532
826
|
return `evm/events/${address.toLowerCase()}`;
|
|
@@ -561,6 +855,42 @@ function networkStakeRewardsIndexStepPath(policyId, step) {
|
|
|
561
855
|
return `${root2(policyId)}/steps/${step.step}/${step.block}.json`;
|
|
562
856
|
}
|
|
563
857
|
|
|
858
|
+
// src/modules/network-model/staticRest/paths/slashIndex.ts
|
|
859
|
+
var ROOT = "slash/v1";
|
|
860
|
+
function slashIndexHeadPath() {
|
|
861
|
+
return `${ROOT}/head.json`;
|
|
862
|
+
}
|
|
863
|
+
function slashIndexManifestPath() {
|
|
864
|
+
return `${ROOT}/manifest.json`;
|
|
865
|
+
}
|
|
866
|
+
function slashIndexRequestPath(hash) {
|
|
867
|
+
return `${ROOT}/requests/by-hash/${hash}.json`;
|
|
868
|
+
}
|
|
869
|
+
function slashIndexCommitPath(hash) {
|
|
870
|
+
return `${ROOT}/commits/by-hash/${hash}.json`;
|
|
871
|
+
}
|
|
872
|
+
function slashIndexChallengePath(hash) {
|
|
873
|
+
return `${ROOT}/challenges/by-hash/${hash}.json`;
|
|
874
|
+
}
|
|
875
|
+
function slashIndexAdjudicationPath(hash) {
|
|
876
|
+
return `${ROOT}/adjudications/by-hash/${hash}.json`;
|
|
877
|
+
}
|
|
878
|
+
function slashIndexKeyPath(accused, offense, block) {
|
|
879
|
+
return `${ROOT}/keys/${accused.toLowerCase()}/${offense}/${block}.json`;
|
|
880
|
+
}
|
|
881
|
+
function slashIndexAccusedPath(address) {
|
|
882
|
+
return `${ROOT}/accused/${address.toLowerCase()}.json`;
|
|
883
|
+
}
|
|
884
|
+
function slashIndexClaimantPath(address) {
|
|
885
|
+
return `${ROOT}/claimants/${address.toLowerCase()}.json`;
|
|
886
|
+
}
|
|
887
|
+
function admissionShadowPath(height) {
|
|
888
|
+
return `admission/shadow/${height}.json`;
|
|
889
|
+
}
|
|
890
|
+
function admissionShadowHeadPath() {
|
|
891
|
+
return "admission/shadow/head.json";
|
|
892
|
+
}
|
|
893
|
+
|
|
564
894
|
// src/modules/network-model/utils/ExplorerLinks.ts
|
|
565
895
|
var ExplorerLinks = class {
|
|
566
896
|
/** Explorer origin with trailing slashes removed. */
|
|
@@ -621,13 +951,22 @@ var ExplorerLinks = class {
|
|
|
621
951
|
}
|
|
622
952
|
};
|
|
623
953
|
export {
|
|
954
|
+
AdmissionShadowAssessmentZod,
|
|
955
|
+
AdmissionShadowReportSchema,
|
|
956
|
+
AdmissionShadowReportZod,
|
|
624
957
|
CHAIN_CONTRACT_MANIFEST_VERSION,
|
|
625
958
|
CHAIN_LAYOUT_VERSION,
|
|
959
|
+
CHAIN_PARAMS_VERSION,
|
|
626
960
|
ChainContractManifestSchema,
|
|
627
961
|
ChainContractManifestZod,
|
|
628
962
|
ChainManifestPathsZod,
|
|
629
963
|
ChainManifestSchema,
|
|
630
964
|
ChainManifestZod,
|
|
965
|
+
ChainParamsHeadSchema,
|
|
966
|
+
ChainParamsHeadZod,
|
|
967
|
+
ChainParamsSchema,
|
|
968
|
+
ChainParamsZod,
|
|
969
|
+
DEFAULT_CHAIN_PARAMS,
|
|
631
970
|
DefaultNetworks,
|
|
632
971
|
EvmEventIndexFrameZod,
|
|
633
972
|
EvmEventIndexHeadZod,
|
|
@@ -656,13 +995,24 @@ export {
|
|
|
656
995
|
NetworkStakeRewardsIndexSnapshotZod,
|
|
657
996
|
NetworkStakeRewardsIndexStepZod,
|
|
658
997
|
NetworkStakeRewardsPolicyIdZod,
|
|
998
|
+
RuleIdZod,
|
|
999
|
+
SLASH_INDEX_VERSION,
|
|
659
1000
|
SequenceNetwork,
|
|
660
1001
|
testnet_default as SequenceNetworkIconString,
|
|
1002
|
+
SlashIndexHeadSchema,
|
|
1003
|
+
SlashIndexHeadZod,
|
|
1004
|
+
SlashIndexKeyRecordSchema,
|
|
1005
|
+
SlashIndexKeyRecordZod,
|
|
661
1006
|
TRANSACTION_INCLUSION_INDEX_LAYOUT,
|
|
662
1007
|
TransactionInclusionHeadZod,
|
|
663
1008
|
TransactionInclusionManifestZod,
|
|
1009
|
+
admissionShadowHeadPath,
|
|
1010
|
+
admissionShadowPath,
|
|
1011
|
+
asAdmissionShadowReport,
|
|
664
1012
|
asChainContractManifest,
|
|
665
1013
|
asChainManifest,
|
|
1014
|
+
asChainParams,
|
|
1015
|
+
asChainParamsHead,
|
|
666
1016
|
asEvmEventIndexFrame,
|
|
667
1017
|
asEvmEventIndexHead,
|
|
668
1018
|
asEvmEventIndexManifest,
|
|
@@ -673,6 +1023,8 @@ export {
|
|
|
673
1023
|
asNetworkStakeRewardsIndexSnapshot,
|
|
674
1024
|
asNetworkStakeRewardsIndexStep,
|
|
675
1025
|
asOptionalNetwork,
|
|
1026
|
+
asSlashIndexHead,
|
|
1027
|
+
asSlashIndexKeyRecord,
|
|
676
1028
|
asTransactionInclusionHead,
|
|
677
1029
|
asTransactionInclusionManifest,
|
|
678
1030
|
blockHashPath,
|
|
@@ -681,13 +1033,21 @@ export {
|
|
|
681
1033
|
blockNumberPathTemplate,
|
|
682
1034
|
chainContractByIdPath,
|
|
683
1035
|
chainManifestPathTemplates,
|
|
1036
|
+
chainParamsHeadPath,
|
|
1037
|
+
chainParamsSuccessionErrors,
|
|
1038
|
+
chainParamsVersionPath,
|
|
1039
|
+
createAdmissionShadowReport,
|
|
684
1040
|
createChainContractManifest,
|
|
685
1041
|
createChainManifest,
|
|
1042
|
+
createChainParams,
|
|
1043
|
+
createChainParamsHead,
|
|
686
1044
|
createIndexHead,
|
|
687
1045
|
createIndexManifest,
|
|
688
1046
|
createIndexManifestFamilies,
|
|
1047
|
+
createSlashIndexHead,
|
|
689
1048
|
createTransactionInclusionHead,
|
|
690
1049
|
createTransactionInclusionManifest,
|
|
1050
|
+
createTrustedPostureParams,
|
|
691
1051
|
evmEventIndexFramePath,
|
|
692
1052
|
evmEventIndexHeadPath,
|
|
693
1053
|
evmEventIndexManifestPath,
|
|
@@ -701,12 +1061,18 @@ export {
|
|
|
701
1061
|
indexSummaryPathTemplate,
|
|
702
1062
|
initNetworkNode,
|
|
703
1063
|
interpolatePathTemplate,
|
|
1064
|
+
isAdmissionShadowReport,
|
|
704
1065
|
isChainContractManifest,
|
|
705
1066
|
isChainManifest,
|
|
1067
|
+
isChainParams,
|
|
1068
|
+
isChainParamsHead,
|
|
706
1069
|
isIndexHead,
|
|
707
1070
|
isIndexManifest,
|
|
708
1071
|
isNetworkBootstrap,
|
|
709
1072
|
isNetworkStakeRewardsIndexManifest,
|
|
1073
|
+
isOffenseReportableAt,
|
|
1074
|
+
isSlashIndexHead,
|
|
1075
|
+
isSlashIndexKeyRecord,
|
|
710
1076
|
isTransactionInclusionHead,
|
|
711
1077
|
isTransactionInclusionManifest,
|
|
712
1078
|
manifestPath,
|
|
@@ -714,13 +1080,26 @@ export {
|
|
|
714
1080
|
networkStakeRewardsIndexManifestPath,
|
|
715
1081
|
networkStakeRewardsIndexSnapshotPath,
|
|
716
1082
|
networkStakeRewardsIndexStepPath,
|
|
1083
|
+
offenseAdjudicationStateAt,
|
|
717
1084
|
payloadPath,
|
|
718
1085
|
payloadPathTemplate,
|
|
1086
|
+
protocolMinAt,
|
|
1087
|
+
slashIndexAccusedPath,
|
|
1088
|
+
slashIndexAdjudicationPath,
|
|
1089
|
+
slashIndexChallengePath,
|
|
1090
|
+
slashIndexClaimantPath,
|
|
1091
|
+
slashIndexCommitPath,
|
|
1092
|
+
slashIndexHeadPath,
|
|
1093
|
+
slashIndexKeyPath,
|
|
1094
|
+
slashIndexManifestPath,
|
|
1095
|
+
slashIndexRequestPath,
|
|
719
1096
|
toChainContractManifest,
|
|
720
1097
|
toChainManifest,
|
|
1098
|
+
toChainParams,
|
|
721
1099
|
toIndexHead,
|
|
722
1100
|
toIndexManifest,
|
|
723
1101
|
toPathTemplate,
|
|
1102
|
+
toSlashIndexHead,
|
|
724
1103
|
toTransactionInclusionHead,
|
|
725
1104
|
toTransactionInclusionManifest,
|
|
726
1105
|
transactionInclusionHeadPath,
|