<!-- XE-16985 · [Low] Statechain sync 10MB TOTAL client cap vs server serving up to 10,000 blocks · testnet -->
*Markdown view of <https://bounty.xe.network/XE-16985>. The page is the record; this is the same page for reading.*

XE-16985 · Bounty

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

Closed · duplicate
—
[xe#696](https://github.com/xeprotocol/xe/issues/696)
filed 2026-11-17 08:12 UTC
by kecedanzz77-bit

Verdict
:   Duplicate

Tier
:   —

Claimed
:   —

Area
:   P2P / sync

Duplicate of
:   [XE-0120](https://bounty.xe.network/XE-0120) triaging

Tracked
:   —

Updated
:   2026-11-22 23:26 UTC

Told
:   2026-11-22 23:26 UTC

### Patches

None linked.

### History

- [770271](https://bounty.xe.network/log/770271) 2026-11-22 23:26 UTC reply.mirror\_failed
- [770025](https://bounty.xe.network/log/770025) 2026-11-22 23:26 UTC proposal.adopted
- [770024](https://bounty.xe.network/log/770024) 2026-11-22 23:26 UTC reply.sent
- [770023](https://bounty.xe.network/log/770023) 2026-11-22 23:26 UTC ticket.status new → closed
- [769159](https://bounty.xe.network/log/769159) 2026-11-22 23:25 UTC proposal.adopted
- [769158](https://bounty.xe.network/log/769158) 2026-11-22 23:25 UTC ticket.facts area
- [769155](https://bounty.xe.network/log/769155) 2026-11-22 23:25 UTC proposal.adopted
- [769154](https://bounty.xe.network/log/769154) 2026-11-22 23:25 UTC ticket.facts
- [769151](https://bounty.xe.network/log/769151) 2026-11-22 23:25 UTC proposal.adopted
- [769150](https://bounty.xe.network/log/769150) 2026-11-22 23:25 UTC ticket.facts
- [766273](https://bounty.xe.network/log/766273) 2026-11-22 23:17 UTC note.added
- [766265](https://bounty.xe.network/log/766265) 2026-11-22 23:17 UTC proposal.created

[Full history](https://bounty.xe.network/log?ref=XE-16985) · [JSON](https://bounty.xe.network/v1/tickets/XE-16985) · [markdown](https://bounty.xe.network/XE-16985.md)

### 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 Denne**team2026-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.
