tasks

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2026 License: Apache-2.0, MIT Imports: 51 Imported by: 0

Documentation

Index

Constants

View Source
const LeafSize = proof.NODE_SIZE
View Source
const MinConfidence = 6

MinConfidence defines how many blocks must be applied before we accept the message as applied. Synonymous with finality

Variables

View Source
var SendLockedWait = 100 * time.Millisecond

Functions

func NewSenderETH

func NewSenderETH(client SenderETHClient, wallet wallet.Wallet, db *gorm.DB) (*SenderETH, *SendTaskETH, error)

NewSenderETH creates a new SenderETH.

func NewWatcherCreate

func NewWatcherCreate(
	db *gorm.DB,
	verifier smartcontracts.Verifier,
	pcs *chainsched.Scheduler,
	serviceContract smartcontracts.Service,
) error

func NewWatcherProviderRegister added in v0.0.17

func NewWatcherProviderRegister(db *gorm.DB, pcs *chainsched.Scheduler, contractAddr common.Address) error

NewWatcherProviderRegister sets up the watcher for provider registrations

func NewWatcherRootAdd

func NewWatcherRootAdd(db *gorm.DB, pcs *chainsched.Scheduler, verifier smartcontracts.Verifier) error

NewWatcherRootAdd sets up the watcher for proof set root additions

func Verify

func Verify(proof smartcontracts.IPDPTypesProof, root [32]byte, position uint64) bool

Types

type ChainAPI

type ChainAPI interface {
	ChainHead(context.Context) (*chaintypes.TipSet, error)
	StateGetRandomnessDigestFromBeacon(ctx context.Context, randEpoch abi.ChainEpoch, tsk chaintypes.TipSetKey) (abi.Randomness, error) //perm:read
}

type InitProvingPeriodTask

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

func NewInitProvingPeriodTask

func NewInitProvingPeriodTask(
	db *gorm.DB,
	ethClient bind.ContractBackend,
	chain ChainAPI,
	chainSched *chainsched.Scheduler,
	sender ethereum.Sender,
	serviceContract smartcontracts.Service,
	verifierContact smartcontracts.Verifier,
) (*InitProvingPeriodTask, error)

func (*InitProvingPeriodTask) Adder

func (ipp *InitProvingPeriodTask) Adder(taskFunc scheduler.AddTaskFunc)

func (*InitProvingPeriodTask) Do

func (ipp *InitProvingPeriodTask) Do(taskID scheduler.TaskID) (done bool, err error)

func (*InitProvingPeriodTask) TypeDetails

func (ipp *InitProvingPeriodTask) TypeDetails() scheduler.TaskTypeDetails

type MessageWatcherEth

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

func NewMessageWatcherEth

func NewMessageWatcherEth(db *gorm.DB, pcs *chainsched.Scheduler, api MessageWatcherEthClient, opts ...WatcherOption) (*MessageWatcherEth, error)

func (*MessageWatcherEth) Start added in v0.0.13

func (mw *MessageWatcherEth) Start()

func (*MessageWatcherEth) Stop

func (mw *MessageWatcherEth) Stop(ctx context.Context) error

type MessageWatcherEthClient

type MessageWatcherEthClient interface {
	TransactionByHash(ctx context.Context, hash common.Hash) (tx *types.Transaction, isPending bool, err error)
	TransactionReceipt(ctx context.Context, txHash common.Hash) (*types.Receipt, error)
}

type NextProvingPeriodTask

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

func NewNextProvingPeriodTask

func NewNextProvingPeriodTask(
	db *gorm.DB,
	ethClient bind.ContractBackend,
	api ChainAPI,
	chainSched *chainsched.Scheduler,
	sender ethereum.Sender,
	verifier smartcontracts.Verifier,
	service smartcontracts.Service,
) (*NextProvingPeriodTask, error)

func (*NextProvingPeriodTask) Adder

func (n *NextProvingPeriodTask) Adder(taskFunc scheduler.AddTaskFunc)

func (*NextProvingPeriodTask) CanAccept

func (*NextProvingPeriodTask) Do

func (n *NextProvingPeriodTask) Do(taskID scheduler.TaskID) (done bool, err error)

func (*NextProvingPeriodTask) TypeDetails

type ProofSetCreate

