@aztec/txe 0.0.1-commit.03f7ef2 → 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 (54) hide show
  1. package/dest/constants.d.ts +4 -0
  2. package/dest/constants.d.ts.map +1 -0
  3. package/dest/constants.js +3 -0
  4. package/dest/oracle/txe_oracle_top_level_context.d.ts +15 -13
  5. package/dest/oracle/txe_oracle_top_level_context.d.ts.map +1 -1
  6. package/dest/oracle/txe_oracle_top_level_context.js +61 -51
  7. package/dest/state_machine/archiver.d.ts +6 -4
  8. package/dest/state_machine/archiver.d.ts.map +1 -1
  9. package/dest/state_machine/archiver.js +35 -12
  10. package/dest/state_machine/dummy_p2p_client.d.ts +8 -7
  11. package/dest/state_machine/dummy_p2p_client.d.ts.map +1 -1
  12. package/dest/state_machine/dummy_p2p_client.js +13 -10
  13. package/dest/state_machine/global_variable_builder.d.ts +2 -2
  14. package/dest/state_machine/global_variable_builder.d.ts.map +1 -1
  15. package/dest/state_machine/global_variable_builder.js +1 -1
  16. package/dest/state_machine/index.d.ts +4 -4
  17. package/dest/state_machine/index.d.ts.map +1 -1
  18. package/dest/state_machine/index.js +7 -7
  19. package/dest/state_machine/mock_epoch_cache.d.ts +2 -1
  20. package/dest/state_machine/mock_epoch_cache.d.ts.map +1 -1
  21. package/dest/state_machine/mock_epoch_cache.js +3 -0
  22. package/dest/txe_session.d.ts +15 -14
  23. package/dest/txe_session.d.ts.map +1 -1
  24. package/dest/txe_session.js +68 -46
  25. package/dest/util/txe_account_store.d.ts +10 -0
  26. package/dest/util/txe_account_store.d.ts.map +1 -0
  27. package/dest/util/{txe_account_data_provider.js → txe_account_store.js} +1 -1
  28. package/dest/util/txe_contract_store.d.ts +12 -0
  29. package/dest/util/txe_contract_store.d.ts.map +1 -0
  30. package/dest/util/{txe_contract_data_provider.js → txe_contract_store.js} +3 -3
  31. package/dest/util/txe_public_contract_data_source.d.ts +4 -4
  32. package/dest/util/txe_public_contract_data_source.d.ts.map +1 -1
  33. package/dest/util/txe_public_contract_data_source.js +10 -10
  34. package/dest/utils/block_creation.d.ts +1 -1
  35. package/dest/utils/block_creation.d.ts.map +1 -1
  36. package/dest/utils/block_creation.js +1 -2
  37. package/package.json +15 -15
  38. package/src/constants.ts +4 -0
  39. package/src/index.ts +1 -1
  40. package/src/oracle/txe_oracle_top_level_context.ts +89 -67
  41. package/src/state_machine/archiver.ts +37 -6
  42. package/src/state_machine/dummy_p2p_client.ts +18 -13
  43. package/src/state_machine/global_variable_builder.ts +1 -1
  44. package/src/state_machine/index.ts +5 -5
  45. package/src/state_machine/mock_epoch_cache.ts +4 -0
  46. package/src/txe_session.ts +138 -79
  47. package/src/util/{txe_account_data_provider.ts → txe_account_store.ts} +1 -1
  48. package/src/util/{txe_contract_data_provider.ts → txe_contract_store.ts} +3 -3
  49. package/src/util/txe_public_contract_data_source.ts +9 -9
  50. package/src/utils/block_creation.ts +2 -2
  51. package/dest/util/txe_account_data_provider.d.ts +0 -10
  52. package/dest/util/txe_account_data_provider.d.ts.map +0 -1
  53. package/dest/util/txe_contract_data_provider.d.ts +0 -12
  54. package/dest/util/txe_contract_data_provider.d.ts.map +0 -1
@@ -6,7 +6,7 @@ import { makeGlobalVariables } from '@aztec/stdlib/testing';
6
6
  import { type CheckpointGlobalVariables, type GlobalVariableBuilder, GlobalVariables } from '@aztec/stdlib/tx';
7
7
 
