@aztec/end-to-end 0.0.1-commit.f2ce05ee → 0.0.1-commit.f8ca9b2f3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. package/dest/bench/client_flows/client_flows_benchmark.d.ts +2 -2
  2. package/dest/bench/client_flows/client_flows_benchmark.d.ts.map +1 -1
  3. package/dest/bench/client_flows/client_flows_benchmark.js +1 -1
  4. package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts +2 -2
  5. package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts.map +1 -1
  6. package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts +2 -2
  7. package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts.map +1 -1
  8. package/dest/e2e_deploy_contract/deploy_test.d.ts +2 -2
  9. package/dest/e2e_deploy_contract/deploy_test.d.ts.map +1 -1
  10. package/dest/e2e_epochs/epochs_test.d.ts +1 -1
  11. package/dest/e2e_epochs/epochs_test.d.ts.map +1 -1
  12. package/dest/e2e_epochs/epochs_test.js +7 -2
  13. package/dest/e2e_fees/fees_test.d.ts +2 -2
  14. package/dest/e2e_fees/fees_test.d.ts.map +1 -1
  15. package/dest/e2e_p2p/p2p_network.d.ts +2 -2
  16. package/dest/e2e_p2p/p2p_network.d.ts.map +1 -1
  17. package/dest/e2e_p2p/shared.d.ts +2 -2
  18. package/dest/e2e_p2p/shared.d.ts.map +1 -1
  19. package/dest/e2e_p2p/shared.js +2 -1
  20. package/dest/e2e_token_contract/token_contract_test.d.ts +2 -2
  21. package/dest/e2e_token_contract/token_contract_test.d.ts.map +1 -1
  22. package/dest/fixtures/e2e_prover_test.d.ts +2 -2
  23. package/dest/fixtures/e2e_prover_test.d.ts.map +1 -1
  24. package/dest/fixtures/setup.d.ts +14 -14
  25. package/dest/fixtures/setup.d.ts.map +1 -1
  26. package/dest/fixtures/setup.js +12 -76
  27. package/dest/shared/submit-transactions.d.ts +2 -2
  28. package/dest/shared/submit-transactions.d.ts.map +1 -1
  29. package/dest/shared/uniswap_l1_l2.d.ts +1 -1
  30. package/dest/shared/uniswap_l1_l2.d.ts.map +1 -1
  31. package/dest/shared/uniswap_l1_l2.js +1 -1
  32. package/dest/spartan/setup_test_wallets.d.ts +2 -2
  33. package/dest/spartan/setup_test_wallets.d.ts.map +1 -1
  34. package/dest/spartan/setup_test_wallets.js +3 -1
  35. package/dest/test-wallet/test_wallet.d.ts +82 -0
  36. package/dest/test-wallet/test_wallet.d.ts.map +1 -0
  37. package/dest/test-wallet/test_wallet.js +213 -0
  38. package/dest/test-wallet/utils.d.ts +41 -0
  39. package/dest/test-wallet/utils.d.ts.map +1 -0
  40. package/dest/test-wallet/utils.js +71 -0
  41. package/package.json +40 -39
  42. package/src/bench/client_flows/client_flows_benchmark.ts +6 -6
  43. package/src/bench/utils.ts +1 -1
  44. package/src/e2e_blacklist_token_contract/blacklist_token_contract_test.ts +2 -2
  45. package/src/e2e_cross_chain_messaging/cross_chain_messaging_test.ts +4 -4
  46. package/src/e2e_deploy_contract/deploy_test.ts +3 -3
  47. package/src/e2e_epochs/epochs_test.ts +12 -3
  48. package/src/e2e_fees/bridging_race.notest.ts +1 -1
  49. package/src/e2e_fees/fees_test.ts +7 -7
  50. package/src/e2e_nested_contract/nested_contract_test.ts +1 -1
  51. package/src/e2e_p2p/inactivity_slash_test.ts +4 -4
  52. package/src/e2e_p2p/p2p_network.ts +5 -5
  53. package/src/e2e_p2p/reqresp/utils.ts +4 -4
  54. package/src/e2e_p2p/shared.ts +2 -1
  55. package/src/e2e_token_contract/token_contract_test.ts +2 -2
  56. package/src/fixtures/e2e_prover_test.ts +4 -4
  57. package/src/fixtures/setup.ts +22 -106
  58. package/src/shared/submit-transactions.ts +2 -1
  59. package/src/shared/uniswap_l1_l2.ts +2 -2
  60. package/src/spartan/setup_test_wallets.ts +3 -1
  61. package/src/test-wallet/test_wallet.ts +296 -0
  62. package/src/test-wallet/utils.ts +112 -0
