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