@@ -50,10 +50,9 @@ import { AztecAddress } from '@aztec/foundation/aztec-address';
50
50
import { padArrayEnd } from '@aztec/foundation/collection' ;
51
51
import { createDebugLogger } from '@aztec/foundation/log' ;
52
52
import { Timer } from '@aztec/foundation/timer' ;
53
- import { type AztecKVStore } from '@aztec/kv-store' ;
54
- import { createStore , openTmpStore } from '@aztec/kv-store/utils' ;
53
+ import { openTmpStore } from '@aztec/kv-store/utils' ;
55
54
import { SHA256Trunc , StandardTree , UnbalancedTree } from '@aztec/merkle-tree' ;
56
- import { AztecKVTxPool , InMemoryAttestationPool , type P2P , createP2PClient } from '@aztec/p2p' ;
55
+ import { InMemoryAttestationPool , type P2P , createP2PClient } from '@aztec/p2p' ;
57
56
import { getCanonicalClassRegisterer } from '@aztec/protocol-contracts/class-registerer' ;
58
57
import { getCanonicalFeeJuice } from '@aztec/protocol-contracts/fee-juice' ;
59
58
import { getCanonicalInstanceDeployer } from '@aztec/protocol-contracts/instance-deployer' ;
@@ -77,7 +76,7 @@ import {
77
76
type ProtocolContractAddresses ,
78
77
} from '@aztec/types/contracts' ;
79
78
import { createValidatorClient } from '@aztec/validator-client' ;
80
- import { MerkleTrees , type WorldStateSynchronizer , createWorldStateSynchronizer } from '@aztec/world-state' ;
79
+ import { type WorldStateSynchronizer , createWorldStateSynchronizer } from '@aztec/world-state' ;
81
80
82
81
import { type AztecNodeConfig , getPackageInfo } from './config.js' ;
83
82
import { NodeMetrics } from './node_metrics.js' ;
@@ -104,7 +103,6 @@ export class AztecNodeService implements AztecNode {
104
103
protected readonly l1ChainId : number ,
105
104
protected readonly version : number ,
106
105
protected readonly globalVariableBuilder : GlobalVariableBuilder ,
107
- protected readonly merkleTreesDb : AztecKVStore ,
108
106
private proofVerifier : ClientProtocolCircuitVerifier ,
109
107
private telemetry : TelemetryClient ,
110
108
private log = createDebugLogger ( 'aztec:node' ) ,
@@ -131,7 +129,6 @@ export class AztecNodeService implements AztecNode {
131
129
config : AztecNodeConfig ,
132
130
telemetry ?: TelemetryClient ,
133
131
log = createDebugLogger ( 'aztec:node' ) ,
134
- storeLog = createDebugLogger ( 'aztec:node:lmdb' ) ,
135
132
) : Promise < AztecNodeService > {
136
133
telemetry ??= new NoopTelemetryClient ( ) ;
137
134
const ethereumChain = createEthereumChain ( config . l1RpcUrl , config . l1ChainId ) ;
@@ -142,25 +139,17 @@ export class AztecNodeService implements AztecNode {
142
139
) ;
143
140
}
144
141
145
- const store = await createStore ( config , config . l1Contracts . rollupAddress , storeLog ) ;
146
-
147
- const archiver = await createArchiver ( config , store , telemetry , { blockUntilSync : true } ) ;
142
+ const archiver = await createArchiver ( config , telemetry , { blockUntilSync : true } ) ;
148
143
149
144
// we identify the P2P transaction protocol by using the rollup contract address.
150
145
// this may well change in future
151
146
config . transactionProtocol = `/aztec/tx/${ config . l1Contracts . rollupAddress . toString ( ) } ` ;
152
147
153
148
// create the tx pool and the p2p client, which will need the l2 block source
154
- const p2pClient = await createP2PClient (
155
- config ,
156
- store ,
157
- new AztecKVTxPool ( store , telemetry ) ,
158
- new InMemoryAttestationPool ( ) ,
159
- archiver ,
160
- ) ;
149
+ const p2pClient = await createP2PClient ( config , new InMemoryAttestationPool ( ) , archiver , telemetry ) ;
161
150
162
151
// now create the merkle trees and the world state synchronizer
163
- const worldStateSynchronizer = await createWorldStateSynchronizer ( config , store , archiver , telemetry ) ;
152
+ const worldStateSynchronizer = await createWorldStateSynchronizer ( config , archiver , telemetry ) ;
164
153
165
154
// start both and wait for them to sync from the block source
166
155
await Promise . all ( [ p2pClient . start ( ) , worldStateSynchronizer . start ( ) ] ) ;
@@ -199,7 +188,6 @@ export class AztecNodeService implements AztecNode {
199
188
ethereumChain . chainInfo . id ,
200
189
config . version ,
201
190
new GlobalVariableBuilder ( config ) ,
202
- store ,
203
191
proofVerifier ,
204
192
telemetry ,
205
193
log ,
@@ -726,13 +714,8 @@ export class AztecNodeService implements AztecNode {
726
714
) ;
727
715
const prevHeader = ( await this . blockSource . getBlock ( - 1 ) ) ?. header ;
728
716
729
- // Instantiate merkle trees so uncommitted updates by this simulation are local to it.
730
- // TODO we should be able to remove this after https://github.com/AztecProtocol/aztec-packages/issues/1869
731
- // So simulation of public functions doesn't affect the merkle trees.
732
- const merkleTrees = await MerkleTrees . new ( this . merkleTreesDb , new NoopTelemetryClient ( ) , this . log ) ;
733
-
734
717
const publicProcessorFactory = new PublicProcessorFactory (
735
- merkleTrees . asLatest ( ) ,
718
+ await this . worldStateSynchronizer . ephemeralFork ( ) ,
736
719
this . contractDataSource ,
737
720
new WASMSimulator ( ) ,
738
721
this . telemetry ,
0 commit comments