@aztec-labs/aztec-node 6.0.0-nightly.20260829

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.
Files changed (83) hide show
  1. package/README.md +15 -0
  2. package/dest/aztec-node/block_response_helpers.d.ts +25 -0
  3. package/dest/aztec-node/block_response_helpers.d.ts.map +1 -0
  4. package/dest/aztec-node/block_response_helpers.js +112 -0
  5. package/dest/aztec-node/config.d.ts +52 -0
  6. package/dest/aztec-node/config.d.ts.map +1 -0
  7. package/dest/aztec-node/config.js +129 -0
  8. package/dest/aztec-node/node_metrics.d.ts +12 -0
  9. package/dest/aztec-node/node_metrics.d.ts.map +1 -0
  10. package/dest/aztec-node/node_metrics.js +36 -0
  11. package/dest/aztec-node/node_public_calls_simulator.d.ts +108 -0
  12. package/dest/aztec-node/node_public_calls_simulator.d.ts.map +1 -0
  13. package/dest/aztec-node/node_public_calls_simulator.js +380 -0
  14. package/dest/aztec-node/public_data_overrides.d.ts +13 -0
  15. package/dest/aztec-node/public_data_overrides.d.ts.map +1 -0
  16. package/dest/aztec-node/public_data_overrides.js +21 -0
  17. package/dest/aztec-node/register_node_rpc_handlers.d.ts +11 -0
  18. package/dest/aztec-node/register_node_rpc_handlers.d.ts.map +1 -0
  19. package/dest/aztec-node/register_node_rpc_handlers.js +48 -0
  20. package/dest/aztec-node/server.d.ts +281 -0
  21. package/dest/aztec-node/server.d.ts.map +1 -0
  22. package/dest/aztec-node/server.js +1235 -0
  23. package/dest/bin/index.d.ts +3 -0
  24. package/dest/bin/index.d.ts.map +1 -0
  25. package/dest/bin/index.js +57 -0
  26. package/dest/factory.d.ts +33 -0
  27. package/dest/factory.d.ts.map +1 -0
  28. package/dest/factory.js +539 -0
  29. package/dest/index.d.ts +5 -0
  30. package/dest/index.d.ts.map +1 -0
  31. package/dest/index.js +4 -0
  32. package/dest/modules/block_parameter.d.ts +25 -0
  33. package/dest/modules/block_parameter.d.ts.map +1 -0
  34. package/dest/modules/block_parameter.js +100 -0
  35. package/dest/modules/node_block_provider.d.ts +19 -0
  36. package/dest/modules/node_block_provider.d.ts.map +1 -0
  37. package/dest/modules/node_block_provider.js +112 -0
  38. package/dest/modules/node_tx_receipt.d.ts +24 -0
  39. package/dest/modules/node_tx_receipt.d.ts.map +1 -0
  40. package/dest/modules/node_tx_receipt.js +70 -0
  41. package/dest/modules/node_world_state_queries.d.ts +65 -0
  42. package/dest/modules/node_world_state_queries.d.ts.map +1 -0
  43. package/dest/modules/node_world_state_queries.js +270 -0
  44. package/dest/sentinel/config.d.ts +9 -0
  45. package/dest/sentinel/config.d.ts.map +1 -0
  46. package/dest/sentinel/config.js +39 -0
  47. package/dest/sentinel/factory.d.ts +11 -0
  48. package/dest/sentinel/factory.d.ts.map +1 -0
  49. package/dest/sentinel/factory.js +24 -0
  50. package/dest/sentinel/index.d.ts +3 -0
  51. package/dest/sentinel/index.d.ts.map +1 -0
  52. package/dest/sentinel/index.js +1 -0
  53. package/dest/sentinel/sentinel.d.ts +217 -0
  54. package/dest/sentinel/sentinel.d.ts.map +1 -0
  55. package/dest/sentinel/sentinel.js +551 -0
  56. package/dest/sentinel/store.d.ts +35 -0
  57. package/dest/sentinel/store.d.ts.map +1 -0
  58. package/dest/sentinel/store.js +182 -0
  59. package/dest/test/index.d.ts +31 -0
  60. package/dest/test/index.d.ts.map +1 -0
  61. package/dest/test/index.js +1 -0
  62. package/package.json +118 -0
  63. package/src/aztec-node/block_response_helpers.ts +161 -0
  64. package/src/aztec-node/config.ts +216 -0
  65. package/src/aztec-node/node_metrics.ts +49 -0
  66. package/src/aztec-node/node_public_calls_simulator.ts +437 -0
  67. package/src/aztec-node/public_data_overrides.ts +35 -0
  68. package/src/aztec-node/register_node_rpc_handlers.ts +45 -0
  69. package/src/aztec-node/server.ts +1155 -0
  70. package/src/bin/index.ts +77 -0
  71. package/src/factory.ts +704 -0
  72. package/src/index.ts +4 -0
  73. package/src/modules/block_parameter.ts +93 -0
  74. package/src/modules/node_block_provider.ts +149 -0
  75. package/src/modules/node_tx_receipt.ts +115 -0
  76. package/src/modules/node_world_state_queries.ts +373 -0
  77. package/src/sentinel/README.md +103 -0
  78. package/src/sentinel/config.ts +49 -0
  79. package/src/sentinel/factory.ts +46 -0
  80. package/src/sentinel/index.ts +8 -0
  81. package/src/sentinel/sentinel.ts +694 -0
  82. package/src/sentinel/store.ts +193 -0
  83. package/src/test/index.ts +32 -0
