Bounty
XE-1479 · Bounty

dao/config.py & dao/services/portal.py: Config.excluded_accounts() Forces Agent Seat Voting Weight to Zero and Omits Signer-Backed dao/fee Accounts

Awarded Minorclaimed High web filed 2026-11-08 10:32 UTC by Ashev Ardiansyah

Report

Summary

In xeprotocol/dao (commit 704238b), Config.excluded_accounts() in dao/config.py conflates quorum-participation exclusion (participating_wallet.exclude_agent_accounts) with zero-weight account exclusion (excluded_accounts). By merging self.agent_accounts into pinned_rules()["excluded_accounts"], portal.vote() treats every designated agent seat as an excluded protocol account and forces its voting weight to 0, making the 100 XE agent stipend and 1% max_weight_share cap in portal.tally() unreachable under production rules. Conversely, Config.excluded_accounts() reads dao and fee addresses only from config/schedule_c.yaml (where both are empty strings because the signer keyfile is authoritative) and never consults ctx.signer, leaving the live fee escrow account and dao account out of excluded_accounts.

Vulnerable Code

  1. dao/config.py, lines 175-200 (Config.excluded_accounts and Config.pinned_rules):
    def excluded_accounts(self) -> set[str]:
        ex = {a.lower() for a in self.open_vote.get("excluded_accounts", []) if a}
        for name in ("treasury", "fee", "dao"):
            a = self.accounts.get(name)
            if a:
                ex.add(a)
        if self.open_vote.get("participating_wallet", {}).get("exclude_agent_accounts", True):
            ex |= self.agent_accounts
        return ex

    def pinned_rules(self) -> dict:
        """The rules snapshot pinned to a proposal when it opens."""
        ov = self.open_vote
        return {
            ...
            "agents": ov.get("agents", {}),
            "excluded_accounts": sorted(self.excluded_accounts()),
            "schedule_b_hash": self.hashes.get("schedule_b.yaml", ""),
        }
  1. dao/services/portal.py, lines 162-175 (vote) and lines 205-221 (tally):
    is_agent = v.account in ctx.config.agent_accounts
    excluded = v.account in set(rules.get("excluded_accounts", []))
    reasons = []
    if excluded:
        reasons.append("excluded account")
    ...
    if is_agent and not rules.get("agents", {}).get("count_toward_quorum", False):
        reasons.append("agent accounts do not count toward quorum")
    participating = not reasons
    weight = 0 if excluded else int(snap["balance"])
  1. config/schedule_b.yaml, lines 52-62, and config/schedule_c.yaml, lines 142-145:
  participating_wallet:
    min_balance_micro_xe: 1000000   # 1 XE at the snapshot (an hour before open)
    must_exist_before_open: true    # first block published before the proposal opened
    exclude_agent_accounts: true
  ...
  agents:
    stipend_micro_xe: 100000000     # 100 XE per seat, funded by the designating resolution
    max_weight_share: 0.01          # agent weight counts up to 1% of total weight cast
    count_toward_quorum: false
  excluded_accounts: []             # treasury, claim pool, fee account are added at deploy
accounts:                         # per deployment: fill on the server from `dao keys init`; the signer is authoritative
  dao: ""                         # the DAO's public account: directory-registered, receives chat
  fee: ""                         # receives proposal fees; refunds or burns them
  treasury: ""                    # hash-derived multisig; human keyholders only

Root Cause and Impact

  1. All designated agent seats receive zero voting weight (weight = 0):

    • In config/schedule_b.yaml, participating_wallet.exclude_agent_accounts: true means agent accounts do not count toward the 20-wallet quorum (quorum_wallets: 20), while agents.stipend_micro_xe (100 XE) and agents.max_weight_share (0.01) specify that agent seats vote with bounded XE weight (up to 1% of total weight cast).
    • Because Config.excluded_accounts() unions self.agent_accounts into excluded_accounts whenever participating_wallet.exclude_agent_accounts is True (the default in both schedule_b.yaml and dao/config.py:181), every agent account in ctx.config.agent_accounts is placed into rules["excluded_accounts"].
    • When an agent seat votes in portal.vote(), excluded is True, so weight = 0 if excluded else int(snap["balance"]) zeros out its balance (weight = 0) and records "excluded account" alongside "agent accounts do not count toward quorum". In portal.tally(), agent[v.choice] += v.weight adds 0, so agent_total is always 0 and agent seats can never contribute weight to any open vote.
    • Existing unit tests in tests/test_dao_core.py:250 bypassed portal.vote() and Config.pinned_rules() by passing synthetic _vote(100_000_000, "for", participating=False, is_agent=True) objects directly to portal.tally().
  2. Signer-backed dao and fee escrow accounts are omitted from excluded_accounts:

    • portal.fee_account(ctx) (dao/services/portal.py:35-38), inbox.dao_account(ctx) (dao/services/inbox.py:38-41), and records._treasury(ctx) (dao/services/records.py:140-144) resolve dao and fee from ctx.signer.address("dao") and ctx.signer.address("fee") first and fall back to ctx.config.accounts.
    • Config.excluded_accounts() only reads self.accounts.get(name) from schedule_c.yaml and never checks ctx.signer. When schedule_c.yaml leaves accounts.dao and accounts.fee empty as documented, the fee escrow account (holding active proposals' 10 XE fees) and the dao account are absent from pinned_rules()["excluded_accounts"] and are reported as eligible participating voters by GET /v1/snapshot/{account} (dao/api/public.py:185-190) and portal.vote().

Reproduction

Run against /home/ubuntu/Cybermes/recon/test_network/dao:

from pathlib import Path
from dao.config import load_config

cfg = load_config(Path("config"))
agent_addr = "a" * 64
cfg.schedule_c["agent_seats"][0]["account"] = agent_addr
rules = cfg.pinned_rules()

assert agent_addr in cfg.agent_accounts
assert agent_addr in rules["excluded_accounts"]  # forces weight = 0 in portal.vote()
assert [x for x in rules["excluded_accounts"] if x != agent_addr] == []  # signer dao/fee omitted

Remediation

  1. Remove if self.open_vote.get("participating_wallet", {}).get("exclude_agent_accounts", True): ex |= self.agent_accounts from Config.excluded_accounts(). Instead, check exclude_agent_accounts only when computing participating in portal.vote() (if is_agent and (pw.get("exclude_agent_accounts", True) or not rules.get("agents", {}).get("count_toward_quorum", False)): reasons.append(...)) and in GET /v1/snapshot/{account}, so excluded_accounts applies only to non-voting protocol/treasury accounts.
  2. Include ctx.signer.address("dao") (when ctx.signer.has("dao")) and ctx.signer.address("fee") (when ctx.signer.has("fee")) in the excluded_accounts list pinned by pinned_rules().

Thread

Joseph Denneteam2026-11-08 20:17 UTCdesk

Thanks for the report. We have read it against the DAO harness code and confirmed the behaviour you describe in how agent seats and protocol accounts are treated in open votes; it is being handled. We will update you here when there is more to say.