@aztec/validator-client 2.1.0-rc.2 → 2.1.0-rc.21
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/block_proposal_handler.d.ts +23 -18
- package/dest/block_proposal_handler.d.ts.map +1 -1
- package/dest/block_proposal_handler.js +89 -60
- package/dest/duties/validation_service.d.ts +1 -2
- package/dest/duties/validation_service.d.ts.map +1 -1
- package/dest/duties/validation_service.js +3 -5
- package/dest/factory.d.ts.map +1 -1
- package/dest/factory.js +3 -1
- package/dest/key_store/node_keystore_adapter.js +1 -1
- package/dest/metrics.d.ts.map +1 -1
- package/dest/metrics.js +2 -1
- package/dest/validator.d.ts +3 -4
- package/dest/validator.d.ts.map +1 -1
- package/dest/validator.js +37 -8
- package/package.json +12 -12
- package/src/block_proposal_handler.ts +116 -87
- package/src/duties/validation_service.ts +1 -5
- package/src/factory.ts +3 -1
- package/src/key_store/node_keystore_adapter.ts +1 -1
- package/src/metrics.ts +2 -1
- package/src/validator.ts +48 -17
|
@@ -3,24 +3,32 @@ import { DateProvider } from '@aztec/foundation/timer';
|
|
|
3
3
|
import type { P2P, PeerId } from '@aztec/p2p';
|
|
4
4
|
import { TxProvider } from '@aztec/p2p';
|
|
5
5
|
import { BlockProposalValidator } from '@aztec/p2p/msg_validators';
|
|
6
|
-
import type { L2BlockSource } from '@aztec/stdlib/block';
|
|
6
|
+
import type { L2Block, L2BlockSource } from '@aztec/stdlib/block';
|
|
7
7
|
import type { IFullNodeBlockBuilder, ValidatorClientFullConfig } from '@aztec/stdlib/interfaces/server';
|
|
8
8
|
import type { L1ToL2MessageSource } from '@aztec/stdlib/messaging';
|
|
9
9
|
import { type BlockProposal } from '@aztec/stdlib/p2p';
|
|
10
10
|
import { type FailedTx, type Tx } from '@aztec/stdlib/tx';
|
|
11
11
|
import { type TelemetryClient, type Tracer } from '@aztec/telemetry-client';
|
|
12
12
|
import type { ValidatorMetrics } from './metrics.js';
|
|
13
|
-
export type BlockProposalValidationFailureReason = 'invalid_proposal' | 'parent_block_not_found' | '
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
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;
|
|
24
32
|
export declare class BlockProposalHandler {
|
|
25
33
|
private blockBuilder;
|
|
26
34
|
private blockSource;
|
|
@@ -35,13 +43,10 @@ export declare class BlockProposalHandler {
|
|
|
35
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);
|
|
36
44
|
registerForReexecution(p2pClient: P2P): BlockProposalHandler;
|
|
37
45
|
handleBlockProposal(proposal: BlockProposal, proposalSender: PeerId, shouldReexecute: boolean): Promise<BlockProposalValidationResult>;
|
|
46
|
+
private getParentBlock;
|
|
38
47
|
private getReexecutionDeadline;
|
|
39
48
|
private getReexecuteFailureReason;
|
|
40
|
-
reexecuteTransactions(proposal: BlockProposal, txs: Tx[], l1ToL2Messages: Fr[]): Promise<
|
|
41
|
-
block: any;
|
|
42
|
-
failedTxs: FailedTx[];
|
|
43
|
-
reexecutionTimeMs: number;
|
|
44
|
-
totalManaUsed: number;
|
|
45
|
-
}>;
|
|
49
|
+
reexecuteTransactions(proposal: BlockProposal, blockNumber: number, txs: Tx[], l1ToL2Messages: Fr[]): Promise<ReexecuteTransactionsResult>;
|
|
46
50
|
}
|
|
51
|
+
export {};
|
|
47
52
|
//# sourceMappingURL=block_proposal_handler.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"block_proposal_handler.d.ts","sourceRoot":"","sources":["../src/block_proposal_handler.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"block_proposal_handler.d.ts","sourceRoot":"","sources":["../src/block_proposal_handler.ts"],"names":[],"mappings":"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"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { INITIAL_L2_BLOCK_NUM } from '@aztec/constants';
|
|
2
|
+
import { TimeoutError } from '@aztec/foundation/error';
|
|
2
3
|
import { Fr } from '@aztec/foundation/fields';
|
|
3
4
|
import { createLogger } from '@aztec/foundation/log';
|
|
4
5
|
import { retryUntil } from '@aztec/foundation/retry';
|
|
@@ -36,16 +37,16 @@ export class BlockProposalHandler {
|
|
|
36
37
|
const handler = async (proposal, proposalSender)=>{
|
|
37
38
|
try {
|
|
38
39
|
const result = await this.handleBlockProposal(proposal, proposalSender, true);
|
|
39
|
-
if (result.isValid
|
|
40
|
+
if (result.isValid) {
|
|
40
41
|
this.log.info(`Non-validator reexecution completed for slot ${proposal.slotNumber.toBigInt()}`, {
|
|
41
|
-
blockNumber:
|
|
42
|
-
reexecutionTimeMs: result.reexecutionResult
|
|
43
|
-
totalManaUsed: result.reexecutionResult
|
|
44
|
-
numTxs: result.reexecutionResult
|
|
42
|
+
blockNumber: result.blockNumber,
|
|
43
|
+
reexecutionTimeMs: result.reexecutionResult?.reexecutionTimeMs,
|
|
44
|
+
totalManaUsed: result.reexecutionResult?.totalManaUsed,
|
|
45
|
+
numTxs: result.reexecutionResult?.block?.body?.txEffects?.length ?? 0
|
|
45
46
|
});
|
|
46
47
|
} else {
|
|
47
48
|
this.log.warn(`Non-validator reexecution failed for slot ${proposal.slotNumber.toBigInt()}`, {
|
|
48
|
-
blockNumber:
|
|
49
|
+
blockNumber: result.blockNumber,
|
|
49
50
|
reason: result.reason
|
|
50
51
|
});
|
|
51
52
|
}
|
|
@@ -59,8 +60,16 @@ export class BlockProposalHandler {
|
|
|
59
60
|
}
|
|
60
61
|
async handleBlockProposal(proposal, proposalSender, shouldReexecute) {
|
|
61
62
|
const slotNumber = proposal.slotNumber.toBigInt();
|
|
62
|
-
const blockNumber = proposal.blockNumber;
|
|
63
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
|
+
}
|
|
64
73
|
const proposalInfo = {
|
|
65
74
|
...proposal.toBlockInfo(),
|
|
66
75
|
proposer: proposer.toString()
|
|
@@ -79,46 +88,45 @@ export class BlockProposalHandler {
|
|
|
79
88
|
reason: 'invalid_proposal'
|
|
80
89
|
};
|
|
81
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
|
+
}
|
|
82
124
|
// Collect txs from the proposal. We start doing this as early as possible,
|
|
83
|
-
// and we do it even if we don't plan to re-execute the txs, so that we have them
|
|
84
|
-
|
|
85
|
-
const config = this.blockBuilder.getConfig();
|
|
86
|
-
const { txs, missingTxs } = await this.txProvider.getTxsForBlockProposal(proposal, {
|
|
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, {
|
|
87
127
|
pinnedPeer: proposalSender,
|
|
88
|
-
deadline: this.getReexecutionDeadline(
|
|
128
|
+
deadline: this.getReexecutionDeadline(slotNumber, config)
|
|
89
129
|
});
|
|
90
|
-
// Check that the parent proposal is a block we know, otherwise reexecution would fail
|
|
91
|
-
if (blockNumber > INITIAL_L2_BLOCK_NUM) {
|
|
92
|
-
const deadline = this.getReexecutionDeadline(proposal, config);
|
|
93
|
-
const currentTime = this.dateProvider.now();
|
|
94
|
-
const timeoutDurationMs = deadline.getTime() - currentTime;
|
|
95
|
-
const parentBlock = timeoutDurationMs <= 0 ? undefined : await retryUntil(async ()=>{
|
|
96
|
-
const block = await this.blockSource.getBlock(blockNumber - 1);
|
|
97
|
-
if (block) {
|
|
98
|
-
return block;
|
|
99
|
-
}
|
|
100
|
-
await this.blockSource.syncImmediate();
|
|
101
|
-
return await this.blockSource.getBlock(blockNumber - 1);
|
|
102
|
-
}, 'Force Archiver Sync', timeoutDurationMs / 1000, 0.5);
|
|
103
|
-
if (parentBlock === undefined) {
|
|
104
|
-
this.log.warn(`Parent block for ${blockNumber} not found, skipping processing`, proposalInfo);
|
|
105
|
-
return {
|
|
106
|
-
isValid: false,
|
|
107
|
-
reason: 'parent_block_not_found'
|
|
108
|
-
};
|
|
109
|
-
}
|
|
110
|
-
if (!proposal.payload.header.lastArchiveRoot.equals(parentBlock.archive.root)) {
|
|
111
|
-
this.log.warn(`Parent block archive root for proposal does not match, skipping processing`, {
|
|
112
|
-
proposalLastArchiveRoot: proposal.payload.header.lastArchiveRoot.toString(),
|
|
113
|
-
parentBlockArchiveRoot: parentBlock.archive.root.toString(),
|
|
114
|
-
...proposalInfo
|
|
115
|
-
});
|
|
116
|
-
return {
|
|
117
|
-
isValid: false,
|
|
118
|
-
reason: 'parent_block_does_not_match'
|
|
119
|
-
};
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
130
|
// Check that I have the same set of l1ToL2Messages as the proposal
|
|
123
131
|
const l1ToL2Messages = await this.l1ToL2MessageSource.getL1ToL2Messages(blockNumber);
|
|
124
132
|
const computedInHash = await computeInHashFromL1ToL2Messages(l1ToL2Messages);
|
|
@@ -131,18 +139,10 @@ export class BlockProposalHandler {
|
|
|
131
139
|
});
|
|
132
140
|
return {
|
|
133
141
|
isValid: false,
|
|
142
|
+
blockNumber,
|
|
134
143
|
reason: 'in_hash_mismatch'
|
|
135
144
|
};
|
|
136
145
|
}
|
|
137
|
-
// Check that this block number does not exist already
|
|
138
|
-
const existingBlock = await this.blockSource.getBlockHeader(blockNumber);
|
|
139
|
-
if (existingBlock) {
|
|
140
|
-
this.log.warn(`Block number ${blockNumber} already exists, skipping processing`, proposalInfo);
|
|
141
|
-
return {
|
|
142
|
-
isValid: false,
|
|
143
|
-
reason: 'block_number_already_exists'
|
|
144
|
-
};
|
|
145
|
-
}
|
|
146
146
|
// Check that all of the transactions in the proposal are available
|
|
147
147
|
if (missingTxs.length > 0) {
|
|
148
148
|
this.log.warn(`Missing ${missingTxs.length} txs to process proposal`, {
|
|
@@ -151,6 +151,7 @@ export class BlockProposalHandler {
|
|
|
151
151
|
});
|
|
152
152
|
return {
|
|
153
153
|
isValid: false,
|
|
154
|
+
blockNumber,
|
|
154
155
|
reason: 'txs_not_available'
|
|
155
156
|
};
|
|
156
157
|
}
|
|
@@ -159,12 +160,13 @@ export class BlockProposalHandler {
|
|
|
159
160
|
if (shouldReexecute) {
|
|
160
161
|
try {
|
|
161
162
|
this.log.verbose(`Re-executing transactions in the proposal`, proposalInfo);
|
|
162
|
-
reexecutionResult = await this.reexecuteTransactions(proposal, txs, l1ToL2Messages);
|
|
163
|
+
reexecutionResult = await this.reexecuteTransactions(proposal, blockNumber, txs, l1ToL2Messages);
|
|
163
164
|
} catch (error) {
|
|
164
165
|
this.log.error(`Error reexecuting txs while processing block proposal`, error, proposalInfo);
|
|
165
166
|
const reason = this.getReexecuteFailureReason(error);
|
|
166
167
|
return {
|
|
167
168
|
isValid: false,
|
|
169
|
+
blockNumber,
|
|
168
170
|
reason,
|
|
169
171
|
reexecutionResult
|
|
170
172
|
};
|
|
@@ -173,11 +175,38 @@ export class BlockProposalHandler {
|
|
|
173
175
|
this.log.info(`Successfully processed proposal for slot ${slotNumber}`, proposalInfo);
|
|
174
176
|
return {
|
|
175
177
|
isValid: true,
|
|
178
|
+
blockNumber,
|
|
176
179
|
reexecutionResult
|
|
177
180
|
};
|
|
178
181
|
}
|
|
179
|
-
|
|
180
|
-
const
|
|
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));
|
|
181
210
|
const msNeededForPropagationAndPublishing = this.config.validatorReexecuteDeadlineMs;
|
|
182
211
|
return new Date(nextSlotTimestampSeconds * 1000 - msNeededForPropagationAndPublishing);
|
|
183
212
|
}
|
|
@@ -188,11 +217,11 @@ export class BlockProposalHandler {
|
|
|
188
217
|
return 'failed_txs';
|
|
189
218
|
} else if (err instanceof ReExTimeoutError) {
|
|
190
219
|
return 'timeout';
|
|
191
|
-
} else
|
|
220
|
+
} else {
|
|
192
221
|
return 'unknown_error';
|
|
193
222
|
}
|
|
194
223
|
}
|
|
195
|
-
async reexecuteTransactions(proposal, txs, l1ToL2Messages) {
|
|
224
|
+
async reexecuteTransactions(proposal, blockNumber, txs, l1ToL2Messages) {
|
|
196
225
|
const { header } = proposal.payload;
|
|
197
226
|
const { txHashes } = proposal;
|
|
198
227
|
// If we do not have all of the transactions, then we should fail
|
|
@@ -210,13 +239,13 @@ export class BlockProposalHandler {
|
|
|
210
239
|
coinbase: proposal.payload.header.coinbase,
|
|
211
240
|
feeRecipient: proposal.payload.header.feeRecipient,
|
|
212
241
|
gasFees: proposal.payload.header.gasFees,
|
|
213
|
-
blockNumber
|
|
242
|
+
blockNumber,
|
|
214
243
|
timestamp: header.timestamp,
|
|
215
244
|
chainId: new Fr(config.l1ChainId),
|
|
216
245
|
version: new Fr(config.rollupVersion)
|
|
217
246
|
});
|
|
218
247
|
const { block, failedTxs } = await this.blockBuilder.buildBlock(txs, l1ToL2Messages, globalVariables, {
|
|
219
|
-
deadline: this.getReexecutionDeadline(proposal, config)
|
|
248
|
+
deadline: this.getReexecutionDeadline(proposal.payload.header.slotNumber.toBigInt(), config)
|
|
220
249
|
});
|
|
221
250
|
const numFailedTxs = failedTxs.length;
|
|
222
251
|
const slot = proposal.slotNumber.toBigInt();
|
|
@@ -11,14 +11,13 @@ export declare class ValidationService {
|
|
|
11
11
|
/**
|
|
12
12
|
* Create a block proposal with the given header, archive, and transactions
|
|
13
13
|
*
|
|
14
|
-
* @param blockNumber - The block number this proposal is for
|
|
15
14
|
* @param header - The block header
|
|
16
15
|
* @param archive - The archive of the current block
|
|
17
16
|
* @param txs - TxHash[] ordered list of transactions
|
|
18
17
|
*
|
|
19
18
|
* @returns A block proposal signing the above information (not the current implementation!!!)
|
|
20
19
|
*/
|
|
21
|
-
createBlockProposal(
|
|
20
|
+
createBlockProposal(header: ProposedBlockHeader, archive: Fr, stateReference: StateReference, txs: Tx[], proposerAttesterAddress: EthAddress | undefined, options: BlockProposalOptions): Promise<BlockProposal>;
|
|
22
21
|
/**
|
|
23
22
|
* Attest with selection of validators to the given block proposal, constructed by the current sequencer
|
|
24
23
|
*
|
|
@@ -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;AAChE,OAAO,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AAC5D,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AACnD,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,qBAAqB,CAAC;AAC3E,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
|
|
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;AAChE,OAAO,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AAC5D,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AACnD,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,qBAAqB,CAAC;AAC3E,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;;;;;;;;OAQG;IACG,mBAAmB,CACvB,MAAM,EAAE,mBAAmB,EAC3B,OAAO,EAAE,EAAE,EACX,cAAc,EAAE,cAAc,EAC9B,GAAG,EAAE,EAAE,EAAE,EACT,uBAAuB,EAAE,UAAU,GAAG,SAAS,EAC/C,OAAO,EAAE,oBAAoB,GAC5B,OAAO,CAAC,aAAa,CAAC;IAoBzB;;;;;;;;;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,GAAG,SAAS,GAC/B,OAAO,CAAC,SAAS,CAAC;CAUtB"}
|
|
@@ -10,13 +10,12 @@ export class ValidationService {
|
|
|
10
10
|
/**
|
|
11
11
|
* Create a block proposal with the given header, archive, and transactions
|
|
12
12
|
*
|
|
13
|
-
* @param blockNumber - The block number this proposal is for
|
|
14
13
|
* @param header - The block header
|
|
15
14
|
* @param archive - The archive of the current block
|
|
16
15
|
* @param txs - TxHash[] ordered list of transactions
|
|
17
16
|
*
|
|
18
17
|
* @returns A block proposal signing the above information (not the current implementation!!!)
|
|
19
|
-
*/ async createBlockProposal(
|
|
18
|
+
*/ async createBlockProposal(header, archive, stateReference, txs, proposerAttesterAddress, options) {
|
|
20
19
|
let payloadSigner;
|
|
21
20
|
if (proposerAttesterAddress !== undefined) {
|
|
22
21
|
payloadSigner = (payload)=>this.keyStore.signMessageWithAddress(proposerAttesterAddress, payload);
|
|
@@ -27,7 +26,7 @@ export class ValidationService {
|
|
|
27
26
|
}
|
|
28
27
|
// TODO: check if this is calculated earlier / can not be recomputed
|
|
29
28
|
const txHashes = await Promise.all(txs.map((tx)=>tx.getTxHash()));
|
|
30
|
-
return BlockProposal.createProposalFromSigner(
|
|
29
|
+
return BlockProposal.createProposalFromSigner(new ConsensusPayload(header, archive, stateReference), txHashes, options.publishFullTxs ? txs : undefined, payloadSigner);
|
|
31
30
|
}
|
|
32
31
|
/**
|
|
33
32
|
* Attest with selection of validators to the given block proposal, constructed by the current sequencer
|
|
@@ -41,8 +40,7 @@ export class ValidationService {
|
|
|
41
40
|
*/ async attestToProposal(proposal, attestors) {
|
|
42
41
|
const buf = Buffer32.fromBuffer(keccak256(proposal.payload.getPayloadToSign(SignatureDomainSeparator.blockAttestation)));
|
|
43
42
|
const signatures = await Promise.all(attestors.map((attestor)=>this.keyStore.signMessageWithAddress(attestor, buf)));
|
|
44
|
-
|
|
45
|
-
return signatures.map((sig)=>new BlockAttestation(proposal.blockNumber, proposal.payload, sig));
|
|
43
|
+
return signatures.map((sig)=>new BlockAttestation(proposal.payload, sig, proposal.signature));
|
|
46
44
|
}
|
|
47
45
|
async signAttestationsAndSigners(attestationsAndSigners, proposer) {
|
|
48
46
|
if (proposer === undefined) {
|
package/dest/factory.d.ts.map
CHANGED
|
@@ -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,EAA0B,KAAK,SAAS,EAAE,MAAM,YAAY,CAAC;AACpE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,KAAK,EAAE,qBAAqB,EAAE,yBAAyB,EAAE,MAAM,iCAAiC,CAAC;AACxG,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AACnE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAE/D,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AAEnE,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAEjD,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,
|
|
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,EAA0B,KAAK,SAAS,EAAE,MAAM,YAAY,CAAC;AACpE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,KAAK,EAAE,qBAAqB,EAAE,yBAAyB,EAAE,MAAM,iCAAiC,CAAC;AACxG,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AACnE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAE/D,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AAEnE,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAEjD,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
|
@@ -4,7 +4,9 @@ import { ValidatorMetrics } from './metrics.js';
|
|
|
4
4
|
import { ValidatorClient } from './validator.js';
|
|
5
5
|
export function createBlockProposalHandler(config, deps) {
|
|
6
6
|
const metrics = new ValidatorMetrics(deps.telemetry);
|
|
7
|
-
const blockProposalValidator = new BlockProposalValidator(deps.epochCache
|
|
7
|
+
const blockProposalValidator = new BlockProposalValidator(deps.epochCache, {
|
|
8
|
+
txsPermitted: !config.disableTransactions
|
|
9
|
+
});
|
|
8
10
|
return new BlockProposalHandler(deps.blockBuilder, deps.blockSource, deps.l1ToL2MessageSource, deps.p2pClient.getTxProvider(), blockProposalValidator, config, metrics, deps.dateProvider, deps.telemetry);
|
|
9
11
|
}
|
|
10
12
|
export function createValidatorClient(config, deps) {
|
|
@@ -272,7 +272,7 @@ export class NodeKeystoreAdapter {
|
|
|
272
272
|
* @returns Coinbase EthAddress
|
|
273
273
|
*/ getCoinbaseAddress(attesterAddress) {
|
|
274
274
|
const validatorIndex = this.findValidatorIndexForAttester(attesterAddress);
|
|
275
|
-
return this.keystoreManager.getCoinbaseAddress(validatorIndex);
|
|
275
|
+
return this.keystoreManager.getCoinbaseAddress(validatorIndex, attesterAddress);
|
|
276
276
|
}
|
|
277
277
|
/**
|
|
278
278
|
* Get the publisher addresses for the validator that contains the given attester.
|
package/dest/metrics.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"metrics.d.ts","sourceRoot":"","sources":["../src/metrics.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,EAIL,KAAK,eAAe,EAGrB,MAAM,yBAAyB,CAAC;AAEjC,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,wBAAwB,CAAgB;IAChD,OAAO,CAAC,iBAAiB,CAAgB;IACzC,OAAO,CAAC,uBAAuB,CAAgB;IAE/C,OAAO,CAAC,QAAQ,CAAY;IAC5B,OAAO,CAAC,MAAM,CAAY;IAC1B,OAAO,CAAC,YAAY,CAAY;gBAEpB,eAAe,EAAE,eAAe;IAsCrC,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM;IAMxD,uBAAuB,CAAC,QAAQ,EAAE,aAAa;
|
|
1
|
+
{"version":3,"file":"metrics.d.ts","sourceRoot":"","sources":["../src/metrics.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,EAIL,KAAK,eAAe,EAGrB,MAAM,yBAAyB,CAAC;AAEjC,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,wBAAwB,CAAgB;IAChD,OAAO,CAAC,iBAAiB,CAAgB;IACzC,OAAO,CAAC,uBAAuB,CAAgB;IAE/C,OAAO,CAAC,QAAQ,CAAY;IAC5B,OAAO,CAAC,MAAM,CAAY;IAC1B,OAAO,CAAC,YAAY,CAAY;gBAEpB,eAAe,EAAE,eAAe;IAsCrC,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM;IAMxD,uBAAuB,CAAC,QAAQ,EAAE,aAAa;IAQ/C,eAAe,CAAC,GAAG,EAAE,MAAM;IAI3B,qBAAqB,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,OAAO;CAM/E"}
|
package/dest/metrics.js
CHANGED
|
@@ -43,9 +43,10 @@ export class ValidatorMetrics {
|
|
|
43
43
|
this.reexMana.record(mManaTotal);
|
|
44
44
|
}
|
|
45
45
|
recordFailedReexecution(proposal) {
|
|
46
|
+
const proposer = proposal.getSender();
|
|
46
47
|
this.failedReexecutionCounter.add(1, {
|
|
47
48
|
[Attributes.STATUS]: 'failed',
|
|
48
|
-
[Attributes.BLOCK_PROPOSER]:
|
|
49
|
+
[Attributes.BLOCK_PROPOSER]: proposer?.toString() ?? 'unknown'
|
|
49
50
|
});
|
|
50
51
|
}
|
|
51
52
|
incAttestations(num) {
|
package/dest/validator.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ import { Fr } from '@aztec/foundation/fields';
|
|
|
5
5
|
import { DateProvider } from '@aztec/foundation/timer';
|
|
6
6
|
import type { KeystoreManager } from '@aztec/node-keystore';
|
|
7
7
|
import type { P2P, PeerId, TxProvider } from '@aztec/p2p';
|
|
8
|
-
import { type
|
|
8
|
+
import { type Watcher, type WatcherEmitter } from '@aztec/slasher';
|
|
9
9
|
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
10
10
|
import type { CommitteeAttestationsAndSigners, L2BlockSource } from '@aztec/stdlib/block';
|
|
11
11
|
import type { IFullNodeBlockBuilder, Validator, ValidatorClientFullConfig } from '@aztec/stdlib/interfaces/server';
|
|
@@ -15,7 +15,6 @@ import type { ProposedBlockHeader, StateReference, Tx } from '@aztec/stdlib/tx';
|
|
|
15
15
|
import { type TelemetryClient, type Tracer } from '@aztec/telemetry-client';
|
|
16
16
|
import type { TypedDataDefinition } from 'viem';
|
|
17
17
|
import { BlockProposalHandler } from './block_proposal_handler.js';
|
|
18
|
-
import type { ValidatorClientConfig } from './config.js';
|
|
19
18
|
import { NodeKeystoreAdapter } from './key_store/node_keystore_adapter.js';
|
|
20
19
|
declare const ValidatorClient_base: new () => WatcherEmitter;
|
|
21
20
|
/**
|
|
@@ -40,10 +39,10 @@ export declare class ValidatorClient extends ValidatorClient_base implements Val
|
|
|
40
39
|
protected constructor(keyStore: NodeKeystoreAdapter, epochCache: EpochCache, p2pClient: P2P, blockProposalHandler: BlockProposalHandler, config: ValidatorClientFullConfig, dateProvider?: DateProvider, telemetry?: TelemetryClient, log?: import("@aztec/foundation/log").Logger);
|
|
41
40
|
static validateKeyStoreConfiguration(keyStoreManager: KeystoreManager): void;
|
|
42
41
|
private handleEpochCommitteeUpdate;
|
|
43
|
-
static new(config:
|
|
42
|
+
static new(config: ValidatorClientFullConfig, blockBuilder: IFullNodeBlockBuilder, epochCache: EpochCache, p2pClient: P2P, blockSource: L2BlockSource, l1ToL2MessageSource: L1ToL2MessageSource, txProvider: TxProvider, keyStoreManager: KeystoreManager, dateProvider?: DateProvider, telemetry?: TelemetryClient): ValidatorClient;
|
|
44
43
|
getValidatorAddresses(): EthAddress[];
|
|
45
44
|
getBlockProposalHandler(): BlockProposalHandler;
|
|
46
|
-
reExecuteTransactions(proposal: BlockProposal, txs: any[], l1ToL2Messages: Fr[]): Promise<any>;
|
|
45
|
+
reExecuteTransactions(proposal: BlockProposal, blockNumber: number, txs: any[], l1ToL2Messages: Fr[]): Promise<any>;
|
|
47
46
|
signWithAddress(addr: EthAddress, msg: TypedDataDefinition): Promise<Signature>;
|
|
48
47
|
getCoinbaseForAttestor(attestor: EthAddress): EthAddress;
|
|
49
48
|
getFeeRecipientForAttestor(attestor: EthAddress): AztecAddress;
|
package/dest/validator.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validator.d.ts","sourceRoot":"","sources":["../src/validator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAI9C,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAE1D,OAAO,
|
|
1
|
+
{"version":3,"file":"validator.d.ts","sourceRoot":"","sources":["../src/validator.ts"],"names":[],"mappings":"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"}
|
package/dest/validator.js
CHANGED
|
@@ -91,7 +91,9 @@ const SLASHABLE_BLOCK_PROPOSAL_VALIDATION_RESULT = [
|
|
|
91
91
|
}
|
|
92
92
|
static new(config, blockBuilder, epochCache, p2pClient, blockSource, l1ToL2MessageSource, txProvider, keyStoreManager, dateProvider = new DateProvider(), telemetry = getTelemetryClient()) {
|
|
93
93
|
const metrics = new ValidatorMetrics(telemetry);
|
|
94
|
-
const blockProposalValidator = new BlockProposalValidator(epochCache
|
|
94
|
+
const blockProposalValidator = new BlockProposalValidator(epochCache, {
|
|
95
|
+
txsPermitted: !config.disableTransactions
|
|
96
|
+
});
|
|
95
97
|
const blockProposalHandler = new BlockProposalHandler(blockBuilder, blockSource, l1ToL2MessageSource, txProvider, blockProposalValidator, config, metrics, dateProvider, telemetry);
|
|
96
98
|
const validator = new ValidatorClient(NodeKeystoreAdapter.fromKeyStoreManager(keyStoreManager), epochCache, p2pClient, blockProposalHandler, config, dateProvider, telemetry);
|
|
97
99
|
return validator;
|
|
@@ -103,8 +105,8 @@ const SLASHABLE_BLOCK_PROPOSAL_VALIDATION_RESULT = [
|
|
|
103
105
|
return this.blockProposalHandler;
|
|
104
106
|
}
|
|
105
107
|
// Proxy method for backwards compatibility with tests
|
|
106
|
-
reExecuteTransactions(proposal, txs, l1ToL2Messages) {
|
|
107
|
-
return this.blockProposalHandler.reexecuteTransactions(proposal, txs, l1ToL2Messages);
|
|
108
|
+
reExecuteTransactions(proposal, blockNumber, txs, l1ToL2Messages) {
|
|
109
|
+
return this.blockProposalHandler.reexecuteTransactions(proposal, blockNumber, txs, l1ToL2Messages);
|
|
108
110
|
}
|
|
109
111
|
signWithAddress(addr, msg) {
|
|
110
112
|
return this.keyStore.signTypedDataWithAddress(addr, msg);
|
|
@@ -157,6 +159,11 @@ const SLASHABLE_BLOCK_PROPOSAL_VALIDATION_RESULT = [
|
|
|
157
159
|
async attestToProposal(proposal, proposalSender) {
|
|
158
160
|
const slotNumber = proposal.slotNumber.toBigInt();
|
|
159
161
|
const proposer = proposal.getSender();
|
|
162
|
+
// Reject proposals with invalid signatures
|
|
163
|
+
if (!proposer) {
|
|
164
|
+
this.log.warn(`Received proposal with invalid signature for slot ${slotNumber}`);
|
|
165
|
+
return undefined;
|
|
166
|
+
}
|
|
160
167
|
// Check that I have any address in current committee before attesting
|
|
161
168
|
const inCommittee = await this.epochCache.filterInCommittee(slotNumber, this.getValidatorAddresses());
|
|
162
169
|
const partOfCommittee = inCommittee.length > 0;
|
|
@@ -165,7 +172,7 @@ const SLASHABLE_BLOCK_PROPOSAL_VALIDATION_RESULT = [
|
|
|
165
172
|
...proposal.toBlockInfo(),
|
|
166
173
|
proposer: proposer.toString()
|
|
167
174
|
};
|
|
168
|
-
this.log.info(`Received proposal for
|
|
175
|
+
this.log.info(`Received proposal for slot ${slotNumber}`, {
|
|
169
176
|
...proposalInfo,
|
|
170
177
|
txHashes: proposal.txHashes.map((t)=>t.toString())
|
|
171
178
|
});
|
|
@@ -190,13 +197,18 @@ const SLASHABLE_BLOCK_PROPOSAL_VALIDATION_RESULT = [
|
|
|
190
197
|
return undefined;
|
|
191
198
|
}
|
|
192
199
|
// Provided all of the above checks pass, we can attest to the proposal
|
|
193
|
-
this.log.info(`Attesting to proposal for block
|
|
200
|
+
this.log.info(`Attesting to proposal for block at slot ${slotNumber}`, proposalInfo);
|
|
194
201
|
this.metrics.incAttestations(inCommittee.length);
|
|
195
202
|
// If the above function does not throw an error, then we can attest to the proposal
|
|
196
203
|
return this.createBlockAttestationsFromProposal(proposal, inCommittee);
|
|
197
204
|
}
|
|
198
205
|
slashInvalidBlock(proposal) {
|
|
199
206
|
const proposer = proposal.getSender();
|
|
207
|
+
// Skip if signature is invalid (shouldn't happen since we validate earlier)
|
|
208
|
+
if (!proposer) {
|
|
209
|
+
this.log.warn(`Cannot slash proposal with invalid signature`);
|
|
210
|
+
return;
|
|
211
|
+
}
|
|
200
212
|
// Trim the set if it's too big.
|
|
201
213
|
if (this.proposersOfInvalidBlocks.size > MAX_PROPOSERS_OF_INVALID_BLOCKS) {
|
|
202
214
|
// remove oldest proposer. `values` is guaranteed to be in insertion order.
|
|
@@ -217,7 +229,7 @@ const SLASHABLE_BLOCK_PROPOSAL_VALIDATION_RESULT = [
|
|
|
217
229
|
this.log.verbose(`Already made a proposal for the same slot, skipping proposal`);
|
|
218
230
|
return Promise.resolve(undefined);
|
|
219
231
|
}
|
|
220
|
-
const newProposal = await this.validationService.createBlockProposal(
|
|
232
|
+
const newProposal = await this.validationService.createBlockProposal(header, archive, stateReference, txs, proposerAddress, options);
|
|
221
233
|
this.previousProposal = newProposal;
|
|
222
234
|
return newProposal;
|
|
223
235
|
}
|
|
@@ -248,11 +260,28 @@ const SLASHABLE_BLOCK_PROPOSAL_VALIDATION_RESULT = [
|
|
|
248
260
|
const myAddresses = this.getValidatorAddresses();
|
|
249
261
|
let attestations = [];
|
|
250
262
|
while(true){
|
|
251
|
-
|
|
263
|
+
// Filter out attestations with a mismatching payload. This should NOT happen since we have verified
|
|
264
|
+
// the proposer signature (ie our own) before accepting the attestation into the pool via the p2p client.
|
|
265
|
+
const collectedAttestations = (await this.p2pClient.getAttestationsForSlot(slot, proposalId)).filter((attestation)=>{
|
|
266
|
+
if (!attestation.payload.equals(proposal.payload)) {
|
|
267
|
+
this.log.warn(`Received attestation for slot ${slot} with mismatched payload from ${attestation.getSender()?.toString()}`, {
|
|
268
|
+
attestationPayload: attestation.payload,
|
|
269
|
+
proposalPayload: proposal.payload
|
|
270
|
+
});
|
|
271
|
+
return false;
|
|
272
|
+
}
|
|
273
|
+
return true;
|
|
274
|
+
});
|
|
275
|
+
// Log new attestations we collected
|
|
252
276
|
const oldSenders = attestations.map((attestation)=>attestation.getSender());
|
|
253
277
|
for (const collected of collectedAttestations){
|
|
254
278
|
const collectedSender = collected.getSender();
|
|
255
|
-
|
|
279
|
+
// Skip attestations with invalid signatures
|
|
280
|
+
if (!collectedSender) {
|
|
281
|
+
this.log.warn(`Skipping attestation with invalid signature for slot ${slot}`);
|
|
282
|
+
continue;
|
|
283
|
+
}
|
|
284
|
+
if (!myAddresses.some((address)=>address.equals(collectedSender)) && !oldSenders.some((sender)=>sender?.equals(collectedSender))) {
|
|
256
285
|
this.log.debug(`Received attestation for slot ${slot} from ${collectedSender.toString()}`);
|
|
257
286
|
}
|
|
258
287
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/validator-client",
|
|
3
|
-
"version": "2.1.0-rc.
|
|
3
|
+
"version": "2.1.0-rc.21",
|
|
4
4
|
"main": "dest/index.js",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -64,20 +64,20 @@
|
|
|
64
64
|
]
|
|
65
65
|
},
|
|
66
66
|
"dependencies": {
|
|
67
|
-
"@aztec/constants": "2.1.0-rc.
|
|
68
|
-
"@aztec/epoch-cache": "2.1.0-rc.
|
|
69
|
-
"@aztec/ethereum": "2.1.0-rc.
|
|
70
|
-
"@aztec/foundation": "2.1.0-rc.
|
|
71
|
-
"@aztec/node-keystore": "2.1.0-rc.
|
|
72
|
-
"@aztec/p2p": "2.1.0-rc.
|
|
73
|
-
"@aztec/prover-client": "2.1.0-rc.
|
|
74
|
-
"@aztec/slasher": "2.1.0-rc.
|
|
75
|
-
"@aztec/stdlib": "2.1.0-rc.
|
|
76
|
-
"@aztec/telemetry-client": "2.1.0-rc.
|
|
67
|
+
"@aztec/constants": "2.1.0-rc.21",
|
|
68
|
+
"@aztec/epoch-cache": "2.1.0-rc.21",
|
|
69
|
+
"@aztec/ethereum": "2.1.0-rc.21",
|
|
70
|
+
"@aztec/foundation": "2.1.0-rc.21",
|
|
71
|
+
"@aztec/node-keystore": "2.1.0-rc.21",
|
|
72
|
+
"@aztec/p2p": "2.1.0-rc.21",
|
|
73
|
+
"@aztec/prover-client": "2.1.0-rc.21",
|
|
74
|
+
"@aztec/slasher": "2.1.0-rc.21",
|
|
75
|
+
"@aztec/stdlib": "2.1.0-rc.21",
|
|
76
|
+
"@aztec/telemetry-client": "2.1.0-rc.21",
|
|
77
77
|
"koa": "^2.16.1",
|
|
78
78
|
"koa-router": "^13.1.1",
|
|
79
79
|
"tslib": "^2.4.0",
|
|
80
|
-
"viem": "2.
|
|
80
|
+
"viem": "npm:@spalladino/viem@2.38.2-eip7594.0"
|
|
81
81
|
},
|
|
82
82
|
"devDependencies": {
|
|
83
83
|
"@jest/globals": "^30.0.0",
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { INITIAL_L2_BLOCK_NUM } from '@aztec/constants';
|
|
2
|
+
import { TimeoutError } from '@aztec/foundation/error';
|
|
2
3
|
import { Fr } from '@aztec/foundation/fields';
|
|
3
4
|
import { createLogger } from '@aztec/foundation/log';
|
|
4
5
|
import { retryUntil } from '@aztec/foundation/retry';
|
|
@@ -7,12 +8,12 @@ import type { P2P, PeerId } from '@aztec/p2p';
|
|
|
7
8
|
import { TxProvider } from '@aztec/p2p';
|
|
8
9
|
import { BlockProposalValidator } from '@aztec/p2p/msg_validators';
|
|
9
10
|
import { computeInHashFromL1ToL2Messages } from '@aztec/prover-client/helpers';
|
|
10
|
-
import type { L2BlockSource } from '@aztec/stdlib/block';
|
|
11
|
+
import type { L2Block, L2BlockSource } from '@aztec/stdlib/block';
|
|
11
12
|
import { getTimestampForSlot } from '@aztec/stdlib/epoch-helpers';
|
|
12
13
|
import type { IFullNodeBlockBuilder, ValidatorClientFullConfig } from '@aztec/stdlib/interfaces/server';
|
|
13
14
|
import type { L1ToL2MessageSource } from '@aztec/stdlib/messaging';
|
|
14
15
|
import { type BlockProposal, ConsensusPayload } from '@aztec/stdlib/p2p';
|
|
15
|
-
import { type FailedTx, GlobalVariables, type Tx } from '@aztec/stdlib/tx';
|
|
16
|
+
import { BlockHeader, type FailedTx, GlobalVariables, type Tx } from '@aztec/stdlib/tx';
|
|
16
17
|
import {
|
|
17
18
|
ReExFailedTxsError,
|
|
18
19
|
ReExStateMismatchError,
|
|
@@ -26,7 +27,7 @@ import type { ValidatorMetrics } from './metrics.js';
|
|
|
26
27
|
export type BlockProposalValidationFailureReason =
|
|
27
28
|
| 'invalid_proposal'
|
|
28
29
|
| 'parent_block_not_found'
|
|
29
|
-
| '
|
|
30
|
+
| 'parent_block_wrong_slot'
|
|
30
31
|
| 'in_hash_mismatch'
|
|
31
32
|
| 'block_number_already_exists'
|
|
32
33
|
| 'txs_not_available'
|
|
@@ -35,16 +36,27 @@ export type BlockProposalValidationFailureReason =
|
|
|
35
36
|
| 'timeout'
|
|
36
37
|
| 'unknown_error';
|
|
37
38
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
39
|
+
type ReexecuteTransactionsResult = {
|
|
40
|
+
block: L2Block;
|
|
41
|
+
failedTxs: FailedTx[];
|
|
42
|
+
reexecutionTimeMs: number;
|
|
43
|
+
totalManaUsed: number;
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
export type BlockProposalValidationSuccessResult = {
|
|
47
|
+
isValid: true;
|
|
48
|
+
blockNumber: number;
|
|
49
|
+
reexecutionResult?: ReexecuteTransactionsResult;
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
export type BlockProposalValidationFailureResult = {
|
|
53
|
+
isValid: false;
|
|
54
|
+
reason: BlockProposalValidationFailureReason;
|
|
55
|
+
blockNumber?: number;
|
|
56
|
+
reexecutionResult?: ReexecuteTransactionsResult;
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
export type BlockProposalValidationResult = BlockProposalValidationSuccessResult | BlockProposalValidationFailureResult;
|
|
48
60
|
|
|
49
61
|
export class BlockProposalHandler {
|
|
50
62
|
public readonly tracer: Tracer;
|
|
@@ -68,16 +80,16 @@ export class BlockProposalHandler {
|
|
|
68
80
|
const handler = async (proposal: BlockProposal, proposalSender: PeerId) => {
|
|
69
81
|
try {
|
|
70
82
|
const result = await this.handleBlockProposal(proposal, proposalSender, true);
|
|
71
|
-
if (result.isValid
|
|
83
|
+
if (result.isValid) {
|
|
72
84
|
this.log.info(`Non-validator reexecution completed for slot ${proposal.slotNumber.toBigInt()}`, {
|
|
73
|
-
blockNumber:
|
|
74
|
-
reexecutionTimeMs: result.reexecutionResult
|
|
75
|
-
totalManaUsed: result.reexecutionResult
|
|
76
|
-
numTxs: result.reexecutionResult
|
|
85
|
+
blockNumber: result.blockNumber,
|
|
86
|
+
reexecutionTimeMs: result.reexecutionResult?.reexecutionTimeMs,
|
|
87
|
+
totalManaUsed: result.reexecutionResult?.totalManaUsed,
|
|
88
|
+
numTxs: result.reexecutionResult?.block?.body?.txEffects?.length ?? 0,
|
|
77
89
|
});
|
|
78
90
|
} else {
|
|
79
91
|
this.log.warn(`Non-validator reexecution failed for slot ${proposal.slotNumber.toBigInt()}`, {
|
|
80
|
-
blockNumber:
|
|
92
|
+
blockNumber: result.blockNumber,
|
|
81
93
|
reason: result.reason,
|
|
82
94
|
});
|
|
83
95
|
}
|
|
@@ -97,8 +109,14 @@ export class BlockProposalHandler {
|
|
|
97
109
|
shouldReexecute: boolean,
|
|
98
110
|
): Promise<BlockProposalValidationResult> {
|
|
99
111
|
const slotNumber = proposal.slotNumber.toBigInt();
|
|
100
|
-
const blockNumber = proposal.blockNumber;
|
|
101
112
|
const proposer = proposal.getSender();
|
|
113
|
+
const config = this.blockBuilder.getConfig();
|
|
114
|
+
|
|
115
|
+
// Reject proposals with invalid signatures
|
|
116
|
+
if (!proposer) {
|
|
117
|
+
this.log.warn(`Received proposal with invalid signature for slot ${slotNumber}`);
|
|
118
|
+
return { isValid: false, reason: 'invalid_proposal' };
|
|
119
|
+
}
|
|
102
120
|
|
|
103
121
|
const proposalInfo = { ...proposal.toBlockInfo(), proposer: proposer.toString() };
|
|
104
122
|
this.log.info(`Processing proposal for slot ${slotNumber}`, {
|
|
@@ -114,52 +132,40 @@ export class BlockProposalHandler {
|
|
|
114
132
|
return { isValid: false, reason: 'invalid_proposal' };
|
|
115
133
|
}
|
|
116
134
|
|
|
117
|
-
// Collect txs from the proposal. We start doing this as early as possible,
|
|
118
|
-
// and we do it even if we don't plan to re-execute the txs, so that we have them
|
|
119
|
-
// if another node needs them.
|
|
120
|
-
const config = this.blockBuilder.getConfig();
|
|
121
|
-
const { txs, missingTxs } = await this.txProvider.getTxsForBlockProposal(proposal, {
|
|
122
|
-
pinnedPeer: proposalSender,
|
|
123
|
-
deadline: this.getReexecutionDeadline(proposal, config),
|
|
124
|
-
});
|
|
125
|
-
|
|
126
135
|
// Check that the parent proposal is a block we know, otherwise reexecution would fail
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
timeoutDurationMs <= 0
|
|
133
|
-
? undefined
|
|
134
|
-
: await retryUntil(
|
|
135
|
-
async () => {
|
|
136
|
-
const block = await this.blockSource.getBlock(blockNumber - 1);
|
|
137
|
-
if (block) {
|
|
138
|
-
return block;
|
|
139
|
-
}
|
|
140
|
-
await this.blockSource.syncImmediate();
|
|
141
|
-
return await this.blockSource.getBlock(blockNumber - 1);
|
|
142
|
-
},
|
|
143
|
-
'Force Archiver Sync',
|
|
144
|
-
timeoutDurationMs / 1000,
|
|
145
|
-
0.5,
|
|
146
|
-
);
|
|
136
|
+
const parentBlockHeader = await this.getParentBlock(proposal);
|
|
137
|
+
if (parentBlockHeader === undefined) {
|
|
138
|
+
this.log.warn(`Parent block for proposal not found, skipping processing`, proposalInfo);
|
|
139
|
+
return { isValid: false, reason: 'parent_block_not_found' };
|
|
140
|
+
}
|
|
147
141
|
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
142
|
+
// Check that the parent block's slot is less than the proposal's slot (should not happen, but we check anyway)
|
|
143
|
+
if (parentBlockHeader !== 'genesis' && parentBlockHeader.getSlot() >= slotNumber) {
|
|
144
|
+
this.log.warn(`Parent block slot is greater than or equal to proposal slot, skipping processing`, {
|
|
145
|
+
parentBlockSlot: parentBlockHeader.getSlot().toString(),
|
|
146
|
+
proposalSlot: slotNumber.toString(),
|
|
147
|
+
...proposalInfo,
|
|
148
|
+
});
|
|
149
|
+
return { isValid: false, reason: 'parent_block_wrong_slot' };
|
|
150
|
+
}
|
|
152
151
|
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
}
|
|
152
|
+
// Compute the block number based on the parent block
|
|
153
|
+
const blockNumber = parentBlockHeader === 'genesis' ? INITIAL_L2_BLOCK_NUM : parentBlockHeader.getBlockNumber() + 1;
|
|
154
|
+
|
|
155
|
+
// Check that this block number does not exist already
|
|
156
|
+
const existingBlock = await this.blockSource.getBlockHeader(blockNumber);
|
|
157
|
+
if (existingBlock) {
|
|
158
|
+
this.log.warn(`Block number ${blockNumber} already exists, skipping processing`, proposalInfo);
|
|
159
|
+
return { isValid: false, blockNumber, reason: 'block_number_already_exists' };
|
|
161
160
|
}
|
|
162
161
|
|
|
162
|
+
// Collect txs from the proposal. We start doing this as early as possible,
|
|
163
|
+
// 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.
|
|
164
|
+
const { txs, missingTxs } = await this.txProvider.getTxsForBlockProposal(proposal, blockNumber, {
|
|
165
|
+
pinnedPeer: proposalSender,
|
|
166
|
+
deadline: this.getReexecutionDeadline(slotNumber, config),
|
|
167
|
+
});
|
|
168
|
+
|
|
163
169
|
// Check that I have the same set of l1ToL2Messages as the proposal
|
|
164
170
|
const l1ToL2Messages = await this.l1ToL2MessageSource.getL1ToL2Messages(blockNumber);
|
|
165
171
|
const computedInHash = await computeInHashFromL1ToL2Messages(l1ToL2Messages);
|
|
@@ -170,20 +176,13 @@ export class BlockProposalHandler {
|
|
|
170
176
|
computedInHash: computedInHash.toString(),
|
|
171
177
|
...proposalInfo,
|
|
172
178
|
});
|
|
173
|
-
return { isValid: false, reason: 'in_hash_mismatch' };
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
// Check that this block number does not exist already
|
|
177
|
-
const existingBlock = await this.blockSource.getBlockHeader(blockNumber);
|
|
178
|
-
if (existingBlock) {
|
|
179
|
-
this.log.warn(`Block number ${blockNumber} already exists, skipping processing`, proposalInfo);
|
|
180
|
-
return { isValid: false, reason: 'block_number_already_exists' };
|
|
179
|
+
return { isValid: false, blockNumber, reason: 'in_hash_mismatch' };
|
|
181
180
|
}
|
|
182
181
|
|
|
183
182
|
// Check that all of the transactions in the proposal are available
|
|
184
183
|
if (missingTxs.length > 0) {
|
|
185
184
|
this.log.warn(`Missing ${missingTxs.length} txs to process proposal`, { ...proposalInfo, missingTxs });
|
|
186
|
-
return { isValid: false, reason: 'txs_not_available' };
|
|
185
|
+
return { isValid: false, blockNumber, reason: 'txs_not_available' };
|
|
187
186
|
}
|
|
188
187
|
|
|
189
188
|
// Try re-executing the transactions in the proposal if needed
|
|
@@ -191,23 +190,57 @@ export class BlockProposalHandler {
|
|
|
191
190
|
if (shouldReexecute) {
|
|
192
191
|
try {
|
|
193
192
|
this.log.verbose(`Re-executing transactions in the proposal`, proposalInfo);
|
|
194
|
-
reexecutionResult = await this.reexecuteTransactions(proposal, txs, l1ToL2Messages);
|
|
193
|
+
reexecutionResult = await this.reexecuteTransactions(proposal, blockNumber, txs, l1ToL2Messages);
|
|
195
194
|
} catch (error) {
|
|
196
195
|
this.log.error(`Error reexecuting txs while processing block proposal`, error, proposalInfo);
|
|
197
196
|
const reason = this.getReexecuteFailureReason(error);
|
|
198
|
-
return { isValid: false, reason, reexecutionResult };
|
|
197
|
+
return { isValid: false, blockNumber, reason, reexecutionResult };
|
|
199
198
|
}
|
|
200
199
|
}
|
|
201
200
|
|
|
202
201
|
this.log.info(`Successfully processed proposal for slot ${slotNumber}`, proposalInfo);
|
|
203
|
-
return { isValid: true, reexecutionResult };
|
|
202
|
+
return { isValid: true, blockNumber, reexecutionResult };
|
|
204
203
|
}
|
|
205
204
|
|
|
206
|
-
private
|
|
207
|
-
proposal
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
const
|
|
205
|
+
private async getParentBlock(proposal: BlockProposal): Promise<'genesis' | BlockHeader | undefined> {
|
|
206
|
+
const parentArchive = proposal.payload.header.lastArchiveRoot;
|
|
207
|
+
const slot = proposal.slotNumber.toBigInt();
|
|
208
|
+
const config = this.blockBuilder.getConfig();
|
|
209
|
+
const { genesisArchiveRoot } = await this.blockSource.getGenesisValues();
|
|
210
|
+
|
|
211
|
+
if (parentArchive.equals(genesisArchiveRoot)) {
|
|
212
|
+
return 'genesis';
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
const deadline = this.getReexecutionDeadline(slot, config);
|
|
216
|
+
const currentTime = this.dateProvider.now();
|
|
217
|
+
const timeoutDurationMs = deadline.getTime() - currentTime;
|
|
218
|
+
|
|
219
|
+
try {
|
|
220
|
+
return (
|
|
221
|
+
(await this.blockSource.getBlockHeaderByArchive(parentArchive)) ??
|
|
222
|
+
(timeoutDurationMs <= 0
|
|
223
|
+
? undefined
|
|
224
|
+
: await retryUntil(
|
|
225
|
+
() =>
|
|
226
|
+
this.blockSource.syncImmediate().then(() => this.blockSource.getBlockHeaderByArchive(parentArchive)),
|
|
227
|
+
'force archiver sync',
|
|
228
|
+
timeoutDurationMs / 1000,
|
|
229
|
+
0.5,
|
|
230
|
+
))
|
|
231
|
+
);
|
|
232
|
+
} catch (err) {
|
|
233
|
+
if (err instanceof TimeoutError) {
|
|
234
|
+
this.log.debug(`Timed out getting parent block by archive root`, { parentArchive });
|
|
235
|
+
} else {
|
|
236
|
+
this.log.error('Error getting parent block by archive root', err, { parentArchive });
|
|
237
|
+
}
|
|
238
|
+
return undefined;
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
private getReexecutionDeadline(slot: bigint, config: { l1GenesisTime: bigint; slotDuration: number }): Date {
|
|
243
|
+
const nextSlotTimestampSeconds = Number(getTimestampForSlot(slot + 1n, config));
|
|
211
244
|
const msNeededForPropagationAndPublishing = this.config.validatorReexecuteDeadlineMs;
|
|
212
245
|
return new Date(nextSlotTimestampSeconds * 1000 - msNeededForPropagationAndPublishing);
|
|
213
246
|
}
|
|
@@ -219,21 +252,17 @@ export class BlockProposalHandler {
|
|
|
219
252
|
return 'failed_txs';
|
|
220
253
|
} else if (err instanceof ReExTimeoutError) {
|
|
221
254
|
return 'timeout';
|
|
222
|
-
} else
|
|
255
|
+
} else {
|
|
223
256
|
return 'unknown_error';
|
|
224
257
|
}
|
|
225
258
|
}
|
|
226
259
|
|
|
227
260
|
async reexecuteTransactions(
|
|
228
261
|
proposal: BlockProposal,
|
|
262
|
+
blockNumber: number,
|
|
229
263
|
txs: Tx[],
|
|
230
264
|
l1ToL2Messages: Fr[],
|
|
231
|
-
): Promise<{
|
|
232
|
-
block: any;
|
|
233
|
-
failedTxs: FailedTx[];
|
|
234
|
-
reexecutionTimeMs: number;
|
|
235
|
-
totalManaUsed: number;
|
|
236
|
-
}> {
|
|
265
|
+
): Promise<ReexecuteTransactionsResult> {
|
|
237
266
|
const { header } = proposal.payload;
|
|
238
267
|
const { txHashes } = proposal;
|
|
239
268
|
|
|
@@ -254,14 +283,14 @@ export class BlockProposalHandler {
|
|
|
254
283
|
coinbase: proposal.payload.header.coinbase, // set arbitrarily by the proposer
|
|
255
284
|
feeRecipient: proposal.payload.header.feeRecipient, // set arbitrarily by the proposer
|
|
256
285
|
gasFees: proposal.payload.header.gasFees, // validated by the rollup contract
|
|
257
|
-
blockNumber
|
|
286
|
+
blockNumber, // computed from the parent block and checked it does not exist in archiver
|
|
258
287
|
timestamp: header.timestamp, // checked in the rollup contract against the slot number
|
|
259
288
|
chainId: new Fr(config.l1ChainId),
|
|
260
289
|
version: new Fr(config.rollupVersion),
|
|
261
290
|
});
|
|
262
291
|
|
|
263
292
|
const { block, failedTxs } = await this.blockBuilder.buildBlock(txs, l1ToL2Messages, globalVariables, {
|
|
264
|
-
deadline: this.getReexecutionDeadline(proposal, config),
|
|
293
|
+
deadline: this.getReexecutionDeadline(proposal.payload.header.slotNumber.toBigInt(), config),
|
|
265
294
|
});
|
|
266
295
|
|
|
267
296
|
const numFailedTxs = failedTxs.length;
|
|
@@ -21,7 +21,6 @@ export class ValidationService {
|
|
|
21
21
|
/**
|
|
22
22
|
* Create a block proposal with the given header, archive, and transactions
|
|
23
23
|
*
|
|
24
|
-
* @param blockNumber - The block number this proposal is for
|
|
25
24
|
* @param header - The block header
|
|
26
25
|
* @param archive - The archive of the current block
|
|
27
26
|
* @param txs - TxHash[] ordered list of transactions
|
|
@@ -29,7 +28,6 @@ export class ValidationService {
|
|
|
29
28
|
* @returns A block proposal signing the above information (not the current implementation!!!)
|
|
30
29
|
*/
|
|
31
30
|
async createBlockProposal(
|
|
32
|
-
blockNumber: number,
|
|
33
31
|
header: ProposedBlockHeader,
|
|
34
32
|
archive: Fr,
|
|
35
33
|
stateReference: StateReference,
|
|
@@ -49,7 +47,6 @@ export class ValidationService {
|
|
|
49
47
|
const txHashes = await Promise.all(txs.map(tx => tx.getTxHash()));
|
|
50
48
|
|
|
51
49
|
return BlockProposal.createProposalFromSigner(
|
|
52
|
-
blockNumber,
|
|
53
50
|
new ConsensusPayload(header, archive, stateReference),
|
|
54
51
|
txHashes,
|
|
55
52
|
options.publishFullTxs ? txs : undefined,
|
|
@@ -74,8 +71,7 @@ export class ValidationService {
|
|
|
74
71
|
const signatures = await Promise.all(
|
|
75
72
|
attestors.map(attestor => this.keyStore.signMessageWithAddress(attestor, buf)),
|
|
76
73
|
);
|
|
77
|
-
|
|
78
|
-
return signatures.map(sig => new BlockAttestation(proposal.blockNumber, proposal.payload, sig));
|
|
74
|
+
return signatures.map(sig => new BlockAttestation(proposal.payload, sig, proposal.signature));
|
|
79
75
|
}
|
|
80
76
|
|
|
81
77
|
async signAttestationsAndSigners(
|
package/src/factory.ts
CHANGED
|
@@ -24,7 +24,9 @@ export function createBlockProposalHandler(
|
|
|
24
24
|
},
|
|
25
25
|
) {
|
|
26
26
|
const metrics = new ValidatorMetrics(deps.telemetry);
|
|
27
|
-
const blockProposalValidator = new BlockProposalValidator(deps.epochCache
|
|
27
|
+
const blockProposalValidator = new BlockProposalValidator(deps.epochCache, {
|
|
28
|
+
txsPermitted: !config.disableTransactions,
|
|
29
|
+
});
|
|
28
30
|
return new BlockProposalHandler(
|
|
29
31
|
deps.blockBuilder,
|
|
30
32
|
deps.blockSource,
|
|
@@ -324,7 +324,7 @@ export class NodeKeystoreAdapter implements ExtendedValidatorKeyStore {
|
|
|
324
324
|
*/
|
|
325
325
|
getCoinbaseAddress(attesterAddress: EthAddress): EthAddress {
|
|
326
326
|
const validatorIndex = this.findValidatorIndexForAttester(attesterAddress);
|
|
327
|
-
return this.keystoreManager.getCoinbaseAddress(validatorIndex);
|
|
327
|
+
return this.keystoreManager.getCoinbaseAddress(validatorIndex, attesterAddress);
|
|
328
328
|
}
|
|
329
329
|
|
|
330
330
|
/**
|
package/src/metrics.ts
CHANGED
|
@@ -62,9 +62,10 @@ export class ValidatorMetrics {
|
|
|
62
62
|
}
|
|
63
63
|
|
|
64
64
|
public recordFailedReexecution(proposal: BlockProposal) {
|
|
65
|
+
const proposer = proposal.getSender();
|
|
65
66
|
this.failedReexecutionCounter.add(1, {
|
|
66
67
|
[Attributes.STATUS]: 'failed',
|
|
67
|
-
[Attributes.BLOCK_PROPOSER]:
|
|
68
|
+
[Attributes.BLOCK_PROPOSER]: proposer?.toString() ?? 'unknown',
|
|
68
69
|
});
|
|
69
70
|
}
|
|
70
71
|
|
package/src/validator.ts
CHANGED
|
@@ -9,13 +9,7 @@ import { DateProvider } from '@aztec/foundation/timer';
|
|
|
9
9
|
import type { KeystoreManager } from '@aztec/node-keystore';
|
|
10
10
|
import type { P2P, PeerId, TxProvider } from '@aztec/p2p';
|
|
11
11
|
import { AuthRequest, AuthResponse, BlockProposalValidator, ReqRespSubProtocol } from '@aztec/p2p';
|
|
12
|
-
import {
|
|
13
|
-
OffenseType,
|
|
14
|
-
type SlasherConfig,
|
|
15
|
-
WANT_TO_SLASH_EVENT,
|
|
16
|
-
type Watcher,
|
|
17
|
-
type WatcherEmitter,
|
|
18
|
-
} from '@aztec/slasher';
|
|
12
|
+
import { OffenseType, WANT_TO_SLASH_EVENT, type Watcher, type WatcherEmitter } from '@aztec/slasher';
|
|
19
13
|
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
20
14
|
import type { CommitteeAttestationsAndSigners, L2BlockSource } from '@aztec/stdlib/block';
|
|
21
15
|
import type { IFullNodeBlockBuilder, Validator, ValidatorClientFullConfig } from '@aztec/stdlib/interfaces/server';
|
|
@@ -29,7 +23,6 @@ import { EventEmitter } from 'events';
|
|
|
29
23
|
import type { TypedDataDefinition } from 'viem';
|
|
30
24
|
|
|
31
25
|
import { BlockProposalHandler, type BlockProposalValidationFailureReason } from './block_proposal_handler.js';
|
|
32
|
-
import type { ValidatorClientConfig } from './config.js';
|
|
33
26
|
import { ValidationService } from './duties/validation_service.js';
|
|
34
27
|
import { NodeKeystoreAdapter } from './key_store/node_keystore_adapter.js';
|
|
35
28
|
import { ValidatorMetrics } from './metrics.js';
|
|
@@ -134,7 +127,7 @@ export class ValidatorClient extends (EventEmitter as new () => WatcherEmitter)
|
|
|
134
127
|
}
|
|
135
128
|
|
|
136
129
|
static new(
|
|
137
|
-
config:
|
|
130
|
+
config: ValidatorClientFullConfig,
|
|
138
131
|
blockBuilder: IFullNodeBlockBuilder,
|
|
139
132
|
epochCache: EpochCache,
|
|
140
133
|
p2pClient: P2P,
|
|
@@ -146,7 +139,9 @@ export class ValidatorClient extends (EventEmitter as new () => WatcherEmitter)
|
|
|
146
139
|
telemetry: TelemetryClient = getTelemetryClient(),
|
|
147
140
|
) {
|
|
148
141
|
const metrics = new ValidatorMetrics(telemetry);
|
|
149
|
-
const blockProposalValidator = new BlockProposalValidator(epochCache
|
|
142
|
+
const blockProposalValidator = new BlockProposalValidator(epochCache, {
|
|
143
|
+
txsPermitted: !config.disableTransactions,
|
|
144
|
+
});
|
|
150
145
|
const blockProposalHandler = new BlockProposalHandler(
|
|
151
146
|
blockBuilder,
|
|
152
147
|
blockSource,
|
|
@@ -183,8 +178,13 @@ export class ValidatorClient extends (EventEmitter as new () => WatcherEmitter)
|
|
|
183
178
|
}
|
|
184
179
|
|
|
185
180
|
// Proxy method for backwards compatibility with tests
|
|
186
|
-
public reExecuteTransactions(
|
|
187
|
-
|
|
181
|
+
public reExecuteTransactions(
|
|
182
|
+
proposal: BlockProposal,
|
|
183
|
+
blockNumber: number,
|
|
184
|
+
txs: any[],
|
|
185
|
+
l1ToL2Messages: Fr[],
|
|
186
|
+
): Promise<any> {
|
|
187
|
+
return this.blockProposalHandler.reexecuteTransactions(proposal, blockNumber, txs, l1ToL2Messages);
|
|
188
188
|
}
|
|
189
189
|
|
|
190
190
|
public signWithAddress(addr: EthAddress, msg: TypedDataDefinition) {
|
|
@@ -256,13 +256,19 @@ export class ValidatorClient extends (EventEmitter as new () => WatcherEmitter)
|
|
|
256
256
|
const slotNumber = proposal.slotNumber.toBigInt();
|
|
257
257
|
const proposer = proposal.getSender();
|
|
258
258
|
|
|
259
|
+
// Reject proposals with invalid signatures
|
|
260
|
+
if (!proposer) {
|
|
261
|
+
this.log.warn(`Received proposal with invalid signature for slot ${slotNumber}`);
|
|
262
|
+
return undefined;
|
|
263
|
+
}
|
|
264
|
+
|
|
259
265
|
// Check that I have any address in current committee before attesting
|
|
260
266
|
const inCommittee = await this.epochCache.filterInCommittee(slotNumber, this.getValidatorAddresses());
|
|
261
267
|
const partOfCommittee = inCommittee.length > 0;
|
|
262
268
|
const incFailedAttestation = (reason: string) => this.metrics.incFailedAttestations(1, reason, partOfCommittee);
|
|
263
269
|
|
|
264
270
|
const proposalInfo = { ...proposal.toBlockInfo(), proposer: proposer.toString() };
|
|
265
|
-
this.log.info(`Received proposal for
|
|
271
|
+
this.log.info(`Received proposal for slot ${slotNumber}`, {
|
|
266
272
|
...proposalInfo,
|
|
267
273
|
txHashes: proposal.txHashes.map(t => t.toString()),
|
|
268
274
|
});
|
|
@@ -304,7 +310,7 @@ export class ValidatorClient extends (EventEmitter as new () => WatcherEmitter)
|
|
|
304
310
|
}
|
|
305
311
|
|
|
306
312
|
// Provided all of the above checks pass, we can attest to the proposal
|
|
307
|
-
this.log.info(`Attesting to proposal for block
|
|
313
|
+
this.log.info(`Attesting to proposal for block at slot ${slotNumber}`, proposalInfo);
|
|
308
314
|
this.metrics.incAttestations(inCommittee.length);
|
|
309
315
|
|
|
310
316
|
// If the above function does not throw an error, then we can attest to the proposal
|
|
@@ -314,6 +320,12 @@ export class ValidatorClient extends (EventEmitter as new () => WatcherEmitter)
|
|
|
314
320
|
private slashInvalidBlock(proposal: BlockProposal) {
|
|
315
321
|
const proposer = proposal.getSender();
|
|
316
322
|
|
|
323
|
+
// Skip if signature is invalid (shouldn't happen since we validate earlier)
|
|
324
|
+
if (!proposer) {
|
|
325
|
+
this.log.warn(`Cannot slash proposal with invalid signature`);
|
|
326
|
+
return;
|
|
327
|
+
}
|
|
328
|
+
|
|
317
329
|
// Trim the set if it's too big.
|
|
318
330
|
if (this.proposersOfInvalidBlocks.size > MAX_PROPOSERS_OF_INVALID_BLOCKS) {
|
|
319
331
|
// remove oldest proposer. `values` is guaranteed to be in insertion order.
|
|
@@ -347,7 +359,6 @@ export class ValidatorClient extends (EventEmitter as new () => WatcherEmitter)
|
|
|
347
359
|
}
|
|
348
360
|
|
|
349
361
|
const newProposal = await this.validationService.createBlockProposal(
|
|
350
|
-
blockNumber,
|
|
351
362
|
header,
|
|
352
363
|
archive,
|
|
353
364
|
stateReference,
|
|
@@ -396,13 +407,33 @@ export class ValidatorClient extends (EventEmitter as new () => WatcherEmitter)
|
|
|
396
407
|
|
|
397
408
|
let attestations: BlockAttestation[] = [];
|
|
398
409
|
while (true) {
|
|
399
|
-
|
|
410
|
+
// Filter out attestations with a mismatching payload. This should NOT happen since we have verified
|
|
411
|
+
// the proposer signature (ie our own) before accepting the attestation into the pool via the p2p client.
|
|
412
|
+
const collectedAttestations = (await this.p2pClient.getAttestationsForSlot(slot, proposalId)).filter(
|
|
413
|
+
attestation => {
|
|
414
|
+
if (!attestation.payload.equals(proposal.payload)) {
|
|
415
|
+
this.log.warn(
|
|
416
|
+
`Received attestation for slot ${slot} with mismatched payload from ${attestation.getSender()?.toString()}`,
|
|
417
|
+
{ attestationPayload: attestation.payload, proposalPayload: proposal.payload },
|
|
418
|
+
);
|
|
419
|
+
return false;
|
|
420
|
+
}
|
|
421
|
+
return true;
|
|
422
|
+
},
|
|
423
|
+
);
|
|
424
|
+
|
|
425
|
+
// Log new attestations we collected
|
|
400
426
|
const oldSenders = attestations.map(attestation => attestation.getSender());
|
|
401
427
|
for (const collected of collectedAttestations) {
|
|
402
428
|
const collectedSender = collected.getSender();
|
|
429
|
+
// Skip attestations with invalid signatures
|
|
430
|
+
if (!collectedSender) {
|
|
431
|
+
this.log.warn(`Skipping attestation with invalid signature for slot ${slot}`);
|
|
432
|
+
continue;
|
|
433
|
+
}
|
|
403
434
|
if (
|
|
404
435
|
!myAddresses.some(address => address.equals(collectedSender)) &&
|
|
405
|
-
!oldSenders.some(sender => sender
|
|
436
|
+
!oldSenders.some(sender => sender?.equals(collectedSender))
|
|
406
437
|
) {
|
|
407
438
|
this.log.debug(`Received attestation for slot ${slot} from ${collectedSender.toString()}`);
|
|
408
439
|
}
|