@aztec/aztec-node 0.0.0-test.1 → 0.0.1-commit.0b941701

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 (48) hide show
  1. package/dest/aztec-node/config.d.ts +18 -10
  2. package/dest/aztec-node/config.d.ts.map +1 -1
  3. package/dest/aztec-node/config.js +81 -14
  4. package/dest/aztec-node/node_metrics.d.ts +5 -1
  5. package/dest/aztec-node/node_metrics.d.ts.map +1 -1
  6. package/dest/aztec-node/node_metrics.js +17 -7
  7. package/dest/aztec-node/server.d.ts +114 -141
  8. package/dest/aztec-node/server.d.ts.map +1 -1
  9. package/dest/aztec-node/server.js +1093 -339
  10. package/dest/bin/index.d.ts +1 -1
  11. package/dest/bin/index.js +4 -2
  12. package/dest/index.d.ts +1 -2
  13. package/dest/index.d.ts.map +1 -1
  14. package/dest/index.js +0 -1
  15. package/dest/sentinel/config.d.ts +8 -0
  16. package/dest/sentinel/config.d.ts.map +1 -0
  17. package/dest/sentinel/config.js +29 -0
  18. package/dest/sentinel/factory.d.ts +9 -0
  19. package/dest/sentinel/factory.d.ts.map +1 -0
  20. package/dest/sentinel/factory.js +17 -0
  21. package/dest/sentinel/index.d.ts +3 -0
  22. package/dest/sentinel/index.d.ts.map +1 -0
  23. package/dest/sentinel/index.js +1 -0
  24. package/dest/sentinel/sentinel.d.ts +93 -0
  25. package/dest/sentinel/sentinel.d.ts.map +1 -0
  26. package/dest/sentinel/sentinel.js +403 -0
  27. package/dest/sentinel/store.d.ts +35 -0
  28. package/dest/sentinel/store.d.ts.map +1 -0
  29. package/dest/sentinel/store.js +170 -0
  30. package/dest/test/index.d.ts +31 -0
  31. package/dest/test/index.d.ts.map +1 -0
  32. package/dest/test/index.js +1 -0
  33. package/package.json +46 -35
  34. package/src/aztec-node/config.ts +132 -25
  35. package/src/aztec-node/node_metrics.ts +24 -14
  36. package/src/aztec-node/server.ts +902 -418
  37. package/src/bin/index.ts +4 -2
  38. package/src/index.ts +0 -1
  39. package/src/sentinel/config.ts +37 -0
  40. package/src/sentinel/factory.ts +36 -0
  41. package/src/sentinel/index.ts +8 -0
  42. package/src/sentinel/sentinel.ts +510 -0
  43. package/src/sentinel/store.ts +185 -0
  44. package/src/test/index.ts +32 -0
  45. package/dest/aztec-node/http_rpc_server.d.ts +0 -8
  46. package/dest/aztec-node/http_rpc_server.d.ts.map +0 -1
  47. package/dest/aztec-node/http_rpc_server.js +0 -9
  48. package/src/aztec-node/http_rpc_server.ts +0 -11
@@ -1,20 +1,31 @@
1
1
  import { type ArchiverConfig } from '@aztec/archiver/config';
2
+ import { type GenesisStateConfig } from '@aztec/ethereum/config';
3
+ import { type L1ContractAddresses } from '@aztec/ethereum/l1-contract-addresses';
2
4
  import { type ConfigMappingsType } from '@aztec/foundation/config';
3
5
  import { type DataStoreConfig } from '@aztec/kv-store/config';
6
+ import { type KeyStore } from '@aztec/node-keystore';
7
+ import { type SharedNodeConfig } from '@aztec/node-lib/config';
4
8
  import { type P2PConfig } from '@aztec/p2p/config';
