@aztec/archiver 0.0.1-commit.04852196a → 0.0.1-commit.04d373f

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 (117) hide show
  1. package/README.md +19 -11
  2. package/dest/archiver.d.ts +36 -19
  3. package/dest/archiver.d.ts.map +1 -1
  4. package/dest/archiver.js +250 -79
  5. package/dest/config.d.ts +6 -3
  6. package/dest/config.d.ts.map +1 -1
  7. package/dest/config.js +23 -15
  8. package/dest/errors.d.ts +55 -9
  9. package/dest/errors.d.ts.map +1 -1
  10. package/dest/errors.js +81 -14
  11. package/dest/factory.d.ts +12 -8
  12. package/dest/factory.d.ts.map +1 -1
  13. package/dest/factory.js +42 -32
  14. package/dest/index.d.ts +11 -3
  15. package/dest/index.d.ts.map +1 -1
  16. package/dest/index.js +10 -2
  17. package/dest/l1/calldata_retriever.d.ts +2 -1
  18. package/dest/l1/calldata_retriever.d.ts.map +1 -1
  19. package/dest/l1/calldata_retriever.js +15 -5
  20. package/dest/l1/data_retrieval.d.ts +19 -10
  21. package/dest/l1/data_retrieval.d.ts.map +1 -1
  22. package/dest/l1/data_retrieval.js +25 -32
  23. package/dest/l1/trace_tx.d.ts +12 -66
  24. package/dest/l1/trace_tx.d.ts.map +1 -1
  25. package/dest/l1/validate_historical_logs.d.ts +23 -0
  26. package/dest/l1/validate_historical_logs.d.ts.map +1 -0
  27. package/dest/l1/validate_historical_logs.js +108 -0
  28. package/dest/modules/contract_data_source_adapter.d.ts +25 -0
  29. package/dest/modules/contract_data_source_adapter.d.ts.map +1 -0
  30. package/dest/modules/contract_data_source_adapter.js +40 -0
  31. package/dest/modules/data_source_base.d.ts +70 -46
  32. package/dest/modules/data_source_base.d.ts.map +1 -1
  33. package/dest/modules/data_source_base.js +270 -135
  34. package/dest/modules/data_store_updater.d.ts +39 -17
  35. package/dest/modules/data_store_updater.d.ts.map +1 -1
  36. package/dest/modules/data_store_updater.js +183 -122
  37. package/dest/modules/instrumentation.d.ts +7 -2
  38. package/dest/modules/instrumentation.d.ts.map +1 -1
  39. package/dest/modules/instrumentation.js +25 -7
  40. package/dest/modules/l1_synchronizer.d.ts +12 -7
  41. package/dest/modules/l1_synchronizer.d.ts.map +1 -1
  42. package/dest/modules/l1_synchronizer.js +430 -205
  43. package/dest/modules/validation.d.ts +4 -3
  44. package/dest/modules/validation.d.ts.map +1 -1
  45. package/dest/modules/validation.js +6 -6
  46. package/dest/store/block_store.d.ts +174 -70
  47. package/dest/store/block_store.d.ts.map +1 -1
  48. package/dest/store/block_store.js +696 -250
  49. package/dest/store/contract_class_store.d.ts +17 -4
  50. package/dest/store/contract_class_store.d.ts.map +1 -1
  51. package/dest/store/contract_class_store.js +24 -68
  52. package/dest/store/contract_instance_store.d.ts +28 -1
  53. package/dest/store/contract_instance_store.d.ts.map +1 -1
  54. package/dest/store/contract_instance_store.js +37 -2
  55. package/dest/store/data_stores.d.ts +68 -0
  56. package/dest/store/data_stores.d.ts.map +1 -0
  57. package/dest/store/data_stores.js +54 -0
  58. package/dest/store/function_names_cache.d.ts +17 -0
  59. package/dest/store/function_names_cache.d.ts.map +1 -0
  60. package/dest/store/function_names_cache.js +30 -0
  61. package/dest/store/l2_tips_cache.d.ts +13 -7
  62. package/dest/store/l2_tips_cache.d.ts.map +1 -1
  63. package/dest/store/l2_tips_cache.js +13 -76
  64. package/dest/store/log_store.d.ts +42 -37
  65. package/dest/store/log_store.d.ts.map +1 -1
  66. package/dest/store/log_store.js +262 -408
  67. package/dest/store/log_store_codec.d.ts +70 -0
  68. package/dest/store/log_store_codec.d.ts.map +1 -0
  69. package/dest/store/log_store_codec.js +101 -0
  70. package/dest/store/message_store.d.ts +11 -1
  71. package/dest/store/message_store.d.ts.map +1 -1
  72. package/dest/store/message_store.js +50 -8
  73. package/dest/test/fake_l1_state.d.ts +20 -1
  74. package/dest/test/fake_l1_state.d.ts.map +1 -1
  75. package/dest/test/fake_l1_state.js +114 -18
  76. package/dest/test/mock_l1_to_l2_message_source.d.ts +1 -1
  77. package/dest/test/mock_l1_to_l2_message_source.d.ts.map +1 -1
  78. package/dest/test/mock_l1_to_l2_message_source.js +2 -1
  79. package/dest/test/mock_l2_block_source.d.ts +51 -46
  80. package/dest/test/mock_l2_block_source.d.ts.map +1 -1
  81. package/dest/test/mock_l2_block_source.js +243 -170
  82. package/dest/test/noop_l1_archiver.d.ts +12 -6
  83. package/dest/test/noop_l1_archiver.d.ts.map +1 -1
  84. package/dest/test/noop_l1_archiver.js +26 -9
  85. package/package.json +14 -14
  86. package/src/archiver.ts +301 -86
  87. package/src/config.ts +32 -12
  88. package/src/errors.ts +122 -21
  89. package/src/factory.ts +50 -28
  90. package/src/index.ts +18 -2
  91. package/src/l1/calldata_retriever.ts +16 -5
  92. package/src/l1/data_retrieval.ts +36 -45
  93. package/src/l1/validate_historical_logs.ts +140 -0
  94. package/src/modules/contract_data_source_adapter.ts +55 -0
  95. package/src/modules/data_source_base.ts +336 -171
  96. package/src/modules/data_store_updater.ts +219 -154
  97. package/src/modules/instrumentation.ts +28 -8
  98. package/src/modules/l1_synchronizer.ts +566 -248
  99. package/src/modules/validation.ts +10 -9
  100. package/src/store/block_store.ts +865 -290
  101. package/src/store/contract_class_store.ts +31 -103
  102. package/src/store/contract_instance_store.ts +51 -5
  103. package/src/store/data_stores.ts +104 -0
  104. package/src/store/function_names_cache.ts +37 -0
  105. package/src/store/l2_tips_cache.ts +16 -70
  106. package/src/store/log_store.ts +301 -559
  107. package/src/store/log_store_codec.ts +132 -0
  108. package/src/store/message_store.ts +59 -9
  109. package/src/structs/inbox_message.ts +1 -1
  110. package/src/test/fake_l1_state.ts +142 -29
  111. package/src/test/mock_l1_to_l2_message_source.ts +1 -0
  112. package/src/test/mock_l2_block_source.ts +303 -205
  113. package/src/test/noop_l1_archiver.ts +39 -9
  114. package/dest/store/kv_archiver_store.d.ts +0 -354
  115. package/dest/store/kv_archiver_store.d.ts.map +0 -1
  116. package/dest/store/kv_archiver_store.js +0 -464
  117. package/src/store/kv_archiver_store.ts +0 -671