8
8
  export class TXEGlobalVariablesBuilder implements GlobalVariableBuilder {
9
- public getCurrentBaseFees(): Promise<GasFees> {
9
+ public getCurrentMinFees(): Promise<GasFees> {
10
10
  return Promise.resolve(new GasFees(0, 0));
11
11
  }
12
12
 
@@ -2,7 +2,7 @@ import { type AztecNodeConfig, AztecNodeService } from '@aztec/aztec-node';
2
2
  import { TestCircuitVerifier } from '@aztec/bb-prover/test';
3
3
  import { createLogger } from '@aztec/foundation/log';
4
4
  import type { AztecAsyncKVStore } from '@aztec/kv-store';
5
- import { AnchorBlockDataProvider } from '@aztec/pxe/server';
5
+ import { AnchorBlockStore } from '@aztec/pxe/server';
6
6
  import { L2Block } from '@aztec/stdlib/block';
7
7
  import { L1PublishedData, PublishedCheckpoint } from '@aztec/stdlib/checkpoint';
8
8
  import type { AztecNode } from '@aztec/stdlib/interfaces/client';
@@ -22,13 +22,13 @@ export class TXEStateMachine {
22
22
  public node: AztecNode,
23
23
  public synchronizer: TXESynchronizer,
24
24
  public archiver: TXEArchiver,
25
- public anchorBlockDataProvider: AnchorBlockDataProvider,
25
+ public anchorBlockStore: AnchorBlockStore,
26
26
  ) {}
27
27
 
28
28
  public static async create(db: AztecAsyncKVStore) {
29
29
  const archiver = new TXEArchiver(db);
30
30
  const synchronizer = await TXESynchronizer.create();
31
- const anchorBlockDataProvider = new AnchorBlockDataProvider(db);
31
+ const anchorBlockStore = new AnchorBlockStore(db);
32
32
 
33
33
  const aztecNodeConfig = {} as AztecNodeConfig;
34
34
 
@@ -55,7 +55,7 @@ export class TXEStateMachine {
55
55
  log,
56
56
  );
57
57
 
58
- return new this(node, synchronizer, archiver, anchorBlockDataProvider);
58
+ return new this(node, synchronizer, archiver, anchorBlockStore);
59
59
  }
60
60
 
61
61
  public async handleL2Block(block: L2Block) {
@@ -72,7 +72,7 @@ export class TXEStateMachine {
72
72
  await Promise.all([
73
73
  this.synchronizer.handleL2Block(block.toL2Block()),
74
74
  this.archiver.addCheckpoints([publishedCheckpoint], undefined),
75
- this.anchorBlockDataProvider.setHeader(block.getBlockHeader()),
75
+ this.anchorBlockStore.setHeader(block.getBlockHeader()),
76
76
  ]);
77
77
  }
78
78
  }
@@ -54,6 +54,10 @@ export class MockEpochCache implements EpochCacheInterface {
54
54
  });
55
55
  }
56
56
 
57
+ getProposerAttesterAddressInSlot(_slot: SlotNumber): Promise<EthAddress | undefined> {
58
+ return Promise.resolve(undefined);
59
+ }
60
+
57
61
  isInCommittee(_slot: SlotTag, _validator: EthAddress): Promise<boolean> {
58
62
  return Promise.resolve(false);
59
63
  }
@@ -5,13 +5,14 @@ import { KeyStore } from '@aztec/key-store';
5
5
  import { openTmpStore } from '@aztec/kv-store/lmdb-v2';
6
6
  import type { ProtocolContract } from '@aztec/protocol-contracts';
7
7
  import {
8
- AddressDataProvider,
9
- CapsuleDataProvider,
10
- NoteDataProvider,
8
+ AddressStore,
9
+ CapsuleStore,
11
10
  NoteService,
12
- PrivateEventDataProvider,
13
- RecipientTaggingDataProvider,
14
- SenderTaggingDataProvider,
11
+ NoteStore,
12
+ PrivateEventStore,
13
+ RecipientTaggingStore,
14
+ SenderAddressBookStore,
15
+ SenderTaggingStore,
15
16
  } from '@aztec/pxe/server';
