dao/config.py & dao/services/portal.py: Config.excluded_accounts() Forces Agent Seat Voting Weight to Zero and Omits Signer-Backed dao/fee Accounts
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
dao/config.py, lines 175-200 (Config.excluded_accountsandConfig.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", ""),
}
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"])
config/schedule_b.yaml, lines 52-62, andconfig/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
-
All designated agent seats receive zero voting weight (
weight = 0):- In
config/schedule_b.yaml,participating_wallet.exclude_agent_accounts: truemeans agent accounts do not count toward the 20-wallet quorum (quorum_wallets: 20), whileagents.stipend_micro_xe(100 XE) andagents.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()unionsself.agent_accountsintoexcluded_accountswheneverparticipating_wallet.exclude_agent_accountsisTrue(the default in bothschedule_b.yamlanddao/config.py:181), every agent account inctx.config.agent_accountsis placed intorules["excluded_accounts"]. - When an agent seat votes in
portal.vote(),excludedisTrue, soweight = 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". Inportal.tally(),agent[v.choice] += v.weightadds0, soagent_totalis always0and agent seats can never contribute weight to any open vote. - Existing unit tests in
tests/test_dao_core.py:250bypassedportal.vote()andConfig.pinned_rules()by passing synthetic_vote(100_000_000, "for", participating=False, is_agent=True)objects directly toportal.tally().
- In
-
Signer-backed
daoandfeeescrow accounts are omitted fromexcluded_accounts:portal.fee_account(ctx)(dao/services/portal.py:35-38),inbox.dao_account(ctx)(dao/services/inbox.py:38-41), andrecords._treasury(ctx)(dao/services/records.py:140-144) resolvedaoandfeefromctx.signer.address("dao")andctx.signer.address("fee")first and fall back toctx.config.accounts.Config.excluded_accounts()only readsself.accounts.get(name)fromschedule_c.yamland never checksctx.signer. Whenschedule_c.yamlleavesaccounts.daoandaccounts.feeempty as documented, thefeeescrow account (holding active proposals' 10 XE fees) and thedaoaccount are absent frompinned_rules()["excluded_accounts"]and are reported as eligible participating voters byGET /v1/snapshot/{account}(dao/api/public.py:185-190) andportal.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
- Remove
if self.open_vote.get("participating_wallet", {}).get("exclude_agent_accounts", True): ex |= self.agent_accountsfromConfig.excluded_accounts(). Instead, checkexclude_agent_accountsonly when computingparticipatinginportal.vote()(if is_agent and (pw.get("exclude_agent_accounts", True) or not rules.get("agents", {}).get("count_toward_quorum", False)): reasons.append(...)) and inGET /v1/snapshot/{account}, soexcluded_accountsapplies only to non-voting protocol/treasury accounts. - Include
ctx.signer.address("dao")(whenctx.signer.has("dao")) andctx.signer.address("fee")(whenctx.signer.has("fee")) in theexcluded_accountslist pinned bypinned_rules().
Thread
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.