state

package
v0.9.7-rc3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 19, 2021 License: Apache-2.0, MIT Imports: 27 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewBitField

func NewBitField() *bitfield.BitField

Types

type AccountView added in v0.9.1

type AccountView interface {
	ResolveToKeyAddr(ctx context.Context, address address.Address) (address.Address, error)
}

type ChainSectorInfo

type ChainSectorInfo struct {
	Info miner.SectorOnChainInfo
	ID   abi.SectorNumber
}

type CirculatingSupply

type CirculatingSupply struct {
	FilVested      abi.TokenAmount
	FilMined       abi.TokenAmount
	FilBurnt       abi.TokenAmount
	FilLocked      abi.TokenAmount
	FilCirculating abi.TokenAmount
}

type DealCollateralBounds

type DealCollateralBounds struct {
	Min abi.TokenAmount
	Max abi.TokenAmount
}

type FakeMinerState

type FakeMinerState struct {
	Owner              address.Address
	Worker             address.Address
	PeerID             peer.ID
	ProvingPeriodStart abi.ChainEpoch
	ProvingPeriodEnd   abi.ChainEpoch
	PoStFailures       int
	Sectors            []miner.SectorOnChainInfo
	Deadlines          []*bitfield.BitField
	ClaimedRawPower    abi.StoragePower
	ClaimedQAPower     abi.StoragePower
	PledgeRequirement  abi.TokenAmount
	PledgeBalance      abi.TokenAmount
}

FakeMinerState is fake state for a single miner.

type FakeSectorInfo

type FakeSectorInfo struct {
	ID        abi.SectorNumber
	SealedCID cid.Cid
}

FakeSectorInfo fakes a subset of sector onchain info

type FakeStateView

type FakeStateView struct {
	NetworkName string
	Power       *NetworkPower
	Miners      map[address.Address]*FakeMinerState
}

FakeStateView is a fake state view.

func NewFakeStateView

func NewFakeStateView(rawBytePower, qaPower abi.StoragePower, minerCount, minPowerMinerCount int64) *FakeStateView

NewFakeStateView creates a new fake state view.

func (*FakeStateView) GetMinerWorkerRaw added in v0.9.1

func (v *FakeStateView) GetMinerWorkerRaw(ctx context.Context, maddr address.Address) (address.Address, error)

func (*FakeStateView) GetSectorsForWinningPoSt

func (v *FakeStateView) GetSectorsForWinningPoSt(ctx context.Context, nv network.Version, pv ffiwrapper.Verifier, st cid.Cid, maddr address.Address, rand abi.PoStRandomness) ([]builtin.SectorInfo, error)

func (*FakeStateView) InitNetworkName

func (v *FakeStateView) InitNetworkName(_ context.Context) (string, error)

func (*FakeStateView) MinerClaimedPower

func (v *FakeStateView) MinerClaimedPower(ctx context.Context, miner address.Address) (abi.StoragePower, abi.StoragePower, error)

func (*FakeStateView) MinerExists

func (v *FakeStateView) MinerExists(_ context.Context, _ address.Address) (bool, error)

func (*FakeStateView) MinerInfo

func (v *FakeStateView) MinerInfo(ctx context.Context, maddr address.Address, nv network.Version) (*miner.MinerInfo, error)

func (*FakeStateView) MinerPledgeCollateral

func (v *FakeStateView) MinerPledgeCollateral(_ context.Context, maddr address.Address) (locked abi.TokenAmount, total abi.TokenAmount, err error)

func (*FakeStateView) MinerProvingPeriod

func (v *FakeStateView) MinerProvingPeriod(ctx context.Context, maddr address.Address) (start abi.ChainEpoch, end abi.ChainEpoch, failureCount int, err error)

func (*FakeStateView) MinerSectorCount

func (v *FakeStateView) MinerSectorCount(ctx context.Context, maddr address.Address) (uint64, error)

MinerSectorCount reports the number of sectors a miner has pledged

func (*FakeStateView) MinerSectorInfo

func (v *FakeStateView) MinerSectorInfo(_ context.Context, maddr address.Address, sectorNum abi.SectorNumber) (*miner.SectorOnChainInfo, error)

func (*FakeStateView) PowerNetworkTotal

func (v *FakeStateView) PowerNetworkTotal(_ context.Context) (*NetworkPower, error)

func (*FakeStateView) ResolveToKeyAddr added in v0.9.1

func (v *FakeStateView) ResolveToKeyAddr(ctx context.Context, addr address.Address) (address.Address, error)

type FaultStateView

type FaultStateView interface {
	MinerExists(ctx context.Context, maddr address.Address) (bool, error)
}

