verifreg

package
v0.14.0-dev2 Latest Latest
Warning

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

Go to latest
Published: May 7, 2024 License: Apache-2.0, MIT Imports: 15 Imported by: 14

Documentation

Index

Constants

View Source
const EndOfLifeClaimDropPeriod = 30 * builtin.EpochsInDay
View Source
const MaximumVerifiedAllocationExpiration = 60 * builtin.EpochsInDay
View Source
const MaximumVerifiedAllocationTerm = 5 * builtin.EpochsInYear
View Source
const MinimumVerifiedAllocationSize = 1 << 20
View Source
const MinimumVerifiedAllocationTerm = 180 * builtin.EpochsInDay
View Source
const NoAllocationID = AllocationId(0)
View Source
const SignatureDomainSeparation_RemoveDataCap = "fil_removedatacap:"

Variables

View Source
var DataCapGranularity = builtin.TokenPrecision
View Source
var Methods = map[abi.MethodNum]builtin.MethodMeta{
	1: {"Constructor", *new(func(*address.Address) *abi.EmptyValue)},
	2: {"AddVerifier", *new(func(*AddVerifierParams) *abi.EmptyValue)},
	3: {"RemoveVerifier", *new(func(*address.Address) *abi.EmptyValue)},
	4: {"AddVerifiedClient", *new(func(*AddVerifiedClientParams) *abi.EmptyValue)},
	builtin.MustGenerateFRCMethodNum("AddVerifiedClient"): {"AddVerifiedClientExported", *new(func(*AddVerifiedClientParams) *abi.EmptyValue)},
	5: {"UseBytes", nil},
	6: {"RestoreBytes", nil},
	7: {"RemoveVerifiedClientDataCap", *new(func(*RemoveDataCapParams) *RemoveDataCapReturn)},
	8: {"RemoveExpiredAllocations", *new(func(*RemoveExpiredAllocationsParams) *RemoveExpiredAllocationsReturn)},
	builtin.MustGenerateFRCMethodNum("RemoveExpiredAllocations"): {"RemoveExpiredAllocationsExported", *new(func(*RemoveExpiredAllocationsParams) *RemoveExpiredAllocationsReturn)},
	9:  {"ClaimAllocations", *new(func(*ClaimAllocationsParams) *ClaimAllocationsReturn)},
	10: {"GetClaims", *new(func(*GetClaimsParams) *GetClaimsReturn)},
	builtin.MustGenerateFRCMethodNum("GetClaims"): {"GetClaimsExported", *new(func(*GetClaimsParams) *GetClaimsReturn)},
	11: {"ExtendClaimTerms", *new(func(*ExtendClaimTermsParams) *ExtendClaimTermsReturn)},
	builtin.MustGenerateFRCMethodNum("ExtendClaimTerms"): {"ExtendClaimTermsExported", *new(func(*ExtendClaimTermsParams) *ExtendClaimTermsReturn)},
	12: {"RemoveExpiredClaims", *new(func(*RemoveExpiredClaimsParams) *RemoveExpiredClaimsReturn)},
	builtin.MustGenerateFRCMethodNum("RemoveExpiredClaims"): {"RemoveExpiredClaimsExported", *new(func(*RemoveExpiredClaimsParams) *RemoveExpiredClaimsReturn)},
	builtin.MustGenerateFRCMethodNum("Receive"):             {"UniversalReceiverHook", *new(func(*UniversalReceiverParams) *AllocationsResponse)},
}
View Source
var MinVerifiedDealSize = abi.NewStoragePower(1 << 20)

Functions

This section is empty.

Types

type AddVerifiedClientParams

type AddVerifiedClientParams struct {
	Address   addr.Address
	Allowance DataCap
}

func (*AddVerifiedClientParams) MarshalCBOR

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

func (*AddVerifiedClientParams) UnmarshalCBOR

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

type AddVerifierParams

type AddVerifierParams struct {
	Address   addr.Address
	Allowance DataCap
}

func (*AddVerifierParams) MarshalCBOR

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

func (*AddVerifierParams) UnmarshalCBOR

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

type Allocation

type Allocation struct {
	// The verified client which allocated the DataCap.
	Client abi.ActorID
	// The provider (miner actor) which may claim the allocation.
	Provider abi.ActorID
	// Identifier of the data to be committed.
	Data cid.Cid
	// The (padded) size of data.
	Size abi.PaddedPieceSize
	// The minimum duration which the provider must commit to storing the piece to avoid
	// early-termination penalties (epochs).
	TermMin abi.ChainEpoch
	// The maximum period for which a provider can earn quality-adjusted power
	// for the piece (epochs).
	TermMax abi.ChainEpoch
	// The latest epoch by which a provider must commit data before the allocation expires.
	Expiration abi.ChainEpoch
}

