proofshare

package
v1.26.0 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2025 License: Apache-2.0, MIT Imports: 36 Imported by: 0

Documentation

Index

Constants

View Source
const PSProveTask = "PSProve"
View Source
const ProveAdderInterval = 10 * time.Second
View Source
const ProveCleanupInterval = 5 * time.Minute
View Source
const SettleGas = 50_000_000
View Source
const WithdrawableFeeMult = 1 / 0.002 // max 0.2% network gas fee

Variables

View Source
var AutosettleInterval = 2 * time.Minute
View Source
var BoredBeforeToStart = time.Second * 7
View Source
var PollInterval = 20 * time.Second
View Source
var PrioTasks = []string{
	"PoRep",
	"UpdateProve",
	"WdPost",
	"WinPost",
	"TreeRC",
}

List of tasks that are considered "priority" When all machines in the cluster are responsible for PSProve AND those tasks ProofShare asks will be suspended until the priority tasks get assigned to machines

View Source
var ProofRequestPollInterval = time.Second * 3
View Source
var RequestQueueHighWaterMark = 8
View Source
var RequestQueueLowWaterMark = 5
View Source
var SubmitScheduleInterval = 10 * time.Second

Functions

func GetMinimumConflictSet

func GetMinimumConflictSet(ctx context.Context, db *harmonydb.DB) []string

GetMinimumConflictSet returns a slice of task names from PrioTasks which are NOT supported by any machine that can run PSProve. The intention is to identify which task types might starve when every PSProve-capable machine is busy proving, so that scheduling logic can decide if it should temporarily pause ProofShare related work until those task types are picked up.

The implementation looks at harmony_machine_details.tasks – a list of task names supported by each machine. If at least one PSProve-capable machine advertises support for a priority task, that task is *removed* from the returned conflict set because it can already be handled by the same pool of machines that do PSProve.

func ShouldHoldProofShare

func ShouldHoldProofShare(ctx context.Context, db *harmonydb.DB) bool

ShouldHoldProofShare decides whether ProofShare (PSProve) work should be held off. It returns true when there are still unassigned tasks in the minimum conflict set calculated above. Unassigned means a row in harmony_task with owner_id IS NULL.

Types

type CandidateRequest

type CandidateRequest struct {
	SpID                 int64  `db:"sp_id"`
	SectorNumber         int64  `db:"sector_num"`
	RequestType          string `db:"request_type"`
	RequestCID           string `db:"request_cid"`
	RequestPartitionCost int64  `db:"request_partition_cost"`
}

type ClientRequest

type ClientRequest struct {
	SpID         int64 `db:"sp_id"`
	SectorNumber int64 `db:"sector_num"`

	RequestCID           *string `db:"request_cid"`
	RequestUploaded      bool    `db:"request_uploaded"`
	RequestPartitionCost int64   `db:"request_partition_cost"`
	RequestType          string  `db:"request_type"`

	PaymentWallet *int64 `db:"payment_wallet"`
	PaymentNonce  *int64 `db:"payment_nonce"`

	RequestSent  bool   `db:"request_sent"`
	ResponseData []byte `db:"response_data"`

	Done bool `db:"done"`
}

ClientRequest holds the client request information

type ClientServiceAPI

type ClientServiceAPI interface {
	ChainHead(context.Context) (*types.TipSet, error)
	StateGetRandomnessFromBeacon(context.Context, crypto.DomainSeparationTag, abi.ChainEpoch, []byte, types.TipSetKey) (abi.Randomness, error)
	StateLookupID(context.Context, address.Address, types.TipSetKey) (address.Address, error)
	WalletSign(context.Context, address.Address, []byte) (*crypto.Signature, error)
	StateAccountKey(context.Context, address.Address, types.TipSetKey) (address.Address, error)
}

type Payment

type Payment struct {
	Wallet           int64  `db:"wallet"`
	Nonce            int64  `db:"nonce"`
	Consumed         bool   `db:"consumed"`
	CumulativeAmount string `db:"cumulative_amount"`
	Signature        []byte `db:"signature"`
}

type SectorInfo

type SectorInfo struct {
	SpID         int64  `db:"sp_id"`
	SectorNumber int64  `db:"sector_number"`
	RegSealProof int    `db:"reg_seal_proof"`
	TicketEpoch  int64  `db:"ticket_epoch"`
	TicketValue  []byte `db:"ticket_value"`
	SeedEpoch    int64  `db:"seed_epoch"`
	SealedCID    string `db:"tree_r_cid"`
	UnsealedCID  string `db:"tree_d_cid"`
	Sealed       cid.Cid
	Unsealed     cid.Cid
}

SectorInfo holds the sector information

func (*SectorInfo) SectorID

func (s *SectorInfo) SectorID() abi.SectorID

type TaskAutosettle

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

func NewTaskAutosettle

func NewTaskAutosettle(db *harmonydb.DB, chain api.FullNode, sender *message.Sender) *TaskAutosettle

func (*TaskAutosettle) Adder

func (*TaskAutosettle) CanAccept

func (*TaskAutosettle) Do

func (t *TaskAutosettle) Do(taskID harmonytask.TaskID, stillOwned func() bool) (done bool, err error)

func (*TaskAutosettle) TypeDetails

func (t *TaskAutosettle) TypeDetails() harmonytask.TaskTypeDetails

TypeDetails implements harmonytask.TaskInterface.

