@aztec/end-to-end 4.0.0-devnet.1-patch.0 → 4.0.0-devnet.2-patch.0
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 +2 -2
- package/dest/bench/client_flows/client_flows_benchmark.d.ts.map +1 -1
- package/dest/bench/client_flows/client_flows_benchmark.js +3 -3
- package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts +4 -2
- 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 +10 -0
- package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts +2 -2
- package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts.map +1 -1
- package/dest/e2e_deploy_contract/deploy_test.d.ts +2 -2
- package/dest/e2e_deploy_contract/deploy_test.d.ts.map +1 -1
- package/dest/e2e_epochs/epochs_test.d.ts +9 -7
- package/dest/e2e_epochs/epochs_test.d.ts.map +1 -1
- package/dest/e2e_epochs/epochs_test.js +53 -34
- package/dest/e2e_fees/fees_test.d.ts +2 -2
- package/dest/e2e_fees/fees_test.d.ts.map +1 -1
- package/dest/e2e_fees/fees_test.js +5 -5
- package/dest/e2e_p2p/p2p_network.d.ts +2 -2
- package/dest/e2e_p2p/p2p_network.d.ts.map +1 -1
- package/dest/e2e_p2p/p2p_network.js +2 -2
- package/dest/e2e_p2p/reqresp/utils.d.ts +3 -3
- package/dest/e2e_p2p/reqresp/utils.d.ts.map +1 -1
- package/dest/e2e_p2p/reqresp/utils.js +32 -8
- package/dest/e2e_p2p/shared.d.ts +2 -2
- package/dest/e2e_p2p/shared.d.ts.map +1 -1
- package/dest/e2e_p2p/shared.js +2 -1
- package/dest/e2e_token_contract/token_contract_test.d.ts +4 -2
- package/dest/e2e_token_contract/token_contract_test.d.ts.map +1 -1
- package/dest/e2e_token_contract/token_contract_test.js +10 -0
- package/dest/fixtures/authwit_proxy.d.ts +15 -0
- package/dest/fixtures/authwit_proxy.d.ts.map +1 -0
- package/dest/fixtures/authwit_proxy.js +30 -0
- package/dest/fixtures/e2e_prover_test.d.ts +4 -4
- package/dest/fixtures/e2e_prover_test.d.ts.map +1 -1
- package/dest/fixtures/e2e_prover_test.js +27 -34
- package/dest/fixtures/fixtures.d.ts +5 -1
- package/dest/fixtures/fixtures.d.ts.map +1 -1
- package/dest/fixtures/fixtures.js +6 -0
- package/dest/fixtures/ha_setup.d.ts +1 -1
- package/dest/fixtures/ha_setup.d.ts.map +1 -1
- package/dest/fixtures/ha_setup.js +3 -1
- package/dest/fixtures/setup.d.ts +27 -10
- package/dest/fixtures/setup.d.ts.map +1 -1
- package/dest/fixtures/setup.js +56 -81
- package/dest/fixtures/setup_p2p_test.d.ts +6 -3
- package/dest/fixtures/setup_p2p_test.d.ts.map +1 -1
- package/dest/fixtures/setup_p2p_test.js +12 -9
- package/dest/shared/index.d.ts +2 -1
- package/dest/shared/index.d.ts.map +1 -1
- package/dest/shared/index.js +1 -0
- package/dest/shared/mock_state_view.d.ts +86 -0
- package/dest/shared/mock_state_view.d.ts.map +1 -0
- package/dest/shared/mock_state_view.js +186 -0
- package/dest/shared/submit-transactions.d.ts +2 -2
- package/dest/shared/submit-transactions.d.ts.map +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/simulators/token_simulator.d.ts +1 -1
- package/dest/simulators/token_simulator.d.ts.map +1 -1
- package/dest/simulators/token_simulator.js +2 -23
- package/dest/spartan/setup_test_wallets.d.ts +9 -2
- package/dest/spartan/setup_test_wallets.d.ts.map +1 -1
- package/dest/spartan/setup_test_wallets.js +31 -1
- package/dest/spartan/utils/bot.d.ts +3 -2
- package/dest/spartan/utils/bot.d.ts.map +1 -1
- package/dest/spartan/utils/bot.js +2 -1
- package/dest/spartan/utils/index.d.ts +2 -2
- package/dest/spartan/utils/index.d.ts.map +1 -1
- package/dest/spartan/utils/index.js +1 -1
- package/dest/spartan/utils/k8s.d.ts +3 -1
- package/dest/spartan/utils/k8s.d.ts.map +1 -1
- package/dest/spartan/utils/k8s.js +6 -0
- package/dest/test-wallet/test_wallet.d.ts +83 -0
- package/dest/test-wallet/test_wallet.d.ts.map +1 -0
- package/dest/test-wallet/test_wallet.js +214 -0
- package/dest/test-wallet/utils.d.ts +41 -0
- package/dest/test-wallet/utils.d.ts.map +1 -0
- package/dest/test-wallet/utils.js +71 -0
- package/dest/test-wallet/wallet_worker_script.d.ts +2 -0
- package/dest/test-wallet/wallet_worker_script.d.ts.map +1 -0
- package/dest/test-wallet/wallet_worker_script.js +40 -0
- package/dest/test-wallet/worker_wallet.d.ts +52 -0
- package/dest/test-wallet/worker_wallet.d.ts.map +1 -0
- package/dest/test-wallet/worker_wallet.js +103 -0
- package/dest/test-wallet/worker_wallet_schema.d.ts +271 -0
- package/dest/test-wallet/worker_wallet_schema.d.ts.map +1 -0
- package/dest/test-wallet/worker_wallet_schema.js +10 -0
- package/package.json +40 -39
- package/src/bench/client_flows/client_flows_benchmark.ts +3 -7
- package/src/e2e_blacklist_token_contract/blacklist_token_contract_test.ts +10 -1
- package/src/e2e_cross_chain_messaging/cross_chain_messaging_test.ts +1 -1
- package/src/e2e_deploy_contract/deploy_test.ts +1 -1
- package/src/e2e_epochs/epochs_test.ts +66 -66
- package/src/e2e_fees/bridging_race.notest.ts +1 -1
- package/src/e2e_fees/fees_test.ts +5 -20
- package/src/e2e_p2p/p2p_network.ts +3 -3
- package/src/e2e_p2p/reqresp/utils.ts +36 -8
- package/src/e2e_p2p/shared.ts +2 -1
- package/src/e2e_token_contract/token_contract_test.ts +10 -1
- package/src/fixtures/authwit_proxy.ts +50 -0
- package/src/fixtures/dumps/epoch_proof_result.json +1 -1
- package/src/fixtures/e2e_prover_test.ts +26 -36
- package/src/fixtures/fixtures.ts +10 -0
- package/src/fixtures/ha_setup.ts +3 -1
- package/src/fixtures/setup.ts +73 -109
- package/src/fixtures/setup_p2p_test.ts +9 -17
- package/src/guides/up_quick_start.sh +3 -3
- package/src/shared/index.ts +1 -0
- package/src/shared/mock_state_view.ts +188 -0
- package/src/shared/submit-transactions.ts +2 -1
- package/src/shared/uniswap_l1_l2.ts +1 -1
- package/src/simulators/token_simulator.ts +1 -29
- package/src/spartan/setup_test_wallets.ts +43 -1
- package/src/spartan/utils/bot.ts +4 -1
- package/src/spartan/utils/index.ts +1 -0
- package/src/spartan/utils/k8s.ts +8 -0
- package/src/test-wallet/test_wallet.ts +306 -0
- package/src/test-wallet/utils.ts +112 -0
- package/src/test-wallet/wallet_worker_script.ts +43 -0
- package/src/test-wallet/worker_wallet.ts +165 -0
- package/src/test-wallet/worker_wallet_schema.ts +13 -0
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
import type { CallIntent, IntentInnerHash } from '@aztec/aztec.js/authorization';
|
|
2
|
+
import type { InteractionWaitOptions, SendReturn } from '@aztec/aztec.js/contracts';
|
|
3
|
+
import type {
|
|
4
|
+
Aliased,
|
|
5
|
+
AppCapabilities,
|
|
6
|
+
BatchResults,
|
|
7
|
+
BatchedMethod,
|
|
8
|
+
ContractClassMetadata,
|
|
9
|
+
ContractMetadata,
|
|
10
|
+
PrivateEvent,
|
|
11
|
+
PrivateEventFilter,
|
|
12
|
+
ProfileOptions,
|
|
13
|
+
SendOptions,
|
|
14
|
+
SimulateOptions,
|
|
15
|
+
SimulateUtilityOptions,
|
|
16
|
+
Wallet,
|
|
17
|
+
WalletCapabilities,
|
|
18
|
+
} from '@aztec/aztec.js/wallet';
|
|
19
|
+
import type { ChainInfo } from '@aztec/entrypoints/interfaces';
|
|
20
|
+
import type { Fr } from '@aztec/foundation/curves/bn254';
|
|
21
|
+
import { jsonStringify } from '@aztec/foundation/json-rpc';
|
|
22
|
+
import type { ApiSchema } from '@aztec/foundation/schemas';
|
|
23
|
+
import { NodeConnector, TransportClient } from '@aztec/foundation/transport';
|
|
24
|
+
import type { PXEConfig } from '@aztec/pxe/config';
|
|
25
|
+
import type { ContractArtifact, EventMetadataDefinition, FunctionCall } from '@aztec/stdlib/abi';
|
|
26
|
+
import type { AuthWitness } from '@aztec/stdlib/auth-witness';
|
|
27
|
+
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
28
|
+
import type { ContractInstanceWithAddress } from '@aztec/stdlib/contract';
|
|
29
|
+
import type { ExecutionPayload, TxProfileResult, TxSimulationResult, UtilitySimulationResult } from '@aztec/stdlib/tx';
|
|
30
|
+
import { Tx } from '@aztec/stdlib/tx';
|
|
31
|
+
|
|
32
|
+
import { Worker } from 'worker_threads';
|
|
33
|
+
|
|
34
|
+
import { WorkerWalletSchema } from './worker_wallet_schema.js';
|
|
35
|
+
|
|
36
|
+
type WorkerMsg = { fn: string; args: string };
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Wallet implementation that offloads all work to a worker thread.
|
|
40
|
+
* Implements the Wallet interface by proxying calls over a transport layer
|
|
41
|
+
* using JSON serialization with Zod schema parsing on both ends.
|
|
42
|
+
*/
|
|
43
|
+
export class WorkerWallet implements Wallet {
|
|
44
|
+
private constructor(
|
|
45
|
+
private worker: Worker,
|
|
46
|
+
private client: TransportClient<WorkerMsg>,
|
|
47
|
+
) {}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Creates a WorkerWallet by spawning a worker thread that creates a TestWallet internally.
|
|
51
|
+
* @param nodeUrl - URL of the Aztec node to connect to.
|
|
52
|
+
* @param pxeConfig - Optional PXE configuration overrides.
|
|
53
|
+
* @returns A WorkerWallet ready to use.
|
|
54
|
+
*/
|
|
55
|
+
static async create(nodeUrl: string, pxeConfig?: Partial<PXEConfig>): Promise<WorkerWallet> {
|
|
56
|
+
const worker = new Worker(new URL('./wallet_worker_script.js', import.meta.url), {
|
|
57
|
+
workerData: { nodeUrl, pxeConfig },
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
const connector = new NodeConnector(worker);
|
|
61
|
+
const client = new TransportClient<WorkerMsg>(connector);
|
|
62
|
+
await client.open();
|
|
63
|
+
|
|
64
|
+
const wallet = new WorkerWallet(worker, client);
|
|
65
|
+
// Warmup / readiness check — blocks until the worker has finished creating the TestWallet.
|
|
66
|
+
await wallet.getChainInfo();
|
|
67
|
+
return wallet;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
private async callRaw(fn: string, ...args: any[]): Promise<string> {
|
|
71
|
+
const argsJson = jsonStringify(args);
|
|
72
|
+
return (await this.client.request({ fn, args: argsJson })) as string;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
private async call(fn: string, ...args: any[]): Promise<any> {
|
|
76
|
+
const resultJson = await this.callRaw(fn, ...args);
|
|
77
|
+
const methodSchema = (WorkerWalletSchema as ApiSchema)[fn];
|
|
78
|
+
return methodSchema.returnType().parseAsync(JSON.parse(resultJson));
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
getChainInfo(): Promise<ChainInfo> {
|
|
82
|
+
return this.call('getChainInfo');
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
getContractMetadata(address: AztecAddress): Promise<ContractMetadata> {
|
|
86
|
+
return this.call('getContractMetadata', address);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
getContractClassMetadata(id: Fr): Promise<ContractClassMetadata> {
|
|
90
|
+
return this.call('getContractClassMetadata', id);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
getPrivateEvents<T>(
|
|
94
|
+
eventMetadata: EventMetadataDefinition,
|
|
95
|
+
eventFilter: PrivateEventFilter,
|
|
96
|
+
): Promise<PrivateEvent<T>[]> {
|
|
97
|
+
return this.call('getPrivateEvents', eventMetadata, eventFilter);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
registerSender(address: AztecAddress, alias?: string): Promise<AztecAddress> {
|
|
101
|
+
return this.call('registerSender', address, alias);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
getAddressBook(): Promise<Aliased<AztecAddress>[]> {
|
|
105
|
+
return this.call('getAddressBook');
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
getAccounts(): Promise<Aliased<AztecAddress>[]> {
|
|
109
|
+
return this.call('getAccounts');
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
registerContract(
|
|
113
|
+
instance: ContractInstanceWithAddress,
|
|
114
|
+
artifact?: ContractArtifact,
|
|
115
|
+
secretKey?: Fr,
|
|
116
|
+
): Promise<ContractInstanceWithAddress> {
|
|
117
|
+
return this.call('registerContract', instance, artifact, secretKey);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
simulateTx(exec: ExecutionPayload, opts: SimulateOptions): Promise<TxSimulationResult> {
|
|
121
|
+
return this.call('simulateTx', exec, opts);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
simulateUtility(call: FunctionCall, opts: SimulateUtilityOptions): Promise<UtilitySimulationResult> {
|
|
125
|
+
return this.call('simulateUtility', call, opts);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
profileTx(exec: ExecutionPayload, opts: ProfileOptions): Promise<TxProfileResult> {
|
|
129
|
+
return this.call('profileTx', exec, opts);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
sendTx<W extends InteractionWaitOptions = undefined>(
|
|
133
|
+
exec: ExecutionPayload,
|
|
134
|
+
opts: SendOptions<W>,
|
|
135
|
+
): Promise<SendReturn<W>> {
|
|
136
|
+
return this.call('sendTx', exec, opts);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
proveTx(exec: ExecutionPayload, opts: Omit<SendOptions, 'wait'>): Promise<Tx> {
|
|
140
|
+
return this.call('proveTx', exec, opts);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
/** Registers an account inside the worker's TestWallet, populating its accounts map. */
|
|
144
|
+
registerAccount(secret: Fr, salt: Fr): Promise<AztecAddress> {
|
|
145
|
+
return this.call('registerAccount', secret, salt);
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
createAuthWit(from: AztecAddress, messageHashOrIntent: IntentInnerHash | CallIntent): Promise<AuthWitness> {
|
|
149
|
+
return this.call('createAuthWit', from, messageHashOrIntent);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
requestCapabilities(manifest: AppCapabilities): Promise<WalletCapabilities> {
|
|
153
|
+
return this.call('requestCapabilities', manifest);
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
batch<const T extends readonly BatchedMethod[]>(methods: T): Promise<BatchResults<T>> {
|
|
157
|
+
return this.call('batch', methods);
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
/** Shuts down the worker thread and closes the transport. */
|
|
161
|
+
async stop(): Promise<void> {
|
|
162
|
+
this.client.close();
|
|
163
|
+
await this.worker.terminate();
|
|
164
|
+
}
|
|
165
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ExecutionPayloadSchema, SendOptionsSchema, WalletSchema } from '@aztec/aztec.js/wallet';
|
|
2
|
+
import { schemas } from '@aztec/foundation/schemas';
|
|
3
|
+
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
4
|
+
import { Tx } from '@aztec/stdlib/tx';
|
|
5
|
+
|
|
6
|
+
import { z } from 'zod';
|
|
7
|
+
|
|
8
|
+
/** Schema for the WorkerWallet API — extends WalletSchema with proveTx and registerAccount. */
|
|
9
|
+
export const WorkerWalletSchema = {
|
|
10
|
+
...WalletSchema,
|
|
11
|
+
proveTx: z.function().args(ExecutionPayloadSchema, SendOptionsSchema).returns(Tx.schema),
|
|
12
|
+
registerAccount: z.function().args(schemas.Fr, schemas.Fr).returns(AztecAddress.schema),
|
|
13
|
+
};
|