state

package
v1.9.0-rc1 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2022 License: Apache-2.0, MIT Imports: 29 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AccountView added in v0.9.1

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

todo remove Account view a nd headsignerview

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, maddr address.Address, rand abi.PoStRandomness) ([]builtin.ExtendedSectorInfo, 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 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, maddr address.Address, rand abi.PoStRandomness) ([]builtin.ExtendedSectorInfo, 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.Message, sig *crypto.Signature) error

ValidateBLSMessageAggregate validate bls aggregate message

func (*SignatureValidator) ValidateMessageSignature

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

ValidateSignature check the signature of message is valid or not. first get the cid of message and than checkout signature of messager cid and address

func (*SignatureValidator) ValidateSignature

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

ValidateSignature check the signature is valid or not

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)

GetFilLocked return all locked fil amount

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

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

GetSectorsForWinningPoSt return sector of winning post challenge result

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) LoadAccountState added in v1.1.0

func (v *View) LoadAccountState(ctx context.Context, a addr.Address) (account.State, error)

nolint

func (*View) LoadActor

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

LoadActor load actor from tree

func (*View) LoadDatacapState added in v1.8.0

func (v *View) LoadDatacapState(ctx context.Context) (datacap.State, error)

func (*View) LoadInitState added in v1.1.0

func (v *View) LoadInitState(ctx context.Context) (notinit.State, 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) (lminer.State, error)

LoadMinerState return miner state

func (*View) LoadPaychState added in v0.9.1

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

LoadPaychState get pay channel state for actor

func (*View) LoadPowerActor added in v1.1.0

func (v *View) LoadPowerActor(ctx context.Context) (power.State, error)

func (*View) LoadPowerState added in v1.1.0

func (v *View) LoadPowerState(ctx context.Context) (power.State, error)

nolint

func (*View) LoadRewardState added in v1.1.0

func (v *View) LoadRewardState(ctx context.Context) (reward.State, error)

nolint

func (*View) LoadVerifregActor added in v1.1.0

func (v *View) LoadVerifregActor(ctx context.Context) (verifreg.State, error)

func (*View) LookupID

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

LookupID retrieves the ID address of the given address

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) 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) (*types.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) (*lminer.MinerInfo, error)

MinerInfo returns info about the indicated miner

func (*View) MinerNominalPowerMeetsConsensusMinimum

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

MinerNominalPowerMeetsConsensusMinimum return whether miner meet consensus minmum power

func (*View) MinerSectorInfo

func (v *View) MinerSectorInfo(ctx context.Context, maddr addr.Address, sectorNum abi.SectorNumber) (*types.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) ResolveToKeyAddr

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

ResolveToKeyAddress is similar to `vm.ResolveToKeyAddr` but does not allow `Actor` type of addresses. Uses the `TipSet` `ts` to generate the VM state.

func (*View) SectorPreCommitInfo added in v0.9.7

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

StateSectorPreCommitInfo returns the PreCommit info for the specified miner's sector

func (*View) StateListMiners

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

StateListMiners returns the addresses of every miner that has claimed power in the Power Actor

func (*View) StateMarketDeals

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

StateMarketDeals returns information about every deal in the Storage Market

func (*View) StateMarketStorageDeal

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

StateMarketStorageDeal returns information about the indicated deal

func (*View) StateMinerActiveSectors

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

StateMinerActiveSectors returns info about sectors that a given miner is actively proving.

func (*View) StateMinerAvailableBalance

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

StateMinerAvailableBalance returns the portion of a miner's balance that can be withdrawn or spent

func (*View) StateMinerPower

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

StateMinerPower returns the power of the indicated miner

func (*View) StateMinerProvingDeadline

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

StateMinerProvingDeadline calculates the deadline at some epoch for a proving period and returns the deadline-related calculations.

func (*View) StateSectorExpiration

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

StateSectorExpiration returns epoch at which given sector will expire

func (*View) StateSectorPartition

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

StateSectorPartition finds deadline/partition with the specified sector

func (*View) StateVerifiedClientStatus

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

StateVerifiedClientStatus returns the data cap for the given address. Returns nil if there is no entry in the data cap table for the address.

type Viewer

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

Viewer builds state views from state root CIDs. remove tipset argument in many function of viewer

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