-
Notifications
You must be signed in to change notification settings - Fork 53
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Delegated PoS #55
Comments
For reasons other than Serai, I had to write a DPoS pallet. During that, the following designs were produced. Validator SortingThe trie underlying Substrate offers lexicographic iteration over its keys. We We want to iterate from highest balance to lowest balance, so we encode the This does open up attacks where a malicious user can stake amounts sharing To work around this, we only insert members who pass some minimum amount The alternative would've been heavily inefficient in-memory sorts or a bucketing RewardsIn order to issue rewards, a mapping from an awarded validator to their The solution is to allocate a storage key for the 'ValidatorToDelegators' map, Then, rewards can accumulate over the session. After the session, they'd be This prevents both possible DoS vectors present with delegators. This is possible via Substrate's provided DPoS pallet uses O(n) algorithms with limits which make it fine, yet AFAICT, this is how it'd be done scalable. Upon further discussion, a versioned algorithm was proposed similar to how OpenZeppelin contracts handle historical token balances. This would be a map of From my initial review and understanding of this, it's impossible to prune historical entries (or at least difficult) as you can't know how many sessions a historical entry was live for. There may be ways for each delegator to have a vector with relevant metadata, which could be binary searched in logarithmic time though. Reading the vector would be O(n) to the amount of sessions updates occurred in AND would set a maximum amount of updates (due to the requirements of using a BoundedVec). This mechanism would avoid needing a merkle proof though, and by doing so, reduce the size of claim transactions (at the cost of state size). |
Delegation will potentially increase centralization while also allowing anyone to bond Serai, not just people with large amounts of it. This will maintain the ability to repay holders after theft (if a validator set is compromised), yet does also increase the odds of theft as validator sets are no longer paying for the bond they use to enable their theft.
So:
- fund security
+ scalability
+ potential centralization
+ staking participation
while maintaining economic security, as viewed by the statement we can reimburse users.
The issue with the reimbursement comment is that if we have a single validator set which commits theft of all funds, Serai is worthless. Sure, we have their bonds they paid for... they won't pay for it again with the assets they stole. We can only buy back assets so long as Serai as a whole still has backing, such as under a scheme with multiple validator sets, which will happen post-launch.
Beyond the multiple validator set discussion about the feasibility of re-acquiring assets, the question becomes is the reduction in security acceptable for the benefits we'd gain. Others considerations would be reducing the bond ratio, which would decrease fund security and no longer guarantee economic security (unless we blame everyone in the group, which may be required since we'd be unable to determine who actually did it). It would enforce the costs come from the actual validators who performed the theft though, while not changing centralization, yet would potentially be less scalable.
#53 has the following document regarding delegation.
The commentary on delegation will be reviewed, as it was already left to post-launch, and there's obviously still aspects to discuss here. The API itself remains sane though, as a manager address may have multiple validators, and accordingly the separation of addresses/messages remains sane. It's just the heavy leaning towards DPoS in the future which will be removed, as this is discussed.
We can also just leave this until after launch. It's highly dependent on the security we achieve, how limiting bond is to pool liquidity, and if we do set up multiple validator sets.
The text was updated successfully, but these errors were encountered: