@aztec/txe 0.0.0-test.1 → 0.0.1-commit.0208eb9

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 (100) hide show
  1. package/dest/bin/index.d.ts +1 -1
  2. package/dest/bin/index.js +3 -2
  3. package/dest/constants.d.ts +3 -0
  4. package/dest/constants.d.ts.map +1 -0
  5. package/dest/constants.js +2 -0
  6. package/dest/index.d.ts +1 -1
  7. package/dest/index.d.ts.map +1 -1
  8. package/dest/index.js +81 -51
  9. package/dest/oracle/interfaces.d.ts +57 -0
  10. package/dest/oracle/interfaces.d.ts.map +1 -0
  11. package/dest/oracle/interfaces.js +3 -0
  12. package/dest/oracle/txe_oracle_public_context.d.ts +34 -0
  13. package/dest/oracle/txe_oracle_public_context.d.ts.map +1 -0
  14. package/dest/oracle/txe_oracle_public_context.js +122 -0
  15. package/dest/oracle/txe_oracle_top_level_context.d.ts +66 -0
  16. package/dest/oracle/txe_oracle_top_level_context.d.ts.map +1 -0
  17. package/dest/oracle/txe_oracle_top_level_context.js +472 -0
  18. package/dest/rpc_translator.d.ts +252 -0
  19. package/dest/rpc_translator.d.ts.map +1 -0
  20. package/dest/rpc_translator.js +691 -0
  21. package/dest/state_machine/archiver.d.ts +31 -0
  22. package/dest/state_machine/archiver.d.ts.map +1 -0
  23. package/dest/state_machine/archiver.js +85 -0
  24. package/dest/state_machine/dummy_p2p_client.d.ts +55 -0
  25. package/dest/state_machine/dummy_p2p_client.d.ts.map +1 -0
  26. package/dest/state_machine/dummy_p2p_client.js +141 -0
  27. package/dest/state_machine/global_variable_builder.d.ts +11 -0
  28. package/dest/state_machine/global_variable_builder.d.ts.map +1 -0
  29. package/dest/state_machine/global_variable_builder.js +22 -0
  30. package/dest/state_machine/index.d.ts +16 -0
  31. package/dest/state_machine/index.d.ts.map +1 -0
  32. package/dest/state_machine/index.js +63 -0
  33. package/dest/state_machine/mock_epoch_cache.d.ts +27 -0
  34. package/dest/state_machine/mock_epoch_cache.d.ts.map +1 -0
  35. package/dest/state_machine/mock_epoch_cache.js +54 -0
  36. package/dest/state_machine/synchronizer.d.ts +33 -0
  37. package/dest/state_machine/synchronizer.d.ts.map +1 -0
  38. package/dest/state_machine/synchronizer.js +59 -0
  39. package/dest/txe_session.d.ts +75 -0
  40. package/dest/txe_session.d.ts.map +1 -0
  41. package/dest/txe_session.js +302 -0
  42. package/dest/util/encoding.d.ts +641 -24
  43. package/dest/util/encoding.d.ts.map +1 -1
  44. package/dest/util/encoding.js +66 -11
  45. package/dest/util/expected_failure_error.d.ts +1 -1
  46. package/dest/util/expected_failure_error.d.ts.map +1 -1
  47. package/dest/util/txe_account_store.d.ts +10 -0
  48. package/dest/util/txe_account_store.d.ts.map +1 -0
  49. package/dest/util/{txe_account_data_provider.js → txe_account_store.js} +1 -1
  50. package/dest/util/txe_contract_store.d.ts +12 -0
  51. package/dest/util/txe_contract_store.d.ts.map +1 -0
  52. package/dest/util/txe_contract_store.js +22 -0
  53. package/dest/util/txe_public_contract_data_source.d.ts +12 -11
  54. package/dest/util/txe_public_contract_data_source.d.ts.map +1 -1
  55. package/dest/util/txe_public_contract_data_source.js +37 -58
  56. package/dest/utils/block_creation.d.ts +28 -0
  57. package/dest/utils/block_creation.d.ts.map +1 -0
  58. package/dest/utils/block_creation.js +56 -0
  59. package/dest/utils/tx_effect_creation.d.ts +5 -0
  60. package/dest/utils/tx_effect_creation.d.ts.map +1 -0
  61. package/dest/utils/tx_effect_creation.js +13 -0
  62. package/package.json +30 -24
  63. package/src/bin/index.ts +3 -2
  64. package/src/constants.ts +3 -0
  65. package/src/index.ts +105 -74
  66. package/src/oracle/interfaces.ts +86 -0
  67. package/src/oracle/txe_oracle_public_context.ts +158 -0
  68. package/src/oracle/txe_oracle_top_level_context.ts +762 -0
  69. package/src/rpc_translator.ts +1109 -0
  70. package/src/state_machine/archiver.ts +95 -0
  71. package/src/state_machine/dummy_p2p_client.ts +209 -0
  72. package/src/state_machine/global_variable_builder.ts +38 -0
  73. package/src/state_machine/index.ts +100 -0
  74. package/src/state_machine/mock_epoch_cache.ts +67 -0
  75. package/src/state_machine/synchronizer.ts +88 -0
  76. package/src/txe_session.ts +539 -0
  77. package/src/util/encoding.ts +85 -11
  78. package/src/util/{txe_account_data_provider.ts → txe_account_store.ts} +1 -1
  79. package/src/util/txe_contract_store.ts +36 -0
  80. package/src/util/txe_public_contract_data_source.ts +43 -58
  81. package/src/utils/block_creation.ts +95 -0
  82. package/src/utils/tx_effect_creation.ts +30 -0
  83. package/dest/node/txe_node.d.ts +0 -358
  84. package/dest/node/txe_node.d.ts.map +0 -1
  85. package/dest/node/txe_node.js +0 -504
  86. package/dest/oracle/txe_oracle.d.ts +0 -152
  87. package/dest/oracle/txe_oracle.d.ts.map +0 -1
  88. package/dest/oracle/txe_oracle.js +0 -833
  89. package/dest/txe_service/txe_service.d.ts +0 -212
  90. package/dest/txe_service/txe_service.d.ts.map +0 -1
  91. package/dest/txe_service/txe_service.js +0 -572
  92. package/dest/util/txe_account_data_provider.d.ts +0 -10
  93. package/dest/util/txe_account_data_provider.d.ts.map +0 -1
  94. package/dest/util/txe_world_state_db.d.ts +0 -14
  95. package/dest/util/txe_world_state_db.d.ts.map +0 -1
  96. package/dest/util/txe_world_state_db.js +0 -27
  97. package/src/node/txe_node.ts +0 -725
  98. package/src/oracle/txe_oracle.ts +0 -1241
  99. package/src/txe_service/txe_service.ts +0 -749
  100. package/src/util/txe_world_state_db.ts +0 -38