type TaskClientPoll

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

func NewTaskClientPoll

func NewTaskClientPoll(db *harmonydb.DB, api ClientServiceAPI) *TaskClientPoll

func (*TaskClientPoll) Adder

func (t *TaskClientPoll) Adder(atf harmonytask.AddTaskFunc)

Adder implements harmonytask.TaskInterface.

func (*TaskClientPoll) CanAccept

CanAccept implements harmonytask.TaskInterface.

func (*TaskClientPoll) Do

func (t *TaskClientPoll) Do(taskID harmonytask.TaskID, stillOwned func() bool) (done bool, err error)

Do implements harmonytask.TaskInterface.

func (*TaskClientPoll) TypeDetails

func (t *TaskClientPoll) TypeDetails() harmonytask.TaskTypeDetails

TypeDetails implements harmonytask.TaskInterface.

type TaskClientSend

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

func NewTaskClientSend

func NewTaskClientSend(db *harmonydb.DB, api ClientServiceAPI, router *common.Service) *TaskClientSend

func (*TaskClientSend) Adder

func (t *TaskClientSend) Adder(atf harmonytask.AddTaskFunc)

Adder implements harmonytask.TaskInterface.

func (*TaskClientSend) CanAccept

CanAccept implements harmonytask.TaskInterface.

func (*TaskClientSend) Do

func (t *TaskClientSend) Do(taskID harmonytask.TaskID, stillOwned func() bool) (done bool, err error)

Do implements harmonytask.TaskInterface.

func (*TaskClientSend) TypeDetails

func (t *TaskClientSend) TypeDetails() harmonytask.TaskTypeDetails

TypeDetails implements harmonytask.TaskInterface.

type TaskClientUpload

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

func NewTaskClientUpload

func NewTaskClientUpload(db *harmonydb.DB, api ClientServiceAPI, storage *paths.Remote, router *common.Service, max int) *TaskClientUpload

func (*TaskClientUpload) Adder

Adder implements harmonytask.TaskInterface.

func (*TaskClientUpload) CanAccept

CanAccept implements harmonytask.TaskInterface.

func (*TaskClientUpload) Do

func (t *TaskClientUpload) Do(taskID harmonytask.TaskID, stillOwned func() bool) (done bool, err error)

Do implements harmonytask.TaskInterface.

func (*TaskClientUpload) TypeDetails

func (t *TaskClientUpload) TypeDetails() harmonytask.TaskTypeDetails

TypeDetails implements harmonytask.TaskInterface.

type TaskProvideSnark

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

func NewTaskProvideSnark

func NewTaskProvideSnark(db *harmonydb.DB, paramck func() (bool, error), max int) *TaskProvideSnark

func (*TaskProvideSnark) Adder

Adder implements harmonytask.TaskInterface.

func (*TaskProvideSnark) CanAccept

CanAccept implements harmonytask.TaskInterface.

func (*TaskProvideSnark) Do

func (t *TaskProvideSnark) Do(taskID harmonytask.TaskID, stillOwned func() bool) (done bool, err error)

Do implements harmonytask.TaskInterface.

func (*TaskProvideSnark) TypeDetails

func (t *TaskProvideSnark) TypeDetails() harmonytask.TaskTypeDetails

TypeDetails implements harmonytask.TaskInterface.

type TaskRequestProofs

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

func NewTaskRequestProofs

func NewTaskRequestProofs(db *harmonydb.DB, chain api.FullNode, paramck func() (bool, error)) *TaskRequestProofs

func (*TaskRequestProofs) Adder

func (t *TaskRequestProofs) Adder(taskTx harmonytask.AddTaskFunc)

Adder starts new requests when: - enabled - wallet not null - request_task_id null - request_queue len <= RequestQueueLowWaterMark - snap/porep tasks were bored recently

func (*TaskRequestProofs) CanAccept

CanAccept implements harmonytask.TaskInterface.

func (*TaskRequestProofs) Do

func (t *TaskRequestProofs) Do(taskID harmonytask.TaskID, stillOwned func() bool) (done bool, err error)

Do implements harmonytask.TaskInterface.

func (*TaskRequestProofs) TypeDetails

TypeDetails implements harmonytask.TaskInterface.

type TaskSubmit

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

func NewTaskSubmit

func NewTaskSubmit(db *harmonydb.DB, chain api.FullNode) *TaskSubmit

func (*TaskSubmit) Adder

func (t *TaskSubmit) Adder(addTask harmonytask.AddTaskFunc)

func (*TaskSubmit) CanAccept

func (*TaskSubmit) Do

func (t *TaskSubmit) Do(taskID harmonytask.TaskID, stillOwned func() bool) (bool, error)

func (*TaskSubmit) TypeDetails

func (t *TaskSubmit) TypeDetails() harmonytask.TaskTypeDetails

type UpdateSectorInfo

type UpdateSectorInfo struct {
	SpID            int64                     `db:"sp_id"`
	SectorNumber    int64                     `db:"sector_number"`
	UpdateProofType abi.RegisteredUpdateProof `db:"upgrade_proof"`
	RegSealProof    abi.RegisteredSealProof   `db:"reg_seal_proof"`

	OldR proof.Commitment
	NewR proof.Commitment
	NewD proof.Commitment
}

func (*UpdateSectorInfo) SectorID

func (s *UpdateSectorInfo) SectorID() abi.SectorID

Jump to

Keyboard shortcuts

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