@aztec/validator-client 2.0.3 → 2.1.0-rc.10
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 +47 -0
- package/dest/block_proposal_handler.d.ts.map +1 -0
- package/dest/block_proposal_handler.js +257 -0
- package/dest/config.d.ts.map +1 -1
- package/dest/config.js +5 -0
- package/dest/duties/validation_service.d.ts +3 -0
- package/dest/duties/validation_service.d.ts.map +1 -1
- package/dest/duties/validation_service.js +8 -0
- package/dest/factory.d.ts +13 -4
- package/dest/factory.d.ts.map +1 -1
- package/dest/factory.js +8 -0
- package/dest/index.d.ts +1 -0
- package/dest/index.d.ts.map +1 -1
- package/dest/index.js +1 -0
- package/dest/key_store/interface.d.ts +1 -1
- package/dest/key_store/interface.d.ts.map +1 -1
- package/dest/key_store/local_key_store.d.ts +1 -1
- package/dest/key_store/local_key_store.d.ts.map +1 -1
- package/dest/key_store/local_key_store.js +1 -1
- package/dest/key_store/node_keystore_adapter.d.ts +1 -1
- package/dest/key_store/node_keystore_adapter.d.ts.map +1 -1
- package/dest/key_store/node_keystore_adapter.js +2 -2
- package/dest/key_store/web3signer_key_store.d.ts +1 -1
- package/dest/key_store/web3signer_key_store.d.ts.map +1 -1
- package/dest/metrics.d.ts +1 -1
- package/dest/metrics.d.ts.map +1 -1
- package/dest/metrics.js +3 -2
- package/dest/validator.d.ts +16 -20
- package/dest/validator.d.ts.map +1 -1
- package/dest/validator.js +66 -179
- package/package.json +14 -14
- package/src/block_proposal_handler.ts +314 -0
- package/src/config.ts +6 -0
- package/src/duties/validation_service.ts +16 -1
- package/src/factory.ts +32 -4
- package/src/index.ts +1 -0
- package/src/key_store/interface.ts +1 -1
- package/src/key_store/local_key_store.ts +1 -1
- package/src/key_store/node_keystore_adapter.ts +3 -3
- package/src/key_store/web3signer_key_store.ts +1 -1
- package/src/metrics.ts +2 -1
- package/src/validator.ts +109 -228
|
@@ -0,0 +1,47 @@
|
|
|
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 { 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_does_not_match' | 'in_hash_mismatch' | 'block_number_already_exists' | 'txs_not_available' | 'state_mismatch' | 'failed_txs' | 'timeout' | 'unknown_error';
|
|
14
|
+
export interface BlockProposalValidationResult {
|
|
15
|
+
isValid: boolean;
|
|
16
|
+
reason?: BlockProposalValidationFailureReason;
|
|
17
|
+
reexecutionResult?: {
|
|
18
|
+
block: any;
|
|
19
|
+
failedTxs: FailedTx[];
|
|
20
|
+
reexecutionTimeMs: number;
|
|
21
|
+
totalManaUsed: number;
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
export declare class BlockProposalHandler {
|
|
25
|
+
private blockBuilder;
|
|
26
|
+
private blockSource;
|
|
27
|
+
private l1ToL2MessageSource;
|
|
28
|
+
private txProvider;
|
|
29
|
+
private blockProposalValidator;
|
|
30
|
+
private config;
|
|
31
|
+
private metrics?;
|
|
32
|
+
private dateProvider;
|
|
33
|
+
private log;
|
|
34
|
+
readonly tracer: Tracer;
|
|
35
|
+
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
|
+
registerForReexecution(p2pClient: P2P): BlockProposalHandler;
|
|
37
|
+
handleBlockProposal(proposal: BlockProposal, proposalSender: PeerId, shouldReexecute: boolean): Promise<BlockProposalValidationResult>;
|
|
38
|
+
private getReexecutionDeadline;
|
|
39
|
+
private getReexecuteFailureReason;
|
|
40
|
+
reexecuteTransactions(proposal: BlockProposal, txs: Tx[], l1ToL2Messages: Fr[]): Promise<{
|
|
41
|
+
block: any;
|
|
42
|
+
failedTxs: FailedTx[];
|
|
43
|
+
reexecutionTimeMs: number;
|
|
44
|
+
totalManaUsed: number;
|
|
45
|
+
}>;
|
|
46
|
+
}
|
|
47
|
+
//# 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":"AACA,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,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEzD,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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AAsC,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;IA4GzC,OAAO,CAAC,sBAAsB;IAS9B,OAAO,CAAC,yBAAyB;IAY3B,qBAAqB,CACzB,QAAQ,EAAE,aAAa,EACvB,GAAG,EAAE,EAAE,EAAE,EACT,cAAc,EAAE,EAAE,EAAE,GACnB,OAAO,CAAC;QACT,KAAK,EAAE,GAAG,CAAC;QACX,SAAS,EAAE,QAAQ,EAAE,CAAC;QACtB,iBAAiB,EAAE,MAAM,CAAC;QAC1B,aAAa,EAAE,MAAM,CAAC;KACvB,CAAC;CA8EH"}
|
|
@@ -0,0 +1,257 @@
|
|
|
1
|
+
import { INITIAL_L2_BLOCK_NUM } from '@aztec/constants';
|
|
2
|
+
import { Fr } from '@aztec/foundation/fields';
|
|
3
|
+
import { createLogger } from '@aztec/foundation/log';
|
|
4
|
+
import { retryUntil } from '@aztec/foundation/retry';
|
|
5
|
+
import { DateProvider, Timer } from '@aztec/foundation/timer';
|
|
6
|
+
import { computeInHashFromL1ToL2Messages } from '@aztec/prover-client/helpers';
|
|
7
|
+
import { getTimestampForSlot } from '@aztec/stdlib/epoch-helpers';
|
|
8
|
+
import { ConsensusPayload } from '@aztec/stdlib/p2p';
|
|
9
|
+
import { GlobalVariables } from '@aztec/stdlib/tx';
|
|
10
|
+
import { ReExFailedTxsError, ReExStateMismatchError, ReExTimeoutError, TransactionsNotAvailableError } from '@aztec/stdlib/validators';
|
|
11
|
+
import { getTelemetryClient } from '@aztec/telemetry-client';
|
|
12
|
+
export class BlockProposalHandler {
|
|
13
|
+
blockBuilder;
|
|
14
|
+
blockSource;
|
|
15
|
+
l1ToL2MessageSource;
|
|
16
|
+
txProvider;
|
|
17
|
+
blockProposalValidator;
|
|
18
|
+
config;
|
|
19
|
+
metrics;
|
|
20
|
+
dateProvider;
|
|
21
|
+
log;
|
|
22
|
+
tracer;
|
|
23
|
+
constructor(blockBuilder, blockSource, l1ToL2MessageSource, txProvider, blockProposalValidator, config, metrics, dateProvider = new DateProvider(), telemetry = getTelemetryClient(), log = createLogger('validator:block-proposal-handler')){
|
|
24
|
+
this.blockBuilder = blockBuilder;
|
|
25
|
+
this.blockSource = blockSource;
|
|
26
|
+
this.l1ToL2MessageSource = l1ToL2MessageSource;
|
|
27
|
+
this.txProvider = txProvider;
|
|
28
|
+
this.blockProposalValidator = blockProposalValidator;
|
|
29
|
+
this.config = config;
|
|
30
|
+
this.metrics = metrics;
|
|
31
|
+
this.dateProvider = dateProvider;
|
|
32
|
+
this.log = log;
|
|
33
|
+
this.tracer = telemetry.getTracer('BlockProposalHandler');
|
|
34
|
+
}
|
|
35
|
+
registerForReexecution(p2pClient) {
|
|
36
|
+
const handler = async (proposal, proposalSender)=>{
|
|
37
|
+
try {
|
|
38
|
+
const result = await this.handleBlockProposal(proposal, proposalSender, true);
|
|
39
|
+
if (result.isValid && result.reexecutionResult) {
|
|
40
|
+
this.log.info(`Non-validator reexecution completed for slot ${proposal.slotNumber.toBigInt()}`, {
|
|
41
|
+
blockNumber: proposal.blockNumber,
|
|
42
|
+
reexecutionTimeMs: result.reexecutionResult.reexecutionTimeMs,
|
|
43
|
+
totalManaUsed: result.reexecutionResult.totalManaUsed,
|
|
44
|
+
numTxs: result.reexecutionResult.block?.body?.txEffects?.length ?? 0
|
|
45
|
+
});
|
|
46
|
+
} else {
|
|
47
|
+
this.log.warn(`Non-validator reexecution failed for slot ${proposal.slotNumber.toBigInt()}`, {
|
|
48
|
+
blockNumber: proposal.blockNumber,
|
|
49
|
+
reason: result.reason
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
} catch (error) {
|
|
53
|
+
this.log.error('Error processing block proposal in non-validator handler', error);
|
|
54
|
+
}
|
|
55
|
+
return undefined; // Non-validator nodes don't return attestations
|
|
56
|
+
};
|
|
57
|
+
p2pClient.registerBlockProposalHandler(handler);
|
|
58
|
+
return this;
|
|
59
|
+
}
|
|
60
|
+
async handleBlockProposal(proposal, proposalSender, shouldReexecute) {
|
|
61
|
+
const slotNumber = proposal.slotNumber.toBigInt();
|
|
62
|
+
const blockNumber = proposal.blockNumber;
|
|
63
|
+
const proposer = proposal.getSender();
|
|
64
|
+
const proposalInfo = {
|
|
65
|
+
...proposal.toBlockInfo(),
|
|
66
|
+
proposer: proposer.toString()
|
|
67
|
+
};
|
|
68
|
+
this.log.info(`Processing proposal for slot ${slotNumber}`, {
|
|
69
|
+
...proposalInfo,
|
|
70
|
+
txHashes: proposal.txHashes.map((t)=>t.toString())
|
|
71
|
+
});
|
|
72
|
+
// Check that the proposal is from the current proposer, or the next proposer
|
|
73
|
+
// This should have been handled by the p2p layer, but we double check here out of caution
|
|
74
|
+
const invalidProposal = await this.blockProposalValidator.validate(proposal);
|
|
75
|
+
if (invalidProposal) {
|
|
76
|
+
this.log.warn(`Proposal is not valid, skipping processing`, proposalInfo);
|
|
77
|
+
return {
|
|
78
|
+
isValid: false,
|
|
79
|
+
reason: 'invalid_proposal'
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
// 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
|
+
// if another node needs them.
|
|
85
|
+
const config = this.blockBuilder.getConfig();
|
|
86
|
+
const { txs, missingTxs } = await this.txProvider.getTxsForBlockProposal(proposal, {
|
|
87
|
+
pinnedPeer: proposalSender,
|
|
88
|
+
deadline: this.getReexecutionDeadline(proposal, config)
|
|
89
|
+
});
|
|
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
|
+
// Check that I have the same set of l1ToL2Messages as the proposal
|
|
123
|
+
const l1ToL2Messages = await this.l1ToL2MessageSource.getL1ToL2Messages(blockNumber);
|
|
124
|
+
const computedInHash = await computeInHashFromL1ToL2Messages(l1ToL2Messages);
|
|
125
|
+
const proposalInHash = proposal.payload.header.contentCommitment.inHash;
|
|
126
|
+
if (!computedInHash.equals(proposalInHash)) {
|
|
127
|
+
this.log.warn(`L1 to L2 messages in hash mismatch, skipping processing`, {
|
|
128
|
+
proposalInHash: proposalInHash.toString(),
|
|
129
|
+
computedInHash: computedInHash.toString(),
|
|
130
|
+
...proposalInfo
|
|
131
|
+
});
|
|
132
|
+
return {
|
|
133
|
+
isValid: false,
|
|
134
|
+
reason: 'in_hash_mismatch'
|
|
135
|
+
};
|
|
136
|
+
}
|
|
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
|
+
// 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
|
+
reason: 'txs_not_available'
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
// Try re-executing the transactions in the proposal if needed
|
|
158
|
+
let reexecutionResult;
|
|
159
|
+
if (shouldReexecute) {
|
|
160
|
+
try {
|
|
161
|
+
this.log.verbose(`Re-executing transactions in the proposal`, proposalInfo);
|
|
162
|
+
reexecutionResult = await this.reexecuteTransactions(proposal, txs, l1ToL2Messages);
|
|
163
|
+
} catch (error) {
|
|
164
|
+
this.log.error(`Error reexecuting txs while processing block proposal`, error, proposalInfo);
|
|
165
|
+
const reason = this.getReexecuteFailureReason(error);
|
|
166
|
+
return {
|
|
167
|
+
isValid: false,
|
|
168
|
+
reason,
|
|
169
|
+
reexecutionResult
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
this.log.info(`Successfully processed proposal for slot ${slotNumber}`, proposalInfo);
|
|
174
|
+
return {
|
|
175
|
+
isValid: true,
|
|
176
|
+
reexecutionResult
|
|
177
|
+
};
|
|
178
|
+
}
|
|
179
|
+
getReexecutionDeadline(proposal, config) {
|
|
180
|
+
const nextSlotTimestampSeconds = Number(getTimestampForSlot(proposal.slotNumber.toBigInt() + 1n, config));
|
|
181
|
+
const msNeededForPropagationAndPublishing = this.config.validatorReexecuteDeadlineMs;
|
|
182
|
+
return new Date(nextSlotTimestampSeconds * 1000 - msNeededForPropagationAndPublishing);
|
|
183
|
+
}
|
|
184
|
+
getReexecuteFailureReason(err) {
|
|
185
|
+
if (err instanceof ReExStateMismatchError) {
|
|
186
|
+
return 'state_mismatch';
|
|
187
|
+
} else if (err instanceof ReExFailedTxsError) {
|
|
188
|
+
return 'failed_txs';
|
|
189
|
+
} else if (err instanceof ReExTimeoutError) {
|
|
190
|
+
return 'timeout';
|
|
191
|
+
} else if (err instanceof Error) {
|
|
192
|
+
return 'unknown_error';
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
async reexecuteTransactions(proposal, txs, l1ToL2Messages) {
|
|
196
|
+
const { header } = proposal.payload;
|
|
197
|
+
const { txHashes } = proposal;
|
|
198
|
+
// If we do not have all of the transactions, then we should fail
|
|
199
|
+
if (txs.length !== txHashes.length) {
|
|
200
|
+
const foundTxHashes = txs.map((tx)=>tx.getTxHash());
|
|
201
|
+
const missingTxHashes = txHashes.filter((txHash)=>!foundTxHashes.includes(txHash));
|
|
202
|
+
throw new TransactionsNotAvailableError(missingTxHashes);
|
|
203
|
+
}
|
|
204
|
+
// Use the sequencer's block building logic to re-execute the transactions
|
|
205
|
+
const timer = new Timer();
|
|
206
|
+
const config = this.blockBuilder.getConfig();
|
|
207
|
+
// We source most global variables from the proposal
|
|
208
|
+
const globalVariables = GlobalVariables.from({
|
|
209
|
+
slotNumber: proposal.payload.header.slotNumber,
|
|
210
|
+
coinbase: proposal.payload.header.coinbase,
|
|
211
|
+
feeRecipient: proposal.payload.header.feeRecipient,
|
|
212
|
+
gasFees: proposal.payload.header.gasFees,
|
|
213
|
+
blockNumber: proposal.blockNumber,
|
|
214
|
+
timestamp: header.timestamp,
|
|
215
|
+
chainId: new Fr(config.l1ChainId),
|
|
216
|
+
version: new Fr(config.rollupVersion)
|
|
217
|
+
});
|
|
218
|
+
const { block, failedTxs } = await this.blockBuilder.buildBlock(txs, l1ToL2Messages, globalVariables, {
|
|
219
|
+
deadline: this.getReexecutionDeadline(proposal, config)
|
|
220
|
+
});
|
|
221
|
+
const numFailedTxs = failedTxs.length;
|
|
222
|
+
const slot = proposal.slotNumber.toBigInt();
|
|
223
|
+
this.log.verbose(`Transaction re-execution complete for slot ${slot}`, {
|
|
224
|
+
numFailedTxs,
|
|
225
|
+
numProposalTxs: txHashes.length,
|
|
226
|
+
numProcessedTxs: block.body.txEffects.length,
|
|
227
|
+
slot
|
|
228
|
+
});
|
|
229
|
+
if (numFailedTxs > 0) {
|
|
230
|
+
this.metrics?.recordFailedReexecution(proposal);
|
|
231
|
+
throw new ReExFailedTxsError(numFailedTxs);
|
|
232
|
+
}
|
|
233
|
+
if (block.body.txEffects.length !== txHashes.length) {
|
|
234
|
+
this.metrics?.recordFailedReexecution(proposal);
|
|
235
|
+
throw new ReExTimeoutError();
|
|
236
|
+
}
|
|
237
|
+
// Throw a ReExStateMismatchError error if state updates do not match
|
|
238
|
+
const blockPayload = ConsensusPayload.fromBlock(block);
|
|
239
|
+
if (!blockPayload.equals(proposal.payload)) {
|
|
240
|
+
this.log.warn(`Re-execution state mismatch for slot ${slot}`, {
|
|
241
|
+
expected: blockPayload.toInspect(),
|
|
242
|
+
actual: proposal.payload.toInspect()
|
|
243
|
+
});
|
|
244
|
+
this.metrics?.recordFailedReexecution(proposal);
|
|
245
|
+
throw new ReExStateMismatchError(proposal.archive, block.archive.root, proposal.payload.stateReference, block.header.state);
|
|
246
|
+
}
|
|
247
|
+
const reexecutionTimeMs = timer.ms();
|
|
248
|
+
const totalManaUsed = block.header.totalManaUsed.toNumber() / 1e6;
|
|
249
|
+
this.metrics?.recordReex(reexecutionTimeMs, txs.length, totalManaUsed);
|
|
250
|
+
return {
|
|
251
|
+
block,
|
|
252
|
+
failedTxs,
|
|
253
|
+
reexecutionTimeMs,
|
|
254
|
+
totalManaUsed
|
|
255
|
+
};
|
|
256
|
+
}
|
|
257
|
+
}
|
package/dest/config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
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,
|
|
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
|
@@ -39,6 +39,11 @@ export const validatorClientConfigMappings = {
|
|
|
39
39
|
env: 'VALIDATOR_REEXECUTE_DEADLINE_MS',
|
|
40
40
|
description: 'Will re-execute until this many milliseconds are left in the slot',
|
|
41
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)
|
|
42
47
|
}
|
|
43
48
|
};
|
|
44
49
|
/**
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import type { EthAddress } from '@aztec/foundation/eth-address';
|
|
2
|
+
import { Signature } from '@aztec/foundation/eth-signature';
|
|
2
3
|
import type { 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
6
|
import type { ProposedBlockHeader, StateReference, Tx } from '@aztec/stdlib/tx';
|
|
5
7
|
import type { ValidatorKeyStore } from '../key_store/interface.js';
|
|
@@ -28,5 +30,6 @@ export declare class ValidationService {
|
|
|
28
30
|
* @returns attestations
|
|
29
31
|
*/
|
|
30
32
|
attestToProposal(proposal: BlockProposal, attestors: EthAddress[]): Promise<BlockAttestation[]>;
|
|
33
|
+
signAttestationsAndSigners(attestationsAndSigners: CommitteeAttestationsAndSigners, proposer: EthAddress | undefined): Promise<Signature>;
|
|
31
34
|
}
|
|
32
35
|
//# 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;
|
|
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;;;;;;;;;OASG;IACG,mBAAmB,CACvB,WAAW,EAAE,MAAM,EACnB,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;IAqBzB;;;;;;;;;OASG;IACG,gBAAgB,CAAC,QAAQ,EAAE,aAAa,EAAE,SAAS,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC,gBAAgB,EAAE,CAAC;IAW/F,0BAA0B,CAC9B,sBAAsB,EAAE,+BAA+B,EACvD,QAAQ,EAAE,UAAU,GAAG,SAAS,GAC/B,OAAO,CAAC,SAAS,CAAC;CAUtB"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Buffer32 } from '@aztec/foundation/buffer';
|
|
2
2
|
import { keccak256 } from '@aztec/foundation/crypto';
|
|
3
|
+
import { Signature } from '@aztec/foundation/eth-signature';
|
|
3
4
|
import { BlockAttestation, BlockProposal, ConsensusPayload, SignatureDomainSeparator } from '@aztec/stdlib/p2p';
|
|
4
5
|
export class ValidationService {
|
|
5
6
|
keyStore;
|
|
@@ -43,4 +44,11 @@ export class ValidationService {
|
|
|
43
44
|
//await this.keyStore.signMessage(buf);
|
|
44
45
|
return signatures.map((sig)=>new BlockAttestation(proposal.blockNumber, proposal.payload, sig));
|
|
45
46
|
}
|
|
47
|
+
async signAttestationsAndSigners(attestationsAndSigners, proposer) {
|
|
48
|
+
if (proposer === undefined) {
|
|
49
|
+
return Signature.empty();
|
|
50
|
+
}
|
|
51
|
+
const buf = Buffer32.fromBuffer(keccak256(attestationsAndSigners.getPayloadToSign(SignatureDomainSeparator.attestationsAndSigners)));
|
|
52
|
+
return await this.keyStore.signMessageWithAddress(proposer, buf);
|
|
53
|
+
}
|
|
46
54
|
}
|
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
|
|
4
|
+
import { type P2PClient } from '@aztec/p2p';
|
|
5
5
|
import type { L2BlockSource } from '@aztec/stdlib/block';
|
|
6
|
-
import type { IFullNodeBlockBuilder,
|
|
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
|
|
9
|
+
import { BlockProposalHandler } from './block_proposal_handler.js';
|
|
10
10
|
import { ValidatorClient } from './validator.js';
|
|
11
|
-
export declare function
|
|
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;
|
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,KAAK,
|
|
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,wBAeF;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,12 @@
|
|
|
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
|
+
return new BlockProposalHandler(deps.blockBuilder, deps.blockSource, deps.l1ToL2MessageSource, deps.p2pClient.getTxProvider(), blockProposalValidator, config, metrics, deps.dateProvider, deps.telemetry);
|
|
9
|
+
}
|
|
2
10
|
export function createValidatorClient(config, deps) {
|
|
3
11
|
if (config.disableValidator || !deps.keyStoreManager) {
|
|
4
12
|
return undefined;
|
package/dest/index.d.ts
CHANGED
package/dest/index.d.ts.map
CHANGED
|
@@ -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
|
@@ -3,7 +3,7 @@ import type { EthAddress } from '@aztec/foundation/eth-address';
|
|
|
3
3
|
import type { Signature } from '@aztec/foundation/eth-signature';
|
|
4
4
|
import type { EthRemoteSignerConfig } from '@aztec/node-keystore';
|
|
5
5
|
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
6
|
-
import type { TypedDataDefinition } from 'viem';
|
|
6
|
+
import type { TypedDataDefinition } from '@spalladino/viem';
|
|
7
7
|
/** Key Store
|
|
8
8
|
*
|
|
9
9
|
* A keystore interface that can be replaced with a local keystore / remote signer service
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interface.d.ts","sourceRoot":"","sources":["../../src/key_store/interface.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAClE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAEhE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"interface.d.ts","sourceRoot":"","sources":["../../src/key_store/interface.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,KAAK,EAAE,qBA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|
3
3
|
import type { Signature } from '@aztec/foundation/eth-signature';
|
|
4
|
-
import { type TypedDataDefinition } from 'viem';
|
|
4
|
+
import { type TypedDataDefinition } from '@spalladino/viem';
|
|
5
5
|
import type { ValidatorKeyStore } from './interface.js';
|
|
6
6
|
/**
|
|
7
7
|
* Local Key Store
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"local_key_store.d.ts","sourceRoot":"","sources":["../../src/key_store/local_key_store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAEpD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AAEjE,OAAO,EAAE,KAAK,mBAAmB,EAAiB,MAAM,
|
|
1
|
+
{"version":3,"file":"local_key_store.d.ts","sourceRoot":"","sources":["../../src/key_store/local_key_store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAEpD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AAEjE,OAAO,EAAE,KAAK,mBAAmB,EAAiB,MAAM,kBAAkB,CAAC;AAE3E,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAExD;;;;GAIG;AACH,qBAAa,aAAc,YAAW,iBAAiB;IACrD,OAAO,CAAC,OAAO,CAAoB;IACnC,OAAO,CAAC,gBAAgB,CAAsC;gBAElD,WAAW,EAAE,QAAQ,EAAE;IAKnC;;;;;OAKG;IACI,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,UAAU;IAO5C;;;;OAIG;IACI,YAAY,IAAI,UAAU,EAAE;IAInC;;;;OAIG;IACI,aAAa,CAAC,SAAS,EAAE,mBAAmB,GAAG,OAAO,CAAC,SAAS,EAAE,CAAC;IAK1E;;;;;;OAMG;IACI,wBAAwB,CAAC,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,mBAAmB,GAAG,OAAO,CAAC,SAAS,CAAC;IASxG;;;;;OAKG;IACI,WAAW,CAAC,OAAO,EAAE,QAAQ,GAAG,OAAO,CAAC,SAAS,EAAE,CAAC;IAI3D;;;;;;OAMG;IACI,sBAAsB,CAAC,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,QAAQ,GAAG,OAAO,CAAC,SAAS,CAAC;CAO1F"}
|
|
@@ -4,7 +4,7 @@ import type { Signature } from '@aztec/foundation/eth-signature';
|
|
|
4
4
|
import { KeystoreManager } from '@aztec/node-keystore';
|
|
5
5
|
import type { EthRemoteSignerConfig } from '@aztec/node-keystore';
|
|
6
6
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
7
|
-
import type { TypedDataDefinition } from 'viem';
|
|
7
|
+
import type { TypedDataDefinition } from '@spalladino/viem';
|
|
8
8
|
import type { ExtendedValidatorKeyStore } from './interface.js';
|
|
9
9
|
export declare class NodeKeystoreAdapter implements ExtendedValidatorKeyStore {
|
|
10
10
|
private readonly keystoreManager;
|
|
@@ -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,
|
|
1
|
+
{"version":3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CvB;;OAEG;IACH,OAAO,CAAE,gBAAgB;IAOzB;;;;;OAKG;IACH,OAAO,CAAC,6BAA6B;IAcrC;;;;;OAKG;IACH,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,UAAU;IAQrC;;OAEG;IACH,YAAY,IAAI,UAAU,EAAE;IAY5B;;;;OAIG;IACG,aAAa,CAAC,SAAS,EAAE,mBAAmB,GAAG,OAAO,CAAC,SAAS,EAAE,CAAC;IAWzE;;;;OAIG;IACG,WAAW,CAAC,OAAO,EAAE,QAAQ,GAAG,OAAO,CAAC,SAAS,EAAE,CAAC;IAW1D;;;;;;;OAOG;IACG,wBAAwB,CAAC,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,mBAAmB,GAAG,OAAO,CAAC,SAAS,CAAC;IAkBvG;;;;;;;OAOG;IACG,sBAAsB,CAAC,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,QAAQ,GAAG,OAAO,CAAC,SAAS,CAAC;IAiBxF;;OAEG;IACH,oBAAoB,IAAI,UAAU,EAAE;IAIpC;;;;OAIG;IACH,kBAAkB,CAAC,eAAe,EAAE,UAAU,GAAG,UAAU;IAK3D;;;;OAIG;IACH,qBAAqB,CAAC,eAAe,EAAE,UAAU,GAAG,UAAU,EAAE;IAMhE,uBAAuB,CAAC,gBAAgB,EAAE,UAAU,GAAG,UAAU;IAajE;;;;OAIG;IACH,eAAe,CAAC,eAAe,EAAE,UAAU,GAAG,YAAY;IAK1D;;;;;;OAMG;IACH,qBAAqB,CAAC,eAAe,EAAE,UAAU,GAAG,qBAAqB,GAAG,SAAS;CAItF"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { KeystoreManager, loadKeystoreFile } from '@aztec/node-keystore';
|
|
2
2
|
import { InvalidValidatorPrivateKeyError } from '@aztec/stdlib/validators';
|
|
3
|
-
import { privateKeyToAccount } from 'viem/accounts';
|
|
3
|
+
import { privateKeyToAccount } from '@spalladino/viem/accounts';
|
|
4
4
|
export class NodeKeystoreAdapter {
|
|
5
5
|
keystoreManager;
|
|
6
6
|
// Per-validator cache (lazy)
|
|
@@ -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.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Buffer32 } from '@aztec/foundation/buffer';
|
|
2
2
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
3
3
|
import { Signature } from '@aztec/foundation/eth-signature';
|
|
4
|
-
import type { TypedDataDefinition } from 'viem';
|
|
4
|
+
import type { TypedDataDefinition } from '@spalladino/viem';
|
|
5
5
|
import type { ValidatorKeyStore } from './interface.js';
|
|
6
6
|
/**
|
|
7
7
|
* Web3Signer Key Store
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"web3signer_key_store.d.ts","sourceRoot":"","sources":["../../src/key_store/web3signer_key_store.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAC3D,OAAO,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AAE5D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"web3signer_key_store.d.ts","sourceRoot":"","sources":["../../src/key_store/web3signer_key_store.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAC3D,OAAO,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AAE5D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAE5D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAExD;;;;;GAKG;AACH,qBAAa,kBAAmB,YAAW,iBAAiB;IAExD,OAAO,CAAC,SAAS;IACjB,OAAO,CAAC,OAAO;gBADP,SAAS,EAAE,UAAU,EAAE,EACvB,OAAO,EAAE,MAAM;IAGzB;;;;;OAKG;IACI,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,UAAU;IAO5C;;;;OAIG;IACI,YAAY,IAAI,UAAU,EAAE;IAInC;;;;OAIG;IACU,aAAa,CAAC,SAAS,EAAE,mBAAmB,GAAG,OAAO,CAAC,SAAS,EAAE,CAAC;IAOhF;;;;;;OAMG;IACU,wBAAwB,CAAC,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,mBAAmB,GAAG,OAAO,CAAC,SAAS,CAAC;IAQ9G;;;;;OAKG;IACU,WAAW,CAAC,OAAO,EAAE,QAAQ,GAAG,OAAO,CAAC,SAAS,EAAE,CAAC;IAKjE;;;;;;OAMG;IACU,sBAAsB,CAAC,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,QAAQ,GAAG,OAAO,CAAC,SAAS,CAAC;IAO/F;;;;;OAKG;YACW,sBAAsB;YAiDtB,+BAA+B;CA6C9C"}
|
package/dest/metrics.d.ts
CHANGED
|
@@ -11,6 +11,6 @@ export declare class ValidatorMetrics {
|
|
|
11
11
|
recordReex(time: number, txs: number, mManaTotal: number): void;
|
|
12
12
|
recordFailedReexecution(proposal: BlockProposal): void;
|
|
13
13
|
incAttestations(num: number): void;
|
|
14
|
-
incFailedAttestations(num: number, reason: string): void;
|
|
14
|
+
incFailedAttestations(num: number, reason: string, inCommittee: boolean): void;
|
|
15
15
|
}
|
|
16
16
|
//# sourceMappingURL=metrics.d.ts.map
|
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;IAO/C,eAAe,CAAC,GAAG,EAAE,MAAM;IAI3B,qBAAqB,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;
|
|
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;IAO/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
|
@@ -51,9 +51,10 @@ export class ValidatorMetrics {
|
|
|
51
51
|
incAttestations(num) {
|
|
52
52
|
this.attestationsCount.add(num);
|
|
53
53
|
}
|
|
54
|
-
incFailedAttestations(num, reason) {
|
|
54
|
+
incFailedAttestations(num, reason, inCommittee) {
|
|
55
55
|
this.failedAttestationsCount.add(num, {
|
|
56
|
-
[Attributes.ERROR_TYPE]: reason
|
|
56
|
+
[Attributes.ERROR_TYPE]: reason,
|
|
57
|
+
[Attributes.VALIDATOR_STATUS]: inCommittee ? 'in-committee' : 'none'
|
|
57
58
|
});
|
|
58
59
|
}
|
|
59
60
|
}
|