@aztec/txe 3.0.0-nightly.20260104 → 3.0.0-nightly.20260106
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.
- package/dest/constants.d.ts +3 -0
- package/dest/constants.d.ts.map +1 -0
- package/dest/constants.js +2 -0
- package/dest/oracle/txe_oracle_top_level_context.d.ts +15 -14
- package/dest/oracle/txe_oracle_top_level_context.d.ts.map +1 -1
- package/dest/oracle/txe_oracle_top_level_context.js +61 -53
- package/dest/state_machine/index.d.ts +4 -4
- package/dest/state_machine/index.d.ts.map +1 -1
- package/dest/state_machine/index.js +7 -7
- package/dest/txe_session.d.ts +15 -15
- package/dest/txe_session.d.ts.map +1 -1
- package/dest/txe_session.js +68 -49
- package/dest/util/txe_account_store.d.ts +10 -0
- package/dest/util/txe_account_store.d.ts.map +1 -0
- package/dest/util/{txe_account_data_provider.js → txe_account_store.js} +1 -1
- package/dest/util/txe_contract_store.d.ts +12 -0
- package/dest/util/txe_contract_store.d.ts.map +1 -0
- package/dest/util/{txe_contract_data_provider.js → txe_contract_store.js} +3 -3
- package/dest/util/txe_public_contract_data_source.d.ts +4 -4
- package/dest/util/txe_public_contract_data_source.d.ts.map +1 -1
- package/dest/util/txe_public_contract_data_source.js +10 -10
- package/package.json +15 -15
- package/src/constants.ts +3 -0
- package/src/index.ts +1 -1
- package/src/oracle/txe_oracle_top_level_context.ts +87 -70
- package/src/state_machine/index.ts +5 -5
- package/src/txe_session.ts +135 -86
- package/src/util/{txe_account_data_provider.ts → txe_account_store.ts} +1 -1
- package/src/util/{txe_contract_data_provider.ts → txe_contract_store.ts} +3 -3
- package/src/util/txe_public_contract_data_source.ts +9 -9
- package/dest/util/txe_account_data_provider.d.ts +0 -10
- package/dest/util/txe_account_data_provider.d.ts.map +0 -1
- package/dest/util/txe_contract_data_provider.d.ts +0 -12
- package/dest/util/txe_contract_data_provider.d.ts.map +0 -1
package/src/txe_session.ts
CHANGED
|
@@ -5,14 +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
|
-
|
|
9
|
-
|
|
10
|
-
NoteDataProvider,
|
|
8
|
+
AddressStore,
|
|
9
|
+
CapsuleStore,
|
|
11
10
|
NoteService,
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
11
|
+
NoteStore,
|
|
12
|
+
PrivateEventStore,
|
|
13
|
+
RecipientTaggingStore,
|
|
14
|
+
SenderAddressBookStore,
|
|
15
|
+
SenderTaggingStore,
|
|
16
16
|
} from '@aztec/pxe/server';
|
|
17
17
|
import {
|
|
18
18
|
ExecutionNoteCache,
|
|
@@ -20,10 +20,19 @@ import {
|
|
|
20
20
|
HashedValuesCache,
|
|
21
21
|
type IPrivateExecutionOracle,
|
|
22
22
|
type IUtilityExecutionOracle,
|
|
23
|
+
Oracle,
|
|
23
24
|
PrivateExecutionOracle,
|
|
24
25
|
UtilityExecutionOracle,
|
|
25
26
|
} from '@aztec/pxe/simulator';
|
|
26
|
-
import {
|
|
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';
|
|
27
36
|
import type { AuthWitness } from '@aztec/stdlib/auth-witness';
|
|
28
37
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
29
38
|
import { GasSettings } from '@aztec/stdlib/gas';
|
|
@@ -34,14 +43,15 @@ import { CallContext, GlobalVariables, TxContext } from '@aztec/stdlib/tx';
|
|
|
34
43
|
|
|
35
44
|
import { z } from 'zod';
|
|
36
45
|
|
|
46
|
+
import { DEFAULT_ADDRESS } from './constants.js';
|
|
37
47
|
import type { IAvmExecutionOracle, ITxeExecutionOracle } from './oracle/interfaces.js';
|
|
38
48
|
import { TXEOraclePublicContext } from './oracle/txe_oracle_public_context.js';
|
|
39
49
|
import { TXEOracleTopLevelContext } from './oracle/txe_oracle_top_level_context.js';
|
|
40
50
|
import { RPCTranslator } from './rpc_translator.js';
|
|
41
51
|
import { TXEStateMachine } from './state_machine/index.js';
|
|
42
52
|
import type { ForeignCallArgs, ForeignCallResult } from './util/encoding.js';
|
|
43
|
-
import {
|
|
44
|
-
import {
|
|
53
|
+
import { TXEAccountStore } from './util/txe_account_store.js';
|
|
54
|
+
import { TXEContractStore } from './util/txe_contract_store.js';
|
|
45
55
|
import { getSingleTxBlockRequestHash, insertTxEffectIntoWorldTrees, makeTXEBlock } from './utils/block_creation.js';
|
|
46
56
|
import { makeTxEffect } from './utils/tx_effect_creation.js';
|
|
47
57
|
|
|
@@ -103,8 +113,6 @@ export interface TXESessionStateHandler {
|
|
|
103
113
|
enterUtilityState(contractAddress?: AztecAddress): Promise<void>;
|
|
104
114
|
}
|
|
105
115
|
|
|
106
|
-
export const DEFAULT_ADDRESS = AztecAddress.fromNumber(42);
|
|
107
|
-
|
|
108
116
|
/**
|
|
109
117
|
* A `TXESession` corresponds to a Noir `#[test]` function, and handles all of its oracle calls, stores test-specific
|
|
110
118
|
* state, etc., independent of all other tests running in parallel.
|
|
@@ -121,16 +129,16 @@ export class TXESession implements TXESessionStateHandler {
|
|
|
121
129
|
| IPrivateExecutionOracle
|
|
122
130
|
| IAvmExecutionOracle
|
|
123
131
|
| ITxeExecutionOracle,
|
|
124
|
-
private
|
|
125
|
-
private
|
|
132
|
+
private contractStore: TXEContractStore,
|
|
133
|
+
private noteStore: NoteStore,
|
|
126
134
|
private keyStore: KeyStore,
|
|
127
|
-
private
|
|
128
|
-
private
|
|
129
|
-
private
|
|
130
|
-
private
|
|
131
|
-
private
|
|
132
|
-
private
|
|
133
|
-
private
|
|
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,
|
|
134
142
|
private chainId: Fr,
|
|
135
143
|
private version: Fr,
|
|
136
144
|
private nextBlockTimestamp: bigint,
|
|
@@ -139,21 +147,21 @@ export class TXESession implements TXESessionStateHandler {
|
|
|
139
147
|
static async init(protocolContracts: ProtocolContract[]) {
|
|
140
148
|
const store = await openTmpStore('txe-session');
|
|
141
149
|
|
|
142
|
-
const
|
|
143
|
-
const
|
|
144
|
-
const
|
|
145
|
-
const
|
|
146
|
-
const
|
|
147
|
-
const
|
|
148
|
-
const
|
|
149
|
-
const
|
|
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);
|
|
150
158
|
const keyStore = new KeyStore(store);
|
|
151
|
-
const
|
|
159
|
+
const accountStore = new TXEAccountStore(store);
|
|
152
160
|
|
|
153
161
|
// Register protocol contracts.
|
|
154
162
|
for (const { contractClass, instance, artifact } of protocolContracts) {
|
|
155
|
-
await
|
|
156
|
-
await
|
|
163
|
+
await contractStore.addContractArtifact(contractClass.id, artifact);
|
|
164
|
+
await contractStore.addContractInstance(instance);
|
|
157
165
|
}
|
|
158
166
|
|
|
159
167
|
const stateMachine = await TXEStateMachine.create(store);
|
|
@@ -164,16 +172,16 @@ export class TXESession implements TXESessionStateHandler {
|
|
|
164
172
|
|
|
165
173
|
const topLevelOracleHandler = new TXEOracleTopLevelContext(
|
|
166
174
|
stateMachine,
|
|
167
|
-
|
|
168
|
-
|
|
175
|
+
contractStore,
|
|
176
|
+
noteStore,
|
|
169
177
|
keyStore,
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
178
|
+
addressStore,
|
|
179
|
+
accountStore,
|
|
180
|
+
senderTaggingStore,
|
|
181
|
+
recipientTaggingStore,
|
|
182
|
+
senderAddressBookStore,
|
|
183
|
+
capsuleStore,
|
|
184
|
+
privateEventStore,
|
|
177
185
|
nextBlockTimestamp,
|
|
178
186
|
version,
|
|
179
187
|
chainId,
|
|
@@ -185,16 +193,16 @@ export class TXESession implements TXESessionStateHandler {
|
|
|
185
193
|
createLogger('txe:session'),
|
|
186
194
|
stateMachine,
|
|
187
195
|
topLevelOracleHandler,
|
|
188
|
-
|
|
189
|
-
|
|
196
|
+
contractStore,
|
|
197
|
+
noteStore,
|
|
190
198
|
keyStore,
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
199
|
+
addressStore,
|
|
200
|
+
accountStore,
|
|
201
|
+
senderTaggingStore,
|
|
202
|
+
recipientTaggingStore,
|
|
203
|
+
senderAddressBookStore,
|
|
204
|
+
capsuleStore,
|
|
205
|
+
privateEventStore,
|
|
198
206
|
version,
|
|
199
207
|
chainId,
|
|
200
208
|
nextBlockTimestamp,
|
|
@@ -256,16 +264,16 @@ export class TXESession implements TXESessionStateHandler {
|
|
|
256
264
|
|
|
257
265
|
this.oracleHandler = new TXEOracleTopLevelContext(
|
|
258
266
|
this.stateMachine,
|
|
259
|
-
this.
|
|
260
|
-
this.
|
|
267
|
+
this.contractStore,
|
|
268
|
+
this.noteStore,
|
|
261
269
|
this.keyStore,
|
|
262
|
-
this.
|
|
263
|
-
this.
|
|
264
|
-
this.
|
|
265
|
-
this.
|
|
266
|
-
this.
|
|
267
|
-
this.
|
|
268
|
-
this.
|
|
270
|
+
this.addressStore,
|
|
271
|
+
this.accountStore,
|
|
272
|
+
this.senderTaggingStore,
|
|
273
|
+
this.recipientTaggingStore,
|
|
274
|
+
this.senderAddressBookStore,
|
|
275
|
+
this.capsuleStore,
|
|
276
|
+
this.privateEventStore,
|
|
269
277
|
this.nextBlockTimestamp,
|
|
270
278
|
this.version,
|
|
271
279
|
this.chainId,
|
|
@@ -282,15 +290,10 @@ export class TXESession implements TXESessionStateHandler {
|
|
|
282
290
|
): Promise<PrivateContextInputs> {
|
|
283
291
|
this.exitTopLevelState();
|
|
284
292
|
|
|
285
|
-
// There is no automatic message discovery and contract-driven syncing process in inlined private or utility
|
|
286
|
-
// contexts, which means that known nullifiers are also not searched for, since it is during the tagging sync that
|
|
287
|
-
// we perform this. We therefore search for known nullifiers now, as otherwise notes that were nullified would not
|
|
288
|
-
// be removed from the database.
|
|
289
|
-
// TODO(#12553): make the synchronizer sync here instead and remove this
|
|
290
293
|
await new NoteService(
|
|
291
|
-
this.
|
|
294
|
+
this.noteStore,
|
|
292
295
|
this.stateMachine.node,
|
|
293
|
-
this.stateMachine.
|
|
296
|
+
this.stateMachine.anchorBlockStore,
|
|
294
297
|
).syncNoteNullifiers(contractAddress);
|
|
295
298
|
|
|
296
299
|
// Private execution has two associated block numbers: the anchor block (i.e. the historical block that is used to
|
|
@@ -311,27 +314,29 @@ export class TXESession implements TXESessionStateHandler {
|
|
|
311
314
|
const noteCache = new ExecutionNoteCache(protocolNullifier);
|
|
312
315
|
const taggingIndexCache = new ExecutionTaggingIndexCache();
|
|
313
316
|
|
|
317
|
+
const utilityExecutor = this.utilityExecutorForContractSync(anchorBlock);
|
|
314
318
|
this.oracleHandler = new PrivateExecutionOracle(
|
|
315
319
|
Fr.ZERO,
|
|
316
320
|
new TxContext(this.chainId, this.version, GasSettings.empty()),
|
|
317
321
|
new CallContext(AztecAddress.ZERO, contractAddress, FunctionSelector.empty(), false),
|
|
318
322
|
anchorBlock!,
|
|
323
|
+
utilityExecutor,
|
|
319
324
|
[],
|
|
320
325
|
[],
|
|
321
326
|
new HashedValuesCache(),
|
|
322
327
|
noteCache,
|
|
323
328
|
taggingIndexCache,
|
|
324
|
-
this.
|
|
325
|
-
this.
|
|
329
|
+
this.contractStore,
|
|
330
|
+
this.noteStore,
|
|
326
331
|
this.keyStore,
|
|
327
|
-
this.
|
|
332
|
+
this.addressStore,
|
|
328
333
|
this.stateMachine.node,
|
|
329
|
-
this.stateMachine.
|
|
330
|
-
this.
|
|
331
|
-
this.
|
|
332
|
-
this.
|
|
333
|
-
this.
|
|
334
|
-
this.
|
|
334
|
+
this.stateMachine.anchorBlockStore,
|
|
335
|
+
this.senderTaggingStore,
|
|
336
|
+
this.recipientTaggingStore,
|
|
337
|
+
this.senderAddressBookStore,
|
|
338
|
+
this.capsuleStore,
|
|
339
|
+
this.privateEventStore,
|
|
335
340
|
);
|
|
336
341
|
|
|
337
342
|
// We store the note and tagging index caches fed into the PrivateExecutionOracle (along with some other auxiliary
|
|
@@ -378,28 +383,28 @@ export class TXESession implements TXESessionStateHandler {
|
|
|
378
383
|
// be removed from the database.
|
|
379
384
|
// TODO(#12553): make the synchronizer sync here instead and remove this
|
|
380
385
|
await new NoteService(
|
|
381
|
-
this.
|
|
386
|
+
this.noteStore,
|
|
382
387
|
this.stateMachine.node,
|
|
383
|
-
this.stateMachine.
|
|
388
|
+
this.stateMachine.anchorBlockStore,
|
|
384
389
|
).syncNoteNullifiers(contractAddress);
|
|
385
390
|
|
|
386
|
-
const anchorBlockHeader = await this.stateMachine.
|
|
391
|
+
const anchorBlockHeader = await this.stateMachine.anchorBlockStore.getBlockHeader();
|
|
387
392
|
|
|
388
393
|
this.oracleHandler = new UtilityExecutionOracle(
|
|
389
394
|
contractAddress,
|
|
390
395
|
[],
|
|
391
396
|
[],
|
|
392
397
|
anchorBlockHeader,
|
|
393
|
-
this.
|
|
394
|
-
this.
|
|
398
|
+
this.contractStore,
|
|
399
|
+
this.noteStore,
|
|
395
400
|
this.keyStore,
|
|
396
|
-
this.
|
|
401
|
+
this.addressStore,
|
|
397
402
|
this.stateMachine.node,
|
|
398
|
-
this.stateMachine.
|
|
399
|
-
this.
|
|
400
|
-
this.
|
|
401
|
-
this.
|
|
402
|
-
this.
|
|
403
|
+
this.stateMachine.anchorBlockStore,
|
|
404
|
+
this.recipientTaggingStore,
|
|
405
|
+
this.senderAddressBookStore,
|
|
406
|
+
this.capsuleStore,
|
|
407
|
+
this.privateEventStore,
|
|
403
408
|
);
|
|
404
409
|
|
|
405
410
|
this.state = { name: 'UTILITY' };
|
|
@@ -470,4 +475,48 @@ export class TXESession implements TXESessionStateHandler {
|
|
|
470
475
|
throw new Error(`Expected to be in state 'UTILITY', but got '${this.state.name}' instead`);
|
|
471
476
|
}
|
|
472
477
|
}
|
|
478
|
+
|
|
479
|
+
private utilityExecutorForContractSync(anchorBlock: any) {
|
|
480
|
+
return async (call: FunctionCall) => {
|
|
481
|
+
const entryPointArtifact = await this.contractStore.getFunctionArtifactWithDebugMetadata(call.to, call.selector);
|
|
482
|
+
if (entryPointArtifact.functionType !== FunctionType.UTILITY) {
|
|
483
|
+
throw new Error(`Cannot run ${entryPointArtifact.functionType} function as utility`);
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
try {
|
|
487
|
+
const oracle = new UtilityExecutionOracle(
|
|
488
|
+
call.to,
|
|
489
|
+
[],
|
|
490
|
+
[],
|
|
491
|
+
anchorBlock!,
|
|
492
|
+
this.contractStore,
|
|
493
|
+
this.noteStore,
|
|
494
|
+
this.keyStore,
|
|
495
|
+
this.addressStore,
|
|
496
|
+
this.stateMachine.node,
|
|
497
|
+
this.stateMachine.anchorBlockStore,
|
|
498
|
+
this.recipientTaggingStore,
|
|
499
|
+
this.senderAddressBookStore,
|
|
500
|
+
this.capsuleStore,
|
|
501
|
+
this.privateEventStore,
|
|
502
|
+
);
|
|
503
|
+
await new WASMSimulator()
|
|
504
|
+
.executeUserCircuit(toACVMWitness(0, call.args), entryPointArtifact, new Oracle(oracle).toACIRCallback())
|
|
505
|
+
.catch((err: Error) => {
|
|
506
|
+
err.message = resolveAssertionMessageFromError(err, entryPointArtifact);
|
|
507
|
+
throw new ExecutionError(
|
|
508
|
+
err.message,
|
|
509
|
+
{
|
|
510
|
+
contractAddress: call.to,
|
|
511
|
+
functionSelector: call.selector,
|
|
512
|
+
},
|
|
513
|
+
extractCallStack(err, entryPointArtifact.debug),
|
|
514
|
+
{ cause: err },
|
|
515
|
+
);
|
|
516
|
+
});
|
|
517
|
+
} catch (err) {
|
|
518
|
+
throw createSimulationError(err instanceof Error ? err : new Error('Unknown error contract data sync'));
|
|
519
|
+
}
|
|
520
|
+
};
|
|
521
|
+
}
|
|
473
522
|
}
|
|
@@ -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
|
|
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 {
|
|
3
|
+
import { ContractStore } from '@aztec/pxe/server';
|
|
4
4
|
|
|
5
5
|
export type ContractArtifactWithHash = ContractArtifact & { artifactHash: Fr };
|
|
6
6
|
|
|
7
7
|
/*
|
|
8
|
-
* A contract
|
|
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
|
|
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 {
|
|
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
|
|
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.
|
|
27
|
+
const contractClass = await this.contractStore.getContractClass(id);
|
|
28
28
|
if (!contractClass) {
|
|
29
29
|
return;
|
|
30
30
|
}
|
|
31
|
-
const artifact = await this.
|
|
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.
|
|
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.
|
|
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.
|
|
76
|
-
return instance && this.
|
|
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.
|
|
80
|
+
return await this.contractStore.getDebugFunctionName(address, selector);
|
|
81
81
|
}
|
|
82
82
|
|
|
83
83
|
registerContractFunctionSignatures(_signatures: []): Promise<void> {
|
|
@@ -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"}
|