FaultStateView is a view of chain state for adjustment of miner power claims based on changes since the power state's lookback (primarily, the miner ceasing to be registered).

type HeadSignView added in v0.9.1

type HeadSignView struct {
	// contains filtered or unexported fields
}

func NewHeadSignView added in v0.9.1

func NewHeadSignView(tipSignerView tipSignerView) *HeadSignView

func (*HeadSignView) ResolveToKeyAddr added in v0.9.1

func (headSignView *HeadSignView) ResolveToKeyAddr(ctx context.Context, addr address.Address) (address.Address, error)

type MarketDeal

type MarketDeal struct {
	Proposal market.DealProposal
	State    market.DealState
}

type NetworkPower

type NetworkPower struct {
	RawBytePower         abi.StoragePower
	QualityAdjustedPower abi.StoragePower
	MinerCount           int64
	MinPowerMinerCount   int64
}

type PowerStateView

type PowerStateView interface {
	ResolveToKeyAddr(ctx context.Context, maddr address.Address) (address.Address, error)
	GetMinerWorkerRaw(ctx context.Context, maddr address.Address) (address.Address, error)
	MinerInfo(ctx context.Context, maddr address.Address, nv network.Version) (*miner.MinerInfo, error)
	MinerSectorInfo(ctx context.Context, maddr address.Address, sectorNum abi.SectorNumber) (*miner.SectorOnChainInfo, error)
	PowerNetworkTotal(ctx context.Context) (*NetworkPower, error)
	MinerClaimedPower(ctx context.Context, miner address.Address) (raw, qa abi.StoragePower, err error)
	GetSectorsForWinningPoSt(ctx context.Context, nv network.Version, pv ffiwrapper.Verifier, st cid.Cid, maddr address.Address, rand abi.PoStRandomness) ([]builtin.SectorInfo, error)
}

PowerStateView is a view of chain state for election computations, typically at some lookback from the immediate parent state. This type isn't doing much that the state view doesn't already do, consider removing it.

type PowerTableView

type PowerTableView struct {
	// contains filtered or unexported fields
}

An interface to the network power table for elections. Elections use the quality-adjusted power, rather than raw byte power.

func NewPowerTableView

func NewPowerTableView(state PowerStateView, faultState FaultStateView) PowerTableView

func (PowerTableView) MinerClaimedPower

func (v PowerTableView) MinerClaimedPower(ctx context.Context, mAddr address.Address) (abi.StoragePower, error)

Returns a miner's claimed quality-adjusted power.

func (PowerTableView) NetworkTotalPower

func (v PowerTableView) NetworkTotalPower(ctx context.Context) (abi.StoragePower, error)

Returns the network's total quality-adjusted power.

func (PowerTableView) SignerAddress

func (v PowerTableView) SignerAddress(ctx context.Context, addr address.Address) (address.Address, error)

SignerAddress returns the public key address associated with the given address.

func (PowerTableView) WorkerAddr

func (v PowerTableView) WorkerAddr(ctx context.Context, mAddr address.Address, nv network.Version) (address.Address, error)

WorkerAddr returns the worker address for a miner actor.

type SignatureValidator

type SignatureValidator struct {
	// contains filtered or unexported fields
}

SignatureValidator resolves account actor addresses to their pubkey-style address for signature validation.

func NewSignatureValidator

func NewSignatureValidator(signerView AccountView) *SignatureValidator

func (*SignatureValidator) ValidateBLSMessageAggregate

func (v *SignatureValidator) ValidateBLSMessageAggregate(ctx context.Context, msgs []*types.UnsignedMessage, sig *crypto.Signature) error

func (*SignatureValidator) ValidateMessageSignature

func (v *SignatureValidator) ValidateMessageSignature(ctx context.Context, msg *types.SignedMessage) error

func (*SignatureValidator) ValidateSignature

func (v *SignatureValidator) ValidateSignature(ctx context.Context, data []byte, signer address.Address, sig crypto.Signature) error

type Signer

type Signer struct {
	// contains filtered or unexported fields
}

Signer looks up non-signing addresses before signing

func NewSigner

func NewSigner(signerView AccountView, wallet *wallet.Wallet) *Signer

NewSigner creates a new signer

func (*Signer) HasAddress

func (s *Signer) HasAddress(ctx context.Context, addr address.Address) (bool, error)

HasAddress returns whether this signer can sign with the given address

func (*Signer) SignBytes

func (s *Signer) SignBytes(ctx context.Context, data []byte, addr address.Address) (*crypto.Signature, error)

