@aztec/txe 0.0.1-commit.d431d1c → 0.0.1-commit.e3c1de76
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 +35 -23
- 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 +39 -26
- 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,35 @@ export class RPCTranslator {
|
|
|
633
641
|
return toForeignCallResult(header.toFields().map(toSingle));
|
|
634
642
|
}
|
|
635
643
|
|
|
636
|
-
async
|
|
637
|
-
foreignBlockHash
|
|
638
|
-
foreignTreeId: ForeignCallSingle,
|
|
639
|
-
foreignLeafValue: ForeignCallSingle,
|
|
640
|
-
) {
|
|
641
|
-
const blockHash = L2BlockHash.fromString(foreignBlockHash);
|
|
642
|
-
const treeId = fromSingle(foreignTreeId).toNumber();
|
|
644
|
+
async utilityGetNoteHashMembershipWitness(foreignBlockHash: ForeignCallSingle, foreignLeafValue: ForeignCallSingle) {
|
|
645
|
+
const blockHash = new BlockHash(fromSingle(foreignBlockHash));
|
|
643
646
|
const leafValue = fromSingle(foreignLeafValue);
|
|
644
647
|
|
|
645
|
-
const witness = await this.handlerAsUtility().
|
|
648
|
+
const witness = await this.handlerAsUtility().utilityGetNoteHashMembershipWitness(blockHash, leafValue);
|
|
646
649
|
|
|
647
650
|
if (!witness) {
|
|
648
|
-
throw new Error(
|
|
649
|
-
`Membership witness in tree ${MerkleTreeId[treeId]} not found for value ${leafValue} at block ${blockHash}.`,
|
|
650
|
-
);
|
|
651
|
+
throw new Error(`Note hash ${leafValue} not found in the note hash tree at block ${blockHash.toString()}.`);
|
|
651
652
|
}
|
|
652
|
-
return toForeignCallResult(
|
|
653
|
+
return toForeignCallResult(witness.toNoirRepresentation());
|
|
654
|
+
}
|
|
655
|
+
|
|
656
|
+
async utilityGetArchiveMembershipWitness(foreignBlockHash: ForeignCallSingle, foreignLeafValue: ForeignCallSingle) {
|
|
657
|
+
const blockHash = new BlockHash(fromSingle(foreignBlockHash));
|
|
658
|
+
const leafValue = fromSingle(foreignLeafValue);
|
|
659
|
+
|
|
660
|
+
const witness = await this.handlerAsUtility().utilityGetArchiveMembershipWitness(blockHash, leafValue);
|
|
661
|
+
|
|
662
|
+
if (!witness) {
|
|
663
|
+
throw new Error(`Block hash ${leafValue} not found in the archive tree at block ${blockHash.toString()}.`);
|
|
664
|
+
}
|
|
665
|
+
return toForeignCallResult(witness.toNoirRepresentation());
|
|
653
666
|
}
|
|
654
667
|
|
|
655
668
|
async utilityGetLowNullifierMembershipWitness(
|
|
656
669
|
foreignBlockHash: ForeignCallSingle,
|
|
657
670
|
foreignNullifier: ForeignCallSingle,
|
|
658
671
|
) {
|
|
659
|
-
const blockHash =
|
|
672
|
+
const blockHash = new BlockHash(fromSingle(foreignBlockHash));
|
|
660
673
|
const nullifier = fromSingle(foreignNullifier);
|
|
661
674
|
|
|
662
675
|
const witness = await this.handlerAsUtility().utilityGetLowNullifierMembershipWitness(blockHash, nullifier);
|
|
@@ -675,7 +688,7 @@ export class RPCTranslator {
|
|
|
675
688
|
return toForeignCallResult([]);
|
|
676
689
|
}
|
|
677
690
|
|
|
678
|
-
public async
|
|
691
|
+
public async utilityValidateAndStoreEnqueuedNotesAndEvents(
|
|
679
692
|
foreignContractAddress: ForeignCallSingle,
|
|
680
693
|
foreignNoteValidationRequestsArrayBaseSlot: ForeignCallSingle,
|
|
681
694
|
foreignEventValidationRequestsArrayBaseSlot: ForeignCallSingle,
|
|
@@ -684,7 +697,7 @@ export class RPCTranslator {
|
|
|
684
697
|
const noteValidationRequestsArrayBaseSlot = fromSingle(foreignNoteValidationRequestsArrayBaseSlot);
|
|
685
698
|
const eventValidationRequestsArrayBaseSlot = fromSingle(foreignEventValidationRequestsArrayBaseSlot);
|
|
686
699
|
|
|
687
|
-
await this.handlerAsUtility().
|
|
700
|
+
await this.handlerAsUtility().utilityValidateAndStoreEnqueuedNotesAndEvents(
|
|
688
701
|
contractAddress,
|
|
689
702
|
noteValidationRequestsArrayBaseSlot,
|
|
690
703
|
eventValidationRequestsArrayBaseSlot,
|
|
@@ -822,10 +835,11 @@ export class RPCTranslator {
|
|
|
822
835
|
return toForeignCallResult([]);
|
|
823
836
|
}
|
|
824
837
|
|
|
825
|
-
async avmOpcodeStorageRead(foreignSlot: ForeignCallSingle) {
|
|
838
|
+
async avmOpcodeStorageRead(foreignSlot: ForeignCallSingle, foreignContractAddress: ForeignCallSingle) {
|
|
826
839
|
const slot = fromSingle(foreignSlot);
|
|
840
|
+
const contractAddress = AztecAddress.fromField(fromSingle(foreignContractAddress));
|
|
827
841
|
|
|
828
|
-
const value = (await this.handlerAsAvm().avmOpcodeStorageRead(slot)).value;
|
|
842
|
+
const value = (await this.handlerAsAvm().avmOpcodeStorageRead(slot, contractAddress)).value;
|
|
829
843
|
|
|
830
844
|
return toForeignCallResult([toSingle(new Fr(value))]);
|
|
831
845
|
}
|
|
@@ -897,11 +911,10 @@ export class RPCTranslator {
|
|
|
897
911
|
return toForeignCallResult([]);
|
|
898
912
|
}
|
|
899
913
|
|
|
900
|
-
async avmOpcodeNullifierExists(
|
|
901
|
-
const
|
|
902
|
-
const targetAddress = AztecAddress.fromField(fromSingle(foreignTargetAddress));
|
|
914
|
+
async avmOpcodeNullifierExists(foreignSiloedNullifier: ForeignCallSingle) {
|
|
915
|
+
const siloedNullifier = fromSingle(foreignSiloedNullifier);
|
|
903
916
|
|
|
904
|
-
const exists = await this.handlerAsAvm().avmOpcodeNullifierExists(
|
|
917
|
+
const exists = await this.handlerAsAvm().avmOpcodeNullifierExists(siloedNullifier);
|
|
905
918
|
|
|
906
919
|
return toForeignCallResult([toSingle(new Fr(exists))]);
|
|
907
920
|
}
|
|
@@ -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
|
}
|