1
1
import { type MerkleTreeWriteOperations } from '@aztec/circuit-types' ;
2
2
import { type AvmCircuitInputs , AztecAddress , VerificationKeyData } from '@aztec/circuits.js' ;
3
3
import { PublicTxSimulationTester , type TestEnqueuedCall } from '@aztec/simulator/public/fixtures' ;
4
+ import { WorldStateDB } from '@aztec/simulator/server' ;
4
5
import { NativeWorldStateService } from '@aztec/world-state' ;
5
6
6
7
import fs from 'node:fs/promises' ;
@@ -25,21 +26,24 @@ export class AvmProvingTester extends PublicTxSimulationTester {
25
26
constructor (
26
27
private bbWorkingDirectory : string ,
27
28
private checkCircuitOnly : boolean ,
29
+ worldStateDB : WorldStateDB ,
28
30
contractDataSource : SimpleContractDataSource ,
29
31
merkleTrees : MerkleTreeWriteOperations ,
30
32
skipContractDeployments : boolean ,
31
33
) {
32
- super ( contractDataSource , merkleTrees , skipContractDeployments ) ;
34
+ super ( worldStateDB , contractDataSource , merkleTrees , skipContractDeployments ) ;
33
35
}
34
36
35
37
static override async create ( checkCircuitOnly : boolean = false , skipContractDeployments : boolean = false ) {
36
38
const bbWorkingDirectory = await fs . mkdtemp ( path . join ( tmpdir ( ) , 'bb-' ) ) ;
37
39
38
40
const contractDataSource = new SimpleContractDataSource ( ) ;
39
41
const merkleTrees = await ( await NativeWorldStateService . tmp ( ) ) . fork ( ) ;
42
+ const worldStateDB = new WorldStateDB ( merkleTrees , contractDataSource ) ;
40
43
return new AvmProvingTester (
41
44
bbWorkingDirectory ,
42
45
checkCircuitOnly ,
46
+ worldStateDB ,
43
47
contractDataSource ,
44
48
merkleTrees ,
45
49
skipContractDeployments ,
@@ -110,19 +114,27 @@ export class AvmProvingTester extends PublicTxSimulationTester {
110
114
export class AvmProvingTesterV2 extends PublicTxSimulationTester {
111
115
constructor (
112
116
private bbWorkingDirectory : string ,
117
+ worldStateDB : WorldStateDB ,
113
118
contractDataSource : SimpleContractDataSource ,
114
119
merkleTrees : MerkleTreeWriteOperations ,
115
120
skipContractDeployments : boolean ,
116
121
) {
117
- super ( contractDataSource , merkleTrees , skipContractDeployments ) ;
122
+ super ( worldStateDB , contractDataSource , merkleTrees , skipContractDeployments ) ;
118
123
}
119
124
120
125
static override async create ( skipContractDeployments : boolean = false ) {
121
126
const bbWorkingDirectory = await fs . mkdtemp ( path . join ( tmpdir ( ) , 'bb-' ) ) ;
122
127
123
128
const contractDataSource = new SimpleContractDataSource ( ) ;
124
129
const merkleTrees = await ( await NativeWorldStateService . tmp ( ) ) . fork ( ) ;
125
- return new AvmProvingTesterV2 ( bbWorkingDirectory , contractDataSource , merkleTrees , skipContractDeployments ) ;
130
+ const worldStateDB = new WorldStateDB ( merkleTrees , contractDataSource ) ;
131
+ return new AvmProvingTesterV2 (
132
+ bbWorkingDirectory ,
133
+ worldStateDB ,
134
+ contractDataSource ,
135
+ merkleTrees ,
136
+ skipContractDeployments ,
137
+ ) ;
126
138
}
127
139
128
140
async proveV2 ( avmCircuitInputs : AvmCircuitInputs ) : Promise < BBResult > {
0 commit comments