@aztec/pxe 0.0.1-commit.8f9871590 → 0.0.1-commit.934299a21
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/config/package_info.js +1 -1
- package/dest/contract_function_simulator/contract_function_simulator.d.ts +1 -1
- package/dest/contract_function_simulator/contract_function_simulator.d.ts.map +1 -1
- package/dest/contract_function_simulator/contract_function_simulator.js +8 -8
- package/dest/contract_function_simulator/noir-structs/event_validation_request.js +1 -1
- package/dest/contract_function_simulator/noir-structs/note_validation_request.d.ts +2 -2
- package/dest/contract_function_simulator/noir-structs/note_validation_request.d.ts.map +1 -1
- package/dest/contract_function_simulator/noir-structs/note_validation_request.js +1 -1
- package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts +1 -1
- package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/private_execution_oracle.js +2 -10
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts +1 -1
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts.map +1 -1
- package/dest/contract_function_simulator/oracle/utility_execution_oracle.js +4 -7
- package/dest/contract_logging.d.ts +22 -0
- package/dest/contract_logging.d.ts.map +1 -0
- package/dest/contract_logging.js +23 -0
- package/dest/debug/pxe_debug_utils.d.ts +2 -2
- package/dest/debug/pxe_debug_utils.d.ts.map +1 -1
- package/dest/debug/pxe_debug_utils.js +4 -4
- package/dest/entrypoints/client/bundle/index.d.ts +2 -1
- package/dest/entrypoints/client/bundle/index.d.ts.map +1 -1
- package/dest/entrypoints/client/bundle/index.js +1 -0
- package/dest/entrypoints/client/lazy/index.d.ts +2 -1
- package/dest/entrypoints/client/lazy/index.d.ts.map +1 -1
- package/dest/entrypoints/client/lazy/index.js +1 -0
- package/dest/private_kernel/hints/private_kernel_reset_private_inputs_builder.d.ts +4 -3
- package/dest/private_kernel/hints/private_kernel_reset_private_inputs_builder.d.ts.map +1 -1
- package/dest/private_kernel/hints/private_kernel_reset_private_inputs_builder.js +129 -68
- package/dest/private_kernel/hints/test_utils.d.ts +122 -0
- package/dest/private_kernel/hints/test_utils.d.ts.map +1 -0
- package/dest/private_kernel/hints/test_utils.js +203 -0
- package/dest/private_kernel/private_kernel_execution_prover.d.ts +1 -1
- package/dest/private_kernel/private_kernel_execution_prover.d.ts.map +1 -1
- package/dest/private_kernel/private_kernel_execution_prover.js +13 -5
- package/dest/private_kernel/private_kernel_oracle.d.ts +6 -2
- package/dest/private_kernel/private_kernel_oracle.d.ts.map +1 -1
- package/dest/private_kernel/private_kernel_oracle.js +7 -3
- package/dest/pxe.d.ts +6 -6
- package/dest/pxe.d.ts.map +1 -1
- package/dest/pxe.js +27 -23
- package/dest/storage/contract_store/contract_store.d.ts +42 -15
- package/dest/storage/contract_store/contract_store.d.ts.map +1 -1
- package/dest/storage/contract_store/contract_store.js +140 -64
- package/package.json +16 -16
- package/src/config/package_info.ts +1 -1
- package/src/contract_function_simulator/contract_function_simulator.ts +15 -17
- package/src/contract_function_simulator/noir-structs/event_validation_request.ts +1 -1
- package/src/contract_function_simulator/noir-structs/note_validation_request.ts +1 -1
- package/src/contract_function_simulator/oracle/private_execution_oracle.ts +2 -11
- package/src/contract_function_simulator/oracle/utility_execution_oracle.ts +8 -7
- package/src/contract_logging.ts +39 -0
- package/src/debug/pxe_debug_utils.ts +4 -4
- package/src/entrypoints/client/bundle/index.ts +1 -0
- package/src/entrypoints/client/lazy/index.ts +1 -0
- package/src/private_kernel/hints/private_kernel_reset_private_inputs_builder.ts +164 -117
- package/src/private_kernel/hints/test_utils.ts +325 -0
- package/src/private_kernel/private_kernel_execution_prover.ts +13 -6
- package/src/private_kernel/private_kernel_oracle.ts +7 -7
- package/src/pxe.ts +33 -30
- package/src/storage/contract_store/contract_store.ts +170 -71
|
@@ -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,
|
|
45
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHJpdmF0ZV9rZXJuZWxfZXhlY3V0aW9uX3Byb3Zlci5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL3ByaXZhdGVfa2VybmVsL3ByaXZhdGVfa2VybmVsX2V4ZWN1dGlvbl9wcm92ZXIudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBRUEsT0FBTyxFQUFlLEtBQUssY0FBYyxFQUFnQixNQUFNLHVCQUF1QixDQUFDO0FBTXZGLE9BQU8sS0FBSyxFQUFFLG1CQUFtQixFQUFFLE1BQU0saUNBQWlDLENBQUM7QUFDM0UsT0FBTyxFQVFMLEtBQUssaUNBQWlDLEVBS3RDLEtBQUssb0NBQW9DLEVBRTFDLE1BQU0sc0JBQXNCLENBQUM7QUFFOUIsT0FBTyxFQUVMLEtBQUssc0JBQXNCLEVBQzNCLFNBQVMsRUFHVixNQUFNLGtCQUFrQixDQUFDO0FBSTFCLE9BQU8sS0FBSyxFQUFFLG1CQUFtQixFQUFFLE1BQU0sNEJBQTRCLENBQUM7QUFTdEUsTUFBTSxXQUFXLGtDQUFrQztJQUNqRCxRQUFRLEVBQUUsT0FBTyxDQUFDO0lBQ2xCLGtCQUFrQixFQUFFLE9BQU8sQ0FBQztJQUM1QixXQUFXLEVBQUUsT0FBTyxHQUFHLGlCQUFpQixHQUFHLE1BQU0sR0FBRyxNQUFNLENBQUM7Q0FDNUQ7QUFFRDs7Ozs7R0FLRztBQUNILHFCQUFhLDRCQUE0QjtJQUlyQyxPQUFPLENBQUMsTUFBTTtJQUNkLE9BQU8sQ0FBQyxZQUFZO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AAG,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,
|
|
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
|
-
//
|
|
136
|
-
|
|
137
|
-
|
|
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
|
|
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) {
|
|
@@ -26,7 +26,11 @@ export declare class PrivateKernelOracle {
|
|
|
26
26
|
saltedInitializationHash: Fr;
|
|
27
27
|
}>;
|
|
28
28
|
/** Retrieves the preimage of a contract class id from the contract classes db. */
|
|
29
|
-
getContractClassIdPreimage(contractClassId: Fr): Promise<
|
|
29
|
+
getContractClassIdPreimage(contractClassId: Fr): Promise<{
|
|
30
|
+
artifactHash: Fr;
|
|
31
|
+
privateFunctionsRoot: Fr;
|
|
32
|
+
publicBytecodeCommitment: Fr;
|
|
33
|
+
}>;
|
|
30
34
|
/** Returns a membership witness with the sibling path and leaf index in our private functions tree. */
|
|
31
35
|
getFunctionMembershipWitness(contractClassId: Fr, selector: FunctionSelector): Promise<MembershipWitness<typeof FUNCTION_TREE_HEIGHT>>;
|
|
32
36
|
/**
|
|
@@ -56,4 +60,4 @@ export declare class PrivateKernelOracle {
|
|
|
56
60
|
*/
|
|
57
61
|
getUpdatedClassIdHints(contractAddress: AztecAddress): Promise<UpdatedClassIdHints>;
|
|
58
62
|
}
|
|
59
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
63
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHJpdmF0ZV9rZXJuZWxfb3JhY2xlLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvcHJpdmF0ZV9rZXJuZWwvcHJpdmF0ZV9rZXJuZWxfb3JhY2xlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxvQkFBb0IsRUFBRSxxQkFBcUIsRUFBMkIsY0FBYyxFQUFFLE1BQU0sa0JBQWtCLENBQUM7QUFDeEgsT0FBTyxLQUFLLEVBQUUsRUFBRSxFQUFFLE1BQU0sZ0NBQWdDLENBQUM7QUFDekQsT0FBTyxLQUFLLEVBQUUsY0FBYyxFQUFFLEtBQUssRUFBRSxNQUFNLG1DQUFtQyxDQUFDO0FBQy9FLE9BQU8sRUFBRSxpQkFBaUIsRUFBRSxNQUFNLHlCQUF5QixDQUFDO0FBQzVELE9BQU8sS0FBSyxFQUFFLFFBQVEsRUFBRSxNQUFNLGtCQUFrQixDQUFDO0FBR2pELE9BQU8sS0FBSyxFQUFFLGdCQUFnQixFQUFFLE1BQU0sbUJBQW1CLENBQUM7QUFDMUQsT0FBTyxLQUFLLEVBQUUsWUFBWSxFQUFFLE1BQU0sNkJBQTZCLENBQUM7QUFDaEUsT0FBTyxFQUFFLFNBQVMsRUFBRSxNQUFNLHFCQUFxQixDQUFDO0FBQ2hELE9BQU8sRUFBRSxLQUFLLDJCQUEyQixFQUFtQyxNQUFNLHdCQUF3QixDQUFDO0FBRzNHLE9BQU8sS0FBSyxFQUFFLFNBQVMsRUFBRSxNQUFNLGlDQUFpQyxDQUFDO0FBQ2pFLE9B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AAC,mBAAmB,CAAC,CA8B/F;CACF"}
|
|
@@ -2,7 +2,7 @@ import { PUBLIC_DATA_TREE_HEIGHT, VK_TREE_HEIGHT } from '@aztec/constants';
|
|
|
2
2
|
import { MembershipWitness } from '@aztec/foundation/trees';
|
|
3
3
|
import { getVKIndex, getVKSiblingPath } from '@aztec/noir-protocol-circuits-types/vk-tree';
|
|
4
4
|
import { ProtocolContractAddress } from '@aztec/protocol-contracts';
|
|
5
|
-
import {
|
|
5
|
+
import { computeSaltedInitializationHash } from '@aztec/stdlib/contract';
|
|
6
6
|
import { DelayedPublicMutableValues, DelayedPublicMutableValuesWithHash } from '@aztec/stdlib/delayed-public-mutable';
|
|
7
7
|
import { computePublicDataTreeLeafSlot } from '@aztec/stdlib/hash';
|
|
8
8
|
import { UpdatedClassIdHints } from '@aztec/stdlib/kernel';
|
|
@@ -30,11 +30,15 @@ import { UpdatedClassIdHints } from '@aztec/stdlib/kernel';
|
|
|
30
30
|
};
|
|
31
31
|
}
|
|
32
32
|
/** Retrieves the preimage of a contract class id from the contract classes db. */ async getContractClassIdPreimage(contractClassId) {
|
|
33
|
-
const contractClass = await this.contractStore.
|
|
33
|
+
const contractClass = await this.contractStore.getContractClassWithPreimage(contractClassId);
|
|
34
34
|
if (!contractClass) {
|
|
35
35
|
throw new Error(`Contract class not found when getting class id preimage. Class id: ${contractClassId}.`);
|
|
36
36
|
}
|
|
37
|
-
return
|
|
37
|
+
return {
|
|
38
|
+
artifactHash: contractClass.artifactHash,
|
|
39
|
+
privateFunctionsRoot: contractClass.privateFunctionsRoot,
|
|
40
|
+
publicBytecodeCommitment: contractClass.publicBytecodeCommitment
|
|
41
|
+
};
|
|
38
42
|
}
|
|
39
43
|
/** Returns a membership witness with the sibling path and leaf index in our private functions tree. */ async getFunctionMembershipWitness(contractClassId, selector) {
|
|
40
44
|
const membershipWitness = await this.contractStore.getFunctionMembershipWitness(contractClassId, selector);
|
package/dest/pxe.d.ts
CHANGED
|
@@ -9,7 +9,7 @@ import type { AuthWitness } from '@aztec/stdlib/auth-witness';
|
|
|
9
9
|
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
10
10
|
import { CompleteAddress, type ContractInstanceWithAddress, type PartialAddress } from '@aztec/stdlib/contract';
|
|
11
11
|
import type { AztecNode, PrivateKernelProver } from '@aztec/stdlib/interfaces/client';
|
|
12
|
-
import { BlockHeader, type InTx, SimulationOverrides, TxExecutionRequest, TxProfileResult, TxProvingResult, TxSimulationResult,
|
|
12
|
+
import { BlockHeader, type InTx, SimulationOverrides, TxExecutionRequest, TxProfileResult, TxProvingResult, TxSimulationResult, UtilityExecutionResult } from '@aztec/stdlib/tx';
|
|
13
13
|
import type { AccessScopes } from './access_scopes.js';
|
|
14
14
|
import type { PXEConfig } from './config/index.js';
|
|
15
15
|
import { PXEDebugUtils } from './debug/pxe_debug_utils.js';
|
|
@@ -39,8 +39,8 @@ export type SimulateTxOpts = {
|
|
|
39
39
|
/** Addresses whose private state and keys are accessible during private execution */
|
|
40
40
|
scopes: AccessScopes;
|
|
41
41
|
};
|
|
42
|
-
/** Options for PXE.
|
|
43
|
-
export type
|
|
42
|
+
/** Options for PXE.executeUtility. */
|
|
43
|
+
export type ExecuteUtilityOpts = {
|
|
44
44
|
/** The authentication witnesses required for the function call. */
|
|
45
45
|
authwits?: AuthWitness[];
|
|
46
46
|
/** The accounts whose notes we can access in this call */
|
|
@@ -224,10 +224,10 @@ export declare class PXE {
|
|
|
224
224
|
*/
|
|
225
225
|
simulateTx(txRequest: TxExecutionRequest, { simulatePublic, skipTxValidation, skipFeeEnforcement, overrides, scopes }: SimulateTxOpts): Promise<TxSimulationResult>;
|
|
226
226
|
/**
|
|
227
|
-
*
|
|
227
|
+
* Executes a contract utility function.
|
|
228
228
|
* @param call - The function call containing the function details, arguments, and target contract address.
|
|
229
229
|
*/
|
|
230
|
-
|
|
230
|
+
executeUtility(call: FunctionCall, { authwits, scopes }?: ExecuteUtilityOpts): Promise<UtilityExecutionResult>;
|
|
231
231
|
/**
|
|
232
232
|
* Returns the private events given search parameters.
|
|
233
233
|
* @param eventSelector - Event selector to search for.
|
|
@@ -247,4 +247,4 @@ export declare class PXE {
|
|
|
247
247
|
*/
|
|
248
248
|
stop(): Promise<void>;
|
|
249
249
|
}
|
|
250
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
250
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHhlLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvcHhlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sS0FBSyxFQUFFLGtCQUFrQixFQUFFLE1BQU0sd0JBQXdCLENBQUM7QUFFakUsT0FBTyxFQUFFLEVBQUUsRUFBRSxNQUFNLGdDQUFnQyxDQUFDO0FBQ3BELE9BQU8sRUFBRSxLQUFLLE1BQU0sRUFBcUMsTUFBTSx1QkFBdUIsQ0FBQztBQUl2RixPQUFPLEtBQUssRUFBRSxpQkFBaUIsRUFBRSxNQUFNLGlCQUFpQixDQUFDO0FBRXpELE9BQU8sRUFBRSxLQUFLLHlCQUF5QixFQUF5QixNQUFNLDJCQUEyQixDQUFDO0FBQ2xHLE9BQU8sS0FBSyxFQUFFLGdCQUFnQixFQUFFLE1BQU0seUJBQXlCLENBQUM7QUFDaEUsT0FBTyxFQUNMLEtBQUssZ0JBQWdCLEVBQ3JCLGFBQWEsRUFDYixZQUFZLEVBR2IsTUFBTSxtQkFBbUIsQ0FBQztBQUMzQixPQUFPLEtBQUssRUFBRSxXQUFXLEVBQUUsTUFBTSw0QkFBNEIsQ0FBQztBQUM5RCxPQUFPLEtBQUssRUFBRSxZQUFZLEVBQUUsTUFBTSw2QkFBNkIsQ0FBQztBQUNoRSxPQUFPLEVBQ0wsZUFBZSxFQUNmLEtBQUssMkJBQTJCLEVBQ2hDLEtBQUssY0FBYyxFQUdwQixNQUFNLHdCQUF3QixDQUFDO0F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CAuE9F;IAED;;;;;OAKG;IACI,SAAS,CACd,SAAS,EAAE,kBAAkB,EAC7B,EAAE,WAAW,EAAE,mBAA0B,EAAE,MAAM,EAAE,EAAE,aAAa,GACjE,OAAO,CAAC,eAAe,CAAC,CAkE1B;IAED;;;;;;;;;;;;;;;;;OAiBG;IACI,UAAU,CACf,SAAS,EAAE,kBAAkB,EAC7B,EAAE,cAAc,EAAE,gBAAwB,EAAE,kBAA0B,EAAE,SAAS,EAAE,MAAM,EAAE,EAAE,cAAc,GAC1G,OAAO,CAAC,kBAAkB,CAAC,CAmI7B;IAED;;;OAGG;IACI,cAAc,CACnB,IAAI,EAAE,YAAY,EAClB,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAE,kBAA6C,GAClE,OAAO,CAAC,sBAAsB,CAAC,CAwDjC;IAED;;;;;;;;;;;;OAYG;IACU,gBAAgB,CAC3B,aAAa,EAAE,aAAa,EAC5B,MAAM,EAAE,kBAAkB,GACzB,OAAO,CAAC,kBAAkB,EAAE,CAAC,CA8B/B;IAED;;OAEG;IACI,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAE3B;CACF"}
|
package/dest/pxe.js
CHANGED
|
@@ -13,6 +13,7 @@ import { BlockSynchronizer } from './block_synchronizer/index.js';
|
|
|
13
13
|
import { BenchmarkedNodeFactory } from './contract_function_simulator/benchmarked_node.js';
|
|
14
14
|
import { ContractFunctionSimulator, generateSimulatedProvingResult } from './contract_function_simulator/contract_function_simulator.js';
|
|
15
15
|
import { ProxiedContractStoreFactory } from './contract_function_simulator/proxied_contract_data_source.js';
|
|
16
|
+
import { displayDebugLogs } from './contract_logging.js';
|
|
16
17
|
import { ContractSyncService } from './contract_sync/contract_sync_service.js';
|
|
17
18
|
import { readCurrentClassId } from './contract_sync/helpers.js';
|
|
18
19
|
import { PXEDebugUtils } from './debug/pxe_debug_utils.js';
|
|
@@ -115,7 +116,7 @@ import { SenderTaggingStore } from './storage/tagging_store/sender_tagging_store
|
|
|
115
116
|
const debugUtils = new PXEDebugUtils(contractSyncService, noteStore, synchronizer, anchorBlockStore);
|
|
116
117
|
const jobQueue = new SerialQueue();
|
|
117
118
|
const pxe = new PXE(node, synchronizer, keyStore, contractStore, noteStore, capsuleStore, anchorBlockStore, senderTaggingStore, senderAddressBookStore, recipientTaggingStore, addressStore, privateEventStore, contractSyncService, simulator, proverEnabled, proofCreator, protocolContractsProvider, log, jobQueue, jobCoordinator, debugUtils);
|
|
118
|
-
debugUtils.setPXEHelpers(pxe.#putInJobQueue.bind(pxe), pxe.#getSimulatorForTx.bind(pxe), pxe.#
|
|
119
|
+
debugUtils.setPXEHelpers(pxe.#putInJobQueue.bind(pxe), pxe.#getSimulatorForTx.bind(pxe), pxe.#executeUtility.bind(pxe));
|
|
119
120
|
pxe.jobQueue.start();
|
|
120
121
|
await pxe.#registerProtocolContracts();
|
|
121
122
|
log.info(`Started PXE connected to chain ${info.l1ChainId} version ${info.rollupVersion}`);
|
|
@@ -180,8 +181,8 @@ import { SenderTaggingStore } from './storage/tagging_store/sender_tagging_store
|
|
|
180
181
|
async #registerProtocolContracts() {
|
|
181
182
|
const registered = {};
|
|
182
183
|
for (const name of protocolContractNames){
|
|
183
|
-
const { address,
|
|
184
|
-
await this.contractStore.addContractArtifact(
|
|
184
|
+
const { address, instance, artifact } = await this.protocolContractsProvider.getProtocolContractArtifact(name);
|
|
185
|
+
await this.contractStore.addContractArtifact(artifact);
|
|
185
186
|
await this.contractStore.addContractInstance(instance);
|
|
186
187
|
registered[name] = address.toString();
|
|
187
188
|
}
|
|
@@ -193,7 +194,7 @@ import { SenderTaggingStore } from './storage/tagging_store/sender_tagging_store
|
|
|
193
194
|
const { origin: contractAddress, functionSelector } = txRequest;
|
|
194
195
|
try {
|
|
195
196
|
const anchorBlockHeader = await this.anchorBlockStore.getBlockHeader();
|
|
196
|
-
await this.contractSyncService.ensureContractSynced(contractAddress, functionSelector, (privateSyncCall, execScopes)=>this.#
|
|
197
|
+
await this.contractSyncService.ensureContractSynced(contractAddress, functionSelector, (privateSyncCall, execScopes)=>this.#executeUtility(contractFunctionSimulator, privateSyncCall, [], execScopes, jobId), anchorBlockHeader, jobId, scopes);
|
|
197
198
|
const result = await contractFunctionSimulator.run(txRequest, {
|
|
198
199
|
contractAddress,
|
|
199
200
|
selector: functionSelector,
|
|
@@ -211,15 +212,15 @@ import { SenderTaggingStore } from './storage/tagging_store/sender_tagging_store
|
|
|
211
212
|
}
|
|
212
213
|
}
|
|
213
214
|
/**
|
|
214
|
-
*
|
|
215
|
+
* Execute a utility function call on the given contract.
|
|
215
216
|
* @param contractFunctionSimulator - The simulator to use for the function call.
|
|
216
217
|
* @param call - The function call to execute.
|
|
217
218
|
* @param authWitnesses - Authentication witnesses required for the function call.
|
|
218
219
|
* @param scopes - Optional array of account addresses whose notes can be accessed in this call. Defaults to all
|
|
219
220
|
* accounts if not specified.
|
|
220
221
|
* @param jobId - The job ID for staged writes.
|
|
221
|
-
* @returns The
|
|
222
|
-
*/ async #
|
|
222
|
+
* @returns The execution result containing the outputs of the utility function.
|
|
223
|
+
*/ async #executeUtility(contractFunctionSimulator, call, authWitnesses, scopes, jobId) {
|
|
223
224
|
try {
|
|
224
225
|
const anchorBlockHeader = await this.anchorBlockStore.getBlockHeader();
|
|
225
226
|
return contractFunctionSimulator.runUtility(call, authWitnesses ?? [], anchorBlockHeader, scopes, jobId);
|
|
@@ -371,8 +372,7 @@ import { SenderTaggingStore } from './storage/tagging_store/sender_tagging_store
|
|
|
371
372
|
*
|
|
372
373
|
* @param artifact - The build artifact for the contract class.
|
|
373
374
|
*/ async registerContractClass(artifact) {
|
|
374
|
-
const
|
|
375
|
-
await this.contractStore.addContractArtifact(contractClassId, artifact);
|
|
375
|
+
const contractClassId = await this.contractStore.addContractArtifact(artifact);
|
|
376
376
|
this.log.info(`Added contract class ${artifact.name} with id ${contractClassId}`);
|
|
377
377
|
}
|
|
378
378
|
/**
|
|
@@ -388,15 +388,14 @@ import { SenderTaggingStore } from './storage/tagging_store/sender_tagging_store
|
|
|
388
388
|
if (artifact) {
|
|
389
389
|
// If the user provides an artifact, validate it against the expected class id and register it
|
|
390
390
|
const contractClass = await getContractClassFromArtifact(artifact);
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
throw new Error(`Artifact does not match expected class id (computed ${contractClassId} but instance refers to ${instance.currentContractClassId})`);
|
|
391
|
+
if (!contractClass.id.equals(instance.currentContractClassId)) {
|
|
392
|
+
throw new Error(`Artifact does not match expected class id (computed ${contractClass.id} but instance refers to ${instance.currentContractClassId})`);
|
|
394
393
|
}
|
|
395
394
|
const computedAddress = await computeContractAddressFromInstance(instance);
|
|
396
395
|
if (!computedAddress.equals(instance.address)) {
|
|
397
396
|
throw new Error('Added a contract in which the address does not match the contract instance.');
|
|
398
397
|
}
|
|
399
|
-
await this.contractStore.addContractArtifact(
|
|
398
|
+
await this.contractStore.addContractArtifact(artifact, contractClass);
|
|
400
399
|
const publicFunctionSignatures = artifact.functions.filter((fn)=>fn.functionType === FunctionType.PUBLIC).map((fn)=>decodeFunctionSignature(fn.name, fn.parameters));
|
|
401
400
|
await this.node.registerContractFunctionSignatures(publicFunctionSignatures);
|
|
402
401
|
} else {
|
|
@@ -432,11 +431,13 @@ import { SenderTaggingStore } from './storage/tagging_store/sender_tagging_store
|
|
|
432
431
|
if (!contractClass.id.equals(currentClassId)) {
|
|
433
432
|
throw new Error('Could not update contract to a class different from the current one.');
|
|
434
433
|
}
|
|
435
|
-
await this.contractStore.addContractArtifact(contractClass.id, artifact);
|
|
436
434
|
const publicFunctionSignatures = artifact.functions.filter((fn)=>fn.functionType === FunctionType.PUBLIC).map((fn)=>decodeFunctionSignature(fn.name, fn.parameters));
|
|
437
435
|
await this.node.registerContractFunctionSignatures(publicFunctionSignatures);
|
|
438
436
|
currentInstance.currentContractClassId = contractClass.id;
|
|
439
|
-
await
|
|
437
|
+
await Promise.all([
|
|
438
|
+
this.contractStore.addContractArtifact(artifact, contractClass),
|
|
439
|
+
this.contractStore.addContractInstance(currentInstance)
|
|
440
|
+
]);
|
|
440
441
|
this.log.info(`Updated contract ${artifact.name} at ${contractAddress.toString()} to class ${contractClass.id}`);
|
|
441
442
|
});
|
|
442
443
|
}
|
|
@@ -640,6 +641,9 @@ import { SenderTaggingStore } from './storage/tagging_store/sender_tagging_store
|
|
|
640
641
|
const publicSimulationTimer = new Timer();
|
|
641
642
|
publicOutput = await this.#simulatePublicCalls(simulatedTx, skipFeeEnforcement);
|
|
642
643
|
publicSimulationTime = publicSimulationTimer.ms();
|
|
644
|
+
if (publicOutput?.debugLogs?.length) {
|
|
645
|
+
await displayDebugLogs(publicOutput.debugLogs, (addr)=>this.contractStore.getDebugContractName(addr));
|
|
646
|
+
}
|
|
643
647
|
}
|
|
644
648
|
let validationTime;
|
|
645
649
|
if (!skipTxValidation) {
|
|
@@ -688,14 +692,14 @@ import { SenderTaggingStore } from './storage/tagging_store/sender_tagging_store
|
|
|
688
692
|
});
|
|
689
693
|
}
|
|
690
694
|
/**
|
|
691
|
-
*
|
|
695
|
+
* Executes a contract utility function.
|
|
692
696
|
* @param call - The function call containing the function details, arguments, and target contract address.
|
|
693
|
-
*/
|
|
697
|
+
*/ executeUtility(call, { authwits, scopes } = {
|
|
694
698
|
scopes: 'ALL_SCOPES'
|
|
695
699
|
}) {
|
|
696
|
-
// We disable concurrent
|
|
700
|
+
// We disable concurrent executions since those might execute oracles which read and write to the PXE stores (e.g.
|
|
697
701
|
// to the capsules), and we need to prevent concurrent runs from interfering with one another (e.g. attempting to
|
|
698
|
-
// delete the same read value, or reading values that another
|
|
702
|
+
// delete the same read value, or reading values that another execution is currently modifying).
|
|
699
703
|
return this.#putInJobQueue(async (jobId)=>{
|
|
700
704
|
try {
|
|
701
705
|
const totalTimer = new Timer();
|
|
@@ -705,8 +709,8 @@ import { SenderTaggingStore } from './storage/tagging_store/sender_tagging_store
|
|
|
705
709
|
const functionTimer = new Timer();
|
|
706
710
|
const contractFunctionSimulator = this.#getSimulatorForTx();
|
|
707
711
|
const anchorBlockHeader = await this.anchorBlockStore.getBlockHeader();
|
|
708
|
-
await this.contractSyncService.ensureContractSynced(call.to, call.selector, (privateSyncCall, execScopes)=>this.#
|
|
709
|
-
const executionResult = await this.#
|
|
712
|
+
await this.contractSyncService.ensureContractSynced(call.to, call.selector, (privateSyncCall, execScopes)=>this.#executeUtility(contractFunctionSimulator, privateSyncCall, [], execScopes, jobId), anchorBlockHeader, jobId, scopes);
|
|
713
|
+
const executionResult = await this.#executeUtility(contractFunctionSimulator, call, authwits ?? [], scopes, jobId);
|
|
710
714
|
const functionTime = functionTimer.ms();
|
|
711
715
|
const totalTime = totalTimer.ms();
|
|
712
716
|
const perFunction = [
|
|
@@ -732,7 +736,7 @@ import { SenderTaggingStore } from './storage/tagging_store/sender_tagging_store
|
|
|
732
736
|
} catch (err) {
|
|
733
737
|
const { to, name, args } = call;
|
|
734
738
|
const stringifiedArgs = args.map((arg)=>arg.toString()).join(', ');
|
|
735
|
-
throw this.#contextualizeError(err, `
|
|
739
|
+
throw this.#contextualizeError(err, `executeUtility ${to}:${name}(${stringifiedArgs})`, `scopes=${scopes === 'ALL_SCOPES' ? scopes : scopes.map((s)=>s.toString()).join(', ')}`);
|
|
736
740
|
}
|
|
737
741
|
});
|
|
738
742
|
}
|
|
@@ -755,7 +759,7 @@ import { SenderTaggingStore } from './storage/tagging_store/sender_tagging_store
|
|
|
755
759
|
const anchorBlockHeader = await this.anchorBlockStore.getBlockHeader();
|
|
756
760
|
anchorBlockNumber = anchorBlockHeader.getBlockNumber();
|
|
757
761
|
const contractFunctionSimulator = this.#getSimulatorForTx();
|
|
758
|
-
await this.contractSyncService.ensureContractSynced(filter.contractAddress, null, async (privateSyncCall, execScopes)=>await this.#
|
|
762
|
+
await this.contractSyncService.ensureContractSynced(filter.contractAddress, null, async (privateSyncCall, execScopes)=>await this.#executeUtility(contractFunctionSimulator, privateSyncCall, [], execScopes, jobId), anchorBlockHeader, jobId, filter.scopes);
|
|
759
763
|
});
|
|
760
764
|
// anchorBlockNumber is set during the job and fixed to whatever it is after a block sync
|
|
761
765
|
const sanitizedFilter = new PrivateEventFilterValidator(anchorBlockNumber).validate(filter);
|