feat(network): per-message-type size limit - #16173
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #16173 +/- ##
==========================================
- Coverage 73.62% 73.62% -0.01%
==========================================
Files 865 865
Lines 191633 191657 +24
Branches 191633 191657 +24
==========================================
+ Hits 141090 141103 +13
- Misses 46065 46079 +14
+ Partials 4478 4475 -3
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
25db423 to
a5f1e44
Compare
There was a problem hiding this comment.
Pull request overview
Adds per-message-type limits to reduce oversized inbound network messages.
Changes:
- Defines four message-size tiers.
- Drops and logs messages exceeding their type’s limit.
- Records oversized-message metrics by type.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
chain/network/src/network_protocol/mod.rs |
Maps message variants to size limits. |
chain/network/src/peer/peer_actor.rs |
Enforces limits on incoming messages. |
chain/network/src/stats/metrics.rs |
Adds oversized-message drop metrics. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| let max_size = peer_msg.max_size(); | ||
| if msg.len() > max_size { | ||
| let msg_variant = peer_msg.msg_variant(); | ||
| metrics::MessageDropped::TooLargeForType.inc_msg_type(msg_variant); |
| // Enforce a per-message-type size limit. | ||
| let max_size = peer_msg.max_size(); | ||
| if msg.len() > max_size { |
Greptile SummaryAdds per-message-type limits to incoming network traffic, replacing reliance on the single 512 MiB framing ceiling.
Confidence Score: 5/5The PR appears safe to merge with no concrete blocking or independently actionable issue established. The new checks consistently classify decoded message variants, drop frames above the corresponding threshold before dispatch, and account for those drops through the existing metrics infrastructure.
|
Add a size limit for all network message types. Previously the size was only limited by the main network message limit (512 MB)
cherry-pick 5ac2fcd to master