Repository navigation
Conversation
- crossing.gno: Fix infinite recursion in crossingDAO.Render() (was calling c.Render instead of c.dao.Render) - cond_members_threshold.gno: Division-by-zero guard when membersCount=0 - cond_role_treshold.gno: Division-by-zero guard when role count=0 - cond_role_treshold.gno: Fix RenderWithVotes format string arity mismatch (was passing 2 args for 3 format verbs, causing runtime panic)
…it, member guard daokit/proposals: - Proposal expiration: ProposalTTLBlocks (~30 days), ProposalStatusExpired - UpdateStatus now checks expiry before evaluating conditions - MaxOpenProposals = 50 spam limit (prevents unbounded proposal creation) - openCount tracking with decrementOpen on execution/expiry daokit/daokit: - Vote now checks expiry before allowing vote (expired proposals reject votes) - Execute decrements open count after successful execution basedao/members: - Minimum member guard: RemoveMember panics if only 1 member remains (prevents permanent DAO bricking by removing all members)
…governance hardening CRITICAL — Float64 → integer basis points in daocond (consensus safety): - cond_members_threshold: thresholdBps (uint64), Eval uses integer math yes*10000 >= thresholdBps*total (was float64 division + comparison) - cond_role_treshold: same pattern with uint64 casts for safety - Float64 was technically deterministic under Go spec but a latent mainnet consensus risk across VM implementations - Signal() still returns float64 (display-only, not consensus-critical) - Threshold constructor still accepts float64 0.0-1.0 for API compat, converts to bps at construction time daokit/proposals — openCount desync fix: - GetProposals/GetProposalsJSON now decrement openCount on expiry transitions - New UpdateProposalStatus store helper keeps openCount in sync - New CleanExpired() public function for batch cleanup - Vote path uses UpdateProposalStatus (auto-decrements) - Prevents DoS via MaxOpenProposals slot leakage basedao/members — O(n) → O(1) optimization: - CountMembersWithRole now uses roleData.Members.Size() directly - Previously allocated full slice just to call len()
CRITICAL fixes: H-6 — Threshold denominator snapshot (prevents minority takeover): - New Snapshottable interface in daocond - MembersThresholdCond.Snapshot() freezes membersCountFn at proposal creation - RoleThresholdCond.Snapshot() freezes usersRoleCountFn at proposal creation - AndCond and OrCond propagate Snapshot() to children - ProposalsStore.newProposal calls Snapshot() if condition supports it - Prevents attacks where members are added/removed between vote and execution to retroactively change whether a proposal passes M-10 — Execute openCount leak via handler panic: - Refactored Core.Execute to use UpdateProposalStatus (single decrement path) - Set Status = Executed BEFORE handler call (re-entrancy gate) - If handler panics, entire tx reverts including the status change (Gno atomic) - Prevents permanent slot leak on faulty action handlers R17 — Constitutional supermajority: - New Config.SupermajorityCondition (default: MembersThreshold(0.75)) - ChangeDAOImplementation now requires supermajority (was 60%) - RemoveMember now requires supermajority (was 60%) - Other actions (AddMember, AssignRole, etc.) keep InitialCondition (60%)
Replace math.Max with explicit comparison to reduce float64 surface area in daocond. Signal is display-only (Eval is the consensus path) but removing the math import keeps the package free of float operations beyond the display-only Signal returns. Addresses CTO-1 P1 finding.
|
gno's float64 is deterministic, there is no such thing as "consensus path" and "not consensus path" since everything is run in the vm consensus |
|
Fair correction, thanks — agreed:
I'll keep the bps change in The other commits stand on their own merits independently of this discussion:
Heads-up that CI is currently red here for an unrelated reason: the Makefile pins |
|
Superseded — its findings landed, by a different route. The two that mattered were harvested and shipped in #67: the Its headline finding — infinite recursion in Closing rather than merging because its own CI ran and failed, and the remaining 283 lines are unreviewed against a codebase that has since moved through the whole freeze stack. |
Summary
Consolidated security, governance, and code-hygiene work on gnodaokit primitives (
basedao,daocond,daokit), spanning four review tracks:math.MaxfromorCond.Signalto drop themathimport surface10 files, +283 / -48.
Note on framing (post @n0izn0iz review, thread)
The
float64 → bpschange ind5ab78ewas originally framed as "consensus safety across VM implementations." That framing was overstated — gno's float64 is deterministic, and there's no structural Eval/Signal split (everything in the VM is consensus when invoked from a tx; the display-only nature ofSignal()is conventional, not structural). The change is retained as code hygiene (removes themathimport; integer-onlyEvalis cleaner) rather than a consensus-safety fix. Thed5ab78ecommit message is left as-is in history; this PR description and the comment thread are the corrected record.Critical fixes
crossingDAO.Render()— was callingc.Renderinstead ofc.dao.Render(06f76e5).45f9c65): newSnapshottableinterface in daocond;MembersThresholdCond.Snapshot()andRoleThresholdCond.Snapshot()freeze counter fns at proposal creation;AndCond/OrCondpropagate;ProposalsStore.newProposalcalls Snapshot when supported. Prevents membership-shifting between vote and execution to retroactively change pass/fail.45f9c65): refactoredCore.Executeto setStatus = ExecutedBEFORE the handler call (re-entrancy gate). If the handler panics, the whole tx reverts including the status change (Gno atomicity). Prevents permanent slot leak on faulty action handlers.Governance hardening
7776384):ProposalTTLBlocks(~30 days) +ProposalStatusExpired.UpdateStatus,Vote,Executeall honour expiry. Expired proposals reject votes.7776384):openCounttracking with decrement on execute/expire.7776384):RemoveMemberpanics if only 1 member remains. Prevents permanent DAO bricking.45f9c65): newConfig.SupermajorityCondition(defaultMembersThreshold(0.75)).ChangeDAOImplementationandRemoveMembernow require supermajority (was 60%). Other actions keepInitialCondition(60%).Safety nets + code hygiene
cond_members_thresholdandcond_role_tresholdwhen count = 0 (06f76e5).cond_role_treshold.RenderWithVotes— was passing 2 args for 3 verbs, runtime panic (06f76e5).openCountdesync fix (d5ab78e):GetProposals/GetProposalsJSONdecrement on expiry transitions; newUpdateProposalStatusstore helper; new publicCleanExpired()for batch cleanup; Vote path usesUpdateProposalStatus(auto-decrements).CountMembersWithRole: O(n) → O(1) viaroleData.Members.Size()(was allocating full slice just to calllen()) (d5ab78e).cond_members_threshold+cond_role_treshold(d5ab78e):thresholdBps(uint64),yes*10000 >= thresholdBps*total(was float64 division + comparison). Constructor still accepts float64 0.0–1.0 for API compat, converts to bps at construction time. Code hygiene per @n0izn0iz — see framing note above.math.MaxfromorCond.Signal— explicit comparison instead. Drops themathimport (c599cb7).Files
gno/p/basedao/basedao.gnogno/p/basedao/members.gnogno/p/daocond/cond_and.gnogno/p/daocond/cond_members_threshold.gnogno/p/daocond/cond_or.gnogno/p/daocond/cond_role_treshold.gnogno/p/daocond/daocond.gnogno/p/daokit/crossing.gnogno/p/daokit/daokit.gnogno/p/daokit/proposals.gnoTest plan
CI note (unrelated toolchain rot)
CI is currently red on
gno-lint+gno-testfor an issue that affects ALL gnodaokit branches right now, not this one specifically. The Makefile pinsGNOVERSION=4e80c37e8d18(gno @ 2025-09-29), which can no longer unmarshal current upstream package-server responses (amino: unrecognized concrete type full name vm.InvalidPackageError). Last green run onmainwas 2025-11-12; no main commits since, so the rot wasn't noticed.A separate
chore/ci-bump-gno-toolchainPR is in flight on gnodaokit to bump the pin to96264d21d(v1.1.0 / gnoland1.1 release commit, 2026-04-01). Once that merges, this PR will be rebased to inherit green CI.Notes