@aztec/pxe 0.0.1-commit.d1cd2107c → 0.0.1-commit.d1da697d6

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 (165) hide show
  1. package/dest/block_synchronizer/block_synchronizer.d.ts +1 -1
  2. package/dest/block_synchronizer/block_synchronizer.d.ts.map +1 -1
  3. package/dest/block_synchronizer/block_synchronizer.js +6 -0
  4. package/dest/contract_function_simulator/contract_function_simulator.d.ts +10 -5
  5. package/dest/contract_function_simulator/contract_function_simulator.d.ts.map +1 -1
  6. package/dest/contract_function_simulator/contract_function_simulator.js +29 -6
  7. package/dest/contract_function_simulator/execution_tagging_index_cache.d.ts +5 -5
  8. package/dest/contract_function_simulator/execution_tagging_index_cache.d.ts.map +1 -1
  9. package/dest/contract_function_simulator/execution_tagging_index_cache.js +17 -9
  10. package/dest/contract_function_simulator/index.d.ts +2 -1
  11. package/dest/contract_function_simulator/index.d.ts.map +1 -1
  12. package/dest/contract_function_simulator/index.js +1 -0
  13. package/dest/contract_function_simulator/noir-structs/event_validation_request.d.ts +3 -5
  14. package/dest/contract_function_simulator/noir-structs/event_validation_request.d.ts.map +1 -1
  15. package/dest/contract_function_simulator/noir-structs/event_validation_request.js +7 -9
  16. package/dest/contract_function_simulator/noir-structs/log_retrieval_response.d.ts +1 -1
  17. package/dest/contract_function_simulator/noir-structs/log_retrieval_response.d.ts.map +1 -1
  18. package/dest/contract_function_simulator/noir-structs/log_retrieval_response.js +1 -3
  19. package/dest/contract_function_simulator/noir-structs/note_validation_request.d.ts +3 -6
  20. package/dest/contract_function_simulator/noir-structs/note_validation_request.d.ts.map +1 -1
  21. package/dest/contract_function_simulator/noir-structs/note_validation_request.js +5 -10
  22. package/dest/contract_function_simulator/oracle/interfaces.d.ts +21 -20
  23. package/dest/contract_function_simulator/oracle/interfaces.d.ts.map +1 -1
  24. package/dest/contract_function_simulator/oracle/legacy_oracle_mappings.d.ts +9 -0
  25. package/dest/contract_function_simulator/oracle/legacy_oracle_mappings.d.ts.map +1 -0
  26. package/dest/contract_function_simulator/oracle/legacy_oracle_mappings.js +38 -0
  27. package/dest/contract_function_simulator/oracle/oracle.d.ts +39 -19
  28. package/dest/contract_function_simulator/oracle/oracle.d.ts.map +1 -1
  29. package/dest/contract_function_simulator/oracle/oracle.js +91 -44
  30. package/dest/contract_function_simulator/oracle/private_execution.js +5 -3
  31. package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts +12 -38
  32. package/dest/contract_function_simulator/oracle/private_execution_oracle.d.ts.map +1 -1
  33. package/dest/contract_function_simulator/oracle/private_execution_oracle.js +21 -44
  34. package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts +45 -28
  35. package/dest/contract_function_simulator/oracle/utility_execution_oracle.d.ts.map +1 -1
  36. package/dest/contract_function_simulator/oracle/utility_execution_oracle.js +164 -71
  37. package/dest/contract_function_simulator/pick_notes.d.ts +1 -1
  38. package/dest/contract_function_simulator/pick_notes.d.ts.map +1 -1
  39. package/dest/contract_function_simulator/pick_notes.js +9 -2
  40. package/dest/contract_logging.d.ts +9 -4
  41. package/dest/contract_logging.d.ts.map +1 -1
  42. package/dest/contract_logging.js +21 -6
  43. package/dest/contract_sync/contract_sync_service.d.ts +6 -5
  44. package/dest/contract_sync/contract_sync_service.d.ts.map +1 -1
  45. package/dest/contract_sync/contract_sync_service.js +44 -37
  46. package/dest/contract_sync/helpers.d.ts +2 -3
  47. package/dest/contract_sync/helpers.d.ts.map +1 -1
  48. package/dest/contract_sync/helpers.js +7 -2
  49. package/dest/debug/pxe_debug_utils.d.ts +3 -3
  50. package/dest/debug/pxe_debug_utils.d.ts.map +1 -1
  51. package/dest/entrypoints/client/bundle/index.d.ts +1 -2
  52. package/dest/entrypoints/client/bundle/index.d.ts.map +1 -1
  53. package/dest/entrypoints/client/bundle/index.js +0 -1
  54. package/dest/entrypoints/client/bundle/utils.d.ts +2 -2
  55. package/dest/entrypoints/client/bundle/utils.d.ts.map +1 -1
  56. package/dest/entrypoints/client/bundle/utils.js +2 -2
  57. package/dest/entrypoints/client/lazy/index.d.ts +1 -2
  58. package/dest/entrypoints/client/lazy/index.d.ts.map +1 -1
  59. package/dest/entrypoints/client/lazy/index.js +0 -1
  60. package/dest/entrypoints/client/lazy/utils.d.ts +2 -2
  61. package/dest/entrypoints/client/lazy/utils.d.ts.map +1 -1
  62. package/dest/entrypoints/client/lazy/utils.js +2 -2
  63. package/dest/entrypoints/pxe_creation_options.d.ts +3 -1
  64. package/dest/entrypoints/pxe_creation_options.d.ts.map +1 -1
  65. package/dest/entrypoints/pxe_creation_options.js +3 -1
  66. package/dest/entrypoints/server/index.d.ts +1 -2
  67. package/dest/entrypoints/server/index.d.ts.map +1 -1
  68. package/dest/entrypoints/server/index.js +0 -1
  69. package/dest/entrypoints/server/utils.d.ts +2 -2
  70. package/dest/entrypoints/server/utils.d.ts.map +1 -1
  71. package/dest/entrypoints/server/utils.js +2 -2
  72. package/dest/events/event_service.d.ts +3 -2
  73. package/dest/events/event_service.d.ts.map +1 -1
  74. package/dest/events/event_service.js +16 -4
  75. package/dest/logs/log_service.d.ts +6 -7
  76. package/dest/logs/log_service.d.ts.map +1 -1
  77. package/dest/logs/log_service.js +32 -30
  78. package/dest/messages/message_context_service.d.ts +17 -0
  79. package/dest/messages/message_context_service.d.ts.map +1 -0
  80. package/dest/messages/message_context_service.js +36 -0
  81. package/dest/notes/note_service.d.ts +4 -5
  82. package/dest/notes/note_service.d.ts.map +1 -1
  83. package/dest/notes/note_service.js +14 -5
  84. package/dest/notes_filter.d.ts +2 -3
  85. package/dest/notes_filter.d.ts.map +1 -1
  86. package/dest/oracle_version.d.ts +2 -2
  87. package/dest/oracle_version.js +2 -2
  88. package/dest/pxe.d.ts +9 -7
  89. package/dest/pxe.d.ts.map +1 -1
  90. package/dest/pxe.js +39 -23
  91. package/dest/storage/capsule_store/capsule_service.d.ts +21 -0
  92. package/dest/storage/capsule_store/capsule_service.d.ts.map +1 -0
  93. package/dest/storage/capsule_store/capsule_service.js +50 -0
  94. package/dest/storage/capsule_store/capsule_store.d.ts +9 -9
  95. package/dest/storage/capsule_store/capsule_store.d.ts.map +1 -1
  96. package/dest/storage/capsule_store/capsule_store.js +33 -28
  97. package/dest/storage/capsule_store/index.d.ts +2 -1
  98. package/dest/storage/capsule_store/index.d.ts.map +1 -1
  99. package/dest/storage/capsule_store/index.js +1 -0
  100. package/dest/storage/metadata.d.ts +1 -1
  101. package/dest/storage/metadata.js +1 -1
  102. package/dest/storage/note_store/note_store.d.ts +1 -1
  103. package/dest/storage/note_store/note_store.d.ts.map +1 -1
  104. package/dest/storage/note_store/note_store.js +2 -2
  105. package/dest/storage/tagging_store/sender_tagging_store.d.ts +26 -25
  106. package/dest/storage/tagging_store/sender_tagging_store.d.ts.map +1 -1
  107. package/dest/storage/tagging_store/sender_tagging_store.js +141 -115
  108. package/dest/tagging/index.d.ts +2 -2
  109. package/dest/tagging/index.d.ts.map +1 -1
  110. package/dest/tagging/sender_sync/sync_sender_tagging_indexes.d.ts +1 -1
  111. package/dest/tagging/sender_sync/sync_sender_tagging_indexes.d.ts.map +1 -1
  112. package/dest/tagging/sender_sync/sync_sender_tagging_indexes.js +10 -1
  113. package/dest/tagging/sender_sync/utils/get_status_change_of_pending.d.ts +4 -3
  114. package/dest/tagging/sender_sync/utils/get_status_change_of_pending.d.ts.map +1 -1
  115. package/dest/tagging/sender_sync/utils/get_status_change_of_pending.js +20 -10
  116. package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.d.ts +2 -1
  117. package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.d.ts.map +1 -1
  118. package/dest/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.js +24 -11
  119. package/package.json +16 -16
  120. package/src/block_synchronizer/block_synchronizer.ts +6 -0
  121. package/src/contract_function_simulator/contract_function_simulator.ts +42 -10
  122. package/src/contract_function_simulator/execution_tagging_index_cache.ts +16 -11
  123. package/src/contract_function_simulator/index.ts +1 -0
  124. package/src/contract_function_simulator/noir-structs/event_validation_request.ts +8 -8
  125. package/src/contract_function_simulator/noir-structs/log_retrieval_response.ts +1 -4
  126. package/src/contract_function_simulator/noir-structs/note_validation_request.ts +3 -9
  127. package/src/contract_function_simulator/oracle/interfaces.ts +34 -28
  128. package/src/contract_function_simulator/oracle/legacy_oracle_mappings.ts +98 -0
  129. package/src/contract_function_simulator/oracle/oracle.ts +120 -64
  130. package/src/contract_function_simulator/oracle/private_execution.ts +4 -4
  131. package/src/contract_function_simulator/oracle/private_execution_oracle.ts +26 -65
  132. package/src/contract_function_simulator/oracle/utility_execution_oracle.ts +288 -85
  133. package/src/contract_function_simulator/pick_notes.ts +9 -2
  134. package/src/contract_logging.ts +18 -5
  135. package/src/contract_sync/contract_sync_service.ts +77 -59
  136. package/src/contract_sync/helpers.ts +4 -4
  137. package/src/debug/pxe_debug_utils.ts +3 -3
  138. package/src/entrypoints/client/bundle/index.ts +0 -1
  139. package/src/entrypoints/client/bundle/utils.ts +2 -3
  140. package/src/entrypoints/client/lazy/index.ts +0 -1
  141. package/src/entrypoints/client/lazy/utils.ts +2 -3
  142. package/src/entrypoints/pxe_creation_options.ts +7 -0
  143. package/src/entrypoints/server/index.ts +0 -1
  144. package/src/entrypoints/server/utils.ts +2 -3
  145. package/src/events/event_service.ts +17 -4
  146. package/src/logs/log_service.ts +63 -48
  147. package/src/messages/message_context_service.ts +44 -0
  148. package/src/notes/note_service.ts +18 -8
  149. package/src/notes_filter.ts +1 -3
  150. package/src/oracle_version.ts +2 -2
  151. package/src/pxe.ts +62 -28
  152. package/src/storage/capsule_store/capsule_service.ts +90 -0
  153. package/src/storage/capsule_store/capsule_store.ts +34 -26
  154. package/src/storage/capsule_store/index.ts +1 -0
  155. package/src/storage/metadata.ts +1 -1
  156. package/src/storage/note_store/note_store.ts +2 -5
  157. package/src/storage/tagging_store/sender_tagging_store.ts +182 -135
  158. package/src/tagging/index.ts +1 -1
  159. package/src/tagging/sender_sync/sync_sender_tagging_indexes.ts +19 -1
  160. package/src/tagging/sender_sync/utils/get_status_change_of_pending.ts +26 -11
  161. package/src/tagging/sender_sync/utils/load_and_store_new_tagging_indexes.ts +19 -9
  162. package/dest/access_scopes.d.ts +0 -9
  163. package/dest/access_scopes.d.ts.map +0 -1
  164. package/dest/access_scopes.js +0 -6
  165. package/src/access_scopes.ts +0 -9
