@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
@@ -3,22 +3,22 @@ import { FunctionType } from '@aztec/stdlib/abi';
3
3
  import { computePrivateFunctionsRoot, computePublicBytecodeCommitment, getContractClassPrivateFunctionFromArtifact } from '@aztec/stdlib/contract';
4
4
  export class TXEPublicContractDataSource {
5
5
  blockNumber;
6
- contractDataProvider;
6
+ contractStore;
7
7
  #privateFunctionsRoot;
8
- constructor(blockNumber, contractDataProvider){
8
+ constructor(blockNumber, contractStore){
9
9
  this.blockNumber = blockNumber;
10
- this.contractDataProvider = contractDataProvider;
10
+ this.contractStore = contractStore;
11
11
  this.#privateFunctionsRoot = new Map();
12
12
  }
13
13
  getBlockNumber() {
14
14
  return Promise.resolve(this.blockNumber);
15
15
  }
16
16
  async getContractClass(id) {
17
- const contractClass = await this.contractDataProvider.getContractClass(id);
17
+ const contractClass = await this.contractStore.getContractClass(id);
18
18
  if (!contractClass) {
19
19
  return;
20
20
  }
21
- const artifact = await this.contractDataProvider.getContractArtifact(id);
21
+ const artifact = await this.contractStore.getContractArtifact(id);
22
22
  if (!artifact) {
23
23
  return;
24
24
  }
@@ -41,11 +41,11 @@ export class TXEPublicContractDataSource {
41
41
  };
42
42
  }
43
43
  async getBytecodeCommitment(id) {
44
- const contractClass = await this.contractDataProvider.getContractClass(id);
44
+ const contractClass = await this.contractStore.getContractClass(id);
45
45
  return contractClass && computePublicBytecodeCommitment(contractClass.packedBytecode);
46
46
  }
47
47
  async getContract(address) {
48
- const instance = await this.contractDataProvider.getContractInstance(address);
48
+ const instance = await this.contractStore.getContractInstance(address);
49
49
  return instance && {
50
50
  ...instance,
51
51
  address
@@ -55,11 +55,11 @@ export class TXEPublicContractDataSource {
55
55
  throw new Error('Method not implemented.');
56
56
  }
57
57
  async getContractArtifact(address) {
58
- const instance = await this.contractDataProvider.getContractInstance(address);
59
- return instance && this.contractDataProvider.getContractArtifact(instance.currentContractClassId);
58
+ const instance = await this.contractStore.getContractInstance(address);
59
+ return instance && this.contractStore.getContractArtifact(instance.currentContractClassId);
60
60
  }
61
61
  async getDebugFunctionName(address, selector) {
62
- return await this.contractDataProvider.getDebugFunctionName(address, selector);
62
+ return await this.contractStore.getDebugFunctionName(address, selector);
63
63
  }
64
64
  registerContractFunctionSignatures(_signatures) {
65
65
  return Promise.resolve();
@@ -25,4 +25,4 @@ export declare function makeTXEBlockHeader(worldTrees: MerkleTreeWriteOperations
25
25
  * @returns The created L2Block with proper archive chaining
26
26
  */
27
27
  export declare function makeTXEBlock(worldTrees: MerkleTreeWriteOperations, globalVariables: GlobalVariables, txEffects: TxEffect[]): Promise<L2Block>;
28
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYmxvY2tfY3JlYXRpb24uZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3V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CAChD,QAAQ,EAAE,QAAQ,EAClB,UAAU,EAAE,yBAAyB,GACpC,OAAO,CAAC,IAAI,CAAC,CAkBf;AAED,wBAAsB,kBAAkB,CACtC,UAAU,EAAE,yBAAyB,EACrC,eAAe,EAAE,eAAe,GAC/B,OAAO,CAAC,aAAa,CAAC,CAexB;AAED;;;;;;;;;;;;GAYG;AACH,wBAAsB,YAAY,CAChC,UAAU,EAAE,yBAAyB,EACrC,eAAe,EAAE,eAAe,EAChC,SAAS,EAAE,QAAQ,EAAE,GACpB,OAAO,CAAC,OAAO,CAAC,CAWlB"}
@@ -2,7 +2,6 @@ import { MAX_NOTE_HASHES_PER_TX, MAX_NULLIFIERS_PER_TX, NULLIFIER_SUBTREE_HEIGHT
2
2
  import { padArrayEnd } from '@aztec/foundation/collection';
3
3
  import { Fr } from '@aztec/foundation/curves/bn254';
4
4
  import { Body, L2Block, L2BlockHeader } from '@aztec/stdlib/block';
5
- import { makeContentCommitment } from '@aztec/stdlib/testing';
6
5
  import { AppendOnlyTreeSnapshot, MerkleTreeId } from '@aztec/stdlib/trees';
7
6
  /**
8
7
  * Returns a transaction request hash that is valid for transactions that are the only ones in a block.
@@ -20,7 +19,7 @@ export async function insertTxEffectIntoWorldTrees(txEffect, worldTrees) {
20
19
  export async function makeTXEBlockHeader(worldTrees, globalVariables) {
21
20
  const stateReference = await worldTrees.getStateReference();
22
21
  const archiveInfo = await worldTrees.getTreeInfo(MerkleTreeId.ARCHIVE);
23
- return new L2BlockHeader(new AppendOnlyTreeSnapshot(new Fr(archiveInfo.root), Number(archiveInfo.size)), makeContentCommitment(), stateReference, globalVariables, Fr.ZERO, Fr.ZERO, Fr.ZERO, Fr.ZERO);
22
+ return new L2BlockHeader(new AppendOnlyTreeSnapshot(new Fr(archiveInfo.root), Number(archiveInfo.size)), Fr.ZERO, Fr.ZERO, stateReference, globalVariables, Fr.ZERO, Fr.ZERO, Fr.ZERO, Fr.ZERO);
24
23
  }
25
24
  /**
26
25
  * Creates an L2Block with proper archive chaining.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aztec/txe",
3
- "version": "0.0.1-commit.03f7ef2",
3
+ "version": "0.0.1-commit.1142ef1",
4
4
  "type": "module",
5
5
  "exports": "./dest/index.js",
6
6
  "bin": "./dest/bin/index.js",
@@ -61,20 +61,20 @@
61
61
  ]
62
62
  },
63
63
  "dependencies": {
64
- "@aztec/accounts": "0.0.1-commit.03f7ef2",
65
- "@aztec/archiver": "0.0.1-commit.03f7ef2",
66
- "@aztec/aztec-node": "0.0.1-commit.03f7ef2",
67
- "@aztec/aztec.js": "0.0.1-commit.03f7ef2",
68
- "@aztec/bb-prover": "0.0.1-commit.03f7ef2",
69
- "@aztec/constants": "0.0.1-commit.03f7ef2",
70
- "@aztec/foundation": "0.0.1-commit.03f7ef2",
71
- "@aztec/key-store": "0.0.1-commit.03f7ef2",
72
- "@aztec/kv-store": "0.0.1-commit.03f7ef2",
73
- "@aztec/protocol-contracts": "0.0.1-commit.03f7ef2",
74
- "@aztec/pxe": "0.0.1-commit.03f7ef2",
75
- "@aztec/simulator": "0.0.1-commit.03f7ef2",
76
- "@aztec/stdlib": "0.0.1-commit.03f7ef2",
77
- "@aztec/world-state": "0.0.1-commit.03f7ef2",
64
+ "@aztec/accounts": "0.0.1-commit.1142ef1",
65
+ "@aztec/archiver": "0.0.1-commit.1142ef1",
66
+ "@aztec/aztec-node": "0.0.1-commit.1142ef1",
67
+ "@aztec/aztec.js": "0.0.1-commit.1142ef1",
68
+ "@aztec/bb-prover": "0.0.1-commit.1142ef1",
69
+ "@aztec/constants": "0.0.1-commit.1142ef1",
70
+ "@aztec/foundation": "0.0.1-commit.1142ef1",
71
+ "@aztec/key-store": "0.0.1-commit.1142ef1",
72
+ "@aztec/kv-store": "0.0.1-commit.1142ef1",
73
+ "@aztec/protocol-contracts": "0.0.1-commit.1142ef1",
74
+ "@aztec/pxe": "0.0.1-commit.1142ef1",
75
+ "@aztec/simulator": "0.0.1-commit.1142ef1",
76
+ "@aztec/stdlib": "0.0.1-commit.1142ef1",
77
+ "@aztec/world-state": "0.0.1-commit.1142ef1",
78
78
  "zod": "^3.23.8"
79
79
  },
80
80
  "devDependencies": {
@@ -0,0 +1,4 @@
1
+ import { AztecAddress } from '@aztec/stdlib/aztec-address';
2
+
3
+ export const DEFAULT_ADDRESS = AztecAddress.fromNumber(42);
4
+ export const TXE_JOB_ID = 'test-job-id';
package/src/index.ts CHANGED
@@ -33,7 +33,7 @@ import {
33
33
  fromSingle,
34
34
  toSingle,
35
35
  } from './util/encoding.js';
36
- import type { ContractArtifactWithHash } from './util/txe_contract_data_provider.js';
36
+ import type { ContractArtifactWithHash } from './util/txe_contract_store.js';
37
37
 
38
38
  const sessions = new Map<number, TXESession>();
39
39
 
@@ -13,13 +13,14 @@ import { LogLevels, type Logger, applyStringFormatting, createLogger } from '@az
13
13
  import { TestDateProvider } from '@aztec/foundation/timer';
14
14
  import type { KeyStore } from '@aztec/key-store';
15
15
  import {
16
- AddressDataProvider,
17
- CapsuleDataProvider,
18
- NoteDataProvider,
16
+ AddressStore,
17
+ CapsuleStore,
18
+ NoteStore,
19
19
  ORACLE_VERSION,
20
- PrivateEventDataProvider,
21
- RecipientTaggingDataProvider,
22
- SenderTaggingDataProvider,
20
+ PrivateEventStore,
21
+ RecipientTaggingStore,
22
+ SenderAddressBookStore,
23
+ SenderTaggingStore,
23
24
  enrichPublicSimulationError,
24
25
  } from '@aztec/pxe/server';
25
26
  import {
@@ -48,7 +49,7 @@ import {
48
49
  PublicContractsDB,
49
50
  PublicProcessor,
50
51
  } from '@aztec/simulator/server';
51
- import { type ContractArtifact, EventSelector, FunctionSelector, FunctionType } from '@aztec/stdlib/abi';
52
+ import { type ContractArtifact, EventSelector, FunctionCall, FunctionSelector, FunctionType } from '@aztec/stdlib/abi';
52
53
  import { AuthWitness } from '@aztec/stdlib/auth-witness';
53
54
  import { PublicSimulatorConfig } from '@aztec/stdlib/avm';
54
55
  import { AztecAddress } from '@aztec/stdlib/aztec-address';
@@ -79,10 +80,10 @@ import {
79
80
  import type { UInt64 } from '@aztec/stdlib/types';
80
81
  import { ForkCheckpoint } from '@aztec/world-state';
81
82
 
83
+ import { DEFAULT_ADDRESS, TXE_JOB_ID } from '../constants.js';
82
84
  import type { TXEStateMachine } from '../state_machine/index.js';
83
- import { DEFAULT_ADDRESS } from '../txe_session.js';
84
- import type { TXEAccountDataProvider } from '../util/txe_account_data_provider.js';
85
- import type { TXEContractDataProvider } from '../util/txe_contract_data_provider.js';
85
+ import type { TXEAccountStore } from '../util/txe_account_store.js';
86
+ import type { TXEContractStore } from '../util/txe_contract_store.js';
86
87
  import { TXEPublicContractDataSource } from '../util/txe_public_contract_data_source.js';
87
88
  import { getSingleTxBlockRequestHash, insertTxEffectIntoWorldTrees, makeTXEBlock } from '../utils/block_creation.js';
88
89
  import type { ITxeExecutionOracle } from './interfaces.js';
@@ -95,15 +96,16 @@ export class TXEOracleTopLevelContext implements IMiscOracle, ITxeExecutionOracl
95
96
 
96
97
  constructor(
97
98
  private stateMachine: TXEStateMachine,
98
- private contractDataProvider: TXEContractDataProvider,
99
- private noteDataProvider: NoteDataProvider,
99
+ private contractStore: TXEContractStore,
100
+ private noteStore: NoteStore,
100
101
  private keyStore: KeyStore,
101
- private addressDataProvider: AddressDataProvider,
102
- private accountDataProvider: TXEAccountDataProvider,
103
- private senderTaggingDataProvider: SenderTaggingDataProvider,
104
- private recipientTaggingDataProvider: RecipientTaggingDataProvider,
105
- private capsuleDataProvider: CapsuleDataProvider,
106
- private privateEventDataProvider: PrivateEventDataProvider,
102
+ private addressStore: AddressStore,
103
+ private accountStore: TXEAccountStore,
104
+ private senderTaggingStore: SenderTaggingStore,
105
+ private recipientTaggingStore: RecipientTaggingStore,
106
+ private senderAddressBookStore: SenderAddressBookStore,
107
+ private capsuleStore: CapsuleStore,
108
+ private privateEventStore: PrivateEventStore,
107
109
  private nextBlockTimestamp: bigint,
108
110
  private version: Fr,
109
111
  private chainId: Fr,
@@ -168,7 +170,7 @@ export class TXEOracleTopLevelContext implements IMiscOracle, ITxeExecutionOracl
168
170
 
169
171
  async txeGetPrivateEvents(selector: EventSelector, contractAddress: AztecAddress, scope: AztecAddress) {
170
172
  return (
171
- await this.privateEventDataProvider.getPrivateEvents(selector, {
173
+ await this.privateEventStore.getPrivateEvents(selector, {
172
174
  contractAddress,
173
175
  scopes: [scope],
174
176
  fromBlock: 0,
@@ -204,8 +206,8 @@ export class TXEOracleTopLevelContext implements IMiscOracle, ITxeExecutionOracl
204
206
  if (!secret.equals(Fr.ZERO)) {
205
207
  await this.txeAddAccount(artifact, instance, secret);
206
208
  } else {
207
- await this.contractDataProvider.addContractInstance(instance);
208
- await this.contractDataProvider.addContractArtifact(instance.currentContractClassId, artifact);
209
+ await this.contractStore.addContractInstance(instance);
210
+ await this.contractStore.addContractArtifact(instance.currentContractClassId, artifact);
209
211
  this.logger.debug(`Deployed ${artifact.name} at ${instance.address}`);
210
212
  }
211
213
  }
@@ -214,12 +216,12 @@ export class TXEOracleTopLevelContext implements IMiscOracle, ITxeExecutionOracl
214
216
  const partialAddress = await computePartialAddress(instance);
215
217
 
216
218
  this.logger.debug(`Deployed ${artifact.name} at ${instance.address}`);
217
- await this.contractDataProvider.addContractInstance(instance);
218
- await this.contractDataProvider.addContractArtifact(instance.currentContractClassId, artifact);
219
+ await this.contractStore.addContractInstance(instance);
220
+ await this.contractStore.addContractArtifact(instance.currentContractClassId, artifact);
219
221
 
220
222
  const completeAddress = await this.keyStore.addAccount(secret, partialAddress);
221
- await this.accountDataProvider.setAccount(completeAddress.address, completeAddress);
222
- await this.addressDataProvider.addCompleteAddress(completeAddress);
223
+ await this.accountStore.setAccount(completeAddress.address, completeAddress);
224
+ await this.addressStore.addCompleteAddress(completeAddress);
223
225
  this.logger.debug(`Created account ${completeAddress.address}`);
224
226
 
225
227
  return completeAddress;
@@ -228,15 +230,15 @@ export class TXEOracleTopLevelContext implements IMiscOracle, ITxeExecutionOracl
228
230
  async txeCreateAccount(secret: Fr) {
229
231
  // This is a foot gun !
230
232
  const completeAddress = await this.keyStore.addAccount(secret, secret);
231
- await this.accountDataProvider.setAccount(completeAddress.address, completeAddress);
232
- await this.addressDataProvider.addCompleteAddress(completeAddress);
233
+ await this.accountStore.setAccount(completeAddress.address, completeAddress);
234
+ await this.addressStore.addCompleteAddress(completeAddress);
233
235
  this.logger.debug(`Created account ${completeAddress.address}`);
234
236
 
235
237
  return completeAddress;
236
238
  }
237
239
 
238
240
  async txeAddAuthWitness(address: AztecAddress, messageHash: Fr) {
239
- const account = await this.accountDataProvider.getAccount(address);
241
+ const account = await this.accountStore.getAccount(address);
240
242
  const privateKey = await this.keyStore.getMasterSecretKey(account.publicKeys.masterIncomingViewingPublicKey);
241
243
 
242
244
  const schnorr = new Schnorr();
@@ -281,10 +283,10 @@ export class TXEOracleTopLevelContext implements IMiscOracle, ITxeExecutionOracl
281
283
  isStaticCall: boolean = false,
282
284
  ) {
283
285
  this.logger.verbose(
284
- `Executing external function ${await this.contractDataProvider.getDebugFunctionName(targetContractAddress, functionSelector)}@${targetContractAddress} isStaticCall=${isStaticCall}`,
286
+ `Executing external function ${await this.contractStore.getDebugFunctionName(targetContractAddress, functionSelector)}@${targetContractAddress} isStaticCall=${isStaticCall}`,
285
287
  );
286
288
 
287
- const artifact = await this.contractDataProvider.getFunctionArtifact(targetContractAddress, functionSelector);
289
+ const artifact = await this.contractStore.getFunctionArtifact(targetContractAddress, functionSelector);
288
290
  if (!artifact) {
289
291
  const message = functionSelector.equals(await FunctionSelector.fromSignature('verify_private_authwit(Field)'))
290
292
  ? 'Found no account contract artifact for a private authwit check - use `create_contract_account` instead of `create_light_account` for authwit support.'
@@ -292,19 +294,24 @@ export class TXEOracleTopLevelContext implements IMiscOracle, ITxeExecutionOracl
292
294
  throw new Error(message);
293
295
  }
294
296
 
297
+ // Sync notes before executing private function to discover notes from previous transactions
298
+ const utilityExecutor = async (call: FunctionCall) => {
299
+ await this.executeUtilityCall(call);
300
+ };
301
+
302
+ await this.contractStore.syncPrivateState(targetContractAddress, functionSelector, utilityExecutor);
303
+
295
304
  const blockNumber = await this.txeGetNextBlockNumber();
296
305
 
297
306
  const callContext = new CallContext(from, targetContractAddress, functionSelector, isStaticCall);
298
307
 
299
308
  const gasLimits = new Gas(DEFAULT_DA_GAS_LIMIT, DEFAULT_L2_GAS_LIMIT);
300
-
301
309
  const teardownGasLimits = new Gas(DEFAULT_TEARDOWN_DA_GAS_LIMIT, DEFAULT_TEARDOWN_L2_GAS_LIMIT);
302
-
303
310
  const gasSettings = new GasSettings(gasLimits, teardownGasLimits, GasFees.empty(), GasFees.empty());
304
311
 
305
312
  const txContext = new TxContext(this.chainId, this.version, gasSettings);
306
313
 
307
- const blockHeader = await this.stateMachine.anchorBlockDataProvider.getBlockHeader();
314
+ const blockHeader = await this.stateMachine.anchorBlockStore.getBlockHeader();
308
315
 
309
316
  const protocolNullifier = await computeProtocolNullifier(getSingleTxBlockRequestHash(blockNumber));
310
317
  const noteCache = new ExecutionNoteCache(protocolNullifier);
@@ -318,6 +325,7 @@ export class TXEOracleTopLevelContext implements IMiscOracle, ITxeExecutionOracl
318
325
  callContext,
319
326
  /** Header of a block whose state is used during private execution (not the block the transaction is included in). */
320
327
  blockHeader,
328
+ utilityExecutor,
321
329
  /** List of transient auth witnesses to be used during this simulation */
322
330
  Array.from(this.authwits.values()),
323
331
  /** List of transient auth witnesses to be used during this simulation */
@@ -325,16 +333,18 @@ export class TXEOracleTopLevelContext implements IMiscOracle, ITxeExecutionOracl
325
333
  HashedValuesCache.create([new HashedValues(args, argsHash)]),
326
334
  noteCache,
327
335
  taggingIndexCache,
328
- this.contractDataProvider,
329
- this.noteDataProvider,
336
+ this.contractStore,
337
+ this.noteStore,
330
338
  this.keyStore,
331
- this.addressDataProvider,
339
+ this.addressStore,
332
340
  this.stateMachine.node,
333
- this.stateMachine.anchorBlockDataProvider,
334
- this.senderTaggingDataProvider,
335
- this.recipientTaggingDataProvider,
336
- this.capsuleDataProvider,
337
- this.privateEventDataProvider,
341
+ this.stateMachine.anchorBlockStore,
342
+ this.senderTaggingStore,
343
+ this.recipientTaggingStore,
344
+ this.senderAddressBookStore,
345
+ this.capsuleStore,
346
+ this.privateEventStore,
347
+ TXE_JOB_ID,
338
348
  0,
339
349
  1,
340
350
  undefined, // log
@@ -384,7 +394,7 @@ export class TXEOracleTopLevelContext implements IMiscOracle, ITxeExecutionOracl
384
394
  // can either be the first nullifier in the tx or the hash of the initial tx request
385
395
  // if there are none.
386
396
  const nonceGenerator = result.firstNullifier.equals(Fr.ZERO) ? protocolNullifier : result.firstNullifier;
387
- const { publicInputs } = await generateSimulatedProvingResult(result, nonceGenerator, this.contractDataProvider);
397
+ const { publicInputs } = await generateSimulatedProvingResult(result, nonceGenerator, this.contractStore);
388
398
 
389
399
  const globals = makeGlobalVariables();
390
400
  globals.blockNumber = blockNumber;
@@ -395,7 +405,7 @@ export class TXEOracleTopLevelContext implements IMiscOracle, ITxeExecutionOracl
395
405
 
396
406
  const forkedWorldTrees = await this.stateMachine.synchronizer.nativeWorldStateService.fork();
397
407
 
398
- const contractsDB = new PublicContractsDB(new TXEPublicContractDataSource(blockNumber, this.contractDataProvider));
408
+ const contractsDB = new PublicContractsDB(new TXEPublicContractDataSource(blockNumber, this.contractStore));
399
409
  const guardedMerkleTrees = new GuardedMerkleTreeOperations(forkedWorldTrees);
400
410
  const config = PublicSimulatorConfig.from({
401
411
  skipFeeEnforcement: true,
@@ -434,7 +444,7 @@ export class TXEOracleTopLevelContext implements IMiscOracle, ITxeExecutionOracl
434
444
  } else if (!processedTx.revertCode.isOK()) {
435
445
  if (processedTx.revertReason) {
436
446
  try {
437
- await enrichPublicSimulationError(processedTx.revertReason, this.contractDataProvider, this.logger);
447
+ await enrichPublicSimulationError(processedTx.revertReason, this.contractStore, this.logger);
438
448
  // eslint-disable-next-line no-empty
439
449
  } catch {}
440
450
  throw new Error(`Contract execution has reverted: ${processedTx.revertReason.getMessage()}`);
@@ -479,7 +489,7 @@ export class TXEOracleTopLevelContext implements IMiscOracle, ITxeExecutionOracl
479
489
  isStaticCall: boolean,
480
490
  ) {
481
491
  this.logger.verbose(
482
- `Executing public function ${await this.contractDataProvider.getDebugFunctionName(targetContractAddress, FunctionSelector.fromField(calldata[0]))}@${targetContractAddress} isStaticCall=${isStaticCall}`,
492
+ `Executing public function ${await this.contractStore.getDebugFunctionName(targetContractAddress, FunctionSelector.fromField(calldata[0]))}@${targetContractAddress} isStaticCall=${isStaticCall}`,
483
493
  );
484
494
 
485
495
  const blockNumber = await this.txeGetNextBlockNumber();
@@ -492,7 +502,7 @@ export class TXEOracleTopLevelContext implements IMiscOracle, ITxeExecutionOracl
492
502
 
493
503
  const txContext = new TxContext(this.chainId, this.version, gasSettings);
494
504
 
495
- const anchorBlockHeader = await this.stateMachine.anchorBlockDataProvider.getBlockHeader();
505
+ const anchorBlockHeader = await this.stateMachine.anchorBlockStore.getBlockHeader();
496
506
 
497
507
  const calldataHash = await computeCalldataHash(calldata);
498
508
  const calldataHashedValues = new HashedValues(calldata, calldataHash);
@@ -506,7 +516,7 @@ export class TXEOracleTopLevelContext implements IMiscOracle, ITxeExecutionOracl
506
516
 
507
517
  const forkedWorldTrees = await this.stateMachine.synchronizer.nativeWorldStateService.fork();
508
518
 
509
- const contractsDB = new PublicContractsDB(new TXEPublicContractDataSource(blockNumber, this.contractDataProvider));
519
+ const contractsDB = new PublicContractsDB(new TXEPublicContractDataSource(blockNumber, this.contractStore));
510
520
  const guardedMerkleTrees = new GuardedMerkleTreeOperations(forkedWorldTrees);
511
521
  const config = PublicSimulatorConfig.from({
512
522
  skipFeeEnforcement: true,
@@ -574,7 +584,7 @@ export class TXEOracleTopLevelContext implements IMiscOracle, ITxeExecutionOracl
574
584
  } else if (!processedTx.revertCode.isOK()) {
575
585
  if (processedTx.revertReason) {
576
586
  try {
577
- await enrichPublicSimulationError(processedTx.revertReason, this.contractDataProvider, this.logger);
587
+ await enrichPublicSimulationError(processedTx.revertReason, this.contractStore, this.logger);
578
588
  // eslint-disable-next-line no-empty
579
589
  } catch {}
580
590
  throw new Error(`Contract execution has reverted: ${processedTx.revertReason.getMessage()}`);
@@ -620,21 +630,32 @@ export class TXEOracleTopLevelContext implements IMiscOracle, ITxeExecutionOracl
620
630
  functionSelector: FunctionSelector,
621
631
  args: Fr[],
622
632
  ) {
623
- const artifact = await this.contractDataProvider.getFunctionArtifact(targetContractAddress, functionSelector);
633
+ const artifact = await this.contractStore.getFunctionArtifact(targetContractAddress, functionSelector);
624
634
  if (!artifact) {
625
635
  throw new Error(`Cannot call ${functionSelector} as there is no artifact found at ${targetContractAddress}.`);
626
636
  }
627
637
 
628
- const call = {
629
- name: artifact.name,
630
- selector: functionSelector,
631
- to: targetContractAddress,
632
- };
638
+ // Sync notes before executing utility function to discover notes from previous transactions
639
+ await this.contractStore.syncPrivateState(targetContractAddress, functionSelector, async call => {
640
+ await this.executeUtilityCall(call);
641
+ });
633
642
 
634
- const entryPointArtifact = await this.contractDataProvider.getFunctionArtifactWithDebugMetadata(
635
- call.to,
636
- call.selector,
643
+ const call = new FunctionCall(
644
+ artifact.name,
645
+ targetContractAddress,
646
+ functionSelector,
647
+ FunctionType.UTILITY,
648
+ false,
649
+ false,
650
+ args,
651
+ [],
637
652
  );
653
+
654
+ return this.executeUtilityCall(call);
655
+ }
656
+
657
+ private async executeUtilityCall(call: FunctionCall): Promise<Fr[]> {
658
+ const entryPointArtifact = await this.contractStore.getFunctionArtifactWithDebugMetadata(call.to, call.selector);
638
659
  if (entryPointArtifact.functionType !== FunctionType.UTILITY) {
639
660
  throw new Error(`Cannot run ${entryPointArtifact.functionType} function as utility`);
640
661
  }
@@ -645,25 +666,26 @@ export class TXEOracleTopLevelContext implements IMiscOracle, ITxeExecutionOracl
645
666
  });
646
667
 
647
668
  try {
648
- const anchorBlockHeader = await this.stateMachine.anchorBlockDataProvider.getBlockHeader();
669
+ const anchorBlockHeader = await this.stateMachine.anchorBlockStore.getBlockHeader();
649
670
  const oracle = new UtilityExecutionOracle(
650
671
  call.to,
651
672
  [],
652
673
  [],
653
674
  anchorBlockHeader,
654
- this.contractDataProvider,
655
- this.noteDataProvider,
675
+ this.contractStore,
676
+ this.noteStore,
656
677
  this.keyStore,
657
- this.addressDataProvider,
678
+ this.addressStore,
658
679
  this.stateMachine.node,
659
- this.stateMachine.anchorBlockDataProvider,
660
- this.senderTaggingDataProvider,
661
- this.recipientTaggingDataProvider,
662
- this.capsuleDataProvider,
663
- this.privateEventDataProvider,
680
+ this.stateMachine.anchorBlockStore,
681
+ this.recipientTaggingStore,
682
+ this.senderAddressBookStore,
683
+ this.capsuleStore,
684
+ this.privateEventStore,
685
+ TXE_JOB_ID,
664
686
  );
665
687
  const acirExecutionResult = await new WASMSimulator()
666
- .executeUserCircuit(toACVMWitness(0, args), entryPointArtifact, new Oracle(oracle).toACIRCallback())
688
+ .executeUserCircuit(toACVMWitness(0, call.args), entryPointArtifact, new Oracle(oracle).toACIRCallback())
667
689
  .catch((err: Error) => {
668
690
  err.message = resolveAssertionMessageFromError(err, entryPointArtifact);
669
691
  throw new ExecutionError(
@@ -7,14 +7,16 @@ import { isDefined } from '@aztec/foundation/types';
7
7
  import type { AztecAsyncKVStore } from '@aztec/kv-store';
8
8
  import type { AztecAddress } from '@aztec/stdlib/aztec-address';
9
9
  import {
10
+ type CheckpointId,
10
11
  CommitteeAttestation,
11
12
  L2Block,
12
13
  type L2BlockId,
13
14
  type L2BlockNew,
14
15
  type L2BlockSource,
16
+ type L2TipId,
15
17
  type L2Tips,
16
18
  PublishedL2Block,
17
- type ValidateBlockResult,
19
+ type ValidateCheckpointResult,
18
20
  } from '@aztec/stdlib/block';
19
21
  import { Checkpoint, PublishedCheckpoint } from '@aztec/stdlib/checkpoint';
20
22
  import type { ContractInstanceWithAddress } from '@aztec/stdlib/contract';
@@ -48,7 +50,7 @@ export class TXEArchiver extends ArchiverStoreHelper implements L2BlockSource {
48
50
 
49
51
  public override async addCheckpoints(
50
52
  checkpoints: PublishedCheckpoint[],
51
- _result?: ValidateBlockResult,
53
+ _result?: ValidateCheckpointResult,
52
54
  ): Promise<boolean> {
53
55
  const allBlocks = checkpoints.flatMap(ch => ch.checkpoint.blocks);
54
56
  const opResults = await Promise.all([this.store.addLogs(allBlocks), this.store.addCheckpoints(checkpoints)]);
@@ -93,6 +95,16 @@ export class TXEArchiver extends ArchiverStoreHelper implements L2BlockSource {
93
95
  return this.retrievePublishedBlocks(from, limit, proven);
94
96
  }
95
97
 
98
+ async getL2BlocksNew(from: BlockNumber, limit: number, proven?: boolean): Promise<L2BlockNew[]> {
99
+ const blocks = await this.store.getBlocks(from, limit);
100
+
101
+ if (proven === true) {
102
+ const provenBlockNumber = await this.store.getProvenBlockNumber();
103
+ return blocks.filter(b => b.number <= provenBlockNumber);
104
+ }
105
+ return blocks;
106
+ }
107
+
96
108
  private async retrievePublishedBlocks(
97
109
  from: BlockNumber,
98
110
  limit: number,
@@ -211,10 +223,25 @@ export class TXEArchiver extends ArchiverStoreHelper implements L2BlockSource {
211
223
 
212
224
  const number = blockHeader.globalVariables.blockNumber;
213
225
  const hash = (await blockHeader.hash()).toString();
226
+ const checkpointedBlock = await this.getCheckpointedBlock(number);
227
+ if (!checkpointedBlock) {
228
+ throw new Error(`L2Tips requested from TXE Archiver but no checkpointed block found for block number ${number}`);
229
+ }
230
+ const checkpoint = await this.store.getRangeOfCheckpoints(CheckpointNumber(number), 1);
231
+ if (checkpoint.length === 0) {
232
+ throw new Error(`L2Tips requested from TXE Archiver but no checkpoint found for block number ${number}`);
233
+ }
234
+ const blockId: L2BlockId = { number, hash };
235
+ const checkpointId: CheckpointId = {
236
+ number: checkpoint[0].checkpointNumber,
237
+ hash: checkpoint[0].header.hash().toString(),
238
+ };
239
+ const tipId: L2TipId = { block: blockId, checkpoint: checkpointId };
214
240
  return {
215
- latest: { number, hash } as L2BlockId,
216
- proven: { number, hash } as L2BlockId,
217
- finalized: { number, hash } as L2BlockId,
241
+ proposed: blockId,
242
+ proven: tipId,
243
+ finalized: tipId,
244
+ checkpointed: tipId,
218
245
  };
219
246
  }
220
247
 
@@ -250,7 +277,7 @@ export class TXEArchiver extends ArchiverStoreHelper implements L2BlockSource {
250
277
  return Promise.resolve(false);
251
278
  }
252
279
 
253
- public override getPendingChainValidationStatus(): Promise<ValidateBlockResult> {
280
+ public override getPendingChainValidationStatus(): Promise<ValidateCheckpointResult> {
254
281
  return Promise.resolve({ valid: true });
255
282
  }
256
283
 
@@ -260,4 +287,8 @@ export class TXEArchiver extends ArchiverStoreHelper implements L2BlockSource {
260
287
  getPublishedBlockByArchive(_archive: Fr): Promise<PublishedL2Block | undefined> {
261
288
  throw new Error('Method not implemented.');
262
289
  }
290
+
291
+ getCheckpointedBlocks(_from: BlockNumber, _limit: number, _proven?: boolean): Promise<never[]> {
292
+ throw new Error('TXE Archiver does not implement "getCheckpointedBlocks"');
293
+ }
263
294
  }
@@ -4,6 +4,7 @@ import type {
4
4
  ENR,
5
5
  P2P,
6
6
  P2PBlockReceivedCallback,
7
+ P2PCheckpointReceivedCallback,
7
8
  P2PConfig,
8
9
  P2PSyncState,
9
10
  PeerId,
@@ -14,14 +15,10 @@ import type {
14
15
  } from '@aztec/p2p';
15
16
  import type { EthAddress, L2BlockStreamEvent, L2Tips } from '@aztec/stdlib/block';
16
17
  import type { PeerInfo } from '@aztec/stdlib/interfaces/server';
17
- import type { BlockAttestation, BlockProposal } from '@aztec/stdlib/p2p';
18
+ import type { BlockProposal, CheckpointAttestation, CheckpointProposal } from '@aztec/stdlib/p2p';
18
19
  import type { Tx, TxHash } from '@aztec/stdlib/tx';
19
20
 
20
21
  export class DummyP2P implements P2P {
21
- public broadcastAttestations(_attestations: BlockAttestation[]): Promise<void> {
22
- return Promise.resolve();
23
- }
24
-
25
22
  public validate(_txs: Tx[]): Promise<void> {
26
23
  return Promise.resolve();
27
24
  }
@@ -46,10 +43,22 @@ export class DummyP2P implements P2P {
46
43
  throw new Error('DummyP2P does not implement "broadcastProposal"');
47
44
  }
48
45
 
46
+ public broadcastCheckpointProposal(_proposal: CheckpointProposal): Promise<void> {
47
+ throw new Error('DummyP2P does not implement "broadcastCheckpointProposal"');
48
+ }
49
+
50
+ public broadcastCheckpointAttestations(_attestations: CheckpointAttestation[]): Promise<void> {
51
+ throw new Error('DummyP2P does not implement "broadcastCheckpointAttestations"');
52
+ }
53
+
49
54
  public registerBlockProposalHandler(_handler: P2PBlockReceivedCallback): void {
50
55
  throw new Error('DummyP2P does not implement "registerBlockProposalHandler"');
51
56
  }
52
57
 
58
+ public registerCheckpointProposalHandler(_handler: P2PCheckpointReceivedCallback): void {
59
+ throw new Error('DummyP2P does not implement "registerCheckpointProposalHandler"');
60
+ }
61
+
53
62
  public requestTxs(_txHashes: TxHash[]): Promise<(Tx | undefined)[]> {
54
63
  throw new Error('DummyP2P does not implement "requestTxs"');
55
64
  }
@@ -120,16 +129,12 @@ export class DummyP2P implements P2P {
120
129
  throw new Error('DummyP2P does not implement "getTxsByHash"');
121
130
  }
122
131
 
123
- public getAttestationsForSlot(_slot: SlotNumber, _proposalId?: string): Promise<BlockAttestation[]> {
124
- throw new Error('DummyP2P does not implement "getAttestationForSlot"');
125
- }
126
-
127
- public deleteAttestation(_attestation: BlockAttestation): Promise<void> {
128
- return Promise.resolve();
132
+ public getCheckpointAttestationsForSlot(_slot: SlotNumber, _proposalId?: string): Promise<CheckpointAttestation[]> {
133
+ throw new Error('DummyP2P does not implement "getCheckpointAttestationsForSlot"');
129
134
  }
130
135
 
131
- public addAttestations(_attestations: BlockAttestation[]): Promise<void> {
132
- throw new Error('DummyP2P does not implement "addAttestations"');
136
+ public addCheckpointAttestations(_attestations: CheckpointAttestation[]): Promise<void> {
137
+ throw new Error('DummyP2P does not implement "addCheckpointAttestations"');
133
138
  }
134
139
 
135
140
  public getL2BlockHash(_number: number): Promise<string | undefined> {