Convex-Dev / convex

Convex Main Repository - Decentralised platform for the Internet of Value
https://convex.world
Other
91 stars 27 forks source link

Convex Generic DAO #434

Open mikera opened 1 year ago

mikera commented 1 year ago

Convex provides highly dynamic capabilities for DAOs. In particular, the on-chain compiler makes it possible for proposals to be compiled at executed by the DAO itself!

Key functions:

Design comments;

A DAO with maximum flexibility could use eval or eval-as for the execute function. More constrained DAOs may have more limited capabilities.

helins commented 1 year ago

What was the incentive for having both accept and reject Vs a unique finalize function?

mikera commented 1 year ago

I guess separate accept and reject are more explicit about what you expect the result to be. A finalise transaction could (in theory) be vulnerable to a front running attack that changed the result, so the caller might end up accepting a proposal that they intended to reject. Which might be a big risk if security depends on only certain people having accept/reject privileges.

helins commented 1 year ago

I'm not sure I can picture the front running concerns 🤔

In my current design, there is a result function which stops the voting process of a proposal if the voting library associated with that proposal can produce results given its voting state. Voting results mean that voting is done (otherwise, one couldn't produce definitive results). At this point, things have been set in stone by the voting process and that's it. Which obviously makes sense, what's the point of a voting process if someone can somehow change outcomes after voting.

If a proposal has voting results attached, anyone can finalize (hence execute) it. Even someone external to the DAO. Things have been decided, cannot be changed, so I don't see a point in restricting execution at this step.

result and finalize are separate for clarity but in theory they could very well be bundled in a single function.

helins commented 1 year ago

Ah yes, maybe it isn't clear: rejection is part of the voting choices. The propose function must enforce this depending on what execute considers to be a rejection (e.g. nil choice if execute does eval).