Bounty
XE-16985 · Bounty

[Low] Statechain sync 10MB TOTAL client cap vs server serving up to 10,000 blocks

Closed · duplicate — xe#696 filed 2026-11-17 08:12 UTC by kecedanzz77-bit

Report

Summary

Statechain sync has a 10 MB total client cap against a server that serves up to 10,000 blocks per round with no byte cap. The client decodes the entire stream through ONE io.LimitReader — not per-page (contrast ledger sync's per-page 10 MB + 32 MB session cap) — so a full 10k-block sync breaks whenever the average block JSON exceeds ~1,048 bytes. The client applies blocks inline as decoded, so a capped round makes partial progress and resumes on the next trigger — noisy multi-round sync, not a hard stall.

Root Cause

  • Server side: statechain sync serves pages of 64 blocks, total cap 10,000 blocks, no byte cap (statechain/sync.go:23-28: syncPageSize = 64, syncMaxBlocks = 10000). Per-block max MaxBlockSize=256KB (statechain/types.go:102); per-op value cap MaxValueSize=65536 (:101).
  • Client side: decodes the ENTIRE stream through one io.LimitReader(s, syncMaxResponseSize=10MB) (statechain/sync.go:215, syncMaxResponseSize = 10 << 20 at :28).

Verification

Executed PoC (in-package net test, block-size quantification):

minimal DAO block JSON: 693 bytes -> 10MB cap fits 15130 blocks
epoch-like block JSON: 1391 bytes -> 10MB cap fits 7538 blocks
server serves up to 10000 blocks/round; break-even avg block size: 1048 bytes
full 10k-block sync at minimal size: 6930000 bytes (cap 10485760) — fits
full 10k-block sync at epoch-like size: 13910000 bytes (cap 10485760) — FAILS

Note on related reports

Searched "statechain sync 10MB total cap", "statechain sync response size cap", "statechain sync 10000 blocks" — only #284 (read-path lock), #244 (ledger-sync frontiers 1 MiB, different protocol), #58 (timestamps), #245 (apply loop) — none cover this mechanism.

Suggested fix

Apply the response cap per page (like ledger sync) instead of per round, or bound the total blocks served per round by bytes.

Thread

Joseph Denneteam2026-11-22 23:26 UTCdesk

Thanks. This is the same finding as https://bounty.xe.network/XE-0120, which was filed first; the programme pays the first verifiable submission, so this one closes as a duplicate. If you believe it is a different bug, file a new report that links https://bounty.xe.network/XE-16985 and says what differs; it is read like any other.