@aztec/validator-client 3.0.0-canary.a9708bd → 3.0.0-devnet.3

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.
@@ -0,0 +1,52 @@
1
+ import { Fr } from '@aztec/foundation/fields';
2
+ import { DateProvider } from '@aztec/foundation/timer';
3
+ import type { P2P, PeerId } from '@aztec/p2p';
4
+ import { TxProvider } from '@aztec/p2p';
5
+ import { BlockProposalValidator } from '@aztec/p2p/msg_validators';
6
+ import type { L2Block, L2BlockSource } from '@aztec/stdlib/block';
7
+ import type { IFullNodeBlockBuilder, ValidatorClientFullConfig } from '@aztec/stdlib/interfaces/server';
8
+ import type { L1ToL2MessageSource } from '@aztec/stdlib/messaging';
9
+ import { type BlockProposal } from '@aztec/stdlib/p2p';
10
+ import { type FailedTx, type Tx } from '@aztec/stdlib/tx';
11
+ import { type TelemetryClient, type Tracer } from '@aztec/telemetry-client';
12
+ import type { ValidatorMetrics } from './metrics.js';
13
+ export type BlockProposalValidationFailureReason = 'invalid_proposal' | 'parent_block_not_found' | 'parent_block_wrong_slot' | 'in_hash_mismatch' | 'block_number_already_exists' | 'txs_not_available' | 'state_mismatch' | 'failed_txs' | 'timeout' | 'unknown_error';
14
+ type ReexecuteTransactionsResult = {
15
+ block: L2Block;
16
+ failedTxs: FailedTx[];
17
+ reexecutionTimeMs: number;
18
+ totalManaUsed: number;
19
+ };
20
+ export type BlockProposalValidationSuccessResult = {
21
+ isValid: true;
22
+ blockNumber: number;
23
+ reexecutionResult?: ReexecuteTransactionsResult;
24
+ };
25
+ export type BlockProposalValidationFailureResult = {
26
+ isValid: false;
27
+ reason: BlockProposalValidationFailureReason;
28
+ blockNumber?: number;
29
+ reexecutionResult?: ReexecuteTransactionsResult;
30
+ };
31
+ export type BlockProposalValidationResult = BlockProposalValidationSuccessResult | BlockProposalValidationFailureResult;
32
+ export declare class BlockProposalHandler {
33
+ private blockBuilder;
34
+ private blockSource;
35
+ private l1ToL2MessageSource;
36
+ private txProvider;
37
+ private blockProposalValidator;
38
+ private config;
39
+ private metrics?;
40
+ private dateProvider;
41
+ private log;
42
+ readonly tracer: Tracer;
43
+ constructor(blockBuilder: IFullNodeBlockBuilder, blockSource: L2BlockSource, l1ToL2MessageSource: L1ToL2MessageSource, txProvider: TxProvider, blockProposalValidator: BlockProposalValidator, config: ValidatorClientFullConfig, metrics?: ValidatorMetrics | undefined, dateProvider?: DateProvider, telemetry?: TelemetryClient, log?: import("@aztec/foundation/log").Logger);
44
+ registerForReexecution(p2pClient: P2P): BlockProposalHandler;
45
+ handleBlockProposal(proposal: BlockProposal, proposalSender: PeerId, shouldReexecute: boolean): Promise<BlockProposalValidationResult>;
46
+ private getParentBlock;
47
+ private getReexecutionDeadline;
48
+ private getReexecuteFailureReason;
49
+ reexecuteTransactions(proposal: BlockProposal, blockNumber: number, txs: Tx[], l1ToL2Messages: Fr[]): Promise<ReexecuteTransactionsResult>;
50
+ }
51
+ export {};
52
+ //# sourceMappingURL=block_proposal_handler.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"block_proposal_handler.d.ts","sourceRoot":"","sources":["../src/block_proposal_handler.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAG9C,OAAO,EAAE,YAAY,EAAS,MAAM,yBAAyB,CAAC;AAC9D,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACxC,OAAO,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AAEnE,OAAO,KAAK,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAElE,OAAO,KAAK,EAAE,qBAAqB,EAAE,yBAAyB,EAAE,MAAM,iCAAiC,CAAC;AACxG,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AACnE,OAAO,EAAE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AG;IAZb,SAAgB,MAAM,EAAE,MAAM,CAAC;gBAGrB,YAAY,EAAE,qBAAqB,EACnC,WAAW,EAAE,aAAa,EAC1B,mBAAmB,EAAE,mBAAmB,EACxC,UAAU,EAAE,UAAU,EACtB,sBAAsB,EAAE,sBAAsB,EAC9C,MAAM,EAAE,yBAAyB,EACjC,OAAO,CAAC,EAAE,gBAAgB,YAAA,EAC1B,YAAY,GAAE,YAAiC,EACvD,SAAS,GAAE,eAAsC,EACzC,GAAG,yCAAmD;IAKhE,sBAAsB,CAAC,SAAS,EAAE,GAAG,GAAG,oBAAoB;IA2BtD,mBAAmB,CACvB,QAAQ,EAAE,aAAa,EACvB,cAAc,EAAE,MAAM,EACtB,eAAe,EAAE,OAAO,GACvB,OAAO,CAAC,6BAA6B,CAAC;YA+F3B,cAAc;IAqC5B,OAAO,CAAC,sBAAsB;IAM9B,OAAO,CAAC,yBAAyB;IAY3B,qBAAqB,CACzB,QAAQ,EAAE,aAAa,EACvB,WAAW,EAAE,MAAM,EACnB,GAAG,EAAE,EAAE,EAAE,EACT,cAAc,EAAE,EAAE,EAAE,GACnB,OAAO,CAAC,2BAA2B,CAAC;CA8ExC"}
@@ -0,0 +1,286 @@
1
+ import { INITIAL_L2_BLOCK_NUM } from '@aztec/constants';
2
+ import { TimeoutError } from '@aztec/foundation/error';
3
+ import { Fr } from '@aztec/foundation/fields';
4
+ import { createLogger } from '@aztec/foundation/log';
5
+ import { retryUntil } from '@aztec/foundation/retry';
6
+ import { DateProvider, Timer } from '@aztec/foundation/timer';
7
+ import { computeInHashFromL1ToL2Messages } from '@aztec/prover-client/helpers';
8
+ import { getTimestampForSlot } from '@aztec/stdlib/epoch-helpers';
9
+ import { ConsensusPayload } from '@aztec/stdlib/p2p';
10
+ import { GlobalVariables } from '@aztec/stdlib/tx';
11
+ import { ReExFailedTxsError, ReExStateMismatchError, ReExTimeoutError, TransactionsNotAvailableError } from '@aztec/stdlib/validators';
12
+ import { getTelemetryClient } from '@aztec/telemetry-client';
13
+ export class BlockProposalHandler {
14
+ blockBuilder;
15
+ blockSource;
16
+ l1ToL2MessageSource;
17
+ txProvider;
18
+ blockProposalValidator;
19
+ config;
20
+ metrics;
21
+ dateProvider;
22
+ log;
23
+ tracer;
24
+ constructor(blockBuilder, blockSource, l1ToL2MessageSource, txProvider, blockProposalValidator, config, metrics, dateProvider = new DateProvider(), telemetry = getTelemetryClient(), log = createLogger('validator:block-proposal-handler')){
25
+ this.blockBuilder = blockBuilder;
26
+ this.blockSource = blockSource;
27
+ this.l1ToL2MessageSource = l1ToL2MessageSource;
28
+ this.txProvider = txProvider;
29
+ this.blockProposalValidator = blockProposalValidator;
30
+ this.config = config;
31
+ this.metrics = metrics;
32
+ this.dateProvider = dateProvider;
33
+ this.log = log;
34
+ this.tracer = telemetry.getTracer('BlockProposalHandler');
35
+ }
36
+ registerForReexecution(p2pClient) {
37
+ const handler = async (proposal, proposalSender)=>{
38
+ try {
39
+ const result = await this.handleBlockProposal(proposal, proposalSender, true);
40
+ if (result.isValid) {
41
+ this.log.info(`Non-validator reexecution completed for slot ${proposal.slotNumber.toBigInt()}`, {
42
+ blockNumber: result.blockNumber,
43
+ reexecutionTimeMs: result.reexecutionResult?.reexecutionTimeMs,
44
+ totalManaUsed: result.reexecutionResult?.totalManaUsed,
45
+ numTxs: result.reexecutionResult?.block?.body?.txEffects?.length ?? 0
46
+ });
47
+ } else {
48
+ this.log.warn(`Non-validator reexecution failed for slot ${proposal.slotNumber.toBigInt()}`, {
49
+ blockNumber: result.blockNumber,
50
+ reason: result.reason
51
+ });
52
+ }
53
+ } catch (error) {
54
+ this.log.error('Error processing block proposal in non-validator handler', error);
55
+ }
56
+ return undefined; // Non-validator nodes don't return attestations
57
+ };
58
+ p2pClient.registerBlockProposalHandler(handler);
59
+ return this;
60
+ }
61
+ async handleBlockProposal(proposal, proposalSender, shouldReexecute) {
62
+ const slotNumber = proposal.slotNumber.toBigInt();
63
+ const proposer = proposal.getSender();
64
+ const config = this.blockBuilder.getConfig();
65
+ // Reject proposals with invalid signatures
66
+ if (!proposer) {
67
+ this.log.warn(`Received proposal with invalid signature for slot ${slotNumber}`);
68
+ return {
69
+ isValid: false,
70
+ reason: 'invalid_proposal'
71
+ };
72
+ }
73
+ const proposalInfo = {
74
+ ...proposal.toBlockInfo(),
75
+ proposer: proposer.toString()
76
+ };
77
+ this.log.info(`Processing proposal for slot ${slotNumber}`, {
78
+ ...proposalInfo,
79
+ txHashes: proposal.txHashes.map((t)=>t.toString())
80
+ });
81
+ // Check that the proposal is from the current proposer, or the next proposer
82
+ // This should have been handled by the p2p layer, but we double check here out of caution
83
+ const invalidProposal = await this.blockProposalValidator.validate(proposal);
84
+ if (invalidProposal) {
85
+ this.log.warn(`Proposal is not valid, skipping processing`, proposalInfo);
86
+ return {
87
+ isValid: false,
88
+ reason: 'invalid_proposal'
89
+ };
90
+ }
91
+ // Check that the parent proposal is a block we know, otherwise reexecution would fail
92
+ const parentBlockHeader = await this.getParentBlock(proposal);
93
+ if (parentBlockHeader === undefined) {
94
+ this.log.warn(`Parent block for proposal not found, skipping processing`, proposalInfo);
95
+ return {
96
+ isValid: false,
97
+ reason: 'parent_block_not_found'
98
+ };
99
+ }
100
+ // Check that the parent block's slot is less than the proposal's slot (should not happen, but we check anyway)
101
+ if (parentBlockHeader !== 'genesis' && parentBlockHeader.getSlot() >= slotNumber) {
102
+ this.log.warn(`Parent block slot is greater than or equal to proposal slot, skipping processing`, {
103
+ parentBlockSlot: parentBlockHeader.getSlot().toString(),
104
+ proposalSlot: slotNumber.toString(),
105
+ ...proposalInfo
106
+ });
107
+ return {
108
+ isValid: false,
109
+ reason: 'parent_block_wrong_slot'
110
+ };
111
+ }
112
+ // Compute the block number based on the parent block
113
+ const blockNumber = parentBlockHeader === 'genesis' ? INITIAL_L2_BLOCK_NUM : parentBlockHeader.getBlockNumber() + 1;
114
+ // Check that this block number does not exist already
115
+ const existingBlock = await this.blockSource.getBlockHeader(blockNumber);
116
+ if (existingBlock) {
117
+ this.log.warn(`Block number ${blockNumber} already exists, skipping processing`, proposalInfo);
118
+ return {
119
+ isValid: false,
120
+ blockNumber,
121
+ reason: 'block_number_already_exists'
122
+ };
123
+ }
124
+ // Collect txs from the proposal. We start doing this as early as possible,
125
+ // and we do it even if we don't plan to re-execute the txs, so that we have them if another node needs them.
126
+ const { txs, missingTxs } = await this.txProvider.getTxsForBlockProposal(proposal, blockNumber, {
127
+ pinnedPeer: proposalSender,
128
+ deadline: this.getReexecutionDeadline(slotNumber, config)
129
+ });
130
+ // Check that I have the same set of l1ToL2Messages as the proposal
131
+ const l1ToL2Messages = await this.l1ToL2MessageSource.getL1ToL2Messages(blockNumber);
132
+ const computedInHash = await computeInHashFromL1ToL2Messages(l1ToL2Messages);
133
+ const proposalInHash = proposal.payload.header.contentCommitment.inHash;
134
+ if (!computedInHash.equals(proposalInHash)) {
135
+ this.log.warn(`L1 to L2 messages in hash mismatch, skipping processing`, {
136
+ proposalInHash: proposalInHash.toString(),
137
+ computedInHash: computedInHash.toString(),
138
+ ...proposalInfo
139
+ });
140
+ return {
141
+ isValid: false,
142
+ blockNumber,
143
+ reason: 'in_hash_mismatch'
144
+ };
145
+ }
146
+ // Check that all of the transactions in the proposal are available
147
+ if (missingTxs.length > 0) {
148
+ this.log.warn(`Missing ${missingTxs.length} txs to process proposal`, {
149
+ ...proposalInfo,
150
+ missingTxs
151
+ });
152
+ return {
153
+ isValid: false,
154
+ blockNumber,
155
+ reason: 'txs_not_available'
156
+ };
157
+ }
158
+ // Try re-executing the transactions in the proposal if needed
159
+ let reexecutionResult;
160
+ if (shouldReexecute) {
161
+ try {
162
+ this.log.verbose(`Re-executing transactions in the proposal`, proposalInfo);
163
+ reexecutionResult = await this.reexecuteTransactions(proposal, blockNumber, txs, l1ToL2Messages);
164
+ } catch (error) {
165
+ this.log.error(`Error reexecuting txs while processing block proposal`, error, proposalInfo);
166
+ const reason = this.getReexecuteFailureReason(error);
167
+ return {
168
+ isValid: false,
169
+ blockNumber,
170
+ reason,
171
+ reexecutionResult
172
+ };
173
+ }
174
+ }
175
+ this.log.info(`Successfully processed proposal for slot ${slotNumber}`, proposalInfo);
176
+ return {
177
+ isValid: true,
178
+ blockNumber,
179
+ reexecutionResult
180
+ };
181
+ }
182
+ async getParentBlock(proposal) {
183
+ const parentArchive = proposal.payload.header.lastArchiveRoot;
184
+ const slot = proposal.slotNumber.toBigInt();
185
+ const config = this.blockBuilder.getConfig();
186
+ const { genesisArchiveRoot } = await this.blockSource.getGenesisValues();
187
+ if (parentArchive.equals(genesisArchiveRoot)) {
188
+ return 'genesis';
189
+ }
190
+ const deadline = this.getReexecutionDeadline(slot, config);
191
+ const currentTime = this.dateProvider.now();
192
+ const timeoutDurationMs = deadline.getTime() - currentTime;
193
+ try {
194
+ return await this.blockSource.getBlockHeaderByArchive(parentArchive) ?? (timeoutDurationMs <= 0 ? undefined : await retryUntil(()=>this.blockSource.syncImmediate().then(()=>this.blockSource.getBlockHeaderByArchive(parentArchive)), 'force archiver sync', timeoutDurationMs / 1000, 0.5));
195
+ } catch (err) {
196
+ if (err instanceof TimeoutError) {
197
+ this.log.debug(`Timed out getting parent block by archive root`, {
198
+ parentArchive
199
+ });
200
+ } else {
201
+ this.log.error('Error getting parent block by archive root', err, {
202
+ parentArchive
203
+ });
204
+ }
205
+ return undefined;
206
+ }
207
+ }
208
+ getReexecutionDeadline(slot, config) {
209
+ const nextSlotTimestampSeconds = Number(getTimestampForSlot(slot + 1n, config));
210
+ const msNeededForPropagationAndPublishing = this.config.validatorReexecuteDeadlineMs;
211
+ return new Date(nextSlotTimestampSeconds * 1000 - msNeededForPropagationAndPublishing);
212
+ }
213
+ getReexecuteFailureReason(err) {
214
+ if (err instanceof ReExStateMismatchError) {
215
+ return 'state_mismatch';
216
+ } else if (err instanceof ReExFailedTxsError) {
217
+ return 'failed_txs';
218
+ } else if (err instanceof ReExTimeoutError) {
219
+ return 'timeout';
220
+ } else {
221
+ return 'unknown_error';
222
+ }
223
+ }
224
+ async reexecuteTransactions(proposal, blockNumber, txs, l1ToL2Messages) {
225
+ const { header } = proposal.payload;
226
+ const { txHashes } = proposal;
227
+ // If we do not have all of the transactions, then we should fail
228
+ if (txs.length !== txHashes.length) {
229
+ const foundTxHashes = txs.map((tx)=>tx.getTxHash());
230
+ const missingTxHashes = txHashes.filter((txHash)=>!foundTxHashes.includes(txHash));
231
+ throw new TransactionsNotAvailableError(missingTxHashes);
232
+ }
233
+ // Use the sequencer's block building logic to re-execute the transactions
234
+ const timer = new Timer();
235
+ const config = this.blockBuilder.getConfig();
236
+ // We source most global variables from the proposal
237
+ const globalVariables = GlobalVariables.from({
238
+ slotNumber: proposal.payload.header.slotNumber,
239
+ coinbase: proposal.payload.header.coinbase,
240
+ feeRecipient: proposal.payload.header.feeRecipient,
241
+ gasFees: proposal.payload.header.gasFees,
242
+ blockNumber,
243
+ timestamp: header.timestamp,
244
+ chainId: new Fr(config.l1ChainId),
245
+ version: new Fr(config.rollupVersion)
246
+ });
247
+ const { block, failedTxs } = await this.blockBuilder.buildBlock(txs, l1ToL2Messages, globalVariables, {
248
+ deadline: this.getReexecutionDeadline(proposal.payload.header.slotNumber.toBigInt(), config)
249
+ });
250
+ const numFailedTxs = failedTxs.length;
251
+ const slot = proposal.slotNumber.toBigInt();
252
+ this.log.verbose(`Transaction re-execution complete for slot ${slot}`, {
253
+ numFailedTxs,
254
+ numProposalTxs: txHashes.length,
255
+ numProcessedTxs: block.body.txEffects.length,
256
+ slot
257
+ });
258
+ if (numFailedTxs > 0) {
259
+ this.metrics?.recordFailedReexecution(proposal);
260
+ throw new ReExFailedTxsError(numFailedTxs);
261
+ }
262
+ if (block.body.txEffects.length !== txHashes.length) {
263
+ this.metrics?.recordFailedReexecution(proposal);
264
+ throw new ReExTimeoutError();
265
+ }
266
+ // Throw a ReExStateMismatchError error if state updates do not match
267
+ const blockPayload = ConsensusPayload.fromBlock(block);
268
+ if (!blockPayload.equals(proposal.payload)) {
269
+ this.log.warn(`Re-execution state mismatch for slot ${slot}`, {
270
+ expected: blockPayload.toInspect(),
271
+ actual: proposal.payload.toInspect()
272
+ });
273
+ this.metrics?.recordFailedReexecution(proposal);
274
+ throw new ReExStateMismatchError(proposal.archive, block.archive.root, proposal.payload.stateReference, block.header.state);
275
+ }
276
+ const reexecutionTimeMs = timer.ms();
277
+ const totalManaUsed = block.header.totalManaUsed.toNumber() / 1e6;
278
+ this.metrics?.recordReex(reexecutionTimeMs, txs.length, totalManaUsed);
279
+ return {
280
+ block,
281
+ failedTxs,
282
+ reexecutionTimeMs,
283
+ totalManaUsed
284
+ };
285
+ }
286
+ }
package/dest/config.d.ts CHANGED
@@ -1,22 +1,6 @@
1
- import { type ConfigMappingsType, type SecretValue } from '@aztec/foundation/config';
2
- import { EthAddress } from '@aztec/foundation/eth-address';
3
- /**
4
- * The Validator Configuration
5
- */
6
- export interface ValidatorClientConfig {
7
- /** The private keys of the validators participating in attestation duties */
8
- validatorPrivateKeys?: SecretValue<`0x${string}`[]>;
9
- /** The addresses of the validators to use with remote signers */
10
- validatorAddresses?: EthAddress[];
11
- /** Do not run the validator */
12
- disableValidator: boolean;
13
- /** Interval between polling for new attestations from peers */
14
- attestationPollingIntervalMs: number;
15
- /** Re-execute transactions before attesting */
16
- validatorReexecute: boolean;
17
- /** Will re-execute until this many milliseconds are left in the slot */
18
- validatorReexecuteDeadlineMs: number;
19
- }
1
+ import { type ConfigMappingsType } from '@aztec/foundation/config';
2
+ import type { ValidatorClientConfig } from '@aztec/stdlib/interfaces/server';
3
+ export type { ValidatorClientConfig };
20
4
  export declare const validatorClientConfigMappings: ConfigMappingsType<ValidatorClientConfig>;