@@ -6,6 +6,7 @@ import { Point } from '@aztec/foundation/curves/grumpkin';
6
6
  import { LogLevels, type Logger, createLogger } from '@aztec/foundation/log';
7
7
  import type { MembershipWitness } from '@aztec/foundation/trees';
8
8
  import type { KeyStore } from '@aztec/key-store';
9
+ import { isProtocolContract } from '@aztec/protocol-contracts';
9
10
  import type { AuthWitness } from '@aztec/stdlib/auth-witness';
10
11
  import { AztecAddress } from '@aztec/stdlib/aztec-address';
11
12
  import { BlockHash } from '@aztec/stdlib/block';
@@ -14,20 +15,21 @@ import { siloNullifier } from '@aztec/stdlib/hash';
14
15
  import type { AztecNode } from '@aztec/stdlib/interfaces/server';
15
16
  import type { KeyValidationRequest } from '@aztec/stdlib/kernel';
16
17
  import { type PublicKeys, computeAddressSecret } from '@aztec/stdlib/keys';
17
- import { deriveEcdhSharedSecret } from '@aztec/stdlib/logs';
18
+ import { MessageContext, deriveAppSiloedSharedSecret } from '@aztec/stdlib/logs';
18
19
  import { getNonNullifiedL1ToL2MessageWitness } from '@aztec/stdlib/messaging';
