@aztec/txe 0.0.1-commit.6230a0c → 0.0.1-commit.64b6bbb

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.
Files changed (33) hide show
  1. package/dest/oracle/txe_oracle_top_level_context.d.ts +2 -2
  2. package/dest/oracle/txe_oracle_top_level_context.d.ts.map +1 -1
  3. package/dest/oracle/txe_oracle_top_level_context.js +76 -17
  4. package/dest/rpc_translator.d.ts +3 -3
  5. package/dest/rpc_translator.d.ts.map +1 -1
  6. package/dest/rpc_translator.js +2 -2
  7. package/dest/state_machine/archiver.d.ts +1 -1
  8. package/dest/state_machine/archiver.d.ts.map +1 -1
  9. package/dest/state_machine/archiver.js +2 -0
  10. package/dest/state_machine/dummy_p2p_client.d.ts +9 -8
  11. package/dest/state_machine/dummy_p2p_client.d.ts.map +1 -1
  12. package/dest/state_machine/dummy_p2p_client.js +15 -12
  13. package/dest/state_machine/index.d.ts +5 -5
  14. package/dest/state_machine/index.d.ts.map +1 -1
  15. package/dest/state_machine/index.js +14 -9
  16. package/dest/state_machine/mock_epoch_cache.d.ts +3 -1
  17. package/dest/state_machine/mock_epoch_cache.d.ts.map +1 -1
  18. package/dest/state_machine/mock_epoch_cache.js +4 -0
  19. package/dest/txe_session.d.ts +1 -1
  20. package/dest/txe_session.d.ts.map +1 -1
  21. package/dest/txe_session.js +61 -5
  22. package/dest/utils/block_creation.d.ts +1 -1
  23. package/dest/utils/block_creation.d.ts.map +1 -1
  24. package/dest/utils/block_creation.js +3 -1
  25. package/package.json +15 -15
  26. package/src/oracle/txe_oracle_top_level_context.ts +62 -67
  27. package/src/rpc_translator.ts +2 -2
  28. package/src/state_machine/archiver.ts +2 -0
  29. package/src/state_machine/dummy_p2p_client.ts +21 -15
  30. package/src/state_machine/index.ts +24 -9
  31. package/src/state_machine/mock_epoch_cache.ts +5 -0
  32. package/src/txe_session.ts +56 -51
  33. package/src/utils/block_creation.ts +3 -1
@@ -1,6 +1,7 @@
1
1
  import type { EpochAndSlot, EpochCacheInterface, EpochCommitteeInfo, SlotTag } from '@aztec/epoch-cache';
2
2
  import { EpochNumber, SlotNumber } from '@aztec/foundation/branded-types';
3
3
  import { EthAddress } from '@aztec/foundation/eth-address';
4
+ import { EmptyL1RollupConstants, type L1RollupConstants } from '@aztec/stdlib/epoch-helpers';
4
5
 
