txinclude

package
v1.16.13 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2026 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BasicBudget

type BasicBudget interface {
	Credit(eth.ETH) eth.ETH
	Debit(eth.ETH) (eth.ETH, error)
}

type Budget

type Budget interface {
	// BeforeResubmit is called before the transaction is resubmitted. It allows the cost to be
	// re-estimated in case of any changes (e.g., nonce increments affecting DA cost).
	BeforeResubmit(oldBudgetedCost eth.ETH, tx *types.Transaction) (newBudgetedCost eth.ETH, err error)
	// AfterCancel is called after the transaction is canceled, providing a chance to refund the
	// cost.
	AfterCancel(budgetedCost eth.ETH, tx *types.Transaction)
	// AfterIncluded is called after the transaction is included, giving an opportunity to refund
	// the difference between the budgeted cost and the actual cost.
	AfterIncluded(budgetedCost eth.ETH, tx *IncludedTx)
}

Budget tracks costs throughout a tranaction's lifecycle.

type EL

type EL interface {
	Sender
	ReceiptGetter
}

EL represents an EVM execution layer. It is responsible for handling transport errors, such as HTTP 429s.

func NewReliableEL

func NewReliableEL(el EL, blockTime time.Duration) EL

NewReliableEL turns an implementation of the EL interface into one that will retry on intermittent failures.

type IncludedTx

type IncludedTx struct {
	Transaction *types.Transaction
	Receipt     *types.Receipt
}

type Includer

type Includer interface {
	Include(ctx context.Context, tx types.TxData) (*IncludedTx, error)
}

type IsthmusCostOracle

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

IsthmusCostOracle implements OPCostOracle only for the Isthmus hard fork.

func NewIsthmusCostOracle

func NewIsthmusCostOracle(client RPCClient, blockTime time.Duration) *IsthmusCostOracle

func (*IsthmusCostOracle) OPCost

func (i *IsthmusCostOracle) OPCost(tx *types.Transaction) *big.Int

func (*IsthmusCostOracle) SetParams

func (i *IsthmusCostOracle) SetParams(ctx context.Context) error

func (*IsthmusCostOracle) Start

func (i *IsthmusCostOracle) Start(ctx context.Context)

type Limit

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

func NewLimit

func NewLimit(inner Includer, limit int) *Limit

func (*Limit) Include

func (l *Limit) Include(ctx context.Context, tx types.TxData) (*IncludedTx, error)

type Monitor

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

Monitor is a ReceiptGetter that will continue looking for a receipt even when it doesn't find it right away.

func NewMonitor

func NewMonitor(inner ReceiptGetter, blockTime time.Duration) *Monitor

func (*Monitor) TransactionReceipt

func (m *Monitor) TransactionReceipt(ctx context.Context, hash common.Hash) (*types.Receipt, error)

type NoOpResubmitterObserver

type NoOpResubmitterObserver struct{}

func (NoOpResubmitterObserver) SubmissionError

func (NoOpResubmitterObserver) SubmissionError(error)

type OPCostOracle

type OPCostOracle interface {
	// OPCost returns the total OP-specific costs for tx, such as the L1 cost and operator cost.
	OPCost(*types.Transaction) *big.Int
}

type Persistent

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

Persistent is an Includer that persists transactions to an execution layer.

func NewPersistent

func NewPersistent(signer Signer, el EL, opts ...PersistentOption) *Persistent

NewPersistent creates a Persistent Includer. It assumes el is reliable:

  • el.SendTransaction guarantees mempool inclusion without the possibility of eviction.
  • el.TransactionReceipt will return a valid receipt if one eventually exists.

func (*Persistent) Include

func (p *Persistent) Include(ctx context.Context, tx types.TxData) (*IncludedTx, error)

Include attempts to persist tx to p's EL, updating its budget in real time throughout the transaction lifecycle. It fails to include a transaction in the event of an error from the context, budget, signer, or EL. It tries to recover from EL nonce and fee errors by adjusting those parameters accordingly.

type PersistentOption

type PersistentOption func(cfg *persistentConfig)

func WithBudget

func WithBudget(budget Budget) PersistentOption

WithBudget adds a budget to the Includer. The default is unlimited.

func WithStartNonce

func WithStartNonce(nonce uint64) PersistentOption

WithStartNonce instructs the Persistent includer to use nonce as a starting nonce. The default is zero.

type PkSigner

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

func NewPkSigner

func NewPkSigner(pk *ecdsa.PrivateKey, chainID *big.Int) *PkSigner

func (*PkSigner) Sign

type RPCClient

type RPCClient interface {
	BatchCallContext(context.Context, []rpc.BatchElem) error
}

type ReceiptGetter

type ReceiptGetter interface {
	TransactionReceipt(context.Context, common.Hash) (*types.Receipt, error)
}

type Resubmitter

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

func NewResubmitter

func NewResubmitter(inner Sender, blockTime time.Duration, opts ...ResubmitterOption) *Resubmitter

func (*Resubmitter) SendTransaction

func (r *Resubmitter) SendTransaction(ctx context.Context, tx *types.Transaction) error

SendTransaction implements Sender. It will continue resubmitting unless an error is hit that the resubmitter considers unfixable with resubmissions alone (e.g., requiring modifications to tx) See fatalErrs for the list of these errors.

type ResubmitterObserver

type ResubmitterObserver interface {
	SubmissionError(error)
}

type ResubmitterOption

type ResubmitterOption func(*resubmitterConfig)

func WithObserver

func WithObserver(observer ResubmitterObserver) ResubmitterOption

type Sender

type Sender interface {
	SendTransaction(context.Context, *types.Transaction) error
}

type Signer

type Signer interface {
	Sign(context.Context, *types.Transaction) (*types.Transaction, error)
}

type TxBudget

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

TxBudget provides budgeting helpers oriented around a transaction's lifecycle.

func NewTxBudget

func NewTxBudget(inner BasicBudget, opts ...TxBudgetOption) *TxBudget

func (*TxBudget) AfterCancel

func (b *TxBudget) AfterCancel(cost eth.ETH, _ *types.Transaction)

AfterCancel credits cost.

func (*TxBudget) AfterIncluded

func (b *TxBudget) AfterIncluded(budgetedCost eth.ETH, tx *IncludedTx)

AfterIncluded credits the difference between the budgeted cost and the actual cost. It is assumed that the budgeted cost is always greater than the actual cost.

func (*TxBudget) BeforeResubmit

func (b *TxBudget) BeforeResubmit(oldCost eth.ETH, tx *types.Transaction) (eth.ETH, error)

BeforeResubmit calculates the cost of tx. If the new cost is greather than oldCost, it debits the difference. If the new cost is less than oldCost, it credits the difference.

type TxBudgetOption

type TxBudgetOption func(*txBudgetConfig)

func WithOPCostOracle

func WithOPCostOracle(oracle OPCostOracle) TxBudgetOption

type UnlimitedBudget

type UnlimitedBudget struct{}

func (UnlimitedBudget) AfterCancel

func (UnlimitedBudget) AfterCancel(_ eth.ETH, _ *types.Transaction)

func (UnlimitedBudget) AfterIncluded

func (UnlimitedBudget) AfterIncluded(_ eth.ETH, _ *IncludedTx)

func (UnlimitedBudget) BeforeResubmit

func (n UnlimitedBudget) BeforeResubmit(oldCost eth.ETH, _ *types.Transaction) (eth.ETH, error)

Jump to

Keyboard shortcuts

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