19
20
  import type { NoteStatus } from '@aztec/stdlib/note';
20
21
  import { MerkleTreeId, type NullifierMembershipWitness, PublicDataWitness } from '@aztec/stdlib/trees';
21
- import type { BlockHeader, Capsule } from '@aztec/stdlib/tx';
22
+ import type { BlockHeader, Capsule, OffchainEffect } from '@aztec/stdlib/tx';
22
23
 
23
- import type { AccessScopes } from '../../access_scopes.js';
24
- import { createContractLogger, logContractMessage } from '../../contract_logging.js';
24
+ import { createContractLogger, logContractMessage, stripAztecnrLogPrefix } from '../../contract_logging.js';
25
+ import type { ContractSyncService } from '../../contract_sync/contract_sync_service.js';
25
26
  import { EventService } from '../../events/event_service.js';
26
27
  import { LogService } from '../../logs/log_service.js';
28
+ import { MessageContextService } from '../../messages/message_context_service.js';
27
29
  import { NoteService } from '../../notes/note_service.js';
28
30
  import { ORACLE_VERSION } from '../../oracle_version.js';
29
31
  import type { AddressStore } from '../../storage/address_store/address_store.js';
30
- import type { CapsuleStore } from '../../storage/capsule_store/capsule_store.js';
32
+ import type { CapsuleService } from '../../storage/capsule_store/capsule_service.js';
31
33
  import type { ContractStore } from '../../storage/contract_store/contract_store.js';
32
34
  import type { NoteStore } from '../../storage/note_store/note_store.js';
33
35
  import type { PrivateEventStore } from '../../storage/private_event_store/private_event_store.js';
@@ -56,11 +58,13 @@ export type UtilityExecutionOracleArgs = {
56
58
  aztecNode: AztecNode;
57
59
  recipientTaggingStore: RecipientTaggingStore;
58
60
  senderAddressBookStore: SenderAddressBookStore;
59
- capsuleStore: CapsuleStore;
61
+ capsuleService: CapsuleService;
60
62
  privateEventStore: PrivateEventStore;
63
+ messageContextService: MessageContextService;
64
+ contractSyncService: ContractSyncService;
61
65
  jobId: string;
62
66
  log?: ReturnType<typeof createLogger>;
63
- scopes: AccessScopes;
67
+ scopes: AztecAddress[];
64
68
  };
65
69
 
66
70
  /**
@@ -71,6 +75,8 @@ export class UtilityExecutionOracle implements IMiscOracle, IUtilityExecutionOra
71
75
  isUtility = true as const;
72
76
 
73
77
  private contractLogger: Logger | undefined;
78
+ private aztecnrLogger: Logger | undefined;
79
+ private offchainEffects: OffchainEffect[] = [];
74
80
 
75
81
  protected readonly contractAddress: AztecAddress;
76
82
  protected readonly authWitnesses: AuthWitness[];
@@ -83,11 +89,13 @@ export class UtilityExecutionOracle implements IMiscOracle, IUtilityExecutionOra
83
89
  protected readonly aztecNode: AztecNode;
84
90
  protected readonly recipientTaggingStore: RecipientTaggingStore;
85
91
  protected readonly senderAddressBookStore: SenderAddressBookStore;
86
- protected readonly capsuleStore: CapsuleStore;
92
+ protected readonly capsuleService: CapsuleService;
87
93
  protected readonly privateEventStore: PrivateEventStore;
94
+ protected readonly messageContextService: MessageContextService;
95
+ protected readonly contractSyncService: ContractSyncService;
88
96
  protected readonly jobId: string;
89
97
  protected logger: ReturnType<typeof createLogger>;
90
- protected readonly scopes: AccessScopes;
98
+ protected readonly scopes: AztecAddress[];
91
99
 
92
100
  constructor(args: UtilityExecutionOracleArgs) {
93
101
  this.contractAddress = args.contractAddress;
@@ -101,16 +109,43 @@ export class UtilityExecutionOracle implements IMiscOracle, IUtilityExecutionOra
101
109
  this.aztecNode = args.aztecNode;
102
110
  this.recipientTaggingStore = args.recipientTaggingStore;
103
111
  this.senderAddressBookStore = args.senderAddressBookStore;
104
- this.capsuleStore = args.capsuleStore;
112
+ this.capsuleService = args.capsuleService;
105
113
  this.privateEventStore = args.privateEventStore;
114
+ this.messageContextService = args.messageContextService;
115
+ this.contractSyncService = args.contractSyncService;
106
116
  this.jobId = args.jobId;
107
117
  this.logger = args.log ?? createLogger('simulator:client_view_context');
108
118
  this.scopes = args.scopes;
109
119
  }
110
120
 
111
121
  public assertCompatibleOracleVersion(version: number): void {
122
+ // TODO(F-416): Remove this hack on v5 when protocol contracts are redeployed.
123
+ // Protocol contracts/canonical contracts shipped with committed bytecode that cannot be changed. Assert they use
124
+ // the expected pinned version or the current one. We want to allow for both the pinned and the current versions
125
+ // because we want this code to work with both the pinned and unpinned version since some branches do not have the
126
+ // pinned contracts (like e.g. next)
127
+ const LEGACY_ORACLE_VERSION = 12;
128
+ if (isProtocolContract(this.contractAddress)) {
129
+ if (version !== LEGACY_ORACLE_VERSION && version !== ORACLE_VERSION) {
130
+ const hint =
131
+ version > ORACLE_VERSION
132
+ ? 'The contract was compiled with a newer version of Aztec.nr than your private environment supports. Upgrade your private environment to a compatible version.'
133
+ : 'The contract was compiled with an older version of Aztec.nr than your private environment supports. Recompile the contract with a compatible version of Aztec.nr.';
134
+ throw new Error(
135
+ `Incompatible private environment version: ${hint} See https://docs.aztec.network/errors/8 (expected oracle version ${LEGACY_ORACLE_VERSION} or ${ORACLE_VERSION}, got ${version})`,
136
+ );
137
+ }
138
+ return;
139
+ }
140
+
112
141
  if (version !== ORACLE_VERSION) {
113
- throw new Error(`Incompatible oracle version. Expected version ${ORACLE_VERSION}, got ${version}.`);
142
+ const hint =
143
+ version > ORACLE_VERSION
144
+ ? 'The contract was compiled with a newer version of Aztec.nr than your private environment supports. Upgrade your private environment to a compatible version.'
145
+ : 'The contract was compiled with an older version of Aztec.nr than your private environment supports. Recompile the contract with a compatible version of Aztec.nr.';
146
+ throw new Error(
147
+ `Incompatible private environment version: ${hint} See https://docs.aztec.network/errors/8 (expected oracle version ${ORACLE_VERSION}, got ${version})`,
148
+ );
114
149
  }
115
150
  }
116
151
 
@@ -130,33 +165,32 @@ export class UtilityExecutionOracle implements IMiscOracle, IUtilityExecutionOra
130
165
  * @throws If scopes are defined and the account is not in the scopes.
131
166
  */
132
167
  public async getKeyValidationRequest(pkMHash: Fr): Promise<KeyValidationRequest> {
133
- // If scopes are defined, check that the key belongs to an account in the scopes.
134
- if (this.scopes !== 'ALL_SCOPES' && this.scopes.length > 0) {
135
- let hasAccess = false;
136
- for (let i = 0; i < this.scopes.length && !hasAccess; i++) {
137
- if (await this.keyStore.accountHasKey(this.scopes[i], pkMHash)) {
138
- hasAccess = true;
139
- }
140
- }
141
- if (!hasAccess) {
142
- throw new Error(`Key validation request denied: no scoped account has a key with hash ${pkMHash.toString()}.`);
168
+ let hasAccess = false;
169
+ for (let i = 0; i < this.scopes.length && !hasAccess; i++) {
170
+ if (await this.keyStore.accountHasKey(this.scopes[i], pkMHash)) {
171
+ hasAccess = true;
143
172
  }
144
173
  }
174
+ if (!hasAccess) {
175
+ throw new Error(`Key validation request denied: no scoped account has a key with hash ${pkMHash.toString()}.`);
176
+ }
145
177
  return this.keyStore.getKeyValidationRequest(pkMHash, this.contractAddress);
146
178
  }
147
179
 
148
180
  /**
149
181
  * Fetches the index and sibling path of a leaf at a given block from the note hash tree.
150
- * @param anchorBlockHash - The hash of a block that contains the note hash tree root in which to find the membership
151
- * witness.
182
+ * @param blockHash - The hash of a block that contains the note hash tree root in which to find the
183
+ * membership witness.
152
184
  * @param noteHash - The note hash to find in the note hash tree.
153
185
  * @returns The membership witness containing the leaf index and sibling path
154
186
  */
155
187
  public getNoteHashMembershipWitness(
156
- anchorBlockHash: BlockHash,
188
+ blockHash: BlockHash,
157
189
  noteHash: Fr,
158
190
  ): Promise<MembershipWitness<typeof NOTE_HASH_TREE_HEIGHT> | undefined> {
159
- return this.aztecNode.getNoteHashMembershipWitness(anchorBlockHash, noteHash);
191
+ return this.#queryWithBlockHashNotAfterAnchor(blockHash, () =>
192
+ this.aztecNode.getNoteHashMembershipWitness(blockHash, noteHash),
193
+ );
160
194
  }
161
195
 
162
196
  /**
@@ -165,16 +199,21 @@ export class UtilityExecutionOracle implements IMiscOracle, IUtilityExecutionOra
165
199
  * Block hashes are the leaves of the archive tree. Each time a new block is added to the chain,
166
200
  * its block hash is appended as a new leaf to the archive tree.
167
201
  *
168
- * @param anchorBlockHash - The hash of a block that contains the archive tree root in which to find the membership
202
+ * @param referenceBlockHash - The hash of a block that contains the archive tree root in which to find the membership
169
203
  * witness.
170
204
  * @param blockHash - The block hash to find in the archive tree.
171
205
  * @returns The membership witness containing the leaf index and sibling path
172
206
  */
173
207
  public getBlockHashMembershipWitness(
174
- anchorBlockHash: BlockHash,
208
+ referenceBlockHash: BlockHash,
175
209
  blockHash: BlockHash,
176
210
  ): Promise<MembershipWitness<typeof ARCHIVE_HEIGHT> | undefined> {
177
- return this.aztecNode.getBlockHashMembershipWitness(anchorBlockHash, blockHash);
211
+ // Note that we validate that the reference block hash is at or before the anchor block - we don't test the block
212
+ // hash at all. If the block hash did not exist by the reference block hash, then the node will not return the
213
+ // membership witness as there is none.
214
+ return this.#queryWithBlockHashNotAfterAnchor(referenceBlockHash, () =>
215
+ this.aztecNode.getBlockHashMembershipWitness(referenceBlockHash, blockHash),
216
+ );
178
217
  }
179
218
 
180
219
  /**
@@ -187,7 +226,9 @@ export class UtilityExecutionOracle implements IMiscOracle, IUtilityExecutionOra
187
226
  blockHash: BlockHash,
188
227
  nullifier: Fr,
189
228
  ): Promise<NullifierMembershipWitness | undefined> {
190
- return this.aztecNode.getNullifierMembershipWitness(blockHash, nullifier);
229
+ return this.#queryWithBlockHashNotAfterAnchor(blockHash, () =>
230
+ this.aztecNode.getNullifierMembershipWitness(blockHash, nullifier),
231
+ );
191
232
  }
192
233
 
193
234
  /**
@@ -203,7 +244,9 @@ export class UtilityExecutionOracle implements IMiscOracle, IUtilityExecutionOra
203
244
  blockHash: BlockHash,
204
245
  nullifier: Fr,
205
246
  ): Promise<NullifierMembershipWitness | undefined> {
206
- return this.aztecNode.getLowNullifierMembershipWitness(blockHash, nullifier);
247
+ return this.#queryWithBlockHashNotAfterAnchor(blockHash, () =>
248
+ this.aztecNode.getLowNullifierMembershipWitness(blockHash, nullifier),
249
+ );
207
250
  }
208
251
 
209
252
  /**
@@ -213,7 +256,9 @@ export class UtilityExecutionOracle implements IMiscOracle, IUtilityExecutionOra
213
256
  * @returns - The witness
214
257
  */
215
258
  public getPublicDataWitness(blockHash: BlockHash, leafSlot: Fr): Promise<PublicDataWitness | undefined> {
216
- return this.aztecNode.getPublicDataWitness(blockHash, leafSlot);
259
+ return this.#queryWithBlockHashNotAfterAnchor(blockHash, () =>
260
+ this.aztecNode.getPublicDataWitness(blockHash, leafSlot),
261
+ );
217
262
  }
218
263
 
219
264
  /**
@@ -236,7 +281,7 @@ export class UtilityExecutionOracle implements IMiscOracle, IUtilityExecutionOra
236
281
  * @param account - The account address.
237
282
  * @returns The public keys and partial address, or `undefined` if the account is not registered.
238
283
  */