5
6
  /**
6
7
  * Mock implementation of the EpochCacheInterface used to satisfy dependencies of AztecNodeService.
@@ -64,4 +65,8 @@ export class MockEpochCache implements EpochCacheInterface {
64
65
  filterInCommittee(_slot: SlotTag, _validators: EthAddress[]): Promise<EthAddress[]> {
65
66
  return Promise.resolve([]);
66
67
  }
68
+
69
+ getL1Constants(): L1RollupConstants {
70
+ return EmptyL1RollupConstants;
71
+ }
67
72
  }
@@ -6,6 +6,7 @@ import { openTmpStore } from '@aztec/kv-store/lmdb-v2';
6
6
  import type { ProtocolContract } from '@aztec/protocol-contracts';
7
7
  import {
8
8
  AddressStore,
9
+ AnchorBlockStore,
9
10
  CapsuleStore,
10
11
  JobCoordinator,
11
12
  NoteService,
@@ -49,6 +50,7 @@ import type { IAvmExecutionOracle, ITxeExecutionOracle } from './oracle/interfac
49
50
  import { TXEOraclePublicContext } from './oracle/txe_oracle_public_context.js';
50
51
  import { TXEOracleTopLevelContext } from './oracle/txe_oracle_top_level_context.js';
51
52
  import { RPCTranslator } from './rpc_translator.js';
53
+ import { TXEArchiver } from './state_machine/archiver.js';
52
54
  import { TXEStateMachine } from './state_machine/index.js';
53
55
  import type { ForeignCallArgs, ForeignCallResult } from './util/encoding.js';
54
56
  import { TXEAccountStore } from './util/txe_account_store.js';
@@ -176,7 +178,9 @@ export class TXESession implements TXESessionStateHandler {
176
178
  await contractStore.addContractInstance(instance);
177
179
  }
178
180
 
179
- const stateMachine = await TXEStateMachine.create(store);
181
+ const archiver = new TXEArchiver(store);
182
+ const anchorBlockStore = new AnchorBlockStore(store);
183
+ const stateMachine = await TXEStateMachine.create(archiver, anchorBlockStore, contractStore, noteStore);
180
184
 
181
185
  const nextBlockTimestamp = BigInt(Math.floor(new Date().getTime() / 1000));
182
186
  const version = new Fr(await stateMachine.node.getVersion());
@@ -335,29 +339,30 @@ export class TXESession implements TXESessionStateHandler {
335
339
  const taggingIndexCache = new ExecutionTaggingIndexCache();
336
340
 
337
341
  const utilityExecutor = this.utilityExecutorForContractSync(anchorBlock);
338
- this.oracleHandler = new PrivateExecutionOracle(
339
- Fr.ZERO,
340
- new TxContext(this.chainId, this.version, GasSettings.empty()),
341
- new CallContext(AztecAddress.ZERO, contractAddress, FunctionSelector.empty(), false),
342
- anchorBlock!,
342
+ this.oracleHandler = new PrivateExecutionOracle({
343
+ argsHash: Fr.ZERO,
344
+ txContext: new TxContext(this.chainId, this.version, GasSettings.empty()),
345
+ callContext: new CallContext(AztecAddress.ZERO, contractAddress, FunctionSelector.empty(), false),
346
+ anchorBlockHeader: anchorBlock!,
343
347
  utilityExecutor,
344
- [],
345
- [],
346
- new HashedValuesCache(),
348
+ authWitnesses: [],
349
+ capsules: [],
350
+ executionCache: new HashedValuesCache(),
347
351
  noteCache,
348
352
  taggingIndexCache,
349
- this.contractStore,
350
- this.noteStore,
351
- this.keyStore,
352
- this.addressStore,
353
- this.stateMachine.node,
354
- this.senderTaggingStore,
355
- this.recipientTaggingStore,
356
- this.senderAddressBookStore,
357
- this.capsuleStore,
358
- this.privateEventStore,
359
- this.currentJobId,
360
- );
353
+ contractStore: this.contractStore,
354
+ noteStore: this.noteStore,
355
+ keyStore: this.keyStore,
356
+ addressStore: this.addressStore,
357
+ aztecNode: this.stateMachine.node,
358
+ senderTaggingStore: this.senderTaggingStore,
359
+ recipientTaggingStore: this.recipientTaggingStore,
360
+ senderAddressBookStore: this.senderAddressBookStore,
361
+ capsuleStore: this.capsuleStore,
362
+ privateEventStore: this.privateEventStore,
363
+ contractSyncService: this.stateMachine.contractSyncService,
364
+ jobId: this.currentJobId,
365
+ });
361
366
 
362
367
  // We store the note and tagging index caches fed into the PrivateExecutionOracle (along with some other auxiliary
363
368
  // data) in order to refer to it later, mimicking the way this object is used by the ContractFunctionSimulator. The
@@ -411,22 +416,22 @@ export class TXESession implements TXESessionStateHandler {
411
416
  this.currentJobId,
412
417
  ).syncNoteNullifiers(contractAddress);
413
418
 
414
- this.oracleHandler = new UtilityExecutionOracle(
419
+ this.oracleHandler = new UtilityExecutionOracle({
415
420
  contractAddress,
416
- [],
417
- [],
421
+ authWitnesses: [],
422
+ capsules: [],
418
423
  anchorBlockHeader,
419
- this.contractStore,
420
- this.noteStore,
421
- this.keyStore,
422
- this.addressStore,
423
- this.stateMachine.node,
424
- this.recipientTaggingStore,
425
- this.senderAddressBookStore,
426
- this.capsuleStore,
427
- this.privateEventStore,
428
- this.currentJobId,
429
- );
424
+ contractStore: this.contractStore,
425
+ noteStore: this.noteStore,
426
+ keyStore: this.keyStore,
427
+ addressStore: this.addressStore,
428
+ aztecNode: this.stateMachine.node,
429
+ recipientTaggingStore: this.recipientTaggingStore,
430
+ senderAddressBookStore: this.senderAddressBookStore,
431
+ capsuleStore: this.capsuleStore,
432
+ privateEventStore: this.privateEventStore,
433
+ jobId: this.currentJobId,
434
+ });
430
435
 
431
436
  this.state = { name: 'UTILITY' };
432
437
  this.logger.debug(`Entered state ${this.state.name}`);
@@ -501,22 +506,22 @@ export class TXESession implements TXESessionStateHandler {
501
506
  }
502
507
 
503
508
  try {
504
- const oracle = new UtilityExecutionOracle(
505
- call.to,
506
- [],
507
- [],
508
- anchorBlock!,
509
- this.contractStore,
510
- this.noteStore,
511
- this.keyStore,
512
- this.addressStore,
513
- this.stateMachine.node,
514
- this.recipientTaggingStore,
515
- this.senderAddressBookStore,
516
- this.capsuleStore,
517
- this.privateEventStore,
518
- this.currentJobId,
519
- );
509
+ const oracle = new UtilityExecutionOracle({
510
+ contractAddress: call.to,
511
+ authWitnesses: [],
512
+ capsules: [],
513
+ anchorBlockHeader: anchorBlock!,
514
+ contractStore: this.contractStore,
515
+ noteStore: this.noteStore,
516
+ keyStore: this.keyStore,
517
+ addressStore: this.addressStore,
518
+ aztecNode: this.stateMachine.node,
519
+ recipientTaggingStore: this.recipientTaggingStore,
520
+ senderAddressBookStore: this.senderAddressBookStore,
521
+ capsuleStore: this.capsuleStore,
522
+ privateEventStore: this.privateEventStore,
523
+ jobId: this.currentJobId,
524
+ });
520
525
  await new WASMSimulator()
521
526
  .executeUserCircuit(toACVMWitness(0, call.args), entryPointArtifact, new Oracle(oracle).toACIRCallback())
522
527
  .catch((err: Error) => {
@@ -87,7 +87,9 @@ export async function makeTXEBlock(
87
87
  const newArchiveInfo = await worldTrees.getTreeInfo(MerkleTreeId.ARCHIVE);
88
88
  const newArchive = new AppendOnlyTreeSnapshot(new Fr(newArchiveInfo.root), Number(newArchiveInfo.size));
89
89
 
90
- // L2Block requires checkpointNumber and indexWithinCheckpoint
90
+ // L2Block requires checkpointNumber and indexWithinCheckpoint.
91
+ // TXE uses 1-block-per-checkpoint for testing simplicity, so we can use block number as checkpoint number.
92
+ // This uses the deprecated fromBlockNumber method intentionally for the TXE testing environment.
91
93
  const checkpointNumber = CheckpointNumber.fromBlockNumber(globalVariables.blockNumber);
92
94
  const indexWithinCheckpoint = IndexWithinCheckpoint(0);
93
95