5
- import { type ProverClientConfig } from '@aztec/prover-client/config';
6
- import { type SequencerClientConfig, sequencerClientConfigMappings } from '@aztec/sequencer-client/config';
9
+ import { type ProverClientUserConfig } from '@aztec/prover-client/config';
10
+ import { type SequencerClientConfig, type TxSenderConfig, sequencerClientConfigMappings } from '@aztec/sequencer-client/config';
11
+ import { type NodeRPCConfig } from '@aztec/stdlib/config';
12
+ import type { SlasherConfig } from '@aztec/stdlib/interfaces/server';
7
13
  import { type ValidatorClientConfig } from '@aztec/validator-client/config';
8
14
  import { type WorldStateConfig } from '@aztec/world-state/config';
15
+ import { type SentinelConfig } from '../sentinel/config.js';
9
16
  export { sequencerClientConfigMappings, type SequencerClientConfig };
10
17
  /**
11
18
  * The configuration the aztec node.
12
19
  */
13
- export type AztecNodeConfig = ArchiverConfig & SequencerClientConfig & ValidatorClientConfig & ProverClientConfig & WorldStateConfig & Pick<ProverClientConfig, 'bbBinaryPath' | 'bbWorkingDirectory' | 'realProofs'> & P2PConfig & DataStoreConfig & {
20
+ export type AztecNodeConfig = ArchiverConfig & SequencerClientConfig & ValidatorClientConfig & ProverClientUserConfig & WorldStateConfig & Pick<ProverClientUserConfig, 'bbBinaryPath' | 'bbWorkingDirectory' | 'realProofs'> & P2PConfig & DataStoreConfig & SentinelConfig & SharedNodeConfig & GenesisStateConfig & NodeRPCConfig & SlasherConfig & {
21
+ /** L1 contracts addresses */
22
+ l1Contracts: L1ContractAddresses;
14
23
  /** Whether the validator is disabled for this node */
15
24
  disableValidator: boolean;
16
- /** Whether to populate the genesis state with initial fee juice for the test accounts */
17
- testAccounts: boolean;
25
+ /** Whether to skip waiting for the archiver to be fully synced before starting other services */
26
+ skipArchiverInitialSync: boolean;
27
+ /** A flag to force verification of tx Chonk proofs. Only used for testnet */
28
+ debugForceTxProofVerification: boolean;
18
29
  };
19
30
  export declare const aztecNodeConfigMappings: ConfigMappingsType<AztecNodeConfig>;
20
31
  /**
@@ -22,8 +33,5 @@ export declare const aztecNodeConfigMappings: ConfigMappingsType<AztecNodeConfig
22
33
  * @returns A valid aztec node config.
23
34
  */
24
35
  export declare function getConfigEnvVars(): AztecNodeConfig;
25
- /**
26
- * Returns package version.
27
- */
28
- export declare function getPackageVersion(): any;
29
- //# sourceMappingURL=config.d.ts.map
36
+ export declare function createKeyStoreForValidator(config: TxSenderConfig & SequencerClientConfig & SharedNodeConfig): KeyStore | undefined;
37
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29uZmlnLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvYXp0ZWMtbm9kZS9jb25maWcudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLEtBQUssY0FBYyxFQUEwQixNQUFNLHdCQUF3QixDQUFDO0FBQ3JGLE9BQU8sRUFBRSxLQUFLLGtCQUFrQixFQUE4QixNQUFNLHdC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c,GAAG,qBAAqB,GAAG,gBAAgB,GAChE,QAAQ,GAAG,SAAS,CAMtB"}
@@ -1,32 +1,54 @@
1
1
  import { archiverConfigMappings } from '@aztec/archiver/config';
2
+ import { genesisStateConfigMappings } from '@aztec/ethereum/config';
3
+ import { l1ContractAddressesMapping } from '@aztec/ethereum/l1-contract-addresses';
2
4
  import { booleanConfigHelper, getConfigFromMappings } from '@aztec/foundation/config';
5
+ import { EthAddress } from '@aztec/foundation/eth-address';
3
6
  import { dataConfigMappings } from '@aztec/kv-store/config';
7
+ import { ethPrivateKeySchema, keyStoreConfigMappings } from '@aztec/node-keystore';
8
+ import { sharedNodeConfigMappings } from '@aztec/node-lib/config';
4
9
  import { p2pConfigMappings } from '@aztec/p2p/config';
5
10
  import { proverClientConfigMappings } from '@aztec/prover-client/config';
6
11
  import { sequencerClientConfigMappings } from '@aztec/sequencer-client/config';
12
+ import { slasherConfigMappings } from '@aztec/slasher';
13
+ import { AztecAddress } from '@aztec/stdlib/aztec-address';
14
+ import { nodeRpcConfigMappings } from '@aztec/stdlib/config';
7
15
  import { validatorClientConfigMappings } from '@aztec/validator-client/config';
8
16
  import { worldStateConfigMappings } from '@aztec/world-state/config';
9
- import { readFileSync } from 'fs';
10
- import { dirname, resolve } from 'path';
11
- import { fileURLToPath } from 'url';
17
+ import { privateKeyToAddress } from 'viem/accounts';
18
+ import { sentinelConfigMappings } from '../sentinel/config.js';
12
19
  export { sequencerClientConfigMappings };
13
20
  export const aztecNodeConfigMappings = {
21
+ ...dataConfigMappings,
22
+ ...keyStoreConfigMappings,
14
23
  ...archiverConfigMappings,
15
24
  ...sequencerClientConfigMappings,
16
25
  ...validatorClientConfigMappings,
17
26
  ...proverClientConfigMappings,
18
27
  ...worldStateConfigMappings,
19
28
  ...p2pConfigMappings,
20
- ...dataConfigMappings,
29
+ ...sentinelConfigMappings,
30
+ ...sharedNodeConfigMappings,
31
+ ...genesisStateConfigMappings,
32
+ ...nodeRpcConfigMappings,
33
+ ...slasherConfigMappings,
34
+ l1Contracts: {
35
+ description: 'The deployed L1 contract addresses',
36
+ nested: l1ContractAddressesMapping
37
+ },
21
38
  disableValidator: {
22
39
  env: 'VALIDATOR_DISABLED',
23
40
  description: 'Whether the validator is disabled for this node.',
24
41
  ...booleanConfigHelper()
25
42
  },
26
- testAccounts: {
27
- env: 'TEST_ACCOUNTS',
28
- description: 'Whether to populate the genesis state with initial fee juice for the test accounts.',
29
- ...booleanConfigHelper()
43
+ skipArchiverInitialSync: {
44
+ env: 'SKIP_ARCHIVER_INITIAL_SYNC',
45
+ description: 'Whether to skip waiting for the archiver to be fully synced before starting other services.',
46
+ ...booleanConfigHelper(false)
47
+ },
48
+ debugForceTxProofVerification: {
49
+ env: 'DEBUG_FORCE_TX_PROOF_VERIFICATION',
50
+ description: 'Whether to skip waiting for the archiver to be fully synced before starting other services.',
51
+ ...booleanConfigHelper(false)
30
52
  }
31
53
  };
32
54
  /**
@@ -35,10 +57,55 @@ export const aztecNodeConfigMappings = {
35
57
  */ export function getConfigEnvVars() {
36
58
  return getConfigFromMappings(aztecNodeConfigMappings);
37
59
  }
38
- /**
39
- * Returns package version.
40
- */ export function getPackageVersion() {
41
- const releasePleaseManifestPath = resolve(dirname(fileURLToPath(import.meta.url)), '../../../../.release-please-manifest.json');
42
- const version = JSON.parse(readFileSync(releasePleaseManifestPath).toString());
43
- return version['.'];
60
+ function createKeyStoreFromWeb3Signer(config) {
61
+ const validatorKeyStores = [];
62
+ if (config.web3SignerUrl === undefined || config.web3SignerUrl.length === 0 || config.validatorAddresses === undefined || config.validatorAddresses.length === 0) {
63
+ return undefined;
64
+ }
65
+ validatorKeyStores.push({
66
+ attester: config.validatorAddresses,
67
+ feeRecipient: config.feeRecipient ?? AztecAddress.ZERO,
68
+ coinbase: config.coinbase ?? config.validatorAddresses[0],
69
+ remoteSigner: config.web3SignerUrl,
70
+ publisher: config.publisherAddresses ?? []
71
+ });
72
+ const keyStore = {
73
+ schemaVersion: 1,
74
+ slasher: undefined,
75
+ prover: undefined,
76
+ remoteSigner: undefined,
77
+ validators: validatorKeyStores
78
+ };
79
+ return keyStore;
80
+ }
81
+ function createKeyStoreFromPrivateKeys(config) {
82
+ const validatorKeyStores = [];
83
+ const ethPrivateKeys = config.validatorPrivateKeys ? config.validatorPrivateKeys.getValue().map((x)=>ethPrivateKeySchema.parse(x)) : [];
84
+ if (!ethPrivateKeys.length) {
85
+ return undefined;
86
+ }
87
+ const coinbase = config.coinbase ?? EthAddress.fromString(privateKeyToAddress(ethPrivateKeys[0]));
88
+ const feeRecipient = config.feeRecipient ?? AztecAddress.ZERO;
89
+ const publisherKeys = config.publisherPrivateKeys ? config.publisherPrivateKeys.map((k)=>ethPrivateKeySchema.parse(k.getValue())) : [];
90
+ validatorKeyStores.push({
91
+ attester: ethPrivateKeys,
92
+ feeRecipient: feeRecipient,
93
+ coinbase: coinbase,
94
+ remoteSigner: undefined,
95
+ publisher: publisherKeys
96
+ });
97
+ const keyStore = {
98
+ schemaVersion: 1,
99
+ slasher: undefined,
100
+ prover: undefined,
101
+ remoteSigner: undefined,
102
+ validators: validatorKeyStores
103
+ };
104
+ return keyStore;
105
+ }
106
+ export function createKeyStoreForValidator(config) {
107
+ if (config.web3SignerUrl !== undefined && config.web3SignerUrl.length > 0) {
108
+ return createKeyStoreFromWeb3Signer(config);
109
+ }
110
+ return createKeyStoreFromPrivateKeys(config);
44
111
  }
@@ -2,7 +2,11 @@ import { type TelemetryClient } from '@aztec/telemetry-client';
2
2
  export declare class NodeMetrics {
3
3
  private receiveTxCount;
4
4
  private receiveTxDuration;
5
+ private snapshotErrorCount;
6
+ private snapshotDuration;
5
7
  constructor(client: TelemetryClient, name?: string);
6
8
  receivedTx(durationMs: number, isAccepted: boolean): void;
9
+ recordSnapshot(durationMs: number): void;
10
+ recordSnapshotError(): void;
7
11
  }
8
- //# sourceMappingURL=node_metrics.d.ts.map
12
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibm9kZV9tZXRyaWNzLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvYXp0ZWMtbm9kZS9ub2RlX21ldHJpY3MudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUF1QyxLQUFLLGVBQWUsRUFBc0IsTUFBTSx5QkFBeUIsQ0FBQztBQUV4SCxxQkFBYSxXQUFXO0lBQ3RCLE9BQU8sQ0FBQyxjQUFjLENBQWdCO0lBQ3RDLE9BQU8sQ0FBQyxpQkFBaUIsQ0FBWTtJQUVyQyxPQUFPLENBQUMsa0JBQWtCLENBQWdCO0lBQzFDLE9BQU8sQ0FBQyxnQkFBZ0IsQ0FBWTtJQUVwQyxZQUFZLE1BQU0sRUFBRSxlQUFlLEVBQUUsSUFBSSxTQUFjLEVBVXREO0lBRUQsVUFBVSxDQUFDLFVBQVUsRUFBRSxNQUFNLEVBQUUsVUFBVSxFQUFFLE9BQU8sUUFPakQ7SUFFRCxjQUFjLENBQUMsVUFBVSxFQUFFLE1BQU0sUUFNaEM7SUFFRCxtQkFBbUIsU0FFbEI7Q0FDRiJ9
@@ -1 +1 @@
1
- {"version":3,"file":"node_metrics.d.ts","sourceRoot":"","sources":["../../src/aztec-node/node_metrics.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,eAAe,EAGrB,MAAM,yBAAyB,CAAC;AAEjC,qBAAa,WAAW;IACtB,OAAO,CAAC,cAAc,CAAgB;IACtC,OAAO,CAAC,iBAAiB,CAAY;gBAEzB,MAAM,EAAE,eAAe,EAAE,IAAI,SAAc;IAUvD,UAAU,CAAC,UAAU,EAAE,MAAM,EAAE,UAAU,EAAE,OAAO;CAQnD"}
1
+ {"version":3,"file":"node_metrics.d.ts","sourceRoot":"","sources":["../../src/aztec-node/node_metrics.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuC,KAAK,eAAe,EAAsB,MAAM,yBAAyB,CAAC;AAExH,qBAAa,WAAW;IACtB,OAAO,CAAC,cAAc,CAAgB;IACtC,OAAO,CAAC,iBAAiB,CAAY;IAErC,OAAO,CAAC,kBAAkB,CAAgB;IAC1C,OAAO,CAAC,gBAAgB,CAAY;IAEpC,YAAY,MAAM,EAAE,eAAe,EAAE,IAAI,SAAc,EAUtD;IAED,UAAU,CAAC,UAAU,EAAE,MAAM,EAAE,UAAU,EAAE,OAAO,QAOjD;IAED,cAAc,CAAC,UAAU,EAAE,MAAM,QAMhC;IAED,mBAAmB,SAElB;CACF"}
@@ -1,15 +1,16 @@
1
- import { Attributes, Metrics, ValueType } from '@aztec/telemetry-client';
1
+ import { Attributes, Metrics } from '@aztec/telemetry-client';
2
2
  export class NodeMetrics {
3
3
  receiveTxCount;
4
4
  receiveTxDuration;
5
+ snapshotErrorCount;
6
+ snapshotDuration;
5
7
  constructor(client, name = 'AztecNode'){
6
8
  const meter = client.getMeter(name);
7
- this.receiveTxCount = meter.createUpDownCounter(Metrics.NODE_RECEIVE_TX_COUNT, {});
8
- this.receiveTxDuration = meter.createHistogram(Metrics.NODE_RECEIVE_TX_DURATION, {
9
- description: 'The duration of the receiveTx method',
10
- unit: 'ms',
11
- valueType: ValueType.INT
12
- });
9
+ this.receiveTxCount = meter.createUpDownCounter(Metrics.NODE_RECEIVE_TX_COUNT);
10
+ this.receiveTxDuration = meter.createHistogram(Metrics.NODE_RECEIVE_TX_DURATION);
11
+ this.snapshotDuration = meter.createHistogram(Metrics.NODE_SNAPSHOT_DURATION);
12
+ this.snapshotErrorCount = meter.createUpDownCounter(Metrics.NODE_SNAPSHOT_ERROR_COUNT);
13
+ this.snapshotErrorCount.add(0);
13
14
  }
14
15
  receivedTx(durationMs, isAccepted) {
15
16
  this.receiveTxDuration.record(Math.ceil(durationMs), {
@@ -19,4 +20,13 @@ export class NodeMetrics {
19
20
  [Attributes.OK]: isAccepted
20
21
  });
21
22
  }
23
+ recordSnapshot(durationMs) {
24
+ if (isNaN(durationMs)) {
25
+ return;
26
+ }
27
+ this.snapshotDuration.record(Math.ceil(durationMs));
28
+ }
29
+ recordSnapshotError() {
30
+ this.snapshotErrorCount.add(1);
31
+ }
22
32
  }