@@ -0,0 +1,216 @@
1
+ import { type ArchiverConfig, archiverConfigMappings } from '@aztec-labs/archiver/config';
2
+ import { type GenesisStateConfig, genesisStateConfigMappings } from '@aztec-labs/ethereum/config';
3
+ import { type ConfigMappingsType, booleanConfigHelper, getConfigFromMappings } from '@aztec-labs/foundation/config';
4
+ import { EthAddress } from '@aztec-labs/foundation/eth-address';
5
+ import {
6
+ type KeyStore,
7
+ type ValidatorKeyStore,
8
+ ethPrivateKeySchema,
9
+ keyStoreConfigMappings,
10
+ } from '@aztec-labs/node-keystore';
11
+ import { type SharedNodeConfig, sharedNodeConfigMappings } from '@aztec-labs/node-lib/config';
12
+ import { type P2PConfig, p2pConfigMappings } from '@aztec-labs/p2p/config';
13
+ import { type ProverClientUserConfig, proverClientConfigMappings } from '@aztec-labs/prover-client/config';
14
+ import {
15
+ type ProverNodeConfig,
16
+ proverNodeConfigMappings,
17
+ specificProverNodeConfigMappings,
18
+ } from '@aztec-labs/prover-node/config';
19
+ import {
20
+ type SequencerClientConfig,
21
+ type SequencerTxSenderConfig,
22
+ sequencerClientConfigMappings,
23
+ } from '@aztec-labs/sequencer-client/config';
24
+ import { slasherConfigMappings } from '@aztec-labs/slasher';
25
+ import { AztecAddress } from '@aztec-labs/stdlib/aztec-address';
26
+ import { type NodeRPCConfig, nodeRpcConfigMappings } from '@aztec-labs/stdlib/config';
27
+ import type { SlasherConfig } from '@aztec-labs/stdlib/interfaces/server';
28
+ import { type DataStoreConfig, dataConfigMappings } from '@aztec-labs/stdlib/kv-store';
29
+ import { type ValidatorClientConfig, validatorClientConfigMappings } from '@aztec-labs/validator-client/config';
30
+ import { type WorldStateConfig, worldStateConfigMappings } from '@aztec-labs/world-state/config';
31
+ import { privateKeyToAddress } from 'viem/accounts';
32
+
33
+ import { type SentinelConfig, sentinelConfigMappings } from '../sentinel/config.js';
34
+
35
+ export { sequencerClientConfigMappings, type SequencerClientConfig };
36
+
37
+ /**
38
+ * The configuration the aztec node.
39
+ */
40
+ export type AztecNodeConfig = ArchiverConfig &
41
+ SequencerClientConfig &
42
+ ValidatorClientConfig &
43
+ ProverClientUserConfig &
44
+ WorldStateConfig &
45
+ Pick<ProverClientUserConfig, 'bbBinaryPath' | 'bbWorkingDirectory' | 'realProofs'> &
46
+ P2PConfig &
47
+ DataStoreConfig &
48
+ SentinelConfig &
49
+ SharedNodeConfig &
50
+ GenesisStateConfig &
51
+ NodeRPCConfig &
52
+ SlasherConfig &
53
+ ProverNodeConfig & {
54
+ /** Whether the validator is disabled for this node */
55
+ disableValidator: boolean;
56
+ /** Whether to skip waiting for the archiver to be fully synced before starting other services */
57
+ skipArchiverInitialSync: boolean;
58
+ /** A flag to force verification of tx Chonk proofs. Only used for testnet */
59
+ debugForceTxProofVerification: boolean;
60
+ /** Whether to enable the prover node as a subsystem. */
61
+ enableProverNode: boolean;
62
+ /** Whether to run the slashing watchers to collect offenses even if not a validator. */
63
+ enableOffenseCollection: boolean;
64
+ /**
65
+ * Test-only: use the deterministic AutomineSequencer instead of the production Sequencer.
66
+ * Requires `aztecTargetCommitteeSize === 0` on the deployed rollup and anvil-backed L1.
67
+ * See `AUTOMINE_E2E_OPTS` in `end-to-end/src/fixtures/fixtures.ts`.
68
+ */
69
+ useAutomineSequencer?: boolean;
70
+ /**
71
+ * Test-only: have the AutomineSequencer automatically prove epochs (write epoch out hashes into
72
+ * the L1 Outbox and advance the proven tip) as checkpoints land, replacing the standalone
73
+ * `EpochTestSettler`. Set by the local network/sandbox; the e2e `AUTOMINE_E2E_OPTS` fixture leaves
74
+ * it off so tests drive proving manually via `prove` / `cheatCodes.rollup.markAsProven`.
75
+ */
76
+ automineEnableProveEpoch?: boolean;
77
+ };
78
+
79
+ export const aztecNodeConfigMappings: ConfigMappingsType<AztecNodeConfig> = {
80
+ ...dataConfigMappings,
81
+ ...keyStoreConfigMappings,
82
+ ...archiverConfigMappings,
83
+ ...sequencerClientConfigMappings,
84
+ ...proverNodeConfigMappings,
85
+ ...validatorClientConfigMappings,
86
+ ...proverClientConfigMappings,
87
+ ...worldStateConfigMappings,
88
+ ...p2pConfigMappings,
89
+ ...sentinelConfigMappings,
90
+ ...sharedNodeConfigMappings,
91
+ ...genesisStateConfigMappings,
92
+ ...nodeRpcConfigMappings,
93
+ ...slasherConfigMappings,
94
+ ...specificProverNodeConfigMappings,
95
+ disableValidator: {
96
+ env: 'VALIDATOR_DISABLED',
97
+ description: 'Whether the validator is disabled for this node.',
98
+ ...booleanConfigHelper(),
99
+ },
100
+ skipArchiverInitialSync: {
101
+ env: 'SKIP_ARCHIVER_INITIAL_SYNC',
102
+ description: 'Whether to skip waiting for the archiver to be fully synced before starting other services.',
103
+ ...booleanConfigHelper(false),
104
+ },
105
+ debugForceTxProofVerification: {
106
+ env: 'DEBUG_FORCE_TX_PROOF_VERIFICATION',
107
+ description: 'Whether to skip waiting for the archiver to be fully synced before starting other services.',
108
+ ...booleanConfigHelper(false),
109
+ },
110
+ enableProverNode: {
111
+ env: 'ENABLE_PROVER_NODE',
112
+ description: 'Whether to enable the prover node as a subsystem.',
113
+ ...booleanConfigHelper(false),
114
+ },
115
+ enableOffenseCollection: {
116
+ env: 'OFFENSE_COLLECTION_ENABLED',
117
+ description: 'Whether to run the slashing watchers to collect offenses even if not a validator.',
118
+ ...booleanConfigHelper(false),
119
+ },
120
+ useAutomineSequencer: {
121
+ env: 'USE_AUTOMINE_SEQUENCER',
122
+ description: 'Test-only: use AutomineSequencer instead of the production Sequencer.',
123
+ ...booleanConfigHelper(false),
124
+ },
125
+ automineEnableProveEpoch: {
126
+ env: 'AUTOMINE_ENABLE_PROVE_EPOCH',
127
+ description: 'Test-only: have the AutomineSequencer automatically prove epochs as checkpoints land.',
128
+ ...booleanConfigHelper(false),
129
+ },
130
+ };
131
+
132
+ /**
133
+ * Returns the config of the aztec node from environment variables with reasonable defaults.
134
+ * @returns A valid aztec node config.
135
+ */
136
+ export function getConfigEnvVars(): AztecNodeConfig {
137
+ return getConfigFromMappings<AztecNodeConfig>(aztecNodeConfigMappings);
138
+ }
139
+
140
+ type ConfigRequiredToBuildKeyStore = SequencerClientConfig & SharedNodeConfig & ValidatorClientConfig;
141
+
142
+ function createKeyStoreFromWeb3Signer(config: ConfigRequiredToBuildKeyStore): KeyStore | undefined {
143
+ const validatorKeyStores: ValidatorKeyStore[] = [];
144
+
145
+ if (
146
+ config.web3SignerUrl === undefined ||
147
+ config.web3SignerUrl.length === 0 ||
148
+ config.validatorAddresses === undefined ||
149
+ config.validatorAddresses.length === 0
150
+ ) {
151
+ return undefined;
152
+ }
153
+
154
+ validatorKeyStores.push({
155
+ attester: config.validatorAddresses,
156
+ feeRecipient: config.feeRecipient ?? AztecAddress.ZERO,
157
+ coinbase: config.coinbase ?? config.validatorAddresses[0],
158
+ remoteSigner: config.web3SignerUrl,
159
+ publisher: config.sequencerPublisherAddresses ?? [],
160
+ });
161
+
162
+ const keyStore: KeyStore = {
163
+ schemaVersion: 1,
164
+ slasher: undefined,
165
+ prover: undefined,
166
+ remoteSigner: undefined,
167
+ validators: validatorKeyStores,
168
+ };
169
+ return keyStore;
170
+ }
171
+
172
+ function createKeyStoreFromPrivateKeys(config: ConfigRequiredToBuildKeyStore): KeyStore | undefined {
173
+ const validatorKeyStores: ValidatorKeyStore[] = [];
174
+ const ethPrivateKeys = config.validatorPrivateKeys
175
+ ? config.validatorPrivateKeys.getValue().map((x: string) => ethPrivateKeySchema.parse(x))
176
+ : [];
177
+
178
+ if (!ethPrivateKeys.length) {
179
+ return undefined;
180
+ }
181
+ const coinbase = config.coinbase ?? EthAddress.fromString(privateKeyToAddress(ethPrivateKeys[0]));
182
+ const feeRecipient = config.feeRecipient ?? AztecAddress.ZERO;
183
+
184
+ const publisherKeys = config.sequencerPublisherPrivateKeys
185
+ ? config.sequencerPublisherPrivateKeys.map((k: { getValue: () => string }) =>
186
+ ethPrivateKeySchema.parse(k.getValue()),
187
+ )
188
+ : [];
189
+
190
+ validatorKeyStores.push({
191
+ attester: ethPrivateKeys,
192
+ feeRecipient: feeRecipient,
193
+ coinbase: coinbase,
194
+ remoteSigner: undefined,
195
+ publisher: publisherKeys,
196
+ });
197
+
198
+ const keyStore: KeyStore = {
199
+ schemaVersion: 1,
200
+ slasher: undefined,
201
+ prover: undefined,
202
+ remoteSigner: undefined,
203
+ validators: validatorKeyStores,
204
+ };
205
+ return keyStore;
206
+ }
207
+
208
+ export function createKeyStoreForValidator(
209
+ config: SequencerTxSenderConfig & SequencerClientConfig & SharedNodeConfig,
210
+ ): KeyStore | undefined {
211
+ if (config.web3SignerUrl !== undefined && config.web3SignerUrl.length > 0) {
212
+ return createKeyStoreFromWeb3Signer(config);
213
+ }
214
+
215
+ return createKeyStoreFromPrivateKeys(config);
216
+ }
@@ -0,0 +1,49 @@
1
+ import {
2
+ Attributes,
3
+ type Histogram,
4
+ Metrics,
5
+ type TelemetryClient,
6
+ type UpDownCounter,
7
+ createUpDownCounterWithDefault,
8
+ } from '@aztec-labs/telemetry-client';
9
+
10
+ export class NodeMetrics {
11
+ private receiveTxCount: UpDownCounter;
12
+ private receiveTxDuration: Histogram;
13
+
14
+ private snapshotErrorCount: UpDownCounter;
15
+ private snapshotDuration: Histogram;
16
+
17
+ constructor(client: TelemetryClient, name = 'AztecNode') {
18
+ const meter = client.getMeter(name);
19
+ this.receiveTxCount = createUpDownCounterWithDefault(meter, Metrics.NODE_RECEIVE_TX_COUNT, {
20
+ [Attributes.OK]: [true, false],
21
+ });
22
+ this.receiveTxDuration = meter.createHistogram(Metrics.NODE_RECEIVE_TX_DURATION);
23
+
24
+ this.snapshotDuration = meter.createHistogram(Metrics.NODE_SNAPSHOT_DURATION);
25
+
26
+ this.snapshotErrorCount = createUpDownCounterWithDefault(meter, Metrics.NODE_SNAPSHOT_ERROR_COUNT);
27
+ }
28
+
29
+ receivedTx(durationMs: number, isAccepted: boolean) {
30
+ this.receiveTxDuration.record(Math.ceil(durationMs), {
31
+ [Attributes.OK]: isAccepted,
32
+ });
33
+ this.receiveTxCount.add(1, {
34
+ [Attributes.OK]: isAccepted,
35
+ });
36
+ }
37
+
38
+ recordSnapshot(durationMs: number) {
39
+ if (isNaN(durationMs)) {
40
+ return;
41
+ }
42
+
43
+ this.snapshotDuration.record(Math.ceil(durationMs));
44
+ }
45
+
46
+ recordSnapshotError() {
47
+ this.snapshotErrorCount.add(1);
48
+ }
49
+ }