@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.
- package/dest/index.d.ts +1 -1
- package/dest/index.d.ts.map +1 -1
- package/dest/index.js +8 -6
- package/dest/oracle/interfaces.d.ts +29 -28
- package/dest/oracle/interfaces.d.ts.map +1 -1
- package/dest/oracle/txe_oracle_public_context.d.ts +13 -13
- package/dest/oracle/txe_oracle_public_context.d.ts.map +1 -1
- package/dest/oracle/txe_oracle_public_context.js +12 -12
- package/dest/oracle/txe_oracle_top_level_context.d.ts +21 -21
- package/dest/oracle/txe_oracle_top_level_context.d.ts.map +1 -1
- package/dest/oracle/txe_oracle_top_level_context.js +44 -34
- package/dest/rpc_translator.d.ts +82 -82
- package/dest/rpc_translator.d.ts.map +1 -1
- package/dest/rpc_translator.js +241 -148
- package/dest/state_machine/dummy_p2p_client.d.ts +2 -2
- package/dest/state_machine/dummy_p2p_client.d.ts.map +1 -1
- package/dest/state_machine/dummy_p2p_client.js +1 -1
- package/dest/txe_session.d.ts +6 -1
- package/dest/txe_session.d.ts.map +1 -1
- package/dest/txe_session.js +14 -7
- package/package.json +15 -15
- package/src/index.ts +8 -5
- package/src/oracle/interfaces.ts +32 -31
- package/src/oracle/txe_oracle_public_context.ts +12 -12
- package/src/oracle/txe_oracle_top_level_context.ts +56 -32
- package/src/rpc_translator.ts +254 -156
- package/src/state_machine/dummy_p2p_client.ts +1 -1
- package/src/txe_session.ts +19 -7
|
@@ -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
|
|
24
|
+
public validateTxsReceivedInBlockProposal(_txs: Tx[]): Promise<void> {
|
|
25
25
|
return Promise.resolve();
|
|
26
26
|
}
|
|
27
27
|
|
package/src/txe_session.ts
CHANGED
|
@@ -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.
|
|
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.
|
|
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 `
|
|
444
|
-
// `
|
|
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
|