@aztec/simulator 0.60.0 → 0.62.0
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/acvm/oracle/oracle.d.ts +3 -0
- package/dest/acvm/oracle/oracle.d.ts.map +1 -1
- package/dest/acvm/oracle/oracle.js +12 -1
- package/dest/acvm/oracle/typed_oracle.d.ts +4 -1
- package/dest/acvm/oracle/typed_oracle.d.ts.map +1 -1
- package/dest/acvm/oracle/typed_oracle.js +10 -1
- package/dest/avm/avm_gas.d.ts.map +1 -1
- package/dest/avm/avm_gas.js +8 -5
- package/dest/avm/avm_machine_state.d.ts +2 -0
- package/dest/avm/avm_machine_state.d.ts.map +1 -1
- package/dest/avm/avm_machine_state.js +3 -1
- package/dest/avm/avm_simulator.d.ts +15 -0
- package/dest/avm/avm_simulator.d.ts.map +1 -1
- package/dest/avm/avm_simulator.js +45 -4
- package/dest/avm/fixtures/index.d.ts +1 -1
- package/dest/avm/fixtures/index.d.ts.map +1 -1
- package/dest/avm/fixtures/index.js +7 -7
- package/dest/avm/journal/journal.d.ts +5 -6
- package/dest/avm/journal/journal.d.ts.map +1 -1
- package/dest/avm/journal/journal.js +42 -17
- package/dest/avm/opcodes/contract.d.ts +8 -1
- package/dest/avm/opcodes/contract.d.ts.map +1 -1
- package/dest/avm/opcodes/contract.js +41 -21
- package/dest/avm/opcodes/control_flow.js +5 -5
- package/dest/avm/opcodes/conversion.d.ts +1 -1
- package/dest/avm/opcodes/conversion.d.ts.map +1 -1
- package/dest/avm/opcodes/conversion.js +12 -9
- package/dest/avm/opcodes/environment_getters.d.ts +1 -1
- package/dest/avm/opcodes/environment_getters.d.ts.map +1 -1
- package/dest/avm/opcodes/environment_getters.js +5 -1
- package/dest/avm/opcodes/external_calls.d.ts +3 -6
- package/dest/avm/opcodes/external_calls.d.ts.map +1 -1
- package/dest/avm/opcodes/external_calls.js +23 -43
- package/dest/avm/opcodes/memory.d.ts +20 -0
- package/dest/avm/opcodes/memory.d.ts.map +1 -1
- package/dest/avm/opcodes/memory.js +59 -3
- package/dest/avm/serialization/bytecode_serialization.d.ts.map +1 -1
- package/dest/avm/serialization/bytecode_serialization.js +5 -3
- package/dest/avm/serialization/instruction_serialization.d.ts +36 -34
- package/dest/avm/serialization/instruction_serialization.d.ts.map +1 -1
- package/dest/avm/serialization/instruction_serialization.js +37 -35
- package/dest/avm/test_utils.d.ts +2 -1
- package/dest/avm/test_utils.d.ts.map +1 -1
- package/dest/avm/test_utils.js +4 -1
- package/dest/client/client_execution_context.d.ts +1 -8
- package/dest/client/client_execution_context.d.ts.map +1 -1
- package/dest/client/client_execution_context.js +4 -18
- package/dest/client/db_oracle.d.ts +24 -1
- package/dest/client/db_oracle.d.ts.map +1 -1
- package/dest/client/db_oracle.js +1 -1
- package/dest/client/view_data_oracle.d.ts +17 -1
- package/dest/client/view_data_oracle.d.ts.map +1 -1
- package/dest/client/view_data_oracle.js +21 -1
- package/dest/common/index.d.ts +0 -1
- package/dest/common/index.d.ts.map +1 -1
- package/dest/common/index.js +1 -2
- package/dest/public/dual_side_effect_trace.d.ts +3 -5
- package/dest/public/dual_side_effect_trace.d.ts.map +1 -1
- package/dest/public/dual_side_effect_trace.js +8 -4
- package/dest/public/enqueued_call_side_effect_trace.d.ts +4 -6
- package/dest/public/enqueued_call_side_effect_trace.d.ts.map +1 -1
- package/dest/public/enqueued_call_side_effect_trace.js +19 -7
- package/dest/public/enqueued_call_simulator.d.ts +2 -2
- package/dest/public/enqueued_call_simulator.d.ts.map +1 -1
- package/dest/public/enqueued_call_simulator.js +21 -29
- package/dest/public/enqueued_calls_processor.d.ts +2 -3
- package/dest/public/enqueued_calls_processor.d.ts.map +1 -1
- package/dest/public/enqueued_calls_processor.js +18 -25
- package/dest/public/public_db_sources.d.ts.map +1 -1
- package/dest/public/public_db_sources.js +10 -15
- package/dest/public/public_kernel.d.ts +0 -1
- package/dest/public/public_kernel.d.ts.map +1 -1
- package/dest/public/public_kernel.js +5 -8
- package/dest/public/public_kernel_tail_simulator.d.ts +1 -5
- package/dest/public/public_kernel_tail_simulator.d.ts.map +1 -1
- package/dest/public/public_kernel_tail_simulator.js +6 -12
- package/dest/public/public_processor.js +4 -4
- package/dest/public/side_effect_trace.d.ts +4 -3
- package/dest/public/side_effect_trace.d.ts.map +1 -1
- package/dest/public/side_effect_trace.js +27 -16
- package/dest/public/side_effect_trace_interface.d.ts +3 -3
- package/dest/public/side_effect_trace_interface.d.ts.map +1 -1
- package/dest/test/utils.d.ts +2 -2
- package/dest/test/utils.d.ts.map +1 -1
- package/dest/test/utils.js +4 -4
- package/package.json +9 -9
- package/src/acvm/oracle/oracle.ts +20 -0
- package/src/acvm/oracle/typed_oracle.ts +13 -0
- package/src/avm/avm_gas.ts +7 -4
- package/src/avm/avm_machine_state.ts +2 -0
- package/src/avm/avm_simulator.ts +69 -6
- package/src/avm/fixtures/index.ts +7 -7
- package/src/avm/journal/journal.ts +62 -19
- package/src/avm/opcodes/contract.ts +45 -21
- package/src/avm/opcodes/control_flow.ts +5 -5
- package/src/avm/opcodes/conversion.ts +9 -6
- package/src/avm/opcodes/environment_getters.ts +7 -2
- package/src/avm/opcodes/external_calls.ts +21 -45
- package/src/avm/opcodes/memory.ts +69 -2
- package/src/avm/serialization/bytecode_serialization.ts +6 -2
- package/src/avm/serialization/instruction_serialization.ts +5 -3
- package/src/avm/test_utils.ts +5 -1
- package/src/client/client_execution_context.ts +4 -27
- package/src/client/db_oracle.ts +38 -0
- package/src/client/view_data_oracle.ts +31 -1
- package/src/common/index.ts +0 -1
- package/src/public/dual_side_effect_trace.ts +20 -6
- package/src/public/enqueued_call_side_effect_trace.ts +46 -8
- package/src/public/enqueued_call_simulator.ts +42 -26
- package/src/public/enqueued_calls_processor.ts +26 -38
- package/src/public/public_db_sources.ts +10 -15
- package/src/public/public_kernel.ts +9 -12
- package/src/public/public_kernel_tail_simulator.ts +6 -15
- package/src/public/public_processor.ts +3 -3
- package/src/public/side_effect_trace.ts +54 -15
- package/src/public/side_effect_trace_interface.ts +9 -4
- package/src/test/utils.ts +9 -2
- package/dest/client/test_utils.d.ts +0 -9
- package/dest/client/test_utils.d.ts.map +0 -1
- package/dest/client/test_utils.js +0 -27
- package/dest/common/side_effect_counter.d.ts +0 -10
- package/dest/common/side_effect_counter.d.ts.map +0 -1
- package/dest/common/side_effect_counter.js +0 -18
- package/dest/rollup/index.d.ts +0 -2
- package/dest/rollup/index.d.ts.map +0 -1
- package/dest/rollup/index.js +0 -2
- package/dest/rollup/rollup.d.ts +0 -101
- package/dest/rollup/rollup.d.ts.map +0 -1
- package/dest/rollup/rollup.js +0 -100
- package/src/client/test_utils.ts +0 -57
- package/src/common/side_effect_counter.ts +0 -17
- package/src/rollup/index.ts +0 -1
- package/src/rollup/rollup.ts +0 -228
package/src/rollup/rollup.ts
DELETED
|
@@ -1,228 +0,0 @@
|
|
|
1
|
-
import { type CircuitSimulationStats } from '@aztec/circuit-types/stats';
|
|
2
|
-
import {
|
|
3
|
-
type BaseOrMergeRollupPublicInputs,
|
|
4
|
-
type BaseParityInputs,
|
|
5
|
-
type BaseRollupInputs,
|
|
6
|
-
type BlockMergeRollupInputs,
|
|
7
|
-
type BlockRootOrBlockMergePublicInputs,
|
|
8
|
-
type BlockRootRollupInputs,
|
|
9
|
-
type MergeRollupInputs,
|
|
10
|
-
type ParityPublicInputs,
|
|
11
|
-
type RootParityInputs,
|
|
12
|
-
type RootRollupInputs,
|
|
13
|
-
type RootRollupPublicInputs,
|
|
14
|
-
} from '@aztec/circuits.js';
|
|
15
|
-
import { createDebugLogger } from '@aztec/foundation/log';
|
|
16
|
-
import { elapsed } from '@aztec/foundation/timer';
|
|
17
|
-
import {
|
|
18
|
-
SimulatedServerCircuitArtifacts,
|
|
19
|
-
convertBaseParityInputsToWitnessMap,
|
|
20
|
-
convertBaseParityOutputsFromWitnessMap,
|
|
21
|
-
convertBlockMergeRollupInputsToWitnessMap,
|
|
22
|
-
convertBlockMergeRollupOutputsFromWitnessMap,
|
|
23
|
-
convertBlockRootRollupInputsToWitnessMap,
|
|
24
|
-
convertBlockRootRollupOutputsFromWitnessMap,
|
|
25
|
-
convertMergeRollupInputsToWitnessMap,
|
|
26
|
-
convertMergeRollupOutputsFromWitnessMap,
|
|
27
|
-
convertRootParityInputsToWitnessMap,
|
|
28
|
-
convertRootParityOutputsFromWitnessMap,
|
|
29
|
-
convertRootRollupInputsToWitnessMap,
|
|
30
|
-
convertRootRollupOutputsFromWitnessMap,
|
|
31
|
-
convertSimulatedBaseRollupInputsToWitnessMap,
|
|
32
|
-
convertSimulatedBaseRollupOutputsFromWitnessMap,
|
|
33
|
-
} from '@aztec/noir-protocol-circuits-types';
|
|
34
|
-
|
|
35
|
-
import { WASMSimulator } from '../providers/acvm_wasm.js';
|
|
36
|
-
import { type SimulationProvider } from '../providers/simulation_provider.js';
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* Circuit simulator for the rollup circuits.
|
|
40
|
-
*/
|
|
41
|
-
export interface RollupSimulator {
|
|
42
|
-
/**
|
|
43
|
-
* Simulates the base parity circuit from its inputs.
|
|
44
|
-
* @param inputs - Inputs to the circuit.
|
|
45
|
-
* @returns The public inputs of the parity circuit.
|
|
46
|
-
*/
|
|
47
|
-
baseParityCircuit(inputs: BaseParityInputs): Promise<ParityPublicInputs>;
|
|
48
|
-
/**
|
|
49
|
-
* Simulates the root parity circuit from its inputs.
|
|
50
|
-
* @param inputs - Inputs to the circuit.
|
|
51
|
-
* @returns The public inputs of the parity circuit.
|
|
52
|
-
*/
|
|
53
|
-
rootParityCircuit(inputs: RootParityInputs): Promise<ParityPublicInputs>;
|
|
54
|
-
/**
|
|
55
|
-
* Simulates the base rollup circuit from its inputs.
|
|
56
|
-
* @param input - Inputs to the circuit.
|
|
57
|
-
* @returns The public inputs as outputs of the simulation.
|
|
58
|
-
*/
|
|
59
|
-
baseRollupCircuit(input: BaseRollupInputs): Promise<BaseOrMergeRollupPublicInputs>;
|
|
60
|
-
/**
|
|
61
|
-
* Simulates the merge rollup circuit from its inputs.
|
|
62
|
-
* @param input - Inputs to the circuit.
|
|
63
|
-
* @returns The public inputs as outputs of the simulation.
|
|
64
|
-
*/
|
|
65
|
-
mergeRollupCircuit(input: MergeRollupInputs): Promise<BaseOrMergeRollupPublicInputs>;
|
|
66
|
-
/**
|
|
67
|
-
* Simulates the block root rollup circuit from its inputs.
|
|
68
|
-
* @param input - Inputs to the circuit.
|
|
69
|
-
* @returns The public inputs as outputs of the simulation.
|
|
70
|
-
*/
|
|
71
|
-
blockRootRollupCircuit(input: BlockRootRollupInputs): Promise<BlockRootOrBlockMergePublicInputs>;
|
|
72
|
-
/**
|
|
73
|
-
* Simulates the block merge rollup circuit from its inputs.
|
|
74
|
-
* @param input - Inputs to the circuit.
|
|
75
|
-
* @returns The public inputs as outputs of the simulation.
|
|
76
|
-
*/
|
|
77
|
-
blockMergeRollupCircuit(input: BlockMergeRollupInputs): Promise<BlockRootOrBlockMergePublicInputs>;
|
|
78
|
-
/**
|
|
79
|
-
* Simulates the root rollup circuit from its inputs.
|
|
80
|
-
* @param input - Inputs to the circuit.
|
|
81
|
-
* @returns The public inputs as outputs of the simulation.
|
|
82
|
-
*/
|
|
83
|
-
rootRollupCircuit(input: RootRollupInputs): Promise<RootRollupPublicInputs>;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
/**
|
|
87
|
-
* Implements the rollup circuit simulator.
|
|
88
|
-
*/
|
|
89
|
-
export class RealRollupCircuitSimulator implements RollupSimulator {
|
|
90
|
-
private log = createDebugLogger('aztec:rollup-simulator');
|
|
91
|
-
|
|
92
|
-
// Some circuits are so small it is faster to use WASM
|
|
93
|
-
private wasmSimulator: WASMSimulator = new WASMSimulator();
|
|
94
|
-
|
|
95
|
-
constructor(private simulationProvider: SimulationProvider) {}
|
|
96
|
-
|
|
97
|
-
/**
|
|
98
|
-
* Simulates the base parity circuit from its inputs.
|
|
99
|
-
* @param inputs - Inputs to the circuit.
|
|
100
|
-
* @returns The public inputs of the parity circuit.
|
|
101
|
-
*/
|
|
102
|
-
public async baseParityCircuit(inputs: BaseParityInputs): Promise<ParityPublicInputs> {
|
|
103
|
-
const witnessMap = convertBaseParityInputsToWitnessMap(inputs);
|
|
104
|
-
|
|
105
|
-
const witness = await this.simulationProvider.simulateCircuit(
|
|
106
|
-
witnessMap,
|
|
107
|
-
SimulatedServerCircuitArtifacts.BaseParityArtifact,
|
|
108
|
-
);
|
|
109
|
-
|
|
110
|
-
const result = convertBaseParityOutputsFromWitnessMap(witness);
|
|
111
|
-
|
|
112
|
-
return Promise.resolve(result);
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
/**
|
|
116
|
-
* Simulates the root parity circuit from its inputs.
|
|
117
|
-
* @param inputs - Inputs to the circuit.
|
|
118
|
-
* @returns The public inputs of the parity circuit.
|
|
119
|
-
*/
|
|
120
|
-
public async rootParityCircuit(inputs: RootParityInputs): Promise<ParityPublicInputs> {
|
|
121
|
-
const witnessMap = convertRootParityInputsToWitnessMap(inputs);
|
|
122
|
-
|
|
123
|
-
const witness = await this.simulationProvider.simulateCircuit(
|
|
124
|
-
witnessMap,
|
|
125
|
-
SimulatedServerCircuitArtifacts.RootParityArtifact,
|
|
126
|
-
);
|
|
127
|
-
|
|
128
|
-
const result = convertRootParityOutputsFromWitnessMap(witness);
|
|
129
|
-
|
|
130
|
-
return Promise.resolve(result);
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
/**
|
|
134
|
-
* Simulates the base rollup circuit from its inputs.
|
|
135
|
-
* @param input - Inputs to the circuit.
|
|
136
|
-
* @returns The public inputs as outputs of the simulation.
|
|
137
|
-
*/
|
|
138
|
-
public async baseRollupCircuit(input: BaseRollupInputs): Promise<BaseOrMergeRollupPublicInputs> {
|
|
139
|
-
const witnessMap = convertSimulatedBaseRollupInputsToWitnessMap(input);
|
|
140
|
-
|
|
141
|
-
const witness = await this.simulationProvider.simulateCircuit(
|
|
142
|
-
witnessMap,
|
|
143
|
-
SimulatedServerCircuitArtifacts.BaseRollupArtifact,
|
|
144
|
-
);
|
|
145
|
-
|
|
146
|
-
const result = convertSimulatedBaseRollupOutputsFromWitnessMap(witness);
|
|
147
|
-
|
|
148
|
-
return Promise.resolve(result);
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
/**
|
|
152
|
-
* Simulates the merge rollup circuit from its inputs.
|
|
153
|
-
* @param input - Inputs to the circuit.
|
|
154
|
-
* @returns The public inputs as outputs of the simulation.
|
|
155
|
-
*/
|
|
156
|
-
public async mergeRollupCircuit(input: MergeRollupInputs): Promise<BaseOrMergeRollupPublicInputs> {
|
|
157
|
-
const witnessMap = convertMergeRollupInputsToWitnessMap(input);
|
|
158
|
-
|
|
159
|
-
const witness = await this.wasmSimulator.simulateCircuit(
|
|
160
|
-
witnessMap,
|
|
161
|
-
SimulatedServerCircuitArtifacts.MergeRollupArtifact,
|
|
162
|
-
);
|
|
163
|
-
|
|
164
|
-
const result = convertMergeRollupOutputsFromWitnessMap(witness);
|
|
165
|
-
|
|
166
|
-
return result;
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
/**
|
|
170
|
-
* Simulates the block root rollup circuit from its inputs.
|
|
171
|
-
* @param input - Inputs to the circuit.
|
|
172
|
-
* @returns The public inputs as outputs of the simulation.
|
|
173
|
-
*/
|
|
174
|
-
public async blockRootRollupCircuit(input: BlockRootRollupInputs): Promise<BlockRootOrBlockMergePublicInputs> {
|
|
175
|
-
const witnessMap = convertBlockRootRollupInputsToWitnessMap(input);
|
|
176
|
-
|
|
177
|
-
const witness = await this.wasmSimulator.simulateCircuit(
|
|
178
|
-
witnessMap,
|
|
179
|
-
SimulatedServerCircuitArtifacts.BlockRootRollupArtifact,
|
|
180
|
-
);
|
|
181
|
-
|
|
182
|
-
const result = convertBlockRootRollupOutputsFromWitnessMap(witness);
|
|
183
|
-
|
|
184
|
-
return Promise.resolve(result);
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
/**
|
|
188
|
-
* Simulates the block merge rollup circuit from its inputs.
|
|
189
|
-
* @param input - Inputs to the circuit.
|
|
190
|
-
* @returns The public inputs as outputs of the simulation.
|
|
191
|
-
*/
|
|
192
|
-
public async blockMergeRollupCircuit(input: BlockMergeRollupInputs): Promise<BlockRootOrBlockMergePublicInputs> {
|
|
193
|
-
const witnessMap = convertBlockMergeRollupInputsToWitnessMap(input);
|
|
194
|
-
|
|
195
|
-
const witness = await this.wasmSimulator.simulateCircuit(
|
|
196
|
-
witnessMap,
|
|
197
|
-
SimulatedServerCircuitArtifacts.BlockMergeRollupArtifact,
|
|
198
|
-
);
|
|
199
|
-
|
|
200
|
-
const result = convertBlockMergeRollupOutputsFromWitnessMap(witness);
|
|
201
|
-
|
|
202
|
-
return Promise.resolve(result);
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
/**
|
|
206
|
-
* Simulates the root rollup circuit from its inputs.
|
|
207
|
-
* @param input - Inputs to the circuit.
|
|
208
|
-
* @returns The public inputs as outputs of the simulation.
|
|
209
|
-
*/
|
|
210
|
-
public async rootRollupCircuit(input: RootRollupInputs): Promise<RootRollupPublicInputs> {
|
|
211
|
-
const witnessMap = convertRootRollupInputsToWitnessMap(input);
|
|
212
|
-
|
|
213
|
-
const [duration, witness] = await elapsed(() =>
|
|
214
|
-
this.wasmSimulator.simulateCircuit(witnessMap, SimulatedServerCircuitArtifacts.RootRollupArtifact),
|
|
215
|
-
);
|
|
216
|
-
|
|
217
|
-
const result = convertRootRollupOutputsFromWitnessMap(witness);
|
|
218
|
-
|
|
219
|
-
this.log.debug(`Simulated root rollup circuit`, {
|
|
220
|
-
eventName: 'circuit-simulation',
|
|
221
|
-
circuitName: 'root-rollup',
|
|
222
|
-
duration,
|
|
223
|
-
inputSize: input.toBuffer().length,
|
|
224
|
-
outputSize: result.toBuffer().length,
|
|
225
|
-
} satisfies CircuitSimulationStats);
|
|
226
|
-
return result;
|
|
227
|
-
}
|
|
228
|
-
}
|