@aztec/archiver 0.0.1-commit.f295ac2 → 0.0.1-commit.f504929

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 (95) hide show
  1. package/README.md +9 -0
  2. package/dest/archiver.d.ts +10 -6
  3. package/dest/archiver.d.ts.map +1 -1
  4. package/dest/archiver.js +50 -111
  5. package/dest/errors.d.ts +6 -1
  6. package/dest/errors.d.ts.map +1 -1
  7. package/dest/errors.js +8 -0
  8. package/dest/factory.d.ts +5 -2
  9. package/dest/factory.d.ts.map +1 -1
  10. package/dest/factory.js +16 -13
  11. package/dest/index.d.ts +2 -1
  12. package/dest/index.d.ts.map +1 -1
  13. package/dest/index.js +1 -0
  14. package/dest/l1/bin/retrieve-calldata.js +35 -32
  15. package/dest/l1/calldata_retriever.d.ts +73 -50
  16. package/dest/l1/calldata_retriever.d.ts.map +1 -1
  17. package/dest/l1/calldata_retriever.js +190 -259
  18. package/dest/l1/data_retrieval.d.ts +9 -9
  19. package/dest/l1/data_retrieval.d.ts.map +1 -1
  20. package/dest/l1/data_retrieval.js +24 -22
  21. package/dest/l1/spire_proposer.d.ts +5 -5
  22. package/dest/l1/spire_proposer.d.ts.map +1 -1
  23. package/dest/l1/spire_proposer.js +9 -17
  24. package/dest/l1/validate_trace.d.ts +6 -3
  25. package/dest/l1/validate_trace.d.ts.map +1 -1
  26. package/dest/l1/validate_trace.js +13 -9
  27. package/dest/modules/data_source_base.d.ts +25 -21
  28. package/dest/modules/data_source_base.d.ts.map +1 -1
  29. package/dest/modules/data_source_base.js +48 -123
  30. package/dest/modules/data_store_updater.d.ts +31 -20
  31. package/dest/modules/data_store_updater.d.ts.map +1 -1
  32. package/dest/modules/data_store_updater.js +79 -60
  33. package/dest/modules/instrumentation.d.ts +17 -4
  34. package/dest/modules/instrumentation.d.ts.map +1 -1
  35. package/dest/modules/instrumentation.js +36 -12
  36. package/dest/modules/l1_synchronizer.d.ts +4 -8
  37. package/dest/modules/l1_synchronizer.d.ts.map +1 -1
  38. package/dest/modules/l1_synchronizer.js +23 -19
  39. package/dest/store/block_store.d.ts +50 -32
  40. package/dest/store/block_store.d.ts.map +1 -1
  41. package/dest/store/block_store.js +147 -54
  42. package/dest/store/contract_class_store.d.ts +1 -1
  43. package/dest/store/contract_class_store.d.ts.map +1 -1
  44. package/dest/store/contract_class_store.js +11 -7
  45. package/dest/store/kv_archiver_store.d.ts +52 -29
  46. package/dest/store/kv_archiver_store.d.ts.map +1 -1
  47. package/dest/store/kv_archiver_store.js +49 -23
  48. package/dest/store/l2_tips_cache.d.ts +19 -0
  49. package/dest/store/l2_tips_cache.d.ts.map +1 -0
  50. package/dest/store/l2_tips_cache.js +89 -0
  51. package/dest/store/log_store.d.ts +17 -8
  52. package/dest/store/log_store.d.ts.map +1 -1
  53. package/dest/store/log_store.js +77 -43
  54. package/dest/test/fake_l1_state.d.ts +9 -4
  55. package/dest/test/fake_l1_state.d.ts.map +1 -1
  56. package/dest/test/fake_l1_state.js +56 -18
  57. package/dest/test/index.js +3 -1
  58. package/dest/test/mock_archiver.d.ts +1 -1
  59. package/dest/test/mock_archiver.d.ts.map +1 -1
  60. package/dest/test/mock_archiver.js +3 -2
  61. package/dest/test/mock_l2_block_source.d.ts +36 -21
  62. package/dest/test/mock_l2_block_source.d.ts.map +1 -1
  63. package/dest/test/mock_l2_block_source.js +151 -109
  64. package/dest/test/mock_structs.d.ts +3 -2
  65. package/dest/test/mock_structs.d.ts.map +1 -1
  66. package/dest/test/mock_structs.js +11 -9
  67. package/dest/test/noop_l1_archiver.d.ts +23 -0
  68. package/dest/test/noop_l1_archiver.d.ts.map +1 -0
  69. package/dest/test/noop_l1_archiver.js +68 -0
  70. package/package.json +14 -13
  71. package/src/archiver.ts +71 -136
  72. package/src/errors.ts +12 -0
  73. package/src/factory.ts +30 -14
  74. package/src/index.ts +1 -0
  75. package/src/l1/README.md +25 -68
  76. package/src/l1/bin/retrieve-calldata.ts +45 -33
  77. package/src/l1/calldata_retriever.ts +249 -379
  78. package/src/l1/data_retrieval.ts +27 -29
  79. package/src/l1/spire_proposer.ts +7 -15
  80. package/src/l1/validate_trace.ts +24 -6
  81. package/src/modules/data_source_base.ts +81 -167
  82. package/src/modules/data_store_updater.ts +92 -63
  83. package/src/modules/instrumentation.ts +46 -14
  84. package/src/modules/l1_synchronizer.ts +26 -24
  85. package/src/store/block_store.ts +188 -92
  86. package/src/store/contract_class_store.ts +11 -7
  87. package/src/store/kv_archiver_store.ts +85 -36
  88. package/src/store/l2_tips_cache.ts +89 -0
  89. package/src/store/log_store.ts +134 -49
  90. package/src/test/fake_l1_state.ts +77 -19
  91. package/src/test/index.ts +3 -0
  92. package/src/test/mock_archiver.ts +3 -2
  93. package/src/test/mock_l2_block_source.ts +196 -126
  94. package/src/test/mock_structs.ts +26 -10
  95. package/src/test/noop_l1_archiver.ts +109 -0
package/src/factory.ts CHANGED
@@ -6,7 +6,6 @@ import { BlockNumber } from '@aztec/foundation/branded-types';
6
6
  import { Buffer32 } from '@aztec/foundation/buffer';
7
7
  import { merge } from '@aztec/foundation/collection';
8
8
  import { Fr } from '@aztec/foundation/curves/bn254';
9
- import { createLogger } from '@aztec/foundation/log';
10
9
  import { DateProvider } from '@aztec/foundation/timer';
11
10
  import type { DataStoreConfig } from '@aztec/kv-store/config';
12
11
  import { createStore } from '@aztec/kv-store/lmdb-v2';
@@ -15,6 +14,7 @@ import { BundledProtocolContractsProvider } from '@aztec/protocol-contracts/prov
15
14
  import { FunctionType, decodeFunctionSignature } from '@aztec/stdlib/abi';
16
15
  import type { ArchiverEmitter } from '@aztec/stdlib/block';
17
16
  import { type ContractClassPublic, computePublicBytecodeCommitment } from '@aztec/stdlib/contract';
17
+ import type { L1RollupConstants } from '@aztec/stdlib/epoch-helpers';
18
18
  import { getTelemetryClient } from '@aztec/telemetry-client';
19
19
 
20
20
  import { EventEmitter } from 'events';
@@ -25,19 +25,21 @@ import { type ArchiverConfig, mapArchiverConfig } from './config.js';
25
25
  import { ArchiverInstrumentation } from './modules/instrumentation.js';
26
26
  import { ArchiverL1Synchronizer } from './modules/l1_synchronizer.js';
27
27
  import { ARCHIVER_DB_VERSION, KVArchiverDataStore } from './store/kv_archiver_store.js';
28
+ import { L2TipsCache } from './store/l2_tips_cache.js';
28
29
 
29
30
  export const ARCHIVER_STORE_NAME = 'archiver';
30
31
 
31
32
  /** Creates an archiver store. */
32
33
  export async function createArchiverStore(
33
34
  userConfig: Pick<ArchiverConfig, 'archiverStoreMapSizeKb' | 'maxLogs'> & DataStoreConfig,
35
+ l1Constants: Pick<L1RollupConstants, 'epochDuration'>,
34
36
  ) {
35
37
  const config = {
36
38
  ...userConfig,
37
39
  dataStoreMapSizeKb: userConfig.archiverStoreMapSizeKb ?? userConfig.dataStoreMapSizeKb,
38
40
  };
39
- const store = await createStore(ARCHIVER_STORE_NAME, ARCHIVER_DB_VERSION, config, createLogger('archiver:lmdb'));
40
- return new KVArchiverDataStore(store, config.maxLogs);
41
+ const store = await createStore(ARCHIVER_STORE_NAME, ARCHIVER_DB_VERSION, config);
42
+ return new KVArchiverDataStore(store, config.maxLogs, l1Constants);
41
43
  }
