Skip to content

Commit

Permalink
chore(tests): shorten block times in e2e p2p tests (#12073)
Browse files Browse the repository at this point in the history
  • Loading branch information
Maddiaa0 authored Feb 19, 2025
1 parent aaf0ae0 commit 657492c
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 5 deletions.
5 changes: 4 additions & 1 deletion yarn-project/end-to-end/src/e2e_p2p/gossip_network.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import fs from 'fs';
import { shouldCollectMetrics } from '../fixtures/fixtures.js';
import { type NodeContext, createNodes } from '../fixtures/setup_p2p_test.js';
import { AlertChecker, type AlertConfig } from '../quality_of_service/alert_checker.js';
import { P2PNetworkTest, WAIT_FOR_TX_TIMEOUT } from './p2p_network.js';
import { P2PNetworkTest, SHORTENED_BLOCK_TIME_CONFIG, WAIT_FOR_TX_TIMEOUT } from './p2p_network.js';
import { createPXEServiceAndSubmitTransactions } from './shared.js';

const CHECK_ALERTS = process.env.CHECK_ALERTS === 'true';
Expand Down Expand Up @@ -41,6 +41,9 @@ describe('e2e_p2p_network', () => {
numberOfNodes: NUM_NODES,
basePort: BOOT_NODE_UDP_PORT,
metricsPort: shouldCollectMetrics(),
initialConfig: {
...SHORTENED_BLOCK_TIME_CONFIG,
},
});

await t.setupAccount();
Expand Down
15 changes: 14 additions & 1 deletion yarn-project/end-to-end/src/e2e_p2p/p2p_network.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,13 @@ const BOOTSTRAP_NODE_PRIVATE_KEY = '080212208f988fc0899e4a73a5aee4d271a5f2067060
const l1ContractsConfig = getL1ContractsConfigEnvVars();
export const WAIT_FOR_TX_TIMEOUT = l1ContractsConfig.aztecSlotDuration * 3;

export const SHORTENED_BLOCK_TIME_CONFIG = {
aztecEpochDuration: 4,
aztecSlotDuration: 12,
ethereumSlotDuration: 4,
aztecProofSubmissionWindow: 4 * 2 - 1, // epoch_duration * 2 - 1
};

export class P2PNetworkTest {
private snapshotManager: ISnapshotManager;
private baseAccount;
Expand Down Expand Up @@ -86,13 +93,19 @@ export class P2PNetworkTest {
process.env.E2E_DATA_PATH,
{
...initialValidatorConfig,
ethereumSlotDuration: l1ContractsConfig.ethereumSlotDuration,
ethereumSlotDuration: initialValidatorConfig.ethereumSlotDuration ?? l1ContractsConfig.ethereumSlotDuration,
aztecEpochDuration: initialValidatorConfig.aztecEpochDuration ?? l1ContractsConfig.aztecEpochDuration,
aztecSlotDuration: initialValidatorConfig.aztecSlotDuration ?? l1ContractsConfig.aztecSlotDuration,
aztecProofSubmissionWindow:
initialValidatorConfig.aztecProofSubmissionWindow ?? l1ContractsConfig.aztecProofSubmissionWindow,
salt: 420,
metricsPort: metricsPort,
numberOfInitialFundedAccounts: 1,
},
{
aztecEpochDuration: initialValidatorConfig.aztecEpochDuration ?? l1ContractsConfig.aztecEpochDuration,
ethereumSlotDuration: initialValidatorConfig.ethereumSlotDuration ?? l1ContractsConfig.ethereumSlotDuration,
aztecSlotDuration: initialValidatorConfig.aztecSlotDuration ?? l1ContractsConfig.aztecSlotDuration,
aztecProofSubmissionWindow:
initialValidatorConfig.aztecProofSubmissionWindow ?? l1ContractsConfig.aztecProofSubmissionWindow,
assumeProvenThrough: assumeProvenThrough ?? Number.MAX_SAFE_INTEGER,
Expand Down
5 changes: 4 additions & 1 deletion yarn-project/end-to-end/src/e2e_p2p/rediscovery.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import fs from 'fs';

import { shouldCollectMetrics } from '../fixtures/fixtures.js';
import { type NodeContext, createNode, createNodes } from '../fixtures/setup_p2p_test.js';
import { P2PNetworkTest, WAIT_FOR_TX_TIMEOUT } from './p2p_network.js';
import { P2PNetworkTest, SHORTENED_BLOCK_TIME_CONFIG, WAIT_FOR_TX_TIMEOUT } from './p2p_network.js';
import { createPXEServiceAndSubmitTransactions } from './shared.js';

// Don't set this to a higher value than 9 because each node will use a different L1 publisher account and anvil seeds
Expand All @@ -26,6 +26,9 @@ describe('e2e_p2p_rediscovery', () => {
basePort: BOOT_NODE_UDP_PORT,
// To collect metrics - run in aztec-packages `docker compose --profile metrics up` and set COLLECT_METRICS=true
metricsPort: shouldCollectMetrics(),
initialConfig: {
...SHORTENED_BLOCK_TIME_CONFIG,
},
});
await t.setupAccount();
await t.applyBaseSnapshots();
Expand Down
5 changes: 4 additions & 1 deletion yarn-project/end-to-end/src/e2e_p2p/reqresp.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { getContract } from 'viem';

import { shouldCollectMetrics } from '../fixtures/fixtures.js';
import { type NodeContext, createNodes } from '../fixtures/setup_p2p_test.js';
import { P2PNetworkTest, WAIT_FOR_TX_TIMEOUT } from './p2p_network.js';
import { P2PNetworkTest, SHORTENED_BLOCK_TIME_CONFIG, WAIT_FOR_TX_TIMEOUT } from './p2p_network.js';
import { createPXEServiceAndSubmitTransactions } from './shared.js';

// Don't set this to a higher value than 9 because each node will use a different L1 publisher account and anvil seeds
Expand All @@ -29,6 +29,9 @@ describe('e2e_p2p_reqresp_tx', () => {
basePort: BOOT_NODE_UDP_PORT,
// To collect metrics - run in aztec-packages `docker compose --profile metrics up`
metricsPort: shouldCollectMetrics(),
initialConfig: {
...SHORTENED_BLOCK_TIME_CONFIG,
},
});
await t.setupAccount();
await t.applyBaseSnapshots();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { getAddress, getContract } from 'viem';

import { shouldCollectMetrics } from '../fixtures/fixtures.js';
import { createNodes } from '../fixtures/setup_p2p_test.js';
import { P2PNetworkTest } from './p2p_network.js';
import { P2PNetworkTest, SHORTENED_BLOCK_TIME_CONFIG } from './p2p_network.js';

// Don't set this to a higher value than 9 because each node will use a different L1 publisher account and anvil seeds
const NUM_NODES = 4;
Expand All @@ -42,6 +42,9 @@ describe('e2e_p2p_governance_proposer', () => {
basePort: BOOT_NODE_UDP_PORT,
// To collect metrics - run in aztec-packages `docker compose --profile metrics up`
metricsPort: shouldCollectMetrics(),
initialConfig: {
...SHORTENED_BLOCK_TIME_CONFIG,
},
});
await t.applyBaseSnapshots();
await t.setup();
Expand Down

0 comments on commit 657492c

Please sign in to comment.