net/sync: 10,000-block cap produces a terminal response despite unsent blocks; no explicit continuation signal
Report
Suggested severity: Minor, potentially Medium if the readiness implication is confirmed end-to-end (team to assess).
Area: P2P frontier synchronization / node observability.
Tested version: xeprotocol/xe commit 978785929bc17a2f4ab30c383e5fc9cf4d634512 (Go 1.25.0), network testnet-0005.
Summary
When a peer is missing more than 10,000 blocks, findMissingBlocksPaginated stops at maxServerBlocks = 10000 and can emit its final response with has_more:false even though the source chain still has unsent blocks. capHit is tracked locally but discarded. SyncResponse includes a cursor, but SyncRequest has no cursor/continuation field. The receiving peer can eventually retrieve the remainder if its frontier advances and it makes another request; without frontier progress, it receives the same first 10,000 blocks on each request.
This is a confirmed completion/continuation ambiguity, not a claim of permanent synchronization failure. Whether has_more is intentionally scoped only to pages within one request needs clarification. A related readiness risk is that a nil return from requestSync is marked a successful sync round; /ready checks the timestamp of that success, not independently established full convergence. This potential false-green readiness outcome follows the code path but has not been reproduced end-to-end.
Affected code
net/sync.go:20-40:maxServerBlocksandmaxTotalBlockseach 10,000.net/sync.go:651-751:findMissingBlocksPaginatedstops on cap, sendsHasMore:falseat lines 743-748, discardscapHitat line 750.net/messages.go:16-26:SyncRequestonly containsFrontiersandPageSize;SyncResponseincludesCursor.net/sync.go:529-648and326-337, 366-377:requestSynccan return nil after processing a capped stream; callers recordRecordSyncRound(true)on nil.metrics/metrics.go:228-245andnode/observability.go:554-567: successful-round timestamp is used for thesyncedreadiness check.
Reproduction (offline, in-memory; no public-node load)
From repository checkout at the commit above, save the following as net/xe_sync_replay_repro_test.go and run go test -p 2 -count=1 -run '^TestXECapReplayAndResume$' -v ./net:
package net
import (
"fmt"
"testing"
"github.com/xeprotocol/xe/core"
"github.com/xeprotocol/xe/store"
)
func TestXECapReplayAndResume(t *testing.T) {
s := store.NewMemStore()
l := core.NewLedger(s, core.LedgerConfig{})
const account = "synthetic-offline"
blocks := make([]*core.Block, 10001)
for i := range blocks {
blocks[i] = &core.Block{Account: account, Hash: fmt.Sprintf("%064x", i+1)}
}
if err := s.PutAccountChain(account, &core.AccountChain{Blocks: blocks}); err != nil { t.Fatal(err) }
if err := s.PutFrontier(account, blocks[10000].Hash); err != nil { t.Fatal(err) }
request := l.Frontiers()
delete(request, account) // genesis already known; synthetic account unknown
collect := func() (count int, last string, terminal bool) {
for resp := range findMissingBlocksPaginated(request, l, 64) {
count += len(resp.Blocks)
if len(resp.Blocks) > 0 { last = resp.Blocks[len(resp.Blocks)-1].Hash }
if !resp.HasMore { terminal = true }
}
return
}
n1, h1, end1 := collect()
n2, h2, end2 := collect()
t.Logf("NO_CLIENT_PROGRESS round1=%d round2=%d same_last=%t server_terminal=%t source_chain=10001", n1, n2, h1 == h2, end1 && end2)
if n1 != 10000 || n2 != 10000 || h1 != h2 || !end1 || !end2 { t.Fatal("unexpected capped replay") }
request[account] = h1 // control: receiver persists the 10,000-block prefix
n3, h3, end3 := collect()
t.Logf("AFTER_ADVANCING_FRONTIER remaining=%d final_hash_is_tail=%t terminal=%t", n3, h3 == blocks[10000].Hash, end3)
if n3 != 1 || h3 != blocks[10000].Hash || !end3 { t.Fatal("resume differs from expected") }
}
Observed, 2026-10-30:
=== RUN TestXECapReplayAndResume
NO_CLIENT_PROGRESS round1=10000 round2=10000 same_last=true server_terminal=true source_chain=10001
AFTER_ADVANCING_FRONTIER remaining=1 final_hash_is_tail=true terminal=true
--- PASS: TestXECapReplayAndResume (0.14s)
PASS
ok github.com/xeprotocol/xe/net 0.246s
This validates both the repeated capped prefix when the receiver has not advanced and the negative control: after advancing its frontier, the last block is supplied successfully.
Supplementary observation (not a separate bounty claim)
A short testnet-0005 run of a fresh node on a 4-vCPU VPS connected to 7 peers. It processed 463 blocks while an official bootstrap node had about 135,623 at that time. Its XE journal contained 131 occurrences of sync: hit maxTotalBlocks cap (10000), stopping. /health returned HTTP 200; /ready returned HTTP 503 with synced=false (so no false-positive ready was observed). Memory increased to ~2.3 GiB before the XE node was stopped. Memory growth and slow shutdown are already separately reported and are not claimed here.
Why this matters / suggested clarification
The protocol offers no explicit signal distinguishing “this sync request has ended because the 10,000-block server cap was hit” from “there is no more remote state to send.” A client or operational readiness monitor may treat a successful capped request as evidence of completion. Possible fixes: a truncated / more_after_cap indicator, documented frontier-based continuation, or request-cursor support; additionally, do not equate merely successful request completion with proven convergence in the readiness signal.
Existing reports and scope limits
Related accepted reports: #59 (overlapping sync goroutines and resource exhaustion), #60 (shutdown waits on in-flight sync), #57 (lease-family blocks not syncing). This report does not re-claim their resource, SIGTERM, or lease-dependency findings. There is no demonstrated permanent stall, fund loss, or exploitable security impact here; maintainers may regard stream-scoped has_more as intended semantics.
Testing ethics: Reproduction is local and synthetic. No keys, wallets, other users’ workloads, or public sustained load were used. Only an ordinary short first-boot test was performed on public testnet.
XE payout address (testnet wallet; confirm mainnet compatibility at launch): 6cae644263a88b2fc1167c7b3680ec182e81035777b682827c02ccf1be027a39.
Thread
Additional bounded local P2P evidence (2026-10-30)
Following the earlier code-path hypothesis, I ran a second reproduction through real in-process libp2p hosts on 127.0.0.1, with no public-network traffic. The controlled peer responds to /xe/sync/1.0.0 with a syntactically valid, empty terminal SyncResponse{Blocks:nil, HasMore:false}. The unmodified SetupSync client records metrics.LastSuccessfulSync() as nonzero. Using that actual sync-success timestamp, NewFixedObserver then returns ready=true with a synthetic snapshot containing just one local genesis block and otherwise passing readiness conditions.
This is stronger evidence that synced is a recent successful stream/round check rather than a proof of convergence. It does not demonstrate a public-node HTTP /ready false positive, because the observer's other inputs were supplied by a test fixture. It also does not prove a permanent stall or security-critical outcome. A fully validating, multi-peer end-to-end test would still be needed to establish the live operational impact.
=== RUN TestXELocalEmptySyncMarksPeerReady
ACTUAL_LOCAL_P2P_EMPTY_TERMINAL: local_blocks=1 peer_count=1 sync_success_nonzero=true ready=true status=ready
--- PASS: TestXELocalEmptySyncMarksPeerReady (0.07s)
PASS
ok github.com/xeprotocol/xe/net 0.101s
To reproduce on pinned commit 978785929bc17a2f4ab30c383e5fc9cf4d634512, save the test below as net/xe_p2p_readiness_local_test.go:
package net_test
import (
"context"
"encoding/json"
"testing"
"time"
"github.com/libp2p/go-libp2p"
libnetwork "github.com/libp2p/go-libp2p/core/network"
"github.com/libp2p/go-libp2p/core/peer"
"github.com/xeprotocol/xe/core"
"github.com/xeprotocol/xe/store"
xenet "github.com/xeprotocol/xe/net"
"github.com/xeprotocol/xe/metrics"
"github.com/xeprotocol/xe/node"
)
func TestXELocalEmptySyncMarksPeerReady(t *testing.T) {
metrics.ResetSyncProgress()
defer metrics.ResetSyncProgress()
server,err:=libp2p.New(libp2p.ListenAddrStrings("/ip4/127.0.0.1/tcp/0"))
if err!=nil {t.Fatal(err)}
defer server.Close()
client,err:=libp2p.New(libp2p.ListenAddrStrings("/ip4/127.0.0.1/tcp/0"))
if err!=nil {t.Fatal(err)}
ctx,cancel:=context.WithCancel(context.Background())
defer cancel()
defer client.Close()
server.SetStreamHandler("/xe/sync/1.0.0",func(s libnetwork.Stream){
defer s.Close()
var req xenet.SyncRequest
if err:=json.NewDecoder(s).Decode(&req);err!=nil{return}
_=json.NewEncoder(s).Encode(&xenet.SyncResponse{Blocks:nil,HasMore:false})
})
ledger:=core.NewLedger(store.NewMemStore(),core.LedgerConfig{})
_,wait:=xenet.SetupSync(ctx,client,ledger)
defer func(){cancel();_ = client.Close();wait()}()
if err:=client.Connect(ctx,peer.AddrInfo{ID:server.ID(),Addrs:server.Addrs()});err!=nil {t.Fatal(err)}
deadline:=time.Now().Add(5*time.Second)
for metrics.LastSuccessfulSync().IsZero() && time.Now().Before(deadline) {
time.Sleep(20*time.Millisecond)
}
last:=metrics.LastSuccessfulSync()
if last.IsZero(){t.Fatal("No sync success from empty terminal response")}
snap:=&node.Snapshot{At:time.Now(),Blocks:1,Accounts:1,
DelegatedWeight:42,Representatives:1,ActiveRepresentatives:1,
QuorumMargin:0.33,UnfinalizedPositions:0}
obs:=node.NewFixedObserver(node.ObsConfig{MinPeers:1},snap,1,last)
ready:=obs.Ready()
t.Logf("ACTUAL_LOCAL_P2P_EMPTY_TERMINAL: local_blocks=%d peer_count=1 sync_success_nonzero=%t ready=%t status=%s",
snap.Blocks,!last.IsZero(),ready.Ready,ready.Status)
if !ready.Ready {t.Fatalf("Unexpected checks: %+v",ready.Checks)}
}
Then run: go test -p 2 -count=1 -run '^TestXELocalEmptySyncMarksPeerReady$' -v ./net.
Only loopback P2P and in-memory storage were used. I am keeping this as supporting evidence for #219, not a separate resource-exhaustion claim or a request to raise severity.
[comment from a blocked account removed]
Thank you, @arturbarszcz78, for preparing PR #223 and implementing a proposed fix for the synchronization issue reported here.
I appreciate your work on the fix and the additional regression tests.
For clarity regarding Bug Bounty attribution, I would like to emphasize that the original issue was identified, reproduced, documented, and reported by me under #219 (@freestriker00), before PR #223 was submitted.
The original report included a reproducible 10,001-block test case, analysis of the truncation and convergence behavior, and additional local P2P evidence concerning the readiness mechanism.
I fully recognize and appreciate @arturbarszcz78's contribution as the author of the proposed fix. However, credit for discovering and reporting the issue should be distinguished from credit for implementing its solution.
Since PR #223 includes separate reward addresses, I would kindly ask the XE maintainers to clarify how Bug Bounty attribution and any potential rewards will be handled.
My original XE payout address remains the one provided in issue #219.
I am also happy to help validate PR #223 against the original reproduction cases.
Thank you for your consideration and for improving the XE protocol.
Additional public-testnet observation: /ready can be green during incomplete historical sync (2026-10-30)
I performed a bounded ordinary cold-start of one real XE node on public testnet-0005 as part of the announced, protocol-only research campaign #224.
At 2026-10-30 17:11:37 UTC, the fresh node returned:
GET /node 200 network_id=testnet-0005, block_count=32
GET /health 200 ok=true
GET /ready 200 ready=true, checks.synced=true, peer_count=6
Shortly before this run, GET https://ldn.core.test.network/node reported network_id=testnet-0005 and block_count=144688. The fresh node was therefore visibly nowhere near the official bootstrap ledger's block count while claiming to be synced/ready. The local journal recorded 25 sync: hit maxTotalBlocks cap (10000), stopping warnings.
This supplements the earlier offline tests with an actual public-node readiness mismatch, but does not isolate the 10,000-block cap as the unique cause, establish permanent stalling, or claim a new severity. The node had only one configured bootstrap but six observed connected peers; the reported mismatch is a single sampled snapshot, not a time-series study.
The run was stopped under resource controls, with no transaction writes or request flood. Full operational caveats, including the apparent-vs-allocated disk monitoring error, are documented in campaign #224, comment https://github.com/xeprotocol/xe/issues/224#issuecomment-6528787448. I am keeping this as further evidence for the original report #219, not an additional bounty claim.
Time-series follow-up to #219: premature /ready during ordinary public-testnet sync
A second, separately started research node on public testnet-0005 reproduced the ready=true / synced=true mismatch during incomplete historical synchronization. Unlike the previous single-snapshot observation, this run recorded 18 samples at five-second intervals.
- At t=15s, the pinned research-client binary (
xe/dev, source commit978785929bc17a2f4ab30c383e5fc9cf4d634512) had 16 blocks, butGET /readyreturned HTTP 200, ready=true, checks.synced=true. readyremained true through t=85s, when the local ledger held only 288 blocks.- The official London bootstrap node (
xe/4f19518, samenetwork_id=testnet-0005but different software build) reported 145,130 blocks before and 145,190 afterward. - The local journal logged 47
sync: hit maxTotalBlocks cap (10000), stoppingevents. These logs do not establish the cap as the unique root cause of this readiness mismatch. - Memory rose to 848.1 MB, below the safety cap; actual allocated data was ~5.6 MB at the final sample; the run had five to six connected peers. No transaction writes or load were generated, and the node is stopped.
Full second-run methodology, 18 data points, explicit limitations and termination details are in the pre-notified campaign report #224, follow-up comment.
This is supporting operational evidence for the existing issue #219, not a new bug report, an additional reward claim, proof of permanent sync stall, or proof that the latest public build behaves identically.