@aztec/archiver 0.0.0-test.1 → 0.0.1-commit.1142ef1

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 (151) hide show
  1. package/README.md +27 -6
  2. package/dest/archiver/archiver.d.ts +204 -94
  3. package/dest/archiver/archiver.d.ts.map +1 -1
  4. package/dest/archiver/archiver.js +1616 -414
  5. package/dest/archiver/archiver_store.d.ts +178 -83
  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 +2373 -397
  10. package/dest/archiver/config.d.ts +7 -22
  11. package/dest/archiver/config.d.ts.map +1 -1
  12. package/dest/archiver/config.js +30 -14
  13. package/dest/archiver/errors.d.ts +33 -1
  14. package/dest/archiver/errors.d.ts.map +1 -1
  15. package/dest/archiver/errors.js +49 -0
  16. package/dest/archiver/index.d.ts +3 -4
  17. package/dest/archiver/index.d.ts.map +1 -1
  18. package/dest/archiver/index.js +1 -2
  19. package/dest/archiver/instrumentation.d.ts +14 -6
  20. package/dest/archiver/instrumentation.d.ts.map +1 -1
  21. package/dest/archiver/instrumentation.js +45 -41
  22. package/dest/archiver/kv_archiver_store/block_store.d.ts +98 -21
  23. package/dest/archiver/kv_archiver_store/block_store.d.ts.map +1 -1
  24. package/dest/archiver/kv_archiver_store/block_store.js +495 -86
  25. package/dest/archiver/kv_archiver_store/contract_class_store.d.ts +4 -4
  26. package/dest/archiver/kv_archiver_store/contract_class_store.d.ts.map +1 -1
  27. package/dest/archiver/kv_archiver_store/contract_class_store.js +13 -19
  28. package/dest/archiver/kv_archiver_store/contract_instance_store.d.ts +12 -9
  29. package/dest/archiver/kv_archiver_store/contract_instance_store.d.ts.map +1 -1
  30. package/dest/archiver/kv_archiver_store/contract_instance_store.js +30 -16
  31. package/dest/archiver/kv_archiver_store/kv_archiver_store.d.ts +81 -75
  32. package/dest/archiver/kv_archiver_store/kv_archiver_store.d.ts.map +1 -1
  33. package/dest/archiver/kv_archiver_store/kv_archiver_store.js +145 -83
  34. package/dest/archiver/kv_archiver_store/log_store.d.ts +12 -16
  35. package/dest/archiver/kv_archiver_store/log_store.d.ts.map +1 -1
  36. package/dest/archiver/kv_archiver_store/log_store.js +151 -114
  37. package/dest/archiver/kv_archiver_store/message_store.d.ts +25 -18
  38. package/dest/archiver/kv_archiver_store/message_store.d.ts.map +1 -1
  39. package/dest/archiver/kv_archiver_store/message_store.js +152 -49
  40. package/dest/archiver/l1/bin/retrieve-calldata.d.ts +3 -0
  41. package/dest/archiver/l1/bin/retrieve-calldata.d.ts.map +1 -0
  42. package/dest/archiver/l1/bin/retrieve-calldata.js +149 -0
  43. package/dest/archiver/l1/calldata_retriever.d.ts +112 -0
  44. package/dest/archiver/l1/calldata_retriever.d.ts.map +1 -0
  45. package/dest/archiver/l1/calldata_retriever.js +471 -0
  46. package/dest/archiver/l1/data_retrieval.d.ts +90 -0
  47. package/dest/archiver/l1/data_retrieval.d.ts.map +1 -0
  48. package/dest/archiver/l1/data_retrieval.js +331 -0
  49. package/dest/archiver/l1/debug_tx.d.ts +19 -0
  50. package/dest/archiver/l1/debug_tx.d.ts.map +1 -0
  51. package/dest/archiver/l1/debug_tx.js +73 -0
  52. package/dest/archiver/l1/spire_proposer.d.ts +70 -0
  53. package/dest/archiver/l1/spire_proposer.d.ts.map +1 -0
  54. package/dest/archiver/l1/spire_proposer.js +157 -0
  55. package/dest/archiver/l1/trace_tx.d.ts +97 -0
  56. package/dest/archiver/l1/trace_tx.d.ts.map +1 -0
  57. package/dest/archiver/l1/trace_tx.js +91 -0
  58. package/dest/archiver/l1/types.d.ts +12 -0
  59. package/dest/archiver/l1/types.d.ts.map +1 -0
  60. package/dest/archiver/l1/types.js +3 -0
  61. package/dest/archiver/l1/validate_trace.d.ts +29 -0
  62. package/dest/archiver/l1/validate_trace.d.ts.map +1 -0
  63. package/dest/archiver/l1/validate_trace.js +150 -0
  64. package/dest/archiver/structs/data_retrieval.d.ts +1 -1
  65. package/dest/archiver/structs/inbox_message.d.ts +15 -0
  66. package/dest/archiver/structs/inbox_message.d.ts.map +1 -0
  67. package/dest/archiver/structs/inbox_message.js +39 -0
  68. package/dest/archiver/structs/published.d.ts +2 -11
  69. package/dest/archiver/structs/published.d.ts.map +1 -1
  70. package/dest/archiver/structs/published.js +1 -1
  71. package/dest/archiver/validation.d.ts +17 -0
  72. package/dest/archiver/validation.d.ts.map +1 -0
  73. package/dest/archiver/validation.js +98 -0
  74. package/dest/factory.d.ts +9 -14
  75. package/dest/factory.d.ts.map +1 -1
  76. package/dest/factory.js +22 -52
  77. package/dest/index.d.ts +2 -2
  78. package/dest/index.d.ts.map +1 -1
  79. package/dest/index.js +1 -1
  80. package/dest/rpc/index.d.ts +2 -3
  81. package/dest/rpc/index.d.ts.map +1 -1
  82. package/dest/rpc/index.js +1 -4
  83. package/dest/test/index.d.ts +1 -1
  84. package/dest/test/mock_archiver.d.ts +16 -8
  85. package/dest/test/mock_archiver.d.ts.map +1 -1
  86. package/dest/test/mock_archiver.js +19 -14
  87. package/dest/test/mock_l1_to_l2_message_source.d.ts +9 -6
  88. package/dest/test/mock_l1_to_l2_message_source.d.ts.map +1 -1
  89. package/dest/test/mock_l1_to_l2_message_source.js +30 -7
  90. package/dest/test/mock_l2_block_source.d.ts +56 -13
  91. package/dest/test/mock_l2_block_source.d.ts.map +1 -1
  92. package/dest/test/mock_l2_block_source.js +196 -25
  93. package/dest/test/mock_structs.d.ts +10 -0
  94. package/dest/test/mock_structs.d.ts.map +1 -0
  95. package/dest/test/mock_structs.js +38 -0
  96. package/package.json +29 -30
  97. package/src/archiver/archiver.ts +1596 -512
  98. package/src/archiver/archiver_store.ts +205 -88
  99. package/src/archiver/archiver_store_test_suite.ts +2386 -354
  100. package/src/archiver/config.ts +38 -46
  101. package/src/archiver/errors.ts +85 -0
  102. package/src/archiver/index.ts +2 -3
  103. package/src/archiver/instrumentation.ts +65 -45
  104. package/src/archiver/kv_archiver_store/block_store.ts +668 -101
  105. package/src/archiver/kv_archiver_store/contract_class_store.ts +14 -24
  106. package/src/archiver/kv_archiver_store/contract_instance_store.ts +36 -28
  107. package/src/archiver/kv_archiver_store/kv_archiver_store.ts +197 -113
  108. package/src/archiver/kv_archiver_store/log_store.ts +204 -132
  109. package/src/archiver/kv_archiver_store/message_store.ts +213 -54
  110. package/src/archiver/l1/README.md +98 -0
  111. package/src/archiver/l1/bin/retrieve-calldata.ts +182 -0
  112. package/src/archiver/l1/calldata_retriever.ts +641 -0
  113. package/src/archiver/l1/data_retrieval.ts +512 -0
  114. package/src/archiver/l1/debug_tx.ts +99 -0
  115. package/src/archiver/l1/spire_proposer.ts +160 -0
  116. package/src/archiver/l1/trace_tx.ts +128 -0
  117. package/src/archiver/l1/types.ts +13 -0
  118. package/src/archiver/l1/validate_trace.ts +211 -0
  119. package/src/archiver/structs/inbox_message.ts +41 -0
  120. package/src/archiver/structs/published.ts +1 -11
  121. package/src/archiver/validation.ts +124 -0
  122. package/src/factory.ts +28 -69
  123. package/src/index.ts +1 -1
  124. package/src/rpc/index.ts +1 -5
  125. package/src/test/fixtures/debug_traceTransaction-multicall3.json +88 -0
  126. package/src/test/fixtures/debug_traceTransaction-multiplePropose.json +153 -0
  127. package/src/test/fixtures/debug_traceTransaction-proxied.json +122 -0
  128. package/src/test/fixtures/trace_transaction-multicall3.json +65 -0
  129. package/src/test/fixtures/trace_transaction-multiplePropose.json +319 -0
  130. package/src/test/fixtures/trace_transaction-proxied.json +128 -0
  131. package/src/test/fixtures/trace_transaction-randomRevert.json +216 -0
  132. package/src/test/mock_archiver.ts +22 -16
  133. package/src/test/mock_l1_to_l2_message_source.ts +26 -8
  134. package/src/test/mock_l2_block_source.ts +254 -31
  135. package/src/test/mock_structs.ts +50 -0
  136. package/dest/archiver/data_retrieval.d.ts +0 -74
  137. package/dest/archiver/data_retrieval.d.ts.map +0 -1
  138. package/dest/archiver/data_retrieval.js +0 -283
  139. package/dest/archiver/kv_archiver_store/nullifier_store.d.ts +0 -12
  140. package/dest/archiver/kv_archiver_store/nullifier_store.d.ts.map +0 -1
  141. package/dest/archiver/kv_archiver_store/nullifier_store.js +0 -73
  142. package/dest/archiver/memory_archiver_store/l1_to_l2_message_store.d.ts +0 -23
  143. package/dest/archiver/memory_archiver_store/l1_to_l2_message_store.d.ts.map +0 -1
  144. package/dest/archiver/memory_archiver_store/l1_to_l2_message_store.js +0 -49
  145. package/dest/archiver/memory_archiver_store/memory_archiver_store.d.ts +0 -175
  146. package/dest/archiver/memory_archiver_store/memory_archiver_store.d.ts.map +0 -1
  147. package/dest/archiver/memory_archiver_store/memory_archiver_store.js +0 -636
  148. package/src/archiver/data_retrieval.ts +0 -422
  149. package/src/archiver/kv_archiver_store/nullifier_store.ts +0 -97
  150. package/src/archiver/memory_archiver_store/l1_to_l2_message_store.ts +0 -61
  151. package/src/archiver/memory_archiver_store/memory_archiver_store.ts +0 -801
