@aztec/txe 3.0.0-nightly.20260104 → 3.0.0-nightly.20260106
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/constants.d.ts +3 -0
- package/dest/constants.d.ts.map +1 -0
- package/dest/constants.js +2 -0
- package/dest/oracle/txe_oracle_top_level_context.d.ts +15 -14
- package/dest/oracle/txe_oracle_top_level_context.d.ts.map +1 -1
- package/dest/oracle/txe_oracle_top_level_context.js +61 -53
- package/dest/state_machine/index.d.ts +4 -4
- package/dest/state_machine/index.d.ts.map +1 -1
- package/dest/state_machine/index.js +7 -7
- package/dest/txe_session.d.ts +15 -15
- package/dest/txe_session.d.ts.map +1 -1
- package/dest/txe_session.js +68 -49
- package/dest/util/txe_account_store.d.ts +10 -0
- package/dest/util/txe_account_store.d.ts.map +1 -0
- package/dest/util/{txe_account_data_provider.js → txe_account_store.js} +1 -1
- package/dest/util/txe_contract_store.d.ts +12 -0
- package/dest/util/txe_contract_store.d.ts.map +1 -0
- package/dest/util/{txe_contract_data_provider.js → txe_contract_store.js} +3 -3
- package/dest/util/txe_public_contract_data_source.d.ts +4 -4
- package/dest/util/txe_public_contract_data_source.d.ts.map +1 -1
- package/dest/util/txe_public_contract_data_source.js +10 -10
- package/package.json +15 -15
- package/src/constants.ts +3 -0
- package/src/index.ts +1 -1
- package/src/oracle/txe_oracle_top_level_context.ts +87 -70
- package/src/state_machine/index.ts +5 -5
- package/src/txe_session.ts +135 -86
- package/src/util/{txe_account_data_provider.ts → txe_account_store.ts} +1 -1
- package/src/util/{txe_contract_data_provider.ts → txe_contract_store.ts} +3 -3
- package/src/util/txe_public_contract_data_source.ts +9 -9
- package/dest/util/txe_account_data_provider.d.ts +0 -10
- package/dest/util/txe_account_data_provider.d.ts.map +0 -1
- package/dest/util/txe_contract_data_provider.d.ts +0 -12
- package/dest/util/txe_contract_data_provider.d.ts.map +0 -1
|
@@ -13,14 +13,14 @@ import { LogLevels, type Logger, applyStringFormatting, createLogger } from '@az
|
|
|
13
13
|
import { TestDateProvider } from '@aztec/foundation/timer';
|
|
14
14
|
import type { KeyStore } from '@aztec/key-store';
|
|
15
15
|
import {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
AddressStore,
|
|
17
|
+
CapsuleStore,
|
|
18
|
+
NoteStore,
|
|
19
19
|
ORACLE_VERSION,
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
20
|
+
PrivateEventStore,
|
|
21
|
+
RecipientTaggingStore,
|
|
22
|
+
SenderAddressBookStore,
|
|
23
|
+
SenderTaggingStore,
|
|
24
24
|
enrichPublicSimulationError,
|
|
25
25
|
} from '@aztec/pxe/server';
|
|
26
26
|
import {
|
|
@@ -49,7 +49,7 @@ import {
|
|
|
49
49
|
PublicContractsDB,
|
|
50
50
|
PublicProcessor,
|
|
51
51
|
} from '@aztec/simulator/server';
|
|
52
|
-
import { type ContractArtifact, EventSelector, FunctionSelector, FunctionType } from '@aztec/stdlib/abi';
|
|
52
|
+
import { type ContractArtifact, EventSelector, FunctionCall, FunctionSelector, FunctionType } from '@aztec/stdlib/abi';
|
|
53
53
|
import { AuthWitness } from '@aztec/stdlib/auth-witness';
|
|
54
54
|
import { PublicSimulatorConfig } from '@aztec/stdlib/avm';
|
|
55
55
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
@@ -80,10 +80,10 @@ import {
|
|
|
80
80
|
import type { UInt64 } from '@aztec/stdlib/types';
|
|
81
81
|
import { ForkCheckpoint } from '@aztec/world-state';
|
|
82
82
|
|
|
83
|
+
import { DEFAULT_ADDRESS } from '../constants.js';
|
|
83
84
|
import type { TXEStateMachine } from '../state_machine/index.js';
|
|
84
|
-
import {
|
|
85
|
-
import type {
|
|
86
|
-
import type { TXEContractDataProvider } from '../util/txe_contract_data_provider.js';
|
|
85
|
+
import type { TXEAccountStore } from '../util/txe_account_store.js';
|
|
86
|
+
import type { TXEContractStore } from '../util/txe_contract_store.js';
|
|
87
87
|
import { TXEPublicContractDataSource } from '../util/txe_public_contract_data_source.js';
|
|
88
88
|
import { getSingleTxBlockRequestHash, insertTxEffectIntoWorldTrees, makeTXEBlock } from '../utils/block_creation.js';
|
|
89
89
|
import type { ITxeExecutionOracle } from './interfaces.js';
|
|
@@ -96,16 +96,16 @@ export class TXEOracleTopLevelContext implements IMiscOracle, ITxeExecutionOracl
|
|
|
96
96
|
|
|
97
97
|
constructor(
|
|
98
98
|
private stateMachine: TXEStateMachine,
|
|
99
|
-
private
|
|
100
|
-
private
|
|
99
|
+
private contractStore: TXEContractStore,
|
|
100
|
+
private noteStore: NoteStore,
|
|
101
101
|
private keyStore: KeyStore,
|
|
102
|
-
private
|
|
103
|
-
private
|
|
104
|
-
private
|
|
105
|
-
private
|
|
106
|
-
private
|
|
107
|
-
private
|
|
108
|
-
private
|
|
102
|
+
private addressStore: AddressStore,
|
|
103
|
+
private accountStore: TXEAccountStore,
|
|
104
|
+
private senderTaggingStore: SenderTaggingStore,
|
|
105
|
+
private recipientTaggingStore: RecipientTaggingStore,
|
|
106
|
+
private senderAddressBookStore: SenderAddressBookStore,
|
|
107
|
+
private capsuleStore: CapsuleStore,
|
|
108
|
+
private privateEventStore: PrivateEventStore,
|
|
109
109
|
private nextBlockTimestamp: bigint,
|
|
110
110
|
private version: Fr,
|
|
111
111
|
private chainId: Fr,
|
|
@@ -170,7 +170,7 @@ export class TXEOracleTopLevelContext implements IMiscOracle, ITxeExecutionOracl
|
|
|
170
170
|
|
|
171
171
|
async txeGetPrivateEvents(selector: EventSelector, contractAddress: AztecAddress, scope: AztecAddress) {
|
|
172
172
|
return (
|
|
173
|
-
await this.
|
|
173
|
+
await this.privateEventStore.getPrivateEvents(selector, {
|
|
174
174
|
contractAddress,
|
|
175
175
|
scopes: [scope],
|
|
176
176
|
fromBlock: 0,
|
|
@@ -206,8 +206,8 @@ export class TXEOracleTopLevelContext implements IMiscOracle, ITxeExecutionOracl
|
|
|
206
206
|
if (!secret.equals(Fr.ZERO)) {
|
|
207
207
|
await this.txeAddAccount(artifact, instance, secret);
|
|
208
208
|
} else {
|
|
209
|
-
await this.
|
|
210
|
-
await this.
|
|
209
|
+
await this.contractStore.addContractInstance(instance);
|
|
210
|
+
await this.contractStore.addContractArtifact(instance.currentContractClassId, artifact);
|
|
211
211
|
this.logger.debug(`Deployed ${artifact.name} at ${instance.address}`);
|
|
212
212
|
}
|
|
213
213
|
}
|
|
@@ -216,12 +216,12 @@ export class TXEOracleTopLevelContext implements IMiscOracle, ITxeExecutionOracl
|
|
|
216
216
|
const partialAddress = await computePartialAddress(instance);
|
|
217
217
|
|
|
218
218
|
this.logger.debug(`Deployed ${artifact.name} at ${instance.address}`);
|
|
219
|
-
await this.
|
|
220
|
-
await this.
|
|
219
|
+
await this.contractStore.addContractInstance(instance);
|
|
220
|
+
await this.contractStore.addContractArtifact(instance.currentContractClassId, artifact);
|
|
221
221
|
|
|
222
222
|
const completeAddress = await this.keyStore.addAccount(secret, partialAddress);
|
|
223
|
-
await this.
|
|
224
|
-
await this.
|
|
223
|
+
await this.accountStore.setAccount(completeAddress.address, completeAddress);
|
|
224
|
+
await this.addressStore.addCompleteAddress(completeAddress);
|
|
225
225
|
this.logger.debug(`Created account ${completeAddress.address}`);
|
|
226
226
|
|
|
227
227
|
return completeAddress;
|
|
@@ -230,15 +230,15 @@ export class TXEOracleTopLevelContext implements IMiscOracle, ITxeExecutionOracl
|
|
|
230
230
|
async txeCreateAccount(secret: Fr) {
|
|
231
231
|
// This is a foot gun !
|
|
232
232
|
const completeAddress = await this.keyStore.addAccount(secret, secret);
|
|
233
|
-
await this.
|
|
234
|
-
await this.
|
|
233
|
+
await this.accountStore.setAccount(completeAddress.address, completeAddress);
|
|
234
|
+
await this.addressStore.addCompleteAddress(completeAddress);
|
|
235
235
|
this.logger.debug(`Created account ${completeAddress.address}`);
|
|
236
236
|
|
|
237
237
|
return completeAddress;
|
|
238
238
|
}
|
|
239
239
|
|
|
240
240
|
async txeAddAuthWitness(address: AztecAddress, messageHash: Fr) {
|
|
241
|
-
const account = await this.
|
|
241
|
+
const account = await this.accountStore.getAccount(address);
|
|
242
242
|
const privateKey = await this.keyStore.getMasterSecretKey(account.publicKeys.masterIncomingViewingPublicKey);
|
|
243
243
|
|
|
244
244
|
const schnorr = new Schnorr();
|
|
@@ -283,10 +283,10 @@ export class TXEOracleTopLevelContext implements IMiscOracle, ITxeExecutionOracl
|
|
|
283
283
|
isStaticCall: boolean = false,
|
|
284
284
|
) {
|
|
285
285
|
this.logger.verbose(
|
|
286
|
-
`Executing external function ${await this.
|
|
286
|
+
`Executing external function ${await this.contractStore.getDebugFunctionName(targetContractAddress, functionSelector)}@${targetContractAddress} isStaticCall=${isStaticCall}`,
|
|
287
287
|
);
|
|
288
288
|
|
|
289
|
-
const artifact = await this.
|
|
289
|
+
const artifact = await this.contractStore.getFunctionArtifact(targetContractAddress, functionSelector);
|
|
290
290
|
if (!artifact) {
|
|
291
291
|
const message = functionSelector.equals(await FunctionSelector.fromSignature('verify_private_authwit(Field)'))
|
|
292
292
|
? 'Found no account contract artifact for a private authwit check - use `create_contract_account` instead of `create_light_account` for authwit support.'
|
|
@@ -294,19 +294,24 @@ export class TXEOracleTopLevelContext implements IMiscOracle, ITxeExecutionOracl
|
|
|
294
294
|
throw new Error(message);
|
|
295
295
|
}
|
|
296
296
|
|
|
297
|
+
// Sync notes before executing private function to discover notes from previous transactions
|
|
298
|
+
const utilityExecutor = async (call: FunctionCall) => {
|
|
299
|
+
await this.executeUtilityCall(call);
|
|
300
|
+
};
|
|
301
|
+
|
|
302
|
+
await this.contractStore.syncPrivateState(targetContractAddress, functionSelector, utilityExecutor);
|
|
303
|
+
|
|
297
304
|
const blockNumber = await this.txeGetNextBlockNumber();
|
|
298
305
|
|
|
299
306
|
const callContext = new CallContext(from, targetContractAddress, functionSelector, isStaticCall);
|
|
300
307
|
|
|
301
308
|
const gasLimits = new Gas(DEFAULT_DA_GAS_LIMIT, DEFAULT_L2_GAS_LIMIT);
|
|
302
|
-
|
|
303
309
|
const teardownGasLimits = new Gas(DEFAULT_TEARDOWN_DA_GAS_LIMIT, DEFAULT_TEARDOWN_L2_GAS_LIMIT);
|
|
304
|
-
|
|
305
310
|
const gasSettings = new GasSettings(gasLimits, teardownGasLimits, GasFees.empty(), GasFees.empty());
|
|
306
311
|
|
|
307
312
|
const txContext = new TxContext(this.chainId, this.version, gasSettings);
|
|
308
313
|
|
|
309
|
-
const blockHeader = await this.stateMachine.
|
|
314
|
+
const blockHeader = await this.stateMachine.anchorBlockStore.getBlockHeader();
|
|
310
315
|
|
|
311
316
|
const protocolNullifier = await computeProtocolNullifier(getSingleTxBlockRequestHash(blockNumber));
|
|
312
317
|
const noteCache = new ExecutionNoteCache(protocolNullifier);
|
|
@@ -320,6 +325,7 @@ export class TXEOracleTopLevelContext implements IMiscOracle, ITxeExecutionOracl
|
|
|
320
325
|
callContext,
|
|
321
326
|
/** Header of a block whose state is used during private execution (not the block the transaction is included in). */
|
|
322
327
|
blockHeader,
|
|
328
|
+
utilityExecutor,
|
|
323
329
|
/** List of transient auth witnesses to be used during this simulation */
|
|
324
330
|
Array.from(this.authwits.values()),
|
|
325
331
|
/** List of transient auth witnesses to be used during this simulation */
|
|
@@ -327,17 +333,17 @@ export class TXEOracleTopLevelContext implements IMiscOracle, ITxeExecutionOracl
|
|
|
327
333
|
HashedValuesCache.create([new HashedValues(args, argsHash)]),
|
|
328
334
|
noteCache,
|
|
329
335
|
taggingIndexCache,
|
|
330
|
-
this.
|
|
331
|
-
this.
|
|
336
|
+
this.contractStore,
|
|
337
|
+
this.noteStore,
|
|
332
338
|
this.keyStore,
|
|
333
|
-
this.
|
|
339
|
+
this.addressStore,
|
|
334
340
|
this.stateMachine.node,
|
|
335
|
-
this.stateMachine.
|
|
336
|
-
this.
|
|
337
|
-
this.
|
|
338
|
-
this.
|
|
339
|
-
this.
|
|
340
|
-
this.
|
|
341
|
+
this.stateMachine.anchorBlockStore,
|
|
342
|
+
this.senderTaggingStore,
|
|
343
|
+
this.recipientTaggingStore,
|
|
344
|
+
this.senderAddressBookStore,
|
|
345
|
+
this.capsuleStore,
|
|
346
|
+
this.privateEventStore,
|
|
341
347
|
0,
|
|
342
348
|
1,
|
|
343
349
|
undefined, // log
|
|
@@ -387,7 +393,7 @@ export class TXEOracleTopLevelContext implements IMiscOracle, ITxeExecutionOracl
|
|
|
387
393
|
// can either be the first nullifier in the tx or the hash of the initial tx request
|
|
388
394
|
// if there are none.
|
|
389
395
|
const nonceGenerator = result.firstNullifier.equals(Fr.ZERO) ? protocolNullifier : result.firstNullifier;
|
|
390
|
-
const { publicInputs } = await generateSimulatedProvingResult(result, nonceGenerator, this.
|
|
396
|
+
const { publicInputs } = await generateSimulatedProvingResult(result, nonceGenerator, this.contractStore);
|
|
391
397
|
|
|
392
398
|
const globals = makeGlobalVariables();
|
|
393
399
|
globals.blockNumber = blockNumber;
|
|
@@ -398,7 +404,7 @@ export class TXEOracleTopLevelContext implements IMiscOracle, ITxeExecutionOracl
|
|
|
398
404
|
|
|
399
405
|
const forkedWorldTrees = await this.stateMachine.synchronizer.nativeWorldStateService.fork();
|
|
400
406
|
|
|
401
|
-
const contractsDB = new PublicContractsDB(new TXEPublicContractDataSource(blockNumber, this.
|
|
407
|
+
const contractsDB = new PublicContractsDB(new TXEPublicContractDataSource(blockNumber, this.contractStore));
|
|
402
408
|
const guardedMerkleTrees = new GuardedMerkleTreeOperations(forkedWorldTrees);
|
|
403
409
|
const config = PublicSimulatorConfig.from({
|
|
404
410
|
skipFeeEnforcement: true,
|
|
@@ -437,7 +443,7 @@ export class TXEOracleTopLevelContext implements IMiscOracle, ITxeExecutionOracl
|
|
|
437
443
|
} else if (!processedTx.revertCode.isOK()) {
|
|
438
444
|
if (processedTx.revertReason) {
|
|
439
445
|
try {
|
|
440
|
-
await enrichPublicSimulationError(processedTx.revertReason, this.
|
|
446
|
+
await enrichPublicSimulationError(processedTx.revertReason, this.contractStore, this.logger);
|
|
441
447
|
// eslint-disable-next-line no-empty
|
|
442
448
|
} catch {}
|
|
443
449
|
throw new Error(`Contract execution has reverted: ${processedTx.revertReason.getMessage()}`);
|
|
@@ -482,7 +488,7 @@ export class TXEOracleTopLevelContext implements IMiscOracle, ITxeExecutionOracl
|
|
|
482
488
|
isStaticCall: boolean,
|
|
483
489
|
) {
|
|
484
490
|
this.logger.verbose(
|
|
485
|
-
`Executing public function ${await this.
|
|
491
|
+
`Executing public function ${await this.contractStore.getDebugFunctionName(targetContractAddress, FunctionSelector.fromField(calldata[0]))}@${targetContractAddress} isStaticCall=${isStaticCall}`,
|
|
486
492
|
);
|
|
487
493
|
|
|
488
494
|
const blockNumber = await this.txeGetNextBlockNumber();
|
|
@@ -495,7 +501,7 @@ export class TXEOracleTopLevelContext implements IMiscOracle, ITxeExecutionOracl
|
|
|
495
501
|
|
|
496
502
|
const txContext = new TxContext(this.chainId, this.version, gasSettings);
|
|
497
503
|
|
|
498
|
-
const anchorBlockHeader = await this.stateMachine.
|
|
504
|
+
const anchorBlockHeader = await this.stateMachine.anchorBlockStore.getBlockHeader();
|
|
499
505
|
|
|
500
506
|
const calldataHash = await computeCalldataHash(calldata);
|
|
501
507
|
const calldataHashedValues = new HashedValues(calldata, calldataHash);
|
|
@@ -509,7 +515,7 @@ export class TXEOracleTopLevelContext implements IMiscOracle, ITxeExecutionOracl
|
|
|
509
515
|
|
|
510
516
|
const forkedWorldTrees = await this.stateMachine.synchronizer.nativeWorldStateService.fork();
|
|
511
517
|
|
|
512
|
-
const contractsDB = new PublicContractsDB(new TXEPublicContractDataSource(blockNumber, this.
|
|
518
|
+
const contractsDB = new PublicContractsDB(new TXEPublicContractDataSource(blockNumber, this.contractStore));
|
|
513
519
|
const guardedMerkleTrees = new GuardedMerkleTreeOperations(forkedWorldTrees);
|
|
514
520
|
const config = PublicSimulatorConfig.from({
|
|
515
521
|
skipFeeEnforcement: true,
|
|
@@ -577,7 +583,7 @@ export class TXEOracleTopLevelContext implements IMiscOracle, ITxeExecutionOracl
|
|
|
577
583
|
} else if (!processedTx.revertCode.isOK()) {
|
|
578
584
|
if (processedTx.revertReason) {
|
|
579
585
|
try {
|
|
580
|
-
await enrichPublicSimulationError(processedTx.revertReason, this.
|
|
586
|
+
await enrichPublicSimulationError(processedTx.revertReason, this.contractStore, this.logger);
|
|
581
587
|
// eslint-disable-next-line no-empty
|
|
582
588
|
} catch {}
|
|
583
589
|
throw new Error(`Contract execution has reverted: ${processedTx.revertReason.getMessage()}`);
|
|
@@ -623,21 +629,32 @@ export class TXEOracleTopLevelContext implements IMiscOracle, ITxeExecutionOracl
|
|
|
623
629
|
functionSelector: FunctionSelector,
|
|
624
630
|
args: Fr[],
|
|
625
631
|
) {
|
|
626
|
-
const artifact = await this.
|
|
632
|
+
const artifact = await this.contractStore.getFunctionArtifact(targetContractAddress, functionSelector);
|
|
627
633
|
if (!artifact) {
|
|
628
634
|
throw new Error(`Cannot call ${functionSelector} as there is no artifact found at ${targetContractAddress}.`);
|
|
629
635
|
}
|
|
630
636
|
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
};
|
|
637
|
+
// Sync notes before executing utility function to discover notes from previous transactions
|
|
638
|
+
await this.contractStore.syncPrivateState(targetContractAddress, functionSelector, async call => {
|
|
639
|
+
await this.executeUtilityCall(call);
|
|
640
|
+
});
|
|
636
641
|
|
|
637
|
-
const
|
|
638
|
-
|
|
639
|
-
|
|
642
|
+
const call = new FunctionCall(
|
|
643
|
+
artifact.name,
|
|
644
|
+
targetContractAddress,
|
|
645
|
+
functionSelector,
|
|
646
|
+
FunctionType.UTILITY,
|
|
647
|
+
false,
|
|
648
|
+
false,
|
|
649
|
+
args,
|
|
650
|
+
[],
|
|
640
651
|
);
|
|
652
|
+
|
|
653
|
+
return this.executeUtilityCall(call);
|
|
654
|
+
}
|
|
655
|
+
|
|
656
|
+
private async executeUtilityCall(call: FunctionCall): Promise<Fr[]> {
|
|
657
|
+
const entryPointArtifact = await this.contractStore.getFunctionArtifactWithDebugMetadata(call.to, call.selector);
|
|
641
658
|
if (entryPointArtifact.functionType !== FunctionType.UTILITY) {
|
|
642
659
|
throw new Error(`Cannot run ${entryPointArtifact.functionType} function as utility`);
|
|
643
660
|
}
|
|
@@ -648,25 +665,25 @@ export class TXEOracleTopLevelContext implements IMiscOracle, ITxeExecutionOracl
|
|
|
648
665
|
});
|
|
649
666
|
|
|
650
667
|
try {
|
|
651
|
-
const anchorBlockHeader = await this.stateMachine.
|
|
668
|
+
const anchorBlockHeader = await this.stateMachine.anchorBlockStore.getBlockHeader();
|
|
652
669
|
const oracle = new UtilityExecutionOracle(
|
|
653
670
|
call.to,
|
|
654
671
|
[],
|
|
655
672
|
[],
|
|
656
673
|
anchorBlockHeader,
|
|
657
|
-
this.
|
|
658
|
-
this.
|
|
674
|
+
this.contractStore,
|
|
675
|
+
this.noteStore,
|
|
659
676
|
this.keyStore,
|
|
660
|
-
this.
|
|
677
|
+
this.addressStore,
|
|
661
678
|
this.stateMachine.node,
|
|
662
|
-
this.stateMachine.
|
|
663
|
-
this.
|
|
664
|
-
this.
|
|
665
|
-
this.
|
|
666
|
-
this.
|
|
679
|
+
this.stateMachine.anchorBlockStore,
|
|
680
|
+
this.recipientTaggingStore,
|
|
681
|
+
this.senderAddressBookStore,
|
|
682
|
+
this.capsuleStore,
|
|
683
|
+
this.privateEventStore,
|
|
667
684
|
);
|
|
668
685
|
const acirExecutionResult = await new WASMSimulator()
|
|
669
|
-
.executeUserCircuit(toACVMWitness(0, args), entryPointArtifact, new Oracle(oracle).toACIRCallback())
|
|
686
|
+
.executeUserCircuit(toACVMWitness(0, call.args), entryPointArtifact, new Oracle(oracle).toACIRCallback())
|
|
670
687
|
.catch((err: Error) => {
|
|
671
688
|
err.message = resolveAssertionMessageFromError(err, entryPointArtifact);
|
|
672
689
|
throw new ExecutionError(
|
|
@@ -2,7 +2,7 @@ import { type AztecNodeConfig, AztecNodeService } from '@aztec/aztec-node';
|
|
|
2
2
|
import { TestCircuitVerifier } from '@aztec/bb-prover/test';
|
|
3
3
|
import { createLogger } from '@aztec/foundation/log';
|
|
4
4
|
import type { AztecAsyncKVStore } from '@aztec/kv-store';
|
|
5
|
-
import {
|
|
5
|
+
import { AnchorBlockStore } from '@aztec/pxe/server';
|
|
6
6
|
import { L2Block } from '@aztec/stdlib/block';
|
|
7
7
|
import { L1PublishedData, PublishedCheckpoint } from '@aztec/stdlib/checkpoint';
|
|
8
8
|
import type { AztecNode } from '@aztec/stdlib/interfaces/client';
|
|
@@ -22,13 +22,13 @@ export class TXEStateMachine {
|
|
|
22
22
|
public node: AztecNode,
|
|
23
23
|
public synchronizer: TXESynchronizer,
|
|
24
24
|
public archiver: TXEArchiver,
|
|
25
|
-
public
|
|
25
|
+
public anchorBlockStore: AnchorBlockStore,
|
|
26
26
|
) {}
|
|
27
27
|
|
|
28
28
|
public static async create(db: AztecAsyncKVStore) {
|
|
29
29
|
const archiver = new TXEArchiver(db);
|
|
30
30
|
const synchronizer = await TXESynchronizer.create();
|
|
31
|
-
const
|
|
31
|
+
const anchorBlockStore = new AnchorBlockStore(db);
|
|
32
32
|
|
|
33
33
|
const aztecNodeConfig = {} as AztecNodeConfig;
|
|
34
34
|
|
|
@@ -55,7 +55,7 @@ export class TXEStateMachine {
|
|
|
55
55
|
log,
|
|
56
56
|
);
|
|
57
57
|
|
|
58
|
-
return new this(node, synchronizer, archiver,
|
|
58
|
+
return new this(node, synchronizer, archiver, anchorBlockStore);
|
|
59
59
|
}
|
|
60
60
|
|
|
61
61
|
public async handleL2Block(block: L2Block) {
|
|
@@ -72,7 +72,7 @@ export class TXEStateMachine {
|
|
|
72
72
|
await Promise.all([
|
|
73
73
|
this.synchronizer.handleL2Block(block.toL2Block()),
|
|
74
74
|
this.archiver.addCheckpoints([publishedCheckpoint], undefined),
|
|
75
|
-
this.
|
|
75
|
+
this.anchorBlockStore.setHeader(block.getBlockHeader()),
|
|
76
76
|
]);
|
|
77
77
|
}
|
|
78
78
|
}
|