@aztec/archiver 0.0.1-commit.ec5f612 → 0.0.1-commit.ec7ac5448
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 +8 -7
- package/dest/archiver.d.ts.map +1 -1
- package/dest/archiver.js +77 -26
- package/dest/config.d.ts +3 -3
- package/dest/config.d.ts.map +1 -1
- package/dest/config.js +2 -1
- package/dest/errors.d.ts +34 -10
- package/dest/errors.d.ts.map +1 -1
- package/dest/errors.js +45 -16
- package/dest/factory.d.ts +4 -5
- package/dest/factory.d.ts.map +1 -1
- package/dest/factory.js +24 -21
- package/dest/l1/calldata_retriever.d.ts +1 -1
- package/dest/l1/calldata_retriever.d.ts.map +1 -1
- package/dest/l1/calldata_retriever.js +2 -1
- package/dest/l1/data_retrieval.d.ts +3 -3
- package/dest/l1/data_retrieval.d.ts.map +1 -1
- package/dest/l1/data_retrieval.js +14 -15
- package/dest/modules/data_source_base.d.ts +8 -6
- package/dest/modules/data_source_base.d.ts.map +1 -1
- package/dest/modules/data_source_base.js +11 -5
- package/dest/modules/data_store_updater.d.ts +18 -12
- package/dest/modules/data_store_updater.d.ts.map +1 -1
- package/dest/modules/data_store_updater.js +87 -77
- package/dest/modules/instrumentation.d.ts +4 -2
- package/dest/modules/instrumentation.d.ts.map +1 -1
- package/dest/modules/instrumentation.js +17 -6
- package/dest/modules/l1_synchronizer.d.ts +4 -2
- package/dest/modules/l1_synchronizer.d.ts.map +1 -1
- package/dest/modules/l1_synchronizer.js +166 -129
- package/dest/modules/validation.d.ts +1 -1
- package/dest/modules/validation.d.ts.map +1 -1
- package/dest/modules/validation.js +2 -2
- package/dest/store/block_store.d.ts +50 -16
- package/dest/store/block_store.d.ts.map +1 -1
- package/dest/store/block_store.js +288 -119
- 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 +45 -22
- package/dest/store/kv_archiver_store.d.ts.map +1 -1
- package/dest/store/kv_archiver_store.js +57 -27
- 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 +25 -5
- package/dest/store/log_store.d.ts +6 -3
- package/dest/store/log_store.d.ts.map +1 -1
- package/dest/store/log_store.js +93 -16
- package/dest/store/message_store.d.ts +5 -1
- package/dest/store/message_store.d.ts.map +1 -1
- package/dest/store/message_store.js +21 -9
- package/dest/test/fake_l1_state.d.ts +16 -1
- package/dest/test/fake_l1_state.d.ts.map +1 -1
- package/dest/test/fake_l1_state.js +77 -8
- 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 +10 -4
- package/dest/test/mock_l2_block_source.d.ts.map +1 -1
- package/dest/test/mock_l2_block_source.js +35 -7
- package/dest/test/mock_structs.d.ts +4 -1
- package/dest/test/mock_structs.d.ts.map +1 -1
- package/dest/test/mock_structs.js +13 -1
- package/dest/test/noop_l1_archiver.d.ts +4 -1
- package/dest/test/noop_l1_archiver.d.ts.map +1 -1
- package/dest/test/noop_l1_archiver.js +5 -2
- package/package.json +13 -13
- package/src/archiver.ts +98 -31
- package/src/config.ts +8 -1
- package/src/errors.ts +70 -26
- package/src/factory.ts +23 -15
- package/src/l1/calldata_retriever.ts +2 -1
- package/src/l1/data_retrieval.ts +8 -12
- package/src/modules/data_source_base.ts +26 -7
- package/src/modules/data_store_updater.ts +96 -107
- package/src/modules/instrumentation.ts +19 -7
- package/src/modules/l1_synchronizer.ts +189 -161
- package/src/modules/validation.ts +2 -2
- package/src/store/block_store.ts +370 -140
- 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 +81 -39
- package/src/store/l2_tips_cache.ts +50 -11
- package/src/store/log_store.ts +126 -27
- package/src/store/message_store.ts +27 -10
- package/src/structs/inbox_message.ts +1 -1
- package/src/test/fake_l1_state.ts +103 -13
- package/src/test/mock_l1_to_l2_message_source.ts +1 -0
- package/src/test/mock_l2_block_source.ts +52 -5
- package/src/test/mock_structs.ts +20 -6
- package/src/test/noop_l1_archiver.ts +7 -2
package/src/test/mock_structs.ts
CHANGED
|
@@ -127,6 +127,25 @@ export function makeL1PublishedData(l1BlockNumber: number): L1PublishedData {
|
|
|
127
127
|
return new L1PublishedData(BigInt(l1BlockNumber), BigInt(l1BlockNumber * 1000), makeBlockHash(l1BlockNumber));
|
|
128
128
|
}
|
|
129
129
|
|
|
130
|
+
/** Creates a Checkpoint from a list of blocks with a header that matches the blocks' structure. */
|
|
131
|
+
export function makeCheckpoint(blocks: L2Block[], checkpointNumber = CheckpointNumber(1)): Checkpoint {
|
|
132
|
+
const firstBlock = blocks[0];
|
|
133
|
+
const { slotNumber, timestamp, coinbase, feeRecipient, gasFees } = firstBlock.header.globalVariables;
|
|
134
|
+
return new Checkpoint(
|
|
135
|
+
blocks.at(-1)!.archive,
|
|
136
|
+
CheckpointHeader.random({
|
|
137
|
+
lastArchiveRoot: firstBlock.header.lastArchive.root,
|
|
138
|
+
slotNumber,
|
|
139
|
+
timestamp,
|
|
140
|
+
coinbase,
|
|
141
|
+
feeRecipient,
|
|
142
|
+
gasFees,
|
|
143
|
+
}),
|
|
144
|
+
blocks,
|
|
145
|
+
checkpointNumber,
|
|
146
|
+
);
|
|
147
|
+
}
|
|
148
|
+
|
|
130
149
|
/** Wraps a Checkpoint with L1 published data and random attestations. */
|
|
131
150
|
export function makePublishedCheckpoint(
|
|
132
151
|
checkpoint: Checkpoint,
|
|
@@ -301,11 +320,6 @@ export async function makeCheckpointWithLogs(
|
|
|
301
320
|
return txEffect;
|
|
302
321
|
});
|
|
303
322
|
|
|
304
|
-
const checkpoint =
|
|
305
|
-
AppendOnlyTreeSnapshot.random(),
|
|
306
|
-
CheckpointHeader.random(),
|
|
307
|
-
[block],
|
|
308
|
-
CheckpointNumber.fromBlockNumber(BlockNumber(blockNumber)),
|
|
309
|
-
);
|
|
323
|
+
const checkpoint = makeCheckpoint([block], CheckpointNumber.fromBlockNumber(BlockNumber(blockNumber)));
|
|
310
324
|
return makePublishedCheckpoint(checkpoint, blockNumber);
|
|
311
325
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { BlobClientInterface } from '@aztec/blob-client/client';
|
|
2
2
|
import type { RollupContract } from '@aztec/ethereum/contracts';
|
|
3
3
|
import type { ViemPublicClient, ViemPublicDebugClient } from '@aztec/ethereum/types';
|
|
4
|
+
import { SlotNumber } from '@aztec/foundation/branded-types';
|
|
4
5
|
import { Buffer32 } from '@aztec/foundation/buffer';
|
|
5
6
|
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
6
7
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
@@ -30,7 +31,7 @@ class NoopL1Synchronizer implements FunctionsOf<ArchiverL1Synchronizer> {
|
|
|
30
31
|
return 0n;
|
|
31
32
|
}
|
|
32
33
|
getL1Timestamp(): bigint | undefined {
|
|
33
|
-
return
|
|
34
|
+
return undefined;
|
|
34
35
|
}
|
|
35
36
|
testEthereumNodeSynced(): Promise<void> {
|
|
36
37
|
return Promise.resolve();
|
|
@@ -71,7 +72,6 @@ export class NoopL1Archiver extends Archiver {
|
|
|
71
72
|
{
|
|
72
73
|
registryAddress: EthAddress.ZERO,
|
|
73
74
|
governanceProposerAddress: EthAddress.ZERO,
|
|
74
|
-
slashFactoryAddress: EthAddress.ZERO,
|
|
75
75
|
slashingProposerAddress: EthAddress.ZERO,
|
|
76
76
|
},
|
|
77
77
|
dataStore,
|
|
@@ -96,6 +96,11 @@ export class NoopL1Archiver extends Archiver {
|
|
|
96
96
|
this.runningPromise.start();
|
|
97
97
|
return Promise.resolve();
|
|
98
98
|
}
|
|
99
|
+
|
|
100
|
+
/** Always reports as fully synced since there is no real L1 to sync from. */
|
|
101
|
+
public override getSyncedL2SlotNumber(): Promise<SlotNumber | undefined> {
|
|
102
|
+
return Promise.resolve(SlotNumber(Number.MAX_SAFE_INTEGER));
|
|
103
|
+
}
|
|
99
104
|
}
|
|
100
105
|
|
|
101
106
|
/** Creates an archiver with mocked L1 connectivity for testing. */
|