Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.Sign up
[Bug Bounty: 50 ETH] Sortition Sum Tree #115
Sortition Sum Tree Bounties
This bug bounty is posted on solidified.
Sortition Sum Tree
In Kleros liquid, instead of using segments, we would use a sortition sum tree. This would allow depositing and taking back PNK in almost real time.
The root tells us that we should draw r in [0,50[.
Now, if we draw r=27.
We can find out which node is drawn in logarithmic time (assuming the tree is balanced).
In order to save on write operations, we can use a K-ary tree (tree where nodes can have up to
Keeping the tree pseudo-balanced
To keep it pseudo-balanced when nodes are added, instead of saving the amount of descendants of each node (which would take additional space), we can:
Note that this does not assure the tree to be perfectly balanced (we could remove a node and its parent making the tree unbalanced). But it does assure that we only add a level to the tree if the current ones are all full.
To avoid having to include in each node a reference to the parent and child nodes, we use a array as an implicit data structure.
Smart Contract guidelines
We use those guidelines to write smart contracts. In particular, we do not try to prevent stupid behaviors at the contract level but leave this task to the UI. Letting the possibility to a user to harm itself is not a vulnerability (but should of course be dealt at the UI level).
Violation of guidelines are not vulnerabilities but can be reported as "suggestion for tips".
My review https://docs.google.com/document/d/1WHxFRo-91iDoDnfBptr6QFL8D69jUvbrcVm6ARm52j0/edit?usp=sharing