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
9 changes: 9 additions & 0 deletions yarn-project/p2p/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ export interface P2PConfig
/** Maximum transactions per block for validation. Overrides maxTxsPerBlock for gossip validation when set. */
validateMaxTxsPerBlock?: number;

/** Maximum transactions per checkpoint for validation. Used as fallback for maxTxsPerBlock when that is not set. */
validateMaxTxsPerCheckpoint?: number;

/** Maximum L2 gas per block for validation. When set, txs exceeding this limit are rejected. */
validateMaxL2BlockGas?: number;

Expand Down Expand Up @@ -214,6 +217,12 @@ export const p2pConfigMappings: ConfigMappingsType<P2PConfig> = {
'Maximum transactions per block for validation. Overrides maxTxsPerBlock for gossip validation when set.',
parseEnv: (val: string) => (val ? parseInt(val, 10) : undefined),
},
validateMaxTxsPerCheckpoint: {
env: 'VALIDATOR_MAX_TX_PER_CHECKPOINT',
description:
'Maximum transactions per checkpoint for validation. Used as fallback for maxTxsPerBlock when that is not set.',
parseEnv: (val: string) => (val ? parseInt(val, 10) : undefined),
},
validateMaxL2BlockGas: {
env: 'VALIDATOR_MAX_L2_BLOCK_GAS',
description: 'Maximum L2 gas per block for validation. When set, txs exceeding this limit are rejected.',
Expand Down
2 changes: 1 addition & 1 deletion yarn-project/p2p/src/services/libp2p/libp2p_service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ export class LibP2PService extends WithTracer implements P2PService {

const proposalValidatorOpts = {
txsPermitted: !config.disableTransactions,
maxTxsPerBlock: config.validateMaxTxsPerBlock,
maxTxsPerBlock: config.validateMaxTxsPerBlock ?? config.validateMaxTxsPerCheckpoint,
};
this.blockProposalValidator = new BlockProposalValidator(epochCache, proposalValidatorOpts);
this.checkpointProposalValidator = new CheckpointProposalValidator(epochCache, proposalValidatorOpts);
Expand Down
2 changes: 1 addition & 1 deletion yarn-project/validator-client/src/factory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export function createBlockProposalHandler(
const metrics = new ValidatorMetrics(deps.telemetry);
const blockProposalValidator = new BlockProposalValidator(deps.epochCache, {
txsPermitted: !config.disableTransactions,
maxTxsPerBlock: config.validateMaxTxsPerBlock,
maxTxsPerBlock: config.validateMaxTxsPerBlock ?? config.validateMaxTxsPerCheckpoint,
});
return new BlockProposalHandler(
deps.checkpointsBuilder,
Expand Down
Loading