@aztec/aztec-node 0.0.1-commit.b1c78909e → 0.0.1-commit.b2a5d0dd1
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/server.d.ts +29 -31
- package/dest/aztec-node/server.d.ts.map +1 -1
- package/dest/aztec-node/server.js +397 -276
- package/dest/sentinel/sentinel.js +6 -6
- package/package.json +26 -27
- package/src/aztec-node/server.ts +485 -350
- package/src/sentinel/sentinel.ts +6 -6
|
@@ -48,7 +48,7 @@ export class Sentinel extends EventEmitter {
|
|
|
48
48
|
this.runningPromise.start();
|
|
49
49
|
}
|
|
50
50
|
/** Loads initial slot and initializes blockstream. We will not process anything at or before the initial slot. */ async init() {
|
|
51
|
-
this.initialSlot = this.epochCache.
|
|
51
|
+
this.initialSlot = this.epochCache.getSlotNow();
|
|
52
52
|
const startingBlock = BlockNumber(await this.archiver.getBlockNumber());
|
|
53
53
|
this.logger.info(`Starting validator sentinel with initial slot ${this.initialSlot} and block ${startingBlock}`);
|
|
54
54
|
this.blockStream = new L2BlockStream(this.archiver, this.l2TipsStore, this, this.logger, {
|
|
@@ -157,13 +157,13 @@ export class Sentinel extends EventEmitter {
|
|
|
157
157
|
return false;
|
|
158
158
|
}
|
|
159
159
|
// Check that we have at least requiredConsecutiveEpochs and that all of them are above the inactivity threshold
|
|
160
|
-
return pastEpochs.slice(0, requiredConsecutiveEpochs).every((p)=>p.missed / p.total >= this.config.slashInactivityTargetPercentage);
|
|
160
|
+
return pastEpochs.slice(0, requiredConsecutiveEpochs).every((p)=>p.total === 0 ? false : p.missed / p.total >= this.config.slashInactivityTargetPercentage);
|
|
161
161
|
}
|
|
162
162
|
async handleProvenPerformance(epoch, performance) {
|
|
163
163
|
if (this.config.slashInactivityPenalty === 0n) {
|
|
164
164
|
return;
|
|
165
165
|
}
|
|
166
|
-
const inactiveValidators = getEntries(performance).filter(([_, { missed, total }])=>missed / total >= this.config.slashInactivityTargetPercentage).map(([address])=>address);
|
|
166
|
+
const inactiveValidators = getEntries(performance).filter(([_, { missed, total }])=>total > 0 && missed / total >= this.config.slashInactivityTargetPercentage).map(([address])=>address);
|
|
167
167
|
this.logger.debug(`Found ${inactiveValidators.length} inactive validators in epoch ${epoch}`, {
|
|
168
168
|
inactiveValidators,
|
|
169
169
|
epoch,
|
|
@@ -190,7 +190,7 @@ export class Sentinel extends EventEmitter {
|
|
|
190
190
|
* Note that we do not process historical data, since we rely on p2p data for processing,
|
|
191
191
|
* and we don't have that data if we were offline during the period.
|
|
192
192
|
*/ async work() {
|
|
193
|
-
const
|
|
193
|
+
const currentSlot = this.epochCache.getSlotNow();
|
|
194
194
|
try {
|
|
195
195
|
// Manually sync the block stream to ensure we have the latest data.
|
|
196
196
|
// Note we never `start` the blockstream, so it loops at the same pace as we do.
|
|
@@ -351,7 +351,7 @@ export class Sentinel extends EventEmitter {
|
|
|
351
351
|
v.toString(),
|
|
352
352
|
await this.store.getHistory(v)
|
|
353
353
|
]))) : await this.store.getHistories();
|
|
354
|
-
const slotNow = this.epochCache.
|
|
354
|
+
const slotNow = this.epochCache.getSlotNow();
|
|
355
355
|
fromSlot ??= SlotNumber(Math.max((this.lastProcessedSlot ?? slotNow) - this.store.getHistoryLength(), 0));
|
|
356
356
|
toSlot ??= this.lastProcessedSlot ?? slotNow;
|
|
357
357
|
const stats = mapValues(histories, (history, address)=>this.computeStatsForValidator(address, history ?? [], fromSlot, toSlot));
|
|
@@ -367,7 +367,7 @@ export class Sentinel extends EventEmitter {
|
|
|
367
367
|
if (!history || history.length === 0) {
|
|
368
368
|
return undefined;
|
|
369
369
|
}
|
|
370
|
-
const slotNow = this.epochCache.
|
|
370
|
+
const slotNow = this.epochCache.getSlotNow();
|
|
371
371
|
const effectiveFromSlot = fromSlot ?? SlotNumber(Math.max((this.lastProcessedSlot ?? slotNow) - this.store.getHistoryLength(), 0));
|
|
372
372
|
const effectiveToSlot = toSlot ?? this.lastProcessedSlot ?? slotNow;
|
|
373
373
|
const historyLength = BigInt(this.store.getHistoryLength());
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/aztec-node",
|
|
3
|
-
"version": "0.0.1-commit.
|
|
3
|
+
"version": "0.0.1-commit.b2a5d0dd1",
|
|
4
4
|
"main": "dest/index.js",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -65,32 +65,31 @@
|
|
|
65
65
|
]
|
|
66
66
|
},
|
|
67
67
|
"dependencies": {
|
|
68
|
-
"@aztec/archiver": "0.0.1-commit.
|
|
69
|
-
"@aztec/bb-prover": "0.0.1-commit.
|
|
70
|
-
"@aztec/blob-client": "0.0.1-commit.
|
|
71
|
-
"@aztec/blob-lib": "0.0.1-commit.
|
|
72
|
-
"@aztec/constants": "0.0.1-commit.
|
|
73
|
-
"@aztec/epoch-cache": "0.0.1-commit.
|
|
74
|
-
"@aztec/ethereum": "0.0.1-commit.
|
|
75
|
-
"@aztec/foundation": "0.0.1-commit.
|
|
76
|
-
"@aztec/kv-store": "0.0.1-commit.
|
|
77
|
-
"@aztec/l1-artifacts": "0.0.1-commit.
|
|
78
|
-
"@aztec/
|
|
79
|
-
"@aztec/node-
|
|
80
|
-
"@aztec/
|
|
81
|
-
"@aztec/
|
|
82
|
-
"@aztec/
|
|
83
|
-
"@aztec/
|
|
84
|
-
"@aztec/prover-
|
|
85
|
-
"@aztec/
|
|
86
|
-
"@aztec/
|
|
87
|
-
"@aztec/
|
|
88
|
-
"@aztec/
|
|
89
|
-
"@aztec/
|
|
90
|
-
"@aztec/
|
|
91
|
-
"@aztec/validator-
|
|
92
|
-
"@aztec/
|
|
93
|
-
"@aztec/world-state": "0.0.1-commit.b1c78909e",
|
|
68
|
+
"@aztec/archiver": "0.0.1-commit.b2a5d0dd1",
|
|
69
|
+
"@aztec/bb-prover": "0.0.1-commit.b2a5d0dd1",
|
|
70
|
+
"@aztec/blob-client": "0.0.1-commit.b2a5d0dd1",
|
|
71
|
+
"@aztec/blob-lib": "0.0.1-commit.b2a5d0dd1",
|
|
72
|
+
"@aztec/constants": "0.0.1-commit.b2a5d0dd1",
|
|
73
|
+
"@aztec/epoch-cache": "0.0.1-commit.b2a5d0dd1",
|
|
74
|
+
"@aztec/ethereum": "0.0.1-commit.b2a5d0dd1",
|
|
75
|
+
"@aztec/foundation": "0.0.1-commit.b2a5d0dd1",
|
|
76
|
+
"@aztec/kv-store": "0.0.1-commit.b2a5d0dd1",
|
|
77
|
+
"@aztec/l1-artifacts": "0.0.1-commit.b2a5d0dd1",
|
|
78
|
+
"@aztec/node-keystore": "0.0.1-commit.b2a5d0dd1",
|
|
79
|
+
"@aztec/node-lib": "0.0.1-commit.b2a5d0dd1",
|
|
80
|
+
"@aztec/noir-protocol-circuits-types": "0.0.1-commit.b2a5d0dd1",
|
|
81
|
+
"@aztec/p2p": "0.0.1-commit.b2a5d0dd1",
|
|
82
|
+
"@aztec/protocol-contracts": "0.0.1-commit.b2a5d0dd1",
|
|
83
|
+
"@aztec/prover-client": "0.0.1-commit.b2a5d0dd1",
|
|
84
|
+
"@aztec/prover-node": "0.0.1-commit.b2a5d0dd1",
|
|
85
|
+
"@aztec/sequencer-client": "0.0.1-commit.b2a5d0dd1",
|
|
86
|
+
"@aztec/simulator": "0.0.1-commit.b2a5d0dd1",
|
|
87
|
+
"@aztec/slasher": "0.0.1-commit.b2a5d0dd1",
|
|
88
|
+
"@aztec/stdlib": "0.0.1-commit.b2a5d0dd1",
|
|
89
|
+
"@aztec/telemetry-client": "0.0.1-commit.b2a5d0dd1",
|
|
90
|
+
"@aztec/validator-client": "0.0.1-commit.b2a5d0dd1",
|
|
91
|
+
"@aztec/validator-ha-signer": "0.0.1-commit.b2a5d0dd1",
|
|
92
|
+
"@aztec/world-state": "0.0.1-commit.b2a5d0dd1",
|
|
94
93
|
"koa": "^2.16.1",
|
|
95
94
|
"koa-router": "^13.1.1",
|
|
96
95
|
"tslib": "^2.4.0",
|