@aztec/aztec-node 4.0.0-nightly.20250907 → 4.0.0-nightly.20260107

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.
@@ -1,21 +1,13 @@
1
1
  import { type ArchiverConfig, archiverConfigMappings } from '@aztec/archiver/config';
2
- import {
3
- type GenesisStateConfig,
4
- type L1ContractAddresses,
5
- genesisStateConfigMappings,
6
- l1ContractAddressesMapping,
7
- } from '@aztec/ethereum';
2
+ import { type GenesisStateConfig, genesisStateConfigMappings } from '@aztec/ethereum/config';
3
+ import { type L1ContractAddresses, l1ContractAddressesMapping } from '@aztec/ethereum/l1-contract-addresses';
8
4
  import { type ConfigMappingsType, booleanConfigHelper, getConfigFromMappings } from '@aztec/foundation/config';
5
+ import { EthAddress } from '@aztec/foundation/eth-address';
9
6
  import { type DataStoreConfig, dataConfigMappings } from '@aztec/kv-store/config';
10
7
  import {
11
- type AztecAddressHex,
12
- type EthAddressHex,
13
- type EthPrivateKey,
14
- type EthRemoteSignerAccount,
15
- type Hex,
16
8
  type KeyStore,
17
- type KeyStoreConfig,
18
9
  type ValidatorKeyStore,
10
+ ethPrivateKeySchema,
19
11
  keyStoreConfigMappings,
20
12
  } from '@aztec/node-keystore';
21
13
  import { type SharedNodeConfig, sharedNodeConfigMappings } from '@aztec/node-lib/config';
@@ -50,7 +42,6 @@ export type AztecNodeConfig = ArchiverConfig &
50
42
  Pick<ProverClientUserConfig, 'bbBinaryPath' | 'bbWorkingDirectory' | 'realProofs'> &
51
43
  P2PConfig &
52
44
  DataStoreConfig &
53
- KeyStoreConfig &
54
45
  SentinelConfig &
55
46
  SharedNodeConfig &
56
47
  GenesisStateConfig &
@@ -60,6 +51,11 @@ export type AztecNodeConfig = ArchiverConfig &
60
51
  l1Contracts: L1ContractAddresses;
61
52
  /** Whether the validator is disabled for this node */
62
53
  disableValidator: boolean;
54
+ /** Whether to skip waiting for the archiver to be fully synced before starting other services */
55
+ skipArchiverInitialSync: boolean;
56
+
57
+ /** A flag to force verification of tx Chonk proofs. Only used for testnet */
58
+ debugForceTxProofVerification: boolean;
63
59
  };
64
60
 
65
61
  export const aztecNodeConfigMappings: ConfigMappingsType<AztecNodeConfig> = {
@@ -85,6 +81,16 @@ export const aztecNodeConfigMappings: ConfigMappingsType<AztecNodeConfig> = {
85
81
  description: 'Whether the validator is disabled for this node.',
86
82
  ...booleanConfigHelper(),
87
83
  },
84
+ skipArchiverInitialSync: {
85
+ env: 'SKIP_ARCHIVER_INITIAL_SYNC',
86
+ description: 'Whether to skip waiting for the archiver to be fully synced before starting other services.',
87
+ ...booleanConfigHelper(false),
88
+ },
89
+ debugForceTxProofVerification: {
90
+ env: 'DEBUG_FORCE_TX_PROOF_VERIFICATION',
91
+ description: 'Whether to skip waiting for the archiver to be fully synced before starting other services.',
92
+ ...booleanConfigHelper(false),
93
+ },
88
94
  };
89
95
 