func (*Allocation) MarshalCBOR

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

func (*Allocation) UnmarshalCBOR

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

type AllocationId

type AllocationId uint64

func (AllocationId) Key

func (a AllocationId) Key() string

type AllocationRequest

type AllocationRequest struct {
	// The provider (miner actor) which may claim the allocation.
	Provider abi.ActorID
	// Identifier of the data to be committed.
	Data cid.Cid
	// The (padded) size of data.
	Size abi.PaddedPieceSize
	// The minimum duration which the provider must commit to storing the piece to avoid
	// early-termination penalties (epochs).
	TermMin abi.ChainEpoch
	// The maximum period for which a provider can earn quality-adjusted power
	// for the piece (epochs).
	TermMax abi.ChainEpoch
	// The latest epoch by which a provider must commit data before the allocation expires.
	Expiration abi.ChainEpoch
}

func (*AllocationRequest) MarshalCBOR added in v0.12.1

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

func (*AllocationRequest) UnmarshalCBOR added in v0.12.1

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

type AllocationRequests

type AllocationRequests struct {
	Allocations []AllocationRequest
	Extensions  []ClaimExtensionRequest
}

func (*AllocationRequests) MarshalCBOR added in v0.12.1

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

func (*AllocationRequests) UnmarshalCBOR added in v0.12.1

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

type AllocationsResponse

type AllocationsResponse struct {
	AllocationResults BatchReturn
	ExtensionResults  BatchReturn
	NewAllocations    []AllocationId
}

func (*AllocationsResponse) MarshalCBOR

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

func (*AllocationsResponse) UnmarshalCBOR

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

type BatchReturn

type BatchReturn struct {
	SuccessCount uint64
	FailCodes    []FailCode
}

func (*BatchReturn) MarshalCBOR

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

func (*BatchReturn) UnmarshalCBOR

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

type Claim

type Claim struct {
	// The provider storing the data (from allocation).
	Provider abi.ActorID
	// The client which allocated the DataCap (from allocation).
	Client abi.ActorID
	// Identifier of the data committed (from allocation).
	Data cid.Cid
	// The (padded) size of data (from allocation).
	Size abi.PaddedPieceSize
	// The min period which the provider must commit to storing data
	TermMin abi.ChainEpoch
	// The max period for which provider can earn QA-power for the data
	TermMax abi.ChainEpoch
	// The epoch at which the (first range of the) piece was committed.
	TermStart abi.ChainEpoch
	// ID of the provider's sector in which the data is committed.
	Sector abi.SectorNumber
}

func (*Claim) MarshalCBOR

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

func (*Claim) UnmarshalCBOR

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

type ClaimAllocationsParams

type ClaimAllocationsParams struct {
	Sectors      []SectorAllocationClaim
	AllOrNothing bool
}

func (*ClaimAllocationsParams) MarshalCBOR

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

func (*ClaimAllocationsParams) UnmarshalCBOR

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

type ClaimAllocationsReturn

type ClaimAllocationsReturn struct {
	BatchInfo    BatchReturn
	ClaimedSpace big.Int
}

func (*ClaimAllocationsReturn) MarshalCBOR

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

func (*ClaimAllocationsReturn) UnmarshalCBOR

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

type ClaimExtensionRequest

type ClaimExtensionRequest struct {
	// The provider (miner actor) which may claim the allocation.
	Provider abi.ActorID
	// Identifier of the claim to be extended.
	Claim ClaimId
	// The new maximum period for which a provider can earn quality-adjusted power
	// for the piece (epochs).
	TermMax abi.ChainEpoch
}

func (*ClaimExtensionRequest) MarshalCBOR added in v0.12.1

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

func (*ClaimExtensionRequest) UnmarshalCBOR added in v0.12.1

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

type ClaimId

type ClaimId uint64

func (ClaimId) Key

func (a ClaimId) Key() string

type ClaimTerm

type ClaimTerm struct {
	Provider abi.ActorID
	ClaimId  ClaimId
	TermMax  abi.ChainEpoch
}

func (*ClaimTerm) MarshalCBOR

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

func (*ClaimTerm) UnmarshalCBOR

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

type DataCap

type DataCap = abi.StoragePower

DataCap is an integer number of bytes. We can introduce policy changes and replace this in the future.

type ExtendClaimTermsParams

type ExtendClaimTermsParams struct {
	Terms []ClaimTerm
}

func (*ExtendClaimTermsParams) MarshalCBOR

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

func (*ExtendClaimTermsParams) UnmarshalCBOR

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

type ExtendClaimTermsReturn

type ExtendClaimTermsReturn BatchReturn

func (*ExtendClaimTermsReturn) MarshalCBOR

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

func (*ExtendClaimTermsReturn) UnmarshalCBOR

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

type FailCode

type FailCode struct {
	Idx  uint64
	Code exitcode.ExitCode
}

func (*FailCode) MarshalCBOR

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

func (*FailCode) UnmarshalCBOR

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

type GetClaimsParams

type GetClaimsParams struct {
	Provider abi.ActorID
	ClaimIds []ClaimId
}

func (*GetClaimsParams) MarshalCBOR

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

func (*GetClaimsParams) UnmarshalCBOR

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

type GetClaimsReturn

type GetClaimsReturn struct {
	BatchInfo BatchReturn
	Claims    []Claim
}

func (*GetClaimsReturn) MarshalCBOR

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

func (*GetClaimsReturn) UnmarshalCBOR

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

type ReceiverType

type ReceiverType uint64

type RemoveDataCapParams

type RemoveDataCapParams struct {
	VerifiedClientToRemove addr.Address
	DataCapAmountToRemove  DataCap
	VerifierRequest1       RemoveDataCapRequest
	VerifierRequest2       RemoveDataCapRequest
}

func (*RemoveDataCapParams) MarshalCBOR

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

func (*RemoveDataCapParams) UnmarshalCBOR

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

type RemoveDataCapProposal

type RemoveDataCapProposal struct {
	// VerifiedClient is the client address to remove the DataCap from
	// The address must be an ID address
	VerifiedClient addr.Address
	// DataCapAmount is the amount of DataCap to be removed from the VerifiedClient address
	DataCapAmount DataCap
	// RemovalProposalID is the counter of the proposal sent by the Verifier for the VerifiedClient
	RemovalProposalID RmDcProposalID
}

RemoveDataCapProposal A verifier who wants to send/agree to a RemoveDataCapRequest should sign a RemoveDataCapProposal and send the signed proposal to the root key holder.

func (*RemoveDataCapProposal) MarshalCBOR

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

func (*RemoveDataCapProposal) UnmarshalCBOR

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

type RemoveDataCapRequest

type RemoveDataCapRequest struct {
	// Verifier is the verifier address used for VerifierSignature.
	// The address can be address.SECP256K1 or address.BLS
	Verifier addr.Address
	// VerifierSignature is the Verifier's signature over a RemoveDataCapProposal
	VerifierSignature crypto.Signature
}

RemoveDataCapRequest A verifier who wants to submit a request should send their RemoveDataCapRequest to the RKH.

func (*RemoveDataCapRequest) MarshalCBOR

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

func (*RemoveDataCapRequest) UnmarshalCBOR

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

type RemoveDataCapReturn

type RemoveDataCapReturn struct {
	VerifiedClient addr.Address
	DataCapRemoved DataCap
}

func (*RemoveDataCapReturn) MarshalCBOR

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

func (*RemoveDataCapReturn) UnmarshalCBOR

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

type RemoveExpiredAllocationsParams

type RemoveExpiredAllocationsParams struct {
	Client        abi.ActorID
	AllocationIds []AllocationId
}

func (*RemoveExpiredAllocationsParams) MarshalCBOR

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

func (*RemoveExpiredAllocationsParams) UnmarshalCBOR

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

type RemoveExpiredAllocationsReturn

type RemoveExpiredAllocationsReturn struct {
	Considered       []AllocationId
	Results          BatchReturn
	DataCapRecovered DataCap
}

func (*RemoveExpiredAllocationsReturn) MarshalCBOR

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

func (*RemoveExpiredAllocationsReturn) UnmarshalCBOR

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

type RemoveExpiredClaimsParams

type RemoveExpiredClaimsParams struct {
	Provider abi.ActorID
	ClaimIds []ClaimId
}

func (*RemoveExpiredClaimsParams) MarshalCBOR

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

func (*RemoveExpiredClaimsParams) UnmarshalCBOR

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

