@aztec/txe 0.0.1-commit.d431d1c → 0.0.1-commit.e310a4c8
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/oracle/interfaces.d.ts +3 -3
- package/dest/oracle/interfaces.d.ts.map +1 -1
- package/dest/oracle/txe_oracle_public_context.d.ts +5 -5
- package/dest/oracle/txe_oracle_public_context.d.ts.map +1 -1
- package/dest/oracle/txe_oracle_public_context.js +6 -6
- package/dest/oracle/txe_oracle_top_level_context.d.ts +1 -1
- package/dest/oracle/txe_oracle_top_level_context.d.ts.map +1 -1
- package/dest/oracle/txe_oracle_top_level_context.js +12 -10
- package/dest/rpc_translator.d.ts +11 -5
- package/dest/rpc_translator.d.ts.map +1 -1
- package/dest/rpc_translator.js +36 -24
- package/dest/state_machine/archiver.d.ts +2 -2
- package/dest/state_machine/archiver.d.ts.map +1 -1
- package/dest/state_machine/archiver.js +5 -6
- package/dest/state_machine/index.d.ts +3 -3
- package/dest/state_machine/index.d.ts.map +1 -1
- package/dest/state_machine/index.js +18 -9
- package/dest/state_machine/mock_epoch_cache.d.ts +4 -2
- package/dest/state_machine/mock_epoch_cache.d.ts.map +1 -1
- package/dest/state_machine/mock_epoch_cache.js +2 -1
- package/dest/state_machine/synchronizer.d.ts +3 -3
- package/dest/state_machine/synchronizer.d.ts.map +1 -1
- package/dest/txe_session.d.ts +1 -1
- package/dest/txe_session.d.ts.map +1 -1
- package/dest/txe_session.js +9 -8
- package/dest/utils/block_creation.d.ts +5 -5
- package/dest/utils/block_creation.d.ts.map +1 -1
- package/dest/utils/block_creation.js +5 -5
- package/package.json +15 -15
- package/src/oracle/interfaces.ts +2 -2
- package/src/oracle/txe_oracle_public_context.ts +8 -10
- package/src/oracle/txe_oracle_top_level_context.ts +26 -9
- package/src/rpc_translator.ts +44 -23
- package/src/state_machine/archiver.ts +4 -8
- package/src/state_machine/index.ts +26 -12
- package/src/state_machine/mock_epoch_cache.ts +2 -1
- package/src/state_machine/synchronizer.ts +2 -2
- package/src/txe_session.ts +16 -14
- package/src/utils/block_creation.ts +6 -6
package/src/rpc_translator.ts
CHANGED
|
@@ -10,8 +10,7 @@ import {
|
|
|
10
10
|
} from '@aztec/pxe/simulator';
|
|
11
11
|
import { type ContractArtifact, EventSelector, FunctionSelector, NoteSelector } from '@aztec/stdlib/abi';
|
|
12
12
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
13
|
-
import {
|
|
14
|
-
import { MerkleTreeId } from '@aztec/stdlib/trees';
|
|
13
|
+
import { BlockHash } from '@aztec/stdlib/block';
|
|
15
14
|
|
|
16
15
|
import type { IAvmExecutionOracle, ITxeExecutionOracle } from './oracle/interfaces.js';
|
|
17
16
|
import type { TXESessionStateHandler } from './txe_session.js';
|
|
@@ -352,7 +351,7 @@ export class RPCTranslator {
|
|
|
352
351
|
foreignStartStorageSlot: ForeignCallSingle,
|
|
353
352
|
foreignNumberOfElements: ForeignCallSingle,
|
|
354
353
|
) {
|
|
355
|
-
const blockHash =
|
|
354
|
+
const blockHash = new BlockHash(fromSingle(foreignBlockHash));
|
|
356
355
|
const contractAddress = addressFromSingle(foreignContractAddress);
|
|
357
356
|
const startStorageSlot = fromSingle(foreignStartStorageSlot);
|
|
358
357
|
const numberOfElements = fromSingle(foreignNumberOfElements).toNumber();
|
|
@@ -368,7 +367,7 @@ export class RPCTranslator {
|
|
|
368
367
|
}
|
|
369
368
|
|
|
370
369
|
async utilityGetPublicDataWitness(foreignBlockHash: ForeignCallSingle, foreignLeafSlot: ForeignCallSingle) {
|
|
371
|
-
const blockHash =
|
|
370
|
+
const blockHash = new BlockHash(fromSingle(foreignBlockHash));
|
|
372
371
|
const leafSlot = fromSingle(foreignLeafSlot);
|
|
373
372
|
|
|
374
373
|
const witness = await this.handlerAsUtility().utilityGetPublicDataWitness(blockHash, leafSlot);
|
|
@@ -513,6 +512,15 @@ export class RPCTranslator {
|
|
|
513
512
|
return toForeignCallResult([]);
|
|
514
513
|
}
|
|
515
514
|
|
|
515
|
+
async privateIsNullifierPending(foreignInnerNullifier: ForeignCallSingle, foreignContractAddress: ForeignCallSingle) {
|
|
516
|
+
const innerNullifier = fromSingle(foreignInnerNullifier);
|
|
517
|
+
const contractAddress = addressFromSingle(foreignContractAddress);
|
|
518
|
+
|
|
519
|
+
const isPending = await this.handlerAsPrivate().privateIsNullifierPending(innerNullifier, contractAddress);
|
|
520
|
+
|
|
521
|
+
return toForeignCallResult([toSingle(new Fr(isPending))]);
|
|
522
|
+
}
|
|
523
|
+
|
|
516
524
|
async utilityCheckNullifierExists(foreignInnerNullifier: ForeignCallSingle) {
|
|
517
525
|
const innerNullifier = fromSingle(foreignInnerNullifier);
|
|
518
526
|
|
|
@@ -566,7 +574,7 @@ export class RPCTranslator {
|
|
|
566
574
|
}
|
|
567
575
|
|
|
568
576
|
async utilityGetNullifierMembershipWitness(foreignBlockHash: ForeignCallSingle, foreignNullifier: ForeignCallSingle) {
|
|
569
|
-
const blockHash =
|
|
577
|
+
const blockHash = new BlockHash(fromSingle(foreignBlockHash));
|
|
570
578
|
const nullifier = fromSingle(foreignNullifier);
|
|
571
579
|
|
|
572
580
|
const witness = await this.handlerAsUtility().utilityGetNullifierMembershipWitness(blockHash, nullifier);
|
|
@@ -633,30 +641,43 @@ export class RPCTranslator {
|
|
|
633
641
|
return toForeignCallResult(header.toFields().map(toSingle));
|
|
634
642
|
}
|
|
635
643
|
|
|
636
|
-
async
|
|
644
|
+
async utilityGetNoteHashMembershipWitness(
|
|
645
|
+
foreignAnchorBlockHash: ForeignCallSingle,
|
|
646
|
+
foreignNoteHash: ForeignCallSingle,
|
|
647
|
+
) {
|
|
648
|
+
const blockHash = new BlockHash(fromSingle(foreignAnchorBlockHash));
|
|
649
|
+
const noteHash = fromSingle(foreignNoteHash);
|
|
650
|
+
|
|
651
|
+
const witness = await this.handlerAsUtility().utilityGetNoteHashMembershipWitness(blockHash, noteHash);
|
|
652
|
+
|
|
653
|
+
if (!witness) {
|
|
654
|
+
throw new Error(`Note hash ${noteHash} not found in the note hash tree at block ${blockHash.toString()}.`);
|
|
655
|
+
}
|
|
656
|
+
return toForeignCallResult(witness.toNoirRepresentation());
|
|
657
|
+
}
|
|
658
|
+
|
|
659
|
+
async utilityGetBlockHashMembershipWitness(
|
|
660
|
+
foreignAnchorBlockHash: ForeignCallSingle,
|
|
637
661
|
foreignBlockHash: ForeignCallSingle,
|
|
638
|
-
foreignTreeId: ForeignCallSingle,
|
|
639
|
-
foreignLeafValue: ForeignCallSingle,
|
|
640
662
|
) {
|
|
641
|
-
const
|
|
642
|
-
const
|
|
643
|
-
const leafValue = fromSingle(foreignLeafValue);
|
|
663
|
+
const anchorBlockHash = new BlockHash(fromSingle(foreignAnchorBlockHash));
|
|
664
|
+
const blockHash = new BlockHash(fromSingle(foreignBlockHash));
|
|
644
665
|
|
|
645
|
-
const witness = await this.handlerAsUtility().
|
|
666
|
+
const witness = await this.handlerAsUtility().utilityGetBlockHashMembershipWitness(anchorBlockHash, blockHash);
|
|
646
667
|
|
|
647
668
|
if (!witness) {
|
|
648
669
|
throw new Error(
|
|
649
|
-
`
|
|
670
|
+
`Block hash ${blockHash.toString()} not found in the archive tree at anchor block ${anchorBlockHash.toString()}.`,
|
|
650
671
|
);
|
|
651
672
|
}
|
|
652
|
-
return toForeignCallResult(
|
|
673
|
+
return toForeignCallResult(witness.toNoirRepresentation());
|
|
653
674
|
}
|
|
654
675
|
|
|
655
676
|
async utilityGetLowNullifierMembershipWitness(
|
|
656
677
|
foreignBlockHash: ForeignCallSingle,
|
|
657
678
|
foreignNullifier: ForeignCallSingle,
|
|
658
679
|
) {
|
|
659
|
-
const blockHash =
|
|
680
|
+
const blockHash = new BlockHash(fromSingle(foreignBlockHash));
|
|
660
681
|
const nullifier = fromSingle(foreignNullifier);
|
|
661
682
|
|
|
662
683
|
const witness = await this.handlerAsUtility().utilityGetLowNullifierMembershipWitness(blockHash, nullifier);
|
|
@@ -675,7 +696,7 @@ export class RPCTranslator {
|
|
|
675
696
|
return toForeignCallResult([]);
|
|
676
697
|
}
|
|
677
698
|
|
|
678
|
-
public async
|
|
699
|
+
public async utilityValidateAndStoreEnqueuedNotesAndEvents(
|
|
679
700
|
foreignContractAddress: ForeignCallSingle,
|
|
680
701
|
foreignNoteValidationRequestsArrayBaseSlot: ForeignCallSingle,
|
|
681
702
|
foreignEventValidationRequestsArrayBaseSlot: ForeignCallSingle,
|
|
@@ -684,7 +705,7 @@ export class RPCTranslator {
|
|
|
684
705
|
const noteValidationRequestsArrayBaseSlot = fromSingle(foreignNoteValidationRequestsArrayBaseSlot);
|
|
685
706
|
const eventValidationRequestsArrayBaseSlot = fromSingle(foreignEventValidationRequestsArrayBaseSlot);
|
|
686
707
|
|
|
687
|
-
await this.handlerAsUtility().
|
|
708
|
+
await this.handlerAsUtility().utilityValidateAndStoreEnqueuedNotesAndEvents(
|
|
688
709
|
contractAddress,
|
|
689
710
|
noteValidationRequestsArrayBaseSlot,
|
|
690
711
|
eventValidationRequestsArrayBaseSlot,
|
|
@@ -822,10 +843,11 @@ export class RPCTranslator {
|
|
|
822
843
|
return toForeignCallResult([]);
|
|
823
844
|
}
|
|
824
845
|
|
|
825
|
-
async avmOpcodeStorageRead(foreignSlot: ForeignCallSingle) {
|
|
846
|
+
async avmOpcodeStorageRead(foreignSlot: ForeignCallSingle, foreignContractAddress: ForeignCallSingle) {
|
|
826
847
|
const slot = fromSingle(foreignSlot);
|
|
848
|
+
const contractAddress = AztecAddress.fromField(fromSingle(foreignContractAddress));
|
|
827
849
|
|
|
828
|
-
const value = (await this.handlerAsAvm().avmOpcodeStorageRead(slot)).value;
|
|
850
|
+
const value = (await this.handlerAsAvm().avmOpcodeStorageRead(slot, contractAddress)).value;
|
|
829
851
|
|
|
830
852
|
return toForeignCallResult([toSingle(new Fr(value))]);
|
|
831
853
|
}
|
|
@@ -897,11 +919,10 @@ export class RPCTranslator {
|
|
|
897
919
|
return toForeignCallResult([]);
|
|
898
920
|
}
|
|
899
921
|
|
|
900
|
-
async avmOpcodeNullifierExists(
|
|
901
|
-
const
|
|
902
|
-
const targetAddress = AztecAddress.fromField(fromSingle(foreignTargetAddress));
|
|
922
|
+
async avmOpcodeNullifierExists(foreignSiloedNullifier: ForeignCallSingle) {
|
|
923
|
+
const siloedNullifier = fromSingle(foreignSiloedNullifier);
|
|
903
924
|
|
|
904
|
-
const exists = await this.handlerAsAvm().avmOpcodeNullifierExists(
|
|
925
|
+
const exists = await this.handlerAsAvm().avmOpcodeNullifierExists(siloedNullifier);
|
|
905
926
|
|
|
906
927
|
return toForeignCallResult([toSingle(new Fr(exists))]);
|
|
907
928
|
}
|
|
@@ -17,18 +17,14 @@ export class TXEArchiver extends ArchiverDataSourceBase {
|
|
|
17
17
|
private readonly updater = new ArchiverDataStoreUpdater(this.store);
|
|
18
18
|
|
|
19
19
|
constructor(db: AztecAsyncKVStore) {
|
|
20
|
-
const store = new KVArchiverDataStore(db, 9999);
|
|
20
|
+
const store = new KVArchiverDataStore(db, 9999, { epochDuration: 32 });
|
|
21
21
|
super(store);
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
await this.updater.setNewCheckpointData(checkpoints, result);
|
|
27
|
-
return true;
|
|
24
|
+
public async addCheckpoints(checkpoints: PublishedCheckpoint[], result?: ValidateCheckpointResult): Promise<void> {
|
|
25
|
+
await this.updater.addCheckpoints(checkpoints, result);
|
|
28
26
|
}
|
|
29
27
|
|
|
30
|
-
// Abstract method implementations
|
|
31
|
-
|
|
32
28
|
public getRollupAddress(): Promise<EthAddress> {
|
|
33
29
|
throw new Error('TXE Archiver does not implement "getRollupAddress"');
|
|
34
30
|
}
|
|
@@ -63,7 +59,7 @@ export class TXEArchiver extends ArchiverDataSourceBase {
|
|
|
63
59
|
if (!checkpointedBlock) {
|
|
64
60
|
throw new Error(`L2Tips requested from TXE Archiver but no checkpointed block found for block number ${number}`);
|
|
65
61
|
}
|
|
66
|
-
const checkpoint = await this.store.getRangeOfCheckpoints(CheckpointNumber(number), 1);
|
|
62
|
+
const checkpoint = await this.store.getRangeOfCheckpoints(CheckpointNumber.fromBlockNumber(number), 1);
|
|
67
63
|
if (checkpoint.length === 0) {
|
|
68
64
|
throw new Error(`L2Tips requested from TXE Archiver but no checkpoint found for block number ${number}`);
|
|
69
65
|
}
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import { type AztecNodeConfig, AztecNodeService } from '@aztec/aztec-node';
|
|
2
2
|
import { TestCircuitVerifier } from '@aztec/bb-prover/test';
|
|
3
|
+
import { CheckpointNumber } from '@aztec/foundation/branded-types';
|
|
4
|
+
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
3
5
|
import { createLogger } from '@aztec/foundation/log';
|
|
4
6
|
import type { AztecAsyncKVStore } from '@aztec/kv-store';
|
|
5
7
|
import { AnchorBlockStore } from '@aztec/pxe/server';
|
|
6
|
-
import {
|
|
8
|
+
import { L2Block } from '@aztec/stdlib/block';
|
|
7
9
|
import { Checkpoint, L1PublishedData, PublishedCheckpoint } from '@aztec/stdlib/checkpoint';
|
|
8
10
|
import type { AztecNode } from '@aztec/stdlib/interfaces/client';
|
|
11
|
+
import { CheckpointHeader } from '@aztec/stdlib/rollup';
|
|
9
12
|
import { getPackageVersion } from '@aztec/stdlib/update-checker';
|
|
10
13
|
|
|
11
14
|
import { TXEArchiver } from './archiver.js';
|
|
@@ -58,15 +61,26 @@ export class TXEStateMachine {
|
|
|
58
61
|
return new this(node, synchronizer, archiver, anchorBlockStore);
|
|
59
62
|
}
|
|
60
63
|
|
|
61
|
-
public async handleL2Block(block:
|
|
62
|
-
// Create a checkpoint from the block
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
64
|
+
public async handleL2Block(block: L2Block) {
|
|
65
|
+
// Create a checkpoint from the block manually
|
|
66
|
+
const checkpoint = new Checkpoint(
|
|
67
|
+
block.archive,
|
|
68
|
+
CheckpointHeader.from({
|
|
69
|
+
lastArchiveRoot: block.header.lastArchive.root,
|
|
70
|
+
inHash: Fr.ZERO,
|
|
71
|
+
blobsHash: Fr.ZERO,
|
|
72
|
+
blockHeadersHash: Fr.ZERO,
|
|
73
|
+
epochOutHash: Fr.ZERO,
|
|
74
|
+
slotNumber: block.header.globalVariables.slotNumber,
|
|
75
|
+
timestamp: block.header.globalVariables.timestamp,
|
|
76
|
+
coinbase: block.header.globalVariables.coinbase,
|
|
77
|
+
feeRecipient: block.header.globalVariables.feeRecipient,
|
|
78
|
+
gasFees: block.header.globalVariables.gasFees,
|
|
79
|
+
totalManaUsed: block.header.totalManaUsed,
|
|
80
|
+
}),
|
|
81
|
+
[block],
|
|
82
|
+
CheckpointNumber.fromBlockNumber(block.number),
|
|
83
|
+
);
|
|
70
84
|
|
|
71
85
|
const publishedCheckpoint = new PublishedCheckpoint(
|
|
72
86
|
checkpoint,
|
|
@@ -78,9 +92,9 @@ export class TXEStateMachine {
|
|
|
78
92
|
[],
|
|
79
93
|
);
|
|
80
94
|
await Promise.all([
|
|
81
|
-
this.synchronizer.handleL2Block(block),
|
|
95
|
+
this.synchronizer.handleL2Block(block),
|
|
82
96
|
this.archiver.addCheckpoints([publishedCheckpoint], undefined),
|
|
83
|
-
this.anchorBlockStore.setHeader(block.header),
|
|
97
|
+
this.anchorBlockStore.setHeader(block.header),
|
|
84
98
|
]);
|
|
85
99
|
}
|
|
86
100
|
}
|
|
@@ -16,11 +16,12 @@ export class MockEpochCache implements EpochCacheInterface {
|
|
|
16
16
|
});
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
getEpochAndSlotNow(): EpochAndSlot {
|
|
19
|
+
getEpochAndSlotNow(): EpochAndSlot & { nowMs: bigint } {
|
|
20
20
|
return {
|
|
21
21
|
epoch: EpochNumber.ZERO,
|
|
22
22
|
slot: SlotNumber(0),
|
|
23
23
|
ts: 0n,
|
|
24
|
+
nowMs: 0n,
|
|
24
25
|
};
|
|
25
26
|
}
|
|
26
27
|
|
|
@@ -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 {
|
|
4
|
+
import type { L2Block } from '@aztec/stdlib/block';
|
|
5
5
|
import type {
|
|
6
6
|
MerkleTreeReadOperations,
|
|
7
7
|
MerkleTreeWriteOperations,
|
|
@@ -23,7 +23,7 @@ export class TXESynchronizer implements WorldStateSynchronizer {
|
|
|
23
23
|
return new this(nativeWorldStateService);
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
public async handleL2Block(block:
|
|
26
|
+
public async handleL2Block(block: L2Block) {
|
|
27
27
|
await this.nativeWorldStateService.handleL2BlockAndMessages(
|
|
28
28
|
block,
|
|
29
29
|
Array(NUMBER_OF_L1_L2_MESSAGES_PER_ROLLUP).fill(0).map(Fr.zero),
|
package/src/txe_session.ts
CHANGED
|
@@ -152,7 +152,7 @@ export class TXESession implements TXESessionStateHandler {
|
|
|
152
152
|
const addressStore = new AddressStore(store);
|
|
153
153
|
const privateEventStore = new PrivateEventStore(store);
|
|
154
154
|
const contractStore = new TXEContractStore(store);
|
|
155
|
-
const noteStore =
|
|
155
|
+
const noteStore = new NoteStore(store);
|
|
156
156
|
const senderTaggingStore = new SenderTaggingStore(store);
|
|
157
157
|
const recipientTaggingStore = new RecipientTaggingStore(store);
|
|
158
158
|
const senderAddressBookStore = new SenderAddressBookStore(store);
|
|
@@ -162,7 +162,13 @@ export class TXESession implements TXESessionStateHandler {
|
|
|
162
162
|
|
|
163
163
|
// Create job coordinator and register staged stores
|
|
164
164
|
const jobCoordinator = new JobCoordinator(store);
|
|
165
|
-
jobCoordinator.registerStores([
|
|
165
|
+
jobCoordinator.registerStores([
|
|
166
|
+
capsuleStore,
|
|
167
|
+
senderTaggingStore,
|
|
168
|
+
recipientTaggingStore,
|
|
169
|
+
privateEventStore,
|
|
170
|
+
noteStore,
|
|
171
|
+
]);
|
|
166
172
|
|
|
167
173
|
// Register protocol contracts.
|
|
168
174
|
for (const { contractClass, instance, artifact } of protocolContracts) {
|
|
@@ -306,16 +312,14 @@ export class TXESession implements TXESessionStateHandler {
|
|
|
306
312
|
): Promise<PrivateContextInputs> {
|
|
307
313
|
this.exitTopLevelState();
|
|
308
314
|
|
|
309
|
-
await new NoteService(
|
|
310
|
-
this.noteStore,
|
|
311
|
-
this.stateMachine.node,
|
|
312
|
-
this.stateMachine.anchorBlockStore,
|
|
313
|
-
).syncNoteNullifiers(contractAddress);
|
|
314
|
-
|
|
315
315
|
// Private execution has two associated block numbers: the anchor block (i.e. the historical block that is used to
|
|
316
316
|
// build the proof), and the *next* block, i.e. the one we'll create once the execution ends, and which will contain
|
|
317
317
|
// a single transaction with the effects of what was done in the test.
|
|
318
318
|
const anchorBlock = await this.stateMachine.node.getBlockHeader(anchorBlockNumber ?? 'latest');
|
|
319
|
+
|
|
320
|
+
await new NoteService(this.noteStore, this.stateMachine.node, anchorBlock!, this.currentJobId).syncNoteNullifiers(
|
|
321
|
+
contractAddress,
|
|
322
|
+
);
|
|
319
323
|
const latestBlock = await this.stateMachine.node.getBlockHeader('latest');
|
|
320
324
|
|
|
321
325
|
const nextBlockGlobalVariables = makeGlobalVariables(undefined, {
|
|
@@ -347,7 +351,6 @@ export class TXESession implements TXESessionStateHandler {
|
|
|
347
351
|
this.keyStore,
|
|
348
352
|
this.addressStore,
|
|
349
353
|
this.stateMachine.node,
|
|
350
|
-
this.stateMachine.anchorBlockStore,
|
|
351
354
|
this.senderTaggingStore,
|
|
352
355
|
this.recipientTaggingStore,
|
|
353
356
|
this.senderAddressBookStore,
|
|
@@ -394,6 +397,8 @@ export class TXESession implements TXESessionStateHandler {
|
|
|
394
397
|
async enterUtilityState(contractAddress: AztecAddress = DEFAULT_ADDRESS) {
|
|
395
398
|
this.exitTopLevelState();
|
|
396
399
|
|
|
400
|
+
const anchorBlockHeader = await this.stateMachine.anchorBlockStore.getBlockHeader();
|
|
401
|
+
|
|
397
402
|
// There is no automatic message discovery and contract-driven syncing process in inlined private or utility
|
|
398
403
|
// contexts, which means that known nullifiers are also not searched for, since it is during the tagging sync that
|
|
399
404
|
// we perform this. We therefore search for known nullifiers now, as otherwise notes that were nullified would not
|
|
@@ -402,11 +407,10 @@ export class TXESession implements TXESessionStateHandler {
|
|
|
402
407
|
await new NoteService(
|
|
403
408
|
this.noteStore,
|
|
404
409
|
this.stateMachine.node,
|
|
405
|
-
|
|
410
|
+
anchorBlockHeader,
|
|
411
|
+
this.currentJobId,
|
|
406
412
|
).syncNoteNullifiers(contractAddress);
|
|
407
413
|
|
|
408
|
-
const anchorBlockHeader = await this.stateMachine.anchorBlockStore.getBlockHeader();
|
|
409
|
-
|
|
410
414
|
this.oracleHandler = new UtilityExecutionOracle(
|
|
411
415
|
contractAddress,
|
|
412
416
|
[],
|
|
@@ -417,7 +421,6 @@ export class TXESession implements TXESessionStateHandler {
|
|
|
417
421
|
this.keyStore,
|
|
418
422
|
this.addressStore,
|
|
419
423
|
this.stateMachine.node,
|
|
420
|
-
this.stateMachine.anchorBlockStore,
|
|
421
424
|
this.recipientTaggingStore,
|
|
422
425
|
this.senderAddressBookStore,
|
|
423
426
|
this.capsuleStore,
|
|
@@ -508,7 +511,6 @@ export class TXESession implements TXESessionStateHandler {
|
|
|
508
511
|
this.keyStore,
|
|
509
512
|
this.addressStore,
|
|
510
513
|
this.stateMachine.node,
|
|
511
|
-
this.stateMachine.anchorBlockStore,
|
|
512
514
|
this.recipientTaggingStore,
|
|
513
515
|
this.senderAddressBookStore,
|
|
514
516
|
this.capsuleStore,
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
import { BlockNumber, CheckpointNumber, IndexWithinCheckpoint } from '@aztec/foundation/branded-types';
|
|
8
8
|
import { padArrayEnd } from '@aztec/foundation/collection';
|
|
9
9
|
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
10
|
-
import { Body,
|
|
10
|
+
import { Body, L2Block } from '@aztec/stdlib/block';
|
|
11
11
|
import { AppendOnlyTreeSnapshot, MerkleTreeId, type MerkleTreeWriteOperations } from '@aztec/stdlib/trees';
|
|
12
12
|
import { BlockHeader, GlobalVariables, TxEffect } from '@aztec/stdlib/tx';
|
|
13
13
|
|
|
@@ -61,7 +61,7 @@ export async function makeTXEBlockHeader(
|
|
|
61
61
|
}
|
|
62
62
|
|
|
63
63
|
/**
|
|
64
|
-
* Creates an
|
|
64
|
+
* Creates an L2Block with proper archive chaining.
|
|
65
65
|
* This function:
|
|
66
66
|
* 1. Gets the current archive state as lastArchive for the header
|
|
67
67
|
* 2. Creates the block header
|
|
@@ -71,13 +71,13 @@ export async function makeTXEBlockHeader(
|
|
|
71
71
|
* @param worldTrees - The world trees to read/write from
|
|
72
72
|
* @param globalVariables - Global variables for the block
|
|
73
73
|
* @param txEffects - Transaction effects to include in the block
|
|
74
|
-
* @returns The created
|
|
74
|
+
* @returns The created L2Block with proper archive chaining
|
|
75
75
|
*/
|
|
76
76
|
export async function makeTXEBlock(
|
|
77
77
|
worldTrees: MerkleTreeWriteOperations,
|
|
78
78
|
globalVariables: GlobalVariables,
|
|
79
79
|
txEffects: TxEffect[],
|
|
80
|
-
): Promise<
|
|
80
|
+
): Promise<L2Block> {
|
|
81
81
|
const header = await makeTXEBlockHeader(worldTrees, globalVariables);
|
|
82
82
|
|
|
83
83
|
// Update the archive tree with this block's header hash
|
|
@@ -87,9 +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
|
-
//
|
|
90
|
+
// L2Block requires checkpointNumber and indexWithinCheckpoint
|
|
91
91
|
const checkpointNumber = CheckpointNumber.fromBlockNumber(globalVariables.blockNumber);
|
|
92
92
|
const indexWithinCheckpoint = IndexWithinCheckpoint(0);
|
|
93
93
|
|
|
94
|
-
return new
|
|
94
|
+
return new L2Block(newArchive, header, new Body(txEffects), checkpointNumber, indexWithinCheckpoint);
|
|
95
95
|
}
|