@aztec/sequencer-client 0.26.2 → 0.26.5
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/block_builder/solo_block_builder.d.ts +5 -4
- package/dest/block_builder/solo_block_builder.d.ts.map +1 -1
- package/dest/block_builder/solo_block_builder.js +75 -30
- package/dest/client/sequencer-client.d.ts.map +1 -1
- package/dest/client/sequencer-client.js +29 -3
- package/dest/config.d.ts.map +1 -1
- package/dest/config.js +4 -2
- package/dest/index.d.ts +2 -0
- package/dest/index.d.ts.map +1 -1
- package/dest/index.js +2 -1
- package/dest/publisher/l1-publisher.js +5 -5
- package/dest/publisher/viem-tx-sender.js +2 -2
- package/dest/sequencer/public_processor.d.ts +3 -1
- package/dest/sequencer/public_processor.d.ts.map +1 -1
- package/dest/sequencer/public_processor.js +4 -3
- package/dest/sequencer/sequencer.js +3 -3
- package/dest/simulator/acvm_native.d.ts +20 -0
- package/dest/simulator/acvm_native.d.ts.map +1 -0
- package/dest/simulator/acvm_native.js +96 -0
- package/dest/simulator/acvm_wasm.d.ts +7 -0
- package/dest/simulator/acvm_wasm.d.ts.map +1 -0
- package/dest/simulator/acvm_wasm.js +23 -0
- package/dest/simulator/index.d.ts +1 -0
- package/dest/simulator/index.d.ts.map +1 -1
- package/dest/simulator/index.js +2 -2
- package/dest/simulator/public_kernel.d.ts +4 -0
- package/dest/simulator/public_kernel.d.ts.map +1 -1
- package/dest/simulator/public_kernel.js +16 -6
- package/dest/simulator/rollup.d.ts +4 -0
- package/dest/simulator/rollup.d.ts.map +1 -1
- package/dest/simulator/rollup.js +16 -20
- package/dest/simulator/simulation_provider.d.ts +9 -0
- package/dest/simulator/simulation_provider.d.ts.map +1 -0
- package/dest/simulator/simulation_provider.js +2 -0
- package/package.json +15 -13
- package/src/block_builder/solo_block_builder.ts +109 -50
- package/src/client/sequencer-client.ts +37 -2
- package/src/config.ts +4 -0
- package/src/index.ts +2 -0
- package/src/publisher/l1-publisher.ts +4 -4
- package/src/publisher/viem-tx-sender.ts +1 -1
- package/src/sequencer/public_processor.ts +3 -1
- package/src/sequencer/sequencer.ts +2 -2
- package/src/simulator/acvm_native.ts +112 -0
- package/src/simulator/acvm_wasm.ts +31 -0
- package/src/simulator/index.ts +1 -0
- package/src/simulator/public_kernel.ts +31 -7
- package/src/simulator/rollup.ts +31 -19
- package/src/simulator/simulation_provider.ts +10 -0
package/src/simulator/rollup.ts
CHANGED
|
@@ -8,9 +8,20 @@ import {
|
|
|
8
8
|
} from '@aztec/circuits.js';
|
|
9
9
|
import { createDebugLogger } from '@aztec/foundation/log';
|
|
10
10
|
import { elapsed } from '@aztec/foundation/timer';
|
|
11
|
-
import {
|
|
11
|
+
import {
|
|
12
|
+
BaseRollupArtifact,
|
|
13
|
+
MergeRollupArtifact,
|
|
14
|
+
RootRollupArtifact,
|
|
15
|
+
convertBaseRollupInputsToWitnessMap,
|
|
16
|
+
convertBaseRollupOutputsFromWitnessMap,
|
|
17
|
+
convertMergeRollupInputsToWitnessMap,
|
|
18
|
+
convertMergeRollupOutputsFromWitnessMap,
|
|
19
|
+
convertRootRollupInputsToWitnessMap,
|
|
20
|
+
convertRootRollupOutputsFromWitnessMap,
|
|
21
|
+
} from '@aztec/noir-protocol-circuits-types';
|
|
12
22
|
|
|
13
|
-
import { RollupSimulator } from './index.js';
|
|
23
|
+
import { RollupSimulator, WASMSimulator } from './index.js';
|
|
24
|
+
import { SimulationProvider } from './simulation_provider.js';
|
|
14
25
|
|
|
15
26
|
/**
|
|
16
27
|
* Implements the rollup circuit simulator.
|
|
@@ -18,21 +29,22 @@ import { RollupSimulator } from './index.js';
|
|
|
18
29
|
export class RealRollupCircuitSimulator implements RollupSimulator {
|
|
19
30
|
private log = createDebugLogger('aztec:rollup-simulator');
|
|
20
31
|
|
|
32
|
+
// Some circuits are so small it is faster to use WASM
|
|
33
|
+
private wasmSimulator: WASMSimulator = new WASMSimulator();
|
|
34
|
+
|
|
35
|
+
constructor(private simulationProvider: SimulationProvider) {}
|
|
36
|
+
|
|
21
37
|
/**
|
|
22
38
|
* Simulates the base rollup circuit from its inputs.
|
|
23
39
|
* @param input - Inputs to the circuit.
|
|
24
40
|
* @returns The public inputs as outputs of the simulation.
|
|
25
41
|
*/
|
|
26
42
|
public async baseRollupCircuit(input: BaseRollupInputs): Promise<BaseOrMergeRollupPublicInputs> {
|
|
27
|
-
const
|
|
43
|
+
const witnessMap = convertBaseRollupInputsToWitnessMap(input);
|
|
28
44
|
|
|
29
|
-
this.
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
duration,
|
|
33
|
-
inputSize: input.toBuffer().length,
|
|
34
|
-
outputSize: result.toBuffer().length,
|
|
35
|
-
} satisfies CircuitSimulationStats);
|
|
45
|
+
const witness = await this.simulationProvider.simulateCircuit(witnessMap, BaseRollupArtifact);
|
|
46
|
+
|
|
47
|
+
const result = convertBaseRollupOutputsFromWitnessMap(witness);
|
|
36
48
|
|
|
37
49
|
return Promise.resolve(result);
|
|
38
50
|
}
|
|
@@ -42,15 +54,11 @@ export class RealRollupCircuitSimulator implements RollupSimulator {
|
|
|
42
54
|
* @returns The public inputs as outputs of the simulation.
|
|
43
55
|
*/
|
|
44
56
|
public async mergeRollupCircuit(input: MergeRollupInputs): Promise<BaseOrMergeRollupPublicInputs> {
|
|
45
|
-
const
|
|
57
|
+
const witnessMap = convertMergeRollupInputsToWitnessMap(input);
|
|
46
58
|
|
|
47
|
-
this.
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
duration,
|
|
51
|
-
inputSize: input.toBuffer().length,
|
|
52
|
-
outputSize: result.toBuffer().length,
|
|
53
|
-
} satisfies CircuitSimulationStats);
|
|
59
|
+
const witness = await this.wasmSimulator.simulateCircuit(witnessMap, MergeRollupArtifact);
|
|
60
|
+
|
|
61
|
+
const result = convertMergeRollupOutputsFromWitnessMap(witness);
|
|
54
62
|
|
|
55
63
|
return result;
|
|
56
64
|
}
|
|
@@ -61,7 +69,11 @@ export class RealRollupCircuitSimulator implements RollupSimulator {
|
|
|
61
69
|
* @returns The public inputs as outputs of the simulation.
|
|
62
70
|
*/
|
|
63
71
|
public async rootRollupCircuit(input: RootRollupInputs): Promise<RootRollupPublicInputs> {
|
|
64
|
-
const
|
|
72
|
+
const witnessMap = convertRootRollupInputsToWitnessMap(input);
|
|
73
|
+
|
|
74
|
+
const [duration, witness] = await elapsed(() => this.wasmSimulator.simulateCircuit(witnessMap, RootRollupArtifact));
|
|
75
|
+
|
|
76
|
+
const result = convertRootRollupOutputsFromWitnessMap(witness);
|
|
65
77
|
|
|
66
78
|
this.log(`Simulated root rollup circuit`, {
|
|
67
79
|
eventName: 'circuit-simulation',
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { NoirCompiledCircuit } from '@aztec/types/noir';
|
|
2
|
+
|
|
3
|
+
import { WitnessMap } from '@noir-lang/types';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Low level simulation interface
|
|
7
|
+
*/
|
|
8
|
+
export interface SimulationProvider {
|
|
9
|
+
simulateCircuit(input: WitnessMap, compiledCircuit: NoirCompiledCircuit): Promise<WitnessMap>;
|
|
10
|
+
}
|