Struct forest_actor::miner::State[][src]

pub struct State {
Show fields pub info: Cid, pub pre_commit_deposits: TokenAmount, pub locked_funds: TokenAmount, pub vesting_funds: Cid, pub initial_pledge_requirement: TokenAmount, pub pre_committed_sectors: Cid, pub pre_committed_sectors_expiry: Cid, pub allocated_sectors: Cid, pub sectors: Cid, pub proving_period_start: ChainEpoch, pub current_deadline: u64, pub deadlines: Cid, pub early_terminations: BitField,
}

Balance of Miner Actor should be greater than or equal to the sum of PreCommitDeposits and LockedFunds. It is possible for balance to fall below the sum of PCD, LF and InitialPledgeRequirements, and this is a bad state (IP Debt) that limits a miner actor’s behavior (i.e. no balance withdrawals) Excess balance as computed by st.GetAvailableBalance will be withdrawable or usable for pre-commit deposit or pledge lock-up.

Fields

info: Cid

Contains static info about this miner

pre_commit_deposits: TokenAmount

Total funds locked as pre_commit_deposit

locked_funds: TokenAmount

Total rewards and added funds locked in vesting table

vesting_funds: Cid

VestingFunds (Vesting Funds schedule for the miner).

initial_pledge_requirement: TokenAmount

Sum of initial pledge requirements of all active sectors

pre_committed_sectors: Cid

Sectors that have been pre-committed but not yet proven. Map, HAMT<SectorNumber, SectorPreCommitOnChainInfo>

pre_committed_sectors_expiry: Cid

PreCommittedSectorsExpiry maintains the state required to expire PreCommittedSectors.

allocated_sectors: Cid

Allocated sector IDs. Sector IDs can never be reused once allocated.

sectors: Cid

Information for all proven and not-yet-garbage-collected sectors.

Sectors are removed from this AMT when the partition to which the sector belongs is compacted.

proving_period_start: ChainEpoch

The first epoch in this miner’s current proving period. This is the first epoch in which a PoSt for a partition at the miner’s first deadline may arrive. Alternatively, it is after the last epoch at which a PoSt for the previous window is valid. Always greater than zero, this may be greater than the current epoch for genesis miners in the first WPoStProvingPeriod epochs of the chain; the epochs before the first proving period starts are exempt from Window PoSt requirements. Updated at the end of every period by a cron callback.

current_deadline: u64

Index of the deadline within the proving period beginning at ProvingPeriodStart that has not yet been finalized. Updated at the end of each deadline window by a cron callback.

deadlines: Cid

The sector numbers due for PoSt at each deadline in the current proving period, frozen at period start. New sectors are added and expired ones removed at proving period boundary. Faults are not subtracted from this in state, but on the fly.

early_terminations: BitField

Deadlines with outstanding fees for early sector termination.

Implementations

impl State[src]

pub fn new(
    info_cid: Cid,
    period_start: ChainEpoch,
    empty_bitfield_cid: Cid,
    empty_array_cid: Cid,
    empty_map_cid: Cid,
    empty_deadlines_cid: Cid,
    empty_vesting_funds_cid: Cid
) -> Self
[src]

pub fn get_info<BS: BlockStore>(
    &self,
    store: &BS
) -> Result<MinerInfo, Box<dyn StdError>>
[src]

pub fn save_info<BS: BlockStore>(
    &mut self,
    store: &BS,
    info: MinerInfo
) -> Result<(), Box<dyn StdError>>
[src]

pub fn deadline_info(&self, current_epoch: ChainEpoch) -> DeadlineInfo[src]

Returns deadline calculations for the current (according to state) proving period.

pub fn quant_spec_for_deadline(&self, deadline_idx: u64) -> QuantSpec[src]

Returns deadline calculations for the current (according to state) proving period.

pub fn allocate_sector_number<BS: BlockStore>(
    &mut self,
    store: &BS,
    sector_number: SectorNumber
) -> Result<(), ActorError>
[src]

pub fn mask_sector_numbers<BS: BlockStore>(
    &mut self,
    store: &BS,
    sector_numbers: &BitField
) -> Result<(), ActorError>
[src]

pub fn put_precommitted_sector<BS: BlockStore>(
    &mut self,
    store: &BS,
    info: SectorPreCommitOnChainInfo
) -> Result<(), HamtError>
[src]

pub fn get_precommitted_sector<BS: BlockStore>(
    &self,
    store: &BS,
    sector_num: SectorNumber
) -> Result<Option<SectorPreCommitOnChainInfo>, HamtError>
[src]

pub fn find_precommitted_sectors<BS: BlockStore>(
    &self,
    store: &BS,
    sector_numbers: &[SectorNumber]
) -> Result<Vec<SectorPreCommitOnChainInfo>, Box<dyn StdError>>
[src]

Gets and returns the requested pre-committed sectors, skipping missing sectors.

pub fn delete_precommitted_sectors<BS: BlockStore>(
    &mut self,
    store: &BS,
    sector_nums: &[SectorNumber]
) -> Result<(), HamtError>
[src]

pub fn has_sector_number<BS: BlockStore>(
    &self,
    store: &BS,
    sector_num: SectorNumber
) -> Result<bool, Box<dyn StdError>>
[src]

pub fn put_sectors<BS: BlockStore>(
    &mut self,
    store: &BS,
    new_sectors: Vec<SectorOnChainInfo>
) -> Result<(), Box<dyn StdError>>
[src]

pub fn get_sector<BS: BlockStore>(
    &self,
    store: &BS,
    sector_num: SectorNumber
) -> Result<Option<SectorOnChainInfo>, Box<dyn StdError>>
[src]

pub fn delete_sectors<BS: BlockStore>(
    &mut self,
    store: &BS,
    sector_nos: &BitField
) -> Result<(), AmtError>
[src]

pub fn for_each_sector<BS: BlockStore, F>(
    &self,
    store: &BS,
    f: F
) -> Result<(), Box<dyn StdError>> where
    F: FnMut(&SectorOnChainInfo) -> Result<(), Box<dyn StdError>>, 
[src]

pub fn find_sector<BS: BlockStore>(
    &self,
    store: &BS,
    sector_number: SectorNumber
) -> Result<(u64, u64), Box<dyn StdError>>
[src]

Returns the deadline and partition index for a sector number.

pub fn reschedule_sector_expirations<BS: BlockStore>(
    &mut self,
    store: &BS,
    current_epoch: ChainEpoch,
    sector_size: SectorSize,
    deadline_sectors: DeadlineSectorMap
) -> Result<(), Box<dyn StdError>>
[src]

Schedules each sector to expire at its next deadline end. If it can’t find any given sector, it skips it.

This method assumes that each sector’s power has not changed, despite the rescheduling.

Note: this method is used to “upgrade” sectors, rescheduling the now-replaced sectors to expire at the end of the next deadline. Given the expense of sealing a sector, this function skips missing/faulty/terminated “upgraded” sectors instead of failing. That way, the new sectors can still be proved.

pub fn assign_sectors_to_deadlines<BS: BlockStore>(
    &mut self,
    store: &BS,
    current_epoch: ChainEpoch,
    sectors: Vec<SectorOnChainInfo>,
    partition_size: u64,
    sector_size: SectorSize
) -> Result<PowerPair, Box<dyn StdError>>
[src]

Assign new sectors to deadlines.

pub fn pop_early_terminations<BS: BlockStore>(
    &mut self,
    store: &BS,
    max_partitions: u64,
    max_sectors: u64
) -> Result<(TerminationResult, bool), Box<dyn StdError>>
[src]

Pops up to max_sectors early terminated sectors from all deadlines.

Returns true if we still have more early terminations to process.

pub fn check_sector_health<BS: BlockStore>(
    &self,
    store: &BS,
    deadline_idx: u64,
    partition_idx: u64,
    sector_number: SectorNumber
) -> Result<(), Box<dyn StdError>>
[src]

pub fn load_sector_infos<BS: BlockStore>(
    &self,
    store: &BS,
    sectors: &BitField
) -> Result<Vec<SectorOnChainInfo>, Box<dyn StdError>>
[src]

Loads sector info for a sequence of sectors.

pub fn load_sector_infos_for_proof<BS: BlockStore>(
    &mut self,
    store: &BS,
    proven_sectors: &BitField,
    expected_faults: &BitField
) -> Result<Vec<SectorOnChainInfo>, Box<dyn StdError>>
[src]

Loads info for a set of sectors to be proven. If any of the sectors are declared faulty and not to be recovered, info for the first non-faulty sector is substituted instead. If any of the sectors are declared recovered, they are returned from this method.

pub fn load_deadlines<BS: BlockStore>(
    &self,
    store: &BS
) -> Result<Deadlines, ActorError>
[src]

pub fn save_deadlines<BS: BlockStore>(
    &mut self,
    store: &BS,
    deadlines: Deadlines
) -> Result<(), Box<dyn StdError>>
[src]

