@aztec/archiver 0.0.1-commit.5de5ca79e → 0.0.1-commit.6201a7b05
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/README.md +12 -6
- package/dest/archiver.d.ts +16 -7
- package/dest/archiver.d.ts.map +1 -1
- package/dest/archiver.js +104 -48
- package/dest/config.d.ts +3 -1
- package/dest/config.d.ts.map +1 -1
- package/dest/config.js +14 -3
- package/dest/errors.d.ts +41 -2
- package/dest/errors.d.ts.map +1 -1
- package/dest/errors.js +62 -1
- package/dest/factory.d.ts +2 -2
- package/dest/factory.d.ts.map +1 -1
- package/dest/factory.js +9 -7
- package/dest/index.d.ts +3 -2
- package/dest/index.d.ts.map +1 -1
- package/dest/index.js +2 -1
- package/dest/l1/calldata_retriever.d.ts +2 -1
- package/dest/l1/calldata_retriever.d.ts.map +1 -1
- package/dest/l1/calldata_retriever.js +11 -5
- package/dest/l1/data_retrieval.d.ts +19 -10
- package/dest/l1/data_retrieval.d.ts.map +1 -1
- package/dest/l1/data_retrieval.js +25 -32
- package/dest/l1/validate_historical_logs.d.ts +23 -0
- package/dest/l1/validate_historical_logs.d.ts.map +1 -0
- package/dest/l1/validate_historical_logs.js +108 -0
- package/dest/modules/data_source_base.d.ts +8 -2
- package/dest/modules/data_source_base.d.ts.map +1 -1
- package/dest/modules/data_source_base.js +19 -1
- package/dest/modules/data_store_updater.d.ts +15 -10
- package/dest/modules/data_store_updater.d.ts.map +1 -1
- package/dest/modules/data_store_updater.js +71 -68
- package/dest/modules/instrumentation.d.ts +7 -2
- package/dest/modules/instrumentation.d.ts.map +1 -1
- package/dest/modules/instrumentation.js +22 -6
- package/dest/modules/l1_synchronizer.d.ts +7 -2
- package/dest/modules/l1_synchronizer.d.ts.map +1 -1
- package/dest/modules/l1_synchronizer.js +261 -143
- package/dest/modules/validation.d.ts +4 -3
- package/dest/modules/validation.d.ts.map +1 -1
- package/dest/modules/validation.js +6 -6
- package/dest/store/block_store.d.ts +72 -5
- package/dest/store/block_store.d.ts.map +1 -1
- package/dest/store/block_store.js +341 -66
- package/dest/store/contract_class_store.d.ts +2 -3
- package/dest/store/contract_class_store.d.ts.map +1 -1
- package/dest/store/contract_class_store.js +7 -67
- package/dest/store/contract_instance_store.d.ts +1 -1
- package/dest/store/contract_instance_store.d.ts.map +1 -1
- package/dest/store/contract_instance_store.js +6 -2
- package/dest/store/kv_archiver_store.d.ts +51 -17
- package/dest/store/kv_archiver_store.d.ts.map +1 -1
- package/dest/store/kv_archiver_store.js +60 -16
- package/dest/store/l2_tips_cache.d.ts +2 -1
- package/dest/store/l2_tips_cache.d.ts.map +1 -1
- package/dest/store/l2_tips_cache.js +27 -7
- package/dest/store/log_store.d.ts +1 -1
- package/dest/store/log_store.d.ts.map +1 -1
- package/dest/store/log_store.js +2 -4
- package/dest/store/message_store.d.ts +3 -3
- package/dest/store/message_store.d.ts.map +1 -1
- package/dest/store/message_store.js +9 -10
- package/dest/test/fake_l1_state.d.ts +15 -3
- package/dest/test/fake_l1_state.d.ts.map +1 -1
- package/dest/test/fake_l1_state.js +80 -18
- package/dest/test/mock_l1_to_l2_message_source.d.ts +1 -1
- package/dest/test/mock_l1_to_l2_message_source.d.ts.map +1 -1
- package/dest/test/mock_l1_to_l2_message_source.js +2 -1
- package/dest/test/mock_l2_block_source.d.ts +16 -2
- package/dest/test/mock_l2_block_source.d.ts.map +1 -1
- package/dest/test/mock_l2_block_source.js +50 -3
- package/dest/test/noop_l1_archiver.d.ts +1 -1
- package/dest/test/noop_l1_archiver.d.ts.map +1 -1
- package/dest/test/noop_l1_archiver.js +4 -2
- package/package.json +13 -13
- package/src/archiver.ts +126 -46
- package/src/config.ts +15 -1
- package/src/errors.ts +97 -2
- package/src/factory.ts +13 -7
- package/src/index.ts +2 -1
- package/src/l1/calldata_retriever.ts +17 -5
- package/src/l1/data_retrieval.ts +36 -45
- package/src/l1/validate_historical_logs.ts +140 -0
- package/src/modules/data_source_base.ts +32 -1
- package/src/modules/data_store_updater.ts +98 -97
- package/src/modules/instrumentation.ts +27 -7
- package/src/modules/l1_synchronizer.ts +328 -169
- package/src/modules/validation.ts +10 -9
- package/src/store/block_store.ts +419 -76
- package/src/store/contract_class_store.ts +8 -106
- package/src/store/contract_instance_store.ts +8 -5
- package/src/store/kv_archiver_store.ts +100 -32
- package/src/store/l2_tips_cache.ts +58 -13
- package/src/store/log_store.ts +2 -5
- package/src/store/message_store.ts +10 -12
- package/src/structs/inbox_message.ts +1 -1
- package/src/test/fake_l1_state.ts +99 -27
- package/src/test/mock_l1_to_l2_message_source.ts +1 -0
- package/src/test/mock_l2_block_source.ts +58 -2
- package/src/test/noop_l1_archiver.ts +3 -1
|
@@ -15,12 +15,8 @@ import { CommitteeAttestation, CommitteeAttestationsAndSigners, L2Block } from '
|
|
|
15
15
|
import { Checkpoint } from '@aztec/stdlib/checkpoint';
|
|
16
16
|
import { getSlotAtTimestamp } from '@aztec/stdlib/epoch-helpers';
|
|
17
17
|
import { InboxLeaf } from '@aztec/stdlib/messaging';
|
|
18
|
-
import { ConsensusPayload,
|
|
19
|
-
import {
|
|
20
|
-
makeAndSignCommitteeAttestationsAndSigners,
|
|
21
|
-
makeCheckpointAttestationFromCheckpoint,
|
|
22
|
-
mockCheckpointAndMessages,
|
|
23
|
-
} from '@aztec/stdlib/testing';
|
|
18
|
+
import { ConsensusPayload, getHashedSignaturePayloadTypedData } from '@aztec/stdlib/p2p';
|
|
19
|
+
import { mockCheckpointAndMessages } from '@aztec/stdlib/testing';
|
|
24
20
|
import { AppendOnlyTreeSnapshot } from '@aztec/stdlib/trees';
|
|
25
21
|
|
|
26
22
|
import { type MockProxy, mock } from 'jest-mock-extended';
|
|
@@ -151,8 +147,10 @@ export class FakeL1State {
|
|
|
151
147
|
// Computed from checkpoints based on L1 block visibility
|
|
152
148
|
private pendingCheckpointNumber: CheckpointNumber = CheckpointNumber(0);
|
|
153
149
|
|
|
154
|
-
// The L1 block number reported as "finalized" (defaults to the start block)
|
|
155
|
-
|
|
150
|
+
// The L1 block number reported as "finalized" (defaults to the start block).
|
|
151
|
+
// `undefined` simulates the startup window on a fresh devnet where
|
|
152
|
+
// `getBlock({ blockTag: 'finalized' })` fails with "finalized block not found".
|
|
153
|
+
private finalizedL1BlockNumber: bigint | undefined;
|
|
156
154
|
|
|
157
155
|
constructor(private readonly config: FakeL1StateConfig) {
|
|
158
156
|
this.l1BlockNumber = config.l1StartBlock;
|
|
@@ -288,8 +286,11 @@ export class FakeL1State {
|
|
|
288
286
|
this.updatePendingCheckpointNumber();
|
|
289
287
|
}
|
|
290
288
|
|
|
291
|
-
/**
|
|
292
|
-
|
|
289
|
+
/**
|
|
290
|
+
* Sets the L1 block number that will be reported as "finalized". Pass `undefined` to
|
|
291
|
+
* simulate a chain that does not yet have a finalized block (devnet startup).
|
|
292
|
+
*/
|
|
293
|
+
setFinalizedL1BlockNumber(blockNumber: bigint | undefined): void {
|
|
293
294
|
this.finalizedL1BlockNumber = blockNumber;
|
|
294
295
|
}
|
|
295
296
|
|
|
@@ -332,6 +333,21 @@ export class FakeL1State {
|
|
|
332
333
|
this.updatePendingCheckpointNumber();
|
|
333
334
|
}
|
|
334
335
|
|
|
336
|
+
/**
|
|
337
|
+
* Moves a checkpoint to a different L1 block number (simulates L1 reorg that
|
|
338
|
+
* re-includes the same checkpoint transaction in a different block).
|
|
339
|
+
* The checkpoint content stays the same — only the L1 metadata changes.
|
|
340
|
+
* Auto-updates pending status.
|
|
341
|
+
*/
|
|
342
|
+
moveCheckpointToL1Block(checkpointNumber: CheckpointNumber, newL1BlockNumber: bigint): void {
|
|
343
|
+
for (const cpData of this.checkpoints) {
|
|
344
|
+
if (cpData.checkpointNumber === checkpointNumber) {
|
|
345
|
+
cpData.l1BlockNumber = newL1BlockNumber;
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
this.updatePendingCheckpointNumber();
|
|
349
|
+
}
|
|
350
|
+
|
|
335
351
|
/**
|
|
336
352
|
* Removes messages after a given total index (simulates L1 reorg).
|
|
337
353
|
* Auto-updates rolling hash.
|
|
@@ -451,19 +467,33 @@ export class FakeL1State {
|
|
|
451
467
|
createMockInboxContract(_publicClient: MockProxy<ViemPublicClient>): MockProxy<InboxContract> {
|
|
452
468
|
const mockInbox = mock<InboxContract>();
|
|
453
469
|
|
|
454
|
-
mockInbox.getState.mockImplementation(() => {
|
|
470
|
+
mockInbox.getState.mockImplementation((opts: { blockTag?: string; blockNumber?: bigint } = {}) => {
|
|
471
|
+
// Filter messages visible at the given block number (or all if not specified)
|
|
472
|
+
const blockNumber = opts.blockNumber ?? this.l1BlockNumber;
|
|
473
|
+
const visibleMessages = this.messages.filter(m => m.l1BlockNumber <= blockNumber);
|
|
474
|
+
|
|
455
475
|
// treeInProgress must be > any sealed checkpoint. On L1, a checkpoint can only be proposed
|
|
456
476
|
// after its messages are sealed, so treeInProgress > checkpointNumber for all published checkpoints.
|
|
457
477
|
const maxFromMessages =
|
|
458
|
-
|
|
478
|
+
visibleMessages.length > 0 ? Math.max(...visibleMessages.map(m => Number(m.checkpointNumber))) + 1 : 0;
|
|
459
479
|
const maxFromCheckpoints =
|
|
460
480
|
this.checkpoints.length > 0
|
|
461
|
-
? Math.max(
|
|
481
|
+
? Math.max(
|
|
482
|
+
...this.checkpoints
|
|
483
|
+
.filter(cp => !cp.pruned && cp.l1BlockNumber <= blockNumber)
|
|
484
|
+
.map(cp => Number(cp.checkpointNumber)),
|
|
485
|
+
0,
|
|
486
|
+
) + 1
|
|
462
487
|
: 0;
|
|
463
488
|
const treeInProgress = Math.max(maxFromMessages, maxFromCheckpoints, INITIAL_CHECKPOINT_NUMBER);
|
|
489
|
+
|
|
490
|
+
// Compute rolling hash only for visible messages
|
|
491
|
+
const rollingHash =
|
|
492
|
+
visibleMessages.length > 0 ? visibleMessages[visibleMessages.length - 1].rollingHash : Buffer16.ZERO;
|
|
493
|
+
|
|
464
494
|
return Promise.resolve({
|
|
465
|
-
messagesRollingHash:
|
|
466
|
-
totalMessagesInserted: BigInt(
|
|
495
|
+
messagesRollingHash: rollingHash,
|
|
496
|
+
totalMessagesInserted: BigInt(visibleMessages.length),
|
|
467
497
|
treeInProgress: BigInt(treeInProgress),
|
|
468
498
|
});
|
|
469
499
|
});
|
|
@@ -473,8 +503,8 @@ export class FakeL1State {
|
|
|
473
503
|
Promise.resolve(this.getMessageSentLogs(fromBlock, toBlock)),
|
|
474
504
|
);
|
|
475
505
|
|
|
476
|
-
mockInbox.getMessageSentEventByHash.mockImplementation((
|
|
477
|
-
Promise.resolve(this.
|
|
506
|
+
mockInbox.getMessageSentEventByHash.mockImplementation((msgHash: string, aroundL1BlockNumber: bigint) =>
|
|
507
|
+
Promise.resolve(this.getMessageSentLogByHash(msgHash, aroundL1BlockNumber) as MessageSentLog),
|
|
478
508
|
);
|
|
479
509
|
|
|
480
510
|
return mockInbox;
|
|
@@ -485,11 +515,19 @@ export class FakeL1State {
|
|
|
485
515
|
const publicClient = mock<ViemPublicClient>();
|
|
486
516
|
|
|
487
517
|
publicClient.getChainId.mockResolvedValue(1);
|
|
518
|
+
// Several consumers (CalldataRetriever, ArchiverL1Synchronizer) derive the EIP-712 signing
|
|
519
|
+
// context from `publicClient.chain.id`. Pin it so it matches `getSignatureContext()` below.
|
|
520
|
+
(publicClient as unknown as { chain: { id: number } }).chain = { id: 1 };
|
|
488
521
|
publicClient.getBlockNumber.mockImplementation(() => Promise.resolve(this.l1BlockNumber));
|
|
489
522
|
|
|
490
523
|
publicClient.getBlock.mockImplementation((async (args: { blockNumber?: bigint; blockTag?: string } = {}) => {
|
|
491
524
|
let blockNum: bigint;
|
|
492
525
|
if (args.blockTag === 'finalized') {
|
|
526
|
+
if (this.finalizedL1BlockNumber === undefined) {
|
|
527
|
+
throw Object.assign(new Error('finalized block not found'), {
|
|
528
|
+
details: 'finalized block not found',
|
|
529
|
+
});
|
|
530
|
+
}
|
|
493
531
|
blockNum = this.finalizedL1BlockNumber;
|
|
494
532
|
} else {
|
|
495
533
|
blockNum = args.blockNumber ?? (await publicClient.getBlockNumber());
|
|
@@ -515,10 +553,10 @@ export class FakeL1State {
|
|
|
515
553
|
createMockBlobClient(): MockProxy<BlobClientInterface> {
|
|
516
554
|
const blobClient = mock<BlobClientInterface>();
|
|
517
555
|
|
|
518
|
-
// The blockId is the
|
|
556
|
+
// The blockId is the L1 block hash, which we derive from the L1 block number
|
|
519
557
|
blobClient.getBlobSidecar.mockImplementation((blockId: `0x${string}`) =>
|
|
520
558
|
Promise.resolve(
|
|
521
|
-
this.checkpoints.find(cpData => cpData.
|
|
559
|
+
this.checkpoints.find(cpData => Buffer32.fromBigInt(cpData.l1BlockNumber).toString() === blockId)?.blobs ?? [],
|
|
522
560
|
),
|
|
523
561
|
);
|
|
524
562
|
|
|
@@ -594,13 +632,38 @@ export class FakeL1State {
|
|
|
594
632
|
}));
|
|
595
633
|
}
|
|
596
634
|
|
|
635
|
+
private getMessageSentLogByHash(msgHash: string, aroundL1BlockNumber: bigint): MessageSentLog | undefined {
|
|
636
|
+
const msg = this.messages.find(
|
|
637
|
+
msg =>
|
|
638
|
+
msg.leaf.toString() === msgHash &&
|
|
639
|
+
msg.l1BlockNumber >= aroundL1BlockNumber - 5n &&
|
|
640
|
+
msg.l1BlockNumber <= aroundL1BlockNumber + 5n,
|
|
641
|
+
);
|
|
642
|
+
if (!msg) {
|
|
643
|
+
return undefined;
|
|
644
|
+
}
|
|
645
|
+
return {
|
|
646
|
+
l1BlockNumber: msg.l1BlockNumber,
|
|
647
|
+
l1BlockHash: Buffer32.fromBigInt(msg.l1BlockNumber),
|
|
648
|
+
l1TransactionHash: `0x${msg.l1BlockNumber.toString(16)}` as `0x${string}`,
|
|
649
|
+
args: {
|
|
650
|
+
checkpointNumber: msg.checkpointNumber,
|
|
651
|
+
index: msg.index,
|
|
652
|
+
leaf: msg.leaf,
|
|
653
|
+
rollingHash: msg.rollingHash,
|
|
654
|
+
},
|
|
655
|
+
};
|
|
656
|
+
}
|
|
657
|
+
|
|
597
658
|
private async makeRollupTx(
|
|
598
659
|
checkpoint: Checkpoint,
|
|
599
660
|
signers: Secp256k1Signer[],
|
|
600
661
|
): Promise<{ tx: Transaction; attestationsHash: Buffer32; payloadDigest: Buffer32 }> {
|
|
662
|
+
const signatureContext = this.getSignatureContext();
|
|
663
|
+
const consensusPayload = ConsensusPayload.fromCheckpoint(checkpoint, signatureContext);
|
|
664
|
+
const attestationDigest = getHashedSignaturePayloadTypedData(consensusPayload);
|
|
601
665
|
const attestations = signers
|
|
602
|
-
.map(signer =>
|
|
603
|
-
.map(attestation => CommitteeAttestation.fromSignature(attestation.signature))
|
|
666
|
+
.map(signer => CommitteeAttestation.fromSignature(signer.sign(attestationDigest)))
|
|
604
667
|
.map(committeeAttestation => committeeAttestation.toViem());
|
|
605
668
|
|
|
606
669
|
const header = checkpoint.header.toViem();
|
|
@@ -608,11 +671,15 @@ export class FakeL1State {
|
|
|
608
671
|
const archive = toHex(checkpoint.archive.root.toBuffer());
|
|
609
672
|
const attestationsAndSigners = new CommitteeAttestationsAndSigners(
|
|
610
673
|
attestations.map(attestation => CommitteeAttestation.fromViem(attestation)),
|
|
674
|
+
signatureContext,
|
|
611
675
|
);
|
|
612
676
|
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
677
|
+
// Fall back to a random signer when no attesters are provided, so tests that
|
|
678
|
+
// don't care about the proposer identity (e.g. sync tests) still produce a
|
|
679
|
+
// valid-looking signature for the attestationsAndSigners struct.
|
|
680
|
+
const proposerSigner = signers[0] ?? Secp256k1Signer.random();
|
|
681
|
+
const attestationsAndSignersSignature = proposerSigner.sign(
|
|
682
|
+
getHashedSignaturePayloadTypedData(attestationsAndSigners),
|
|
616
683
|
);
|
|
617
684
|
|
|
618
685
|
const packedAttestations = attestationsAndSigners.getPackedAttestations();
|
|
@@ -653,9 +720,7 @@ export class FakeL1State {
|
|
|
653
720
|
);
|
|
654
721
|
|
|
655
722
|
// Compute payloadDigest (same logic as CalldataRetriever)
|
|
656
|
-
const
|
|
657
|
-
const payloadToSign = consensusPayload.getPayloadToSign(SignatureDomainSeparator.checkpointAttestation);
|
|
658
|
-
const payloadDigest = Buffer32.fromString(keccak256(payloadToSign));
|
|
723
|
+
const payloadDigest = getHashedSignaturePayloadTypedData(consensusPayload);
|
|
659
724
|
|
|
660
725
|
const tx = {
|
|
661
726
|
input: multiCallInput,
|
|
@@ -667,6 +732,13 @@ export class FakeL1State {
|
|
|
667
732
|
return { tx, attestationsHash, payloadDigest };
|
|
668
733
|
}
|
|
669
734
|
|
|
735
|
+
private getSignatureContext() {
|
|
736
|
+
return {
|
|
737
|
+
chainId: 1,
|
|
738
|
+
rollupAddress: this.config.rollupAddress,
|
|
739
|
+
};
|
|
740
|
+
}
|
|
741
|
+
|
|
670
742
|
/** Extracts the CommitteeAttestations struct definition from RollupAbi for hash computation. */
|
|
671
743
|
private getCommitteeAttestationsStructDef(): AbiParameter {
|
|
672
744
|
const proposeFunction = RollupAbi.find(item => item.type === 'function' && item.name === 'propose') as
|
|
@@ -16,7 +16,13 @@ import {
|
|
|
16
16
|
type L2Tips,
|
|
17
17
|
type ValidateCheckpointResult,
|
|
18
18
|
} from '@aztec/stdlib/block';
|
|
19
|
-
import {
|
|
19
|
+
import {
|
|
20
|
+
Checkpoint,
|
|
21
|
+
type CheckpointData,
|
|
22
|
+
L1PublishedData,
|
|
23
|
+
type ProposedCheckpointData,
|
|
24
|
+
PublishedCheckpoint,
|
|
25
|
+
} from '@aztec/stdlib/checkpoint';
|
|
20
26
|
import type { ContractClassPublic, ContractDataSource, ContractInstanceWithAddress } from '@aztec/stdlib/contract';
|
|
21
27
|
import {
|
|
22
28
|
EmptyL1RollupConstants,
|
|
@@ -39,6 +45,7 @@ export class MockL2BlockSource implements L2BlockSource, ContractDataSource {
|
|
|
39
45
|
private provenBlockNumber: number = 0;
|
|
40
46
|
private finalizedBlockNumber: number = 0;
|
|
41
47
|
private checkpointedBlockNumber: number = 0;
|
|
48
|
+
private proposedCheckpointBlockNumber: number = 0;
|
|
42
49
|
|
|
43
50
|
private log = createLogger('archiver:mock_l2_block_source');
|
|
44
51
|
|
|
@@ -89,6 +96,7 @@ export class MockL2BlockSource implements L2BlockSource, ContractDataSource {
|
|
|
89
96
|
});
|
|
90
97
|
// Keep tip numbers consistent with remaining blocks.
|
|
91
98
|
this.checkpointedBlockNumber = Math.min(this.checkpointedBlockNumber, maxBlockNum);
|
|
99
|
+
this.proposedCheckpointBlockNumber = Math.min(this.proposedCheckpointBlockNumber, maxBlockNum);
|
|
92
100
|
this.provenBlockNumber = Math.min(this.provenBlockNumber, maxBlockNum);
|
|
93
101
|
this.finalizedBlockNumber = Math.min(this.finalizedBlockNumber, maxBlockNum);
|
|
94
102
|
this.log.verbose(`Removed ${numBlocks} blocks from the mock L2 block source`);
|
|
@@ -105,9 +113,17 @@ export class MockL2BlockSource implements L2BlockSource, ContractDataSource {
|
|
|
105
113
|
this.finalizedBlockNumber = finalizedBlockNumber;
|
|
106
114
|
}
|
|
107
115
|
|
|
116
|
+
public setProposedCheckpointBlockNumber(blockNumber: number) {
|
|
117
|
+
this.proposedCheckpointBlockNumber = blockNumber;
|
|
118
|
+
}
|
|
119
|
+
|
|
108
120
|
public setCheckpointedBlockNumber(checkpointedBlockNumber: number) {
|
|
109
121
|
const prevCheckpointed = this.checkpointedBlockNumber;
|
|
110
122
|
this.checkpointedBlockNumber = checkpointedBlockNumber;
|
|
123
|
+
// Proposed checkpoint is always at least as advanced as checkpointed
|
|
124
|
+
if (this.proposedCheckpointBlockNumber < checkpointedBlockNumber) {
|
|
125
|
+
this.proposedCheckpointBlockNumber = checkpointedBlockNumber;
|
|
126
|
+
}
|
|
111
127
|
// Auto-create single-block checkpoints for newly checkpointed blocks that don't have one yet.
|
|
112
128
|
// This handles blocks added via addProposedBlocks that are now being marked as checkpointed.
|
|
113
129
|
const newCheckpoints: Checkpoint[] = [];
|
|
@@ -171,6 +187,10 @@ export class MockL2BlockSource implements L2BlockSource, ContractDataSource {
|
|
|
171
187
|
return Promise.resolve(BlockNumber(this.finalizedBlockNumber));
|
|
172
188
|
}
|
|
173
189
|
|
|
190
|
+
public getProposedCheckpointL2BlockNumber() {
|
|
191
|
+
return Promise.resolve(BlockNumber(this.proposedCheckpointBlockNumber));
|
|
192
|
+
}
|
|
193
|
+
|
|
174
194
|
public getCheckpointedBlock(number: BlockNumber): Promise<CheckpointedL2Block | undefined> {
|
|
175
195
|
if (number > this.checkpointedBlockNumber) {
|
|
176
196
|
return Promise.resolve(undefined);
|
|
@@ -301,6 +321,26 @@ export class MockL2BlockSource implements L2BlockSource, ContractDataSource {
|
|
|
301
321
|
};
|
|
302
322
|
}
|
|
303
323
|
|
|
324
|
+
public getCheckpointData(_n: CheckpointNumber): Promise<CheckpointData | undefined> {
|
|
325
|
+
return Promise.resolve(undefined);
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
public getCheckpointDataRange(_from: CheckpointNumber, _limit: number): Promise<CheckpointData[]> {
|
|
329
|
+
return Promise.resolve([]);
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
public getCheckpointNumberBySlot(_slot: SlotNumber): Promise<CheckpointNumber | undefined> {
|
|
333
|
+
return Promise.resolve(undefined);
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
public async getBlockDataWithCheckpointContext(number: BlockNumber) {
|
|
337
|
+
const data = await this.getBlockData(number);
|
|
338
|
+
if (!data) {
|
|
339
|
+
return undefined;
|
|
340
|
+
}
|
|
341
|
+
return { data, checkpoint: undefined, l1: undefined, attestations: [] };
|
|
342
|
+
}
|
|
343
|
+
|
|
304
344
|
public async getBlockDataByArchive(archive: Fr): Promise<BlockData | undefined> {
|
|
305
345
|
const block = this.l2Blocks.find(b => b.archive.root.equals(archive));
|
|
306
346
|
if (!block) {
|
|
@@ -336,6 +376,7 @@ export class MockL2BlockSource implements L2BlockSource, ContractDataSource {
|
|
|
336
376
|
),
|
|
337
377
|
startBlock: checkpoint.blocks[0].number,
|
|
338
378
|
blockCount: checkpoint.blocks.length,
|
|
379
|
+
feeAssetPriceModifier: checkpoint.feeAssetPriceModifier,
|
|
339
380
|
attestations: [],
|
|
340
381
|
l1: this.mockL1DataForCheckpoint(checkpoint),
|
|
341
382
|
}),
|
|
@@ -408,17 +449,19 @@ export class MockL2BlockSource implements L2BlockSource, ContractDataSource {
|
|
|
408
449
|
}
|
|
409
450
|
|
|
410
451
|
async getL2Tips(): Promise<L2Tips> {
|
|
411
|
-
const [latest, proven, finalized, checkpointed] = [
|
|
452
|
+
const [latest, proven, finalized, checkpointed, proposedCheckpoint] = [
|
|
412
453
|
await this.getBlockNumber(),
|
|
413
454
|
await this.getProvenBlockNumber(),
|
|
414
455
|
this.finalizedBlockNumber,
|
|
415
456
|
this.checkpointedBlockNumber,
|
|
457
|
+
await this.getProposedCheckpointL2BlockNumber(),
|
|
416
458
|
] as const;
|
|
417
459
|
|
|
418
460
|
const latestBlock = this.l2Blocks[latest - 1];
|
|
419
461
|
const provenBlock = this.l2Blocks[proven - 1];
|
|
420
462
|
const finalizedBlock = this.l2Blocks[finalized - 1];
|
|
421
463
|
const checkpointedBlock = this.l2Blocks[checkpointed - 1];
|
|
464
|
+
const proposedCheckpointBlock = this.l2Blocks[proposedCheckpoint - 1];
|
|
422
465
|
|
|
423
466
|
const latestBlockId = {
|
|
424
467
|
number: BlockNumber(latest),
|
|
@@ -436,6 +479,10 @@ export class MockL2BlockSource implements L2BlockSource, ContractDataSource {
|
|
|
436
479
|
number: BlockNumber(checkpointed),
|
|
437
480
|
hash: (await checkpointedBlock?.hash())?.toString(),
|
|
438
481
|
};
|
|
482
|
+
const proposedCheckpointBlockId = {
|
|
483
|
+
number: BlockNumber(proposedCheckpoint),
|
|
484
|
+
hash: (await proposedCheckpointBlock?.hash())?.toString(),
|
|
485
|
+
};
|
|
439
486
|
|
|
440
487
|
const makeTipId = (blockId: typeof latestBlockId) => ({
|
|
441
488
|
block: blockId,
|
|
@@ -450,6 +497,7 @@ export class MockL2BlockSource implements L2BlockSource, ContractDataSource {
|
|
|
450
497
|
checkpointed: makeTipId(checkpointedBlockId),
|
|
451
498
|
proven: makeTipId(provenBlockId),
|
|
452
499
|
finalized: makeTipId(finalizedBlockId),
|
|
500
|
+
proposedCheckpoint: makeTipId(proposedCheckpointBlockId),
|
|
453
501
|
};
|
|
454
502
|
}
|
|
455
503
|
|
|
@@ -531,6 +579,14 @@ export class MockL2BlockSource implements L2BlockSource, ContractDataSource {
|
|
|
531
579
|
return Promise.resolve({ valid: true });
|
|
532
580
|
}
|
|
533
581
|
|
|
582
|
+
getLastCheckpoint(): Promise<ProposedCheckpointData | undefined> {
|
|
583
|
+
return Promise.resolve(undefined);
|
|
584
|
+
}
|
|
585
|
+
|
|
586
|
+
getLastProposedCheckpoint(): Promise<ProposedCheckpointData | undefined> {
|
|
587
|
+
return Promise.resolve(undefined);
|
|
588
|
+
}
|
|
589
|
+
|
|
534
590
|
/** Returns checkpoints whose slot falls within the given epoch. */
|
|
535
591
|
private getCheckpointsInEpoch(epochNumber: EpochNumber): Checkpoint[] {
|
|
536
592
|
const epochDuration = DefaultL1ContractsConfig.aztecEpochDuration;
|
|
@@ -70,9 +70,10 @@ export class NoopL1Archiver extends Archiver {
|
|
|
70
70
|
debugClient,
|
|
71
71
|
rollup,
|
|
72
72
|
{
|
|
73
|
+
rollupAddress: EthAddress.ZERO,
|
|
73
74
|
registryAddress: EthAddress.ZERO,
|
|
75
|
+
inboxAddress: EthAddress.ZERO,
|
|
74
76
|
governanceProposerAddress: EthAddress.ZERO,
|
|
75
|
-
slashFactoryAddress: EthAddress.ZERO,
|
|
76
77
|
slashingProposerAddress: EthAddress.ZERO,
|
|
77
78
|
},
|
|
78
79
|
dataStore,
|
|
@@ -82,6 +83,7 @@ export class NoopL1Archiver extends Archiver {
|
|
|
82
83
|
skipValidateCheckpointAttestations: true,
|
|
83
84
|
maxAllowedEthClientDriftSeconds: 300,
|
|
84
85
|
ethereumAllowNoDebugHosts: true, // Skip trace validation
|
|
86
|
+
skipHistoricalLogsCheck: true, // Skip historical logs validation
|
|
85
87
|
},
|
|
86
88
|
blobClient,
|
|
87
89
|
instrumentation,
|