@aztec/txe 3.0.0-nightly.20251103 → 3.0.0-nightly.20251105
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/oracle/txe_oracle_top_level_context.js +4 -4
- package/dest/txe_session.d.ts.map +1 -1
- package/dest/txe_session.js +5 -3
- package/dest/utils/tx_effect_creation.d.ts +1 -1
- package/dest/utils/tx_effect_creation.d.ts.map +1 -1
- package/dest/utils/tx_effect_creation.js +5 -5
- package/package.json +15 -15
- package/src/oracle/txe_oracle_top_level_context.ts +4 -4
- package/src/txe_session.ts +6 -4
- package/src/utils/tx_effect_creation.ts +5 -5
|
@@ -13,7 +13,7 @@ import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
|
13
13
|
import { Body, L2Block } from '@aztec/stdlib/block';
|
|
14
14
|
import { computePartialAddress } from '@aztec/stdlib/contract';
|
|
15
15
|
import { Gas, GasFees, GasSettings } from '@aztec/stdlib/gas';
|
|
16
|
-
import { computeCalldataHash, siloNullifier } from '@aztec/stdlib/hash';
|
|
16
|
+
import { computeCalldataHash, computeProtocolNullifier, siloNullifier } from '@aztec/stdlib/hash';
|
|
17
17
|
import { PartialPrivateTailPublicInputsForPublic, PrivateKernelTailCircuitPublicInputs, PrivateToPublicAccumulatedData, PublicCallRequest } from '@aztec/stdlib/kernel';
|
|
18
18
|
import { ChonkProof } from '@aztec/stdlib/proofs';
|
|
19
19
|
import { makeAppendOnlyTreeSnapshot, makeGlobalVariables } from '@aztec/stdlib/testing';
|
|
@@ -184,8 +184,8 @@ export class TXEOracleTopLevelContext {
|
|
|
184
184
|
const gasSettings = new GasSettings(gasLimits, teardownGasLimits, GasFees.empty(), GasFees.empty());
|
|
185
185
|
const txContext = new TxContext(this.chainId, this.version, gasSettings);
|
|
186
186
|
const blockHeader = await this.pxeOracleInterface.getAnchorBlockHeader();
|
|
187
|
-
const
|
|
188
|
-
const noteCache = new ExecutionNoteCache(
|
|
187
|
+
const protocolNullifier = await computeProtocolNullifier(getSingleTxBlockRequestHash(blockNumber));
|
|
188
|
+
const noteCache = new ExecutionNoteCache(protocolNullifier);
|
|
189
189
|
const taggingIndexCache = new ExecutionTaggingIndexCache();
|
|
190
190
|
const simulator = new WASMSimulator();
|
|
191
191
|
const privateExecutionOracle = new PrivateExecutionOracle(argsHash, txContext, callContext, /** Header of a block whose state is used during private execution (not the block the transaction is included in). */ blockHeader, /** List of transient auth witnesses to be used during this simulation */ Array.from(this.authwits.values()), /** List of transient auth witnesses to be used during this simulation */ [], HashedValuesCache.create([
|
|
@@ -218,7 +218,7 @@ export class TXEOracleTopLevelContext {
|
|
|
218
218
|
// According to the protocol rules, the nonce generator for the note hashes
|
|
219
219
|
// can either be the first nullifier in the tx or the hash of the initial tx request
|
|
220
220
|
// if there are none.
|
|
221
|
-
const nonceGenerator = result.firstNullifier.equals(Fr.ZERO) ?
|
|
221
|
+
const nonceGenerator = result.firstNullifier.equals(Fr.ZERO) ? protocolNullifier : result.firstNullifier;
|
|
222
222
|
const { publicInputs } = await generateSimulatedProvingResult(result, nonceGenerator, this.contractDataProvider);
|
|
223
223
|
const globals = makeGlobalVariables();
|
|
224
224
|
globals.blockNumber = blockNumber;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"txe_session.d.ts","sourceRoot":"","sources":["../src/txe_session.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAC9C,OAAO,EAAE,KAAK,MAAM,EAAgB,MAAM,uBAAuB,CAAC;AAClE,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAE5C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAClE,OAAO,EACL,mBAAmB,EAGnB,kBAAkB,EAGnB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAIL,KAAK,uBAAuB,EAC5B,KAAK,uBAAuB,EAG7B,MAAM,sBAAsB,CAAC;AAG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MAAM,EAC1B,kBAAkB,EAAE,kBAAkB;WAGnC,IAAI,CAAC,iBAAiB,EAAE,gBAAgB,EAAE;IAiEvD;;;;;OAKG;IACH,eAAe,CAAC,YAAY,EAAE,qBAAqB,EAAE,MAAM,EAAE,eAAe,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAyBnG,kBAAkB;IAuClB,iBAAiB,CACrB,eAAe,GAAE,YAA8B,EAC/C,iBAAiB,CAAC,EAAE,MAAM,GACzB,OAAO,CAAC,oBAAoB,CAAC;IAoD1B,gBAAgB,CAAC,eAAe,CAAC,EAAE,YAAY;IAwB/C,iBAAiB,CAAC,eAAe,GAAE,YAA8B;IAgBvE,OAAO,CAAC,iBAAiB;YAiBX,gBAAgB;YAoChB,eAAe;IAS7B,OAAO,CAAC,kBAAkB;CAK3B"}
|
package/dest/txe_session.js
CHANGED
|
@@ -8,6 +8,7 @@ import { FunctionSelector } from '@aztec/stdlib/abi';
|
|
|
8
8
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
9
9
|
import { Body, L2Block } from '@aztec/stdlib/block';
|
|
10
10
|
import { GasSettings } from '@aztec/stdlib/gas';
|
|
11
|
+
import { computeProtocolNullifier } from '@aztec/stdlib/hash';
|
|
11
12
|
import { makeAppendOnlyTreeSnapshot, makeGlobalVariables } from '@aztec/stdlib/testing';
|
|
12
13
|
import { CallContext, TxContext } from '@aztec/stdlib/tx';
|
|
13
14
|
import { z } from 'zod';
|
|
@@ -151,7 +152,8 @@ const DEFAULT_ADDRESS = AztecAddress.fromNumber(42);
|
|
|
151
152
|
chainId: this.chainId
|
|
152
153
|
});
|
|
153
154
|
const txRequestHash = getSingleTxBlockRequestHash(nextBlockGlobalVariables.blockNumber);
|
|
154
|
-
const
|
|
155
|
+
const protocolNullifier = await computeProtocolNullifier(txRequestHash);
|
|
156
|
+
const noteCache = new ExecutionNoteCache(protocolNullifier);
|
|
155
157
|
const taggingIndexCache = new ExecutionTaggingIndexCache();
|
|
156
158
|
this.oracleHandler = new PrivateExecutionOracle(Fr.ZERO, new TxContext(this.chainId, this.version, GasSettings.empty()), new CallContext(AztecAddress.ZERO, contractAddress, FunctionSelector.empty(), false), anchorBlock, [], [], new HashedValuesCache(), noteCache, taggingIndexCache, this.pxeOracleInterface);
|
|
157
159
|
// We store the note and tagging index caches fed into the PrivateExecutionOracle (along with some other auxiliary
|
|
@@ -162,7 +164,7 @@ const DEFAULT_ADDRESS = AztecAddress.fromNumber(42);
|
|
|
162
164
|
this.state = {
|
|
163
165
|
name: 'PRIVATE',
|
|
164
166
|
nextBlockGlobalVariables,
|
|
165
|
-
|
|
167
|
+
protocolNullifier,
|
|
166
168
|
noteCache,
|
|
167
169
|
taggingIndexCache
|
|
168
170
|
};
|
|
@@ -224,7 +226,7 @@ const DEFAULT_ADDRESS = AztecAddress.fromNumber(42);
|
|
|
224
226
|
});
|
|
225
227
|
// We rely on the note cache to determine the effects of the transaction. This is incomplete as it doesn't private
|
|
226
228
|
// logs (other effects like enqueued public calls don't need to be considered since those are not allowed).
|
|
227
|
-
const txEffect = await makeTxEffect(this.state.noteCache, this.state.
|
|
229
|
+
const txEffect = await makeTxEffect(this.state.noteCache, this.state.protocolNullifier, this.state.nextBlockGlobalVariables.blockNumber);
|
|
228
230
|
// We build a block holding just this transaction
|
|
229
231
|
const forkedWorldTrees = await this.stateMachine.synchronizer.nativeWorldStateService.fork();
|
|
230
232
|
await insertTxEffectIntoWorldTrees(txEffect, forkedWorldTrees);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Fr } from '@aztec/foundation/fields';
|
|
2
2
|
import type { ExecutionNoteCache } from '@aztec/pxe/simulator';
|
|
3
3
|
import { TxEffect } from '@aztec/stdlib/tx';
|
|
4
|
-
export declare function makeTxEffect(noteCache: ExecutionNoteCache,
|
|
4
|
+
export declare function makeTxEffect(noteCache: ExecutionNoteCache, protocolNullifier: Fr, txBlockNumber: number): Promise<TxEffect>;
|
|
5
5
|
//# sourceMappingURL=tx_effect_creation.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tx_effect_creation.d.ts","sourceRoot":"","sources":["../../src/utils/tx_effect_creation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAC9C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE/D,OAAO,EAAE,QAAQ,EAAU,MAAM,kBAAkB,CAAC;AAEpD,wBAAsB,YAAY,CAChC,SAAS,EAAE,kBAAkB,EAC7B,
|
|
1
|
+
{"version":3,"file":"tx_effect_creation.d.ts","sourceRoot":"","sources":["../../src/utils/tx_effect_creation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAC9C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE/D,OAAO,EAAE,QAAQ,EAAU,MAAM,kBAAkB,CAAC;AAEpD,wBAAsB,YAAY,CAChC,SAAS,EAAE,kBAAkB,EAC7B,iBAAiB,EAAE,EAAE,EACrB,aAAa,EAAE,MAAM,GACpB,OAAO,CAAC,QAAQ,CAAC,CA2BnB"}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { Fr } from '@aztec/foundation/fields';
|
|
2
2
|
import { computeNoteHashNonce, computeUniqueNoteHash, siloNoteHash } from '@aztec/stdlib/hash';
|
|
3
3
|
import { TxEffect, TxHash } from '@aztec/stdlib/tx';
|
|
4
|
-
export async function makeTxEffect(noteCache,
|
|
4
|
+
export async function makeTxEffect(noteCache, protocolNullifier, txBlockNumber) {
|
|
5
5
|
const txEffect = TxEffect.empty();
|
|
6
|
-
const {
|
|
7
|
-
const nonceGenerator =
|
|
6
|
+
const { usedProtocolNullifierForNonces } = noteCache.finish();
|
|
7
|
+
const nonceGenerator = usedProtocolNullifierForNonces ? protocolNullifier : noteCache.getAllNullifiers()[0];
|
|
8
8
|
txEffect.noteHashes = await Promise.all(noteCache.getAllNotes().map(async (pendingNote, i)=>computeUniqueNoteHash(await computeNoteHashNonce(nonceGenerator, i), await siloNoteHash(pendingNote.note.contractAddress, pendingNote.noteHashForConsumption))));
|
|
9
9
|
// Nullifiers are already siloed
|
|
10
10
|
txEffect.nullifiers = noteCache.getAllNullifiers();
|
|
11
|
-
if (
|
|
12
|
-
txEffect.nullifiers.unshift(
|
|
11
|
+
if (usedProtocolNullifierForNonces) {
|
|
12
|
+
txEffect.nullifiers.unshift(protocolNullifier);
|
|
13
13
|
}
|
|
14
14
|
txEffect.txHash = new TxHash(new Fr(txBlockNumber));
|
|
15
15
|
return txEffect;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/txe",
|
|
3
|
-
"version": "3.0.0-nightly.
|
|
3
|
+
"version": "3.0.0-nightly.20251105",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": "./dest/index.js",
|
|
6
6
|
"bin": "./dest/bin/index.js",
|
|
@@ -61,20 +61,20 @@
|
|
|
61
61
|
]
|
|
62
62
|
},
|
|
63
63
|
"dependencies": {
|
|
64
|
-
"@aztec/accounts": "3.0.0-nightly.
|
|
65
|
-
"@aztec/archiver": "3.0.0-nightly.
|
|
66
|
-
"@aztec/aztec-node": "3.0.0-nightly.
|
|
67
|
-
"@aztec/aztec.js": "3.0.0-nightly.
|
|
68
|
-
"@aztec/bb-prover": "3.0.0-nightly.
|
|
69
|
-
"@aztec/constants": "3.0.0-nightly.
|
|
70
|
-
"@aztec/foundation": "3.0.0-nightly.
|
|
71
|
-
"@aztec/key-store": "3.0.0-nightly.
|
|
72
|
-
"@aztec/kv-store": "3.0.0-nightly.
|
|
73
|
-
"@aztec/protocol-contracts": "3.0.0-nightly.
|
|
74
|
-
"@aztec/pxe": "3.0.0-nightly.
|
|
75
|
-
"@aztec/simulator": "3.0.0-nightly.
|
|
76
|
-
"@aztec/stdlib": "3.0.0-nightly.
|
|
77
|
-
"@aztec/world-state": "3.0.0-nightly.
|
|
64
|
+
"@aztec/accounts": "3.0.0-nightly.20251105",
|
|
65
|
+
"@aztec/archiver": "3.0.0-nightly.20251105",
|
|
66
|
+
"@aztec/aztec-node": "3.0.0-nightly.20251105",
|
|
67
|
+
"@aztec/aztec.js": "3.0.0-nightly.20251105",
|
|
68
|
+
"@aztec/bb-prover": "3.0.0-nightly.20251105",
|
|
69
|
+
"@aztec/constants": "3.0.0-nightly.20251105",
|
|
70
|
+
"@aztec/foundation": "3.0.0-nightly.20251105",
|
|
71
|
+
"@aztec/key-store": "3.0.0-nightly.20251105",
|
|
72
|
+
"@aztec/kv-store": "3.0.0-nightly.20251105",
|
|
73
|
+
"@aztec/protocol-contracts": "3.0.0-nightly.20251105",
|
|
74
|
+
"@aztec/pxe": "3.0.0-nightly.20251105",
|
|
75
|
+
"@aztec/simulator": "3.0.0-nightly.20251105",
|
|
76
|
+
"@aztec/stdlib": "3.0.0-nightly.20251105",
|
|
77
|
+
"@aztec/world-state": "3.0.0-nightly.20251105",
|
|
78
78
|
"zod": "^3.23.8"
|
|
79
79
|
},
|
|
80
80
|
"devDependencies": {
|
|
@@ -49,7 +49,7 @@ import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
|
49
49
|
import { Body, L2Block } from '@aztec/stdlib/block';
|
|
50
50
|
import { type ContractInstanceWithAddress, computePartialAddress } from '@aztec/stdlib/contract';
|
|
51
51
|
import { Gas, GasFees, GasSettings } from '@aztec/stdlib/gas';
|
|
52
|
-
import { computeCalldataHash, siloNullifier } from '@aztec/stdlib/hash';
|
|
52
|
+
import { computeCalldataHash, computeProtocolNullifier, siloNullifier } from '@aztec/stdlib/hash';
|
|
53
53
|
import {
|
|
54
54
|
PartialPrivateTailPublicInputsForPublic,
|
|
55
55
|
PrivateKernelTailCircuitPublicInputs,
|
|
@@ -291,8 +291,8 @@ export class TXEOracleTopLevelContext implements IMiscOracle, ITxeExecutionOracl
|
|
|
291
291
|
|
|
292
292
|
const blockHeader = await this.pxeOracleInterface.getAnchorBlockHeader();
|
|
293
293
|
|
|
294
|
-
const
|
|
295
|
-
const noteCache = new ExecutionNoteCache(
|
|
294
|
+
const protocolNullifier = await computeProtocolNullifier(getSingleTxBlockRequestHash(blockNumber));
|
|
295
|
+
const noteCache = new ExecutionNoteCache(protocolNullifier);
|
|
296
296
|
const taggingIndexCache = new ExecutionTaggingIndexCache();
|
|
297
297
|
|
|
298
298
|
const simulator = new WASMSimulator();
|
|
@@ -359,7 +359,7 @@ export class TXEOracleTopLevelContext implements IMiscOracle, ITxeExecutionOracl
|
|
|
359
359
|
// According to the protocol rules, the nonce generator for the note hashes
|
|
360
360
|
// can either be the first nullifier in the tx or the hash of the initial tx request
|
|
361
361
|
// if there are none.
|
|
362
|
-
const nonceGenerator = result.firstNullifier.equals(Fr.ZERO) ?
|
|
362
|
+
const nonceGenerator = result.firstNullifier.equals(Fr.ZERO) ? protocolNullifier : result.firstNullifier;
|
|
363
363
|
const { publicInputs } = await generateSimulatedProvingResult(result, nonceGenerator, this.contractDataProvider);
|
|
364
364
|
|
|
365
365
|
const globals = makeGlobalVariables();
|
package/src/txe_session.ts
CHANGED
|
@@ -25,6 +25,7 @@ import type { AuthWitness } from '@aztec/stdlib/auth-witness';
|
|
|
25
25
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
26
26
|
import { Body, L2Block } from '@aztec/stdlib/block';
|
|
27
27
|
import { GasSettings } from '@aztec/stdlib/gas';
|
|
28
|
+
import { computeProtocolNullifier } from '@aztec/stdlib/hash';
|
|
28
29
|
import { PrivateContextInputs } from '@aztec/stdlib/kernel';
|
|
29
30
|
import { makeAppendOnlyTreeSnapshot, makeGlobalVariables } from '@aztec/stdlib/testing';
|
|
30
31
|
import { CallContext, GlobalVariables, TxContext } from '@aztec/stdlib/tx';
|
|
@@ -66,7 +67,7 @@ type SessionState =
|
|
|
66
67
|
| {
|
|
67
68
|
name: 'PRIVATE';
|
|
68
69
|
nextBlockGlobalVariables: GlobalVariables;
|
|
69
|
-
|
|
70
|
+
protocolNullifier: Fr;
|
|
70
71
|
noteCache: ExecutionNoteCache;
|
|
71
72
|
taggingIndexCache: ExecutionTaggingIndexCache;
|
|
72
73
|
}
|
|
@@ -295,7 +296,8 @@ export class TXESession implements TXESessionStateHandler {
|
|
|
295
296
|
});
|
|
296
297
|
|
|
297
298
|
const txRequestHash = getSingleTxBlockRequestHash(nextBlockGlobalVariables.blockNumber);
|
|
298
|
-
const
|
|
299
|
+
const protocolNullifier = await computeProtocolNullifier(txRequestHash);
|
|
300
|
+
const noteCache = new ExecutionNoteCache(protocolNullifier);
|
|
299
301
|
const taggingIndexCache = new ExecutionTaggingIndexCache();
|
|
300
302
|
|
|
301
303
|
this.oracleHandler = new PrivateExecutionOracle(
|
|
@@ -316,7 +318,7 @@ export class TXESession implements TXESessionStateHandler {
|
|
|
316
318
|
// difference resides in that the simulator has all information needed in order to run the simulation, while ours
|
|
317
319
|
// will be ongoing as the different oracles will be invoked from the Noir test, until eventually the private
|
|
318
320
|
// execution finishes.
|
|
319
|
-
this.state = { name: 'PRIVATE', nextBlockGlobalVariables,
|
|
321
|
+
this.state = { name: 'PRIVATE', nextBlockGlobalVariables, protocolNullifier, noteCache, taggingIndexCache };
|
|
320
322
|
this.logger.debug(`Entered state ${this.state.name}`);
|
|
321
323
|
|
|
322
324
|
return (this.oracleHandler as PrivateExecutionOracle).getPrivateContextInputs();
|
|
@@ -392,7 +394,7 @@ export class TXESession implements TXESessionStateHandler {
|
|
|
392
394
|
// logs (other effects like enqueued public calls don't need to be considered since those are not allowed).
|
|
393
395
|
const txEffect = await makeTxEffect(
|
|
394
396
|
this.state.noteCache,
|
|
395
|
-
this.state.
|
|
397
|
+
this.state.protocolNullifier,
|
|
396
398
|
this.state.nextBlockGlobalVariables.blockNumber,
|
|
397
399
|
);
|
|
398
400
|
|
|
@@ -5,13 +5,13 @@ import { TxEffect, TxHash } from '@aztec/stdlib/tx';
|
|
|
5
5
|
|
|
6
6
|
export async function makeTxEffect(
|
|
7
7
|
noteCache: ExecutionNoteCache,
|
|
8
|
-
|
|
8
|
+
protocolNullifier: Fr,
|
|
9
9
|
txBlockNumber: number,
|
|
10
10
|
): Promise<TxEffect> {
|
|
11
11
|
const txEffect = TxEffect.empty();
|
|
12
12
|
|
|
13
|
-
const {
|
|
14
|
-
const nonceGenerator =
|
|
13
|
+
const { usedProtocolNullifierForNonces } = noteCache.finish();
|
|
14
|
+
const nonceGenerator = usedProtocolNullifierForNonces ? protocolNullifier : noteCache.getAllNullifiers()[0];
|
|
15
15
|
|
|
16
16
|
txEffect.noteHashes = await Promise.all(
|
|
17
17
|
noteCache
|
|
@@ -27,8 +27,8 @@ export async function makeTxEffect(
|
|
|
27
27
|
// Nullifiers are already siloed
|
|
28
28
|
txEffect.nullifiers = noteCache.getAllNullifiers();
|
|
29
29
|
|
|
30
|
-
if (
|
|
31
|
-
txEffect.nullifiers.unshift(
|
|
30
|
+
if (usedProtocolNullifierForNonces) {
|
|
31
|
+
txEffect.nullifiers.unshift(protocolNullifier);
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
txEffect.txHash = new TxHash(new Fr(txBlockNumber));
|