Model Staking

Main logic for model peer staking

Outline

Model staking is a separate feature from general validator staking. The implementation of allowing staking towards validators is planned for mainnet. Read more here.


Increase Stake

pub fn add_to_stake(
    origin: OriginFor<T>, 
    model_id: u32,
    stake_to_be_added: u128,
) -> DispatchResult

Parameters

  • model_id: The key of the model. This can be found through querying ModelPaths using the model path.

  • stake_to_be_added: The balance to add to stake towards a specific model.

Information

To add to stake, an account must be a peer. Accounts that are not peers cannot stake towards a model.


Remove Stake

pub fn remove_stake(
    origin: OriginFor<T>, 
    model_id: u32, 
    stake_to_be_removed: u128
) -> DispatchResult

Parameters

  • model_id: The key of the model. This can be found through querying ModelPaths using the model path.

  • stake_to_be_removed: The balance to remove from stake towards a specific model.

Information

  • As a model peer, the stake balance must always be equal to or greater than the minimum required stake balance based on the MinStakeBalance.

  • Unstaking the total balance can only be accomplished once the model peer is no longer interfaced with the blockchain.

  • Model peers must wait for multiple epochs following the initialization or removal of the model peer to unstake.


Information

Minimum Stake Balance

To remove a stake, the peer must have greater than the minimum required balance based on the MinStakeBalance. A peer's increase in balance is accomplished as rewards are emitted on epochs where the peer has successfully submitted consensus data and is in consensus.

Required Unstake Epochs

The stake balance towards the model will not be available for removal until enough epochs have passed based on MinRequiredUnstakeEpochs after both the initialized block or removal block, whichever happened last.

Unstaking Post-Model Peer Removal

When a user removes themselves as a peer using the remove_model_peer() or they have been removed as a peer due to the consensus mechanism, they can then call remove_stake() to remove their total balance staked towards the specified model.

Last updated