Skip to content
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion yarn-project/archiver/src/archiver/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export const archiverConfigMappings: ConfigMappingsType<ArchiverConfig> = {
archiverPollingIntervalMS: {
env: 'ARCHIVER_POLLING_INTERVAL_MS',
description: 'The polling interval in ms for retrieving new L2 blocks and encrypted logs.',
...numberConfigHelper(1_000),
...numberConfigHelper(500),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a heads up that this will double the rate at which we query eth nodes/APIs. 💰 (times as many validators + boot node + prover node run)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point. I'll bring it up on standup to discuss.

},
archiverBatchSize: {
env: 'ARCHIVER_BATCH_SIZE',
Expand Down
7 changes: 6 additions & 1 deletion yarn-project/end-to-end/src/e2e_block_building.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,12 @@ describe('e2e_block_building', () => {
sequencer: sequencerClient,
dateProvider,
cheatCodes,
} = await setup(2));
} = await setup(2, {
archiverPollingIntervalMS: 200,
transactionPollingIntervalMS: 200,
worldStateBlockCheckIntervalMS: 200,
blockCheckIntervalMS: 200,
}));
sequencer = sequencerClient! as TestSequencerClient;
});

Expand Down
10 changes: 1 addition & 9 deletions yarn-project/p2p/src/client/factory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,5 @@ export const createP2PClient = async <T extends P2PClientType>(
logger.verbose('P2P is disabled. Using dummy P2P service');
p2pService = new DummyP2PService();
}
return new P2PClient(
clientType,
store,
l2BlockSource,
mempools,
p2pService,
config.keepProvenTxsInPoolFor,
telemetry,
);
return new P2PClient(clientType, store, l2BlockSource, mempools, p2pService, config, telemetry);
};
20 changes: 13 additions & 7 deletions yarn-project/p2p/src/client/p2p_client.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ describe('In-Memory P2P Client', () => {
};

kvStore = openTmpStore();
client = new P2PClient(P2PClientType.Full, kvStore, blockSource, mempools, p2pService, 0);
client = new P2PClient(P2PClientType.Full, kvStore, blockSource, mempools, p2pService);
});

const advanceToProvenBlock = async (getProvenBlockNumber: number, provenEpochNumber = getProvenBlockNumber) => {
Expand Down Expand Up @@ -108,7 +108,7 @@ describe('In-Memory P2P Client', () => {
await client.start();
await client.stop();

const client2 = new P2PClient(P2PClientType.Full, kvStore, blockSource, mempools, p2pService, 0);
const client2 = new P2PClient(P2PClientType.Full, kvStore, blockSource, mempools, p2pService);
expect(client2.getSyncedLatestBlockNum()).toEqual(client.getSyncedLatestBlockNum());
});

Expand All @@ -123,7 +123,9 @@ describe('In-Memory P2P Client', () => {
});

it('deletes txs after waiting the set number of blocks', async () => {
client = new P2PClient(P2PClientType.Full, kvStore, blockSource, mempools, p2pService, 10);
client = new P2PClient(P2PClientType.Full, kvStore, blockSource, mempools, p2pService, {
keepProvenTxsInPoolFor: 10,
});
blockSource.setProvenBlockNumber(0);
await client.start();
expect(txPool.deleteTxs).not.toHaveBeenCalled();
Expand All @@ -140,7 +142,7 @@ describe('In-Memory P2P Client', () => {
});

it('stores and returns epoch proof quotes', async () => {
client = new P2PClient(P2PClientType.Full, kvStore, blockSource, mempools, p2pService, 0);
client = new P2PClient(P2PClientType.Full, kvStore, blockSource, mempools, p2pService);

blockSource.setProvenEpochNumber(2);
await client.start();
Expand Down Expand Up @@ -172,7 +174,7 @@ describe('In-Memory P2P Client', () => {

// TODO(#10737) flake cc Maddiaa0
it.skip('deletes expired proof quotes', async () => {
client = new P2PClient(P2PClientType.Full, kvStore, blockSource, mempools, p2pService, 0);
client = new P2PClient(P2PClientType.Full, kvStore, blockSource, mempools, p2pService);

blockSource.setProvenEpochNumber(1);
blockSource.setProvenBlockNumber(1);
Expand Down Expand Up @@ -236,7 +238,9 @@ describe('In-Memory P2P Client', () => {
});

it('deletes txs created from a pruned block', async () => {
client = new P2PClient(P2PClientType.Full, kvStore, blockSource, mempools, p2pService, 10);
client = new P2PClient(P2PClientType.Full, kvStore, blockSource, mempools, p2pService, {
keepProvenTxsInPoolFor: 10,
});
blockSource.setProvenBlockNumber(0);
await client.start();

Expand All @@ -258,7 +262,9 @@ describe('In-Memory P2P Client', () => {
});

it('moves mined and valid txs back to the pending set', async () => {
client = new P2PClient(P2PClientType.Full, kvStore, blockSource, mempools, p2pService, 10);
client = new P2PClient(P2PClientType.Full, kvStore, blockSource, mempools, p2pService, {
keepProvenTxsInPoolFor: 10,
});
blockSource.setProvenBlockNumber(0);
await client.start();

Expand Down
13 changes: 9 additions & 4 deletions yarn-project/p2p/src/client/p2p_client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import {

import { type ENR } from '@chainsafe/enr';

import { getP2PConfigFromEnv } from '../config.js';
import { type P2PConfig, getP2PDefaultConfig } from '../config.js';
import { type AttestationPool } from '../mem_pools/attestation_pool/attestation_pool.js';
import { type EpochProofQuotePool } from '../mem_pools/epoch_proof_quote_pool/epoch_proof_quote_pool.js';
import { type MemPools } from '../mem_pools/interface.js';
Expand Down Expand Up @@ -209,6 +209,8 @@ export class P2PClient<T extends P2PClientType = P2PClientType.Full>

/** How many slots to keep attestations for. */
private keepAttestationsInPoolFor: number;
/** How many slots to keep proven txs for. */
private keepProvenTxsFor: number;

private blockStream;

Expand All @@ -227,14 +229,17 @@ export class P2PClient<T extends P2PClientType = P2PClientType.Full>
private l2BlockSource: L2BlockSource,
mempools: MemPools<T>,
private p2pService: P2PService,
private keepProvenTxsFor: number,
config: Partial<P2PConfig> = {},
telemetry: TelemetryClient = getTelemetryClient(),
private log = createLogger('p2p'),
) {
super(telemetry, 'P2PClient');

const { blockCheckIntervalMS, blockRequestBatchSize, keepAttestationsInPoolFor } = getP2PConfigFromEnv();

const { keepProvenTxsInPoolFor, blockCheckIntervalMS, blockRequestBatchSize, keepAttestationsInPoolFor } = {
...getP2PDefaultConfig(),
...config,
};
this.keepProvenTxsFor = keepProvenTxsInPoolFor;
this.keepAttestationsInPoolFor = keepAttestationsInPoolFor;

const tracer = telemetry.getTracer('P2PL2BlockStream');
Expand Down
2 changes: 1 addition & 1 deletion yarn-project/prover-node/src/prover-node.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ describe('prover-node', () => {
port,
);
const kvStore = openTmpStore();
return new P2PClient(P2PClientType.Prover, kvStore, l2BlockSource, mempools, libp2pService, 0);
return new P2PClient(P2PClientType.Prover, kvStore, l2BlockSource, mempools, libp2pService);
};

beforeEach(async () => {
Expand Down
2 changes: 1 addition & 1 deletion yarn-project/sequencer-client/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export const sequencerConfigMappings: ConfigMappingsType<SequencerConfig> = {
transactionPollingIntervalMS: {
env: 'SEQ_TX_POLLING_INTERVAL_MS',
description: 'The number of ms to wait between polling for pending txs.',
...numberConfigHelper(1_000),
...numberConfigHelper(500),
},
maxTxsPerBlock: {
env: 'SEQ_MAX_TX_PER_BLOCK',
Expand Down
Loading