@aztec/aztec-node 2.1.0-rc.9 → 2.1.1-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dest/aztec-node/config.d.ts +2 -0
- package/dest/aztec-node/config.d.ts.map +1 -1
- package/dest/aztec-node/config.js +5 -0
- package/dest/aztec-node/node_metrics.d.ts +4 -0
- package/dest/aztec-node/node_metrics.d.ts.map +1 -1
- package/dest/aztec-node/node_metrics.js +20 -0
- package/dest/aztec-node/server.d.ts +24 -0
- package/dest/aztec-node/server.d.ts.map +1 -1
- package/dest/aztec-node/server.js +51 -12
- package/dest/sentinel/sentinel.d.ts.map +1 -1
- package/dest/sentinel/sentinel.js +7 -5
- package/package.json +25 -25
- package/src/aztec-node/config.ts +7 -0
- package/src/aztec-node/node_metrics.ts +26 -0
- package/src/aztec-node/server.ts +64 -12
- package/src/sentinel/sentinel.ts +9 -12
|
@@ -21,6 +21,8 @@ export type AztecNodeConfig = ArchiverConfig & SequencerClientConfig & Validator
|
|
|
21
21
|
l1Contracts: L1ContractAddresses;
|
|
22
22
|
/** Whether the validator is disabled for this node */
|
|
23
23
|
disableValidator: boolean;
|
|
24
|
+
/** Whether to skip waiting for the archiver to be fully synced before starting other services */
|
|
25
|
+
skipArchiverInitialSync: boolean;
|
|
24
26
|
};
|
|
25
27
|
export declare const aztecNodeConfigMappings: ConfigMappingsType<AztecNodeConfig>;
|
|
26
28
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/aztec-node/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,cAAc,EAA0B,MAAM,wBAAwB,CAAC;AACrF,OAAO,EACL,KAAK,kBAAkB,EACvB,KAAK,mBAAmB,EAGzB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,KAAK,kBAAkB,EAA8C,MAAM,0BAA0B,CAAC;AAE/G,OAAO,EAAE,KAAK,e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C1B,iGAAiG;IACjG,uBAAuB,EAAE,OAAO,CAAC;CAClC,CAAC;AAEJ,eAAO,MAAM,uBAAuB,EAAE,kBAAkB,CAAC,eAAe,CA4BvE,CAAC;AAEF;;;GAGG;AACH,wBAAgB,gBAAgB,IAAI,eAAe,CAElD;AAoED,wBAAgB,0BAA0B,CACxC,MAAM,EAAE,cAAc,GAAG,qBAAqB,GAAG,gBAAgB,GAChE,QAAQ,GAAG,SAAS,CAMtB"}
|
|
@@ -38,6 +38,11 @@ export const aztecNodeConfigMappings = {
|
|
|
38
38
|
env: 'VALIDATOR_DISABLED',
|
|
39
39
|
description: 'Whether the validator is disabled for this node.',
|
|
40
40
|
...booleanConfigHelper()
|
|
41
|
+
},
|
|
42
|
+
skipArchiverInitialSync: {
|
|
43
|
+
env: 'SKIP_ARCHIVER_INITIAL_SYNC',
|
|
44
|
+
description: 'Whether to skip waiting for the archiver to be fully synced before starting other services.',
|
|
45
|
+
...booleanConfigHelper(false)
|
|
41
46
|
}
|
|
42
47
|
};
|
|
43
48
|
/**
|
|
@@ -2,7 +2,11 @@ import { type TelemetryClient } from '@aztec/telemetry-client';
|
|
|
2
2
|
export declare class NodeMetrics {
|
|
3
3
|
private receiveTxCount;
|
|
4
4
|
private receiveTxDuration;
|
|
5
|
+
private snapshotErrorCount;
|
|
6
|
+
private snapshotDuration;
|
|
5
7
|
constructor(client: TelemetryClient, name?: string);
|
|
6
8
|
receivedTx(durationMs: number, isAccepted: boolean): void;
|
|
9
|
+
recordSnapshot(durationMs: number): void;
|
|
10
|
+
recordSnapshotError(): void;
|
|
7
11
|
}
|
|
8
12
|
//# sourceMappingURL=node_metrics.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"node_metrics.d.ts","sourceRoot":"","sources":["../../src/aztec-node/node_metrics.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,eAAe,EAGrB,MAAM,yBAAyB,CAAC;AAEjC,qBAAa,WAAW;IACtB,OAAO,CAAC,cAAc,CAAgB;IACtC,OAAO,CAAC,iBAAiB,CAAY;
|
|
1
|
+
{"version":3,"file":"node_metrics.d.ts","sourceRoot":"","sources":["../../src/aztec-node/node_metrics.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,eAAe,EAGrB,MAAM,yBAAyB,CAAC;AAEjC,qBAAa,WAAW;IACtB,OAAO,CAAC,cAAc,CAAgB;IACtC,OAAO,CAAC,iBAAiB,CAAY;IAErC,OAAO,CAAC,kBAAkB,CAAgB;IAC1C,OAAO,CAAC,gBAAgB,CAAY;gBAExB,MAAM,EAAE,eAAe,EAAE,IAAI,SAAc;IAqBvD,UAAU,CAAC,UAAU,EAAE,MAAM,EAAE,UAAU,EAAE,OAAO;IASlD,cAAc,CAAC,UAAU,EAAE,MAAM;IAQjC,mBAAmB;CAGpB"}
|
|
@@ -2,6 +2,8 @@ import { Attributes, Metrics, ValueType } from '@aztec/telemetry-client';
|
|
|
2
2
|
export class NodeMetrics {
|
|
3
3
|
receiveTxCount;
|
|
4
4
|
receiveTxDuration;
|
|
5
|
+
snapshotErrorCount;
|
|
6
|
+
snapshotDuration;
|
|
5
7
|
constructor(client, name = 'AztecNode'){
|
|
6
8
|
const meter = client.getMeter(name);
|
|
7
9
|
this.receiveTxCount = meter.createUpDownCounter(Metrics.NODE_RECEIVE_TX_COUNT, {});
|
|
@@ -10,6 +12,15 @@ export class NodeMetrics {
|
|
|
10
12
|
unit: 'ms',
|
|
11
13
|
valueType: ValueType.INT
|
|
12
14
|
});
|
|
15
|
+
this.snapshotDuration = meter.createHistogram(Metrics.NODE_SNAPSHOT_DURATION, {
|
|
16
|
+
description: 'How long taking a snapshot takes',
|
|
17
|
+
unit: 'ms',
|
|
18
|
+
valueType: ValueType.INT
|
|
19
|
+
});
|
|
20
|
+
this.snapshotErrorCount = meter.createUpDownCounter(Metrics.NODE_SNAPSHOT_ERROR_COUNT, {
|
|
21
|
+
description: 'How many snapshot errors have happened',
|
|
22
|
+
valueType: ValueType.INT
|
|
23
|
+
});
|
|
13
24
|
}
|
|
14
25
|
receivedTx(durationMs, isAccepted) {
|
|
15
26
|
this.receiveTxDuration.record(Math.ceil(durationMs), {
|
|
@@ -19,4 +30,13 @@ export class NodeMetrics {
|
|
|
19
30
|
[Attributes.OK]: isAccepted
|
|
20
31
|
});
|
|
21
32
|
}
|
|
33
|
+
recordSnapshot(durationMs) {
|
|
34
|
+
if (isNaN(durationMs)) {
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
this.snapshotDuration.record(Math.ceil(durationMs));
|
|
38
|
+
}
|
|
39
|
+
recordSnapshotError() {
|
|
40
|
+
this.snapshotErrorCount.add(1);
|
|
41
|
+
}
|
|
22
42
|
}
|
|
@@ -100,6 +100,18 @@ export declare class AztecNodeService implements AztecNode, AztecNodeAdmin, Trac
|
|
|
100
100
|
* @returns The requested block.
|
|
101
101
|
*/
|
|
102
102
|
getBlock(number: L2BlockNumber): Promise<L2Block | undefined>;
|
|
103
|
+
/**
|
|
104
|
+
* Get a block specified by its hash.
|
|
105
|
+
* @param blockHash - The block hash being requested.
|
|
106
|
+
* @returns The requested block.
|
|
107
|
+
*/
|
|
108
|
+
getBlockByHash(blockHash: Fr): Promise<L2Block | undefined>;
|
|
109
|
+
/**
|
|
110
|
+
* Get a block specified by its archive root.
|
|
111
|
+
* @param archive - The archive root being requested.
|
|
112
|
+
* @returns The requested block.
|
|
113
|
+
*/
|
|
114
|
+
getBlockByArchive(archive: Fr): Promise<L2Block | undefined>;
|
|
103
115
|
/**
|
|
104
116
|
* Method to request blocks. Will attempt to return all requested blocks but will return only those available.
|
|
105
117
|
* @param from - The start of the range of blocks to return.
|
|
@@ -293,6 +305,18 @@ export declare class AztecNodeService implements AztecNode, AztecNodeAdmin, Trac
|
|
|
293
305
|
* @returns The current committed block header.
|
|
294
306
|
*/
|
|
295
307
|
getBlockHeader(blockNumber?: L2BlockNumber): Promise<BlockHeader | undefined>;
|
|
308
|
+
/**
|
|
309
|
+
* Get a block header specified by its hash.
|
|
310
|
+
* @param blockHash - The block hash being requested.
|
|
311
|
+
* @returns The requested block header.
|
|
312
|
+
*/
|
|
313
|
+
getBlockHeaderByHash(blockHash: Fr): Promise<BlockHeader | undefined>;
|
|
314
|
+
/**
|
|
315
|
+
* Get a block header specified by its archive root.
|
|
316
|
+
* @param archive - The archive root being requested.
|
|
317
|
+
* @returns The requested block header.
|
|
318
|
+
*/
|
|
319
|
+
getBlockHeaderByArchive(archive: Fr): Promise<BlockHeader | undefined>;
|
|
296
320
|
/**
|
|
297
321
|
* Simulates the public part of a transaction with the current state.
|
|
298
322
|
* @param tx - The transaction to simulate.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/aztec-node/server.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,uBAAuB,EAAwB,MAAM,yBAAyB,CAAC;AAC7F,OAAO,EACL,cAAc,EAEd,KAAK,wBAAwB,EAC7B,KAAK,qBAAqB,EAC1B,KAAK,qBAAqB,EAC1B,KAAK,uBAAuB,EAC7B,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAc,KAAK,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAC1E,OAAO,EACL,KAAK,mBAAmB,EAKzB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAC3D,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAE9C,OAAO,EAAE,KAAK,MAAM,EAAgB,MAAM,uBAAuB,CAAC;AAGlE,OAAO,EAAE,YAAY,EAAS,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAIzE,OAAO,EAAE,KAAK,GAAG,EAAE,KAAK,aAAa,EAAoD,MAAM,YAAY,CAAC;AAE5G,OAAO,EAGL,eAAe,EACf,KAAK,kBAAkB,EAExB,MAA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IAAI,OAAO,CAAC,yBAAyB,CAAC;IASlE,kCAAkC,CAAC,UAAU,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAIvE,kBAAkB,IAAI,OAAO,CAAC,eAAe,CAAC;IAI9C,iBAAiB,CACtB,gBAAgB,EAAE,UAAU,EAC5B,QAAQ,CAAC,EAAE,MAAM,EACjB,MAAM,CAAC,EAAE,MAAM,GACd,OAAO,CAAC,oBAAoB,GAAG,SAAS,CAAC;IAI/B,mBAAmB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IA4CpD,UAAU,CAAC,WAAW,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;IAoC/D,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC;IAMhC,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAO3B,gBAAgB,IAAI,OAAO,CAAC,iBAAiB,EAAE,CAAC;IAOhD,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,KAAK,GAAG,SAAS,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC;CAiD/E"}
|
|
@@ -182,7 +182,7 @@ import { NodeMetrics } from './node_metrics.js';
|
|
|
182
182
|
telemetry,
|
|
183
183
|
dateProvider
|
|
184
184
|
}, {
|
|
185
|
-
blockUntilSync:
|
|
185
|
+
blockUntilSync: !config.skipArchiverInitialSync
|
|
186
186
|
});
|
|
187
187
|
// now create the merkle trees and the world state synchronizer
|
|
188
188
|
const worldStateSynchronizer = await createWorldStateSynchronizer(config, archiver, options.prefilledPublicData, telemetry);
|
|
@@ -193,7 +193,8 @@ import { NodeMetrics } from './node_metrics.js';
|
|
|
193
193
|
const proofVerifier = new QueuedIVCVerifier(config, circuitVerifier);
|
|
194
194
|
// create the tx pool and the p2p client, which will need the l2 block source
|
|
195
195
|
const p2pClient = await createP2PClient(P2PClientType.Full, config, archiver, proofVerifier, worldStateSynchronizer, epochCache, packageVersion, dateProvider, telemetry, deps.p2pClientDeps);
|
|
196
|
-
//
|
|
196
|
+
// Start world state and wait for it to sync to the archiver.
|
|
197
|
+
await worldStateSynchronizer.start();
|
|
197
198
|
config.txPublicSetupAllowList = config.txPublicSetupAllowList ?? await getDefaultAllowedSetupFunctions();
|
|
198
199
|
const blockBuilder = new BlockBuilder({
|
|
199
200
|
...config,
|
|
@@ -241,26 +242,28 @@ import { NodeMetrics } from './node_metrics.js';
|
|
|
241
242
|
// Start p2p. Note that it depends on world state to be running.
|
|
242
243
|
await p2pClient.start();
|
|
243
244
|
const validatorsSentinel = await createSentinel(epochCache, archiver, p2pClient, config);
|
|
244
|
-
if (validatorsSentinel) {
|
|
245
|
-
|
|
246
|
-
await validatorsSentinel.start();
|
|
247
|
-
if (config.slashInactivityPenalty > 0n) {
|
|
248
|
-
watchers.push(validatorsSentinel);
|
|
249
|
-
}
|
|
245
|
+
if (validatorsSentinel && config.slashInactivityPenalty > 0n) {
|
|
246
|
+
watchers.push(validatorsSentinel);
|
|
250
247
|
}
|
|
251
248
|
let epochPruneWatcher;
|
|
252
249
|
if (config.slashPrunePenalty > 0n || config.slashDataWithholdingPenalty > 0n) {
|
|
253
250
|
epochPruneWatcher = new EpochPruneWatcher(archiver, archiver, epochCache, p2pClient.getTxProvider(), blockBuilder, config);
|
|
254
|
-
await epochPruneWatcher.start();
|
|
255
251
|
watchers.push(epochPruneWatcher);
|
|
256
252
|
}
|
|
257
253
|
// We assume we want to slash for invalid attestations unless all max penalties are set to 0
|
|
258
254
|
let attestationsBlockWatcher;
|
|
259
255
|
if (config.slashProposeInvalidAttestationsPenalty > 0n || config.slashAttestDescendantOfInvalidPenalty > 0n) {
|
|
260
256
|
attestationsBlockWatcher = new AttestationsBlockWatcher(archiver, epochCache, config);
|
|
261
|
-
await attestationsBlockWatcher.start();
|
|
262
257
|
watchers.push(attestationsBlockWatcher);
|
|
263
258
|
}
|
|
259
|
+
// Start p2p-related services once the archiver has completed sync
|
|
260
|
+
void archiver.waitForInitialSync().then(async ()=>{
|
|
261
|
+
await p2pClient.start();
|
|
262
|
+
await validatorsSentinel?.start();
|
|
263
|
+
await epochPruneWatcher?.start();
|
|
264
|
+
await attestationsBlockWatcher?.start();
|
|
265
|
+
log.info(`All p2p services started`);
|
|
266
|
+
}).catch((err)=>log.error('Failed to start p2p services after archiver sync', err));
|
|
264
267
|
log.verbose(`All Aztec Node subsystems synced`);
|
|
265
268
|
// Validator enabled, create/start relevant service
|
|
266
269
|
let sequencer;
|
|
@@ -279,9 +282,8 @@ import { NodeMetrics } from './node_metrics.js';
|
|
|
279
282
|
logger: log.createChild('l1-tx-utils'),
|
|
280
283
|
dateProvider
|
|
281
284
|
});
|
|
285
|
+
// Create and start the sequencer client
|
|
282
286
|
sequencer = await SequencerClient.new(config, {
|
|
283
|
-
// if deps were provided, they should override the defaults,
|
|
284
|
-
// or things that we created in this function
|
|
285
287
|
...deps,
|
|
286
288
|
epochCache,
|
|
287
289
|
l1TxUtils,
|
|
@@ -364,6 +366,22 @@ import { NodeMetrics } from './node_metrics.js';
|
|
|
364
366
|
return await this.blockSource.getBlock(blockNumber);
|
|
365
367
|
}
|
|
366
368
|
/**
|
|
369
|
+
* Get a block specified by its hash.
|
|
370
|
+
* @param blockHash - The block hash being requested.
|
|
371
|
+
* @returns The requested block.
|
|
372
|
+
*/ async getBlockByHash(blockHash) {
|
|
373
|
+
const publishedBlock = await this.blockSource.getPublishedBlockByHash(blockHash);
|
|
374
|
+
return publishedBlock?.block;
|
|
375
|
+
}
|
|
376
|
+
/**
|
|
377
|
+
* Get a block specified by its archive root.
|
|
378
|
+
* @param archive - The archive root being requested.
|
|
379
|
+
* @returns The requested block.
|
|
380
|
+
*/ async getBlockByArchive(archive) {
|
|
381
|
+
const publishedBlock = await this.blockSource.getPublishedBlockByArchive(archive);
|
|
382
|
+
return publishedBlock?.block;
|
|
383
|
+
}
|
|
384
|
+
/**
|
|
367
385
|
* Method to request blocks. Will attempt to return all requested blocks but will return only those available.
|
|
368
386
|
* @param from - The start of the range of blocks to return.
|
|
369
387
|
* @param limit - The maximum number of blocks to obtain.
|
|
@@ -756,6 +774,20 @@ import { NodeMetrics } from './node_metrics.js';
|
|
|
756
774
|
return blockNumber === 0 || blockNumber === 'latest' && await this.blockSource.getBlockNumber() === 0 ? this.worldStateSynchronizer.getCommitted().getInitialHeader() : this.blockSource.getBlockHeader(blockNumber);
|
|
757
775
|
}
|
|
758
776
|
/**
|
|
777
|
+
* Get a block header specified by its hash.
|
|
778
|
+
* @param blockHash - The block hash being requested.
|
|
779
|
+
* @returns The requested block header.
|
|
780
|
+
*/ async getBlockHeaderByHash(blockHash) {
|
|
781
|
+
return await this.blockSource.getBlockHeaderByHash(blockHash);
|
|
782
|
+
}
|
|
783
|
+
/**
|
|
784
|
+
* Get a block header specified by its archive root.
|
|
785
|
+
* @param archive - The archive root being requested.
|
|
786
|
+
* @returns The requested block header.
|
|
787
|
+
*/ async getBlockHeaderByArchive(archive) {
|
|
788
|
+
return await this.blockSource.getBlockHeaderByArchive(archive);
|
|
789
|
+
}
|
|
790
|
+
/**
|
|
759
791
|
* Simulates the public part of a transaction with the current state.
|
|
760
792
|
* @param tx - The transaction to simulate.
|
|
761
793
|
**/ async simulatePublicCalls(tx, skipFeeEnforcement = false) {
|
|
@@ -864,26 +896,33 @@ import { NodeMetrics } from './node_metrics.js';
|
|
|
864
896
|
// We break support for archiver running remotely to the node
|
|
865
897
|
const archiver = this.blockSource;
|
|
866
898
|
if (!('backupTo' in archiver)) {
|
|
899
|
+
this.metrics.recordSnapshotError();
|
|
867
900
|
throw new Error('Archiver implementation does not support backups. Cannot generate snapshot.');
|
|
868
901
|
}
|
|
869
902
|
// Test that the archiver has done an initial sync.
|
|
870
903
|
if (!archiver.isInitialSyncComplete()) {
|
|
904
|
+
this.metrics.recordSnapshotError();
|
|
871
905
|
throw new Error(`Archiver initial sync not complete. Cannot start snapshot.`);
|
|
872
906
|
}
|
|
873
907
|
// And it has an L2 block hash
|
|
874
908
|
const l2BlockHash = await archiver.getL2Tips().then((tips)=>tips.latest.hash);
|
|
875
909
|
if (!l2BlockHash) {
|
|
910
|
+
this.metrics.recordSnapshotError();
|
|
876
911
|
throw new Error(`Archiver has no latest L2 block hash downloaded. Cannot start snapshot.`);
|
|
877
912
|
}
|
|
878
913
|
if (this.isUploadingSnapshot) {
|
|
914
|
+
this.metrics.recordSnapshotError();
|
|
879
915
|
throw new Error(`Snapshot upload already in progress. Cannot start another one until complete.`);
|
|
880
916
|
}
|
|
881
917
|
// Do not wait for the upload to be complete to return to the caller, but flag that an operation is in progress
|
|
882
918
|
this.isUploadingSnapshot = true;
|
|
919
|
+
const timer = new Timer();
|
|
883
920
|
void uploadSnapshot(location, this.blockSource, this.worldStateSynchronizer, this.config, this.log).then(()=>{
|
|
884
921
|
this.isUploadingSnapshot = false;
|
|
922
|
+
this.metrics.recordSnapshot(timer.ms());
|
|
885
923
|
}).catch((err)=>{
|
|
886
924
|
this.isUploadingSnapshot = false;
|
|
925
|
+
this.metrics.recordSnapshotError();
|
|
887
926
|
this.log.error(`Error uploading snapshot: ${err}`);
|
|
888
927
|
});
|
|
889
928
|
return Promise.resolve();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sentinel.d.ts","sourceRoot":"","sources":["../../src/sentinel/sentinel.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"sentinel.d.ts","sourceRoot":"","sources":["../../src/sentinel/sentinel.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAErD,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAE3D,OAAO,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AACnE,OAAO,EAAqB,KAAK,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAC7E,OAAO,KAAK,EAAE,SAAS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MAAM,CAAC,EAAE,MAAM,CAAC;QAAC,UAAU,CAAC,EAAE,UAAU,EAAE,CAAA;KAAO,GAAG,OAAO,CAAC,eAAe,CAAC;IAqBpG,6CAA6C;IAChC,iBAAiB,CAC5B,gBAAgB,EAAE,UAAU,EAC5B,QAAQ,CAAC,EAAE,MAAM,EACjB,MAAM,CAAC,EAAE,MAAM,GACd,OAAO,CAAC,oBAAoB,GAAG,SAAS,CAAC;IAoC5C,SAAS,CAAC,wBAAwB,CAChC,OAAO,EAAE,KAAK,MAAM,EAAE,EACtB,UAAU,EAAE,sBAAsB,EAClC,QAAQ,CAAC,EAAE,MAAM,EACjB,MAAM,CAAC,EAAE,MAAM,GACd,cAAc;IAgBjB,SAAS,CAAC,aAAa,CACrB,OAAO,EAAE,sBAAsB,EAC/B,iBAAiB,EAAE,mBAAmB,GAAG,SAAS,EAClD,MAAM,EAAE,qBAAqB,EAAE;;;;;;IAYjC,SAAS,CAAC,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS;;;;;CAOnD"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { countWhile, filterAsync, fromEntries, getEntries, mapValues } from '@aztec/foundation/collection';
|
|
2
2
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
3
3
|
import { createLogger } from '@aztec/foundation/log';
|
|
4
4
|
import { RunningPromise } from '@aztec/foundation/running-promise';
|
|
5
5
|
import { L2TipsMemoryStore } from '@aztec/kv-store/stores';
|
|
6
6
|
import { OffenseType, WANT_TO_SLASH_EVENT } from '@aztec/slasher';
|
|
7
|
-
import { L2BlockStream,
|
|
7
|
+
import { L2BlockStream, getAttestationInfoFromPublishedL2Block } from '@aztec/stdlib/block';
|
|
8
8
|
import { getEpochAtSlot, getSlotRangeForEpoch, getTimestampForSlot } from '@aztec/stdlib/epoch-helpers';
|
|
9
9
|
import EventEmitter from 'node:events';
|
|
10
10
|
export class Sentinel extends EventEmitter {
|
|
@@ -55,7 +55,7 @@ export class Sentinel extends EventEmitter {
|
|
|
55
55
|
this.slotNumberToBlock.set(block.block.header.getSlot(), {
|
|
56
56
|
blockNumber: block.block.number,
|
|
57
57
|
archive: block.block.archive.root.toString(),
|
|
58
|
-
attestors:
|
|
58
|
+
attestors: getAttestationInfoFromPublishedL2Block(block).filter((a)=>a.status === 'recovered-from-signature').map((a)=>a.address)
|
|
59
59
|
});
|
|
60
60
|
}
|
|
61
61
|
// Prune the archive map to only keep at most N entries
|
|
@@ -206,7 +206,7 @@ export class Sentinel extends EventEmitter {
|
|
|
206
206
|
return false;
|
|
207
207
|
}
|
|
208
208
|
const archiverSlot = await this.archiver.getL2SlotNumber();
|
|
209
|
-
if (archiverSlot < targetSlot) {
|
|
209
|
+
if (archiverSlot === undefined || archiverSlot < targetSlot) {
|
|
210
210
|
this.logger.debug(`Waiting for archiver to sync with L2 slot ${targetSlot}`, {
|
|
211
211
|
archiverSlot,
|
|
212
212
|
targetSlot
|
|
@@ -256,8 +256,10 @@ export class Sentinel extends EventEmitter {
|
|
|
256
256
|
// (contains the ones synced from mined blocks, which we may have missed from p2p).
|
|
257
257
|
const block = this.slotNumberToBlock.get(slot);
|
|
258
258
|
const p2pAttested = await this.p2p.getAttestationsForSlot(slot, block?.archive);
|
|
259
|
+
// Filter out attestations with invalid signatures
|
|
260
|
+
const p2pAttestors = p2pAttested.map((a)=>a.getSender()).filter((s)=>s !== undefined);
|
|
259
261
|
const attestors = new Set([
|
|
260
|
-
...
|
|
262
|
+
...p2pAttestors.map((a)=>a.toString()),
|
|
261
263
|
...block?.attestors.map((a)=>a.toString()) ?? []
|
|
262
264
|
].filter((addr)=>proposer.toString() !== addr));
|
|
263
265
|
// We assume that there was a block proposal if at least one of the validators (other than the proposer) attested to it.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/aztec-node",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.1-rc.1",
|
|
4
4
|
"main": "dest/index.js",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -66,33 +66,33 @@
|
|
|
66
66
|
]
|
|
67
67
|
},
|
|
68
68
|
"dependencies": {
|
|
69
|
-
"@aztec/archiver": "2.1.
|
|
70
|
-
"@aztec/bb-prover": "2.1.
|
|
71
|
-
"@aztec/blob-sink": "2.1.
|
|
72
|
-
"@aztec/constants": "2.1.
|
|
73
|
-
"@aztec/epoch-cache": "2.1.
|
|
74
|
-
"@aztec/ethereum": "2.1.
|
|
75
|
-
"@aztec/foundation": "2.1.
|
|
76
|
-
"@aztec/kv-store": "2.1.
|
|
77
|
-
"@aztec/l1-artifacts": "2.1.
|
|
78
|
-
"@aztec/merkle-tree": "2.1.
|
|
79
|
-
"@aztec/node-keystore": "2.1.
|
|
80
|
-
"@aztec/node-lib": "2.1.
|
|
81
|
-
"@aztec/noir-protocol-circuits-types": "2.1.
|
|
82
|
-
"@aztec/p2p": "2.1.
|
|
83
|
-
"@aztec/protocol-contracts": "2.1.
|
|
84
|
-
"@aztec/prover-client": "2.1.
|
|
85
|
-
"@aztec/sequencer-client": "2.1.
|
|
86
|
-
"@aztec/simulator": "2.1.
|
|
87
|
-
"@aztec/slasher": "2.1.
|
|
88
|
-
"@aztec/stdlib": "2.1.
|
|
89
|
-
"@aztec/telemetry-client": "2.1.
|
|
90
|
-
"@aztec/validator-client": "2.1.
|
|
91
|
-
"@aztec/world-state": "2.1.
|
|
69
|
+
"@aztec/archiver": "2.1.1-rc.1",
|
|
70
|
+
"@aztec/bb-prover": "2.1.1-rc.1",
|
|
71
|
+
"@aztec/blob-sink": "2.1.1-rc.1",
|
|
72
|
+
"@aztec/constants": "2.1.1-rc.1",
|
|
73
|
+
"@aztec/epoch-cache": "2.1.1-rc.1",
|
|
74
|
+
"@aztec/ethereum": "2.1.1-rc.1",
|
|
75
|
+
"@aztec/foundation": "2.1.1-rc.1",
|
|
76
|
+
"@aztec/kv-store": "2.1.1-rc.1",
|
|
77
|
+
"@aztec/l1-artifacts": "2.1.1-rc.1",
|
|
78
|
+
"@aztec/merkle-tree": "2.1.1-rc.1",
|
|
79
|
+
"@aztec/node-keystore": "2.1.1-rc.1",
|
|
80
|
+
"@aztec/node-lib": "2.1.1-rc.1",
|
|
81
|
+
"@aztec/noir-protocol-circuits-types": "2.1.1-rc.1",
|
|
82
|
+
"@aztec/p2p": "2.1.1-rc.1",
|
|
83
|
+
"@aztec/protocol-contracts": "2.1.1-rc.1",
|
|
84
|
+
"@aztec/prover-client": "2.1.1-rc.1",
|
|
85
|
+
"@aztec/sequencer-client": "2.1.1-rc.1",
|
|
86
|
+
"@aztec/simulator": "2.1.1-rc.1",
|
|
87
|
+
"@aztec/slasher": "2.1.1-rc.1",
|
|
88
|
+
"@aztec/stdlib": "2.1.1-rc.1",
|
|
89
|
+
"@aztec/telemetry-client": "2.1.1-rc.1",
|
|
90
|
+
"@aztec/validator-client": "2.1.1-rc.1",
|
|
91
|
+
"@aztec/world-state": "2.1.1-rc.1",
|
|
92
92
|
"koa": "^2.16.1",
|
|
93
93
|
"koa-router": "^13.1.1",
|
|
94
94
|
"tslib": "^2.4.0",
|
|
95
|
-
"viem": "2.
|
|
95
|
+
"viem": "npm:@spalladino/viem@2.38.2-eip7594.0"
|
|
96
96
|
},
|
|
97
97
|
"devDependencies": {
|
|
98
98
|
"@jest/globals": "^30.0.0",
|
package/src/aztec-node/config.ts
CHANGED
|
@@ -55,6 +55,8 @@ export type AztecNodeConfig = ArchiverConfig &
|
|
|
55
55
|
l1Contracts: L1ContractAddresses;
|
|
56
56
|
/** Whether the validator is disabled for this node */
|
|
57
57
|
disableValidator: boolean;
|
|
58
|
+
/** Whether to skip waiting for the archiver to be fully synced before starting other services */
|
|
59
|
+
skipArchiverInitialSync: boolean;
|
|
58
60
|
};
|
|
59
61
|
|
|
60
62
|
export const aztecNodeConfigMappings: ConfigMappingsType<AztecNodeConfig> = {
|
|
@@ -80,6 +82,11 @@ export const aztecNodeConfigMappings: ConfigMappingsType<AztecNodeConfig> = {
|
|
|
80
82
|
description: 'Whether the validator is disabled for this node.',
|
|
81
83
|
...booleanConfigHelper(),
|
|
82
84
|
},
|
|
85
|
+
skipArchiverInitialSync: {
|
|
86
|
+
env: 'SKIP_ARCHIVER_INITIAL_SYNC',
|
|
87
|
+
description: 'Whether to skip waiting for the archiver to be fully synced before starting other services.',
|
|
88
|
+
...booleanConfigHelper(false),
|
|
89
|
+
},
|
|
83
90
|
};
|
|
84
91
|
|
|
85
92
|
/**
|
|
@@ -11,6 +11,9 @@ export class NodeMetrics {
|
|
|
11
11
|
private receiveTxCount: UpDownCounter;
|
|
12
12
|
private receiveTxDuration: Histogram;
|
|
13
13
|
|
|
14
|
+
private snapshotErrorCount: UpDownCounter;
|
|
15
|
+
private snapshotDuration: Histogram;
|
|
16
|
+
|
|
14
17
|
constructor(client: TelemetryClient, name = 'AztecNode') {
|
|
15
18
|
const meter = client.getMeter(name);
|
|
16
19
|
this.receiveTxCount = meter.createUpDownCounter(Metrics.NODE_RECEIVE_TX_COUNT, {});
|
|
@@ -19,6 +22,17 @@ export class NodeMetrics {
|
|
|
19
22
|
unit: 'ms',
|
|
20
23
|
valueType: ValueType.INT,
|
|
21
24
|
});
|
|
25
|
+
|
|
26
|
+
this.snapshotDuration = meter.createHistogram(Metrics.NODE_SNAPSHOT_DURATION, {
|
|
27
|
+
description: 'How long taking a snapshot takes',
|
|
28
|
+
unit: 'ms',
|
|
29
|
+
valueType: ValueType.INT,
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
this.snapshotErrorCount = meter.createUpDownCounter(Metrics.NODE_SNAPSHOT_ERROR_COUNT, {
|
|
33
|
+
description: 'How many snapshot errors have happened',
|
|
34
|
+
valueType: ValueType.INT,
|
|
35
|
+
});
|
|
22
36
|
}
|
|
23
37
|
|
|
24
38
|
receivedTx(durationMs: number, isAccepted: boolean) {
|
|
@@ -29,4 +43,16 @@ export class NodeMetrics {
|
|
|
29
43
|
[Attributes.OK]: isAccepted,
|
|
30
44
|
});
|
|
31
45
|
}
|
|
46
|
+
|
|
47
|
+
recordSnapshot(durationMs: number) {
|
|
48
|
+
if (isNaN(durationMs)) {
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
this.snapshotDuration.record(Math.ceil(durationMs));
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
recordSnapshotError() {
|
|
56
|
+
this.snapshotErrorCount.add(1);
|
|
57
|
+
}
|
|
32
58
|
}
|
package/src/aztec-node/server.ts
CHANGED
|
@@ -276,7 +276,7 @@ export class AztecNodeService implements AztecNode, AztecNodeAdmin, Traceable {
|
|
|
276
276
|
const archiver = await createArchiver(
|
|
277
277
|
config,
|
|
278
278
|
{ blobSinkClient, epochCache, telemetry, dateProvider },
|
|
279
|
-
{ blockUntilSync:
|
|
279
|
+
{ blockUntilSync: !config.skipArchiverInitialSync },
|
|
280
280
|
);
|
|
281
281
|
|
|
282
282
|
// now create the merkle trees and the world state synchronizer
|
|
@@ -306,7 +306,9 @@ export class AztecNodeService implements AztecNode, AztecNodeAdmin, Traceable {
|
|
|
306
306
|
deps.p2pClientDeps,
|
|
307
307
|
);
|
|
308
308
|
|
|
309
|
-
//
|
|
309
|
+
// Start world state and wait for it to sync to the archiver.
|
|
310
|
+
await worldStateSynchronizer.start();
|
|
311
|
+
|
|
310
312
|
config.txPublicSetupAllowList = config.txPublicSetupAllowList ?? (await getDefaultAllowedSetupFunctions());
|
|
311
313
|
|
|
312
314
|
const blockBuilder = new BlockBuilder(
|
|
@@ -364,12 +366,8 @@ export class AztecNodeService implements AztecNode, AztecNodeAdmin, Traceable {
|
|
|
364
366
|
await p2pClient.start();
|
|
365
367
|
|
|
366
368
|
const validatorsSentinel = await createSentinel(epochCache, archiver, p2pClient, config);
|
|
367
|
-
if (validatorsSentinel) {
|
|
368
|
-
|
|
369
|
-
await validatorsSentinel.start();
|
|
370
|
-
if (config.slashInactivityPenalty > 0n) {
|
|
371
|
-
watchers.push(validatorsSentinel);
|
|
372
|
-
}
|
|
369
|
+
if (validatorsSentinel && config.slashInactivityPenalty > 0n) {
|
|
370
|
+
watchers.push(validatorsSentinel);
|
|
373
371
|
}
|
|
374
372
|
|
|
375
373
|
let epochPruneWatcher: EpochPruneWatcher | undefined;
|
|
@@ -382,7 +380,6 @@ export class AztecNodeService implements AztecNode, AztecNodeAdmin, Traceable {
|
|
|
382
380
|
blockBuilder,
|
|
383
381
|
config,
|
|
384
382
|
);
|
|
385
|
-
await epochPruneWatcher.start();
|
|
386
383
|
watchers.push(epochPruneWatcher);
|
|
387
384
|
}
|
|
388
385
|
|
|
@@ -390,10 +387,21 @@ export class AztecNodeService implements AztecNode, AztecNodeAdmin, Traceable {
|
|
|
390
387
|
let attestationsBlockWatcher: AttestationsBlockWatcher | undefined;
|
|
391
388
|
if (config.slashProposeInvalidAttestationsPenalty > 0n || config.slashAttestDescendantOfInvalidPenalty > 0n) {
|
|
392
389
|
attestationsBlockWatcher = new AttestationsBlockWatcher(archiver, epochCache, config);
|
|
393
|
-
await attestationsBlockWatcher.start();
|
|
394
390
|
watchers.push(attestationsBlockWatcher);
|
|
395
391
|
}
|
|
396
392
|
|
|
393
|
+
// Start p2p-related services once the archiver has completed sync
|
|
394
|
+
void archiver
|
|
395
|
+
.waitForInitialSync()
|
|
396
|
+
.then(async () => {
|
|
397
|
+
await p2pClient.start();
|
|
398
|
+
await validatorsSentinel?.start();
|
|
399
|
+
await epochPruneWatcher?.start();
|
|
400
|
+
await attestationsBlockWatcher?.start();
|
|
401
|
+
log.info(`All p2p services started`);
|
|
402
|
+
})
|
|
403
|
+
.catch(err => log.error('Failed to start p2p services after archiver sync', err));
|
|
404
|
+
|
|
397
405
|
log.verbose(`All Aztec Node subsystems synced`);
|
|
398
406
|
|
|
399
407
|
// Validator enabled, create/start relevant service
|
|
@@ -426,9 +434,8 @@ export class AztecNodeService implements AztecNode, AztecNodeAdmin, Traceable {
|
|
|
426
434
|
{ telemetry, logger: log.createChild('l1-tx-utils'), dateProvider },
|
|
427
435
|
);
|
|
428
436
|
|
|
437
|
+
// Create and start the sequencer client
|
|
429
438
|
sequencer = await SequencerClient.new(config, {
|
|
430
|
-
// if deps were provided, they should override the defaults,
|
|
431
|
-
// or things that we created in this function
|
|
432
439
|
...deps,
|
|
433
440
|
epochCache,
|
|
434
441
|
l1TxUtils,
|
|
@@ -548,6 +555,26 @@ export class AztecNodeService implements AztecNode, AztecNodeAdmin, Traceable {
|
|
|
548
555
|
return await this.blockSource.getBlock(blockNumber);
|
|
549
556
|
}
|
|
550
557
|
|
|
558
|
+
/**
|
|
559
|
+
* Get a block specified by its hash.
|
|
560
|
+
* @param blockHash - The block hash being requested.
|
|
561
|
+
* @returns The requested block.
|
|
562
|
+
*/
|
|
563
|
+
public async getBlockByHash(blockHash: Fr): Promise<L2Block | undefined> {
|
|
564
|
+
const publishedBlock = await this.blockSource.getPublishedBlockByHash(blockHash);
|
|
565
|
+
return publishedBlock?.block;
|
|
566
|
+
}
|
|
567
|
+
|
|
568
|
+
/**
|
|
569
|
+
* Get a block specified by its archive root.
|
|
570
|
+
* @param archive - The archive root being requested.
|
|
571
|
+
* @returns The requested block.
|
|
572
|
+
*/
|
|
573
|
+
public async getBlockByArchive(archive: Fr): Promise<L2Block | undefined> {
|
|
574
|
+
const publishedBlock = await this.blockSource.getPublishedBlockByArchive(archive);
|
|
575
|
+
return publishedBlock?.block;
|
|
576
|
+
}
|
|
577
|
+
|
|
551
578
|
/**
|
|
552
579
|
* Method to request blocks. Will attempt to return all requested blocks but will return only those available.
|
|
553
580
|
* @param from - The start of the range of blocks to return.
|
|
@@ -1056,6 +1083,24 @@ export class AztecNodeService implements AztecNode, AztecNodeAdmin, Traceable {
|
|
|
1056
1083
|
: this.blockSource.getBlockHeader(blockNumber);
|
|
1057
1084
|
}
|
|
1058
1085
|
|
|
1086
|
+
/**
|
|
1087
|
+
* Get a block header specified by its hash.
|
|
1088
|
+
* @param blockHash - The block hash being requested.
|
|
1089
|
+
* @returns The requested block header.
|
|
1090
|
+
*/
|
|
1091
|
+
public async getBlockHeaderByHash(blockHash: Fr): Promise<BlockHeader | undefined> {
|
|
1092
|
+
return await this.blockSource.getBlockHeaderByHash(blockHash);
|
|
1093
|
+
}
|
|
1094
|
+
|
|
1095
|
+
/**
|
|
1096
|
+
* Get a block header specified by its archive root.
|
|
1097
|
+
* @param archive - The archive root being requested.
|
|
1098
|
+
* @returns The requested block header.
|
|
1099
|
+
*/
|
|
1100
|
+
public async getBlockHeaderByArchive(archive: Fr): Promise<BlockHeader | undefined> {
|
|
1101
|
+
return await this.blockSource.getBlockHeaderByArchive(archive);
|
|
1102
|
+
}
|
|
1103
|
+
|
|
1059
1104
|
/**
|
|
1060
1105
|
* Simulates the public part of a transaction with the current state.
|
|
1061
1106
|
* @param tx - The transaction to simulate.
|
|
@@ -1209,32 +1254,39 @@ export class AztecNodeService implements AztecNode, AztecNodeAdmin, Traceable {
|
|
|
1209
1254
|
// We break support for archiver running remotely to the node
|
|
1210
1255
|
const archiver = this.blockSource as Archiver;
|
|
1211
1256
|
if (!('backupTo' in archiver)) {
|
|
1257
|
+
this.metrics.recordSnapshotError();
|
|
1212
1258
|
throw new Error('Archiver implementation does not support backups. Cannot generate snapshot.');
|
|
1213
1259
|
}
|
|
1214
1260
|
|
|
1215
1261
|
// Test that the archiver has done an initial sync.
|
|
1216
1262
|
if (!archiver.isInitialSyncComplete()) {
|
|
1263
|
+
this.metrics.recordSnapshotError();
|
|
1217
1264
|
throw new Error(`Archiver initial sync not complete. Cannot start snapshot.`);
|
|
1218
1265
|
}
|
|
1219
1266
|
|
|
1220
1267
|
// And it has an L2 block hash
|
|
1221
1268
|
const l2BlockHash = await archiver.getL2Tips().then(tips => tips.latest.hash);
|
|
1222
1269
|
if (!l2BlockHash) {
|
|
1270
|
+
this.metrics.recordSnapshotError();
|
|
1223
1271
|
throw new Error(`Archiver has no latest L2 block hash downloaded. Cannot start snapshot.`);
|
|
1224
1272
|
}
|
|
1225
1273
|
|
|
1226
1274
|
if (this.isUploadingSnapshot) {
|
|
1275
|
+
this.metrics.recordSnapshotError();
|
|
1227
1276
|
throw new Error(`Snapshot upload already in progress. Cannot start another one until complete.`);
|
|
1228
1277
|
}
|
|
1229
1278
|
|
|
1230
1279
|
// Do not wait for the upload to be complete to return to the caller, but flag that an operation is in progress
|
|
1231
1280
|
this.isUploadingSnapshot = true;
|
|
1281
|
+
const timer = new Timer();
|
|
1232
1282
|
void uploadSnapshot(location, this.blockSource as Archiver, this.worldStateSynchronizer, this.config, this.log)
|
|
1233
1283
|
.then(() => {
|
|
1234
1284
|
this.isUploadingSnapshot = false;
|
|
1285
|
+
this.metrics.recordSnapshot(timer.ms());
|
|
1235
1286
|
})
|
|
1236
1287
|
.catch(err => {
|
|
1237
1288
|
this.isUploadingSnapshot = false;
|
|
1289
|
+
this.metrics.recordSnapshotError();
|
|
1238
1290
|
this.log.error(`Error uploading snapshot: ${err}`);
|
|
1239
1291
|
});
|
|
1240
1292
|
|
package/src/sentinel/sentinel.ts
CHANGED
|
@@ -1,12 +1,5 @@
|
|
|
1
1
|
import type { EpochCache } from '@aztec/epoch-cache';
|
|
2
|
-
import {
|
|
3
|
-
compactArray,
|
|
4
|
-
countWhile,
|
|
5
|
-
filterAsync,
|
|
6
|
-
fromEntries,
|
|
7
|
-
getEntries,
|
|
8
|
-
mapValues,
|
|
9
|
-
} from '@aztec/foundation/collection';
|
|
2
|
+
import { countWhile, filterAsync, fromEntries, getEntries, mapValues } from '@aztec/foundation/collection';
|
|
10
3
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
11
4
|
import { createLogger } from '@aztec/foundation/log';
|
|
12
5
|
import { RunningPromise } from '@aztec/foundation/running-promise';
|
|
@@ -25,7 +18,7 @@ import {
|
|
|
25
18
|
L2BlockStream,
|
|
26
19
|
type L2BlockStreamEvent,
|
|
27
20
|
type L2BlockStreamEventHandler,
|
|
28
|
-
|
|
21
|
+
getAttestationInfoFromPublishedL2Block,
|
|
29
22
|
} from '@aztec/stdlib/block';
|
|
30
23
|
import { getEpochAtSlot, getSlotRangeForEpoch, getTimestampForSlot } from '@aztec/stdlib/epoch-helpers';
|
|
31
24
|
import type {
|
|
@@ -98,7 +91,9 @@ export class Sentinel extends (EventEmitter as new () => WatcherEmitter) impleme
|
|
|
98
91
|
this.slotNumberToBlock.set(block.block.header.getSlot(), {
|
|
99
92
|
blockNumber: block.block.number,
|
|
100
93
|
archive: block.block.archive.root.toString(),
|
|
101
|
-
attestors:
|
|
94
|
+
attestors: getAttestationInfoFromPublishedL2Block(block)
|
|
95
|
+
.filter(a => a.status === 'recovered-from-signature')
|
|
96
|
+
.map(a => a.address!),
|
|
102
97
|
});
|
|
103
98
|
}
|
|
104
99
|
|
|
@@ -279,7 +274,7 @@ export class Sentinel extends (EventEmitter as new () => WatcherEmitter) impleme
|
|
|
279
274
|
}
|
|
280
275
|
|
|
281
276
|
const archiverSlot = await this.archiver.getL2SlotNumber();
|
|
282
|
-
if (archiverSlot < targetSlot) {
|
|
277
|
+
if (archiverSlot === undefined || archiverSlot < targetSlot) {
|
|
283
278
|
this.logger.debug(`Waiting for archiver to sync with L2 slot ${targetSlot}`, { archiverSlot, targetSlot });
|
|
284
279
|
return false;
|
|
285
280
|
}
|
|
@@ -326,8 +321,10 @@ export class Sentinel extends (EventEmitter as new () => WatcherEmitter) impleme
|
|
|
326
321
|
// (contains the ones synced from mined blocks, which we may have missed from p2p).
|
|
327
322
|
const block = this.slotNumberToBlock.get(slot);
|
|
328
323
|
const p2pAttested = await this.p2p.getAttestationsForSlot(slot, block?.archive);
|
|
324
|
+
// Filter out attestations with invalid signatures
|
|
325
|
+
const p2pAttestors = p2pAttested.map(a => a.getSender()).filter((s): s is EthAddress => s !== undefined);
|
|
329
326
|
const attestors = new Set(
|
|
330
|
-
[...
|
|
327
|
+
[...p2pAttestors.map(a => a.toString()), ...(block?.attestors.map(a => a.toString()) ?? [])].filter(
|
|
331
328
|
addr => proposer.toString() !== addr, // Exclude the proposer from the attestors
|
|
332
329
|
),
|
|
333
330
|
);
|