<!-- XE-13354 · Report bug · testnet -->
*Markdown view of <https://bounty.xe.network/XE-13354>. The page is the record; this is the same page for reading.*

XE-13354 · Bounty

# Report bug

Triaging
[xe#499](https://github.com/xeprotocol/xe/issues/499)
filed 2026-11-12 03:50 UTC
by Gib230223

Verdict
:   published when the fix ships

Tier
:   published when the fix ships

Claimed
:   —

Area
:   Node / API

Duplicate of
:   —

Tracked
:   —

Updated
:   2026-11-20 00:38 UTC

Told
:   2026-11-20 00:34 UTC

### Patches

- [xe#519](https://github.com/xeprotocol/xe/pull/519) open by arturbarszcz78
  fix(chat): clamp maxPerAccount and defensively guard against slice panics (fixes #499)

### History

- [554988](https://bounty.xe.network/log/554988) 2026-11-20 00:38 UTC github.labels
- [554427](https://bounty.xe.network/log/554427) 2026-11-20 00:37 UTC proposal.adopted
- [554426](https://bounty.xe.network/log/554426) 2026-11-20 00:37 UTC ticket.award
- [554025](https://bounty.xe.network/log/554025) 2026-11-20 00:34 UTC reply.mirrored
- [553935](https://bounty.xe.network/log/553935) 2026-11-20 00:34 UTC proposal.adopted
- [553934](https://bounty.xe.network/log/553934) 2026-11-20 00:34 UTC reply.sent
- [553858](https://bounty.xe.network/log/553858) 2026-11-20 00:34 UTC proposal.adopted
- [553857](https://bounty.xe.network/log/553857) 2026-11-20 00:34 UTC ticket.status new → triaging
- [553575](https://bounty.xe.network/log/553575) 2026-11-20 00:34 UTC proposal.adopted
- [553574](https://bounty.xe.network/log/553574) 2026-11-20 00:34 UTC ticket.facts area
- [553573](https://bounty.xe.network/log/553573) 2026-11-20 00:34 UTC proposal.adopted
- [553572](https://bounty.xe.network/log/553572) 2026-11-20 00:34 UTC ticket.facts

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

### Report

# XE Bounty — Laporan siap file (temuan pass 4 #4)

File issue baru di: https://github.com/xeprotocol/xe/issues/new
Paste judul \+ isi di bawah. Akun GitHub: Gib230223.

---

## Judul

\[Low\] ChatStore panics when constructed with maxPerAccount \<\= 0

## Isi

## Summary

`chat.NewChatStore(maxPerAccount)` takes the bound with no validation, and `storeFor` indexes `newMsgs[s.maxPerAccount-1]` whenever `len(msgs) >= s.maxPerAccount`. With `maxPerAccount == 0`, `len(msgs) >= 0` is always true, so the first `Store` panics; with a negative value, `make` panics. An exported constructor that panics on a plausible misconfiguration.

## Evidence

```
// chat/chat.go:21 — no validation of the bound:
func NewChatStore(maxPerAccount int) *ChatStore {
    return &ChatStore{
        messages:      make(map[string][]*Envelope),
        seen:          make(map[string]int64),
        maxPerAccount: maxPerAccount,
        listeners:     make([]chan *Envelope, 0),
    }
}

// chat/chat.go:72-83 — storeFor panics on maxPerAccount <= 0:
func (s *ChatStore) storeFor(account string, env *Envelope) {
    msgs := s.messages[account]
    if len(msgs) >= s.maxPerAccount {
        newMsgs := make([]*Envelope, s.maxPerAccount)
        copy(newMsgs, msgs[1:])
        newMsgs[s.maxPerAccount-1] = env
        s.messages[account] = newMsgs
    } else {
        s.messages[account] = append(msgs, env)
    }
}
```

## Impact (Low, latent)

The only production caller passes 1000 (`node/node.go:314`: `chat.NewChatStore(1000)`), so there is no live production path today. Robustness / defense-in-depth: an exported constructor that panics on a plausible misconfiguration; one-line fix (clamp `maxPerAccount` to \>\= 1 in `NewChatStore`).

## Reproduction (PoC)

`TestPoc4ChatStoreZeroMaxPanics` (package `chat`):

```
maxPerAccount=0: Store panicked as expected: runtime error: slice bounds out of range [1:0]
maxPerAccount=-1: Store panicked as expected: runtime error: makeslice: len out of range
```

## Novelty note

No ticket covers the zero/negative-bound panic. Board greps for `maxPerAccount`, `ChatStore panic` return only XE-7038 (ChatStore dedup-set saturation halts all chat ingestion — a different mechanism, about the dedup set filling up, not the bound). GitHub `search_issues` for "ChatStore maxPerAccount panic" returns 0 results; the closest are #269 (flooding eviction — the rotation itself) and #256 (ANSI escapes) — neither is the zero/negative-bound panic. Checked the live bounty board (High\+Medium and Minor views) and the GitHub repo issues, 2026-11-12.

Repo: github.com/xeprotocol/xe, HEAD 89a542e, testnet-0005.

### Thread

**Joseph Denne**team2026-11-20 00:34 UTCgithub

Thanks for the report. We have read it against the current tree and it is being handled. The assessment and any award follow the fix.

**Tsaqifalk**2026-11-21 13:26 UTCgithub

Omaga

**rhnhabibi**2026-11-21 13:43 UTCgithub

jangan asal timpa mas reportnya dibaca dulu xixixi

**ddettaa**2026-11-21 13:46 UTCgithub

😹😹

**rhnhabibi**2026-11-21 13:47 UTCgithub

lucu bgt loh rek lupa masih bahasa indo

**Gib230223**2026-11-21 13:48 UTCgithub

Mana saya tau saya nyuruh Muse yang ngerjain

Pada Sab, 21 Nov 2026, 20.43, rhnhabibi ***@***.\*\*\*\> menulis:

> *rhnhabibi* left a comment (xeprotocol/xe#499)
> <https://github.com/xeprotocol/xe/issues/499#issuecomment-7063527908>
>
> jangan asal timpa mas reportnya dibaca dulu xixixi
>
> —
> Reply to this email directly, view it on GitHub
> [https://github.com/xeprotocol/xe/issues/499?email\_source\=notifications\&email\_token\=BQY7MN6LYJEUKMMVHGIEAQT52GLZZA5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTOMBWGM2TENZZGA4KM4TFMFZW63VGMF2XI2DPOKSWK5TFNZ2KYZTPN52GK4S7MNWGSY3L#issuecomment-7063527908](https://github.com/xeprotocol/xe/issues/499?email_source=notifications&email_token=BQY7MN6LYJEUKMMVHGIEAQT52GLZZA5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTOMBWGM2TENZZGA4KM4TFMFZW63VGMF2XI2DPOKSWK5TFNZ2KYZTPN52GK4S7MNWGSY3L#issuecomment-7063527908),
> or unsubscribe
> <https://github.com/notifications/unsubscribe-auth/BQY7MN5XET5QRHFTJZQKW7T52GLZZAVCNFSNUABGKJSXA33TNF2G64TZHMYTGMRVGI2TCNBSGE5US43TOVSTWNRTGQZDGNRSGA4DPILWAI>
> .
> Triage notifications, keep track of coding agent tasks and review pull
> requests on the go with GitHub Mobile for iOS
> <https://github.com/notifications/mobile/ios/BQY7MN7CO6GSJ34K2JZD3TT52GLZZA5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTOMBWGM2TENZZGA4KM4TFMFZW63VGMF2XI2DPOKSWK5TFNZ2KUZTPN52GK4S7NFXXG>
> and Android
> <https://github.com/notifications/mobile/android/BQY7MN6VZRZ7MELLG7IUE6T52GLZZA5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTOMBWGM2TENZZGA4KM4TFMFZW63VGMF2XI2DPOKSWK5TFNZ2K4ZTPN52GK4S7MFXGI4TPNFSA>.
> Download it today!
> You are receiving this because you authored the thread.Message ID:
> ***@***.\*\*\*\>

**Gib230223**2026-11-21 13:48 UTCgithub

Maksud

Pada Sab, 21 Nov 2026, 20.47, rhnhabibi ***@***.\*\*\*\> menulis:

> *rhnhabibi* left a comment (xeprotocol/xe#499)
> <https://github.com/xeprotocol/xe/issues/499#issuecomment-7063582241>
>
> lucu bgt loh rek lupa masih bahasa indo
>
> —
> Reply to this email directly, view it on GitHub
> [https://github.com/xeprotocol/xe/issues/499?email\_source\=notifications\&email\_token\=BQY7MN2X2VWUY6LA6CN3F6L52GMH3A5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTOMBWGM2TQMRSGQY2M4TFMFZW63VGMF2XI2DPOKSWK5TFNZ2KYZTPN52GK4S7MNWGSY3L#issuecomment-7063582241](https://github.com/xeprotocol/xe/issues/499?email_source=notifications&email_token=BQY7MN2X2VWUY6LA6CN3F6L52GMH3A5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTOMBWGM2TQMRSGQY2M4TFMFZW63VGMF2XI2DPOKSWK5TFNZ2KYZTPN52GK4S7MNWGSY3L#issuecomment-7063582241),
> or unsubscribe
> <https://github.com/notifications/unsubscribe-auth/BQY7MN4ZMCBU3VAJDK2HZLT52GMH3AVCNFSNUABGKJSXA33TNF2G64TZHMYTGMRVGI2TCNBSGE5US43TOVSTWNRTGQZDGNRSGA4DPILWAI>
> .
> Triage notifications, keep track of coding agent tasks and review pull
> requests on the go with GitHub Mobile for iOS
> <https://github.com/notifications/mobile/ios/BQY7MN5TZGLJTL5TNAFWTK352GMH3A5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTOMBWGM2TQMRSGQY2M4TFMFZW63VGMF2XI2DPOKSWK5TFNZ2KUZTPN52GK4S7NFXXG>
> and Android
> <https://github.com/notifications/mobile/android/BQY7MN24NEUOMYIC4NZDJ7D52GMH3A5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTOMBWGM2TQMRSGQY2M4TFMFZW63VGMF2XI2DPOKSWK5TFNZ2K4ZTPN52GK4S7MFXGI4TPNFSA>.
> Download it today!
> You are receiving this because you authored the thread.Message ID:
> ***@***.\*\*\*\>

**Creepzone11**2026-11-21 13:53 UTCgithub

> Thanks for the report. We have read it against the current tree and it is being handled. The assessment and any award follow the fix.
>
> XE-13354 · https://bounty.xe.network/XE-13354

Njing

**Gib230223**2026-11-21 13:59 UTCgithub

Wey ko pada ngumpul disini cok

**supercherki**2026-11-21 14:00 UTCgithub

muse saya setara nasa, kamu tidak bisa mengelak

**Gib230223**2026-11-21 14:01 UTCgithub

Heleh Muse plenger

**arashel666**2026-11-21 14:12 UTCgithub

kalo nimpa dipikir mas

**Gib230223**2026-11-21 14:13 UTCgithub

Loh gua nimpa punya siapa gua ajh nuyuruh Muse malah d bilang nimpa kocak

**erisaerisul**2026-11-21 14:19 UTCgithub

saya adalah muse spark sahabat pemerintah

**mmasyoga0**2026-11-21 17:28 UTCgithub

Ngerii
