@aztec/txe 4.1.0-rc.3 → 4.2.0-nightly.20260319

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.
@@ -4,6 +4,7 @@ import { CheckpointNumber } from '@aztec/foundation/branded-types';
4
4
  import { Fr } from '@aztec/foundation/curves/bn254';
5
5
  import { createLogger } from '@aztec/foundation/log';
6
6
  import { type AnchorBlockStore, type ContractStore, ContractSyncService, type NoteStore } from '@aztec/pxe/server';
7
+ import { MessageContextService } from '@aztec/pxe/simulator';
7
8
  import { L2Block } from '@aztec/stdlib/block';
8
9
  import { Checkpoint, L1PublishedData, PublishedCheckpoint } from '@aztec/stdlib/checkpoint';
9
10
  import type { AztecNode } from '@aztec/stdlib/interfaces/client';
@@ -26,6 +27,7 @@ export class TXEStateMachine {
26
27
  public archiver: TXEArchiver,
27
28
  public anchorBlockStore: AnchorBlockStore,
28
29
  public contractSyncService: ContractSyncService,
30
+ public messageContextService: MessageContextService,
29
31
  ) {}
30
32
 
31
33
  public static async create(
@@ -68,7 +70,9 @@ export class TXEStateMachine {
68
70
  createLogger('txe:contract_sync'),
69
71
  );
70
72
 
71
- return new this(node, synchronizer, archiver, anchorBlockStore, contractSyncService);
73
+ const messageContextService = new MessageContextService(node);
74
+
75
+ return new this(node, synchronizer, archiver, anchorBlockStore, contractSyncService, messageContextService);
72
76
  }
73
77
 
74
78
  public async handleL2Block(block: L2Block) {
@@ -1,7 +1,7 @@
1
1
  import { NUMBER_OF_L1_L2_MESSAGES_PER_ROLLUP } from '@aztec/constants';
2
2
  import { BlockNumber } from '@aztec/foundation/branded-types';
3
3
  import { Fr } from '@aztec/foundation/curves/bn254';
4
- import type { L2Block } from '@aztec/stdlib/block';
4
+ import type { BlockHash, L2Block } from '@aztec/stdlib/block';
5
5
  import type {
6
6
  MerkleTreeReadOperations,
7
7
  MerkleTreeWriteOperations,
@@ -33,12 +33,12 @@ export class TXESynchronizer implements WorldStateSynchronizer {
33
33
  }
34
34
 
35
35
  /**
36
- * Forces an immediate sync to an optionally provided minimum block number
36
+ * Forces an immediate sync to an optionally provided minimum block number.
37
37
  * @param targetBlockNumber - The target block number that we must sync to. Will download unproven blocks if needed to reach it.
38
- * @param skipThrowIfTargetNotReached - Whether to skip throwing if the target block number is not reached.
38
+ * @param blockHash - If provided, verifies the block at targetBlockNumber matches this hash.
39
39
  * @returns A promise that resolves with the block number the world state was synced to
40
40
  */
41
- public syncImmediate(_minBlockNumber?: BlockNumber, _skipThrowIfTargetNotReached?: boolean): Promise<BlockNumber> {
41
+ public syncImmediate(_minBlockNumber?: BlockNumber, _blockHash?: BlockHash): Promise<BlockNumber> {
42
42
  return Promise.resolve(this.blockNumber);
43
43
  }
44
44
 
@@ -202,7 +202,7 @@ export class TXESession implements TXESessionStateHandler {
202
202
  chainId,
203
203
  new Map(),
204
204
  );
205
- await topLevelOracleHandler.txeAdvanceBlocksBy(1);
205
+ await topLevelOracleHandler.advanceBlocksBy(1);
206
206
 
207
207
  return new TXESession(
208
208
  createLogger('txe:session'),
@@ -369,6 +369,7 @@ export class TXESession implements TXESessionStateHandler {
369
369
  contractSyncService: this.stateMachine.contractSyncService,
370
370
  jobId: this.currentJobId,
371
371
  scopes: 'ALL_SCOPES',
372
+ messageContextService: this.stateMachine.messageContextService,
372
373
  });
373
374
 
374
375
  // We store the note and tagging index caches fed into the PrivateExecutionOracle (along with some other auxiliary
@@ -437,6 +438,7 @@ export class TXESession implements TXESessionStateHandler {
437
438
  senderAddressBookStore: this.senderAddressBookStore,
438
439
  capsuleStore: this.capsuleStore,
439
440
  privateEventStore: this.privateEventStore,
441
+ messageContextService: this.stateMachine.messageContextService,
440
442
  jobId: this.currentJobId,
441
443
  scopes: 'ALL_SCOPES',
442
444
  });
@@ -452,8 +454,8 @@ export class TXESession implements TXESessionStateHandler {
452
454
 
453
455
  // Note that while all public and private contexts do is build a single block that we then process when exiting
454
456
  // those, the top level context performs a large number of actions not captured in the following 'close' call. Among
455
- // others, it will create empty blocks (via `txeAdvanceBlocksBy` and `deploy`), create blocks with transactions via
456
- // `txePrivateCallNewFlow` and `txePublicCallNewFlow`, add accounts to PXE via `txeAddAccount`, etc. This is a
457
+ // others, it will create empty blocks (via `advanceBlocksBy` and `deploy`), create blocks with transactions via
458
+ // `privateCallNewFlow` and `publicCallNewFlow`, add accounts to PXE via `addAccount`, etc. This is a
457
459
  // slight inconsistency in the working model of this class, but is not too bad.
458
460
  // TODO: it's quite unfortunate that we need to capture the authwits created to later pass them again when the top
459
461
  // level context is re-created. This is because authwits create a temporary utility context that'd otherwise reset
@@ -528,6 +530,7 @@ export class TXESession implements TXESessionStateHandler {
528
530
  senderAddressBookStore: this.senderAddressBookStore,
529
531
  capsuleStore: this.capsuleStore,
530
532
  privateEventStore: this.privateEventStore,
533
+ messageContextService: this.stateMachine.messageContextService,
531
534
  jobId: this.currentJobId,
532
535
  scopes,
533
536
  });