SignBytes creates a signature for the given data using either the given addr or its associated signing address

type View

type View struct {
	// contains filtered or unexported fields
}

View is a read-only interface to a snapshot of application-level actor state. This object interprets the actor state, abstracting the concrete on-chain structures so as to hide the complications of protocol versions. Exported methods on this type avoid exposing concrete state structures (which may be subject to versioning) where possible.

func NewView

func NewView(store cbor.IpldStore, root cid.Cid) *View

NewView creates a new state view

func (*View) GetFilLocked

func (v *View) GetFilLocked(ctx context.Context, st vmstate.Tree) (abi.TokenAmount, error)

func (*View) GetMinerWorkerRaw added in v0.9.1

func (v *View) GetMinerWorkerRaw(ctx context.Context, maddr addr.Address) (addr.Address, error)

ResolveToKeyAddr returns the public key type of address (`BLS`/`SECP256K1`) of an account actor identified by `addr`.

func (*View) GetPartsProving

func (v *View) GetPartsProving(ctx context.Context, maddr addr.Address) ([]bitfield.BitField, error)

func (*View) GetPowerRaw

func (v *View) GetPowerRaw(ctx context.Context, maddr addr.Address) (power.Claim, power.Claim, bool, error)

func (*View) GetSectorsForWinningPoSt

func (v *View) GetSectorsForWinningPoSt(ctx context.Context, nv network.Version, pv ffiwrapper.Verifier, st cid.Cid, maddr addr.Address, rand abi.PoStRandomness) ([]builtin.SectorInfo, error)

func (*View) InitNetworkName

func (v *View) InitNetworkName(ctx context.Context) (string, error)

InitNetworkName Returns the network name from the init actor state.

func (*View) InitResolveAddress

func (v *View) InitResolveAddress(ctx context.Context, a addr.Address) (addr.Address, error)

InitResolveAddress Returns ID address if public key address is given.

func (*View) LoadActor

func (v *View) LoadActor(ctx context.Context, address addr.Address) (*types.Actor, error)

func (*View) LoadMarketState

func (v *View) LoadMarketState(ctx context.Context) (market.State, error)

func (*View) LoadMinerState

func (v *View) LoadMinerState(ctx context.Context, maddr addr.Address) (miner.State, error)

func (*View) LoadPaychState added in v0.9.1

func (v *View) LoadPaychState(ctx context.Context, actr *types.Actor) (paychActor.State, error)

func (*View) LookupID

func (v *View) LookupID(ctx context.Context, address addr.Address) (addr.Address, error)

func (*View) MarketComputeDataCommitment

func (v *View) MarketComputeDataCommitment(ctx context.Context, registeredProof abi.RegisteredSealProof, dealIDs []abi.DealID) (cid.Cid, error)

MarketComputeDataCommitment takes deal ids and uses associated commPs to compute commD for a sector that contains the deals

func (*View) MarketDealProposal

func (v *View) MarketDealProposal(ctx context.Context, dealID abi.DealID) (market.DealProposal, error)

NOTE: exposes on-chain structures directly for storage FSM interface.

func (*View) MarketDealProviderCollateralBounds

func (v *View) MarketDealProviderCollateralBounds(ctx context.Context, size abi.PaddedPieceSize, verified bool, height abi.ChainEpoch) (DealCollateralBounds, error)

StateDealProviderCollateralBounds returns the min and max collateral a storage provider can issue. It takes the deal size and verified status as parameters.

func (*View) MarketDealState

func (v *View) MarketDealState(ctx context.Context, dealID abi.DealID) (*market.DealState, bool, error)

NOTE: exposes on-chain structures directly for storage FSM and market module interfaces.

func (*View) MarketDealStatesForEach

func (v *View) MarketDealStatesForEach(ctx context.Context, f func(id abi.DealID, state *market.DealState) error) error

NOTE: exposes on-chain structures directly for market interface. The callback receives a pointer to a transient object; take a copy or drop the reference outside the callback.

func (*View) MarketEscrowBalance

func (v *View) MarketEscrowBalance(ctx context.Context, addr addr.Address) (found bool, amount abi.TokenAmount, err error)

MarketEscrowBalance looks up a token amount in the escrow table for the given address

func (*View) MinerClaimedPower

func (v *View) MinerClaimedPower(ctx context.Context, miner addr.Address) (raw, qa abi.StoragePower, err error)

Returns the power of a miner's committed sectors.

func (*View) MinerDeadlineInfo

func (v *View) MinerDeadlineInfo(ctx context.Context, maddr addr.Address, epoch abi.ChainEpoch) (index uint64, open, close, challenge abi.ChainEpoch, _ error)

