@aztec/stdlib 3.0.0-nightly.20250905 → 4.0.0-nightly.20250907
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/dest/epoch-helpers/index.d.ts +6 -2
- package/dest/epoch-helpers/index.d.ts.map +1 -1
- package/dest/epoch-helpers/index.js +6 -0
- package/dest/interfaces/aztec-node-admin.d.ts +22 -2
- package/dest/interfaces/aztec-node-admin.d.ts.map +1 -1
- package/dest/interfaces/aztec-node-admin.js +2 -1
- package/dest/interfaces/server.d.ts +1 -0
- package/dest/interfaces/server.d.ts.map +1 -1
- package/dest/interfaces/server.js +1 -0
- package/dest/interfaces/validator.d.ts +60 -0
- package/dest/interfaces/validator.d.ts.map +1 -0
- package/dest/interfaces/validator.js +10 -0
- package/dest/validators/schemas.d.ts +42 -4
- package/dest/validators/schemas.d.ts.map +1 -1
- package/dest/validators/schemas.js +5 -4
- package/dest/validators/types.d.ts +8 -10
- package/dest/validators/types.d.ts.map +1 -1
- package/package.json +9 -8
- package/src/epoch-helpers/index.ts +16 -2
- package/src/interfaces/aztec-node-admin.ts +6 -1
- package/src/interfaces/server.ts +1 -0
- package/src/interfaces/validator.ts +70 -0
- package/src/validators/schemas.ts +6 -4
- package/src/validators/types.ts +9 -10
|
@@ -39,12 +39,16 @@ export declare function getEpochNumberAtTimestamp(ts: bigint, constants: Pick<L1
|
|
|
39
39
|
/** Returns the epoch number for a given slot. */
|
|
40
40
|
export declare function getEpochAtSlot(slot: bigint, constants: Pick<L1RollupConstants, 'epochDuration'>): bigint;
|
|
41
41
|
/** Returns the range of L2 slots (inclusive) for a given epoch number. */
|
|
42
|
-
export declare function getSlotRangeForEpoch(epochNumber: bigint, constants: Pick<L1RollupConstants, 'epochDuration'>): bigint
|
|
42
|
+
export declare function getSlotRangeForEpoch(epochNumber: bigint, constants: Pick<L1RollupConstants, 'epochDuration'>): [bigint, bigint];
|
|
43
43
|
/**
|
|
44
44
|
* Returns the range of L1 timestamps (inclusive) for a given epoch number.
|
|
45
45
|
* Note that the endTimestamp is the start timestamp of the last L1 slot for the epoch.
|
|
46
46
|
*/
|
|
47
|
-
export declare function getTimestampRangeForEpoch(epochNumber: bigint, constants: Pick<L1RollupConstants, 'l1GenesisTime' | 'slotDuration' | 'epochDuration' | 'ethereumSlotDuration'>): bigint
|
|
47
|
+
export declare function getTimestampRangeForEpoch(epochNumber: bigint, constants: Pick<L1RollupConstants, 'l1GenesisTime' | 'slotDuration' | 'epochDuration' | 'ethereumSlotDuration'>): [bigint, bigint];
|
|
48
|
+
/**
|
|
49
|
+
* Returns the start timestamp for a given epoch number.
|
|
50
|
+
*/
|
|
51
|
+
export declare function getStartTimestampForEpoch(epochNumber: bigint, constants: Pick<L1RollupConstants, 'l1GenesisTime' | 'slotDuration' | 'epochDuration'>): bigint;
|
|
48
52
|
/**
|
|
49
53
|
* Returns the epoch number at which proofs are no longer accepted for a given epoch.
|
|
50
54
|
* See l1-contracts/src/core/libraries/TimeLib.sol
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/epoch-helpers/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,MAAM,MAAM,iBAAiB,GAAG;IAC9B,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,MAAM,CAAC;IACtB,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,MAAM,CAAC;IACtB,oBAAoB,EAAE,MAAM,CAAC;IAC7B,qBAAqB,EAAE,MAAM,CAAC;CAC/B,CAAC;AAEF,eAAO,MAAM,sBAAsB,EAAE,iBAOpC,CAAC;AAEF,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;EAOE,CAAC;AAEvC,iDAAiD;AACjD,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,MAAM,EACZ,SAAS,EAAE,IAAI,CAAC,iBAAiB,EAAE,eA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AACtD,wBAAgB,yBAAyB,CACvC,EAAE,EAAE,MAAM,EACV,SAAS,EAAE,IAAI,CAAC,iBAAiB,EAAE,eAAe,GAAG,cAAc,GAAG,eAAe,CAAC,UAGvF;AAED,iDAAiD;AACjD,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,IAAI,CAAC,iBAAiB,EAAE,eAAe,CAAC,UAE/F;AAED,0EAA0E;AAC1E,wBAAgB,oBAAoB,CAClC,WAAW,EAAE,MAAM,EACnB,SAAS,EAAE,IAAI,CAAC,iBAAiB,EAAE,eAAe,CAAC,GAClD,CAAC,MAAM,EAAE,MAAM,CAAC,CAGlB;AAED;;;GAGG;AACH,wBAAgB,yBAAyB,CACvC,WAAW,EAAE,MAAM,EACnB,SAAS,EAAE,IAAI,CAAC,iBAAiB,EAAE,eAAe,GAAG,cAAc,GAAG,eAAe,GAAG,sBAAsB,CAAC,GAC9G,CAAC,MAAM,EAAE,MAAM,CAAC,CASlB;AAED;;GAEG;AACH,wBAAgB,yBAAyB,CACvC,WAAW,EAAE,MAAM,EACnB,SAAS,EAAE,IAAI,CAAC,iBAAiB,EAAE,eAAe,GAAG,cAAc,GAAG,eAAe,CAAC,UAIvF;AAED;;;GAGG;AACH,wBAAgB,+BAA+B,CAC7C,WAAW,EAAE,MAAM,EACnB,SAAS,EAAE,IAAI,CAAC,iBAAiB,EAAE,uBAAuB,CAAC,UAG5D;AAED;;;GAGG;AACH,wBAAgB,mCAAmC,CACjD,WAAW,EAAE,MAAM,EACnB,SAAS,EAAE,IAAI,CAAC,iBAAiB,EAAE,eAAe,GAAG,cAAc,GAAG,eAAe,GAAG,uBAAuB,CAAC,UAOjH"}
|
|
@@ -46,6 +46,12 @@ export const L1RollupConstantsSchema = z.object({
|
|
|
46
46
|
constants.l1GenesisTime + endSlot * BigInt(constants.slotDuration) + BigInt((ethereumSlotsPerL2Slot - 1) * constants.ethereumSlotDuration)
|
|
47
47
|
];
|
|
48
48
|
}
|
|
49
|
+
/**
|
|
50
|
+
* Returns the start timestamp for a given epoch number.
|
|
51
|
+
*/ export function getStartTimestampForEpoch(epochNumber, constants) {
|
|
52
|
+
const [startSlot] = getSlotRangeForEpoch(epochNumber, constants);
|
|
53
|
+
return getTimestampForSlot(startSlot, constants);
|
|
54
|
+
}
|
|
49
55
|
/**
|
|
50
56
|
* Returns the epoch number at which proofs are no longer accepted for a given epoch.
|
|
51
57
|
* See l1-contracts/src/core/libraries/TimeLib.sol
|
|
@@ -6,6 +6,7 @@ import { type ComponentsVersions } from '../versioning/index.js';
|
|
|
6
6
|
import { type SequencerConfig } from './configs.js';
|
|
7
7
|
import { type ProverConfig } from './prover-client.js';
|
|
8
8
|
import { type SlasherConfig } from './slasher.js';
|
|
9
|
+
import { type ValidatorClientFullConfig } from './validator.js';
|
|
9
10
|
/**
|
|
10
11
|
* Aztec node admin API.
|
|
11
12
|
*/
|
|
@@ -39,10 +40,10 @@ export interface AztecNodeAdmin {
|
|
|
39
40
|
/** Returns all offenses applicable for the given round. */
|
|
40
41
|
getSlashOffenses(round: bigint | 'all' | 'current'): Promise<Offense[]>;
|
|
41
42
|
}
|
|
42
|
-
export type AztecNodeAdminConfig = SequencerConfig & ProverConfig & SlasherConfig & {
|
|
43
|
+
export type AztecNodeAdminConfig = ValidatorClientFullConfig & SequencerConfig & ProverConfig & SlasherConfig & {
|
|
43
44
|
maxTxPoolSize: number;
|
|
44
45
|
};
|
|
45
|
-
export declare const AztecNodeAdminConfigSchema: z.ZodObject<z.objectUtil.extendShape<z.objectUtil.extendShape<z.objectUtil.extendShape<{
|
|
46
|
+
export declare const AztecNodeAdminConfigSchema: z.ZodObject<z.objectUtil.extendShape<z.objectUtil.extendShape<z.objectUtil.extendShape<z.objectUtil.extendShape<{
|
|
46
47
|
transactionPollingIntervalMS: z.ZodOptional<z.ZodNumber>;
|
|
47
48
|
maxTxsPerBlock: z.ZodOptional<z.ZodNumber>;
|
|
48
49
|
minTxsPerBlock: z.ZodOptional<z.ZodNumber>;
|
|
@@ -120,6 +121,13 @@ export declare const AztecNodeAdminConfigSchema: z.ZodObject<z.objectUtil.extend
|
|
|
120
121
|
slashGracePeriodL2Slots: z.ZodNumber;
|
|
121
122
|
slashBroadcastedInvalidBlockPenalty: z.ZodPipeline<z.ZodUnion<[z.ZodBigInt, z.ZodNumber, z.ZodString]>, z.ZodBigInt>;
|
|
122
123
|
slashSelfAllowed: z.ZodOptional<z.ZodBoolean>;
|
|
124
|
+
}>, {
|
|
125
|
+
validatorAddresses: z.ZodOptional<z.ZodArray<z.ZodType<import("@aztec/foundation/schemas").EthAddress, any, string>, "many">>;
|
|
126
|
+
disableValidator: z.ZodBoolean;
|
|
127
|
+
disabledValidators: z.ZodArray<z.ZodType<import("@aztec/foundation/schemas").EthAddress, any, string>, "many">;
|
|
128
|
+
attestationPollingIntervalMs: z.ZodNumber;
|
|
129
|
+
validatorReexecute: z.ZodBoolean;
|
|
130
|
+
validatorReexecuteDeadlineMs: z.ZodNumber;
|
|
123
131
|
}>, {
|
|
124
132
|
maxTxPoolSize: z.ZodNumber;
|
|
125
133
|
}>, "strip", z.ZodTypeAny, {
|
|
@@ -146,6 +154,11 @@ export declare const AztecNodeAdminConfigSchema: z.ZodObject<z.objectUtil.extend
|
|
|
146
154
|
proverTestDelayMs: number;
|
|
147
155
|
proverTestDelayFactor: number;
|
|
148
156
|
proverAgentCount: number;
|
|
157
|
+
disableValidator: boolean;
|
|
158
|
+
disabledValidators: import("@aztec/foundation/schemas").EthAddress[];
|
|
159
|
+
attestationPollingIntervalMs: number;
|
|
160
|
+
validatorReexecute: boolean;
|
|
161
|
+
validatorReexecuteDeadlineMs: number;
|
|
149
162
|
maxTxPoolSize: number;
|
|
150
163
|
coinbase?: import("@aztec/foundation/schemas").EthAddress | undefined;
|
|
151
164
|
feeRecipient?: import("../aztec-address/index.js").AztecAddress | undefined;
|
|
@@ -179,6 +192,7 @@ export declare const AztecNodeAdminConfigSchema: z.ZodObject<z.objectUtil.extend
|
|
|
179
192
|
slashOverridePayload?: import("@aztec/foundation/schemas").EthAddress | undefined;
|
|
180
193
|
slashSelfAllowed?: boolean | undefined;
|
|
181
194
|
nodeUrl?: string | undefined;
|
|
195
|
+
validatorAddresses?: import("@aztec/foundation/schemas").EthAddress[] | undefined;
|
|
182
196
|
}, {
|
|
183
197
|
secondsBeforeInvalidatingBlockAsCommitteeMember: number;
|
|
184
198
|
secondsBeforeInvalidatingBlockAsNonCommitteeMember: number;
|
|
@@ -203,6 +217,11 @@ export declare const AztecNodeAdminConfigSchema: z.ZodObject<z.objectUtil.extend
|
|
|
203
217
|
proverTestDelayMs: number;
|
|
204
218
|
proverTestDelayFactor: number;
|
|
205
219
|
proverAgentCount: number;
|
|
220
|
+
disableValidator: boolean;
|
|
221
|
+
disabledValidators: string[];
|
|
222
|
+
attestationPollingIntervalMs: number;
|
|
223
|
+
validatorReexecute: boolean;
|
|
224
|
+
validatorReexecuteDeadlineMs: number;
|
|
206
225
|
maxTxPoolSize: number;
|
|
207
226
|
coinbase?: any;
|
|
208
227
|
feeRecipient?: any;
|
|
@@ -236,6 +255,7 @@ export declare const AztecNodeAdminConfigSchema: z.ZodObject<z.objectUtil.extend
|
|
|
236
255
|
slashOverridePayload?: string | undefined;
|
|
237
256
|
slashSelfAllowed?: boolean | undefined;
|
|
238
257
|
nodeUrl?: string | undefined;
|
|
258
|
+
validatorAddresses?: string[] | undefined;
|
|
239
259
|
}>;
|
|
240
260
|
export declare const AztecNodeAdminApiSchema: ApiSchemaFor<AztecNodeAdmin>;
|
|
241
261
|
export declare function createAztecNodeAdminClient(url: string, versions?: Partial<ComponentsVersions>, fetch?: typeof defaultFetch): AztecNodeAdmin;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"aztec-node-admin.d.ts","sourceRoot":"","sources":["../../src/interfaces/aztec-node-admin.ts"],"names":[],"mappings":"AAAA,OAAO,EAA2B,YAAY,EAAE,MAAM,mCAAmC,CAAC;AAE1F,OAAO,EAAE,C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SequencerConfigSchema } from './configs.js';
|
|
6
6
|
import { ProverConfigSchema } from './prover-client.js';
|
|
7
7
|
import { SlasherConfigSchema } from './slasher.js';
|
|
8
|
-
|
|
8
|
+
import { ValidatorClientConfigSchema } from './validator.js';
|
|
9
|
+
export const AztecNodeAdminConfigSchema = SequencerConfigSchema.merge(ProverConfigSchema).merge(SlasherConfigSchema).merge(ValidatorClientConfigSchema).merge(z.object({
|
|
9
10
|
maxTxPoolSize: z.number()
|
|
10
11
|
}));
|
|
11
12
|
export const AztecNodeAdminApiSchema = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/interfaces/server.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,cAAc,CAAC;AAC7B,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,oBAAoB,CAAC;AACnC,cAAc,UAAU,CAAC;AACzB,cAAc,2BAA2B,CAAC;AAC1C,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,0BAA0B,CAAC;AACzC,cAAc,kBAAkB,CAAC;AACjC,cAAc,yBAAyB,CAAC;AACxC,cAAc,kBAAkB,CAAC;AACjC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC"}
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/interfaces/server.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,cAAc,CAAC;AAC7B,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,oBAAoB,CAAC;AACnC,cAAc,UAAU,CAAC;AACzB,cAAc,2BAA2B,CAAC;AAC1C,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,0BAA0B,CAAC;AACzC,cAAc,kBAAkB,CAAC;AACjC,cAAc,yBAAyB,CAAC;AACxC,cAAc,kBAAkB,CAAC;AACjC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,kBAAkB,CAAC;AACjC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import type { SecretValue } from '@aztec/foundation/config';
|
|
2
|
+
import type { EthAddress } from '@aztec/foundation/eth-address';
|
|
3
|
+
import { Fr } from '@aztec/foundation/fields';
|
|
4
|
+
import type { SequencerConfig, SlasherConfig } from '@aztec/stdlib/interfaces/server';
|
|
5
|
+
import type { BlockAttestation, BlockProposal, BlockProposalOptions } from '@aztec/stdlib/p2p';
|
|
6
|
+
import type { ProposedBlockHeader, StateReference, Tx } from '@aztec/stdlib/tx';
|
|
7
|
+
import type { PeerId } from '@libp2p/interface';
|
|
8
|
+
import { z } from 'zod';
|
|
9
|
+
/**
|
|
10
|
+
* Validator client configuration
|
|
11
|
+
*/
|
|
12
|
+
export interface ValidatorClientConfig {
|
|
13
|
+
/** The private keys of the validators participating in attestation duties */
|
|
14
|
+
validatorPrivateKeys?: SecretValue<`0x${string}`[]>;
|
|
15
|
+
/** The addresses of the validators to use with remote signers */
|
|
16
|
+
validatorAddresses?: EthAddress[];
|
|
17
|
+
/** Do not run the validator */
|
|
18
|
+
disableValidator: boolean;
|
|
19
|
+
/** Temporarily disable these specific validator addresses */
|
|
20
|
+
disabledValidators: EthAddress[];
|
|
21
|
+
/** Interval between polling for new attestations from peers */
|
|
22
|
+
attestationPollingIntervalMs: number;
|
|
23
|
+
/** Re-execute transactions before attesting */
|
|
24
|
+
validatorReexecute: boolean;
|
|
25
|
+
/** Will re-execute until this many milliseconds are left in the slot */
|
|
26
|
+
validatorReexecuteDeadlineMs: number;
|
|
27
|
+
}
|
|
28
|
+
export type ValidatorClientFullConfig = ValidatorClientConfig & Pick<SequencerConfig, 'txPublicSetupAllowList'> & Pick<SlasherConfig, 'slashBroadcastedInvalidBlockPenalty'>;
|
|
29
|
+
export declare const ValidatorClientConfigSchema: z.ZodObject<{
|
|
30
|
+
validatorAddresses: z.ZodOptional<z.ZodArray<z.ZodType<EthAddress, any, string>, "many">>;
|
|
31
|
+
disableValidator: z.ZodBoolean;
|
|
32
|
+
disabledValidators: z.ZodArray<z.ZodType<EthAddress, any, string>, "many">;
|
|
33
|
+
attestationPollingIntervalMs: z.ZodNumber;
|
|
34
|
+
validatorReexecute: z.ZodBoolean;
|
|
35
|
+
validatorReexecuteDeadlineMs: z.ZodNumber;
|
|
36
|
+
}, "strip", z.ZodTypeAny, {
|
|
37
|
+
disableValidator: boolean;
|
|
38
|
+
disabledValidators: EthAddress[];
|
|
39
|
+
attestationPollingIntervalMs: number;
|
|
40
|
+
validatorReexecute: boolean;
|
|
41
|
+
validatorReexecuteDeadlineMs: number;
|
|
42
|
+
validatorAddresses?: EthAddress[] | undefined;
|
|
43
|
+
}, {
|
|
44
|
+
disableValidator: boolean;
|
|
45
|
+
disabledValidators: string[];
|
|
46
|
+
attestationPollingIntervalMs: number;
|
|
47
|
+
validatorReexecute: boolean;
|
|
48
|
+
validatorReexecuteDeadlineMs: number;
|
|
49
|
+
validatorAddresses?: string[] | undefined;
|
|
50
|
+
}>;
|
|
51
|
+
export interface Validator {
|
|
52
|
+
start(): Promise<void>;
|
|
53
|
+
registerBlockProposalHandler(): void;
|
|
54
|
+
updateConfig(config: Partial<ValidatorClientFullConfig>): void;
|
|
55
|
+
createBlockProposal(blockNumber: number, header: ProposedBlockHeader, archive: Fr, stateReference: StateReference, txs: Tx[], proposerAddress: EthAddress | undefined, options: BlockProposalOptions): Promise<BlockProposal | undefined>;
|
|
56
|
+
attestToProposal(proposal: BlockProposal, sender: PeerId): Promise<BlockAttestation[] | undefined>;
|
|
57
|
+
broadcastBlockProposal(proposal: BlockProposal): Promise<void>;
|
|
58
|
+
collectAttestations(proposal: BlockProposal, required: number, deadline: Date): Promise<BlockAttestation[]>;
|
|
59
|
+
}
|
|
60
|
+
//# sourceMappingURL=validator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validator.d.ts","sourceRoot":"","sources":["../../src/interfaces/validator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAE9C,OAAO,KAAK,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AACtF,OAAO,KAAK,EAAE,gBAAgB,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAC/F,OAAO,KAAK,EAAE,mBAAmB,EAAE,cAAc,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAC;AAEhF,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,6EAA6E;IAC7E,oBAAoB,CAAC,EAAE,WAAW,CAAC,KAAK,MAAM,EAAE,EAAE,CAAC,CAAC;IAEpD,iEAAiE;IACjE,kBAAkB,CA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AgB,EAAE,CAAC,CAAC;CAC7G"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { schemas } from '@aztec/foundation/schemas';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
export const ValidatorClientConfigSchema = z.object({
|
|
4
|
+
validatorAddresses: z.array(schemas.EthAddress).optional(),
|
|
5
|
+
disableValidator: z.boolean(),
|
|
6
|
+
disabledValidators: z.array(schemas.EthAddress),
|
|
7
|
+
attestationPollingIntervalMs: z.number().min(0),
|
|
8
|
+
validatorReexecute: z.boolean(),
|
|
9
|
+
validatorReexecuteDeadlineMs: z.number().min(0)
|
|
10
|
+
});
|
|
@@ -63,26 +63,32 @@ export declare const ValidatorStatsSchema: z.ZodObject<{
|
|
|
63
63
|
currentStreak: z.ZodPipeline<z.ZodUnion<[z.ZodBigInt, z.ZodNumber, z.ZodString]>, z.ZodNumber>;
|
|
64
64
|
rate: z.ZodOptional<z.ZodNumber>;
|
|
65
65
|
count: z.ZodPipeline<z.ZodUnion<[z.ZodBigInt, z.ZodNumber, z.ZodString]>, z.ZodNumber>;
|
|
66
|
+
total: z.ZodPipeline<z.ZodUnion<[z.ZodBigInt, z.ZodNumber, z.ZodString]>, z.ZodNumber>;
|
|
66
67
|
}, "strip", z.ZodTypeAny, {
|
|
67
68
|
currentStreak: number;
|
|
68
69
|
count: number;
|
|
70
|
+
total: number;
|
|
69
71
|
rate?: number | undefined;
|
|
70
72
|
}, {
|
|
71
73
|
currentStreak: string | number | bigint;
|
|
72
74
|
count: string | number | bigint;
|
|
75
|
+
total: string | number | bigint;
|
|
73
76
|
rate?: number | undefined;
|
|
74
77
|
}>;
|
|
75
78
|
missedAttestations: z.ZodObject<{
|
|
76
79
|
currentStreak: z.ZodPipeline<z.ZodUnion<[z.ZodBigInt, z.ZodNumber, z.ZodString]>, z.ZodNumber>;
|
|
77
80
|
rate: z.ZodOptional<z.ZodNumber>;
|
|
78
81
|
count: z.ZodPipeline<z.ZodUnion<[z.ZodBigInt, z.ZodNumber, z.ZodString]>, z.ZodNumber>;
|
|
82
|
+
total: z.ZodPipeline<z.ZodUnion<[z.ZodBigInt, z.ZodNumber, z.ZodString]>, z.ZodNumber>;
|
|
79
83
|
}, "strip", z.ZodTypeAny, {
|
|
80
84
|
currentStreak: number;
|
|
81
85
|
count: number;
|
|
86
|
+
total: number;
|
|
82
87
|
rate?: number | undefined;
|
|
83
88
|
}, {
|
|
84
89
|
currentStreak: string | number | bigint;
|
|
85
90
|
count: string | number | bigint;
|
|
91
|
+
total: string | number | bigint;
|
|
86
92
|
rate?: number | undefined;
|
|
87
93
|
}>;
|
|
88
94
|
history: z.ZodArray<z.ZodObject<{
|
|
@@ -101,11 +107,13 @@ export declare const ValidatorStatsSchema: z.ZodObject<{
|
|
|
101
107
|
missedProposals: {
|
|
102
108
|
currentStreak: number;
|
|
103
109
|
count: number;
|
|
110
|
+
total: number;
|
|
104
111
|
rate?: number | undefined;
|
|
105
112
|
};
|
|
106
113
|
missedAttestations: {
|
|
107
114
|
currentStreak: number;
|
|
108
115
|
count: number;
|
|
116
|
+
total: number;
|
|
109
117
|
rate?: number | undefined;
|
|
110
118
|
};
|
|
111
119
|
history: {
|
|
@@ -128,11 +136,13 @@ export declare const ValidatorStatsSchema: z.ZodObject<{
|
|
|
128
136
|
missedProposals: {
|
|
129
137
|
currentStreak: string | number | bigint;
|
|
130
138
|
count: string | number | bigint;
|
|
139
|
+
total: string | number | bigint;
|
|
131
140
|
rate?: number | undefined;
|
|
132
141
|
};
|
|
133
142
|
missedAttestations: {
|
|
134
143
|
currentStreak: string | number | bigint;
|
|
135
144
|
count: string | number | bigint;
|
|
145
|
+
total: string | number | bigint;
|
|
136
146
|
rate?: number | undefined;
|
|
137
147
|
};
|
|
138
148
|
history: {
|
|
@@ -184,26 +194,32 @@ export declare const ValidatorsStatsSchema: z.ZodObject<{
|
|
|
184
194
|
currentStreak: z.ZodPipeline<z.ZodUnion<[z.ZodBigInt, z.ZodNumber, z.ZodString]>, z.ZodNumber>;
|
|
185
195
|
rate: z.ZodOptional<z.ZodNumber>;
|
|
186
196
|
count: z.ZodPipeline<z.ZodUnion<[z.ZodBigInt, z.ZodNumber, z.ZodString]>, z.ZodNumber>;
|
|
197
|
+
total: z.ZodPipeline<z.ZodUnion<[z.ZodBigInt, z.ZodNumber, z.ZodString]>, z.ZodNumber>;
|
|
187
198
|
}, "strip", z.ZodTypeAny, {
|
|
188
199
|
currentStreak: number;
|
|
189
200
|
count: number;
|
|
201
|
+
total: number;
|
|
190
202
|
rate?: number | undefined;
|
|
191
203
|
}, {
|
|
192
204
|
currentStreak: string | number | bigint;
|
|
193
205
|
count: string | number | bigint;
|
|
206
|
+
total: string | number | bigint;
|
|
194
207
|
rate?: number | undefined;
|
|
195
208
|
}>;
|
|
196
209
|
missedAttestations: z.ZodObject<{
|
|
197
210
|
currentStreak: z.ZodPipeline<z.ZodUnion<[z.ZodBigInt, z.ZodNumber, z.ZodString]>, z.ZodNumber>;
|
|
198
211
|
rate: z.ZodOptional<z.ZodNumber>;
|
|
199
212
|
count: z.ZodPipeline<z.ZodUnion<[z.ZodBigInt, z.ZodNumber, z.ZodString]>, z.ZodNumber>;
|
|
213
|
+
total: z.ZodPipeline<z.ZodUnion<[z.ZodBigInt, z.ZodNumber, z.ZodString]>, z.ZodNumber>;
|
|
200
214
|
}, "strip", z.ZodTypeAny, {
|
|
201
215
|
currentStreak: number;
|
|
202
216
|
count: number;
|
|
217
|
+
total: number;
|
|
203
218
|
rate?: number | undefined;
|
|
204
219
|
}, {
|
|
205
220
|
currentStreak: string | number | bigint;
|
|
206
221
|
count: string | number | bigint;
|
|
222
|
+
total: string | number | bigint;
|
|
207
223
|
rate?: number | undefined;
|
|
208
224
|
}>;
|
|
209
225
|
history: z.ZodArray<z.ZodObject<{
|
|
@@ -222,11 +238,13 @@ export declare const ValidatorsStatsSchema: z.ZodObject<{
|
|
|
222
238
|
missedProposals: {
|
|
223
239
|
currentStreak: number;
|
|
224
240
|
count: number;
|
|
241
|
+
total: number;
|
|
225
242
|
rate?: number | undefined;
|
|
226
243
|
};
|
|
227
244
|
missedAttestations: {
|
|
228
245
|
currentStreak: number;
|
|
229
246
|
count: number;
|
|
247
|
+
total: number;
|
|
230
248
|
rate?: number | undefined;
|
|
231
249
|
};
|
|
232
250
|
history: {
|
|
@@ -249,11 +267,13 @@ export declare const ValidatorsStatsSchema: z.ZodObject<{
|
|
|
249
267
|
missedProposals: {
|
|
250
268
|
currentStreak: string | number | bigint;
|
|
251
269
|
count: string | number | bigint;
|
|
270
|
+
total: string | number | bigint;
|
|
252
271
|
rate?: number | undefined;
|
|
253
272
|
};
|
|
254
273
|
missedAttestations: {
|
|
255
274
|
currentStreak: string | number | bigint;
|
|
256
275
|
count: string | number | bigint;
|
|
276
|
+
total: string | number | bigint;
|
|
257
277
|
rate?: number | undefined;
|
|
258
278
|
};
|
|
259
279
|
history: {
|
|
@@ -281,11 +301,13 @@ export declare const ValidatorsStatsSchema: z.ZodObject<{
|
|
|
281
301
|
missedProposals: {
|
|
282
302
|
currentStreak: number;
|
|
283
303
|
count: number;
|
|
304
|
+
total: number;
|
|
284
305
|
rate?: number | undefined;
|
|
285
306
|
};
|
|
286
307
|
missedAttestations: {
|
|
287
308
|
currentStreak: number;
|
|
288
309
|
count: number;
|
|
310
|
+
total: number;
|
|
289
311
|
rate?: number | undefined;
|
|
290
312
|
};
|
|
291
313
|
history: {
|
|
@@ -313,11 +335,13 @@ export declare const ValidatorsStatsSchema: z.ZodObject<{
|
|
|
313
335
|
missedProposals: {
|
|
314
336
|
currentStreak: string | number | bigint;
|
|
315
337
|
count: string | number | bigint;
|
|
338
|
+
total: string | number | bigint;
|
|
316
339
|
rate?: number | undefined;
|
|
317
340
|
};
|
|
318
341
|
missedAttestations: {
|
|
319
342
|
currentStreak: string | number | bigint;
|
|
320
343
|
count: string | number | bigint;
|
|
344
|
+
total: string | number | bigint;
|
|
321
345
|
rate?: number | undefined;
|
|
322
346
|
};
|
|
323
347
|
history: {
|
|
@@ -373,26 +397,32 @@ export declare const SingleValidatorStatsSchema: z.ZodObject<{
|
|
|
373
397
|
currentStreak: z.ZodPipeline<z.ZodUnion<[z.ZodBigInt, z.ZodNumber, z.ZodString]>, z.ZodNumber>;
|
|
374
398
|
rate: z.ZodOptional<z.ZodNumber>;
|
|
375
399
|
count: z.ZodPipeline<z.ZodUnion<[z.ZodBigInt, z.ZodNumber, z.ZodString]>, z.ZodNumber>;
|
|
400
|
+
total: z.ZodPipeline<z.ZodUnion<[z.ZodBigInt, z.ZodNumber, z.ZodString]>, z.ZodNumber>;
|
|
376
401
|
}, "strip", z.ZodTypeAny, {
|
|
377
402
|
currentStreak: number;
|
|
378
403
|
count: number;
|
|
404
|
+
total: number;
|
|
379
405
|
rate?: number | undefined;
|
|
380
406
|
}, {
|
|
381
407
|
currentStreak: string | number | bigint;
|
|
382
408
|
count: string | number | bigint;
|
|
409
|
+
total: string | number | bigint;
|
|
383
410
|
rate?: number | undefined;
|
|
384
411
|
}>;
|
|
385
412
|
missedAttestations: z.ZodObject<{
|
|
386
413
|
currentStreak: z.ZodPipeline<z.ZodUnion<[z.ZodBigInt, z.ZodNumber, z.ZodString]>, z.ZodNumber>;
|
|
387
414
|
rate: z.ZodOptional<z.ZodNumber>;
|
|
388
415
|
count: z.ZodPipeline<z.ZodUnion<[z.ZodBigInt, z.ZodNumber, z.ZodString]>, z.ZodNumber>;
|
|
416
|
+
total: z.ZodPipeline<z.ZodUnion<[z.ZodBigInt, z.ZodNumber, z.ZodString]>, z.ZodNumber>;
|
|
389
417
|
}, "strip", z.ZodTypeAny, {
|
|
390
418
|
currentStreak: number;
|
|
391
419
|
count: number;
|
|
420
|
+
total: number;
|
|
392
421
|
rate?: number | undefined;
|
|
393
422
|
}, {
|
|
394
423
|
currentStreak: string | number | bigint;
|
|
395
424
|
count: string | number | bigint;
|
|
425
|
+
total: string | number | bigint;
|
|
396
426
|
rate?: number | undefined;
|
|
397
427
|
}>;
|
|
398
428
|
history: z.ZodArray<z.ZodObject<{
|
|
@@ -411,11 +441,13 @@ export declare const SingleValidatorStatsSchema: z.ZodObject<{
|
|
|
411
441
|
missedProposals: {
|
|
412
442
|
currentStreak: number;
|
|
413
443
|
count: number;
|
|
444
|
+
total: number;
|
|
414
445
|
rate?: number | undefined;
|
|
415
446
|
};
|
|
416
447
|
missedAttestations: {
|
|
417
448
|
currentStreak: number;
|
|
418
449
|
count: number;
|
|
450
|
+
total: number;
|
|
419
451
|
rate?: number | undefined;
|
|
420
452
|
};
|
|
421
453
|
history: {
|
|
@@ -438,11 +470,13 @@ export declare const SingleValidatorStatsSchema: z.ZodObject<{
|
|
|
438
470
|
missedProposals: {
|
|
439
471
|
currentStreak: string | number | bigint;
|
|
440
472
|
count: string | number | bigint;
|
|
473
|
+
total: string | number | bigint;
|
|
441
474
|
rate?: number | undefined;
|
|
442
475
|
};
|
|
443
476
|
missedAttestations: {
|
|
444
477
|
currentStreak: string | number | bigint;
|
|
445
478
|
count: string | number | bigint;
|
|
479
|
+
total: string | number | bigint;
|
|
446
480
|
rate?: number | undefined;
|
|
447
481
|
};
|
|
448
482
|
history: {
|
|
@@ -466,12 +500,12 @@ export declare const SingleValidatorStatsSchema: z.ZodObject<{
|
|
|
466
500
|
epoch: z.ZodPipeline<z.ZodUnion<[z.ZodBigInt, z.ZodNumber, z.ZodString]>, z.ZodBigInt>;
|
|
467
501
|
}, "strip", z.ZodTypeAny, {
|
|
468
502
|
epoch: bigint;
|
|
469
|
-
missed: number;
|
|
470
503
|
total: number;
|
|
504
|
+
missed: number;
|
|
471
505
|
}, {
|
|
472
506
|
epoch: string | number | bigint;
|
|
473
|
-
missed: string | number | bigint;
|
|
474
507
|
total: string | number | bigint;
|
|
508
|
+
missed: string | number | bigint;
|
|
475
509
|
}>, "many">;
|
|
476
510
|
lastProcessedSlot: z.ZodOptional<z.ZodPipeline<z.ZodUnion<[z.ZodBigInt, z.ZodNumber, z.ZodString]>, z.ZodBigInt>>;
|
|
477
511
|
initialSlot: z.ZodOptional<z.ZodPipeline<z.ZodUnion<[z.ZodBigInt, z.ZodNumber, z.ZodString]>, z.ZodBigInt>>;
|
|
@@ -484,11 +518,13 @@ export declare const SingleValidatorStatsSchema: z.ZodObject<{
|
|
|
484
518
|
missedProposals: {
|
|
485
519
|
currentStreak: number;
|
|
486
520
|
count: number;
|
|
521
|
+
total: number;
|
|
487
522
|
rate?: number | undefined;
|
|
488
523
|
};
|
|
489
524
|
missedAttestations: {
|
|
490
525
|
currentStreak: number;
|
|
491
526
|
count: number;
|
|
527
|
+
total: number;
|
|
492
528
|
rate?: number | undefined;
|
|
493
529
|
};
|
|
494
530
|
history: {
|
|
@@ -508,8 +544,8 @@ export declare const SingleValidatorStatsSchema: z.ZodObject<{
|
|
|
508
544
|
};
|
|
509
545
|
allTimeProvenPerformance: {
|
|
510
546
|
epoch: bigint;
|
|
511
|
-
missed: number;
|
|
512
547
|
total: number;
|
|
548
|
+
missed: number;
|
|
513
549
|
}[];
|
|
514
550
|
lastProcessedSlot?: bigint | undefined;
|
|
515
551
|
initialSlot?: bigint | undefined;
|
|
@@ -521,11 +557,13 @@ export declare const SingleValidatorStatsSchema: z.ZodObject<{
|
|
|
521
557
|
missedProposals: {
|
|
522
558
|
currentStreak: string | number | bigint;
|
|
523
559
|
count: string | number | bigint;
|
|
560
|
+
total: string | number | bigint;
|
|
524
561
|
rate?: number | undefined;
|
|
525
562
|
};
|
|
526
563
|
missedAttestations: {
|
|
527
564
|
currentStreak: string | number | bigint;
|
|
528
565
|
count: string | number | bigint;
|
|
566
|
+
total: string | number | bigint;
|
|
529
567
|
rate?: number | undefined;
|
|
530
568
|
};
|
|
531
569
|
history: {
|
|
@@ -545,8 +583,8 @@ export declare const SingleValidatorStatsSchema: z.ZodObject<{
|
|
|
545
583
|
};
|
|
546
584
|
allTimeProvenPerformance: {
|
|
547
585
|
epoch: string | number | bigint;
|
|
548
|
-
missed: string | number | bigint;
|
|
549
586
|
total: string | number | bigint;
|
|
587
|
+
missed: string | number | bigint;
|
|
550
588
|
}[];
|
|
551
589
|
lastProcessedSlot?: string | number | bigint | undefined;
|
|
552
590
|
initialSlot?: string | number | bigint | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../src/validators/schemas.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../src/validators/schemas.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAWxB,eAAO,MAAM,2BAA2B,wGAME,CAAC;AAE3C,eAAO,MAAM,4BAA4B;;;;;;;;;WAKC,CAAC;AAE3C,eAAO,MAAM,iCAAiC;;;;;;;;;oBAAwC,CAAC;AAEvF,eAAO,MAAM,+BAA+B;;;;;;;;;qBAA8C,CAAC;AAe3F,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAQE,CAAC;AAEpC,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAKE,CAAC;AAErC,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAYE,CAAC"}
|
|
@@ -18,18 +18,19 @@ const ValidatorTimeStatSchema = z.object({
|
|
|
18
18
|
slot: schemas.BigInt,
|
|
19
19
|
date: z.string()
|
|
20
20
|
});
|
|
21
|
-
const
|
|
21
|
+
const ValidatorMissedStatsSchema = z.object({
|
|
22
22
|
currentStreak: schemas.Integer,
|
|
23
23
|
rate: z.number().optional(),
|
|
24
|
-
count: schemas.Integer
|
|
24
|
+
count: schemas.Integer,
|
|
25
|
+
total: schemas.Integer
|
|
25
26
|
});
|
|
26
27
|
export const ValidatorStatsSchema = z.object({
|
|
27
28
|
address: schemas.EthAddress,
|
|
28
29
|
lastProposal: ValidatorTimeStatSchema.optional(),
|
|
29
30
|
lastAttestation: ValidatorTimeStatSchema.optional(),
|
|
30
31
|
totalSlots: schemas.Integer,
|
|
31
|
-
missedProposals:
|
|
32
|
-
missedAttestations:
|
|
32
|
+
missedProposals: ValidatorMissedStatsSchema,
|
|
33
|
+
missedAttestations: ValidatorMissedStatsSchema,
|
|
33
34
|
history: ValidatorStatusHistorySchema
|
|
34
35
|
});
|
|
35
36
|
export const ValidatorsStatsSchema = z.object({
|
|
@@ -5,6 +5,12 @@ export type ValidatorStatusHistory = {
|
|
|
5
5
|
slot: bigint;
|
|
6
6
|
status: ValidatorStatusInSlot;
|
|
7
7
|
}[];
|
|
8
|
+
export type ValidatorMissedStats = {
|
|
9
|
+
currentStreak: number;
|
|
10
|
+
rate?: number;
|
|
11
|
+
count: number;
|
|
12
|
+
total: number;
|
|
13
|
+
};
|
|
8
14
|
export type ValidatorStats = {
|
|
9
15
|
address: EthAddress;
|
|
10
16
|
lastProposal?: {
|
|
@@ -18,16 +24,8 @@ export type ValidatorStats = {
|
|
|
18
24
|
date: string;
|
|
19
25
|
};
|
|
20
26
|
totalSlots: number;
|
|
21
|
-
missedProposals:
|
|
22
|
-
|
|
23
|
-
rate?: number;
|
|
24
|
-
count: number;
|
|
25
|
-
};
|
|
26
|
-
missedAttestations: {
|
|
27
|
-
currentStreak: number;
|
|
28
|
-
rate?: number;
|
|
29
|
-
count: number;
|
|
30
|
-
};
|
|
27
|
+
missedProposals: ValidatorMissedStats;
|
|
28
|
+
missedAttestations: ValidatorMissedStats;
|
|
31
29
|
history: ValidatorStatusHistory;
|
|
32
30
|
};
|
|
33
31
|
export type ValidatorsStats = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/validators/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAEhE,MAAM,MAAM,mBAAmB,GAAG,OAAO,GAAG,aAAa,CAAC;AAE1D,MAAM,MAAM,qBAAqB,GAC7B,aAAa,GACb,gBAAgB,GAChB,cAAc,GACd,kBAAkB,GAClB,oBAAoB,CAAC;AAEzB,MAAM,MAAM,sBAAsB,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,qBAAqB,CAAA;CAAE,EAAE,CAAC;AAEvF,MAAM,MAAM,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/validators/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAEhE,MAAM,MAAM,mBAAmB,GAAG,OAAO,GAAG,aAAa,CAAC;AAE1D,MAAM,MAAM,qBAAqB,GAC7B,aAAa,GACb,gBAAgB,GAChB,cAAc,GACd,kBAAkB,GAClB,oBAAoB,CAAC;AAEzB,MAAM,MAAM,sBAAsB,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,qBAAqB,CAAA;CAAE,EAAE,CAAC;AAEvF,MAAM,MAAM,oBAAoB,GAAG;IACjC,aAAa,EAAE,MAAM,CA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}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/stdlib",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.0-nightly.20250907",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"inherits": [
|
|
6
6
|
"../package.common.json",
|
|
@@ -69,13 +69,13 @@
|
|
|
69
69
|
"test": "NODE_NO_WARNINGS=1 node --experimental-vm-modules ../node_modules/.bin/jest --passWithNoTests --maxWorkers=${JEST_MAX_WORKERS:-8}"
|
|
70
70
|
},
|
|
71
71
|
"dependencies": {
|
|
72
|
-
"@aztec/bb.js": "
|
|
73
|
-
"@aztec/blob-lib": "
|
|
74
|
-
"@aztec/constants": "
|
|
75
|
-
"@aztec/ethereum": "
|
|
76
|
-
"@aztec/foundation": "
|
|
77
|
-
"@aztec/l1-artifacts": "
|
|
78
|
-
"@aztec/noir-noirc_abi": "
|
|
72
|
+
"@aztec/bb.js": "4.0.0-nightly.20250907",
|
|
73
|
+
"@aztec/blob-lib": "4.0.0-nightly.20250907",
|
|
74
|
+
"@aztec/constants": "4.0.0-nightly.20250907",
|
|
75
|
+
"@aztec/ethereum": "4.0.0-nightly.20250907",
|
|
76
|
+
"@aztec/foundation": "4.0.0-nightly.20250907",
|
|
77
|
+
"@aztec/l1-artifacts": "4.0.0-nightly.20250907",
|
|
78
|
+
"@aztec/noir-noirc_abi": "4.0.0-nightly.20250907",
|
|
79
79
|
"@google-cloud/storage": "^7.15.0",
|
|
80
80
|
"axios": "^1.9.0",
|
|
81
81
|
"json-stringify-deterministic": "1.0.12",
|
|
@@ -92,6 +92,7 @@
|
|
|
92
92
|
"devDependencies": {
|
|
93
93
|
"@jest/expect": "^30.0.0",
|
|
94
94
|
"@jest/globals": "^30.0.0",
|
|
95
|
+
"@libp2p/interface": "1.3.1",
|
|
95
96
|
"@types/jest": "^30.0.0",
|
|
96
97
|
"@types/lodash.chunk": "^4.2.9",
|
|
97
98
|
"@types/lodash.isequal": "^4.5.8",
|
|
@@ -56,7 +56,10 @@ export function getEpochAtSlot(slot: bigint, constants: Pick<L1RollupConstants,
|
|
|
56
56
|
}
|
|
57
57
|
|
|
58
58
|
/** Returns the range of L2 slots (inclusive) for a given epoch number. */
|
|
59
|
-
export function getSlotRangeForEpoch(
|
|
59
|
+
export function getSlotRangeForEpoch(
|
|
60
|
+
epochNumber: bigint,
|
|
61
|
+
constants: Pick<L1RollupConstants, 'epochDuration'>,
|
|
62
|
+
): [bigint, bigint] {
|
|
60
63
|
const startSlot = epochNumber * BigInt(constants.epochDuration);
|
|
61
64
|
return [startSlot, startSlot + BigInt(constants.epochDuration) - 1n];
|
|
62
65
|
}
|
|
@@ -68,7 +71,7 @@ export function getSlotRangeForEpoch(epochNumber: bigint, constants: Pick<L1Roll
|
|
|
68
71
|
export function getTimestampRangeForEpoch(
|
|
69
72
|
epochNumber: bigint,
|
|
70
73
|
constants: Pick<L1RollupConstants, 'l1GenesisTime' | 'slotDuration' | 'epochDuration' | 'ethereumSlotDuration'>,
|
|
71
|
-
) {
|
|
74
|
+
): [bigint, bigint] {
|
|
72
75
|
const [startSlot, endSlot] = getSlotRangeForEpoch(epochNumber, constants);
|
|
73
76
|
const ethereumSlotsPerL2Slot = constants.slotDuration / constants.ethereumSlotDuration;
|
|
74
77
|
return [
|
|
@@ -79,6 +82,17 @@ export function getTimestampRangeForEpoch(
|
|
|
79
82
|
];
|
|
80
83
|
}
|
|
81
84
|
|
|
85
|
+
/**
|
|
86
|
+
* Returns the start timestamp for a given epoch number.
|
|
87
|
+
*/
|
|
88
|
+
export function getStartTimestampForEpoch(
|
|
89
|
+
epochNumber: bigint,
|
|
90
|
+
constants: Pick<L1RollupConstants, 'l1GenesisTime' | 'slotDuration' | 'epochDuration'>,
|
|
91
|
+
) {
|
|
92
|
+
const [startSlot] = getSlotRangeForEpoch(epochNumber, constants);
|
|
93
|
+
return getTimestampForSlot(startSlot, constants);
|
|
94
|
+
}
|
|
95
|
+
|
|
82
96
|
/**
|
|
83
97
|
* Returns the epoch number at which proofs are no longer accepted for a given epoch.
|
|
84
98
|
* See l1-contracts/src/core/libraries/TimeLib.sol
|
|
@@ -8,6 +8,7 @@ import { type ComponentsVersions, getVersioningResponseHandler } from '../versio
|
|
|
8
8
|
import { type SequencerConfig, SequencerConfigSchema } from './configs.js';
|
|
9
9
|
import { type ProverConfig, ProverConfigSchema } from './prover-client.js';
|
|
10
10
|
import { type SlasherConfig, SlasherConfigSchema } from './slasher.js';
|
|
11
|
+
import { ValidatorClientConfigSchema, type ValidatorClientFullConfig } from './validator.js';
|
|
11
12
|
|
|
12
13
|
/**
|
|
13
14
|
* Aztec node admin API.
|
|
@@ -50,10 +51,14 @@ export interface AztecNodeAdmin {
|
|
|
50
51
|
getSlashOffenses(round: bigint | 'all' | 'current'): Promise<Offense[]>;
|
|
51
52
|
}
|
|
52
53
|
|
|
53
|
-
export type AztecNodeAdminConfig =
|
|
54
|
+
export type AztecNodeAdminConfig = ValidatorClientFullConfig &
|
|
55
|
+
SequencerConfig &
|
|
56
|
+
ProverConfig &
|
|
57
|
+
SlasherConfig & { maxTxPoolSize: number };
|
|
54
58
|
|
|
55
59
|
export const AztecNodeAdminConfigSchema = SequencerConfigSchema.merge(ProverConfigSchema)
|
|
56
60
|
.merge(SlasherConfigSchema)
|
|
61
|
+
.merge(ValidatorClientConfigSchema)
|
|
57
62
|
.merge(z.object({ maxTxPoolSize: z.number() }));
|
|
58
63
|
|
|
59
64
|
export const AztecNodeAdminApiSchema: ApiSchemaFor<AztecNodeAdmin> = {
|
package/src/interfaces/server.ts
CHANGED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import type { SecretValue } from '@aztec/foundation/config';
|
|
2
|
+
import type { EthAddress } from '@aztec/foundation/eth-address';
|
|
3
|
+
import { Fr } from '@aztec/foundation/fields';
|
|
4
|
+
import { type ZodFor, schemas } from '@aztec/foundation/schemas';
|
|
5
|
+
import type { SequencerConfig, SlasherConfig } from '@aztec/stdlib/interfaces/server';
|
|
6
|
+
import type { BlockAttestation, BlockProposal, BlockProposalOptions } from '@aztec/stdlib/p2p';
|
|
7
|
+
import type { ProposedBlockHeader, StateReference, Tx } from '@aztec/stdlib/tx';
|
|
8
|
+
|
|
9
|
+
import type { PeerId } from '@libp2p/interface';
|
|
10
|
+
import { z } from 'zod';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Validator client configuration
|
|
14
|
+
*/
|
|
15
|
+
export interface ValidatorClientConfig {
|
|
16
|
+
/** The private keys of the validators participating in attestation duties */
|
|
17
|
+
validatorPrivateKeys?: SecretValue<`0x${string}`[]>;
|
|
18
|
+
|
|
19
|
+
/** The addresses of the validators to use with remote signers */
|
|
20
|
+
validatorAddresses?: EthAddress[];
|
|
21
|
+
|
|
22
|
+
/** Do not run the validator */
|
|
23
|
+
disableValidator: boolean;
|
|
24
|
+
|
|
25
|
+
/** Temporarily disable these specific validator addresses */
|
|
26
|
+
disabledValidators: EthAddress[];
|
|
27
|
+
|
|
28
|
+
/** Interval between polling for new attestations from peers */
|
|
29
|
+
attestationPollingIntervalMs: number;
|
|
30
|
+
|
|
31
|
+
/** Re-execute transactions before attesting */
|
|
32
|
+
validatorReexecute: boolean;
|
|
33
|
+
|
|
34
|
+
/** Will re-execute until this many milliseconds are left in the slot */
|
|
35
|
+
validatorReexecuteDeadlineMs: number;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export type ValidatorClientFullConfig = ValidatorClientConfig &
|
|
39
|
+
Pick<SequencerConfig, 'txPublicSetupAllowList'> &
|
|
40
|
+
Pick<SlasherConfig, 'slashBroadcastedInvalidBlockPenalty'>;
|
|
41
|
+
|
|
42
|
+
export const ValidatorClientConfigSchema = z.object({
|
|
43
|
+
validatorAddresses: z.array(schemas.EthAddress).optional(),
|
|
44
|
+
disableValidator: z.boolean(),
|
|
45
|
+
disabledValidators: z.array(schemas.EthAddress),
|
|
46
|
+
attestationPollingIntervalMs: z.number().min(0),
|
|
47
|
+
validatorReexecute: z.boolean(),
|
|
48
|
+
validatorReexecuteDeadlineMs: z.number().min(0),
|
|
49
|
+
}) satisfies ZodFor<Omit<ValidatorClientConfig, 'validatorPrivateKeys'>>;
|
|
50
|
+
|
|
51
|
+
export interface Validator {
|
|
52
|
+
start(): Promise<void>;
|
|
53
|
+
registerBlockProposalHandler(): void;
|
|
54
|
+
updateConfig(config: Partial<ValidatorClientFullConfig>): void;
|
|
55
|
+
|
|
56
|
+
// Block validation responsibilities
|
|
57
|
+
createBlockProposal(
|
|
58
|
+
blockNumber: number,
|
|
59
|
+
header: ProposedBlockHeader,
|
|
60
|
+
archive: Fr,
|
|
61
|
+
stateReference: StateReference,
|
|
62
|
+
txs: Tx[],
|
|
63
|
+
proposerAddress: EthAddress | undefined,
|
|
64
|
+
options: BlockProposalOptions,
|
|
65
|
+
): Promise<BlockProposal | undefined>;
|
|
66
|
+
attestToProposal(proposal: BlockProposal, sender: PeerId): Promise<BlockAttestation[] | undefined>;
|
|
67
|
+
|
|
68
|
+
broadcastBlockProposal(proposal: BlockProposal): Promise<void>;
|
|
69
|
+
collectAttestations(proposal: BlockProposal, required: number, deadline: Date): Promise<BlockAttestation[]>;
|
|
70
|
+
}
|
|
@@ -4,6 +4,7 @@ import { z } from 'zod';
|
|
|
4
4
|
|
|
5
5
|
import type {
|
|
6
6
|
SingleValidatorStats,
|
|
7
|
+
ValidatorMissedStats,
|
|
7
8
|
ValidatorStats,
|
|
8
9
|
ValidatorStatusHistory,
|
|
9
10
|
ValidatorStatusInSlot,
|
|
@@ -35,19 +36,20 @@ const ValidatorTimeStatSchema = z.object({
|
|
|
35
36
|
date: z.string(),
|
|
36
37
|
});
|
|
37
38
|
|
|
38
|
-
const
|
|
39
|
+
const ValidatorMissedStatsSchema = z.object({
|
|
39
40
|
currentStreak: schemas.Integer,
|
|
40
41
|
rate: z.number().optional(),
|
|
41
42
|
count: schemas.Integer,
|
|
42
|
-
|
|
43
|
+
total: schemas.Integer,
|
|
44
|
+
}) satisfies ZodFor<ValidatorMissedStats>;
|
|
43
45
|
|
|
44
46
|
export const ValidatorStatsSchema = z.object({
|
|
45
47
|
address: schemas.EthAddress,
|
|
46
48
|
lastProposal: ValidatorTimeStatSchema.optional(),
|
|
47
49
|
lastAttestation: ValidatorTimeStatSchema.optional(),
|
|
48
50
|
totalSlots: schemas.Integer,
|
|
49
|
-
missedProposals:
|
|
50
|
-
missedAttestations:
|
|
51
|
+
missedProposals: ValidatorMissedStatsSchema,
|
|
52
|
+
missedAttestations: ValidatorMissedStatsSchema,
|
|
51
53
|
history: ValidatorStatusHistorySchema,
|
|
52
54
|
}) satisfies ZodFor<ValidatorStats>;
|
|
53
55
|
|
package/src/validators/types.ts
CHANGED
|
@@ -11,21 +11,20 @@ export type ValidatorStatusInSlot =
|
|
|
11
11
|
|
|
12
12
|
export type ValidatorStatusHistory = { slot: bigint; status: ValidatorStatusInSlot }[];
|
|
13
13
|
|
|
14
|
+
export type ValidatorMissedStats = {
|
|
15
|
+
currentStreak: number;
|
|
16
|
+
rate?: number;
|
|
17
|
+
count: number;
|
|
18
|
+
total: number;
|
|
19
|
+
};
|
|
20
|
+
|
|
14
21
|
export type ValidatorStats = {
|
|
15
22
|
address: EthAddress;
|
|
16
23
|
lastProposal?: { timestamp: bigint; slot: bigint; date: string };
|
|
17
24
|
lastAttestation?: { timestamp: bigint; slot: bigint; date: string };
|
|
18
25
|
totalSlots: number;
|
|
19
|
-
missedProposals:
|
|
20
|
-
|
|
21
|
-
rate?: number;
|
|
22
|
-
count: number;
|
|
23
|
-
};
|
|
24
|
-
missedAttestations: {
|
|
25
|
-
currentStreak: number;
|
|
26
|
-
rate?: number;
|
|
27
|
-
count: number;
|
|
28
|
-
};
|
|
26
|
+
missedProposals: ValidatorMissedStats;
|
|
27
|
+
missedAttestations: ValidatorMissedStats;
|
|
29
28
|
history: ValidatorStatusHistory;
|
|
30
29
|
};
|
|
31
30
|
|