dao: proposal fee accepted on an unfinalized send; a rollback frees the author to respend it (Medium)
Report
Summary
The DAO proposal endpoint verifies the fee by reading the fee block from the node API and checking type, asset, destination, source and amount, but never reads the block's finalized flag. A send that is visible but not final satisfies the check. An author can open a proposal backed by a send that later loses a conflict and is rolled back; the fee account never receives, and the proposal stays open for the full window.
Affected component
dao/services/portal.py, _verify_fee at lines 43 to 69 (no finalized check) and submit from line 72; the node already exposes Finalized on GET /blocks/{hash} (api/handler.go lines 515 to 527 at the xe pin), at dao commit c60cf81522e3eb9e258b353e77164a3f7634cd98. ## Scope note The dao service is the governance backend named in the program's "state chain and multisig governance" scope row; flagging that the dao repository itself is not separately named on the bounty page.
Impact
One open proposal per fee-free author per window (default window is multi-week). The DAO never receives the 10 XE fee for a proposal that stays open and votable. No treasury theft: the fee account simply never receives, and the proposal eventually closes unpaid.
Suggested severity: Medium (validation gap on a 10 XE advisory-portal fee). Confirmed by read-only source review with an in-process harness.
PoC
PoC
Script (clone the dao repository as a sibling checkout directory and adjust the path line inside the script if your layout differs):
#!/usr/bin/env python3
"""F21: DAO _verify_fee accepts a send and never reads the finalized flag."""
from __future__ import annotations
import asyncio
import os
import sys
from types import SimpleNamespace
sys.path.insert(0, os.path.join(os.path.dirname(__file__), "..", "ws", "dao"))
from dao.services.portal import _verify_fee # noqa: E402
class FakeResult:
def first(self):
return None
class FakeDB:
async def execute(self, stmt):
return FakeResult()
class FakeChain:
def __init__(self, block: dict):
self._block = block
async def block(self, fee_block_hash: str) -> dict:
return self._block
async def run() -> int:
fee_acct = "ff" * 32
author = "aa" * 32
fee_hash = "bb" * 32
unfinalized = {
"hash": fee_hash,
"type": "send",
"asset": "XE",
"destination": fee_acct,
"account": author,
"amount": 10_000_000,
"finalized": False,
"previous": "cc" * 32,
}
ctx = SimpleNamespace(
signer=SimpleNamespace(has=lambda k: False),
config=SimpleNamespace(accounts={"fee": fee_acct}),
chain=FakeChain(unfinalized),
)
got = await _verify_fee(ctx, FakeDB(), fee_hash, author, fee=10_000_000)
print(
f"fee_block finalized={got.get('finalized')!r} type={got.get('type')} "
f"amount={got.get('amount')} keys={sorted(got)}"
)
if got.get("finalized") is False and got.get("type") == "send":
print("PASS: F21 _verify_fee accepted an unfinalized send (finalized flag ignored)")
return 0
print("FAIL: F21 expected _verify_fee to return the unfinalized send")
return 0
if __name__ == "__main__":
raise SystemExit(asyncio.run(run()))
Run (run 1 of 5 consecutive runs, 5/5 PASS, exit 0):
fee_block finalized=False type=send amount=10000000 keys=['account', 'amount', 'asset', 'destination', 'finalized', 'hash', 'previous', 'type']
PASS: F21 _verify_fee accepted an unfinalized send (finalized flag ignored)
Fix suggestion
Require Finalized is true (or a receive block on the fee account) in _verify_fee before accepting the proposal.
Thread
Thanks, confirmed. _verify_fee does not read the block's finalized flag, and we found the settlement side has the same gap: a fee row that was never received into the fee account is still refunded or burned at close. Both are being fixed together: a finalized check at submission and a receive check before any refund or burn. We will post the commit on this issue when it lands.
Fix is on main: https://github.com/xeprotocol/dao/commit/fd2b0d5f0ed1a3dbf0a11a9b33ce3cb7a1741c8d. Deploying to dao.test.network next; this issue will be updated once it is live.
This fix is now live on dao.test.network.