eth/protocols/eth: increase maxTxPacketSize from 100 KB to 1 MB#2160
eth/protocols/eth: increase maxTxPacketSize from 100 KB to 1 MB#2160
Conversation
There was a problem hiding this comment.
Claude Code Review
This repository is configured for manual code reviews. Comment @claude review to trigger a review.
Tip: disable this comment in your organization's Code Review settings.
c97bd2f to
b68b8a9
Compare
Code reviewNo issues found. Checked for bugs and CLAUDE.md compliance. |
…olygon throughput Polygon mainnet processes 120M gas/block at 2s block times. At high utilization (90-100% gas), blocks carry 430-520 KB of transaction data, with full blocks reaching ~520 KB. The previous 100 KB limit required 5+ sequential p2p messages per peer per full block. This affected both paths: - Direct broadcast (full txs to sqrt(peers)): many sequential messages - GetPooledTransactions responses: peers fetching txs after announcement could not receive a full block's worth in one response, increasing round trips for mempool convergence across the wider peer set 1 MB is chosen to: - Fit any block at current gas limits in a single message - Provide ~2x headroom over the current full-block maximum (~520 KB), absorbing a gas limit increase to ~200M without another bump - Stay at 6.3% of the 16 MB p2p message size limit - Remain well below the ~15 MB witness messages already exchanged on this network, keeping head-of-line blocking risk negligible Note: 512 KB was considered but rejected — full blocks already reach 520 KB, leaving essentially no margin.
b68b8a9 to
e9c1799
Compare
Code reviewNo issues found. Checked for bugs and CLAUDE.md compliance. Note: The PR title says "512 KB" but the code sets |
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #2160 +/- ##
===========================================
- Coverage 51.57% 51.56% -0.02%
===========================================
Files 882 882
Lines 154164 154164
===========================================
- Hits 79505 79488 -17
- Misses 69489 69509 +20
+ Partials 5170 5167 -3
... and 21 files with indirect coverage changes
🚀 New features to boost your workflow:
|



Summary
Increases
maxTxPacketSizeineth/protocols/eth/broadcast.gofrom the go-ethereum default of 100 KB to 1 MB to match Polygon mainnet's actual transaction throughput at high utilization.Background: what
maxTxPacketSizecontrolsThis constant is the flush threshold used in two places:
broadcastTransactions): the loop accumulates full transactions and flushes when the accumulated size hits the limit. Onlysqrt(peers)receive direct txs.GetPooledTransactionsresponses: when a peer fetches full txs after receiving hash announcements (the path used by the majority of peers), the response is also bounded by this limit.Announcements (
NewPooledTransactionHashesPacket) are unaffected — they carry only 32-byte hashes, so even a 440-tx block produces ~14 KB, negligible against any reasonable limit.Problem: 100 KB is severely undersized for Polygon
Sampling 11 Polygon mainnet blocks at high utilization (blocks 84665222–84665232, sampled 2026-03-25):
Average: 430 KB/block. Max observed (100% utilization): 520 KB.
At 100 KB, a full block requires 5+ sequential p2p messages per peer. The impact compounds on the fetch path: the majority of peers receive only hash announcements and call
GetPooledTransactionsto fetch full txs. A 100 KB response limit means multiple round trips to converge the mempool across the full peer set — not just the smallsqrt(peers)direct broadcast set.Why not 512 KB?
512 KB was initially considered, but full blocks already reach ~520 KB — leaving essentially no margin. Blocks 84665224, 84665225, and 84665226 all exceed or come within 2 KB of 512 KB at 97–100% utilization. Any sustained period at full capacity would regularly split into 2 messages.
Size selection: 1 MB
1 MB is chosen because:
Network topology consideration
A significant portion of Polygon's transaction volume originates from a small number of high-throughput RPC providers (Alchemy, Infura, QuickNode, etc.) that submit large batches of transactions in near every block. These nodes tend to be well-connected to validators and their txs propagate via direct broadcast. However, the broader peer set — archive nodes, indexers, regional RPC nodes — relies entirely on the announce→fetch path. With a 100 KB response limit, these nodes consistently need 5+ round trips per block to converge their mempools, degrading local tx visibility and fee estimation accuracy.
Risk assessment
Testing
Built and verified. The constant affects only the flush threshold in the broadcast/announce loops; no behavioral changes beyond batch sizing.