abi

package
v0.13.1 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2024 License: Apache-2.0, MIT Imports: 17 Imported by: 1,280

Documentation

Index

Constants

View Source
const (
	RegisteredSealProof_StackedDrg2KiBV1   = RegisteredSealProof(0)
	RegisteredSealProof_StackedDrg8MiBV1   = RegisteredSealProof(1)
	RegisteredSealProof_StackedDrg512MiBV1 = RegisteredSealProof(2)
	RegisteredSealProof_StackedDrg32GiBV1  = RegisteredSealProof(3)
	RegisteredSealProof_StackedDrg64GiBV1  = RegisteredSealProof(4)

	RegisteredSealProof_StackedDrg2KiBV1_1   = RegisteredSealProof(5)
	RegisteredSealProof_StackedDrg8MiBV1_1   = RegisteredSealProof(6)
	RegisteredSealProof_StackedDrg512MiBV1_1 = RegisteredSealProof(7)
	RegisteredSealProof_StackedDrg32GiBV1_1  = RegisteredSealProof(8)
	RegisteredSealProof_StackedDrg64GiBV1_1  = RegisteredSealProof(9)

	RegisteredSealProof_StackedDrg2KiBV1_1_Feat_SyntheticPoRep   = RegisteredSealProof(10)
	RegisteredSealProof_StackedDrg8MiBV1_1_Feat_SyntheticPoRep   = RegisteredSealProof(11)
	RegisteredSealProof_StackedDrg512MiBV1_1_Feat_SyntheticPoRep = RegisteredSealProof(12)
	RegisteredSealProof_StackedDrg32GiBV1_1_Feat_SyntheticPoRep  = RegisteredSealProof(13)
	RegisteredSealProof_StackedDrg64GiBV1_1_Feat_SyntheticPoRep  = RegisteredSealProof(14)
)
View Source
const (
	RegisteredPoStProof_StackedDrgWinning2KiBV1   = RegisteredPoStProof(0)
	RegisteredPoStProof_StackedDrgWinning8MiBV1   = RegisteredPoStProof(1)
	RegisteredPoStProof_StackedDrgWinning512MiBV1 = RegisteredPoStProof(2)
	RegisteredPoStProof_StackedDrgWinning32GiBV1  = RegisteredPoStProof(3)
	RegisteredPoStProof_StackedDrgWinning64GiBV1  = RegisteredPoStProof(4)

	RegisteredPoStProof_StackedDrgWindow2KiBV1   = RegisteredPoStProof(5)
	RegisteredPoStProof_StackedDrgWindow8MiBV1   = RegisteredPoStProof(6)
	RegisteredPoStProof_StackedDrgWindow512MiBV1 = RegisteredPoStProof(7)
	RegisteredPoStProof_StackedDrgWindow32GiBV1  = RegisteredPoStProof(8)
	RegisteredPoStProof_StackedDrgWindow64GiBV1  = RegisteredPoStProof(9)

	RegisteredPoStProof_StackedDrgWindow2KiBV1_1   = RegisteredPoStProof(10)
	RegisteredPoStProof_StackedDrgWindow8MiBV1_1   = RegisteredPoStProof(11)
	RegisteredPoStProof_StackedDrgWindow512MiBV1_1 = RegisteredPoStProof(12)
	RegisteredPoStProof_StackedDrgWindow32GiBV1_1  = RegisteredPoStProof(13)
	RegisteredPoStProof_StackedDrgWindow64GiBV1_1  = RegisteredPoStProof(14)
)
View Source
const (
	RegisteredAggregationProof_SnarkPackV1 = RegisteredAggregationProof(0)
	RegisteredAggregationProof_SnarkPackV2 = RegisteredAggregationProof(1)
)
View Source
const (
	RegisteredUpdateProof_StackedDrg2KiBV1   = RegisteredUpdateProof(0)
	RegisteredUpdateProof_StackedDrg8MiBV1   = RegisteredUpdateProof(1)
	RegisteredUpdateProof_StackedDrg512MiBV1 = RegisteredUpdateProof(2)
	RegisteredUpdateProof_StackedDrg32GiBV1  = RegisteredUpdateProof(3)
	RegisteredUpdateProof_StackedDrg64GiBV1  = RegisteredUpdateProof(4)
)
View Source
const MaxSectorNumber = math.MaxInt64

The maximum assignable sector number. Raising this would require modifying our AMT implementation.

View Source
const RandomnessLength = 32

RandomnessLength is the length of the randomness slice.

Variables

View Source
var (
	// HashFunction is the default hash function for computing CIDs.
	//
	// This is currently Blake2b-256.
	HashFunction = uint64(mh.BLAKE2B_MIN + 31)

	// When producing a CID for an IPLD block less than or equal to CIDInlineLimit
	// bytes in length, the identity hash function will be used instead of
	// HashFunction. This will effectively "inline" the block into the CID, allowing
	// it to be extracted directly from the CID with no disk/network operations.
	//
	// This is currently -1 for "disabled".
	//
	// This is exposed for testing. Do not modify unless you know what you're doing.
	CIDInlineLimit = -1
)
View Source
var CidBuilder cid.Builder = cidBuilder{/* contains filtered or unexported fields */}

CidBuilder is the default CID builder for Filecoin.

- The default codec is CBOR. This can be changed with CidBuilder.WithCodec. - The default hash function is 256bit blake2b.

View Source
var SealProofInfos = map[RegisteredSealProof]*SealProofInfo{
	RegisteredSealProof_StackedDrg2KiBV1: {
		ProofSize:        192,
		SectorSize:       ss2KiB,
		WinningPoStProof: RegisteredPoStProof_StackedDrgWinning2KiBV1,
		WindowPoStProof:  RegisteredPoStProof_StackedDrgWindow2KiBV1,
		UpdateProof:      RegisteredUpdateProof_StackedDrg2KiBV1,
	},

	RegisteredSealProof_StackedDrg8MiBV1: {
		ProofSize:        192,
		SectorSize:       ss8MiB,
		WinningPoStProof: RegisteredPoStProof_StackedDrgWinning8MiBV1,
		WindowPoStProof:  RegisteredPoStProof_StackedDrgWindow8MiBV1,
		UpdateProof:      RegisteredUpdateProof_StackedDrg8MiBV1,
	},
	RegisteredSealProof_StackedDrg512MiBV1: {
		ProofSize:        192,
		SectorSize:       ss512MiB,
		WinningPoStProof: RegisteredPoStProof_StackedDrgWinning512MiBV1,
		WindowPoStProof:  RegisteredPoStProof_StackedDrgWindow512MiBV1,
		UpdateProof:      RegisteredUpdateProof_StackedDrg512MiBV1,
	},
	RegisteredSealProof_StackedDrg32GiBV1: {
		ProofSize:        1920,
		SectorSize:       ss32GiB,
		WinningPoStProof: RegisteredPoStProof_StackedDrgWinning32GiBV1,
		WindowPoStProof:  RegisteredPoStProof_StackedDrgWindow32GiBV1,
		UpdateProof:      RegisteredUpdateProof_StackedDrg32GiBV1,
	},
	RegisteredSealProof_StackedDrg64GiBV1: {
		ProofSize:        1920,
		SectorSize:       ss64GiB,
		WinningPoStProof: RegisteredPoStProof_StackedDrgWinning64GiBV1,
		WindowPoStProof:  RegisteredPoStProof_StackedDrgWindow64GiBV1,
		UpdateProof:      RegisteredUpdateProof_StackedDrg64GiBV1,
	},

	RegisteredSealProof_StackedDrg2KiBV1_1: {
		ProofSize:        192,
		SectorSize:       ss2KiB,
		WinningPoStProof: RegisteredPoStProof_StackedDrgWinning2KiBV1,
		WindowPoStProof:  RegisteredPoStProof_StackedDrgWindow2KiBV1,
		UpdateProof:      RegisteredUpdateProof_StackedDrg2KiBV1,
	},
	RegisteredSealProof_StackedDrg8MiBV1_1: {
		ProofSize:        192,
		SectorSize:       ss8MiB,
		WinningPoStProof: RegisteredPoStProof_StackedDrgWinning8MiBV1,
		WindowPoStProof:  RegisteredPoStProof_StackedDrgWindow8MiBV1,
		UpdateProof:      RegisteredUpdateProof_StackedDrg8MiBV1,
	},
	RegisteredSealProof_StackedDrg512MiBV1_1: {
		ProofSize:        192,
		SectorSize:       ss512MiB,
		WinningPoStProof: RegisteredPoStProof_StackedDrgWinning512MiBV1,
		WindowPoStProof:  RegisteredPoStProof_StackedDrgWindow512MiBV1,
		UpdateProof:      RegisteredUpdateProof_StackedDrg512MiBV1,
	},
	RegisteredSealProof_StackedDrg32GiBV1_1: {
		ProofSize:        1920,
		SectorSize:       ss32GiB,
		WinningPoStProof: RegisteredPoStProof_StackedDrgWinning32GiBV1,
		WindowPoStProof:  RegisteredPoStProof_StackedDrgWindow32GiBV1,
		UpdateProof:      RegisteredUpdateProof_StackedDrg32GiBV1,
	},
	RegisteredSealProof_StackedDrg64GiBV1_1: {
		ProofSize:        1920,
		SectorSize:       ss64GiB,
		WinningPoStProof: RegisteredPoStProof_StackedDrgWinning64GiBV1,
		WindowPoStProof:  RegisteredPoStProof_StackedDrgWindow64GiBV1,
		UpdateProof:      RegisteredUpdateProof_StackedDrg64GiBV1,
	},
	RegisteredSealProof_StackedDrg2KiBV1_1_Feat_SyntheticPoRep: {
		ProofSize:        192,
		SectorSize:       ss2KiB,
		WinningPoStProof: RegisteredPoStProof_StackedDrgWinning2KiBV1,
		WindowPoStProof:  RegisteredPoStProof_StackedDrgWindow2KiBV1,
		UpdateProof:      RegisteredUpdateProof_StackedDrg2KiBV1,
	},
	RegisteredSealProof_StackedDrg8MiBV1_1_Feat_SyntheticPoRep: {
		ProofSize:        192,
		SectorSize:       ss8MiB,
		WinningPoStProof: RegisteredPoStProof_StackedDrgWinning8MiBV1,
		WindowPoStProof:  RegisteredPoStProof_StackedDrgWindow8MiBV1,
		UpdateProof:      RegisteredUpdateProof_StackedDrg8MiBV1,
	},
	RegisteredSealProof_StackedDrg512MiBV1_1_Feat_SyntheticPoRep: {
		ProofSize:        192,
		SectorSize:       ss512MiB,
		WinningPoStProof: RegisteredPoStProof_StackedDrgWinning512MiBV1,
		WindowPoStProof:  RegisteredPoStProof_StackedDrgWindow512MiBV1,
		UpdateProof:      RegisteredUpdateProof_StackedDrg512MiBV1,
	},
	RegisteredSealProof_StackedDrg32GiBV1_1_Feat_SyntheticPoRep: {
		ProofSize:        1920,
		SectorSize:       ss32GiB,
		WinningPoStProof: RegisteredPoStProof_StackedDrgWinning32GiBV1,
		WindowPoStProof:  RegisteredPoStProof_StackedDrgWindow32GiBV1,
		UpdateProof:      RegisteredUpdateProof_StackedDrg32GiBV1,
	},
	RegisteredSealProof_StackedDrg64GiBV1_1_Feat_SyntheticPoRep: {
		ProofSize:        1920,
		SectorSize:       ss64GiB,
		WinningPoStProof: RegisteredPoStProof_StackedDrgWinning64GiBV1,
		WindowPoStProof:  RegisteredPoStProof_StackedDrgWindow64GiBV1,
		UpdateProof:      RegisteredUpdateProof_StackedDrg64GiBV1,
	},
}

Functions

func AddressValidForNetworkVersion added in v0.9.9

func AddressValidForNetworkVersion(addr address.Address, nv network.Version) bool

AddressValidForNetworkVersion returns true if the address is supported by the given network version.

NOTE: It will _also_ return true if the address is "empty", because all versions support empty addresses in some places. I.e., it's not a version specific check.

func IntKey

func IntKey(k int64) intKey

noinspection GoExportedFuncWithUnexportedType

func ParseIntKey

func ParseIntKey(k string) (int64, error)

noinspection GoUnusedExportedFunction

func ParseUIntKey

func ParseUIntKey(k string) (uint64, error)

func UIntKey

func UIntKey(k uint64) uintKey

noinspection GoExportedFuncWithUnexportedType

Types

type ActorID

type ActorID uint64

A sequential number assigned to an actor when created by the InitActor. This ID is embedded in ID-type addresses.

func (ActorID) String

func (e ActorID) String() string

type AddrKey

type AddrKey address.Address

Adapts an address as a mapping key.

func (AddrKey) Key

func (k AddrKey) Key() string

type AddrPairKey added in v0.1.2

type AddrPairKey struct {
	First  address.Address
	Second address.Address
}

Adapts an address tuple as a mapping key.

func NewAddrPairKey added in v0.1.2

func NewAddrPairKey(first address.Address, second address.Address) *AddrPairKey

func (*AddrPairKey) Key added in v0.1.2

func (k *AddrPairKey) Key() string

func (*AddrPairKey) MarshalCBOR added in v0.1.3

func (t *AddrPairKey) MarshalCBOR(w io.Writer) error

func (*AddrPairKey) UnmarshalCBOR added in v0.1.3

func (t *AddrPairKey) UnmarshalCBOR(r io.Reader) (err error)

type CborBytes added in v0.10.0

type CborBytes []byte

func (*CborBytes) MarshalCBOR added in v0.10.0

func (t *CborBytes) MarshalCBOR(w io.Writer) error

func (*CborBytes) UnmarshalCBOR added in v0.10.0

func (t *CborBytes) UnmarshalCBOR(r io.Reader) error

type CborBytesTransparent added in v0.10.0

type CborBytesTransparent []byte

CborBytesTransparent NOTE This struct does not create a valid cbor-encoded byte slice. It just passes the bytes through as-is.

func (*CborBytesTransparent) MarshalCBOR added in v0.10.0

func (t *CborBytesTransparent) MarshalCBOR(w io.Writer) error

MarshalCBOR Does NOT marshall to a cbor-encoding. This is just syntactic sugar to let us pass bytes transparently through lotus which requires a cbor-marshallable object.

func (*CborBytesTransparent) UnmarshalCBOR added in v0.10.0

func (t *CborBytesTransparent) UnmarshalCBOR(r io.Reader) error

UnmarshalCBOR CANNOT read a cbor-encoded byte slice. This will just transparently pass the underlying bytes. This method is also risky, as it reads unboundedly. Do NOT use it for anything vulnerable.

type CborString added in v0.9.0

type CborString string

func (*CborString) MarshalCBOR added in v0.9.0

func (t *CborString) MarshalCBOR(w io.Writer) error

func (*CborString) UnmarshalCBOR added in v0.9.0

func (t *CborString) UnmarshalCBOR(r io.Reader) error

type ChainEpoch

type ChainEpoch int64

Epoch number of the chain state, which acts as a proxy for time within the VM.

func (ChainEpoch) String

func (e ChainEpoch) String() string

type CidKey

type CidKey cid.Cid

func (CidKey) Key

func (k CidKey) Key() string

type DealID

type DealID uint64

type DealWeight

type DealWeight = big.Int // units: byte-epochs

BigInt types are aliases rather than new types because the latter introduce incredible amounts of noise converting to and from types in order to manipulate values. We give up some type safety for ergonomics.

type EmptyValue

type EmptyValue struct{}

The empty value represents absence of a value. It is used for parameter and return types for actor methods that don't take/return any data. This saves a byte in serialization of messages and receipts: the serialized form is an empty byte slice, rather than a byte slice containing a single byte CBOR encoding of nil/empty/etc.

The only expected use of this is as the type of a nil reference. Don't instantiate this type.

This is primarily necessary due to Go's lack of a void type and our interface-based serialization scheme.

var Empty *EmptyValue = nil

A typed nil pointer to EmptyValue.

func (*EmptyValue) MarshalCBOR

func (v *EmptyValue) MarshalCBOR(_ io.Writer) error

func (*EmptyValue) UnmarshalCBOR

func (v *EmptyValue) UnmarshalCBOR(_ io.Reader) error

type IdAddrKey added in v0.1.12

type IdAddrKey address.Address

func (IdAddrKey) Key added in v0.1.12

func (k IdAddrKey) Key() string

type InteractiveSealRandomness

type InteractiveSealRandomness Randomness

type Keyer

type Keyer interface {
	Key() string
}

Keyer defines an interface required to put values in mapping.

type MethodNum

type MethodNum uint64

MethodNum is an integer that represents a particular method in an actor's function table. These numbers are used to compress invocation of actor code, and to decouple human language concerns about method names from the ability to uniquely refer to a particular method.

Consider MethodNum numbers to be similar in concerns as for offsets in function tables (in programming languages), and for tags in ProtocolBuffer fields. Tags in ProtocolBuffers recommend assigning a unique tag to a field and never reusing that tag. If a field is no longer used, the field name may change but should still remain defined in the code to ensure the tag number is not reused accidentally. The same should apply to the MethodNum associated with methods in Filecoin VM Actors.

func (MethodNum) String

func (e MethodNum) String() string

type Multiaddrs

type Multiaddrs = []byte

Multiaddrs is a byte array representing a Libp2p MultiAddress

type PaddedPieceSize

type PaddedPieceSize uint64

func (PaddedPieceSize) Unpadded

func (s PaddedPieceSize) Unpadded() UnpaddedPieceSize

func (PaddedPieceSize) Validate

func (s PaddedPieceSize) Validate() error

type PeerID

type PeerID = []byte

PeerID is a byte array representing a Libp2p PeerID

type PieceInfo

type PieceInfo struct {
	Size     PaddedPieceSize // Size in nodes. For BLS12-381 (capacity 254 bits), must be >= 16. (16 * 8 = 128)
	PieceCID cid.Cid
}

func (*PieceInfo) MarshalCBOR

func (t *PieceInfo) MarshalCBOR(w io.Writer) error

func (*PieceInfo) UnmarshalCBOR

func (t *PieceInfo) UnmarshalCBOR(r io.Reader) (err error)

type PoStProofInfo

type PoStProofInfo struct {
	SectorSize SectorSize

	// Size of a single proof.
	ProofSize uint64
}

Metadata about a PoSt proof type.

type PoStRandomness

type PoStRandomness Randomness

type ProverID added in v0.12.0

type ProverID [32]byte

func MakeProverID added in v0.12.0

func MakeProverID(e ActorID) (ProverID, error)

ProverID returns a 32 byte proverID used when computing ReplicaID

type Randomness

type Randomness []byte

Randomness is a string of random bytes

type RegisteredAggregationProof added in v0.1.1

type RegisteredAggregationProof int64

type RegisteredPoStProof

type RegisteredPoStProof int64

func (RegisteredPoStProof) ProofSize

func (p RegisteredPoStProof) ProofSize() (uint64, error)

ProofSize returns the size of window post proofs for the given sector type.

func (RegisteredPoStProof) SectorSize

func (p RegisteredPoStProof) SectorSize() (SectorSize, error)

func (RegisteredPoStProof) ToV1_1PostProof added in v0.11.0

func (r RegisteredPoStProof) ToV1_1PostProof() (RegisteredPoStProof, error)

type RegisteredSealProof

type RegisteredSealProof int64

These enumerations must match the proofs library and never change.

func (RegisteredSealProof) PoRepID added in v0.12.0

func (p RegisteredSealProof) PoRepID() ([32]byte, error)

PoRepID produces the porep_id for this RegisteredSealProof. Mainly used for computing replica_id.

func (RegisteredSealProof) ProofSize

func (p RegisteredSealProof) ProofSize() (uint64, error)

ProofSize returns the size of seal proofs for the given sector type.

func (RegisteredSealProof) RegisteredUpdateProof added in v0.1.1

func (p RegisteredSealProof) RegisteredUpdateProof() (RegisteredUpdateProof, error)

RegisteredUpdateProof produces the Update-specific RegisteredProof corresponding to the receiving RegisteredProof.

func (RegisteredSealProof) RegisteredWindowPoStProof

func (p RegisteredSealProof) RegisteredWindowPoStProof() (RegisteredPoStProof, error)

RegisteredWindowPoStProof produces the V1 PoSt-specific RegisteredPoStProof corresponding to the receiving RegisteredSealProof.

func (RegisteredSealProof) RegisteredWindowPoStProofByNetworkVersion added in v0.11.0

func (p RegisteredSealProof) RegisteredWindowPoStProofByNetworkVersion(nv network.Version) (RegisteredPoStProof, error)

RegisteredWindowPoStProofByNetworkVersion produces the V1 PoSt-specific RegisteredPoStProof corresponding to the receiving RegisteredSealProof. Before nv19, the V1 Proof is returned, from nv19 onwards the v1_1 proof is returned.

func (RegisteredSealProof) RegisteredWinningPoStProof

func (p RegisteredSealProof) RegisteredWinningPoStProof() (RegisteredPoStProof, error)

RegisteredWinningPoStProof produces the PoSt-specific RegisteredProof corresponding to the receiving RegisteredProof.

func (RegisteredSealProof) ReplicaId added in v0.12.0

func (p RegisteredSealProof) ReplicaId(prover ActorID, sector SectorNumber, ticket []byte, commd []byte) ([32]byte, error)

ReplicaId produces the replica_id for this RegisteredSealProof. This is used as the main input for computing SDR

func (RegisteredSealProof) SectorSize

func (p RegisteredSealProof) SectorSize() (SectorSize, error)

type RegisteredUpdateProof added in v0.1.1

type RegisteredUpdateProof int64

type SealProofInfo

type SealProofInfo struct {
	// The proof sizes are 192 * the number of "porep" partitions.
	// https://github.com/filecoin-project/rust-fil-proofs/blob/64390b6fcedb04dd1fdbe43c82b1e91c1439cea2/filecoin-proofs/src/constants.rs#L68-L80
	ProofSize        uint64
	SectorSize       SectorSize
	WinningPoStProof RegisteredPoStProof
	WindowPoStProof  RegisteredPoStProof
	UpdateProof      RegisteredUpdateProof
}

Metadata about a seal proof type.

type SealRandomness

type SealRandomness Randomness

type SectorID

type SectorID struct {
	Miner  ActorID
	Number SectorNumber
}

func (*SectorID) MarshalCBOR

func (t *SectorID) MarshalCBOR(w io.Writer) error

func (*SectorID) UnmarshalCBOR

func (t *SectorID) UnmarshalCBOR(r io.Reader) (err error)

type SectorNumber

type SectorNumber uint64

SectorNumber is a numeric identifier for a sector. It is usually relative to a miner.

func (SectorNumber) String

func (s SectorNumber) String() string

type SectorQuality

type SectorQuality = big.Int

type SectorSize

type SectorSize uint64

SectorSize indicates one of a set of possible sizes in the network. Ideally, SectorSize would be an enum

type SectorSize enum {
  1KiB = 1024
  1MiB = 1048576
  1GiB = 1073741824
  1TiB = 1099511627776
  1PiB = 1125899906842624
  1EiB = 1152921504606846976
  max  = 18446744073709551615
}

func (SectorSize) ShortString

func (s SectorSize) ShortString() string

Abbreviates the size as a human-scale number. This approximates (truncates) the size unless it is a power of 1024.

func (SectorSize) String

func (s SectorSize) String() string

Formats the size as a decimal string.

type StoragePower

type StoragePower = big.Int

The unit of storage power (measured in bytes)

func NewStoragePower

func NewStoragePower(n int64) StoragePower

type TokenAmount

type TokenAmount = big.Int

TokenAmount is an amount of Filecoin tokens. This type is used within the VM in message execution, to account movement of tokens, payment of VM gas, and more.

BigInt types are aliases rather than new types because the latter introduce incredible amounts of noise converting to and from types in order to manipulate values. We give up some type safety for ergonomics.

func NewTokenAmount

func NewTokenAmount(t int64) TokenAmount

type UnpaddedPieceSize

type UnpaddedPieceSize uint64

UnpaddedPieceSize is the size of a piece, in bytes

func (UnpaddedPieceSize) Padded

func (UnpaddedPieceSize) Validate

func (s UnpaddedPieceSize) Validate() error

Jump to

Keyboard shortcuts

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