@aztec/archiver 4.0.0-nightly.20250907 → 4.0.0-nightly.20260107

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 (133) hide show
  1. package/README.md +27 -6
  2. package/dest/archiver/archiver.d.ts +127 -84
  3. package/dest/archiver/archiver.d.ts.map +1 -1
  4. package/dest/archiver/archiver.js +1128 -380
  5. package/dest/archiver/archiver_store.d.ts +122 -45
  6. package/dest/archiver/archiver_store.d.ts.map +1 -1
  7. package/dest/archiver/archiver_store_test_suite.d.ts +1 -1
  8. package/dest/archiver/archiver_store_test_suite.d.ts.map +1 -1
  9. package/dest/archiver/archiver_store_test_suite.js +2013 -343
  10. package/dest/archiver/config.d.ts +7 -20
  11. package/dest/archiver/config.d.ts.map +1 -1
  12. package/dest/archiver/config.js +21 -5
  13. package/dest/archiver/errors.d.ts +25 -1
  14. package/dest/archiver/errors.d.ts.map +1 -1
  15. package/dest/archiver/errors.js +37 -0
  16. package/dest/archiver/index.d.ts +2 -2
  17. package/dest/archiver/index.d.ts.map +1 -1
  18. package/dest/archiver/instrumentation.d.ts +5 -3
  19. package/dest/archiver/instrumentation.d.ts.map +1 -1
  20. package/dest/archiver/instrumentation.js +14 -0
  21. package/dest/archiver/kv_archiver_store/block_store.d.ts +83 -15
  22. package/dest/archiver/kv_archiver_store/block_store.d.ts.map +1 -1
  23. package/dest/archiver/kv_archiver_store/block_store.js +396 -73
  24. package/dest/archiver/kv_archiver_store/contract_class_store.d.ts +2 -2
  25. package/dest/archiver/kv_archiver_store/contract_class_store.d.ts.map +1 -1
  26. package/dest/archiver/kv_archiver_store/contract_class_store.js +1 -1
  27. package/dest/archiver/kv_archiver_store/contract_instance_store.d.ts +2 -2
  28. package/dest/archiver/kv_archiver_store/contract_instance_store.d.ts.map +1 -1
  29. package/dest/archiver/kv_archiver_store/kv_archiver_store.d.ts +51 -55
  30. package/dest/archiver/kv_archiver_store/kv_archiver_store.d.ts.map +1 -1
  31. package/dest/archiver/kv_archiver_store/kv_archiver_store.js +82 -46
  32. package/dest/archiver/kv_archiver_store/log_store.d.ts +12 -16
  33. package/dest/archiver/kv_archiver_store/log_store.d.ts.map +1 -1
  34. package/dest/archiver/kv_archiver_store/log_store.js +149 -84
  35. package/dest/archiver/kv_archiver_store/message_store.d.ts +6 -5
  36. package/dest/archiver/kv_archiver_store/message_store.d.ts.map +1 -1
  37. package/dest/archiver/kv_archiver_store/message_store.js +15 -14
  38. package/dest/archiver/l1/bin/retrieve-calldata.d.ts +3 -0
  39. package/dest/archiver/l1/bin/retrieve-calldata.d.ts.map +1 -0
  40. package/dest/archiver/l1/bin/retrieve-calldata.js +149 -0
  41. package/dest/archiver/l1/calldata_retriever.d.ts +112 -0
  42. package/dest/archiver/l1/calldata_retriever.d.ts.map +1 -0
  43. package/dest/archiver/l1/calldata_retriever.js +471 -0
  44. package/dest/archiver/l1/data_retrieval.d.ts +90 -0
  45. package/dest/archiver/l1/data_retrieval.d.ts.map +1 -0
  46. package/dest/archiver/l1/data_retrieval.js +331 -0
  47. package/dest/archiver/l1/debug_tx.d.ts +19 -0
  48. package/dest/archiver/l1/debug_tx.d.ts.map +1 -0
  49. package/dest/archiver/l1/debug_tx.js +73 -0
  50. package/dest/archiver/l1/spire_proposer.d.ts +70 -0
  51. package/dest/archiver/l1/spire_proposer.d.ts.map +1 -0
  52. package/dest/archiver/l1/spire_proposer.js +157 -0
  53. package/dest/archiver/l1/trace_tx.d.ts +97 -0
  54. package/dest/archiver/l1/trace_tx.d.ts.map +1 -0
  55. package/dest/archiver/l1/trace_tx.js +91 -0
  56. package/dest/archiver/l1/types.d.ts +12 -0
  57. package/dest/archiver/l1/types.d.ts.map +1 -0
  58. package/dest/archiver/l1/types.js +3 -0
  59. package/dest/archiver/l1/validate_trace.d.ts +29 -0
  60. package/dest/archiver/l1/validate_trace.d.ts.map +1 -0
  61. package/dest/archiver/l1/validate_trace.js +150 -0
  62. package/dest/archiver/structs/data_retrieval.d.ts +1 -1
  63. package/dest/archiver/structs/inbox_message.d.ts +4 -4
  64. package/dest/archiver/structs/inbox_message.d.ts.map +1 -1
  65. package/dest/archiver/structs/inbox_message.js +6 -5
  66. package/dest/archiver/structs/published.d.ts +2 -2
  67. package/dest/archiver/structs/published.d.ts.map +1 -1
  68. package/dest/archiver/validation.d.ts +10 -4
  69. package/dest/archiver/validation.d.ts.map +1 -1
  70. package/dest/archiver/validation.js +66 -44
  71. package/dest/factory.d.ts +4 -6
  72. package/dest/factory.d.ts.map +1 -1
  73. package/dest/factory.js +5 -4
  74. package/dest/index.d.ts +2 -2
  75. package/dest/index.d.ts.map +1 -1
  76. package/dest/index.js +1 -1
  77. package/dest/rpc/index.d.ts +2 -2
  78. package/dest/test/index.d.ts +1 -1
  79. package/dest/test/mock_archiver.d.ts +16 -8
  80. package/dest/test/mock_archiver.d.ts.map +1 -1
  81. package/dest/test/mock_archiver.js +19 -14
  82. package/dest/test/mock_l1_to_l2_message_source.d.ts +7 -6
  83. package/dest/test/mock_l1_to_l2_message_source.d.ts.map +1 -1
  84. package/dest/test/mock_l1_to_l2_message_source.js +10 -9
  85. package/dest/test/mock_l2_block_source.d.ts +31 -20
  86. package/dest/test/mock_l2_block_source.d.ts.map +1 -1
  87. package/dest/test/mock_l2_block_source.js +85 -18
  88. package/dest/test/mock_structs.d.ts +3 -2
  89. package/dest/test/mock_structs.d.ts.map +1 -1
  90. package/dest/test/mock_structs.js +9 -8
  91. package/package.json +18 -17
  92. package/src/archiver/archiver.ts +971 -475
  93. package/src/archiver/archiver_store.ts +141 -44
  94. package/src/archiver/archiver_store_test_suite.ts +2114 -331
  95. package/src/archiver/config.ts +30 -35
  96. package/src/archiver/errors.ts +64 -0
  97. package/src/archiver/index.ts +1 -1
  98. package/src/archiver/instrumentation.ts +19 -2
  99. package/src/archiver/kv_archiver_store/block_store.ts +541 -83
  100. package/src/archiver/kv_archiver_store/contract_class_store.ts +1 -1
  101. package/src/archiver/kv_archiver_store/contract_instance_store.ts +1 -1
  102. package/src/archiver/kv_archiver_store/kv_archiver_store.ts +107 -67
  103. package/src/archiver/kv_archiver_store/log_store.ts +209 -99
  104. package/src/archiver/kv_archiver_store/message_store.ts +21 -18
  105. package/src/archiver/l1/README.md +98 -0
  106. package/src/archiver/l1/bin/retrieve-calldata.ts +182 -0
  107. package/src/archiver/l1/calldata_retriever.ts +641 -0
  108. package/src/archiver/l1/data_retrieval.ts +512 -0
  109. package/src/archiver/l1/debug_tx.ts +99 -0
  110. package/src/archiver/l1/spire_proposer.ts +160 -0
  111. package/src/archiver/l1/trace_tx.ts +128 -0
  112. package/src/archiver/l1/types.ts +13 -0
  113. package/src/archiver/l1/validate_trace.ts +211 -0
  114. package/src/archiver/structs/inbox_message.ts +8 -8
  115. package/src/archiver/structs/published.ts +1 -1
  116. package/src/archiver/validation.ts +86 -32
  117. package/src/factory.ts +6 -7
  118. package/src/index.ts +1 -1
  119. package/src/test/fixtures/debug_traceTransaction-multicall3.json +88 -0
  120. package/src/test/fixtures/debug_traceTransaction-multiplePropose.json +153 -0
  121. package/src/test/fixtures/debug_traceTransaction-proxied.json +122 -0
  122. package/src/test/fixtures/trace_transaction-multicall3.json +65 -0
  123. package/src/test/fixtures/trace_transaction-multiplePropose.json +319 -0
  124. package/src/test/fixtures/trace_transaction-proxied.json +128 -0
  125. package/src/test/fixtures/trace_transaction-randomRevert.json +216 -0
  126. package/src/test/mock_archiver.ts +22 -16
  127. package/src/test/mock_l1_to_l2_message_source.ts +10 -9
  128. package/src/test/mock_l2_block_source.ts +114 -27
  129. package/src/test/mock_structs.ts +10 -9
  130. package/dest/archiver/data_retrieval.d.ts +0 -78
  131. package/dest/archiver/data_retrieval.d.ts.map +0 -1
  132. package/dest/archiver/data_retrieval.js +0 -354
  133. package/src/archiver/data_retrieval.ts +0 -535
