I think the most important metric for ranking public goods is amount of funding received via QF. Ideally this data should come from clrfund itself, so we need to implement our own ranking mechanism (which will work independently from curation mechanism such as Kleros TCR).
The very basic version of ranking mechanism was implemented in SimpleRecipientRegistry
contract and is currently used in production. It divides projects into two categories: valid and invalid (removed). When the total number of projects in the registry reaches the limit and the owner adds a new project, the smart contract replaces one of invalid projects by reassigning its index to a new valid project.
We can use this logic to create a ranking mechanism that uses the amount of funds received during the last N
rounds as an input.
- New project replaces old project that didn’t collect any funds during the last
N
rounds. It’s easier to implement but at some point all non-receivers will be removed and it will be impossible to add new project.
- New project replaces old project that received the smallest amount of funds during the last
N
rounds according to on-chain data. Such mechanism can work indefinitely, but it requires on-chain sorting which is hard to do and gas-intensive. I think it requires some advanced data structure like binary search tree. Example of solidity library: https://github.com/saurfang/solidity-treemap.
- New project replaces old project that received the smallest amount of funds during the last
N
rounds according to the oracle. In this case the sorting is done offchain and to replace the least popular project someone needs to submit a replacement request (usually it is someone who wants to add a new project). The replacement request can be disputed in decentralized court and if jurors rule in favor of the requester, the project gets replaced.
I think option 3 is the best but it’s probably not necessary today. If we increase the vote option tree depth in MACI by 1 it will allow 625 recipients which should be enough for the foreseeable future. For now we can use a simpler ranking mechanism that relies only on validity (similar to SimpleRecipientRegistry
, but integrated with Kleros TCR).