@@ -0,0 +1,213 @@
1
+ import { EcdsaKAccountContract, EcdsaRAccountContract } from '@aztec/accounts/ecdsa';
2
+ import { SchnorrAccountContract } from '@aztec/accounts/schnorr';
3
+ import { StubAccountContractArtifact, createStubAccount } from '@aztec/accounts/stub';
4
+ import { SignerlessAccount } from '@aztec/aztec.js/account';
5
+ import { SetPublicAuthwitContractInteraction, computeInnerAuthWitHashFromAction, isContractFunctionInteractionCallIntent, lookupValidity } from '@aztec/aztec.js/authorization';
6
+ import { AccountManager } from '@aztec/aztec.js/wallet';
7
+ import { Fr } from '@aztec/foundation/curves/bn254';
8
+ import { GrumpkinScalar } from '@aztec/foundation/curves/grumpkin';
9
+ import { getPXEConfig } from '@aztec/pxe/config';
10
+ import { createPXE } from '@aztec/pxe/server';
11
+ import { AztecAddress } from '@aztec/stdlib/aztec-address';
12
+ import { getContractInstanceFromInstantiationParams } from '@aztec/stdlib/contract';
13
+ import { deriveSigningKey } from '@aztec/stdlib/keys';
14
+ import { mergeExecutionPayloads } from '@aztec/stdlib/tx';
15
+ import { BaseWallet } from '@aztec/wallet-sdk/base-wallet';
16
+ import { AztecNodeProxy, ProvenTx } from './utils.js';
17
+ /**
18
+ * Wallet implementation that stores accounts in memory and provides extra debugging
19
+ * utilities
20
+ * It is intended to be used in e2e tests.
21
+ */ export class TestWallet extends BaseWallet {
22
+ nodeRef;
23
+ constructor(pxe, nodeRef){
24
+ super(pxe, nodeRef), this.nodeRef = nodeRef, this.accounts = new Map(), this.simulatedSimulations = false;
25
+ }
26
+ static async create(node, overridePXEConfig, options = {
27
+ loggers: {}
28
+ }) {
29
+ const nodeRef = new AztecNodeProxy(node);
30
+ const pxeConfig = Object.assign(getPXEConfig(), {
31
+ proverEnabled: overridePXEConfig?.proverEnabled ?? false,
32
+ ...overridePXEConfig
33
+ });
34
+ const pxe = await createPXE(nodeRef, pxeConfig, options);
35
+ return new TestWallet(pxe, nodeRef);
36
+ }
37
+ /**
38
+ * Updates the underlying node that this wallet and its PXE communicate with.
39
+ * @param node - The new AztecNode to forward all calls to.
40
+ */ updateNode(node) {
41
+ this.nodeRef.updateTargetNode(node);
42
+ }
43
+ createSchnorrAccount(secret, salt, signingKey) {
44
+ signingKey = signingKey ?? deriveSigningKey(secret);
45
+ const accountData = {
46
+ secret,
47
+ salt,
48
+ contract: new SchnorrAccountContract(signingKey)
49
+ };
50
+ return this.createAccount(accountData);
51
+ }
52
+ createECDSARAccount(secret, salt, signingKey) {
53
+ const accountData = {
54
+ secret,
55
+ salt,
56
+ contract: new EcdsaRAccountContract(signingKey)
57
+ };
58
+ return this.createAccount(accountData);
59
+ }
60
+ createECDSAKAccount(secret, salt, signingKey) {
61
+ const accountData = {
62
+ secret,
63
+ salt,
64
+ contract: new EcdsaKAccountContract(signingKey)
65
+ };
66
+ return this.createAccount(accountData);
67
+ }
68
+ async getFakeAccountDataFor(address) {
69
+ const originalAccount = await this.getAccountFromAddress(address);
70
+ if (originalAccount instanceof SignerlessAccount) {
71
+ throw new Error(`Cannot create fake account data for SignerlessAccount at address: ${address}`);
72
+ }
73
+ const originalAddress = originalAccount.getCompleteAddress();
74
+ const contractInstance = await this.pxe.getContractInstance(originalAddress.address);
75
+ if (!contractInstance) {
76
+ throw new Error(`No contract instance found for address: ${originalAddress.address}`);
77
+ }
78
+ const stubAccount = createStubAccount(originalAddress);
79
+ const instance = await getContractInstanceFromInstantiationParams(StubAccountContractArtifact, {
80
+ salt: Fr.random()
81
+ });
82
+ return {
83
+ account: stubAccount,
84
+ instance,
85
+ artifact: StubAccountContractArtifact
86
+ };
87
+ }
88
+ accounts;
89
+ /**
90
+ * Toggle for running "simulated simulations" when calling simulateTx.
91
+ *
92
+ * When this flag is true, simulateViaEntrypoint constructs a request using a fake account
93
+ * (and accepts contract overrides on the input) and the PXE emulates kernel effects without
94
+ * generating kernel witnesses. When false, simulateViaEntrypoint defers to the standard
95
+ * simulation path via the real account entrypoint.
96
+ */ simulatedSimulations;
97
+ enableSimulatedSimulations() {
98
+ this.simulatedSimulations = true;
99
+ }
100
+ disableSimulatedSimulations() {
101
+ this.simulatedSimulations = false;
102
+ }
103
+ setMinFeePadding(value) {
104
+ this.minFeePadding = value ?? 0.5;
105
+ }
106
+ getAccountFromAddress(address) {
107
+ let account;
108
+ if (address.equals(AztecAddress.ZERO)) {
109
+ account = new SignerlessAccount();
110
+ } else {
111
+ account = this.accounts.get(address?.toString() ?? '');
112
+ }
113
+ if (!account) {
114
+ throw new Error(`Account not found in wallet for address: ${address}`);
115
+ }
116
+ return Promise.resolve(account);
117
+ }
118
+ getAccounts() {
119
+ return Promise.resolve(Array.from(this.accounts.values()).map((acc)=>({
120
+ alias: '',
121
+ item: acc.getAddress()
122
+ })));
123
+ }
124
+ async createAccount(accountData) {
125
+ const secret = accountData?.secret ?? Fr.random();
126
+ const salt = accountData?.salt ?? Fr.random();
127
+ const contract = accountData?.contract ?? new SchnorrAccountContract(GrumpkinScalar.random());
128
+ const accountManager = await AccountManager.create(this, secret, contract, salt);
129
+ const instance = accountManager.getInstance();
130
+ const artifact = await contract.getContractArtifact();
131
+ await this.registerContract(instance, artifact, secret);
132
+ this.accounts.set(accountManager.address.toString(), await accountManager.getAccount());
133
+ return accountManager;
134
+ }
135
+ lookupValidity(onBehalfOf, intent, witness) {
136
+ return lookupValidity(this, onBehalfOf, intent, witness);
137
+ }
138
+ setPublicAuthWit(from, messageHashOrIntent, authorized) {
139
+ return SetPublicAuthwitContractInteraction.create(this, from, messageHashOrIntent, authorized);
140
+ }
141
+ async createAuthWit(from, intent) {
142
+ const account = await this.getAccountFromAddress(from);
143
+ const chainInfo = await this.getChainInfo();
144
+ let intentInnerHash;
145
+ if ('caller' in intent) {
146
+ const call = isContractFunctionInteractionCallIntent(intent) ? await intent.action.getFunctionCall() : intent.call;
147
+ const innerHash = await computeInnerAuthWitHashFromAction(intent.caller, call);
148
+ intentInnerHash = {
149
+ innerHash,
150
+ consumer: call.to
151
+ };
152
+ } else {
153
+ intentInnerHash = intent;
154
+ }
155
+ return account.createAuthWit(intentInnerHash, chainInfo);
156
+ }
157
+ /**
158
+ * Override simulateViaEntrypoint to use fake accounts for kernelless simulation
159
+ * when simulatedSimulations is enabled. Otherwise falls through to the real entrypoint path.
160
+ */ async simulateViaEntrypoint(executionPayload, from, feeOptions, skipTxValidation, skipFeeEnforcement) {
161
+ if (!this.simulatedSimulations) {
162
+ return super.simulateViaEntrypoint(executionPayload, from, feeOptions, skipTxValidation, skipFeeEnforcement);
163
+ }
164
+ const feeExecutionPayload = await feeOptions.walletFeePaymentMethod?.getExecutionPayload();
165
+ const executionOptions = {
166
+ txNonce: Fr.random(),
167
+ cancellable: this.cancellableTransactions,
168
+ feePaymentMethodOptions: feeOptions.accountFeePaymentMethodOptions
169
+ };
170
+ const finalExecutionPayload = feeExecutionPayload ? mergeExecutionPayloads([
171
+ feeExecutionPayload,
172
+ executionPayload
173
+ ]) : executionPayload;
174
+ const { account: fromAccount, instance, artifact } = await this.getFakeAccountDataFor(from);
175
+ const chainInfo = await this.getChainInfo();
176
+ const txRequest = await fromAccount.createTxExecutionRequest(finalExecutionPayload, feeOptions.gasSettings, chainInfo, executionOptions);
177
+ const contractOverrides = {
178
+ [from.toString()]: {
179
+ instance,
180
+ artifact
181
+ }
182
+ };
183
+ return this.pxe.simulateTx(txRequest, {
184
+ simulatePublic: true,
185
+ skipFeeEnforcement: true,
186
+ skipTxValidation: true,
187
+ overrides: {
188
+ contracts: contractOverrides
189
+ }
190
+ });
191
+ }
192
+ async proveTx(exec, opts) {
193
+ const fee = await this.completeFeeOptions(opts.from, exec.feePayer, opts.fee?.gasSettings);
194
+ const txRequest = await this.createTxExecutionRequestFromPayloadAndFee(exec, opts.from, fee);
195
+ const txProvingResult = await this.pxe.proveTx(txRequest);
196
+ return new ProvenTx(this.aztecNode, await txProvingResult.toTx(), txProvingResult.getOffchainEffects(), txProvingResult.stats);
197
+ }
198
+ getTxReceipt(txHash) {
199
+ return this.aztecNode.getTxReceipt(txHash);
200
+ }
201
+ getNotes(filter) {
202
+ return this.pxe.debug.getNotes(filter);
203
+ }
204
+ getSyncedBlockHeader() {
205
+ return this.pxe.getSyncedBlockHeader();
206
+ }
207
+ sync() {
208
+ return this.pxe.debug.sync();
209
+ }
210
+ stop() {
211
+ return this.pxe.stop();
212
+ }
213
+ }
@@ -0,0 +1,41 @@
1
+ import { ContractFunctionInteraction, DeployMethod, type DeployOptions, type NoWait, type SendInteractionOptions, type WaitOpts } from '@aztec/aztec.js/contracts';
2
+ import { type AztecNode } from '@aztec/aztec.js/node';
3
+ import { type OffchainEffect, type ProvingStats, Tx, TxHash, type TxReceipt } from '@aztec/stdlib/tx';
4
+ import type { TestWallet } from './test_wallet.js';
5
+ export type ProvenTxSendOpts = {
6
+ wait?: NoWait | WaitOpts;
7
+ };
8
+ export type ProvenTxSendReturn<T extends NoWait | WaitOpts | undefined> = T extends NoWait ? TxHash : TxReceipt;
9
+ export declare class ProvenTx extends Tx {
10
+ private node;
11
+ offchainEffects: OffchainEffect[];
12
+ stats?: ProvingStats | undefined;
13
+ constructor(node: AztecNode, tx: Tx, offchainEffects: OffchainEffect[], stats?: ProvingStats | undefined);
14
+ send(options?: Omit<ProvenTxSendOpts, 'wait'>): Promise<TxReceipt>;
15
+ send<W extends ProvenTxSendOpts['wait']>(options: ProvenTxSendOpts & {
16
+ wait: W;
17
+ }): Promise<ProvenTxSendReturn<W>>;
18
+ private contextualizeError;
19
+ }
20
+ export declare function proveInteraction(wallet: TestWallet, interaction: ContractFunctionInteraction | DeployMethod, options: SendInteractionOptions | DeployOptions): Promise<ProvenTx>;
21
+ /**
22
+ * Extends AztecNode via declaration merging so instances can be used wherever AztecNode is expected.
23
+ * The actual method forwarding is handled by a Proxy in the class constructor.
24
+ */
25
+ export interface AztecNodeProxy extends AztecNode {
26
+ }
27
+ /**
28
+ * Mutable wrapper around an AztecNode that forwards all calls to the current target.
29
+ * Allows swapping the underlying node at runtime via updateTargetNode, which is useful
30
+ * for tests that need to redirect a wallet from one node to another without recreating it.
31
+ */
32
+ export declare class AztecNodeProxy {
33
+ private target;
34
+ constructor(target: AztecNode);
35
+ /**
36
+ * Updates the underlying node that this reference points to.
37
+ * @param node - The new node to forward calls to.
38
+ */
39
+ updateTargetNode(node: AztecNode): void;
40
+ }
41
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidXRpbHMuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy90ZXN0LXdhbGxldC91dGlscy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQ0wsMkJBQTJCLEVBQzNCLFlBQVksRUFDWixLQUFLLGFBQWEsRUFFbEIsS0FBSyxNQUFNLEVBQ1gsS0FBSyxzQkFBc0IsRUFDM0IsS0FBSyxRQUFRLEVBRWQsTUFBTSwyQkFBMkIsQ0FBQztBQUNuQyxPQUFPLEVBQUUsS0FBSyxTQUFTLEVBQWEsTUFBTSxzQkFBc0IsQ0FBQztBQUVqRSxPQUFPLEVBQUUsS0FBSyxjQUFjLEVBQUUsS0FBSyxZQUFZLEVBQUUsRUFBRSxFQUFFLE1BQU0sRUFBRSxLQUFLLFNBQVMsRUFBRSxNQUFNLGtCQUFrQixDQUFDO0FBSXRHLE9BQU8sS0FBSyxFQUFFLFVBQVUsRUFBRSxNQUFNLGtCQUFrQixDQUFDO0FBRW5ELE1BQU0sTUFBTSxnQkFBZ0IsR0FBRztJQUM3QixJQUFJLENBQUMsRUFBRSxNQUFNLEdBQUcsUUFBUSxDQUFDO0NBQzFCLENBQUM7QUFFRixNQUFNLE1BQU0sa0JBQWtCLENBQUMsQ0FBQyxTQUFTLE1BQU0sR0FBRyxRQUFRLEdBQUcsU0FBUyxJQUFJLENBQUMsU0FBUyxNQUFNLEdBQUcsTUFBTSxHQUFHLFNBQVMsQ0FBQztBQUVoSCxxQkFBYSxRQUFTLFNBQVEsRUFBRTtJQUU1QixPQUFPL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AAE,2BAA2B,GAAG,YAAY,EACvD,OAAO,EAAE,sBAAsB,GAAG,aAAa,qBAShD;AAED;;;GAGG;AAEH,MAAM,WAAW,cAAe,SAAQ,SAAS;CAAG;AAEpD;;;;GAIG;AAEH,qBAAa,cAAc;IACb,OAAO,CAAC,MAAM;IAA1B,YAAoB,MAAM,EAAE,SAAS,EAYpC;IAED;;;OAGG;IACH,gBAAgB,CAAC,IAAI,EAAE,SAAS,GAAG,IAAI,CAEtC;CACF"}
@@ -0,0 +1,71 @@
1
+ import { DeployMethod, NO_WAIT, toSendOptions } from '@aztec/aztec.js/contracts';
2
+ import { waitForTx } from '@aztec/aztec.js/node';
3
+ import { SimulationError } from '@aztec/stdlib/errors';
4
+ import { Tx } from '@aztec/stdlib/tx';
5
+ import { inspect } from 'util';
6
+ export class ProvenTx extends Tx {
7
+ node;
8
+ offchainEffects;
9
+ stats;
10
+ constructor(node, tx, offchainEffects, stats){
11
+ super(tx.getTxHash(), tx.data, tx.chonkProof, tx.contractClassLogFields, tx.publicFunctionCalldata), this.node = node, this.offchainEffects = offchainEffects, this.stats = stats;
12
+ }
13
+ async send(options) {
14
+ const txHash = this.getTxHash();
15
+ await this.node.sendTx(this).catch((err)=>{
16
+ throw this.contextualizeError(err, inspect(this));
17
+ });
18
+ if (options?.wait === NO_WAIT) {
19
+ return txHash;
20
+ }
21
+ const waitOpts = typeof options?.wait === 'object' ? options.wait : undefined;
22
+ return await waitForTx(this.node, txHash, waitOpts);
23
+ }
24
+ contextualizeError(err, ...context) {
25
+ let contextStr = '';
26
+ if (context.length > 0) {
27
+ contextStr = `\nContext:\n${context.join('\n')}`;
28
+ }
29
+ if (err instanceof SimulationError) {
30
+ err.setAztecContext(contextStr);
31
+ }
32
+ return err;
33
+ }
34
+ }
35
+ export async function proveInteraction(wallet, interaction, options) {
36
+ let execPayload;
37
+ if (interaction instanceof DeployMethod) {
38
+ execPayload = await interaction.request(interaction.convertDeployOptionsToRequestOptions(options));
39
+ } else {
40
+ execPayload = await interaction.request(options);
41
+ }
42
+ return wallet.proveTx(execPayload, toSendOptions(options));
43
+ }
44
+ /**
45
+ * Mutable wrapper around an AztecNode that forwards all calls to the current target.
46
+ * Allows swapping the underlying node at runtime via updateTargetNode, which is useful
47
+ * for tests that need to redirect a wallet from one node to another without recreating it.
48
+ */ // eslint-disable-next-line @typescript-eslint/no-unsafe-declaration-merging
49
+ export class AztecNodeProxy {
50
+ target;
51
+ constructor(target){
52
+ this.target = target;
53
+ return new Proxy(this, {
54
+ get: (obj, prop, receiver)=>{
55
+ // Own properties and methods (updateTargetNode, target) are served directly.
56
+ if (Reflect.has(obj, prop)) {
57
+ return Reflect.get(obj, prop, receiver);
58
+ }
59
+ // Everything else is forwarded to the current target node.
60
+ const val = obj.target[prop];
61
+ return typeof val === 'function' ? val.bind(obj.target) : val;
62
+ }
63
+ });
64
+ }
65
+ /**
66
+ * Updates the underlying node that this reference points to.
67
+ * @param node - The new node to forward calls to.
68
+ */ updateTargetNode(node) {
69
+ this.target = node;
70
+ }
71
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aztec/end-to-end",
3
- "version": "0.0.1-commit.f2ce05ee",
3
+ "version": "0.0.1-commit.f8ca9b2f3",
4
4
  "type": "module",
5
5
  "exports": "./dest/index.js",
6
6
  "inherits": [
@@ -26,44 +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.f2ce05ee",
30
- "@aztec/archiver": "0.0.1-commit.f2ce05ee",
31
- "@aztec/aztec": "0.0.1-commit.f2ce05ee",
32
- "@aztec/aztec-node": "0.0.1-commit.f2ce05ee",
33
- "@aztec/aztec.js": "0.0.1-commit.f2ce05ee",
34
- "@aztec/bb-prover": "0.0.1-commit.f2ce05ee",
35
- "@aztec/bb.js": "0.0.1-commit.f2ce05ee",
36
- "@aztec/blob-client": "0.0.1-commit.f2ce05ee",
37
- "@aztec/blob-lib": "0.0.1-commit.f2ce05ee",
38
- "@aztec/bot": "0.0.1-commit.f2ce05ee",
39
- "@aztec/cli": "0.0.1-commit.f2ce05ee",
40
- "@aztec/constants": "0.0.1-commit.f2ce05ee",
41
- "@aztec/entrypoints": "0.0.1-commit.f2ce05ee",
42
- "@aztec/epoch-cache": "0.0.1-commit.f2ce05ee",
43
- "@aztec/ethereum": "0.0.1-commit.f2ce05ee",
44
- "@aztec/foundation": "0.0.1-commit.f2ce05ee",
45
- "@aztec/kv-store": "0.0.1-commit.f2ce05ee",
46
- "@aztec/l1-artifacts": "0.0.1-commit.f2ce05ee",
47
- "@aztec/merkle-tree": "0.0.1-commit.f2ce05ee",
48
- "@aztec/node-keystore": "0.0.1-commit.f2ce05ee",
49
- "@aztec/noir-contracts.js": "0.0.1-commit.f2ce05ee",
50
- "@aztec/noir-noirc_abi": "0.0.1-commit.f2ce05ee",
51
- "@aztec/noir-protocol-circuits-types": "0.0.1-commit.f2ce05ee",
52
- "@aztec/noir-test-contracts.js": "0.0.1-commit.f2ce05ee",
53
- "@aztec/p2p": "0.0.1-commit.f2ce05ee",
54
- "@aztec/protocol-contracts": "0.0.1-commit.f2ce05ee",
55
- "@aztec/prover-client": "0.0.1-commit.f2ce05ee",
56
- "@aztec/prover-node": "0.0.1-commit.f2ce05ee",
57
- "@aztec/pxe": "0.0.1-commit.f2ce05ee",
58
- "@aztec/sequencer-client": "0.0.1-commit.f2ce05ee",
59
- "@aztec/simulator": "0.0.1-commit.f2ce05ee",
60
- "@aztec/slasher": "0.0.1-commit.f2ce05ee",
61
- "@aztec/stdlib": "0.0.1-commit.f2ce05ee",
62
- "@aztec/telemetry-client": "0.0.1-commit.f2ce05ee",
63
- "@aztec/test-wallet": "0.0.1-commit.f2ce05ee",
64
- "@aztec/validator-client": "0.0.1-commit.f2ce05ee",
65
- "@aztec/validator-ha-signer": "0.0.1-commit.f2ce05ee",
66
- "@aztec/world-state": "0.0.1-commit.f2ce05ee",
29
+ "@aztec/accounts": "0.0.1-commit.f8ca9b2f3",
30
+ "@aztec/archiver": "0.0.1-commit.f8ca9b2f3",
31
+ "@aztec/aztec": "0.0.1-commit.f8ca9b2f3",
32
+ "@aztec/aztec-node": "0.0.1-commit.f8ca9b2f3",
33
+ "@aztec/aztec.js": "0.0.1-commit.f8ca9b2f3",
34
+ "@aztec/bb-prover": "0.0.1-commit.f8ca9b2f3",
35
+ "@aztec/bb.js": "0.0.1-commit.f8ca9b2f3",
36
+ "@aztec/blob-client": "0.0.1-commit.f8ca9b2f3",
37
+ "@aztec/blob-lib": "0.0.1-commit.f8ca9b2f3",
38
+ "@aztec/bot": "0.0.1-commit.f8ca9b2f3",
39
+ "@aztec/cli": "0.0.1-commit.f8ca9b2f3",
40
+ "@aztec/constants": "0.0.1-commit.f8ca9b2f3",
41
+ "@aztec/entrypoints": "0.0.1-commit.f8ca9b2f3",
42
+ "@aztec/epoch-cache": "0.0.1-commit.f8ca9b2f3",
43
+ "@aztec/ethereum": "0.0.1-commit.f8ca9b2f3",
44
+ "@aztec/foundation": "0.0.1-commit.f8ca9b2f3",
45
+ "@aztec/kv-store": "0.0.1-commit.f8ca9b2f3",
46
+ "@aztec/l1-artifacts": "0.0.1-commit.f8ca9b2f3",
47
+ "@aztec/merkle-tree": "0.0.1-commit.f8ca9b2f3",
48
+ "@aztec/node-keystore": "0.0.1-commit.f8ca9b2f3",
49
+ "@aztec/noir-contracts.js": "0.0.1-commit.f8ca9b2f3",
50
+ "@aztec/noir-noirc_abi": "0.0.1-commit.f8ca9b2f3",
51
+ "@aztec/noir-protocol-circuits-types": "0.0.1-commit.f8ca9b2f3",
52
+ "@aztec/noir-test-contracts.js": "0.0.1-commit.f8ca9b2f3",
53
+ "@aztec/p2p": "0.0.1-commit.f8ca9b2f3",
54
+ "@aztec/protocol-contracts": "0.0.1-commit.f8ca9b2f3",
55
+ "@aztec/prover-client": "0.0.1-commit.f8ca9b2f3",
56
+ "@aztec/prover-node": "0.0.1-commit.f8ca9b2f3",
57
+ "@aztec/pxe": "0.0.1-commit.f8ca9b2f3",
58
+ "@aztec/sequencer-client": "0.0.1-commit.f8ca9b2f3",
59
+ "@aztec/simulator": "0.0.1-commit.f8ca9b2f3",
60
+ "@aztec/slasher": "0.0.1-commit.f8ca9b2f3",
61
+ "@aztec/stdlib": "0.0.1-commit.f8ca9b2f3",
62
+ "@aztec/telemetry-client": "0.0.1-commit.f8ca9b2f3",
63
+ "@aztec/validator-client": "0.0.1-commit.f8ca9b2f3",
64
+ "@aztec/validator-ha-signer": "0.0.1-commit.f8ca9b2f3",
65
+ "@aztec/wallet-sdk": "0.0.1-commit.f8ca9b2f3",
66
+ "@aztec/wallets": "0.0.1-commit.f8ca9b2f3",
67
+ "@aztec/world-state": "0.0.1-commit.f8ca9b2f3",
67
68
  "@iarna/toml": "^2.2.5",
68
69
  "@jest/globals": "^30.0.0",
69
70
  "@noble/curves": "=1.0.0",
@@ -26,7 +26,6 @@ import { type PXEConfig, getPXEConfig } from '@aztec/pxe/server';
26
26
  import type { ContractInstanceWithAddress } from '@aztec/stdlib/contract';
27
27
  import { GasSettings } from '@aztec/stdlib/gas';
28
28
  import { deriveSigningKey } from '@aztec/stdlib/keys';
29
- import { TestWallet } from '@aztec/test-wallet/server';
30
29
 
31
30
  import { MNEMONIC } from '../../fixtures/fixtures.js';
32
31
  import { type EndToEndContext, type SetupOptions, deployAccounts, setup, teardown } from '../../fixtures/setup.js';
@@ -37,6 +36,7 @@ import {
37
36
  FeeJuicePortalTestingHarnessFactory,
38
37
  type GasBridgingTestHarness,
39
38
  } from '../../shared/gas_portal_test_harness.js';
39
+ import { TestWallet } from '../../test-wallet/test_wallet.js';
40
40
  import { ProxyLogger } from './benchmark.js';
41
41
  import { type ClientFlowsConfig, FULL_FLOWS_CONFIG, KEY_FLOWS_CONFIG } from './config.js';
42
42
 
@@ -138,10 +138,10 @@ export class ClientFlowsBenchmark {
138
138
  });
139
139
  await this.applyBaseSetup();
140
140
 
141
- await this.context.aztecNodeService!.setConfig({ feeRecipient: this.sequencerAddress, coinbase: this.coinbase });
141
+ await this.context.aztecNodeService.setConfig({ feeRecipient: this.sequencerAddress, coinbase: this.coinbase });
142
142
 
143
143
  const rollupContract = RollupContract.getFromConfig(this.context.config);
144
- this.chainMonitor = new ChainMonitor(rollupContract, this.context.dateProvider!, this.logger, 200).start();
144
+ this.chainMonitor = new ChainMonitor(rollupContract, this.context.dateProvider, this.logger, 200).start();
145
145
 
146
146
  return this;
147
147
  }
