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 fee_debt: TokenAmount, pub initial_pledge: 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: usize, pub deadlines: Cid, pub early_terminations: BitField, pub deadline_cron_active: bool,
}
Expand description

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).

fee_debt: TokenAmount

Absolute value of debt this miner owes from unpaid fees.

initial_pledge: 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: usize

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.

deadline_cron_active: bool

Implementations

impl State[src]

pub fn new<BS: BlockStore>(
    store: &BS,
    info_cid: Cid,
    period_start: ChainEpoch,
    deadline_idx: usize
) -> Result<Self, Box<dyn StdError>>
[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 recorded_deadline_info(&self, current_epoch: ChainEpoch) -> DeadlineInfo[src]

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

pub fn quant_spec_for_deadline(&self, deadline_idx: usize) -> 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<(), Box<dyn StdError>>
[src]

Stores a pre-committed sector info, failing if the sector number is already present.

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<(usize, usize), 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<Vec<SectorOnChainInfo>, 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<(), 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: usize,
    partition_idx: usize,
    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_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 continue_deadline_cron(&self) -> bool[src]

pub fn add_pre_commit_deposit(
    &mut self,
    amount: &TokenAmount
) -> Result<(), String>
[src]

pub fn add_initial_pledge(&mut self, amount: &TokenAmount) -> Result<(), String>[src]

pub fn apply_penalty(&mut self, penalty: &TokenAmount) -> Result<(), String>[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 repay_partial_debt_in_priority_order<BS: BlockStore>(
    &mut self,
    store: &BS,
    current_epoch: ChainEpoch,
    curr_balance: &TokenAmount
) -> Result<(TokenAmount, TokenAmount), Box<dyn StdError>>
[src]

Draws from vesting table and unlocked funds to repay up to the fee debt. Returns the amount unlocked from the vesting table and the amount taken from current balance. If the fee debt exceeds the total amount available for repayment the fee debt field is updated to track the remaining debt. Otherwise it is set to zero.

pub fn repay_debts(
    &mut self,
    curr_balance: &TokenAmount
) -> Result<TokenAmount, Box<dyn StdError>>
[src]

Repays the full miner actor fee debt. Returns the amount that must be burnt and an error if there are not sufficient funds to cover repayment. Miner state repays from unlocked funds and fails if unlocked funds are insufficient to cover fee debt. FeeDebt will be zero after a successful call.

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
) -> Result<TokenAmount, String>
[src]

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

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

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

pub fn check_balance_invariants(
    &self,
    balance: &TokenAmount
) -> Result<(), String>
[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 expire_pre_commits<BS: BlockStore>(
    &mut self,
    store: &BS,
    current_epoch: ChainEpoch
) -> Result<TokenAmount, Box<dyn StdError>>
[src]

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

Trait Implementations

impl Cbor for State[src]

fn marshal_cbor(&self) -> Result<Vec<u8, Global>, Error>[src]

Marshalls cbor encodable object into cbor bytes

fn unmarshal_cbor(bz: &[u8]) -> Result<Self, Error>[src]

Unmarshals cbor encoded bytes to object

fn cid(&self) -> Result<Cid, Error>[src]

Returns the content identifier of the raw block of data Default is Blake2b256 hash Read more

impl Clone for State[src]

fn clone(&self) -> State[src]

Returns a copy of the value. Read more

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

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

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> where
    D: Deserializer<'de>, 
[src]

Deserialize this value from the given Serde deserializer. Read more

impl Serialize for State[src]

fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error> where
    S: Serializer
[src]

Serialize this value into the given Serde serializer. Read more

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]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

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

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

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

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

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

pub fn from(t: T) -> T[src]

Performs the conversion.

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

pub fn into(self) -> U[src]

Performs the conversion.

impl<T> Pointable for T

pub const ALIGN: usize

The alignment of pointer.

type Init = T

The type for initializers.

pub unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more

pub unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more

pub unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more

pub unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more

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.

pub fn to_owned(&self) -> T[src]

Creates owned data from borrowed data, usually by cloning. Read more

pub fn clone_into(&self, target: &mut T)[src]

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

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.

pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]

Performs the conversion.

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.

pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]

Performs the conversion.

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

pub fn vzip(self) -> V

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