@aztec/aztec-node 5.0.0-nightly.20260428 → 5.0.0-nightly.20260430
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/block_response_helpers.d.ts +21 -0
- package/dest/aztec-node/block_response_helpers.d.ts.map +1 -0
- package/dest/aztec-node/block_response_helpers.js +88 -0
- package/dest/aztec-node/server.d.ts +18 -51
- package/dest/aztec-node/server.d.ts.map +1 -1
- package/dest/aztec-node/server.js +292 -109
- package/dest/sentinel/factory.d.ts +3 -2
- package/dest/sentinel/factory.d.ts.map +1 -1
- package/dest/sentinel/sentinel.d.ts +6 -3
- package/dest/sentinel/sentinel.d.ts.map +1 -1
- package/dest/sentinel/sentinel.js +7 -1
- package/package.json +26 -26
- package/src/aztec-node/block_response_helpers.ts +131 -0
- package/src/aztec-node/server.ts +319 -140
- package/src/sentinel/factory.ts +2 -1
- package/src/sentinel/sentinel.ts +17 -5
package/src/sentinel/sentinel.ts
CHANGED
|
@@ -21,7 +21,9 @@ import {
|
|
|
21
21
|
type L2BlockStreamEventHandler,
|
|
22
22
|
getAttestationInfoFromPublishedCheckpoint,
|
|
23
23
|
} from '@aztec/stdlib/block';
|
|
24
|
+
import type { ChainConfig } from '@aztec/stdlib/config';
|
|
24
25
|
import { getEpochAtSlot, getSlotRangeForEpoch, getTimestampForSlot } from '@aztec/stdlib/epoch-helpers';
|
|
26
|
+
import type { CoordinationSignatureContext } from '@aztec/stdlib/p2p';
|
|
25
27
|
import type {
|
|
26
28
|
SingleValidatorStats,
|
|
27
29
|
ValidatorStats,
|
|
@@ -36,6 +38,12 @@ import EventEmitter from 'node:events';
|
|
|
36
38
|
|
|
37
39
|
import { SentinelStore } from './store.js';
|
|
38
40
|
|
|
41
|
+
export type SentinelRuntimeConfig = Pick<
|
|
42
|
+
SlasherConfig,
|
|
43
|
+
'slashInactivityTargetPercentage' | 'slashInactivityPenalty' | 'slashInactivityConsecutiveEpochThreshold'
|
|
44
|
+
> &
|
|
45
|
+
Pick<ChainConfig, 'l1ChainId' | 'l1Contracts'>;
|
|
46
|
+
|
|
39
47
|
/** Maps a validator status to its category: proposer or attestation. */
|
|
40
48
|
function statusToCategory(status: ValidatorStatusInSlot): ValidatorStatusType {
|
|
41
49
|
switch (status) {
|
|
@@ -65,10 +73,7 @@ export class Sentinel extends (EventEmitter as new () => WatcherEmitter) impleme
|
|
|
65
73
|
protected archiver: L2BlockSource,
|
|
66
74
|
protected p2p: P2PClient,
|
|
67
75
|
protected store: SentinelStore,
|
|
68
|
-
protected config:
|
|
69
|
-
SlasherConfig,
|
|
70
|
-
'slashInactivityTargetPercentage' | 'slashInactivityPenalty' | 'slashInactivityConsecutiveEpochThreshold'
|
|
71
|
-
>,
|
|
76
|
+
protected config: SentinelRuntimeConfig,
|
|
72
77
|
protected logger = createLogger('node:sentinel'),
|
|
73
78
|
) {
|
|
74
79
|
super();
|
|
@@ -77,6 +82,13 @@ export class Sentinel extends (EventEmitter as new () => WatcherEmitter) impleme
|
|
|
77
82
|
this.runningPromise = new RunningPromise(this.work.bind(this), logger, interval);
|
|
78
83
|
}
|
|
79
84
|
|
|
85
|
+
private getSignatureContext(): CoordinationSignatureContext {
|
|
86
|
+
return {
|
|
87
|
+
chainId: this.config.l1ChainId,
|
|
88
|
+
rollupAddress: this.config.l1Contracts.rollupAddress,
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
|
|
80
92
|
public updateConfig(config: Partial<SlasherConfig>) {
|
|
81
93
|
this.config = { ...this.config, ...config };
|
|
82
94
|
}
|
|
@@ -117,7 +129,7 @@ export class Sentinel extends (EventEmitter as new () => WatcherEmitter) impleme
|
|
|
117
129
|
this.slotNumberToCheckpoint.set(checkpoint.checkpoint.header.slotNumber, {
|
|
118
130
|
checkpointNumber: checkpoint.checkpoint.number,
|
|
119
131
|
archive: checkpoint.checkpoint.archive.root.toString(),
|
|
120
|
-
attestors: getAttestationInfoFromPublishedCheckpoint(checkpoint)
|
|
132
|
+
attestors: getAttestationInfoFromPublishedCheckpoint(checkpoint, this.getSignatureContext())
|
|
121
133
|
.filter(a => a.status === 'recovered-from-signature')
|
|
122
134
|
.map(a => a.address!),
|
|
123
135
|
});
|