239
- public async tryGetPublicKeysAndPartialAddress(
284
+ public async getPublicKeysAndPartialAddress(
240
285
  account: AztecAddress,
241
286
  ): Promise<{ publicKeys: PublicKeys; partialAddress: PartialAddress } | undefined> {
242
287
  const completeAddress = await this.addressStore.getCompleteAddress(account);
@@ -342,7 +387,7 @@ export class UtilityExecutionOracle implements IMiscOracle, IUtilityExecutionOra
342
387
  * @param innerNullifier - The inner nullifier.
343
388
  * @returns A boolean indicating whether the nullifier exists in the tree or not.
344
389
  */
345
- public async checkNullifierExists(innerNullifier: Fr) {
390
+ public async doesNullifierExist(innerNullifier: Fr) {
346
391
  const [nullifier, anchorBlockHash] = await Promise.all([
347
392
  siloNullifier(this.contractAddress, innerNullifier!),
348
393
  this.anchorBlockHeader.hash(),
@@ -354,7 +399,7 @@ export class UtilityExecutionOracle implements IMiscOracle, IUtilityExecutionOra
354
399
  }
355
400
 
356
401
  /**
357
- * Fetches a message from the executionStore, given its key.
402
+ * Returns the membership witness of an un-nullified L1 to L2 message.
358
403
  * @param contractAddress - Address of a contract by which the message was emitted.
359
404
  * @param messageHash - Hash of the message.
360
405
  * @param secret - Secret used to compute a nullifier.
@@ -367,6 +412,7 @@ export class UtilityExecutionOracle implements IMiscOracle, IUtilityExecutionOra
367
412
  contractAddress,
368
413
  messageHash,
369
414
  secret,
415
+ await this.anchorBlockHeader.hash(),
370
416
  );
371
417
 
372
418
  return new MessageLoadOracleInputs(messageIndex, siblingPath);
@@ -379,29 +425,31 @@ export class UtilityExecutionOracle implements IMiscOracle, IUtilityExecutionOra
379
425
  * @param startStorageSlot - The starting storage slot.
380
426
  * @param numberOfElements - Number of elements to read from the starting storage slot.
381
427
  */
382
- public async storageRead(
428
+ public getFromPublicStorage(
383
429
  blockHash: BlockHash,
384
430
  contractAddress: AztecAddress,
385
431
  startStorageSlot: Fr,
386
432
  numberOfElements: number,
387
433
  ) {
388
- const slots = Array(numberOfElements)
389
- .fill(0)
390
- .map((_, i) => new Fr(startStorageSlot.value + BigInt(i)));
434
+ return this.#queryWithBlockHashNotAfterAnchor(blockHash, async () => {
435
+ const slots = Array(numberOfElements)
436
+ .fill(0)
437
+ .map((_, i) => new Fr(startStorageSlot.value + BigInt(i)));
391
438
 
392
- const values = await Promise.all(
393
- slots.map(storageSlot => this.aztecNode.getPublicStorageAt(blockHash, contractAddress, storageSlot)),
394
- );
439
+ const values = await Promise.all(
440
+ slots.map(storageSlot => this.aztecNode.getPublicStorageAt(blockHash, contractAddress, storageSlot)),
441
+ );
395
442
 
396
- this.logger.debug(
397
- `Oracle storage read: slots=[${slots.map(slot => slot.toString()).join(', ')}] address=${contractAddress.toString()} values=[${values.join(', ')}]`,
398
- );
443
+ this.logger.debug(
444
+ `Oracle storage read: slots=[${slots.map(slot => slot.toString()).join(', ')}] address=${contractAddress.toString()} values=[${values.join(', ')}]`,
445
+ );
399
446
 
400
- return values;
447
+ return values;
448
+ });
401
449
  }
402
450
 
403
451
  /**
404
- * Returns a per-contract logger whose output is prefixed with `contract_log::<name>(<addrAbbrev>)`.
452
+ * Returns a per-contract logger whose output is prefixed with `contract:<name>(<addrAbbrev>)`.
405
453
  */
406
454
  async #getContractLogger(): Promise<Logger> {
407
455
  if (!this.contractLogger) {
@@ -410,26 +458,47 @@ export class UtilityExecutionOracle implements IMiscOracle, IUtilityExecutionOra
410
458
  this.contractLogger = await createContractLogger(
411
459
  this.contractAddress,
412
460
  addr => this.contractStore.getDebugContractName(addr),
461
+ 'user',
413
462
  { instanceId: this.jobId },
414
463
  );
415
464
  }
416
465
  return this.contractLogger;
417
466
  }
418
467
 
468
+ /**
469
+ * Returns a per-contract logger whose output is prefixed with `aztecnr:<name>(<addrAbbrev>)`.
470
+ */
471
+ async #getAztecnrLogger(): Promise<Logger> {
472
+ if (!this.aztecnrLogger) {
473
+ // Purpose of instanceId is to distinguish logs from different instances of the same component. It makes sense
474
+ // to re-use jobId as instanceId here as executions of different PXE jobs are isolated.
475
+ this.aztecnrLogger = await createContractLogger(
476
+ this.contractAddress,
477
+ addr => this.contractStore.getDebugContractName(addr),
478
+ 'aztecnr',
479
+ { instanceId: this.jobId },
480
+ );
481
+ }
482
+ return this.aztecnrLogger;
483
+ }
484
+
419
485
  public async log(level: number, message: string, fields: Fr[]): Promise<void> {
420
486
  if (!LogLevels[level]) {
421
487
  throw new Error(`Invalid log level: ${level}`);
422
488
  }
423
- const logger = await this.#getContractLogger();
424
- logContractMessage(logger, LogLevels[level], message, fields);
489
+
490
+ const { kind, message: strippedMessage } = stripAztecnrLogPrefix(message);
491
+
492
+ const logger = kind == 'aztecnr' ? await this.#getAztecnrLogger() : await this.#getContractLogger();
493
+ logContractMessage(logger, LogLevels[level], strippedMessage, fields);
425
494
  }
426
495
 
427
- public async fetchTaggedLogs(pendingTaggedLogArrayBaseSlot: Fr) {
496
+ public async getPendingTaggedLogs(pendingTaggedLogArrayBaseSlot: Fr, scope: AztecAddress) {
428
497
  const logService = new LogService(
429
498
  this.aztecNode,
430
499
  this.anchorBlockHeader,
431
500
  this.keyStore,
432
- this.capsuleStore,
501
+ this.capsuleService,
433
502
  this.recipientTaggingStore,
434
503
  this.senderAddressBookStore,
435
504
  this.addressStore,
@@ -437,7 +506,7 @@ export class UtilityExecutionOracle implements IMiscOracle, IUtilityExecutionOra
437
506
  this.logger.getBindings(),
438
507
  );
439
508
 
440
- await logService.fetchTaggedLogs(this.contractAddress, pendingTaggedLogArrayBaseSlot, this.scopes);
509
+ await logService.fetchTaggedLogs(this.contractAddress, pendingTaggedLogArrayBaseSlot, scope);
441
510
  }
442
511
 
443
512
  /**
@@ -454,6 +523,9 @@ export class UtilityExecutionOracle implements IMiscOracle, IUtilityExecutionOra
454
523
  contractAddress: AztecAddress,
455
524
  noteValidationRequestsArrayBaseSlot: Fr,
456
525
  eventValidationRequestsArrayBaseSlot: Fr,
526
+ maxNotePackedLen: number,
527
+ maxEventSerializedLen: number,
528
+ scope: AztecAddress,
457
529
  ) {
458
530
  // TODO(#10727): allow other contracts to store notes
459
531
  if (!this.contractAddress.equals(contractAddress)) {
@@ -463,12 +535,22 @@ export class UtilityExecutionOracle implements IMiscOracle, IUtilityExecutionOra
463
535
  // We read all note and event validation requests and process them all concurrently. This makes the process much
464
536
  // faster as we don't need to wait for the network round-trip.
465
537
  const noteValidationRequests = (
466
- await this.capsuleStore.readCapsuleArray(contractAddress, noteValidationRequestsArrayBaseSlot, this.jobId)
467
- ).map(NoteValidationRequest.fromFields);
538
+ await this.capsuleService.readCapsuleArray(
539
+ contractAddress,
540
+ noteValidationRequestsArrayBaseSlot,
541
+ this.jobId,
542
+ scope,
543
+ )
544
+ ).map(fields => NoteValidationRequest.fromFields(fields, maxNotePackedLen));
468
545
 
469
546
  const eventValidationRequests = (
470
- await this.capsuleStore.readCapsuleArray(contractAddress, eventValidationRequestsArrayBaseSlot, this.jobId)
471
- ).map(EventValidationRequest.fromFields);
547
+ await this.capsuleService.readCapsuleArray(
548
+ contractAddress,
549
+ eventValidationRequestsArrayBaseSlot,
550
+ this.jobId,
551
+ scope,
552
+ )
553
+ ).map(fields => EventValidationRequest.fromFields(fields, maxEventSerializedLen));
472
554
 
473
555
  const noteService = new NoteService(this.noteStore, this.aztecNode, this.anchorBlockHeader, this.jobId);
474
556
  const noteStorePromises = noteValidationRequests.map(request =>
@@ -482,7 +564,7 @@ export class UtilityExecutionOracle implements IMiscOracle, IUtilityExecutionOra
482
564
  request.noteHash,
483
565
  request.nullifier,
484
566
  request.txHash,
485
- request.recipient,
567
+ scope,
486
568
  ),
487
569
  );
488
570
 
@@ -495,21 +577,34 @@ export class UtilityExecutionOracle implements IMiscOracle, IUtilityExecutionOra
495
577
  request.serializedEvent,
496
578
  request.eventCommitment,
497
579
  request.txHash,
498
- request.recipient,
580
+ scope,
499
581
  ),
500
582
  );
501
583
 
502
584
  await Promise.all([...noteStorePromises, ...eventStorePromises]);
503
585
 
504
586
  // Requests are cleared once we're done.
505
- await this.capsuleStore.setCapsuleArray(contractAddress, noteValidationRequestsArrayBaseSlot, [], this.jobId);
506
- await this.capsuleStore.setCapsuleArray(contractAddress, eventValidationRequestsArrayBaseSlot, [], this.jobId);
587
+ await this.capsuleService.setCapsuleArray(
588
+ contractAddress,
589
+ noteValidationRequestsArrayBaseSlot,
590
+ [],
591
+ this.jobId,
592
+ scope,
593
+ );
594
+ await this.capsuleService.setCapsuleArray(
595
+ contractAddress,
596
+ eventValidationRequestsArrayBaseSlot,
597
+ [],
598
+ this.jobId,
599
+ scope,
600
+ );
507
601
  }
508
602
 
509
- public async bulkRetrieveLogs(
603
+ public async getLogsByTag(
510
604
  contractAddress: AztecAddress,
511
605
  logRetrievalRequestsArrayBaseSlot: Fr,
512
606
  logRetrievalResponsesArrayBaseSlot: Fr,
607
+ scope: AztecAddress,
513
608
  ) {
514
609
  // TODO(#10727): allow other contracts to process partial notes
515
610
  if (!this.contractAddress.equals(contractAddress)) {
@@ -519,14 +614,14 @@ export class UtilityExecutionOracle implements IMiscOracle, IUtilityExecutionOra
519
614
  // We read all log retrieval requests and process them all concurrently. This makes the process much faster as we
520
615
  // don't need to wait for the network round-trip.
521
616
  const logRetrievalRequests = (
522
- await this.capsuleStore.readCapsuleArray(contractAddress, logRetrievalRequestsArrayBaseSlot, this.jobId)
617
+ await this.capsuleService.readCapsuleArray(contractAddress, logRetrievalRequestsArrayBaseSlot, this.jobId, scope)
523
618
  ).map(LogRetrievalRequest.fromFields);
524
619
 
525
620
  const logService = new LogService(
526
621
  this.aztecNode,
527
622
  this.anchorBlockHeader,
528
623
  this.keyStore,
529
- this.capsuleStore,
624
+ this.capsuleService,
530
625
  this.recipientTaggingStore,
531
626
  this.senderAddressBookStore,
532
627
  this.addressStore,
@@ -534,77 +629,185 @@ export class UtilityExecutionOracle implements IMiscOracle, IUtilityExecutionOra
534
629
  this.logger.getBindings(),
535
630
  );
536
631
 
537
- const maybeLogRetrievalResponses = await logService.bulkRetrieveLogs(logRetrievalRequests);
632
+ const maybeLogRetrievalResponses = await logService.fetchLogsByTag(contractAddress, logRetrievalRequests);
538
633
 
539
634
  // Requests are cleared once we're done.
540
- await this.capsuleStore.setCapsuleArray(contractAddress, logRetrievalRequestsArrayBaseSlot, [], this.jobId);
635
+ await this.capsuleService.setCapsuleArray(
636
+ contractAddress,
637
+ logRetrievalRequestsArrayBaseSlot,
638
+ [],
639
+ this.jobId,
640
+ scope,
641
+ );
541
642
 
542
643
  // The responses are stored as Option<LogRetrievalResponse> in a second CapsuleArray.
543
- await this.capsuleStore.setCapsuleArray(
644
+ await this.capsuleService.setCapsuleArray(
544
645
  contractAddress,
545
646
  logRetrievalResponsesArrayBaseSlot,
546
647
  maybeLogRetrievalResponses.map(LogRetrievalResponse.toSerializedOption),
547
648
  this.jobId,
649
+ scope,
548
650
  );
549
651
  }
550
652
 
551
- public storeCapsule(contractAddress: AztecAddress, slot: Fr, capsule: Fr[]): Promise<void> {
653
+ public async getMessageContextsByTxHash(
654
+ contractAddress: AztecAddress,
655
+ messageContextRequestsArrayBaseSlot: Fr,
656
+ messageContextResponsesArrayBaseSlot: Fr,
657
+ scope: AztecAddress,
658
+ ) {
659
+ try {
660
+ if (!this.contractAddress.equals(contractAddress)) {
661
+ throw new Error(`Got a message context request from ${contractAddress}, expected ${this.contractAddress}`);
662
+ }
663
+
664
+ // TODO(@mverzilli): this is a prime example of where using a volatile array would make much more sense, we don't
665
+ // need scopes here, we just need a bit of shared memory to cross boundaries between Noir and TS.
666
+ // At the same time, we don't want to allow any global scope access other than where backwards compatibility
667
+ // forces us to. Hence we need the scope here to be artificial.
668
+ const requestCapsules = await this.capsuleService.readCapsuleArray(
669
+ contractAddress,
670
+ messageContextRequestsArrayBaseSlot,
671
+ this.jobId,
672
+ scope,
673
+ );
674
+
675
+ const txHashes = requestCapsules.map((fields, i) => {
676
+ if (fields.length !== 1) {
677
+ throw new Error(
678
+ `Malformed message context request at index ${i}: expected 1 field (tx hash), got ${fields.length}`,
679
+ );
680
+ }
681
+ return fields[0];
682
+ });
683
+
684
+ const maybeMessageContexts = await this.messageContextService.getMessageContextsByTxHash(
685
+ txHashes,
686
+ this.anchorBlockHeader.getBlockNumber(),
687
+ );
688
+
689
+ // Leave response in response capsule array.
690
+ await this.capsuleService.setCapsuleArray(
691
+ contractAddress,
692
+ messageContextResponsesArrayBaseSlot,
693
+ maybeMessageContexts.map(MessageContext.toSerializedOption),
694
+ this.jobId,
695
+ scope,
696
+ );
697
+ } finally {
698
+ await this.capsuleService.setCapsuleArray(
699
+ contractAddress,
700
+ messageContextRequestsArrayBaseSlot,
701
+ [],
702
+ this.jobId,
703
+ scope,
704
+ );
705
+ }
706
+ }
707
+
708
+ public setCapsule(contractAddress: AztecAddress, slot: Fr, capsule: Fr[], scope: AztecAddress): void {
552
709
  if (!contractAddress.equals(this.contractAddress)) {
553
710
  // TODO(#10727): instead of this check that this.contractAddress is allowed to access the external DB
554
711
  throw new Error(`Contract ${contractAddress} is not allowed to access ${this.contractAddress}'s PXE DB`);
555
712
  }
556
- this.capsuleStore.storeCapsule(this.contractAddress, slot, capsule, this.jobId);
557
- return Promise.resolve();
713
+ this.capsuleService.setCapsule(contractAddress, slot, capsule, this.jobId, scope);
558
714
  }
559
715
 
560
- public async loadCapsule(contractAddress: AztecAddress, slot: Fr): Promise<Fr[] | null> {
716
+ public getCapsule(contractAddress: AztecAddress, slot: Fr, scope: AztecAddress): Promise<Fr[] | null> {
561
717
  if (!contractAddress.equals(this.contractAddress)) {
562
718
  // TODO(#10727): instead of this check that this.contractAddress is allowed to access the external DB
563
719
  throw new Error(`Contract ${contractAddress} is not allowed to access ${this.contractAddress}'s PXE DB`);
564
720
  }
565
- return (
566
- // TODO(#12425): On the following line, the pertinent capsule gets overshadowed by the transient one. Tackle this.
567
- this.capsules.find(c => c.contractAddress.equals(contractAddress) && c.storageSlot.equals(slot))?.data ??
568
- (await this.capsuleStore.loadCapsule(this.contractAddress, slot, this.jobId))
569
- );
721
+ return this.capsuleService.getCapsule(contractAddress, slot, this.jobId, scope, this.capsules);
570
722
  }
571
723
 
572
- public deleteCapsule(contractAddress: AztecAddress, slot: Fr): Promise<void> {
724
+ public deleteCapsule(contractAddress: AztecAddress, slot: Fr, scope: AztecAddress): void {
573
725
  if (!contractAddress.equals(this.contractAddress)) {
574
726
  // TODO(#10727): instead of this check that this.contractAddress is allowed to access the external DB
575
727
  throw new Error(`Contract ${contractAddress} is not allowed to access ${this.contractAddress}'s PXE DB`);
576
728
  }
577
- this.capsuleStore.deleteCapsule(this.contractAddress, slot, this.jobId);
578
- return Promise.resolve();
729
+ this.capsuleService.deleteCapsule(contractAddress, slot, this.jobId, scope);
579
730
  }
580
731
 
581
- public copyCapsule(contractAddress: AztecAddress, srcSlot: Fr, dstSlot: Fr, numEntries: number): Promise<void> {
732
+ public copyCapsule(
733
+ contractAddress: AztecAddress,
734
+ srcSlot: Fr,
735
+ dstSlot: Fr,
736
+ numEntries: number,
737
+ scope: AztecAddress,
738
+ ): Promise<void> {
582
739
  if (!contractAddress.equals(this.contractAddress)) {
583
740
  // TODO(#10727): instead of this check that this.contractAddress is allowed to access the external DB
584
741
  throw new Error(`Contract ${contractAddress} is not allowed to access ${this.contractAddress}'s PXE DB`);
585
742
  }
586
- return this.capsuleStore.copyCapsule(this.contractAddress, srcSlot, dstSlot, numEntries, this.jobId);
743
+ return this.capsuleService.copyCapsule(contractAddress, srcSlot, dstSlot, numEntries, this.jobId, scope);
744
+ }
745
+
746
+ /**
747
+ * Clears cached sync state for a contract for a set of scopes, forcing re-sync on the next query so that newly
748
+ * stored notes or events are discovered.
749
+ */
750
+ public setContractSyncCacheInvalid(contractAddress: AztecAddress, scopes: AztecAddress[]): void {
751
+ if (!contractAddress.equals(this.contractAddress)) {
752
+ throw new Error(`Contract ${this.contractAddress} cannot invalidate sync cache of ${contractAddress}`);
753
+ }
754
+ this.contractSyncService.invalidateContractForScopes(contractAddress, scopes);
587
755
  }
588
756
 
589
757
  // TODO(#11849): consider replacing this oracle with a pure Noir implementation of aes decryption.
590
- public aes128Decrypt(ciphertext: Buffer, iv: Buffer, symKey: Buffer): Promise<Buffer> {
758
+ public decryptAes128(ciphertext: Buffer, iv: Buffer, symKey: Buffer): Promise<Buffer> {
591
759
  const aes128 = new Aes128();
592
760
  return aes128.decryptBufferCBC(ciphertext, iv, symKey);
593
761
  }
594
762
 
595
763
  /**
596
- * Retrieves the shared secret for a given address and ephemeral public key.
764
+ * Retrieves the app-siloed shared secret for a given address and ephemeral public key.
597
765
  * @param address - The address to get the secret for.
598
766
  * @param ephPk - The ephemeral public key to get the secret for.
599
- * @returns The secret for the given address.
767
+ * @param contractAddress - The contract address for app-siloing (validated against execution context).
768
+ * @returns The app-siloed shared secret as a Field.
600
769
  */
601
- public async getSharedSecret(address: AztecAddress, ephPk: Point): Promise<Point> {
602
- // TODO(#12656): return an app-siloed secret
770
+ public async getSharedSecret(address: AztecAddress, ephPk: Point, contractAddress: AztecAddress): Promise<Fr> {
771
+ if (!contractAddress.equals(this.contractAddress)) {
772
+ throw new Error(
773
+ `getSharedSecret called with contract address ${contractAddress}, expected ${this.contractAddress}`,
774
+ );
775
+ }
603
776
  const recipientCompleteAddress = await this.getCompleteAddressOrFail(address);
604
777
  const ivskM = await this.keyStore.getMasterSecretKey(
605
778
  recipientCompleteAddress.publicKeys.masterIncomingViewingPublicKey,
606
779
  );
607
780
  const addressSecret = await computeAddressSecret(await recipientCompleteAddress.getPreaddress(), ivskM);
608
- return deriveEcdhSharedSecret(addressSecret, ephPk);
781
+ return deriveAppSiloedSharedSecret(addressSecret, ephPk, this.contractAddress);
782
+ }
783
+
784
+ public emitOffchainEffect(data: Fr[]): Promise<void> {
785
+ this.offchainEffects.push({ data, contractAddress: this.contractAddress });
786
+ return Promise.resolve();
787
+ }
788
+
789
+ /** Returns offchain effects collected during execution. */
790
+ public getOffchainEffects(): OffchainEffect[] {
791
+ return this.offchainEffects;
792
+ }
793
+
794
+ /** Runs a query concurrently with a validation that the block hash is not ahead of the anchor block. */
795
+ async #queryWithBlockHashNotAfterAnchor<T>(blockHash: BlockHash, query: () => Promise<T>): Promise<T> {
796
+ const [response] = await Promise.all([
797
+ query(),
798
+ (async () => {
799
+ const header = await this.aztecNode.getBlockHeader(blockHash);
800
+ if (!header) {
801
+ throw new Error(`Could not find block header for block hash ${blockHash}`);
802
+ }
803
+
804
+ if (header.getBlockNumber() > this.anchorBlockHeader.getBlockNumber()) {
805
+ throw new Error(
806
+ `Made a node query with a reference block hash ${blockHash} with block number ${header.getBlockNumber()}, which is ahead of the anchor block number ${this.anchorBlockHeader.getBlockNumber()} (from anchor block hash ${await this.anchorBlockHeader.hash()}).`,
807
+ );
808
+ }
809
+ })(),
810
+ ]);
811
+ return response;
609
812
  }
610
813
  }