42
44
 
43
45
  /**
@@ -52,7 +54,7 @@ export async function createArchiver(
52
54
  deps: ArchiverDeps,
53
55
  opts: { blockUntilSync: boolean } = { blockUntilSync: true },
54
56
  ): Promise<Archiver> {
55
- const archiverStore = await createArchiverStore(config);
57
+ const archiverStore = await createArchiverStore(config, { epochDuration: config.aztecEpochDuration });
56
58
  await registerProtocolContracts(archiverStore);
57
59
 
58
60
  // Create Ethereum clients
@@ -76,14 +78,21 @@ export async function createArchiver(
76
78
  const inbox = new InboxContract(publicClient, config.l1Contracts.inboxAddress);
77
79
 
78
80
  // Fetch L1 constants from rollup contract
79
- const [l1StartBlock, l1GenesisTime, proofSubmissionEpochs, genesisArchiveRoot, slashingProposerAddress] =
80
- await Promise.all([
81
- rollup.getL1StartBlock(),
82
- rollup.getL1GenesisTime(),
83
- rollup.getProofSubmissionEpochs(),
84
- rollup.getGenesisArchiveTreeRoot(),
85
- rollup.getSlashingProposerAddress(),
86
- ] as const);
81
+ const [
82
+ l1StartBlock,
83
+ l1GenesisTime,
84
+ proofSubmissionEpochs,
85
+ genesisArchiveRoot,
86
+ slashingProposerAddress,
87
+ targetCommitteeSize,
88
+ ] = await Promise.all([
89
+ rollup.getL1StartBlock(),
90
+ rollup.getL1GenesisTime(),
91
+ rollup.getProofSubmissionEpochs(),
92
+ rollup.getGenesisArchiveTreeRoot(),
93
+ rollup.getSlashingProposerAddress(),
94
+ rollup.getTargetCommitteeSize(),
95
+ ] as const);
87
96
 
88
97
  const l1StartBlockHash = await publicClient
89
98
  .getBlock({ blockNumber: l1StartBlock, includeTransactions: false })
@@ -99,6 +108,7 @@ export async function createArchiver(
99
108
  slotDuration,
100
109
  ethereumSlotDuration,
101
110
  proofSubmissionEpochs: Number(proofSubmissionEpochs),
111
+ targetCommitteeSize,
102
112
  genesisArchiveRoot: Fr.fromString(genesisArchiveRoot.toString()),
103
113
  };
104
114
 
@@ -119,13 +129,15 @@ export async function createArchiver(
119
129
  // Create the event emitter that will be shared by archiver and synchronizer
120
130
  const events = new EventEmitter() as ArchiverEmitter;
121
131
 
132
+ // Create L2 tips cache shared by archiver and synchronizer
133
+ const l2TipsCache = new L2TipsCache(archiverStore.blockStore);
134
+
122
135
  // Create the L1 synchronizer
123
136
  const synchronizer = new ArchiverL1Synchronizer(
124
137
  publicClient,
125
138
  debugClient,
126
139
  rollup,
127
140
  inbox,
128
- { ...config.l1Contracts, slashingProposerAddress },
129
141
  archiverStore,
130
142
  archiverConfig,
131
143
  deps.blobClient,
@@ -135,6 +147,8 @@ export async function createArchiver(
135
147
  l1Constants,
136
148
  events,
137
149
  instrumentation.tracer,
150
+ l2TipsCache,
151
+ undefined, // log (use default)
138
152
  );
139
153
 
140
154
  const archiver = new Archiver(
@@ -149,13 +163,15 @@ export async function createArchiver(
149
163
  l1Constants,
150
164
  synchronizer,
151
165
  events,
166
+ l2TipsCache,
152
167
  );
153
168
 
154
169
  await archiver.start(opts.blockUntilSync);
155
170
  return archiver;
156
171
  }
157
172
 
158
- async function registerProtocolContracts(store: KVArchiverDataStore) {
173
+ /** Registers protocol contracts in the archiver store. */
174
+ export async function registerProtocolContracts(store: KVArchiverDataStore) {
159
175
  const blockNumber = 0;
160
176
  for (const name of protocolContractNames) {
161
177
  const provider = new BundledProtocolContractsProvider();
package/src/index.ts CHANGED
@@ -8,5 +8,6 @@ export * from './config.js';
8
8
  export { type L1PublishedData } from './structs/published.js';
9
9
  export { KVArchiverDataStore, ARCHIVER_DB_VERSION } from './store/kv_archiver_store.js';
10
10
  export { ContractInstanceStore } from './store/contract_instance_store.js';
11
+ export { L2TipsCache } from './store/l2_tips_cache.js';
11
12
 
12
13
  export { retrieveCheckpointsFromRollup, retrieveL2ProofVerifiedEvents } from './l1/data_retrieval.js';
package/src/l1/README.md CHANGED
@@ -5,29 +5,27 @@ Modules and classes to handle data retrieval from L1 for the archiver.
5
5
  ## Calldata Retriever
6
6
 
7
7
  The sequencer publisher bundles multiple operations into a single multicall3 transaction for gas
8
- efficiency. A typical transaction includes:
8
+ efficiency. The archiver needs to extract the `propose` calldata from these bundled transactions
9
+ to reconstruct L2 blocks.
9
10
 
10
- 1. Attestation invalidations (if needed): `invalidateBadAttestation`, `invalidateInsufficientAttestations`
11
- 2. Block proposal: `propose` (exactly one per transaction to the rollup contract)
12
- 3. Governance and slashing (if needed): votes, payload creation/execution
11
+ The retriever uses hash matching against `attestationsHash` and `payloadDigest` from the
12
+ `CheckpointProposed` L1 event to verify it has found the correct propose calldata. These hashes
13
+ are always required.
13
14
 
14
- The archiver needs to extract the `propose` calldata from these bundled transactions to reconstruct
15
- L2 blocks. This class needs to handle scenarios where the transaction was submitted via multicall3,
16
- as well as alternative ways for submitting the `propose` call that other clients might use.
15
+ ### Multicall3 Decoding with Hash Matching
17
16
 
18
- ### Multicall3 Validation and Decoding
19
-
20
- First attempt to decode the transaction as a multicall3 `aggregate3` call with validation:
17
+ First attempt to decode the transaction as a multicall3 `aggregate3` call:
21
18
 
22
19
  - Check if transaction is to multicall3 address (`0xcA11bde05977b3631167028862bE2a173976CA11`)
23
20
  - Decode as `aggregate3(Call3[] calldata calls)`
24
- - Allow calls to known addresses and methods (rollup, governance, slashing contracts, etc.)
25
- - Find the single `propose` call to the rollup contract
26
- - Verify exactly one `propose` call exists
27
- - Extract and return the propose calldata
21
+ - Find all calls matching the rollup contract address and the `propose` function selector
22
+ - Verify each candidate by computing `attestationsHash` (keccak256 of ABI-encoded attestations)
23
+ and `payloadDigest` (keccak256 of the consensus payload signing hash) and comparing against
24
+ expected values from the `CheckpointProposed` event
25
+ - Return the verified candidate (if multiple verify, return the first with a warning)
28
26
 
29
- This step handles the common case efficiently without requiring expensive trace or debug RPC calls.
30
- Any validation failure triggers fallback to the next step.
27
+ This approach works regardless of what other calls are in the multicall3 bundle, because hash
28
+ matching identifies the correct propose call without needing an allowlist.
31
29
 
32
30
  ### Direct Propose Call
33
31
 
@@ -35,64 +33,23 @@ Second attempt to decode the transaction as a direct `propose` call to the rollu
35
33
 
36
34
  - Check if transaction is to the rollup address
37
35
  - Decode as `propose` function call
38
- - Verify the function is indeed `propose`
36
+ - Verify against expected hashes
39
37
  - Return the transaction input as the propose calldata
40
38
 
41
- This handles scenarios where clients submit transactions directly to the rollup contract without
42
- using multicall3 for bundling. Any validation failure triggers fallback to the next step.
43
-
44
39
  ### Spire Proposer Call
45
40
 
46
- Given existing attempts to route the call via the Spire proposer, we also check if the tx is `to` the
47
- proposer known address, and if so, we try decoding it as either a multicall3 or a direct call to the
48
- rollup contract.
49
-
50
- Similar as with the multicall3 check, we check that there are no other calls in the Spire proposer, so
51
- we are absolutely sure that the only call is the successful one to the rollup. Any extraneous call would
52
- imply an unexpected path to calling `propose` in the rollup contract, and since we cannot verify if the
53
- calldata arguments we extracted are the correct ones (see the section below), we cannot know for sure which
54
- one is the call that succeeded, so we don't know which calldata to process.
55
-
56
- Furthermore, since the Spire proposer is upgradeable, we check if the implementation has not changed in
57
- order to decode. As usual, any validation failure triggers fallback to the next step.
58
-
59
- ### Verifying Multicall3 Arguments
60
-
61
- **This is NOT implemented for simplicity's sake**
62
-
63
- If the checks above don't hold, such as when there are multiple calls to `propose`, then we cannot
64
- reliably extract the `propose` calldata from the multicall3 arguments alone. We can try a best-effort
65
- where we try all `propose` calls we see and validate them against on-chain data. Note that we can use these
66
- same strategies if we were to obtain the calldata from another source.
67
-
68
- #### TempBlockLog Verification
69
-
70
- Read the stored `TempBlockLog` for the L2 block number from L1 and verify it matches our decoded header hash,
71
- since the `TempBlockLog` stores the hash of the proposed block header, the payload commitment, and the attestations.
72
-
73
- However, `TempBlockLog` is only stored temporarily and deleted after proven, so this method only works for recent
74
- blocks, not for historical data syncing.
75
-
76
- #### Archive Verification
77
-
78
- Verify that the archive root in the decoded propose is correct with regard to the block header. This requires
79
- hashing the block header we have retrieved, inserting it into the archive tree, and checking the resulting root
80
- against the one we got from L1.
81
-
82
- However, this requires that the archive keeps a reference to world-state, which is not the case in the current
83
- system.
84
-
85
- #### Emit Commitments in Rollup Contract
86
-
87
- Modify rollup contract to emit commitments to the block header in the `L2BlockProposed` event, allowing us to easily
88
- verify the calldata we obtained vs the emitted event.
41
+ Given existing attempts to route the call via the Spire proposer, we also check if the tx is
42
+ `to` the proposer known address. If so, we extract all wrapped calls and try each as either
43
+ a multicall3 or direct propose call, using hash matching to find and verify the correct one.
89
44
 
90
- However, modifying the rollup contract is out of scope for this change. But we can implement this approach in `v2`.
45
+ Since the Spire proposer is upgradeable, we check that the implementation has not changed in
46
+ order to decode. Any validation failure triggers fallback to the next step.
91
47
 
92
48
  ### Debug and Trace Transaction Fallback
93
49
 
94
- Last, we use L1 node's trace/debug RPC methods to definitively identify the one successful `propose` call within the tx.
95
- We can then extract the exact calldata that hit the `propose` function in the rollup contract.
50
+ Last, we use L1 node's trace/debug RPC methods to definitively identify the one successful
51
+ `propose` call within the tx. We can then extract the exact calldata that hit the `propose`
52
+ function in the rollup contract.
96
53
 
97
- This approach requires access to a debug-enabled L1 node, which may be more resource-intensive, so we only
98
- use it as a fallback when the first step fails, which should be rare in practice.
54
+ This approach requires access to a debug-enabled L1 node, which may be more resource-intensive,
55
+ so we only use it as a fallback when earlier steps fail, which should be rare in practice.
@@ -3,8 +3,9 @@ import type { ViemPublicClient, ViemPublicDebugClient } from '@aztec/ethereum/ty
3
3
  import { CheckpointNumber } from '@aztec/foundation/branded-types';
4
4
  import { EthAddress } from '@aztec/foundation/eth-address';
5
5
  import { createLogger } from '@aztec/foundation/log';
6
+ import { RollupAbi } from '@aztec/l1-artifacts/RollupAbi';
6
7
 
7
- import { type Hex, createPublicClient, http } from 'viem';
8
+ import { type Hex, createPublicClient, decodeEventLog, getAbiItem, http, toEventSelector } from 'viem';
8
9
  import { mainnet } from 'viem/chains';
9
10
 
10
11
  import { CalldataRetriever } from '../calldata_retriever.js';
@@ -88,14 +89,6 @@ async function main() {
88
89
 
89
90
  logger.info(`Transaction found in block ${tx.blockNumber}`);
90
91
 
91
- // For simplicity, use zero addresses for optional contract addresses
92
- // In production, these would be fetched from the rollup contract or configuration
93
- const slashingProposerAddress = EthAddress.ZERO;
94
- const governanceProposerAddress = EthAddress.ZERO;
95
- const slashFactoryAddress = undefined;
96
-
97
- logger.info('Using zero addresses for governance/slashing (can be configured if needed)');
98
-
99
92
  // Create CalldataRetriever
100
93
  const retriever = new CalldataRetriever(
101
94
  publicClient as unknown as ViemPublicClient,
@@ -103,48 +96,67 @@ async function main() {
103
96
  targetCommitteeSize,
104
97
  undefined,
105
98
  logger,
106
- {
107
- rollupAddress,
108
- governanceProposerAddress,
109
- slashingProposerAddress,
110
- slashFactoryAddress,
111
- },
99
+ rollupAddress,
112
100
  );
113
101
 
114
- // Extract L2 block number from transaction logs
115
- logger.info('Decoding transaction to extract L2 block number...');
102
+ // Extract checkpoint number and hashes from transaction logs
103
+ logger.info('Decoding transaction to extract checkpoint number and hashes...');
116
104
  const receipt = await publicClient.getTransactionReceipt({ hash: txHash });
117
- const l2BlockProposedEvent = receipt.logs.find(log => {
105
+
106
+ // Look for CheckpointProposed event
107
+ const checkpointProposedEventAbi = getAbiItem({ abi: RollupAbi, name: 'CheckpointProposed' });
108
+ const checkpointProposedLog = receipt.logs.find(log => {
118
109
  try {
119
- // Try to match the L2BlockProposed event
120
110
  return (
121
111
  log.address.toLowerCase() === rollupAddress.toString().toLowerCase() &&
122
- log.topics[0] === '0x2f1d0e696fa5186494a2f2f89a0e0bcbb15d607f6c5eac4637e07e1e5e7d3c00' // L2BlockProposed event signature
112
+ log.topics[0] === toEventSelector(checkpointProposedEventAbi)
123
113
  );
124
114
  } catch {
125
115
  return false;
126
116
  }
127
117
  });
128
118
 
129
- let l2BlockNumber: number;
130
- if (l2BlockProposedEvent && l2BlockProposedEvent.topics[1]) {
131
- // L2 block number is typically the first indexed parameter
132
- l2BlockNumber = Number(BigInt(l2BlockProposedEvent.topics[1]));
133
- logger.info(`L2 Block Number (from event): ${l2BlockNumber}`);
134
- } else {
135
- // Fallback: try to extract from transaction data or use a default
136
- logger.warn('Could not extract L2 block number from event, using block number as fallback');
137
- l2BlockNumber = Number(tx.blockNumber);
119
+ if (!checkpointProposedLog || checkpointProposedLog.topics[1] === undefined) {
120
+ throw new Error(`Checkpoint proposed event not found`);
138
121
  }
139
122
 
123
+ const checkpointNumber = CheckpointNumber.fromBigInt(BigInt(checkpointProposedLog.topics[1]));
124
+
125
+ // Decode the full event to extract attestationsHash and payloadDigest
126
+ const decodedEvent = decodeEventLog({
127
+ abi: RollupAbi,
128
+ data: checkpointProposedLog.data,
129
+ topics: checkpointProposedLog.topics,
130
+ });
131
+
132
+ const eventArgs = decodedEvent.args as {
133
+ checkpointNumber: bigint;
134
+ archive: Hex;
135
+ versionedBlobHashes: Hex[];
136
+ attestationsHash: Hex;
137
+ payloadDigest: Hex;
138
+ };
139
+
140
+ if (!eventArgs.attestationsHash || !eventArgs.payloadDigest) {
141
+ throw new Error(`CheckpointProposed event missing attestationsHash or payloadDigest`);
142
+ }
143
+
144
+ const expectedHashes = {
145
+ attestationsHash: eventArgs.attestationsHash,
146
+ payloadDigest: eventArgs.payloadDigest,
147
+ };
148
+
149
+ logger.info(`Checkpoint Number: ${checkpointNumber}`);
150
+ logger.info(`Attestations Hash: ${expectedHashes.attestationsHash}`);
151
+ logger.info(`Payload Digest: ${expectedHashes.payloadDigest}`);
152
+
140
153
  logger.info('');
141
- logger.info('Retrieving block header from rollup transaction...');
154
+ logger.info('Retrieving checkpoint from rollup transaction...');
142
155
  logger.info('');
143
156
 
144
- // For this script, we don't have blob hashes or expected hashes, so pass empty arrays/objects
145
- const result = await retriever.getCheckpointFromRollupTx(txHash, [], CheckpointNumber(l2BlockNumber), {});
157
+ const result = await retriever.getCheckpointFromRollupTx(txHash, [], checkpointNumber, expectedHashes);
146
158
 
147
- logger.info(' Successfully retrieved block header!');
159
+ logger.info(' Successfully retrieved block header!');
148
160
  logger.info('');
149
161
  logger.info('Block Header Details:');
150
162
  logger.info('====================');