proof

package
v1.23.1 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2024 License: Apache-2.0, MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const CommPBuf = abi.UnpaddedPieceSize(commPBufPad - (commPBufPad / 128)) // can't use .Unpadded() for const
View Source
const NODE_SIZE = 32

Variables

This section is empty.

Functions

func BuildTreeD

func BuildTreeD(data io.Reader, unpaddedData bool, outPath string, size abi.PaddedPieceSize) (_ cid.Cid, err error)

func DecodeHasherDomain added in v1.23.1

func DecodeHasherDomain[H HasherDomain](r io.Reader) (H, error)

func DeriveInteractiveChallenges added in v1.23.1

func DeriveInteractiveChallenges(
	challengesPerPartition uint64,
	sectorNnodes SectorNodes,
	ReplicaID Commitment,
	Seed Ticket,
	k uint8,
) []uint64

func EncodeLabels added in v1.23.1

func EncodeLabels(w io.Writer, labels TAuxLabels) error

func EncodeStoreConfig added in v1.23.1

func EncodeStoreConfig(w io.Writer, sc StoreConfig) error

func EncodeTAux added in v1.23.1

func EncodeTAux(w io.Writer, taux TemporaryAux) error

func EnsureTauxForType added in v1.23.1

func EnsureTauxForType(spt abi.RegisteredSealProof, path string) error

EnsureTauxForType ensures that the t_aux file exists in the specified path for the specified seal proof type. If the file does not exist, it will be created with the default values for the specified seal proof type.

func ReadLE added in v1.23.1

func ReadLE[T any](r io.Reader) (T, error)

func ReadString added in v1.23.1

func ReadString(r io.Reader) (string, error)

func WriteLE added in v1.23.1

func WriteLE[T any](w io.Writer, data T) error

func WriteString added in v1.23.1

func WriteString(w io.Writer, s string) error

Types

type Column added in v1.23.1

type Column[H HasherDomain] struct {
	Index uint32 `json:"index"`
	Rows  []H    `json:"rows"`
	H     any    `json:"_h"`
}

func DecodeColumn added in v1.23.1

func DecodeColumn[H HasherDomain](r io.Reader) (Column[H], error)

type ColumnProof added in v1.23.1

type ColumnProof[H HasherDomain] struct {
	Column         Column[H]      `json:"column"`
	InclusionProof MerkleProof[H] `json:"inclusion_proof"`
}

func DecodeColumnProof added in v1.23.1

func DecodeColumnProof[H HasherDomain](r io.Reader) (ColumnProof[H], error)

type Commit1OutRaw added in v1.23.1

type Commit1OutRaw struct {
	CommD           Commitment                `json:"comm_d"`
	CommR           Commitment                `json:"comm_r"`
	RegisteredProof StringRegisteredProofType `json:"registered_proof"`
	ReplicaID       Commitment                `json:"replica_id"`
	Seed            Ticket                    `json:"seed"`
	Ticket          Ticket                    `json:"ticket"`

	// ProofType -> [partitions] -> [challenge_index?] -> Proof
	VanillaProofs map[StringRegisteredProofType][][]VanillaStackedProof `json:"vanilla_proofs"`
}

func DecodeCommit1OutRaw added in v1.23.1

func DecodeCommit1OutRaw(r io.Reader) (Commit1OutRaw, error)

type Commitment added in v1.23.1

type Commitment [32]byte

func DecodeCommitment added in v1.23.1

func DecodeCommitment(r io.Reader) (Commitment, error)

type DataCIDSize added in v1.23.1

type DataCIDSize struct {
	PayloadSize int64
	PieceSize   abi.PaddedPieceSize
	PieceCID    cid.Cid
}

type DataCidWriter added in v1.23.1

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

DataCidWriter is used as follows:

cc := new(DataCidWriter) _, err = io.Copy(cc, f) dc, err := cc.Sum()

This computes CommP / PieceCID from a stream, also returns piece and payload sizes.

func (*DataCidWriter) Sum added in v1.23.1

func (w *DataCidWriter) Sum() (DataCIDSize, error)

func (*DataCidWriter) Write added in v1.23.1

func (w *DataCidWriter) Write(p []byte) (int, error)

type EncodingProof added in v1.23.1

type EncodingProof[H HasherDomain] struct {
	Parents    []H    `json:"parents"`
	LayerIndex uint32 `json:"layer_index"`
	Node       uint64 `json:"node"`
}

func DecodeEncodingProof added in v1.23.1

func DecodeEncodingProof[H HasherDomain](r io.Reader) (EncodingProof[H], error)

type HasherDomain added in v1.23.1

type HasherDomain = any

type InclusionPath added in v1.23.1

type InclusionPath[H HasherDomain] struct {
	Path []PathElement[H] `json:"path"`
}

func DecodeInclusionPath added in v1.23.1

func DecodeInclusionPath[H HasherDomain](r io.Reader) (InclusionPath[H], error)

type Label added in v1.23.1

type Label struct {
	ID            string `json:"id"`
	Path          string `json:"path"`
	RowsToDiscard int    `json:"rows_to_discard"`
	Size          int    `json:"size"`
}

type LabelingProof added in v1.23.1

type LabelingProof[H HasherDomain] struct {
	Parents    []H    `json:"parents"`
	LayerIndex uint32 `json:"layer_index"`
	Node       uint64 `json:"node"`
}

func DecodeLabelingProof added in v1.23.1

func DecodeLabelingProof[H HasherDomain](r io.Reader) (LabelingProof[H], error)

type Labels added in v1.23.1

type Labels struct {
	H      any     `json:"_h"` // todo ?
	Labels []Label `json:"labels"`
}

type MerkleProof added in v1.23.1

type MerkleProof[H HasherDomain] struct {
	Data ProofData[H] `json:"data"`
}

func DecodeMerkleProof added in v1.23.1

func DecodeMerkleProof[H HasherDomain](r io.Reader) (MerkleProof[H], error)

type PathElement added in v1.23.1

type PathElement[H HasherDomain] struct {
	Hashes []H    `json:"hashes"`
	Index  uint64 `json:"index"`
}

func DecodePathElement added in v1.23.1

func DecodePathElement[H HasherDomain](r io.Reader) (PathElement[H], error)

type PoseidonDomain added in v1.23.1

type PoseidonDomain [32]byte // Fr

type PreCommit1OutRaw added in v1.23.1

type PreCommit1OutRaw struct {
	LotusSealRand []byte `json:"_lotus_SealRandomness"`

	CommD           Commitment                           `json:"comm_d"`
	Config          Label                                `json:"config"`
	Labels          map[StringRegisteredProofType]Labels `json:"labels"`
	RegisteredProof StringRegisteredProofType            `json:"registered_proof"`
}

type ProofData added in v1.23.1

type ProofData[H HasherDomain] struct {
	Single *SingleProof[H] `json:"Single,omitempty"`
	Sub    *SubProof[H]    `json:"Sub,omitempty"`
	Top    *TopProof[H]    `json:"Top,omitempty"`
}

func DecodeProofData added in v1.23.1

func DecodeProofData[H HasherDomain](r io.Reader) (ProofData[H], error)

type ReplicaColumnProof added in v1.23.1

type ReplicaColumnProof[H HasherDomain] struct {
	C_X        ColumnProof[H]   `json:"c_x"`
	DrgParents []ColumnProof[H] `json:"drg_parents"`
	ExpParents []ColumnProof[H] `json:"exp_parents"`
}

func DecodeReplicaColumnProof added in v1.23.1

func DecodeReplicaColumnProof[H HasherDomain](r io.Reader) (ReplicaColumnProof[H], error)

type SectorNodes added in v1.23.1

type SectorNodes uint64

SectorNodes is sector size as node count

type Sha256Domain added in v1.23.1

type Sha256Domain [32]byte

type SingleProof added in v1.23.1

type SingleProof[H HasherDomain] struct {
	Root H                `json:"root"`
	Leaf H                `json:"leaf"`
	Path InclusionPath[H] `json:"path"`
}

func DecodeSingleProof added in v1.23.1

func DecodeSingleProof[H HasherDomain](r io.Reader) (SingleProof[H], error)

type StoreConfig added in v1.23.1

type StoreConfig struct {
	// A directory in which data (a merkle tree) can be persisted.
	Path string

	// A unique identifier used to help specify the on-disk store location for this particular data.
	ID string

	// The number of elements in the DiskStore. This field is optional, and unused internally.
	Size *uint64

	// The number of merkle tree rows_to_discard then cache on disk.
	RowsToDiscard uint64
}

func DecodeStoreConfig added in v1.23.1

func DecodeStoreConfig(r io.Reader) (StoreConfig, error)

type StringRegisteredProofType added in v1.23.1

type StringRegisteredProofType string // e.g. "StackedDrg2KiBV1"

type SubProof added in v1.23.1

type SubProof[H HasherDomain] struct {
	BaseProof InclusionPath[H] `json:"base_proof"`
	SubProof  InclusionPath[H] `json:"sub_proof"`
	Root      H                `json:"root"`
	Leaf      H                `json:"leaf"`
}

func DecodeSubProof added in v1.23.1

func DecodeSubProof[H HasherDomain](r io.Reader) (SubProof[H], error)

type TAuxLabels added in v1.23.1

type TAuxLabels struct {
	Labels []StoreConfig
}

func DecodeLabels added in v1.23.1

func DecodeLabels(r io.Reader) (*TAuxLabels, error)

type TemporaryAux added in v1.23.1

type TemporaryAux struct {
	Labels      TAuxLabels
	TreeDConfig StoreConfig
	TreeRConfig StoreConfig
	TreeCConfig StoreConfig
}

func DecodeTAux added in v1.23.1

func DecodeTAux(r io.Reader) (*TemporaryAux, error)

type Ticket added in v1.23.1

type Ticket [32]byte

func DecodeTicket added in v1.23.1

func DecodeTicket(r io.Reader) (Ticket, error)

type TopProof added in v1.23.1

type TopProof[H HasherDomain] struct {
	BaseProof InclusionPath[H] `json:"base_proof"`
	SubProof  InclusionPath[H] `json:"sub_proof"`
	TopProof  InclusionPath[H] `json:"top_proof"`

	Root H `json:"root"`
	Leaf H `json:"leaf"`
}

func DecodeTopProof added in v1.23.1

func DecodeTopProof[H HasherDomain](r io.Reader) (TopProof[H], error)

type VanillaStackedProof added in v1.23.1

type VanillaStackedProof struct {
	CommDProofs    MerkleProof[Sha256Domain]   `json:"comm_d_proofs"`
	CommRLastProof MerkleProof[PoseidonDomain] `json:"comm_r_last_proof"`

	ReplicaColumnProofs ReplicaColumnProof[PoseidonDomain] `json:"replica_column_proofs"`
	LabelingProofs      []LabelingProof[PoseidonDomain]    `json:"labeling_proofs"`
	EncodingProof       EncodingProof[PoseidonDomain]      `json:"encoding_proof"`
}

func DecodeVanillaStackedProof added in v1.23.1

func DecodeVanillaStackedProof(r io.Reader) (VanillaStackedProof, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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