@@ -1,4 +1,4 @@
1
- import { Fr } from '@aztec/foundation/fields';
1
+ import { Fr } from '@aztec/foundation/curves/bn254';
2
2
  import { toArray } from '@aztec/foundation/iterable';
3
3
  import { BufferReader, numToUInt8, serializeToBuffer } from '@aztec/foundation/serialize';
4
4
  import type { AztecAsyncKVStore, AztecAsyncMap } from '@aztec/kv-store';
@@ -7,7 +7,7 @@ import type {
7
7
  ContractClassPublic,
8
8
  ContractClassPublicWithBlockNumber,
9
9
  ExecutablePrivateFunctionWithMembershipProof,
10
- UnconstrainedFunctionWithMembershipProof,
10
+ UtilityFunctionWithMembershipProof,
11
11
  } from '@aztec/stdlib/contract';
12
12
  import { Vector } from '@aztec/stdlib/types';
13
13
 
@@ -60,7 +60,7 @@ export class ContractClassStore {
60
60
  async addFunctions(
61
61
  contractClassId: Fr,
62
62
  newPrivateFunctions: ExecutablePrivateFunctionWithMembershipProof[],
63
- newUnconstrainedFunctions: UnconstrainedFunctionWithMembershipProof[],
63
+ newUtilityFunctions: UtilityFunctionWithMembershipProof[],
64
64
  ): Promise<boolean> {
65
65
  await this.db.transactionAsync(async () => {
66
66
  const existingClassBuffer = await this.#contractClasses.getAsync(contractClassId.toString());
@@ -69,7 +69,7 @@ export class ContractClassStore {
69
69
  }
70
70
 
71
71
  const existingClass = deserializeContractClassPublic(existingClassBuffer);
72
- const { privateFunctions: existingPrivateFns, unconstrainedFunctions: existingUnconstrainedFns } = existingClass;
72
+ const { privateFunctions: existingPrivateFns, utilityFunctions: existingUtilityFns } = existingClass;
73
73
 
74
74
  const updatedClass: Omit<ContractClassPublicWithBlockNumber, 'id'> = {
75
75
  ...existingClass,
@@ -77,11 +77,9 @@ export class ContractClassStore {
77
77
  ...existingPrivateFns,
78
78
  ...newPrivateFunctions.filter(newFn => !existingPrivateFns.some(f => f.selector.equals(newFn.selector))),
79
79
  ],
80
- unconstrainedFunctions: [
81
- ...existingUnconstrainedFns,
82
- ...newUnconstrainedFunctions.filter(
83
- newFn => !existingUnconstrainedFns.some(f => f.selector.equals(newFn.selector)),
84
- ),
80
+ utilityFunctions: [
81
+ ...existingUtilityFns,
82
+ ...newUtilityFunctions.filter(newFn => !existingUtilityFns.some(f => f.selector.equals(newFn.selector))),
85
83
  ],
86
84
  };
87
85
  await this.#contractClasses.set(contractClassId.toString(), serializeContractClassPublic(updatedClass));
@@ -96,12 +94,10 @@ function serializeContractClassPublic(contractClass: Omit<ContractClassPublicWit
96
94
  contractClass.l2BlockNumber,
97
95
  numToUInt8(contractClass.version),
98
96
  contractClass.artifactHash,
99
- contractClass.publicFunctions.length,
100
- contractClass.publicFunctions?.map(f => serializeToBuffer(f.selector, f.bytecode.length, f.bytecode)) ?? [],
101
97
  contractClass.privateFunctions.length,
102
98
  contractClass.privateFunctions.map(serializePrivateFunction),
103
- contractClass.unconstrainedFunctions.length,
104
- contractClass.unconstrainedFunctions.map(serializeUnconstrainedFunction),
99
+ contractClass.utilityFunctions.length,
100
+ contractClass.utilityFunctions.map(serializeUtilityFunction),
105
101
  contractClass.packedBytecode.length,
106
102
  contractClass.packedBytecode,
107
103
  contractClass.privateFunctionsRoot,
@@ -116,7 +112,7 @@ function serializePrivateFunction(fn: ExecutablePrivateFunctionWithMembershipPro
116
112
  fn.bytecode,
117
113
  fn.functionMetadataHash,
118
114
  fn.artifactMetadataHash,
119
- fn.unconstrainedFunctionsArtifactTreeRoot,
115
+ fn.utilityFunctionsTreeRoot,
120
116
  new Vector(fn.privateFunctionTreeSiblingPath),
121
117
  fn.privateFunctionTreeLeafIndex,
122
118
  new Vector(fn.artifactTreeSiblingPath),
@@ -124,7 +120,7 @@ function serializePrivateFunction(fn: ExecutablePrivateFunctionWithMembershipPro
124
120
  );
125
121
  }
126
122
 
127
- function serializeUnconstrainedFunction(fn: UnconstrainedFunctionWithMembershipProof): Buffer {
123
+ function serializeUtilityFunction(fn: UtilityFunctionWithMembershipProof): Buffer {
128
124
  return serializeToBuffer(
129
125
  fn.selector,
130
126
  fn.bytecode.length,
@@ -143,14 +139,8 @@ function deserializeContractClassPublic(buffer: Buffer): Omit<ContractClassPubli
143
139
  l2BlockNumber: reader.readNumber(),
144
140
  version: reader.readUInt8() as 1,
145
141
  artifactHash: reader.readObject(Fr),
146
- publicFunctions: reader.readVector({
147
- fromBuffer: reader => ({
148
- selector: reader.readObject(FunctionSelector),
149
- bytecode: reader.readBuffer(),
150
- }),
151
- }),
152
142
  privateFunctions: reader.readVector({ fromBuffer: deserializePrivateFunction }),
153
- unconstrainedFunctions: reader.readVector({ fromBuffer: deserializeUnconstrainedFunction }),
143
+ utilityFunctions: reader.readVector({ fromBuffer: deserializeUtilityFunction }),
154
144
  packedBytecode: reader.readBuffer(),
155
145
  privateFunctionsRoot: reader.readObject(Fr),
156
146
  };
@@ -164,7 +154,7 @@ function deserializePrivateFunction(buffer: Buffer | BufferReader): ExecutablePr
164
154
  bytecode: reader.readBuffer(),
165
155
  functionMetadataHash: reader.readObject(Fr),
166
156
  artifactMetadataHash: reader.readObject(Fr),
167
- unconstrainedFunctionsArtifactTreeRoot: reader.readObject(Fr),
157
+ utilityFunctionsTreeRoot: reader.readObject(Fr),
168
158
  privateFunctionTreeSiblingPath: reader.readVector(Fr),
169
159
  privateFunctionTreeLeafIndex: reader.readNumber(),
170
160
  artifactTreeSiblingPath: reader.readVector(Fr),
@@ -172,7 +162,7 @@ function deserializePrivateFunction(buffer: Buffer | BufferReader): ExecutablePr
172
162
  };
173
163
  }
174
164
 
175
- function deserializeUnconstrainedFunction(buffer: Buffer | BufferReader): UnconstrainedFunctionWithMembershipProof {
165
+ function deserializeUtilityFunction(buffer: Buffer | BufferReader): UtilityFunctionWithMembershipProof {
176
166
  const reader = BufferReader.asReader(buffer);
177
167
  return {
178
168
  selector: reader.readObject(FunctionSelector),
@@ -1,4 +1,4 @@
1
- import type { Fr } from '@aztec/foundation/fields';
1
+ import type { Fr } from '@aztec/foundation/curves/bn254';
2
2
  import type { AztecAsyncKVStore, AztecAsyncMap } from '@aztec/kv-store';
3
3
  import type { AztecAddress } from '@aztec/stdlib/aztec-address';
4
4
  import {
@@ -7,71 +7,75 @@ import {
7
7
  SerializableContractInstance,
8
8
  SerializableContractInstanceUpdate,
9
9
  } from '@aztec/stdlib/contract';
10
+ import type { UInt64 } from '@aztec/stdlib/types';
10
11
 
11
- type ContractInstanceUpdateKey = [string, number] | [string, number, number];
12
+ type ContractInstanceUpdateKey = [string, string] | [string, string, number];
12
13
 
13
14
  /**
14
15
  * LMDB implementation of the ArchiverDataStore interface.
15
16
  */
16
17
  export class ContractInstanceStore {
17
18
  #contractInstances: AztecAsyncMap<string, Buffer>;
19
+ #contractInstancePublishedAt: AztecAsyncMap<string, number>;
18
20
  #contractInstanceUpdates: AztecAsyncMap<ContractInstanceUpdateKey, Buffer>;
19
21
 
20
- constructor(db: AztecAsyncKVStore) {
22
+ constructor(private db: AztecAsyncKVStore) {
21
23
  this.#contractInstances = db.openMap('archiver_contract_instances');
24
+ this.#contractInstancePublishedAt = db.openMap('archiver_contract_instances_publication_block_number');
22
25
  this.#contractInstanceUpdates = db.openMap('archiver_contract_instance_updates');
23
26
  }
24
27
 
25
- addContractInstance(contractInstance: ContractInstanceWithAddress): Promise<void> {
26
- return this.#contractInstances.set(
27
- contractInstance.address.toString(),
28
- new SerializableContractInstance(contractInstance).toBuffer(),
29
- );
28
+ addContractInstance(contractInstance: ContractInstanceWithAddress, blockNumber: number): Promise<void> {
29
+ return this.db.transactionAsync(async () => {
30
+ await this.#contractInstances.set(
31
+ contractInstance.address.toString(),
32
+ new SerializableContractInstance(contractInstance).toBuffer(),
33
+ );
34
+ await this.#contractInstancePublishedAt.set(contractInstance.address.toString(), blockNumber);
35
+ });
30
36
  }
31
37
 
32
38
  deleteContractInstance(contractInstance: ContractInstanceWithAddress): Promise<void> {
33
- return this.#contractInstances.delete(contractInstance.address.toString());
39
+ return this.db.transactionAsync(async () => {
40
+ await this.#contractInstances.delete(contractInstance.address.toString());
41
+ await this.#contractInstancePublishedAt.delete(contractInstance.address.toString());
42
+ });
34
43
  }
35
44
 
36
- getUpdateKey(contractAddress: AztecAddress, blockNumber: number, logIndex?: number): ContractInstanceUpdateKey {
45
+ getUpdateKey(contractAddress: AztecAddress, timestamp: UInt64, logIndex?: number): ContractInstanceUpdateKey {
37
46
  if (logIndex === undefined) {
38
- return [contractAddress.toString(), blockNumber];
47
+ return [contractAddress.toString(), timestamp.toString()];
39
48
  } else {
40
- return [contractAddress.toString(), blockNumber, logIndex];
49
+ return [contractAddress.toString(), timestamp.toString(), logIndex];
41
50
  }
42
51
  }
43
52
 
44
53
  addContractInstanceUpdate(
45
54
  contractInstanceUpdate: ContractInstanceUpdateWithAddress,
46
- blockNumber: number,
55
+ timestamp: UInt64,
47
56
  logIndex: number,
48
57
  ): Promise<void> {
49
58
  return this.#contractInstanceUpdates.set(
50
- this.getUpdateKey(contractInstanceUpdate.address, blockNumber, logIndex),
59
+ this.getUpdateKey(contractInstanceUpdate.address, timestamp, logIndex),
51
60
  new SerializableContractInstanceUpdate(contractInstanceUpdate).toBuffer(),
52
61
  );
53
62
  }
54
63
 
55
64
  deleteContractInstanceUpdate(
56
65
  contractInstanceUpdate: ContractInstanceUpdateWithAddress,
57
- blockNumber: number,
66
+ timestamp: UInt64,
58
67
  logIndex: number,
59
68
  ): Promise<void> {
60
- return this.#contractInstanceUpdates.delete(
61
- this.getUpdateKey(contractInstanceUpdate.address, blockNumber, logIndex),
62
- );
69
+ return this.#contractInstanceUpdates.delete(this.getUpdateKey(contractInstanceUpdate.address, timestamp, logIndex));
63
70
  }
64
71
 
65
- async getCurrentContractInstanceClassId(
66
- address: AztecAddress,
67
- blockNumber: number,
68
- originalClassId: Fr,
69
- ): Promise<Fr> {
70
- // We need to find the last update before the given block number
72
+ async getCurrentContractInstanceClassId(address: AztecAddress, timestamp: UInt64, originalClassId: Fr): Promise<Fr> {
73
+ // We need to find the last update before the given timestamp
71
74
  const queryResult = await this.#contractInstanceUpdates
72
75
  .valuesAsync({
73
76
  reverse: true,
74
- end: this.getUpdateKey(address, blockNumber + 1), // No update can match this key since it doesn't have a log index. We want the highest key <= blockNumber
77
+ start: this.getUpdateKey(address, 0n), // Make sure we only look at updates for this contract
78
+ end: this.getUpdateKey(address, timestamp + 1n), // No update can match this key since it doesn't have a log index. We want the highest key <= timestamp
75
79
  limit: 1,
76
80
  })
77
81
  .next();
@@ -81,7 +85,7 @@ export class ContractInstanceStore {
81
85
 
82
86
  const serializedUpdate = queryResult.value;
83
87
  const update = SerializableContractInstanceUpdate.fromBuffer(serializedUpdate);
84
- if (blockNumber < update.blockOfChange) {
88
+ if (timestamp < update.timestampOfChange) {
85
89
  return update.prevContractClassId.isZero() ? originalClassId : update.prevContractClassId;
86
90
  }
87
91
  return update.newContractClassId;
@@ -89,7 +93,7 @@ export class ContractInstanceStore {
89
93
 
90
94
  async getContractInstance(
91
95
  address: AztecAddress,
92
- blockNumber: number,
96
+ timestamp: UInt64,
93
97
  ): Promise<ContractInstanceWithAddress | undefined> {
94
98
  const contractInstance = await this.#contractInstances.getAsync(address.toString());
95
99
  if (!contractInstance) {
@@ -99,9 +103,13 @@ export class ContractInstanceStore {
99
103
  const instance = SerializableContractInstance.fromBuffer(contractInstance).withAddress(address);
100
104
  instance.currentContractClassId = await this.getCurrentContractInstanceClassId(
101
105
  address,
102
- blockNumber,
106
+ timestamp,
103
107
  instance.originalContractClassId,
104
108
  );
105
109
  return instance;
106
110
  }
111
+
112
+ getContractInstanceDeploymentBlockNumber(address: AztecAddress): Promise<number | undefined> {
113
+ return this.#contractInstancePublishedAt.getAsync(address.toString());
114
+ }
107
115
  }