classic-terra / core

GO implementation of the Terra Classic Protocol
Other
69 stars 48 forks source link

Research Possibility of tiered minimum commission on validator to ensure decentralization #89

Closed nghuyenthevinh2000 closed 1 year ago

nghuyenthevinh2000 commented 1 year ago

Allnode case has left me with much thoughts about a possible governance attack.

Especially after reading this: https://decrypt.co/38050/steem-steemit-tron-justin-sun-cryptocurrency-war. Same fate can happen to Terra Classic if Justin Sun decides to incorporate Terra community into his own empire.

Vitalik has some great thoughts on this matter: https://vitalik.ca/general/2021/08/16/voting3.html

A quick solution would be to implement a logic that enforces minimum commission on top validator to discourage people from delegating into them and encourage people into delegating into lower ranked validator.

top 10: min 20% commission top 50 - 10: min 10% commission 100 - 50: min 5% commission Outside of active set: no enforcement

Implementation

  1. An ante handler that check EditValidator msg for commission. It will fetch Validator Set to determine position of validator that sends Msg, and check if editted commission is allowed
  2. An ABCI logic BeginBlock() in custom staking that checks for violation in commission and auto - update commision to reflect validator position.

Thoughts? @ZaradarBH @inon-man @edk208 @StrathCole @fragwuerdig

fragwuerdig commented 1 year ago

There is a ongoing discussion about this between Rexyz from TCV and LLL69. Let me poke them and point them to this discussion.

fragwuerdig commented 1 year ago

The main concern I have with a tiered min. commission, is that due to the noise in delegations the validators that are close to the tiers are going to see heavy flipping with their min. commission rate.

So I discussed with TCV and LLL an option, where we would tie the min. commission rate to a function of the voting power. That curve could be a high power polynom that essentially runs flat for small voting powers and goes steep for higher voting powers:

MINCOMMISSION(VP) = PARAM * VP^12

The PARAM could be subject to governance to tweak/scale the curve in the y-direction. PARAM=200_000_000 would cause Allnodes to have around 11% commission.

image

I don't know exactly what a curve implies regarding determinism of floating point operations. Maybe @nghuyenthevinh2000 or @inon-man can elaborate more on that question?

nghuyenthevinh2000 commented 1 year ago

So I discussed with TCV and LLL an option, where we would tie the min. commission rate to a function of the voting power. That curve could be a high power polynom that essentially runs flat for small voting powers and goes steep for higher voting powers:

MINCOMMISSION(VP) = PARAM * VP^12

I see your point, that would make a lot of sense to have a curve so as not to shock validator

LunaticLunaLover69 commented 1 year ago

Hello @nghuyenthevinh2000 and the others, thanks for opening this issue. In general I like the idea of enforcing a minimum commission with higher VP, it would encourage people but not force them to redelegate, also wouldn't enforce a VP-Cap, instead gently introduce a natural cap due to delegators natural desire to get the most rewards for their delegations.

I would agree with the min commission tiers which you proposed: 0%, 5%, 10%, 20%. I would however (and if technically possible) not enforce the min-commission based on the relative position of each validator in the set, instead enforce it based on the absolute VP of a validator.

My thought process is as following: Assume a fairly even balanced set with some "spikes" in the top ranks (1: 8%, 2: 8%, 3: 2%, 4: 2% etc. ). In this set the 3rd and 4th validator would have to quote a 20% commission, which doesn't seem right to me, since it takes their competitive advantage. This becomes even worse the more balanced the set becomes.

I would therefore propose tiers similar to this where VP is the absolute VP percentage regardless of position in the set:

Also @fragwuerdig mentioned that tiers might be an issue, so maybe something like this could be implemented as a curve. My main point is, I wouldn't make it dependent on the relative position in the set rather than the absolute VP %.

fragwuerdig commented 1 year ago

@LunaticLunaLover69: please correct me. I am trying to rephrase what you said to get a better understanding. You are proposing: "Validators that accumulate top 10% voting power get 20% min. commission". Or do you rather mean "Top 10 validators by voting power get 20% min commission"?

LunaticLunaLover69 commented 1 year ago

@fragwuerdig Basically what I am saying is the min-commission enforcement should be only based on the absolute VP they have, not based on their relative position in the set

