@aztec/aztec-node 0.0.1-commit.1bea0213 → 0.0.1-commit.21ecf947b
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/node_metrics.d.ts +1 -1
- package/dest/aztec-node/node_metrics.d.ts.map +1 -1
- package/dest/aztec-node/node_metrics.js +8 -4
- package/dest/aztec-node/server.d.ts +13 -16
- package/dest/aztec-node/server.d.ts.map +1 -1
- package/dest/aztec-node/server.js +38 -52
- package/dest/sentinel/factory.d.ts +1 -1
- package/dest/sentinel/factory.d.ts.map +1 -1
- package/dest/sentinel/factory.js +1 -1
- package/dest/sentinel/sentinel.d.ts +2 -2
- package/dest/sentinel/sentinel.d.ts.map +1 -1
- package/dest/sentinel/sentinel.js +38 -19
- package/dest/sentinel/store.d.ts +2 -2
- package/dest/sentinel/store.d.ts.map +1 -1
- package/dest/sentinel/store.js +11 -7
- package/package.json +25 -25
- package/src/aztec-node/node_metrics.ts +12 -5
- package/src/aztec-node/server.ts +56 -85
- package/src/sentinel/factory.ts +1 -6
- package/src/sentinel/sentinel.ts +41 -17
- package/src/sentinel/store.ts +12 -12
|
@@ -8,6 +8,15 @@ import { OffenseType, WANT_TO_SLASH_EVENT } from '@aztec/slasher';
|
|
|
8
8
|
import { L2BlockStream, getAttestationInfoFromPublishedCheckpoint } from '@aztec/stdlib/block';
|
|
9
9
|
import { getEpochAtSlot, getSlotRangeForEpoch, getTimestampForSlot } from '@aztec/stdlib/epoch-helpers';
|
|
10
10
|
import EventEmitter from 'node:events';
|
|
11
|
+
/** Maps a validator status to its category: proposer or attestation. */ function statusToCategory(status) {
|
|
12
|
+
switch(status){
|
|
13
|
+
case 'attestation-sent':
|
|
14
|
+
case 'attestation-missed':
|
|
15
|
+
return 'attestation';
|
|
16
|
+
default:
|
|
17
|
+
return 'proposer';
|
|
18
|
+
}
|
|
19
|
+
}
|
|
11
20
|
export class Sentinel extends EventEmitter {
|
|
12
21
|
epochCache;
|
|
13
22
|
archiver;
|
|
@@ -263,17 +272,17 @@ export class Sentinel extends EventEmitter {
|
|
|
263
272
|
committee
|
|
264
273
|
});
|
|
265
274
|
// Check if there is an L2 block in L1 for this L2 slot
|
|
266
|
-
// Here we get all attestations for the
|
|
267
|
-
// or all attestations for all proposals in the slot if no
|
|
275
|
+
// Here we get all checkpoint attestations for the checkpoint at the given slot,
|
|
276
|
+
// or all checkpoint attestations for all proposals in the slot if no checkpoint was mined.
|
|
268
277
|
// We gather from both p2p (contains the ones seen on the p2p layer) and archiver
|
|
269
|
-
// (contains the ones synced from mined
|
|
270
|
-
const
|
|
271
|
-
const p2pAttested = await this.p2p.getCheckpointAttestationsForSlot(slot,
|
|
278
|
+
// (contains the ones synced from mined checkpoints, which we may have missed from p2p).
|
|
279
|
+
const checkpoint = this.slotNumberToCheckpoint.get(slot);
|
|
280
|
+
const p2pAttested = await this.p2p.getCheckpointAttestationsForSlot(slot, checkpoint?.archive);
|
|
272
281
|
// Filter out attestations with invalid signatures
|
|
273
282
|
const p2pAttestors = p2pAttested.map((a)=>a.getSender()).filter((s)=>s !== undefined);
|
|
274
283
|
const attestors = new Set([
|
|
275
284
|
...p2pAttestors.map((a)=>a.toString()),
|
|
276
|
-
...
|
|
285
|
+
...checkpoint?.attestors.map((a)=>a.toString()) ?? []
|
|
277
286
|
].filter((addr)=>proposer.toString() !== addr));
|
|
278
287
|
// We assume that there was a block proposal if at least one of the validators (other than the proposer) attested to it.
|
|
279
288
|
// It could be the case that every single validator failed, and we could differentiate it by having
|
|
@@ -281,17 +290,26 @@ export class Sentinel extends EventEmitter {
|
|
|
281
290
|
// But we'll leave that corner case out to reduce pressure on the node.
|
|
282
291
|
// TODO(palla/slash): This breaks if a given node has more than one validator in the current committee,
|
|
283
292
|
// since they will attest to their own proposal it even if it's not re-executable.
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
293
|
+
let status;
|
|
294
|
+
if (checkpoint) {
|
|
295
|
+
status = 'checkpoint-mined';
|
|
296
|
+
} else if (attestors.size > 0) {
|
|
297
|
+
status = 'checkpoint-proposed';
|
|
298
|
+
} else {
|
|
299
|
+
// No checkpoint on L1 and no checkpoint attestations seen. Check if block proposals were sent for this slot.
|
|
300
|
+
const hasBlockProposals = await this.p2p.hasBlockProposalsForSlot(slot);
|
|
301
|
+
status = hasBlockProposals ? 'checkpoint-missed' : 'blocks-missed';
|
|
302
|
+
}
|
|
303
|
+
this.logger.debug(`Checkpoint status for slot ${slot}: ${status}`, {
|
|
304
|
+
...checkpoint,
|
|
287
305
|
slot
|
|
288
306
|
});
|
|
289
|
-
// Get attestors that failed their
|
|
290
|
-
const missedAttestors = new Set(
|
|
307
|
+
// Get attestors that failed their checkpoint attestation duties, but only if there was a checkpoint proposed or mined
|
|
308
|
+
const missedAttestors = new Set(status === 'blocks-missed' || status === 'checkpoint-missed' ? [] : committee.filter((v)=>!attestors.has(v.toString()) && !proposer.equals(v)).map((v)=>v.toString()));
|
|
291
309
|
this.logger.debug(`Retrieved ${attestors.size} attestors out of ${committee.length} for slot ${slot}`, {
|
|
292
|
-
|
|
310
|
+
status,
|
|
293
311
|
proposer: proposer.toString(),
|
|
294
|
-
...
|
|
312
|
+
...checkpoint,
|
|
295
313
|
slot,
|
|
296
314
|
attestors: [
|
|
297
315
|
...attestors
|
|
@@ -304,7 +322,7 @@ export class Sentinel extends EventEmitter {
|
|
|
304
322
|
// Compute the status for each validator in the committee
|
|
305
323
|
const statusFor = (who)=>{
|
|
306
324
|
if (who === proposer.toString()) {
|
|
307
|
-
return
|
|
325
|
+
return status;
|
|
308
326
|
} else if (attestors.has(who)) {
|
|
309
327
|
return 'attestation-sent';
|
|
310
328
|
} else if (missedAttestors.has(who)) {
|
|
@@ -361,15 +379,16 @@ export class Sentinel extends EventEmitter {
|
|
|
361
379
|
computeStatsForValidator(address, allHistory, fromSlot, toSlot) {
|
|
362
380
|
let history = fromSlot ? allHistory.filter((h)=>BigInt(h.slot) >= fromSlot) : allHistory;
|
|
363
381
|
history = toSlot ? history.filter((h)=>BigInt(h.slot) <= toSlot) : history;
|
|
364
|
-
const lastProposal = history.filter((h)=>h.status === '
|
|
382
|
+
const lastProposal = history.filter((h)=>h.status === 'checkpoint-proposed' || h.status === 'checkpoint-mined').at(-1);
|
|
365
383
|
const lastAttestation = history.filter((h)=>h.status === 'attestation-sent').at(-1);
|
|
366
384
|
return {
|
|
367
385
|
address: EthAddress.fromString(address),
|
|
368
386
|
lastProposal: this.computeFromSlot(lastProposal?.slot),
|
|
369
387
|
lastAttestation: this.computeFromSlot(lastAttestation?.slot),
|
|
370
388
|
totalSlots: history.length,
|
|
371
|
-
missedProposals: this.computeMissed(history, '
|
|
372
|
-
'
|
|
389
|
+
missedProposals: this.computeMissed(history, 'proposer', [
|
|
390
|
+
'checkpoint-missed',
|
|
391
|
+
'blocks-missed'
|
|
373
392
|
]),
|
|
374
393
|
missedAttestations: this.computeMissed(history, 'attestation', [
|
|
375
394
|
'attestation-missed'
|
|
@@ -377,8 +396,8 @@ export class Sentinel extends EventEmitter {
|
|
|
377
396
|
history
|
|
378
397
|
};
|
|
379
398
|
}
|
|
380
|
-
computeMissed(history,
|
|
381
|
-
const relevantHistory = history.filter((h)=>!
|
|
399
|
+
computeMissed(history, computeOverCategory, filter) {
|
|
400
|
+
const relevantHistory = history.filter((h)=>!computeOverCategory || statusToCategory(h.status) === computeOverCategory);
|
|
382
401
|
const filteredHistory = relevantHistory.filter((h)=>filter.includes(h.status));
|
|
383
402
|
return {
|
|
384
403
|
currentStreak: countWhile([
|
package/dest/sentinel/store.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ import type { ValidatorStatusHistory, ValidatorStatusInSlot, ValidatorsEpochPerf
|
|
|
5
5
|
export declare class SentinelStore {
|
|
6
6
|
private store;
|
|
7
7
|
private config;
|
|
8
|
-
static readonly SCHEMA_VERSION =
|
|
8
|
+
static readonly SCHEMA_VERSION = 3;
|
|
9
9
|
private readonly historyMap;
|
|
10
10
|
private readonly provenMap;
|
|
11
11
|
constructor(store: AztecAsyncKVStore, config: {
|
|
@@ -32,4 +32,4 @@ export declare class SentinelStore {
|
|
|
32
32
|
private statusToNumber;
|
|
33
33
|
private statusFromNumber;
|
|
34
34
|
}
|
|
35
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
35
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic3RvcmUuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9zZW50aW5lbC9zdG9yZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsV0FBVyxFQUFFLFVBQVUsRUFBRSxNQUFNLGlDQUFpQyxDQUFDO0FBQzFFLE9BQU8sRUFBRSxVQUFVLEVBQUUsTUFBTSwrQkFBK0IsQ0FBQztBQUUzRCxPQUFPLEtBQUssRUFBRSxpQkFBaUIsRUFBaUIsTUFBTSxpQkFBaUIsQ0FBQztBQUN4RSxPQUFPLEtBQUssRUFDVixzQkFBc0IsRUFDdEIscUJBQXFCLEVBQ3JCLDBCQUEwQixFQUMzQixNQUFNLDBCQUEwQixDQUFDO0FBRWxDLHFCQUFhLGFBQWE7SUFXdEIsT0FBTyxDQUFDLEtBQUs7SUFDYixPQUFPLENBQUMsTUFBTTtJQVhoQixnQkFBdUIsY0FBYyxLQUFLO0lBRzFDLE9BQU8sQ0FBQyxRQUFRLENBQUMsVUFBVSxDQUF1QztJQUlsRSxPQUFPLENBQUMsUUFBUSxDQUFDLFNBQVMsQ0FBdUM7SUFFakUsWUFDVSxLQUFLLEVBQUUsaUJBQWlCLEVBQ3hCLE1BQU0sRUFBRTtRQUFFLGFBQWEsRUFBRSxNQUFNLENBQUM7UUFBQywrQkFBK0IsRUFBRSxNQUFNLENBQUE7S0FBRSxFQUluRjtJQUVNLGdCQUFnQixXQUV0QjtJQUVNLGtDQUFrQyxXQUV4QztJQUVZLHVCQUF1QixD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
store;
|
|
6
6
|
config;
|
|
7
|
-
static SCHEMA_VERSION =
|
|
7
|
+
static SCHEMA_VERSION = 3;
|
|
8
8
|
// a map from validator address to their ValidatorStatusHistory
|
|
9
9
|
historyMap;
|
|
10
10
|
// a map from validator address to their historical proven epoch performance
|
|
@@ -134,16 +134,18 @@ export class SentinelStore {
|
|
|
134
134
|
}
|
|
135
135
|
statusToNumber(status) {
|
|
136
136
|
switch(status){
|
|
137
|
-
case '
|
|
137
|
+
case 'checkpoint-mined':
|
|
138
138
|
return 1;
|
|
139
|
-
case '
|
|
139
|
+
case 'checkpoint-proposed':
|
|
140
140
|
return 2;
|
|
141
|
-
case '
|
|
141
|
+
case 'checkpoint-missed':
|
|
142
142
|
return 3;
|
|
143
143
|
case 'attestation-sent':
|
|
144
144
|
return 4;
|
|
145
145
|
case 'attestation-missed':
|
|
146
146
|
return 5;
|
|
147
|
+
case 'blocks-missed':
|
|
148
|
+
return 6;
|
|
147
149
|
default:
|
|
148
150
|
{
|
|
149
151
|
const _exhaustive = status;
|
|
@@ -154,15 +156,17 @@ export class SentinelStore {
|
|
|
154
156
|
statusFromNumber(status) {
|
|
155
157
|
switch(status){
|
|
156
158
|
case 1:
|
|
157
|
-
return '
|
|
159
|
+
return 'checkpoint-mined';
|
|
158
160
|
case 2:
|
|
159
|
-
return '
|
|
161
|
+
return 'checkpoint-proposed';
|
|
160
162
|
case 3:
|
|
161
|
-
return '
|
|
163
|
+
return 'checkpoint-missed';
|
|
162
164
|
case 4:
|
|
163
165
|
return 'attestation-sent';
|
|
164
166
|
case 5:
|
|
165
167
|
return 'attestation-missed';
|
|
168
|
+
case 6:
|
|
169
|
+
return 'blocks-missed';
|
|
166
170
|
default:
|
|
167
171
|
throw new Error(`Unknown status: ${status}`);
|
|
168
172
|
}
|
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.21ecf947b",
|
|
4
4
|
"main": "dest/index.js",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -65,30 +65,30 @@
|
|
|
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/constants": "0.0.1-commit.
|
|
72
|
-
"@aztec/epoch-cache": "0.0.1-commit.
|
|
73
|
-
"@aztec/ethereum": "0.0.1-commit.
|
|
74
|
-
"@aztec/foundation": "0.0.1-commit.
|
|
75
|
-
"@aztec/kv-store": "0.0.1-commit.
|
|
76
|
-
"@aztec/l1-artifacts": "0.0.1-commit.
|
|
77
|
-
"@aztec/merkle-tree": "0.0.1-commit.
|
|
78
|
-
"@aztec/node-keystore": "0.0.1-commit.
|
|
79
|
-
"@aztec/node-lib": "0.0.1-commit.
|
|
80
|
-
"@aztec/noir-protocol-circuits-types": "0.0.1-commit.
|
|
81
|
-
"@aztec/p2p": "0.0.1-commit.
|
|
82
|
-
"@aztec/protocol-contracts": "0.0.1-commit.
|
|
83
|
-
"@aztec/prover-client": "0.0.1-commit.
|
|
84
|
-
"@aztec/sequencer-client": "0.0.1-commit.
|
|
85
|
-
"@aztec/simulator": "0.0.1-commit.
|
|
86
|
-
"@aztec/slasher": "0.0.1-commit.
|
|
87
|
-
"@aztec/stdlib": "0.0.1-commit.
|
|
88
|
-
"@aztec/telemetry-client": "0.0.1-commit.
|
|
89
|
-
"@aztec/validator-client": "0.0.1-commit.
|
|
90
|
-
"@aztec/validator-ha-signer": "0.0.1-commit.
|
|
91
|
-
"@aztec/world-state": "0.0.1-commit.
|
|
68
|
+
"@aztec/archiver": "0.0.1-commit.21ecf947b",
|
|
69
|
+
"@aztec/bb-prover": "0.0.1-commit.21ecf947b",
|
|
70
|
+
"@aztec/blob-client": "0.0.1-commit.21ecf947b",
|
|
71
|
+
"@aztec/constants": "0.0.1-commit.21ecf947b",
|
|
72
|
+
"@aztec/epoch-cache": "0.0.1-commit.21ecf947b",
|
|
73
|
+
"@aztec/ethereum": "0.0.1-commit.21ecf947b",
|
|
74
|
+
"@aztec/foundation": "0.0.1-commit.21ecf947b",
|
|
75
|
+
"@aztec/kv-store": "0.0.1-commit.21ecf947b",
|
|
76
|
+
"@aztec/l1-artifacts": "0.0.1-commit.21ecf947b",
|
|
77
|
+
"@aztec/merkle-tree": "0.0.1-commit.21ecf947b",
|
|
78
|
+
"@aztec/node-keystore": "0.0.1-commit.21ecf947b",
|
|
79
|
+
"@aztec/node-lib": "0.0.1-commit.21ecf947b",
|
|
80
|
+
"@aztec/noir-protocol-circuits-types": "0.0.1-commit.21ecf947b",
|
|
81
|
+
"@aztec/p2p": "0.0.1-commit.21ecf947b",
|
|
82
|
+
"@aztec/protocol-contracts": "0.0.1-commit.21ecf947b",
|
|
83
|
+
"@aztec/prover-client": "0.0.1-commit.21ecf947b",
|
|
84
|
+
"@aztec/sequencer-client": "0.0.1-commit.21ecf947b",
|
|
85
|
+
"@aztec/simulator": "0.0.1-commit.21ecf947b",
|
|
86
|
+
"@aztec/slasher": "0.0.1-commit.21ecf947b",
|
|
87
|
+
"@aztec/stdlib": "0.0.1-commit.21ecf947b",
|
|
88
|
+
"@aztec/telemetry-client": "0.0.1-commit.21ecf947b",
|
|
89
|
+
"@aztec/validator-client": "0.0.1-commit.21ecf947b",
|
|
90
|
+
"@aztec/validator-ha-signer": "0.0.1-commit.21ecf947b",
|
|
91
|
+
"@aztec/world-state": "0.0.1-commit.21ecf947b",
|
|
92
92
|
"koa": "^2.16.1",
|
|
93
93
|
"koa-router": "^13.1.1",
|
|
94
94
|
"tslib": "^2.4.0",
|
|
@@ -1,4 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
Attributes,
|
|
3
|
+
type Histogram,
|
|
4
|
+
Metrics,
|
|
5
|
+
type TelemetryClient,
|
|
6
|
+
type UpDownCounter,
|
|
7
|
+
createUpDownCounterWithDefault,
|
|
8
|
+
} from '@aztec/telemetry-client';
|
|
2
9
|
|
|
3
10
|
export class NodeMetrics {
|
|
4
11
|
private receiveTxCount: UpDownCounter;
|
|
@@ -9,14 +16,14 @@ export class NodeMetrics {
|
|
|
9
16
|
|
|
10
17
|
constructor(client: TelemetryClient, name = 'AztecNode') {
|
|
11
18
|
const meter = client.getMeter(name);
|
|
12
|
-
this.receiveTxCount = meter
|
|
19
|
+
this.receiveTxCount = createUpDownCounterWithDefault(meter, Metrics.NODE_RECEIVE_TX_COUNT, {
|
|
20
|
+
[Attributes.OK]: [true, false],
|
|
21
|
+
});
|
|
13
22
|
this.receiveTxDuration = meter.createHistogram(Metrics.NODE_RECEIVE_TX_DURATION);
|
|
14
23
|
|
|
15
24
|
this.snapshotDuration = meter.createHistogram(Metrics.NODE_SNAPSHOT_DURATION);
|
|
16
25
|
|
|
17
|
-
this.snapshotErrorCount = meter
|
|
18
|
-
|
|
19
|
-
this.snapshotErrorCount.add(0);
|
|
26
|
+
this.snapshotErrorCount = createUpDownCounterWithDefault(meter, Metrics.NODE_SNAPSHOT_ERROR_COUNT);
|
|
20
27
|
}
|
|
21
28
|
|
|
22
29
|
receivedTx(durationMs: number, isAccepted: boolean) {
|
package/src/aztec-node/server.ts
CHANGED
|
@@ -1,13 +1,7 @@
|
|
|
1
1
|
import { Archiver, createArchiver } from '@aztec/archiver';
|
|
2
2
|
import { BBCircuitVerifier, QueuedIVCVerifier, TestCircuitVerifier } from '@aztec/bb-prover';
|
|
3
3
|
import { type BlobClientInterface, createBlobClientWithFileStores } from '@aztec/blob-client/client';
|
|
4
|
-
import {
|
|
5
|
-
ARCHIVE_HEIGHT,
|
|
6
|
-
type L1_TO_L2_MSG_TREE_HEIGHT,
|
|
7
|
-
type NOTE_HASH_TREE_HEIGHT,
|
|
8
|
-
type NULLIFIER_TREE_HEIGHT,
|
|
9
|
-
type PUBLIC_DATA_TREE_HEIGHT,
|
|
10
|
-
} from '@aztec/constants';
|
|
4
|
+
import { ARCHIVE_HEIGHT, type L1_TO_L2_MSG_TREE_HEIGHT, type NOTE_HASH_TREE_HEIGHT } from '@aztec/constants';
|
|
11
5
|
import { EpochCache, type EpochCacheInterface } from '@aztec/epoch-cache';
|
|
12
6
|
import { createEthereumChain } from '@aztec/ethereum/chain';
|
|
13
7
|
import { getPublicClient } from '@aztec/ethereum/client';
|
|
@@ -559,6 +553,7 @@ export class AztecNodeService implements AztecNode, AztecNodeAdmin, Traceable {
|
|
|
559
553
|
enr,
|
|
560
554
|
l1ContractAddresses: contractAddresses,
|
|
561
555
|
protocolContractAddresses: protocolContractAddresses,
|
|
556
|
+
realProofs: !!this.config.realProofs,
|
|
562
557
|
};
|
|
563
558
|
|
|
564
559
|
return nodeInfo;
|
|
@@ -570,8 +565,8 @@ export class AztecNodeService implements AztecNode, AztecNodeAdmin, Traceable {
|
|
|
570
565
|
* @returns The requested block.
|
|
571
566
|
*/
|
|
572
567
|
public async getBlock(block: BlockParameter): Promise<L2Block | undefined> {
|
|
573
|
-
if (BlockHash.
|
|
574
|
-
return this.getBlockByHash(
|
|
568
|
+
if (BlockHash.isBlockHash(block)) {
|
|
569
|
+
return this.getBlockByHash(block);
|
|
575
570
|
}
|
|
576
571
|
const blockNumber = block === 'latest' ? await this.getBlockNumber() : (block as BlockNumber);
|
|
577
572
|
if (blockNumber === BlockNumber.ZERO) {
|
|
@@ -585,9 +580,9 @@ export class AztecNodeService implements AztecNode, AztecNodeAdmin, Traceable {
|
|
|
585
580
|
* @param blockHash - The block hash being requested.
|
|
586
581
|
* @returns The requested block.
|
|
587
582
|
*/
|
|
588
|
-
public async getBlockByHash(blockHash:
|
|
583
|
+
public async getBlockByHash(blockHash: BlockHash): Promise<L2Block | undefined> {
|
|
589
584
|
const initialBlockHash = await this.#getInitialHeaderHash();
|
|
590
|
-
if (blockHash.equals(
|
|
585
|
+
if (blockHash.equals(initialBlockHash)) {
|
|
591
586
|
return this.buildInitialBlock();
|
|
592
587
|
}
|
|
593
588
|
return await this.blockSource.getL2BlockByHash(blockHash);
|
|
@@ -697,8 +692,7 @@ export class AztecNodeService implements AztecNode, AztecNodeAdmin, Traceable {
|
|
|
697
692
|
if (referenceBlock) {
|
|
698
693
|
const initialBlockHash = await this.#getInitialHeaderHash();
|
|
699
694
|
if (!referenceBlock.equals(initialBlockHash)) {
|
|
700
|
-
const
|
|
701
|
-
const header = await this.blockSource.getBlockHeaderByHash(blockHashFr);
|
|
695
|
+
const header = await this.blockSource.getBlockHeaderByHash(referenceBlock);
|
|
702
696
|
if (!header) {
|
|
703
697
|
throw new Error(
|
|
704
698
|
`Block ${referenceBlock.toString()} not found in the node. This might indicate a reorg has occurred.`,
|
|
@@ -718,8 +712,7 @@ export class AztecNodeService implements AztecNode, AztecNodeAdmin, Traceable {
|
|
|
718
712
|
if (referenceBlock) {
|
|
719
713
|
const initialBlockHash = await this.#getInitialHeaderHash();
|
|
720
714
|
if (!referenceBlock.equals(initialBlockHash)) {
|
|
721
|
-
const
|
|
722
|
-
const header = await this.blockSource.getBlockHeaderByHash(blockHashFr);
|
|
715
|
+
const header = await this.blockSource.getBlockHeaderByHash(referenceBlock);
|
|
723
716
|
if (!header) {
|
|
724
717
|
throw new Error(
|
|
725
718
|
`Block ${referenceBlock.toString()} not found in the node. This might indicate a reorg has occurred.`,
|
|
@@ -859,11 +852,11 @@ export class AztecNodeService implements AztecNode, AztecNodeAdmin, Traceable {
|
|
|
859
852
|
}
|
|
860
853
|
|
|
861
854
|
public async findLeavesIndexes(
|
|
862
|
-
|
|
855
|
+
referenceBlock: BlockParameter,
|
|
863
856
|
treeId: MerkleTreeId,
|
|
864
857
|
leafValues: Fr[],
|
|
865
858
|
): Promise<(DataInBlock<bigint> | undefined)[]> {
|
|
866
|
-
const committedDb = await this.#getWorldState(
|
|
859
|
+
const committedDb = await this.#getWorldState(referenceBlock);
|
|
867
860
|
const maybeIndices = await committedDb.findLeafIndices(
|
|
868
861
|
treeId,
|
|
869
862
|
leafValues.map(x => x.toBuffer()),
|
|
@@ -915,44 +908,28 @@ export class AztecNodeService implements AztecNode, AztecNodeAdmin, Traceable {
|
|
|
915
908
|
}
|
|
916
909
|
return {
|
|
917
910
|
l2BlockNumber: BlockNumber(Number(blockNumber)),
|
|
918
|
-
l2BlockHash: BlockHash
|
|
911
|
+
l2BlockHash: new BlockHash(blockHash),
|
|
919
912
|
data: index,
|
|
920
913
|
};
|
|
921
914
|
});
|
|
922
915
|
}
|
|
923
916
|
|
|
924
|
-
public async
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
): Promise<SiblingPath<typeof NULLIFIER_TREE_HEIGHT>> {
|
|
928
|
-
const committedDb = await this.#getWorldState(block);
|
|
929
|
-
return committedDb.getSiblingPath(MerkleTreeId.NULLIFIER_TREE, leafIndex);
|
|
930
|
-
}
|
|
931
|
-
|
|
932
|
-
public async getNoteHashSiblingPath(
|
|
933
|
-
block: BlockParameter,
|
|
934
|
-
leafIndex: bigint,
|
|
935
|
-
): Promise<SiblingPath<typeof NOTE_HASH_TREE_HEIGHT>> {
|
|
936
|
-
const committedDb = await this.#getWorldState(block);
|
|
937
|
-
return committedDb.getSiblingPath(MerkleTreeId.NOTE_HASH_TREE, leafIndex);
|
|
938
|
-
}
|
|
939
|
-
|
|
940
|
-
public async getArchiveMembershipWitness(
|
|
941
|
-
block: BlockParameter,
|
|
942
|
-
archive: Fr,
|
|
917
|
+
public async getBlockHashMembershipWitness(
|
|
918
|
+
referenceBlock: BlockParameter,
|
|
919
|
+
blockHash: BlockHash,
|
|
943
920
|
): Promise<MembershipWitness<typeof ARCHIVE_HEIGHT> | undefined> {
|
|
944
|
-
const committedDb = await this.#getWorldState(
|
|
945
|
-
const [pathAndIndex] = await committedDb.findSiblingPaths<MerkleTreeId.ARCHIVE>(MerkleTreeId.ARCHIVE, [
|
|
921
|
+
const committedDb = await this.#getWorldState(referenceBlock);
|
|
922
|
+
const [pathAndIndex] = await committedDb.findSiblingPaths<MerkleTreeId.ARCHIVE>(MerkleTreeId.ARCHIVE, [blockHash]);
|
|
946
923
|
return pathAndIndex === undefined
|
|
947
924
|
? undefined
|
|
948
925
|
: MembershipWitness.fromSiblingPath(pathAndIndex.index, pathAndIndex.path);
|
|
949
926
|
}
|
|
950
927
|
|
|
951
928
|
public async getNoteHashMembershipWitness(
|
|
952
|
-
|
|
929
|
+
referenceBlock: BlockParameter,
|
|
953
930
|
noteHash: Fr,
|
|
954
931
|
): Promise<MembershipWitness<typeof NOTE_HASH_TREE_HEIGHT> | undefined> {
|
|
955
|
-
const committedDb = await this.#getWorldState(
|
|
932
|
+
const committedDb = await this.#getWorldState(referenceBlock);
|
|
956
933
|
const [pathAndIndex] = await committedDb.findSiblingPaths<MerkleTreeId.NOTE_HASH_TREE>(
|
|
957
934
|
MerkleTreeId.NOTE_HASH_TREE,
|
|
958
935
|
[noteHash],
|
|
@@ -963,10 +940,10 @@ export class AztecNodeService implements AztecNode, AztecNodeAdmin, Traceable {
|
|
|
963
940
|
}
|
|
964
941
|
|
|
965
942
|
public async getL1ToL2MessageMembershipWitness(
|
|
966
|
-
|
|
943
|
+
referenceBlock: BlockParameter,
|
|
967
944
|
l1ToL2Message: Fr,
|
|
968
945
|
): Promise<[bigint, SiblingPath<typeof L1_TO_L2_MSG_TREE_HEIGHT>] | undefined> {
|
|
969
|
-
const db = await this.#getWorldState(
|
|
946
|
+
const db = await this.#getWorldState(referenceBlock);
|
|
970
947
|
const [witness] = await db.findSiblingPaths(MerkleTreeId.L1_TO_L2_MESSAGE_TREE, [l1ToL2Message]);
|
|
971
948
|
if (!witness) {
|
|
972
949
|
return undefined;
|
|
@@ -1019,27 +996,11 @@ export class AztecNodeService implements AztecNode, AztecNodeAdmin, Traceable {
|
|
|
1019
996
|
);
|
|
1020
997
|
}
|
|
1021
998
|
|
|
1022
|
-
public async getArchiveSiblingPath(
|
|
1023
|
-
block: BlockParameter,
|
|
1024
|
-
leafIndex: bigint,
|
|
1025
|
-
): Promise<SiblingPath<typeof ARCHIVE_HEIGHT>> {
|
|
1026
|
-
const committedDb = await this.#getWorldState(block);
|
|
1027
|
-
return committedDb.getSiblingPath(MerkleTreeId.ARCHIVE, leafIndex);
|
|
1028
|
-
}
|
|
1029
|
-
|
|
1030
|
-
public async getPublicDataSiblingPath(
|
|
1031
|
-
block: BlockParameter,
|
|
1032
|
-
leafIndex: bigint,
|
|
1033
|
-
): Promise<SiblingPath<typeof PUBLIC_DATA_TREE_HEIGHT>> {
|
|
1034
|
-
const committedDb = await this.#getWorldState(block);
|
|
1035
|
-
return committedDb.getSiblingPath(MerkleTreeId.PUBLIC_DATA_TREE, leafIndex);
|
|
1036
|
-
}
|
|
1037
|
-
|
|
1038
999
|
public async getNullifierMembershipWitness(
|
|
1039
|
-
|
|
1000
|
+
referenceBlock: BlockParameter,
|
|
1040
1001
|
nullifier: Fr,
|
|
1041
1002
|
): Promise<NullifierMembershipWitness | undefined> {
|
|
1042
|
-
const db = await this.#getWorldState(
|
|
1003
|
+
const db = await this.#getWorldState(referenceBlock);
|
|
1043
1004
|
const [witness] = await db.findSiblingPaths(MerkleTreeId.NULLIFIER_TREE, [nullifier.toBuffer()]);
|
|
1044
1005
|
if (!witness) {
|
|
1045
1006
|
return undefined;
|
|
@@ -1056,7 +1017,8 @@ export class AztecNodeService implements AztecNode, AztecNodeAdmin, Traceable {
|
|
|
1056
1017
|
|
|
1057
1018
|
/**
|
|
1058
1019
|
* Returns a low nullifier membership witness for a given nullifier at a given block.
|
|
1059
|
-
* @param
|
|
1020
|
+
* @param referenceBlock - The block parameter (block number, block hash, or 'latest') at which to get the data
|
|
1021
|
+
* (which contains the root of the nullifier tree in which we are searching for the nullifier).
|
|
1060
1022
|
* @param nullifier - Nullifier we try to find the low nullifier witness for.
|
|
1061
1023
|
* @returns The low nullifier membership witness (if found).
|
|
1062
1024
|
* @remarks Low nullifier witness can be used to perform a nullifier non-inclusion proof by leveraging the "linked
|
|
@@ -1069,10 +1031,10 @@ export class AztecNodeService implements AztecNode, AztecNodeAdmin, Traceable {
|
|
|
1069
1031
|
* TODO: This is a confusing behavior and we should eventually address that.
|
|
1070
1032
|
*/
|
|
1071
1033
|
public async getLowNullifierMembershipWitness(
|
|
1072
|
-
|
|
1034
|
+
referenceBlock: BlockParameter,
|
|
1073
1035
|
nullifier: Fr,
|
|
1074
1036
|
): Promise<NullifierMembershipWitness | undefined> {
|
|
1075
|
-
const committedDb = await this.#getWorldState(
|
|
1037
|
+
const committedDb = await this.#getWorldState(referenceBlock);
|
|
1076
1038
|
const findResult = await committedDb.getPreviousValueIndex(MerkleTreeId.NULLIFIER_TREE, nullifier.toBigInt());
|
|
1077
1039
|
if (!findResult) {
|
|
1078
1040
|
return undefined;
|
|
@@ -1087,8 +1049,8 @@ export class AztecNodeService implements AztecNode, AztecNodeAdmin, Traceable {
|
|
|
1087
1049
|
return new NullifierMembershipWitness(BigInt(index), preimageData as NullifierLeafPreimage, siblingPath);
|
|
1088
1050
|
}
|
|
1089
1051
|
|
|
1090
|
-
async getPublicDataWitness(
|
|
1091
|
-
const committedDb = await this.#getWorldState(
|
|
1052
|
+
async getPublicDataWitness(referenceBlock: BlockParameter, leafSlot: Fr): Promise<PublicDataWitness | undefined> {
|
|
1053
|
+
const committedDb = await this.#getWorldState(referenceBlock);
|
|
1092
1054
|
const lowLeafResult = await committedDb.getPreviousValueIndex(MerkleTreeId.PUBLIC_DATA_TREE, leafSlot.toBigInt());
|
|
1093
1055
|
if (!lowLeafResult) {
|
|
1094
1056
|
return undefined;
|
|
@@ -1102,8 +1064,8 @@ export class AztecNodeService implements AztecNode, AztecNodeAdmin, Traceable {
|
|
|
1102
1064
|
}
|
|
1103
1065
|
}
|
|
1104
1066
|
|
|
1105
|
-
public async getPublicStorageAt(
|
|
1106
|
-
const committedDb = await this.#getWorldState(
|
|
1067
|
+
public async getPublicStorageAt(referenceBlock: BlockParameter, contract: AztecAddress, slot: Fr): Promise<Fr> {
|
|
1068
|
+
const committedDb = await this.#getWorldState(referenceBlock);
|
|
1107
1069
|
const leafSlot = await computePublicDataTreeLeafSlot(contract, slot);
|
|
1108
1070
|
|
|
1109
1071
|
const lowLeafResult = await committedDb.getPreviousValueIndex(MerkleTreeId.PUBLIC_DATA_TREE, leafSlot.toBigInt());
|
|
@@ -1118,14 +1080,13 @@ export class AztecNodeService implements AztecNode, AztecNodeAdmin, Traceable {
|
|
|
1118
1080
|
}
|
|
1119
1081
|
|
|
1120
1082
|
public async getBlockHeader(block: BlockParameter = 'latest'): Promise<BlockHeader | undefined> {
|
|
1121
|
-
if (BlockHash.
|
|
1083
|
+
if (BlockHash.isBlockHash(block)) {
|
|
1122
1084
|
const initialBlockHash = await this.#getInitialHeaderHash();
|
|
1123
1085
|
if (block.equals(initialBlockHash)) {
|
|
1124
1086
|
// Block source doesn't handle initial header so we need to handle the case separately.
|
|
1125
1087
|
return this.worldStateSynchronizer.getCommitted().getInitialHeader();
|
|
1126
1088
|
}
|
|
1127
|
-
|
|
1128
|
-
return this.blockSource.getBlockHeaderByHash(blockHashFr);
|
|
1089
|
+
return this.blockSource.getBlockHeaderByHash(block);
|
|
1129
1090
|
} else {
|
|
1130
1091
|
// Block source doesn't handle initial header so we need to handle the case separately.
|
|
1131
1092
|
const blockNumber = block === 'latest' ? await this.getBlockNumber() : (block as BlockNumber);
|
|
@@ -1183,6 +1144,7 @@ export class AztecNodeService implements AztecNode, AztecNodeAdmin, Traceable {
|
|
|
1183
1144
|
this.contractDataSource,
|
|
1184
1145
|
new DateProvider(),
|
|
1185
1146
|
this.telemetry,
|
|
1147
|
+
this.log.getBindings(),
|
|
1186
1148
|
);
|
|
1187
1149
|
|
|
1188
1150
|
this.log.verbose(`Simulating public calls for tx ${txHash}`, {
|
|
@@ -1191,6 +1153,10 @@ export class AztecNodeService implements AztecNode, AztecNodeAdmin, Traceable {
|
|
|
1191
1153
|
blockNumber,
|
|
1192
1154
|
});
|
|
1193
1155
|
|
|
1156
|
+
// Ensure world state is synced to the latest block before forking.
|
|
1157
|
+
// Without this, the fork may be behind the archiver, causing lookups
|
|
1158
|
+
// (e.g. L1-to-L2 message existence checks) to fail against stale state.
|
|
1159
|
+
await this.#syncWorldState();
|
|
1194
1160
|
const merkleTreeFork = await this.worldStateSynchronizer.fork();
|
|
1195
1161
|
try {
|
|
1196
1162
|
const config = PublicSimulatorConfig.from({
|
|
@@ -1233,19 +1199,25 @@ export class AztecNodeService implements AztecNode, AztecNodeAdmin, Traceable {
|
|
|
1233
1199
|
const db = this.worldStateSynchronizer.getCommitted();
|
|
1234
1200
|
const verifier = isSimulation ? undefined : this.proofVerifier;
|
|
1235
1201
|
|
|
1236
|
-
// We accept transactions if they are not expired by the next slot (checked based on the
|
|
1202
|
+
// We accept transactions if they are not expired by the next slot (checked based on the ExpirationTimestamp field)
|
|
1237
1203
|
const { ts: nextSlotTimestamp } = this.epochCache.getEpochAndSlotInNextL1Slot();
|
|
1238
1204
|
const blockNumber = BlockNumber((await this.blockSource.getBlockNumber()) + 1);
|
|
1239
|
-
const validator = createValidatorForAcceptingTxs(
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1205
|
+
const validator = createValidatorForAcceptingTxs(
|
|
1206
|
+
db,
|
|
1207
|
+
this.contractDataSource,
|
|
1208
|
+
verifier,
|
|
1209
|
+
{
|
|
1210
|
+
timestamp: nextSlotTimestamp,
|
|
1211
|
+
blockNumber,
|
|
1212
|
+
l1ChainId: this.l1ChainId,
|
|
1213
|
+
rollupVersion: this.version,
|
|
1214
|
+
setupAllowList: this.config.txPublicSetupAllowList ?? (await getDefaultAllowedSetupFunctions()),
|
|
1215
|
+
gasFees: await this.getCurrentMinFees(),
|
|
1216
|
+
skipFeeEnforcement,
|
|
1217
|
+
txsPermitted: !this.config.disableTransactions,
|
|
1218
|
+
},
|
|
1219
|
+
this.log.getBindings(),
|
|
1220
|
+
);
|
|
1249
1221
|
|
|
1250
1222
|
return await validator.validateTx(tx);
|
|
1251
1223
|
}
|
|
@@ -1435,15 +1407,14 @@ export class AztecNodeService implements AztecNode, AztecNodeAdmin, Traceable {
|
|
|
1435
1407
|
return this.worldStateSynchronizer.getCommitted();
|
|
1436
1408
|
}
|
|
1437
1409
|
|
|
1438
|
-
if (BlockHash.
|
|
1410
|
+
if (BlockHash.isBlockHash(block)) {
|
|
1439
1411
|
const initialBlockHash = await this.#getInitialHeaderHash();
|
|
1440
1412
|
if (block.equals(initialBlockHash)) {
|
|
1441
1413
|
// Block source doesn't handle initial header so we need to handle the case separately.
|
|
1442
1414
|
return this.worldStateSynchronizer.getSnapshot(BlockNumber.ZERO);
|
|
1443
1415
|
}
|
|
1444
1416
|
|
|
1445
|
-
const
|
|
1446
|
-
const header = await this.blockSource.getBlockHeaderByHash(blockHashFr);
|
|
1417
|
+
const header = await this.blockSource.getBlockHeaderByHash(block);
|
|
1447
1418
|
if (!header) {
|
|
1448
1419
|
throw new Error(
|
|
1449
1420
|
`Block hash ${block.toString()} not found when querying world state. If the node API has been queried with anchor block hash possibly a reorg has occurred.`,
|
package/src/sentinel/factory.ts
CHANGED
|
@@ -20,12 +20,7 @@ export async function createSentinel(
|
|
|
20
20
|
if (!config.sentinelEnabled) {
|
|
21
21
|
return undefined;
|
|
22
22
|
}
|
|
23
|
-
const kvStore = await createStore(
|
|
24
|
-
'sentinel',
|
|
25
|
-
SentinelStore.SCHEMA_VERSION,
|
|
26
|
-
config,
|
|
27
|
-
createLogger('node:sentinel:lmdb'),
|
|
28
|
-
);
|
|
23
|
+
const kvStore = await createStore('sentinel', SentinelStore.SCHEMA_VERSION, config, logger.getBindings());
|
|
29
24
|
const storeHistoryLength = config.sentinelHistoryLengthInEpochs * epochCache.getL1Constants().epochDuration;
|
|
30
25
|
const storeHistoricProvenPerformanceLength = config.sentinelHistoricProvenPerformanceLengthInEpochs;
|
|
31
26
|
const sentinelStore = new SentinelStore(kvStore, {
|