@aztec/pxe 3.0.0-nightly.20251104 → 3.0.0-nightly.20251106
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/contract_function_simulator/contract_function_simulator.d.ts.map +1 -1
- package/dest/contract_function_simulator/contract_function_simulator.js +5 -5
- package/dest/contract_function_simulator/execution_note_cache.d.ts +4 -4
- package/dest/contract_function_simulator/execution_note_cache.d.ts.map +1 -1
- package/dest/contract_function_simulator/execution_note_cache.js +11 -10
- package/dest/pxe.d.ts.map +1 -1
- package/dest/pxe.js +3 -4
- package/package.json +16 -16
- package/src/contract_function_simulator/contract_function_simulator.ts +11 -5
- package/src/contract_function_simulator/execution_note_cache.ts +8 -8
- package/src/pxe.ts +3 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contract_function_simulator.d.ts","sourceRoot":"","sources":["../../src/contract_function_simulator/contract_function_simulator.ts"],"names":[],"mappings":"AAoBA,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAK9C,OAAO,EACL,KAAK,gBAAgB,EAOtB,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAClE,OAAO,EAAE,gBAAgB,EAA+B,MAAM,mBAAmB,CAAC;AAClF,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"contract_function_simulator.d.ts","sourceRoot":"","sources":["../../src/contract_function_simulator/contract_function_simulator.ts"],"names":[],"mappings":"AAoBA,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAK9C,OAAO,EACL,KAAK,gBAAgB,EAOtB,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AA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{ ExecutionError, createSimulationError, extractCallStack, resolveAsserti
|
|
|
10
10
|
import { FunctionSelector, FunctionType, decodeFromAbi } from '@aztec/stdlib/abi';
|
|
11
11
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
12
12
|
import { Gas } from '@aztec/stdlib/gas';
|
|
13
|
-
import { computeNoteHashNonce, computeUniqueNoteHash, siloNoteHash, siloNullifier } from '@aztec/stdlib/hash';
|
|
13
|
+
import { computeNoteHashNonce, computeProtocolNullifier, computeUniqueNoteHash, siloNoteHash, siloNullifier } from '@aztec/stdlib/hash';
|
|
14
14
|
import { PartialPrivateTailPublicInputsForPublic, PartialPrivateTailPublicInputsForRollup, PrivateKernelTailCircuitPublicInputs, PrivateToPublicAccumulatedData, PrivateToRollupAccumulatedData, PublicCallRequest, ScopedLogHash } from '@aztec/stdlib/kernel';
|
|
15
15
|
import { PrivateLog } from '@aztec/stdlib/logs';
|
|
16
16
|
import { ScopedL2ToL1Message } from '@aztec/stdlib/messaging';
|
|
@@ -59,8 +59,8 @@ import { UtilityExecutionOracle } from './oracle/utility_execution_oracle.js';
|
|
|
59
59
|
// reserve the first side effect for the tx hash (inserted by the private kernel)
|
|
60
60
|
const startSideEffectCounter = 1;
|
|
61
61
|
const callContext = new CallContext(msgSender, contractAddress, await FunctionSelector.fromNameAndParameters(entryPointArtifact.name, entryPointArtifact.parameters), entryPointArtifact.isStatic);
|
|
62
|
-
const
|
|
63
|
-
const noteCache = new ExecutionNoteCache(
|
|
62
|
+
const protocolNullifier = await computeProtocolNullifier(await request.toTxRequest().hash());
|
|
63
|
+
const noteCache = new ExecutionNoteCache(protocolNullifier);
|
|
64
64
|
const taggingIndexCache = new ExecutionTaggingIndexCache();
|
|
65
65
|
const privateExecutionOracle = new PrivateExecutionOracle(request.firstCallArgsHash, request.txContext, callContext, anchorBlockHeader, request.authWitnesses, request.capsules, HashedValuesCache.create(request.argsOfCalls), noteCache, taggingIndexCache, this.executionDataProvider, 0, startSideEffectCounter, undefined, scopes, senderForTags, this.simulator);
|
|
66
66
|
const setupTime = simulatorSetupTimer.ms();
|
|
@@ -71,8 +71,8 @@ import { UtilityExecutionOracle } from './oracle/utility_execution_oracle.js';
|
|
|
71
71
|
// within executionResult.nestedExecutionResults).
|
|
72
72
|
const executionResult = await executePrivateFunction(this.simulator, privateExecutionOracle, entryPointArtifact, contractAddress, request.functionSelector);
|
|
73
73
|
const simulatorTeardownTimer = new Timer();
|
|
74
|
-
const {
|
|
75
|
-
const firstNullifierHint =
|
|
74
|
+
const { usedProtocolNullifierForNonces } = noteCache.finish();
|
|
75
|
+
const firstNullifierHint = usedProtocolNullifierForNonces ? Fr.ZERO : noteCache.getAllNullifiers()[0];
|
|
76
76
|
const publicCallRequests = collectNested([
|
|
77
77
|
executionResult
|
|
78
78
|
], (r)=>r.publicInputs.publicCallRequests.getActiveItems().map((r)=>r.inner).concat(r.publicInputs.publicTeardownCallRequest.isEmpty() ? [] : [
|
|
@@ -11,7 +11,7 @@ interface PendingNote {
|
|
|
11
11
|
*/
|
|
12
12
|
export declare class ExecutionNoteCache {
|
|
13
13
|
#private;
|
|
14
|
-
private readonly
|
|
14
|
+
private readonly protocolNullifier;
|
|
15
15
|
/**
|
|
16
16
|
* New notes created in this transaction.
|
|
17
17
|
* They are pushed to this array in the same order as they are emitted.
|
|
@@ -37,15 +37,15 @@ export declare class ExecutionNoteCache {
|
|
|
37
37
|
* We don't need to use the tx request hash for nonces if another non revertible nullifier is emitted.
|
|
38
38
|
* In that case we disable injecting the tx request hash as a nullifier.
|
|
39
39
|
*/
|
|
40
|
-
private
|
|
41
|
-
constructor(
|
|
40
|
+
private usedProtocolNullifierForNonces;
|
|
41
|
+
constructor(protocolNullifier: Fr);
|
|
42
42
|
/**
|
|
43
43
|
* Enters the revertible phase of the transaction.
|
|
44
44
|
* @param minRevertibleSideEffectCounter - The counter at which the transaction enters the revertible phase.
|
|
45
45
|
*/
|
|
46
46
|
setMinRevertibleSideEffectCounter(minRevertibleSideEffectCounter: number): Promise<void>;
|
|
47
47
|
finish(): {
|
|
48
|
-
|
|
48
|
+
usedProtocolNullifierForNonces: boolean;
|
|
49
49
|
};
|
|
50
50
|
/**
|
|
51
51
|
* Add a new note to cache.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"execution_note_cache.d.ts","sourceRoot":"","sources":["../../src/contract_function_simulator/execution_note_cache.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAC9C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAGhE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAEvD,UAAU,WAAW;IACnB,IAAI,EAAE,QAAQ,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,sBAAsB,EAAE,EAAE,CAAC;CAC5B;AAED;;GAEG;AACH,qBAAa,kBAAkB;;IAiCjB,OAAO,CAAC,QAAQ,CAAC,
|
|
1
|
+
{"version":3,"file":"execution_note_cache.d.ts","sourceRoot":"","sources":["../../src/contract_function_simulator/execution_note_cache.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAC9C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAGhE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAEvD,UAAU,WAAW;IACnB,IAAI,EAAE,QAAQ,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,sBAAsB,EAAE,EAAE,CAAC;CAC5B;AAED;;GAEG;AACH,qBAAa,kBAAkB;;IAiCjB,OAAO,CAAC,QAAQ,CAAC,iBAAiB;IAhC9C;;;OAGG;IACH,OAAO,CAAC,KAAK,CAAqB;IAClC;;OAEG;IACH,OAAO,CAAC,OAAO,CAAyC;IAExD;;;;OAIG;IACH,OAAO,CAAC,YAAY,CAAuC;IAE3D;;OAEG;IACH,OAAO,CAAC,aAAa,CAA0B;IAE/C,OAAO,CAAC,8BAA8B,CAAK;IAE3C,OAAO,CAAC,iBAAiB,CAAS;IAElC;;;OAGG;IACH,OAAO,CAAC,8BAA8B,CAAQ;gBAEjB,iBAAiB,EAAE,EAAE;IAElD;;;OAGG;IACU,iCAAiC,CAAC,8BAA8B,EAAE,MAAM;IAuC9E,MAAM;;;IAYb;;;OAGG;IACI,UAAU,CAAC,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM;IAWjD;;;;;;OAMG;IACU,WAAW,CAAC,eAAe,EAAE,YAAY,EAAE,cAAc,EAAE,EAAE,EAAE,QAAQ,EAAE,EAAE;IA2BxF;;;;OAIG;IACU,gBAAgB,CAAC,eAAe,EAAE,YAAY,EAAE,cAAc,EAAE,EAAE;IAK/E;;;;;QAKI;IACG,QAAQ,CAAC,eAAe,EAAE,YAAY,EAAE,WAAW,EAAE,EAAE;IAK9D;;;;;QAKI;IACG,eAAe,CAAC,eAAe,EAAE,YAAY,EAAE,QAAQ,EAAE,EAAE;IAKlE;;;OAGG;IACI,aAAa,CAAC,eAAe,EAAE,YAAY,GAAG,GAAG,CAAC,MAAM,CAAC;IAYhE,WAAW,IAAI,WAAW,EAAE;IAI5B,gBAAgB,IAAI,EAAE,EAAE;IAIxB,eAAe,CAAC,eAAe,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM;CAWvE"}
|
|
@@ -3,7 +3,7 @@ import { computeNoteHashNonce, computeUniqueNoteHash, siloNoteHash, siloNullifie
|
|
|
3
3
|
/**
|
|
4
4
|
* Data that's accessible by all the function calls in an execution.
|
|
5
5
|
*/ export class ExecutionNoteCache {
|
|
6
|
-
|
|
6
|
+
protocolNullifier;
|
|
7
7
|
/**
|
|
8
8
|
* New notes created in this transaction.
|
|
9
9
|
* They are pushed to this array in the same order as they are emitted.
|
|
@@ -24,16 +24,16 @@ import { computeNoteHashNonce, computeUniqueNoteHash, siloNoteHash, siloNullifie
|
|
|
24
24
|
/**
|
|
25
25
|
* We don't need to use the tx request hash for nonces if another non revertible nullifier is emitted.
|
|
26
26
|
* In that case we disable injecting the tx request hash as a nullifier.
|
|
27
|
-
*/
|
|
28
|
-
constructor(
|
|
29
|
-
this.
|
|
27
|
+
*/ usedProtocolNullifierForNonces;
|
|
28
|
+
constructor(protocolNullifier){
|
|
29
|
+
this.protocolNullifier = protocolNullifier;
|
|
30
30
|
this.notes = [];
|
|
31
31
|
this.noteMap = new Map();
|
|
32
32
|
this.nullifierMap = new Map();
|
|
33
33
|
this.allNullifiers = new Set();
|
|
34
34
|
this.minRevertibleSideEffectCounter = 0;
|
|
35
35
|
this.inRevertiblePhase = false;
|
|
36
|
-
this.
|
|
36
|
+
this.usedProtocolNullifierForNonces = true;
|
|
37
37
|
}
|
|
38
38
|
/**
|
|
39
39
|
* Enters the revertible phase of the transaction.
|
|
@@ -44,11 +44,11 @@ import { computeNoteHashNonce, computeUniqueNoteHash, siloNoteHash, siloNullifie
|
|
|
44
44
|
}
|
|
45
45
|
this.inRevertiblePhase = true;
|
|
46
46
|
this.minRevertibleSideEffectCounter = minRevertibleSideEffectCounter;
|
|
47
|
-
let nonceGenerator = this.
|
|
47
|
+
let nonceGenerator = this.protocolNullifier;
|
|
48
48
|
const nullifiers = this.getAllNullifiers();
|
|
49
49
|
if (nullifiers.length > 0) {
|
|
50
50
|
nonceGenerator = new Fr(nullifiers[0]);
|
|
51
|
-
this.
|
|
51
|
+
this.usedProtocolNullifierForNonces = false;
|
|
52
52
|
}
|
|
53
53
|
// The existing pending notes are all non-revertible.
|
|
54
54
|
// They cannot be squashed by nullifiers emitted after minRevertibleSideEffectCounter is set.
|
|
@@ -72,13 +72,14 @@ import { computeNoteHashNonce, computeUniqueNoteHash, siloNoteHash, siloNullifie
|
|
|
72
72
|
updatedNotes.forEach((n)=>this.#addNote(n));
|
|
73
73
|
}
|
|
74
74
|
finish() {
|
|
75
|
-
// If we never entered the revertible phase, we need to use the
|
|
75
|
+
// If we never entered the revertible phase, we need to use the protocol nullifier to compute the nonces for the
|
|
76
|
+
// notes if no nullifiers have been emitted.
|
|
76
77
|
if (!this.inRevertiblePhase) {
|
|
77
|
-
this.
|
|
78
|
+
this.usedProtocolNullifierForNonces = this.getAllNullifiers().length === 0;
|
|
78
79
|
}
|
|
79
80
|
// If we entered the revertible phase, the nonce generator was decided based on wether or not a nullifier was emitted before entering.
|
|
80
81
|
return {
|
|
81
|
-
|
|
82
|
+
usedProtocolNullifierForNonces: this.usedProtocolNullifierForNonces
|
|
82
83
|
};
|
|
83
84
|
}
|
|
84
85
|
/**
|
package/dest/pxe.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pxe.d.ts","sourceRoot":"","sources":["../src/pxe.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAC9C,OAAO,EAAE,KAAK,MAAM,EAAgB,MAAM,uBAAuB,CAAC;AAIlE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAEzD,OAAO,EAAE,KAAK,yBAAyB,EAAyB,MAAM,2BAA2B,CAAC;AAClG,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EACL,KAAK,gBAAgB,EACrB,KAAK,uBAAuB,EAO7B,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,EACL,eAAe,EACf,KAAK,mBAAmB,EACxB,KAAK,2BAA2B,EAChC,KAAK,cAAc,EAGpB,MAAM,wBAAwB,CAAC;AAGhC,OAAO,KAAK,EAAE,SAAS,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAMtF,OAAO,EAAE,KAAK,WAAW,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAClE,OAAO,EAML,mB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C,eAAe,CAAC;IAoE3B;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACI,UAAU,CACf,SAAS,EAAE,kBAAkB,EAC7B,cAAc,EAAE,OAAO,EACvB,gBAAgB,GAAE,OAAe,EACjC,kBAAkB,GAAE,OAAe,EACnC,SAAS,CAAC,EAAE,mBAAmB,EAC/B,MAAM,CAAC,EAAE,YAAY,EAAE,GACtB,OAAO,CAAC,kBAAkB,CAAC;IAgI9B;;;;;;;;;;;OAWG;IACI,eAAe,CACpB,YAAY,EAAE,MAAM,EACpB,IAAI,EAAE,GAAG,EAAE,EACX,EAAE,EAAE,YAAY,EAChB,QAAQ,CAAC,EAAE,WAAW,EAAE,EACxB,KAAK,CAAC,EAAE,YAAY,EACpB,MAAM,CAAC,EAAE,YAAY,EAAE,GACtB,OAAO,CAAC,uBAAuB,CAAC;IA6CnC;;;;;;;;OAQG;IACU,gBAAgB,CAAC,CAAC,EAC7B,eAAe,EAAE,YAAY,EAC7B,gBAAgB,EAAE,uBAAuB,EACzC,IAAI,EAAE,MAAM,EACZ,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,YAAY,EAAE,GACzB,OAAO,CAAC,CAAC,EAAE,CAAC;IAyBf;;OAEG;IACI,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;CAG7B"}
|
package/dest/pxe.js
CHANGED
|
@@ -8,7 +8,7 @@ import { protocolContractNames } from '@aztec/protocol-contracts';
|
|
|
8
8
|
import { FunctionSelector, FunctionType, decodeFromAbi, decodeFunctionSignature, encodeArguments } from '@aztec/stdlib/abi';
|
|
9
9
|
import { computeContractAddressFromInstance, getContractClassFromArtifact } from '@aztec/stdlib/contract';
|
|
10
10
|
import { SimulationError } from '@aztec/stdlib/errors';
|
|
11
|
-
import { siloNullifier } from '@aztec/stdlib/hash';
|
|
11
|
+
import { computeProtocolNullifier, siloNullifier } from '@aztec/stdlib/hash';
|
|
12
12
|
import { UniqueNote } from '@aztec/stdlib/note';
|
|
13
13
|
import { PrivateSimulationResult, TxProfileResult, TxProvingResult, TxSimulationResult } from '@aztec/stdlib/tx';
|
|
14
14
|
import { inspect } from 'util';
|
|
@@ -640,9 +640,8 @@ import { Synchronizer } from './synchronizer/index.js';
|
|
|
640
640
|
let executionSteps = [];
|
|
641
641
|
if (skipKernels) {
|
|
642
642
|
// According to the protocol rules, the nonce generator for the note hashes
|
|
643
|
-
// can either be the first nullifier in the tx or the
|
|
644
|
-
|
|
645
|
-
const nonceGenerator = privateExecutionResult.firstNullifier.equals(Fr.ZERO) ? await txRequest.toTxRequest().hash() : privateExecutionResult.firstNullifier;
|
|
643
|
+
// can either be the first nullifier in the tx or the protocol nullifier if there are none.
|
|
644
|
+
const nonceGenerator = privateExecutionResult.firstNullifier.equals(Fr.ZERO) ? await computeProtocolNullifier(await txRequest.toTxRequest().hash()) : privateExecutionResult.firstNullifier;
|
|
646
645
|
({ publicInputs, executionSteps } = await generateSimulatedProvingResult(privateExecutionResult, nonceGenerator, this.contractDataProvider));
|
|
647
646
|
} else {
|
|
648
647
|
// Kernel logic, plus proving of all private functions and kernels.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/pxe",
|
|
3
|
-
"version": "3.0.0-nightly.
|
|
3
|
+
"version": "3.0.0-nightly.20251106",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
"./server": "./dest/entrypoints/server/index.js",
|
|
@@ -61,19 +61,19 @@
|
|
|
61
61
|
]
|
|
62
62
|
},
|
|
63
63
|
"dependencies": {
|
|
64
|
-
"@aztec/bb-prover": "3.0.0-nightly.
|
|
65
|
-
"@aztec/bb.js": "3.0.0-nightly.
|
|
66
|
-
"@aztec/builder": "3.0.0-nightly.
|
|
67
|
-
"@aztec/constants": "3.0.0-nightly.
|
|
68
|
-
"@aztec/ethereum": "3.0.0-nightly.
|
|
69
|
-
"@aztec/foundation": "3.0.0-nightly.
|
|
70
|
-
"@aztec/key-store": "3.0.0-nightly.
|
|
71
|
-
"@aztec/kv-store": "3.0.0-nightly.
|
|
72
|
-
"@aztec/noir-protocol-circuits-types": "3.0.0-nightly.
|
|
73
|
-
"@aztec/noir-types": "3.0.0-nightly.
|
|
74
|
-
"@aztec/protocol-contracts": "3.0.0-nightly.
|
|
75
|
-
"@aztec/simulator": "3.0.0-nightly.
|
|
76
|
-
"@aztec/stdlib": "3.0.0-nightly.
|
|
64
|
+
"@aztec/bb-prover": "3.0.0-nightly.20251106",
|
|
65
|
+
"@aztec/bb.js": "3.0.0-nightly.20251106",
|
|
66
|
+
"@aztec/builder": "3.0.0-nightly.20251106",
|
|
67
|
+
"@aztec/constants": "3.0.0-nightly.20251106",
|
|
68
|
+
"@aztec/ethereum": "3.0.0-nightly.20251106",
|
|
69
|
+
"@aztec/foundation": "3.0.0-nightly.20251106",
|
|
70
|
+
"@aztec/key-store": "3.0.0-nightly.20251106",
|
|
71
|
+
"@aztec/kv-store": "3.0.0-nightly.20251106",
|
|
72
|
+
"@aztec/noir-protocol-circuits-types": "3.0.0-nightly.20251106",
|
|
73
|
+
"@aztec/noir-types": "3.0.0-nightly.20251106",
|
|
74
|
+
"@aztec/protocol-contracts": "3.0.0-nightly.20251106",
|
|
75
|
+
"@aztec/simulator": "3.0.0-nightly.20251106",
|
|
76
|
+
"@aztec/stdlib": "3.0.0-nightly.20251106",
|
|
77
77
|
"koa": "^2.16.1",
|
|
78
78
|
"koa-router": "^13.1.1",
|
|
79
79
|
"lodash.omit": "^4.5.0",
|
|
@@ -82,8 +82,8 @@
|
|
|
82
82
|
"viem": "npm:@spalladino/viem@2.38.2-eip7594.0"
|
|
83
83
|
},
|
|
84
84
|
"devDependencies": {
|
|
85
|
-
"@aztec/merkle-tree": "3.0.0-nightly.
|
|
86
|
-
"@aztec/noir-test-contracts.js": "3.0.0-nightly.
|
|
85
|
+
"@aztec/merkle-tree": "3.0.0-nightly.20251106",
|
|
86
|
+
"@aztec/noir-test-contracts.js": "3.0.0-nightly.20251106",
|
|
87
87
|
"@jest/globals": "^30.0.0",
|
|
88
88
|
"@types/jest": "^30.0.0",
|
|
89
89
|
"@types/lodash.omit": "^4.5.7",
|
|
@@ -37,7 +37,13 @@ import { FunctionSelector, FunctionType, decodeFromAbi } from '@aztec/stdlib/abi
|
|
|
37
37
|
import type { AuthWitness } from '@aztec/stdlib/auth-witness';
|
|
38
38
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
39
39
|
import { Gas } from '@aztec/stdlib/gas';
|
|
40
|
-
import {
|
|
40
|
+
import {
|
|
41
|
+
computeNoteHashNonce,
|
|
42
|
+
computeProtocolNullifier,
|
|
43
|
+
computeUniqueNoteHash,
|
|
44
|
+
siloNoteHash,
|
|
45
|
+
siloNullifier,
|
|
46
|
+
} from '@aztec/stdlib/hash';
|
|
41
47
|
import {
|
|
42
48
|
PartialPrivateTailPublicInputsForPublic,
|
|
43
49
|
PartialPrivateTailPublicInputsForRollup,
|
|
@@ -132,8 +138,8 @@ export class ContractFunctionSimulator {
|
|
|
132
138
|
entryPointArtifact.isStatic,
|
|
133
139
|
);
|
|
134
140
|
|
|
135
|
-
const
|
|
136
|
-
const noteCache = new ExecutionNoteCache(
|
|
141
|
+
const protocolNullifier = await computeProtocolNullifier(await request.toTxRequest().hash());
|
|
142
|
+
const noteCache = new ExecutionNoteCache(protocolNullifier);
|
|
137
143
|
const taggingIndexCache = new ExecutionTaggingIndexCache();
|
|
138
144
|
|
|
139
145
|
const privateExecutionOracle = new PrivateExecutionOracle(
|
|
@@ -170,8 +176,8 @@ export class ContractFunctionSimulator {
|
|
|
170
176
|
request.functionSelector,
|
|
171
177
|
);
|
|
172
178
|
const simulatorTeardownTimer = new Timer();
|
|
173
|
-
const {
|
|
174
|
-
const firstNullifierHint =
|
|
179
|
+
const { usedProtocolNullifierForNonces } = noteCache.finish();
|
|
180
|
+
const firstNullifierHint = usedProtocolNullifierForNonces ? Fr.ZERO : noteCache.getAllNullifiers()[0];
|
|
175
181
|
|
|
176
182
|
const publicCallRequests = collectNested([executionResult], r =>
|
|
177
183
|
r.publicInputs.publicCallRequests
|
|
@@ -44,9 +44,9 @@ export class ExecutionNoteCache {
|
|
|
44
44
|
* We don't need to use the tx request hash for nonces if another non revertible nullifier is emitted.
|
|
45
45
|
* In that case we disable injecting the tx request hash as a nullifier.
|
|
46
46
|
*/
|
|
47
|
-
private
|
|
47
|
+
private usedProtocolNullifierForNonces = true;
|
|
48
48
|
|
|
49
|
-
constructor(private readonly
|
|
49
|
+
constructor(private readonly protocolNullifier: Fr) {}
|
|
50
50
|
|
|
51
51
|
/**
|
|
52
52
|
* Enters the revertible phase of the transaction.
|
|
@@ -60,12 +60,11 @@ export class ExecutionNoteCache {
|
|
|
60
60
|
}
|
|
61
61
|
this.inRevertiblePhase = true;
|
|
62
62
|
this.minRevertibleSideEffectCounter = minRevertibleSideEffectCounter;
|
|
63
|
-
|
|
64
|
-
let nonceGenerator = this.txRequestHash;
|
|
63
|
+
let nonceGenerator = this.protocolNullifier;
|
|
65
64
|
const nullifiers = this.getAllNullifiers();
|
|
66
65
|
if (nullifiers.length > 0) {
|
|
67
66
|
nonceGenerator = new Fr(nullifiers[0]);
|
|
68
|
-
this.
|
|
67
|
+
this.usedProtocolNullifierForNonces = false;
|
|
69
68
|
}
|
|
70
69
|
|
|
71
70
|
// The existing pending notes are all non-revertible.
|
|
@@ -93,13 +92,14 @@ export class ExecutionNoteCache {
|
|
|
93
92
|
}
|
|
94
93
|
|
|
95
94
|
public finish() {
|
|
96
|
-
// If we never entered the revertible phase, we need to use the
|
|
95
|
+
// If we never entered the revertible phase, we need to use the protocol nullifier to compute the nonces for the
|
|
96
|
+
// notes if no nullifiers have been emitted.
|
|
97
97
|
if (!this.inRevertiblePhase) {
|
|
98
|
-
this.
|
|
98
|
+
this.usedProtocolNullifierForNonces = this.getAllNullifiers().length === 0;
|
|
99
99
|
}
|
|
100
100
|
// If we entered the revertible phase, the nonce generator was decided based on wether or not a nullifier was emitted before entering.
|
|
101
101
|
return {
|
|
102
|
-
|
|
102
|
+
usedProtocolNullifierForNonces: this.usedProtocolNullifierForNonces,
|
|
103
103
|
};
|
|
104
104
|
}
|
|
105
105
|
|
package/src/pxe.ts
CHANGED
|
@@ -28,7 +28,7 @@ import {
|
|
|
28
28
|
getContractClassFromArtifact,
|
|
29
29
|
} from '@aztec/stdlib/contract';
|
|
30
30
|
import { SimulationError } from '@aztec/stdlib/errors';
|
|
31
|
-
import { siloNullifier } from '@aztec/stdlib/hash';
|
|
31
|
+
import { computeProtocolNullifier, siloNullifier } from '@aztec/stdlib/hash';
|
|
32
32
|
import type { AztecNode, PrivateKernelProver } from '@aztec/stdlib/interfaces/client';
|
|
33
33
|
import type {
|
|
34
34
|
PrivateExecutionStep,
|
|
@@ -908,10 +908,9 @@ export class PXE {
|
|
|
908
908
|
|
|
909
909
|
if (skipKernels) {
|
|
910
910
|
// According to the protocol rules, the nonce generator for the note hashes
|
|
911
|
-
// can either be the first nullifier in the tx or the
|
|
912
|
-
// if there are none.
|
|
911
|
+
// can either be the first nullifier in the tx or the protocol nullifier if there are none.
|
|
913
912
|
const nonceGenerator = privateExecutionResult.firstNullifier.equals(Fr.ZERO)
|
|
914
|
-
? await txRequest.toTxRequest().hash()
|
|
913
|
+
? await computeProtocolNullifier(await txRequest.toTxRequest().hash())
|
|
915
914
|
: privateExecutionResult.firstNullifier;
|
|
916
915
|
({ publicInputs, executionSteps } = await generateSimulatedProvingResult(
|
|
917
916
|
privateExecutionResult,
|