Having more than 10% voting power would in my example enforce a 20% min commission. If the validator coming next in the set only has 2% VP, it would (imo) be not justified to enforce the same 20% min commission on him (which would happen if you enforce the min commission based on the position of Validators in the set aka enforcing it on the top 10 e.g.)

fragwuerdig commented 1 year ago

@LunaticLunaLover69: But the curve I presented earlier is based on the absolute voting power. Not on the relative position in the set. However, I think we would be able to fit a curve into the tiers you presented, so that we have a smooth distribution.

Also, if I look into a graphical representation of your tiers and I draw a smooth curve trough it, then I see a fundamental imbalance: With your tiers the smaller validators by VP have a steeper slope into a higher min. commission. Which basically means: "smaller validators compete by commission" and "bigger validators compete by service quality". But I would actually like to see it vice versa.

LunaticLunaLover69 commented 1 year ago

@fragwuerdig my comment on the absolute VP was in regards to the initial post of @nghuyenthevinh2000 ( he mentioned the "top 100, top 10" etc. )

If the curve is based on the absolute VP and allows small validators to run with a vey low or even zero commission, I am fine with any solution.

"smaller validators compete by commission" and "bigger validators compete by service quality"

That was the idea behind the tiers: I think it's fair to let smaller validators compete by commission and not interfere too much as long as they don't outgrow the healthy (as in healthy for a balanced set) VP range.

edk208 commented 1 year ago

Can we move the adjustment to trigger at the end of the epoch? I don't think it is worth the computation to do every block.

StrathCole commented 1 year ago

I see an upcoming conflict with the unchangeable "maximum commission" setting of the validators. Which would either have to be also adjusted or the minimum / actual commission might be higher than the configured maximum for a validator.

nghuyenthevinh2000 commented 1 year ago

I see an upcoming conflict with the unchangeable "maximum commission" setting of the validators. Which would either have to be also adjusted or the minimum / actual commission might be higher than the configured maximum for a validator.

I will take maximum commission into account and recaculate minimum commission

StrathCole commented 1 year ago

I see an upcoming conflict with the unchangeable "maximum commission" setting of the validators. Which would either have to be also adjusted or the minimum / actual commission might be higher than the configured maximum for a validator.

I will take maximum commission into account and recaculate minimum commission

So what if a validator has set maximum commission to 1% (some have). And they get to 5% VP?

By the way, the dynamic min commission idea is not really a new one: https://twitter.com/Sephiroth/status/1571281321363902464?s=20 But it didn't get approved by many validators until now.

OhhBilboBaggins commented 1 year ago

Also, if I look into a graphical representation of your tiers and I draw a smooth curve trough it, then I see a fundamental imbalance: With your tiers the smaller validators by VP have a steeper slope into a higher min. commission. Which basically means: "smaller validators compete by commission" and "bigger validators compete by service quality". But I would actually like to see it vice versa.

Have you considered just tying minimum commission to current voting power one to one? You potentially could do the computations in tandem with the voting power and not need to wait till the end of the epoch for commissions to be updated (a behaviour that could confuse validators that don't understand how the system works when they see their minimum commission from one day to the next)

So what if a validator has set maximum commission to 1% (some have). And they get to 5% VP?

This will be an issue yes, and scenarios such as below will have to be considered as well:

StrathCole commented 1 year ago

I agree. The enforced minimum commission might be a good way of incentive people to redelegate, but it comes with quite huge challenges to solve. That's why I am also not really keen on seeing those pass on governance right now before there are actual solutions (there is a prop with a fixed min commission in deposit stage).

I think we could even think of more "special" situations like the two you mentioned, @OhhBilboBaggins (e.g. what happens with commission that was "forced higher" when the VP gets lower again?).

LuncBurner commented 1 year ago

I have updated the title for this item to 'Research Possibility of' rather than implementation, as this item will be required to go to governance in any case (and I don't want people that are reviewing our Github repo to think we are implementing this as of yet). As illustrated by the discussion above, there will be many possible approaches to how this issue could be addressed. I suspect that doing some options analysis similar to what we did for the cosmwasm upgrade may be necessary.

OhhBilboBaggins commented 1 year ago

I agree. The enforced minimum commission might be a good way of incentive people to redelegate, but it comes with quite huge challenges to solve. That's why I am also not really keen on seeing those pass on governance right now before there are actual solutions (there is a prop with a fixed min commission in deposit stage).

I was involved in that prop, but I acknowledge your point. On the bright side there's only 3 validators that have < 5% commission in the active set right now, but it's still a problem all the same and doesn't account for validators outside of the active set.

I think we could even think of more "special" situations like the two you mentioned, @OhhBilboBaggins (e.g. what happens with commission that was "forced higher" when the VP gets lower again?).

You're right. Ultimately the question we're probably really trying to answer here (at least from my perspective) is "If we're going to potentially introduce mechanisms that force validators to change their commissions via the use of changing minimum commission, what's stopping us from just having validator commissions be a direct function of voting power and providing validators opportunities to make other sources of revenue via different means that help the chain?"

This type of question introduces a new line of thinking around ways to provide more sustainability around validator hosting of FCD / LCD / RPC / GRPC infrastructure that may be worth exploring, as well as relays. We all know there's currently a cost for validators to host those services, and right now those costs are creating barriers for smaller validators to take some of that chain infrastructural load off of bigger validators that can afford those costs, so if we can expand on that model to make that cost centre also a larger means of profit for a validator to do (thus moving it away from chain based altruism), maybe we'll start to see more validators get incentivized to host FCD / LCD / RPC / GRPC / relays and start differentiating on those vectors instead of just commission (which at the end of the day is just fiddling with a number and really doesn't bring much value to the chain in comparison to the other considerations that I've just highlighted)

nghuyenthevinh2000 commented 1 year ago

I think we could even think of more "special" situations like the two you mentioned, @OhhBilboBaggins (e.g. what happens with commission that was "forced higher" when the VP gets lower again?).

I intend to include a logic to check for validator set position at the end of each epochs to adjust commission

StrathCole commented 1 year ago

I intend to include a logic to check for validator set position at the end of each epochs to adjust commission

Personally I don't think it makes sense. As others mentioned the position in the set is not really something that is suited to determine commissions, imho.

OhhBilboBaggins commented 1 year ago

I don't think it makes sense to check the validator set position at the end of each epochs and adjust commission either. There's a lot of validators that are all but guaranteed to be confused by this behaviour. Some of them may not even know what an epoch is. After taking the time to think about it I'm not a fan of using minimum commission as the knob that we're fiddling with for this because of the edges it has that StrathCole and I identified (and we're sure there's more). If we're going to create a rising floor on minimum commission and limit validator choice on what their commission is, we may as well go all in and just have commission be a direct function of voting power. No epochs required in that case.

StrathCole commented 1 year ago

we may as well go all in and just have commission be a direct function of voting power

I would not say this is a good idea unless this would be an additional commission. I think that if a minimum commission based on VP is introduced, there should always be the possibility to take more commission for several reasons. Including using it for project support etc.

So an idea to solve this would be to take the current "commission" setting as something like "added commission" that is simply added to the VP-based (by function) commission and is by default "0".

Example: Function e.g. is commission = VP, the most simple case. If a validator sets "premium commission" (or however it's named) to 2%, then with a VP of 4% he would have 6% commission.

Rexyz123 commented 1 year ago

Interesting discussion and thank you to everyone that has contributed.

I see that we have a number of very important factors at play here which manifest themselves into the following risks: a) Ineffective Decentralization - the risks associated with to much power under one authority including control of validator keys. b) Insufficient Validation - The risks of validators not able to operate sustainably, i.e. finance, competence c) Unstaking - The risks of delegators not finding it profitable to stake and therefore unstaking. d) Ineffective Governance - Too much perceived voting power under too few validators.

Clearly all these have the potential to be extremely significant risks and moreover, when the risks of b & c are considered these are also massive risk factors that affect the risk magnitude of a & d. In simple speak, if people unstake because it is not worth staking, and validators cannot earn enough to make validating sustainable then decentralization and governance is of little importance. A highly decentralised well governed dead blockchain is even less desirable than the current status quo.