pub fn load_vesting_funds<BS: BlockStore>(
    &self,
    store: &BS
) -> Result<VestingFunds, Box<dyn StdError>>
[src]

Loads the vesting funds table from the store.

pub fn save_vesting_funds<BS: BlockStore>(
    &mut self,
    store: &BS,
    funds: &VestingFunds
) -> Result<(), Box<dyn StdError>>
[src]

Saves the vesting table to the store.

pub fn add_pre_commit_deposit(&mut self, amount: &TokenAmount)[src]

pub fn add_initial_pledge_requirement(&mut self, amount: &TokenAmount)[src]

pub fn add_locked_funds<BS: BlockStore>(
    &mut self,
    store: &BS,
    current_epoch: ChainEpoch,
    vesting_sum: &TokenAmount,
    spec: VestSpec
) -> Result<TokenAmount, Box<dyn StdError>>
[src]

First vests and unlocks the vested funds AND then locks the given funds in the vesting table.

pub fn penalize_funds_in_priority_order<BS: BlockStore>(
    &mut self,
    store: &BS,
    current_epoch: ChainEpoch,
    target: &TokenAmount,
    unlocked_balance: &TokenAmount
) -> Result<(TokenAmount, TokenAmount), Box<dyn StdError>>
[src]

First unlocks unvested funds from the vesting table. If the target is not yet hit it deducts funds from the (new) available balance. Returns the amount unlocked from the vesting table and the amount taken from current balance. If the penalty exceeds the total amount available in the vesting table and unlocked funds the penalty is reduced to match. This must be fixed when handling bankrupcy: https://github.com/filecoin-project/specs-actors/issues/627

pub fn unlock_unvested_funds<BS: BlockStore>(
    &mut self,
    store: &BS,
    current_epoch: ChainEpoch,
    target: &TokenAmount
) -> Result<TokenAmount, Box<dyn StdError>>
[src]

Unlocks an amount of funds that have not yet vested, if possible. The soonest-vesting entries are unlocked first. Returns the amount actually unlocked.

pub fn unlock_vested_funds<BS: BlockStore>(
    &mut self,
    store: &BS,
    current_epoch: ChainEpoch
) -> Result<TokenAmount, Box<dyn StdError>>
[src]

Unlocks all vesting funds that have vested before the provided epoch. Returns the amount unlocked.

pub fn check_vested_funds<BS: BlockStore>(
    &self,
    store: &BS,
    current_epoch: ChainEpoch
) -> Result<TokenAmount, Box<dyn StdError>>
[src]

CheckVestedFunds returns the amount of vested funds that have vested before the provided epoch.

pub fn get_unlocked_balance(
    &self,
    actor_balance: &TokenAmount,
    network_version: NetworkVersion
) -> Result<TokenAmount, ActorError>
[src]

Unclaimed funds that are not locked – includes funds used to cover initial pledge requirement.

pub fn get_available_balance(
    &self,
    actor_balance: &TokenAmount,
    network_version: NetworkVersion
) -> Result<TokenAmount, ActorError>
[src]

Unclaimed funds. Actor balance - (locked funds, precommit deposit, ip requirement) Can go negative if the miner is in IP debt.

pub fn assert_balance_invariants(
    &self,
    balance: &TokenAmount,
    network_version: NetworkVersion
) -> Result<(), ActorError>
[src]

pub fn meets_initial_pledge_condition(
    &self,
    balance: &TokenAmount,
    network_version: NetworkVersion
) -> Result<bool, ActorError>
[src]

pub fn quant_spec_every_deadline(&self) -> QuantSpec[src]

pre-commit expiry

pub fn add_pre_commit_expiry<BS: BlockStore>(
    &mut self,
    store: &BS,
    expire_epoch: ChainEpoch,
    sector_number: SectorNumber
) -> Result<(), Box<dyn StdError>>
[src]

pub fn check_precommit_expiry<BS: BlockStore>(
    &mut self,
    store: &BS,
    sectors: &BitField,
    network_version: NetworkVersion
) -> Result<TokenAmount, Box<dyn StdError>>
[src]

Trait Implementations

impl Cbor for State[src]

impl Clone for State[src]

impl<'de> Deserialize<'de> for State[src]

impl Serialize for State[src]

Auto Trait Implementations

impl RefUnwindSafe for State

impl Send for State

impl Sync for State

impl Unpin for State

impl UnwindSafe for State

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> DeserializeOwned for T where
    T: for<'de> Deserialize<'de>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Pointable for T

type Init = T

The type for initializers.

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,