@aztec/end-to-end 0.0.1-commit.dbf9cec → 0.0.1-commit.df81a97b5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dest/bench/client_flows/client_flows_benchmark.d.ts +1 -1
- package/dest/bench/client_flows/client_flows_benchmark.d.ts.map +1 -1
- package/dest/bench/client_flows/client_flows_benchmark.js +18 -10
- package/dest/bench/utils.d.ts +1 -1
- package/dest/bench/utils.d.ts.map +1 -1
- package/dest/bench/utils.js +6 -3
- package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts +1 -1
- package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts.map +1 -1
- package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.js +14 -14
- package/dest/e2e_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 +5 -2
- 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 +12 -5
- package/dest/e2e_nested_contract/nested_contract_test.d.ts +1 -1
- package/dest/e2e_nested_contract/nested_contract_test.d.ts.map +1 -1
- package/dest/e2e_nested_contract/nested_contract_test.js +4 -6
- package/dest/e2e_p2p/p2p_network.d.ts +4 -3
- package/dest/e2e_p2p/p2p_network.d.ts.map +1 -1
- package/dest/e2e_p2p/p2p_network.js +19 -16
- 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 +15 -2
- package/dest/e2e_p2p/shared.d.ts +21 -1
- package/dest/e2e_p2p/shared.d.ts.map +1 -1
- package/dest/e2e_p2p/shared.js +33 -2
- package/dest/e2e_token_contract/token_contract_test.d.ts +1 -1
- package/dest/e2e_token_contract/token_contract_test.d.ts.map +1 -1
- package/dest/e2e_token_contract/token_contract_test.js +11 -11
- package/dest/fixtures/authwit_proxy.d.ts +3 -3
- package/dest/fixtures/authwit_proxy.d.ts.map +1 -1
- package/dest/fixtures/e2e_prover_test.d.ts +4 -3
- package/dest/fixtures/e2e_prover_test.d.ts.map +1 -1
- package/dest/fixtures/e2e_prover_test.js +9 -11
- 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 +7 -2
- package/dest/fixtures/setup.d.ts.map +1 -1
- package/dest/fixtures/setup.js +16 -12
- 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 -2
- package/dest/shared/cross_chain_test_harness.d.ts +1 -1
- package/dest/shared/cross_chain_test_harness.d.ts.map +1 -1
- package/dest/shared/cross_chain_test_harness.js +13 -13
- package/dest/shared/gas_portal_test_harness.js +2 -2
- package/dest/shared/jest_setup.js +32 -1
- package/dest/shared/submit-transactions.d.ts +1 -1
- package/dest/shared/submit-transactions.d.ts.map +1 -1
- package/dest/shared/submit-transactions.js +1 -1
- package/dest/shared/uniswap_l1_l2.d.ts +1 -1
- package/dest/shared/uniswap_l1_l2.d.ts.map +1 -1
- package/dest/shared/uniswap_l1_l2.js +14 -17
- 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 +4 -4
- package/dest/simulators/token_simulator.d.ts +1 -1
- package/dest/simulators/token_simulator.d.ts.map +1 -1
- package/dest/simulators/token_simulator.js +2 -2
- package/dest/spartan/setup_test_wallets.d.ts +4 -2
- package/dest/spartan/setup_test_wallets.d.ts.map +1 -1
- package/dest/spartan/setup_test_wallets.js +28 -15
- package/dest/spartan/tx_metrics.js +1 -1
- package/dest/spartan/utils/config.d.ts +4 -1
- package/dest/spartan/utils/config.d.ts.map +1 -1
- package/dest/spartan/utils/config.js +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 +10 -17
- package/dest/test-wallet/test_wallet.d.ts.map +1 -1
- package/dest/test-wallet/test_wallet.js +47 -48
- package/dest/test-wallet/worker_wallet_schema.d.ts +3 -3
- package/package.json +42 -44
- package/src/bench/client_flows/client_flows_benchmark.ts +40 -31
- package/src/bench/utils.ts +7 -2
- package/src/e2e_blacklist_token_contract/blacklist_token_contract_test.ts +18 -14
- package/src/e2e_epochs/epochs_test.ts +14 -2
- package/src/e2e_fees/fees_test.ts +12 -5
- package/src/e2e_nested_contract/nested_contract_test.ts +6 -4
- package/src/e2e_p2p/p2p_network.ts +25 -21
- package/src/e2e_p2p/reqresp/utils.ts +23 -2
- package/src/e2e_p2p/shared.ts +55 -2
- package/src/e2e_token_contract/token_contract_test.ts +16 -8
- package/src/fixtures/e2e_prover_test.ts +16 -16
- package/src/fixtures/get_bb_config.ts +7 -6
- package/src/fixtures/setup.ts +22 -11
- package/src/fixtures/token_utils.ts +4 -2
- package/src/shared/cross_chain_test_harness.ts +13 -9
- package/src/shared/gas_portal_test_harness.ts +1 -1
- package/src/shared/jest_setup.ts +36 -1
- package/src/shared/submit-transactions.ts +1 -4
- package/src/shared/uniswap_l1_l2.ts +35 -28
- package/src/simulators/lending_simulator.ts +8 -4
- package/src/simulators/token_simulator.ts +6 -2
- package/src/spartan/setup_test_wallets.ts +51 -19
- package/src/spartan/tx_metrics.ts +1 -1
- package/src/spartan/utils/config.ts +1 -0
- package/src/spartan/utils/index.ts +3 -0
- package/src/spartan/utils/pod_logs.ts +99 -0
- package/src/test-wallet/test_wallet.ts +60 -65
|
@@ -149,6 +149,13 @@ export async function runReqrespTxTest(params: {
|
|
|
149
149
|
const submittedTxs = await Promise.all(
|
|
150
150
|
txBatches.map(async (batch, batchIndex) => {
|
|
151
151
|
const proposerNode = nodes[proposerIndexes[batchIndex]];
|
|
152
|
+
for (const tx of batch) {
|
|
153
|
+
t.logger.info(`Tx ${tx.getTxHash().toString()} base64: ${tx.toBuffer().toString('base64')}`);
|
|
154
|
+
}
|
|
155
|
+
const txHashes = batch.map(tx => tx.getTxHash().toString());
|
|
156
|
+
t.logger.info(
|
|
157
|
+
`Sending batch ${batchIndex} to proposer ${getNodePort(proposerIndexes[batchIndex])}: ${txHashes.join(', ')}`,
|
|
158
|
+
);
|
|
152
159
|
await Promise.all(
|
|
153
160
|
batch.map(async tx => {
|
|
154
161
|
try {
|
|
@@ -163,6 +170,12 @@ export async function runReqrespTxTest(params: {
|
|
|
163
170
|
}),
|
|
164
171
|
);
|
|
165
172
|
|
|
173
|
+
// Log pool state per node after sending
|
|
174
|
+
for (let i = 0; i < NUM_VALIDATORS; i++) {
|
|
175
|
+
const count = await nodes[i].getPendingTxCount();
|
|
176
|
+
t.logger.info(`Node ${getNodePort(i)} pool has ${count} pending txs`);
|
|
177
|
+
}
|
|
178
|
+
|
|
166
179
|
t.logger.info('Waiting for all transactions to be mined');
|
|
167
180
|
await Promise.all(
|
|
168
181
|
submittedTxs.flatMap((batch, batchIndex) =>
|
|
@@ -178,8 +191,16 @@ export async function runReqrespTxTest(params: {
|
|
|
178
191
|
|
|
179
192
|
// Assert that multiple blocks were built for at least one slot
|
|
180
193
|
t.logger.info('Verifying multiple blocks for at least one checkpoint');
|
|
181
|
-
|
|
182
|
-
|
|
194
|
+
// Wait for L1 checkpoint sync, which may lag behind P2P block propagation.
|
|
195
|
+
const checkpoints = await retryUntil(
|
|
196
|
+
async () => {
|
|
197
|
+
const cps = await nodes[0].getCheckpoints(CheckpointNumber(1), 50);
|
|
198
|
+
return cps.length > 0 && cps.some(cp => cp.checkpoint.blocks.length >= 2) ? cps : undefined;
|
|
199
|
+
},
|
|
200
|
+
'waiting for multi-block checkpoint to sync from L1',
|
|
201
|
+
30,
|
|
202
|
+
1,
|
|
203
|
+
);
|
|
183
204
|
|
|
184
205
|
let mbpsFound = false;
|
|
185
206
|
let expectedBlockNumber = checkpoints[0].checkpoint.blocks[0].number;
|
package/src/e2e_p2p/shared.ts
CHANGED
|
@@ -6,12 +6,13 @@ import { Fr } from '@aztec/aztec.js/fields';
|
|
|
6
6
|
import type { Logger } from '@aztec/aztec.js/log';
|
|
7
7
|
import { TxHash } from '@aztec/aztec.js/tx';
|
|
8
8
|
import type { RollupCheatCodes } from '@aztec/aztec/testing';
|
|
9
|
+
import type { EpochCacheInterface } from '@aztec/epoch-cache';
|
|
9
10
|
import type {
|
|
10
11
|
EmpireSlashingProposerContract,
|
|
11
12
|
RollupContract,
|
|
12
13
|
TallySlashingProposerContract,
|
|
13
14
|
} from '@aztec/ethereum/contracts';
|
|
14
|
-
import { EpochNumber } from '@aztec/foundation/branded-types';
|
|
15
|
+
import { EpochNumber, SlotNumber } from '@aztec/foundation/branded-types';
|
|
15
16
|
import { timesAsync, unique } from '@aztec/foundation/collection';
|
|
16
17
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
17
18
|
import { retryUntil } from '@aztec/foundation/retry';
|
|
@@ -41,7 +42,7 @@ export const submitComplexTxsTo = async (
|
|
|
41
42
|
const spamCount = 15;
|
|
42
43
|
for (let i = 0; i < numTxs; i++) {
|
|
43
44
|
const method = spamContract.methods.spam(seed + BigInt(i * spamCount), spamCount, !!opts.callPublic);
|
|
44
|
-
const txHash = await method.send({ from, wait: NO_WAIT });
|
|
45
|
+
const { txHash } = await method.send({ from, wait: NO_WAIT });
|
|
45
46
|
logger.info(`Tx sent with hash ${txHash.toString()}`);
|
|
46
47
|
txs.push(txHash);
|
|
47
48
|
}
|
|
@@ -150,6 +151,58 @@ export async function awaitCommitteeExists({
|
|
|
150
151
|
return committee!.map(c => c.toString() as `0x${string}`);
|
|
151
152
|
}
|
|
152
153
|
|
|
154
|
+
/**
|
|
155
|
+
* Advance epochs until we find one where the target proposer is selected for at least one slot,
|
|
156
|
+
* then stop one epoch before it. This leaves time for the caller to start sequencers before
|
|
157
|
+
* warping to the target epoch, avoiding the race where the target epoch passes before sequencers
|
|
158
|
+
* are ready.
|
|
159
|
+
*
|
|
160
|
+
* Returns the target epoch number so the caller can warp to it after starting sequencers.
|
|
161
|
+
*/
|
|
162
|
+
export async function advanceToEpochBeforeProposer({
|
|
163
|
+
epochCache,
|
|
164
|
+
cheatCodes,
|
|
165
|
+
targetProposer,
|
|
166
|
+
logger,
|
|
167
|
+
maxAttempts = 20,
|
|
168
|
+
}: {
|
|
169
|
+
epochCache: EpochCacheInterface;
|
|
170
|
+
cheatCodes: RollupCheatCodes;
|
|
171
|
+
targetProposer: EthAddress;
|
|
172
|
+
logger: Logger;
|
|
173
|
+
maxAttempts?: number;
|
|
174
|
+
}): Promise<{ targetEpoch: EpochNumber }> {
|
|
175
|
+
const { epochDuration } = await cheatCodes.getConfig();
|
|
176
|
+
|
|
177
|
+
for (let attempt = 0; attempt < maxAttempts; attempt++) {
|
|
178
|
+
const currentEpoch = await cheatCodes.getEpoch();
|
|
179
|
+
// Check the NEXT epoch's slots so we stay one epoch before the target,
|
|
180
|
+
// giving the caller time to start sequencers before the target epoch arrives.
|
|
181
|
+
const nextEpoch = Number(currentEpoch) + 1;
|
|
182
|
+
const startSlot = nextEpoch * Number(epochDuration);
|
|
183
|
+
const endSlot = startSlot + Number(epochDuration);
|
|
184
|
+
|
|
185
|
+
logger.info(
|
|
186
|
+
`Checking next epoch ${nextEpoch} (slots ${startSlot}-${endSlot - 1}) for proposer ${targetProposer} (current epoch: ${currentEpoch})`,
|
|
187
|
+
);
|
|
188
|
+
|
|
189
|
+
for (let s = startSlot; s < endSlot; s++) {
|
|
190
|
+
const proposer = await epochCache.getProposerAttesterAddressInSlot(SlotNumber(s));
|
|
191
|
+
if (proposer && proposer.equals(targetProposer)) {
|
|
192
|
+
logger.warn(
|
|
193
|
+
`Found target proposer ${targetProposer} in slot ${s} of epoch ${nextEpoch}. Staying at epoch ${currentEpoch} to allow sequencer startup.`,
|
|
194
|
+
);
|
|
195
|
+
return { targetEpoch: EpochNumber(nextEpoch) };
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
logger.info(`Target proposer not found in epoch ${nextEpoch}, advancing to next epoch`);
|
|
200
|
+
await cheatCodes.advanceToNextEpoch();
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
throw new Error(`Target proposer ${targetProposer} not found in any slot after ${maxAttempts} epoch attempts`);
|
|
204
|
+
}
|
|
205
|
+
|
|
153
206
|
export async function awaitOffenseDetected({
|
|
154
207
|
logger,
|
|
155
208
|
nodeAdmin,
|
|
@@ -81,24 +81,28 @@ export class TokenContractTest {
|
|
|
81
81
|
await publicDeployAccounts(this.wallet, [this.adminAddress, this.account1Address]);
|
|
82
82
|
|
|
83
83
|
this.logger.verbose(`Deploying TokenContract...`);
|
|
84
|
-
this.asset = await TokenContract.deploy(
|
|
84
|
+
({ contract: this.asset } = await TokenContract.deploy(
|
|
85
85
|
this.wallet,
|
|
86
86
|
this.adminAddress,
|
|
87
87
|
TokenContractTest.TOKEN_NAME,
|
|
88
88
|
TokenContractTest.TOKEN_SYMBOL,
|
|
89
89
|
TokenContractTest.TOKEN_DECIMALS,
|
|
90
|
-
).send({ from: this.adminAddress });
|
|
90
|
+
).send({ from: this.adminAddress }));
|
|
91
91
|
this.logger.verbose(`Token deployed to ${this.asset.address}`);
|
|
92
92
|
|
|
93
93
|
this.logger.verbose(`Deploying bad account...`);
|
|
94
|
-
this.badAccount = await InvalidAccountContract.deploy(this.wallet).send({
|
|
94
|
+
({ contract: this.badAccount } = await InvalidAccountContract.deploy(this.wallet).send({
|
|
95
|
+
from: this.adminAddress,
|
|
96
|
+
}));
|
|
95
97
|
this.logger.verbose(`Deployed to ${this.badAccount.address}.`);
|
|
96
98
|
|
|
97
99
|
// Deploy a proxy contract for "on behalf of other" tests. The note owner must be the tx sender
|
|
98
100
|
// (so their notes are in scope), but msg_sender in the target must differ from the note owner
|
|
99
101
|
// to trigger authwit validation. The proxy forwards calls so that msg_sender != tx sender.
|
|
100
102
|
this.logger.verbose(`Deploying generic proxy...`);
|
|
101
|
-
this.authwitProxy = await GenericProxyContract.deploy(this.wallet).send({
|
|
103
|
+
({ contract: this.authwitProxy } = await GenericProxyContract.deploy(this.wallet).send({
|
|
104
|
+
from: this.adminAddress,
|
|
105
|
+
}));
|
|
102
106
|
this.logger.verbose(`Deployed to ${this.authwitProxy.address}.`);
|
|
103
107
|
|
|
104
108
|
this.tokenSim = new TokenSimulator(this.asset, this.wallet, this.adminAddress, this.logger, [
|
|
@@ -106,7 +110,7 @@ export class TokenContractTest {
|
|
|
106
110
|
this.account1Address,
|
|
107
111
|
]);
|
|
108
112
|
|
|
109
|
-
expect(await this.asset.methods.get_admin().simulate({ from: this.adminAddress })).toBe(
|
|
113
|
+
expect((await this.asset.methods.get_admin().simulate({ from: this.adminAddress })).result).toBe(
|
|
110
114
|
this.adminAddress.toBigInt(),
|
|
111
115
|
);
|
|
112
116
|
}
|
|
@@ -140,7 +144,9 @@ export class TokenContractTest {
|
|
|
140
144
|
await asset.methods.mint_to_public(adminAddress, amount).send({ from: adminAddress });
|
|
141
145
|
tokenSim.mintPublic(adminAddress, amount);
|
|
142
146
|
|
|
143
|
-
const publicBalance = await asset.methods
|
|
147
|
+
const { result: publicBalance } = await asset.methods
|
|
148
|
+
.balance_of_public(adminAddress)
|
|
149
|
+
.simulate({ from: adminAddress });
|
|
144
150
|
this.logger.verbose(`Public balance of wallet 0: ${publicBalance}`);
|
|
145
151
|
expect(publicBalance).toEqual(this.tokenSim.balanceOfPublic(adminAddress));
|
|
146
152
|
|
|
@@ -148,11 +154,13 @@ export class TokenContractTest {
|
|
|
148
154
|
await mintTokensToPrivate(asset, adminAddress, adminAddress, amount);
|
|
149
155
|
tokenSim.mintPrivate(adminAddress, amount);
|
|
150
156
|
|
|
151
|
-
const privateBalance = await asset.methods
|
|
157
|
+
const { result: privateBalance } = await asset.methods
|
|
158
|
+
.balance_of_private(adminAddress)
|
|
159
|
+
.simulate({ from: adminAddress });
|
|
152
160
|
this.logger.verbose(`Private balance of wallet 0: ${privateBalance}`);
|
|
153
161
|
expect(privateBalance).toEqual(tokenSim.balanceOfPrivate(adminAddress));
|
|
154
162
|
|
|
155
|
-
const totalSupply = await asset.methods.total_supply().simulate({ from: adminAddress });
|
|
163
|
+
const { result: totalSupply } = await asset.methods.total_supply().simulate({ from: adminAddress });
|
|
156
164
|
this.logger.verbose(`Total supply: ${totalSupply}`);
|
|
157
165
|
expect(totalSupply).toEqual(tokenSim.totalSupply);
|
|
158
166
|
|
|
@@ -4,12 +4,7 @@ import { AztecAddress, EthAddress } from '@aztec/aztec.js/addresses';
|
|
|
4
4
|
import { type Logger, createLogger } from '@aztec/aztec.js/log';
|
|
5
5
|
import type { AztecNode } from '@aztec/aztec.js/node';
|
|
6
6
|
import { CheatCodes } from '@aztec/aztec/testing';
|
|
7
|
-
import {
|
|
8
|
-
BBCircuitVerifier,
|
|
9
|
-
type ClientProtocolCircuitVerifier,
|
|
10
|
-
QueuedIVCVerifier,
|
|
11
|
-
TestCircuitVerifier,
|
|
12
|
-
} from '@aztec/bb-prover';
|
|
7
|
+
import type { ClientProtocolCircuitVerifier } from '@aztec/bb-prover';
|
|
13
8
|
import { BackendType, Barretenberg } from '@aztec/bb.js';
|
|
14
9
|
import type { DeployAztecL1ContractsReturnType } from '@aztec/ethereum/deploy-aztec-l1-contracts';
|
|
15
10
|
import { Buffer32 } from '@aztec/foundation/buffer';
|
|
@@ -68,7 +63,10 @@ export class FullProverTest {
|
|
|
68
63
|
private provenComponents: ProvenSetup[] = [];
|
|
69
64
|
private bbConfigCleanup?: () => Promise<void>;
|
|
70
65
|
private acvmConfigCleanup?: () => Promise<void>;
|
|
71
|
-
|
|
66
|
+
/** Returns the proof verifier from the prover node (for test assertions). */
|
|
67
|
+
get circuitProofVerifier(): ClientProtocolCircuitVerifier | undefined {
|
|
68
|
+
return this.proverAztecNode?.getProofVerifier();
|
|
69
|
+
}
|
|
72
70
|
provenAsset!: TokenContract;
|
|
73
71
|
context!: EndToEndContext;
|
|
74
72
|
private proverAztecNode!: AztecNodeService;
|
|
@@ -106,7 +104,9 @@ export class FullProverTest {
|
|
|
106
104
|
await publicDeployAccounts(this.wallet, this.accounts.slice(0, 2));
|
|
107
105
|
|
|
108
106
|
this.logger.info('Applying base setup: deploying token contract');
|
|
109
|
-
const {
|
|
107
|
+
const {
|
|
108
|
+
receipt: { contract: asset, instance },
|
|
109
|
+
} = await TokenContract.deploy(
|
|
110
110
|
this.wallet,
|
|
111
111
|
this.accounts[0],
|
|
112
112
|
FullProverTest.TOKEN_NAME,
|
|
@@ -121,7 +121,7 @@ export class FullProverTest {
|
|
|
121
121
|
|
|
122
122
|
this.tokenSim = new TokenSimulator(this.fakeProofsAsset, this.wallet, this.accounts[0], this.logger, this.accounts);
|
|
123
123
|
|
|
124
|
-
expect(await this.fakeProofsAsset.methods.get_admin().simulate({ from: this.accounts[0] })).toBe(
|
|
124
|
+
expect((await this.fakeProofsAsset.methods.get_admin().simulate({ from: this.accounts[0] })).result).toBe(
|
|
125
125
|
this.accounts[0].toBigInt(),
|
|
126
126
|
);
|
|
127
127
|
}
|
|
@@ -168,9 +168,6 @@ export class FullProverTest {
|
|
|
168
168
|
|
|
169
169
|
await Barretenberg.initSingleton({ backend: BackendType.NativeUnixSocket });
|
|
170
170
|
|
|
171
|
-
const verifier = await BBCircuitVerifier.new(bbConfig);
|
|
172
|
-
this.circuitProofVerifier = new QueuedIVCVerifier(bbConfig, verifier);
|
|
173
|
-
|
|
174
171
|
this.logger.debug(`Configuring the node for real proofs...`);
|
|
175
172
|
await this.aztecNodeAdmin.setConfig({
|
|
176
173
|
realProofs: true,
|
|
@@ -178,7 +175,6 @@ export class FullProverTest {
|
|
|
178
175
|
});
|
|
179
176
|
} else {
|
|
180
177
|
this.logger.debug(`Configuring the node min txs per block ${this.minNumberOfTxsPerBlock}...`);
|
|
181
|
-
this.circuitProofVerifier = new TestCircuitVerifier();
|
|
182
178
|
await this.aztecNodeAdmin.setConfig({
|
|
183
179
|
minTxsPerBlock: this.minNumberOfTxsPerBlock,
|
|
184
180
|
});
|
|
@@ -310,16 +306,20 @@ export class FullProverTest {
|
|
|
310
306
|
} = this;
|
|
311
307
|
tokenSim.mintPublic(address, publicAmount);
|
|
312
308
|
|
|
313
|
-
const publicBalance = await fakeProofsAsset.methods
|
|
309
|
+
const { result: publicBalance } = await fakeProofsAsset.methods
|
|
310
|
+
.balance_of_public(address)
|
|
311
|
+
.simulate({ from: address });
|
|
314
312
|
this.logger.verbose(`Public balance of wallet 0: ${publicBalance}`);
|
|
315
313
|
expect(publicBalance).toEqual(this.tokenSim.balanceOfPublic(address));
|
|
316
314
|
|
|
317
315
|
tokenSim.mintPrivate(address, publicAmount);
|
|
318
|
-
const privateBalance = await fakeProofsAsset.methods
|
|
316
|
+
const { result: privateBalance } = await fakeProofsAsset.methods
|
|
317
|
+
.balance_of_private(address)
|
|
318
|
+
.simulate({ from: address });
|
|
319
319
|
this.logger.verbose(`Private balance of wallet 0: ${privateBalance}`);
|
|
320
320
|
expect(privateBalance).toEqual(tokenSim.balanceOfPrivate(address));
|
|
321
321
|
|
|
322
|
-
const totalSupply = await fakeProofsAsset.methods.total_supply().simulate({ from: address });
|
|
322
|
+
const { result: totalSupply } = await fakeProofsAsset.methods.total_supply().simulate({ from: address });
|
|
323
323
|
this.logger.verbose(`Total supply: ${totalSupply}`);
|
|
324
324
|
expect(totalSupply).toEqual(tokenSim.totalSupply);
|
|
325
325
|
}
|
|
@@ -13,8 +13,10 @@ const {
|
|
|
13
13
|
BB_SKIP_CLEANUP = '',
|
|
14
14
|
TEMP_DIR = tmpdir(),
|
|
15
15
|
BB_WORKING_DIRECTORY = '',
|
|
16
|
-
BB_NUM_IVC_VERIFIERS = '
|
|
16
|
+
BB_NUM_IVC_VERIFIERS = '8',
|
|
17
17
|
BB_IVC_CONCURRENCY = '1',
|
|
18
|
+
BB_CHONK_VERIFY_MAX_BATCH = '16',
|
|
19
|
+
BB_CHONK_VERIFY_BATCH_CONCURRENCY = '6',
|
|
18
20
|
} = process.env;
|
|
19
21
|
|
|
20
22
|
export const getBBConfig = async (
|
|
@@ -41,16 +43,15 @@ export const getBBConfig = async (
|
|
|
41
43
|
const bbSkipCleanup = ['1', 'true'].includes(BB_SKIP_CLEANUP);
|
|
42
44
|
const cleanup = bbSkipCleanup ? () => Promise.resolve() : () => tryRmDir(directoryToCleanup);
|
|
43
45
|
|
|
44
|
-
const numIvcVerifiers = Number(BB_NUM_IVC_VERIFIERS);
|
|
45
|
-
const ivcConcurrency = Number(BB_IVC_CONCURRENCY);
|
|
46
|
-
|
|
47
46
|
return {
|
|
48
47
|
bbSkipCleanup,
|
|
49
48
|
bbBinaryPath,
|
|
50
49
|
bbWorkingDirectory,
|
|
51
50
|
cleanup,
|
|
52
|
-
numConcurrentIVCVerifiers:
|
|
53
|
-
bbIVCConcurrency:
|
|
51
|
+
numConcurrentIVCVerifiers: Number(BB_NUM_IVC_VERIFIERS),
|
|
52
|
+
bbIVCConcurrency: Number(BB_IVC_CONCURRENCY),
|
|
53
|
+
bbChonkVerifyMaxBatch: Number(BB_CHONK_VERIFY_MAX_BATCH),
|
|
54
|
+
bbChonkVerifyConcurrency: Number(BB_CHONK_VERIFY_BATCH_CONCURRENCY),
|
|
54
55
|
};
|
|
55
56
|
} catch (err) {
|
|
56
57
|
logger.error(`Native BB not available, error: ${err}`);
|
package/src/fixtures/setup.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { SchnorrAccountContractArtifact } from '@aztec/accounts/schnorr';
|
|
2
2
|
import { type InitialAccountData, generateSchnorrAccounts } from '@aztec/accounts/testing';
|
|
3
3
|
import { type AztecNodeConfig, AztecNodeService, getConfigEnvVars } from '@aztec/aztec-node';
|
|
4
|
+
import { NO_FROM } from '@aztec/aztec.js/account';
|
|
4
5
|
import { AztecAddress, EthAddress } from '@aztec/aztec.js/addresses';
|
|
5
6
|
import {
|
|
6
7
|
BatchCall,
|
|
@@ -30,6 +31,7 @@ import {
|
|
|
30
31
|
} from '@aztec/ethereum/deploy-aztec-l1-contracts';
|
|
31
32
|
import type { Delayer } from '@aztec/ethereum/l1-tx-utils';
|
|
32
33
|
import { EthCheatCodes, EthCheatCodesWithState, startAnvil } from '@aztec/ethereum/test';
|
|
34
|
+
import type { Anvil } from '@aztec/ethereum/test';
|
|
33
35
|
import { BlockNumber, EpochNumber } from '@aztec/foundation/branded-types';
|
|
34
36
|
import { SecretValue } from '@aztec/foundation/config';
|
|
35
37
|
import { randomBytes } from '@aztec/foundation/crypto/random';
|
|
@@ -60,7 +62,6 @@ import { BenchmarkTelemetryClient } from '@aztec/telemetry-client/bench';
|
|
|
60
62
|
import { deployFundedSchnorrAccounts } from '@aztec/wallets/testing';
|
|
61
63
|
import { getGenesisValues } from '@aztec/world-state/testing';
|
|
62
64
|
|
|
63
|
-
import type { Anvil } from '@viem/anvil';
|
|
64
65
|
import fs from 'fs/promises';
|
|
65
66
|
import { tmpdir } from 'os';
|
|
66
67
|
import path from 'path';
|
|
@@ -185,6 +186,11 @@ export type SetupOptions = {
|
|
|
185
186
|
anvilAccounts?: number;
|
|
186
187
|
/** Port to start anvil (defaults to 8545) */
|
|
187
188
|
anvilPort?: number;
|
|
189
|
+
/**
|
|
190
|
+
* Number of slots per epoch for Anvil's finality simulation.
|
|
191
|
+
* Anvil reports `finalized = latest - slotsInAnEpoch * 2`.
|
|
192
|
+
*/
|
|
193
|
+
anvilSlotsInAnEpoch?: number;
|
|
188
194
|
/** Key to use for publishing L1 contracts */
|
|
189
195
|
l1PublisherKey?: SecretValue<`0x${string}`>;
|
|
190
196
|
/** ZkPassport configuration (domain, scope, mock verifier) */
|
|
@@ -297,6 +303,8 @@ export async function setup(
|
|
|
297
303
|
config.dataDirectory = directoryToCleanup;
|
|
298
304
|
}
|
|
299
305
|
|
|
306
|
+
const dateProvider = new TestDateProvider();
|
|
307
|
+
|
|
300
308
|
if (!config.l1RpcUrls?.length) {
|
|
301
309
|
if (!isAnvilTestChain(chain.id)) {
|
|
302
310
|
throw new Error(`No ETHEREUM_HOSTS set but non anvil chain requested`);
|
|
@@ -305,6 +313,8 @@ export async function setup(
|
|
|
305
313
|
l1BlockTime: opts.ethereumSlotDuration,
|
|
306
314
|
accounts: opts.anvilAccounts,
|
|
307
315
|
port: opts.anvilPort ?? (process.env.ANVIL_PORT ? parseInt(process.env.ANVIL_PORT) : undefined),
|
|
316
|
+
slotsInAnEpoch: opts.anvilSlotsInAnEpoch,
|
|
317
|
+
dateProvider,
|
|
308
318
|
});
|
|
309
319
|
anvil = res.anvil;
|
|
310
320
|
config.l1RpcUrls = [res.rpcUrl];
|
|
@@ -316,8 +326,6 @@ export async function setup(
|
|
|
316
326
|
logger.info(`Logging metrics to ${filename}`);
|
|
317
327
|
setupMetricsLogger(filename);
|
|
318
328
|
}
|
|
319
|
-
|
|
320
|
-
const dateProvider = new TestDateProvider();
|
|
321
329
|
const ethCheatCodes = new EthCheatCodesWithState(config.l1RpcUrls, dateProvider);
|
|
322
330
|
|
|
323
331
|
if (opts.stateLoad) {
|
|
@@ -413,11 +421,12 @@ export async function setup(
|
|
|
413
421
|
await ethCheatCodes.setIntervalMining(config.ethereumSlotDuration);
|
|
414
422
|
}
|
|
415
423
|
|
|
416
|
-
//
|
|
417
|
-
//
|
|
418
|
-
//
|
|
419
|
-
|
|
420
|
-
|
|
424
|
+
// In compose mode (no local anvil), sync dateProvider to L1 time since it may have drifted
|
|
425
|
+
// ahead of system time due to the local-network watcher warping time forward on each filled slot.
|
|
426
|
+
// When running with a local anvil, the dateProvider is kept in sync via the stdout listener.
|
|
427
|
+
if (!anvil) {
|
|
428
|
+
dateProvider.setTime((await ethCheatCodes.lastBlockTimestamp()) * 1000);
|
|
429
|
+
}
|
|
421
430
|
|
|
422
431
|
if (opts.l2StartTime) {
|
|
423
432
|
await ethCheatCodes.warp(opts.l2StartTime, { resetBlockInterval: true });
|
|
@@ -753,7 +762,9 @@ export function getBalancesFn(
|
|
|
753
762
|
): (...addresses: (AztecAddress | { address: AztecAddress })[]) => Promise<bigint[]> {
|
|
754
763
|
const balances = async (...addressLikes: (AztecAddress | { address: AztecAddress })[]) => {
|
|
755
764
|
const addresses = addressLikes.map(addressLike => ('address' in addressLike ? addressLike.address : addressLike));
|
|
756
|
-
const b = await Promise.all(
|
|
765
|
+
const b = await Promise.all(
|
|
766
|
+
addresses.map(async address => (await method(address).simulate({ from: address })).result),
|
|
767
|
+
);
|
|
757
768
|
const debugString = `${symbol} balances: ${addresses.map((address, i) => `${address}: ${b[i]}`).join(', ')}`;
|
|
758
769
|
logger.verbose(debugString);
|
|
759
770
|
return b;
|
|
@@ -839,7 +850,7 @@ export const deployAccounts =
|
|
|
839
850
|
);
|
|
840
851
|
const deployMethod = await accountManager.getDeployMethod();
|
|
841
852
|
await deployMethod.send({
|
|
842
|
-
from:
|
|
853
|
+
from: NO_FROM,
|
|
843
854
|
skipClassPublication: i !== 0, // Publish the contract class at most once.
|
|
844
855
|
});
|
|
845
856
|
}
|
|
@@ -871,7 +882,7 @@ export async function publicDeployAccounts(
|
|
|
871
882
|
|
|
872
883
|
const batch = new BatchCall(wallet, calls);
|
|
873
884
|
|
|
874
|
-
const txReceipt = await batch.send({ from: accountsToDeploy[0] });
|
|
885
|
+
const { receipt: txReceipt } = await batch.send({ from: accountsToDeploy[0] });
|
|
875
886
|
if (waitUntilProven) {
|
|
876
887
|
if (!node) {
|
|
877
888
|
throw new Error('Need to provide an AztecNode to wait for proven.');
|
|
@@ -6,7 +6,9 @@ import { TokenContract } from '@aztec/noir-contracts.js/Token';
|
|
|
6
6
|
|
|
7
7
|
export async function deployToken(wallet: Wallet, admin: AztecAddress, initialAdminBalance: bigint, logger: Logger) {
|
|
8
8
|
logger.info(`Deploying Token contract...`);
|
|
9
|
-
const {
|
|
9
|
+
const {
|
|
10
|
+
receipt: { contract, instance },
|
|
11
|
+
} = await TokenContract.deploy(wallet, admin, 'TokenName', 'TokenSymbol', 18).send({
|
|
10
12
|
from: admin,
|
|
11
13
|
wait: { returnReceipt: true },
|
|
12
14
|
});
|
|
@@ -39,7 +41,7 @@ export async function expectTokenBalance(
|
|
|
39
41
|
) {
|
|
40
42
|
// Then check the balance
|
|
41
43
|
const contractWithWallet = TokenContract.at(token.address, wallet);
|
|
42
|
-
const balance = await contractWithWallet.methods.balance_of_private(owner).simulate({ from: owner });
|
|
44
|
+
const { result: balance } = await contractWithWallet.methods.balance_of_private(owner).simulate({ from: owner });
|
|
43
45
|
logger.info(`Account ${owner} balance: ${balance}`);
|
|
44
46
|
expect(balance).toBe(expectedBalance);
|
|
45
47
|
}
|
|
@@ -73,22 +73,26 @@ export async function deployAndInitializeTokenAndBridgeContracts(
|
|
|
73
73
|
});
|
|
74
74
|
|
|
75
75
|
// deploy l2 token
|
|
76
|
-
const token = await TokenContract.deploy(wallet, owner, 'TokenName', 'TokenSymbol', 18).send({
|
|
76
|
+
const { contract: token } = await TokenContract.deploy(wallet, owner, 'TokenName', 'TokenSymbol', 18).send({
|
|
77
|
+
from: owner,
|
|
78
|
+
});
|
|
77
79
|
|
|
78
80
|
// deploy l2 token bridge and attach to the portal
|
|
79
|
-
const bridge = await TokenBridgeContract.deploy(wallet, token.address, tokenPortalAddress).send({
|
|
81
|
+
const { contract: bridge } = await TokenBridgeContract.deploy(wallet, token.address, tokenPortalAddress).send({
|
|
82
|
+
from: owner,
|
|
83
|
+
});
|
|
80
84
|
|
|
81
|
-
if ((await token.methods.get_admin().simulate({ from: owner })) !== owner.toBigInt()) {
|
|
85
|
+
if ((await token.methods.get_admin().simulate({ from: owner })).result !== owner.toBigInt()) {
|
|
82
86
|
throw new Error(`Token admin is not ${owner}`);
|
|
83
87
|
}
|
|
84
88
|
|
|
85
|
-
if (!(await bridge.methods.get_config().simulate({ from: owner })).token.equals(token.address)) {
|
|
89
|
+
if (!(await bridge.methods.get_config().simulate({ from: owner })).result.token.equals(token.address)) {
|
|
86
90
|
throw new Error(`Bridge token is not ${token.address}`);
|
|
87
91
|
}
|
|
88
92
|
|
|
89
93
|
// make the bridge a minter on the token:
|
|
90
94
|
await token.methods.set_minter(bridge.address, true).send({ from: owner });
|
|
91
|
-
if ((await token.methods.is_minter(bridge.address).simulate({ from: owner })) === 1n) {
|
|
95
|
+
if ((await token.methods.is_minter(bridge.address).simulate({ from: owner })).result === 1n) {
|
|
92
96
|
throw new Error(`Bridge is not a minter`);
|
|
93
97
|
}
|
|
94
98
|
|
|
@@ -269,7 +273,7 @@ export class CrossChainTestHarness {
|
|
|
269
273
|
authwitNonce: Fr = Fr.ZERO,
|
|
270
274
|
authWitness: AuthWitness,
|
|
271
275
|
): Promise<TxReceipt> {
|
|
272
|
-
const withdrawReceipt = await this.l2Bridge.methods
|
|
276
|
+
const { receipt: withdrawReceipt } = await this.l2Bridge.methods
|
|
273
277
|
.exit_to_l1_private(this.l2Token.address, this.ethAccount, withdrawAmount, EthAddress.ZERO, authwitNonce)
|
|
274
278
|
.send({ authWitnesses: [authWitness], from: this.ownerAddress });
|
|
275
279
|
|
|
@@ -277,7 +281,7 @@ export class CrossChainTestHarness {
|
|
|
277
281
|
}
|
|
278
282
|
|
|
279
283
|
async withdrawPublicFromAztecToL1(withdrawAmount: bigint, authwitNonce: Fr = Fr.ZERO): Promise<TxReceipt> {
|
|
280
|
-
const withdrawReceipt = await this.l2Bridge.methods
|
|
284
|
+
const { receipt: withdrawReceipt } = await this.l2Bridge.methods
|
|
281
285
|
.exit_to_l1_public(this.ethAccount, withdrawAmount, EthAddress.ZERO, authwitNonce)
|
|
282
286
|
.send({ from: this.ownerAddress });
|
|
283
287
|
|
|
@@ -285,7 +289,7 @@ export class CrossChainTestHarness {
|
|
|
285
289
|
}
|
|
286
290
|
|
|
287
291
|
async getL2PrivateBalanceOf(owner: AztecAddress) {
|
|
288
|
-
return await this.l2Token.methods.balance_of_private(owner).simulate({ from: owner });
|
|
292
|
+
return (await this.l2Token.methods.balance_of_private(owner).simulate({ from: owner })).result;
|
|
289
293
|
}
|
|
290
294
|
|
|
291
295
|
async expectPrivateBalanceOnL2(owner: AztecAddress, expectedBalance: bigint) {
|
|
@@ -295,7 +299,7 @@ export class CrossChainTestHarness {
|
|
|
295
299
|
}
|
|
296
300
|
|
|
297
301
|
async getL2PublicBalanceOf(owner: AztecAddress) {
|
|
298
|
-
return await this.l2Token.methods.balance_of_public(owner).simulate({ from: this.ownerAddress });
|
|
302
|
+
return (await this.l2Token.methods.balance_of_public(owner).simulate({ from: this.ownerAddress })).result;
|
|
299
303
|
}
|
|
300
304
|
|
|
301
305
|
async expectPublicBalanceOnL2(owner: AztecAddress, expectedBalance: bigint) {
|
|
@@ -131,7 +131,7 @@ export class GasBridgingTestHarness implements IGasBridgingTestHarness {
|
|
|
131
131
|
}
|
|
132
132
|
|
|
133
133
|
async getL2PublicBalanceOf(owner: AztecAddress) {
|
|
134
|
-
return await this.feeJuice.methods.balance_of_public(owner).simulate({ from: owner });
|
|
134
|
+
return (await this.feeJuice.methods.balance_of_public(owner).simulate({ from: owner })).result;
|
|
135
135
|
}
|
|
136
136
|
|
|
137
137
|
async expectPublicBalanceOnL2(owner: AztecAddress, expectedBalance: bigint) {
|
package/src/shared/jest_setup.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { createLogger } from '@aztec/aztec.js/log';
|
|
2
2
|
|
|
3
|
-
import { afterEach, beforeEach, expect } from '@jest/globals';
|
|
3
|
+
import { afterAll, afterEach, beforeEach, expect } from '@jest/globals';
|
|
4
|
+
import { readlinkSync } from 'fs';
|
|
4
5
|
import { basename } from 'path';
|
|
5
6
|
|
|
6
7
|
import { EluMonitor } from '../fixtures/elu_monitor.js';
|
|
@@ -26,3 +27,37 @@ beforeEach(() => {
|
|
|
26
27
|
afterEach(() => {
|
|
27
28
|
eluMonitor?.stopTest();
|
|
28
29
|
});
|
|
30
|
+
|
|
31
|
+
// Log leaked handles after all tests complete. This runs after test-level afterAll hooks,
|
|
32
|
+
// so any handles still alive at this point were not properly cleaned up during teardown.
|
|
33
|
+
// This diagnostic helps identify the source of exit hangs without masking them.
|
|
34
|
+
afterAll(() => {
|
|
35
|
+
const handles = (process as any)._getActiveHandles();
|
|
36
|
+
if (handles.length > 0) {
|
|
37
|
+
const details = handles.map((h: any) => {
|
|
38
|
+
const type = h?.constructor?.name ?? typeof h;
|
|
39
|
+
const fd = h?.fd ?? h?._handle?.fd ?? '?';
|
|
40
|
+
const destroyed = h?.destroyed ?? '?';
|
|
41
|
+
const hasRef = typeof h?.hasRef === 'function' ? h.hasRef() : '?';
|
|
42
|
+
const localAddr = h?.localAddress ?? '';
|
|
43
|
+
const remoteAddr = h?.remoteAddress ?? '';
|
|
44
|
+
const localPort = h?.localPort ?? '';
|
|
45
|
+
const remotePort = h?.remotePort ?? '';
|
|
46
|
+
const proto = Object.getPrototypeOf(h)?.constructor?.name ?? '?';
|
|
47
|
+
const keys = Object.keys(h).slice(0, 10).join(',');
|
|
48
|
+
let fdTarget = '';
|
|
49
|
+
if (typeof fd === 'number') {
|
|
50
|
+
try {
|
|
51
|
+
fdTarget = ` -> ${readlinkSync(`/proc/self/fd/${fd}`)}`;
|
|
52
|
+
} catch {
|
|
53
|
+
// ignore
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
return ` ${type}(fd=${fd}, destroyed=${destroyed}, hasRef=${hasRef}${fdTarget}) proto=${proto} addr=${localAddr}:${localPort}->${remoteAddr}:${remotePort} keys=[${keys}]`;
|
|
57
|
+
});
|
|
58
|
+
process.stderr.write(
|
|
59
|
+
`\n[jest_setup] WARNING: ${handles.length} handle(s) still active after teardown:\n${details.join('\n')}\n` +
|
|
60
|
+
`These may prevent Jest from exiting. Investigate and fix the leak.\n\n`,
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
});
|
|
@@ -19,10 +19,7 @@ export const submitTxsTo = async (
|
|
|
19
19
|
times(numTxs, async () => {
|
|
20
20
|
const accountManager = await wallet.createSchnorrAccount(Fr.random(), Fr.random(), GrumpkinScalar.random());
|
|
21
21
|
const deployMethod = await accountManager.getDeployMethod();
|
|
22
|
-
const txHash = await deployMethod.send({
|
|
23
|
-
from: submitter,
|
|
24
|
-
wait: NO_WAIT,
|
|
25
|
-
});
|
|
22
|
+
const { txHash } = await deployMethod.send({ from: submitter, wait: NO_WAIT });
|
|
26
23
|
|
|
27
24
|
logger.info(`Tx sent with hash ${txHash}`);
|
|
28
25
|
const receipt: TxReceipt = await wallet.getTxReceipt(txHash);
|