I open with this because when managing risks very rarely does risk treatment act independently of secondary and tertiary risk factors. i.e. alter one thing and you are likely to increase the risk elsewhere, often creating an even bigger problem often somewhere unexpected.

Fixing minimum commission Lets start with what it WILL NOT DO. A minimum commission regime will not stop validators from offering a zero fee staking solution. It is super easy to offer cash back on a validator that has an imposed minimum commission in effect reducing the fixed rate to zero. Also it is likely that only the more informed validators would know how to do this, and therefore those who a low rate is aimed at benefitting the most may be the worst affected with higher more experienced validators securing even more power. Game theory suggests that delegators will always move to the zero fee once the costs of not doing so becomes intolerable.

However if we are convinced that having a minimum commission or variable commission model is required we need to understand that if people feel the need to redelegate too often without there being sufficient compensation for the hassle of doing so, then i think we will see a cancer of undelegating which could ultimately kill the chain. I therefore suggest that any fees applied need to be high enough to encourage active delegators to redelegate but low enough so that the (what i suspect) is the larger percentage of delegators are not disillusioned and opt to move to other chains.

Another issue to consider is, does decentralization actually result in better decision making. How many validators simply vote with the tide to secure votes, rather than what was best for the community? I am not sure that the majority of validators actually invest the time needed to make well informed choices. Those that canvas their delegators and vote on their behalf imo are simply adding an additional vote to an existing vote. These delegators could simply vote themselves. Voting intelligently is not always a vote winner.

Fixing commission to voting power. By taking this approach we are aiming to prevent a validator from having a single validator operating at a high VP, however in practice this is simply encouraging a validator to strike up another validator under a different name. So it is false comfort. However this is at some inconvenience to the validator and only a number of validators have had multiple validators. This voting power related commission approach can reward excellent customer service with a higher commission, but also it can make them less competitive and can also favour smaller potentially less reliable and customer focused operators. Also lets remember delegators have chosen these validators, in affect we are saying we do not approve of too many people sharing the same politics, which if they are the ones that are correct, introduces massive risk.

As I understand implementing loops to identify the top 33% or 67% is not desirable in blockchain, and therefore it is difficult to implement a system with staged minimum commissions based on this. Also by selecting the top 10, 20, 30 or so on may ultimately not fully target individual high commission validators.

Sustainability If we create a situation where the larger validators that are providing services to the chain such as relays and infrastructure cannot get to sufficient size to make it financially viable to operate these community services then we introduce other risks. So I think it is unwise to overly penalize larger validators. In this instance it maybe desirable to have a base minimum commission with a voting commission parameter added on top of this. Again this does not stop validators offering cash back. But also we need to be mindful that delegator rewards need to be competitive so a change in this direction really needs a corresponding enhancement to the oracle or other method to reward stakers.

Conclusions My preferred approach would be a staged commission depending on whether you were in the top 33% or 67% and this be recalculated each epoch, with a possible minimum commission to help support smaller validators. However i do not agree with implementing control over validators and implementing rules to essentially penalize those with the best customer service, validator offerings and alignment to the community. All things considered though it appears using commission rather than a stick is the best approach unless we could achieve a voluntary code of conduct which I do not think would work. In terms of rates I think anything in excess of 10% could cause unstaking from TerraClassic if this was used widespread. I could live with a commission model similar to what Strathcole has defined which is easy to understand. We must however realize that we are simply setting a rule for the compliant to comply with. Remembering some wise words an old friend of mine regularly borrowed from Douglas Bader, 'rules are for fools and the guidance of wise men', rules simply do not work for those intent on not following them.

aeuser999 commented 1 year ago

If this has to do with distributing consensus voting power, commissions seems the wrong place to be looking (if it is going to be a coded solution). Why not look at the actual mechanism that does that (the custom tendermint layer)?:

If it should happen that minimum commission is set to lets say 5% (such as Prop 11322), what will now happen with the three validators that have a max commission lower than 5%? There is no current way for them to change this.

ZaradarBH commented 1 year ago

Dropped enhancement label as we have another issue to track the work. Also a general FYI if you need to discuss stuff GH recently introduced a discussion feature @ https://github.com/classic-terra/core/discussions which is more like the forums we are used to from other places :)