@aztec/end-to-end 0.0.1-commit.f504929 → 0.0.1-commit.f650c0a5c
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/README.md +27 -0
- 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 +21 -29
- package/dest/e2e_epochs/epochs_test.d.ts +3 -1
- package/dest/e2e_epochs/epochs_test.d.ts.map +1 -1
- package/dest/e2e_epochs/epochs_test.js +8 -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 +9 -2
- package/dest/e2e_p2p/inactivity_slash_test.js +3 -3
- package/dest/e2e_p2p/p2p_network.d.ts +6 -8
- package/dest/e2e_p2p/p2p_network.d.ts.map +1 -1
- package/dest/e2e_p2p/p2p_network.js +9 -13
- package/dest/e2e_p2p/reqresp/utils.d.ts +1 -1
- package/dest/e2e_p2p/reqresp/utils.d.ts.map +1 -1
- package/dest/e2e_p2p/reqresp/utils.js +16 -3
- package/dest/e2e_p2p/shared.d.ts +16 -12
- package/dest/e2e_p2p/shared.d.ts.map +1 -1
- package/dest/e2e_p2p/shared.js +33 -51
- package/dest/fixtures/authwit_proxy.d.ts +1 -1
- package/dest/fixtures/authwit_proxy.d.ts.map +1 -1
- package/dest/fixtures/authwit_proxy.js +4 -0
- package/dest/fixtures/e2e_prover_test.d.ts +4 -3
- package/dest/fixtures/e2e_prover_test.d.ts.map +1 -1
- package/dest/fixtures/e2e_prover_test.js +7 -12
- package/dest/fixtures/get_bb_config.d.ts +1 -1
- package/dest/fixtures/get_bb_config.d.ts.map +1 -1
- package/dest/fixtures/get_bb_config.js +5 -5
- package/dest/fixtures/setup.d.ts +10 -4
- package/dest/fixtures/setup.d.ts.map +1 -1
- package/dest/fixtures/setup.js +20 -15
- package/dest/fixtures/setup_p2p_test.d.ts +6 -6
- package/dest/fixtures/setup_p2p_test.d.ts.map +1 -1
- package/dest/fixtures/setup_p2p_test.js +8 -8
- package/dest/fixtures/token_utils.d.ts +1 -1
- package/dest/fixtures/token_utils.d.ts.map +1 -1
- package/dest/fixtures/token_utils.js +2 -5
- package/dest/legacy-jest-resolver.d.cts +3 -0
- package/dest/legacy-jest-resolver.d.cts.map +1 -0
- 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 +9 -12
- 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.js +1 -1
- package/dest/spartan/setup_test_wallets.d.ts +4 -2
- package/dest/spartan/setup_test_wallets.d.ts.map +1 -1
- package/dest/spartan/setup_test_wallets.js +70 -40
- 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 +1 -0
- 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/pod_logs.d.ts +25 -0
- package/dest/spartan/utils/pod_logs.d.ts.map +1 -0
- package/dest/spartan/utils/pod_logs.js +74 -0
- package/dest/test-wallet/test_wallet.d.ts +15 -23
- package/dest/test-wallet/test_wallet.d.ts.map +1 -1
- package/dest/test-wallet/test_wallet.js +72 -64
- package/dest/test-wallet/worker_wallet_schema.d.ts +2 -2
- package/package.json +40 -40
- package/src/bench/client_flows/client_flows_benchmark.ts +35 -23
- package/src/e2e_epochs/epochs_test.ts +17 -5
- package/src/e2e_fees/fees_test.ts +5 -2
- package/src/e2e_p2p/inactivity_slash_test.ts +3 -3
- package/src/e2e_p2p/p2p_network.ts +17 -24
- package/src/e2e_p2p/reqresp/utils.ts +24 -3
- package/src/e2e_p2p/shared.ts +36 -67
- package/src/fixtures/authwit_proxy.ts +4 -0
- package/src/fixtures/e2e_prover_test.ts +12 -17
- package/src/fixtures/get_bb_config.ts +7 -6
- package/src/fixtures/setup.ts +29 -21
- package/src/fixtures/setup_p2p_test.ts +9 -9
- package/src/fixtures/token_utils.ts +1 -4
- package/src/legacy-jest-resolver.cjs +135 -0
- package/src/shared/uniswap_l1_l2.ts +29 -24
- package/src/simulators/lending_simulator.ts +4 -2
- package/src/simulators/token_simulator.ts +1 -1
- package/src/spartan/setup_test_wallets.ts +97 -35
- package/src/spartan/utils/config.ts +1 -0
- package/src/spartan/utils/index.ts +3 -0
- package/src/spartan/utils/pod_logs.ts +99 -0
- package/src/test-wallet/test_wallet.ts +99 -79
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
import { EcdsaKAccountContract, EcdsaRAccountContract } from '@aztec/accounts/ecdsa';
|
|
2
2
|
import { SchnorrAccountContract } from '@aztec/accounts/schnorr';
|
|
3
3
|
import { StubAccountContractArtifact, createStubAccount } from '@aztec/accounts/stub';
|
|
4
|
-
import {
|
|
4
|
+
import { NO_FROM } from '@aztec/aztec.js/account';
|
|
5
5
|
import { SetPublicAuthwitContractInteraction, computeInnerAuthWitHashFromAction, isContractFunctionInteractionCallIntent, lookupValidity } from '@aztec/aztec.js/authorization';
|
|
6
6
|
import { AccountManager } from '@aztec/aztec.js/wallet';
|
|
7
|
+
import { DefaultEntrypoint } from '@aztec/entrypoints/default';
|
|
7
8
|
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
8
9
|
import { GrumpkinScalar } from '@aztec/foundation/curves/grumpkin';
|
|
9
10
|
import { getPXEConfig } from '@aztec/pxe/config';
|
|
10
11
|
import { createPXE } from '@aztec/pxe/server';
|
|
11
|
-
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
12
12
|
import { getContractInstanceFromInstantiationParams } from '@aztec/stdlib/contract';
|
|
13
13
|
import { deriveSigningKey } from '@aztec/stdlib/keys';
|
|
14
|
+
import { SimulationOverrides } from '@aztec/stdlib/tx';
|
|
14
15
|
import { mergeExecutionPayloads } from '@aztec/stdlib/tx';
|
|
15
16
|
import { BaseWallet } from '@aztec/wallet-sdk/base-wallet';
|
|
16
17
|
import { AztecNodeProxy, ProvenTx } from './utils.js';
|
|
@@ -21,7 +22,7 @@ import { AztecNodeProxy, ProvenTx } from './utils.js';
|
|
|
21
22
|
*/ export class TestWallet extends BaseWallet {
|
|
22
23
|
nodeRef;
|
|
23
24
|
constructor(pxe, nodeRef){
|
|
24
|
-
super(pxe, nodeRef), this.nodeRef = nodeRef, this.accounts = new Map(), this.
|
|
25
|
+
super(pxe, nodeRef), this.nodeRef = nodeRef, this.accounts = new Map(), this.simulationMode = 'kernelless';
|
|
25
26
|
}
|
|
26
27
|
static async create(node, overridePXEConfig, options = {
|
|
27
28
|
loggers: {}
|
|
@@ -65,51 +66,45 @@ import { AztecNodeProxy, ProvenTx } from './utils.js';
|
|
|
65
66
|
};
|
|
66
67
|
return this.createAccount(accountData);
|
|
67
68
|
}
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
}
|
|
73
|
-
const
|
|
74
|
-
const
|
|
75
|
-
|
|
76
|
-
|
|
69
|
+
/**
|
|
70
|
+
* Builds contract overrides for all provided addresses by replacing their account contracts with stub implementations.
|
|
71
|
+
*/ async buildAccountOverrides(addresses) {
|
|
72
|
+
const accounts = await this.getAccounts();
|
|
73
|
+
const contracts = {};
|
|
74
|
+
const filtered = accounts.filter((acc)=>addresses.some((addr)=>addr.equals(acc.item)));
|
|
75
|
+
for (const account of filtered){
|
|
76
|
+
const address = account.item;
|
|
77
|
+
const originalAccount = await this.getAccountFromAddress(address);
|
|
78
|
+
const completeAddress = originalAccount.getCompleteAddress();
|
|
79
|
+
const contractInstance = await this.pxe.getContractInstance(completeAddress.address);
|
|
80
|
+
if (!contractInstance) {
|
|
81
|
+
throw new Error(`No contract instance found for address: ${completeAddress.address} during account override building. This is a bug!`);
|
|
82
|
+
}
|
|
83
|
+
const stubInstance = await getContractInstanceFromInstantiationParams(StubAccountContractArtifact, {
|
|
84
|
+
salt: Fr.random()
|
|
85
|
+
});
|
|
86
|
+
contracts[address.toString()] = {
|
|
87
|
+
instance: stubInstance,
|
|
88
|
+
artifact: StubAccountContractArtifact
|
|
89
|
+
};
|
|
77
90
|
}
|
|
78
|
-
|
|
79
|
-
const instance = await getContractInstanceFromInstantiationParams(StubAccountContractArtifact, {
|
|
80
|
-
salt: Fr.random()
|
|
81
|
-
});
|
|
82
|
-
return {
|
|
83
|
-
account: stubAccount,
|
|
84
|
-
instance,
|
|
85
|
-
artifact: StubAccountContractArtifact
|
|
86
|
-
};
|
|
91
|
+
return contracts;
|
|
87
92
|
}
|
|
88
93
|
accounts;
|
|
89
94
|
/**
|
|
90
|
-
*
|
|
91
|
-
*
|
|
92
|
-
*
|
|
93
|
-
*
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
enableSimulatedSimulations() {
|
|
98
|
-
this.simulatedSimulations = true;
|
|
99
|
-
}
|
|
100
|
-
disableSimulatedSimulations() {
|
|
101
|
-
this.simulatedSimulations = false;
|
|
95
|
+
* Controls how the test wallet simulates transactions:
|
|
96
|
+
* - `kernelless`: Skips kernel circuits but uses the real account contract. Default.
|
|
97
|
+
* - `kernelless-override`: Skips kernels and replaces the account with a stub that doesn't do authwit validation.
|
|
98
|
+
* - `full`: Uses real kernel circuits and real account contracts. Slow!
|
|
99
|
+
*/ simulationMode;
|
|
100
|
+
setSimulationMode(mode) {
|
|
101
|
+
this.simulationMode = mode;
|
|
102
102
|
}
|
|
103
103
|
setMinFeePadding(value) {
|
|
104
104
|
this.minFeePadding = value ?? 0.5;
|
|
105
105
|
}
|
|
106
106
|
getAccountFromAddress(address) {
|
|
107
|
-
|
|
108
|
-
if (address.equals(AztecAddress.ZERO)) {
|
|
109
|
-
account = new SignerlessAccount();
|
|
110
|
-
} else {
|
|
111
|
-
account = this.accounts.get(address?.toString() ?? '');
|
|
112
|
-
}
|
|
107
|
+
const account = this.accounts.get(address?.toString() ?? '');
|
|
113
108
|
if (!account) {
|
|
114
109
|
throw new Error(`Account not found in wallet for address: ${address}`);
|
|
115
110
|
}
|
|
@@ -154,44 +149,57 @@ import { AztecNodeProxy, ProvenTx } from './utils.js';
|
|
|
154
149
|
}
|
|
155
150
|
return account.createAuthWit(intentInnerHash, chainInfo);
|
|
156
151
|
}
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
if (!this.simulatedSimulations) {
|
|
162
|
-
return super.simulateViaEntrypoint(executionPayload, from, feeOptions, scopes, skipTxValidation, skipFeeEnforcement);
|
|
163
|
-
}
|
|
152
|
+
async simulateViaEntrypoint(executionPayload, opts) {
|
|
153
|
+
const { from, feeOptions, scopes, skipTxValidation, skipFeeEnforcement } = opts;
|
|
154
|
+
const skipKernels = this.simulationMode !== 'full';
|
|
155
|
+
const useOverride = this.simulationMode === 'kernelless-override';
|
|
164
156
|
const feeExecutionPayload = await feeOptions.walletFeePaymentMethod?.getExecutionPayload();
|
|
165
|
-
const executionOptions = {
|
|
166
|
-
txNonce: Fr.random(),
|
|
167
|
-
cancellable: this.cancellableTransactions,
|
|
168
|
-
feePaymentMethodOptions: feeOptions.accountFeePaymentMethodOptions
|
|
169
|
-
};
|
|
170
157
|
const finalExecutionPayload = feeExecutionPayload ? mergeExecutionPayloads([
|
|
171
158
|
feeExecutionPayload,
|
|
172
159
|
executionPayload
|
|
173
160
|
]) : executionPayload;
|
|
174
|
-
const { account: fromAccount, instance, artifact } = await this.getFakeAccountDataFor(from);
|
|
175
161
|
const chainInfo = await this.getChainInfo();
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
162
|
+
let overrides;
|
|
163
|
+
let txRequest;
|
|
164
|
+
if (useOverride) {
|
|
165
|
+
const accountOverrides = await this.buildAccountOverrides(this.scopesFrom(from, opts.additionalScopes));
|
|
166
|
+
overrides = new SimulationOverrides(accountOverrides);
|
|
167
|
+
}
|
|
168
|
+
if (from === NO_FROM) {
|
|
169
|
+
const entrypoint = new DefaultEntrypoint();
|
|
170
|
+
txRequest = await entrypoint.createTxExecutionRequest(finalExecutionPayload, feeOptions.gasSettings, chainInfo);
|
|
171
|
+
} else {
|
|
172
|
+
let fromAccount;
|
|
173
|
+
if (useOverride) {
|
|
174
|
+
const originalAccount = await this.getAccountFromAddress(from);
|
|
175
|
+
const completeAddress = originalAccount.getCompleteAddress();
|
|
176
|
+
fromAccount = createStubAccount(completeAddress);
|
|
177
|
+
} else {
|
|
178
|
+
fromAccount = await this.getAccountFromAddress(from);
|
|
181
179
|
}
|
|
182
|
-
|
|
180
|
+
const executionOptions = {
|
|
181
|
+
txNonce: Fr.random(),
|
|
182
|
+
cancellable: this.cancellableTransactions,
|
|
183
|
+
// If from is an address, feeOptions include the way the account contract should handle the fee payment
|
|
184
|
+
feePaymentMethodOptions: feeOptions.accountFeePaymentMethodOptions
|
|
185
|
+
};
|
|
186
|
+
txRequest = await fromAccount.createTxExecutionRequest(finalExecutionPayload, feeOptions.gasSettings, chainInfo, executionOptions);
|
|
187
|
+
}
|
|
183
188
|
return this.pxe.simulateTx(txRequest, {
|
|
184
189
|
simulatePublic: true,
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
},
|
|
190
|
+
skipKernels,
|
|
191
|
+
skipFeeEnforcement,
|
|
192
|
+
skipTxValidation,
|
|
193
|
+
overrides,
|
|
190
194
|
scopes
|
|
191
195
|
});
|
|
192
196
|
}
|
|
193
197
|
async proveTx(exec, opts) {
|
|
194
|
-
const fee = await this.completeFeeOptions(
|
|
198
|
+
const fee = await this.completeFeeOptions({
|
|
199
|
+
from: opts.from,
|
|
200
|
+
feePayer: exec.feePayer,
|
|
201
|
+
gasSettings: opts.fee?.gasSettings
|
|
202
|
+
});
|
|
195
203
|
const txRequest = await this.createTxExecutionRequestFromPayloadAndFee(exec, opts.from, fee);
|
|
196
204
|
const txProvingResult = await this.pxe.proveTx(txRequest, this.scopesFrom(opts.from, opts.additionalScopes));
|
|
197
205
|
return new ProvenTx(this.aztecNode, await txProvingResult.toTx(), txProvingResult.getOffchainEffects(), txProvingResult.stats);
|
|
@@ -82,7 +82,7 @@ export declare const WorkerWalletSchema: {
|
|
|
82
82
|
extraHashedArgs: any[];
|
|
83
83
|
feePayer?: any;
|
|
84
84
|
}>, z.ZodObject<{
|
|
85
|
-
from: import("@aztec/foundation/schemas").ZodFor<AztecAddress>;
|
|
85
|
+
from: z.ZodUnion<[import("@aztec/foundation/schemas").ZodFor<AztecAddress>, z.ZodLiteral<"NO_FROM">]>;
|
|
86
86
|
authWitnesses: import("@aztec/foundation/schemas").ZodNullableOptional<z.ZodArray<z.ZodType<import("@aztec/stdlib/auth-witness").AuthWitness, any, string>, "many">>;
|
|
87
87
|
capsules: import("@aztec/foundation/schemas").ZodNullableOptional<z.ZodArray<z.ZodType<import("@aztec/stdlib/tx").Capsule, any, string>, "many">>;
|
|
88
88
|
fee: import("@aztec/foundation/schemas").ZodNullableOptional<z.ZodObject<{
|
|
@@ -213,7 +213,7 @@ export declare const WorkerWalletSchema: {
|
|
|
213
213
|
}>]>>;
|
|
214
214
|
additionalScopes: import("@aztec/foundation/schemas").ZodNullableOptional<z.ZodArray<import("@aztec/foundation/schemas").ZodFor<AztecAddress>, "many">>;
|
|
215
215
|
}, "strip", z.ZodTypeAny, {
|
|
216
|
-
from: AztecAddress;
|
|
216
|
+
from: "NO_FROM" | AztecAddress;
|
|
217
217
|
authWitnesses?: import("@aztec/stdlib/auth-witness").AuthWitness[] | undefined;
|
|
218
218
|
capsules?: import("@aztec/stdlib/tx").Capsule[] | undefined;
|
|
219
219
|
fee?: {
|
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.f650c0a5c",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": "./dest/index.js",
|
|
6
6
|
"inherits": [
|
|
@@ -26,45 +26,44 @@
|
|
|
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/
|
|
48
|
-
"@aztec/
|
|
49
|
-
"@aztec/noir-
|
|
50
|
-
"@aztec/noir-
|
|
51
|
-
"@aztec/noir-
|
|
52
|
-
"@aztec/
|
|
53
|
-
"@aztec/
|
|
54
|
-
"@aztec/
|
|
55
|
-
"@aztec/prover-
|
|
56
|
-
"@aztec/
|
|
57
|
-
"@aztec/
|
|
58
|
-
"@aztec/
|
|
59
|
-
"@aztec/
|
|
60
|
-
"@aztec/
|
|
61
|
-
"@aztec/
|
|
62
|
-
"@aztec/
|
|
63
|
-
"@aztec/validator-
|
|
64
|
-
"@aztec/
|
|
65
|
-
"@aztec/
|
|
66
|
-
"@aztec/
|
|
67
|
-
"@aztec/world-state": "0.0.1-commit.f504929",
|
|
29
|
+
"@aztec/accounts": "0.0.1-commit.f650c0a5c",
|
|
30
|
+
"@aztec/archiver": "0.0.1-commit.f650c0a5c",
|
|
31
|
+
"@aztec/aztec": "0.0.1-commit.f650c0a5c",
|
|
32
|
+
"@aztec/aztec-node": "0.0.1-commit.f650c0a5c",
|
|
33
|
+
"@aztec/aztec.js": "0.0.1-commit.f650c0a5c",
|
|
34
|
+
"@aztec/bb-prover": "0.0.1-commit.f650c0a5c",
|
|
35
|
+
"@aztec/bb.js": "0.0.1-commit.f650c0a5c",
|
|
36
|
+
"@aztec/blob-client": "0.0.1-commit.f650c0a5c",
|
|
37
|
+
"@aztec/blob-lib": "0.0.1-commit.f650c0a5c",
|
|
38
|
+
"@aztec/bot": "0.0.1-commit.f650c0a5c",
|
|
39
|
+
"@aztec/cli": "0.0.1-commit.f650c0a5c",
|
|
40
|
+
"@aztec/constants": "0.0.1-commit.f650c0a5c",
|
|
41
|
+
"@aztec/entrypoints": "0.0.1-commit.f650c0a5c",
|
|
42
|
+
"@aztec/epoch-cache": "0.0.1-commit.f650c0a5c",
|
|
43
|
+
"@aztec/ethereum": "0.0.1-commit.f650c0a5c",
|
|
44
|
+
"@aztec/foundation": "0.0.1-commit.f650c0a5c",
|
|
45
|
+
"@aztec/kv-store": "0.0.1-commit.f650c0a5c",
|
|
46
|
+
"@aztec/l1-artifacts": "0.0.1-commit.f650c0a5c",
|
|
47
|
+
"@aztec/node-keystore": "0.0.1-commit.f650c0a5c",
|
|
48
|
+
"@aztec/noir-contracts.js": "0.0.1-commit.f650c0a5c",
|
|
49
|
+
"@aztec/noir-noirc_abi": "0.0.1-commit.f650c0a5c",
|
|
50
|
+
"@aztec/noir-protocol-circuits-types": "0.0.1-commit.f650c0a5c",
|
|
51
|
+
"@aztec/noir-test-contracts.js": "0.0.1-commit.f650c0a5c",
|
|
52
|
+
"@aztec/p2p": "0.0.1-commit.f650c0a5c",
|
|
53
|
+
"@aztec/protocol-contracts": "0.0.1-commit.f650c0a5c",
|
|
54
|
+
"@aztec/prover-client": "0.0.1-commit.f650c0a5c",
|
|
55
|
+
"@aztec/prover-node": "0.0.1-commit.f650c0a5c",
|
|
56
|
+
"@aztec/pxe": "0.0.1-commit.f650c0a5c",
|
|
57
|
+
"@aztec/sequencer-client": "0.0.1-commit.f650c0a5c",
|
|
58
|
+
"@aztec/simulator": "0.0.1-commit.f650c0a5c",
|
|
59
|
+
"@aztec/slasher": "0.0.1-commit.f650c0a5c",
|
|
60
|
+
"@aztec/stdlib": "0.0.1-commit.f650c0a5c",
|
|
61
|
+
"@aztec/telemetry-client": "0.0.1-commit.f650c0a5c",
|
|
62
|
+
"@aztec/validator-client": "0.0.1-commit.f650c0a5c",
|
|
63
|
+
"@aztec/validator-ha-signer": "0.0.1-commit.f650c0a5c",
|
|
64
|
+
"@aztec/wallet-sdk": "0.0.1-commit.f650c0a5c",
|
|
65
|
+
"@aztec/wallets": "0.0.1-commit.f650c0a5c",
|
|
66
|
+
"@aztec/world-state": "0.0.1-commit.f650c0a5c",
|
|
68
67
|
"@iarna/toml": "^2.2.5",
|
|
69
68
|
"@jest/globals": "^30.0.0",
|
|
70
69
|
"@noble/curves": "=1.0.0",
|
|
@@ -160,6 +159,7 @@
|
|
|
160
159
|
"moduleNameMapper": {
|
|
161
160
|
"^(\\.{1,2}/.*)\\.[cm]?js$": "$1"
|
|
162
161
|
},
|
|
162
|
+
"resolver": "<rootDir>/legacy-jest-resolver.cjs",
|
|
163
163
|
"testRegex": "./src/.*\\.test\\.(js|mjs|ts)$",
|
|
164
164
|
"rootDir": "./src",
|
|
165
165
|
"testTimeout": 120000,
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
+
import { NO_FROM } from '@aztec/aztec.js/account';
|
|
1
2
|
import { AztecAddress } from '@aztec/aztec.js/addresses';
|
|
2
3
|
import { FeeJuicePaymentMethodWithClaim } from '@aztec/aztec.js/fee';
|
|
3
4
|
import { type FeePaymentMethod, PrivateFeePaymentMethod, SponsoredFeePaymentMethod } from '@aztec/aztec.js/fee';
|
|
4
5
|
import { type Logger, createLogger } from '@aztec/aztec.js/log';
|
|
5
6
|
import type { AztecNode } from '@aztec/aztec.js/node';
|
|
6
7
|
import type { Wallet } from '@aztec/aztec.js/wallet';
|
|
7
|
-
import { CheatCodes } from '@aztec/aztec/testing';
|
|
8
|
+
import { CheatCodes, getTokenAllowedSetupFunctions } from '@aztec/aztec/testing';
|
|
8
9
|
import { createExtendedL1Client } from '@aztec/ethereum/client';
|
|
9
10
|
import { RollupContract } from '@aztec/ethereum/contracts';
|
|
10
11
|
import type { DeployAztecL1ContractsArgs } from '@aztec/ethereum/deploy-aztec-l1-contracts';
|
|
@@ -130,11 +131,14 @@ export class ClientFlowsBenchmark {
|
|
|
130
131
|
|
|
131
132
|
async setup() {
|
|
132
133
|
this.logger.info('Setting up subsystems from fresh');
|
|
134
|
+
// Token allowlist entries are test-only: FPC-based fee payment with custom tokens won't work on mainnet alpha.
|
|
135
|
+
const tokenAllowList = await getTokenAllowedSetupFunctions();
|
|
133
136
|
this.context = await setup(0, {
|
|
134
137
|
...this.setupOptions,
|
|
135
138
|
fundSponsoredFPC: true,
|
|
136
139
|
skipAccountDeployment: true,
|
|
137
140
|
l1ContractsArgs: this.setupOptions,
|
|
141
|
+
txPublicSetupAllowListExtend: [...(this.setupOptions.txPublicSetupAllowListExtend ?? []), ...tokenAllowList],
|
|
138
142
|
});
|
|
139
143
|
await this.applyBaseSetup();
|
|
140
144
|
|
|
@@ -246,11 +250,14 @@ export class ClientFlowsBenchmark {
|
|
|
246
250
|
|
|
247
251
|
async applyDeployBananaToken() {
|
|
248
252
|
this.logger.info('Applying banana token deployment');
|
|
249
|
-
const {
|
|
250
|
-
|
|
251
|
-
|
|
253
|
+
const { contract: bananaCoin, instance: bananaCoinInstance } = await BananaCoin.deploy(
|
|
254
|
+
this.adminWallet,
|
|
255
|
+
this.adminAddress,
|
|
256
|
+
'BC',
|
|
257
|
+
'BC',
|
|
258
|
+
18n,
|
|
259
|
+
).send({
|
|
252
260
|
from: this.adminAddress,
|
|
253
|
-
wait: { returnReceipt: true },
|
|
254
261
|
});
|
|
255
262
|
this.logger.info(`BananaCoin deployed at ${bananaCoin.address}`);
|
|
256
263
|
this.bananaCoin = bananaCoin;
|
|
@@ -259,11 +266,14 @@ export class ClientFlowsBenchmark {
|
|
|
259
266
|
|
|
260
267
|
async applyDeployCandyBarToken() {
|
|
261
268
|
this.logger.info('Applying candy bar token deployment');
|
|
262
|
-
const {
|
|
263
|
-
|
|
264
|
-
|
|
269
|
+
const { contract: candyBarCoin, instance: candyBarCoinInstance } = await TokenContract.deploy(
|
|
270
|
+
this.adminWallet,
|
|
271
|
+
this.adminAddress,
|
|
272
|
+
'CBC',
|
|
273
|
+
'CBC',
|
|
274
|
+
18n,
|
|
275
|
+
).send({
|
|
265
276
|
from: this.adminAddress,
|
|
266
|
-
wait: { returnReceipt: true },
|
|
267
277
|
});
|
|
268
278
|
this.logger.info(`CandyBarCoin deployed at ${candyBarCoin.address}`);
|
|
269
279
|
this.candyBarCoin = candyBarCoin;
|
|
@@ -276,11 +286,12 @@ export class ClientFlowsBenchmark {
|
|
|
276
286
|
expect((await this.context.wallet.getContractMetadata(feeJuiceContract.address)).isContractPublished).toBe(true);
|
|
277
287
|
|
|
278
288
|
const bananaCoin = this.bananaCoin;
|
|
279
|
-
const {
|
|
280
|
-
|
|
281
|
-
|
|
289
|
+
const { contract: bananaFPC, instance: bananaFPCInstance } = await FPCContract.deploy(
|
|
290
|
+
this.adminWallet,
|
|
291
|
+
bananaCoin.address,
|
|
292
|
+
this.adminAddress,
|
|
293
|
+
).send({
|
|
282
294
|
from: this.adminAddress,
|
|
283
|
-
wait: { returnReceipt: true },
|
|
284
295
|
});
|
|
285
296
|
|
|
286
297
|
this.logger.info(`BananaPay deployed at ${bananaFPC.address}`);
|
|
@@ -330,7 +341,7 @@ export class ClientFlowsBenchmark {
|
|
|
330
341
|
const claim = await this.feeJuiceBridgeTestHarness.prepareTokensOnL1(benchysAddress);
|
|
331
342
|
const behchysDeployMethod = await benchysAccountManager.getDeployMethod();
|
|
332
343
|
await behchysDeployMethod.send({
|
|
333
|
-
from:
|
|
344
|
+
from: NO_FROM,
|
|
334
345
|
fee: { paymentMethod: new FeeJuicePaymentMethodWithClaim(benchysAddress, claim) },
|
|
335
346
|
});
|
|
336
347
|
// Register benchy on the user's Wallet, where we're going to be interacting from
|
|
@@ -344,20 +355,21 @@ export class ClientFlowsBenchmark {
|
|
|
344
355
|
|
|
345
356
|
public async applyDeployAmm() {
|
|
346
357
|
this.logger.info('Applying AMM deployment');
|
|
347
|
-
const {
|
|
348
|
-
|
|
349
|
-
|
|
358
|
+
const { contract: liquidityToken, instance: liquidityTokenInstance } = await TokenContract.deploy(
|
|
359
|
+
this.adminWallet,
|
|
360
|
+
this.adminAddress,
|
|
361
|
+
'LPT',
|
|
362
|
+
'LPT',
|
|
363
|
+
18n,
|
|
364
|
+
).send({
|
|
350
365
|
from: this.adminAddress,
|
|
351
|
-
wait: { returnReceipt: true },
|
|
352
366
|
});
|
|
353
|
-
const {
|
|
354
|
-
receipt: { contract: amm, instance: ammInstance },
|
|
355
|
-
} = await AMMContract.deploy(
|
|
367
|
+
const { contract: amm, instance: ammInstance } = await AMMContract.deploy(
|
|
356
368
|
this.adminWallet,
|
|
357
369
|
this.bananaCoin.address,
|
|
358
370
|
this.candyBarCoin.address,
|
|
359
371
|
liquidityToken.address,
|
|
360
|
-
).send({ from: this.adminAddress
|
|
372
|
+
).send({ from: this.adminAddress });
|
|
361
373
|
this.logger.info(`AMM deployed at ${amm.address}`);
|
|
362
374
|
await liquidityToken.methods.set_minter(amm.address, true).send({ from: this.adminAddress });
|
|
363
375
|
this.liquidityToken = liquidityToken;
|
|
@@ -375,7 +387,7 @@ export class ClientFlowsBenchmark {
|
|
|
375
387
|
// The private fee paying method assembled on the app side requires knowledge of the maximum
|
|
376
388
|
// fee the user is willing to pay
|
|
377
389
|
const maxFeesPerGas = (await this.aztecNode.getCurrentMinFees()).mul(1.5);
|
|
378
|
-
const gasSettings = GasSettings.
|
|
390
|
+
const gasSettings = GasSettings.fallback({ maxFeesPerGas });
|
|
379
391
|
return new PrivateFeePaymentMethod(this.bananaFPC.address, sender, wallet, gasSettings);
|
|
380
392
|
}
|
|
381
393
|
|
|
@@ -28,6 +28,7 @@ import { type SequencerClient, type SequencerEvents, SequencerState } from '@azt
|
|
|
28
28
|
import { type BlockParameter, EthAddress } from '@aztec/stdlib/block';
|
|
29
29
|
import { type L1RollupConstants, getProofSubmissionDeadlineTimestamp } from '@aztec/stdlib/epoch-helpers';
|
|
30
30
|
import { tryStop } from '@aztec/stdlib/interfaces/server';
|
|
31
|
+
import type { SlashingProtectionDatabase } from '@aztec/validator-ha-signer/types';
|
|
31
32
|
|
|
32
33
|
import { join } from 'path';
|
|
33
34
|
import type { Hex } from 'viem';
|
|
@@ -144,7 +145,7 @@ export class EpochsTestContext {
|
|
|
144
145
|
proverId: EthAddress.fromNumber(1),
|
|
145
146
|
worldStateCheckpointHistory: WORLD_STATE_CHECKPOINT_HISTORY,
|
|
146
147
|
exitDelaySeconds: DefaultL1ContractsConfig.exitDelaySeconds,
|
|
147
|
-
|
|
148
|
+
slasherEnabled: false,
|
|
148
149
|
l1PublishingTime,
|
|
149
150
|
...opts,
|
|
150
151
|
},
|
|
@@ -181,6 +182,7 @@ export class EpochsTestContext {
|
|
|
181
182
|
ethereumSlotDuration,
|
|
182
183
|
proofSubmissionEpochs: Number(await this.rollup.getProofSubmissionEpochs()),
|
|
183
184
|
targetCommitteeSize: await this.rollup.getTargetCommitteeSize(),
|
|
185
|
+
rollupManaLimit: Number(await this.rollup.getManaLimit()),
|
|
184
186
|
};
|
|
185
187
|
|
|
186
188
|
this.logger.info(
|
|
@@ -221,7 +223,7 @@ export class EpochsTestContext {
|
|
|
221
223
|
},
|
|
222
224
|
},
|
|
223
225
|
{
|
|
224
|
-
|
|
226
|
+
genesis: this.context.genesis,
|
|
225
227
|
dontStart: opts.dontStart,
|
|
226
228
|
},
|
|
227
229
|
),
|
|
@@ -237,13 +239,21 @@ export class EpochsTestContext {
|
|
|
237
239
|
|
|
238
240
|
public createValidatorNode(
|
|
239
241
|
privateKeys: `0x${string}`[],
|
|
240
|
-
opts: Partial<AztecNodeConfig> & {
|
|
242
|
+
opts: Partial<AztecNodeConfig> & {
|
|
243
|
+
dontStartSequencer?: boolean;
|
|
244
|
+
slashingProtectionDb?: SlashingProtectionDatabase;
|
|
245
|
+
} = {},
|
|
241
246
|
) {
|
|
242
247
|
this.logger.warn('Creating and syncing a validator node...');
|
|
243
248
|
return this.createNode({ ...opts, disableValidator: false, validatorPrivateKeys: new SecretValue(privateKeys) });
|
|
244
249
|
}
|
|
245
250
|
|
|
246
|
-
private async createNode(
|
|
251
|
+
private async createNode(
|
|
252
|
+
opts: Partial<AztecNodeConfig> & {
|
|
253
|
+
dontStartSequencer?: boolean;
|
|
254
|
+
slashingProtectionDb?: SlashingProtectionDatabase;
|
|
255
|
+
} = {},
|
|
256
|
+
) {
|
|
247
257
|
const nodeIndex = this.nodes.length + 1;
|
|
248
258
|
const actorPrefix = opts.disableValidator ? 'node' : 'validator';
|
|
249
259
|
const { mockGossipSubNetwork } = this.context;
|
|
@@ -256,6 +266,7 @@ export class EpochsTestContext {
|
|
|
256
266
|
...resolvedConfig,
|
|
257
267
|
dataDirectory: join(this.context.config.dataDirectory!, randomBytes(8).toString('hex')),
|
|
258
268
|
validatorPrivateKeys: opts.validatorPrivateKeys ?? new SecretValue([]),
|
|
269
|
+
nodeId: resolvedConfig.nodeId || `${actorPrefix}-${nodeIndex}`,
|
|
259
270
|
p2pEnabled,
|
|
260
271
|
p2pIp,
|
|
261
272
|
},
|
|
@@ -264,9 +275,10 @@ export class EpochsTestContext {
|
|
|
264
275
|
p2pClientDeps: {
|
|
265
276
|
p2pServiceFactory: mockGossipSubNetwork ? getMockPubSubP2PServiceFactory(mockGossipSubNetwork) : undefined,
|
|
266
277
|
},
|
|
278
|
+
slashingProtectionDb: opts.slashingProtectionDb,
|
|
267
279
|
},
|
|
268
280
|
{
|
|
269
|
-
|
|
281
|
+
genesis: this.context.genesis,
|
|
270
282
|
...opts,
|
|
271
283
|
},
|
|
272
284
|
),
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { AztecAddress } from '@aztec/aztec.js/addresses';
|
|
2
2
|
import { type Logger, createLogger } from '@aztec/aztec.js/log';
|
|
3
3
|
import type { AztecNode } from '@aztec/aztec.js/node';
|
|
4
|
-
import { CheatCodes } from '@aztec/aztec/testing';
|
|
4
|
+
import { CheatCodes, getTokenAllowedSetupFunctions } from '@aztec/aztec/testing';
|
|
5
5
|
import { createExtendedL1Client } from '@aztec/ethereum/client';
|
|
6
6
|
import { RollupContract } from '@aztec/ethereum/contracts';
|
|
7
7
|
import type { DeployAztecL1ContractsArgs } from '@aztec/ethereum/deploy-aztec-l1-contracts';
|
|
@@ -104,12 +104,15 @@ export class FeesTest {
|
|
|
104
104
|
|
|
105
105
|
async setup() {
|
|
106
106
|
this.logger.verbose('Setting up fresh context...');
|
|
107
|
+
// Token allowlist entries are test-only: FPC-based fee payment with custom tokens won't work on mainnet alpha.
|
|
108
|
+
const tokenAllowList = await getTokenAllowedSetupFunctions();
|
|
107
109
|
this.context = await setup(0, {
|
|
108
110
|
startProverNode: true,
|
|
109
111
|
...this.setupOptions,
|
|
110
112
|
fundSponsoredFPC: true,
|
|
111
113
|
skipAccountDeployment: true,
|
|
112
114
|
l1ContractsArgs: { ...this.setupOptions },
|
|
115
|
+
txPublicSetupAllowListExtend: [...(this.setupOptions.txPublicSetupAllowListExtend ?? []), ...tokenAllowList],
|
|
113
116
|
});
|
|
114
117
|
|
|
115
118
|
this.rollupContract = RollupContract.getFromConfig(this.context.config);
|
|
@@ -190,7 +193,7 @@ export class FeesTest {
|
|
|
190
193
|
this.wallet = this.context.wallet;
|
|
191
194
|
this.aztecNode = this.context.aztecNodeService;
|
|
192
195
|
this.aztecNodeAdmin = this.context.aztecNodeService;
|
|
193
|
-
this.gasSettings = GasSettings.
|
|
196
|
+
this.gasSettings = GasSettings.fallback({ maxFeesPerGas: (await this.aztecNode.getCurrentMinFees()).mul(2) });
|
|
194
197
|
this.cheatCodes = this.context.cheatCodes;
|
|
195
198
|
this.accounts = deployedAccounts.map(a => a.address);
|
|
196
199
|
this.accounts.forEach((a, i) => this.logger.verbose(`Account ${i} address: ${a}`));
|
|
@@ -58,6 +58,7 @@ export class P2PInactivityTest {
|
|
|
58
58
|
basePort: BOOT_NODE_UDP_PORT,
|
|
59
59
|
startProverNode: true,
|
|
60
60
|
initialConfig: {
|
|
61
|
+
anvilSlotsInAnEpoch: 4,
|
|
61
62
|
proverNodeConfig: { proverNodeEpochProvingDelayMs: AZTEC_SLOT_DURATION * 1000 },
|
|
62
63
|
aztecTargetCommitteeSize: COMMITTEE_SIZE,
|
|
63
64
|
aztecSlotDuration: AZTEC_SLOT_DURATION,
|
|
@@ -66,7 +67,6 @@ export class P2PInactivityTest {
|
|
|
66
67
|
listenAddress: '127.0.0.1',
|
|
67
68
|
minTxsPerBlock: 0,
|
|
68
69
|
aztecEpochDuration: EPOCH_DURATION,
|
|
69
|
-
validatorReexecute: false,
|
|
70
70
|
sentinelEnabled: true,
|
|
71
71
|
slashingQuorum: SLASHING_QUORUM,
|
|
72
72
|
slashingRoundSizeInEpochs: SLASHING_ROUND_SIZE_IN_EPOCHS,
|
|
@@ -108,7 +108,7 @@ export class P2PInactivityTest {
|
|
|
108
108
|
this.test.bootstrapNodeEnr,
|
|
109
109
|
NUM_NODES - this.inactiveNodeCount - Number(this.keepInitialNode),
|
|
110
110
|
BOOT_NODE_UDP_PORT,
|
|
111
|
-
this.test.
|
|
111
|
+
this.test.genesis,
|
|
112
112
|
this.dataDir,
|
|
113
113
|
undefined,
|
|
114
114
|
Number(this.keepInitialNode),
|
|
@@ -122,7 +122,7 @@ export class P2PInactivityTest {
|
|
|
122
122
|
this.test.bootstrapNodeEnr,
|
|
123
123
|
this.inactiveNodeCount,
|
|
124
124
|
BOOT_NODE_UDP_PORT,
|
|
125
|
-
this.test.
|
|
125
|
+
this.test.genesis,
|
|
126
126
|
this.dataDir,
|
|
127
127
|
undefined,
|
|
128
128
|
NUM_NODES - this.inactiveNodeCount,
|