@aztec/end-to-end 0.0.1-commit.f650c0a5c → 0.0.1-commit.f7ea82942
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.js +2 -2
- package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts +3 -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 +1 -1
- package/dest/e2e_epochs/epochs_test.d.ts +16 -1
- package/dest/e2e_epochs/epochs_test.d.ts.map +1 -1
- package/dest/e2e_epochs/epochs_test.js +53 -5
- 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 +2 -2
- package/dest/e2e_p2p/p2p_network.d.ts +6 -3
- package/dest/e2e_p2p/p2p_network.d.ts.map +1 -1
- package/dest/e2e_p2p/p2p_network.js +38 -15
- package/dest/e2e_p2p/shared.d.ts +1 -1
- package/dest/e2e_p2p/shared.d.ts.map +1 -1
- package/dest/e2e_p2p/shared.js +20 -5
- package/dest/fixtures/fixtures.d.ts +12 -1
- package/dest/fixtures/fixtures.d.ts.map +1 -1
- package/dest/fixtures/fixtures.js +10 -0
- package/dest/fixtures/ha_setup.d.ts +2 -2
- package/dest/fixtures/ha_setup.d.ts.map +1 -1
- package/dest/fixtures/ha_setup.js +1 -1
- package/dest/fixtures/schnorr_hardcoded_account_contract.d.ts +25 -0
- package/dest/fixtures/schnorr_hardcoded_account_contract.d.ts.map +1 -0
- package/dest/fixtures/schnorr_hardcoded_account_contract.js +39 -0
- package/dest/fixtures/setup.d.ts +13 -7
- package/dest/fixtures/setup.d.ts.map +1 -1
- package/dest/fixtures/setup.js +22 -7
- package/dest/forward-compatibility/wallet_rpc_client.d.ts +7 -0
- package/dest/forward-compatibility/wallet_rpc_client.d.ts.map +1 -0
- package/dest/forward-compatibility/wallet_rpc_client.js +15 -0
- package/dest/forward-compatibility/wallet_service.d.ts +3 -0
- package/dest/forward-compatibility/wallet_service.d.ts.map +1 -0
- package/dest/forward-compatibility/wallet_service.js +109 -0
- package/dest/shared/gas_portal_test_harness.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 +0 -4
- package/dest/test-wallet/test_wallet.d.ts +13 -4
- package/dest/test-wallet/test_wallet.d.ts.map +1 -1
- package/dest/test-wallet/test_wallet.js +54 -25
- 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_schema.d.ts +7 -2
- package/dest/test-wallet/worker_wallet_schema.d.ts.map +1 -1
- package/package.json +39 -39
- package/src/bench/client_flows/client_flows_benchmark.ts +2 -2
- package/src/e2e_blacklist_token_contract/blacklist_token_contract_test.ts +3 -6
- package/src/e2e_epochs/epochs_test.ts +53 -4
- package/src/e2e_fees/fees_test.ts +4 -2
- package/src/e2e_p2p/p2p_network.ts +41 -16
- package/src/e2e_p2p/shared.ts +17 -4
- package/src/fixtures/fixtures.ts +22 -0
- package/src/fixtures/ha_setup.ts +4 -2
- package/src/fixtures/schnorr_hardcoded_account_contract.ts +49 -0
- package/src/fixtures/setup.ts +35 -8
- package/src/forward-compatibility/wallet_rpc_client.ts +14 -0
- package/src/forward-compatibility/wallet_service.ts +104 -0
- package/src/guides/up_quick_start.sh +0 -2
- package/src/legacy-jest-resolver.cjs +2 -2
- package/src/shared/gas_portal_test_harness.ts +0 -1
- package/src/shared/uniswap_l1_l2.ts +0 -4
- package/src/test-wallet/test_wallet.ts +56 -29
- package/src/test-wallet/worker_wallet.ts +3 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// Custom Jest resolver. When CONTRACT_ARTIFACTS_VERSION is set, redirects *only* JSON artifact files under
|
|
2
|
-
// @aztec/noir-contracts.js/artifacts
|
|
2
|
+
// @aztec/noir-contracts.js/artifacts/, @aztec/noir-test-contracts.js/artifacts/, and @aztec/accounts/artifacts/ to a local cache of the pinned
|
|
3
3
|
// legacy versions. TypeScript wrapper classes (e.g. Token.ts) continue to load from the current workspace and use the
|
|
4
4
|
// current @aztec/aztec.js — only the artifact JSON (the deployed-contract ABI / bytecode / notes surface) is swapped.
|
|
5
5
|
//
|
|
@@ -18,7 +18,7 @@ const fs = require('fs');
|
|
|
18
18
|
const { execSync } = require('child_process');
|
|
19
19
|
|
|
20
20
|
const version = process.env.CONTRACT_ARTIFACTS_VERSION;
|
|
21
|
-
const REDIRECTED = ['@aztec/noir-contracts.js', '@aztec/noir-test-contracts.js'];
|
|
21
|
+
const REDIRECTED = ['@aztec/noir-contracts.js', '@aztec/noir-test-contracts.js', '@aztec/accounts'];
|
|
22
22
|
|
|
23
23
|
// Jest sets rootDir to <e2e>/src; this file lives there too.
|
|
24
24
|
const e2eRoot = path.resolve(__dirname, '..');
|
|
@@ -154,7 +154,6 @@ export const uniswapL1L2TestSuite = (
|
|
|
154
154
|
await cleanup();
|
|
155
155
|
});
|
|
156
156
|
|
|
157
|
-
// docs:start:uniswap_private
|
|
158
157
|
it('should uniswap trade on L1 from L2 funds privately (swaps WETH -> DAI)', async () => {
|
|
159
158
|
const wethL1BeforeBalance = await wethCrossChainHarness.getL1BalanceOf(ownerEthAddress);
|
|
160
159
|
|
|
@@ -345,10 +344,8 @@ export const uniswapL1L2TestSuite = (
|
|
|
345
344
|
logger.info('WETH balance after swap : ', wethL2BalanceAfterSwap.toString());
|
|
346
345
|
logger.info('DAI balance after swap : ', daiL2BalanceAfterSwap.toString());
|
|
347
346
|
});
|
|
348
|
-
// docs:end:uniswap_private
|
|
349
347
|
|
|
350
348
|
// TODO(#7463): reenable look into this failure https://github.com/AztecProtocol/aztec-packages/actions/runs/9912612912/job/27388320150?pr=7462
|
|
351
|
-
// // docs:start:uniswap_public
|
|
352
349
|
// it('should uniswap trade on L1 from L2 funds publicly (swaps WETH -> DAI)', async () => {
|
|
353
350
|
// const wethL1BeforeBalance = await wethCrossChainHarness.getL1BalanceOf(ownerEthAddress);
|
|
354
351
|
|
|
@@ -581,7 +578,6 @@ export const uniswapL1L2TestSuite = (
|
|
|
581
578
|
// logger.info('WETH balance after swap : ', wethL2BalanceAfterSwap.toString());
|
|
582
579
|
// logger.info('DAI balance after swap : ', daiL2BalanceAfterSwap.toString());
|
|
583
580
|
// });
|
|
584
|
-
// // docs:end:uniswap_public
|
|
585
581
|
|
|
586
582
|
// Edge cases for the private flow:
|
|
587
583
|
// note - tests for uniswapPortal.sol and minting asset on L2 are covered in other tests.
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { EcdsaKAccountContract, EcdsaRAccountContract } from '@aztec/accounts/ecdsa';
|
|
2
2
|
import { SchnorrAccountContract } from '@aztec/accounts/schnorr';
|
|
3
|
-
import {
|
|
3
|
+
import { StubEcdsaAccountContractArtifact, createStubEcdsaAccount } from '@aztec/accounts/stub/ecdsa';
|
|
4
|
+
import { StubSchnorrAccountContractArtifact, createStubSchnorrAccount } from '@aztec/accounts/stub/schnorr';
|
|
4
5
|
import { type Account, type AccountContract, NO_FROM } from '@aztec/aztec.js/account';
|
|
6
|
+
import type { CompleteAddress } from '@aztec/aztec.js/addresses';
|
|
5
7
|
import {
|
|
6
8
|
type CallIntent,
|
|
7
9
|
type ContractFunctionInteractionCallIntent,
|
|
@@ -13,6 +15,7 @@ import {
|
|
|
13
15
|
} from '@aztec/aztec.js/authorization';
|
|
14
16
|
import type { AztecNode } from '@aztec/aztec.js/node';
|
|
15
17
|
import { AccountManager, type SendOptions } from '@aztec/aztec.js/wallet';
|
|
18
|
+
import { TxSimulationResultWithAppOffset } from '@aztec/aztec.js/wallet';
|
|
16
19
|
import type { DefaultAccountEntrypointOptions } from '@aztec/entrypoints/account';
|
|
17
20
|
import { DefaultEntrypoint } from '@aztec/entrypoints/default';
|
|
18
21
|
import { Fq, Fr } from '@aztec/foundation/curves/bn254';
|
|
@@ -32,11 +35,12 @@ import {
|
|
|
32
35
|
type TxExecutionRequest,
|
|
33
36
|
type TxHash,
|
|
34
37
|
type TxReceipt,
|
|
35
|
-
type TxSimulationResult,
|
|
36
38
|
} from '@aztec/stdlib/tx';
|
|
37
39
|
import { ExecutionPayload, mergeExecutionPayloads } from '@aztec/stdlib/tx';
|
|
38
40
|
import { BaseWallet, type SimulateViaEntrypointOptions } from '@aztec/wallet-sdk/base-wallet';
|
|
41
|
+
import type { AccountType } from '@aztec/wallets/embedded';
|
|
39
42
|
|
|
43
|
+
import { DEFAULT_MIN_FEE_PADDING } from '../fixtures/fixtures.js';
|
|
40
44
|
import { AztecNodeProxy, ProvenTx } from './utils.js';
|
|
41
45
|
|
|
42
46
|
/**
|
|
@@ -45,6 +49,7 @@ import { AztecNodeProxy, ProvenTx } from './utils.js';
|
|
|
45
49
|
export interface AccountData {
|
|
46
50
|
secret: Fr;
|
|
47
51
|
salt: Fr;
|
|
52
|
+
type?: AccountType;
|
|
48
53
|
contract: AccountContract;
|
|
49
54
|
}
|
|
50
55
|
|
|
@@ -59,6 +64,7 @@ export class TestWallet extends BaseWallet {
|
|
|
59
64
|
private readonly nodeRef: AztecNodeProxy,
|
|
60
65
|
) {
|
|
61
66
|
super(pxe, nodeRef);
|
|
67
|
+
this.minFeePadding = DEFAULT_MIN_FEE_PADDING;
|
|
62
68
|
}
|
|
63
69
|
|
|
64
70
|
static async create(
|
|
@@ -85,30 +91,25 @@ export class TestWallet extends BaseWallet {
|
|
|
85
91
|
|
|
86
92
|
createSchnorrAccount(secret: Fr, salt: Fr, signingKey?: Fq): Promise<AccountManager> {
|
|
87
93
|
signingKey = signingKey ?? deriveSigningKey(secret);
|
|
88
|
-
|
|
89
|
-
secret,
|
|
90
|
-
salt,
|
|
91
|
-
contract: new SchnorrAccountContract(signingKey),
|
|
92
|
-
};
|
|
93
|
-
return this.createAccount(accountData);
|
|
94
|
+
return this.createAccount({ secret, salt, type: 'schnorr', contract: new SchnorrAccountContract(signingKey) });
|
|
94
95
|
}
|
|
95
96
|
|
|
96
97
|
createECDSARAccount(secret: Fr, salt: Fr, signingKey: Buffer): Promise<AccountManager> {
|
|
97
|
-
|
|
98
|
+
return this.createAccount({
|
|
98
99
|
secret,
|
|
99
100
|
salt,
|
|
101
|
+
type: 'ecdsasecp256r1',
|
|
100
102
|
contract: new EcdsaRAccountContract(signingKey),
|
|
101
|
-
};
|
|
102
|
-
return this.createAccount(accountData);
|
|
103
|
+
});
|
|
103
104
|
}
|
|
104
105
|
|
|
105
106
|
createECDSAKAccount(secret: Fr, salt: Fr, signingKey: Buffer): Promise<AccountManager> {
|
|
106
|
-
|
|
107
|
+
return this.createAccount({
|
|
107
108
|
secret,
|
|
108
109
|
salt,
|
|
110
|
+
type: 'ecdsasecp256k1',
|
|
109
111
|
contract: new EcdsaKAccountContract(signingKey),
|
|
110
|
-
};
|
|
111
|
-
return this.createAccount(accountData);
|
|
112
|
+
});
|
|
112
113
|
}
|
|
113
114
|
|
|
114
115
|
/**
|
|
@@ -131,20 +132,40 @@ export class TestWallet extends BaseWallet {
|
|
|
131
132
|
);
|
|
132
133
|
}
|
|
133
134
|
|
|
134
|
-
const
|
|
135
|
+
const stubArtifact = this.getStubArtifactFor(address);
|
|
136
|
+
const stubConstructorArgs =
|
|
137
|
+
this.getTypeFor(address) === 'schnorr' ? [Fr.ZERO, Fr.ZERO] : [Buffer.alloc(32), Buffer.alloc(32)];
|
|
138
|
+
const stubInstance = await getContractInstanceFromInstantiationParams(stubArtifact, {
|
|
135
139
|
salt: Fr.random(),
|
|
140
|
+
constructorArgs: stubConstructorArgs,
|
|
136
141
|
});
|
|
137
142
|
|
|
138
143
|
contracts[address.toString()] = {
|
|
139
144
|
instance: stubInstance,
|
|
140
|
-
artifact:
|
|
145
|
+
artifact: stubArtifact,
|
|
141
146
|
};
|
|
142
147
|
}
|
|
143
148
|
|
|
144
149
|
return contracts;
|
|
145
150
|
}
|
|
146
151
|
|
|
147
|
-
protected accounts: Map<string, Account> = new Map();
|
|
152
|
+
protected accounts: Map<string, { account: Account; type: AccountType }> = new Map();
|
|
153
|
+
|
|
154
|
+
private getTypeFor(address: AztecAddress): AccountType {
|
|
155
|
+
return this.accounts.get(address.toString())?.type ?? 'schnorr';
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
private getStubArtifactFor(address: AztecAddress) {
|
|
159
|
+
return this.getTypeFor(address) === 'schnorr'
|
|
160
|
+
? StubSchnorrAccountContractArtifact
|
|
161
|
+
: StubEcdsaAccountContractArtifact;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
private getStubAccountFor(address: AztecAddress, completeAddress: CompleteAddress) {
|
|
165
|
+
return this.getTypeFor(address) === 'schnorr'
|
|
166
|
+
? createStubSchnorrAccount(completeAddress)
|
|
167
|
+
: createStubEcdsaAccount(completeAddress);
|
|
168
|
+
}
|
|
148
169
|
|
|
149
170
|
/**
|
|
150
171
|
* Controls how the test wallet simulates transactions:
|
|
@@ -159,26 +180,29 @@ export class TestWallet extends BaseWallet {
|
|
|
159
180
|
}
|
|
160
181
|
|
|
161
182
|
setMinFeePadding(value?: number) {
|
|
162
|
-
this.minFeePadding = value ??
|
|
183
|
+
this.minFeePadding = value ?? DEFAULT_MIN_FEE_PADDING;
|
|
163
184
|
}
|
|
164
185
|
|
|
165
186
|
protected getAccountFromAddress(address: AztecAddress): Promise<Account> {
|
|
166
|
-
const
|
|
187
|
+
const entry = this.accounts.get(address?.toString() ?? '');
|
|
167
188
|
|
|
168
|
-
if (!
|
|
189
|
+
if (!entry) {
|
|
169
190
|
throw new Error(`Account not found in wallet for address: ${address}`);
|
|
170
191
|
}
|
|
171
192
|
|
|
172
|
-
return Promise.resolve(account);
|
|
193
|
+
return Promise.resolve(entry.account);
|
|
173
194
|
}
|
|
174
195
|
|
|
175
196
|
getAccounts() {
|
|
176
|
-
return Promise.resolve(
|
|
197
|
+
return Promise.resolve(
|
|
198
|
+
Array.from(this.accounts.values()).map(entry => ({ alias: '', item: entry.account.getAddress() })),
|
|
199
|
+
);
|
|
177
200
|
}
|
|
178
201
|
|
|
179
202
|
async createAccount(accountData?: AccountData): Promise<AccountManager> {
|
|
180
203
|
const secret = accountData?.secret ?? Fr.random();
|
|
181
204
|
const salt = accountData?.salt ?? Fr.random();
|
|
205
|
+
const type = accountData?.type ?? 'schnorr';
|
|
182
206
|
const contract = accountData?.contract ?? new SchnorrAccountContract(GrumpkinScalar.random());
|
|
183
207
|
|
|
184
208
|
const accountManager = await AccountManager.create(this, secret, contract, salt);
|
|
@@ -188,7 +212,8 @@ export class TestWallet extends BaseWallet {
|
|
|
188
212
|
|
|
189
213
|
await this.registerContract(instance, artifact, secret);
|
|
190
214
|
|
|
191
|
-
|
|
215
|
+
const address = accountManager.address.toString();
|
|
216
|
+
this.accounts.set(address, { account: await accountManager.getAccount(), type });
|
|
192
217
|
|
|
193
218
|
return accountManager;
|
|
194
219
|
}
|
|
@@ -234,8 +259,9 @@ export class TestWallet extends BaseWallet {
|
|
|
234
259
|
protected override async simulateViaEntrypoint(
|
|
235
260
|
executionPayload: ExecutionPayload,
|
|
236
261
|
opts: SimulateViaEntrypointOptions,
|
|
237
|
-
): Promise<
|
|
238
|
-
const { from, feeOptions,
|
|
262
|
+
): Promise<TxSimulationResultWithAppOffset> {
|
|
263
|
+
const { from, feeOptions, additionalScopes, skipTxValidation, skipFeeEnforcement } = opts;
|
|
264
|
+
const scopes = this.scopesFrom(from, additionalScopes);
|
|
239
265
|
const skipKernels = this.simulationMode !== 'full';
|
|
240
266
|
const useOverride = this.simulationMode === 'kernelless-override';
|
|
241
267
|
|
|
@@ -248,7 +274,7 @@ export class TestWallet extends BaseWallet {
|
|
|
248
274
|
let overrides: SimulationOverrides | undefined;
|
|
249
275
|
let txRequest: TxExecutionRequest;
|
|
250
276
|
if (useOverride) {
|
|
251
|
-
const accountOverrides = await this.buildAccountOverrides(
|
|
277
|
+
const accountOverrides = await this.buildAccountOverrides(scopes);
|
|
252
278
|
overrides = new SimulationOverrides(accountOverrides);
|
|
253
279
|
}
|
|
254
280
|
|
|
@@ -259,8 +285,7 @@ export class TestWallet extends BaseWallet {
|
|
|
259
285
|
let fromAccount: Account;
|
|
260
286
|
if (useOverride) {
|
|
261
287
|
const originalAccount = await this.getAccountFromAddress(from);
|
|
262
|
-
|
|
263
|
-
fromAccount = createStubAccount(completeAddress);
|
|
288
|
+
fromAccount = this.getStubAccountFor(from, originalAccount.getCompleteAddress());
|
|
264
289
|
} else {
|
|
265
290
|
fromAccount = await this.getAccountFromAddress(from);
|
|
266
291
|
}
|
|
@@ -278,7 +303,7 @@ export class TestWallet extends BaseWallet {
|
|
|
278
303
|
);
|
|
279
304
|
}
|
|
280
305
|
|
|
281
|
-
|
|
306
|
+
const result = await this.pxe.simulateTx(txRequest, {
|
|
282
307
|
simulatePublic: true,
|
|
283
308
|
skipKernels,
|
|
284
309
|
skipFeeEnforcement,
|
|
@@ -286,6 +311,8 @@ export class TestWallet extends BaseWallet {
|
|
|
286
311
|
overrides,
|
|
287
312
|
scopes,
|
|
288
313
|
});
|
|
314
|
+
const appCallOffset = await this.computeAppCallOffset(from, feeOptions);
|
|
315
|
+
return TxSimulationResultWithAppOffset.fromResultAndOffset(result, appCallOffset);
|
|
289
316
|
}
|
|
290
317
|
|
|
291
318
|
async proveTx(exec: ExecutionPayload, opts: Omit<SendOptions, 'wait'>): Promise<ProvenTx> {
|
|
@@ -13,6 +13,7 @@ import type {
|
|
|
13
13
|
ProfileOptions,
|
|
14
14
|
SendOptions,
|
|
15
15
|
SimulateOptions,
|
|
16
|
+
TxSimulationResultWithAppOffset,
|
|
16
17
|
Wallet,
|
|
17
18
|
WalletCapabilities,
|
|
18
19
|
} from '@aztec/aztec.js/wallet';
|
|
@@ -29,7 +30,7 @@ import type { ContractArtifact, EventMetadataDefinition, FunctionCall } from '@a
|
|
|
29
30
|
import type { AuthWitness } from '@aztec/stdlib/auth-witness';
|
|
30
31
|
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
31
32
|
import type { ContractInstanceWithAddress } from '@aztec/stdlib/contract';
|
|
32
|
-
import type { ExecutionPayload, TxProfileResult,
|
|
33
|
+
import type { ExecutionPayload, TxProfileResult, UtilityExecutionResult } from '@aztec/stdlib/tx';
|
|
33
34
|
import { Tx } from '@aztec/stdlib/tx';
|
|
34
35
|
|
|
35
36
|
import { Worker } from 'worker_threads';
|
|
@@ -165,7 +166,7 @@ export class WorkerWallet implements Wallet {
|
|
|
165
166
|
return this.call('registerContract', instance, artifact, secretKey);
|
|
166
167
|
}
|
|
167
168
|
|
|
168
|
-
simulateTx(exec: ExecutionPayload, opts: SimulateOptions): Promise<
|
|
169
|
+
simulateTx(exec: ExecutionPayload, opts: SimulateOptions): Promise<TxSimulationResultWithAppOffset> {
|
|
169
170
|
return this.call('simulateTx', exec, opts);
|
|
170
171
|
}
|
|
171
172
|
|