@aztec/archiver 0.0.1-commit.f2ce05ee → 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 (68) hide show
  1. package/dest/archiver.d.ts +5 -2
  2. package/dest/archiver.d.ts.map +1 -1
  3. package/dest/archiver.js +23 -96
  4. package/dest/factory.d.ts +1 -1
  5. package/dest/factory.d.ts.map +1 -1
  6. package/dest/factory.js +5 -5
  7. package/dest/index.d.ts +2 -1
  8. package/dest/index.d.ts.map +1 -1
  9. package/dest/index.js +1 -0
  10. package/dest/l1/bin/retrieve-calldata.js +32 -28
  11. package/dest/l1/calldata_retriever.d.ts +73 -50
  12. package/dest/l1/calldata_retriever.d.ts.map +1 -1
  13. package/dest/l1/calldata_retriever.js +190 -259
  14. package/dest/l1/data_retrieval.d.ts +9 -9
  15. package/dest/l1/data_retrieval.d.ts.map +1 -1
  16. package/dest/l1/data_retrieval.js +21 -19
  17. package/dest/l1/spire_proposer.d.ts +5 -5
  18. package/dest/l1/spire_proposer.d.ts.map +1 -1
  19. package/dest/l1/spire_proposer.js +9 -17
  20. package/dest/modules/data_source_base.d.ts +8 -3
  21. package/dest/modules/data_source_base.d.ts.map +1 -1
  22. package/dest/modules/data_source_base.js +28 -72
  23. package/dest/modules/data_store_updater.d.ts +9 -2
  24. package/dest/modules/data_store_updater.d.ts.map +1 -1
  25. package/dest/modules/data_store_updater.js +40 -19
  26. package/dest/modules/instrumentation.d.ts +15 -2
  27. package/dest/modules/instrumentation.d.ts.map +1 -1
  28. package/dest/modules/instrumentation.js +19 -2
  29. package/dest/modules/l1_synchronizer.d.ts +4 -8
  30. package/dest/modules/l1_synchronizer.d.ts.map +1 -1
  31. package/dest/modules/l1_synchronizer.js +14 -9
  32. package/dest/store/block_store.d.ts +18 -14
  33. package/dest/store/block_store.d.ts.map +1 -1
  34. package/dest/store/block_store.js +69 -17
  35. package/dest/store/kv_archiver_store.d.ts +18 -4
  36. package/dest/store/kv_archiver_store.d.ts.map +1 -1
  37. package/dest/store/kv_archiver_store.js +18 -0
  38. package/dest/store/l2_tips_cache.d.ts +19 -0
  39. package/dest/store/l2_tips_cache.d.ts.map +1 -0
  40. package/dest/store/l2_tips_cache.js +89 -0
  41. package/dest/test/fake_l1_state.d.ts +6 -1
  42. package/dest/test/fake_l1_state.d.ts.map +1 -1
  43. package/dest/test/fake_l1_state.js +56 -18
  44. package/dest/test/mock_archiver.d.ts +1 -1
  45. package/dest/test/mock_archiver.d.ts.map +1 -1
  46. package/dest/test/mock_archiver.js +3 -2
  47. package/dest/test/mock_l2_block_source.d.ts +18 -3
  48. package/dest/test/mock_l2_block_source.d.ts.map +1 -1
  49. package/dest/test/mock_l2_block_source.js +125 -82
  50. package/package.json +13 -13
  51. package/src/archiver.ts +32 -115
  52. package/src/factory.ts +7 -1
  53. package/src/index.ts +1 -0
  54. package/src/l1/README.md +25 -68
  55. package/src/l1/bin/retrieve-calldata.ts +40 -27
  56. package/src/l1/calldata_retriever.ts +249 -379
  57. package/src/l1/data_retrieval.ts +23 -25
  58. package/src/l1/spire_proposer.ts +7 -15
  59. package/src/modules/data_source_base.ts +53 -92
  60. package/src/modules/data_store_updater.ts +43 -18
  61. package/src/modules/instrumentation.ts +29 -2
  62. package/src/modules/l1_synchronizer.ts +15 -12
  63. package/src/store/block_store.ts +85 -36
  64. package/src/store/kv_archiver_store.ts +35 -3
  65. package/src/store/l2_tips_cache.ts +89 -0
  66. package/src/test/fake_l1_state.ts +75 -17
  67. package/src/test/mock_archiver.ts +3 -2
  68. package/src/test/mock_l2_block_source.ts +158 -78