@@ -0,0 +1,59 @@
1
+ import { NUMBER_OF_L1_L2_MESSAGES_PER_ROLLUP } from '@aztec/constants';
2
+ import { BlockNumber } from '@aztec/foundation/branded-types';
3
+ import { Fr } from '@aztec/foundation/curves/bn254';
4
+ import { NativeWorldStateService } from '@aztec/world-state/native';
5
+ export class TXESynchronizer {
6
+ nativeWorldStateService;
7
+ // This works when set to 1 as well.
8
+ blockNumber;
9
+ constructor(nativeWorldStateService){
10
+ this.nativeWorldStateService = nativeWorldStateService;
11
+ this.blockNumber = BlockNumber.ZERO;
12
+ }
13
+ static async create() {
14
+ const nativeWorldStateService = await NativeWorldStateService.tmp();
15
+ return new this(nativeWorldStateService);
16
+ }
17
+ async handleL2Block(block) {
18
+ await this.nativeWorldStateService.handleL2BlockAndMessages(block, Array(NUMBER_OF_L1_L2_MESSAGES_PER_ROLLUP).fill(0).map(Fr.zero));
19
+ this.blockNumber = block.header.globalVariables.blockNumber;
20
+ }
21
+ /**
22
+ * Forces an immediate sync to an optionally provided minimum block number
23
+ * @param targetBlockNumber - The target block number that we must sync to. Will download unproven blocks if needed to reach it.
24
+ * @param skipThrowIfTargetNotReached - Whether to skip throwing if the target block number is not reached.
25
+ * @returns A promise that resolves with the block number the world state was synced to
26
+ */ syncImmediate(_minBlockNumber, _skipThrowIfTargetNotReached) {
27
+ return Promise.resolve(this.blockNumber);
28
+ }
29
+ /** Returns an instance of MerkleTreeAdminOperations that will not include uncommitted data. */ getCommitted() {
30
+ return this.nativeWorldStateService.getCommitted();
31
+ }
32
+ /** Forks the world state at the given block number, defaulting to the latest one. */ fork(block) {
33
+ return this.nativeWorldStateService.fork(block ? BlockNumber(block) : undefined);
34
+ }
35
+ /** Gets a handle that allows reading the state as it was at the given block number. */ getSnapshot(blockNumber) {
36
+ return this.nativeWorldStateService.getSnapshot(BlockNumber(blockNumber));
37
+ }
38
+ /** Backups the db to the target path. */ backupTo(dstPath, compact) {
39
+ return this.nativeWorldStateService.backupTo(dstPath, compact);
40
+ }
41
+ start() {
42
+ throw new Error('TXE Synchronizer does not implement "start"');
43
+ }
44
+ status() {
45
+ throw new Error('TXE Synchronizer does not implement "status"');
46
+ }
47
+ stop() {
48
+ throw new Error('TXE Synchronizer does not implement "stop"');
49
+ }
50
+ stopSync() {
51
+ throw new Error('TXE Synchronizer does not implement "stopSync"');
52
+ }
53
+ resumeSync() {
54
+ throw new Error('TXE Synchronizer does not implement "resumeSync"');
55
+ }
56
+ clear() {
57
+ throw new Error('TXE Synchronizer does not implement "clear"');
58
+ }
59
+ }
@@ -0,0 +1,75 @@
1
+ import { BlockNumber } from '@aztec/foundation/branded-types';
2
+ import { Fr } from '@aztec/foundation/curves/bn254';
3
+ import { type Logger } from '@aztec/foundation/log';
4
+ import { KeyStore } from '@aztec/key-store';
5
+ import type { ProtocolContract } from '@aztec/protocol-contracts';
6
+ import { AddressStore, CapsuleStore, JobCoordinator, NoteStore, PrivateEventStore, RecipientTaggingStore, SenderAddressBookStore, SenderTaggingStore } from '@aztec/pxe/server';
7
+ import { type IPrivateExecutionOracle, type IUtilityExecutionOracle } from '@aztec/pxe/simulator';
8
+ import { AztecAddress } from '@aztec/stdlib/aztec-address';
9
+ import { PrivateContextInputs } from '@aztec/stdlib/kernel';
10
+ import type { IAvmExecutionOracle, ITxeExecutionOracle } from './oracle/interfaces.js';
11
+ import { RPCTranslator } from './rpc_translator.js';
12
+ import { TXEStateMachine } from './state_machine/index.js';
13
+ import type { ForeignCallArgs, ForeignCallResult } from './util/encoding.js';
14
+ import { TXEAccountStore } from './util/txe_account_store.js';
15
+ import { TXEContractStore } from './util/txe_contract_store.js';
16
+ type MethodNames<T> = {
17
+ [K in keyof T]: T[K] extends (...args: any[]) => any ? K : never;
18
+ }[keyof T];
19
+ /**
20
+ * The name of an oracle function that TXE supports, which are a combination of PXE oracles, non-transpiled AVM opcodes,
21
+ * and custom TXE oracles.
22
+ */
23
+ export type TXEOracleFunctionName = Exclude<MethodNames<RPCTranslator>, 'constructor' | 'handlerAsMisc' | 'handlerAsUtility' | 'handlerAsPrivate' | 'handlerAsAvm' | 'handlerAsTxe'>;
24
+ export interface TXESessionStateHandler {
25
+ enterTopLevelState(): Promise<void>;
26
+ enterPublicState(contractAddress?: AztecAddress): Promise<void>;
27
+ enterPrivateState(contractAddress?: AztecAddress, anchorBlockNumber?: BlockNumber): Promise<PrivateContextInputs>;
28
+ enterUtilityState(contractAddress?: AztecAddress): Promise<void>;
29
+ }
30
+ /**
31
+ * A `TXESession` corresponds to a Noir `#[test]` function, and handles all of its oracle calls, stores test-specific
32
+ * state, etc., independent of all other tests running in parallel.
33
+ */
34
+ export declare class TXESession implements TXESessionStateHandler {
35
+ private logger;
36
+ private stateMachine;
37
+ private oracleHandler;
38
+ private contractStore;
39
+ private noteStore;
40
+ private keyStore;
41
+ private addressStore;
42
+ private accountStore;
43
+ private senderTaggingStore;
44
+ private recipientTaggingStore;
45
+ private senderAddressBookStore;
46
+ private capsuleStore;
47
+ private privateEventStore;
48
+ private jobCoordinator;
49
+ private currentJobId;
50
+ private chainId;
51
+ private version;
52
+ private nextBlockTimestamp;
53
+ private state;
54
+ private authwits;
55
+ constructor(logger: Logger, stateMachine: TXEStateMachine, oracleHandler: IUtilityExecutionOracle | IPrivateExecutionOracle | IAvmExecutionOracle | ITxeExecutionOracle, contractStore: TXEContractStore, noteStore: NoteStore, keyStore: KeyStore, addressStore: AddressStore, accountStore: TXEAccountStore, senderTaggingStore: SenderTaggingStore, recipientTaggingStore: RecipientTaggingStore, senderAddressBookStore: SenderAddressBookStore, capsuleStore: CapsuleStore, privateEventStore: PrivateEventStore, jobCoordinator: JobCoordinator, currentJobId: string, chainId: Fr, version: Fr, nextBlockTimestamp: bigint);
56
+ static init(protocolContracts: ProtocolContract[]): Promise<TXESession>;
57
+ /**
58
+ * Processes an oracle function invoked by the Noir test associated to this session.
59
+ * @param functionName The name of the oracle.
60
+ * @param inputs The inputs of the oracle.
61
+ * @returns The oracle return values.
62
+ */
63
+ processFunction(functionName: TXEOracleFunctionName, inputs: ForeignCallArgs): Promise<ForeignCallResult>;
64
+ enterTopLevelState(): Promise<void>;
65
+ enterPrivateState(contractAddress?: AztecAddress, anchorBlockNumber?: BlockNumber): Promise<PrivateContextInputs>;
66
+ enterPublicState(contractAddress?: AztecAddress): Promise<void>;
67
+ enterUtilityState(contractAddress?: AztecAddress): Promise<void>;
68
+ private exitTopLevelState;
69
+ private exitPrivateState;
70
+ private exitPublicState;
71
+ private exitUtilityContext;
72
+ private utilityExecutorForContractSync;
73
+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AiB,EAAE,iBAAiB,EACpC,cAAc,EAAE,cAAc,EAC9B,YAAY,EAAE,MAAM,EACpB,OAAO,EAAE,EAAE,EACX,OAAO,EAAE,EAAE,EACX,kBAAkB,EAAE,MAAM,EAChC;IAEJ,OAAa,IAAI,CAAC,iBAAiB,EAAE,gBAAgB,EAAE,uBA8EtD;IAED;;;;;OAKG;IACH,eAAe,CAAC,YAAY,EAAE,qBAAqB,EAAE,MAAM,EAAE,eAAe,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAuBxG;IAEK,kBAAkB,kBA+CvB;IAEK,iBAAiB,CACrB,eAAe,GAAE,YAA8B,EAC/C,iBAAiB,CAAC,EAAE,WAAW,GAC9B,OAAO,CAAC,oBAAoB,CAAC,CA2D/B;IAEK,gBAAgB,CAAC,eAAe,CAAC,EAAE,YAAY,iBAsBpD;IAEK,iBAAiB,CAAC,eAAe,GAAE,YAA8B,iBAoCtE;IAED,OAAO,CAAC,iBAAiB;YAiBX,gBAAgB;YA6BhB,eAAe;IAS7B,OAAO,CAAC,kBAAkB;IAM1B,OAAO,CAAC,8BAA8B;CA2CvC"}
@@ -0,0 +1,302 @@
1
+ import { BlockNumber } from '@aztec/foundation/branded-types';
2
+ import { Fr } from '@aztec/foundation/curves/bn254';
3
+ import { createLogger } from '@aztec/foundation/log';
4
+ import { KeyStore } from '@aztec/key-store';
5
+ import { openTmpStore } from '@aztec/kv-store/lmdb-v2';
6
+ import { AddressStore, CapsuleStore, JobCoordinator, NoteService, NoteStore, PrivateEventStore, RecipientTaggingStore, SenderAddressBookStore, SenderTaggingStore } from '@aztec/pxe/server';
7
+ import { ExecutionNoteCache, ExecutionTaggingIndexCache, HashedValuesCache, Oracle, PrivateExecutionOracle, UtilityExecutionOracle } from '@aztec/pxe/simulator';
8
+ import { ExecutionError, WASMSimulator, createSimulationError, extractCallStack, resolveAssertionMessageFromError, toACVMWitness } from '@aztec/simulator/client';
9
+ import { FunctionSelector, FunctionType } from '@aztec/stdlib/abi';
10
+ import { AztecAddress } from '@aztec/stdlib/aztec-address';
11
+ import { GasSettings } from '@aztec/stdlib/gas';
12
+ import { computeProtocolNullifier } from '@aztec/stdlib/hash';
13
+ import { makeGlobalVariables } from '@aztec/stdlib/testing';
14
+ import { CallContext, TxContext } from '@aztec/stdlib/tx';
15
+ import { z } from 'zod';
16
+ import { DEFAULT_ADDRESS } from './constants.js';
17
+ import { TXEOraclePublicContext } from './oracle/txe_oracle_public_context.js';
18
+ import { TXEOracleTopLevelContext } from './oracle/txe_oracle_top_level_context.js';
19
+ import { RPCTranslator } from './rpc_translator.js';
20
+ import { TXEStateMachine } from './state_machine/index.js';
21
+ import { TXEAccountStore } from './util/txe_account_store.js';
22
+ import { TXEContractStore } from './util/txe_contract_store.js';
23
+ import { getSingleTxBlockRequestHash, insertTxEffectIntoWorldTrees, makeTXEBlock } from './utils/block_creation.js';
24
+ import { makeTxEffect } from './utils/tx_effect_creation.js';
25
+ /**
26
+ * A `TXESession` corresponds to a Noir `#[test]` function, and handles all of its oracle calls, stores test-specific
27
+ * state, etc., independent of all other tests running in parallel.
28
+ */ export class TXESession {
29
+ logger;
30
+ stateMachine;
31
+ oracleHandler;
32
+ contractStore;
33
+ noteStore;
34
+ keyStore;
35
+ addressStore;
36
+ accountStore;
37
+ senderTaggingStore;
38
+ recipientTaggingStore;
39
+ senderAddressBookStore;
40
+ capsuleStore;
41
+ privateEventStore;
42
+ jobCoordinator;
43
+ currentJobId;
44
+ chainId;
45
+ version;
46
+ nextBlockTimestamp;
47
+ state;
48
+ authwits;
49
+ constructor(logger, stateMachine, oracleHandler, contractStore, noteStore, keyStore, addressStore, accountStore, senderTaggingStore, recipientTaggingStore, senderAddressBookStore, capsuleStore, privateEventStore, jobCoordinator, currentJobId, chainId, version, nextBlockTimestamp){
50
+ this.logger = logger;
51
+ this.stateMachine = stateMachine;
52
+ this.oracleHandler = oracleHandler;
53
+ this.contractStore = contractStore;
54
+ this.noteStore = noteStore;
55
+ this.keyStore = keyStore;
56
+ this.addressStore = addressStore;
57
+ this.accountStore = accountStore;
58
+ this.senderTaggingStore = senderTaggingStore;
59
+ this.recipientTaggingStore = recipientTaggingStore;
60
+ this.senderAddressBookStore = senderAddressBookStore;
61
+ this.capsuleStore = capsuleStore;
62
+ this.privateEventStore = privateEventStore;
63
+ this.jobCoordinator = jobCoordinator;
64
+ this.currentJobId = currentJobId;
65
+ this.chainId = chainId;
66
+ this.version = version;
67
+ this.nextBlockTimestamp = nextBlockTimestamp;
68
+ this.state = {
69
+ name: 'TOP_LEVEL'
70
+ };
71
+ this.authwits = new Map();
72
+ }
73
+ static async init(protocolContracts) {
74
+ const store = await openTmpStore('txe-session');
75
+ const addressStore = new AddressStore(store);
76
+ const privateEventStore = new PrivateEventStore(store);
77
+ const contractStore = new TXEContractStore(store);
78
+ const noteStore = new NoteStore(store);
79
+ const senderTaggingStore = new SenderTaggingStore(store);
80
+ const recipientTaggingStore = new RecipientTaggingStore(store);
81
+ const senderAddressBookStore = new SenderAddressBookStore(store);
82
+ const capsuleStore = new CapsuleStore(store);
83
+ const keyStore = new KeyStore(store);
84
+ const accountStore = new TXEAccountStore(store);
85
+ // Create job coordinator and register staged stores
86
+ const jobCoordinator = new JobCoordinator(store);
87
+ jobCoordinator.registerStores([
88
+ capsuleStore,
89
+ senderTaggingStore,
90
+ recipientTaggingStore,
91
+ privateEventStore,
92
+ noteStore
93
+ ]);
94
+ // Register protocol contracts.
95
+ for (const { contractClass, instance, artifact } of protocolContracts){
96
+ await contractStore.addContractArtifact(contractClass.id, artifact);
97
+ await contractStore.addContractInstance(instance);
98
+ }
99
+ const stateMachine = await TXEStateMachine.create(store);
100
+ const nextBlockTimestamp = BigInt(Math.floor(new Date().getTime() / 1000));
101
+ const version = new Fr(await stateMachine.node.getVersion());
102
+ const chainId = new Fr(await stateMachine.node.getChainId());
103
+ const initialJobId = jobCoordinator.beginJob();
104
+ const topLevelOracleHandler = new TXEOracleTopLevelContext(stateMachine, contractStore, noteStore, keyStore, addressStore, accountStore, senderTaggingStore, recipientTaggingStore, senderAddressBookStore, capsuleStore, privateEventStore, initialJobId, nextBlockTimestamp, version, chainId, new Map());
105
+ await topLevelOracleHandler.txeAdvanceBlocksBy(1);
106
+ return new TXESession(createLogger('txe:session'), stateMachine, topLevelOracleHandler, contractStore, noteStore, keyStore, addressStore, accountStore, senderTaggingStore, recipientTaggingStore, senderAddressBookStore, capsuleStore, privateEventStore, jobCoordinator, initialJobId, version, chainId, nextBlockTimestamp);
107
+ }
108
+ /**
109
+ * Processes an oracle function invoked by the Noir test associated to this session.
110
+ * @param functionName The name of the oracle.
111
+ * @param inputs The inputs of the oracle.
112
+ * @returns The oracle return values.
113
+ */ processFunction(functionName, inputs) {
114
+ try {
115
+ const translator = new RPCTranslator(this, this.oracleHandler);
116
+ // We perform a runtime validation to check that the function name corresponds to a real oracle handler.
117
+ const validatedFunctionName = z.string().refine((fn)=>typeof translator[fn] === 'function' && !fn.startsWith('handlerAs') && fn !== 'constructor').parse(functionName);
118
+ return translator[validatedFunctionName](...inputs);
119
+ } catch (error) {
120
+ if (error instanceof z.ZodError) {
121
+ throw new Error(`${functionName} does not correspond to any oracle handler available on RPCTranslator`);
122
+ } else if (error instanceof Error) {
123
+ throw new Error(`Execution error while processing function ${functionName} in state ${this.state.name}: ${error.message}`);
124
+ } else {
125
+ throw new Error(`Unknown execution error while processing function ${functionName} in state ${this.state.name}`);
126
+ }
127
+ }
128
+ }
129
+ async enterTopLevelState() {
130
+ switch(this.state.name){
131
+ case 'PRIVATE':
132
+ {
133
+ await this.exitPrivateState();
134
+ break;
135
+ }
136
+ case 'PUBLIC':
137
+ {
138
+ await this.exitPublicState();
139
+ break;
140
+ }
141
+ case 'UTILITY':
142
+ {
143
+ this.exitUtilityContext();
144
+ break;
145
+ }
146
+ case 'TOP_LEVEL':
147
+ {
148
+ throw new Error(`Expected to be in state other than TOP_LEVEL`);
149
+ }
150
+ default:
151
+ {
152
+ this.state;
153
+ }
154
+ }
155
+ // Commit all staged stores from the job that was just completed, then begin a new job
156
+ await this.jobCoordinator.commitJob(this.currentJobId);
157
+ this.currentJobId = this.jobCoordinator.beginJob();
158
+ this.oracleHandler = new TXEOracleTopLevelContext(this.stateMachine, this.contractStore, this.noteStore, this.keyStore, this.addressStore, this.accountStore, this.senderTaggingStore, this.recipientTaggingStore, this.senderAddressBookStore, this.capsuleStore, this.privateEventStore, this.currentJobId, this.nextBlockTimestamp, this.version, this.chainId, this.authwits);
159
+ this.state = {
160
+ name: 'TOP_LEVEL'
161
+ };
162
+ this.logger.debug(`Entered state ${this.state.name}`);
163
+ }
164
+ async enterPrivateState(contractAddress = DEFAULT_ADDRESS, anchorBlockNumber) {
165
+ this.exitTopLevelState();
166
+ // Private execution has two associated block numbers: the anchor block (i.e. the historical block that is used to
167
+ // build the proof), and the *next* block, i.e. the one we'll create once the execution ends, and which will contain
168
+ // a single transaction with the effects of what was done in the test.
169
+ const anchorBlock = await this.stateMachine.node.getBlockHeader(anchorBlockNumber ?? 'latest');
170
+ await new NoteService(this.noteStore, this.stateMachine.node, anchorBlock, this.currentJobId).syncNoteNullifiers(contractAddress);
171
+ const latestBlock = await this.stateMachine.node.getBlockHeader('latest');
172
+ const nextBlockGlobalVariables = makeGlobalVariables(undefined, {
173
+ blockNumber: BlockNumber(latestBlock.globalVariables.blockNumber + 1),
174
+ timestamp: this.nextBlockTimestamp,
175
+ version: this.version,
176
+ chainId: this.chainId
177
+ });
178
+ const txRequestHash = getSingleTxBlockRequestHash(nextBlockGlobalVariables.blockNumber);
179
+ const protocolNullifier = await computeProtocolNullifier(txRequestHash);
180
+ const noteCache = new ExecutionNoteCache(protocolNullifier);
181
+ const taggingIndexCache = new ExecutionTaggingIndexCache();
182
+ const utilityExecutor = this.utilityExecutorForContractSync(anchorBlock);
183
+ this.oracleHandler = new PrivateExecutionOracle(Fr.ZERO, new TxContext(this.chainId, this.version, GasSettings.empty()), new CallContext(AztecAddress.ZERO, contractAddress, FunctionSelector.empty(), false), anchorBlock, utilityExecutor, [], [], new HashedValuesCache(), noteCache, taggingIndexCache, this.contractStore, this.noteStore, this.keyStore, this.addressStore, this.stateMachine.node, this.senderTaggingStore, this.recipientTaggingStore, this.senderAddressBookStore, this.capsuleStore, this.privateEventStore, this.currentJobId);
184
+ // We store the note and tagging index caches fed into the PrivateExecutionOracle (along with some other auxiliary
185
+ // data) in order to refer to it later, mimicking the way this object is used by the ContractFunctionSimulator. The
186
+ // difference resides in that the simulator has all information needed in order to run the simulation, while ours
187
+ // will be ongoing as the different oracles will be invoked from the Noir test, until eventually the private
188
+ // execution finishes.
189
+ this.state = {
190
+ name: 'PRIVATE',
191
+ nextBlockGlobalVariables,
192
+ noteCache,
193
+ taggingIndexCache
194
+ };
195
+ this.logger.debug(`Entered state ${this.state.name}`);
196
+ return this.oracleHandler.getPrivateContextInputs();
197
+ }
198
+ async enterPublicState(contractAddress) {
199
+ this.exitTopLevelState();
200
+ // The PublicContext will create a block with a single transaction in it, containing the effects of what was done in
201
+ // the test. The block therefore gets the *next* block number and timestamp.
202
+ const latestBlockNumber = (await this.stateMachine.node.getBlockHeader('latest')).globalVariables.blockNumber;
203
+ const globalVariables = makeGlobalVariables(undefined, {
204
+ blockNumber: BlockNumber(latestBlockNumber + 1),
205
+ timestamp: this.nextBlockTimestamp,
206
+ version: this.version,
207
+ chainId: this.chainId
208
+ });
209
+ this.oracleHandler = new TXEOraclePublicContext(contractAddress ?? DEFAULT_ADDRESS, await this.stateMachine.synchronizer.nativeWorldStateService.fork(), getSingleTxBlockRequestHash(globalVariables.blockNumber), globalVariables);
210
+ this.state = {
211
+ name: 'PUBLIC'
212
+ };
213
+ this.logger.debug(`Entered state ${this.state.name}`);
214
+ }
215
+ async enterUtilityState(contractAddress = DEFAULT_ADDRESS) {
216
+ this.exitTopLevelState();
217
+ const anchorBlockHeader = await this.stateMachine.anchorBlockStore.getBlockHeader();
218
+ // There is no automatic message discovery and contract-driven syncing process in inlined private or utility
219
+ // contexts, which means that known nullifiers are also not searched for, since it is during the tagging sync that
220
+ // we perform this. We therefore search for known nullifiers now, as otherwise notes that were nullified would not
221
+ // be removed from the database.
222
+ // TODO(#12553): make the synchronizer sync here instead and remove this
223
+ await new NoteService(this.noteStore, this.stateMachine.node, anchorBlockHeader, this.currentJobId).syncNoteNullifiers(contractAddress);
224
+ this.oracleHandler = new UtilityExecutionOracle(contractAddress, [], [], anchorBlockHeader, this.contractStore, this.noteStore, this.keyStore, this.addressStore, this.stateMachine.node, this.recipientTaggingStore, this.senderAddressBookStore, this.capsuleStore, this.privateEventStore, this.currentJobId);
225
+ this.state = {
226
+ name: 'UTILITY'
227
+ };
228
+ this.logger.debug(`Entered state ${this.state.name}`);
229
+ }
230
+ exitTopLevelState() {
231
+ if (this.state.name != 'TOP_LEVEL') {
232
+ throw new Error(`Expected to be in state 'TOP_LEVEL', but got '${this.state.name}' instead`);
233
+ }
234
+ // Note that while all public and private contexts do is build a single block that we then process when exiting
235
+ // those, the top level context performs a large number of actions not captured in the following 'close' call. Among
236
+ // others, it will create empty blocks (via `txeAdvanceBlocksBy` and `deploy`), create blocks with transactions via
237
+ // `txePrivateCallNewFlow` and `txePublicCallNewFlow`, add accounts to PXE via `txeAddAccount`, etc. This is a
238
+ // slight inconsistency in the working model of this class, but is not too bad.
239
+ // TODO: it's quite unfortunate that we need to capture the authwits created to later pass them again when the top
240
+ // level context is re-created. This is because authwits create a temporary utility context that'd otherwise reset
241
+ // the authwits if not persisted, so we'd not be able to pass more than one per execution.
242
+ // Ideally authwits would be passed alongside a contract call instead of pre-seeded.
243
+ [this.nextBlockTimestamp, this.authwits] = this.oracleHandler.close();
244
+ }
245
+ async exitPrivateState() {
246
+ if (this.state.name != 'PRIVATE') {
247
+ throw new Error(`Expected to be in state 'PRIVATE', but got '${this.state.name}' instead`);
248
+ }
249
+ this.logger.debug('Exiting Private state, building block with collected side effects', {
250
+ blockNumber: this.state.nextBlockGlobalVariables.blockNumber
251
+ });
252
+ // We rely on the note cache to determine the effects of the transaction. This is incomplete as it doesn't private
253
+ // logs (other effects like enqueued public calls don't need to be considered since those are not allowed).
254
+ const txEffect = await makeTxEffect(this.state.noteCache, this.state.nextBlockGlobalVariables.blockNumber);
255
+ // We build a block holding just this transaction
256
+ const forkedWorldTrees = await this.stateMachine.synchronizer.nativeWorldStateService.fork();
257
+ await insertTxEffectIntoWorldTrees(txEffect, forkedWorldTrees);
258
+ const block = await makeTXEBlock(forkedWorldTrees, this.state.nextBlockGlobalVariables, [
259
+ txEffect
260
+ ]);
261
+ await this.stateMachine.handleL2Block(block);
262
+ await forkedWorldTrees.close();
263
+ this.logger.debug('Exited PublicContext with built block', {
264
+ blockNumber: block.number,
265
+ txEffects: block.body.txEffects
266
+ });
267
+ }
268
+ async exitPublicState() {
269
+ if (this.state.name != 'PUBLIC') {
270
+ throw new Error(`Expected to be in state 'PUBLIC', but got '${this.state.name}' instead`);
271
+ }
272
+ const block = await this.oracleHandler.close();
273
+ await this.stateMachine.handleL2Block(block);
274
+ }
275
+ exitUtilityContext() {
276
+ if (this.state.name != 'UTILITY') {
277
+ throw new Error(`Expected to be in state 'UTILITY', but got '${this.state.name}' instead`);
278
+ }
279
+ }
280
+ utilityExecutorForContractSync(anchorBlock) {
281
+ return async (call)=>{
282
+ const entryPointArtifact = await this.contractStore.getFunctionArtifactWithDebugMetadata(call.to, call.selector);
283
+ if (entryPointArtifact.functionType !== FunctionType.UTILITY) {
284
+ throw new Error(`Cannot run ${entryPointArtifact.functionType} function as utility`);
285
+ }
286
+ try {
287
+ const oracle = new UtilityExecutionOracle(call.to, [], [], anchorBlock, this.contractStore, this.noteStore, this.keyStore, this.addressStore, this.stateMachine.node, this.recipientTaggingStore, this.senderAddressBookStore, this.capsuleStore, this.privateEventStore, this.currentJobId);
288
+ await new WASMSimulator().executeUserCircuit(toACVMWitness(0, call.args), entryPointArtifact, new Oracle(oracle).toACIRCallback()).catch((err)=>{
289
+ err.message = resolveAssertionMessageFromError(err, entryPointArtifact);
290
+ throw new ExecutionError(err.message, {
291
+ contractAddress: call.to,
292
+ functionSelector: call.selector
293
+ }, extractCallStack(err, entryPointArtifact.debug), {
294
+ cause: err
295
+ });
296
+ });
297
+ } catch (err) {
298
+ throw createSimulationError(err instanceof Error ? err : new Error('Unknown error contract data sync'));
299
+ }
300
+ };
301
+ }
302
+ }