{"id":"XE-0088","kind":"bounty","visibility":"public","source":"github","source_repo":"xeprotocol/xe","source_ref":"33","source_url":"https://github.com/xeprotocol/xe/issues/33","reporter_id":10,"title":"Time-to-finality measures 10-35s (median 19.4s) against the documented ~3s; finality advances lag block production 2.5x","area":"sdk-docs-web","claimed_tier":"medium","assessed_tier":null,"verdict":null,"duplicate_of":null,"tracked":true,"internal_ref":"","internal_url":null,"status":"accepted","closed_reason":null,"github_state":"open","disclosed_at":null,"award_xe":null,"award_approved":false,"paid_ref":"","created_at":"2026-10-29T13:57:25.201338+00:00","updated_at":"2026-11-10T11:38:27.058499+00:00","source_created_at":"2026-10-24T14:46:49+00:00","told_at":"2026-11-10T00:16:01+00:00","status_changed_at":"2026-10-29T14:04:14.346214+00:00","url":"https://bounty.xe.network/XE-0088","body":"**Severity (suggested):** Medium — the documented finality bound does not match observable behaviour by ~6×, and a\nsingle missed vote round costs ≥15 s. Not a stall (blocks do finalize), no fund risk.\n\n**XE payout address:** `b68f2b4d8a062d9219590f0c2d7753d783ec9f5d43d85a125230bb0f7a41a86e`\n\n### What the docs say\n\n- the site header/marketing: \"**~3sFinality**\", \"transactions final in seconds\"\n- `/docs/constants`: \"Lock stability window | **3 seconds**\"\n- README: \"Blocks finalize through representative voting … finalize … **final in seconds**\"\n\n### What we measure on `testnet-0005`\n\nTen ordinary 1-micro `send` blocks from one of our own wallets, each one timed from **submission** to the moment the\nnode reports `finalized: true` for that block hash (polling `/accounts/{addr}/chain` every 0.5 s; submit latency\nexcluded from the finality number):\n\n```\n[1]  finalized in  9.8s      [6]  finalized in 20.6s\n[2]  finalized in 10.8s      [7]  finalized in 14.8s\n[3]  finalized in 12.6s      [8]  finalized in 22.7s\n[4]  finalized in 35.3s      [9]  finalized in 23.7s\n[5]  finalized in 18.2s      [10] finalized in 22.7s\n\nfinalized 10/10 · min 9.8s · median 19.4s · mean 19.1s · max 35.4s · >3s: 10/10\n```\n\nIdle baseline (no load from us, 2 minutes, sampled every 5 s on `GET /node`):\n\n```\nblock_count      +25   (7.7 blocks/min)\nfinality_advances +10  (3.1 advances/min)   → 2.5 blocks per finality advance\nlag since last advance: median 9.9s · mean 11.4s · max 24.7s · 12/24 samples >10s\n```\n\nNetwork context at measurement time: `representatives: 1`, `peer_count: 6`, `dropped_blocks: 0`.\n\n### Why ~19 s looks like \"one missed vote round\"\n\nVotes are cast on block add (`node/node.go:279 ledger.SetBlockAddedCallback(voteMgr.OnBlockAdded)`), so a block that\nreaches the representative immediately should confirm in seconds. But if that first round is missed, the retry path is\nslow:\n\n```go\n// node/node.go:281-292\nticker := time.NewTicker(15 * time.Second)\n...\ncase <-ticker.C:\n    voteMgr.SweepFrontiers()\n```\n\nplus `Re-vote backoff | 15 seconds` in `/docs/constants`. A median of ~19 s is consistent with \"the immediate vote\nround is often missed, and the 15 s sweep is what actually finalizes it\" — i.e. the **effective** bound in the common\ncase is one sweep interval, not 3 s.\n\nWe are *not* claiming a root cause beyond that observation: we did not instrument the representative, and\n`time-to-finalized` inherently includes our block reaching the rep and the vote coming back.\n\n### Why it matters\n\n1. **Clients that follow the docs are wrong by ~6×.** Anything that treats a payment as final after ~3 s (the\n   documented promise, and the reason \"settled in under a second\" / \"zero-fee finality\" is attractive for agents)\n   is accepting unfinalized state for another 10–35 s.\n2. **`finalized: false` is the common state, not the exception**: 2.5 blocks per finality advance at idle means most\n   blocks spend most of their life unfinalized.\n3. It also means a *single* representative is the liveness dependency for finality network-wide (`representatives: 1`);\n   if that key is offline, nothing finalizes. That is a design property, but it makes the documented 3 s unreachable\n   rather than merely optimistic.\n\n### Reproduction\n\n```bash\n# 1) submit a block with your own key, then poll until finalized:true and time it\n#    (any wallet with balance can do this; see the script in our earlier comment)\n# 2) network-side view, no client needed:\nfor i in $(seq 1 12); do\n  curl -s https://ldn.core.test.network/node \\\n    | jq -r '\"blocks=\\(.block_count) finality=\\(.finality_advances) lag_ms=\\(((now*1000|floor) - (.last_finality_ns/1000000))|floor)\"'\n  sleep 5\ndone\n```\n\n### Suggested fix (pick one)\n\n- Make finalization retry faster than 15 s (e.g. sweep on vote-receipt gaps, or a 2–3 s retry while a frontier has no\n  quorum), so the common case matches the documented bound; or\n- Keep the implementation and **state the real bound** in the docs (\"finality is typically 10–35 s on testnet-0005\n  with one representative; 3 s is the lock-stability window, not time-to-finality\") — the current wording is what a\n  client developer will code against.\n\nIf \"~3 s\" is intended to describe the lock-stability window rather than time-to-finality, then this is a\ndocumentation defect rather than a code one — either way the two need to agree, because right now a client cannot tell.\n\n---\n\n*Measured 2026-10-24 22:44 (+08) against `https://ldn.core.test.network`, from our own funded testnet wallets,\n1 micro per block, 10 samples. Campaign context: #32.*\n","patch_refs":[],"thread":[{"id":40,"source":"github","source_ref":"6393289935","author":"kenmungeneskar","team":false,"body":"﻿**Follow-up measurement (2026-10-25) — same metric, paired design, 22 probes in one session**\n\nTo check whether the 19.4 s median was representative, I re-measured with a probe wallet that was not part of any load,\nin three windows of the same session (quiet → load → quiet):\n\n| phase | n | median | p90 | max |\n|---|---|---|---|---|\n| quiet before | 7 | **5.5 s** | 7.1 s | 11.0 s |\n| under load (<=4 tx/s, 10 wallets) | 9 | **7.3 s** | 12.2 s | 14.7 s |\n| quiet after | 6 | **6.2 s** | 6.6 s | 13.2 s |\n\n- All 22 blocks finalized; **none under 3 s** (minimum 3.7 s).\n- The 19.4 s median in the report above was measured on 2026-10-24 22:44 (+08), during a slower window — on the same\n  node, ~11:33–11:44 on 2026-10-25 `finality_advances` did not move at all for about eleven minutes before catching up.\n\nSo the **direction** of this report stands (time-to-finality is consistently above the documented ~3 s, and the\n3 s figure is what a client developer will code against), but the **magnitude is condition-dependent**: roughly\n5.5–7.3 s median in a normal window, ~19 s in a slow one. The better-case number is the one to quote; I would rather\ngive you both than the flattering one.","created_at":"2026-10-25T04:10:13+00:00"},{"id":41,"source":"github","source_ref":"6469140684","author":"BoomGone","team":false,"body":"Data point from a bounded single-client re-measurement on the current build (node xe/74eeec5), per notice #132.\n\n25 sequential send blocks, one at a time (well under 1 tx/s), timing submit to finalization via final_height:\n\n- finality: median 3.5s, min 3.2s, max 4.2s (documented ~3s)\n- submit latency: avg 357ms\n\nCaveat so this is not misread: this is single-client sequential load and does NOT reproduce the multi-wallet concurrent conditions here (#34 used ~1 tx/s across 30 wallets). It is a baseline, not a refutation. It shows single-client finality on xe/74eeec5 sits close to the documented 3s; I have not yet measured the multi-wallet degradation on this build.","created_at":"2026-10-28T12:36:11+00:00"},{"id":1589,"source":"github","source_ref":"6755098309","author":"XE desk","team":true,"body":"Read and accepted. It is tracked internally and the fix will land in a public PR; this issue is\nupdated when it does, and the tier and award follow the fix. The desk entry is https://bounty.xe.network/XE-0088.","created_at":"2026-11-10T00:16:01+00:00"},{"id":3136,"source":"github","source_ref":"6822681804","author":"fauzilukman","team":false,"body":"Load-dependence data point for this issue, measured 2026-11-11 on testnet-0005 (public node ldn.core.test.network, own test wallets, 1-micro sends, campaign notice XE-5390):\n\n- At 1 tx/s sustained (60 s, n=59): finality median 4.0 s, p95 10.2 s, max 11.0 s.\n- At ~3.3 tx/s sustained (120 s, n=500, repeated twice): finality median ~20 s, p95 32–51 s, max 46–55 s. Submit latency median rose 0.69 s → ~2 s (p95 ~1.4 s → ~10–14 s). Unfinalised positions 3–6 → 24–26 (stable, not growing).\n- 0 errors, 0 stalls > 60 s, everything finalised, node healthy throughout (/ready 200, quorum margin 0.33, 1/7 reps); full recovery to ~4 s median within minutes of the load stopping.\n\nSo the ~19 s median in this issue looks load-dependent: at low rate the immediate vote round usually lands (~4 s); under sustained load it is usually missed and the 15 s sweep is what finalises. The 3.3 tx/s ceiling here was our generator host's CPU, not the network — the network's breaking point is still above that.","created_at":"2026-11-12T11:44:30+00:00"}]}