21
5
  /**
22
6
  * Returns the prover configuration from the environment variables.
@@ -1 +1 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,kBAAkB,EACvB,KAAK,WAAW,EAKjB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAE3D;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,6EAA6E;IAC7E,oBAAoB,CAAC,EAAE,WAAW,CAAC,KAAK,MAAM,EAAE,EAAE,CAAC,CAAC;IAEpD,iEAAiE;IACjE,kBAAkB,CAAC,EAAE,UAAU,EAAE,CAAC;IAElC,+BAA+B;IAC/B,gBAAgB,EAAE,OAAO,CAAC;IAE1B,+DAA+D;IAC/D,4BAA4B,EAAE,MAAM,CAAC;IAErC,+CAA+C;IAC/C,kBAAkB,EAAE,OAAO,CAAC;IAE5B,wEAAwE;IACxE,4BAA4B,EAAE,MAAM,CAAC;CACtC;AAED,eAAO,MAAM,6BAA6B,EAAE,kBAAkB,CAAC,qBAAqB,CAkCnF,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,gBAAgB,IAAI,qBAAqB,CAExD"}
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,kBAAkB,EAKxB,MAAM,0BAA0B,CAAC;AAElC,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,iCAAiC,CAAC;AAE7E,YAAY,EAAE,qBAAqB,EAAE,CAAC;AAEtC,eAAO,MAAM,6BAA6B,EAAE,kBAAkB,CAAC,qBAAqB,CAsDnF,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,gBAAgB,IAAI,qBAAqB,CAExD"}
package/dest/config.js CHANGED
@@ -12,12 +12,18 @@ export const validatorClientConfigMappings = {
12
12
  validatorAddresses: {
13
13
  env: 'VALIDATOR_ADDRESSES',
14
14
  description: 'List of addresses of the validators to use with remote signers',
15
- parseEnv: (val)=>val.split(',').map((address)=>EthAddress.fromString(address))
15
+ parseEnv: (val)=>val.split(',').filter((address)=>address && address.trim().length > 0).map((address)=>EthAddress.fromString(address.trim())),
16
+ defaultValue: []
16
17
  },
17
18
  disableValidator: {
18
19
  env: 'VALIDATOR_DISABLED',
19
20
  description: 'Do not run the validator',
20
- ...booleanConfigHelper()
21
+ ...booleanConfigHelper(false)
22
+ },
23
+ disabledValidators: {
24
+ description: 'Temporarily disable these specific validator addresses',
25
+ parseEnv: (val)=>val.split(',').filter((address)=>address && address.trim().length > 0).map((address)=>EthAddress.fromString(address.trim())),
26
+ defaultValue: []
21
27
  },
22
28
  attestationPollingIntervalMs: {
23
29
  env: 'VALIDATOR_ATTESTATIONS_POLLING_INTERVAL_MS',
@@ -33,6 +39,11 @@ export const validatorClientConfigMappings = {
33
39
  env: 'VALIDATOR_REEXECUTE_DEADLINE_MS',
34
40
  description: 'Will re-execute until this many milliseconds are left in the slot',
35
41
  ...numberConfigHelper(6000)
42
+ },
43
+ alwaysReexecuteBlockProposals: {
44
+ env: 'ALWAYS_REEXECUTE_BLOCK_PROPOSALS',
45
+ description: 'Whether to always reexecute block proposals, even for non-validator nodes (useful for monitoring network status).',
46
+ ...booleanConfigHelper(false)
36
47
  }
37
48
  };
38
49
  /**
@@ -1,22 +1,26 @@
1
1
  import type { EthAddress } from '@aztec/foundation/eth-address';
2
- import type { Fr } from '@aztec/foundation/fields';
2
+ import type { Signature } from '@aztec/foundation/eth-signature';
3
+ import { Fr } from '@aztec/foundation/fields';
4
+ import type { CommitteeAttestationsAndSigners } from '@aztec/stdlib/block';
3
5
  import { BlockAttestation, BlockProposal, type BlockProposalOptions } from '@aztec/stdlib/p2p';
4
- import type { ProposedBlockHeader, StateReference, Tx } from '@aztec/stdlib/tx';
6
+ import type { CheckpointHeader } from '@aztec/stdlib/rollup';
7
+ import { StateReference, type Tx } from '@aztec/stdlib/tx';
5
8
  import type { ValidatorKeyStore } from '../key_store/interface.js';
6
9
  export declare class ValidationService {
7
10
  private keyStore;
8
- constructor(keyStore: ValidatorKeyStore);
11
+ private log;
12
+ constructor(keyStore: ValidatorKeyStore, log?: import("@aztec/foundation/log").Logger);
9
13
  /**
10
14
  * Create a block proposal with the given header, archive, and transactions
11
15
  *
12
- * @param blockNumber - The block number this proposal is for
13
16
  * @param header - The block header
14
17
  * @param archive - The archive of the current block
15
18
  * @param txs - TxHash[] ordered list of transactions
19
+ * @param options - Block proposal options (including broadcastInvalidBlockProposal for testing)
16
20
  *
17
21
  * @returns A block proposal signing the above information (not the current implementation!!!)
18
22
  */