MinerDeadlineInfo returns information relevant to the current proving deadline

func (*View) MinerExists

func (v *View) MinerExists(ctx context.Context, maddr addr.Address) (bool, error)

MinerExists Returns true iff the miner exists.

func (*View) MinerGetPrecommittedSector

func (v *View) MinerGetPrecommittedSector(ctx context.Context, maddr addr.Address, sectorNum abi.SectorNumber) (*miner.SectorPreCommitOnChainInfo, bool, error)

MinerGetPrecommittedSector Looks up info for a miners precommitted sector. NOTE: exposes on-chain structures directly for storage FSM API.

func (*View) MinerInfo

func (v *View) MinerInfo(ctx context.Context, maddr addr.Address, nv network.Version) (*miner.MinerInfo, error)

func (*View) MinerNominalPowerMeetsConsensusMinimum

func (v *View) MinerNominalPowerMeetsConsensusMinimum(ctx context.Context, addr addr.Address) (bool, error)

func (*View) MinerSectorInfo

func (v *View) MinerSectorInfo(ctx context.Context, maddr addr.Address, sectorNum abi.SectorNumber) (*miner.SectorOnChainInfo, error)

Loads sector info from miner state.

func (*View) PaychActorParties

func (v *View) PaychActorParties(ctx context.Context, paychAddr addr.Address) (from, to addr.Address, err error)

PaychActorParties returns the From and To addresses for the given payment channel

func (*View) PowerNetworkTotal

func (v *View) PowerNetworkTotal(ctx context.Context) (*NetworkPower, error)

Returns the storage power actor's values for network total power.

func (*View) PreCommitInfo

func (v *View) PreCommitInfo(ctx context.Context, maddr addr.Address, sid abi.SectorNumber) (*miner.SectorPreCommitOnChainInfo, error)

func (*View) ResolveToKeyAddr

func (v *View) ResolveToKeyAddr(ctx context.Context, address addr.Address) (addr.Address, error)

func (*View) StateListMiners

func (v *View) StateListMiners(ctx context.Context, tsk types.TipSetKey) ([]addr.Address, error)

func (*View) StateMarketDeals

func (v *View) StateMarketDeals(ctx context.Context, tsk types.TipSetKey) (map[string]MarketDeal, error)

func (*View) StateMarketStorageDeal

func (v *View) StateMarketStorageDeal(ctx context.Context, dealID abi.DealID) (*MarketDeal, error)

func (*View) StateMinerActiveSectors

func (v *View) StateMinerActiveSectors(ctx context.Context, maddr addr.Address, tsk types.TipSetKey) ([]*miner.SectorOnChainInfo, error)

func (*View) StateMinerAvailableBalance

func (v *View) StateMinerAvailableBalance(ctx context.Context, maddr addr.Address, ts *types.TipSet) (big.Int, error)

func (*View) StateMinerDeadlineForIdx

func (v *View) StateMinerDeadlineForIdx(ctx context.Context, addr addr.Address, dlIdx uint64, key types.TipSetKey) (miner.Deadline, error)

func (*View) StateMinerPower

func (v *View) StateMinerPower(ctx context.Context, maddr addr.Address, tsk types.TipSetKey) (power.Claim, power.Claim, bool, error)

func (*View) StateMinerProvingDeadline

func (v *View) StateMinerProvingDeadline(ctx context.Context, addr addr.Address, ts *types.TipSet) (*dline.Info, error)

func (*View) StateMinerSectors

func (v *View) StateMinerSectors(ctx context.Context, addr addr.Address, filter *bitfield.BitField, key types.TipSetKey) ([]*ChainSectorInfo, error)

func (*View) StateSectorExpiration

func (v *View) StateSectorExpiration(ctx context.Context, maddr addr.Address, sectorNumber abi.SectorNumber, key types.TipSetKey) (*miner.SectorExpiration, error)

func (*View) StateSectorPartition

func (v *View) StateSectorPartition(ctx context.Context, maddr addr.Address, sectorNumber abi.SectorNumber) (*miner.SectorLocation, error)

func (*View) StateVerifiedClientStatus

func (v *View) StateVerifiedClientStatus(ctx context.Context, addr addr.Address) (abi.StoragePower, error)

type Viewer

type Viewer struct {
	// contains filtered or unexported fields
}

Viewer builds state views from state root CIDs.

func NewViewer

func NewViewer(store cbor.IpldStore) *Viewer

NewViewer creates a new state

func (*Viewer) StateView

func (c *Viewer) StateView(root cid.Cid) *View

StateView returns a new state view.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL