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

Migrate VirtualStakers introduced in 3889 in Ledger. #4217

Open
Ank4n opened this issue Apr 19, 2024 · 1 comment
Open

Migrate VirtualStakers introduced in 3889 in Ledger. #4217

Ank4n opened this issue Apr 19, 2024 · 1 comment
Assignees
Labels
I10-unconfirmed Issue might be valid, but it's not yet known.

Comments

@Ank4n
Copy link
Contributor

Ank4n commented Apr 19, 2024

#3889 introduced a new storage key VirtualStakers whose funds are not locked by staking pallet. This can be moved to Ledger storage as a bool/enum since it is always read in conjunction with it.

We didn't initially migrate since this is a small overhead and migration would need to iterate over all Ledger items. If we in future do a ledger migration, we can batch this with it as well.

@Ank4n Ank4n added the I10-unconfirmed Issue might be valid, but it's not yet known. label Apr 19, 2024
@Ank4n Ank4n self-assigned this Apr 19, 2024
github-merge-queue bot pushed a commit that referenced this issue Apr 20, 2024
This is the first PR in preparation for
#454.

## Follow ups:
- #3904.
- #3905.

Overall changes are documented here (lot more visual 😍):
https://hackmd.io/@ak0n/454-np-governance

[Maybe followup](#4217)
with migration of storage item `VirtualStakers` as a bool or enum in
`Ledger`.

## Context
We want to achieve a way for a user (`Delegator`) to delegate their
funds to another account (`Agent`). Delegate implies the funds are
locked in delegator account itself. Agent can act on behalf of delegator
to stake directly on Staking pallet.

The delegation feature is added to Staking via another pallet
`delegated-staking` worked on
[here](#3904).

## Introduces:
### StakingUnchecked Trait
As the name implies, this trait allows unchecked (non-locked) mutation
of staking ledger. These apis are only meant to be used by other pallets
in the runtime and should not be exposed directly to user code path.
Also related: #3888.

### Virtual Bond
Allows other pallets to stake via staking pallet while managing the
locks on these accounts themselves. Introduces another storage
`VirtualStakers` that whitelist these accounts.

We also restrict virtual stakers to set reward account as themselves.
Since the account has no locks, we cannot support compounding of
rewards. Conservatively, we require them to set a separate account
different from the staker. Since these are code managed, it should be
easy for another pallet to redistribute reward and rebond them.

### Slashes
Since there is no actual lock maintained by staking-pallet for virtual
stakers, this pallet does not apply any slashes. It is then important
for pallets managing virtual stakers to listen to slashing events and
apply necessary slashes.
@kianenigma
Copy link
Contributor

We inevitably need to migrate all ledgers as a part of #1654

We also need #441 for future unbonding logic, so you can hit 3 targets with one MBM that would do all 3.

This would be a great first usage of MBMs as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
I10-unconfirmed Issue might be valid, but it's not yet known.
Projects
Status: 📕 Backlog
Development

No branches or pull requests

2 participants