@@ -1,10 +1,13 @@
1
+ import { SlotNumber } from '@aztec/foundation/branded-types';
1
2
  import { Buffer32 } from '@aztec/foundation/buffer';
2
3
  import { EthAddress } from '@aztec/foundation/eth-address';
4
+ import { DateProvider } from '@aztec/foundation/timer';
3
5
  import { getTelemetryClient } from '@aztec/telemetry-client';
4
6
  import { mock } from 'jest-mock-extended';
5
7
  import { EventEmitter } from 'node:events';
6
8
  import { Archiver } from '../archiver.js';
7
9
  import { ArchiverInstrumentation } from '../modules/instrumentation.js';
10
+ import { L2TipsCache } from '../store/l2_tips_cache.js';
8
11
  /** Noop L1 synchronizer for testing without L1 connectivity. */ class NoopL1Synchronizer {
9
12
  tracer;
10
13
  constructor(tracer){
@@ -15,7 +18,7 @@ import { ArchiverInstrumentation } from '../modules/instrumentation.js';
15
18
  return 0n;
16
19
  }
17
20
  getL1Timestamp() {
18
- return 0n;
21
+ return undefined;
19
22
  }
20
23
  testEthereumNodeSynced() {
21
24
  return Promise.resolve();
@@ -29,7 +32,7 @@ import { ArchiverInstrumentation } from '../modules/instrumentation.js';
29
32
  * Uses mock L1 clients and a noop synchronizer, enabling tests that
30
33
  * don't require real Ethereum connectivity.
31
34
  */ export class NoopL1Archiver extends Archiver {
32
- constructor(dataStore, l1Constants, instrumentation){
35
+ constructor(dataStores, l1Constants, instrumentation, initialHeader, initialBlockHash, l2TipsCache){
33
36
  // Create mocks for L1 clients
34
37
  const publicClient = mock();
35
38
  const debugClient = mock();
@@ -40,29 +43,43 @@ import { ArchiverInstrumentation } from '../modules/instrumentation.js';
40
43
  publicClient.getBlockNumber.mockResolvedValue(1n);
41
44
  const events = new EventEmitter();
42
45
  const synchronizer = new NoopL1Synchronizer(instrumentation.tracer);
46
+ const epochCache = mock();
47
+ epochCache.pipeliningOffset.mockReturnValue(0);
43
48
  super(publicClient, debugClient, rollup, {
49
+ rollupAddress: EthAddress.ZERO,
44
50
  registryAddress: EthAddress.ZERO,
51
+ inboxAddress: EthAddress.ZERO,
45
52
  governanceProposerAddress: EthAddress.ZERO,
46
- slashFactoryAddress: EthAddress.ZERO,
47
53
  slashingProposerAddress: EthAddress.ZERO
48
- }, dataStore, {
54
+ }, dataStores, {
49
55
  pollingIntervalMs: 1000,
50
56
  batchSize: 100,
51
57
  skipValidateCheckpointAttestations: true,
52
58
  maxAllowedEthClientDriftSeconds: 300,
53
- ethereumAllowNoDebugHosts: true
59
+ ethereumAllowNoDebugHosts: true,
60
+ skipHistoricalLogsCheck: true,
61
+ orphanProposedBlockPruneGraceSeconds: 2
54
62
  }, blobClient, instrumentation, {
55
63
  ...l1Constants,
56
64
  l1StartBlockHash: Buffer32.random()
57
- }, synchronizer, events);
65
+ }, synchronizer, events, initialHeader, initialBlockHash, l2TipsCache, epochCache, new DateProvider());
58
66
  }
59
67
  /** Override start to skip L1 validation checks. */ start(_blockUntilSynced) {
60
68
  // Just start the running promise without L1 checks
61
69
  this.runningPromise.start();
62
70
  return Promise.resolve();
63
71
  }
72
+ /** Always reports as fully synced since there is no real L1 to sync from. */ getSyncedL2SlotNumber() {
73
+ return Promise.resolve(SlotNumber(Number.MAX_SAFE_INTEGER));
74
+ }
64
75
  }
65
- /** Creates an archiver with mocked L1 connectivity for testing. */ export async function createNoopL1Archiver(dataStore, l1Constants, telemetry = getTelemetryClient()) {
66
- const instrumentation = await ArchiverInstrumentation.new(telemetry, ()=>dataStore.estimateSize());
67
- return new NoopL1Archiver(dataStore, l1Constants, instrumentation);
76
+ /** Creates an archiver with mocked L1 connectivity for testing. */ export async function createNoopL1Archiver(dataStores, l1Constants, telemetry = getTelemetryClient(), initialHeader) {
77
+ const instrumentation = await ArchiverInstrumentation.new(telemetry, ()=>dataStores.db.estimateSize());
78
+ // Mirror the production factory: precompute the dynamic genesis block hash from the injected
79
+ // initial header so `L2TipsCache` reports the correct tip hash at block 0. Without this, the
80
+ // cache falls back to the static `GENESIS_BLOCK_HEADER_HASH`, which only matches deployments
81
+ // with default empty genesis.
82
+ const initialBlockHash = await initialHeader.hash();
83
+ const l2TipsCache = new L2TipsCache(dataStores.blocks, initialBlockHash);
84
+ return new NoopL1Archiver(dataStores, l1Constants, instrumentation, initialHeader, initialBlockHash, l2TipsCache);
68
85
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aztec/archiver",
3
- "version": "0.0.1-commit.04852196a",
3
+ "version": "0.0.1-commit.04d373f",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": "./dest/index.js",
@@ -65,23 +65,23 @@
65
65
  ]
66
66
  },
67
67
  "dependencies": {
68
- "@aztec/blob-client": "0.0.1-commit.04852196a",
69
- "@aztec/blob-lib": "0.0.1-commit.04852196a",
70
- "@aztec/constants": "0.0.1-commit.04852196a",
71
- "@aztec/epoch-cache": "0.0.1-commit.04852196a",
72
- "@aztec/ethereum": "0.0.1-commit.04852196a",
73
- "@aztec/foundation": "0.0.1-commit.04852196a",
74
- "@aztec/kv-store": "0.0.1-commit.04852196a",
75
- "@aztec/l1-artifacts": "0.0.1-commit.04852196a",
76
- "@aztec/noir-protocol-circuits-types": "0.0.1-commit.04852196a",
77
- "@aztec/protocol-contracts": "0.0.1-commit.04852196a",
78
- "@aztec/stdlib": "0.0.1-commit.04852196a",
79
- "@aztec/telemetry-client": "0.0.1-commit.04852196a",
68
+ "@aztec/blob-client": "0.0.1-commit.04d373f",
69
+ "@aztec/blob-lib": "0.0.1-commit.04d373f",
70
+ "@aztec/constants": "0.0.1-commit.04d373f",
71
+ "@aztec/epoch-cache": "0.0.1-commit.04d373f",
72
+ "@aztec/ethereum": "0.0.1-commit.04d373f",
73
+ "@aztec/foundation": "0.0.1-commit.04d373f",
74
+ "@aztec/kv-store": "0.0.1-commit.04d373f",
75
+ "@aztec/l1-artifacts": "0.0.1-commit.04d373f",
76
+ "@aztec/noir-protocol-circuits-types": "0.0.1-commit.04d373f",
77
+ "@aztec/protocol-contracts": "0.0.1-commit.04d373f",
78
+ "@aztec/stdlib": "0.0.1-commit.04d373f",
79
+ "@aztec/telemetry-client": "0.0.1-commit.04d373f",
80
80
  "lodash.groupby": "^4.6.0",
81
81
  "lodash.omit": "^4.5.0",
82
82
  "tslib": "^2.5.0",
83
83
  "viem": "npm:@aztec/viem@2.38.2",
84
- "zod": "^3.23.8"
84
+ "zod": "^4"
85
85
  },
86
86
  "devDependencies": {
87
87
  "@jest/globals": "^30.0.0",