type RemoveExpiredClaimsReturn

type RemoveExpiredClaimsReturn struct {
	Considered []AllocationId
	Results    BatchReturn
}

func (*RemoveExpiredClaimsReturn) MarshalCBOR

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

func (*RemoveExpiredClaimsReturn) UnmarshalCBOR

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

type RestoreBytesParams

type RestoreBytesParams struct {
	Address  addr.Address
	DealSize abi.StoragePower
}

func (*RestoreBytesParams) MarshalCBOR

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

func (*RestoreBytesParams) UnmarshalCBOR

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

type RmDcProposalID

type RmDcProposalID struct {
	ProposalID uint64
}

func (*RmDcProposalID) MarshalCBOR

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

func (*RmDcProposalID) UnmarshalCBOR

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

type SectorAllocationClaim

type SectorAllocationClaim struct {
	Client       abi.ActorID
	AllocationId AllocationId
	Data         cid.Cid
	Size         abi.PaddedPieceSize
	Sector       abi.SectorNumber
	SectorExpiry abi.ChainEpoch
}

func (*SectorAllocationClaim) MarshalCBOR

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

func (*SectorAllocationClaim) UnmarshalCBOR

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

type State

type State struct {
	// Root key holder multisig.
	// Authorize and remove verifiers.
	RootKey address.Address

	// Verifiers authorize VerifiedClients.
	// Verifiers delegate their DataCap.
	Verifiers cid.Cid // HAMT[addr.Address]DataCap

	// RemoveDataCapProposalIDs keeps the counters of the datacap removal proposal a verifier has submitted for a
	//specific client. Unique proposal ids ensure that removal proposals cannot be replayed.√
	// AddrPairKey is constructed as <verifier address, client address>, both using ID addresses.
	RemoveDataCapProposalIDs cid.Cid // HAMT[AddrPairKey]RmDcProposalID

	// Maps client IDs to allocations made by that client.
	Allocations cid.Cid // HAMT[ActorID]HAMT[AllocationID]Allocation

	// Next allocation identifier to use.
	// The value 0 is reserved to mean "no allocation".
	NextAllocationId AllocationId

	// Maps provider IDs to allocations claimed by that provider.
	Claims cid.Cid // HAMT[ActorID]HAMT[ClaimID]Claim
}

func ConstructState

func ConstructState(store adt.Store, rootKeyAddress address.Address) (*State, error)

rootKeyAddress comes from genesis.

func (*State) FindAllocation

func (st *State) FindAllocation(store adt.Store, clientIdAddr address.Address, allocationId AllocationId) (*Allocation, bool, error)

func (*State) FindClaim

func (st *State) FindClaim(store adt.Store, providerIdAddr address.Address, claimId ClaimId) (*Claim, bool, error)

func (*State) GetAllAllocations

func (st *State) GetAllAllocations(store adt.Store) (map[AllocationId]Allocation, error)

func (*State) GetAllClaims

func (st *State) GetAllClaims(store adt.Store) (map[ClaimId]Claim, error)

func (*State) LoadAllocationsToMap

func (st *State) LoadAllocationsToMap(store adt.Store, clientIdAddr address.Address) (map[AllocationId]Allocation, error)

func (*State) LoadClaimsToMap

func (st *State) LoadClaimsToMap(store adt.Store, providerIdAddr address.Address) (map[ClaimId]Claim, error)

func (*State) MarshalCBOR

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

func (*State) UnmarshalCBOR

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

type StateSummary

type StateSummary struct {
	Verifiers   map[addr.Address]DataCap
	Claims      map[ClaimId]Claim
	Allocations map[AllocationId]Allocation
}

func CheckStateInvariants

func CheckStateInvariants(st *State, store adt.Store, priorEpoch abi.ChainEpoch) (*StateSummary, *builtin.MessageAccumulator)

Checks internal invariants of verified registry state.

type UniversalReceiverParams

type UniversalReceiverParams struct {
	Type_   ReceiverType
	Payload []byte
}

func (*UniversalReceiverParams) MarshalCBOR

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

func (*UniversalReceiverParams) UnmarshalCBOR

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

type UseBytesParams

type UseBytesParams struct {
	// Address of verified client.
	Address addr.Address
	// Number of bytes to use.
	DealSize abi.StoragePower
}

func (*UseBytesParams) MarshalCBOR

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

func (*UseBytesParams) UnmarshalCBOR

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

Jump to

Keyboard shortcuts

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