@@ -0,0 +1,157 @@
1
+ import { EthAddress } from '@aztec/foundation/eth-address';
2
+ import { decodeFunctionData, getAddress, trim } from 'viem';
3
+ // Spire Proposer Multicall constants
4
+ export const SPIRE_PROPOSER_ADDRESS = '0x9ccc2f3ecde026230e11a5c8799ac7524f2bb294';
5
+ export const SPIRE_PROPOSER_EXPECTED_IMPLEMENTATION = '0x7d38d47e7c82195e6e607d3b0f1c20c615c7bf42';
6
+ // EIP-1967 storage slot for implementation address
7
+ // keccak256("eip1967.proxy.implementation") - 1 = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc
8
+ export const EIP1967_IMPLEMENTATION_SLOT = '0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc';
9
+ // Spire Proposer Multicall ABI
10
+ export const SpireProposerAbi = [
11
+ {
12
+ inputs: [
13
+ {
14
+ components: [
15
+ {
16
+ internalType: 'address',
17
+ name: 'proposer',
18
+ type: 'address'
19
+ },
20
+ {
21
+ internalType: 'address',
22
+ name: 'target',
23
+ type: 'address'
24
+ },
25
+ {
26
+ internalType: 'bytes',
27
+ name: 'data',
28
+ type: 'bytes'
29
+ },
30
+ {
31
+ internalType: 'uint256',
32
+ name: 'value',
33
+ type: 'uint256'
34
+ },
35
+ {
36
+ internalType: 'uint256',
37
+ name: 'gasLimit',
38
+ type: 'uint256'
39
+ }
40
+ ],
41
+ internalType: 'struct IProposerMulticall.Call[]',
42
+ name: '_calls',
43
+ type: 'tuple[]'
44
+ }
45
+ ],
46
+ name: 'multicall',
47
+ outputs: [],
48
+ stateMutability: 'nonpayable',
49
+ type: 'function'
50
+ }
51
+ ];
52
+ /**
53
+ * Verifies that a proxy contract points to the expected implementation using EIP-1967.
54
+ * @param publicClient - The viem public client
55
+ * @param proxyAddress - The proxy contract address
56
+ * @param expectedImplementation - The expected implementation address
57
+ * @param logger - Logger instance
58
+ * @returns True if the proxy points to the expected implementation
59
+ */ export async function verifyProxyImplementation(publicClient, proxyAddress, expectedImplementation, logger) {
60
+ try {
61
+ // Read the EIP-1967 implementation slot
62
+ const implementationData = await publicClient.getStorageAt({
63
+ address: proxyAddress,
64
+ slot: EIP1967_IMPLEMENTATION_SLOT
65
+ });
66
+ if (!implementationData) {
67
+ logger.warn(`No implementation found in EIP-1967 slot for proxy ${proxyAddress}`);
68
+ return false;
69
+ }
70
+ // The implementation address is stored in the last 20 bytes of the slot
71
+ // We need to extract and normalize it for comparison
72
+ const implementationAddress = getAddress(trim(implementationData));
73
+ const expectedAddress = getAddress(expectedImplementation);
74
+ const matches = implementationAddress.toLowerCase() === expectedAddress.toLowerCase();
75
+ if (!matches) {
76
+ logger.warn(`Proxy implementation mismatch: expected ${expectedAddress}, got ${implementationAddress}`, {
77
+ proxyAddress,
78
+ expectedImplementation,
79
+ actualImplementation: implementationAddress
80
+ });
81
+ }
82
+ return matches;
83
+ } catch (err) {
84
+ logger.warn(`Failed to verify proxy implementation for ${proxyAddress}: ${err}`);
85
+ return false;
86
+ }
87
+ }
88
+ /**
89
+ * Attempts to decode transaction as a Spire Proposer Multicall.
90
+ * Spire Proposer is a proxy contract that wraps multiple calls.
91
+ * Returns the target address and calldata of the wrapped call if validation succeeds and there is a single call.
92
+ * @param tx - The transaction to decode
93
+ * @param publicClient - The viem public client for proxy verification
94
+ * @param logger - Logger instance
95
+ * @returns Object with 'to' and 'data' of the wrapped call, or undefined if validation fails
96
+ */ export async function getCallFromSpireProposer(tx, publicClient, logger) {
97
+ const txHash = tx.hash;
98
+ try {
99
+ // Check if transaction is to the Spire Proposer address
100
+ if (!tx.to || !EthAddress.areEqual(tx.to, SPIRE_PROPOSER_ADDRESS)) {
101
+ logger.debug(`Transaction is not to Spire Proposer address (to: ${tx.to})`, {
102
+ txHash
103
+ });
104
+ return undefined;
105
+ }
106
+ // Verify the proxy points to the expected implementation
107
+ const isValidProxy = await verifyProxyImplementation(publicClient, tx.to, SPIRE_PROPOSER_EXPECTED_IMPLEMENTATION, logger);
108
+ if (!isValidProxy) {
109
+ logger.warn(`Spire Proposer proxy implementation verification failed`, {
110
+ txHash,
111
+ to: tx.to
112
+ });
113
+ return undefined;
114
+ }
115
+ // Try to decode as Spire Proposer multicall
116
+ const { functionName: spireFunctionName, args: spireArgs } = decodeFunctionData({
117
+ abi: SpireProposerAbi,
118
+ data: tx.input
119
+ });
120
+ // If not multicall, return undefined
121
+ if (spireFunctionName !== 'multicall') {
122
+ logger.warn(`Transaction to Spire Proposer is not multicall (got ${spireFunctionName})`, {
123
+ txHash
124
+ });
125
+ return undefined;
126
+ }
127
+ if (spireArgs.length !== 1) {
128
+ logger.warn(`Unexpected number of arguments for Spire Proposer multicall (got ${spireArgs.length})`, {
129
+ txHash
130
+ });
131
+ return undefined;
132
+ }
133
+ const [calls] = spireArgs;
134
+ // Validate exactly ONE call (see ./README.md for rationale)
135
+ if (calls.length !== 1) {
136
+ logger.warn(`Spire Proposer multicall must contain exactly one call (got ${calls.length})`, {
137
+ txHash
138
+ });
139
+ return undefined;
140
+ }
141
+ const call = calls[0];
142
+ // Successfully extracted the single wrapped call
143
+ logger.trace(`Decoded Spire Proposer with single call to ${call.target}`, {
144
+ txHash
145
+ });
146
+ return {
147
+ to: call.target,
148
+ data: call.data
149
+ };
150
+ } catch (err) {
151
+ // Any decoding error triggers fallback to trace
152
+ logger.warn(`Failed to decode Spire Proposer: ${err}`, {
153
+ txHash
154
+ });
155
+ return undefined;
156
+ }
157
+ }
@@ -0,0 +1,97 @@
1
+ import type { ViemPublicDebugClient } from '@aztec/ethereum/types';
2
+ import { EthAddress } from '@aztec/foundation/eth-address';
3
+ import type { Logger } from '@aztec/foundation/log';
4
+ import { type ZodFor } from '@aztec/foundation/schemas';
5
+ import type { Hex } from 'viem';
6
+ import { z } from 'zod';
7
+ import type { CallInfo } from './types.js';
8
+ /** Zod schema for a single trace from trace_transaction */
9
+ export declare const traceSchema: z.ZodObject<{
10
+ action: z.ZodObject<{
11
+ from: z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, `0x${string}`, string>;
12
+ to: z.ZodOptional<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, `0x${string}`, string>>;
13
+ callType: z.ZodString;
14
+ gas: z.ZodOptional<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, `0x${string}`, string>>;
15
+ input: z.ZodOptional<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, `0x${string}`, string>>;
16
+ value: z.ZodOptional<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, `0x${string}`, string>>;
17
+ }, "strip", z.ZodTypeAny, {
18
+ from: `0x${string}`;
19
+ to?: `0x${string}` | undefined;
20
+ callType: string;
21
+ gas?: `0x${string}` | undefined;
22
+ input?: `0x${string}` | undefined;
23
+ value?: `0x${string}` | undefined;
24
+ }, {
25
+ from: string;
26
+ to?: string | undefined;
27
+ callType: string;
28
+ gas?: string | undefined;
29
+ input?: string | undefined;
30
+ value?: string | undefined;
31
+ }>;
32
+ result: z.ZodOptional<z.ZodObject<{
33
+ gasUsed: z.ZodOptional<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, `0x${string}`, string>>;
34
+ output: z.ZodOptional<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, `0x${string}`, string>>;
35
+ }, "strip", z.ZodTypeAny, {
36
+ gasUsed?: `0x${string}` | undefined;
37
+ output?: `0x${string}` | undefined;
38
+ }, {
39
+ gasUsed?: string | undefined;
40
+ output?: string | undefined;
41
+ }>>;
42
+ error: z.ZodOptional<z.ZodString>;
43
+ subtraces: z.ZodNumber;
44
+ traceAddress: z.ZodArray<z.ZodNumber, "many">;
45
+ type: z.ZodString;
46
+ }, "strip", z.ZodTypeAny, {
47
+ action: {
48
+ from: `0x${string}`;
49
+ to?: `0x${string}` | undefined;
50
+ callType: string;
51
+ gas?: `0x${string}` | undefined;
52
+ input?: `0x${string}` | undefined;
53
+ value?: `0x${string}` | undefined;
54
+ };
55
+ result?: {
56
+ gasUsed?: `0x${string}` | undefined;
57
+ output?: `0x${string}` | undefined;
58
+ } | undefined;
59
+ error?: string | undefined;
60
+ subtraces: number;
61
+ traceAddress: number[];
62
+ type: string;
63
+ }, {
64
+ action: {
65
+ from: string;
66
+ to?: string | undefined;
67
+ callType: string;
68
+ gas?: string | undefined;
69
+ input?: string | undefined;
70
+ value?: string | undefined;
71
+ };
72
+ result?: {
73
+ gasUsed?: string | undefined;
74
+ output?: string | undefined;
75
+ } | undefined;
76
+ error?: string | undefined;
77
+ subtraces: number;
78
+ traceAddress: number[];
79
+ type: string;
80
+ }>;
81
+ /** Type for trace_transaction response */
82
+ type TraceTransaction = z.infer<typeof traceSchema>;
83
+ /** Zod schema for the full trace_transaction response (array of traces) */
84
+ export declare const traceTransactionResponseSchema: ZodFor<TraceTransaction[]>;
85
+ /**
86
+ * Traces a transaction and extracts all CALL operations to a specific contract and function selector.
87
+ * Uses the trace_transaction RPC method which returns a flat array of traces.
88
+ *
89
+ * @param client - The Viem public debug client
90
+ * @param txHash - The transaction hash to trace
91
+ * @param targetAddress - The contract address to filter for
92
+ * @param functionSelector - The 4-byte function selector to filter for (with or without 0x prefix)
93
+ * @returns Array of CallInfo objects containing from, gasUsed, input, and value for matching calls
94
+ */
95
+ export declare function getSuccessfulCallsFromTrace(client: ViemPublicDebugClient, txHash: Hex, targetAddress: EthAddress, functionSelector: string, logger?: Logger): Promise<CallInfo[]>;
96
+ export {};
97
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidHJhY2VfdHguZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9hcmNoaXZlci9sMS90cmFjZV90eC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEtBQUssRUFBRSxxQkFBcUIsRUFBRSxNQUFNLHVCQUF1QixDQUFDO0FBQ25FLE9BQU8sRUFBRSxVQUFVLEVBQUUsTUFBTSwrQkFBK0IsQ0FBQztBQUMzRCxPQUFPLEtBQUssRUFBRSxNQUFNLEVBQUUsTUFBTSx1QkFBdUIsQ0FBQztBQUNwRCxPQUFPLEVBQUUsS0FBSyxNQUFNLEVBQVcsTUFBTSwyQkFBMkIsQ0FBQztBQUdqRSxPQUFPLEtBQUssRUFBRSxHQUFHLEVBQUUsTUFBTSxNQUFNLENBQUM7QUFDaEMsT0FBTyxFQUFFLENBQUMsRUFBRSxNQUFNLEtBQUssQ0FBQztBQUV4QixPQUFPLEtBQUssRUFBRSxRQUFRLEVBQUUsTUFBTSxZQUFZLENBQUM7QUFrQjNDLDJEQUEyRDtBQUMzRCxlQUFPLE1BQU0sV0FBVzs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7RUFPdEIsQ0FBQztBQUVILDBDQUEwQztBQUMxQyxLQUFLLGdCQUFnQixHQUFHLENBQUMsQ0FBQyxLQUFLLENBQUMsT0FBTyxXQUFXLENBQUMsQ0FBQztBQUVwRCwyRUFBMkU7QUFDM0UsZUFBTyxNQUFNLDhCQUE4QixFQUFFLE1BQU0sQ0FBQyxnQkFBZ0IsRUFBRSxDQUF3QixDQUFDO0FBRS9GOzs7Ozs7Ozs7R0FTRztBQUNILHdCQUFzQiwyQkFBMkIsQ0FDL0MsTUFBTSxFQUFFLHFCQUFxQixFQUM3QixNQUFNLEVBQUUsR0FBRyxFQUNYLGFBQWEsRUFBRSxVQUFVLEVBQ3pCLGdCQUFnQixFQUFFLE1BQU0sRUFDeEIsTUFBTSxDQUFDLEVBQUUsTUFBTSxHQUNkLE9BQU8sQ0FBQyxRQUFRLEVBQUUsQ0FBQyxDQW9FckIifQ==
@@ -0,0 +1 @@
1
+ {"version":3,"file":"trace_tx.d.ts","sourceRoot":"","sources":["../../../src/archiver/l1/trace_tx.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AACnE,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAC3D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,KAAK,MAAM,EAAW,MAAM,2BAA2B,CAAC;AAGjE,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,MAAM,CAAC;AAChC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAkB3C,2DAA2D;AAC3D,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAOtB,CAAC;AAEH,0CAA0C;AAC1C,KAAK,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC;AAEpD,2EAA2E;AAC3E,eAAO,MAAM,8BAA8B,EAAE,MAAM,CAAC,gBAAgB,EAAE,CAAwB,CAAC;AAE/F;;;;;;;;;GASG;AACH,wBAAsB,2BAA2B,CAC/C,MAAM,EAAE,qBAAqB,EAC7B,MAAM,EAAE,GAAG,EACX,aAAa,EAAE,UAAU,EACzB,gBAAgB,EAAE,MAAM,EACxB,MAAM,CAAC,EAAE,MAAM,GACd,OAAO,CAAC,QAAQ,EAAE,CAAC,CAoErB"}
@@ -0,0 +1,91 @@
1
+ import { EthAddress } from '@aztec/foundation/eth-address';
2
+ import { schemas } from '@aztec/foundation/schemas';
3
+ import { withHexPrefix } from '@aztec/foundation/string';
4
+ import { z } from 'zod';
5
+ /** Zod schema for trace action from trace_transaction */ const traceActionSchema = z.object({
6
+ from: schemas.HexStringWith0x,
7
+ to: schemas.HexStringWith0x.optional(),
8
+ callType: z.string(),
9
+ gas: schemas.HexStringWith0x.optional(),
10
+ input: schemas.HexStringWith0x.optional(),
11
+ value: schemas.HexStringWith0x.optional()
12
+ });
13
+ /** Zod schema for trace result from trace_transaction */ const traceResultSchema = z.object({
14
+ gasUsed: schemas.HexStringWith0x.optional(),
15
+ output: schemas.HexStringWith0x.optional()
16
+ });
17
+ /** Zod schema for a single trace from trace_transaction */ export const traceSchema = z.object({
18
+ action: traceActionSchema,
19
+ result: traceResultSchema.optional(),
20
+ error: z.string().optional(),
21
+ subtraces: z.number(),
22
+ traceAddress: z.array(z.number()),
23
+ type: z.string()
24
+ });
25
+ /** Zod schema for the full trace_transaction response (array of traces) */ export const traceTransactionResponseSchema = z.array(traceSchema);
26
+ /**
27
+ * Traces a transaction and extracts all CALL operations to a specific contract and function selector.
28
+ * Uses the trace_transaction RPC method which returns a flat array of traces.
29
+ *
30
+ * @param client - The Viem public debug client
31
+ * @param txHash - The transaction hash to trace
32
+ * @param targetAddress - The contract address to filter for
33
+ * @param functionSelector - The 4-byte function selector to filter for (with or without 0x prefix)
34
+ * @returns Array of CallInfo objects containing from, gasUsed, input, and value for matching calls
35
+ */ export async function getSuccessfulCallsFromTrace(client, txHash, targetAddress, functionSelector, logger) {
36
+ // Normalize inputs for comparison
37
+ const normalizedTarget = targetAddress.toString().toLowerCase();
38
+ const normalizedSelector = withHexPrefix(functionSelector.toLowerCase());
39
+ // Call trace_transaction (no options needed)
40
+ const rawTrace = await client.request({
41
+ method: 'trace_transaction',
42
+ params: [
43
+ txHash
44
+ ]
45
+ });
46
+ if (rawTrace === null || rawTrace === undefined) {
47
+ throw new Error(`Failed to retrieve trace_transaction for ${txHash}`);
48
+ }
49
+ logger?.trace(`Retrieved trace_transaction for ${txHash}`, {
50
+ trace: rawTrace
51
+ });
52
+ // Validate the response with zod
53
+ const traces = traceTransactionResponseSchema.parse(rawTrace);
54
+ const results = [];
55
+ // Build a set of trace addresses that errored - we should skip their descendants
56
+ // A trace address is the path in the trace tree, represented as an array of indices
57
+ const erroredTraceAddresses = new Set();
58
+ for (const trace of traces){
59
+ if (trace.error) {
60
+ erroredTraceAddresses.add(JSON.stringify(trace.traceAddress));
61
+ }
62
+ }
63
+ // Helper to check if a trace is a descendant of an errored trace
64
+ function isDescendantOfError(traceAddress) {
65
+ // Check all possible ancestor paths
66
+ for(let i = 1; i < traceAddress.length; i++){
67
+ const ancestorAddress = traceAddress.slice(0, i);
68
+ if (erroredTraceAddresses.has(JSON.stringify(ancestorAddress))) {
69
+ return true;
70
+ }
71
+ }
72
+ return false;
73
+ }
74
+ // Process each trace
75
+ for (const trace of traces){
76
+ // Skip if this has an error or is a descendant of an errored trace
77
+ if (trace.error || isDescendantOfError(trace.traceAddress)) {
78
+ continue;
79
+ }
80
+ // Check if this is a CALL type trace to the target address with matching selector and result
81
+ if (trace.type === 'call' && trace.action.callType.toLowerCase() === 'call' && trace.action.to?.toLowerCase() === normalizedTarget && trace.action.input?.toLowerCase().startsWith(normalizedSelector) && trace.result) {
82
+ results.push({
83
+ from: EthAddress.fromString(trace.action.from),
84
+ gasUsed: trace.result.gasUsed === undefined ? undefined : BigInt(trace.result.gasUsed),
85
+ input: trace.action.input,
86
+ value: trace.action.value ? BigInt(trace.action.value) : 0n
87
+ });
88
+ }
89
+ }
90
+ return results;
91
+ }
@@ -0,0 +1,12 @@
1
+ import { EthAddress } from '@aztec/foundation/eth-address';
2
+ import type { Hex } from 'viem';
3
+ /**
4
+ * Information about a matching CALL
5
+ */
6
+ export interface CallInfo {
7
+ from: EthAddress;
8
+ gasUsed?: bigint;
9
+ input: Hex;
10
+ value: bigint;
11
+ }
12
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidHlwZXMuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9hcmNoaXZlci9sMS90eXBlcy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsVUFBVSxFQUFFLE1BQU0sK0JBQStCLENBQUM7QUFFM0QsT0FBTyxLQUFLLEVBQUUsR0FBRyxFQUFFLE1BQU0sTUFBTSxDQUFDO0FBRWhDOztHQUVHO0FBQ0gsTUFBTSxXQUFXLFFBQVE7SUFDdkIsSUFBSSxFQUFFLFVBQVUsQ0FBQztJQUNqQixPQUFPLENBQUMsRUFBRSxNQUFNLENBQUM7SUFDakIsS0FBSyxFQUFFLEdBQUcsQ0FBQztJQUNYLEtBQUssRUFBRSxNQUFNLENBQUM7Q0FDZiJ9
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/archiver/l1/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAE3D,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,MAAM,CAAC;AAEhC;;GAEG;AACH,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,UAAU,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,GAAG,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;CACf"}
@@ -0,0 +1,3 @@
1
+ /**
2
+ * Information about a matching CALL
3
+ */ export { };
@@ -0,0 +1,29 @@
1
+ import type { ViemPublicDebugClient } from '@aztec/ethereum/types';
2
+ /** Result of trace availability checks */
3
+ export interface TraceAvailability {
4
+ /** Whether debug_traceTransaction works for recent blocks */
5
+ debugTraceRecent: boolean;
6
+ /** Whether trace_transaction works for recent blocks */
7
+ traceTransactionRecent: boolean;
8
+ /** Whether debug_traceTransaction works for old blocks (512 blocks ago) */
9
+ debugTraceOld: boolean;
10
+ /** Whether trace_transaction works for old blocks (512 blocks ago) */
11
+ traceTransactionOld: boolean;
12
+ }
13
+ /**
14
+ * Validates the availability of debug/trace methods on the Ethereum client.
15
+ *
16
+ * @param client - The Viem public debug client
17
+ * @returns Object indicating which trace methods are available for recent and old blocks
18
+ */
19
+ export declare function validateTraceAvailability(client: ViemPublicDebugClient): Promise<TraceAvailability>;
20
+ /**
21
+ * Validates trace availability and logs appropriate messages based on the results.
22
+ * Optionally throws an error if no trace methods are available and ethereumAllowNoDebugHosts is false.
23
+ *
24
+ * @param client - The Viem public debug client
25
+ * @param ethereumAllowNoDebugHosts - If false, throws an error when no trace methods are available
26
+ * @throws Error if ethereumAllowNoDebugHosts is false and no trace methods are available
27
+ */
28
+ export declare function validateAndLogTraceAvailability(client: ViemPublicDebugClient, ethereumAllowNoDebugHosts: boolean): Promise<void>;
29
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidmFsaWRhdGVfdHJhY2UuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9hcmNoaXZlci9sMS92YWxpZGF0ZV90cmFjZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEtBQUssRUFBRSxxQkFBcUIsRUFBRSxNQUFNLHVCQUF1QixDQUFDO0FBNkNuRSwwQ0FBMEM7QUFDMUMsTUFBTSxXQUFXLGlCQUFpQjtJQUNoQyw2REFBNkQ7SUFDN0QsZ0JBQWdCLEVBQUUsT0FBTyxDQUFDO0lBQzFCLHdEQUF3RDtJQUN4RCxzQkFBc0IsRUFBRSxPQUFPLENBQUM7SUFDaEMsMkVBQTJFO0lBQzNFLGFBQWEsRUFBRSxPQUFPLENBQUM7SUFDdkIsc0VBQXNFO0lBQ3RFLG1CQUFtQixFQUFFLE9BQU8sQ0FBQztDQUM5QjtBQUVEOzs7OztHQUtHO0FBQ0gsd0JBQXNCLHlCQUF5QixDQUFDLE1BQU0sRUFBRSxxQkFBcUIsR0FBRyxPQUFPLENBQUMsaUJBQWlCLENBQUMsQ0FzRnpHO0FBTUQ7Ozs7Ozs7R0FPRztBQUNILHdCQUFzQiwrQkFBK0IsQ0FDbkQsTUFBTSxFQUFFLHFCQUFxQixFQUM3Qix5QkFBeUIsRUFBRSxPQUFPLEdBQ2pDLE9BQU8sQ0FBQyxJQUFJLENBQUMsQ0E0Q2YifQ==
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validate_trace.d.ts","sourceRoot":"","sources":["../../../src/archiver/l1/validate_trace.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AA6CnE,0CAA0C;AAC1C,MAAM,WAAW,iBAAiB;IAChC,6DAA6D;IAC7D,gBAAgB,EAAE,OAAO,CAAC;IAC1B,wDAAwD;IACxD,sBAAsB,EAAE,OAAO,CAAC;IAChC,2EAA2E;IAC3E,aAAa,EAAE,OAAO,CAAC;IACvB,sEAAsE;IACtE,mBAAmB,EAAE,OAAO,CAAC;CAC9B;AAED;;;;;GAKG;AACH,wBAAsB,yBAAyB,CAAC,MAAM,EAAE,qBAAqB,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAsFzG;AAMD;;;;;;;GAOG;AACH,wBAAsB,+BAA+B,CACnD,MAAM,EAAE,qBAAqB,EAC7B,yBAAyB,EAAE,OAAO,GACjC,OAAO,CAAC,IAAI,CAAC,CA4Cf"}
@@ -0,0 +1,150 @@
1
+ import { createLogger } from '@aztec/foundation/log';
2
+ import { callTraceSchema } from './debug_tx.js';
3
+ import { traceTransactionResponseSchema } from './trace_tx.js';
4
+ const logger = createLogger('aztec:archiver:validate_trace');
5
+ /**
6
+ * Helper function to test a trace method with validation
7
+ *
8
+ * @param client - The Viem public debug client
9
+ * @param txHash - Transaction hash to trace
10
+ * @param schema - Zod schema to validate the response
11
+ * @param method - Name of the RPC method ('debug_traceTransaction' or 'trace_transaction')
12
+ * @param blockType - Type of block being tested ('recent' or 'old')
13
+ * @returns true if the method works and validation passes, false otherwise
14
+ */ async function testTraceMethod(client, txHash, schema, method, blockType) {
15
+ try {
16
+ // Make request with appropriate params based on method name
17
+ const result = await client.request(method === 'debug_traceTransaction' ? {
18
+ method,
19
+ params: [
20
+ txHash,
21
+ {
22
+ tracer: 'callTracer'
23
+ }
24
+ ]
25
+ } : {
26
+ method,
27
+ params: [
28
+ txHash
29
+ ]
30
+ });
31
+ schema.parse(result);
32
+ logger.debug(`${method} works for ${blockType} blocks`);
33
+ return true;
34
+ } catch (error) {
35
+ logger.warn(`${method} failed for ${blockType} blocks: ${error}`);
36
+ return false;
37
+ }
38
+ }
39
+ /**
40
+ * Validates the availability of debug/trace methods on the Ethereum client.
41
+ *
42
+ * @param client - The Viem public debug client
43
+ * @returns Object indicating which trace methods are available for recent and old blocks
44
+ */ export async function validateTraceAvailability(client) {
45
+ const result = {
46
+ debugTraceRecent: false,
47
+ traceTransactionRecent: false,
48
+ debugTraceOld: false,
49
+ traceTransactionOld: false
50
+ };
51
+ try {
52
+ // Get the latest block
53
+ let latestBlock = await client.getBlock({
54
+ blockTag: 'latest'
55
+ });
56
+ let attempts = 10;
57
+ // Loop back to find a block with transactions (handles dev/test scenarios)
58
+ while(!hasTxs(latestBlock) && latestBlock.number && latestBlock.number > 0n && --attempts > 0){
59
+ logger.debug(`Block ${latestBlock.number} has no transactions, checking previous block`);
60
+ latestBlock = await client.getBlock({
61
+ blockNumber: latestBlock.number - 1n
62
+ });
63
+ }
64
+ if (!hasTxs(latestBlock)) {
65
+ logger.warn('No blocks with transactions found from latest back to genesis, cannot validate trace availability');
66
+ return result;
67
+ }
68
+ // Get a transaction from the found block
69
+ const recentTxHash = latestBlock.transactions[0];
70
+ // Test debug_traceTransaction with recent block
71
+ result.debugTraceRecent = await testTraceMethod(client, recentTxHash, callTraceSchema, 'debug_traceTransaction', 'recent');
72
+ // Test trace_transaction with recent block
73
+ result.traceTransactionRecent = await testTraceMethod(client, recentTxHash, traceTransactionResponseSchema, 'trace_transaction', 'recent');
74
+ // Get a block from 512 blocks ago
75
+ const oldBlockNumber = latestBlock.number ? latestBlock.number - 512n : null;
76
+ if (!oldBlockNumber || oldBlockNumber < 0n) {
77
+ logger.debug('Cannot test old blocks, blockchain too short');
78
+ return result;
79
+ }
80
+ let oldBlock = await client.getBlock({
81
+ blockNumber: oldBlockNumber
82
+ });
83
+ attempts = 10;
84
+ // Loop back to find a block with transactions (handles dev/test scenarios)
85
+ while(!hasTxs(oldBlock) && oldBlock.number && oldBlock.number > 0n && --attempts > 0){
86
+ logger.debug(`Block ${oldBlock.number} has no transactions, checking previous block`);
87
+ oldBlock = await client.getBlock({
88
+ blockNumber: oldBlock.number - 1n
89
+ });
90
+ }
91
+ if (!hasTxs(oldBlock)) {
92
+ logger.debug('No blocks with transactions found from old block back to genesis, cannot validate trace availability for old blocks');
93
+ return result;
94
+ }
95
+ const oldTxHash = oldBlock.transactions[0];
96
+ // Test debug_traceTransaction with old block
97
+ result.debugTraceOld = await testTraceMethod(client, oldTxHash, callTraceSchema, 'debug_traceTransaction', 'old');
98
+ // Test trace_transaction with old block
99
+ result.traceTransactionOld = await testTraceMethod(client, oldTxHash, traceTransactionResponseSchema, 'trace_transaction', 'old');
100
+ } catch (error) {
101
+ logger.warn(`Error validating debug_traceTransaction and trace_transaction availability: ${error}`);
102
+ }
103
+ return result;
104
+ }
105
+ function hasTxs(block) {
106
+ return Array.isArray(block.transactions) && block.transactions.length > 0;
107
+ }
108
+ /**
109
+ * Validates trace availability and logs appropriate messages based on the results.
110
+ * Optionally throws an error if no trace methods are available and ethereumAllowNoDebugHosts is false.
111
+ *
112
+ * @param client - The Viem public debug client
113
+ * @param ethereumAllowNoDebugHosts - If false, throws an error when no trace methods are available
114
+ * @throws Error if ethereumAllowNoDebugHosts is false and no trace methods are available
115
+ */ export async function validateAndLogTraceAvailability(client, ethereumAllowNoDebugHosts) {
116
+ logger.info('Validating trace/debug method availability...');
117
+ const availability = await validateTraceAvailability(client);
118
+ // Check if we have support for old blocks (either debug or trace)
119
+ const hasOldBlockSupport = availability.debugTraceOld || availability.traceTransactionOld;
120
+ if (hasOldBlockSupport) {
121
+ // Ideal case: we have trace support for old blocks
122
+ const methods = [];
123
+ if (availability.debugTraceOld) {
124
+ methods.push('debug_traceTransaction');
125
+ }
126
+ if (availability.traceTransactionOld) {
127
+ methods.push('trace_transaction');
128
+ }
129
+ logger.info(`Ethereum client supports trace methods for old blocks (${methods.join(', ')}). Archiver can retrieve historical transaction traces.`);
130
+ } else if (availability.debugTraceRecent || availability.traceTransactionRecent) {
131
+ // Warning case: only recent block support
132
+ const methods = [];
133
+ if (availability.debugTraceRecent) {
134
+ methods.push('debug_traceTransaction');
135
+ }
136
+ if (availability.traceTransactionRecent) {
137
+ methods.push('trace_transaction');
138
+ }
139
+ logger.warn(`Ethereum client only supports trace methods for recent blocks (${methods.join(', ')}). Historical transaction traces may not be available.`);
140
+ } else {
141
+ // Error case: no support at all
142
+ const errorMessage = 'Ethereum debug client does not support debug_traceTransaction or trace_transaction methods. Transaction tracing will not be available. This may impact archiver syncing.';
143
+ if (ethereumAllowNoDebugHosts) {
144
+ logger.warn(`${errorMessage} Continuing because ETHEREUM_ALLOW_NO_DEBUG_HOSTS is set to true.`);
145
+ } else {
146
+ logger.error(errorMessage);
147
+ throw new Error(`${errorMessage} Set ETHEREUM_ALLOW_NO_DEBUG_HOSTS=true to bypass this check.`);
148
+ }
149
+ }
150
+ }
@@ -24,4 +24,4 @@ export type SingletonDataRetrieval<T> = {
24
24
  */
25
25
  retrievedData: T;
26
26
  };
27
- //# sourceMappingURL=data_retrieval.d.ts.map
27
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZGF0YV9yZXRyaWV2YWwuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9hcmNoaXZlci9zdHJ1Y3RzL2RhdGFfcmV0cmlldmFsLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBOztHQUVHO0FBQ0gsTUFBTSxNQUFNLGFBQWEsQ0FBQyxDQUFDLElBQUk7SUFDN0I7O09BRUc7SUFDSCwwQkFBMEIsRUFBRSxNQUFNLENBQUM7SUFDbkM7O09BRUc7SUFDSCxhQUFhLEVBQUUsQ0FBQyxFQUFFLENBQUM7Q0FDcEIsQ0FBQztBQUVGOztHQUVHO0FBQ0gsTUFBTSxNQUFNLHNCQUFzQixDQUFDLENBQUMsSUFBSTtJQUN0Qzs7T0FFRztJQUNILDBCQUEwQixFQUFFLE1BQU0sQ0FBQztJQUNuQzs7T0FFRztJQUNILGFBQWEsRUFBRSxDQUFDLENBQUM7Q0FDbEIsQ0FBQyJ9
@@ -1,10 +1,10 @@
1
+ import { CheckpointNumber } from '@aztec/foundation/branded-types';
1
2
  import { Buffer16, Buffer32 } from '@aztec/foundation/buffer';
2
- import { Fr } from '@aztec/foundation/fields';
3
- import type { UInt32 } from '@aztec/stdlib/types';
3
+ import { Fr } from '@aztec/foundation/curves/bn254';
4
4
  export type InboxMessage = {
5
5
  index: bigint;
6
6
  leaf: Fr;
7
- l2BlockNumber: UInt32;
7
+ checkpointNumber: CheckpointNumber;
8
8
  l1BlockNumber: bigint;
9
9
  l1BlockHash: Buffer32;
10
10
  rollingHash: Buffer16;
@@ -12,4 +12,4 @@ export type InboxMessage = {
12
12
  export declare function updateRollingHash(currentRollingHash: Buffer16, leaf: Fr): Buffer16;
13
13
  export declare function serializeInboxMessage(message: InboxMessage): Buffer;
14
14
  export declare function deserializeInboxMessage(buffer: Buffer): InboxMessage;
15
- //# sourceMappingURL=inbox_message.d.ts.map
15
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5ib3hfbWVzc2FnZS5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL2FyY2hpdmVyL3N0cnVjdHMvaW5ib3hfbWVzc2FnZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsZ0JBQWdCLEVBQUUsTUFBTSxpQ0FBaUMsQ0FBQztBQUNuRSxPQUFPLEVBQUUsUUFBUSxFQUFFLFFBQVEsRUFBRSxNQUFNLDBCQUEwQixDQUFDO0FBRTlELE9BQU8sRUFBRSxFQUFFLEVBQUUsTUFBTSxnQ0FBZ0MsQ0FBQztBQUdwRCxNQUFNLE1BQU0sWUFBWSxHQUFHO0lBQ3pCLEtBQUssRUFBRSxNQUFNLENBQUM7SUFDZCxJQUFJLEVBQUUsRUFBRSxDQUFDO0lBQ1QsZ0JBQWdCLEVBQUUsZ0JBQWdCLENBQUM7SUFDbkMsYUFBYSxFQUFFLE1BQU0sQ0FBQztJQUN0QixXQUFXLEVBQUUsUUFBUSxDQUFDO0lBQ3RCLFdBQVcsRUFBRSxRQUFRLENBQUM7Q0FDdkIsQ0FBQztBQUVGLHdCQUFnQixpQkFBaUIsQ0FBQyxrQkFBa0IsRUFBRSxRQUFRLEVBQUUsSUFBSSxFQUFFLEVBQUUsR0FBRyxRQUFRLENBR2xGO0FBRUQsd0JBQWdCLHFCQUFxQixDQUFDLE9BQU8sRUFBRSxZQUFZLEdBQUcsTUFBTSxDQVNuRTtBQUVELHdCQUFnQix1QkFBdUIsQ0FBQyxNQUFNLEVBQUUsTUFBTSxHQUFHLFlBQVksQ0FTcEUifQ==
@@ -1 +1 @@
1
- {"version":3,"file":"inbox_message.d.ts","sourceRoot":"","sources":["../../../src/archiver/structs/inbox_message.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAE9D,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAE9C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAElD,MAAM,MAAM,YAAY,GAAG;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,EAAE,CAAC;IACT,aAAa,EAAE,MAAM,CAAC;IACtB,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,QAAQ,CAAC;IACtB,WAAW,EAAE,QAAQ,CAAC;CACvB,CAAC;AAEF,wBAAgB,iBAAiB,CAAC,kBAAkB,EAAE,QAAQ,EAAE,IAAI,EAAE,EAAE,GAAG,QAAQ,CAGlF;AAED,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,YAAY,GAAG,MAAM,CASnE;AAED,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,MAAM,GAAG,YAAY,CASpE"}
1
+ {"version":3,"file":"inbox_message.d.ts","sourceRoot":"","sources":["../../../src/archiver/structs/inbox_message.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AACnE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAE9D,OAAO,EAAE,EAAE,EAAE,MAAM,gCAAgC,CAAC;AAGpD,MAAM,MAAM,YAAY,GAAG;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,EAAE,CAAC;IACT,gBAAgB,EAAE,gBAAgB,CAAC;IACnC,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,QAAQ,CAAC;IACtB,WAAW,EAAE,QAAQ,CAAC;CACvB,CAAC;AAEF,wBAAgB,iBAAiB,CAAC,kBAAkB,EAAE,QAAQ,EAAE,IAAI,EAAE,EAAE,GAAG,QAAQ,CAGlF;AAED,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,YAAY,GAAG,MAAM,CASnE;AAED,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,MAAM,GAAG,YAAY,CASpE"}
@@ -1,6 +1,7 @@
1
+ import { CheckpointNumber } from '@aztec/foundation/branded-types';
1
2
  import { Buffer16, Buffer32 } from '@aztec/foundation/buffer';
2
- import { keccak256 } from '@aztec/foundation/crypto';
3
- import { Fr } from '@aztec/foundation/fields';
3
+ import { keccak256 } from '@aztec/foundation/crypto/keccak';
4
+ import { Fr } from '@aztec/foundation/curves/bn254';
4
5
  import { BufferReader, bigintToUInt64BE, numToUInt32BE, serializeToBuffer } from '@aztec/foundation/serialize';
5
6
  export function updateRollingHash(currentRollingHash, leaf) {
6
7
  const input = Buffer.concat([
@@ -15,7 +16,7 @@ export function serializeInboxMessage(message) {
15
16
  message.leaf,
16
17
  message.l1BlockHash,
17
18
  numToUInt32BE(Number(message.l1BlockNumber)),
18
- numToUInt32BE(message.l2BlockNumber),
19
+ numToUInt32BE(message.checkpointNumber),
19
20
  message.rollingHash
20
21
  ]);
21
22
  }
@@ -25,14 +26,14 @@ export function deserializeInboxMessage(buffer) {
25
26
  const leaf = reader.readObject(Fr);
26
27
  const l1BlockHash = reader.readObject(Buffer32);
27
28
  const l1BlockNumber = BigInt(reader.readNumber());
28
- const l2BlockNumber = reader.readNumber();
29
+ const checkpointNumber = CheckpointNumber(reader.readNumber());
29
30
  const rollingHash = reader.readObject(Buffer16);
30
31
  return {
31
32
  index,
32
33
  leaf,
33
34
  l1BlockHash,
34
35
  l1BlockNumber,
35
- l2BlockNumber,
36
+ checkpointNumber,
36
37
  rollingHash
37
38
  };
38
39
  }
@@ -1,2 +1,2 @@
1
- export type { PublishedL2Block, L1PublishedData } from '@aztec/stdlib/block';
2
- //# sourceMappingURL=published.d.ts.map
1
+ export type { L1PublishedData, PublishedCheckpoint } from '@aztec/stdlib/checkpoint';
2
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHVibGlzaGVkLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMvYXJjaGl2ZXIvc3RydWN0cy9wdWJsaXNoZWQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsWUFBWSxFQUFFLGVBQWUsRUFBRSxtQkFBbUIsRUFBRSxNQUFNLDBCQUEwQixDQUFDIn0=
@@ -1 +1 @@
1
- {"version":3,"file":"published.d.ts","sourceRoot":"","sources":["../../../src/archiver/structs/published.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC"}
1
+ {"version":3,"file":"published.d.ts","sourceRoot":"","sources":["../../../src/archiver/structs/published.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC"}