Crate namada_proof_of_stake

Crate namada_proof_of_stake 

Source
Expand description

Proof of Stake system.

Re-exports§

pub use parameters::OwnedPosParams;
pub use parameters::PosParams;
pub use types::GenesisValidator;

Modules§

epoched
Epoched and EpochedDelta are structures for data that is set for future (and possibly past) epochs.
event
Proof of Stake events.
lazy_map
Lazy map.
lazy_set
Lazy set.
lazy_vec
Lazy dynamically-sized vector.
parameters
Proof-of-Stake system parameters
queries
Queriezzz
rewards
PoS rewards distribution.
slashing
Slashing tingzzzz
storage
PoS functions for reading and writing to storage and lazy collection handles associated with given storage_keys.
storage_key
Proof-of-Stake storage keys and storage integration.
types
Proof of Stake data types
validator_set_update
Validator set updates
vp
Proof-of-Stake native validity predicate.

Structs§

BecomeValidator
Arguments to become_validator.
Dec
A 256 bit number with POS_DECIMAL_PRECISION number of Dec places.
Epoch
Epoch identifier. Epochs are identified by consecutive numbers.
Key
A storage key is made of storage key segments DbKeySeg, separated by KEY_SEGMENT_SEPARATOR.
LazyMap
Lazy map.
LazySet
A lazy set.
LazyVec
Lazy dynamically-sized vector.
Store
PoS storage Keys/Read/Write implementation

Enums§

BecomeValidatorError
BondError
CommissionRateChangeError
ConsensusKeyChangeError
DeactivationError
Error
GenesisError
InflationError
MetadataError
ReactivationError
RedelegationError
SlashError
UnbondError
UnjailValidatorError
ValidatorMetaDataError

Constants§

ADDRESS
Address of the PoS account implemented as a native VP
CLAIM_REWARDS_EVENT_DESC
Event descriptor for claim-rewards token transfer
SLASH_POOL_ADDRESS
Address of the PoS slash pool account

Traits§

Collectable
Trait used to facilitate collection of lazy maps into eager maps
KeySeg
Represents a segment in a path that may be used as a database key
LazyCollection
A lazy collection of storage values.
OptionExt
An extension to Option to allow turning None case to an Error from a static string (handy for WASM).
Read
Abstract PoS storage read interface
ResultExt
Result extension to easily wrap custom errors into Error.
StorageRead
Common storage read interface
StorageWrite
Common storage write interface

Functions§

become_validator
Initialize data for a new validator.
bond_amount
Get the total bond amount, including slashes, for a given bond ID and epoch. Returns the bond amount after slashing. For future epochs, the value is subject to change.
bond_amounts_for_rewards
Get bond amounts within the claim_start..=claim_end epoch range for claiming rewards for a given bond ID.
bond_tokens
Self-bond tokens to a validator when source is None or equal to the validator address, or delegate tokens from the source to the validator.
change_consensus_key
Consensus key change for a validator
change_validator_commission_rate
Change the commission rate of a validator
change_validator_metadata
Change validator’s metadata. In addition to changing any of the data from ValidatorMetaData, the validator’s commission rate can be changed within here as well.
claim_reward_tokens
Claim available rewards, triggering an immediate transfer of tokens from the PoS account to the source address.
compute_and_store_total_consensus_stake
Compute and then store the total consensus stake
copy_genesis_validator_sets
Copies the validator sets into all epochs up through the pipeline epoch at genesis.
deactivate_validator
Deactivate a validator by removing it from any validator sets. A validator can only be deactivated if it is not jailed or already inactive.
finalize_block
Apply PoS updates for a block
genesis_validator_set_tendermint
Get the genesis consensus validators stake and consensus key for Tendermint, converted from ValidatorSetUpdates using the given function.
get_total_consensus_stake
Find the total amount of tokens staked at the given epoch, belonging to the set of consensus validators.
init_genesis
Init genesis. Requires that the governance parameters are initialized.
is_delegator
Check if the provided address is a delegator address, optionally at a particular epoch. Returns false if the address is a validator.
is_validator
Check if the provided address is a validator address
is_validator_frozen
Check if a validator is frozen.
iter_prefix_bytes
Iterate items matching the given prefix, ordered by the storage keys.
jail_for_liveness
Jail validators who failed to match the liveness threshold
jail_validator
Jail a validator by removing it from and updating the validator sets and changing a its state to Jailed. Validators are jailed for liveness and for misbehaving.
prune_liveness_data
Remove liveness data from storage for all validators that are not in the current consensus validator set.
query_reward_tokens
Query the amount of available reward tokens for a given bond.
raw_bond_amount
Get the total bond amount, without applying slashes, for a given bond ID and epoch. For future epochs, the value is subject to change.
reactivate_validator
Re-activate an inactive validator
record_liveness_data
Record the liveness data of the consensus validators
redelegate_tokens
Redelegate bonded tokens from a source validator to a destination validator
staking_token_address
Address of the staking token (i.e. the native token)
unbond_tokens
Unbond tokens that are bonded between a validator and a source (self or delegator).
unjail_validator
Unjail a validator that is currently jailed.
withdraw_tokens
Withdraw tokens from those that have been unbonded from proof-of-stake

Type Aliases§

NestedMap
A LazyMap with another LazyCollection inside it’s value V
Result
Result of a storage API call.