Skip to content

Subsume InstantStake by Accounts #5583

@lehins

Description

@lehins

The only reason why we have InstantStake defined as a separate Map is because it can contain Credentials that are not registered.

Taking into consideration our future plans of LedgerHD I believe it will be better to move stake of a registered account into AccountState and stake for unregistred accounts keep in a separate much smaller Map NotRegisteredStake

At a high level plan is to add a field to AccountState:

  stakeAccountStateL :: Lens' (AccountState era) (CompactForm Coin)`

which will be updated in the same way as InstantStake is updated today for registered AccountIds and in NotRegisteredStake for accounts that are not registered.

We will also need to update Ledger rules that handle registration/unregistration of accounts that will move possible stake value during registration in from NotRegisteredStake and move any non-zero stake to NotRegisteredStake upon unregistration.

This approach will not only speed up stake resolution, since we will no longer have a separate step that resolves active stake, but we will also simplify future LedgerHD implementation, since it will remove the need for an extra InstanStake table

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions