@aztec/aztec-node 0.76.4 → 0.77.0-testnet-ignition.17
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/config.d.ts +5 -3
- package/dest/aztec-node/config.d.ts.map +1 -1
- package/dest/aztec-node/config.js +12 -7
- package/dest/aztec-node/http_rpc_server.d.ts +1 -1
- package/dest/aztec-node/http_rpc_server.d.ts.map +1 -1
- package/dest/aztec-node/http_rpc_server.js +2 -4
- package/dest/aztec-node/node_metrics.js +7 -6
- package/dest/aztec-node/server.d.ts +24 -7
- package/dest/aztec-node/server.d.ts.map +1 -1
- package/dest/aztec-node/server.js +704 -692
- package/dest/bin/index.js +7 -8
- package/dest/index.js +0 -1
- package/package.json +21 -22
- package/src/aztec-node/config.ts +11 -3
- package/src/aztec-node/http_rpc_server.ts +1 -1
- package/src/aztec-node/server.ts +69 -59
package/dest/bin/index.js
CHANGED
|
@@ -6,18 +6,18 @@ const { AZTEC_NODE_PORT = 8081, API_PREFIX = '' } = process.env;
|
|
|
6
6
|
const logger = createLogger('node');
|
|
7
7
|
/**
|
|
8
8
|
* Creates the node from provided config
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
*/ async function createAndDeployAztecNode() {
|
|
10
|
+
const aztecNodeConfig = {
|
|
11
|
+
...getConfigEnvVars()
|
|
12
|
+
};
|
|
12
13
|
return await AztecNodeService.createAndSync(aztecNodeConfig);
|
|
13
14
|
}
|
|
14
15
|
/**
|
|
15
16
|
* Create and start a new Aztec Node HTTP Server
|
|
16
|
-
*/
|
|
17
|
-
async function main() {
|
|
17
|
+
*/ async function main() {
|
|
18
18
|
logger.info(`Setting up Aztec Node...`);
|
|
19
19
|
const aztecNode = await createAndDeployAztecNode();
|
|
20
|
-
const shutdown = async ()
|
|
20
|
+
const shutdown = async ()=>{
|
|
21
21
|
logger.info('Shutting down...');
|
|
22
22
|
await aztecNode.stop();
|
|
23
23
|
process.exit(0);
|
|
@@ -33,8 +33,7 @@ async function main() {
|
|
|
33
33
|
httpServer.listen(+AZTEC_NODE_PORT);
|
|
34
34
|
logger.info(`Aztec Node JSON-RPC Server listening on port ${AZTEC_NODE_PORT}`);
|
|
35
35
|
}
|
|
36
|
-
main().catch(err
|
|
36
|
+
main().catch((err)=>{
|
|
37
37
|
logger.error(err);
|
|
38
38
|
process.exit(1);
|
|
39
39
|
});
|
|
40
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvYmluL2luZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFDQSxPQUFPLEVBQUUsWUFBWSxFQUFFLE1BQU0sdUJBQXVCLENBQUM7QUFFckQsT0FBTyxJQUFJLE1BQU0sTUFBTSxDQUFDO0FBRXhCLE9BQU8sRUFBd0IsZ0JBQWdCLEVBQUUsd0JBQXdCLEVBQUUsZ0JBQWdCLEVBQUUsTUFBTSxhQUFhLENBQUM7QUFFakgsTUFBTSxFQUFFLGVBQWUsR0FBRyxJQUFJLEVBQUUsVUFBVSxHQUFHLEVBQUUsRUFBRSxHQUFHLE9BQU8sQ0FBQyxHQUFHLENBQUM7QUFFaEUsTUFBTSxNQUFNLEdBQUcsWUFBWSxDQUFDLE1BQU0sQ0FBQyxDQUFDO0FBRXBDOztHQUVHO0FBQ0gsS0FBSyxVQUFVLHdCQUF3QjtJQUNyQyxNQUFNLGVBQWUsR0FBb0IsRUFBRSxHQUFHLGdCQUFnQixFQUFFLEVBQUUsQ0FBQztJQUVuRSxPQUFPLE1BQU0sZ0JBQWdCLENBQUMsYUFBYSxDQUFDLGVBQWUsQ0FBQyxDQUFDO0FBQy9ELENBQUM7QUFFRDs7R0FFRztBQUNILEtBQUssVUFBVSxJQUFJO0lBQ2pCLE1BQU0sQ0FBQyxJQUFJLENBQUMsMEJBQTBCLENBQUMsQ0FBQztJQUV4QyxNQUFNLFNBQVMsR0FBRyxNQUFNLHdCQUF3QixFQUFFLENBQUM7SUFFbkQsTUFBTSxRQUFRLEdBQUcsS0FBSyxJQUFJLEVBQUU7UUFDMUIsTUFBTSxDQUFDLElBQUksQ0FBQyxrQkFBa0IsQ0FBQyxDQUFDO1FBQ2hDLE1BQU0sU0FBUyxDQUFDLElBQUksRUFBRSxDQUFDO1FBQ3ZCLE9BQU8sQ0FBQyxJQUFJLENBQUMsQ0FBQyxDQUFDLENBQUM7SUFDbEIsQ0FBQyxDQUFDO0lBRUYsa0VBQWtFO0lBQ2xFLE9BQU8sQ0FBQyxJQUFJLENBQUMsUUFBUSxFQUFFLFFBQVEsQ0FBQyxDQUFDO0lBQ2pDLGtFQUFrRTtJQUNsRSxPQUFPLENBQUMsSUFBSSxDQUFDLFNBQVMsRUFBRSxRQUFRLENBQUMsQ0FBQztJQUVsQyxNQUFNLFNBQVMsR0FBRyx3QkFBd0IsQ0FBQyxTQUFTLENBQUMsQ0FBQztJQUN0RCxNQUFNLEdBQUcsR0FBRyxTQUFTLENBQUMsTUFBTSxDQUFDLFVBQVUsQ0FBQyxDQUFDO0lBRXpDLGtFQUFrRTtJQUNsRSxNQUFNLFVBQVUsR0FBRyxJQUFJLENBQUMsWUFBWSxDQUFDLEdBQUcsQ0FBQyxRQUFRLEVBQUUsQ0FBQyxDQUFDO0lBQ3JELFVBQVUsQ0FBQyxNQUFNLENBQUMsQ0FBQyxlQUFlLENBQUMsQ0FBQztJQUNwQyxNQUFNLENBQUMsSUFBSSxDQUFDLGdEQUFnRCxlQUFlLEVBQUUsQ0FBQyxDQUFDO0FBQ2pGLENBQUM7QUFFRCxJQUFJLEVBQUUsQ0FBQyxLQUFLLENBQUMsR0FBRyxDQUFDLEVBQUU7SUFDakIsTUFBTSxDQUFDLEtBQUssQ0FBQyxHQUFHLENBQUMsQ0FBQztJQUNsQixPQUFPLENBQUMsSUFBSSxDQUFDLENBQUMsQ0FBQyxDQUFDO0FBQ2xCLENBQUMsQ0FBQyxDQUFDIn0=
|
package/dest/index.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
1
|
export * from './aztec-node/config.js';
|
|
2
2
|
export * from './aztec-node/server.js';
|
|
3
3
|
export * from './aztec-node/http_rpc_server.js';
|
|
4
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsY0FBYyx3QkFBd0IsQ0FBQztBQUN2QyxjQUFjLHdCQUF3QixDQUFDO0FBQ3ZDLGNBQWMsaUNBQWlDLENBQUMifQ==
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/aztec-node",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.77.0-testnet-ignition.17",
|
|
4
4
|
"main": "dest/index.js",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"clean": "rm -rf ./dest .tsbuildinfo",
|
|
24
24
|
"formatting": "run -T prettier --check ./src && run -T eslint ./src",
|
|
25
25
|
"formatting:fix": "run -T eslint --fix ./src && run -T prettier -w ./src",
|
|
26
|
-
"test": "
|
|
26
|
+
"test": "NODE_NO_WARNINGS=1 node --experimental-vm-modules ../node_modules/.bin/jest --passWithNoTests --maxWorkers=${JEST_MAX_WORKERS:-8}"
|
|
27
27
|
},
|
|
28
28
|
"inherits": [
|
|
29
29
|
"../package.common.json"
|
|
@@ -56,31 +56,30 @@
|
|
|
56
56
|
"reporters": [
|
|
57
57
|
"default"
|
|
58
58
|
],
|
|
59
|
-
"testTimeout":
|
|
59
|
+
"testTimeout": 120000,
|
|
60
60
|
"setupFiles": [
|
|
61
61
|
"../../foundation/src/jest/setup.mjs"
|
|
62
62
|
]
|
|
63
63
|
},
|
|
64
64
|
"dependencies": {
|
|
65
|
-
"@aztec/archiver": "0.
|
|
66
|
-
"@aztec/bb-prover": "0.
|
|
67
|
-
"@aztec/blob-sink": "0.
|
|
68
|
-
"@aztec/
|
|
69
|
-
"@aztec/
|
|
70
|
-
"@aztec/
|
|
71
|
-
"@aztec/
|
|
72
|
-
"@aztec/
|
|
73
|
-
"@aztec/
|
|
74
|
-
"@aztec/
|
|
75
|
-
"@aztec/
|
|
76
|
-
"@aztec/
|
|
77
|
-
"@aztec/
|
|
78
|
-
"@aztec/
|
|
79
|
-
"@aztec/
|
|
80
|
-
"@aztec/telemetry-client": "0.
|
|
81
|
-
"@aztec/
|
|
82
|
-
"@aztec/
|
|
83
|
-
"@aztec/world-state": "0.76.4",
|
|
65
|
+
"@aztec/archiver": "0.77.0-testnet-ignition.17",
|
|
66
|
+
"@aztec/bb-prover": "0.77.0-testnet-ignition.17",
|
|
67
|
+
"@aztec/blob-sink": "0.77.0-testnet-ignition.17",
|
|
68
|
+
"@aztec/constants": "0.77.0-testnet-ignition.17",
|
|
69
|
+
"@aztec/epoch-cache": "0.77.0-testnet-ignition.17",
|
|
70
|
+
"@aztec/ethereum": "0.77.0-testnet-ignition.17",
|
|
71
|
+
"@aztec/foundation": "0.77.0-testnet-ignition.17",
|
|
72
|
+
"@aztec/kv-store": "0.77.0-testnet-ignition.17",
|
|
73
|
+
"@aztec/merkle-tree": "0.77.0-testnet-ignition.17",
|
|
74
|
+
"@aztec/p2p": "0.77.0-testnet-ignition.17",
|
|
75
|
+
"@aztec/protocol-contracts": "0.77.0-testnet-ignition.17",
|
|
76
|
+
"@aztec/prover-client": "0.77.0-testnet-ignition.17",
|
|
77
|
+
"@aztec/sequencer-client": "0.77.0-testnet-ignition.17",
|
|
78
|
+
"@aztec/simulator": "0.77.0-testnet-ignition.17",
|
|
79
|
+
"@aztec/stdlib": "0.77.0-testnet-ignition.17",
|
|
80
|
+
"@aztec/telemetry-client": "0.77.0-testnet-ignition.17",
|
|
81
|
+
"@aztec/validator-client": "0.77.0-testnet-ignition.17",
|
|
82
|
+
"@aztec/world-state": "0.77.0-testnet-ignition.17",
|
|
84
83
|
"koa": "^2.14.2",
|
|
85
84
|
"koa-router": "^12.0.0",
|
|
86
85
|
"tslib": "^2.4.0"
|
package/src/aztec-node/config.ts
CHANGED
|
@@ -11,7 +11,7 @@ import { readFileSync } from 'fs';
|
|
|
11
11
|
import { dirname, resolve } from 'path';
|
|
12
12
|
import { fileURLToPath } from 'url';
|
|
13
13
|
|
|
14
|
-
export { sequencerClientConfigMappings, SequencerClientConfig };
|
|
14
|
+
export { sequencerClientConfigMappings, type SequencerClientConfig };
|
|
15
15
|
|
|
16
16
|
/**
|
|
17
17
|
* The configuration the aztec node.
|
|
@@ -22,10 +22,13 @@ export type AztecNodeConfig = ArchiverConfig &
|
|
|
22
22
|
ProverClientConfig &
|
|
23
23
|
WorldStateConfig &
|
|
24
24
|
Pick<ProverClientConfig, 'bbBinaryPath' | 'bbWorkingDirectory' | 'realProofs'> &
|
|
25
|
-
P2PConfig &
|
|
25
|
+
P2PConfig &
|
|
26
|
+
DataStoreConfig & {
|
|
26
27
|
/** Whether the validator is disabled for this node */
|
|
27
28
|
disableValidator: boolean;
|
|
28
|
-
|
|
29
|
+
/** Whether to populate the genesis state with initial fee juice for the test accounts */
|
|
30
|
+
testAccounts: boolean;
|
|
31
|
+
};
|
|
29
32
|
|
|
30
33
|
export const aztecNodeConfigMappings: ConfigMappingsType<AztecNodeConfig> = {
|
|
31
34
|
...archiverConfigMappings,
|
|
@@ -40,6 +43,11 @@ export const aztecNodeConfigMappings: ConfigMappingsType<AztecNodeConfig> = {
|
|
|
40
43
|
description: 'Whether the validator is disabled for this node.',
|
|
41
44
|
...booleanConfigHelper(),
|
|
42
45
|
},
|
|
46
|
+
testAccounts: {
|
|
47
|
+
env: 'TEST_ACCOUNTS',
|
|
48
|
+
description: 'Whether to populate the genesis state with initial fee juice for the test accounts.',
|
|
49
|
+
...booleanConfigHelper(),
|
|
50
|
+
},
|
|
43
51
|
};
|
|
44
52
|
|
|
45
53
|
/**
|
package/src/aztec-node/server.ts
CHANGED
|
@@ -1,67 +1,24 @@
|
|
|
1
1
|
import { createArchiver } from '@aztec/archiver';
|
|
2
2
|
import { BBCircuitVerifier, TestCircuitVerifier } from '@aztec/bb-prover';
|
|
3
3
|
import { type BlobSinkClientInterface, createBlobSinkClient } from '@aztec/blob-sink/client';
|
|
4
|
-
import {
|
|
5
|
-
type AztecNode,
|
|
6
|
-
type ClientProtocolCircuitVerifier,
|
|
7
|
-
type GetContractClassLogsResponse,
|
|
8
|
-
type GetPublicLogsResponse,
|
|
9
|
-
type InBlock,
|
|
10
|
-
type L1ToL2MessageSource,
|
|
11
|
-
type L2Block,
|
|
12
|
-
type L2BlockNumber,
|
|
13
|
-
type L2BlockSource,
|
|
14
|
-
type L2LogsSource,
|
|
15
|
-
type LogFilter,
|
|
16
|
-
MerkleTreeId,
|
|
17
|
-
NullifierMembershipWitness,
|
|
18
|
-
type NullifierWithBlockSource,
|
|
19
|
-
P2PClientType,
|
|
20
|
-
type ProverConfig,
|
|
21
|
-
PublicDataWitness,
|
|
22
|
-
PublicSimulationOutput,
|
|
23
|
-
type SequencerConfig,
|
|
24
|
-
type Service,
|
|
25
|
-
SiblingPath,
|
|
26
|
-
type Tx,
|
|
27
|
-
type TxEffect,
|
|
28
|
-
type TxHash,
|
|
29
|
-
TxReceipt,
|
|
30
|
-
type TxScopedL2Log,
|
|
31
|
-
TxStatus,
|
|
32
|
-
type TxValidationResult,
|
|
33
|
-
type WorldStateSynchronizer,
|
|
34
|
-
tryStop,
|
|
35
|
-
} from '@aztec/circuit-types';
|
|
36
4
|
import {
|
|
37
5
|
type ARCHIVE_HEIGHT,
|
|
38
|
-
type BlockHeader,
|
|
39
|
-
type ContractClassPublic,
|
|
40
|
-
type ContractDataSource,
|
|
41
|
-
type ContractInstanceWithAddress,
|
|
42
|
-
EthAddress,
|
|
43
|
-
Fr,
|
|
44
|
-
type GasFees,
|
|
45
6
|
INITIAL_L2_BLOCK_NUM,
|
|
46
7
|
type L1_TO_L2_MSG_TREE_HEIGHT,
|
|
47
8
|
type NOTE_HASH_TREE_HEIGHT,
|
|
48
9
|
type NULLIFIER_TREE_HEIGHT,
|
|
49
|
-
type NodeInfo,
|
|
50
|
-
type NullifierLeafPreimage,
|
|
51
10
|
type PUBLIC_DATA_TREE_HEIGHT,
|
|
52
|
-
type PrivateLog,
|
|
53
|
-
type ProtocolContractAddresses,
|
|
54
|
-
type PublicDataTreeLeafPreimage,
|
|
55
11
|
REGISTERER_CONTRACT_ADDRESS,
|
|
56
|
-
} from '@aztec/
|
|
57
|
-
import { computePublicDataTreeLeafSlot, siloNullifier } from '@aztec/circuits.js/hash';
|
|
12
|
+
} from '@aztec/constants';
|
|
58
13
|
import { EpochCache } from '@aztec/epoch-cache';
|
|
59
14
|
import { type L1ContractAddresses, createEthereumChain } from '@aztec/ethereum';
|
|
60
|
-
import { AztecAddress } from '@aztec/foundation/aztec-address';
|
|
61
15
|
import { compactArray } from '@aztec/foundation/collection';
|
|
16
|
+
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
17
|
+
import { Fr } from '@aztec/foundation/fields';
|
|
62
18
|
import { type Logger, createLogger } from '@aztec/foundation/log';
|
|
63
19
|
import { DateProvider, Timer } from '@aztec/foundation/timer';
|
|
64
|
-
import {
|
|
20
|
+
import { SiblingPath } from '@aztec/foundation/trees';
|
|
21
|
+
import type { AztecKVStore } from '@aztec/kv-store';
|
|
65
22
|
import { openTmpStore } from '@aztec/kv-store/lmdb';
|
|
66
23
|
import { SHA256Trunc, StandardTree, UnbalancedTree } from '@aztec/merkle-tree';
|
|
67
24
|
import { type P2P, createP2PClient } from '@aztec/p2p';
|
|
@@ -75,6 +32,43 @@ import {
|
|
|
75
32
|
getDefaultAllowedSetupFunctions,
|
|
76
33
|
} from '@aztec/sequencer-client';
|
|
77
34
|
import { PublicProcessorFactory } from '@aztec/simulator/server';
|
|
35
|
+
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
36
|
+
import type { InBlock, L2Block, L2BlockNumber, L2BlockSource, NullifierWithBlockSource } from '@aztec/stdlib/block';
|
|
37
|
+
import type {
|
|
38
|
+
ContractClassPublic,
|
|
39
|
+
ContractDataSource,
|
|
40
|
+
ContractInstanceWithAddress,
|
|
41
|
+
NodeInfo,
|
|
42
|
+
ProtocolContractAddresses,
|
|
43
|
+
} from '@aztec/stdlib/contract';
|
|
44
|
+
import type { GasFees } from '@aztec/stdlib/gas';
|
|
45
|
+
import { computePublicDataTreeLeafSlot, siloNullifier } from '@aztec/stdlib/hash';
|
|
46
|
+
import type { AztecNode, GetContractClassLogsResponse, GetPublicLogsResponse } from '@aztec/stdlib/interfaces/client';
|
|
47
|
+
import {
|
|
48
|
+
type ClientProtocolCircuitVerifier,
|
|
49
|
+
type L2LogsSource,
|
|
50
|
+
type ProverConfig,
|
|
51
|
+
type SequencerConfig,
|
|
52
|
+
type Service,
|
|
53
|
+
type WorldStateSyncStatus,
|
|
54
|
+
type WorldStateSynchronizer,
|
|
55
|
+
tryStop,
|
|
56
|
+
} from '@aztec/stdlib/interfaces/server';
|
|
57
|
+
import type { LogFilter, PrivateLog, TxScopedL2Log } from '@aztec/stdlib/logs';
|
|
58
|
+
import type { L1ToL2MessageSource } from '@aztec/stdlib/messaging';
|
|
59
|
+
import { P2PClientType } from '@aztec/stdlib/p2p';
|
|
60
|
+
import { MerkleTreeId, NullifierMembershipWitness, PublicDataWitness } from '@aztec/stdlib/trees';
|
|
61
|
+
import type { NullifierLeafPreimage, PublicDataTreeLeaf, PublicDataTreeLeafPreimage } from '@aztec/stdlib/trees';
|
|
62
|
+
import {
|
|
63
|
+
type BlockHeader,
|
|
64
|
+
PublicSimulationOutput,
|
|
65
|
+
Tx,
|
|
66
|
+
TxEffect,
|
|
67
|
+
type TxHash,
|
|
68
|
+
TxReceipt,
|
|
69
|
+
TxStatus,
|
|
70
|
+
type TxValidationResult,
|
|
71
|
+
} from '@aztec/stdlib/tx';
|
|
78
72
|
import {
|
|
79
73
|
Attributes,
|
|
80
74
|
type TelemetryClient,
|
|
@@ -122,6 +116,11 @@ export class AztecNodeService implements AztecNode, Traceable {
|
|
|
122
116
|
this.log.info(`Aztec Node started on chain 0x${l1ChainId.toString(16)}`, config.l1Contracts);
|
|
123
117
|
}
|
|
124
118
|
|
|
119
|
+
public async getWorldStateSyncStatus(): Promise<WorldStateSyncStatus> {
|
|
120
|
+
const status = await this.worldStateSynchronizer.status();
|
|
121
|
+
return status.syncSummary;
|
|
122
|
+
}
|
|
123
|
+
|
|
125
124
|
public getL2Tips() {
|
|
126
125
|
return this.blockSource.getL2Tips();
|
|
127
126
|
}
|
|
@@ -140,12 +139,15 @@ export class AztecNodeService implements AztecNode, Traceable {
|
|
|
140
139
|
dateProvider?: DateProvider;
|
|
141
140
|
blobSinkClient?: BlobSinkClientInterface;
|
|
142
141
|
} = {},
|
|
142
|
+
options: {
|
|
143
|
+
prefilledPublicData?: PublicDataTreeLeaf[];
|
|
144
|
+
} = {},
|
|
143
145
|
): Promise<AztecNodeService> {
|
|
144
146
|
const telemetry = deps.telemetry ?? getTelemetryClient();
|
|
145
147
|
const log = deps.logger ?? createLogger('node');
|
|
146
148
|
const dateProvider = deps.dateProvider ?? new DateProvider();
|
|
147
149
|
const blobSinkClient = deps.blobSinkClient ?? createBlobSinkClient(config);
|
|
148
|
-
const ethereumChain = createEthereumChain(config.
|
|
150
|
+
const ethereumChain = createEthereumChain(config.l1RpcUrls, config.l1ChainId);
|
|
149
151
|
//validate that the actual chain id matches that specified in configuration
|
|
150
152
|
if (config.l1ChainId !== ethereumChain.chainInfo.id) {
|
|
151
153
|
throw new Error(
|
|
@@ -156,7 +158,12 @@ export class AztecNodeService implements AztecNode, Traceable {
|
|
|
156
158
|
const archiver = await createArchiver(config, blobSinkClient, { blockUntilSync: true }, telemetry);
|
|
157
159
|
|
|
158
160
|
// now create the merkle trees and the world state synchronizer
|
|
159
|
-
const worldStateSynchronizer = await createWorldStateSynchronizer(
|
|
161
|
+
const worldStateSynchronizer = await createWorldStateSynchronizer(
|
|
162
|
+
config,
|
|
163
|
+
archiver,
|
|
164
|
+
options.prefilledPublicData,
|
|
165
|
+
telemetry,
|
|
166
|
+
);
|
|
160
167
|
const proofVerifier = config.realProofs ? await BBCircuitVerifier.new(config) : new TestCircuitVerifier();
|
|
161
168
|
if (!config.realProofs) {
|
|
162
169
|
log.warn(`Aztec node is accepting fake proofs`);
|
|
@@ -179,6 +186,7 @@ export class AztecNodeService implements AztecNode, Traceable {
|
|
|
179
186
|
|
|
180
187
|
// start both and wait for them to sync from the block source
|
|
181
188
|
await Promise.all([p2pClient.start(), worldStateSynchronizer.start(), slasherClient.start()]);
|
|
189
|
+
log.verbose(`All Aztec Node subsystems synced`);
|
|
182
190
|
|
|
183
191
|
const validatorClient = createValidatorClient(config, { p2pClient, telemetry, dateProvider, epochCache });
|
|
184
192
|
|
|
@@ -825,11 +833,10 @@ export class AztecNodeService implements AztecNode, Traceable {
|
|
|
825
833
|
* Returns the currently committed block header, or the initial header if no blocks have been produced.
|
|
826
834
|
* @returns The current committed block header.
|
|
827
835
|
*/
|
|
828
|
-
public async getBlockHeader(blockNumber: L2BlockNumber = 'latest'): Promise<BlockHeader> {
|
|
829
|
-
return (
|
|
830
|
-
|
|
831
|
-
this.
|
|
832
|
-
);
|
|
836
|
+
public async getBlockHeader(blockNumber: L2BlockNumber = 'latest'): Promise<BlockHeader | undefined> {
|
|
837
|
+
return blockNumber === 0 || (blockNumber === 'latest' && (await this.blockSource.getBlockNumber()) === 0)
|
|
838
|
+
? this.worldStateSynchronizer.getCommitted().getInitialHeader()
|
|
839
|
+
: this.blockSource.getBlockHeader(blockNumber);
|
|
833
840
|
}
|
|
834
841
|
|
|
835
842
|
/**
|
|
@@ -839,7 +846,7 @@ export class AztecNodeService implements AztecNode, Traceable {
|
|
|
839
846
|
@trackSpan('AztecNodeService.simulatePublicCalls', async (tx: Tx) => ({
|
|
840
847
|
[Attributes.TX_HASH]: (await tx.getTxHash()).toString(),
|
|
841
848
|
}))
|
|
842
|
-
public async simulatePublicCalls(tx: Tx,
|
|
849
|
+
public async simulatePublicCalls(tx: Tx, skipFeeEnforcement = false): Promise<PublicSimulationOutput> {
|
|
843
850
|
const txHash = await tx.getTxHash();
|
|
844
851
|
const blockNumber = (await this.blockSource.getBlockNumber()) + 1;
|
|
845
852
|
|
|
@@ -866,7 +873,7 @@ export class AztecNodeService implements AztecNode, Traceable {
|
|
|
866
873
|
});
|
|
867
874
|
|
|
868
875
|
try {
|
|
869
|
-
const processor = publicProcessorFactory.create(fork, newGlobalVariables,
|
|
876
|
+
const processor = publicProcessorFactory.create(fork, newGlobalVariables, skipFeeEnforcement);
|
|
870
877
|
|
|
871
878
|
// REFACTOR: Consider merging ProcessReturnValues into ProcessedTx
|
|
872
879
|
const [processedTxs, failedTxs, returns] = await processor.process([tx]);
|
|
@@ -889,16 +896,19 @@ export class AztecNodeService implements AztecNode, Traceable {
|
|
|
889
896
|
}
|
|
890
897
|
}
|
|
891
898
|
|
|
892
|
-
public async isValidTx(
|
|
899
|
+
public async isValidTx(
|
|
900
|
+
tx: Tx,
|
|
901
|
+
{ isSimulation, skipFeeEnforcement }: { isSimulation?: boolean; skipFeeEnforcement?: boolean } = {},
|
|
902
|
+
): Promise<TxValidationResult> {
|
|
893
903
|
const blockNumber = (await this.blockSource.getBlockNumber()) + 1;
|
|
894
904
|
const db = this.worldStateSynchronizer.getCommitted();
|
|
895
905
|
const verifier = isSimulation ? undefined : this.proofVerifier;
|
|
896
906
|
const validator = createValidatorForAcceptingTxs(db, this.contractDataSource, verifier, {
|
|
897
907
|
blockNumber,
|
|
898
908
|
l1ChainId: this.l1ChainId,
|
|
899
|
-
enforceFees: !!this.config.enforceFees,
|
|
900
909
|
setupAllowList: this.config.allowedInSetup ?? (await getDefaultAllowedSetupFunctions()),
|
|
901
910
|
gasFees: await this.getCurrentBaseFees(),
|
|
911
|
+
skipFeeEnforcement,
|
|
902
912
|
});
|
|
903
913
|
|
|
904
914
|
return await validator.validateTx(tx);
|