@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.
Files changed (49) hide show
  1. package/dest/block_builder/solo_block_builder.d.ts +5 -4
  2. package/dest/block_builder/solo_block_builder.d.ts.map +1 -1
  3. package/dest/block_builder/solo_block_builder.js +75 -30
  4. package/dest/client/sequencer-client.d.ts.map +1 -1
  5. package/dest/client/sequencer-client.js +29 -3
  6. package/dest/config.d.ts.map +1 -1
  7. package/dest/config.js +4 -2
  8. package/dest/index.d.ts +2 -0
  9. package/dest/index.d.ts.map +1 -1
  10. package/dest/index.js +2 -1
  11. package/dest/publisher/l1-publisher.js +5 -5
  12. package/dest/publisher/viem-tx-sender.js +2 -2
  13. package/dest/sequencer/public_processor.d.ts +3 -1
  14. package/dest/sequencer/public_processor.d.ts.map +1 -1
  15. package/dest/sequencer/public_processor.js +4 -3
  16. package/dest/sequencer/sequencer.js +3 -3
  17. package/dest/simulator/acvm_native.d.ts +20 -0
  18. package/dest/simulator/acvm_native.d.ts.map +1 -0
  19. package/dest/simulator/acvm_native.js +96 -0
  20. package/dest/simulator/acvm_wasm.d.ts +7 -0
  21. package/dest/simulator/acvm_wasm.d.ts.map +1 -0
  22. package/dest/simulator/acvm_wasm.js +23 -0
  23. package/dest/simulator/index.d.ts +1 -0
  24. package/dest/simulator/index.d.ts.map +1 -1
  25. package/dest/simulator/index.js +2 -2
  26. package/dest/simulator/public_kernel.d.ts +4 -0
  27. package/dest/simulator/public_kernel.d.ts.map +1 -1
  28. package/dest/simulator/public_kernel.js +16 -6
  29. package/dest/simulator/rollup.d.ts +4 -0
  30. package/dest/simulator/rollup.d.ts.map +1 -1
  31. package/dest/simulator/rollup.js +16 -20
  32. package/dest/simulator/simulation_provider.d.ts +9 -0
  33. package/dest/simulator/simulation_provider.d.ts.map +1 -0
  34. package/dest/simulator/simulation_provider.js +2 -0
  35. package/package.json +15 -13
  36. package/src/block_builder/solo_block_builder.ts +109 -50
  37. package/src/client/sequencer-client.ts +37 -2
  38. package/src/config.ts +4 -0
  39. package/src/index.ts +2 -0
  40. package/src/publisher/l1-publisher.ts +4 -4
  41. package/src/publisher/viem-tx-sender.ts +1 -1
  42. package/src/sequencer/public_processor.ts +3 -1
  43. package/src/sequencer/sequencer.ts +2 -2
  44. package/src/simulator/acvm_native.ts +112 -0
  45. package/src/simulator/acvm_wasm.ts +31 -0
  46. package/src/simulator/index.ts +1 -0
  47. package/src/simulator/public_kernel.ts +31 -7
  48. package/src/simulator/rollup.ts +31 -19
  49. package/src/simulator/simulation_provider.ts +10 -0
@@ -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 { executeBaseRollup, executeMergeRollup, executeRootRollup } from '@aztec/noir-protocol-circuits-types';
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 [duration, result] = await elapsed(() => executeBaseRollup(input));
43
+ const witnessMap = convertBaseRollupInputsToWitnessMap(input);
28
44
 
29
- this.log(`Simulated base rollup circuit`, {
30
- eventName: 'circuit-simulation',
31
- circuitName: 'base-rollup',
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 [duration, result] = await elapsed(() => executeMergeRollup(input));
57
+ const witnessMap = convertMergeRollupInputsToWitnessMap(input);
46
58
 
47
- this.log(`Simulated merge rollup circuit`, {
48
- eventName: 'circuit-simulation',
49
- circuitName: 'merge-rollup',
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 [duration, result] = await elapsed(() => executeRootRollup(input));
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
+ }