@aztec/archiver 4.0.0-nightly.20260113 → 4.0.0-nightly.20260114
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 +139 -22
- package/dest/archiver/archive_source_base.d.ts +75 -0
- package/dest/archiver/archive_source_base.d.ts.map +1 -0
- package/dest/archiver/archive_source_base.js +202 -0
- package/dest/archiver/archiver.d.ts +28 -167
- package/dest/archiver/archiver.d.ts.map +1 -1
- package/dest/archiver/archiver.js +46 -601
- package/dest/archiver/archiver_store_updates.d.ts +38 -0
- package/dest/archiver/archiver_store_updates.d.ts.map +1 -0
- package/dest/archiver/archiver_store_updates.js +212 -0
- package/dest/archiver/index.d.ts +3 -2
- package/dest/archiver/index.d.ts.map +1 -1
- package/dest/archiver/index.js +2 -0
- package/dest/archiver/kv_archiver_store/block_store.d.ts +1 -1
- package/dest/archiver/kv_archiver_store/block_store.js +1 -1
- package/dest/archiver/kv_archiver_store/contract_class_store.d.ts +1 -1
- package/dest/archiver/kv_archiver_store/contract_class_store.js +1 -1
- package/dest/archiver/kv_archiver_store/contract_instance_store.d.ts +1 -1
- package/dest/archiver/kv_archiver_store/contract_instance_store.js +1 -1
- package/dest/archiver/kv_archiver_store/kv_archiver_store.d.ts +169 -9
- package/dest/archiver/kv_archiver_store/kv_archiver_store.d.ts.map +1 -1
- package/dest/archiver/kv_archiver_store/kv_archiver_store.js +157 -49
- package/dest/archiver/l1/data_retrieval.d.ts +9 -11
- package/dest/archiver/l1/data_retrieval.d.ts.map +1 -1
- package/dest/archiver/l1/data_retrieval.js +32 -51
- package/dest/archiver/test/fake_l1_state.d.ts +173 -0
- package/dest/archiver/test/fake_l1_state.d.ts.map +1 -0
- package/dest/archiver/test/fake_l1_state.js +364 -0
- package/package.json +13 -13
- package/src/archiver/archive_source_base.ts +339 -0
- package/src/archiver/archiver.ts +62 -808
- package/src/archiver/archiver_store_updates.ts +321 -0
- package/src/archiver/index.ts +2 -1
- package/src/archiver/kv_archiver_store/block_store.ts +1 -1
- package/src/archiver/kv_archiver_store/contract_class_store.ts +1 -1
- package/src/archiver/kv_archiver_store/contract_instance_store.ts +1 -1
- package/src/archiver/kv_archiver_store/kv_archiver_store.ts +170 -8
- package/src/archiver/l1/data_retrieval.ts +51 -68
- package/src/archiver/test/fake_l1_state.ts +561 -0
- package/dest/archiver/archiver_store.d.ts +0 -315
- package/dest/archiver/archiver_store.d.ts.map +0 -1
- package/dest/archiver/archiver_store.js +0 -4
- package/dest/archiver/archiver_store_test_suite.d.ts +0 -8
- package/dest/archiver/archiver_store_test_suite.d.ts.map +0 -1
- package/dest/archiver/archiver_store_test_suite.js +0 -2770
- package/src/archiver/archiver_store.ts +0 -380
- package/src/archiver/archiver_store_test_suite.ts +0 -2842
package/README.md
CHANGED
|
@@ -1,37 +1,154 @@
|
|
|
1
1
|
# Archiver
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
The archiver fetches onchain data from L1 and stores it locally in a queryable form. It pulls:
|
|
4
|
+
- **Checkpoints** (containing L2 blocks) from `CheckpointProposed` events on the Rollup contract
|
|
5
|
+
- **L1-to-L2 messages** from `MessageSent` events on the Inbox contract
|
|
4
6
|
|
|
5
|
-
The
|
|
7
|
+
The interfaces `L2BlockSource`, `L2LogsSource`, and `ContractDataSource` define how consumers access this data. Interface `L2BlockSink` allows other subsystems, such as the validator client, to push not-yet-checkpointed blocks into the archiver.
|
|
6
8
|
|
|
7
|
-
|
|
8
|
-
2. `MessageAdded` event emitted on Inbox contract,
|
|
9
|
+
## Events
|
|
9
10
|
|
|
10
|
-
The
|
|
11
|
+
The archiver emits events for other subsystems to react to state changes:
|
|
11
12
|
|
|
12
|
-
|
|
13
|
+
- **`L2PruneDetected`**: Emitted before unwinding checkpoints due to epoch prune. Contains the epoch number and affected blocks. Subscribers (e.g., world-state) use this to prepare for the unwind.
|
|
14
|
+
- **`L2BlockProven`**: Emitted when the proven checkpoint advances. Contains the block number, slot, and epoch.
|
|
15
|
+
- **`InvalidAttestationsCheckpointDetected`**: Emitted when a checkpoint with invalid attestations is encountered during sync.
|
|
13
16
|
|
|
14
|
-
|
|
17
|
+
Note that most subsystems handle these events not by subscribing but by polling the archiver using an `L2BlockStream`. This means that, if the node stops while a subsystem has not yet processed an event, the block stream will detect it and have the subsystem reprocess it.
|
|
15
18
|
|
|
16
|
-
|
|
19
|
+
## Sync Process
|
|
17
20
|
|
|
18
|
-
|
|
21
|
+
The archiver runs a periodic sync loop with two phases:
|
|
19
22
|
|
|
20
|
-
|
|
23
|
+
1. **Process queued blocks**: External subsystems (e.g., sequencer) can push blocks directly via `addBlock()`
|
|
24
|
+
2. **Sync from L1**: Pull checkpoints and messages from L1 contracts
|
|
21
25
|
|
|
22
|
-
|
|
23
|
-
|
|
26
|
+
```
|
|
27
|
+
sync()
|
|
28
|
+
├── processQueuedBlocks() # Handle blocks pushed via addBlock()
|
|
29
|
+
└── syncFromL1()
|
|
30
|
+
├── handleL1ToL2Messages() # Sync messages from Inbox contract
|
|
31
|
+
├── handleCheckpoints() # Sync checkpoints from Rollup contract
|
|
32
|
+
├── handleEpochPrune() # Proactive unwind before proof window expires
|
|
33
|
+
└── checkForNewCheckpointsBeforeL1SyncPoint() # Handle L1 reorg edge case
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Each sync iteration pins the current L1 block number at the start and uses it as an upper bound for all queries. This ensures consistent data retrieval even if L1 advances during the iteration.
|
|
37
|
+
|
|
38
|
+
Two independent syncpoints track progress on L1:
|
|
39
|
+
- `blocksSynchedTo`: L1 block number for checkpoint events
|
|
40
|
+
- `messagesSynchedTo`: L1 block ID (number + hash) for messages
|
|
41
|
+
|
|
42
|
+
### L1-to-L2 Messages
|
|
43
|
+
|
|
44
|
+
Messages are synced from the Inbox contract via `handleL1ToL2Messages()`:
|
|
45
|
+
|
|
46
|
+
1. Query Inbox state at the current L1 block (message count + rolling hash)
|
|
47
|
+
2. Compare local vs remote state
|
|
48
|
+
3. If they match, nothing to do
|
|
49
|
+
4. If mismatch, validate the local last message still exists on L1 with the same rolling hash
|
|
50
|
+
- If not found or hash differs, an L1 reorg occurred: find the last common message, delete everything after, and rollback the syncpoint
|
|
51
|
+
5. Fetch `MessageSent` events in batches and store
|
|
52
|
+
|
|
53
|
+
### Checkpoints
|
|
54
|
+
|
|
55
|
+
Checkpoints are synced from the Rollup contract via `handleCheckpoints()`:
|
|
56
|
+
|
|
57
|
+
1. Query rollup status (proven/pending checkpoint numbers, archive roots)
|
|
58
|
+
2. Update local proven checkpoint if it matches L1 (called early to update as soon as possible)
|
|
59
|
+
3. **Reorg detection**: Compare the local pending checkpoint's archive root against L1
|
|
60
|
+
- If not in L1 chain, unwind checkpoints until a common ancestor is found
|
|
61
|
+
4. Retrieve `CheckpointProposed` events in batches
|
|
62
|
+
5. For each checkpoint:
|
|
63
|
+
- Verify archive matches (checkpoint still in chain)
|
|
64
|
+
- Validate attestations (2/3 + 1 committee signatures required)
|
|
65
|
+
- Skip invalid checkpoints (see "Invalid Checkpoints" in Edge Cases)
|
|
66
|
+
- Verify `inHash` matches expected value (see below)
|
|
67
|
+
- Store valid checkpoints with their blocks
|
|
68
|
+
6. Update proven checkpoint again (may have advanced after storing new checkpoints)
|
|
69
|
+
7. Handle epoch prune if applicable
|
|
70
|
+
8. Check for checkpoints behind syncpoint (L1 reorg case)
|
|
71
|
+
|
|
72
|
+
The `inHash` is a hash of all L1-to-L2 messages consumed by a checkpoint. The archiver computes the expected `inHash` from locally stored messages and compares it against the checkpoint header. A mismatch indicates a bug (messages out of sync with checkpoints) and causes a fatal error.
|
|
73
|
+
|
|
74
|
+
The `blocksSynchedTo` syncpoint is updated:
|
|
75
|
+
- When checkpoints are stored: set to the L1 block of the last stored checkpoint
|
|
76
|
+
- When an invalid checkpoint is processed: advanced past it to avoid re-downloading on every iteration
|
|
77
|
+
- When the L2 chain is empty and there are still no checkpoints on L1: set to current L1 block
|
|
78
|
+
- When rolling back due to L1 reorg or missing checkpoints: set to the target L1 block to re-fetch from
|
|
79
|
+
|
|
80
|
+
Note that the `blocksSynchedTo` pointer is NOT updated during normal sync when there are no new checkpoints. This protects against small L1 reorgs that could add a checkpoint on an L1 block we have flagged as already synced.
|
|
81
|
+
|
|
82
|
+
### Block Queue
|
|
83
|
+
|
|
84
|
+
The archiver implements `L2BlockSink`, allowing other subsystems to push blocks before they appear on L1:
|
|
85
|
+
|
|
86
|
+
```typescript
|
|
87
|
+
archiver.addBlock(block); // Queues block for processing
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
Queued blocks are processed at the start of each sync iteration. This allows the sequencer to make blocks available locally before checkpoint publication. This is used to make the `proposed` chain (ie blocks that have been broadcasted via p2p but not checkpointed on L1) available to consumers.
|
|
91
|
+
|
|
92
|
+
### Edge Cases
|
|
93
|
+
|
|
94
|
+
#### L1 Reorgs
|
|
24
95
|
|
|
25
|
-
|
|
96
|
+
Both message and checkpoint sync detect L1 reorgs by comparing local state against L1. When detected, they find the last common ancestor and rollback.
|
|
97
|
+
|
|
98
|
+
**Messages**: Each stored message includes its rolling hash. During sync, if the local last message's rolling hash doesn't match L1, the archiver walks backwards through local messages, querying L1 for each one, until it finds a message with a matching rolling hash. Everything after that message is deleted, and the syncpoint is rolled back.
|
|
99
|
+
|
|
100
|
+
**Checkpoints**: When the archiver queries the Rollup contract for the archive root at the local pending checkpoint number, and it doesn't match the local archive root, the local checkpoint is no longer in L1's chain. The archiver walks backwards through local checkpoints, querying `archiveAt()` for each, until it finds one that matches. All checkpoints after that are unwound.
|
|
101
|
+
|
|
102
|
+
**Example**: The archiver has synced up to checkpoint 15. An L1 reorg replaces checkpoint 14 and 15 with different content. On the next sync:
|
|
103
|
+
1. Archiver queries `archiveAt(15)` and gets a different archive root than stored locally
|
|
104
|
+
2. Archiver queries `archiveAt(14)` — still different
|
|
105
|
+
3. Archiver queries `archiveAt(13)` — matches
|
|
106
|
+
4. Archiver unwinds checkpoints 14 and 15
|
|
107
|
+
5. Next sync iteration re-fetches the new checkpoints 14 and 15
|
|
108
|
+
|
|
109
|
+
#### Epoch Prune
|
|
110
|
+
|
|
111
|
+
If a prune would occur on the next checkpoint submission (checked via `canPruneAtTime`), the archiver preemptively unwinds to the proven checkpoint.
|
|
112
|
+
|
|
113
|
+
This handles the case where an epoch's proof submission window has passed without a valid proof being submitted. The Rollup contract will prune all unproven checkpoints on the next submission. Rather than wait for that to happen and then react, the archiver detects this condition and unwinds proactively. This keeps the local state consistent with what L1 will look like after the next checkpoint. It also means that the sequencer or validator client will build the next block with the unwind having already taken place.
|
|
114
|
+
|
|
115
|
+
**Example**: The proven checkpoint is 10, and pending checkpoints 11-15 exist locally. The proof submission window for the epoch containing checkpoint 11 will expire. On sync:
|
|
116
|
+
1. Archiver calls `canPruneAtTime()` with the next L1 block's timestamp — returns true
|
|
117
|
+
2. Archiver unwinds checkpoints 11-15
|
|
118
|
+
3. Emits `L2PruneDetected` event so subscribed subsystems can react
|
|
119
|
+
4. Local state now shows checkpoint 10 as latest
|
|
120
|
+
|
|
121
|
+
#### Checkpoints Behind Syncpoint
|
|
122
|
+
|
|
123
|
+
If after processing all logs the local checkpoint count is less than L1's pending checkpoint count, an L1 reorg may have added checkpoints _behind_ the syncpoint. The archiver rolls back the syncpoint to re-fetch.
|
|
124
|
+
|
|
125
|
+
This handles a subtle L1 reorg scenario: an L1 reorg doesn't replace existing checkpoints but adds new ones in blocks the archiver already processed. Since the archiver only queries events starting from `blocksSynchedTo`, it would miss these new checkpoints.
|
|
126
|
+
|
|
127
|
+
> [!NOTE]
|
|
128
|
+
> This scenario only occurs when `blocksSynchedTo` was advanced _without_ storing a checkpoint — specifically when the chain is empty or when an invalid checkpoint was processed (and skipped). In normal operation, `blocksSynchedTo` is set to the L1 block of the last stored checkpoint, so any L1 reorg that adds checkpoints would also change the archive root and be caught by the L1 Reorgs check (step 3 in checkpoint sync).
|
|
129
|
+
|
|
130
|
+
**Example**: The archiver has synced to L1 block 1000 with checkpoint 10. An L1 reorg at block 950 adds a new checkpoint 11 in block 960 (which was previously empty). On sync:
|
|
131
|
+
1. Archiver queries events from block 1001 onwards — finds nothing
|
|
132
|
+
2. Archiver queries Rollup contract — pending checkpoint is 11
|
|
133
|
+
3. Local checkpoint count (10) < L1 pending (11)
|
|
134
|
+
4. Archiver rolls back `blocksSynchedTo` to the L1 block of checkpoint 10
|
|
135
|
+
5. Next sync iteration re-queries from that point and finds checkpoint 11
|
|
136
|
+
|
|
137
|
+
#### Invalid Checkpoints
|
|
138
|
+
|
|
139
|
+
When the archiver encounters a checkpoint with invalid attestations, it skips it and continues processing subsequent checkpoints. It also advances `blocksSynchedTo` past the invalid checkpoint to avoid re-downloading it on every iteration.
|
|
140
|
+
|
|
141
|
+
This handles [delayed attestation verification](https://github.com/AztecProtocol/engineering-designs/pull/69): the Rollup contract no longer validates committee attestations on L1. Instead, attestations are posted in calldata and L2 nodes verify them during sync. Checkpoints with invalid attestations (insufficient signatures, wrong signers, or invalid signatures) are skipped. An honest proposer will eventually call `invalidate` on the Rollup contract to remove these checkpoints.
|
|
142
|
+
|
|
143
|
+
The archiver exposes `pendingChainValidationStatus` for the sequencer to know if there's an invalid checkpoint that needs purging before posting a new one. If invalid, this status contains the data needed for the `invalidate` call. When multiple consecutive invalid checkpoints exist, the status references the earliest one (invalidating it automatically purges descendants).
|
|
144
|
+
|
|
145
|
+
> [!WARNING]
|
|
146
|
+
> If a malicious committee attests to a descendant of an invalid checkpoint, nodes should ignore these descendants unless proven. This is not yet implemented — nodes assume honest committee majority.
|
|
26
147
|
|
|
27
|
-
|
|
28
|
-
|
|
148
|
+
**Example**: Chain has progressed to checkpoint 10. Then:
|
|
149
|
+
1. Checkpoint 11 posted with invalid attestations → archiver reports 10 as latest, `pendingChainValidationStatus` points to 11
|
|
150
|
+
2. Checkpoint 11 purged, new invalid checkpoint 11 posted → status updates to new checkpoint 11
|
|
151
|
+
3. Checkpoint 12 with invalid attestations posted → no change (status still points to 11)
|
|
152
|
+
4. Checkpoint 11 purged and reposted with valid attestations → archiver syncs checkpoint 11, status becomes valid
|
|
29
153
|
|
|
30
|
-
As an example, let's say the chain has been progressing normally up until checkpoint 10, and then:
|
|
31
|
-
1. Checkpoint 11 is posted with invalid attestations. The archiver will report 10 as the latest checkpoint, but the `pendingChainValidationStatus` will point to checkpoint 11.
|
|
32
|
-
2. Checkpoint 11 is purged, but another checkpoint 11 with invalid attestations is posted in its place. The archiver will still report 10 as latest, and the `pendingChainValidationStatus` will point to the new checkpoint 11 that needs to be purged.
|
|
33
|
-
3. Checkpoint 12 with invalid attestations is posted. No changes in the archiver.
|
|
34
|
-
4. Checkpoint 13 is posted with valid attestations, due to a malicious committee. The archiver will try to sync it and fail, since 13 does not follow 10. This scenario is not gracefully handled yet.
|
|
35
|
-
5. Checkpoints 11 to 13 are purged. The archiver status will not yet be changed: 10 will still be the latest checkpoint, and the `pendingChainValidationStatus` will point to 11. This is because the archiver does **not** follow `CheckpointInvalidated` events.
|
|
36
|
-
6. Checkpoint 11 with valid attestations is posted. The archiver pending chain now reports 11 as latest, and its status is valid.
|
|
37
154
|
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { BlockNumber, CheckpointNumber, type EpochNumber, type SlotNumber } from '@aztec/foundation/branded-types';
|
|
2
|
+
import type { Fr } from '@aztec/foundation/curves/bn254';
|
|
3
|
+
import type { EthAddress } from '@aztec/foundation/eth-address';
|
|
4
|
+
import type { FunctionSelector } from '@aztec/stdlib/abi';
|
|
5
|
+
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
6
|
+
import { type CheckpointedL2Block, L2Block, type L2BlockNew, type L2Tips, PublishedL2Block } from '@aztec/stdlib/block';
|
|
7
|
+
import { Checkpoint, PublishedCheckpoint } from '@aztec/stdlib/checkpoint';
|
|
8
|
+
import type { ContractClassPublic, ContractDataSource, ContractInstanceWithAddress } from '@aztec/stdlib/contract';
|
|
9
|
+
import type { L1RollupConstants } from '@aztec/stdlib/epoch-helpers';
|
|
10
|
+
import type { GetContractClassLogsResponse, GetPublicLogsResponse } from '@aztec/stdlib/interfaces/client';
|
|
11
|
+
import type { L2LogsSource } from '@aztec/stdlib/interfaces/server';
|
|
12
|
+
import type { LogFilter, SiloedTag, Tag, TxScopedL2Log } from '@aztec/stdlib/logs';
|
|
13
|
+
import type { L1ToL2MessageSource } from '@aztec/stdlib/messaging';
|
|
14
|
+
import type { BlockHeader, IndexedTxEffect, TxHash, TxReceipt } from '@aztec/stdlib/tx';
|
|
15
|
+
import type { UInt64 } from '@aztec/stdlib/types';
|
|
16
|
+
import type { ArchiveSource } from './archiver.js';
|
|
17
|
+
import type { KVArchiverDataStore } from './kv_archiver_store/kv_archiver_store.js';
|
|
18
|
+
import type { ValidateCheckpointResult } from './validation.js';
|
|
19
|
+
/**
|
|
20
|
+
* Abstract base class implementing ArchiveSource using a KVArchiverDataStore.
|
|
21
|
+
* Provides implementations for all store-delegating methods and declares abstract methods
|
|
22
|
+
* for L1-dependent functionality that subclasses must implement.
|
|
23
|
+
*/
|
|
24
|
+
export declare abstract class ArchiveSourceBase implements ArchiveSource, L2LogsSource, ContractDataSource, L1ToL2MessageSource {
|
|
25
|
+
protected readonly store: KVArchiverDataStore;
|
|
26
|
+
constructor(store: KVArchiverDataStore);
|
|
27
|
+
abstract getRollupAddress(): Promise<EthAddress>;
|
|
28
|
+
abstract getRegistryAddress(): Promise<EthAddress>;
|
|
29
|
+
abstract getL1Constants(): Promise<L1RollupConstants>;
|
|
30
|
+
abstract getGenesisValues(): Promise<{
|
|
31
|
+
genesisArchiveRoot: Fr;
|
|
32
|
+
}>;
|
|
33
|
+
abstract getL1Timestamp(): Promise<bigint | undefined>;
|
|
34
|
+
abstract getL2Tips(): Promise<L2Tips>;
|
|
35
|
+
abstract getL2SlotNumber(): Promise<SlotNumber | undefined>;
|
|
36
|
+
abstract getL2EpochNumber(): Promise<EpochNumber | undefined>;
|
|
37
|
+
abstract getCheckpointsForEpoch(epochNumber: EpochNumber): Promise<Checkpoint[]>;
|
|
38
|
+
abstract getBlocksForEpoch(epochNumber: EpochNumber): Promise<L2Block[]>;
|
|
39
|
+
abstract getBlockHeadersForEpoch(epochNumber: EpochNumber): Promise<BlockHeader[]>;
|
|
40
|
+
abstract isEpochComplete(epochNumber: EpochNumber): Promise<boolean>;
|
|
41
|
+
abstract syncImmediate(): Promise<void>;
|
|
42
|
+
getBlockNumber(): Promise<BlockNumber>;
|
|
43
|
+
getProvenBlockNumber(): Promise<BlockNumber>;
|
|
44
|
+
getBlockHeader(number: BlockNumber | 'latest'): Promise<BlockHeader | undefined>;
|
|
45
|
+
getCheckpointedBlock(number: BlockNumber): Promise<CheckpointedL2Block | undefined>;
|
|
46
|
+
getCheckpointedBlocks(from: BlockNumber, limit: number, proven?: boolean): Promise<CheckpointedL2Block[]>;
|
|
47
|
+
getBlockHeaderByHash(blockHash: Fr): Promise<BlockHeader | undefined>;
|
|
48
|
+
getBlockHeaderByArchive(archive: Fr): Promise<BlockHeader | undefined>;
|
|
49
|
+
getL2BlockNew(number: BlockNumber): Promise<L2BlockNew | undefined>;
|
|
50
|
+
getTxEffect(txHash: TxHash): Promise<IndexedTxEffect | undefined>;
|
|
51
|
+
getSettledTxReceipt(txHash: TxHash): Promise<TxReceipt | undefined>;
|
|
52
|
+
isPendingChainInvalid(): Promise<boolean>;
|
|
53
|
+
getPendingChainValidationStatus(): Promise<ValidateCheckpointResult>;
|
|
54
|
+
getL2BlocksNew(from: BlockNumber, limit: number, proven?: boolean): Promise<L2BlockNew[]>;
|
|
55
|
+
getPrivateLogsByTags(tags: SiloedTag[]): Promise<TxScopedL2Log[][]>;
|
|
56
|
+
getPublicLogsByTagsFromContract(contractAddress: AztecAddress, tags: Tag[]): Promise<TxScopedL2Log[][]>;
|
|
57
|
+
getPublicLogs(filter: LogFilter): Promise<GetPublicLogsResponse>;
|
|
58
|
+
getContractClassLogs(filter: LogFilter): Promise<GetContractClassLogsResponse>;
|
|
59
|
+
getContractClass(id: Fr): Promise<ContractClassPublic | undefined>;
|
|
60
|
+
getBytecodeCommitment(id: Fr): Promise<Fr | undefined>;
|
|
61
|
+
getContract(address: AztecAddress, maybeTimestamp?: UInt64): Promise<ContractInstanceWithAddress | undefined>;
|
|
62
|
+
getContractClassIds(): Promise<Fr[]>;
|
|
63
|
+
getDebugFunctionName(address: AztecAddress, selector: FunctionSelector): Promise<string | undefined>;
|
|
64
|
+
registerContractFunctionSignatures(signatures: string[]): Promise<void>;
|
|
65
|
+
getL1ToL2Messages(checkpointNumber: CheckpointNumber): Promise<Fr[]>;
|
|
66
|
+
getL1ToL2MessageIndex(l1ToL2Message: Fr): Promise<bigint | undefined>;
|
|
67
|
+
getPublishedCheckpoints(checkpointNumber: CheckpointNumber, limit: number): Promise<PublishedCheckpoint[]>;
|
|
68
|
+
getPublishedBlocks(from: BlockNumber, limit: number, proven?: boolean): Promise<PublishedL2Block[]>;
|
|
69
|
+
getBlock(number: BlockNumber): Promise<L2Block | undefined>;
|
|
70
|
+
getBlocks(from: BlockNumber, limit: number, proven?: boolean): Promise<L2Block[]>;
|
|
71
|
+
getPublishedBlockByHash(blockHash: Fr): Promise<PublishedL2Block | undefined>;
|
|
72
|
+
getPublishedBlockByArchive(archive: Fr): Promise<PublishedL2Block | undefined>;
|
|
73
|
+
private buildOldBlockFromCheckpointedBlock;
|
|
74
|
+
}
|
|
75
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYXJjaGl2ZV9zb3VyY2VfYmFzZS5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL2FyY2hpdmVyL2FyY2hpdmVfc291cmNlX2Jhc2UudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLFdBQVcsRUFBRSxnQkFBZ0IsRUFBRSxLQUFLLFdBQVcsRUFBRSxLQUFLLFVBQVUsRUFBRSxNQUFNLGlDQUFpQyxDQUFDO0FBQ25ILE9BQU8sS0FBSyxFQUFFLEVBQUUsRUF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a,kCAAkC;CAwBjD"}
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
import { CheckpointNumber } from '@aztec/foundation/branded-types';
|
|
2
|
+
import { isDefined } from '@aztec/foundation/types';
|
|
3
|
+
import { CommitteeAttestation, L2Block, PublishedL2Block } from '@aztec/stdlib/block';
|
|
4
|
+
import { Checkpoint, PublishedCheckpoint } from '@aztec/stdlib/checkpoint';
|
|
5
|
+
/**
|
|
6
|
+
* Abstract base class implementing ArchiveSource using a KVArchiverDataStore.
|
|
7
|
+
* Provides implementations for all store-delegating methods and declares abstract methods
|
|
8
|
+
* for L1-dependent functionality that subclasses must implement.
|
|
9
|
+
*/ export class ArchiveSourceBase {
|
|
10
|
+
store;
|
|
11
|
+
constructor(store){
|
|
12
|
+
this.store = store;
|
|
13
|
+
}
|
|
14
|
+
// Store-delegating methods
|
|
15
|
+
getBlockNumber() {
|
|
16
|
+
return this.store.getLatestBlockNumber();
|
|
17
|
+
}
|
|
18
|
+
getProvenBlockNumber() {
|
|
19
|
+
return this.store.getProvenBlockNumber();
|
|
20
|
+
}
|
|
21
|
+
async getBlockHeader(number) {
|
|
22
|
+
const blockNumber = number === 'latest' ? await this.store.getLatestBlockNumber() : number;
|
|
23
|
+
if (blockNumber === 0) {
|
|
24
|
+
return undefined;
|
|
25
|
+
}
|
|
26
|
+
const headers = await this.store.getBlockHeaders(blockNumber, 1);
|
|
27
|
+
return headers.length === 0 ? undefined : headers[0];
|
|
28
|
+
}
|
|
29
|
+
getCheckpointedBlock(number) {
|
|
30
|
+
return this.store.getCheckpointedBlock(number);
|
|
31
|
+
}
|
|
32
|
+
async getCheckpointedBlocks(from, limit, proven) {
|
|
33
|
+
const blocks = await this.store.getCheckpointedBlocks(from, limit);
|
|
34
|
+
if (proven === true) {
|
|
35
|
+
const provenBlockNumber = await this.store.getProvenBlockNumber();
|
|
36
|
+
return blocks.filter((b)=>b.block.number <= provenBlockNumber);
|
|
37
|
+
}
|
|
38
|
+
return blocks;
|
|
39
|
+
}
|
|
40
|
+
getBlockHeaderByHash(blockHash) {
|
|
41
|
+
return this.store.getBlockHeaderByHash(blockHash);
|
|
42
|
+
}
|
|
43
|
+
getBlockHeaderByArchive(archive) {
|
|
44
|
+
return this.store.getBlockHeaderByArchive(archive);
|
|
45
|
+
}
|
|
46
|
+
async getL2BlockNew(number) {
|
|
47
|
+
// If the number provided is -ve, then return the latest block.
|
|
48
|
+
if (number < 0) {
|
|
49
|
+
number = await this.store.getLatestBlockNumber();
|
|
50
|
+
}
|
|
51
|
+
if (number === 0) {
|
|
52
|
+
return undefined;
|
|
53
|
+
}
|
|
54
|
+
const publishedBlock = await this.store.getBlock(number);
|
|
55
|
+
return publishedBlock;
|
|
56
|
+
}
|
|
57
|
+
getTxEffect(txHash) {
|
|
58
|
+
return this.store.getTxEffect(txHash);
|
|
59
|
+
}
|
|
60
|
+
getSettledTxReceipt(txHash) {
|
|
61
|
+
return this.store.getSettledTxReceipt(txHash);
|
|
62
|
+
}
|
|
63
|
+
isPendingChainInvalid() {
|
|
64
|
+
return this.getPendingChainValidationStatus().then((status)=>!status.valid);
|
|
65
|
+
}
|
|
66
|
+
async getPendingChainValidationStatus() {
|
|
67
|
+
return await this.store.getPendingChainValidationStatus() ?? {
|
|
68
|
+
valid: true
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
async getL2BlocksNew(from, limit, proven) {
|
|
72
|
+
const blocks = await this.store.getBlocks(from, limit);
|
|
73
|
+
if (proven === true) {
|
|
74
|
+
const provenBlockNumber = await this.store.getProvenBlockNumber();
|
|
75
|
+
return blocks.filter((b)=>b.number <= provenBlockNumber);
|
|
76
|
+
}
|
|
77
|
+
return blocks;
|
|
78
|
+
}
|
|
79
|
+
// L2LogsSource methods
|
|
80
|
+
getPrivateLogsByTags(tags) {
|
|
81
|
+
return this.store.getPrivateLogsByTags(tags);
|
|
82
|
+
}
|
|
83
|
+
getPublicLogsByTagsFromContract(contractAddress, tags) {
|
|
84
|
+
return this.store.getPublicLogsByTagsFromContract(contractAddress, tags);
|
|
85
|
+
}
|
|
86
|
+
getPublicLogs(filter) {
|
|
87
|
+
return this.store.getPublicLogs(filter);
|
|
88
|
+
}
|
|
89
|
+
getContractClassLogs(filter) {
|
|
90
|
+
return this.store.getContractClassLogs(filter);
|
|
91
|
+
}
|
|
92
|
+
// ContractDataSource methods
|
|
93
|
+
getContractClass(id) {
|
|
94
|
+
return this.store.getContractClass(id);
|
|
95
|
+
}
|
|
96
|
+
getBytecodeCommitment(id) {
|
|
97
|
+
return this.store.getBytecodeCommitment(id);
|
|
98
|
+
}
|
|
99
|
+
async getContract(address, maybeTimestamp) {
|
|
100
|
+
let timestamp;
|
|
101
|
+
if (maybeTimestamp === undefined) {
|
|
102
|
+
const latestBlockHeader = await this.getBlockHeader('latest');
|
|
103
|
+
// If we get undefined block header, it means that the archiver has not yet synced any block so we default to 0.
|
|
104
|
+
timestamp = latestBlockHeader ? latestBlockHeader.globalVariables.timestamp : 0n;
|
|
105
|
+
} else {
|
|
106
|
+
timestamp = maybeTimestamp;
|
|
107
|
+
}
|
|
108
|
+
return this.store.getContractInstance(address, timestamp);
|
|
109
|
+
}
|
|
110
|
+
getContractClassIds() {
|
|
111
|
+
return this.store.getContractClassIds();
|
|
112
|
+
}
|
|
113
|
+
getDebugFunctionName(address, selector) {
|
|
114
|
+
return this.store.getDebugFunctionName(address, selector);
|
|
115
|
+
}
|
|
116
|
+
registerContractFunctionSignatures(signatures) {
|
|
117
|
+
return this.store.registerContractFunctionSignatures(signatures);
|
|
118
|
+
}
|
|
119
|
+
// L1ToL2MessageSource methods
|
|
120
|
+
getL1ToL2Messages(checkpointNumber) {
|
|
121
|
+
return this.store.getL1ToL2Messages(checkpointNumber);
|
|
122
|
+
}
|
|
123
|
+
getL1ToL2MessageIndex(l1ToL2Message) {
|
|
124
|
+
return this.store.getL1ToL2MessageIndex(l1ToL2Message);
|
|
125
|
+
}
|
|
126
|
+
// Published checkpoint methods
|
|
127
|
+
async getPublishedCheckpoints(checkpointNumber, limit) {
|
|
128
|
+
const checkpoints = await this.store.getRangeOfCheckpoints(checkpointNumber, limit);
|
|
129
|
+
const blocks = (await Promise.all(checkpoints.map((ch)=>this.store.getBlocksForCheckpoint(ch.checkpointNumber)))).filter(isDefined);
|
|
130
|
+
const fullCheckpoints = [];
|
|
131
|
+
for(let i = 0; i < checkpoints.length; i++){
|
|
132
|
+
const blocksForCheckpoint = blocks[i];
|
|
133
|
+
const checkpoint = checkpoints[i];
|
|
134
|
+
const fullCheckpoint = new Checkpoint(checkpoint.archive, checkpoint.header, blocksForCheckpoint, checkpoint.checkpointNumber);
|
|
135
|
+
const publishedCheckpoint = new PublishedCheckpoint(fullCheckpoint, checkpoint.l1, checkpoint.attestations.map((x)=>CommitteeAttestation.fromBuffer(x)));
|
|
136
|
+
fullCheckpoints.push(publishedCheckpoint);
|
|
137
|
+
}
|
|
138
|
+
return fullCheckpoints;
|
|
139
|
+
}
|
|
140
|
+
async getPublishedBlocks(from, limit, proven) {
|
|
141
|
+
const checkpoints = await this.store.getRangeOfCheckpoints(CheckpointNumber(from), limit);
|
|
142
|
+
const provenCheckpointNumber = await this.store.getProvenCheckpointNumber();
|
|
143
|
+
const blocks = (await Promise.all(checkpoints.map((ch)=>this.store.getBlocksForCheckpoint(ch.checkpointNumber)))).filter(isDefined);
|
|
144
|
+
const olbBlocks = [];
|
|
145
|
+
for(let i = 0; i < checkpoints.length; i++){
|
|
146
|
+
const blockForCheckpoint = blocks[i][0];
|
|
147
|
+
const checkpoint = checkpoints[i];
|
|
148
|
+
if (checkpoint.checkpointNumber > provenCheckpointNumber && proven === true) {
|
|
149
|
+
continue;
|
|
150
|
+
}
|
|
151
|
+
const oldCheckpoint = new Checkpoint(blockForCheckpoint.archive, checkpoint.header, [
|
|
152
|
+
blockForCheckpoint
|
|
153
|
+
], checkpoint.checkpointNumber);
|
|
154
|
+
const oldBlock = L2Block.fromCheckpoint(oldCheckpoint);
|
|
155
|
+
const publishedBlock = new PublishedL2Block(oldBlock, checkpoint.l1, checkpoint.attestations.map((x)=>CommitteeAttestation.fromBuffer(x)));
|
|
156
|
+
olbBlocks.push(publishedBlock);
|
|
157
|
+
}
|
|
158
|
+
return olbBlocks;
|
|
159
|
+
}
|
|
160
|
+
// Legacy APIs
|
|
161
|
+
async getBlock(number) {
|
|
162
|
+
// If the number provided is -ve, then return the latest block.
|
|
163
|
+
if (number < 0) {
|
|
164
|
+
number = await this.store.getLatestBlockNumber();
|
|
165
|
+
}
|
|
166
|
+
if (number === 0) {
|
|
167
|
+
return undefined;
|
|
168
|
+
}
|
|
169
|
+
const publishedBlocks = await this.getPublishedBlocks(number, 1);
|
|
170
|
+
if (publishedBlocks.length === 0) {
|
|
171
|
+
return undefined;
|
|
172
|
+
}
|
|
173
|
+
return publishedBlocks[0].block;
|
|
174
|
+
}
|
|
175
|
+
async getBlocks(from, limit, proven) {
|
|
176
|
+
const publishedBlocks = await this.getPublishedBlocks(from, limit, proven);
|
|
177
|
+
return publishedBlocks.map((x)=>x.block);
|
|
178
|
+
}
|
|
179
|
+
async getPublishedBlockByHash(blockHash) {
|
|
180
|
+
const checkpointedBlock = await this.store.getCheckpointedBlockByHash(blockHash);
|
|
181
|
+
return this.buildOldBlockFromCheckpointedBlock(checkpointedBlock);
|
|
182
|
+
}
|
|
183
|
+
async getPublishedBlockByArchive(archive) {
|
|
184
|
+
const checkpointedBlock = await this.store.getCheckpointedBlockByArchive(archive);
|
|
185
|
+
return this.buildOldBlockFromCheckpointedBlock(checkpointedBlock);
|
|
186
|
+
}
|
|
187
|
+
async buildOldBlockFromCheckpointedBlock(checkpointedBlock) {
|
|
188
|
+
if (!checkpointedBlock) {
|
|
189
|
+
return undefined;
|
|
190
|
+
}
|
|
191
|
+
const checkpoint = await this.store.getCheckpointData(checkpointedBlock.checkpointNumber);
|
|
192
|
+
if (!checkpoint) {
|
|
193
|
+
return checkpoint;
|
|
194
|
+
}
|
|
195
|
+
const fullCheckpoint = new Checkpoint(checkpointedBlock?.block.archive, checkpoint?.header, [
|
|
196
|
+
checkpointedBlock.block
|
|
197
|
+
], checkpoint.checkpointNumber);
|
|
198
|
+
const oldBlock = L2Block.fromCheckpoint(fullCheckpoint);
|
|
199
|
+
const published = new PublishedL2Block(oldBlock, checkpoint.l1, checkpoint.attestations.map((x)=>CommitteeAttestation.fromBuffer(x)));
|
|
200
|
+
return published;
|
|
201
|
+
}
|
|
202
|
+
}
|