@aztec/txe 0.0.1-commit.d1cd2107c → 0.0.1-commit.d1da697d6
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.d.ts +4 -3
- package/dest/oracle/txe_oracle_top_level_context.d.ts.map +1 -1
- package/dest/oracle/txe_oracle_top_level_context.js +21 -15
- package/dest/rpc_translator.d.ts +24 -19
- package/dest/rpc_translator.d.ts.map +1 -1
- package/dest/rpc_translator.js +78 -38
- package/dest/state_machine/archiver.d.ts +3 -3
- package/dest/state_machine/archiver.d.ts.map +1 -1
- package/dest/state_machine/archiver.js +7 -8
- package/dest/state_machine/dummy_p2p_client.d.ts +3 -2
- package/dest/state_machine/dummy_p2p_client.d.ts.map +1 -1
- package/dest/state_machine/dummy_p2p_client.js +5 -2
- package/dest/state_machine/global_variable_builder.d.ts +3 -3
- package/dest/state_machine/global_variable_builder.d.ts.map +1 -1
- package/dest/state_machine/global_variable_builder.js +1 -1
- package/dest/state_machine/index.d.ts +4 -2
- package/dest/state_machine/index.d.ts.map +1 -1
- package/dest/state_machine/index.js +7 -3
- package/dest/state_machine/mock_epoch_cache.d.ts +17 -3
- package/dest/state_machine/mock_epoch_cache.d.ts.map +1 -1
- package/dest/state_machine/mock_epoch_cache.js +32 -2
- package/dest/state_machine/synchronizer.d.ts +5 -5
- package/dest/state_machine/synchronizer.d.ts.map +1 -1
- package/dest/state_machine/synchronizer.js +3 -3
- package/dest/txe_session.d.ts +4 -3
- package/dest/txe_session.d.ts.map +1 -1
- package/dest/txe_session.js +21 -12
- package/dest/util/encoding.d.ts +69 -1
- package/dest/util/encoding.d.ts.map +1 -1
- package/dest/util/txe_public_contract_data_source.d.ts +1 -1
- package/dest/util/txe_public_contract_data_source.d.ts.map +1 -1
- package/dest/util/txe_public_contract_data_source.js +1 -3
- package/package.json +15 -15
- package/src/oracle/txe_oracle_top_level_context.ts +31 -18
- package/src/rpc_translator.ts +108 -48
- package/src/state_machine/archiver.ts +6 -5
- package/src/state_machine/dummy_p2p_client.ts +6 -2
- package/src/state_machine/global_variable_builder.ts +7 -1
- package/src/state_machine/index.ts +6 -1
- package/src/state_machine/mock_epoch_cache.ts +42 -3
- package/src/state_machine/synchronizer.ts +4 -4
- package/src/txe_session.ts +23 -10
- package/src/util/txe_public_contract_data_source.ts +0 -2
package/src/txe_session.ts
CHANGED
|
@@ -3,12 +3,13 @@ import { Fr } from '@aztec/foundation/curves/bn254';
|
|
|
3
3
|
import { type Logger, createLogger } from '@aztec/foundation/log';
|
|
4
4
|
import { KeyStore } from '@aztec/key-store';
|
|
5
5
|
import { openTmpStore } from '@aztec/kv-store/lmdb-v2';
|
|
6
|
-
import type { AccessScopes } from '@aztec/pxe/client/lazy';
|
|
7
6
|
import {
|
|
8
7
|
AddressStore,
|
|
9
8
|
AnchorBlockStore,
|
|
9
|
+
CapsuleService,
|
|
10
10
|
CapsuleStore,
|
|
11
11
|
ContractStore,
|
|
12
|
+
ContractSyncService,
|
|
12
13
|
JobCoordinator,
|
|
13
14
|
NoteService,
|
|
14
15
|
NoteStore,
|
|
@@ -150,6 +151,7 @@ export class TXESession implements TXESessionStateHandler {
|
|
|
150
151
|
private chainId: Fr,
|
|
151
152
|
private version: Fr,
|
|
152
153
|
private nextBlockTimestamp: bigint,
|
|
154
|
+
private contractSyncService: ContractSyncService,
|
|
153
155
|
) {}
|
|
154
156
|
|
|
155
157
|
static async init(contractStore: ContractStore) {
|
|
@@ -185,6 +187,9 @@ export class TXESession implements TXESessionStateHandler {
|
|
|
185
187
|
|
|
186
188
|
const initialJobId = jobCoordinator.beginJob();
|
|
187
189
|
|
|
190
|
+
const logger = createLogger('txe:session');
|
|
191
|
+
const contractSyncService = new ContractSyncService(stateMachine.node, contractStore, noteStore, logger);
|
|
192
|
+
|
|
188
193
|
const topLevelOracleHandler = new TXEOracleTopLevelContext(
|
|
189
194
|
stateMachine,
|
|
190
195
|
contractStore,
|
|
@@ -201,11 +206,12 @@ export class TXESession implements TXESessionStateHandler {
|
|
|
201
206
|
version,
|
|
202
207
|
chainId,
|
|
203
208
|
new Map(),
|
|
209
|
+
contractSyncService,
|
|
204
210
|
);
|
|
205
211
|
await topLevelOracleHandler.advanceBlocksBy(1);
|
|
206
212
|
|
|
207
213
|
return new TXESession(
|
|
208
|
-
|
|
214
|
+
logger,
|
|
209
215
|
stateMachine,
|
|
210
216
|
topLevelOracleHandler,
|
|
211
217
|
contractStore,
|
|
@@ -223,6 +229,7 @@ export class TXESession implements TXESessionStateHandler {
|
|
|
223
229
|
version,
|
|
224
230
|
chainId,
|
|
225
231
|
nextBlockTimestamp,
|
|
232
|
+
contractSyncService,
|
|
226
233
|
);
|
|
227
234
|
}
|
|
228
235
|
|
|
@@ -309,6 +316,7 @@ export class TXESession implements TXESessionStateHandler {
|
|
|
309
316
|
this.version,
|
|
310
317
|
this.chainId,
|
|
311
318
|
this.authwits,
|
|
319
|
+
this.contractSyncService,
|
|
312
320
|
);
|
|
313
321
|
|
|
314
322
|
this.state = { name: 'TOP_LEVEL' };
|
|
@@ -328,7 +336,7 @@ export class TXESession implements TXESessionStateHandler {
|
|
|
328
336
|
|
|
329
337
|
await new NoteService(this.noteStore, this.stateMachine.node, anchorBlock!, this.currentJobId).syncNoteNullifiers(
|
|
330
338
|
contractAddress,
|
|
331
|
-
|
|
339
|
+
await this.keyStore.getAccounts(),
|
|
332
340
|
);
|
|
333
341
|
const latestBlock = await this.stateMachine.node.getBlockHeader('latest');
|
|
334
342
|
|
|
@@ -364,11 +372,12 @@ export class TXESession implements TXESessionStateHandler {
|
|
|
364
372
|
senderTaggingStore: this.senderTaggingStore,
|
|
365
373
|
recipientTaggingStore: this.recipientTaggingStore,
|
|
366
374
|
senderAddressBookStore: this.senderAddressBookStore,
|
|
367
|
-
|
|
375
|
+
capsuleService: new CapsuleService(this.capsuleStore, await this.keyStore.getAccounts()),
|
|
368
376
|
privateEventStore: this.privateEventStore,
|
|
369
377
|
contractSyncService: this.stateMachine.contractSyncService,
|
|
370
378
|
jobId: this.currentJobId,
|
|
371
|
-
scopes:
|
|
379
|
+
scopes: await this.keyStore.getAccounts(),
|
|
380
|
+
messageContextService: this.stateMachine.messageContextService,
|
|
372
381
|
});
|
|
373
382
|
|
|
374
383
|
// We store the note and tagging index caches fed into the PrivateExecutionOracle (along with some other auxiliary
|
|
@@ -421,7 +430,7 @@ export class TXESession implements TXESessionStateHandler {
|
|
|
421
430
|
this.stateMachine.node,
|
|
422
431
|
anchorBlockHeader,
|
|
423
432
|
this.currentJobId,
|
|
424
|
-
).syncNoteNullifiers(contractAddress,
|
|
433
|
+
).syncNoteNullifiers(contractAddress, await this.keyStore.getAccounts());
|
|
425
434
|
|
|
426
435
|
this.oracleHandler = new UtilityExecutionOracle({
|
|
427
436
|
contractAddress,
|
|
@@ -435,10 +444,12 @@ export class TXESession implements TXESessionStateHandler {
|
|
|
435
444
|
aztecNode: this.stateMachine.node,
|
|
436
445
|
recipientTaggingStore: this.recipientTaggingStore,
|
|
437
446
|
senderAddressBookStore: this.senderAddressBookStore,
|
|
438
|
-
|
|
447
|
+
capsuleService: new CapsuleService(this.capsuleStore, await this.keyStore.getAccounts()),
|
|
439
448
|
privateEventStore: this.privateEventStore,
|
|
449
|
+
messageContextService: this.stateMachine.messageContextService,
|
|
450
|
+
contractSyncService: this.contractSyncService,
|
|
440
451
|
jobId: this.currentJobId,
|
|
441
|
-
scopes:
|
|
452
|
+
scopes: await this.keyStore.getAccounts(),
|
|
442
453
|
});
|
|
443
454
|
|
|
444
455
|
this.state = { name: 'UTILITY' };
|
|
@@ -507,7 +518,7 @@ export class TXESession implements TXESessionStateHandler {
|
|
|
507
518
|
}
|
|
508
519
|
|
|
509
520
|
private utilityExecutorForContractSync(anchorBlock: any) {
|
|
510
|
-
return async (call: FunctionCall, scopes:
|
|
521
|
+
return async (call: FunctionCall, scopes: AztecAddress[]) => {
|
|
511
522
|
const entryPointArtifact = await this.contractStore.getFunctionArtifactWithDebugMetadata(call.to, call.selector);
|
|
512
523
|
if (entryPointArtifact.functionType !== FunctionType.UTILITY) {
|
|
513
524
|
throw new Error(`Cannot run ${entryPointArtifact.functionType} function as utility`);
|
|
@@ -526,8 +537,10 @@ export class TXESession implements TXESessionStateHandler {
|
|
|
526
537
|
aztecNode: this.stateMachine.node,
|
|
527
538
|
recipientTaggingStore: this.recipientTaggingStore,
|
|
528
539
|
senderAddressBookStore: this.senderAddressBookStore,
|
|
529
|
-
|
|
540
|
+
capsuleService: new CapsuleService(this.capsuleStore, scopes),
|
|
530
541
|
privateEventStore: this.privateEventStore,
|
|
542
|
+
messageContextService: this.stateMachine.messageContextService,
|
|
543
|
+
contractSyncService: this.contractSyncService,
|
|
531
544
|
jobId: this.currentJobId,
|
|
532
545
|
scopes,
|
|
533
546
|
});
|
|
@@ -26,8 +26,6 @@ export class TXEPublicContractDataSource implements ContractDataSource {
|
|
|
26
26
|
packedBytecode: contractClass.packedBytecode,
|
|
27
27
|
privateFunctionsRoot: contractClass.privateFunctionsRoot,
|
|
28
28
|
version: contractClass.version,
|
|
29
|
-
privateFunctions: [],
|
|
30
|
-
utilityFunctions: [],
|
|
31
29
|
};
|
|
32
30
|
}
|
|
33
31
|
|