Skip to content
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

function to increase delegator stake? #6

Open
MKong opened this issue Dec 20, 2019 · 6 comments
Open

function to increase delegator stake? #6

MKong opened this issue Dec 20, 2019 · 6 comments
Labels
enhancement New feature or request

Comments

@MKong
Copy link
Member

MKong commented Dec 20, 2019

Is there a function to increase delegator stake?

@MKong MKong assigned ghost Dec 20, 2019
@ghost
Copy link

ghost commented Dec 20, 2019

No, unfortunately this method cannot be added without increasing complexity. Simply said, contract won't know which delegation amount should be used (while calculation rewards for an epoch) if it's changeable. It's possible to add it, but contract will become more complex. On another hand, user may simply create a new delegation, because minimum delegation is only 1 FTM

@ghost
Copy link

ghost commented Jan 27, 2020

@devintegral3 but isn't it the same with the increaseStake() functions for validators? why can a validator increase its stake but delegators can not? this should affect the reward calculation in the same way in my opinion.

@ghost
Copy link

ghost commented Jan 28, 2020

It would be great to see following functions getting added:

  • increase delegation
  • partially withdraw delegation
  • partially withdraw stake

@ghost
Copy link

ghost commented Feb 10, 2020

but isn't it the same with the increaseStake() functions for validators? why can a validator increase its stake but delegators can not? this should affect the reward calculation in the same way in my opinion.

Because validator's stakes are being copied into each epoch snapshot. During rewards calculation, contract doesn't use current validator's stake, but the one which is written into epoch snapshot for a specified epoch. It's needed to allow delegators to claim their rewards even if validator has withdrawn (also it allows to implement increaseStake).

It would be great to see following functions getting added:

  • increase delegation
  • partially withdraw delegation
  • partially withdraw stake

Thank you for your feedback. Those features can be added, with the following limitations:

increaseDelegation can be implemented if this call will require to claim all the previous rewards before calling this function. This way, we can avoid storing a history of delegation changes.

It'll require a hardfork because we'll have to add support of new log types into go-lachesis node (support of UpdatedDelegation and UpdatedStake was added in Fantom-foundation/go-lachesis#414 ). All the stakes must be tracked by go-lachesis node using the special-purpose contract logs. Instead of adding support for a specific log like IncreasedDelegation, we add the general-purpose log which could be used for other features as well. We can emit IncreasedDelegation as well for clarity, but only UpdatedDelegation/UpdatedStake will be tracked by go-lachesis node.

Using the same new types of logs, support of partial withdrawal can be added as well.

@ghost
Copy link

ghost commented Feb 10, 2020

Because validator's stakes are being copied into each epoch snapshot. During rewards calculation, contract doesn't use current validator's stake, but the one which is written into epoch snapshot for a specified epoch. It's needed to allow delegators to claim their rewards even if validator has withdrawn (also it allows to implement increaseStake).

ok, makes sense.

increaseDelegation can be implemented if this call will require to claim all the previous rewards before calling this function. This way, we can avoid storing a history of delegation changes.

Can you make that work in combination with the reward lock? I think this implementation would be fine, but people should not lose their rewards in case they update their delegation. If they withdraw, then they should, but not if they increase their delegation or also re-delegate to another validator.

... we add the general-purpose log which could be used for other features as well.

sounds good 👌

@ghost
Copy link

ghost commented Feb 11, 2020

Can you make that work in combination with the reward lock? I think this implementation would be fine, but people should not lose their rewards in case they update their delegation. If they withdraw, then they should, but not if they increase their delegation or also re-delegate to another validator.

Certainly delegators shouldn't lose their rewards during increasing delegation.

But it has to be discussed how exactly we change rewards burning logic - #17

@ghost ghost added the enhancement New feature or request label Feb 12, 2020
This was referenced Feb 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant