Skip to content

Initial draft of stake delegation without fees and penalties.#38

Closed
nikita-fuchs wants to merge 1 commit into
aeternity:staking_proposalfrom
nikita-fuchs:delegated_staking_proposal
Closed

Initial draft of stake delegation without fees and penalties.#38
nikita-fuchs wants to merge 1 commit into
aeternity:staking_proposalfrom
nikita-fuchs:delegated_staking_proposal

Conversation

@nikita-fuchs

@nikita-fuchs nikita-fuchs commented Nov 22, 2024

Copy link
Copy Markdown

This PR has been superseded by [PR #39 ]

@nikita-fuchs

Copy link
Copy Markdown
Author

@happi would you please assign yourself, piwo and hans as reviewers? I don't have the rights. thanks.

@nikita-fuchs nikita-fuchs changed the title Initial draft of staking without fees and penalties. Initial draft of stake delegation without fees and penalties. Nov 25, 2024
@happi happi requested review from hanssv, happi and thepiwo November 25, 2024 13:19
@happi happi deleted the branch aeternity:staking_proposal November 25, 2024 17:39
@happi happi closed this Nov 25, 2024
Comment thread delegated-staking.md
The above delegation logic assumes the following requirements to the `main staking logic` to be met:

1. On any adjustment of a staker's amount, who registered as a `delegatee`, `update_delegatees_stake()` is called to keep the delegation logic's book-keeping in sync with the amount of funds staked by stakers in the `main staking logic`. By checking if the Caller is a `delegatee`, all delegatee's calls to adjust their stake shall be forwarded *to the delegation logic* (as for example the direct withdrawal from the staker's total stake in the `main staking logic` would withdraw also the funds *delegated* to him). The delegation logic has means of adjusting the staked amount in the `main staking logic` in accordance to the changes in its book keeping, according stubs are included in the current code.
3. It is assumed there is some function in the `main staking logic` that is called by the block producer every time he produces a block. (Current information: There is supposedly a function called `step()` to which this applies).

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We will not do this on a block-by-block basis...

Comment thread delegated-staking.md

1. On any adjustment of a staker's amount, who registered as a `delegatee`, `update_delegatees_stake()` is called to keep the delegation logic's book-keeping in sync with the amount of funds staked by stakers in the `main staking logic`. By checking if the Caller is a `delegatee`, all delegatee's calls to adjust their stake shall be forwarded *to the delegation logic* (as for example the direct withdrawal from the staker's total stake in the `main staking logic` would withdraw also the funds *delegated* to him). The delegation logic has means of adjusting the staked amount in the `main staking logic` in accordance to the changes in its book keeping, according stubs are included in the current code.
3. It is assumed there is some function in the `main staking logic` that is called by the block producer every time he produces a block. (Current information: There is supposedly a function called `step()` to which this applies).
4. It is assumed that rewards for blocks produced by stakers that registered as `delegatee`s remain in the contract of the `main staking logic`, from which the eligible parties can withdraw them utilizing the delegation logic's `withdraw_rewards()`.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is one way a delegatee/validator might organize his/her "pool" other variants are feasible too, right?

Comment thread delegated-staking.md
1. On any adjustment of a staker's amount, who registered as a `delegatee`, `update_delegatees_stake()` is called to keep the delegation logic's book-keeping in sync with the amount of funds staked by stakers in the `main staking logic`. By checking if the Caller is a `delegatee`, all delegatee's calls to adjust their stake shall be forwarded *to the delegation logic* (as for example the direct withdrawal from the staker's total stake in the `main staking logic` would withdraw also the funds *delegated* to him). The delegation logic has means of adjusting the staked amount in the `main staking logic` in accordance to the changes in its book keeping, according stubs are included in the current code.
3. It is assumed there is some function in the `main staking logic` that is called by the block producer every time he produces a block. (Current information: There is supposedly a function called `step()` to which this applies).
4. It is assumed that rewards for blocks produced by stakers that registered as `delegatee`s remain in the contract of the `main staking logic`, from which the eligible parties can withdraw them utilizing the delegation logic's `withdraw_rewards()`.
5. Every time a block was produced, the `split_reward()` function is to be called (presumably in the function referenced in 3.) . This is safe, because `split_reward()` immediately returns, if the caller is not a registered `delegatee`. It is assumed, that in this call, the earned block reward is `Call.value`. If that is not the case, the delegation logic can easily be adjusted to reference this value from somewhere else which is accessible to the contract.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At the end of an epoch - and with some (1 epoch?) delay - rewards are distributed. The StakingValidator interface allows a callback to be registered; this function will be called with information of rewards during the given epoch.

Comment thread delegated-staking.md
### **Contextual constraints**
The above delegation logic assumes the following requirements to the `main staking logic` to be met:

1. On any adjustment of a staker's amount, who registered as a `delegatee`, `update_delegatees_stake()` is called to keep the delegation logic's book-keeping in sync with the amount of funds staked by stakers in the `main staking logic`. By checking if the Caller is a `delegatee`, all delegatee's calls to adjust their stake shall be forwarded *to the delegation logic* (as for example the direct withdrawal from the staker's total stake in the `main staking logic` would withdraw also the funds *delegated* to him). The delegation logic has means of adjusting the staked amount in the `main staking logic` in accordance to the changes in its book keeping, according stubs are included in the current code.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not settled, but we are leaning towards the main staking contract not knowing if the logic behind a StakingValidator is a single entity or a delegatee backed by several delegates.

@happi

happi commented Nov 25, 2024

Copy link
Copy Markdown
Contributor

Hmm. Not sure how it got closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants