@aztec/pxe 0.0.1-commit.808bf7f90 → 0.0.1-commit.8227e42

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.
@@ -0,0 +1,203 @@
1
+ import { MAX_KEY_VALIDATION_REQUESTS_PER_CALL, MAX_KEY_VALIDATION_REQUESTS_PER_TX, MAX_NOTE_HASHES_PER_CALL, MAX_NOTE_HASHES_PER_TX, MAX_NOTE_HASH_READ_REQUESTS_PER_CALL, MAX_NOTE_HASH_READ_REQUESTS_PER_TX, MAX_NULLIFIERS_PER_CALL, MAX_NULLIFIERS_PER_TX, MAX_NULLIFIER_READ_REQUESTS_PER_CALL, MAX_NULLIFIER_READ_REQUESTS_PER_TX, MAX_PRIVATE_LOGS_PER_CALL, MAX_PRIVATE_LOGS_PER_TX } from '@aztec/constants';
2
+ import { makeTuple } from '@aztec/foundation/array';
3
+ import { Fr } from '@aztec/foundation/curves/bn254';
4
+ import { Point } from '@aztec/foundation/curves/grumpkin';
5
+ import { AztecAddress } from '@aztec/stdlib/aztec-address';
6
+ import { ClaimedLengthArray, KeyValidationRequest, KeyValidationRequestAndSeparator, NoteHash, Nullifier, PrivateCircuitPublicInputs, PrivateKernelCircuitPublicInputs, ReadRequest, ScopedKeyValidationRequestAndSeparator, ScopedNoteHash, ScopedNullifier, ScopedReadRequest } from '@aztec/stdlib/kernel';
7
+ import { PrivateLogData, ScopedPrivateLogData } from '@aztec/stdlib/kernel';
8
+ import { PrivateLog } from '@aztec/stdlib/logs';
9
+ import { PrivateCallExecutionResult } from '@aztec/stdlib/tx';
10
+ import { VerificationKeyData } from '@aztec/stdlib/vks';
11
+ const DEFAULT_CONTRACT_ADDRESS = AztecAddress.fromBigInt(987654n);
12
+ /**
13
+ * Builds a ClaimedLengthArray from a list of items, padding to the required size.
14
+ */ function makeClaimed(items, emptyFactory, maxSize) {
15
+ const padded = makeTuple(maxSize, (i)=>items[i] ?? emptyFactory.empty());
16
+ return new ClaimedLengthArray(padded, items.length);
17
+ }
18
+ /** Builder for PrivateKernelCircuitPublicInputs with fluent API for adding side effects. */ export class PrivateKernelCircuitPublicInputsBuilder {
19
+ contractAddress;
20
+ noteHashes;
21
+ nullifiers;
22
+ noteHashReadRequests;
23
+ nullifierReadRequests;
24
+ keyValidationRequests;
25
+ privateLogs;
26
+ nextCounter;
27
+ constructor(contractAddress = DEFAULT_CONTRACT_ADDRESS, startCounter = 1){
28
+ this.contractAddress = contractAddress;
29
+ this.noteHashes = [];
30
+ this.nullifiers = [];
31
+ this.noteHashReadRequests = [];
32
+ this.nullifierReadRequests = [];
33
+ this.keyValidationRequests = [];
34
+ this.privateLogs = [];
35
+ this.nextCounter = startCounter;
36
+ }
37
+ getCounter(sideEffectCounter) {
38
+ if (sideEffectCounter !== undefined) {
39
+ this.nextCounter = sideEffectCounter + 1;
40
+ return sideEffectCounter;
41
+ }
42
+ return this.nextCounter++;
43
+ }
44
+ /** Adds a note hash to the accumulated data. Defaults are generated randomly. */ addNoteHash(opts) {
45
+ const value = opts?.value ?? Fr.random();
46
+ const counter = this.getCounter(opts?.counter);
47
+ const addr = opts?.contractAddress ?? this.contractAddress;
48
+ this.noteHashes.push(new NoteHash(value, counter).scope(addr));
49
+ return this;
50
+ }
51
+ /** Adds a nullifier to the accumulated data. Defaults are generated randomly. */ addNullifier(opts) {
52
+ const value = opts?.value ?? Fr.random();
53
+ const noteHash = opts?.noteHash ?? Fr.ZERO;
54
+ const counter = this.getCounter(opts?.counter);
55
+ const addr = opts?.contractAddress ?? this.contractAddress;
56
+ this.nullifiers.push(new Nullifier(value, noteHash, counter).scope(addr));
57
+ return this;
58
+ }
59
+ /** Adds a pending note hash read request (non-empty contract address, can match a pending note hash). */ addPendingNoteHashReadRequest(opts) {
60
+ const value = opts?.value ?? Fr.random();
61
+ const counter = this.getCounter(opts?.counter);
62
+ const addr = opts?.contractAddress ?? this.contractAddress;
63
+ this.noteHashReadRequests.push(new ScopedReadRequest(new ReadRequest(value, counter), addr));
64
+ return this;
65
+ }
66
+ /** Adds a settled note hash read request (empty contract address, resolved against the note hash tree). */ addSettledNoteHashReadRequest(opts) {
67
+ const value = opts?.value ?? Fr.random();
68
+ const counter = this.getCounter(opts?.counter);
69
+ this.noteHashReadRequests.push(new ScopedReadRequest(new ReadRequest(value, counter), AztecAddress.ZERO));
70
+ return this;
71
+ }
72
+ /** Adds a pending nullifier read request (non-empty contract address, can match a pending nullifier). */ addPendingNullifierReadRequest(opts) {
73
+ const value = opts?.value ?? Fr.random();
74
+ const counter = this.getCounter(opts?.counter);
75
+ const addr = opts?.contractAddress ?? this.contractAddress;
76
+ this.nullifierReadRequests.push(new ScopedReadRequest(new ReadRequest(value, counter), addr));
77
+ return this;
78
+ }
79
+ /** Adds a settled nullifier read request (empty contract address, resolved against the nullifier tree). */ addSettledNullifierReadRequest(opts) {
80
+ const value = opts?.value ?? Fr.random();
81
+ const counter = this.getCounter(opts?.counter);
82
+ this.nullifierReadRequests.push(new ScopedReadRequest(new ReadRequest(value, counter), AztecAddress.ZERO));
83
+ return this;
84
+ }
85
+ /** Adds a key validation request to validation requests. */ addKeyValidationRequest(opts) {
86
+ const addr = opts?.contractAddress ?? this.contractAddress;
87
+ this.keyValidationRequests.push(new ScopedKeyValidationRequestAndSeparator(new KeyValidationRequestAndSeparator(new KeyValidationRequest(new Point(Fr.random(), Fr.random(), false), Fr.random()), Fr.random()), addr));
88
+ return this;
89
+ }
90
+ /** Adds a private log to the accumulated data. Defaults are generated randomly. */ addPrivateLog(opts) {
91
+ const noteHashCounter = opts?.noteHashCounter ?? 0;
92
+ const counter = this.getCounter(opts?.counter);
93
+ const addr = opts?.contractAddress ?? this.contractAddress;
94
+ this.privateLogs.push(new ScopedPrivateLogData(new PrivateLogData(PrivateLog.empty(), noteHashCounter, counter), addr));
95
+ return this;
96
+ }
97
+ /** Builds the PrivateKernelCircuitPublicInputs with all added side effects. */ build() {
98
+ const publicInputs = PrivateKernelCircuitPublicInputs.empty();
99
+ publicInputs.end.noteHashes = makeClaimed(this.noteHashes, ScopedNoteHash, MAX_NOTE_HASHES_PER_TX);
100
+ publicInputs.end.nullifiers = makeClaimed(this.nullifiers, ScopedNullifier, MAX_NULLIFIERS_PER_TX);
101
+ publicInputs.end.privateLogs = makeClaimed(this.privateLogs, ScopedPrivateLogData, MAX_PRIVATE_LOGS_PER_TX);
102
+ publicInputs.validationRequests.noteHashReadRequests = makeClaimed(this.noteHashReadRequests, ScopedReadRequest, MAX_NOTE_HASH_READ_REQUESTS_PER_TX);
103
+ publicInputs.validationRequests.nullifierReadRequests = makeClaimed(this.nullifierReadRequests, ScopedReadRequest, MAX_NULLIFIER_READ_REQUESTS_PER_TX);
104
+ publicInputs.validationRequests.scopedKeyValidationRequestsAndSeparators = makeClaimed(this.keyValidationRequests, ScopedKeyValidationRequestAndSeparator, MAX_KEY_VALIDATION_REQUESTS_PER_TX);
105
+ return publicInputs;
106
+ }
107
+ }
108
+ /** Builder for PrivateCircuitPublicInputs (call-level) with fluent API for adding side effects. */ export class PrivateCircuitPublicInputsBuilder {
109
+ contractAddress;
110
+ noteHashes;
111
+ nullifiers;
112
+ noteHashReadRequests;
113
+ nullifierReadRequests;
114
+ keyValidationRequests;
115
+ privateLogs;
116
+ nextCounter;
117
+ constructor(contractAddress = DEFAULT_CONTRACT_ADDRESS, startCounter = 1){
118
+ this.contractAddress = contractAddress;
119
+ this.noteHashes = [];
120
+ this.nullifiers = [];
121
+ this.noteHashReadRequests = [];
122
+ this.nullifierReadRequests = [];
123
+ this.keyValidationRequests = [];
124
+ this.privateLogs = [];
125
+ this.nextCounter = startCounter;
126
+ }
127
+ getCounter(sideEffectCounter) {
128
+ if (sideEffectCounter !== undefined) {
129
+ this.nextCounter = sideEffectCounter + 1;
130
+ return sideEffectCounter;
131
+ }
132
+ return this.nextCounter++;
133
+ }
134
+ /** Adds a note hash. Defaults are generated randomly. */ addNoteHash(opts) {
135
+ const value = opts?.value ?? Fr.random();
136
+ const counter = this.getCounter(opts?.counter);
137
+ this.noteHashes.push(new NoteHash(value, counter));
138
+ return this;
139
+ }
140
+ /** Adds a nullifier. Defaults are generated randomly. */ addNullifier(opts) {
141
+ const value = opts?.value ?? Fr.random();
142
+ const noteHash = opts?.noteHash ?? Fr.ZERO;
143
+ const counter = this.getCounter(opts?.counter);
144
+ this.nullifiers.push(new Nullifier(value, noteHash, counter));
145
+ return this;
146
+ }
147
+ /** Adds a pending note hash read request (non-empty contract address, can match a pending note hash). */ addPendingNoteHashReadRequest(opts) {
148
+ const value = opts?.value ?? Fr.random();
149
+ const counter = this.getCounter(opts?.counter);
150
+ this.noteHashReadRequests.push(new ScopedReadRequest(new ReadRequest(value, counter), this.contractAddress));
151
+ return this;
152
+ }
153
+ /** Adds a settled note hash read request (empty contract address, resolved against the note hash tree). */ addSettledNoteHashReadRequest(opts) {
154
+ const value = opts?.value ?? Fr.random();
155
+ const counter = this.getCounter(opts?.counter);
156
+ this.noteHashReadRequests.push(new ScopedReadRequest(new ReadRequest(value, counter), AztecAddress.ZERO));
157
+ return this;
158
+ }
159
+ /** Adds a pending nullifier read request (non-empty contract address, can match a pending nullifier). */ addPendingNullifierReadRequest(opts) {
160
+ const value = opts?.value ?? Fr.random();
161
+ const counter = this.getCounter(opts?.counter);
162
+ this.nullifierReadRequests.push(new ScopedReadRequest(new ReadRequest(value, counter), this.contractAddress));
163
+ return this;
164
+ }
165
+ /** Adds a settled nullifier read request (empty contract address, resolved against the nullifier tree). */ addSettledNullifierReadRequest(opts) {
166
+ const value = opts?.value ?? Fr.random();
167
+ const counter = this.getCounter(opts?.counter);
168
+ this.nullifierReadRequests.push(new ScopedReadRequest(new ReadRequest(value, counter), AztecAddress.ZERO));
169
+ return this;
170
+ }
171
+ /** Adds a key validation request. */ addKeyValidationRequest() {
172
+ this.keyValidationRequests.push(new KeyValidationRequestAndSeparator(new KeyValidationRequest(new Point(Fr.random(), Fr.random(), false), Fr.random()), Fr.random()));
173
+ return this;
174
+ }
175
+ /** Adds a private log. Defaults are generated randomly. */ addPrivateLog(opts) {
176
+ const noteHashCounter = opts?.noteHashCounter ?? 0;
177
+ const counter = this.getCounter(opts?.counter);
178
+ this.privateLogs.push(new PrivateLogData(PrivateLog.empty(), noteHashCounter, counter));
179
+ return this;
180
+ }
181
+ /** Builds the PrivateCircuitPublicInputs with all added side effects. */ build() {
182
+ const publicInputs = PrivateCircuitPublicInputs.empty();
183
+ publicInputs.callContext.contractAddress = this.contractAddress;
184
+ publicInputs.noteHashes = makeClaimed(this.noteHashes, NoteHash, MAX_NOTE_HASHES_PER_CALL);
185
+ publicInputs.nullifiers = makeClaimed(this.nullifiers, Nullifier, MAX_NULLIFIERS_PER_CALL);
186
+ publicInputs.privateLogs = makeClaimed(this.privateLogs, PrivateLogData, MAX_PRIVATE_LOGS_PER_CALL);
187
+ publicInputs.noteHashReadRequests = makeClaimed(this.noteHashReadRequests, ScopedReadRequest, MAX_NOTE_HASH_READ_REQUESTS_PER_CALL);
188
+ publicInputs.nullifierReadRequests = makeClaimed(this.nullifierReadRequests, ScopedReadRequest, MAX_NULLIFIER_READ_REQUESTS_PER_CALL);
189
+ publicInputs.keyValidationRequestsAndSeparators = makeClaimed(this.keyValidationRequests, KeyValidationRequestAndSeparator, MAX_KEY_VALIDATION_REQUESTS_PER_CALL);
190
+ return publicInputs;
191
+ }
192
+ }
193
+ /** Wraps a PrivateKernelCircuitPublicInputs in a PrivateKernelSimulateOutput. */ export function makeKernelOutput(publicInputs) {
194
+ return {
195
+ publicInputs: publicInputs ?? PrivateKernelCircuitPublicInputs.empty(),
196
+ verificationKey: VerificationKeyData.empty(),
197
+ outputWitness: new Map(),
198
+ bytecode: Buffer.from([])
199
+ };
200
+ }
201
+ /** Wraps a PrivateCircuitPublicInputs in a PrivateCallExecutionResult. */ export function makeExecutionResult(publicInputs) {
202
+ return new PrivateCallExecutionResult(Buffer.alloc(0), Buffer.alloc(0), new Map(), publicInputs ?? PrivateCircuitPublicInputs.empty(), [], new Map(), [], [], [], [], []);
203
+ }
@@ -42,4 +42,4 @@ export declare class PrivateKernelExecutionProver {
42
42
  private getVkData;
43
43
  private createPrivateCallData;
44
44
  }