16
17
  import {
17
18
  ExecutionNoteCache,
@@ -19,10 +20,19 @@ import {
19
20
  HashedValuesCache,
20
21
  type IPrivateExecutionOracle,
21
22
  type IUtilityExecutionOracle,
23
+ Oracle,
22
24
  PrivateExecutionOracle,
23
25
  UtilityExecutionOracle,
24
26
  } from '@aztec/pxe/simulator';
25
- import { FunctionSelector } from '@aztec/stdlib/abi';
27
+ import {
28
+ ExecutionError,
29
+ WASMSimulator,
30
+ createSimulationError,
31
+ extractCallStack,
32
+ resolveAssertionMessageFromError,
33
+ toACVMWitness,
34
+ } from '@aztec/simulator/client';
35
+ import { FunctionCall, FunctionSelector, FunctionType } from '@aztec/stdlib/abi';
26
36
  import type { AuthWitness } from '@aztec/stdlib/auth-witness';
27
37
  import { AztecAddress } from '@aztec/stdlib/aztec-address';
28
38
  import { GasSettings } from '@aztec/stdlib/gas';
@@ -33,14 +43,15 @@ import { CallContext, GlobalVariables, TxContext } from '@aztec/stdlib/tx';
33
43
 
34
44
  import { z } from 'zod';
35
45
 
46
+ import { DEFAULT_ADDRESS, TXE_JOB_ID } from './constants.js';
36
47
  import type { IAvmExecutionOracle, ITxeExecutionOracle } from './oracle/interfaces.js';
37
48
  import { TXEOraclePublicContext } from './oracle/txe_oracle_public_context.js';
38
49
  import { TXEOracleTopLevelContext } from './oracle/txe_oracle_top_level_context.js';
39
50
  import { RPCTranslator } from './rpc_translator.js';
40
51
  import { TXEStateMachine } from './state_machine/index.js';
41
52
  import type { ForeignCallArgs, ForeignCallResult } from './util/encoding.js';
42
- import { TXEAccountDataProvider } from './util/txe_account_data_provider.js';
43
- import { TXEContractDataProvider } from './util/txe_contract_data_provider.js';
53
+ import { TXEAccountStore } from './util/txe_account_store.js';
54
+ import { TXEContractStore } from './util/txe_contract_store.js';
44
55
  import { getSingleTxBlockRequestHash, insertTxEffectIntoWorldTrees, makeTXEBlock } from './utils/block_creation.js';
45
56
  import { makeTxEffect } from './utils/tx_effect_creation.js';
46
57
 
@@ -102,8 +113,6 @@ export interface TXESessionStateHandler {
102
113
  enterUtilityState(contractAddress?: AztecAddress): Promise<void>;
103
114
  }
104
115
 
105
- export const DEFAULT_ADDRESS = AztecAddress.fromNumber(42);
106
-
107
116
  /**
108
117
  * A `TXESession` corresponds to a Noir `#[test]` function, and handles all of its oracle calls, stores test-specific
109
118
  * state, etc., independent of all other tests running in parallel.
@@ -120,15 +129,16 @@ export class TXESession implements TXESessionStateHandler {
120
129
  | IPrivateExecutionOracle
121
130
  | IAvmExecutionOracle
122
131
  | ITxeExecutionOracle,
123
- private contractDataProvider: TXEContractDataProvider,
124
- private noteDataProvider: NoteDataProvider,
132
+ private contractStore: TXEContractStore,
133
+ private noteStore: NoteStore,
125
134
  private keyStore: KeyStore,
126
- private addressDataProvider: AddressDataProvider,
127
- private accountDataProvider: TXEAccountDataProvider,
128
- private senderTaggingDataProvider: SenderTaggingDataProvider,
129
- private recipientTaggingDataProvider: RecipientTaggingDataProvider,
130
- private capsuleDataProvider: CapsuleDataProvider,
131
- private privateEventDataProvider: PrivateEventDataProvider,
135
+ private addressStore: AddressStore,
136
+ private accountStore: TXEAccountStore,
137
+ private senderTaggingStore: SenderTaggingStore,
138
+ private recipientTaggingStore: RecipientTaggingStore,
139
+ private senderAddressBookStore: SenderAddressBookStore,
140
+ private capsuleStore: CapsuleStore,
141
+ private privateEventStore: PrivateEventStore,
132
142
  private chainId: Fr,
133
143
  private version: Fr,
134
144
  private nextBlockTimestamp: bigint,
@@ -137,20 +147,21 @@ export class TXESession implements TXESessionStateHandler {
137
147
  static async init(protocolContracts: ProtocolContract[]) {
138
148
  const store = await openTmpStore('txe-session');
139
149
 
140
- const addressDataProvider = new AddressDataProvider(store);
141
- const privateEventDataProvider = new PrivateEventDataProvider(store);
142
- const contractDataProvider = new TXEContractDataProvider(store);
143
- const noteDataProvider = await NoteDataProvider.create(store);
144
- const senderTaggingDataProvider = new SenderTaggingDataProvider(store);
145
- const recipientTaggingDataProvider = new RecipientTaggingDataProvider(store);
146
- const capsuleDataProvider = new CapsuleDataProvider(store);
150
+ const addressStore = new AddressStore(store);
151
+ const privateEventStore = new PrivateEventStore(store);
152
+ const contractStore = new TXEContractStore(store);
153
+ const noteStore = await NoteStore.create(store);
154
+ const senderTaggingStore = new SenderTaggingStore(store);
155
+ const recipientTaggingStore = new RecipientTaggingStore(store);
156
+ const senderAddressBookStore = new SenderAddressBookStore(store);
157
+ const capsuleStore = new CapsuleStore(store);
147
158
  const keyStore = new KeyStore(store);
148
- const accountDataProvider = new TXEAccountDataProvider(store);
159
+ const accountStore = new TXEAccountStore(store);
149
160
 
150
161
  // Register protocol contracts.
151
162
  for (const { contractClass, instance, artifact } of protocolContracts) {
152
- await contractDataProvider.addContractArtifact(contractClass.id, artifact);
153
- await contractDataProvider.addContractInstance(instance);
163
+ await contractStore.addContractArtifact(contractClass.id, artifact);
164
+ await contractStore.addContractInstance(instance);
154
165
  }
155
166
 
156
167
  const stateMachine = await TXEStateMachine.create(store);
@@ -161,15 +172,16 @@ export class TXESession implements TXESessionStateHandler {
161
172
 
162
173
  const topLevelOracleHandler = new TXEOracleTopLevelContext(
163
174
  stateMachine,
164
- contractDataProvider,
165
- noteDataProvider,
175
+ contractStore,
176
+ noteStore,
166
177
  keyStore,
167
- addressDataProvider,
168
- accountDataProvider,
169
- senderTaggingDataProvider,
170
- recipientTaggingDataProvider,
171
- capsuleDataProvider,
172
- privateEventDataProvider,
178
+ addressStore,
179
+ accountStore,
180
+ senderTaggingStore,
181
+ recipientTaggingStore,
182
+ senderAddressBookStore,
183
+ capsuleStore,
184
+ privateEventStore,
173
185
  nextBlockTimestamp,
174
186
  version,
175
187
  chainId,
@@ -181,15 +193,16 @@ export class TXESession implements TXESessionStateHandler {
181
193
  createLogger('txe:session'),
182
194
  stateMachine,
183
195
  topLevelOracleHandler,
184
- contractDataProvider,
185
- noteDataProvider,
196
+ contractStore,
197
+ noteStore,
186
198
  keyStore,
187
- addressDataProvider,
188
- accountDataProvider,
189
- senderTaggingDataProvider,
190
- recipientTaggingDataProvider,
191
- capsuleDataProvider,
192
- privateEventDataProvider,
199
+ addressStore,
200
+ accountStore,
201
+ senderTaggingStore,
202
+ recipientTaggingStore,
203
+ senderAddressBookStore,
204
+ capsuleStore,
205
+ privateEventStore,
193
206
  version,
194
207
  chainId,
195
208
  nextBlockTimestamp,
@@ -251,15 +264,16 @@ export class TXESession implements TXESessionStateHandler {
251
264
 
252
265
  this.oracleHandler = new TXEOracleTopLevelContext(
253
266
  this.stateMachine,
254
- this.contractDataProvider,
255
- this.noteDataProvider,
267
+ this.contractStore,
268
+ this.noteStore,
256
269
  this.keyStore,
257
- this.addressDataProvider,
258
- this.accountDataProvider,
259
- this.senderTaggingDataProvider,
260
- this.recipientTaggingDataProvider,
261
- this.capsuleDataProvider,
262
- this.privateEventDataProvider,
270
+ this.addressStore,
271
+ this.accountStore,
272
+ this.senderTaggingStore,
273
+ this.recipientTaggingStore,
274
+ this.senderAddressBookStore,
275
+ this.capsuleStore,
276
+ this.privateEventStore,
263
277
  this.nextBlockTimestamp,
264
278
  this.version,
265
279
  this.chainId,
@@ -276,15 +290,10 @@ export class TXESession implements TXESessionStateHandler {
276
290
  ): Promise<PrivateContextInputs> {
277
291
  this.exitTopLevelState();
278
292
 
279
- // There is no automatic message discovery and contract-driven syncing process in inlined private or utility
280
- // contexts, which means that known nullifiers are also not searched for, since it is during the tagging sync that
281
- // we perform this. We therefore search for known nullifiers now, as otherwise notes that were nullified would not
282
- // be removed from the database.
283
- // TODO(#12553): make the synchronizer sync here instead and remove this
284
293
  await new NoteService(
285
- this.noteDataProvider,
294
+ this.noteStore,
286
295
  this.stateMachine.node,
287
- this.stateMachine.anchorBlockDataProvider,
296
+ this.stateMachine.anchorBlockStore,
288
297
  ).syncNoteNullifiers(contractAddress);
289
298
 
290
299
  // Private execution has two associated block numbers: the anchor block (i.e. the historical block that is used to
@@ -305,26 +314,30 @@ export class TXESession implements TXESessionStateHandler {
305
314
  const noteCache = new ExecutionNoteCache(protocolNullifier);
306
315
  const taggingIndexCache = new ExecutionTaggingIndexCache();
307
316
 
317
+ const utilityExecutor = this.utilityExecutorForContractSync(anchorBlock);
308
318
  this.oracleHandler = new PrivateExecutionOracle(
309
319
  Fr.ZERO,
310
320
  new TxContext(this.chainId, this.version, GasSettings.empty()),
311
321
  new CallContext(AztecAddress.ZERO, contractAddress, FunctionSelector.empty(), false),
312
322
  anchorBlock!,
323
+ utilityExecutor,
313
324
  [],
314
325
  [],
315
326
  new HashedValuesCache(),
316
327
  noteCache,
317
328
  taggingIndexCache,
318
- this.contractDataProvider,
319
- this.noteDataProvider,
329
+ this.contractStore,
330
+ this.noteStore,
320
331
  this.keyStore,
321
- this.addressDataProvider,
332
+ this.addressStore,
322
333
  this.stateMachine.node,
323
- this.stateMachine.anchorBlockDataProvider,
324
- this.senderTaggingDataProvider,
325
- this.recipientTaggingDataProvider,
326
- this.capsuleDataProvider,
327
- this.privateEventDataProvider,
334
+ this.stateMachine.anchorBlockStore,
335
+ this.senderTaggingStore,
336
+ this.recipientTaggingStore,
337
+ this.senderAddressBookStore,
338
+ this.capsuleStore,
339
+ this.privateEventStore,
340
+ TXE_JOB_ID,
328
341
  );
329
342
 
330
343
  // We store the note and tagging index caches fed into the PrivateExecutionOracle (along with some other auxiliary
@@ -371,28 +384,29 @@ export class TXESession implements TXESessionStateHandler {
371
384
  // be removed from the database.
372
385
  // TODO(#12553): make the synchronizer sync here instead and remove this
373
386
  await new NoteService(
374
- this.noteDataProvider,
387
+ this.noteStore,
375
388
  this.stateMachine.node,
376
- this.stateMachine.anchorBlockDataProvider,
389
+ this.stateMachine.anchorBlockStore,
377
390
  ).syncNoteNullifiers(contractAddress);
378
391
 
379
- const anchorBlockHeader = await this.stateMachine.anchorBlockDataProvider.getBlockHeader();
392
+ const anchorBlockHeader = await this.stateMachine.anchorBlockStore.getBlockHeader();
380
393
 
381
394
  this.oracleHandler = new UtilityExecutionOracle(
382
395
  contractAddress,
383
396
  [],
384
397
  [],
385
398
  anchorBlockHeader,
386
- this.contractDataProvider,
387
- this.noteDataProvider,
399
+ this.contractStore,
400
+ this.noteStore,
388
401
  this.keyStore,
389
- this.addressDataProvider,
402
+ this.addressStore,
390
403
  this.stateMachine.node,
391
- this.stateMachine.anchorBlockDataProvider,
392
- this.senderTaggingDataProvider,
393
- this.recipientTaggingDataProvider,
394
- this.capsuleDataProvider,
395
- this.privateEventDataProvider,
404
+ this.stateMachine.anchorBlockStore,
405
+ this.recipientTaggingStore,
406
+ this.senderAddressBookStore,
407
+ this.capsuleStore,
408
+ this.privateEventStore,
409
+ TXE_JOB_ID,
396
410
  );
397
411
 
398
412
  this.state = { name: 'UTILITY' };
@@ -463,4 +477,49 @@ export class TXESession implements TXESessionStateHandler {
463
477
  throw new Error(`Expected to be in state 'UTILITY', but got '${this.state.name}' instead`);
464
478
  }
465
479
  }
480
+
481
+ private utilityExecutorForContractSync(anchorBlock: any) {
482
+ return async (call: FunctionCall) => {
483
+ const entryPointArtifact = await this.contractStore.getFunctionArtifactWithDebugMetadata(call.to, call.selector);
484
+ if (entryPointArtifact.functionType !== FunctionType.UTILITY) {
485
+ throw new Error(`Cannot run ${entryPointArtifact.functionType} function as utility`);
486
+ }
487
+
488
+ try {
489
+ const oracle = new UtilityExecutionOracle(
490
+ call.to,
491
+ [],
492
+ [],
493
+ anchorBlock!,
494
+ this.contractStore,
495
+ this.noteStore,
496
+ this.keyStore,
497
+ this.addressStore,
498
+ this.stateMachine.node,
499
+ this.stateMachine.anchorBlockStore,
500
+ this.recipientTaggingStore,
501
+ this.senderAddressBookStore,
502
+ this.capsuleStore,
503
+ this.privateEventStore,
504
+ TXE_JOB_ID,
505
+ );
506
+ await new WASMSimulator()
507
+ .executeUserCircuit(toACVMWitness(0, call.args), entryPointArtifact, new Oracle(oracle).toACIRCallback())
508
+ .catch((err: Error) => {
509
+ err.message = resolveAssertionMessageFromError(err, entryPointArtifact);
510
+ throw new ExecutionError(
511
+ err.message,
512
+ {
513
+ contractAddress: call.to,
514
+ functionSelector: call.selector,
515
+ },
516
+ extractCallStack(err, entryPointArtifact.debug),
517
+ { cause: err },
518
+ );
519
+ });
520
+ } catch (err) {
521
+ throw createSimulationError(err instanceof Error ? err : new Error('Unknown error contract data sync'));
522
+ }
523
+ };
524
+ }
466
525
  }
@@ -2,7 +2,7 @@ import type { AztecAsyncKVStore, AztecAsyncMap } from '@aztec/kv-store';
2
2
  import type { AztecAddress } from '@aztec/stdlib/aztec-address';
3
3
  import { CompleteAddress } from '@aztec/stdlib/contract';
4
4
 
5
- export class TXEAccountDataProvider {
5
+ export class TXEAccountStore {
6
6
  #accounts: AztecAsyncMap<string, Buffer>;
7
7
 
8
8
  constructor(store: AztecAsyncKVStore) {
@@ -1,15 +1,15 @@
1
1
  import type { ContractArtifact } from '@aztec/aztec.js/abi';
2
2
  import { Fr } from '@aztec/aztec.js/fields';
3
- import { ContractDataProvider } from '@aztec/pxe/server';
3
+ import { ContractStore } from '@aztec/pxe/server';
4
4
 
5
5
  export type ContractArtifactWithHash = ContractArtifact & { artifactHash: Fr };
6
6
 
7
7
  /*
8
- * A contract data provider that stores contract artifacts with their hashes. Since
8
+ * A contract store that stores contract artifacts with their hashes. Since
9
9
  * TXE typically deploys the same contract again and again for multiple tests, caching
10
10
  * the *very* expensive artifact hash computation improves testing speed significantly.
11
11
  */
12
- export class TXEContractDataProvider extends ContractDataProvider {
12
+ export class TXEContractStore extends ContractStore {
13
13
  #artifactHashes: Map<string, Buffer> = new Map();
14
14
 
15
15
  public override async addContractArtifact(
@@ -1,6 +1,6 @@
1
1
  import { BlockNumber } from '@aztec/foundation/branded-types';
2
2
  import { Fr } from '@aztec/foundation/curves/bn254';
3
- import type { ContractDataProvider } from '@aztec/pxe/server';
3
+ import type { ContractStore } from '@aztec/pxe/server';
4
4
  import { type ContractArtifact, FunctionSelector, FunctionType } from '@aztec/stdlib/abi';
5
5
  import type { AztecAddress } from '@aztec/stdlib/aztec-address';
6
6
  import {
@@ -16,7 +16,7 @@ export class TXEPublicContractDataSource implements ContractDataSource {
16
16
  #privateFunctionsRoot: Map<string, Buffer> = new Map();
17
17
  constructor(
18
18
  private blockNumber: BlockNumber,
19
- private contractDataProvider: ContractDataProvider,
19
+ private contractStore: ContractStore,
20
20
  ) {}
21
21
 
22
22
  getBlockNumber(): Promise<BlockNumber> {
@@ -24,11 +24,11 @@ export class TXEPublicContractDataSource implements ContractDataSource {
24
24
  }
25
25
 
26
26
  async getContractClass(id: Fr): Promise<ContractClassPublic | undefined> {
27
- const contractClass = await this.contractDataProvider.getContractClass(id);
27
+ const contractClass = await this.contractStore.getContractClass(id);
28
28
  if (!contractClass) {
29
29
  return;
30
30
  }
31
- const artifact = await this.contractDataProvider.getContractArtifact(id);
31
+ const artifact = await this.contractStore.getContractArtifact(id);
32
32
  if (!artifact) {
33
33
  return;
34
34
  }
@@ -58,12 +58,12 @@ export class TXEPublicContractDataSource implements ContractDataSource {
58
58
  }
59
59
 
60
60
  async getBytecodeCommitment(id: Fr): Promise<Fr | undefined> {
61
- const contractClass = await this.contractDataProvider.getContractClass(id);
61
+ const contractClass = await this.contractStore.getContractClass(id);
62
62
  return contractClass && computePublicBytecodeCommitment(contractClass.packedBytecode);
63
63
  }
64
64
 
65
65
  async getContract(address: AztecAddress): Promise<ContractInstanceWithAddress | undefined> {
66
- const instance = await this.contractDataProvider.getContractInstance(address);
66
+ const instance = await this.contractStore.getContractInstance(address);
67
67
  return instance && { ...instance, address };
68
68
  }
69
69
 
@@ -72,12 +72,12 @@ export class TXEPublicContractDataSource implements ContractDataSource {
72
72
  }
73
73
 
74
74
  async getContractArtifact(address: AztecAddress): Promise<ContractArtifact | undefined> {
75
- const instance = await this.contractDataProvider.getContractInstance(address);
76
- return instance && this.contractDataProvider.getContractArtifact(instance.currentContractClassId);
75
+ const instance = await this.contractStore.getContractInstance(address);
76
+ return instance && this.contractStore.getContractArtifact(instance.currentContractClassId);
77
77
  }
78
78
 
79
79
  async getDebugFunctionName(address: AztecAddress, selector: FunctionSelector): Promise<string | undefined> {
80
- return await this.contractDataProvider.getDebugFunctionName(address, selector);
80
+ return await this.contractStore.getDebugFunctionName(address, selector);
81
81
  }
82
82
 
83
83
  registerContractFunctionSignatures(_signatures: []): Promise<void> {
@@ -8,7 +8,6 @@ import { BlockNumber } from '@aztec/foundation/branded-types';
8
8
  import { padArrayEnd } from '@aztec/foundation/collection';
9
9
  import { Fr } from '@aztec/foundation/curves/bn254';
10
10
  import { Body, L2Block, L2BlockHeader } from '@aztec/stdlib/block';
11
- import { makeContentCommitment } from '@aztec/stdlib/testing';
12
11
  import { AppendOnlyTreeSnapshot, MerkleTreeId, type MerkleTreeWriteOperations } from '@aztec/stdlib/trees';
13
12
  import { GlobalVariables, TxEffect } from '@aztec/stdlib/tx';
14
13
 
@@ -53,7 +52,8 @@ export async function makeTXEBlockHeader(
53
52
 
54
53
  return new L2BlockHeader(
55
54
  new AppendOnlyTreeSnapshot(new Fr(archiveInfo.root), Number(archiveInfo.size)),
56
- makeContentCommitment(),
55
+ Fr.ZERO,
56
+ Fr.ZERO,
57
57
  stateReference,
58
58
  globalVariables,
59
59
  Fr.ZERO,
@@ -1,10 +0,0 @@
1
- import type { AztecAsyncKVStore } from '@aztec/kv-store';
2
- import type { AztecAddress } from '@aztec/stdlib/aztec-address';
3
- import { CompleteAddress } from '@aztec/stdlib/contract';
4
- export declare class TXEAccountDataProvider {
5
- #private;
6
- constructor(store: AztecAsyncKVStore);
7
- getAccount(key: AztecAddress): Promise<CompleteAddress>;
8
- setAccount(key: AztecAddress, value: CompleteAddress): Promise<void>;
9
- }
10
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidHhlX2FjY291bnRfZGF0YV9wcm92aWRlci5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL3V0aWwvdHhlX2FjY291bnRfZGF0YV9wcm92aWRlci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEtBQUssRUFBRSxpQkFBaUIsRUFBaUIsTUFBTSxpQkFBaUIsQ0FBQztBQUN4RSxPQUFPLEtBQUssRUFBRSxZQUFZLEVBQUUsTUFBTSw2QkFBNkIsQ0FBQztBQUNoRSxPQUFPLEVBQUUsZUFBZSxFQUFFLE1BQU0sd0JBQXdCLENBQUM7QUFFekQscUJBQWEsc0JBQXNCOztJQUdqQyxZQUFZLEtBQUssRUFBRSxpQkFBaUIsRUFFbkM7SUFFSyxVQUFVLENBQUMsR0FBRyxFQUFFLFlBQVksNEJBTWpDO0lBRUssVUFBVSxDQUFDLEdBQUcsRUFBRSxZQUFZLEVBQUUsS0FBSyxFQUFFLGVBQWUsaUJBRXpEO0NBQ0YifQ==
@@ -1 +0,0 @@
1
- {"version":3,"file":"txe_account_data_provider.d.ts","sourceRoot":"","sources":["../../src/util/txe_account_data_provider.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAiB,MAAM,iBAAiB,CAAC;AACxE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAEzD,qBAAa,sBAAsB;;IAGjC,YAAY,KAAK,EAAE,iBAAiB,EAEnC;IAEK,UAAU,CAAC,GAAG,EAAE,YAAY,4BAMjC;IAEK,UAAU,CAAC,GAAG,EAAE,YAAY,EAAE,KAAK,EAAE,eAAe,iBAEzD;CACF"}
@@ -1,12 +0,0 @@
1
- import type { ContractArtifact } from '@aztec/aztec.js/abi';
2
- import { Fr } from '@aztec/aztec.js/fields';
3
- import { ContractDataProvider } from '@aztec/pxe/server';
4
- export type ContractArtifactWithHash = ContractArtifact & {
5
- artifactHash: Fr;
6
- };
7
- export declare class TXEContractDataProvider extends ContractDataProvider {
8
- #private;
9
- addContractArtifact(id: Fr, artifact: ContractArtifact | ContractArtifactWithHash): Promise<void>;
10
- getContractArtifact(contractClassId: Fr): Promise<ContractArtifact | ContractArtifactWithHash | undefined>;
11
- }
12
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidHhlX2NvbnRyYWN0X2RhdGFfcHJvdmlkZXIuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy91dGlsL3R4ZV9jb250cmFjdF9kYXRhX3Byb3ZpZGVyLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sS0FBSyxFQUFFLGdCQUFnQixFQUFFLE1BQU0scUJBQXFCLENBQUM7QUFDNUQsT0FBTyxFQUFFLEVBQUUsRUFBRSxNQUFNLHdCQUF3QixDQUFDO0FBQzVDLE9BQU8sRUFBRSxvQkFBb0IsRUFBRSxNQUFNLG1CQUFtQixDQUFDO0FBRXpELE1BQU0sTUFBTSx3QkFBd0IsR0FBRyxnQkFBZ0IsR0FBRztJQUFFLFlBQVksRUFBRSxFQUFFLENBQUE7Q0FBRSxDQUFDO0FBTy9FLHFCQUFhLHVCQUF3QixTQUFRLG9CQUFvQjs7SUFHekMsbUJBQW1CLENBQ3ZDLEVBQUUsRUFBRSxFQUFFLEVBQ04sUUFBUSxFQUFFLGdCQUFnQixHQUFHLHdCQUF3QixHQUNwRCxPQUFPLENBQUMsSUFBSSxDQUFDLENBS2Y7SUFFcUIsbUJBQW1CLENBQ3ZDLGVBQWUsRUFBRSxFQUFFLEdBQ2xCLE9BQU8sQ0FBQyxnQkFBZ0IsR0FBRyx3QkFBd0IsR0FBRyxTQUFTLENBQUMsQ0FRbEU7Q0FDRiJ9
@@ -1 +0,0 @@
1
- {"version":3,"file":"txe_contract_data_provider.d.ts","sourceRoot":"","sources":["../../src/util/txe_contract_data_provider.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,EAAE,EAAE,EAAE,MAAM,wBAAwB,CAAC;AAC5C,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAEzD,MAAM,MAAM,wBAAwB,GAAG,gBAAgB,GAAG;IAAE,YAAY,EAAE,EAAE,CAAA;CAAE,CAAC;AAO/E,qBAAa,uBAAwB,SAAQ,oBAAoB;;IAGzC,mBAAmB,CACvC,EAAE,EAAE,EAAE,EACN,QAAQ,EAAE,gBAAgB,GAAG,wBAAwB,GACpD,OAAO,CAAC,IAAI,CAAC,CAKf;IAEqB,mBAAmB,CACvC,eAAe,EAAE,EAAE,GAClB,OAAO,CAAC,gBAAgB,GAAG,wBAAwB,GAAG,SAAS,CAAC,CAQlE;CACF"}