@aztec/txe 0.0.1-commit.a5db02d → 0.0.1-commit.aa0c64f
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/AuthRegistry-QVGDDH5X.js +3 -0
- package/dest/{AuthRegistry-56AMRLSQ.js.map → AuthRegistry-QVGDDH5X.js.map} +2 -2
- package/dest/ContractClassRegistry-VWR3F42P.js +3 -0
- package/dest/ContractClassRegistry-VWR3F42P.js.map +7 -0
- package/dest/{ContractInstanceRegistry-NADDSLGL.js → ContractInstanceRegistry-FHIWE33X.js} +1 -1
- package/dest/{ContractInstanceRegistry-NADDSLGL.js.map → ContractInstanceRegistry-FHIWE33X.js.map} +2 -2
- package/dest/FeeJuice-SAOWVGG7.js +3 -0
- package/dest/FeeJuice-SAOWVGG7.js.map +7 -0
- package/dest/HandshakeRegistry-GY5CPEPS.js +3 -0
- package/dest/HandshakeRegistry-GY5CPEPS.js.map +7 -0
- package/dest/{MultiCallEntrypoint-MIDICLQB.js → MultiCallEntrypoint-QG5H33ZZ.js} +1 -1
- package/dest/{MultiCallEntrypoint-MIDICLQB.js.map → MultiCallEntrypoint-QG5H33ZZ.js.map} +2 -2
- package/dest/SchnorrAccount-NME3E45O.js +3 -0
- package/dest/SchnorrAccount-NME3E45O.js.map +7 -0
- package/dest/SchnorrInitializerlessAccount-WTGXU6SW.js +3 -0
- package/dest/SchnorrInitializerlessAccount-WTGXU6SW.js.map +7 -0
- package/dest/bin/check_txe_oracle_version.js +7 -15
- package/dest/bin/index.js +1 -1
- package/dest/chunk-2XE2OXLY.js +260 -0
- package/dest/chunk-2XE2OXLY.js.map +7 -0
- package/dest/chunk-32UHX7YY.js +3 -0
- package/dest/{chunk-RELAEYUE.js → chunk-543AD4I4.js} +2 -2
- package/dest/metafile.json +1451 -2657
- package/dest/oracle/interfaces.d.ts +2 -2
- package/dest/oracle/interfaces.d.ts.map +1 -1
- package/dest/oracle/test-resolver/default_fixtures.d.ts +9 -2
- package/dest/oracle/test-resolver/default_fixtures.d.ts.map +1 -1
- package/dest/oracle/test-resolver/default_fixtures.js +32 -39
- package/dest/oracle/test-resolver/resolver.d.ts +1 -1
- package/dest/oracle/test-resolver/resolver.d.ts.map +1 -1
- package/dest/oracle/test-resolver/resolver.js +2 -2
- package/dest/oracle/txe_oracle_registry.d.ts +3 -3
- package/dest/oracle/txe_oracle_registry.d.ts.map +1 -1
- package/dest/oracle/txe_oracle_registry.js +37 -27
- package/dest/oracle/txe_oracle_top_level_context.d.ts +2 -2
- package/dest/oracle/txe_oracle_top_level_context.d.ts.map +1 -1
- package/dest/oracle/txe_oracle_top_level_context.js +352 -264
- package/dest/oracle/txe_oracle_version.d.ts +3 -3
- package/dest/oracle/txe_oracle_version.js +3 -3
- package/dest/rpc_translator.js +1 -1
- package/dest/server.bundle.js +1 -1
- package/dest/state_machine/synchronizer.d.ts +6 -1
- package/dest/state_machine/synchronizer.d.ts.map +1 -1
- package/dest/state_machine/synchronizer.js +12 -3
- package/dest/txe_session.d.ts +3 -3
- package/dest/txe_session.d.ts.map +1 -1
- package/dest/txe_session.js +10 -2
- package/dest/worker.bundle.js +1 -1
- package/package.json +17 -17
- package/src/bin/check_txe_oracle_version.ts +9 -12
- package/src/oracle/interfaces.ts +1 -1
- package/src/oracle/test-resolver/default_fixtures.ts +58 -69
- package/src/oracle/test-resolver/resolver.ts +2 -2
- package/src/oracle/txe_oracle_registry.ts +38 -25
- package/src/oracle/txe_oracle_top_level_context.ts +27 -20
- package/src/oracle/txe_oracle_version.ts +3 -3
- package/src/rpc_translator.ts +1 -1
- package/src/state_machine/synchronizer.ts +18 -3
- package/src/txe_session.ts +10 -2
- package/dest/AuthRegistry-56AMRLSQ.js +0 -3
- package/dest/ContractClassRegistry-N6NA3SFA.js +0 -3
- package/dest/ContractClassRegistry-N6NA3SFA.js.map +0 -7
- package/dest/FeeJuice-QBH5JWJV.js +0 -3
- package/dest/FeeJuice-QBH5JWJV.js.map +0 -7
- package/dest/HandshakeRegistry-D2W3AOPD.js +0 -3
- package/dest/HandshakeRegistry-D2W3AOPD.js.map +0 -7
- package/dest/SchnorrAccount-HNL7EN7Y.js +0 -3
- package/dest/SchnorrAccount-HNL7EN7Y.js.map +0 -7
- package/dest/SchnorrInitializerlessAccount-TFAFXZW6.js +0 -3
- package/dest/SchnorrInitializerlessAccount-TFAFXZW6.js.map +0 -7
- package/dest/chunk-BJVAAXNA.js +0 -3
- package/dest/chunk-EKHK6CRD.js +0 -268
- package/dest/chunk-EKHK6CRD.js.map +0 -7
- /package/dest/{chunk-BJVAAXNA.js.map → chunk-32UHX7YY.js.map} +0 -0
- /package/dest/{chunk-RELAEYUE.js.map → chunk-543AD4I4.js.map} +0 -0
|
@@ -14,7 +14,6 @@ import type { TaggingSecretStrategy } from '@aztec/pxe/server';
|
|
|
14
14
|
import {
|
|
15
15
|
ARRAY,
|
|
16
16
|
AZTEC_ADDRESS,
|
|
17
|
-
BIGINT,
|
|
18
17
|
BLOCK_NUMBER,
|
|
19
18
|
BOOL,
|
|
20
19
|
ETH_ADDRESS,
|
|
@@ -22,17 +21,20 @@ import {
|
|
|
22
21
|
FIXED_ARRAY,
|
|
23
22
|
FUNCTION_SELECTOR,
|
|
24
23
|
type InputSlot,
|
|
24
|
+
LEAF,
|
|
25
25
|
type MaybePromise,
|
|
26
26
|
OPTION,
|
|
27
27
|
ORACLE_REGISTRY,
|
|
28
28
|
type OracleRegistryEntry,
|
|
29
29
|
type OutputSlot,
|
|
30
30
|
type ParamTypes,
|
|
31
|
+
SCALAR,
|
|
31
32
|
STR,
|
|
32
33
|
STRUCT,
|
|
33
34
|
type SlotShape,
|
|
34
35
|
type TypeMapping,
|
|
35
36
|
U32,
|
|
37
|
+
U64,
|
|
36
38
|
buildACIRCallback,
|
|
37
39
|
makeEntry,
|
|
38
40
|
} from '@aztec/pxe/simulator';
|
|
@@ -59,12 +61,13 @@ export type { BlockHash } from '@aztec/stdlib/block';
|
|
|
59
61
|
export type { MembershipWitness } from '@aztec/foundation/trees';
|
|
60
62
|
export type { NullifierMembershipWitness, PublicDataWitness } from '@aztec/stdlib/trees';
|
|
61
63
|
|
|
62
|
-
const GAS_SETTINGS: TypeMapping<GasSettings> = {
|
|
64
|
+
const GAS_SETTINGS: TypeMapping<GasSettings> = LEAF({
|
|
65
|
+
kind: 'gas-settings',
|
|
63
66
|
deserialization: {
|
|
64
67
|
fn: ([reader]) => GasSettings.fromFields(reader.readFieldArray(GAS_SETTINGS_LENGTH)),
|
|
65
68
|
},
|
|
66
69
|
shape: [{ len: GAS_SETTINGS_LENGTH }],
|
|
67
|
-
};
|
|
70
|
+
});
|
|
68
71
|
|
|
69
72
|
// Tagging secret strategy discriminants. Must match the Noir test helper `TaggingSecretStrategy` in
|
|
70
73
|
// aztec-nr `test/helpers/tagging_secret_strategy.nr`. This is a test-only oracle (only `set_tagging_secret_strategies`
|
|
@@ -74,7 +77,8 @@ const STRATEGY_ARBITRARY_SECRET = 2;
|
|
|
74
77
|
const STRATEGY_ADDRESS_DERIVED = 3;
|
|
75
78
|
const STRATEGY_INTERACTIVE_HANDSHAKE = 4;
|
|
76
79
|
|
|
77
|
-
const TAGGING_SECRET_STRATEGY: TypeMapping<TaggingSecretStrategy> = {
|
|
80
|
+
const TAGGING_SECRET_STRATEGY: TypeMapping<TaggingSecretStrategy> = LEAF({
|
|
81
|
+
kind: 'tagging-secret-strategy',
|
|
78
82
|
serialization: {
|
|
79
83
|
fn: strategy => {
|
|
80
84
|
switch (strategy.type) {
|
|
@@ -108,24 +112,27 @@ const TAGGING_SECRET_STRATEGY: TypeMapping<TaggingSecretStrategy> = {
|
|
|
108
112
|
},
|
|
109
113
|
},
|
|
110
114
|
shape: ['scalar', 'scalar', 'scalar'],
|
|
111
|
-
};
|
|
115
|
+
});
|
|
112
116
|
|
|
113
|
-
const PRIVATE_CONTEXT_INPUTS: TypeMapping<PrivateContextInputs> = {
|
|
117
|
+
const PRIVATE_CONTEXT_INPUTS: TypeMapping<PrivateContextInputs> = LEAF({
|
|
118
|
+
kind: 'private-context-inputs',
|
|
114
119
|
serialization: { fn: v => v.toFields() },
|
|
115
120
|
shape: Array<SlotShape>(PRIVATE_CONTEXT_INPUTS_LENGTH).fill('scalar'),
|
|
116
|
-
};
|
|
121
|
+
});
|
|
117
122
|
|
|
118
|
-
const COMPLETE_ADDRESS: TypeMapping<CompleteAddress> = {
|
|
123
|
+
const COMPLETE_ADDRESS: TypeMapping<CompleteAddress> = LEAF({
|
|
124
|
+
kind: 'complete-address',
|
|
119
125
|
serialization: { fn: v => [v.address.toField(), ...v.publicKeys.toFields()] },
|
|
120
126
|
shape: Array<SlotShape>(8).fill('scalar'), // address + 7 public-key fields
|
|
121
|
-
};
|
|
127
|
+
});
|
|
122
128
|
|
|
123
129
|
const TXE_TX_EFFECTS: TypeMapping<{
|
|
124
130
|
txHash: TxHash;
|
|
125
131
|
noteHashes: Fr[];
|
|
126
132
|
nullifiers: Fr[];
|
|
127
133
|
privateLogs: PrivateLog[];
|
|
128
|
-
}> = {
|
|
134
|
+
}> = LEAF({
|
|
135
|
+
kind: 'txe-tx-effects',
|
|
129
136
|
serialization: {
|
|
130
137
|
fn: ({ txHash, noteHashes, nullifiers, privateLogs }) => {
|
|
131
138
|
const emittedLogs = privateLogs.map(log => log.getEmittedFields());
|
|
@@ -164,9 +171,10 @@ const TXE_TX_EFFECTS: TypeMapping<{
|
|
|
164
171
|
{ len: MAX_PRIVATE_LOGS_PER_TX },
|
|
165
172
|
'scalar',
|
|
166
173
|
],
|
|
167
|
-
};
|
|
174
|
+
});
|
|
168
175
|
|
|
169
|
-
const TXE_OFFCHAIN_EFFECTS: TypeMapping<{ effects: Fr[][] }> = {
|
|
176
|
+
const TXE_OFFCHAIN_EFFECTS: TypeMapping<{ effects: Fr[][] }> = LEAF({
|
|
177
|
+
kind: 'txe-offchain-effects',
|
|
170
178
|
serialization: {
|
|
171
179
|
fn: ({ effects }) => {
|
|
172
180
|
const rawArrayStorage = effects
|
|
@@ -188,9 +196,10 @@ const TXE_OFFCHAIN_EFFECTS: TypeMapping<{ effects: Fr[][] }> = {
|
|
|
188
196
|
{ len: MAX_OFFCHAIN_EFFECTS_PER_TXE_QUERY },
|
|
189
197
|
'scalar',
|
|
190
198
|
],
|
|
191
|
-
};
|
|
199
|
+
});
|
|
192
200
|
|
|
193
|
-
const TXE_CALL_CONTEXT: TypeMapping<{ txHash: Fr; anchorBlockTimestamp: bigint }> = {
|
|
201
|
+
const TXE_CALL_CONTEXT: TypeMapping<{ txHash: Fr; anchorBlockTimestamp: bigint }> = LEAF({
|
|
202
|
+
kind: 'txe-call-context',
|
|
194
203
|
serialization: {
|
|
195
204
|
fn: ({ txHash, anchorBlockTimestamp }) => {
|
|
196
205
|
const isSome = txHash.isZero() ? 0 : 1;
|
|
@@ -198,7 +207,7 @@ const TXE_CALL_CONTEXT: TypeMapping<{ txHash: Fr; anchorBlockTimestamp: bigint }
|
|
|
198
207
|
},
|
|
199
208
|
},
|
|
200
209
|
shape: ['scalar', 'scalar', 'scalar'], // discriminant, txHash, anchor block timestamp
|
|
201
|
-
};
|
|
210
|
+
});
|
|
202
211
|
|
|
203
212
|
const CONTRACT_INSTANCE_MEMBER: TypeMapping<{ exists: boolean; member: Fr }[]> = FIXED_ARRAY(
|
|
204
213
|
STRUCT([
|
|
@@ -208,13 +217,14 @@ const CONTRACT_INSTANCE_MEMBER: TypeMapping<{ exists: boolean; member: Fr }[]> =
|
|
|
208
217
|
1,
|
|
209
218
|
);
|
|
210
219
|
|
|
211
|
-
const EVENT_SELECTOR: TypeMapping<EventSelector> = {
|
|
220
|
+
const EVENT_SELECTOR: TypeMapping<EventSelector> = SCALAR({
|
|
221
|
+
kind: 'event-selector',
|
|
212
222
|
serialization: { fn: v => [v.toField()] },
|
|
213
223
|
deserialization: { fn: ([reader]) => EventSelector.fromField(reader.readField()) },
|
|
214
|
-
|
|
215
|
-
};
|
|
224
|
+
});
|
|
216
225
|
|
|
217
|
-
const TXE_PRIVATE_EVENTS: TypeMapping<Fr[][]> = {
|
|
226
|
+
const TXE_PRIVATE_EVENTS: TypeMapping<Fr[][]> = LEAF({
|
|
227
|
+
kind: 'txe-private-events',
|
|
218
228
|
serialization: {
|
|
219
229
|
fn: events => {
|
|
220
230
|
const rawArrayStorage = events
|
|
@@ -235,7 +245,7 @@ const TXE_PRIVATE_EVENTS: TypeMapping<Fr[][]> = {
|
|
|
235
245
|
{ len: MAX_PRIVATE_EVENTS_PER_TXE_QUERY },
|
|
236
246
|
'scalar',
|
|
237
247
|
],
|
|
238
|
-
};
|
|
248
|
+
});
|
|
239
249
|
|
|
240
250
|
export const TXE_ORACLE_REGISTRY = {
|
|
241
251
|
...ORACLE_REGISTRY,
|
|
@@ -270,14 +280,14 @@ export const TXE_ORACLE_REGISTRY = {
|
|
|
270
280
|
|
|
271
281
|
aztec_txe_getNextBlockNumber: makeEntry({ returnType: BLOCK_NUMBER }),
|
|
272
282
|
|
|
273
|
-
aztec_txe_getNextBlockTimestamp: makeEntry({ returnType:
|
|
283
|
+
aztec_txe_getNextBlockTimestamp: makeEntry({ returnType: U64 }),
|
|
274
284
|
|
|
275
285
|
aztec_txe_advanceBlocksBy: makeEntry({
|
|
276
286
|
params: [{ name: 'blocks', type: U32 }],
|
|
277
287
|
}),
|
|
278
288
|
|
|
279
289
|
aztec_txe_advanceTimestampBy: makeEntry({
|
|
280
|
-
params: [{ name: 'duration', type:
|
|
290
|
+
params: [{ name: 'duration', type: U64 }],
|
|
281
291
|
}),
|
|
282
292
|
|
|
283
293
|
aztec_txe_deploy: makeEntry({
|
|
@@ -294,7 +304,10 @@ export const TXE_ORACLE_REGISTRY = {
|
|
|
294
304
|
}),
|
|
295
305
|
|
|
296
306
|
aztec_txe_createAccount: makeEntry({
|
|
297
|
-
params: [
|
|
307
|
+
params: [
|
|
308
|
+
{ name: 'secret', type: FIELD },
|
|
309
|
+
{ name: 'partialAddress', type: FIELD },
|
|
310
|
+
],
|
|
298
311
|
returnType: COMPLETE_ADDRESS,
|
|
299
312
|
}),
|
|
300
313
|
|
|
@@ -332,7 +345,7 @@ export const TXE_ORACLE_REGISTRY = {
|
|
|
332
345
|
}),
|
|
333
346
|
|
|
334
347
|
aztec_txe_getLastBlockTimestamp: makeEntry({
|
|
335
|
-
returnType:
|
|
348
|
+
returnType: U64,
|
|
336
349
|
}),
|
|
337
350
|
|
|
338
351
|
aztec_txe_getLastTxEffects: makeEntry({ returnType: TXE_TX_EFFECTS }),
|
|
@@ -391,7 +404,7 @@ export const TXE_ORACLE_REGISTRY = {
|
|
|
391
404
|
|
|
392
405
|
aztec_avm_blockNumber: makeEntry({ returnType: BLOCK_NUMBER }),
|
|
393
406
|
|
|
394
|
-
aztec_avm_timestamp: makeEntry({ returnType:
|
|
407
|
+
aztec_avm_timestamp: makeEntry({ returnType: U64 }),
|
|
395
408
|
|
|
396
409
|
aztec_avm_isStaticCall: makeEntry({ returnType: BOOL }),
|
|
397
410
|
|
|
@@ -53,10 +53,10 @@ import {
|
|
|
53
53
|
witnessMapToFields,
|
|
54
54
|
} from '@aztec/simulator/client';
|
|
55
55
|
import {
|
|
56
|
-
CppPublicTxSimulator,
|
|
57
56
|
GuardedMerkleTreeOperations,
|
|
58
57
|
PublicContractsDB,
|
|
59
58
|
PublicProcessor,
|
|
59
|
+
PublicTxSimulator,
|
|
60
60
|
} from '@aztec/simulator/server';
|
|
61
61
|
import { type ContractArtifact, EventSelector, FunctionCall, FunctionSelector, FunctionType } from '@aztec/stdlib/abi';
|
|
62
62
|
import { AuthWitness } from '@aztec/stdlib/auth-witness';
|
|
@@ -336,9 +336,8 @@ export class TXEOracleTopLevelContext implements IMiscOracle, ITxeExecutionOracl
|
|
|
336
336
|
return completeAddress;
|
|
337
337
|
}
|
|
338
338
|
|
|
339
|
-
async createAccount(secret: Fr) {
|
|
340
|
-
|
|
341
|
-
const completeAddress = await this.keyStore.addAccount(await deriveKeys(secret), secret);
|
|
339
|
+
async createAccount(secret: Fr, partialAddress: Fr) {
|
|
340
|
+
const completeAddress = await this.keyStore.addAccount(await deriveKeys(secret), partialAddress);
|
|
342
341
|
await this.accountStore.setAccount(completeAddress.address, completeAddress);
|
|
343
342
|
await this.addressStore.addCompleteAddress(completeAddress);
|
|
344
343
|
this.logger.debug(`Created account ${completeAddress.address}`);
|
|
@@ -492,7 +491,6 @@ export class TXEOracleTopLevelContext implements IMiscOracle, ITxeExecutionOracl
|
|
|
492
491
|
const privateExecutionOracle = new PrivateExecutionOracle({
|
|
493
492
|
argsHash,
|
|
494
493
|
txContext,
|
|
495
|
-
// The TXE does not run the init kernel's salt binding, so no tx-request salt is in scope.
|
|
496
494
|
txRequestSalt: Fr.ZERO,
|
|
497
495
|
callContext,
|
|
498
496
|
anchorBlockHeader: blockHeader,
|
|
@@ -582,7 +580,7 @@ export class TXEOracleTopLevelContext implements IMiscOracle, ITxeExecutionOracl
|
|
|
582
580
|
globals.version = this.version;
|
|
583
581
|
globals.gasFees = GasFees.empty();
|
|
584
582
|
|
|
585
|
-
|
|
583
|
+
await using forkedWorldTrees = await this.stateMachine.synchronizer.nativeWorldStateService.fork();
|
|
586
584
|
|
|
587
585
|
const bindings = this.logger.getBindings();
|
|
588
586
|
const contractsDB = new PublicContractsDB(
|
|
@@ -597,11 +595,20 @@ export class TXEOracleTopLevelContext implements IMiscOracle, ITxeExecutionOracl
|
|
|
597
595
|
collectStatistics: false,
|
|
598
596
|
collectCallMetadata: true,
|
|
599
597
|
});
|
|
598
|
+
// The AVM simulator reads this fork's contracts DB, scoped by fork id, for each simulation.
|
|
599
|
+
const forkId = forkedWorldTrees.getRevision().forkId;
|
|
600
600
|
const processor = new PublicProcessor(
|
|
601
601
|
globals,
|
|
602
602
|
guardedMerkleTrees,
|
|
603
603
|
contractsDB,
|
|
604
|
-
new
|
|
604
|
+
new PublicTxSimulator(
|
|
605
|
+
this.stateMachine.synchronizer.avmSimulator,
|
|
606
|
+
globals,
|
|
607
|
+
contractsDB,
|
|
608
|
+
forkId,
|
|
609
|
+
config,
|
|
610
|
+
bindings,
|
|
611
|
+
),
|
|
605
612
|
new TestDateProvider(),
|
|
606
613
|
undefined,
|
|
607
614
|
createLogger('simulator:public-processor', bindings),
|
|
@@ -652,8 +659,6 @@ export class TXEOracleTopLevelContext implements IMiscOracle, ITxeExecutionOracl
|
|
|
652
659
|
|
|
653
660
|
if (isStaticCall) {
|
|
654
661
|
await checkpoint!.revert();
|
|
655
|
-
|
|
656
|
-
await forkedWorldTrees.close();
|
|
657
662
|
return { returnValues: executionResult.returnValues ?? [], offchainEffects };
|
|
658
663
|
}
|
|
659
664
|
|
|
@@ -674,8 +679,6 @@ export class TXEOracleTopLevelContext implements IMiscOracle, ITxeExecutionOracl
|
|
|
674
679
|
|
|
675
680
|
await this.stateMachine.handleL2Block(l2Block);
|
|
676
681
|
|
|
677
|
-
await forkedWorldTrees.close();
|
|
678
|
-
|
|
679
682
|
return { returnValues: executionResult.returnValues ?? [], offchainEffects };
|
|
680
683
|
}
|
|
681
684
|
|
|
@@ -711,7 +714,7 @@ export class TXEOracleTopLevelContext implements IMiscOracle, ITxeExecutionOracl
|
|
|
711
714
|
globals.version = this.version;
|
|
712
715
|
globals.gasFees = GasFees.empty();
|
|
713
716
|
|
|
714
|
-
|
|
717
|
+
await using forkedWorldTrees = await this.stateMachine.synchronizer.nativeWorldStateService.fork();
|
|
715
718
|
|
|
716
719
|
const bindings2 = this.logger.getBindings();
|
|
717
720
|
const contractsDB = new PublicContractsDB(
|
|
@@ -726,7 +729,16 @@ export class TXEOracleTopLevelContext implements IMiscOracle, ITxeExecutionOracl
|
|
|
726
729
|
collectStatistics: false,
|
|
727
730
|
collectCallMetadata: true,
|
|
728
731
|
});
|
|
729
|
-
|
|
732
|
+
// The AVM simulator reads this fork's contracts DB, scoped by fork id, for each simulation.
|
|
733
|
+
const forkId2 = forkedWorldTrees.getRevision().forkId;
|
|
734
|
+
const simulator = new PublicTxSimulator(
|
|
735
|
+
this.stateMachine.synchronizer.avmSimulator,
|
|
736
|
+
globals,
|
|
737
|
+
contractsDB,
|
|
738
|
+
forkId2,
|
|
739
|
+
config,
|
|
740
|
+
bindings2,
|
|
741
|
+
);
|
|
730
742
|
const processor = new PublicProcessor(
|
|
731
743
|
globals,
|
|
732
744
|
guardedMerkleTrees,
|
|
@@ -812,9 +824,6 @@ export class TXEOracleTopLevelContext implements IMiscOracle, ITxeExecutionOracl
|
|
|
812
824
|
|
|
813
825
|
if (isStaticCall) {
|
|
814
826
|
await checkpoint!.revert();
|
|
815
|
-
|
|
816
|
-
await forkedWorldTrees.close();
|
|
817
|
-
|
|
818
827
|
return returnValues ?? [];
|
|
819
828
|
}
|
|
820
829
|
|
|
@@ -835,8 +844,6 @@ export class TXEOracleTopLevelContext implements IMiscOracle, ITxeExecutionOracl
|
|
|
835
844
|
|
|
836
845
|
await this.stateMachine.handleL2Block(l2Block);
|
|
837
846
|
|
|
838
|
-
await forkedWorldTrees.close();
|
|
839
|
-
|
|
840
847
|
return returnValues ?? [];
|
|
841
848
|
}
|
|
842
849
|
|
|
@@ -923,7 +930,7 @@ export class TXEOracleTopLevelContext implements IMiscOracle, ITxeExecutionOracl
|
|
|
923
930
|
try {
|
|
924
931
|
const simulator = new WASMSimulator();
|
|
925
932
|
const utilityExecutor = async (syncCall: FunctionCall, execScopes: AztecAddress[]) => {
|
|
926
|
-
await this.executeUtilityCall(syncCall, { scopes: execScopes, jobId
|
|
933
|
+
await this.executeUtilityCall(syncCall, { scopes: execScopes, jobId });
|
|
927
934
|
};
|
|
928
935
|
const oracle = new UtilityExecutionOracle({
|
|
929
936
|
callContext: CallContext.from({
|
|
@@ -951,10 +958,10 @@ export class TXEOracleTopLevelContext implements IMiscOracle, ITxeExecutionOracl
|
|
|
951
958
|
jobId,
|
|
952
959
|
scopes,
|
|
953
960
|
simulator,
|
|
954
|
-
utilityExecutor,
|
|
955
961
|
hooks: composeHooks({
|
|
956
962
|
authorizeUtilityCall: this.buildAuthorizeUtilityCallHook('utility', authorizedUtilityCallTargets),
|
|
957
963
|
}),
|
|
964
|
+
utilityExecutor,
|
|
958
965
|
// Execution-tree root (top-level utility run or contract sync): own store; nested frames inherit it.
|
|
959
966
|
transientArrayService: new TransientArrayService(),
|
|
960
967
|
});
|
|
@@ -5,13 +5,13 @@
|
|
|
5
5
|
*
|
|
6
6
|
* The Noir counterparts are in `noir-projects/aztec-nr/aztec/src/test/helpers/txe_oracles.nr`.
|
|
7
7
|
*/
|
|
8
|
-
export const TXE_ORACLE_VERSION_MAJOR =
|
|
8
|
+
export const TXE_ORACLE_VERSION_MAJOR = 4;
|
|
9
9
|
export const TXE_ORACLE_VERSION_MINOR = 1;
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
|
-
* This hash is computed from the TXE
|
|
12
|
+
* This hash is computed from the TXE-specific entries in `TXE_ORACLE_REGISTRY` and is used to
|
|
13
13
|
* detect when those interfaces change. When it does, bump:
|
|
14
14
|
* - TXE_ORACLE_VERSION_MAJOR (and reset MINOR to 0) for breaking changes, or
|
|
15
15
|
* - TXE_ORACLE_VERSION_MINOR for additive changes (new oracle method added).
|
|
16
16
|
*/
|
|
17
|
-
export const TXE_ORACLE_INTERFACE_HASH = '
|
|
17
|
+
export const TXE_ORACLE_INTERFACE_HASH = '1a6c578d0a47cd8dd7dae07fd00abe781225a73920c596d873afcc061c0e4284';
|
package/src/rpc_translator.ts
CHANGED
|
@@ -188,7 +188,7 @@ export class RPCTranslator {
|
|
|
188
188
|
return callTxeHandler({
|
|
189
189
|
oracle: 'aztec_txe_createAccount',
|
|
190
190
|
inputs,
|
|
191
|
-
handler: ([secret]) => this.handlerAsTxe().createAccount(secret),
|
|
191
|
+
handler: ([secret, partialAddress]) => this.handlerAsTxe().createAccount(secret, partialAddress),
|
|
192
192
|
});
|
|
193
193
|
}
|
|
194
194
|
|
|
@@ -2,6 +2,7 @@ import { NUMBER_OF_L1_L2_MESSAGES_PER_ROLLUP } from '@aztec/constants';
|
|
|
2
2
|
import { BlockNumber } from '@aztec/foundation/branded-types';
|
|
3
3
|
import { padArrayEnd } from '@aztec/foundation/collection';
|
|
4
4
|
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
5
|
+
import { AvmSimulatorPool } from '@aztec/simulator/server';
|
|
5
6
|
import type { BlockHash, L2Block } from '@aztec/stdlib/block';
|
|
6
7
|
import type {
|
|
7
8
|
MerkleTreeReadOperations,
|
|
@@ -16,12 +17,21 @@ export class TXESynchronizer implements WorldStateSynchronizer {
|
|
|
16
17
|
// This works when set to 1 as well.
|
|
17
18
|
private blockNumber = BlockNumber.ZERO;
|
|
18
19
|
|
|
20
|
+
/** AVM execution backend (simulator pool + CDB server) shared across all public simulations. */
|
|
21
|
+
public avmSimulator!: AvmSimulatorPool;
|
|
22
|
+
|
|
19
23
|
constructor(public nativeWorldStateService: NativeWorldStateService) {}
|
|
20
24
|
|
|
21
25
|
static async create() {
|
|
22
26
|
const nativeWorldStateService = await NativeWorldStateService.ephemeral();
|
|
23
27
|
|
|
24
|
-
|
|
28
|
+
const synchronizer = new this(nativeWorldStateService);
|
|
29
|
+
|
|
30
|
+
synchronizer.avmSimulator = await AvmSimulatorPool.spawn({
|
|
31
|
+
wsdbIpcPath: nativeWorldStateService.getIpcPath(),
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
return synchronizer;
|
|
25
35
|
}
|
|
26
36
|
|
|
27
37
|
public async handleL2Block(block: L2Block, l1ToL2Messages: Fr[] = []) {
|
|
@@ -76,8 +86,8 @@ export class TXESynchronizer implements WorldStateSynchronizer {
|
|
|
76
86
|
throw new Error('TXE Synchronizer does not implement "status"');
|
|
77
87
|
}
|
|
78
88
|
|
|
79
|
-
public stop(): Promise<void> {
|
|
80
|
-
|
|
89
|
+
public async stop(): Promise<void> {
|
|
90
|
+
await this.closeIpc();
|
|
81
91
|
}
|
|
82
92
|
|
|
83
93
|
public stopSync(): Promise<void> {
|
|
@@ -91,4 +101,9 @@ export class TXESynchronizer implements WorldStateSynchronizer {
|
|
|
91
101
|
public clear(): Promise<void> {
|
|
92
102
|
throw new Error('TXE Synchronizer does not implement "clear"');
|
|
93
103
|
}
|
|
104
|
+
|
|
105
|
+
/** Clean up IPC resources. */
|
|
106
|
+
public async closeIpc(): Promise<void> {
|
|
107
|
+
await this.avmSimulator?.[Symbol.asyncDispose]();
|
|
108
|
+
}
|
|
94
109
|
}
|
package/src/txe_session.ts
CHANGED
|
@@ -279,14 +279,22 @@ export class TXESession implements TXESessionStateHandler {
|
|
|
279
279
|
) {}
|
|
280
280
|
|
|
281
281
|
/**
|
|
282
|
-
*
|
|
283
|
-
* Called via IPC when the dispatcher detects the end of a test. Idempotent.
|
|
282
|
+
* Tears down the per-session AVM simulator (process pool + CDB server), the `NativeWorldStateService`,
|
|
283
|
+
* and the `txe-session` LMDB. Called via IPC when the dispatcher detects the end of a test. Idempotent.
|
|
284
284
|
*/
|
|
285
285
|
async dispose(): Promise<void> {
|
|
286
286
|
if (this.disposed) {
|
|
287
287
|
return;
|
|
288
288
|
}
|
|
289
289
|
this.disposed = true;
|
|
290
|
+
// Dispose the AVM pool before the world state: it kills the bb-avm-sim processes so they release their
|
|
291
|
+
// connection to the WSDB server, letting it shut down cleanly. Skipping this leaks a bb-avm-sim process
|
|
292
|
+
// (and keeps its WSDB alive) per session.
|
|
293
|
+
try {
|
|
294
|
+
await this.stateMachine.synchronizer.closeIpc();
|
|
295
|
+
} catch (err) {
|
|
296
|
+
this.logger.warn(`Error closing AVM simulator during session dispose`, err);
|
|
297
|
+
}
|
|
290
298
|
try {
|
|
291
299
|
await this.stateMachine.synchronizer.nativeWorldStateService.close();
|
|
292
300
|
} catch (err) {
|