@aztec/archiver 0.0.1-commit.d3ec352c → 0.0.1-commit.fcb71a6

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 (122) hide show
  1. package/dest/archiver/archiver.d.ts +84 -70
  2. package/dest/archiver/archiver.d.ts.map +1 -1
  3. package/dest/archiver/archiver.js +439 -228
  4. package/dest/archiver/archiver_store.d.ts +95 -43
  5. package/dest/archiver/archiver_store.d.ts.map +1 -1
  6. package/dest/archiver/archiver_store_test_suite.d.ts +1 -1
  7. package/dest/archiver/archiver_store_test_suite.d.ts.map +1 -1
  8. package/dest/archiver/archiver_store_test_suite.js +1847 -366
  9. package/dest/archiver/config.d.ts +5 -4
  10. package/dest/archiver/config.d.ts.map +1 -1
  11. package/dest/archiver/config.js +10 -3
  12. package/dest/archiver/errors.d.ts +25 -1
  13. package/dest/archiver/errors.d.ts.map +1 -1
  14. package/dest/archiver/errors.js +37 -0
  15. package/dest/archiver/index.d.ts +2 -2
  16. package/dest/archiver/index.d.ts.map +1 -1
  17. package/dest/archiver/instrumentation.d.ts +3 -1
  18. package/dest/archiver/instrumentation.d.ts.map +1 -1
  19. package/dest/archiver/instrumentation.js +11 -0
  20. package/dest/archiver/kv_archiver_store/block_store.d.ts +50 -18
  21. package/dest/archiver/kv_archiver_store/block_store.d.ts.map +1 -1
  22. package/dest/archiver/kv_archiver_store/block_store.js +320 -84
  23. package/dest/archiver/kv_archiver_store/contract_class_store.d.ts +2 -2
  24. package/dest/archiver/kv_archiver_store/contract_class_store.d.ts.map +1 -1
  25. package/dest/archiver/kv_archiver_store/contract_class_store.js +1 -1
  26. package/dest/archiver/kv_archiver_store/contract_instance_store.d.ts +2 -2
  27. package/dest/archiver/kv_archiver_store/contract_instance_store.d.ts.map +1 -1
  28. package/dest/archiver/kv_archiver_store/kv_archiver_store.d.ts +40 -51
  29. package/dest/archiver/kv_archiver_store/kv_archiver_store.d.ts.map +1 -1
  30. package/dest/archiver/kv_archiver_store/kv_archiver_store.js +65 -48
  31. package/dest/archiver/kv_archiver_store/log_store.d.ts +12 -16
  32. package/dest/archiver/kv_archiver_store/log_store.d.ts.map +1 -1
  33. package/dest/archiver/kv_archiver_store/log_store.js +148 -84
  34. package/dest/archiver/kv_archiver_store/message_store.d.ts +6 -5
  35. package/dest/archiver/kv_archiver_store/message_store.d.ts.map +1 -1
  36. package/dest/archiver/kv_archiver_store/message_store.js +15 -14
  37. package/dest/archiver/l1/bin/retrieve-calldata.d.ts +3 -0
  38. package/dest/archiver/l1/bin/retrieve-calldata.d.ts.map +1 -0
  39. package/dest/archiver/l1/bin/retrieve-calldata.js +149 -0
  40. package/dest/archiver/l1/calldata_retriever.d.ts +112 -0
  41. package/dest/archiver/l1/calldata_retriever.d.ts.map +1 -0
  42. package/dest/archiver/l1/calldata_retriever.js +471 -0
  43. package/dest/archiver/l1/data_retrieval.d.ts +90 -0
  44. package/dest/archiver/l1/data_retrieval.d.ts.map +1 -0
  45. package/dest/archiver/{data_retrieval.js → l1/data_retrieval.js} +50 -106
  46. package/dest/archiver/l1/debug_tx.d.ts +19 -0
  47. package/dest/archiver/l1/debug_tx.d.ts.map +1 -0
  48. package/dest/archiver/l1/debug_tx.js +73 -0
  49. package/dest/archiver/l1/spire_proposer.d.ts +70 -0
  50. package/dest/archiver/l1/spire_proposer.d.ts.map +1 -0
  51. package/dest/archiver/l1/spire_proposer.js +157 -0
  52. package/dest/archiver/l1/trace_tx.d.ts +97 -0
  53. package/dest/archiver/l1/trace_tx.d.ts.map +1 -0
  54. package/dest/archiver/l1/trace_tx.js +91 -0
  55. package/dest/archiver/l1/types.d.ts +12 -0
  56. package/dest/archiver/l1/types.d.ts.map +1 -0
  57. package/dest/archiver/l1/types.js +3 -0
  58. package/dest/archiver/l1/validate_trace.d.ts +29 -0
  59. package/dest/archiver/l1/validate_trace.d.ts.map +1 -0
  60. package/dest/archiver/l1/validate_trace.js +150 -0
  61. package/dest/archiver/structs/inbox_message.d.ts +4 -4
  62. package/dest/archiver/structs/inbox_message.d.ts.map +1 -1
  63. package/dest/archiver/structs/inbox_message.js +6 -6
  64. package/dest/archiver/structs/published.d.ts +1 -2
  65. package/dest/archiver/structs/published.d.ts.map +1 -1
  66. package/dest/factory.d.ts +1 -1
  67. package/dest/factory.js +1 -1
  68. package/dest/index.d.ts +2 -2
  69. package/dest/index.d.ts.map +1 -1
  70. package/dest/index.js +1 -1
  71. package/dest/test/mock_archiver.d.ts +4 -5
  72. package/dest/test/mock_archiver.d.ts.map +1 -1
  73. package/dest/test/mock_archiver.js +5 -9
  74. package/dest/test/mock_l1_to_l2_message_source.d.ts +5 -6
  75. package/dest/test/mock_l1_to_l2_message_source.d.ts.map +1 -1
  76. package/dest/test/mock_l1_to_l2_message_source.js +7 -11
  77. package/dest/test/mock_l2_block_source.d.ts +11 -4
  78. package/dest/test/mock_l2_block_source.d.ts.map +1 -1
  79. package/dest/test/mock_l2_block_source.js +18 -17
  80. package/dest/test/mock_structs.d.ts +3 -2
  81. package/dest/test/mock_structs.d.ts.map +1 -1
  82. package/dest/test/mock_structs.js +9 -9
  83. package/package.json +15 -14
  84. package/src/archiver/archiver.ts +567 -290
  85. package/src/archiver/archiver_store.ts +104 -42
  86. package/src/archiver/archiver_store_test_suite.ts +1895 -347
  87. package/src/archiver/config.ts +15 -10
  88. package/src/archiver/errors.ts +64 -0
  89. package/src/archiver/index.ts +1 -1
  90. package/src/archiver/instrumentation.ts +14 -0
  91. package/src/archiver/kv_archiver_store/block_store.ts +435 -95
  92. package/src/archiver/kv_archiver_store/contract_class_store.ts +1 -1
  93. package/src/archiver/kv_archiver_store/contract_instance_store.ts +1 -1
  94. package/src/archiver/kv_archiver_store/kv_archiver_store.ts +81 -66
  95. package/src/archiver/kv_archiver_store/log_store.ts +208 -99
  96. package/src/archiver/kv_archiver_store/message_store.ts +21 -18
  97. package/src/archiver/l1/README.md +98 -0
  98. package/src/archiver/l1/bin/retrieve-calldata.ts +182 -0
  99. package/src/archiver/l1/calldata_retriever.ts +641 -0
  100. package/src/archiver/{data_retrieval.ts → l1/data_retrieval.ts} +96 -161
  101. package/src/archiver/l1/debug_tx.ts +99 -0
  102. package/src/archiver/l1/spire_proposer.ts +160 -0
  103. package/src/archiver/l1/trace_tx.ts +128 -0
  104. package/src/archiver/l1/types.ts +13 -0
  105. package/src/archiver/l1/validate_trace.ts +211 -0
  106. package/src/archiver/structs/inbox_message.ts +7 -8
  107. package/src/archiver/structs/published.ts +0 -1
  108. package/src/factory.ts +1 -1
  109. package/src/index.ts +1 -1
  110. package/src/test/fixtures/debug_traceTransaction-multicall3.json +88 -0
  111. package/src/test/fixtures/debug_traceTransaction-multiplePropose.json +153 -0
  112. package/src/test/fixtures/debug_traceTransaction-proxied.json +122 -0
  113. package/src/test/fixtures/trace_transaction-multicall3.json +65 -0
  114. package/src/test/fixtures/trace_transaction-multiplePropose.json +319 -0
  115. package/src/test/fixtures/trace_transaction-proxied.json +128 -0
  116. package/src/test/fixtures/trace_transaction-randomRevert.json +216 -0
  117. package/src/test/mock_archiver.ts +6 -11
  118. package/src/test/mock_l1_to_l2_message_source.ts +6 -11
  119. package/src/test/mock_l2_block_source.ts +22 -18
  120. package/src/test/mock_structs.ts +10 -10
  121. package/dest/archiver/data_retrieval.d.ts +0 -80
  122. package/dest/archiver/data_retrieval.d.ts.map +0 -1
@@ -1,11 +1,7 @@
1
- import { type BlobSinkConfig, blobSinkConfigMapping } from '@aztec/blob-sink/client';
2
- import {
3
- type L1ContractsConfig,
4
- type L1ReaderConfig,
5
- l1ContractAddressesMapping,
6
- l1ContractsConfigMappings,
7
- l1ReaderConfigMappings,
8
- } from '@aztec/ethereum';
1
+ import { type BlobClientConfig, blobClientConfigMapping } from '@aztec/blob-client/client/config';
2
+ import { type L1ContractsConfig, l1ContractsConfigMappings } from '@aztec/ethereum/config';
3
+ import { l1ContractAddressesMapping } from '@aztec/ethereum/l1-contract-addresses';
4
+ import { type L1ReaderConfig, l1ReaderConfigMappings } from '@aztec/ethereum/l1-reader';
9
5
  import {
10
6
  type ConfigMappingsType,
11
7
  booleanConfigHelper,
@@ -22,10 +18,14 @@ import type { ArchiverSpecificConfig } from '@aztec/stdlib/interfaces/server';
22
18
  * Results of calls to eth_blockNumber are cached by viem with this cache being updated periodically at the interval specified by viemPollingIntervalMS.
23
19
  * As a result the maximum observed polling time for new blocks will be viemPollingIntervalMS + archiverPollingIntervalMS.
24
20
  */
25
- export type ArchiverConfig = ArchiverSpecificConfig & L1ReaderConfig & L1ContractsConfig & BlobSinkConfig & ChainConfig;
21
+ export type ArchiverConfig = ArchiverSpecificConfig &
22
+ L1ReaderConfig &
23
+ L1ContractsConfig &
24
+ BlobClientConfig &
25
+ ChainConfig;
26
26
 
27
27
  export const archiverConfigMappings: ConfigMappingsType<ArchiverConfig> = {
28
- ...blobSinkConfigMapping,
28
+ ...blobClientConfigMapping,
29
29
  archiverPollingIntervalMS: {
30
30
  env: 'ARCHIVER_POLLING_INTERVAL_MS',
31
31
  description: 'The polling interval in ms for retrieving new L2 blocks and encrypted logs.',
@@ -55,6 +55,11 @@ export const archiverConfigMappings: ConfigMappingsType<ArchiverConfig> = {
55
55
  description: 'Maximum allowed drift in seconds between the Ethereum client and current time.',
56
56
  ...numberConfigHelper(300),
57
57
  },
58
+ ethereumAllowNoDebugHosts: {
59
+ env: 'ETHEREUM_ALLOW_NO_DEBUG_HOSTS',
60
+ description: 'Whether to allow starting the archiver without debug/trace method support on Ethereum hosts',
61
+ ...booleanConfigHelper(true),
62
+ },
58
63
  ...chainConfigMappings,
59
64
  ...l1ReaderConfigMappings,
60
65
  viemPollingIntervalMS: {
@@ -1,3 +1,5 @@
1
+ import type { Fr } from '@aztec/foundation/schemas';
2
+
1
3
  export class NoBlobBodiesFoundError extends Error {
2
4
  constructor(l2BlockNum: number) {
3
5
  super(`No blob bodies found for block ${l2BlockNum}`);
@@ -24,3 +26,65 @@ export class BlockNumberNotSequentialError extends Error {
24
26
  );
25
27
  }
26
28
  }
29
+
30
+ export class InitialCheckpointNumberNotSequentialError extends Error {
31
+ constructor(
32
+ public readonly newCheckpointNumber: number,
33
+ public readonly previousCheckpointNumber: number | undefined,
34
+ ) {
35
+ super(
36
+ `Cannot insert new checkpoint ${newCheckpointNumber} given previous checkpoint number in store is ${
37
+ previousCheckpointNumber ?? 'undefined'
38
+ }`,
39
+ );
40
+ }
41
+ }
42
+
43
+ export class CheckpointNumberNotSequentialError extends Error {
44
+ constructor(newCheckpointNumber: number, previous: number | undefined) {
45
+ super(
46
+ `Cannot insert new checkpoint ${newCheckpointNumber} given previous checkpoint number in batch is ${previous ?? 'undefined'}`,
47
+ );
48
+ }
49
+ }
50
+
51
+ export class CheckpointNumberNotConsistentError extends Error {
52
+ constructor(newCheckpointNumber: number, previous: number | undefined) {
53
+ super(
54
+ `Cannot insert block for new checkpoint ${newCheckpointNumber} given previous block was checkpoint ${previous ?? 'undefined'}`,
55
+ );
56
+ }
57
+ }
58
+
59
+ export class BlockIndexNotSequentialError extends Error {
60
+ constructor(newBlockIndex: number, previousBlockIndex: number | undefined) {
61
+ super(
62
+ `Cannot insert new block at checkpoint index ${newBlockIndex} given previous block index is ${previousBlockIndex ?? 'undefined'}`,
63
+ );
64
+ }
65
+ }
66
+
67
+ export class BlockArchiveNotConsistentError extends Error {
68
+ constructor(
69
+ newBlockNumber: number,
70
+ previousBlockNumber: number | undefined,
71
+ newBlockArchive: Fr,
72
+ previousBlockArchive: Fr,
73
+ ) {
74
+ super(
75
+ `Cannot insert new block number ${newBlockNumber} with archive ${newBlockArchive.toString()} previous block number is ${previousBlockNumber ?? 'undefined'}, previous archive is ${previousBlockArchive?.toString() ?? 'undefined'}`,
76
+ );
77
+ }
78
+ }
79
+
80
+ export class CheckpointNotFoundError extends Error {
81
+ constructor(checkpointNumber: number) {
82
+ super(`Failed to find expected checkpoint number ${checkpointNumber}`);
83
+ }
84
+ }
85
+
86
+ export class BlockNotFoundError extends Error {
87
+ constructor(blockNumber: number) {
88
+ super(`Failed to find expected block number ${blockNumber}`);
89
+ }
90
+ }
@@ -1,6 +1,6 @@
1
1
  export * from './archiver.js';
2
2
  export * from './config.js';
3
- export { type PublishedL2Block, type L1PublishedData } from './structs/published.js';
3
+ export { type L1PublishedData } from './structs/published.js';
4
4
  export type { ArchiverDataStore } from './archiver_store.js';
5
5
  export { KVArchiverDataStore, ARCHIVER_DB_VERSION } from './kv_archiver_store/kv_archiver_store.js';
6
6
  export { ContractInstanceStore } from './kv_archiver_store/contract_instance_store.js';
@@ -34,6 +34,8 @@ export class ArchiverInstrumentation {
34
34
  private syncDurationPerMessage: Histogram;
35
35
  private syncMessageCount: UpDownCounter;
36
36
 
37
+ private blockProposalTxTargetCount: UpDownCounter;
38
+
37
39
  private log = createLogger('archiver:instrumentation');
38
40
 
39
41
  private constructor(
@@ -114,6 +116,11 @@ export class ArchiverInstrumentation {
114
116
  valueType: ValueType.INT,
115
117
  });
116
118
 
119
+ this.blockProposalTxTargetCount = meter.createUpDownCounter(Metrics.ARCHIVER_BLOCK_PROPOSAL_TX_TARGET_COUNT, {
120
+ description: 'Number of block proposals by tx target',
121
+ valueType: ValueType.INT,
122
+ });
123
+
117
124
  this.dbMetrics = new LmdbMetrics(
118
125
  meter,
119
126
  {
@@ -184,4 +191,11 @@ export class ArchiverInstrumentation {
184
191
  public updateL1BlockHeight(blockNumber: bigint) {
185
192
  this.l1BlockHeight.record(Number(blockNumber));
186
193
  }
194
+
195
+ public recordBlockProposalTxTarget(target: string, usedTrace: boolean) {
196
+ this.blockProposalTxTargetCount.add(1, {
197
+ [Attributes.L1_BLOCK_PROPOSAL_TX_TARGET]: target.toLowerCase(),
198
+ [Attributes.L1_BLOCK_PROPOSAL_USED_TRACE]: usedTrace,
199
+ });
200
+ }
187
201
  }