@aztec/txe 0.0.1-commit.ff7989d6c → 0.0.1-commit.ffe5b04ea

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.
@@ -21,7 +21,7 @@ import type { BlockProposal, CheckpointAttestation, CheckpointProposal, TopicTyp
21
21
  import type { BlockHeader, Tx, TxHash } from '@aztec/stdlib/tx';
22
22
 
23
23
  export class DummyP2P implements P2P {
24
- public validate(_txs: Tx[]): Promise<void> {
24
+ public validateTxsReceivedInBlockProposal(_txs: Tx[]): Promise<void> {
25
25
  return Promise.resolve();
26
26
  }
27
27
 
@@ -113,6 +113,10 @@ export interface TXESessionStateHandler {
113
113
  enterPublicState(contractAddress?: AztecAddress): Promise<void>;
114
114
  enterPrivateState(contractAddress?: AztecAddress, anchorBlockNumber?: BlockNumber): Promise<PrivateContextInputs>;
115
115
  enterUtilityState(contractAddress?: AztecAddress): Promise<void>;
116
+
117
+ // TODO(F-335): Exposing the job info is abstraction breakage - drop the following 2 functions.
118
+ cycleJob(): Promise<string>;
119
+ getCurrentJob(): string;
116
120
  }
117
121
 
118
122
  /**
@@ -193,13 +197,12 @@ export class TXESession implements TXESessionStateHandler {
193
197
  senderAddressBookStore,
194
198
  capsuleStore,
195
199
  privateEventStore,
196
- initialJobId,
197
200
  nextBlockTimestamp,
198
201
  version,
199
202
  chainId,
200
203
  new Map(),
201
204
  );
202
- await topLevelOracleHandler.txeAdvanceBlocksBy(1);
205
+ await topLevelOracleHandler.advanceBlocksBy(1);
203
206
 
204
207
  return new TXESession(
205
208
  createLogger('txe:session'),
@@ -254,6 +257,17 @@ export class TXESession implements TXESessionStateHandler {
254
257
  }
255
258
  }
256
259
 
260
+ getCurrentJob(): string {
261
+ return this.currentJobId;
262
+ }
263
+
264
+ /** Commits the current job and begins a new one. Returns the new job ID. */
265
+ async cycleJob(): Promise<string> {
266
+ await this.jobCoordinator.commitJob(this.currentJobId);
267
+ this.currentJobId = this.jobCoordinator.beginJob();
268
+ return this.currentJobId;
269
+ }
270
+
257
271
  async enterTopLevelState() {
258
272
  switch (this.state.name) {
259
273
  case 'PRIVATE': {
@@ -277,8 +291,7 @@ export class TXESession implements TXESessionStateHandler {
277
291
  }
278
292
 
279
293
  // Commit all staged stores from the job that was just completed, then begin a new job
280
- await this.jobCoordinator.commitJob(this.currentJobId);
281
- this.currentJobId = this.jobCoordinator.beginJob();
294
+ await this.cycleJob();
282
295
 
283
296
  this.oracleHandler = new TXEOracleTopLevelContext(
284
297
  this.stateMachine,
@@ -292,7 +305,6 @@ export class TXESession implements TXESessionStateHandler {
292
305
  this.senderAddressBookStore,
293
306
  this.capsuleStore,
294
307
  this.privateEventStore,
295
- this.currentJobId,
296
308
  this.nextBlockTimestamp,
297
309
  this.version,
298
310
  this.chainId,
@@ -440,8 +452,8 @@ export class TXESession implements TXESessionStateHandler {
440
452
 
441
453
  // Note that while all public and private contexts do is build a single block that we then process when exiting
442
454
  // those, the top level context performs a large number of actions not captured in the following 'close' call. Among
443
- // others, it will create empty blocks (via `txeAdvanceBlocksBy` and `deploy`), create blocks with transactions via
444
- // `txePrivateCallNewFlow` and `txePublicCallNewFlow`, add accounts to PXE via `txeAddAccount`, etc. This is a
455
+ // others, it will create empty blocks (via `advanceBlocksBy` and `deploy`), create blocks with transactions via
456
+ // `privateCallNewFlow` and `publicCallNewFlow`, add accounts to PXE via `addAccount`, etc. This is a
445
457
  // slight inconsistency in the working model of this class, but is not too bad.
446
458
  // TODO: it's quite unfortunate that we need to capture the authwits created to later pass them again when the top
447
459
  // level context is re-created. This is because authwits create a temporary utility context that'd otherwise reset