90
96
  /**
@@ -97,7 +103,7 @@ export function getConfigEnvVars(): AztecNodeConfig {
97
103
 
98
104
  type ConfigRequiredToBuildKeyStore = TxSenderConfig & SequencerClientConfig & SharedNodeConfig & ValidatorClientConfig;
99
105
 
100
- function createKeyStoreFromWeb3Signer(config: ConfigRequiredToBuildKeyStore) {
106
+ function createKeyStoreFromWeb3Signer(config: ConfigRequiredToBuildKeyStore): KeyStore | undefined {
101
107
  const validatorKeyStores: ValidatorKeyStore[] = [];
102
108
 
103
109
  if (
@@ -108,22 +114,13 @@ function createKeyStoreFromWeb3Signer(config: ConfigRequiredToBuildKeyStore) {
108
114
  ) {
109
115
  return undefined;
110
116
  }
111
- const coinbase = config.coinbase ? config.coinbase.toString() : config.validatorAddresses[0].toString();
112
- const feeRecipient = config.feeRecipient ? config.feeRecipient.toString() : AztecAddress.ZERO.toString();
113
-
114
- const publisherAddresses =
115
- config.publisherAddresses && config.publisherAddresses.length > 0
116
- ? config.publisherAddresses.map(k => k.toChecksumString() as EthRemoteSignerAccount)
117
- : [];
118
-
119
- const attestors = config.validatorAddresses.map(k => k.toChecksumString() as EthRemoteSignerAccount);
120
117
 
121
118
  validatorKeyStores.push({
122
- attester: attestors,
123
- feeRecipient: feeRecipient as AztecAddressHex,
124
- coinbase: coinbase as EthAddressHex,
119
+ attester: config.validatorAddresses,
120
+ feeRecipient: config.feeRecipient ?? AztecAddress.ZERO,
121
+ coinbase: config.coinbase ?? config.validatorAddresses[0],
125
122
  remoteSigner: config.web3SignerUrl,
126
- publisher: publisherAddresses,
123
+ publisher: config.publisherAddresses ?? [],
127
124
  });
128
125
 
129
126
  const keyStore: KeyStore = {
@@ -136,30 +133,26 @@ function createKeyStoreFromWeb3Signer(config: ConfigRequiredToBuildKeyStore) {
136
133
  return keyStore;
137
134
  }
138
135
 
139
- function createKeyStoreFromPrivateKeys(config: ConfigRequiredToBuildKeyStore) {
136
+ function createKeyStoreFromPrivateKeys(config: ConfigRequiredToBuildKeyStore): KeyStore | undefined {
140
137
  const validatorKeyStores: ValidatorKeyStore[] = [];
141
- const ethPrivateKeys: EthPrivateKey[] = [];
142
- const validatorKeys = config.validatorPrivateKeys ? config.validatorPrivateKeys.getValue() : [];
143
- for (let i = 0; i < validatorKeys.length; i++) {
144
- const key = validatorKeys[i];
145
- const ethPrivateKey: EthPrivateKey = key as Hex<32>;
146
- ethPrivateKeys.push(ethPrivateKey);
147
- }
138
+ const ethPrivateKeys = config.validatorPrivateKeys
139
+ ? config.validatorPrivateKeys.getValue().map((x: string) => ethPrivateKeySchema.parse(x))
140
+ : [];
148
141
 
149
142
  if (!ethPrivateKeys.length) {
150
143
  return undefined;
151
144
  }
152
- const coinbase = config.coinbase ? config.coinbase.toString() : privateKeyToAddress(ethPrivateKeys[0]);
153
- const feeRecipient = config.feeRecipient ? config.feeRecipient.toString() : AztecAddress.ZERO.toString();
145
+ const coinbase = config.coinbase ?? EthAddress.fromString(privateKeyToAddress(ethPrivateKeys[0]));
146
+ const feeRecipient = config.feeRecipient ?? AztecAddress.ZERO;
154
147
 
155
148
  const publisherKeys = config.publisherPrivateKeys
156
- ? config.publisherPrivateKeys.map(k => k.getValue() as EthPrivateKey)
149
+ ? config.publisherPrivateKeys.map((k: { getValue: () => string }) => ethPrivateKeySchema.parse(k.getValue()))
157
150
  : [];
158
151
 
159
152
  validatorKeyStores.push({
160
153
  attester: ethPrivateKeys,
161
- feeRecipient: feeRecipient as AztecAddressHex,
162
- coinbase: coinbase as EthAddressHex,
154
+ feeRecipient: feeRecipient,
155
+ coinbase: coinbase,
163
156
  remoteSigner: undefined,
164
157
  publisher: publisherKeys,
165
158
  });
@@ -174,7 +167,9 @@ function createKeyStoreFromPrivateKeys(config: ConfigRequiredToBuildKeyStore) {
174
167
  return keyStore;
175
168
  }
176
169
 
177
- export function createKeyStoreForValidator(config: TxSenderConfig & SequencerClientConfig & SharedNodeConfig) {
170
+ export function createKeyStoreForValidator(
171
+ config: TxSenderConfig & SequencerClientConfig & SharedNodeConfig,
172
+ ): KeyStore | undefined {
178
173
  if (config.web3SignerUrl !== undefined && config.web3SignerUrl.length > 0) {
179
174
  return createKeyStoreFromWeb3Signer(config);
180
175
  }
@@ -11,6 +11,9 @@ export class NodeMetrics {
11
11
  private receiveTxCount: UpDownCounter;
12
12
  private receiveTxDuration: Histogram;
13
13
 
14
+ private snapshotErrorCount: UpDownCounter;
15
+ private snapshotDuration: Histogram;
16
+
14
17
  constructor(client: TelemetryClient, name = 'AztecNode') {
15
18
  const meter = client.getMeter(name);
16
19
  this.receiveTxCount = meter.createUpDownCounter(Metrics.NODE_RECEIVE_TX_COUNT, {});
@@ -19,6 +22,19 @@ export class NodeMetrics {
19
22
  unit: 'ms',
20
23
  valueType: ValueType.INT,
21
24
  });
25
+
26
+ this.snapshotDuration = meter.createHistogram(Metrics.NODE_SNAPSHOT_DURATION, {
27
+ description: 'How long taking a snapshot takes',
28
+ unit: 'ms',
29
+ valueType: ValueType.INT,
30
+ });
31
+
32
+ this.snapshotErrorCount = meter.createUpDownCounter(Metrics.NODE_SNAPSHOT_ERROR_COUNT, {
33
+ description: 'How many snapshot errors have happened',
34
+ valueType: ValueType.INT,
35
+ });
36
+
37
+ this.snapshotErrorCount.add(0);
22
38
  }
23
39
 
24
40
  receivedTx(durationMs: number, isAccepted: boolean) {
@@ -29,4 +45,16 @@ export class NodeMetrics {
29
45
  [Attributes.OK]: isAccepted,
30
46
  });
31
47
  }
48
+
49
+ recordSnapshot(durationMs: number) {
50
+ if (isNaN(durationMs)) {
51
+ return;
52
+ }
53
+
54
+ this.snapshotDuration.record(Math.ceil(durationMs));
55
+ }
56
+
57
+ recordSnapshotError() {
58
+ this.snapshotErrorCount.add(1);
59
+ }
32
60
  }