@aztec/aztec-node 5.0.0-private.20260319 → 5.0.0-rc.2
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 +25 -0
- package/dest/aztec-node/block_response_helpers.d.ts.map +1 -0
- package/dest/aztec-node/block_response_helpers.js +112 -0
- package/dest/aztec-node/config.d.ts +16 -4
- package/dest/aztec-node/config.d.ts.map +1 -1
- package/dest/aztec-node/config.js +15 -5
- package/dest/aztec-node/node_public_calls_simulator.d.ts +90 -0
- package/dest/aztec-node/node_public_calls_simulator.d.ts.map +1 -0
- package/dest/aztec-node/node_public_calls_simulator.js +346 -0
- package/dest/aztec-node/public_data_overrides.d.ts +13 -0
- package/dest/aztec-node/public_data_overrides.d.ts.map +1 -0
- package/dest/aztec-node/public_data_overrides.js +21 -0
- package/dest/aztec-node/register_node_rpc_handlers.d.ts +10 -0
- package/dest/aztec-node/register_node_rpc_handlers.d.ts.map +1 -0
- package/dest/aztec-node/register_node_rpc_handlers.js +31 -0
- package/dest/aztec-node/server.d.ts +128 -134
- package/dest/aztec-node/server.d.ts.map +1 -1
- package/dest/aztec-node/server.js +393 -820
- package/dest/bin/index.js +15 -10
- package/dest/factory.d.ts +33 -0
- package/dest/factory.d.ts.map +1 -0
- package/dest/factory.js +496 -0
- package/dest/index.d.ts +3 -1
- package/dest/index.d.ts.map +1 -1
- package/dest/index.js +2 -0
- package/dest/modules/block_parameter.d.ts +25 -0
- package/dest/modules/block_parameter.d.ts.map +1 -0
- package/dest/modules/block_parameter.js +100 -0
- package/dest/modules/node_block_provider.d.ts +19 -0
- package/dest/modules/node_block_provider.d.ts.map +1 -0
- package/dest/modules/node_block_provider.js +112 -0
- package/dest/modules/node_tx_receipt.d.ts +24 -0
- package/dest/modules/node_tx_receipt.d.ts.map +1 -0
- package/dest/modules/node_tx_receipt.js +70 -0
- package/dest/modules/node_world_state_queries.d.ts +61 -0
- package/dest/modules/node_world_state_queries.d.ts.map +1 -0
- package/dest/modules/node_world_state_queries.js +257 -0
- package/dest/sentinel/config.d.ts +3 -2
- package/dest/sentinel/config.d.ts.map +1 -1
- package/dest/sentinel/config.js +15 -5
- package/dest/sentinel/factory.d.ts +5 -3
- package/dest/sentinel/factory.d.ts.map +1 -1
- package/dest/sentinel/factory.js +12 -5
- package/dest/sentinel/sentinel.d.ts +145 -21
- package/dest/sentinel/sentinel.d.ts.map +1 -1
- package/dest/sentinel/sentinel.js +227 -105
- package/dest/sentinel/store.d.ts +8 -8
- package/dest/sentinel/store.d.ts.map +1 -1
- package/dest/sentinel/store.js +25 -17
- package/dest/test/index.d.ts +3 -3
- package/dest/test/index.d.ts.map +1 -1
- package/package.json +28 -26
- package/src/aztec-node/block_response_helpers.ts +161 -0
- package/src/aztec-node/config.ts +30 -7
- package/src/aztec-node/node_public_calls_simulator.ts +383 -0
- package/src/aztec-node/public_data_overrides.ts +35 -0
- package/src/aztec-node/register_node_rpc_handlers.ts +29 -0
- package/src/aztec-node/server.ts +514 -1070
- package/src/bin/index.ts +19 -12
- package/src/factory.ts +656 -0
- package/src/index.ts +2 -0
- package/src/modules/block_parameter.ts +93 -0
- package/src/modules/node_block_provider.ts +149 -0
- package/src/modules/node_tx_receipt.ts +115 -0
- package/src/modules/node_world_state_queries.ts +360 -0
- package/src/sentinel/README.md +103 -0
- package/src/sentinel/config.ts +18 -6
- package/src/sentinel/factory.ts +21 -6
- package/src/sentinel/sentinel.ts +277 -130
- package/src/sentinel/store.ts +26 -18
- package/src/test/index.ts +2 -2
package/dest/sentinel/store.js
CHANGED
|
@@ -4,28 +4,28 @@ import { BufferReader, numToUInt8, numToUInt32BE, serializeToBuffer } from '@azt
|
|
|
4
4
|
export class SentinelStore {
|
|
5
5
|
store;
|
|
6
6
|
config;
|
|
7
|
-
static SCHEMA_VERSION =
|
|
7
|
+
static SCHEMA_VERSION = 4;
|
|
8
8
|
// a map from validator address to their ValidatorStatusHistory
|
|
9
9
|
historyMap;
|
|
10
|
-
// a map from validator address to their historical
|
|
10
|
+
// a map from validator address to their historical epoch performance, evaluated at end-of-epoch.
|
|
11
11
|
// e.g. { validator: [{ epoch: 1, missed: 1, total: 10 }, { epoch: 2, missed: 3, total: 7 }, ...] }
|
|
12
|
-
|
|
12
|
+
epochMap;
|
|
13
13
|
constructor(store, config){
|
|
14
14
|
this.store = store;
|
|
15
15
|
this.config = config;
|
|
16
16
|
this.historyMap = store.openMap('sentinel-validator-status');
|
|
17
|
-
this.
|
|
17
|
+
this.epochMap = store.openMap('sentinel-validator-epoch');
|
|
18
18
|
}
|
|
19
19
|
getHistoryLength() {
|
|
20
20
|
return this.config.historyLength;
|
|
21
21
|
}
|
|
22
|
-
|
|
23
|
-
return this.config.
|
|
22
|
+
getHistoricEpochPerformanceLength() {
|
|
23
|
+
return this.config.historicEpochPerformanceLength;
|
|
24
24
|
}
|
|
25
|
-
async
|
|
25
|
+
async updateEpochPerformance(epoch, performance) {
|
|
26
26
|
await this.store.transactionAsync(async ()=>{
|
|
27
27
|
for (const [who, { missed, total }] of Object.entries(performance)){
|
|
28
|
-
await this.
|
|
28
|
+
await this.pushValidatorEpochPerformance({
|
|
29
29
|
who: EthAddress.fromString(who),
|
|
30
30
|
missed,
|
|
31
31
|
total,
|
|
@@ -34,12 +34,12 @@ export class SentinelStore {
|
|
|
34
34
|
}
|
|
35
35
|
});
|
|
36
36
|
}
|
|
37
|
-
async
|
|
38
|
-
const currentPerformanceBuffer = await this.
|
|
37
|
+
async getEpochPerformance(who) {
|
|
38
|
+
const currentPerformanceBuffer = await this.epochMap.getAsync(who.toString());
|
|
39
39
|
return currentPerformanceBuffer ? this.deserializePerformance(currentPerformanceBuffer) : [];
|
|
40
40
|
}
|
|
41
|
-
async
|
|
42
|
-
const currentPerformance = await this.
|
|
41
|
+
async pushValidatorEpochPerformance({ who, missed, total, epoch }) {
|
|
42
|
+
const currentPerformance = await this.getEpochPerformance(who);
|
|
43
43
|
const existingIndex = currentPerformance.findIndex((p)=>p.epoch === epoch);
|
|
44
44
|
if (existingIndex !== -1) {
|
|
45
45
|
currentPerformance[existingIndex] = {
|
|
@@ -57,9 +57,9 @@ export class SentinelStore {
|
|
|
57
57
|
// This should be sorted by epoch, but just in case.
|
|
58
58
|
// Since we keep the size small, this is not a big deal.
|
|
59
59
|
currentPerformance.sort((a, b)=>Number(a.epoch - b.epoch));
|
|
60
|
-
// keep the most recent `
|
|
61
|
-
const performanceToKeep = currentPerformance.slice(-this.config.
|
|
62
|
-
await this.
|
|
60
|
+
// keep the most recent `historicEpochPerformanceLength` entries.
|
|
61
|
+
const performanceToKeep = currentPerformance.slice(-this.config.historicEpochPerformanceLength);
|
|
62
|
+
await this.epochMap.set(who.toString(), this.serializePerformance(performanceToKeep));
|
|
63
63
|
}
|
|
64
64
|
async updateValidators(slot, statuses) {
|
|
65
65
|
await this.store.transactionAsync(async ()=>{
|
|
@@ -136,7 +136,7 @@ export class SentinelStore {
|
|
|
136
136
|
switch(status){
|
|
137
137
|
case 'checkpoint-mined':
|
|
138
138
|
return 1;
|
|
139
|
-
case 'checkpoint-
|
|
139
|
+
case 'checkpoint-valid':
|
|
140
140
|
return 2;
|
|
141
141
|
case 'checkpoint-missed':
|
|
142
142
|
return 3;
|
|
@@ -146,6 +146,10 @@ export class SentinelStore {
|
|
|
146
146
|
return 5;
|
|
147
147
|
case 'blocks-missed':
|
|
148
148
|
return 6;
|
|
149
|
+
case 'checkpoint-invalid':
|
|
150
|
+
return 7;
|
|
151
|
+
case 'checkpoint-unvalidated':
|
|
152
|
+
return 8;
|
|
149
153
|
default:
|
|
150
154
|
{
|
|
151
155
|
const _exhaustive = status;
|
|
@@ -158,7 +162,7 @@ export class SentinelStore {
|
|
|
158
162
|
case 1:
|
|
159
163
|
return 'checkpoint-mined';
|
|
160
164
|
case 2:
|
|
161
|
-
return 'checkpoint-
|
|
165
|
+
return 'checkpoint-valid';
|
|
162
166
|
case 3:
|
|
163
167
|
return 'checkpoint-missed';
|
|
164
168
|
case 4:
|
|
@@ -167,6 +171,10 @@ export class SentinelStore {
|
|
|
167
171
|
return 'attestation-missed';
|
|
168
172
|
case 6:
|
|
169
173
|
return 'blocks-missed';
|
|
174
|
+
case 7:
|
|
175
|
+
return 'checkpoint-invalid';
|
|
176
|
+
case 8:
|
|
177
|
+
return 'checkpoint-unvalidated';
|
|
170
178
|
default:
|
|
171
179
|
throw new Error(`Unknown status: ${status}`);
|
|
172
180
|
}
|
package/dest/test/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { EpochCacheInterface } from '@aztec/epoch-cache';
|
|
2
2
|
import type { P2P } from '@aztec/p2p';
|
|
3
3
|
import { SequencerClient } from '@aztec/sequencer-client';
|
|
4
|
-
import {
|
|
4
|
+
import { DataWithholdingWatcher, type SlasherClientInterface } from '@aztec/slasher';
|
|
5
5
|
import type { L2BlockSource } from '@aztec/stdlib/block';
|
|
6
6
|
import type { ContractDataSource } from '@aztec/stdlib/contract';
|
|
7
7
|
import type { L2LogsSource, Service, WorldStateSynchronizer } from '@aztec/stdlib/interfaces/server';
|
|
@@ -21,11 +21,11 @@ export declare class TestAztecNodeService extends AztecNodeService {
|
|
|
21
21
|
sequencer: SequencerClient | undefined;
|
|
22
22
|
slasherClient: SlasherClientInterface | undefined;
|
|
23
23
|
validatorsSentinel: Sentinel | undefined;
|
|
24
|
-
|
|
24
|
+
dataWithholdingWatcher: DataWithholdingWatcher | undefined;
|
|
25
25
|
l1ChainId: number;
|
|
26
26
|
version: number;
|
|
27
27
|
globalVariableBuilder: GlobalVariableBuilderInterface;
|
|
28
28
|
epochCache: EpochCacheInterface;
|
|
29
29
|
packageVersion: string;
|
|
30
30
|
}
|
|
31
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
31
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL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RyxPQUFPLENBQUMsT0FBTyxDQUFDLENBQUM7SUFDOUMsVUFBVSxFQUFFLFlBQVksQ0FBQztJQUN6QixrQkFBa0IsRUFBRSxrQkFBa0IsQ0FBQztJQUN2QyxtQkFBbUIsRUFBRSxtQkFBbUIsQ0FBQztJQUN6QyxzQkFBc0IsRUFBRSxzQkFBc0IsQ0FBQztJQUMvQyxTQUFTLEVBQUUsZUFBZSxHQUFHLFNBQVMsQ0FBQztJQUN2QyxhQUFhLEVBQUUsc0JBQXNCLEdBQUcsU0FBUyxDQUFDO0lBQ2xELGtCQUFrQixFQUFFLFFBQVEsR0FBRyxTQUFTLENBQUM7SUFDekMsc0JBQXNCLEVBQUUsc0JBQXNCLEdBQUcsU0FBUyxDQUFDO0lBQzNELFNBQVMsRUFBRSxNQUFNLENBQUM7SUFDbEIsT0FBTyxFQUFFLE1BQU0sQ0FBQztJQUNoQixxQkFBcUIsRUFBRSw4QkFBOEIsQ0FBQztJQUN0RCxVQUFVLEVBQUUsbUJBQW1CLENBQUM7SUFDaEMsY0FBYyxFQUFFLE1BQU0sQ0FBQztDQUN2QyJ9
|
package/dest/test/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/test/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAC9D,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/test/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAC9D,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,eAAe,EAAE,MAAM,yBAA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vC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/aztec-node",
|
|
3
|
-
"version": "5.0.0-
|
|
3
|
+
"version": "5.0.0-rc.2",
|
|
4
4
|
"main": "dest/index.js",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -65,31 +65,33 @@
|
|
|
65
65
|
]
|
|
66
66
|
},
|
|
67
67
|
"dependencies": {
|
|
68
|
-
"@aztec/archiver": "5.0.0-
|
|
69
|
-
"@aztec/bb-prover": "5.0.0-
|
|
70
|
-
"@aztec/
|
|
71
|
-
"@aztec/blob-
|
|
72
|
-
"@aztec/
|
|
73
|
-
"@aztec/
|
|
74
|
-
"@aztec/
|
|
75
|
-
"@aztec/
|
|
76
|
-
"@aztec/
|
|
77
|
-
"@aztec/
|
|
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/
|
|
92
|
-
"@aztec/
|
|
68
|
+
"@aztec/archiver": "5.0.0-rc.2",
|
|
69
|
+
"@aztec/bb-prover": "5.0.0-rc.2",
|
|
70
|
+
"@aztec/bb.js": "5.0.0-rc.2",
|
|
71
|
+
"@aztec/blob-client": "5.0.0-rc.2",
|
|
72
|
+
"@aztec/blob-lib": "5.0.0-rc.2",
|
|
73
|
+
"@aztec/constants": "5.0.0-rc.2",
|
|
74
|
+
"@aztec/epoch-cache": "5.0.0-rc.2",
|
|
75
|
+
"@aztec/ethereum": "5.0.0-rc.2",
|
|
76
|
+
"@aztec/foundation": "5.0.0-rc.2",
|
|
77
|
+
"@aztec/kv-store": "5.0.0-rc.2",
|
|
78
|
+
"@aztec/l1-artifacts": "5.0.0-rc.2",
|
|
79
|
+
"@aztec/node-keystore": "5.0.0-rc.2",
|
|
80
|
+
"@aztec/node-lib": "5.0.0-rc.2",
|
|
81
|
+
"@aztec/noir-protocol-circuits-types": "5.0.0-rc.2",
|
|
82
|
+
"@aztec/p2p": "5.0.0-rc.2",
|
|
83
|
+
"@aztec/protocol-contracts": "5.0.0-rc.2",
|
|
84
|
+
"@aztec/prover-client": "5.0.0-rc.2",
|
|
85
|
+
"@aztec/prover-node": "5.0.0-rc.2",
|
|
86
|
+
"@aztec/sequencer-client": "5.0.0-rc.2",
|
|
87
|
+
"@aztec/simulator": "5.0.0-rc.2",
|
|
88
|
+
"@aztec/slasher": "5.0.0-rc.2",
|
|
89
|
+
"@aztec/standard-contracts": "5.0.0-rc.2",
|
|
90
|
+
"@aztec/stdlib": "5.0.0-rc.2",
|
|
91
|
+
"@aztec/telemetry-client": "5.0.0-rc.2",
|
|
92
|
+
"@aztec/validator-client": "5.0.0-rc.2",
|
|
93
|
+
"@aztec/validator-ha-signer": "5.0.0-rc.2",
|
|
94
|
+
"@aztec/world-state": "5.0.0-rc.2",
|
|
93
95
|
"koa": "^2.16.1",
|
|
94
96
|
"koa-router": "^13.1.1",
|
|
95
97
|
"tslib": "^2.4.0",
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
import { BlockNumber } from '@aztec/foundation/branded-types';
|
|
2
|
+
import { type BlockData, type CommitteeAttestation, L2Block } from '@aztec/stdlib/block';
|
|
3
|
+
import type {
|
|
4
|
+
CheckpointData,
|
|
5
|
+
L1PublishedData,
|
|
6
|
+
ProposedCheckpointData,
|
|
7
|
+
PublishedCheckpoint,
|
|
8
|
+
} from '@aztec/stdlib/checkpoint';
|
|
9
|
+
import {
|
|
10
|
+
type BlockIncludeOptions,
|
|
11
|
+
type BlockResponse,
|
|
12
|
+
type CheckpointIncludeOptions,
|
|
13
|
+
type CheckpointResponse,
|
|
14
|
+
l1PublishInfoFromL1PublishedData,
|
|
15
|
+
} from '@aztec/stdlib/interfaces/client';
|
|
16
|
+
|
|
17
|
+
/** Projects a full {@link L2Block} into a {@link BlockResponse}, attaching L1 / attestation context when provided. */
|
|
18
|
+
export async function blockResponseFromL2Block(
|
|
19
|
+
block: L2Block,
|
|
20
|
+
options: BlockIncludeOptions,
|
|
21
|
+
context?: { l1?: L1PublishedData; attestations?: CommitteeAttestation[] },
|
|
22
|
+
): Promise<BlockResponse> {
|
|
23
|
+
const response: BlockResponse = {
|
|
24
|
+
header: block.header,
|
|
25
|
+
archive: block.archive,
|
|
26
|
+
hash: await block.hash(),
|
|
27
|
+
checkpointNumber: block.checkpointNumber,
|
|
28
|
+
indexWithinCheckpoint: block.indexWithinCheckpoint,
|
|
29
|
+
number: block.number,
|
|
30
|
+
};
|
|
31
|
+
if (options.includeTransactions) {
|
|
32
|
+
(response as BlockResponse).body = block.body;
|
|
33
|
+
}
|
|
34
|
+
if (options.includeL1PublishInfo) {
|
|
35
|
+
(response as BlockResponse).l1 = l1PublishInfoFromL1PublishedData(context?.l1);
|
|
36
|
+
}
|
|
37
|
+
if (options.includeAttestations) {
|
|
38
|
+
(response as BlockResponse).attestations = context?.attestations ?? [];
|
|
39
|
+
}
|
|
40
|
+
return response;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/** Projects metadata-only {@link BlockData} into a {@link BlockResponse}. */
|
|
44
|
+
export function blockResponseFromBlockData(
|
|
45
|
+
data: BlockData,
|
|
46
|
+
options: BlockIncludeOptions,
|
|
47
|
+
context?: { l1?: L1PublishedData; attestations?: CommitteeAttestation[] },
|
|
48
|
+
): BlockResponse {
|
|
49
|
+
const response: BlockResponse = {
|
|
50
|
+
header: data.header,
|
|
51
|
+
archive: data.archive,
|
|
52
|
+
hash: data.blockHash,
|
|
53
|
+
checkpointNumber: data.checkpointNumber,
|
|
54
|
+
indexWithinCheckpoint: data.indexWithinCheckpoint,
|
|
55
|
+
number: data.header.getBlockNumber(),
|
|
56
|
+
};
|
|
57
|
+
if (options.includeL1PublishInfo) {
|
|
58
|
+
(response as BlockResponse).l1 = l1PublishInfoFromL1PublishedData(context?.l1);
|
|
59
|
+
}
|
|
60
|
+
if (options.includeAttestations) {
|
|
61
|
+
(response as BlockResponse).attestations = context?.attestations ?? [];
|
|
62
|
+
}
|
|
63
|
+
return response;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/** Projects a {@link PublishedCheckpoint} into a {@link CheckpointResponse}. */
|
|
67
|
+
export async function checkpointResponseFromPublishedCheckpoint(
|
|
68
|
+
pc: PublishedCheckpoint,
|
|
69
|
+
options: CheckpointIncludeOptions,
|
|
70
|
+
): Promise<CheckpointResponse> {
|
|
71
|
+
const response: CheckpointResponse = {
|
|
72
|
+
number: pc.checkpoint.number,
|
|
73
|
+
header: pc.checkpoint.header,
|
|
74
|
+
archive: pc.checkpoint.archive,
|
|
75
|
+
checkpointOutHash: pc.checkpoint.getCheckpointOutHash(),
|
|
76
|
+
startBlock: pc.checkpoint.blocks[0]?.number ?? BlockNumber.ZERO,
|
|
77
|
+
blockCount: pc.checkpoint.blocks.length,
|
|
78
|
+
feeAssetPriceModifier: pc.checkpoint.feeAssetPriceModifier,
|
|
79
|
+
};
|
|
80
|
+
if (options.includeBlocks) {
|
|
81
|
+
(response as CheckpointResponse).blocks = await Promise.all(
|
|
82
|
+
pc.checkpoint.blocks.map(block =>
|
|
83
|
+
blockResponseFromL2Block(block, {
|
|
84
|
+
includeTransactions: options.includeTransactions,
|
|
85
|
+
includeL1PublishInfo: false,
|
|
86
|
+
includeAttestations: false,
|
|
87
|
+
}),
|
|
88
|
+
),
|
|
89
|
+
);
|
|
90
|
+
}
|
|
91
|
+
if (options.includeL1PublishInfo) {
|
|
92
|
+
(response as CheckpointResponse).l1 = l1PublishInfoFromL1PublishedData(pc.l1);
|
|
93
|
+
}
|
|
94
|
+
if (options.includeAttestations) {
|
|
95
|
+
(response as CheckpointResponse).attestations = pc.attestations;
|
|
96
|
+
}
|
|
97
|
+
return response;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/** Projects metadata-only {@link CheckpointData} into a {@link CheckpointResponse}. `includeBlocks` is ignored (no blocks loaded). */
|
|
101
|
+
export function checkpointResponseFromCheckpointData(
|
|
102
|
+
cd: CheckpointData,
|
|
103
|
+
options: CheckpointIncludeOptions,
|
|
104
|
+
): CheckpointResponse {
|
|
105
|
+
const response: CheckpointResponse = {
|
|
106
|
+
number: cd.checkpointNumber,
|
|
107
|
+
header: cd.header,
|
|
108
|
+
archive: cd.archive,
|
|
109
|
+
checkpointOutHash: cd.checkpointOutHash,
|
|
110
|
+
startBlock: cd.startBlock,
|
|
111
|
+
blockCount: cd.blockCount,
|
|
112
|
+
feeAssetPriceModifier: cd.feeAssetPriceModifier,
|
|
113
|
+
};
|
|
114
|
+
if (options.includeL1PublishInfo) {
|
|
115
|
+
(response as CheckpointResponse).l1 = l1PublishInfoFromL1PublishedData(cd.l1);
|
|
116
|
+
}
|
|
117
|
+
if (options.includeAttestations) {
|
|
118
|
+
(response as CheckpointResponse).attestations = cd.attestations;
|
|
119
|
+
}
|
|
120
|
+
return response;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* Projects a {@link ProposedCheckpointData} into a {@link CheckpointResponse}.
|
|
125
|
+
* Pure projection — caller pre-fetches `blocks` via `blockSource.getBlocks(...)` when
|
|
126
|
+
* `options.includeBlocks` is true. Throws if `includeL1PublishInfo` or `includeAttestations`
|
|
127
|
+
* is requested (proposed checkpoints have no L1 publish info or attestations).
|
|
128
|
+
*/
|
|
129
|
+
export async function projectProposedToCheckpointResponse(
|
|
130
|
+
proposed: ProposedCheckpointData,
|
|
131
|
+
options: CheckpointIncludeOptions,
|
|
132
|
+
blocks?: L2Block[],
|
|
133
|
+
): Promise<CheckpointResponse> {
|
|
134
|
+
if (options.includeL1PublishInfo || options.includeAttestations) {
|
|
135
|
+
throw new Error('Proposed checkpoints have no L1 publish info or attestations');
|
|
136
|
+
}
|
|
137
|
+
const response: CheckpointResponse = {
|
|
138
|
+
number: proposed.checkpointNumber,
|
|
139
|
+
header: proposed.header,
|
|
140
|
+
archive: proposed.archive,
|
|
141
|
+
checkpointOutHash: proposed.checkpointOutHash,
|
|
142
|
+
startBlock: proposed.startBlock,
|
|
143
|
+
blockCount: proposed.blockCount,
|
|
144
|
+
feeAssetPriceModifier: proposed.feeAssetPriceModifier,
|
|
145
|
+
};
|
|
146
|
+
if (options.includeBlocks) {
|
|
147
|
+
if (!blocks) {
|
|
148
|
+
throw new Error('Blocks must be supplied when includeBlocks is true');
|
|
149
|
+
}
|
|
150
|
+
(response as CheckpointResponse).blocks = await Promise.all(
|
|
151
|
+
blocks.map(block =>
|
|
152
|
+
blockResponseFromL2Block(block, {
|
|
153
|
+
includeTransactions: options.includeTransactions,
|
|
154
|
+
includeL1PublishInfo: false,
|
|
155
|
+
includeAttestations: false,
|
|
156
|
+
}),
|
|
157
|
+
),
|
|
158
|
+
);
|
|
159
|
+
}
|
|
160
|
+
return response;
|
|
161
|
+
}
|
package/src/aztec-node/config.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { type ArchiverConfig, archiverConfigMappings } from '@aztec/archiver/config';
|
|
2
2
|
import { type GenesisStateConfig, genesisStateConfigMappings } from '@aztec/ethereum/config';
|
|
3
|
-
import { type L1ContractAddresses, l1ContractAddressesMapping } from '@aztec/ethereum/l1-contract-addresses';
|
|
4
3
|
import { type ConfigMappingsType, booleanConfigHelper, getConfigFromMappings } from '@aztec/foundation/config';
|
|
5
4
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
6
5
|
import {
|
|
@@ -53,8 +52,6 @@ export type AztecNodeConfig = ArchiverConfig &
|
|
|
53
52
|
NodeRPCConfig &
|
|
54
53
|
SlasherConfig &
|
|
55
54
|
ProverNodeConfig & {
|
|
56
|
-
/** L1 contracts addresses */
|
|
57
|
-
l1Contracts: L1ContractAddresses;
|
|
58
55
|
/** Whether the validator is disabled for this node */
|
|
59
56
|
disableValidator: boolean;
|
|
60
57
|
/** Whether to skip waiting for the archiver to be fully synced before starting other services */
|
|
@@ -63,6 +60,21 @@ export type AztecNodeConfig = ArchiverConfig &
|
|
|
63
60
|
debugForceTxProofVerification: boolean;
|
|
64
61
|
/** Whether to enable the prover node as a subsystem. */
|
|
65
62
|
enableProverNode: boolean;
|
|
63
|
+
/** Whether to run the slashing watchers to collect offenses even if not a validator. */
|
|
64
|
+
enableOffenseCollection: boolean;
|
|
65
|
+
/**
|
|
66
|
+
* Test-only: use the deterministic AutomineSequencer instead of the production Sequencer.
|
|
67
|
+
* Requires `aztecTargetCommitteeSize === 0` on the deployed rollup and anvil-backed L1.
|
|
68
|
+
* See `AUTOMINE_E2E_OPTS` in `end-to-end/src/fixtures/fixtures.ts`.
|
|
69
|
+
*/
|
|
70
|
+
useAutomineSequencer?: boolean;
|
|
71
|
+
/**
|
|
72
|
+
* Test-only: have the AutomineSequencer automatically prove epochs (write epoch out hashes into
|
|
73
|
+
* the L1 Outbox and advance the proven tip) as checkpoints land, replacing the standalone
|
|
74
|
+
* `EpochTestSettler`. Set by the local network/sandbox; the e2e `AUTOMINE_E2E_OPTS` fixture leaves
|
|
75
|
+
* it off so tests drive proving manually via `prove` / `cheatCodes.rollup.markAsProven`.
|
|
76
|
+
*/
|
|
77
|
+
automineEnableProveEpoch?: boolean;
|
|
66
78
|
};
|
|
67
79
|
|
|
68
80
|
export const aztecNodeConfigMappings: ConfigMappingsType<AztecNodeConfig> = {
|
|
@@ -81,10 +93,6 @@ export const aztecNodeConfigMappings: ConfigMappingsType<AztecNodeConfig> = {
|
|
|
81
93
|
...nodeRpcConfigMappings,
|
|
82
94
|
...slasherConfigMappings,
|
|
83
95
|
...specificProverNodeConfigMappings,
|
|
84
|
-
l1Contracts: {
|
|
85
|
-
description: 'The deployed L1 contract addresses',
|
|
86
|
-
nested: l1ContractAddressesMapping,
|
|
87
|
-
},
|
|
88
96
|
disableValidator: {
|
|
89
97
|
env: 'VALIDATOR_DISABLED',
|
|
90
98
|
description: 'Whether the validator is disabled for this node.',
|
|
@@ -105,6 +113,21 @@ export const aztecNodeConfigMappings: ConfigMappingsType<AztecNodeConfig> = {
|
|
|
105
113
|
description: 'Whether to enable the prover node as a subsystem.',
|
|
106
114
|
...booleanConfigHelper(false),
|
|
107
115
|
},
|
|
116
|
+
enableOffenseCollection: {
|
|
117
|
+
env: 'OFFENSE_COLLECTION_ENABLED',
|
|
118
|
+
description: 'Whether to run the slashing watchers to collect offenses even if not a validator.',
|
|
119
|
+
...booleanConfigHelper(false),
|
|
120
|
+
},
|
|
121
|
+
useAutomineSequencer: {
|
|
122
|
+
env: 'USE_AUTOMINE_SEQUENCER',
|
|
123
|
+
description: 'Test-only: use AutomineSequencer instead of the production Sequencer.',
|
|
124
|
+
...booleanConfigHelper(false),
|
|
125
|
+
},
|
|
126
|
+
automineEnableProveEpoch: {
|
|
127
|
+
env: 'AUTOMINE_ENABLE_PROVE_EPOCH',
|
|
128
|
+
description: 'Test-only: have the AutomineSequencer automatically prove epochs as checkpoints land.',
|
|
129
|
+
...booleanConfigHelper(false),
|
|
130
|
+
},
|
|
108
131
|
};
|
|
109
132
|
|
|
110
133
|
/**
|