@aztec/aztec-node 0.0.1-commit.a072138 → 0.0.1-commit.a5db02d
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 +23 -8
- package/dest/aztec-node/config.d.ts.map +1 -1
- package/dest/aztec-node/config.js +26 -8
- 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 +140 -135
- package/dest/aztec-node/server.d.ts.map +1 -1
- package/dest/aztec-node/server.js +490 -730
- 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 +509 -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 +65 -0
- package/dest/modules/node_world_state_queries.d.ts.map +1 -0
- package/dest/modules/node_world_state_queries.js +272 -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 +6 -4
- package/dest/sentinel/factory.d.ts.map +1 -1
- package/dest/sentinel/factory.js +12 -5
- package/dest/sentinel/sentinel.d.ts +146 -22
- package/dest/sentinel/sentinel.d.ts.map +1 -1
- package/dest/sentinel/sentinel.js +266 -118
- package/dest/sentinel/store.d.ts +8 -8
- package/dest/sentinel/store.d.ts.map +1 -1
- package/dest/sentinel/store.js +33 -21
- package/dest/test/index.d.ts +3 -3
- package/dest/test/index.d.ts.map +1 -1
- package/package.json +28 -25
- package/src/aztec-node/block_response_helpers.ts +161 -0
- package/src/aztec-node/config.ts +55 -16
- 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 +632 -939
- package/src/bin/index.ts +19 -12
- package/src/factory.ts +673 -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 +374 -0
- package/src/sentinel/README.md +103 -0
- package/src/sentinel/config.ts +18 -6
- package/src/sentinel/factory.ts +22 -7
- package/src/sentinel/sentinel.ts +316 -136
- package/src/sentinel/store.ts +35 -27
- 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 ()=>{
|
|
@@ -134,16 +134,22 @@ 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-valid':
|
|
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;
|
|
149
|
+
case 'checkpoint-invalid':
|
|
150
|
+
return 7;
|
|
151
|
+
case 'checkpoint-unvalidated':
|
|
152
|
+
return 8;
|
|
147
153
|
default:
|
|
148
154
|
{
|
|
149
155
|
const _exhaustive = status;
|
|
@@ -154,15 +160,21 @@ export class SentinelStore {
|
|
|
154
160
|
statusFromNumber(status) {
|
|
155
161
|
switch(status){
|
|
156
162
|
case 1:
|
|
157
|
-
return '
|
|
163
|
+
return 'checkpoint-mined';
|
|
158
164
|
case 2:
|
|
159
|
-
return '
|
|
165
|
+
return 'checkpoint-valid';
|
|
160
166
|
case 3:
|
|
161
|
-
return '
|
|
167
|
+
return 'checkpoint-missed';
|
|
162
168
|
case 4:
|
|
163
169
|
return 'attestation-sent';
|
|
164
170
|
case 5:
|
|
165
171
|
return 'attestation-missed';
|
|
172
|
+
case 6:
|
|
173
|
+
return 'blocks-missed';
|
|
174
|
+
case 7:
|
|
175
|
+
return 'checkpoint-invalid';
|
|
176
|
+
case 8:
|
|
177
|
+
return 'checkpoint-unvalidated';
|
|
166
178
|
default:
|
|
167
179
|
throw new Error(`Unknown status: ${status}`);
|
|
168
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
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FDLE9BQU8sT0FBTyxvQkFBcUIsU0FBUSxnQkFBZ0I7SUFDakQsTUFBTSxFQUFFLGVBQWUsQ0FBQztJQUN4QixTQUFTLEVBQUUsR0FBRyxDQUFDO0lBQ2YsV0FBVyxFQUFFLGFBQWEsR0FBRyxPQUFPLENBQUMsT0FBTyxDQUFDLENBQUM7SUFDOUMsVUFBVSxFQUFFLFlBQVksQ0FBQztJQUN6QixrQkFBa0IsRUFBRSxrQkFBa0IsQ0FBQztJQUN2QyxtQkFBbUIsRUFBRSxtQkFBbUIsQ0FBQztJQUN6QyxzQkFBc0IsRUFBRSxzQkFBc0IsQ0FBQztJQUMvQyxTQUFTLEVBQUUsZUFBZSxHQUFHLFNBQVMsQ0FBQztJQUN2QyxhQUFhLEVBQUUsc0JBQXNCLEdBQUcsU0FBUyxDQUFDO0lBQ2xELGtCQUFrQixFQUFFLFFBQVEsR0FBRyxTQUFTLENBQUM7SUFDekMsc0JBQXNCLEVBQUUsc0JBQXNCLEdBQUcsU0FBUyxDQUFDO0lBQzNELFNBQVMsRUFBRSxNQUFNLENBQUM7SUFDbEIsT0FBTyxFQUFFLE1BQU0sQ0FBQztJQUNoQixxQkFBcUIsRUFBRSw4QkFBOEIsQ0FBQztJQUN0RCxVQUFVLEVBQUUsbUJBQW1CLENBQUM7SUFDaEMsY0FBYyxFQUFFLE1BQU0sQ0FBQztDQUN2QyJ9
|
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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AS,CAAC;IAC3D,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,qBAAqB,EAAE,8BAA8B,CAAC;IACtD,UAAU,EAAE,mBAAmB,CAAC;IAChC,cAAc,EAAE,MAAM,CAAC;CACvC"}
|
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.a5db02d",
|
|
4
4
|
"main": "dest/index.js",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -65,30 +65,33 @@
|
|
|
65
65
|
]
|
|
66
66
|
},
|
|
67
67
|
"dependencies": {
|
|
68
|
-
"@aztec/archiver": "0.0.1-commit.
|
|
69
|
-
"@aztec/bb-prover": "0.0.1-commit.
|
|
70
|
-
"@aztec/
|
|
71
|
-
"@aztec/
|
|
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/
|
|
85
|
-
"@aztec/
|
|
86
|
-
"@aztec/
|
|
87
|
-
"@aztec/
|
|
88
|
-
"@aztec/
|
|
89
|
-
"@aztec/
|
|
90
|
-
"@aztec/
|
|
91
|
-
"@aztec/
|
|
68
|
+
"@aztec/archiver": "0.0.1-commit.a5db02d",
|
|
69
|
+
"@aztec/bb-prover": "0.0.1-commit.a5db02d",
|
|
70
|
+
"@aztec/bb.js": "0.0.1-commit.a5db02d",
|
|
71
|
+
"@aztec/blob-client": "0.0.1-commit.a5db02d",
|
|
72
|
+
"@aztec/blob-lib": "0.0.1-commit.a5db02d",
|
|
73
|
+
"@aztec/constants": "0.0.1-commit.a5db02d",
|
|
74
|
+
"@aztec/epoch-cache": "0.0.1-commit.a5db02d",
|
|
75
|
+
"@aztec/ethereum": "0.0.1-commit.a5db02d",
|
|
76
|
+
"@aztec/foundation": "0.0.1-commit.a5db02d",
|
|
77
|
+
"@aztec/kv-store": "0.0.1-commit.a5db02d",
|
|
78
|
+
"@aztec/l1-artifacts": "0.0.1-commit.a5db02d",
|
|
79
|
+
"@aztec/node-keystore": "0.0.1-commit.a5db02d",
|
|
80
|
+
"@aztec/node-lib": "0.0.1-commit.a5db02d",
|
|
81
|
+
"@aztec/noir-protocol-circuits-types": "0.0.1-commit.a5db02d",
|
|
82
|
+
"@aztec/p2p": "0.0.1-commit.a5db02d",
|
|
83
|
+
"@aztec/protocol-contracts": "0.0.1-commit.a5db02d",
|
|
84
|
+
"@aztec/prover-client": "0.0.1-commit.a5db02d",
|
|
85
|
+
"@aztec/prover-node": "0.0.1-commit.a5db02d",
|
|
86
|
+
"@aztec/sequencer-client": "0.0.1-commit.a5db02d",
|
|
87
|
+
"@aztec/simulator": "0.0.1-commit.a5db02d",
|
|
88
|
+
"@aztec/slasher": "0.0.1-commit.a5db02d",
|
|
89
|
+
"@aztec/standard-contracts": "0.0.1-commit.a5db02d",
|
|
90
|
+
"@aztec/stdlib": "0.0.1-commit.a5db02d",
|
|
91
|
+
"@aztec/telemetry-client": "0.0.1-commit.a5db02d",
|
|
92
|
+
"@aztec/validator-client": "0.0.1-commit.a5db02d",
|
|
93
|
+
"@aztec/validator-ha-signer": "0.0.1-commit.a5db02d",
|
|
94
|
+
"@aztec/world-state": "0.0.1-commit.a5db02d",
|
|
92
95
|
"koa": "^2.16.1",
|
|
93
96
|
"koa-router": "^13.1.1",
|
|
94
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,9 +1,7 @@
|
|
|
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
|
-
import { type DataStoreConfig, dataConfigMappings } from '@aztec/kv-store/config';
|
|
7
5
|
import {
|
|
8
6
|
type KeyStore,
|
|
9
7
|
type ValidatorKeyStore,
|
|
@@ -13,15 +11,21 @@ import {
|
|
|
13
11
|
import { type SharedNodeConfig, sharedNodeConfigMappings } from '@aztec/node-lib/config';
|
|
14
12
|
import { type P2PConfig, p2pConfigMappings } from '@aztec/p2p/config';
|
|
15
13
|
import { type ProverClientUserConfig, proverClientConfigMappings } from '@aztec/prover-client/config';
|
|
14
|
+
import {
|
|
15
|
+
type ProverNodeConfig,
|
|
16
|
+
proverNodeConfigMappings,
|
|
17
|
+
specificProverNodeConfigMappings,
|
|
18
|
+
} from '@aztec/prover-node/config';
|
|
16
19
|
import {
|
|
17
20
|
type SequencerClientConfig,
|
|
18
|
-
type
|
|
21
|
+
type SequencerTxSenderConfig,
|
|
19
22
|
sequencerClientConfigMappings,
|
|
20
23
|
} from '@aztec/sequencer-client/config';
|
|
21
24
|
import { slasherConfigMappings } from '@aztec/slasher';
|
|
22
25
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
23
26
|
import { type NodeRPCConfig, nodeRpcConfigMappings } from '@aztec/stdlib/config';
|
|
24
27
|
import type { SlasherConfig } from '@aztec/stdlib/interfaces/server';
|
|
28
|
+
import { type DataStoreConfig, dataConfigMappings } from '@aztec/stdlib/kv-store';
|
|
25
29
|
import { type ValidatorClientConfig, validatorClientConfigMappings } from '@aztec/validator-client/config';
|
|
26
30
|
import { type WorldStateConfig, worldStateConfigMappings } from '@aztec/world-state/config';
|
|
27
31
|
|
|
@@ -46,16 +50,31 @@ export type AztecNodeConfig = ArchiverConfig &
|
|
|
46
50
|
SharedNodeConfig &
|
|
47
51
|
GenesisStateConfig &
|
|
48
52
|
NodeRPCConfig &
|
|
49
|
-
SlasherConfig &
|
|
50
|
-
|
|
51
|
-
l1Contracts: L1ContractAddresses;
|
|
53
|
+
SlasherConfig &
|
|
54
|
+
ProverNodeConfig & {
|
|
52
55
|
/** Whether the validator is disabled for this node */
|
|
53
56
|
disableValidator: boolean;
|
|
54
57
|
/** Whether to skip waiting for the archiver to be fully synced before starting other services */
|
|
55
58
|
skipArchiverInitialSync: boolean;
|
|
56
|
-
|
|
57
59
|
/** A flag to force verification of tx Chonk proofs. Only used for testnet */
|
|
58
60
|
debugForceTxProofVerification: boolean;
|
|
61
|
+
/** Whether to enable the prover node as a subsystem. */
|
|
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;
|
|
59
78
|
};
|
|
60
79
|
|
|
61
80
|
export const aztecNodeConfigMappings: ConfigMappingsType<AztecNodeConfig> = {
|
|
@@ -63,6 +82,7 @@ export const aztecNodeConfigMappings: ConfigMappingsType<AztecNodeConfig> = {
|
|
|
63
82
|
...keyStoreConfigMappings,
|
|
64
83
|
...archiverConfigMappings,
|
|
65
84
|
...sequencerClientConfigMappings,
|
|
85
|
+
...proverNodeConfigMappings,
|
|
66
86
|
...validatorClientConfigMappings,
|
|
67
87
|
...proverClientConfigMappings,
|
|
68
88
|
...worldStateConfigMappings,
|
|
@@ -72,10 +92,7 @@ export const aztecNodeConfigMappings: ConfigMappingsType<AztecNodeConfig> = {
|
|
|
72
92
|
...genesisStateConfigMappings,
|
|
73
93
|
...nodeRpcConfigMappings,
|
|
74
94
|
...slasherConfigMappings,
|
|
75
|
-
|
|
76
|
-
description: 'The deployed L1 contract addresses',
|
|
77
|
-
nested: l1ContractAddressesMapping,
|
|
78
|
-
},
|
|
95
|
+
...specificProverNodeConfigMappings,
|
|
79
96
|
disableValidator: {
|
|
80
97
|
env: 'VALIDATOR_DISABLED',
|
|
81
98
|
description: 'Whether the validator is disabled for this node.',
|
|
@@ -91,6 +108,26 @@ export const aztecNodeConfigMappings: ConfigMappingsType<AztecNodeConfig> = {
|
|
|
91
108
|
description: 'Whether to skip waiting for the archiver to be fully synced before starting other services.',
|
|
92
109
|
...booleanConfigHelper(false),
|
|
93
110
|
},
|
|
111
|
+
enableProverNode: {
|
|
112
|
+
env: 'ENABLE_PROVER_NODE',
|
|
113
|
+
description: 'Whether to enable the prover node as a subsystem.',
|
|
114
|
+
...booleanConfigHelper(false),
|
|
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
|
+
},
|
|
94
131
|
};
|
|
95
132
|
|
|
96
133
|
/**
|
|
@@ -101,7 +138,7 @@ export function getConfigEnvVars(): AztecNodeConfig {
|
|
|
101
138
|
return getConfigFromMappings<AztecNodeConfig>(aztecNodeConfigMappings);
|
|
102
139
|
}
|
|
103
140
|
|
|
104
|
-
type ConfigRequiredToBuildKeyStore =
|
|
141
|
+
type ConfigRequiredToBuildKeyStore = SequencerClientConfig & SharedNodeConfig & ValidatorClientConfig;
|
|
105
142
|
|
|
106
143
|
function createKeyStoreFromWeb3Signer(config: ConfigRequiredToBuildKeyStore): KeyStore | undefined {
|
|
107
144
|
const validatorKeyStores: ValidatorKeyStore[] = [];
|
|
@@ -120,7 +157,7 @@ function createKeyStoreFromWeb3Signer(config: ConfigRequiredToBuildKeyStore): Ke
|
|
|
120
157
|
feeRecipient: config.feeRecipient ?? AztecAddress.ZERO,
|
|
121
158
|
coinbase: config.coinbase ?? config.validatorAddresses[0],
|
|
122
159
|
remoteSigner: config.web3SignerUrl,
|
|
123
|
-
publisher: config.
|
|
160
|
+
publisher: config.sequencerPublisherAddresses ?? [],
|
|
124
161
|
});
|
|
125
162
|
|
|
126
163
|
const keyStore: KeyStore = {
|
|
@@ -145,8 +182,10 @@ function createKeyStoreFromPrivateKeys(config: ConfigRequiredToBuildKeyStore): K
|
|
|
145
182
|
const coinbase = config.coinbase ?? EthAddress.fromString(privateKeyToAddress(ethPrivateKeys[0]));
|
|
146
183
|
const feeRecipient = config.feeRecipient ?? AztecAddress.ZERO;
|
|
147
184
|
|
|
148
|
-
const publisherKeys = config.
|
|
149
|
-
? config.
|
|
185
|
+
const publisherKeys = config.sequencerPublisherPrivateKeys
|
|
186
|
+
? config.sequencerPublisherPrivateKeys.map((k: { getValue: () => string }) =>
|
|
187
|
+
ethPrivateKeySchema.parse(k.getValue()),
|
|
188
|
+
)
|
|
150
189
|
: [];
|
|
151
190
|
|
|
152
191
|
validatorKeyStores.push({
|
|
@@ -168,7 +207,7 @@ function createKeyStoreFromPrivateKeys(config: ConfigRequiredToBuildKeyStore): K
|
|
|
168
207
|
}
|
|
169
208
|
|
|
170
209
|
export function createKeyStoreForValidator(
|
|
171
|
-
config:
|
|
210
|
+
config: SequencerTxSenderConfig & SequencerClientConfig & SharedNodeConfig,
|
|
172
211
|
): KeyStore | undefined {
|
|
173
212
|
if (config.web3SignerUrl !== undefined && config.web3SignerUrl.length > 0) {
|
|
174
213
|
return createKeyStoreFromWeb3Signer(config);
|