Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 18 additions & 5 deletions yarn-project/end-to-end/src/spartan/n_tps_prove.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,10 @@ import type { WorkerWallet } from '../test-wallet/worker_wallet.js';
import { type WorkerWalletWrapper, createWorkerWalletClient } from './setup_test_wallets.js';
import { ProvingMetrics } from './tx_metrics.js';
import {
type ServiceEndpoint,
getEthereumEndpoint,
getExternalIP,
setupEnvironment,
startPortForwardForEthereum,
startPortForwardForPrometeheus,
} from './utils.js';

Expand Down Expand Up @@ -128,6 +129,7 @@ describe(`prove ${TARGET_TPS}TPS test`, () => {
let metrics: ProvingMetrics;
let childProcesses: ChildProcess[];
let rollupCheatCodes: RollupCheatCodes;
let ethEndpoint: ServiceEndpoint | undefined;
let metricsStartSnapshot: MetricsSnapshot | undefined;

afterAll(async () => {
Expand Down Expand Up @@ -247,10 +249,11 @@ describe(`prove ${TARGET_TPS}TPS test`, () => {
logger.info('Metrics snapshot captured');

// Setup Ethereum connection for RollupCheatCodes
const { process: ethProcess, port: ethPort } = await startPortForwardForEthereum(config.NAMESPACE);
childProcesses.push(ethProcess);
const ethereumHost = `http://127.0.0.1:${ethPort}`;
const ethCheatCodes = new EthCheatCodesWithState([ethereumHost], new DateProvider());
ethEndpoint = await getEthereumEndpoint(config.NAMESPACE);
if (ethEndpoint.process) {
childProcesses.push(ethEndpoint.process);
}
const ethCheatCodes = new EthCheatCodesWithState([ethEndpoint.url], new DateProvider());
const l1ContractAddresses = await aztecNode.getNodeInfo().then(n => n.l1ContractAddresses);
rollupCheatCodes = new RollupCheatCodes(ethCheatCodes, l1ContractAddresses);

Expand Down Expand Up @@ -382,6 +385,16 @@ describe(`prove ${TARGET_TPS}TPS test`, () => {
`Waiting ${formatDuration(secondsToWait)} (${slotsToWait} slots) until ${SLOTS_BUFFER} slot(s) before epoch boundary (until ${endTime.toISOString()})...`,
);
await sleep(secondsToWait * 1000);

// Port-forward to L1 may have died during the wait; re-establish before using rollupCheatCodes.
ethEndpoint?.process?.kill();
ethEndpoint = await getEthereumEndpoint(config.NAMESPACE);
if (ethEndpoint.process) {
childProcesses.push(ethEndpoint.process);
}
const freshEthCheatCodes = new EthCheatCodesWithState([ethEndpoint.url], new DateProvider());
const freshL1Addresses = await aztecNode.getNodeInfo().then(n => n.l1ContractAddresses);
rollupCheatCodes = new RollupCheatCodes(freshEthCheatCodes, freshL1Addresses);
}
});

Expand Down
Loading