type ProofSetCreate struct {
	CreateMessageHash string `db:"create_message_hash"`
	Service           string `db:"service"`
}

type ProofSetRootAdd

type ProofSetRootAdd struct {
	ProofSet       uint64 `db:"proofset"`
	AddMessageHash string `db:"add_message_hash"`
}

Structures to represent database records

type ProveTask

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

func NewProveTask

func NewProveTask(
	chainSched *chainsched.Scheduler,
	db *gorm.DB,
	ethClient bind.ContractBackend,
	verifier smartcontracts.Verifier,
	api ChainAPI,
	sender ethereum.Sender,
	bs blobstore.Blobstore,
	reader types.PieceReaderAPI,
	resolver types.PieceResolverAPI,
) (*ProveTask, error)

func (*ProveTask) Adder

func (p *ProveTask) Adder(taskFunc scheduler.AddTaskFunc)

func (*ProveTask) CanAccept

func (p *ProveTask) CanAccept(ids []scheduler.TaskID, engine *scheduler.TaskEngine) (*scheduler.TaskID, error)

func (*ProveTask) Do

func (p *ProveTask) Do(taskID scheduler.TaskID) (done bool, err error)

func (*ProveTask) GenerateProofs

func (p *ProveTask) GenerateProofs(ctx context.Context, proofSetID int64, seed abi.Randomness, numChallenges int) ([]smartcontracts.IPDPTypesProof, error)

func (*ProveTask) TypeDetails

func (p *ProveTask) TypeDetails() scheduler.TaskTypeDetails

type RootAddEntry

type RootAddEntry struct {
	ProofSet        uint64 `db:"proofset"`
	Root            string `db:"root"`
	AddMessageHash  string `db:"add_message_hash"`
	AddMessageIndex uint64 `db:"add_message_index"`
	Subroot         string `db:"subroot"`
	SubrootOffset   int64  `db:"subroot_offset"`
	SubrootSize     int64  `db:"subroot_size"`
	PDPPieceRefID   int64  `db:"pdp_pieceref"`
	AddMessageOK    *bool  `db:"add_message_ok"`
	PDPProofSetID   uint64 `db:"proofset"`
}

RootAddEntry represents entries from pdp_proofset_root_adds

type SendTaskETH

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

func (*SendTaskETH) Adder

func (s *SendTaskETH) Adder(taskFunc scheduler.AddTaskFunc)

func (*SendTaskETH) CanAccept

func (s *SendTaskETH) CanAccept(ids []scheduler.TaskID, engine *scheduler.TaskEngine) (*scheduler.TaskID, error)

func (*SendTaskETH) Do

func (s *SendTaskETH) Do(taskID scheduler.TaskID) (done bool, err error)

func (*SendTaskETH) TypeDetails

func (s *SendTaskETH) TypeDetails() scheduler.TaskTypeDetails

type SenderETH

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

func (*SenderETH) Send

func (s *SenderETH) Send(ctx context.Context, fromAddress common.Address, tx *ethtypes.Transaction, reason string) (common.Hash, error)

type SenderETHClient

type SenderETHClient interface {
	NetworkID(ctx context.Context) (*big.Int, error)
	HeaderByNumber(ctx context.Context, number *big.Int) (*ethtypes.Header, error)
	PendingNonceAt(ctx context.Context, account common.Address) (uint64, error)
	EstimateGas(ctx context.Context, msg ethereum.CallMsg) (uint64, error)
	SendTransaction(ctx context.Context, transaction *ethtypes.Transaction) error
	SuggestGasTipCap(ctx context.Context) (*big.Int, error)
}

type TransactionResult added in v0.0.7

type TransactionResult struct {
	TxHash               string
	Receipt              *types.Receipt
	Transaction          *types.Transaction
	ConfirmedBlockNumber int64
	TxDataJSON           []byte
	ReceiptJSON          []byte
	TxSuccess            bool
}

TransactionResult holds all the data needed to update a transaction in the database

type WatcherOption added in v0.0.7

type WatcherOption func(*MessageWatcherEth)

WatcherOption is a functional option for configuring MessageWatcherEth

func WithMaxEthAPIRetries added in v0.0.7

func WithMaxEthAPIRetries(n uint) WatcherOption

WithMaxEthAPIRetries sets the maximum number of retries for the eth api

Jump to

Keyboard shortcuts

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