Skip to content

fix(p2p): fall back to maxTxsPerCheckpoint for per-block tx validation#21605

Merged
spalladino merged 2 commits intomerge-train/spartanfrom
palla/proposal-validator-fallback-max-txs-per-checkpoint
Mar 16, 2026
Merged

fix(p2p): fall back to maxTxsPerCheckpoint for per-block tx validation#21605
spalladino merged 2 commits intomerge-train/spartanfrom
palla/proposal-validator-fallback-max-txs-per-checkpoint

Conversation

@spalladino
Copy link
Contributor

Motivation

When VALIDATOR_MAX_TX_PER_BLOCK is not set but VALIDATOR_MAX_TX_PER_CHECKPOINT is, the gossip-level proposal validator enforces no per-block transaction limit at all. A single block can't have more transactions than the entire checkpoint allows, so the checkpoint limit is a valid upper bound for per-block validation.

Approach

Use validateMaxTxsPerCheckpoint as a fallback when validateMaxTxsPerBlock is not set in the proposal validator construction. This applies at both construction sites: the P2P libp2p service (gossip validation) and the validator-client factory (block proposal handler).

Changes

  • p2p: Added validateMaxTxsPerCheckpoint to P2PConfig interface and config mappings (reads from VALIDATOR_MAX_TX_PER_CHECKPOINT env var)
  • p2p (libp2p_service): Use validateMaxTxsPerBlock ?? validateMaxTxsPerCheckpoint when constructing proposal validators
  • validator-client (factory): Same fallback when constructing the BlockProposalValidator

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@spalladino spalladino enabled auto-merge (squash) March 16, 2026 17:55
@spalladino spalladino merged commit f6c26a8 into merge-train/spartan Mar 16, 2026
11 checks passed
@spalladino spalladino deleted the palla/proposal-validator-fallback-max-txs-per-checkpoint branch March 16, 2026 18:14
AztecBot pushed a commit that referenced this pull request Mar 16, 2026
#21605)

## Motivation

When `VALIDATOR_MAX_TX_PER_BLOCK` is not set but
`VALIDATOR_MAX_TX_PER_CHECKPOINT` is, the gossip-level proposal
validator enforces no per-block transaction limit at all. A single block
can't have more transactions than the entire checkpoint allows, so the
checkpoint limit is a valid upper bound for per-block validation.

## Approach

Use `validateMaxTxsPerCheckpoint` as a fallback when
`validateMaxTxsPerBlock` is not set in the proposal validator
construction. This applies at both construction sites: the P2P libp2p
service (gossip validation) and the validator-client factory (block
proposal handler).

## Changes

- **p2p**: Added `validateMaxTxsPerCheckpoint` to `P2PConfig` interface
and config mappings (reads from `VALIDATOR_MAX_TX_PER_CHECKPOINT` env
var)
- **p2p (libp2p_service)**: Use `validateMaxTxsPerBlock ??
validateMaxTxsPerCheckpoint` when constructing proposal validators
- **validator-client (factory)**: Same fallback when constructing the
`BlockProposalValidator`

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@AztecBot
Copy link
Collaborator

✅ Successfully backported to backport-to-v4-staging #21582.

alexghr added a commit that referenced this pull request Mar 17, 2026
BEGIN_COMMIT_OVERRIDE
fix(aztec-nr): return Option from decode functions and fix event
commitment capacity (backport #21264) (#21360)
fix: backport #21271 — handle bad note lengths on
compute_note_hash_and_nullifier (#21364)
fix: not reusing tags of partially reverted txs (#20817)
chore: revert accidental backport of #20817 (#21583)
feat: Implement commit all and revert all for world state checkpoints
(#21532)
cherry-pick: fix: dependabot alerts (#21531)
fix: dependabot alerts (backport #21531 to v4) (#21592)
fix: backport #21443 — Don't update state if we failed to execute
sufficient transactions (v4) (#21610)
chore: Fix msgpack serialisation (#21612)
fix(p2p): fall back to maxTxsPerCheckpoint for per-block tx validation
(#21605)
chore: merge v4 into backport-to-v4-staging (#21618)
fix(revert): avm sim uses event loop again (#21138) (#21630)
fix(e2e): remove historic/finalized block checks from epochs_multiple
test (#21642)
fix: clamp finalized block to oldest available in world-state (#21643)
fix: skip handleChainFinalized when block is behind oldest available
(#21656)
chore: demote finalized block skip log to trace (#21661)
fix: off-by-1 in getBlockHashMembershipWitness archive snapshot
(backport #21648) (#21663)
fix: capture txs not available error reason in proposal handler (#21670)
chore: add L1 inclusion time to stg public (#21665)
END_COMMIT_OVERRIDE

---------

Co-authored-by: Jan Beneš <janbenes1234@gmail.com>
Co-authored-by: PhilWindle <60546371+PhilWindle@users.noreply.github.com>
Co-authored-by: Phil Windle <philip.windle@gmail.com>
Co-authored-by: Santiago Palladino <santiago@aztecprotocol.com>
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-authored-by: ludamad <adam.domurad@gmail.com>
Co-authored-by: Alex Gherghisan <alexghr@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants