ffi

package module
v0.1.1-0...-18d26dc Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2021 License: Apache-2.0, MIT Imports: 5 Imported by: 0

README

Filecoin FFI stub

For testing and non-production purposes only.

This is an FFI stub that can be used with a go.mod replace directive in tests that do not require real proofs.

Usage

In your go.mod:

replace github.com/filecoin-project/filecoin-ffi => github.com/filecoin-project/ffi-stub v0.1.0

License

Dual-licensed: MIT, Apache Software License v2, by way of the Permissive License Stack.

Documentation

Index

Constants

View Source
const DigestBytes = 96

DigestBytes is the length of a BLS message hash/digest

View Source
const PrivateKeyBytes = 32

PrivateKeyBytes is the length of a BLS private key

View Source
const PublicKeyBytes = 48

PublicKeyBytes is the length of a BLS public key

View Source
const SignatureBytes = 96

SignatureBytes is the length of a BLS signature

Variables

This section is empty.

Functions

func AggregateSealProofs

func AggregateSealProofs(proof5.AggregateSealVerifyProofAndInfos, [][]byte) (out []byte, err error)

func ClearCache

func ClearCache(uint64, string) error

func FauxRep

func FauxRep(abi.RegisteredSealProof, string, string) (cid.Cid, error)

func GeneratePieceCIDFromFile

func GeneratePieceCIDFromFile(_ abi.RegisteredSealProof, _ io.Reader, _ abi.UnpaddedPieceSize) (cid.Cid, error)

func GenerateSingleVanillaProof

func GenerateSingleVanillaProof(replica PrivateSectorInfo, challange []uint64) ([]byte, error)

func GenerateUnsealedCID

func GenerateUnsealedCID(_ abi.RegisteredSealProof, _ []abi.PieceInfo) (cid.Cid, error)

func GetGPUDevices

func GetGPUDevices() ([]string, error)

func HashVerify

func HashVerify(signature *Signature, messages []Message, publicKeys []PublicKey) bool

func SealCommitPhase2

func SealCommitPhase2([]byte, abi.SectorNumber, abi.ActorID) ([]byte, error)

func SealPreCommitPhase1

func SealPreCommitPhase1(_ abi.RegisteredSealProof, _, _, _ string, _ abi.SectorNumber, _ abi.ActorID, _ abi.SealRandomness, _ []abi.PieceInfo) ([]byte, error)

func SealPreCommitPhase2

func SealPreCommitPhase2(_ []byte, _, _ string) (cid.Cid, cid.Cid, error)

func UnsealRange

func UnsealRange(_ abi.RegisteredSealProof, _ string, _, _ *os.File, _ abi.SectorNumber, _ abi.ActorID, _ abi.SealRandomness, _ cid.Cid, _, _ uint64) error

func Verify

func Verify(signature *Signature, digests []Digest, publicKeys []PublicKey) bool

func VerifySeal

func VerifySeal(proof5.SealVerifyInfo) (bool, error)

func VerifyWindowPoSt

func VerifyWindowPoSt(proof5.WindowPoStVerifyInfo) (bool, error)

func VerifyWinningPoSt

func VerifyWinningPoSt(proof5.WinningPoStVerifyInfo) (bool, error)

Types

type Digest

type Digest [DigestBytes]byte

Digest is a compressed affine

func Hash

func Hash(message Message) Digest

type FallbackChallenges

type FallbackChallenges struct {
	Sectors    []abi.SectorNumber
	Challenges map[abi.SectorNumber][]uint64
}

func GeneratePoStFallbackSectorChallenges

func GeneratePoStFallbackSectorChallenges(proofType abi.RegisteredPoStProof, minerID abi.ActorID, randomness abi.PoStRandomness, sectorIds []abi.SectorNumber) (*FallbackChallenges, error)

type Message

type Message []byte

Message is a byte slice

type PrivateKey

type PrivateKey [PrivateKeyBytes]byte

PrivateKey is a compressed affine

func PrivateKeyGenerate

func PrivateKeyGenerate() PrivateKey

func PrivateKeyGenerateWithSeed

func PrivateKeyGenerateWithSeed(seed PrivateKeyGenSeed) PrivateKey

type PrivateKeyGenSeed

type PrivateKeyGenSeed [32]byte

Used when generating a private key deterministically

type PrivateSectorInfo

type PrivateSectorInfo struct {
	abi.SectorNumber
	CacheDirPath     string
	PoStProofType    abi.RegisteredPoStProof
	SealedSectorPath string
	SectorInfo       proof5.SectorInfo
}

type PublicKey

type PublicKey [PublicKeyBytes]byte

PublicKey is a compressed affine

func PrivateKeyPublicKey

func PrivateKeyPublicKey(privateKey PrivateKey) PublicKey

type Signature

type Signature [SignatureBytes]byte

Signature is a compressed affine

func Aggregate

func Aggregate(signatures []Signature) *Signature

func CreateZeroSignature

func CreateZeroSignature() Signature

func PrivateKeySign

func PrivateKeySign(privateKey PrivateKey, message Message) *Signature

type SortedPrivateSectorInfo

type SortedPrivateSectorInfo struct{ abi.SectorNumber }

func NewSortedPrivateSectorInfo

func NewSortedPrivateSectorInfo(...PrivateSectorInfo) SortedPrivateSectorInfo

Jump to

Keyboard shortcuts

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