45
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHJpdmF0ZV9rZXJuZWxfZXhlY3V0aW9uX3Byb3Zlci5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL3ByaXZhdGVfa2VybmVsL3ByaXZhdGVfa2VybmVsX2V4ZWN1dGlvbl9wcm92ZXIudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBRUEsT0FBTyxFQUFlLEtBQUssY0FBYyxFQUFnQixNQUFNLHVCQUF1QixDQUFDO0FBTXZGLE9BQU8sS0FBSyxFQUFFLG1CQUFtQixFQUFFLE1BQU0saUNBQWlDLENBQUM7QUFDM0UsT0FBTyxFQVFMLEtBQUssaUNBQWlDLEVBS3RDLEtBQUssb0NBQW9DLEVBRTFDLE1BQU0sc0JBQXNCLENBQUM7QUFFOUIsT0FBTyxFQUVMLEtBQUssc0JBQXNCLEVBQzNCLFNBQVMsRUFHVixNQUFNLGtCQUFrQixDQUFDO0FBSTFCLE9BQU8sS0FBSyxFQUFFLG1CQUFtQixFQUFFLE1BQU0sNEJBQTRCLENBQUM7QUFTdEUsTUFBTSxXQUFXLGtDQUFrQztJQUNqRCxRQUFRLEVBQUUsT0FBTyxDQUFDO0lBQ2xCLGtCQUFrQixFQUFFLE9BQU8sQ0FBQztJQUM1QixXQUFXLEVBQUUsT0FBTyxHQUFHLGlCQUFpQixHQUFHLE1BQU0sR0FBRyxNQUFNLENBQUM7Q0FDNUQ7QUFFRDs7Ozs7R0FLRztBQUNILHFCQUFhLDRCQUE0QjtJQUlyQyxPQUFPLENBQUMsTUFBTTtJQUNkLE9BQU8sQ0FBQyxZQUFZO0lBQ3BCLE9BQU8sQ0FBQyxVQUFVO0lBTHBCLE9BQU8sQ0FBQyxHQUFHLENBQVM7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AmB,EAAE,MAAM,iCAAiC,CAAC;AAC3E,OAAO,EAQL,KAAK,iCAAiC,EAKtC,KAAK,oCAAoC,EAE1C,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAEL,KAAK,sBAAsB,EAC3B,SAAS,EAGV,MAAM,kBAAkB,CAAC;AAI1B,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAStE,MAAM,WAAW,kCAAkC;IACjD,QAAQ,EAAE,OAAO,CAAC;IAClB,kBAAkB,EAAE,OAAO,CAAC;IAC5B,WAAW,EAAE,OAAO,GAAG,iBAAiB,GAAG,MAAM,GAAG,MAAM,CAAC;CAC5D;AAED;;;;;GAKG;AACH,qBAAa,4BAA4B;IAIrC,OAAO,CAAC,MAAM;IACd,OAAO,CAAC,YAAY;IACpB,OAAO,CAAC,UAAU;IALpB,OAAO,CAAC,GAAG,CAAS;IAEpB,YACU,MAAM,EAAE,mBAAmB,EAC3B,YAAY,EAAE,mBAAmB,EACjC,UAAU,UAAQ,EAC1B,QAAQ,CAAC,EAAE,cAAc,EAG1B;IAED;;;;;;;;;;OAUG;IACG,gBAAgB,CACpB,SAAS,EAAE,SAAS,EACpB,eAAe,EAAE,sBAAsB,EACvC,EAAE,QAAQ,EAAE,kBAAkB,EAAE,WAAW,EAAE,GAAE,kCAI9C,GACA,OAAO,CAAC,iCAAiC,CAAC,oCAAoC,CAAC,CAAC,CAoRlF;IAED;;;;;OAKG;IACH,OAAO,CAAC,uBAAuB;YAoBjB,SAAS;YAST,qBAAqB;CA+BpC"}
1
+ {"version":3,"file":"private_kernel_execution_prover.d.ts","sourceRoot":"","sources":["../../src/private_kernel/private_kernel_execution_prover.ts"],"names":[],"mappings":"AAEA,OAAO,EAAe,KAAK,cAAc,EAAgB,MAAM,uBAAuB,CAAC;AAMvF,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAC3E,OAAO,EAQL,KAAK,iCAAiC,EAKtC,KAAK,oCAAoC,EAE1C,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAEL,KAAK,sBAAsB,EAC3B,SAAS,EAGV,MAAM,kBAAkB,CAAC;AAI1B,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAStE,MAAM,WAAW,kCAAkC;IACjD,QAAQ,EAAE,OAAO,CAAC;IAClB,kBAAkB,EAAE,OAAO,CAAC;IAC5B,WAAW,EAAE,OAAO,GAAG,iBAAiB,GAAG,MAAM,GAAG,MAAM,CAAC;CAC5D;AAED;;;;;GAKG;AACH,qBAAa,4BAA4B;IAIrC,OAAO,CAAC,MAAM;IACd,OAAO,CAAC,YAAY;IACpB,OAAO,CAAC,UAAU;IALpB,OAAO,CAAC,GAAG,CAAS;IAEpB,YACU,MAAM,EAAE,mBAAmB,EAC3B,YAAY,EAAE,mBAAmB,EACjC,UAAU,UAAQ,EAC1B,QAAQ,CAAC,EAAE,cAAc,EAG1B;IAED;;;;;;;;;;OAUG;IACG,gBAAgB,CACpB,SAAS,EAAE,SAAS,EACpB,eAAe,EAAE,sBAAsB,EACvC,EAAE,QAAQ,EAAE,kBAAkB,EAAE,WAAW,EAAE,GAAE,kCAI9C,GACA,OAAO,CAAC,iCAAiC,CAAC,oCAAoC,CAAC,CAAC,CA2RlF;IAED;;;;;OAKG;IACH,OAAO,CAAC,uBAAuB;YAoBjB,SAAS;YAST,qBAAqB;CA+BpC"}
@@ -67,6 +67,7 @@ const NULL_SIMULATE_OUTPUT = {
67
67
  if (!firstIteration) {
68
68
  let resetBuilder = new PrivateKernelResetPrivateInputsBuilder(output, executionStack, noteHashNullifierCounterMap, splitCounter);
69
69
  while(resetBuilder.needsReset()){
70
+ // Inner reset: without siloing.
70
71
  const witgenTimer = new Timer();
71
72
  const privateInputs = await resetBuilder.build(this.oracle);
72
73
  output = generateWitnesses ? await this.proofCreator.generateResetOutput(privateInputs) : await this.proofCreator.simulateReset(privateInputs);
@@ -132,11 +133,19 @@ const NULL_SIMULATE_OUTPUT = {
132
133
  }
133
134
  firstIteration = false;
134
135
  }
135
- // Reset.
136
- let resetBuilder = new PrivateKernelResetPrivateInputsBuilder(output, [], noteHashNullifierCounterMap, splitCounter);
137
- while(resetBuilder.needsReset()){
136
+ // Final reset: include siloing of note hashes, nullifiers and private logs.
137
+ const finalResetBuilder = new PrivateKernelResetPrivateInputsBuilder(output, [], noteHashNullifierCounterMap, splitCounter);
138
+ if (!finalResetBuilder.needsReset()) {
139
+ // The final reset must be performed exactly once, because each tx has at least one nullifier that requires
140
+ // siloing, and siloing cannot be done multiple times.
141
+ // While, in theory, it might be possible to silo note hashes first and then run another reset to silo nullifiers
142
+ // and/or private logs, we currently don't have standalone dimensions for the arrays that require siloing. As a
143
+ // result, all necessary siloing must be done together in a single reset.
144
+ // Refer to the possible combinations of dimensions in private_kernel_reset_config.json.
145
+ throw new Error('Nothing to reset for the final reset.');
146
+ } else {
138
147
  const witgenTimer = new Timer();
139
- const privateInputs = await resetBuilder.build(this.oracle);
148
+ const privateInputs = await finalResetBuilder.build(this.oracle);
140
149
  output = generateWitnesses ? await this.proofCreator.generateResetOutput(privateInputs) : await this.proofCreator.simulateReset(privateInputs);
141
150
  executionSteps.push({
142
151
  functionName: 'private_kernel_reset',
@@ -147,7 +156,6 @@ const NULL_SIMULATE_OUTPUT = {
147
156
  witgen: witgenTimer.ms()
148
157
  }
149
158
  });
150
- resetBuilder = new PrivateKernelResetPrivateInputsBuilder(output, [], noteHashNullifierCounterMap, splitCounter);
151
159
  }
152
160
  if (output.publicInputs.feePayer.isZero() && skipFeeEnforcement) {
153
161
  if (!skipProofGeneration) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aztec/pxe",
3
- "version": "0.0.1-commit.808bf7f90",
3
+ "version": "0.0.1-commit.8227e42",
4
4
  "type": "module",
5
5
  "typedocOptions": {
6
6
  "entryPoints": [
@@ -70,19 +70,19 @@
70
70
  ]
71
71
  },
72
72
  "dependencies": {
73
- "@aztec/bb-prover": "0.0.1-commit.808bf7f90",
74
- "@aztec/bb.js": "0.0.1-commit.808bf7f90",
75
- "@aztec/builder": "0.0.1-commit.808bf7f90",
76
- "@aztec/constants": "0.0.1-commit.808bf7f90",
77
- "@aztec/ethereum": "0.0.1-commit.808bf7f90",
78
- "@aztec/foundation": "0.0.1-commit.808bf7f90",
79
- "@aztec/key-store": "0.0.1-commit.808bf7f90",
80
- "@aztec/kv-store": "0.0.1-commit.808bf7f90",
81
- "@aztec/noir-protocol-circuits-types": "0.0.1-commit.808bf7f90",
82
- "@aztec/noir-types": "0.0.1-commit.808bf7f90",
83
- "@aztec/protocol-contracts": "0.0.1-commit.808bf7f90",
84
- "@aztec/simulator": "0.0.1-commit.808bf7f90",
85
- "@aztec/stdlib": "0.0.1-commit.808bf7f90",
73
+ "@aztec/bb-prover": "0.0.1-commit.8227e42",
74
+ "@aztec/bb.js": "0.0.1-commit.8227e42",
75
+ "@aztec/builder": "0.0.1-commit.8227e42",
76
+ "@aztec/constants": "0.0.1-commit.8227e42",
77
+ "@aztec/ethereum": "0.0.1-commit.8227e42",
78
+ "@aztec/foundation": "0.0.1-commit.8227e42",
79
+ "@aztec/key-store": "0.0.1-commit.8227e42",
80
+ "@aztec/kv-store": "0.0.1-commit.8227e42",
81
+ "@aztec/noir-protocol-circuits-types": "0.0.1-commit.8227e42",
82
+ "@aztec/noir-types": "0.0.1-commit.8227e42",
83
+ "@aztec/protocol-contracts": "0.0.1-commit.8227e42",
84
+ "@aztec/simulator": "0.0.1-commit.8227e42",
85
+ "@aztec/stdlib": "0.0.1-commit.8227e42",
86
86
  "koa": "^2.16.1",
87
87
  "koa-router": "^13.1.1",
88
88
  "lodash.omit": "^4.5.0",
@@ -91,8 +91,8 @@
91
91
  "viem": "npm:@aztec/viem@2.38.2"
92
92
  },
93
93
  "devDependencies": {
94
- "@aztec/merkle-tree": "0.0.1-commit.808bf7f90",
95
- "@aztec/noir-test-contracts.js": "0.0.1-commit.808bf7f90",
94
+ "@aztec/merkle-tree": "0.0.1-commit.8227e42",
95
+ "@aztec/noir-test-contracts.js": "0.0.1-commit.8227e42",
96
96
  "@jest/globals": "^30.0.0",
97
97
  "@types/jest": "^30.0.0",
98
98
  "@types/lodash.omit": "^4.5.7",
@@ -689,6 +689,7 @@ function squashTransientSideEffects(
689
689
  scopedNullifiersCLA,
690
690
  /*futureNoteHashReads=*/ [],
691
691
  /*futureNullifierReads=*/ [],
692
+ /*futureLogs=*/ [],
692
693
  noteHashNullifierCounterMap,
693
694
  minRevertibleSideEffectCounter,
694
695
  );
@@ -731,16 +732,8 @@ async function verifyReadRequests(
731
732
  nullifierReadRequests.length,
732
733
  );
733
734
 
734
- const noteHashResetActions = getNoteHashReadRequestResetActions(
735
- noteHashReadRequestsCLA,
736
- scopedNoteHashesCLA,
737
- /*futureNoteHashes=*/ [],
738
- );
739
- const nullifierResetActions = getNullifierReadRequestResetActions(
740
- nullifierReadRequestsCLA,
741
- scopedNullifiersCLA,
742
- /*futureNullifiers=*/ [],
743
- );
735
+ const noteHashResetActions = getNoteHashReadRequestResetActions(noteHashReadRequestsCLA, scopedNoteHashesCLA);
736
+ const nullifierResetActions = getNullifierReadRequestResetActions(nullifierReadRequestsCLA, scopedNullifiersCLA);
744
737
 
745
738
  const settledNoteHashReads: { index: number; value: Fr }[] = [];
746
739
  for (let i = 0; i < noteHashResetActions.actions.length; i++) {