Documentation
¶
Index ¶
- Constants
- Variables
- func GetMinimumConflictSet(ctx context.Context, db *harmonydb.DB) []string
- func ShouldHoldProofShare(ctx context.Context, db *harmonydb.DB) bool
- type CandidateRequest
- type ClientRequest
- type ClientServiceAPI
- type Payment
- type SectorInfo
- type TaskAutosettle
- func (t *TaskAutosettle) Adder(harmonytask.AddTaskFunc)
- func (t *TaskAutosettle) CanAccept(ids []harmonytask.TaskID, engine *harmonytask.TaskEngine) (*harmonytask.TaskID, error)
- func (t *TaskAutosettle) Do(taskID harmonytask.TaskID, stillOwned func() bool) (done bool, err error)
- func (t *TaskAutosettle) TypeDetails() harmonytask.TaskTypeDetails
- type TaskClientPoll
- func (t *TaskClientPoll) Adder(atf harmonytask.AddTaskFunc)
- func (t *TaskClientPoll) CanAccept(ids []harmonytask.TaskID, engine *harmonytask.TaskEngine) (*harmonytask.TaskID, error)
- func (t *TaskClientPoll) Do(taskID harmonytask.TaskID, stillOwned func() bool) (done bool, err error)
- func (t *TaskClientPoll) TypeDetails() harmonytask.TaskTypeDetails
- type TaskClientSend
- func (t *TaskClientSend) Adder(atf harmonytask.AddTaskFunc)
- func (t *TaskClientSend) CanAccept(ids []harmonytask.TaskID, engine *harmonytask.TaskEngine) (*harmonytask.TaskID, error)
- func (t *TaskClientSend) Do(taskID harmonytask.TaskID, stillOwned func() bool) (done bool, err error)
- func (t *TaskClientSend) TypeDetails() harmonytask.TaskTypeDetails
- type TaskClientUpload
- func (t *TaskClientUpload) Adder(atf harmonytask.AddTaskFunc)
- func (t *TaskClientUpload) CanAccept(ids []harmonytask.TaskID, engine *harmonytask.TaskEngine) (*harmonytask.TaskID, error)
- func (t *TaskClientUpload) Do(taskID harmonytask.TaskID, stillOwned func() bool) (done bool, err error)
- func (t *TaskClientUpload) TypeDetails() harmonytask.TaskTypeDetails
- type TaskProvideSnark
- func (t *TaskProvideSnark) Adder(add harmonytask.AddTaskFunc)
- func (t *TaskProvideSnark) CanAccept(ids []harmonytask.TaskID, engine *harmonytask.TaskEngine) (*harmonytask.TaskID, error)
- func (t *TaskProvideSnark) Do(taskID harmonytask.TaskID, stillOwned func() bool) (done bool, err error)
- func (t *TaskProvideSnark) TypeDetails() harmonytask.TaskTypeDetails
- type TaskRequestProofs
- func (t *TaskRequestProofs) Adder(taskTx harmonytask.AddTaskFunc)
- func (t *TaskRequestProofs) CanAccept(ids []harmonytask.TaskID, engine *harmonytask.TaskEngine) (*harmonytask.TaskID, error)
- func (t *TaskRequestProofs) Do(taskID harmonytask.TaskID, stillOwned func() bool) (done bool, err error)
- func (t *TaskRequestProofs) TypeDetails() harmonytask.TaskTypeDetails
- type TaskSubmit
- func (t *TaskSubmit) Adder(addTask harmonytask.AddTaskFunc)
- func (t *TaskSubmit) CanAccept(ids []harmonytask.TaskID, _ *harmonytask.TaskEngine) (*harmonytask.TaskID, error)
- func (t *TaskSubmit) Do(taskID harmonytask.TaskID, stillOwned func() bool) (bool, error)
- func (t *TaskSubmit) TypeDetails() harmonytask.TaskTypeDetails
- type UpdateSectorInfo
Constants ¶
const PSProveTask = "PSProve"
const ProveAdderInterval = 10 * time.Second
const ProveCleanupInterval = 5 * time.Minute
const SettleGas = 50_000_000
const WithdrawableFeeMult = 1 / 0.002 // max 0.2% network gas fee
Variables ¶
var AutosettleInterval = 2 * time.Minute
var BoredBeforeToStart = time.Second * 7
var PollInterval = 20 * time.Second
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
var ProofRequestPollInterval = time.Second * 3
var RequestQueueHighWaterMark = 8
var RequestQueueLowWaterMark = 5
var SubmitScheduleInterval = 10 * time.Second
Functions ¶
func GetMinimumConflictSet ¶
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 ¶
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 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 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 (*TaskAutosettle) Adder ¶
func (t *TaskAutosettle) Adder(harmonytask.AddTaskFunc)
func (*TaskAutosettle) CanAccept ¶
func (t *TaskAutosettle) CanAccept(ids []harmonytask.TaskID, engine *harmonytask.TaskEngine) (*harmonytask.TaskID, error)
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 ¶
func (t *TaskClientPoll) CanAccept(ids []harmonytask.TaskID, engine *harmonytask.TaskEngine) (*harmonytask.TaskID, error)
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 ¶
func (t *TaskClientSend) CanAccept(ids []harmonytask.TaskID, engine *harmonytask.TaskEngine) (*harmonytask.TaskID, error)
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 ¶
func (t *TaskClientUpload) Adder(atf harmonytask.AddTaskFunc)
Adder implements harmonytask.TaskInterface.
func (*TaskClientUpload) CanAccept ¶
func (t *TaskClientUpload) CanAccept(ids []harmonytask.TaskID, engine *harmonytask.TaskEngine) (*harmonytask.TaskID, error)
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 (*TaskProvideSnark) Adder ¶
func (t *TaskProvideSnark) Adder(add harmonytask.AddTaskFunc)
Adder implements harmonytask.TaskInterface.
func (*TaskProvideSnark) CanAccept ¶
func (t *TaskProvideSnark) CanAccept(ids []harmonytask.TaskID, engine *harmonytask.TaskEngine) (*harmonytask.TaskID, error)
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 (*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 ¶
func (t *TaskRequestProofs) CanAccept(ids []harmonytask.TaskID, engine *harmonytask.TaskEngine) (*harmonytask.TaskID, error)
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 ¶
func (t *TaskRequestProofs) TypeDetails() harmonytask.TaskTypeDetails
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 (t *TaskSubmit) CanAccept(ids []harmonytask.TaskID, _ *harmonytask.TaskEngine) (*harmonytask.TaskID, error)
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