task

package
v0.1.3-testnet Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2024 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const TraceTagBaseProposer = "propose-base"
View Source
const TraceTagChooseFirstExtendEndorsePair = "chooseFirstPair"
View Source
const TraceTagEndorse1Proposer = "propose-endorse1"
View Source
const TraceTagEndorse2Proposer = "propose-endorse2"
View Source
const TraceTagEndorse2RndProposer = "propose-endorse2rnd"
View Source
const TraceTagInsertTagAlongInputs = "InsertTagAlongInputs"
View Source
const TraceTagTask = "task"

Variables

View Source
var (
	AllProposingStrategies = make(map[string]*Strategy)
	ErrNoProposals         = errors.New("no proposals were generated")
	ErrNotGoodEnough       = errors.New("proposals aren't good enough")
)

Functions

func Run

func Run(env environment, targetTs ledger.Time, slotData *SlotData) (*transaction.Transaction, *txmetadata.TransactionMetadata, error)

Run starts task with the aim to generate sequencer transaction for the target ledger time. The proposer task consist of several proposers (goroutines) Each proposer generates proposals and writes it to the channel of the task. The best proposal is selected and returned. Function only returns transaction which is better than others in the tippool for the current slot. Otherwise, returns nil

Types

type ProposalGenerator

type ProposalGenerator func(p *Proposer) (*attacher.IncrementalAttacher, bool)

ProposalGenerator returns incremental attacher as draft transaction or otherwise nil and forceExit flag = true

type Proposer

type Proposer struct {
	*Task

	Name string
	Msg  string // how proposer ended. For debugging
	// contains filtered or unexported fields
}

Task to generate proposals for the target ledger time. The task is interrupted by the context with deadline

func (*Proposer) ChooseFirstExtendEndorsePair

func (p *Proposer) ChooseFirstExtendEndorsePair(shuffleEndorseCandidates bool, pairFilter func(extend vertex.WrappedOutput, endorse *vertex.WrappedTx) bool) *attacher.IncrementalAttacher

ChooseFirstExtendEndorsePair returns incremental attacher which corresponds to the first extend-endorse pair encountered while traversing endorse candidates. Endorse candidates are either sorted descending by coverage, or randomly shuffled Pairs are filtered before checking. It allows to exclude repeating pairs

type SlotData

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

SlotData collect values of sequencer during one slot Proposers may keep theirs state there from target to target

func NewSlotData

func NewSlotData(slot ledger.Slot) *SlotData

func (*SlotData) BranchTxSubmitted

func (s *SlotData) BranchTxSubmitted(txid *ledger.TransactionID)

func (*SlotData) Lines

func (s *SlotData) Lines(prefix ...string) *lines.Lines

func (*SlotData) NewTarget

func (s *SlotData) NewTarget()

func (*SlotData) NoProposals

func (s *SlotData) NoProposals()

func (*SlotData) NotGoodEnough

func (s *SlotData) NotGoodEnough()

func (*SlotData) ProposalSubmitted

func (s *SlotData) ProposalSubmitted(strategyName string)

func (*SlotData) SequencerTxSubmitted

func (s *SlotData) SequencerTxSubmitted(txid *ledger.TransactionID)

type Strategy

type Strategy struct {
	Name             string
	ShortName        string
	GenerateProposal ProposalGenerator
}

Task to generate proposals for the target ledger time. The task is interrupted by the context with deadline

type Task

type Task struct {

	// proposals    []*proposal
	Name string
	// contains filtered or unexported fields
}

Task to generate proposals for the target ledger time. The task is interrupted by the context with deadline

func (*Task) InsertTagAlongInputs

func (t *Task) InsertTagAlongInputs(a *attacher.IncrementalAttacher) (numInserted int)

InsertTagAlongInputs includes tag-along outputs from the backlog into attacher

Jump to

Keyboard shortcuts

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