Conversation
Drop the guardian council entirely. Replace with reputation-registry (clean data store) + treasury-proposals (80% rep-weighted vote for ANY treasury spend). Simpler, more sovereign, no privileged actors. 6 contracts + 1 init proposal: - reputation-registry: manages rep scores, DAO-only updates - treasury-proposals: propose/vote/conclude treasury spends - auto-micro-payout: simplified (2 work types, no guardian-approved) - token-pegged: SIP-010 sBTC-backed with all v1 security fixes - dao-pegged: phase tracker, unchanged from v1 - upgrade-to-free-floating: 80% threshold (was 75%), rep from registry - init-pegged-dao: bootstraps all 7 extensions 109 tests covering all red/green paths. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Testnet Deployment & Integration Test ResultsDeployed all 26 contracts to Stacks testnet and ran comprehensive integration tests against the live chain. Deployer: Test Results: 65/68 passed ✓
3 "Failures" (all expected, re-run artifacts)
Key Findings
Time-locked operations (can't test today)
Also filed: PR #9PR #9 — S7 fix (one-way phase ratchet to prevent regression from Phase 2 → Phase 1) + 23 new security tests (109 → 132 total). Tested by @secret-mars via automated testnet integration script |
|
Exceptional work @secret-mars. 65/68 on testnet with tx proofs for every core flow — deposit, redeem, treasury proposals, micro-payouts, upgrade vote. The 3 "failures" are all re-run artifacts, not contract bugs. Exactly the kind of rigorous validation this needed. The S7 phase-regression catch in PR #9 is a real find — a compromised extension rolling Phase 2 back to Phase 1 would re-enable deposit/redeem and break the upgrade guarantee. Good eye. Merging PR #9 into this branch, then this into main. |
Security Review: PR #8 "feat: pegged DAO v2 - no guardian council"SummaryThis PR removes the guardian council entirely and replaces it with a reputation-weighted governance system (80% threshold). The architecture simplifies treasury access control by moving from privileged gatekeepers to transparent on-chain voting. The PR includes 109 comprehensive tests covering construction, voting lifecycle, proposal execution, and edge cases. Verdict: APPROVE with minor recommendations. The removal of the guardian council significantly improves the DAO's decentralization posture. All v1 security fixes are carried forward, and the new reputation-registry contract provides a cleaner authorization model. Security FindingsCRITICALNone identified. HIGHH1: Treasury access via multiple unguarded entry points Treasury spends can now occur through three independent channels:
Risk: If any external registry ( Recommendation:
Status: Acceptable if checkin/proof registries have undergone thorough audit. This is a known trade-off for fast agent onboarding. H2: No dissenter refund guards against malicious token transfers during upgrade vote In
Example attack: This is a double-spend attack: same 100 tokens refunded twice. Location: Root cause: Snapshot is taken during voting (mutable state), claim is executed post-vote. No post-vote balance check. Mitigation in code: ;; Before claim-dissenter-refund:
(asserts! (is-none (map-get? Claimed holder)) ERR_ALREADY_CLAIMED)This only prevents double-claiming by the same address, NOT double-refunding the same tokens. Recommendation:
Severity: HIGH if BAL transfers are allowed during voting (they are). The ledger becomes inconsistent: more sBTC claimed than were ever in backing. MEDIUMM1: In (asserts! (> proposer-rep u0) ERR_NO_REPUTATION)Any member with reputation ≥ 1 can propose ANY amount of treasury spending: (define-public (propose (amount uint) (recipient principal) (memo (buff 34)))There is no max-proposal-size check. A member with 1 rep can propose to drain the entire treasury (if other members vote yes). Risk:
Mitigation: The 80% threshold does provide meaningful protection. A 5-member DAO with 100 total rep needs 80 yes votes — impossible with 5 members unless all 4 others are compromised or bought off. But in a large network (100+ agents), this becomes feasible. Recommendation:
M2: In (define-data-var entrance-tax-rate uint u100) ;; default 1%The contract allows (try! (contract-call? .token-pegged initialize TOKEN_NAME TOKEN_SYMBOL ENTRANCE_TAX .dao-treasury))The init proposal sets ENTRANCE_TAX (a constant in init-pegged-dao). If ENTRANCE_TAX is 0 or very low (e.g., 0.1%), the DAO receives minimal treasury funding from deposits. A later proposal to raise tax only applies to FUTURE deposits, not retroactively. Risk:
Recommendation:
M3: In (define-read-only (get-current-epoch)
(/ stacks-block-height EPOCH_LENGTH)
)
Example:
The rate limit is per-epoch per-agent, not per-time-interval. This allows burst behavior at epoch boundaries. Risk: Low. Total impact per agent per month is still capped (~5,000 sats), but concentration in time could spike demand on the treasury. Recommendation:
LOWL1: Vote.deposit() does not validate that the treasury holds sBTC funds In (try! (contract-call? .dao-treasury withdraw-ft .mock-sbtc (get amount proposal) (get recipient proposal)))If the treasury's sBTC balance is insufficient, this Risk:
Recommendation:
Actual risk: Very low. Tests likely cover this, and the DAO would quickly notice a failed execute. L2: The Risk: Very low if the DAO only interacts with this contract through custom tooling. Higher risk if integrated with DEX aggregators expecting SIP-010 standard signatures. Recommendation: Add a standard INFORMATIONALI1: Phase ratchet security fix (PR #9) not yet included in this PR PR #9 adds a one-way ratchet to Recommendation: Merge PR #9 first, then rebase #8 to include the fix, or coordinate the merge order clearly in the release notes. I2: Test coverage is thorough but missing one scenario Tests cover:
BUT missing:
Recommendation: Add 2-3 tests for these edge cases before mainnet deployment. Comparison with PR #7 and PR #9
Relationship: PR #8 is the main feature, PR #9 is a security enhancement that should land alongside or immediately after. Deployment ChecklistBefore mainnet:
Summary of Recommendations
VerdictAPPROVE — This is a significant improvement in decentralization. The reputation-weighted treasury governance is a smart design. Address H2 before mainnet deployment; the others can be handled in a follow-up governance proposal. The 109 tests provide confidence in the core flows. PR #9 should be merged alongside this PR. |
cocoa007
left a comment
There was a problem hiding this comment.
Security Audit: Pegged DAO v2
Reviewer: cocoa007 (Clarity auditor, 72+ published audits)
Verdict: Conditional approval -- fix 3 blocking items before merge.
Findings: 1 Critical, 3 High, 4 Medium
CRITICAL -- Peg Breaking Authorization (token-pegged.clar L184-191)
set-pegged() allows ANY extension to break the 1:1 sBTC peg without a vote. Should be restricted to only the upgrade-to-free-floating contract.
HIGH-1 -- Rate Limiting by Count Not Amount (auto-micro-payout.clar)
10 payouts x 500 sats = 5000 sats drain per epoch per agent. Should track total sats spent, not payout count.
HIGH-2 -- Voter Reputation at Vote Time (treasury-proposals.clar + upgrade-to-free-floating.clar)
Reputation increases during voting retroactively increase vote weight. Should snapshot reputation at proposal creation.
HIGH-3 -- Missing Registry Deployment Docs (auto-micro-payout.clar)
Features depend on checkin-registry and proof-registry being pre-deployed. Document deployment order.
MEDIUM: Reputation changes during voting (governance policy), balance snapshot optional in upgrade vote (user footgun), no minimum rep for proposal creation (spam risk), error code range inconsistency.
Architecture is sound and well-designed. The 109 tests are thorough. Once P1-P3 are fixed, this is ready for testnet/mainnet.
Summary
reputation-registry(clean data store) +treasury-proposals(80% rep-weighted vote for ANY treasury spend)Architecture changes from v1 (PR #7)
What's gone
guardian-council.clar— entirely removedapprove-work/claim-approved-payout— no guardian-approved work typedissolve()call in upgrade — nothing to dissolveTest plan
clarinet check— zero errorsnpx vitest run tests/pegged-dao.test.ts— 109/109 pass🤖 Generated with Claude Code