@@ -1 +1 @@
1
- {"version":3,"file":"calldata_retriever.d.ts","sourceRoot":"","sources":["../../src/l1/calldata_retriever.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AACrF,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AACnE,O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,GAAG,IAAI,GAAG,SAAS,CAAC;QAAC,KAAK,EAAE,GAAG,CAAC;QAAC,IAAI,EAAE,GAAG,CAAA;KAAE,EACzD,cAAc,EAAE;QAAE,gBAAgB,EAAE,GAAG,CAAC;QAAC,aAAa,EAAE,GAAG,CAAA;KAAE,EAC7D,gBAAgB,EAAE,gBAAgB,EAClC,SAAS,EAAE,GAAG,GACb,cAAc,GAAG,SAAS,CAkF5B;IAED;;;;;;;;OAQG;IACH,SAAS,CAAC,sBAAsB,CAC9B,EAAE,EAAE;QAAE,EAAE,EAAE,GAAG,GAAG,IAAI,GAAG,SAAS,CAAC;QAAC,KAAK,EAAE,GAAG,CAAC;QAAC,IAAI,EAAE,GAAG,CAAA;KAAE,EACzD,cAAc,EAAE;QAAE,gBAAgB,EAAE,GAAG,CAAC;QAAC,aAAa,EAAE,GAAG,CAAA;KAAE,EAC7D,gBAAgB,EAAE,gBAAgB,EAClC,SAAS,EAAE,GAAG,GACb,cAAc,GAAG,SAAS,CAwB5B;IAED;;;;;;OAMG;IACH,UAAgB,uBAAuB,CAAC,MAAM,EAAE,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,CAmDjE;IAED;;;;;;;;OAQG;IACH,SAAS,CAAC,yBAAyB,CACjC,eAAe,EAAE,GAAG,EACpB,cAAc,EAAE;QAAE,gBAAgB,EAAE,GAAG,CAAC;QAAC,aAAa,EAAE,GAAG,CAAA;KAAE,EAC7D,gBAAgB,EAAE,gBAAgB,EAClC,SAAS,EAAE,GAAG,GACb,cAAc,GAAG,SAAS,CAiE5B;IAED,wEAAwE;IACxE,OAAO,CAAC,uBAAuB;IAI/B,oHAAoH;IACpH,OAAO,CAAC,oBAAoB;IAM5B;;;OAGG;IACH,OAAO,CAAC,iCAAiC;CA+B1C"}
@@ -1,33 +1,36 @@
1
1
  import { MULTI_CALL_3_ADDRESS } from '@aztec/ethereum/contracts';
2
2
  import { Fr } from '@aztec/foundation/curves/bn254';
3
3
  import { EthAddress } from '@aztec/foundation/eth-address';
4
- import { EmpireSlashingProposerAbi, GovernanceProposerAbi, RollupAbi, SlashFactoryAbi, TallySlashingProposerAbi } from '@aztec/l1-artifacts';
4
+ import { RollupAbi } from '@aztec/l1-artifacts';
5
5
  import { CommitteeAttestation } from '@aztec/stdlib/block';
6
6
  import { ConsensusPayload, SignatureDomainSeparator } from '@aztec/stdlib/p2p';
7
7
  import { CheckpointHeader } from '@aztec/stdlib/rollup';
8
8
  import { decodeFunctionData, encodeAbiParameters, hexToBytes, keccak256, multicall3Abi, toFunctionSelector } from 'viem';
9
9
  import { getSuccessfulCallsFromDebug } from './debug_tx.js';
10
- import { getCallFromSpireProposer } from './spire_proposer.js';
10
+ import { getCallsFromSpireProposer } from './spire_proposer.js';
11
11
  import { getSuccessfulCallsFromTrace } from './trace_tx.js';
12
12
  /**
13
13
  * Extracts calldata to the `propose` method of the rollup contract from an L1 transaction
14
- * in order to reconstruct an L2 block header.
14
+ * in order to reconstruct an L2 block header. Uses hash matching against expected hashes
15
+ * from the CheckpointProposed event to verify the correct propose calldata.
15
16
  */ export class CalldataRetriever {
16
17
  publicClient;
17
18
  debugClient;
18
19
  targetCommitteeSize;
19
20
  instrumentation;
20
21
  logger;
21
- /** Pre-computed valid contract calls for validation */ validContractCalls;
22
22
  rollupAddress;
23
- constructor(publicClient, debugClient, targetCommitteeSize, instrumentation, logger, contractAddresses){
23
+ /** Tx hashes we've already logged for trace+debug failure (log once per tx per process). */ static traceFailureWarnedTxHashes = new Set();
24
+ /** Clears the trace-failure warned set. For testing only. */ static resetTraceFailureWarnedForTesting() {
25
+ CalldataRetriever.traceFailureWarnedTxHashes.clear();
26
+ }
27
+ constructor(publicClient, debugClient, targetCommitteeSize, instrumentation, logger, rollupAddress){
24
28
  this.publicClient = publicClient;
25
29
  this.debugClient = debugClient;
26
30
  this.targetCommitteeSize = targetCommitteeSize;
27
31
  this.instrumentation = instrumentation;
28
32
  this.logger = logger;
29
- this.rollupAddress = contractAddresses.rollupAddress;
30
- this.validContractCalls = computeValidContractCalls(contractAddresses);
33
+ this.rollupAddress = rollupAddress;
31
34
  }
32
35
  /**
33
36
  * Gets checkpoint header and metadata from the calldata of an L1 transaction.
@@ -35,84 +38,94 @@ import { getSuccessfulCallsFromTrace } from './trace_tx.js';
35
38
  * @param txHash - Hash of the tx that published it.
36
39
  * @param blobHashes - Blob hashes for the checkpoint.
37
40
  * @param checkpointNumber - Checkpoint number.
38
- * @param expectedHashes - Optional expected hashes from the CheckpointProposed event for validation
41
+ * @param expectedHashes - Expected hashes from the CheckpointProposed event for validation
39
42
  * @returns Checkpoint header and metadata from the calldata, deserialized
40
43
  */ async getCheckpointFromRollupTx(txHash, _blobHashes, checkpointNumber, expectedHashes) {
41
- this.logger.trace(`Fetching checkpoint ${checkpointNumber} from rollup tx ${txHash}`, {
42
- willValidateHashes: !!expectedHashes.attestationsHash || !!expectedHashes.payloadDigest,
43
- hasAttestationsHash: !!expectedHashes.attestationsHash,
44
- hasPayloadDigest: !!expectedHashes.payloadDigest
45
- });
44
+ this.logger.trace(`Fetching checkpoint ${checkpointNumber} from rollup tx ${txHash}`);
46
45
  const tx = await this.publicClient.getTransaction({
47
46
  hash: txHash
48
47
  });
49
- const proposeCalldata = await this.getProposeCallData(tx, checkpointNumber);
50
- return this.decodeAndBuildCheckpoint(proposeCalldata, tx.blockHash, checkpointNumber, expectedHashes);
48
+ return this.getCheckpointFromTx(tx, checkpointNumber, expectedHashes);
51
49
  }
52
- /** Gets rollup propose calldata from a transaction */ async getProposeCallData(tx, checkpointNumber) {
53
- // Try to decode as multicall3 with validation
54
- const proposeCalldata = this.tryDecodeMulticall3(tx);
55
- if (proposeCalldata) {
50
+ /** Gets checkpoint data from a transaction by trying decode strategies then falling back to trace. */ async getCheckpointFromTx(tx, checkpointNumber, expectedHashes) {
51
+ // Try to decode as multicall3 with hash-verified matching
52
+ const multicall3Result = this.tryDecodeMulticall3(tx, expectedHashes, checkpointNumber, tx.blockHash);
53
+ if (multicall3Result) {
56
54
  this.logger.trace(`Decoded propose calldata from multicall3 for tx ${tx.hash}`);
57
55
  this.instrumentation?.recordBlockProposalTxTarget(tx.to, false);
58
- return proposeCalldata;
56
+ return multicall3Result;
59
57
  }
60
58
  // Try to decode as direct propose call
61
- const directProposeCalldata = this.tryDecodeDirectPropose(tx);
62
- if (directProposeCalldata) {
59
+ const directResult = this.tryDecodeDirectPropose(tx, expectedHashes, checkpointNumber, tx.blockHash);
60
+ if (directResult) {
63
61
  this.logger.trace(`Decoded propose calldata from direct call for tx ${tx.hash}`);
64
62
  this.instrumentation?.recordBlockProposalTxTarget(tx.to, false);
65
- return directProposeCalldata;
63
+ return directResult;
66
64
  }
67
65
  // Try to decode as Spire Proposer multicall wrapper
68
- const spireProposeCalldata = await this.tryDecodeSpireProposer(tx);
69
- if (spireProposeCalldata) {
66
+ const spireResult = await this.tryDecodeSpireProposer(tx, expectedHashes, checkpointNumber, tx.blockHash);
67
+ if (spireResult) {
70
68
  this.logger.trace(`Decoded propose calldata from Spire Proposer for tx ${tx.hash}`);
71
69
  this.instrumentation?.recordBlockProposalTxTarget(tx.to, false);
72
- return spireProposeCalldata;
70
+ return spireResult;
73
71
  }
74
72
  // Fall back to trace-based extraction
75
73
  this.logger.warn(`Failed to decode multicall3, direct propose, or Spire proposer for L1 tx ${tx.hash}, falling back to trace for checkpoint ${checkpointNumber}`);
76
74
  this.instrumentation?.recordBlockProposalTxTarget(tx.to ?? EthAddress.ZERO.toString(), true);
77
- return await this.extractCalldataViaTrace(tx.hash);
75
+ const tracedCalldata = await this.extractCalldataViaTrace(tx.hash);
76
+ const tracedResult = this.tryDecodeAndVerifyPropose(tracedCalldata, expectedHashes, checkpointNumber, tx.blockHash);
77
+ if (!tracedResult) {
78
+ throw new Error(`Hash mismatch for traced propose calldata in tx ${tx.hash} for checkpoint ${checkpointNumber}`);
79
+ }
80
+ return tracedResult;
78
81
  }
79
82
  /**
80
83
  * Attempts to decode a transaction as a Spire Proposer multicall wrapper.
81
- * If successful, extracts the wrapped call and validates it as either multicall3 or direct propose.
84
+ * If successful, iterates all wrapped calls and validates each as either multicall3
85
+ * or direct propose, verifying against expected hashes.
82
86
  * @param tx - The transaction to decode
83
- * @returns The propose calldata if successfully decoded and validated, undefined otherwise
84
- */ async tryDecodeSpireProposer(tx) {
85
- // Try to decode as Spire Proposer multicall (extracts the wrapped call)
86
- const spireWrappedCall = await getCallFromSpireProposer(tx, this.publicClient, this.logger);
87
- if (!spireWrappedCall) {
87
+ * @param expectedHashes - Expected hashes for hash-verified matching
88
+ * @param checkpointNumber - The checkpoint number
89
+ * @param blockHash - The L1 block hash
90
+ * @returns The checkpoint data if successfully decoded and validated, undefined otherwise
91
+ */ async tryDecodeSpireProposer(tx, expectedHashes, checkpointNumber, blockHash) {
92
+ // Try to decode as Spire Proposer multicall (extracts all wrapped calls)
93
+ const spireWrappedCalls = await getCallsFromSpireProposer(tx, this.publicClient, this.logger);
94
+ if (!spireWrappedCalls) {
88
95
  return undefined;
89
96
  }
90
- this.logger.trace(`Decoded Spire Proposer wrapping for tx ${tx.hash}, inner call to ${spireWrappedCall.to}`);
91
- // Now try to decode the wrapped call as either multicall3 or direct propose
92
- const wrappedTx = {
93
- to: spireWrappedCall.to,
94
- input: spireWrappedCall.data,
95
- hash: tx.hash
96
- };
97
- const multicall3Calldata = this.tryDecodeMulticall3(wrappedTx);
98
- if (multicall3Calldata) {
99
- this.logger.trace(`Decoded propose calldata from Spire Proposer to multicall3 for tx ${tx.hash}`);
100
- return multicall3Calldata;
101
- }
102
- const directProposeCalldata = this.tryDecodeDirectPropose(wrappedTx);
103
- if (directProposeCalldata) {
104
- this.logger.trace(`Decoded propose calldata from Spire Proposer to direct propose for tx ${tx.hash}`);
105
- return directProposeCalldata;
97
+ this.logger.trace(`Decoded Spire Proposer wrapping for tx ${tx.hash}, ${spireWrappedCalls.length} inner call(s)`);
98
+ // Try each wrapped call as either multicall3 or direct propose
99
+ for (const spireWrappedCall of spireWrappedCalls){
100
+ const wrappedTx = {
101
+ to: spireWrappedCall.to,
102
+ input: spireWrappedCall.data,
103
+ hash: tx.hash
104
+ };
105
+ const multicall3Result = this.tryDecodeMulticall3(wrappedTx, expectedHashes, checkpointNumber, blockHash);
106
+ if (multicall3Result) {
107
+ this.logger.trace(`Decoded propose calldata from Spire Proposer to multicall3 for tx ${tx.hash}`);
108
+ return multicall3Result;
109
+ }
110
+ const directResult = this.tryDecodeDirectPropose(wrappedTx, expectedHashes, checkpointNumber, blockHash);
111
+ if (directResult) {
112
+ this.logger.trace(`Decoded propose calldata from Spire Proposer to direct propose for tx ${tx.hash}`);
113
+ return directResult;
114
+ }
106
115
  }
107
- this.logger.warn(`Spire Proposer wrapped call could not be decoded as multicall3 or direct propose for tx ${tx.hash}`);
116
+ this.logger.warn(`Spire Proposer wrapped calls could not be decoded as multicall3 or direct propose for tx ${tx.hash}`);
108
117
  return undefined;
109
118
  }
110
119
  /**
111
120
  * Attempts to decode transaction input as multicall3 and extract propose calldata.
112
- * Returns undefined if validation fails.
121
+ * Finds all calls matching the rollup address and propose selector, then decodes
122
+ * and verifies each candidate against expected hashes from the CheckpointProposed event.
113
123
  * @param tx - The transaction-like object with to, input, and hash
114
- * @returns The propose calldata if successfully validated, undefined otherwise
115
- */ tryDecodeMulticall3(tx) {
124
+ * @param expectedHashes - Expected hashes from CheckpointProposed event
125
+ * @param checkpointNumber - The checkpoint number
126
+ * @param blockHash - The L1 block hash
127
+ * @returns The checkpoint data if successfully validated, undefined otherwise
128
+ */ tryDecodeMulticall3(tx, expectedHashes, checkpointNumber, blockHash) {
116
129
  const txHash = tx.hash;
117
130
  try {
118
131
  // Check if transaction is to Multicall3 address
@@ -142,59 +155,51 @@ import { getSuccessfulCallsFromTrace } from './trace_tx.js';
142
155
  return undefined;
143
156
  }
144
157
  const [calls] = multicall3Args;
145
- // Validate all calls and find propose calls
158
+ // Find all calls matching rollup address + propose selector
146
159
  const rollupAddressLower = this.rollupAddress.toString().toLowerCase();
147
- const proposeCalls = [];
148
- for(let i = 0; i < calls.length; i++){
149
- const addr = calls[i].target.toLowerCase();
150
- const callData = calls[i].callData;
151
- // Extract function selector (first 4 bytes)
160
+ const proposeSelectorLower = PROPOSE_SELECTOR.toLowerCase();
161
+ const candidates = [];
162
+ for (const call of calls){
163
+ const addr = call.target.toLowerCase();
164
+ const callData = call.callData;
152
165
  if (callData.length < 10) {
153
- // "0x" + 8 hex chars = 10 chars minimum for a valid function call
154
- this.logger.warn(`Invalid calldata length at index ${i} (${callData.length})`, {
155
- txHash
156
- });
157
- return undefined;
166
+ continue;
158
167
  }
159
- const functionSelector = callData.slice(0, 10);
160
- // Validate this call is allowed by searching through valid calls
161
- const validCall = this.validContractCalls.find((vc)=>vc.address === addr && vc.functionSelector === functionSelector);
162
- if (!validCall) {
163
- this.logger.warn(`Invalid contract call detected in multicall3`, {
164
- index: i,
165
- targetAddress: addr,
166
- functionSelector,
167
- validCalls: this.validContractCalls.map((c)=>({
168
- address: c.address,
169
- selector: c.functionSelector
170
- })),
171
- txHash
172
- });
173
- return undefined;
168
+ const selector = callData.slice(0, 10).toLowerCase();
169
+ if (addr === rollupAddressLower && selector === proposeSelectorLower) {
170
+ candidates.push(callData);
174
171
  }
175
- this.logger.trace(`Valid call found to ${addr}`, {
176
- validCall
172
+ }
173
+ if (candidates.length === 0) {
174
+ this.logger.debug(`No propose candidates found in multicall3`, {
175
+ txHash
177
176
  });
178
- // Collect propose calls specifically
179
- if (addr === rollupAddressLower && validCall.functionName === 'propose') {
180
- proposeCalls.push(callData);
177
+ return undefined;
178
+ }
179
+ // Decode, verify, and build for each candidate
180
+ const verified = [];
181
+ for (const candidate of candidates){
182
+ const result = this.tryDecodeAndVerifyPropose(candidate, expectedHashes, checkpointNumber, blockHash);
183
+ if (result) {
184
+ verified.push(result);
181
185
  }
182
186
  }
183
- // Validate exactly ONE propose call
184
- if (proposeCalls.length === 0) {
185
- this.logger.warn(`No propose calls found in multicall3`, {
187
+ if (verified.length === 1) {
188
+ this.logger.trace(`Verified single propose candidate via hash matching`, {
186
189
  txHash
187
190
  });
188
- return undefined;
191
+ return verified[0];
189
192
  }
190
- if (proposeCalls.length > 1) {
191
- this.logger.warn(`Multiple propose calls found in multicall3 (${proposeCalls.length})`, {
193
+ if (verified.length > 1) {
194
+ this.logger.warn(`Multiple propose candidates verified (${verified.length}), returning first (identical data)`, {
192
195
  txHash
193
196
  });
194
- return undefined;
197
+ return verified[0];
195
198
  }
196
- // Successfully extracted single propose call
197
- return proposeCalls[0];
199
+ this.logger.debug(`No candidates verified against expected hashes`, {
200
+ txHash
201
+ });
202
+ return undefined;
198
203
  } catch (err) {
199
204
  // Any decoding error triggers fallback to trace
200
205
  this.logger.warn(`Failed to decode multicall3: ${err}`, {
@@ -205,10 +210,13 @@ import { getSuccessfulCallsFromTrace } from './trace_tx.js';
205
210
  }
206
211
  /**
207
212
  * Attempts to decode transaction as a direct propose call to the rollup contract.
208
- * Returns undefined if validation fails.
213
+ * Decodes, verifies hashes, and builds checkpoint data in a single pass.
209
214
  * @param tx - The transaction-like object with to, input, and hash
210
- * @returns The propose calldata if successfully validated, undefined otherwise
211
- */ tryDecodeDirectPropose(tx) {
215
+ * @param expectedHashes - Expected hashes from CheckpointProposed event
216
+ * @param checkpointNumber - The checkpoint number
217
+ * @param blockHash - The L1 block hash
218
+ * @returns The checkpoint data if successfully validated, undefined otherwise
219
+ */ tryDecodeDirectPropose(tx, expectedHashes, checkpointNumber, blockHash) {
212
220
  const txHash = tx.hash;
213
221
  try {
214
222
  // Check if transaction is to the rollup address
@@ -218,23 +226,22 @@ import { getSuccessfulCallsFromTrace } from './trace_tx.js';
218
226
  });
219
227
  return undefined;
220
228
  }
221
- // Try to decode as propose call
229
+ // Validate it's a propose call before full decode+verify
222
230
  const { functionName } = decodeFunctionData({
223
231
  abi: RollupAbi,
224
232
  data: tx.input
225
233
  });
226
- // If not propose, return undefined
227
234
  if (functionName !== 'propose') {
228
235
  this.logger.warn(`Transaction to rollup is not propose (got ${functionName})`, {
229
236
  txHash
230
237
  });
231
238
  return undefined;
232
239
  }
233
- // Successfully validated direct propose call
240
+ // Decode, verify hashes, and build checkpoint data
234
241
  this.logger.trace(`Validated direct propose call to rollup`, {
235
242
  txHash
236
243
  });
237
- return tx.input;
244
+ return this.tryDecodeAndVerifyPropose(tx.input, expectedHashes, checkpointNumber, blockHash);
238
245
  } catch (err) {
239
246
  // Any decoding error means it's not a valid propose call
240
247
  this.logger.warn(`Failed to decode as direct propose: ${err}`, {
@@ -260,7 +267,8 @@ import { getSuccessfulCallsFromTrace } from './trace_tx.js';
260
267
  this.logger.debug(`Successfully traced using trace_transaction, found ${calls.length} calls`);
261
268
  } catch (err) {
262
269
  const traceError = err instanceof Error ? err : new Error(String(err));
263
- this.logger.verbose(`Failed trace_transaction for ${txHash}`, {
270
+ this.logger.verbose(`Failed trace_transaction for ${txHash}: ${traceError.message}`);
271
+ this.logger.debug(`Trace failure details for ${txHash}`, {
264
272
  traceError
265
273
  });
266
274
  try {
@@ -270,7 +278,13 @@ import { getSuccessfulCallsFromTrace } from './trace_tx.js';
270
278
  this.logger.debug(`Successfully traced using debug_traceTransaction, found ${calls.length} calls`);
271
279
  } catch (debugErr) {
272
280
  const debugError = debugErr instanceof Error ? debugErr : new Error(String(debugErr));
273
- this.logger.warn(`All tracing methods failed for tx ${txHash}`, {
281
+ // Log once per tx so we don't spam on every sync cycle when sync point doesn't advance
282
+ if (!CalldataRetriever.traceFailureWarnedTxHashes.has(txHash)) {
283
+ CalldataRetriever.traceFailureWarnedTxHashes.add(txHash);
284
+ this.logger.warn(`Cannot decode L1 tx ${txHash}: trace and debug RPC failed or unavailable. ` + `trace_transaction: ${traceError.message}; debug_traceTransaction: ${debugError.message}`);
285
+ }
286
+ // Full error objects can be very long; keep at debug only
287
+ this.logger.debug(`Trace/debug failure details for tx ${txHash}`, {
274
288
  traceError,
275
289
  debugError,
276
290
  txHash
@@ -289,9 +303,81 @@ import { getSuccessfulCallsFromTrace } from './trace_tx.js';
289
303
  return calls[0].input;
290
304
  }
291
305
  /**
306
+ * Decodes propose calldata, verifies against expected hashes, and builds checkpoint data.
307
+ * Returns undefined on decode errors or hash mismatches (soft failure for try-based callers).
308
+ * @param proposeCalldata - The propose function calldata
309
+ * @param expectedHashes - Expected hashes from the CheckpointProposed event
310
+ * @param checkpointNumber - The checkpoint number
311
+ * @param blockHash - The L1 block hash
312
+ * @returns The decoded checkpoint data, or undefined on failure
313
+ */ tryDecodeAndVerifyPropose(proposeCalldata, expectedHashes, checkpointNumber, blockHash) {
314
+ try {
315
+ const { functionName, args } = decodeFunctionData({
316
+ abi: RollupAbi,
317
+ data: proposeCalldata
318
+ });
319
+ if (functionName !== 'propose') {
320
+ return undefined;
321
+ }
322
+ const [decodedArgs, packedAttestations] = args;
323
+ // Verify attestationsHash
324
+ const computedAttestationsHash = this.computeAttestationsHash(packedAttestations);
325
+ if (!Buffer.from(hexToBytes(computedAttestationsHash)).equals(Buffer.from(hexToBytes(expectedHashes.attestationsHash)))) {
326
+ this.logger.warn(`Attestations hash mismatch during verification`, {
327
+ computed: computedAttestationsHash,
328
+ expected: expectedHashes.attestationsHash
329
+ });
330
+ return undefined;
331
+ }
332
+ // Verify payloadDigest
333
+ const header = CheckpointHeader.fromViem(decodedArgs.header);
334
+ const archiveRoot = new Fr(Buffer.from(hexToBytes(decodedArgs.archive)));
335
+ const feeAssetPriceModifier = decodedArgs.oracleInput.feeAssetPriceModifier;
336
+ const computedPayloadDigest = this.computePayloadDigest(header, archiveRoot, feeAssetPriceModifier);
337
+ if (!Buffer.from(hexToBytes(computedPayloadDigest)).equals(Buffer.from(hexToBytes(expectedHashes.payloadDigest)))) {
338
+ this.logger.warn(`Payload digest mismatch during verification`, {
339
+ computed: computedPayloadDigest,
340
+ expected: expectedHashes.payloadDigest
341
+ });
342
+ return undefined;
343
+ }
344
+ const attestations = CommitteeAttestation.fromPacked(packedAttestations, this.targetCommitteeSize);
345
+ this.logger.trace(`Validated and decoded propose calldata for checkpoint ${checkpointNumber}`, {
346
+ checkpointNumber,
347
+ archive: decodedArgs.archive,
348
+ header: decodedArgs.header,
349
+ l1BlockHash: blockHash,
350
+ attestations,
351
+ packedAttestations,
352
+ targetCommitteeSize: this.targetCommitteeSize
353
+ });
354
+ return {
355
+ checkpointNumber,
356
+ archiveRoot,
357
+ header,
358
+ attestations,
359
+ blockHash,
360
+ feeAssetPriceModifier
361
+ };
362
+ } catch {
363
+ return undefined;
364
+ }
365
+ }
366
+ /** Computes the keccak256 hash of ABI-encoded CommitteeAttestations. */ computeAttestationsHash(packedAttestations) {
367
+ return keccak256(encodeAbiParameters([
368
+ this.getCommitteeAttestationsStructDef()
369
+ ], [
370
+ packedAttestations
371
+ ]));
372
+ }
373
+ /** Computes the keccak256 payload digest from the checkpoint header, archive root, and fee asset price modifier. */ computePayloadDigest(header, archiveRoot, feeAssetPriceModifier) {
374
+ const consensusPayload = new ConsensusPayload(header, archiveRoot, feeAssetPriceModifier);
375
+ const payloadToSign = consensusPayload.getPayloadToSign(SignatureDomainSeparator.checkpointAttestation);
376
+ return keccak256(payloadToSign);
377
+ }
378
+ /**
292
379
  * Extracts the CommitteeAttestations struct definition from RollupAbi.
293
380
  * Finds the _attestations parameter by name in the propose function.
294
- * Lazy-loaded to avoid issues during module initialization.
295
381
  */ getCommitteeAttestationsStructDef() {
296
382
  const proposeFunction = RollupAbi.find((item)=>item.type === 'function' && item.name === 'propose');
297
383
  if (!proposeFunction) {
@@ -312,160 +398,5 @@ import { getSuccessfulCallsFromTrace } from './trace_tx.js';
312
398
  components: tupleParam.components || []
313
399
  };
314
400
  }
315
- /**
316
- * Decodes propose calldata and builds the checkpoint header structure.
317
- * @param proposeCalldata - The propose function calldata
318
- * @param blockHash - The L1 block hash containing this transaction
319
- * @param checkpointNumber - The checkpoint number
320
- * @param expectedHashes - Optional expected hashes from the CheckpointProposed event for validation
321
- * @returns The decoded checkpoint header and metadata
322
- */ decodeAndBuildCheckpoint(proposeCalldata, blockHash, checkpointNumber, expectedHashes) {
323
- const { functionName: rollupFunctionName, args: rollupArgs } = decodeFunctionData({
324
- abi: RollupAbi,
325
- data: proposeCalldata
326
- });
327
- if (rollupFunctionName !== 'propose') {
328
- throw new Error(`Unexpected rollup method called ${rollupFunctionName}`);
329
- }
330
- const [decodedArgs, packedAttestations, _signers, _attestationsAndSignersSignature, _blobInput] = rollupArgs;
331
- const attestations = CommitteeAttestation.fromPacked(packedAttestations, this.targetCommitteeSize);
332
- const header = CheckpointHeader.fromViem(decodedArgs.header);
333
- const archiveRoot = new Fr(Buffer.from(hexToBytes(decodedArgs.archive)));
334
- // Validate attestationsHash if provided (skip for backwards compatibility with older events)
335
- if (expectedHashes.attestationsHash) {
336
- // Compute attestationsHash: keccak256(abi.encode(CommitteeAttestations))
337
- const computedAttestationsHash = keccak256(encodeAbiParameters([
338
- this.getCommitteeAttestationsStructDef()
339
- ], [
340
- packedAttestations
341
- ]));
342
- // Compare as buffers to avoid case-sensitivity and string comparison issues
343
- const computedBuffer = Buffer.from(hexToBytes(computedAttestationsHash));
344
- const expectedBuffer = Buffer.from(hexToBytes(expectedHashes.attestationsHash));
345
- if (!computedBuffer.equals(expectedBuffer)) {
346
- throw new Error(`Attestations hash mismatch for checkpoint ${checkpointNumber}: ` + `computed=${computedAttestationsHash}, expected=${expectedHashes.attestationsHash}`);
347
- }
348
- this.logger.trace(`Validated attestationsHash for checkpoint ${checkpointNumber}`, {
349
- computedAttestationsHash,
350
- expectedAttestationsHash: expectedHashes.attestationsHash
351
- });
352
- }
353
- // Validate payloadDigest if provided (skip for backwards compatibility with older events)
354
- if (expectedHashes.payloadDigest) {
355
- // Use ConsensusPayload to compute the digest - this ensures we match the exact logic
356
- // used by the network for signing and verification
357
- const consensusPayload = new ConsensusPayload(header, archiveRoot);
358
- const payloadToSign = consensusPayload.getPayloadToSign(SignatureDomainSeparator.checkpointAttestation);
359
- const computedPayloadDigest = keccak256(payloadToSign);
360
- // Compare as buffers to avoid case-sensitivity and string comparison issues
361
- const computedBuffer = Buffer.from(hexToBytes(computedPayloadDigest));
362
- const expectedBuffer = Buffer.from(hexToBytes(expectedHashes.payloadDigest));
363
- if (!computedBuffer.equals(expectedBuffer)) {
364
- throw new Error(`Payload digest mismatch for checkpoint ${checkpointNumber}: ` + `computed=${computedPayloadDigest}, expected=${expectedHashes.payloadDigest}`);
365
- }
366
- this.logger.trace(`Validated payloadDigest for checkpoint ${checkpointNumber}`, {
367
- computedPayloadDigest,
368
- expectedPayloadDigest: expectedHashes.payloadDigest
369
- });
370
- }
371
- this.logger.trace(`Decoded propose calldata`, {
372
- checkpointNumber,
373
- archive: decodedArgs.archive,
374
- header: decodedArgs.header,
375
- l1BlockHash: blockHash,
376
- attestations,
377
- packedAttestations,
378
- targetCommitteeSize: this.targetCommitteeSize
379
- });
380
- return {
381
- checkpointNumber,
382
- archiveRoot,
383
- header,
384
- attestations,
385
- blockHash
386
- };
387
- }
388
- }
389
- /**
390
- * Pre-computed function selectors for all valid contract calls.
391
- * These are computed once at module load time from the ABIs.
392
- * Based on analysis of sequencer-client/src/publisher/sequencer-publisher.ts
393
- */ // Rollup contract function selectors (always valid)
394
- const PROPOSE_SELECTOR = toFunctionSelector(RollupAbi.find((x)=>x.type === 'function' && x.name === 'propose'));
395
- const INVALIDATE_BAD_ATTESTATION_SELECTOR = toFunctionSelector(RollupAbi.find((x)=>x.type === 'function' && x.name === 'invalidateBadAttestation'));
396
- const INVALIDATE_INSUFFICIENT_ATTESTATIONS_SELECTOR = toFunctionSelector(RollupAbi.find((x)=>x.type === 'function' && x.name === 'invalidateInsufficientAttestations'));
397
- // Governance proposer function selectors
398
- const GOVERNANCE_SIGNAL_WITH_SIG_SELECTOR = toFunctionSelector(GovernanceProposerAbi.find((x)=>x.type === 'function' && x.name === 'signalWithSig'));
399
- // Slash factory function selectors
400
- const CREATE_SLASH_PAYLOAD_SELECTOR = toFunctionSelector(SlashFactoryAbi.find((x)=>x.type === 'function' && x.name === 'createSlashPayload'));
401
- // Empire slashing proposer function selectors
402
- const EMPIRE_SIGNAL_WITH_SIG_SELECTOR = toFunctionSelector(EmpireSlashingProposerAbi.find((x)=>x.type === 'function' && x.name === 'signalWithSig'));
403
- const EMPIRE_SUBMIT_ROUND_WINNER_SELECTOR = toFunctionSelector(EmpireSlashingProposerAbi.find((x)=>x.type === 'function' && x.name === 'submitRoundWinner'));
404
- // Tally slashing proposer function selectors
405
- const TALLY_VOTE_SELECTOR = toFunctionSelector(TallySlashingProposerAbi.find((x)=>x.type === 'function' && x.name === 'vote'));
406
- const TALLY_EXECUTE_ROUND_SELECTOR = toFunctionSelector(TallySlashingProposerAbi.find((x)=>x.type === 'function' && x.name === 'executeRound'));
407
- /**
408
- * All valid contract calls that the sequencer publisher can make.
409
- * Builds the list of valid (address, selector) pairs for validation.
410
- *
411
- * Alternatively, if we are absolutely sure that no code path from any of these
412
- * contracts can eventually land on another call to `propose`, we can remove the
413
- * function selectors.
414
- */ function computeValidContractCalls(addresses) {
415
- const { rollupAddress, governanceProposerAddress, slashFactoryAddress, slashingProposerAddress } = addresses;
416
- const calls = [];
417
- // Rollup contract calls (always present)
418
- calls.push({
419
- address: rollupAddress.toString().toLowerCase(),
420
- functionSelector: PROPOSE_SELECTOR,
421
- functionName: 'propose'
422
- }, {
423
- address: rollupAddress.toString().toLowerCase(),
424
- functionSelector: INVALIDATE_BAD_ATTESTATION_SELECTOR,
425
- functionName: 'invalidateBadAttestation'
426
- }, {
427
- address: rollupAddress.toString().toLowerCase(),
428
- functionSelector: INVALIDATE_INSUFFICIENT_ATTESTATIONS_SELECTOR,
429
- functionName: 'invalidateInsufficientAttestations'
430
- });
431
- // Governance proposer calls (optional)
432
- if (governanceProposerAddress && !governanceProposerAddress.isZero()) {
433
- calls.push({
434
- address: governanceProposerAddress.toString().toLowerCase(),
435
- functionSelector: GOVERNANCE_SIGNAL_WITH_SIG_SELECTOR,
436
- functionName: 'signalWithSig'
437
- });
438
- }
439
- // Slash factory calls (optional)
440
- if (slashFactoryAddress && !slashFactoryAddress.isZero()) {
441
- calls.push({
442
- address: slashFactoryAddress.toString().toLowerCase(),
443
- functionSelector: CREATE_SLASH_PAYLOAD_SELECTOR,
444
- functionName: 'createSlashPayload'
445
- });
446
- }
447
- // Slashing proposer calls (optional, can be either Empire or Tally)
448
- if (slashingProposerAddress && !slashingProposerAddress.isZero()) {
449
- // Empire calls
450
- calls.push({
451
- address: slashingProposerAddress.toString().toLowerCase(),
452
- functionSelector: EMPIRE_SIGNAL_WITH_SIG_SELECTOR,
453
- functionName: 'signalWithSig (empire)'
454
- }, {
455
- address: slashingProposerAddress.toString().toLowerCase(),
456
- functionSelector: EMPIRE_SUBMIT_ROUND_WINNER_SELECTOR,
457
- functionName: 'submitRoundWinner'
458
- });
459
- // Tally calls
460
- calls.push({
461
- address: slashingProposerAddress.toString().toLowerCase(),
462
- functionSelector: TALLY_VOTE_SELECTOR,
463
- functionName: 'vote'
464
- }, {
465
- address: slashingProposerAddress.toString().toLowerCase(),
466
- functionSelector: TALLY_EXECUTE_ROUND_SELECTOR,
467
- functionName: 'executeRound'
468
- });
469
- }
470
- return calls;
471
401
  }
402
+ /** Function selector for the `propose` method of the rollup contract. */ const PROPOSE_SELECTOR = toFunctionSelector(RollupAbi.find((x)=>x.type === 'function' && x.name === 'propose'));