@aztec/archiver 3.0.0-nightly.20250908 → 3.0.0-nightly.20250911

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.
Files changed (30) hide show
  1. package/dest/archiver/archiver.d.ts +4 -3
  2. package/dest/archiver/archiver.d.ts.map +1 -1
  3. package/dest/archiver/archiver.js +32 -19
  4. package/dest/archiver/archiver_store.d.ts +5 -1
  5. package/dest/archiver/archiver_store.d.ts.map +1 -1
  6. package/dest/archiver/archiver_store_test_suite.d.ts.map +1 -1
  7. package/dest/archiver/archiver_store_test_suite.js +103 -5
  8. package/dest/archiver/data_retrieval.d.ts +2 -2
  9. package/dest/archiver/data_retrieval.d.ts.map +1 -1
  10. package/dest/archiver/data_retrieval.js +3 -3
  11. package/dest/archiver/kv_archiver_store/block_store.d.ts +11 -1
  12. package/dest/archiver/kv_archiver_store/block_store.d.ts.map +1 -1
  13. package/dest/archiver/kv_archiver_store/block_store.js +27 -3
  14. package/dest/archiver/kv_archiver_store/kv_archiver_store.d.ts +3 -1
  15. package/dest/archiver/kv_archiver_store/kv_archiver_store.d.ts.map +1 -1
  16. package/dest/archiver/kv_archiver_store/kv_archiver_store.js +6 -0
  17. package/dest/archiver/validation.d.ts.map +1 -1
  18. package/dest/archiver/validation.js +7 -4
  19. package/dest/test/mock_l2_block_source.d.ts +2 -10
  20. package/dest/test/mock_l2_block_source.d.ts.map +1 -1
  21. package/dest/test/mock_l2_block_source.js +2 -2
  22. package/package.json +13 -13
  23. package/src/archiver/archiver.ts +35 -20
  24. package/src/archiver/archiver_store.ts +7 -1
  25. package/src/archiver/archiver_store_test_suite.ts +120 -18
  26. package/src/archiver/data_retrieval.ts +5 -7
  27. package/src/archiver/kv_archiver_store/block_store.ts +44 -4
  28. package/src/archiver/kv_archiver_store/kv_archiver_store.ts +9 -1
  29. package/src/archiver/validation.ts +22 -2
  30. package/src/test/mock_l2_block_source.ts +19 -10
@@ -20,6 +20,7 @@ export async function validateBlockAttestations(
20
20
  logger?: Logger,
21
21
  ): Promise<ValidateBlockResult> {
22
22
  const attestations = getAttestationsFromPublishedL2Block(publishedBlock);
23
+ const attestors = attestations.map(a => a.getSender());
23
24
  const { block } = publishedBlock;
24
25
  const blockHash = await block.hash().then(hash => hash.toString());
25
26
  const archiveRoot = block.archive.root.toString();
@@ -51,7 +52,17 @@ export async function validateBlockAttestations(
51
52
  if (!committeeSet.has(signer)) {
52
53
  logger?.warn(`Attestation from non-committee member ${signer} at slot ${slot}`, { committee });
53
54
  const reason = 'invalid-attestation';
54
- return { valid: false, reason, invalidIndex: i, block: publishedBlock, committee, seed, epoch, attestations };
55
+ return {
56
+ valid: false,
57
+ reason,
58
+ invalidIndex: i,
59
+ block: publishedBlock.block.toBlockInfo(),
60
+ committee,
61
+ seed,
62
+ epoch,
63
+ attestors,
64
+ attestations: publishedBlock.attestations,
65
+ };
55
66
  }
56
67
  }
57
68
 
@@ -62,7 +73,16 @@ export async function validateBlockAttestations(
62
73
  ...logData,
63
74
  });
64
75
  const reason = 'insufficient-attestations';
65
- return { valid: false, reason, block: publishedBlock, committee, seed, epoch, attestations };
76
+ return {
77
+ valid: false,
78
+ reason,
79
+ block: publishedBlock.block.toBlockInfo(),
80
+ committee,
81
+ seed,
82
+ epoch,
83
+ attestors,
84
+ attestations: publishedBlock.attestations,
85
+ };
66
86
  }
67
87
 
68
88
  logger?.debug(`Block attestations validated successfully for block ${block.number} at slot ${slot}`, logData);
@@ -5,7 +5,14 @@ import type { Fr } from '@aztec/foundation/fields';
5
5
  import { createLogger } from '@aztec/foundation/log';
6
6
  import type { FunctionSelector } from '@aztec/stdlib/abi';
7
7
  import type { AztecAddress } from '@aztec/stdlib/aztec-address';
8
- import { L2Block, L2BlockHash, type L2BlockSource, type L2Tips, type ValidateBlockResult } from '@aztec/stdlib/block';
8
+ import {
9
+ L2Block,
10
+ L2BlockHash,
11
+ type L2BlockSource,
12
+ type L2Tips,
13
+ PublishedL2Block,
14
+ type ValidateBlockResult,
15
+ } from '@aztec/stdlib/block';
9
16
  import type { ContractClassPublic, ContractDataSource, ContractInstanceWithAddress } from '@aztec/stdlib/contract';
10
17
  import { EmptyL1RollupConstants, type L1RollupConstants, getSlotRangeForEpoch } from '@aztec/stdlib/epoch-helpers';
11
18
  import { type BlockHeader, TxHash, TxReceipt, TxStatus } from '@aztec/stdlib/tx';
@@ -106,15 +113,17 @@ export class MockL2BlockSource implements L2BlockSource, ContractDataSource {
106
113
 
107
114
  public async getPublishedBlocks(from: number, limit: number, proven?: boolean) {
108
115
  const blocks = await this.getBlocks(from, limit, proven);
109
- return blocks.map(block => ({
110
- block,
111
- l1: {
112
- blockNumber: BigInt(block.number),
113
- blockHash: Buffer32.random().toString(),
114
- timestamp: BigInt(block.number),
115
- },
116
- attestations: [],
117
- }));
116
+ return blocks.map(block =>
117
+ PublishedL2Block.fromFields({
118
+ block,
119
+ l1: {
120
+ blockNumber: BigInt(block.number),
121
+ blockHash: Buffer32.random().toString(),
122
+ timestamp: BigInt(block.number),
123
+ },
124
+ attestations: [],
125
+ }),
126
+ );
118
127
  }
119
128
 
120
129
  getBlockHeader(number: number | 'latest'): Promise<BlockHeader | undefined> {