chain

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2021 License: Apache-2.0, MIT Imports: 39 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewAPIBlockstore

func NewAPIBlockstore(cio ChainIO) blockstore.Blockstore

Types

type AccountAPI

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

func NewAccountAPI

func NewAccountAPI(chain *ChainSubmodule) AccountAPI

func (*AccountAPI) StateAccountKey

func (accountAPI *AccountAPI) StateAccountKey(ctx context.Context, addr address.Address, tsk block.TipSetKey) (address.Address, error)

type ActorAPI

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

func NewActorAPI

func NewActorAPI(chain *ChainSubmodule) ActorAPI

func (*ActorAPI) ActorGetSignature

func (actorAPI *ActorAPI) ActorGetSignature(ctx context.Context, actorAddr address.Address, method abi.MethodNum) (vm.ActorMethodSignature, error)

ActorGetSignature returns the signature of the given actor's given method. The function signature is typically used to enable a caller to decode the output of an actor method call (message).

func (*ActorAPI) ListActor

func (actorAPI *ActorAPI) ListActor(ctx context.Context) (map[address.Address]*types.Actor, error)

ActorLs returns a channel with actors from the latest state on the chain

func (*ActorAPI) StateGetActor

func (actorAPI *ActorAPI) StateGetActor(ctx context.Context, actor address.Address, tsk block.TipSetKey) (*types.Actor, error)

type BeaconAPI

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

func NewBeaconAPI

func NewBeaconAPI(chain *ChainSubmodule) BeaconAPI

func (*BeaconAPI) BeaconGetEntry

func (beaconAPI *BeaconAPI) BeaconGetEntry(ctx context.Context, epoch abi.ChainEpoch) (*block.BeaconEntry, error)

type BlockMessages

type BlockMessages struct {
	BlsMessages   []*types.UnsignedMessage
	SecpkMessages []*types.SignedMessage
	Cids          []cid.Cid
}

BlsMessages[x].cid = Cids[x] SecpkMessages[y].cid = Cids[BlsMessages.length + y]

type ChainIO

type ChainIO interface {
	ChainReadObj(context.Context, cid.Cid) ([]byte, error)
	ChainHasObj(context.Context, cid.Cid) (bool, error)
}

type ChainInfoAPI

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

func NewChainInfoAPI

func NewChainInfoAPI(chain *ChainSubmodule) ChainInfoAPI

func (*ChainInfoAPI) BlockTime

func (chainInfoAPI *ChainInfoAPI) BlockTime() time.Duration

todo think which module should this api belong BlockTime returns the block time used by the consensus protocol.

func (*ChainInfoAPI) ChainGetBlock

func (chainInfoAPI *ChainInfoAPI) ChainGetBlock(ctx context.Context, id cid.Cid) (*block.Block, error)

ChainGetBlock gets a block by CID

func (*ChainInfoAPI) ChainGetBlockMessages

func (chainInfoAPI *ChainInfoAPI) ChainGetBlockMessages(ctx context.Context, bid cid.Cid) (*BlockMessages, error)

ChainGetMessages gets a message collection by CID

func (*ChainInfoAPI) ChainGetMessage

func (chainInfoAPI *ChainInfoAPI) ChainGetMessage(ctx context.Context, msgID cid.Cid) (*types.UnsignedMessage, error)

func (*ChainInfoAPI) ChainGetRandomnessFromBeacon

func (chainInfoAPI *ChainInfoAPI) ChainGetRandomnessFromBeacon(ctx context.Context, key block.TipSetKey, personalization acrypto.DomainSeparationTag, randEpoch abi.ChainEpoch, entropy []byte) (abi.Randomness, error)

func (*ChainInfoAPI) ChainGetRandomnessFromTickets

func (chainInfoAPI *ChainInfoAPI) ChainGetRandomnessFromTickets(ctx context.Context, tsk block.TipSetKey, personalization acrypto.DomainSeparationTag, randEpoch abi.ChainEpoch, entropy []byte) (abi.Randomness, error)

func (*ChainInfoAPI) ChainGetReceipts

func (chainInfoAPI *ChainInfoAPI) ChainGetReceipts(ctx context.Context, id cid.Cid) ([]types.MessageReceipt, error)

ChainGetReceipts gets a receipt collection by CID

func (*ChainInfoAPI) ChainGetTipSet

func (chainInfoAPI *ChainInfoAPI) ChainGetTipSet(key block.TipSetKey) (*block.TipSet, error)

ChainTipSet returns the tipset at the given key

func (*ChainInfoAPI) ChainGetTipSetByHeight

func (chainInfoAPI *ChainInfoAPI) ChainGetTipSetByHeight(ctx context.Context, height abi.ChainEpoch, tsk block.TipSetKey) (*block.TipSet, error)

ChainGetTipSetByHeight looks back for a tipset at the specified epoch. If there are no blocks at the specified epoch, a tipset at an earlier epoch will be returned.

func (*ChainInfoAPI) ChainHead

func (chainInfoAPI *ChainInfoAPI) ChainHead(ctx context.Context) (*block.TipSet, error)

func (*ChainInfoAPI) ChainList

func (chainInfoAPI *ChainInfoAPI) ChainList(ctx context.Context, tsKey block.TipSetKey, count int) ([]block.TipSetKey, error)

ChainLs returns an iterator of tipsets from specified head by tsKey to genesis

func (*ChainInfoAPI) ChainNotify

func (chainInfoAPI *ChainInfoAPI) ChainNotify(ctx context.Context) chan []*chain.HeadChange

************Drand****************// ChainNotify subscribe to chain head change event

func (*ChainInfoAPI) ChainSetHead

func (chainInfoAPI *ChainInfoAPI) ChainSetHead(ctx context.Context, key block.TipSetKey) error

ChainSetHead sets `key` as the new head of this chain iff it exists in the nodes chain store.

func (*ChainInfoAPI) GetActor

func (chainInfoAPI *ChainInfoAPI) GetActor(ctx context.Context, addr address.Address) (*types.Actor, error)

func (*ChainInfoAPI) GetEntry

func (chainInfoAPI *ChainInfoAPI) GetEntry(ctx context.Context, height abi.ChainEpoch, round uint64) (*block.BeaconEntry, error)

GetEntry retrieves an entry from the drand server

func (*ChainInfoAPI) GetFullBlock

func (chainInfoAPI *ChainInfoAPI) GetFullBlock(ctx context.Context, id cid.Cid) (*block.FullBlock, error)

func (*ChainInfoAPI) MessageWait

func (chainInfoAPI *ChainInfoAPI) MessageWait(ctx context.Context, msgCid cid.Cid, confidence, lookback abi.ChainEpoch) (*cst.ChainMessage, error)

MessageWait invokes the callback when a message with the given cid appears on chain. It will find the message in both the case that it is already on chain and the case that it appears in a newly mined block. An error is returned if one is encountered or if the context is canceled. Otherwise, it waits forever for the message to appear on chain.

func (*ChainInfoAPI) ProtocolParameters

func (chainInfoAPI *ChainInfoAPI) ProtocolParameters(ctx context.Context) (*ProtocolParams, error)

ProtocolParameters return chain parameters

func (*ChainInfoAPI) ResolveToKeyAddr

func (chainInfoAPI *ChainInfoAPI) ResolveToKeyAddr(ctx context.Context, addr address.Address, ts *block.TipSet) (address.Address, error)

ResolveToKeyAddr resolve user address to t0 address

func (*ChainInfoAPI) StateGetReceipt

func (chainInfoAPI *ChainInfoAPI) StateGetReceipt(ctx context.Context, msg cid.Cid, tsk block.TipSetKey) (*types.MessageReceipt, error)

func (*ChainInfoAPI) StateNetworkName

func (chainInfoAPI *ChainInfoAPI) StateNetworkName(ctx context.Context) (NetworkName, error)

func (*ChainInfoAPI) StateNetworkVersion

func (chainInfoAPI *ChainInfoAPI) StateNetworkVersion(ctx context.Context, tsk block.TipSetKey) (network.Version, error)

func (*ChainInfoAPI) StateSearchMsg

func (chainInfoAPI *ChainInfoAPI) StateSearchMsg(ctx context.Context, mCid cid.Cid) (*cst.MsgLookup, error)

func (*ChainInfoAPI) StateWaitMsg

func (chainInfoAPI *ChainInfoAPI) StateWaitMsg(ctx context.Context, mCid cid.Cid, confidence abi.ChainEpoch) (*cst.MsgLookup, error)

func (*ChainInfoAPI) VerifyEntry

func (chainInfoAPI *ChainInfoAPI) VerifyEntry(parent, child *block.BeaconEntry, height abi.ChainEpoch) bool

VerifyEntry verifies that child is a valid entry if its parent is.

type ChainSubmodule

type ChainSubmodule struct {
	ChainReader  *chain.Store
	MessageStore *chain.MessageStore
	State        *cst.ChainStateReadWriter

	Sampler    *chain.Sampler
	ActorState *appstate.TipSetStateViewer
	Processor  *consensus.DefaultProcessor

	StatusReporter *chain.StatusReporter

	Fork fork.IFork

	CheckPoint block.TipSetKey
	Drand      beacon.Schedule

	// Wait for confirm message
	Waiter *cst.Waiter
	// contains filtered or unexported fields
}

ChainSubmodule enhances the `Node` with chain capabilities.

func NewChainSubmodule

func NewChainSubmodule(config chainConfig,
	repo chainRepo,
	blockstore *blockstore.BlockstoreSubmodule,
	verifier ffiwrapper.Verifier,
) (*ChainSubmodule, error)

NewChainSubmodule creates a new chain submodule.

func (*ChainSubmodule) API

func (chain *ChainSubmodule) API() *ChainAPI

func (*ChainSubmodule) Start

func (chain *ChainSubmodule) Start(ctx context.Context) error

Start loads the chain from disk.

func (*ChainSubmodule) Stop

func (chain *ChainSubmodule) Stop(ctx context.Context)

type DbAPI

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

func NewDbAPI

func NewDbAPI(chain *ChainSubmodule) DbAPI

func (*DbAPI) ChainExport

func (dbAPI *DbAPI) ChainExport(ctx context.Context, head block.TipSetKey, out io.Writer) error

ChainExport exports the chain from `head` up to and including the genesis block to `out`

func (*DbAPI) ChainHasObj

func (dbAPI *DbAPI) ChainHasObj(ctx context.Context, ocid cid.Cid) (bool, error)

func (*DbAPI) ChainReadObj

func (dbAPI *DbAPI) ChainReadObj(ctx context.Context, ocid cid.Cid) ([]byte, error)

type Deadline

type Deadline struct {
	PostSubmissions bitfield.BitField
}

type MarketBalance

type MarketBalance struct {
	Escrow big.Int
	Locked big.Int
}

type MarketDeal

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

type MinerSectors

type MinerSectors struct {
	// Live sectors that should be proven.
	Live uint64
	// Sectors actively contributing to power.
	Active uint64
	// Sectors with failed proofs.
	Faulty uint64
}

type MinerStateAPI

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

func NewMinerStateAPI

func NewMinerStateAPI(chain *ChainSubmodule) MinerStateAPI

func (*MinerStateAPI) StateCirculatingSupply

func (minerStateAPI *MinerStateAPI) StateCirculatingSupply(ctx context.Context, tsk block.TipSetKey) (abi.TokenAmount, error)

func (*MinerStateAPI) StateListActors

func (minerStateAPI *MinerStateAPI) StateListActors(ctx context.Context, tsk block.TipSetKey) ([]address.Address, error)

func (*MinerStateAPI) StateListMiners

func (minerStateAPI *MinerStateAPI) StateListMiners(ctx context.Context, tsk block.TipSetKey) ([]address.Address, error)

func (*MinerStateAPI) StateLookupID

func (minerStateAPI *MinerStateAPI) StateLookupID(ctx context.Context, addr address.Address, tsk block.TipSetKey) (address.Address, error)

func (*MinerStateAPI) StateMarketBalance

func (minerStateAPI *MinerStateAPI) StateMarketBalance(ctx context.Context, addr address.Address, tsk block.TipSetKey) (MarketBalance, error)

func (*MinerStateAPI) StateMarketDeals

func (minerStateAPI *MinerStateAPI) StateMarketDeals(ctx context.Context, tsk block.TipSetKey) (map[string]pstate.MarketDeal, error)

func (*MinerStateAPI) StateMarketStorageDeal

func (minerStateAPI *MinerStateAPI) StateMarketStorageDeal(ctx context.Context, dealID abi.DealID, tsk block.TipSetKey) (*MarketDeal, error)

func (*MinerStateAPI) StateMinerActiveSectors

func (minerStateAPI *MinerStateAPI) StateMinerActiveSectors(ctx context.Context, maddr address.Address, tsk block.TipSetKey) ([]*miner.SectorOnChainInfo, error)

func (*MinerStateAPI) StateMinerAvailableBalance

func (minerStateAPI *MinerStateAPI) StateMinerAvailableBalance(ctx context.Context, maddr address.Address, tsk block.TipSetKey) (big.Int, error)

func (*MinerStateAPI) StateMinerDeadlines

func (minerStateAPI *MinerStateAPI) StateMinerDeadlines(ctx context.Context, maddr address.Address, tsk block.TipSetKey) ([]Deadline, error)

func (*MinerStateAPI) StateMinerFaults

func (minerStateAPI *MinerStateAPI) StateMinerFaults(ctx context.Context, maddr address.Address, tsk block.TipSetKey) (bitfield.BitField, error)

func (*MinerStateAPI) StateMinerInfo

func (minerStateAPI *MinerStateAPI) StateMinerInfo(ctx context.Context, maddr address.Address, tsk block.TipSetKey) (miner.MinerInfo, error)

func (*MinerStateAPI) StateMinerInitialPledgeCollateral

func (minerStateAPI *MinerStateAPI) StateMinerInitialPledgeCollateral(ctx context.Context, maddr address.Address, pci miner.SectorPreCommitInfo, tsk block.TipSetKey) (big.Int, error)

func (*MinerStateAPI) StateMinerPartitions

func (minerStateAPI *MinerStateAPI) StateMinerPartitions(ctx context.Context, maddr address.Address, dlIdx uint64, tsk block.TipSetKey) ([]Partition, error)

func (*MinerStateAPI) StateMinerPower

func (minerStateAPI *MinerStateAPI) StateMinerPower(ctx context.Context, addr address.Address, tsk block.TipSetKey) (*power.MinerPower, error)

func (*MinerStateAPI) StateMinerPreCommitDepositForPower

func (minerStateAPI *MinerStateAPI) StateMinerPreCommitDepositForPower(ctx context.Context, maddr address.Address, pci miner.SectorPreCommitInfo, tsk block.TipSetKey) (big.Int, error)

func (*MinerStateAPI) StateMinerProvingDeadline

func (minerStateAPI *MinerStateAPI) StateMinerProvingDeadline(ctx context.Context, maddr address.Address, tsk block.TipSetKey) (*dline.Info, error)

func (*MinerStateAPI) StateMinerRecoveries

func (minerStateAPI *MinerStateAPI) StateMinerRecoveries(ctx context.Context, maddr address.Address, tsk block.TipSetKey) (bitfield.BitField, error)

func (*MinerStateAPI) StateMinerSectorAllocated

func (minerStateAPI *MinerStateAPI) StateMinerSectorAllocated(ctx context.Context, maddr address.Address, s abi.SectorNumber, tsk block.TipSetKey) (bool, error)

func (*MinerStateAPI) StateMinerSectorCount

func (minerStateAPI *MinerStateAPI) StateMinerSectorCount(ctx context.Context, addr address.Address, tsk block.TipSetKey) (MinerSectors, error)

func (*MinerStateAPI) StateMinerSectorSize

func (minerStateAPI *MinerStateAPI) StateMinerSectorSize(ctx context.Context, maddr address.Address, tsk block.TipSetKey) (abi.SectorSize, error)

func (*MinerStateAPI) StateMinerSectors

func (minerStateAPI *MinerStateAPI) StateMinerSectors(ctx context.Context, maddr address.Address, sectorNos *bitfield.BitField, tsk block.TipSetKey) ([]*miner.SectorOnChainInfo, error)

func (*MinerStateAPI) StateMinerWorkerAddress

func (minerStateAPI *MinerStateAPI) StateMinerWorkerAddress(ctx context.Context, maddr address.Address, tsk block.TipSetKey) (address.Address, error)

func (*MinerStateAPI) StateSectorExpiration

func (minerStateAPI *MinerStateAPI) StateSectorExpiration(ctx context.Context, maddr address.Address, sectorNumber abi.SectorNumber, tsk block.TipSetKey) (*miner.SectorExpiration, error)

func (*MinerStateAPI) StateSectorGetInfo

func (minerStateAPI *MinerStateAPI) StateSectorGetInfo(ctx context.Context, maddr address.Address, n abi.SectorNumber, tsk block.TipSetKey) (*miner.SectorOnChainInfo, error)

func (*MinerStateAPI) StateSectorPartition

func (minerStateAPI *MinerStateAPI) StateSectorPartition(ctx context.Context, maddr address.Address, sectorNumber abi.SectorNumber, tsk block.TipSetKey) (*miner.SectorLocation, error)

func (*MinerStateAPI) StateSectorPreCommitInfo

func (minerStateAPI *MinerStateAPI) StateSectorPreCommitInfo(ctx context.Context, maddr address.Address, n abi.SectorNumber, tsk block.TipSetKey) (miner.SectorPreCommitOnChainInfo, error)

func (*MinerStateAPI) StateVMCirculatingSupplyInternal

func (minerStateAPI *MinerStateAPI) StateVMCirculatingSupplyInternal(ctx context.Context, tsk block.TipSetKey) (chain.CirculatingSupply, error)

type NetworkName

type NetworkName string

type Partition

type Partition struct {
	AllSectors        bitfield.BitField
	FaultySectors     bitfield.BitField
	RecoveringSectors bitfield.BitField
	LiveSectors       bitfield.BitField
	ActiveSectors     bitfield.BitField
}

type ProtocolParams

type ProtocolParams struct {
	Network          string
	BlockTime        time.Duration
	SupportedSectors []SectorInfo
}

ProtocolParams contains parameters that modify the filecoin nodes protocol

type SectorInfo

type SectorInfo struct {
	Size         abi.SectorSize
	MaxPieceSize abi.UnpaddedPieceSize
}

SectorInfo provides information about a sector construction

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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