19
- createBlockProposal(blockNumber: number, header: ProposedBlockHeader, archive: Fr, stateReference: StateReference, txs: Tx[], proposerAttesterAddress: EthAddress | undefined, options: BlockProposalOptions): Promise<BlockProposal>;
23
+ createBlockProposal(header: CheckpointHeader, archive: Fr, stateReference: StateReference, txs: Tx[], proposerAttesterAddress: EthAddress | undefined, options: BlockProposalOptions): Promise<BlockProposal>;
20
24
  /**
21
25
  * Attest with selection of validators to the given block proposal, constructed by the current sequencer
22
26
  *
@@ -28,5 +32,6 @@ export declare class ValidationService {
28
32
  * @returns attestations
29
33
  */
30
34
  attestToProposal(proposal: BlockProposal, attestors: EthAddress[]): Promise<BlockAttestation[]>;
35
+ signAttestationsAndSigners(attestationsAndSigners: CommitteeAttestationsAndSigners, proposer: EthAddress): Promise<Signature>;
31
36
  }
32
37
  //# sourceMappingURL=validation_service.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"validation_service.d.ts","sourceRoot":"","sources":["../../src/duties/validation_service.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAEhE,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AACnD,OAAO,EACL,gBAAgB,EAChB,aAAa,EACb,KAAK,oBAAoB,EAG1B,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EAAE,mBAAmB,EAAE,cAAc,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAC;AAEhF,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAEnE,qBAAa,iBAAiB;IAChB,OAAO,CAAC,QAAQ;gBAAR,QAAQ,EAAE,iBAAiB;IAE/C;;;;;;;;;OASG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EAAE,UAAU,GAAG,SAAS,EAC/C,OAAO,EAAE,oBAAoB,GAC5B,OAAO,CAAC,aAAa,CAAC;IA0BzB;;;;;;;;;OASG;IACG,gBAAgB,CAAC,QAAQ,EAAE,aAAa,EAAE,SAAS,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC,gBAAgB,EAAE,CAAC;IAU/F,0BAA0B,CAC9B,sBAAsB,EAAE,+BAA+B,EACvD,QAAQ,EAAE,UAAU,GACnB,OAAO,CAAC,SAAS,CAAC;CAMtB"}