@@ -207,7 +207,7 @@ export class ClientFlowsBenchmark {
207
207
  const [{ address: adminAddress }, { address: sequencerAddress }] = deployedAccounts;
208
208
 
209
209
  this.adminWallet = this.context.wallet;
210
- this.aztecNode = this.context.aztecNodeService!;
210
+ this.aztecNode = this.context.aztecNodeService;
211
211
  this.cheatCodes = this.context.cheatCodes;
212
212
 
213
213
  this.adminAddress = adminAddress;
@@ -235,8 +235,8 @@ export class ClientFlowsBenchmark {
235
235
  this.feeJuiceContract = FeeJuiceContract.at(ProtocolContractAddress.FeeJuice, this.adminWallet);
236
236
 
237
237
  this.feeJuiceBridgeTestHarness = await FeeJuicePortalTestingHarnessFactory.create({
238
- aztecNode: this.context.aztecNodeService!,
239
- aztecNodeAdmin: this.context.aztecNodeService!,
238
+ aztecNode: this.context.aztecNodeService,
239
+ aztecNodeAdmin: this.context.aztecNodeService,
240
240
  l1Client: this.context.deployL1ContractsValues.l1Client,
241
241
  wallet: this.adminWallet,
242
242
  logger: this.logger,
@@ -28,7 +28,7 @@ export async function benchmarkSetup(
28
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
- const telemetry = context.telemetryClient! as BenchmarkTelemetryClient;
31
+ const telemetry = context.telemetryClient as BenchmarkTelemetryClient;
32
32
  context.logger.warn(`Cleared benchmark data points from setup`);
33
33
  telemetry.clear();
34
34
  const origTeardown = context.teardown.bind(context);
@@ -9,12 +9,12 @@ import type { TokenContract } from '@aztec/noir-contracts.js/Token';
9
9
  import { TokenBlacklistContract } from '@aztec/noir-contracts.js/TokenBlacklist';
10
10
  import { InvalidAccountContract } from '@aztec/noir-test-contracts.js/InvalidAccount';
11
11
  import type { SequencerClient } from '@aztec/sequencer-client';
12
- import type { TestWallet } from '@aztec/test-wallet/server';
13
12
 
14
13
  import { jest } from '@jest/globals';
15
14
 
16
15
  import { type EndToEndContext, deployAccounts, publicDeployAccounts, setup, teardown } from '../fixtures/setup.js';
17
16
  import { TokenSimulator } from '../simulators/token_simulator.js';
17
+ import type { TestWallet } from '../test-wallet/test_wallet.js';
18
18
 
19
19
  export class Role {
20
20
  private isAdmin = false;
@@ -92,7 +92,7 @@ export class BlacklistTokenContractTest {
92
92
  });
93
93
 
94
94
  this.cheatCodes = this.context.cheatCodes;
95
- this.aztecNode = this.context.aztecNodeService!;
95
+ this.aztecNode = this.context.aztecNodeService;
96
96
  this.sequencer = this.context.sequencer!;
97
97
  this.wallet = this.context.wallet;
98
98
  this.adminAddress = deployedAccounts[0].address;
@@ -19,7 +19,6 @@ import { TestERC20Abi, TestERC20Bytecode } from '@aztec/l1-artifacts';
19
19
  import { TokenContract } from '@aztec/noir-contracts.js/Token';
20
20
  import { TokenBridgeContract } from '@aztec/noir-contracts.js/TokenBridge';
21
21
  import type { AztecNodeAdmin } from '@aztec/stdlib/interfaces/client';
22
- import type { TestWallet } from '@aztec/test-wallet/server';
23
22
 
24
23
  import { MNEMONIC } from '../fixtures/fixtures.js';
25
24
  import {
@@ -31,6 +30,7 @@ import {
31
30
  teardown,
32
31
  } from '../fixtures/setup.js';
33
32
  import { CrossChainTestHarness } from '../shared/cross_chain_test_harness.js';
33
+ import type { TestWallet } from '../test-wallet/test_wallet.js';
34
34
 
35
35
  export class CrossChainMessagingTest {
36
36
  private requireEpochProven: boolean;
@@ -109,16 +109,16 @@ export class CrossChainMessagingTest {
109
109
 
110
110
  async applyBaseSetup() {
111
111
  // Set up base context fields
112
- this.aztecNode = this.context.aztecNodeService!;
112
+ this.aztecNode = this.context.aztecNodeService;
113
113
  this.wallet = this.context.wallet;
114
114
  this.aztecNodeConfig = this.context.config;
115
115
  this.cheatCodes = this.context.cheatCodes;
116
116
  this.deployL1ContractsValues = this.context.deployL1ContractsValues;
117
- this.aztecNodeAdmin = this.context.aztecNodeService!;
117
+ this.aztecNodeAdmin = this.context.aztecNodeService;
118
118
 
119
119
  if (this.requireEpochProven) {
120
120
  // Turn off the watcher to prevent it from keep marking blocks as proven.
121
- this.context.watcher!.setIsMarkingAsProven(false);
121
+ this.context.watcher.setIsMarkingAsProven(false);
122
122
  }
123
123
 
124
124
  // Deploy 3 accounts
@@ -8,9 +8,9 @@ import type { AztecNode } from '@aztec/aztec.js/node';
8
8
  import type { Wallet } from '@aztec/aztec.js/wallet';
9
9
  import type { StatefulTestContract } from '@aztec/noir-test-contracts.js/StatefulTest';
10
10
  import type { AztecNodeAdmin } from '@aztec/stdlib/interfaces/client';
11
- import type { TestWallet } from '@aztec/test-wallet/server';
12
11
 
13
12
  import { type EndToEndContext, deployAccounts, setup, teardown } from '../fixtures/setup.js';
13
+ import type { TestWallet } from '../test-wallet/test_wallet.js';
14
14
 
15
15
  export class DeployTest {
16
16
  public context!: EndToEndContext;
@@ -30,9 +30,9 @@ export class DeployTest {
30
30
  fundSponsoredFPC: true,
31
31
  skipAccountDeployment: true,
32
32
  });
33
- this.aztecNode = this.context.aztecNodeService!;
33
+ this.aztecNode = this.context.aztecNodeService;
34
34
  this.wallet = this.context.wallet;
35
- this.aztecNodeAdmin = this.context.aztecNodeService!;
35
+ this.aztecNodeAdmin = this.context.aztecNodeService;
36
36
  await this.applyInitialAccount();
37
37
  return this;
38
38
  }
@@ -213,10 +213,14 @@ export class EpochsTestContext {
213
213
  this.logger.warn('Creating and syncing a simulated prover node...');
214
214
  const proverNodePrivateKey = this.getNextPrivateKey();
215
215
  const proverIndex = this.proverNodes.length + 1;
216
+ const { mockGossipSubNetwork } = this.context;
216
217
  const proverNode = await withLoggerBindings({ actor: `prover-${proverIndex}` }, () =>
217
218
  createAndSyncProverNode(
218
219
  proverNodePrivateKey,
219
- { ...this.context.config },
220
+ {
221
+ ...this.context.config,
222
+ p2pEnabled: this.context.config.p2pEnabled || mockGossipSubNetwork !== undefined,
223
+ },
220
224
  {
221
225
  dataDirectory: join(this.context.config.dataDirectory!, randomBytes(8).toString('hex')),
222
226
  proverId: EthAddress.fromNumber(proverIndex),
@@ -225,7 +229,12 @@ export class EpochsTestContext {
225
229
  },
226
230
  this.context.aztecNode,
227
231
  this.context.prefilledPublicData ?? [],
228
- { dateProvider: this.context.dateProvider },
232
+ {
233
+ dateProvider: this.context.dateProvider,
234
+ p2pClientDeps: mockGossipSubNetwork
235
+ ? { p2pServiceFactory: getMockPubSubP2PServiceFactory(mockGossipSubNetwork) }
236
+ : undefined,
237
+ },
229
238
  ),
230
239
  );
231
240
  this.proverNodes.push(proverNode);
@@ -405,7 +414,7 @@ export class EpochsTestContext {
405
414
  privateKeyToAccount(this.getNextPrivateKey()),
406
415
  this.l1Client.chain,
407
416
  ),
408
- this.context.dateProvider!,
417
+ this.context.dateProvider,
409
418
  { ethereumSlotDuration: this.L1_BLOCK_TIME_IN_S },
410
419
  );
411
420
  expect(await client.getBalance({ address: client.account.address })).toBeGreaterThan(0n);
@@ -4,11 +4,11 @@ import type { Logger } from '@aztec/aztec.js/log';
4
4
  import { Fq } from '@aztec/foundation/curves/bn254';
5
5
  import { sleep } from '@aztec/foundation/sleep';
6
6
  import type { AztecAddress } from '@aztec/stdlib/aztec-address';
7
- import type { TestWallet } from '@aztec/test-wallet/server';
8
7
 
9
8
  import { jest } from '@jest/globals';
10
9
  import type { Hex } from 'viem';
11
10
 
11
+ import type { TestWallet } from '../test-wallet/test_wallet.js';
12
12
  import { FeesTest } from './fees_test.js';
13
13
 
14
14
  jest.setTimeout(300_000);