Documentation ¶
Index ¶
- Constants
- Variables
- func AttachOutputID(oid ledger.OutputID, env Environment, opts ...AttachTxOption) vertex.WrappedOutput
- func AttachOutputWithID(o *ledger.OutputWithID, env Environment, opts ...AttachTxOption) (vertex.WrappedOutput, error)
- func AttachTransaction(tx *transaction.Transaction, env Environment, opts ...AttachTxOption) (vid *vertex.WrappedTx)
- func AttachTransactionFromBytes(txBytes []byte, env Environment, opts ...AttachTxOption) (*vertex.WrappedTx, error)
- func AttachTxID(txid ledger.TransactionID, env Environment, opts ...AttachTxOption) (vid *vertex.WrappedTx)
- func InvalidateTxID(txid ledger.TransactionID, env Environment, reason error) *vertex.WrappedTx
- func WithEnforceTimestampBeforeRealTime(options *_attacherOptions)
- type AttachTxOption
- func WithAttachmentCallback(fun func(vid *vertex.WrappedTx, err error)) AttachTxOption
- func WithAttachmentDepth(depth int) AttachTxOption
- func WithContext(ctx context.Context) AttachTxOption
- func WithInvokedBy(name string) AttachTxOption
- func WithTransactionMetadata(metadata *txmetadata.TransactionMetadata) AttachTxOption
- type Environment
- type IncrementalAttacher
- func (a *IncrementalAttacher) BaselineBranch() *vertex.WrappedTx
- func (a *IncrementalAttacher) Check() *vertex.WrappedOutput
- func (a *IncrementalAttacher) Close()
- func (a *IncrementalAttacher) Completed() bool
- func (a *IncrementalAttacher) CoverageAndDelta() (uint64, uint64)
- func (a *IncrementalAttacher) Endorsing() []*vertex.WrappedTx
- func (a *IncrementalAttacher) Extending() vertex.WrappedOutput
- func (a *IncrementalAttacher) FinalSupply() uint64
- func (a *IncrementalAttacher) InsertEndorsement(endorsement *vertex.WrappedTx) error
- func (a *IncrementalAttacher) InsertTagAlongInput(wOut vertex.WrappedOutput) (bool, error)
- func (a *IncrementalAttacher) IsClosed() bool
- func (a *IncrementalAttacher) LedgerCoverage() uint64
- func (a *IncrementalAttacher) MakeSequencerTransaction(seqName string, privateKey ed25519.PrivateKey, ...) (*transaction.Transaction, error)
- func (a *IncrementalAttacher) Name() string
- func (a *IncrementalAttacher) NumInputs() int
- func (a *IncrementalAttacher) SetTraceAttacher(name string)
- func (a *IncrementalAttacher) SlotInflation() uint64
- func (a *IncrementalAttacher) TargetTs() ledger.Time
- func (a *IncrementalAttacher) Tracef(traceLabel string, format string, args ...any)
- type SequencerCommandParser
Constants ¶
const ( TraceTagAttach = "attach" TraceTagAttachVertex = "attachVertex" )
const (
TraceTagAttachMilestone = "milestone"
)
const TraceTagBranchAvailable = "branchAvailable"
const TraceTagIncrementalAttacher = "incAttach"
const TraceTagPull = "pull"
const TraceTagSolidifySequencerBaseline = "seqBase"
const TraceTagValidateSequencer = "validateSeq"
Variables ¶
var ErrSolidificationDeadline = errors.New("solidification deadline")
Functions ¶
func AttachOutputID ¶
func AttachOutputID(oid ledger.OutputID, env Environment, opts ...AttachTxOption) vertex.WrappedOutput
func AttachOutputWithID ¶
func AttachOutputWithID(o *ledger.OutputWithID, env Environment, opts ...AttachTxOption) (vertex.WrappedOutput, error)
func AttachTransaction ¶
func AttachTransaction(tx *transaction.Transaction, env Environment, opts ...AttachTxOption) (vid *vertex.WrappedTx)
AttachTransaction attaches new incoming transaction. For sequencer transaction it starts milestoneAttacher routine which manages solidification pulling until transaction becomes solid or stopped by the context
func AttachTransactionFromBytes ¶
func AttachTransactionFromBytes(txBytes []byte, env Environment, opts ...AttachTxOption) (*vertex.WrappedTx, error)
AttachTransactionFromBytes used for testing
func AttachTxID ¶
func AttachTxID(txid ledger.TransactionID, env Environment, opts ...AttachTxOption) (vid *vertex.WrappedTx)
AttachTxID ensures the txid is on the MemDAG It load existing branches but does not pull anything
func InvalidateTxID ¶
func InvalidateTxID(txid ledger.TransactionID, env Environment, reason error) *vertex.WrappedTx
InvalidateTxID marks existing vertex as BAD or creates new BAD
func WithEnforceTimestampBeforeRealTime ¶
func WithEnforceTimestampBeforeRealTime(options *_attacherOptions)
Types ¶
type AttachTxOption ¶
type AttachTxOption func(*_attacherOptions)
func WithAttachmentCallback ¶
func WithAttachmentCallback(fun func(vid *vertex.WrappedTx, err error)) AttachTxOption
func WithAttachmentDepth ¶
func WithAttachmentDepth(depth int) AttachTxOption
func WithContext ¶
func WithContext(ctx context.Context) AttachTxOption
func WithInvokedBy ¶
func WithInvokedBy(name string) AttachTxOption
func WithTransactionMetadata ¶
func WithTransactionMetadata(metadata *txmetadata.TransactionMetadata) AttachTxOption
type Environment ¶
type Environment interface { global.NodeGlobal //GossipAttachedTransaction(tx *transaction.Transaction, metadata *txmetadata.TransactionMetadata) ParseMilestoneData(msVID *vertex.WrappedTx) *ledger.MilestoneData SaveFullDAG(fname string) EvidencePastConeSize(sz int) SnapshotBranchID() *ledger.TransactionID DurationSinceLastMessageFromPeer() time.Duration // contains filtered or unexported methods }
type IncrementalAttacher ¶
type IncrementalAttacher struct {
// contains filtered or unexported fields
}
IncrementalAttacher is used by the sequencer to build a sequencer milestone transaction by adding new tag-along inputs one-by-one. It ensures the past cone is conflict-free It is used to generate the transaction and after that it is discarded
func NewIncrementalAttacher ¶
func NewIncrementalAttacher(name string, env Environment, targetTs ledger.Time, extend vertex.WrappedOutput, endorse ...*vertex.WrappedTx) (*IncrementalAttacher, error)
func (*IncrementalAttacher) BaselineBranch ¶
func (a *IncrementalAttacher) BaselineBranch() *vertex.WrappedTx
func (*IncrementalAttacher) Check ¶
func (a *IncrementalAttacher) Check() *vertex.WrappedOutput
func (*IncrementalAttacher) Close ¶
func (a *IncrementalAttacher) Close()
Close releases all references of Vertices. Incremental attacher must be closed before disposing it, otherwise memDAG starts leaking Vertices. Repetitive closing has no effect TODO some kind of checking if it is closed after some time
func (*IncrementalAttacher) Completed ¶
func (a *IncrementalAttacher) Completed() bool
Completed returns true is past cone is all solid and consistent (no conflicts) For incremental attacher it may happen (in theory) that some outputs need re-pull, if unlucky. The owner of the attacher will have to dismiss the attacher and try again later
func (*IncrementalAttacher) CoverageAndDelta ¶
func (*IncrementalAttacher) Endorsing ¶
func (a *IncrementalAttacher) Endorsing() []*vertex.WrappedTx
func (*IncrementalAttacher) Extending ¶
func (a *IncrementalAttacher) Extending() vertex.WrappedOutput
func (*IncrementalAttacher) FinalSupply ¶
func (a *IncrementalAttacher) FinalSupply() uint64
func (*IncrementalAttacher) InsertEndorsement ¶
func (a *IncrementalAttacher) InsertEndorsement(endorsement *vertex.WrappedTx) error
InsertEndorsement preserves consistency in case of failure
func (*IncrementalAttacher) InsertTagAlongInput ¶
func (a *IncrementalAttacher) InsertTagAlongInput(wOut vertex.WrappedOutput) (bool, error)
InsertTagAlongInput inserts tag along input. In case of failure return false and attacher state with vertex references remains consistent
func (*IncrementalAttacher) IsClosed ¶
func (a *IncrementalAttacher) IsClosed() bool
func (*IncrementalAttacher) LedgerCoverage ¶
func (a *IncrementalAttacher) LedgerCoverage() uint64
func (*IncrementalAttacher) MakeSequencerTransaction ¶
func (a *IncrementalAttacher) MakeSequencerTransaction(seqName string, privateKey ed25519.PrivateKey, cmdParser SequencerCommandParser) (*transaction.Transaction, error)
MakeSequencerTransaction creates sequencer transaction from the incremental attacher. Increments slotInflation by the amount inflated in the transaction
func (*IncrementalAttacher) NumInputs ¶
func (a *IncrementalAttacher) NumInputs() int
func (*IncrementalAttacher) SetTraceAttacher ¶
func (a *IncrementalAttacher) SetTraceAttacher(name string)
func (*IncrementalAttacher) SlotInflation ¶
func (a *IncrementalAttacher) SlotInflation() uint64
func (*IncrementalAttacher) TargetTs ¶
func (a *IncrementalAttacher) TargetTs() ledger.Time
type SequencerCommandParser ¶
type SequencerCommandParser interface { // ParseSequencerCommandToOutput analyzes consumed output for sequencer command and produces // one or several outputs as an effect of the command. Returns: // - nil, nil if a syntactically valid sequencer command is not detected in the inputs // - nil, err if a syntactically valid command can be detected, however it contains errors // - list of outputs, nil if it is a success ParseSequencerCommandToOutput(input *ledger.OutputWithID) ([]*ledger.Output, error) }