@@ -1,21 +1,26 @@
1
1
  import { Buffer32 } from '@aztec/foundation/buffer';
2
2
  import { keccak256 } from '@aztec/foundation/crypto';
3
+ import { createLogger } from '@aztec/foundation/log';
4
+ import { unfreeze } from '@aztec/foundation/types';
3
5
  import { BlockAttestation, BlockProposal, ConsensusPayload, SignatureDomainSeparator } from '@aztec/stdlib/p2p';
6
+ import { AppendOnlyTreeSnapshot } from '@aztec/stdlib/trees';
4
7
  export class ValidationService {
5
8
  keyStore;
6
- constructor(keyStore){
9
+ log;
10
+ constructor(keyStore, log = createLogger('validator:validation-service')){
7
11
  this.keyStore = keyStore;
12
+ this.log = log;
8
13
  }
9
14
  /**
10
15
  * Create a block proposal with the given header, archive, and transactions
11
16
  *
12
- * @param blockNumber - The block number this proposal is for
13
17
  * @param header - The block header
14
18
  * @param archive - The archive of the current block
15
19
  * @param txs - TxHash[] ordered list of transactions
20
+ * @param options - Block proposal options (including broadcastInvalidBlockProposal for testing)
16
21
  *
17
22
  * @returns A block proposal signing the above information (not the current implementation!!!)
18
- */ async createBlockProposal(blockNumber, header, archive, stateReference, txs, proposerAttesterAddress, options) {
23
+ */ async createBlockProposal(header, archive, stateReference, txs, proposerAttesterAddress, options) {
19
24
  let payloadSigner;
20
25
  if (proposerAttesterAddress !== undefined) {
21
26
  payloadSigner = (payload)=>this.keyStore.signMessageWithAddress(proposerAttesterAddress, payload);
@@ -26,7 +31,12 @@ export class ValidationService {
26
31
  }
27
32
  // TODO: check if this is calculated earlier / can not be recomputed
28
33
  const txHashes = await Promise.all(txs.map((tx)=>tx.getTxHash()));
29
- return BlockProposal.createProposalFromSigner(blockNumber, new ConsensusPayload(header, archive, stateReference), txHashes, options.publishFullTxs ? txs : undefined, payloadSigner);
34
+ // For testing: corrupt the state reference to trigger state_mismatch validation failure
35
+ if (options.broadcastInvalidBlockProposal) {
36
+ unfreeze(stateReference.partial).noteHashTree = AppendOnlyTreeSnapshot.random();
37
+ this.log.warn(`Creating INVALID block proposal for slot ${header.slotNumber.toBigInt()}`);
38
+ }
39
+ return BlockProposal.createProposalFromSigner(new ConsensusPayload(header, archive, stateReference), txHashes, options.publishFullTxs ? txs : undefined, payloadSigner);
30
40
  }
31
41
  /**
32
42
  * Attest with selection of validators to the given block proposal, constructed by the current sequencer
@@ -40,7 +50,10 @@ export class ValidationService {
40
50
  */ async attestToProposal(proposal, attestors) {
41
51
  const buf = Buffer32.fromBuffer(keccak256(proposal.payload.getPayloadToSign(SignatureDomainSeparator.blockAttestation)));
42
52
  const signatures = await Promise.all(attestors.map((attestor)=>this.keyStore.signMessageWithAddress(attestor, buf)));
43
- //await this.keyStore.signMessage(buf);
44
- return signatures.map((sig)=>new BlockAttestation(proposal.blockNumber, proposal.payload, sig));
53
+ return signatures.map((sig)=>new BlockAttestation(proposal.payload, sig, proposal.signature));
54
+ }
55
+ async signAttestationsAndSigners(attestationsAndSigners, proposer) {
56
+ const buf = Buffer32.fromBuffer(keccak256(attestationsAndSigners.getPayloadToSign(SignatureDomainSeparator.attestationsAndSigners)));
57
+ return await this.keyStore.signMessageWithAddress(proposer, buf);
45
58
  }
46
59
  }
package/dest/factory.d.ts CHANGED
@@ -1,14 +1,23 @@
1
1
  import type { EpochCache } from '@aztec/epoch-cache';
2
2
  import type { DateProvider } from '@aztec/foundation/timer';
3
3
  import type { KeystoreManager } from '@aztec/node-keystore';
4
- import type { P2PClient } from '@aztec/p2p';
4
+ import { type P2PClient } from '@aztec/p2p';
5
5
  import type { L2BlockSource } from '@aztec/stdlib/block';
6
- import type { IFullNodeBlockBuilder, SlasherConfig } from '@aztec/stdlib/interfaces/server';
6
+ import type { IFullNodeBlockBuilder, ValidatorClientFullConfig } from '@aztec/stdlib/interfaces/server';
7
7
  import type { L1ToL2MessageSource } from '@aztec/stdlib/messaging';
8
8
  import type { TelemetryClient } from '@aztec/telemetry-client';
9
- import type { ValidatorClientConfig } from './config.js';
9
+ import { BlockProposalHandler } from './block_proposal_handler.js';
10
10
  import { ValidatorClient } from './validator.js';
11
- export declare function createValidatorClient(config: ValidatorClientConfig & Pick<SlasherConfig, 'slashBroadcastedInvalidBlockPenalty'>, deps: {
11
+ export declare function createBlockProposalHandler(config: ValidatorClientFullConfig, deps: {
12
+ blockBuilder: IFullNodeBlockBuilder;
13
+ blockSource: L2BlockSource;
14
+ l1ToL2MessageSource: L1ToL2MessageSource;
15
+ p2pClient: P2PClient;
16
+ epochCache: EpochCache;
17
+ dateProvider: DateProvider;
18
+ telemetry: TelemetryClient;
19
+ }): BlockProposalHandler;
20
+ export declare function createValidatorClient(config: ValidatorClientFullConfig, deps: {
12
21
  blockBuilder: IFullNodeBlockBuilder;
13
22
  p2pClient: P2PClient;
14
23
  blockSource: L2BlockSource;
@@ -1 +1 @@
1
- {"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../src/factory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,KAAK,EAAE,qBAAqB,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAC5F,OAAO,KAAK,EAAE,mBAAmB,EAA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EjD,wBAAgB,0BAA0B,CACxC,MAAM,EAAE,yBAAyB,EACjC,IAAI,EAAE;IACJ,YAAY,EAAE,qBAAqB,CAAC;IACpC,WAAW,EAAE,aAAa,CAAC;IAC3B,mBAAmB,EAAE,mBAAmB,CAAC;IACzC,SAAS,EAAE,SAAS,CAAC;IACrB,UAAU,EAAE,UAAU,CAAC;IACvB,YAAY,EAAE,YAAY,CAAC;IAC3B,SAAS,EAAE,eAAe,CAAC;CAC5B,wBAiBF;AAED,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,yBAAyB,EACjC,IAAI,EAAE;IACJ,YAAY,EAAE,qBAAqB,CAAC;IACpC,SAAS,EAAE,SAAS,CAAC;IACrB,WAAW,EAAE,aAAa,CAAC;IAC3B,mBAAmB,EAAE,mBAAmB,CAAC;IACzC,SAAS,EAAE,eAAe,CAAC;IAC3B,YAAY,EAAE,YAAY,CAAC;IAC3B,UAAU,EAAE,UAAU,CAAC;IACvB,eAAe,EAAE,eAAe,GAAG,SAAS,CAAC;CAC9C,+BAmBF"}
package/dest/factory.js CHANGED
@@ -1,4 +1,14 @@
1
+ import { BlockProposalValidator } from '@aztec/p2p';
2
+ import { BlockProposalHandler } from './block_proposal_handler.js';
3
+ import { ValidatorMetrics } from './metrics.js';
1
4
  import { ValidatorClient } from './validator.js';
5
+ export function createBlockProposalHandler(config, deps) {
6
+ const metrics = new ValidatorMetrics(deps.telemetry);
7
+ const blockProposalValidator = new BlockProposalValidator(deps.epochCache, {
8
+ txsPermitted: !config.disableTransactions
9
+ });
10
+ return new BlockProposalHandler(deps.blockBuilder, deps.blockSource, deps.l1ToL2MessageSource, deps.p2pClient.getTxProvider(), blockProposalValidator, config, metrics, deps.dateProvider, deps.telemetry);
11
+ }
2
12
  export function createValidatorClient(config, deps) {
3
13
  if (config.disableValidator || !deps.keyStoreManager) {
4
14
  return undefined;
package/dest/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ export * from './block_proposal_handler.js';
1
2
  export * from './config.js';
2
3
  export * from './factory.js';
3
4
  export * from './validator.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,sBAAsB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,6BAA6B,CAAC;AAC5C,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,sBAAsB,CAAC"}
package/dest/index.js CHANGED
@@ -1,3 +1,4 @@
1
+ export * from './block_proposal_handler.js';
1
2
  export * from './config.js';
2
3
  export * from './factory.js';
3
4
  export * from './validator.js';
@@ -1 +1 @@
1
- {"version":3,"file":"node_keystore_adapter.d.ts","sourceRoot":"","sources":["../../src/key_store/node_keystore_adapter.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAC3D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,EAAE,eAAe,EAAoB,MAAM,sBAAsB,CAAC;AACzE,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAClE,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAG3D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,MAAM,CAAC;AAGhD,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,gBAAgB,CAAC;AAahE,qBAAa,mBAAoB,YAAW,yBAAyB;IACnE,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAkB;IAGlD,OAAO,CAAC,QAAQ,CAAC,UAAU,CAA6C;IAExE,OAAO,CAAC,QAA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;;;;OAMG;IACH,qBAAqB,CAAC,eAAe,EAAE,UAAU,GAAG,qBAAqB,GAAG,SAAS;CAItF"}
@@ -1,5 +1,4 @@
1
1
  import { KeystoreManager, loadKeystoreFile } from '@aztec/node-keystore';
2
- import { AztecAddress } from '@aztec/stdlib/aztec-address';
3
2
  import { InvalidValidatorPrivateKeyError } from '@aztec/stdlib/validators';
4
3
  import { privateKeyToAccount } from 'viem/accounts';
5
4
  export class NodeKeystoreAdapter {
@@ -273,7 +272,7 @@ export class NodeKeystoreAdapter {
273
272
  * @returns Coinbase EthAddress
274
273
  */ getCoinbaseAddress(attesterAddress) {
275
274
  const validatorIndex = this.findValidatorIndexForAttester(attesterAddress);
276
- return this.keystoreManager.getCoinbaseAddress(validatorIndex);
275
+ return this.keystoreManager.getCoinbaseAddress(validatorIndex, attesterAddress);
277
276
  }
278
277
  /**
279
278
  * Get the publisher addresses for the validator that contains the given attester.
@@ -302,8 +301,7 @@ export class NodeKeystoreAdapter {
302
301
  * @returns Fee recipient as AztecAddress
303
302
  */ getFeeRecipient(attesterAddress) {
304
303
  const validatorIndex = this.findValidatorIndexForAttester(attesterAddress);
305
- const feeRecipientHex = this.keystoreManager.getFeeRecipient(validatorIndex);
306
- return AztecAddress.fromString(feeRecipientHex);
304
+ return this.keystoreManager.getFeeRecipient(validatorIndex);
307
305
  }
308
306
  /**
309
307
  * Get the effective remote signer configuration for the attester.