@aztec/end-to-end 0.0.1-commit.cf93bcc56 → 0.0.1-commit.d117d021b
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/bench/client_flows/client_flows_benchmark.d.ts +1 -1
- package/dest/bench/client_flows/client_flows_benchmark.d.ts.map +1 -1
- package/dest/bench/client_flows/client_flows_benchmark.js +16 -8
- package/dest/bench/utils.d.ts +1 -1
- package/dest/bench/utils.d.ts.map +1 -1
- package/dest/bench/utils.js +6 -3
- package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts +1 -1
- package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts.map +1 -1
- package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.js +14 -14
- package/dest/e2e_fees/fees_test.d.ts +1 -1
- package/dest/e2e_fees/fees_test.d.ts.map +1 -1
- package/dest/e2e_fees/fees_test.js +13 -6
- package/dest/e2e_nested_contract/nested_contract_test.d.ts +1 -1
- package/dest/e2e_nested_contract/nested_contract_test.d.ts.map +1 -1
- package/dest/e2e_nested_contract/nested_contract_test.js +4 -6
- package/dest/e2e_p2p/p2p_network.d.ts +4 -3
- package/dest/e2e_p2p/p2p_network.d.ts.map +1 -1
- package/dest/e2e_p2p/p2p_network.js +22 -5
- package/dest/e2e_p2p/shared.d.ts +15 -1
- package/dest/e2e_p2p/shared.d.ts.map +1 -1
- package/dest/e2e_p2p/shared.js +25 -2
- package/dest/e2e_token_contract/token_contract_test.d.ts +1 -1
- package/dest/e2e_token_contract/token_contract_test.d.ts.map +1 -1
- package/dest/e2e_token_contract/token_contract_test.js +11 -11
- package/dest/fixtures/authwit_proxy.d.ts +3 -3
- package/dest/fixtures/authwit_proxy.d.ts.map +1 -1
- package/dest/fixtures/e2e_prover_test.d.ts +1 -1
- package/dest/fixtures/e2e_prover_test.d.ts.map +1 -1
- package/dest/fixtures/e2e_prover_test.js +6 -6
- package/dest/fixtures/elu_monitor.d.ts +21 -0
- package/dest/fixtures/elu_monitor.d.ts.map +1 -0
- package/dest/fixtures/elu_monitor.js +102 -0
- package/dest/fixtures/setup.d.ts +3 -4
- package/dest/fixtures/setup.d.ts.map +1 -1
- package/dest/fixtures/setup.js +3 -3
- package/dest/fixtures/token_utils.d.ts +2 -2
- package/dest/fixtures/token_utils.d.ts.map +1 -1
- package/dest/fixtures/token_utils.js +5 -4
- package/dest/shared/cross_chain_test_harness.d.ts +1 -1
- package/dest/shared/cross_chain_test_harness.d.ts.map +1 -1
- package/dest/shared/cross_chain_test_harness.js +13 -13
- package/dest/shared/gas_portal_test_harness.js +2 -2
- package/dest/shared/jest_setup.js +41 -1
- package/dest/shared/submit-transactions.js +1 -1
- package/dest/shared/uniswap_l1_l2.d.ts +1 -1
- package/dest/shared/uniswap_l1_l2.d.ts.map +1 -1
- package/dest/shared/uniswap_l1_l2.js +5 -5
- package/dest/simulators/lending_simulator.d.ts +1 -1
- package/dest/simulators/lending_simulator.d.ts.map +1 -1
- package/dest/simulators/lending_simulator.js +2 -2
- package/dest/simulators/token_simulator.d.ts +1 -1
- package/dest/simulators/token_simulator.d.ts.map +1 -1
- package/dest/simulators/token_simulator.js +2 -2
- package/dest/spartan/setup_test_wallets.d.ts +1 -1
- package/dest/spartan/setup_test_wallets.d.ts.map +1 -1
- package/dest/spartan/setup_test_wallets.js +4 -3
- package/dest/spartan/tx_metrics.js +1 -1
- package/dest/spartan/utils/config.d.ts +4 -1
- package/dest/spartan/utils/config.d.ts.map +1 -1
- package/dest/spartan/utils/config.js +2 -1
- package/dest/spartan/utils/index.d.ts +2 -1
- package/dest/spartan/utils/index.d.ts.map +1 -1
- package/dest/spartan/utils/index.js +2 -0
- package/dest/spartan/utils/nodes.d.ts +4 -5
- package/dest/spartan/utils/nodes.d.ts.map +1 -1
- package/dest/spartan/utils/nodes.js +9 -9
- package/dest/test-wallet/test_wallet.js +1 -1
- package/dest/test-wallet/wallet_worker_script.js +41 -33
- package/dest/test-wallet/worker_wallet.d.ts +4 -4
- package/dest/test-wallet/worker_wallet.d.ts.map +1 -1
- package/dest/test-wallet/worker_wallet.js +53 -5
- package/dest/test-wallet/worker_wallet_schema.d.ts +6 -3
- package/dest/test-wallet/worker_wallet_schema.d.ts.map +1 -1
- package/package.json +43 -44
- package/src/bench/client_flows/client_flows_benchmark.ts +38 -30
- package/src/bench/utils.ts +7 -2
- package/src/e2e_blacklist_token_contract/blacklist_token_contract_test.ts +18 -14
- package/src/e2e_fees/fees_test.ts +13 -6
- package/src/e2e_nested_contract/nested_contract_test.ts +6 -4
- package/src/e2e_p2p/p2p_network.ts +29 -3
- package/src/e2e_p2p/shared.ts +45 -2
- package/src/e2e_token_contract/token_contract_test.ts +16 -8
- package/src/fixtures/dumps/epoch_proof_result.json +1 -1
- package/src/fixtures/e2e_prover_test.ts +11 -5
- package/src/fixtures/elu_monitor.ts +126 -0
- package/src/fixtures/setup.ts +8 -7
- package/src/fixtures/token_utils.ts +6 -3
- package/src/shared/cross_chain_test_harness.ts +13 -9
- package/src/shared/gas_portal_test_harness.ts +1 -1
- package/src/shared/jest_setup.ts +51 -1
- package/src/shared/submit-transactions.ts +1 -1
- package/src/shared/uniswap_l1_l2.ts +6 -4
- package/src/simulators/lending_simulator.ts +4 -2
- package/src/simulators/token_simulator.ts +6 -2
- package/src/spartan/setup_test_wallets.ts +16 -11
- package/src/spartan/tx_metrics.ts +1 -1
- package/src/spartan/utils/config.ts +1 -0
- package/src/spartan/utils/index.ts +3 -0
- package/src/spartan/utils/nodes.ts +15 -10
- package/src/test-wallet/test_wallet.ts +1 -1
- package/src/test-wallet/wallet_worker_script.ts +47 -30
- package/src/test-wallet/worker_wallet.ts +55 -7
|
@@ -1,40 +1,48 @@
|
|
|
1
1
|
import { createAztecNodeClient } from '@aztec/aztec.js/node';
|
|
2
2
|
import { jsonStringify } from '@aztec/foundation/json-rpc';
|
|
3
|
+
import { createLogger } from '@aztec/foundation/log';
|
|
3
4
|
import { parseWithOptionals, schemaHasMethod } from '@aztec/foundation/schemas';
|
|
4
5
|
import { NodeListener, TransportServer } from '@aztec/foundation/transport';
|
|
6
|
+
import { Tx } from '@aztec/stdlib/tx';
|
|
5
7
|
import { workerData } from 'worker_threads';
|
|
6
8
|
import { TestWallet } from './test_wallet.js';
|
|
7
9
|
import { WorkerWalletSchema } from './worker_wallet_schema.js';
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
publicFunctionCalldata
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
const
|
|
29
|
-
const
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
});
|
|
40
|
-
server.start();
|
|
10
|
+
const logger = createLogger('e2e:test-wallet:worker');
|
|
11
|
+
try {
|
|
12
|
+
const { nodeUrl, pxeConfig } = workerData;
|
|
13
|
+
logger.info('Initializing worker wallet', {
|
|
14
|
+
nodeUrl
|
|
15
|
+
});
|
|
16
|
+
const node = createAztecNodeClient(nodeUrl);
|
|
17
|
+
const wallet = await TestWallet.create(node, pxeConfig);
|
|
18
|
+
logger.info('Worker wallet initialized');
|
|
19
|
+
const customMethods = {
|
|
20
|
+
proveTx: async (exec, opts)=>{
|
|
21
|
+
const provenTx = await wallet.proveTx(exec, opts);
|
|
22
|
+
return new Tx(provenTx.getTxHash(), provenTx.data, provenTx.chonkProof, provenTx.contractClassLogFields, provenTx.publicFunctionCalldata);
|
|
23
|
+
},
|
|
24
|
+
registerAccount: async (secret, salt)=>{
|
|
25
|
+
const manager = await wallet.createSchnorrAccount(secret, salt);
|
|
26
|
+
return manager.address;
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
const schema = WorkerWalletSchema;
|
|
30
|
+
const listener = new NodeListener();
|
|
31
|
+
const server = new TransportServer(listener, async (msg)=>{
|
|
32
|
+
if (!schemaHasMethod(schema, msg.fn)) {
|
|
33
|
+
throw new Error(`Unknown method: ${msg.fn}`);
|
|
34
|
+
}
|
|
35
|
+
const jsonParams = JSON.parse(msg.args);
|
|
36
|
+
const args = await parseWithOptionals(jsonParams, schema[msg.fn].parameters());
|
|
37
|
+
// we have to erase the fn type in order to be able to spread ...args
|
|
38
|
+
const handler = msg.fn in customMethods ? customMethods[msg.fn] : undefined;
|
|
39
|
+
const result = handler ? await handler(...args) : await wallet[msg.fn](...args);
|
|
40
|
+
return jsonStringify(result);
|
|
41
|
+
});
|
|
42
|
+
server.start();
|
|
43
|
+
} catch (err) {
|
|
44
|
+
logger.error('Worker wallet initialization failed', {
|
|
45
|
+
error: err instanceof Error ? err.stack : String(err)
|
|
46
|
+
});
|
|
47
|
+
process.exit(1);
|
|
48
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { CallIntent, IntentInnerHash } from '@aztec/aztec.js/authorization';
|
|
2
2
|
import type { InteractionWaitOptions, SendReturn } from '@aztec/aztec.js/contracts';
|
|
3
|
-
import type { Aliased, AppCapabilities, BatchResults, BatchedMethod, ContractClassMetadata, ContractMetadata, PrivateEvent, PrivateEventFilter, ProfileOptions, SendOptions, SimulateOptions,
|
|
3
|
+
import type { Aliased, AppCapabilities, BatchResults, BatchedMethod, ContractClassMetadata, ContractMetadata, ExecuteUtilityOptions, PrivateEvent, PrivateEventFilter, ProfileOptions, SendOptions, SimulateOptions, Wallet, WalletCapabilities } from '@aztec/aztec.js/wallet';
|
|
4
4
|
import type { ChainInfo } from '@aztec/entrypoints/interfaces';
|
|
5
5
|
import type { Fr } from '@aztec/foundation/curves/bn254';
|
|
6
6
|
import type { PXEConfig } from '@aztec/pxe/config';
|
|
@@ -8,7 +8,7 @@ import type { ContractArtifact, EventMetadataDefinition, FunctionCall } from '@a
|
|
|
8
8
|
import type { AuthWitness } from '@aztec/stdlib/auth-witness';
|
|
9
9
|
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
10
10
|
import type { ContractInstanceWithAddress } from '@aztec/stdlib/contract';
|
|
11
|
-
import type { ExecutionPayload, TxProfileResult, TxSimulationResult,
|
|
11
|
+
import type { ExecutionPayload, TxProfileResult, TxSimulationResult, UtilityExecutionResult } from '@aztec/stdlib/tx';
|
|
12
12
|
import { Tx } from '@aztec/stdlib/tx';
|
|
13
13
|
/**
|
|
14
14
|
* Wallet implementation that offloads all work to a worker thread.
|
|
@@ -37,7 +37,7 @@ export declare class WorkerWallet implements Wallet {
|
|
|
37
37
|
getAccounts(): Promise<Aliased<AztecAddress>[]>;
|
|
38
38
|
registerContract(instance: ContractInstanceWithAddress, artifact?: ContractArtifact, secretKey?: Fr): Promise<ContractInstanceWithAddress>;
|
|
39
39
|
simulateTx(exec: ExecutionPayload, opts: SimulateOptions): Promise<TxSimulationResult>;
|
|
40
|
-
|
|
40
|
+
executeUtility(call: FunctionCall, opts: ExecuteUtilityOptions): Promise<UtilityExecutionResult>;
|
|
41
41
|
profileTx(exec: ExecutionPayload, opts: ProfileOptions): Promise<TxProfileResult>;
|
|
42
42
|
sendTx<W extends InteractionWaitOptions = undefined>(exec: ExecutionPayload, opts: SendOptions<W>): Promise<SendReturn<W>>;
|
|
43
43
|
proveTx(exec: ExecutionPayload, opts: Omit<SendOptions, 'wait'>): Promise<Tx>;
|
|
@@ -49,4 +49,4 @@ export declare class WorkerWallet implements Wallet {
|
|
|
49
49
|
/** Shuts down the worker thread and closes the transport. */
|
|
50
50
|
stop(): Promise<void>;
|
|
51
51
|
}
|
|
52
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
52
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoid29ya2VyX3dhbGxldC5kLnRzIiwic291cmNlUm9vdCI6IiI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MsQ0FFM0Q7SUFFRCxhQUFhLENBQUMsSUFBSSxFQUFFLFlBQVksRUFBRSxtQkFBbUIsRUFBRSxlQUFlLEdBQUcsVUFBVSxHQUFHLE9BQU8sQ0FBQyxXQUFXLENBQUMsQ0FFekc7SUFFRCxtQkFBbUIsQ0FBQyxRQUFRLEVBQUUsZUFBZSxHQUFHLE9BQU8sQ0FBQyxrQkFBa0IsQ0FBQyxDQUUxRTtJQUVELEtBQUssQ0FBQyxLQUFLLENBQUMsQ0FBQyxTQUFTLFNBQVMsYUFBYSxFQUFFLEVBQUUsT0FBTyxFQUFFLENBQUMsR0FBRyxPQUFPLENBQUMsWUFBWSxDQUFDLENBQUMsQ0FBQyxDQUFDLENBRXBGO0lBRUQsNkRBQTZEO0lBQ3ZELElBQUksSUFBSSxPQUFPLENBQUMsSUFBSSxDQUFDLENBRzFCO0NBQ0YifQ==
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"worker_wallet.d.ts","sourceRoot":"","sources":["../../src/test-wallet/worker_wallet.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AACjF,OAAO,KAAK,EAAE,sBAAsB,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AACpF,OAAO,KAAK,EACV,OAAO,EACP,eAAe,EACf,YAAY,EACZ,aAAa,EACb,qBAAqB,EACrB,gBAAgB,EAChB,YAAY,EACZ,kBAAkB,EAClB,cAAc,EACd,WAAW,EACX,eAAe,EACf,
|
|
1
|
+
{"version":3,"file":"worker_wallet.d.ts","sourceRoot":"","sources":["../../src/test-wallet/worker_wallet.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AACjF,OAAO,KAAK,EAAE,sBAAsB,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AACpF,OAAO,KAAK,EACV,OAAO,EACP,eAAe,EAC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C,YAAY,CAAC,CAE3D;IAED,aAAa,CAAC,IAAI,EAAE,YAAY,EAAE,mBAAmB,EAAE,eAAe,GAAG,UAAU,GAAG,OAAO,CAAC,WAAW,CAAC,CAEzG;IAED,mBAAmB,CAAC,QAAQ,EAAE,eAAe,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAE1E;IAED,KAAK,CAAC,KAAK,CAAC,CAAC,SAAS,SAAS,aAAa,EAAE,EAAE,OAAO,EAAE,CAAC,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAEpF;IAED,6DAA6D;IACvD,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAG1B;CACF"}
|
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
import { jsonStringify } from '@aztec/foundation/json-rpc';
|
|
2
|
+
import { createLogger } from '@aztec/foundation/log';
|
|
3
|
+
import { promiseWithResolvers } from '@aztec/foundation/promise';
|
|
4
|
+
import { sleep } from '@aztec/foundation/sleep';
|
|
2
5
|
import { NodeConnector, TransportClient } from '@aztec/foundation/transport';
|
|
3
6
|
import { Worker } from 'worker_threads';
|
|
4
7
|
import { WorkerWalletSchema } from './worker_wallet_schema.js';
|
|
8
|
+
const log = createLogger('e2e:test-wallet:worker-wallet');
|
|
9
|
+
const WORKER_READY_TIMEOUT_MS = 120_000;
|
|
5
10
|
/**
|
|
6
11
|
* Wallet implementation that offloads all work to a worker thread.
|
|
7
12
|
* Implements the Wallet interface by proxying calls over a transport layer
|
|
@@ -19,18 +24,61 @@ import { WorkerWalletSchema } from './worker_wallet_schema.js';
|
|
|
19
24
|
* @param pxeConfig - Optional PXE configuration overrides.
|
|
20
25
|
* @returns A WorkerWallet ready to use.
|
|
21
26
|
*/ static async create(nodeUrl, pxeConfig) {
|
|
22
|
-
|
|
27
|
+
// replace stc/ with dest/ so the wallet works in Jest tests
|
|
28
|
+
const workerUrl = new URL('./wallet_worker_script.js', import.meta.url);
|
|
29
|
+
workerUrl.pathname = workerUrl.pathname.replace('/src/', '/dest/');
|
|
30
|
+
// remove JEST_WORKER_ID so the worker uses pino-pretty transport instead of Jest's raw output.
|
|
31
|
+
const { JEST_WORKER_ID: _, ...parentEnv } = process.env;
|
|
32
|
+
const worker = new Worker(workerUrl, {
|
|
23
33
|
workerData: {
|
|
24
34
|
nodeUrl,
|
|
25
35
|
pxeConfig
|
|
36
|
+
},
|
|
37
|
+
env: {
|
|
38
|
+
...parentEnv,
|
|
39
|
+
...process.stderr.isTTY || process.env.FORCE_COLOR ? {
|
|
40
|
+
FORCE_COLOR: '1'
|
|
41
|
+
} : {},
|
|
42
|
+
LOG_LEVEL: process.env.WORKER_LOG_LEVEL ?? 'warn'
|
|
26
43
|
}
|
|
27
44
|
});
|
|
28
45
|
const connector = new NodeConnector(worker);
|
|
29
46
|
const client = new TransportClient(connector);
|
|
30
47
|
await client.open();
|
|
31
48
|
const wallet = new WorkerWallet(worker, client);
|
|
32
|
-
|
|
33
|
-
|
|
49
|
+
const { promise: workerDied, reject: rejectWorkerDied } = promiseWithResolvers();
|
|
50
|
+
// reject if the worker exits or errors before the warmup completes.
|
|
51
|
+
const onError = (err)=>{
|
|
52
|
+
worker.off('exit', onExit);
|
|
53
|
+
rejectWorkerDied(new Error(`Worker wallet thread error: ${err.message}`));
|
|
54
|
+
};
|
|
55
|
+
const onExit = (code)=>{
|
|
56
|
+
worker.off('error', onError);
|
|
57
|
+
rejectWorkerDied(new Error(`Worker wallet thread exited with code ${code} before becoming ready`));
|
|
58
|
+
};
|
|
59
|
+
worker.once('error', onError);
|
|
60
|
+
worker.once('exit', onExit);
|
|
61
|
+
const timeout = sleep(WORKER_READY_TIMEOUT_MS).then(()=>{
|
|
62
|
+
throw new Error(`Worker wallet creation timed out after ${WORKER_READY_TIMEOUT_MS / 1000}s`);
|
|
63
|
+
});
|
|
64
|
+
try {
|
|
65
|
+
// wait for worker wallet to start
|
|
66
|
+
await Promise.race([
|
|
67
|
+
wallet.getChainInfo(),
|
|
68
|
+
workerDied,
|
|
69
|
+
timeout
|
|
70
|
+
]);
|
|
71
|
+
} catch (err) {
|
|
72
|
+
log.error('Worker wallet creation failed, cleaning up', {
|
|
73
|
+
error: String(err)
|
|
74
|
+
});
|
|
75
|
+
client.close();
|
|
76
|
+
await worker.terminate();
|
|
77
|
+
throw err;
|
|
78
|
+
} finally{
|
|
79
|
+
worker.off('error', onError);
|
|
80
|
+
worker.off('exit', onExit);
|
|
81
|
+
}
|
|
34
82
|
return wallet;
|
|
35
83
|
}
|
|
36
84
|
async callRaw(fn, ...args) {
|
|
@@ -72,8 +120,8 @@ import { WorkerWalletSchema } from './worker_wallet_schema.js';
|
|
|
72
120
|
simulateTx(exec, opts) {
|
|
73
121
|
return this.call('simulateTx', exec, opts);
|
|
74
122
|
}
|
|
75
|
-
|
|
76
|
-
return this.call('
|
|
123
|
+
executeUtility(call, opts) {
|
|
124
|
+
return this.call('executeUtility', call, opts);
|
|
77
125
|
}
|
|
78
126
|
profileTx(exec, opts) {
|
|
79
127
|
return this.call('profileTx', exec, opts);
|
|
@@ -12,9 +12,9 @@ export declare const WorkerWalletSchema: {
|
|
|
12
12
|
getAccounts: z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodType<import("@aztec/aztec.js/wallet").Aliased<AztecAddress>[], z.ZodTypeDef, any>>;
|
|
13
13
|
registerContract: z.ZodFunction<z.ZodTuple<[z.ZodType<import("@aztec/stdlib/contract").ContractInstanceWithAddress, z.ZodTypeDef, any>, artifact?: import("@aztec/foundation/schemas").ZodNullableOptional<z.ZodType<import("@aztec/stdlib/abi").ContractArtifact | undefined, z.ZodTypeDef, any>> | undefined, secretKey?: import("@aztec/foundation/schemas").ZodNullableOptional<z.ZodType<import("@aztec/foundation/schemas").Fr | undefined, z.ZodTypeDef, any>> | undefined], z.ZodUnknown>, z.ZodType<import("@aztec/stdlib/contract").ContractInstanceWithAddress, z.ZodTypeDef, any>>;
|
|
14
14
|
simulateTx: z.ZodFunction<z.ZodTuple<[z.ZodType<import("@aztec/stdlib/tx").ExecutionPayload, z.ZodTypeDef, any>, opts: z.ZodType<import("@aztec/aztec.js/wallet").SimulateOptions, z.ZodTypeDef, any>], z.ZodUnknown>, z.ZodType<import("@aztec/stdlib/tx").TxSimulationResult, z.ZodTypeDef, any>>;
|
|
15
|
-
|
|
15
|
+
executeUtility: z.ZodFunction<z.ZodTuple<[z.ZodType<import("@aztec/stdlib/abi").FunctionCall, z.ZodTypeDef, any>, opts: z.ZodType<import("@aztec/aztec.js/wallet").ExecuteUtilityOptions, z.ZodTypeDef, any>], z.ZodUnknown>, z.ZodType<import("@aztec/stdlib/tx").UtilityExecutionResult, z.ZodTypeDef, any>>;
|
|
16
16
|
profileTx: z.ZodFunction<z.ZodTuple<[z.ZodType<import("@aztec/stdlib/tx").ExecutionPayload, z.ZodTypeDef, any>, opts: z.ZodType<import("@aztec/aztec.js/wallet").ProfileOptions, z.ZodTypeDef, any>], z.ZodUnknown>, z.ZodType<import("@aztec/stdlib/tx").TxProfileResult, z.ZodTypeDef, any>>;
|
|
17
|
-
sendTx: z.ZodFunction<z.ZodTuple<[z.ZodType<import("@aztec/stdlib/tx").ExecutionPayload, z.ZodTypeDef, any>, opts: z.ZodType<import("@aztec/aztec.js/wallet").SendOptions<import("@aztec/aztec.js/contracts").InteractionWaitOptions>, z.ZodTypeDef, any>], z.ZodUnknown>, z.ZodType<import("@aztec/
|
|
17
|
+
sendTx: z.ZodFunction<z.ZodTuple<[z.ZodType<import("@aztec/stdlib/tx").ExecutionPayload, z.ZodTypeDef, any>, opts: z.ZodType<import("@aztec/aztec.js/wallet").SendOptions<import("@aztec/aztec.js/contracts").InteractionWaitOptions>, z.ZodTypeDef, any>], z.ZodUnknown>, z.ZodType<import("@aztec/aztec.js/contracts").TxSendResultImmediate | import("@aztec/aztec.js/contracts").TxSendResultMined<import("@aztec/stdlib/tx").TxReceipt>, z.ZodTypeDef, any>>;
|
|
18
18
|
createAuthWit: z.ZodFunction<z.ZodTuple<[z.ZodType<AztecAddress, z.ZodTypeDef, any>, messageHashOrIntent: z.ZodType<import("@aztec/aztec.js/authorization").CallIntent | import("@aztec/aztec.js/authorization").IntentInnerHash, z.ZodTypeDef, any>], z.ZodUnknown>, z.ZodType<import("@aztec/stdlib/auth-witness").AuthWitness, z.ZodTypeDef, any>>;
|
|
19
19
|
requestCapabilities: z.ZodFunction<z.ZodTuple<[z.ZodType<import("@aztec/aztec.js/wallet").AppCapabilities, z.ZodTypeDef, any>], z.ZodUnknown>, z.ZodType<import("@aztec/aztec.js/wallet").WalletCapabilities, z.ZodTypeDef, any>>;
|
|
20
20
|
batch: z.ZodFunction<z.ZodTuple<[z.ZodType<readonly import("@aztec/aztec.js/wallet").BatchedMethod[], z.ZodTypeDef, any>], z.ZodUnknown>, z.ZodType<readonly import("@aztec/aztec.js/wallet").BatchedMethodResultWrapper<import("@aztec/aztec.js/wallet").BatchedMethod>[], z.ZodTypeDef, any>>;
|
|
@@ -211,6 +211,7 @@ export declare const WorkerWalletSchema: {
|
|
|
211
211
|
interval?: number | undefined;
|
|
212
212
|
dontThrowOnRevert?: boolean | undefined;
|
|
213
213
|
}>]>>;
|
|
214
|
+
additionalScopes: import("@aztec/foundation/schemas").ZodNullableOptional<z.ZodArray<import("@aztec/foundation/schemas").ZodFor<AztecAddress>, "many">>;
|
|
214
215
|
}, "strip", z.ZodTypeAny, {
|
|
215
216
|
from: AztecAddress;
|
|
216
217
|
authWitnesses?: import("@aztec/stdlib/auth-witness").AuthWitness[] | undefined;
|
|
@@ -235,6 +236,7 @@ export declare const WorkerWalletSchema: {
|
|
|
235
236
|
interval?: number | undefined;
|
|
236
237
|
dontThrowOnRevert?: boolean | undefined;
|
|
237
238
|
} | undefined;
|
|
239
|
+
additionalScopes?: AztecAddress[] | undefined;
|
|
238
240
|
}, {
|
|
239
241
|
from?: any;
|
|
240
242
|
authWitnesses?: string[] | undefined;
|
|
@@ -265,7 +267,8 @@ export declare const WorkerWalletSchema: {
|
|
|
265
267
|
interval?: number | undefined;
|
|
266
268
|
dontThrowOnRevert?: boolean | undefined;
|
|
267
269
|
} | undefined;
|
|
270
|
+
additionalScopes?: any[] | undefined;
|
|
268
271
|
}>], z.ZodUnknown>, import("@aztec/foundation/schemas").ZodFor<Tx>>;
|
|
269
272
|
registerAccount: z.ZodFunction<z.ZodTuple<[z.ZodType<import("@aztec/foundation/schemas").Fr, any, string>, z.ZodType<import("@aztec/foundation/schemas").Fr, any, string>], z.ZodUnknown>, import("@aztec/foundation/schemas").ZodFor<AztecAddress>>;
|
|
270
273
|
};
|
|
271
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
274
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoid29ya2VyX3dhbGxldF9zY2hlbWEuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy90ZXN0LXdhbGxldC93b3JrZXJfd2FsbGV0X3NjaGVtYS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFFQSxPQUFPLEVBQUUsWUFBWSxFQUFFLE1BQU0sNkJBQTZCLENBQUM7QUFDM0QsT0FBTyxFQUFFLEVBQUUsRUFBRSxNQUFNLGtCQUFrQixDQUFDO0FBRXRDLE9BQU8sRUFBRSxDQUFDLEVBQUUsTUFBTSxLQUFLLENBQUM7QUFFeEIsaUdBQStGO0FBQy9GLGVBQU8sTUFBTSxrQkFBa0I7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Q0FJOUIsQ0FBQyJ9
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"worker_wallet_schema.d.ts","sourceRoot":"","sources":["../../src/test-wallet/worker_wallet_schema.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAC;AAEtC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,iGAA+F;AAC/F,eAAO,MAAM,kBAAkB
|
|
1
|
+
{"version":3,"file":"worker_wallet_schema.d.ts","sourceRoot":"","sources":["../../src/test-wallet/worker_wallet_schema.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAC;AAEtC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,iGAA+F;AAC/F,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAI9B,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/end-to-end",
|
|
3
|
-
"version": "0.0.1-commit.
|
|
3
|
+
"version": "0.0.1-commit.d117d021b",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": "./dest/index.js",
|
|
6
6
|
"inherits": [
|
|
@@ -12,12 +12,12 @@
|
|
|
12
12
|
"build:dev": "../scripts/tsc.sh --watch",
|
|
13
13
|
"clean": "rm -rf ./dest .tsbuildinfo",
|
|
14
14
|
"test:with-alerts": "./scripts/test-with-alerts.sh",
|
|
15
|
-
"test:e2e": "LOG_LEVEL=${LOG_LEVEL:-verbose} NODE_NO_WARNINGS=1 node --experimental-vm-modules ../node_modules/.bin/jest --testTimeout=300000
|
|
15
|
+
"test:e2e": "LOG_LEVEL=${LOG_LEVEL:-verbose} NODE_NO_WARNINGS=1 node --experimental-vm-modules ../node_modules/.bin/jest --testTimeout=300000",
|
|
16
16
|
"test:e2e-docker": "./scripts/run_test.sh simple",
|
|
17
17
|
"test:e2e-no-docker": "echo 'The command test:e2e-no-docker is now the same as test:e2e. You can now run this dropping the no-docker suffix.'; yarn test:e2e",
|
|
18
|
-
"test:profile": "LOG_LEVEL=${LOG_LEVEL:-verbose} NODE_NO_WARNINGS=1 0x --output-dir \"flame_graph/{pid}.0x\" -- node --experimental-vm-modules ../node_modules/jest/bin/jest.js --runInBand --testTimeout=300000
|
|
18
|
+
"test:profile": "LOG_LEVEL=${LOG_LEVEL:-verbose} NODE_NO_WARNINGS=1 0x --output-dir \"flame_graph/{pid}.0x\" -- node --experimental-vm-modules ../node_modules/jest/bin/jest.js --runInBand --testTimeout=300000",
|
|
19
19
|
"serve:flames": "python3 -m http.server --directory \"flame_graph\" 8000",
|
|
20
|
-
"test:debug": "LOG_LEVEL=${LOG_LEVEL:-verbose} NODE_NO_WARNINGS=1 node --inspect --experimental-vm-modules ../node_modules/.bin/jest --testTimeout=300000
|
|
20
|
+
"test:debug": "LOG_LEVEL=${LOG_LEVEL:-verbose} NODE_NO_WARNINGS=1 node --inspect --experimental-vm-modules ../node_modules/.bin/jest --testTimeout=300000",
|
|
21
21
|
"test:integration": "concurrently -k -s first -c reset,dim -n test,anvil \"yarn test:integration:run\" \"anvil\"",
|
|
22
22
|
"test:integration:run": "NODE_NO_WARNINGS=1 node --experimental-vm-modules ../node_modules/.bin/jest --no-cache --runInBand --config jest.integration.config.json",
|
|
23
23
|
"test": "NODE_NO_WARNINGS=1 node --experimental-vm-modules ../node_modules/.bin/jest --passWithNoTests src/fixtures",
|
|
@@ -26,45 +26,45 @@
|
|
|
26
26
|
"formatting": "run -T prettier --check ./src && run -T eslint ./src"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@aztec/accounts": "0.0.1-commit.
|
|
30
|
-
"@aztec/archiver": "0.0.1-commit.
|
|
31
|
-
"@aztec/aztec": "0.0.1-commit.
|
|
32
|
-
"@aztec/aztec-node": "0.0.1-commit.
|
|
33
|
-
"@aztec/aztec.js": "0.0.1-commit.
|
|
34
|
-
"@aztec/bb-prover": "0.0.1-commit.
|
|
35
|
-
"@aztec/bb.js": "0.0.1-commit.
|
|
36
|
-
"@aztec/blob-client": "0.0.1-commit.
|
|
37
|
-
"@aztec/blob-lib": "0.0.1-commit.
|
|
38
|
-
"@aztec/bot": "0.0.1-commit.
|
|
39
|
-
"@aztec/cli": "0.0.1-commit.
|
|
40
|
-
"@aztec/constants": "0.0.1-commit.
|
|
41
|
-
"@aztec/entrypoints": "0.0.1-commit.
|
|
42
|
-
"@aztec/epoch-cache": "0.0.1-commit.
|
|
43
|
-
"@aztec/ethereum": "0.0.1-commit.
|
|
44
|
-
"@aztec/foundation": "0.0.1-commit.
|
|
45
|
-
"@aztec/kv-store": "0.0.1-commit.
|
|
46
|
-
"@aztec/l1-artifacts": "0.0.1-commit.
|
|
47
|
-
"@aztec/merkle-tree": "0.0.1-commit.
|
|
48
|
-
"@aztec/node-keystore": "0.0.1-commit.
|
|
49
|
-
"@aztec/noir-contracts.js": "0.0.1-commit.
|
|
50
|
-
"@aztec/noir-noirc_abi": "0.0.1-commit.
|
|
51
|
-
"@aztec/noir-protocol-circuits-types": "0.0.1-commit.
|
|
52
|
-
"@aztec/noir-test-contracts.js": "0.0.1-commit.
|
|
53
|
-
"@aztec/p2p": "0.0.1-commit.
|
|
54
|
-
"@aztec/protocol-contracts": "0.0.1-commit.
|
|
55
|
-
"@aztec/prover-client": "0.0.1-commit.
|
|
56
|
-
"@aztec/prover-node": "0.0.1-commit.
|
|
57
|
-
"@aztec/pxe": "0.0.1-commit.
|
|
58
|
-
"@aztec/sequencer-client": "0.0.1-commit.
|
|
59
|
-
"@aztec/simulator": "0.0.1-commit.
|
|
60
|
-
"@aztec/slasher": "0.0.1-commit.
|
|
61
|
-
"@aztec/stdlib": "0.0.1-commit.
|
|
62
|
-
"@aztec/telemetry-client": "0.0.1-commit.
|
|
63
|
-
"@aztec/validator-client": "0.0.1-commit.
|
|
64
|
-
"@aztec/validator-ha-signer": "0.0.1-commit.
|
|
65
|
-
"@aztec/wallet-sdk": "0.0.1-commit.
|
|
66
|
-
"@aztec/wallets": "0.0.1-commit.
|
|
67
|
-
"@aztec/world-state": "0.0.1-commit.
|
|
29
|
+
"@aztec/accounts": "0.0.1-commit.d117d021b",
|
|
30
|
+
"@aztec/archiver": "0.0.1-commit.d117d021b",
|
|
31
|
+
"@aztec/aztec": "0.0.1-commit.d117d021b",
|
|
32
|
+
"@aztec/aztec-node": "0.0.1-commit.d117d021b",
|
|
33
|
+
"@aztec/aztec.js": "0.0.1-commit.d117d021b",
|
|
34
|
+
"@aztec/bb-prover": "0.0.1-commit.d117d021b",
|
|
35
|
+
"@aztec/bb.js": "0.0.1-commit.d117d021b",
|
|
36
|
+
"@aztec/blob-client": "0.0.1-commit.d117d021b",
|
|
37
|
+
"@aztec/blob-lib": "0.0.1-commit.d117d021b",
|
|
38
|
+
"@aztec/bot": "0.0.1-commit.d117d021b",
|
|
39
|
+
"@aztec/cli": "0.0.1-commit.d117d021b",
|
|
40
|
+
"@aztec/constants": "0.0.1-commit.d117d021b",
|
|
41
|
+
"@aztec/entrypoints": "0.0.1-commit.d117d021b",
|
|
42
|
+
"@aztec/epoch-cache": "0.0.1-commit.d117d021b",
|
|
43
|
+
"@aztec/ethereum": "0.0.1-commit.d117d021b",
|
|
44
|
+
"@aztec/foundation": "0.0.1-commit.d117d021b",
|
|
45
|
+
"@aztec/kv-store": "0.0.1-commit.d117d021b",
|
|
46
|
+
"@aztec/l1-artifacts": "0.0.1-commit.d117d021b",
|
|
47
|
+
"@aztec/merkle-tree": "0.0.1-commit.d117d021b",
|
|
48
|
+
"@aztec/node-keystore": "0.0.1-commit.d117d021b",
|
|
49
|
+
"@aztec/noir-contracts.js": "0.0.1-commit.d117d021b",
|
|
50
|
+
"@aztec/noir-noirc_abi": "0.0.1-commit.d117d021b",
|
|
51
|
+
"@aztec/noir-protocol-circuits-types": "0.0.1-commit.d117d021b",
|
|
52
|
+
"@aztec/noir-test-contracts.js": "0.0.1-commit.d117d021b",
|
|
53
|
+
"@aztec/p2p": "0.0.1-commit.d117d021b",
|
|
54
|
+
"@aztec/protocol-contracts": "0.0.1-commit.d117d021b",
|
|
55
|
+
"@aztec/prover-client": "0.0.1-commit.d117d021b",
|
|
56
|
+
"@aztec/prover-node": "0.0.1-commit.d117d021b",
|
|
57
|
+
"@aztec/pxe": "0.0.1-commit.d117d021b",
|
|
58
|
+
"@aztec/sequencer-client": "0.0.1-commit.d117d021b",
|
|
59
|
+
"@aztec/simulator": "0.0.1-commit.d117d021b",
|
|
60
|
+
"@aztec/slasher": "0.0.1-commit.d117d021b",
|
|
61
|
+
"@aztec/stdlib": "0.0.1-commit.d117d021b",
|
|
62
|
+
"@aztec/telemetry-client": "0.0.1-commit.d117d021b",
|
|
63
|
+
"@aztec/validator-client": "0.0.1-commit.d117d021b",
|
|
64
|
+
"@aztec/validator-ha-signer": "0.0.1-commit.d117d021b",
|
|
65
|
+
"@aztec/wallet-sdk": "0.0.1-commit.d117d021b",
|
|
66
|
+
"@aztec/wallets": "0.0.1-commit.d117d021b",
|
|
67
|
+
"@aztec/world-state": "0.0.1-commit.d117d021b",
|
|
68
68
|
"@iarna/toml": "^2.2.5",
|
|
69
69
|
"@jest/globals": "^30.0.0",
|
|
70
70
|
"@noble/curves": "=1.0.0",
|
|
@@ -76,7 +76,6 @@
|
|
|
76
76
|
"@types/koa-static": "^4.0.2",
|
|
77
77
|
"@types/lodash.every": "^4.6.7",
|
|
78
78
|
"@types/node": "^22.15.17",
|
|
79
|
-
"@viem/anvil": "^0.0.9",
|
|
80
79
|
"buffer": "^6.0.3",
|
|
81
80
|
"crypto-browserify": "^3.12.1",
|
|
82
81
|
"fs-extra": "^11.2.0",
|
|
@@ -4,7 +4,7 @@ import { type FeePaymentMethod, PrivateFeePaymentMethod, SponsoredFeePaymentMeth
|
|
|
4
4
|
import { type Logger, createLogger } from '@aztec/aztec.js/log';
|
|
5
5
|
import type { AztecNode } from '@aztec/aztec.js/node';
|
|
6
6
|
import type { Wallet } from '@aztec/aztec.js/wallet';
|
|
7
|
-
import { CheatCodes } from '@aztec/aztec/testing';
|
|
7
|
+
import { CheatCodes, getTokenAllowedSetupFunctions } from '@aztec/aztec/testing';
|
|
8
8
|
import { createExtendedL1Client } from '@aztec/ethereum/client';
|
|
9
9
|
import { RollupContract } from '@aztec/ethereum/contracts';
|
|
10
10
|
import type { DeployAztecL1ContractsArgs } from '@aztec/ethereum/deploy-aztec-l1-contracts';
|
|
@@ -130,11 +130,14 @@ export class ClientFlowsBenchmark {
|
|
|
130
130
|
|
|
131
131
|
async setup() {
|
|
132
132
|
this.logger.info('Setting up subsystems from fresh');
|
|
133
|
+
// Token allowlist entries are test-only: FPC-based fee payment with custom tokens won't work on mainnet alpha.
|
|
134
|
+
const tokenAllowList = await getTokenAllowedSetupFunctions();
|
|
133
135
|
this.context = await setup(0, {
|
|
134
136
|
...this.setupOptions,
|
|
135
137
|
fundSponsoredFPC: true,
|
|
136
138
|
skipAccountDeployment: true,
|
|
137
139
|
l1ContractsArgs: this.setupOptions,
|
|
140
|
+
txPublicSetupAllowListExtend: [...(this.setupOptions.txPublicSetupAllowListExtend ?? []), ...tokenAllowList],
|
|
138
141
|
});
|
|
139
142
|
await this.applyBaseSetup();
|
|
140
143
|
|
|
@@ -148,6 +151,7 @@ export class ClientFlowsBenchmark {
|
|
|
148
151
|
|
|
149
152
|
async teardown() {
|
|
150
153
|
await this.chainMonitor.stop();
|
|
154
|
+
await this.userWallet?.stop();
|
|
151
155
|
await teardown(this.context);
|
|
152
156
|
}
|
|
153
157
|
|
|
@@ -161,11 +165,15 @@ export class ClientFlowsBenchmark {
|
|
|
161
165
|
|
|
162
166
|
/** Admin mints bananaCoin tokens privately to the target address and redeems them. */
|
|
163
167
|
async mintPrivateBananas(amount: bigint, address: AztecAddress) {
|
|
164
|
-
const balanceBefore = await this.bananaCoin.methods
|
|
168
|
+
const { result: balanceBefore } = await this.bananaCoin.methods
|
|
169
|
+
.balance_of_private(address)
|
|
170
|
+
.simulate({ from: address });
|
|
165
171
|
|
|
166
172
|
await mintTokensToPrivate(this.bananaCoin, this.adminAddress, address, amount);
|
|
167
173
|
|
|
168
|
-
const balanceAfter = await this.bananaCoin.methods
|
|
174
|
+
const { result: balanceAfter } = await this.bananaCoin.methods
|
|
175
|
+
.balance_of_private(address)
|
|
176
|
+
.simulate({ from: address });
|
|
169
177
|
expect(balanceAfter).toEqual(balanceBefore + amount);
|
|
170
178
|
}
|
|
171
179
|
|
|
@@ -241,13 +249,12 @@ export class ClientFlowsBenchmark {
|
|
|
241
249
|
|
|
242
250
|
async applyDeployBananaToken() {
|
|
243
251
|
this.logger.info('Applying banana token deployment');
|
|
244
|
-
const {
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
).send({ from: this.adminAddress, wait: { returnReceipt: true } });
|
|
252
|
+
const {
|
|
253
|
+
receipt: { contract: bananaCoin, instance: bananaCoinInstance },
|
|
254
|
+
} = await BananaCoin.deploy(this.adminWallet, this.adminAddress, 'BC', 'BC', 18n).send({
|
|
255
|
+
from: this.adminAddress,
|
|
256
|
+
wait: { returnReceipt: true },
|
|
257
|
+
});
|
|
251
258
|
this.logger.info(`BananaCoin deployed at ${bananaCoin.address}`);
|
|
252
259
|
this.bananaCoin = bananaCoin;
|
|
253
260
|
this.bananaCoinInstance = bananaCoinInstance;
|
|
@@ -255,13 +262,12 @@ export class ClientFlowsBenchmark {
|
|
|
255
262
|
|
|
256
263
|
async applyDeployCandyBarToken() {
|
|
257
264
|
this.logger.info('Applying candy bar token deployment');
|
|
258
|
-
const {
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
).send({ from: this.adminAddress, wait: { returnReceipt: true } });
|
|
265
|
+
const {
|
|
266
|
+
receipt: { contract: candyBarCoin, instance: candyBarCoinInstance },
|
|
267
|
+
} = await TokenContract.deploy(this.adminWallet, this.adminAddress, 'CBC', 'CBC', 18n).send({
|
|
268
|
+
from: this.adminAddress,
|
|
269
|
+
wait: { returnReceipt: true },
|
|
270
|
+
});
|
|
265
271
|
this.logger.info(`CandyBarCoin deployed at ${candyBarCoin.address}`);
|
|
266
272
|
this.candyBarCoin = candyBarCoin;
|
|
267
273
|
this.candyBarCoinInstance = candyBarCoinInstance;
|
|
@@ -273,11 +279,12 @@ export class ClientFlowsBenchmark {
|
|
|
273
279
|
expect((await this.context.wallet.getContractMetadata(feeJuiceContract.address)).isContractPublished).toBe(true);
|
|
274
280
|
|
|
275
281
|
const bananaCoin = this.bananaCoin;
|
|
276
|
-
const {
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
this.adminAddress,
|
|
280
|
-
|
|
282
|
+
const {
|
|
283
|
+
receipt: { contract: bananaFPC, instance: bananaFPCInstance },
|
|
284
|
+
} = await FPCContract.deploy(this.adminWallet, bananaCoin.address, this.adminAddress).send({
|
|
285
|
+
from: this.adminAddress,
|
|
286
|
+
wait: { returnReceipt: true },
|
|
287
|
+
});
|
|
281
288
|
|
|
282
289
|
this.logger.info(`BananaPay deployed at ${bananaFPC.address}`);
|
|
283
290
|
|
|
@@ -340,14 +347,15 @@ export class ClientFlowsBenchmark {
|
|
|
340
347
|
|
|
341
348
|
public async applyDeployAmm() {
|
|
342
349
|
this.logger.info('Applying AMM deployment');
|
|
343
|
-
const {
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
350
|
+
const {
|
|
351
|
+
receipt: { contract: liquidityToken, instance: liquidityTokenInstance },
|
|
352
|
+
} = await TokenContract.deploy(this.adminWallet, this.adminAddress, 'LPT', 'LPT', 18n).send({
|
|
353
|
+
from: this.adminAddress,
|
|
354
|
+
wait: { returnReceipt: true },
|
|
355
|
+
});
|
|
356
|
+
const {
|
|
357
|
+
receipt: { contract: amm, instance: ammInstance },
|
|
358
|
+
} = await AMMContract.deploy(
|
|
351
359
|
this.adminWallet,
|
|
352
360
|
this.bananaCoin.address,
|
|
353
361
|
this.candyBarCoin.address,
|
package/src/bench/utils.ts
CHANGED
|
@@ -25,7 +25,7 @@ export async function benchmarkSetup(
|
|
|
25
25
|
) {
|
|
26
26
|
const context = await setup(1, { ...opts, telemetryConfig: { benchmark: true } });
|
|
27
27
|
const defaultAccountAddress = context.accounts[0];
|
|
28
|
-
const contract = await BenchmarkingContract.deploy(context.wallet).send({ from: defaultAccountAddress });
|
|
28
|
+
const { contract } = await BenchmarkingContract.deploy(context.wallet).send({ from: defaultAccountAddress });
|
|
29
29
|
context.logger.info(`Deployed benchmarking contract at ${contract.address}`);
|
|
30
30
|
const sequencer = (context.aztecNode as AztecNodeService).getSequencer()!;
|
|
31
31
|
const telemetry = context.telemetryClient as BenchmarkTelemetryClient;
|
|
@@ -149,7 +149,12 @@ export async function sendTxs(
|
|
|
149
149
|
context.logger.info(`Creating ${txCount} txs`);
|
|
150
150
|
const [from] = context.accounts;
|
|
151
151
|
context.logger.info(`Sending ${txCount} txs`);
|
|
152
|
-
return Promise.all(
|
|
152
|
+
return Promise.all(
|
|
153
|
+
calls.map(async call => {
|
|
154
|
+
const { txHash } = await call.send({ from, wait: NO_WAIT });
|
|
155
|
+
return txHash;
|
|
156
|
+
}),
|
|
157
|
+
);
|
|
153
158
|
}
|
|
154
159
|
|
|
155
160
|
export async function waitTxs(txs: TxHash[], context: EndToEndContext, txWaitOpts?: WaitOpts) {
|