config

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const ChainFamilyName = "stellar"

ChainFamilyName is the canonical chain family identifier for Stellar.

View Source
const DefaultRequestTimeout = 30 * time.Second

DefaultRequestTimeout bounds each individual Soroban RPC call when RequestTimeout is unset.

Variables

This section is empty.

Functions

func GenerateDocs added in v0.0.3

func GenerateDocs() (string, error)

GenerateDocs renders the operator-facing documentation for the Stellar TOML config from docs.toml. The output is meant to be checked into the operator docs site so that documented defaults stay in sync with code.

Types

type Node

type Node struct {
	Name *string       `toml:"Name"`
	URL  *clconfig.URL `toml:"URL"`
	// Order is the node priority used as a tiebreak by the multinode selector (lower wins on
	// equal head). Defaults to 0 when unset.
	Order *int32 `toml:"Order"`
}

Node represents a single Soroban RPC endpoint.

func (*Node) SetFrom added in v0.0.3

func (n *Node) SetFrom(f *Node)

SetFrom copies non-nil fields from f onto n (deep-copied).

func (*Node) ValidateConfig

func (n *Node) ValidateConfig() (err error)

ValidateConfig returns an error for any missing or empty required field.

type Nodes

type Nodes []*Node

Nodes is a slice of Node pointers.

func (*Nodes) SetFrom added in v0.0.3

func (ns *Nodes) SetFrom(fs *Nodes)

SetFrom merges nodes from f into ns by Name: new names appended, matching names overlaid.

type TOMLConfig

type TOMLConfig struct {
	// Enabled controls whether this chain is active. Nil means enabled (default).
	Enabled *bool `toml:"Enabled"`

	// ChainID is the unique identifier for this chain configuration
	ChainID string `toml:"ChainID"`

	// Nodes lists the Soroban RPC endpoints for this chain.
	Nodes Nodes `toml:"Nodes"`

	// TxManager holds optional Stellar transaction manager settings. Omitted
	// fields use defaults applied by SetDefaults (from docs.toml).
	TxManager TxManagerConfig `toml:"TxManager"`

	// MultiNode configures RPC node selection, health checking, and failover. Omitted fields
	// are filled by SetDefaults. See chainlink-framework/multinode.
	MultiNode mncfg.MultiNodeConfig `toml:"MultiNode"`

	// RequestTimeout bounds each individual Soroban RPC call (and the underlying HTTP client
	// timeout). Defaults to DefaultRequestTimeout when unset.
	RequestTimeout *clconfig.Duration `toml:"RequestTimeout"`
}

TOMLConfig is the parsed configuration for a single Stellar chain as it appears inside [[Stellar]] in the Chainlink node TOML.

func Defaults added in v0.0.3

func Defaults() (c TOMLConfig)

Defaults returns a copy of the docs.toml defaults.

func NewDecodedTOMLConfig

func NewDecodedTOMLConfig(rawConfig string) (*TOMLConfig, error)

NewDecodedTOMLConfig decodes rawConfig as Stellar TOML and validates the result

func (*TOMLConfig) IsEnabled

func (c *TOMLConfig) IsEnabled() bool

IsEnabled returns true when the chain is not explicitly disabled.

func (*TOMLConfig) SetDefaults added in v0.0.3

func (c *TOMLConfig) SetDefaults()

SetDefaults fills unset fields with docs.toml defaults via SetFrom, then resolves TXM simulation hints. Returns a fully-resolved config in one phase.

func (*TOMLConfig) SetFrom added in v0.0.3

func (c *TOMLConfig) SetFrom(f *TOMLConfig)

SetFrom copies non-nil fields from f onto c (deep-copied, no pointer sharing). ChainID is a plain string; a non-empty value in f wins.

func (*TOMLConfig) TOMLString

func (c *TOMLConfig) TOMLString() (string, error)

TOMLString serialises the config back to TOML

func (*TOMLConfig) ValidateConfig

func (c *TOMLConfig) ValidateConfig() (err error)

ValidateConfig returns a combined error for all invalid or missing required fields

type TxManagerConfig added in v0.0.3

type TxManagerConfig struct {
	BroadcastChanSize   *uint              `toml:"BroadcastChanSize"`
	ConfirmPollInterval *clconfig.Duration `toml:"ConfirmPollInterval"`

	// Fee strategy: Stellar fees = InclusionFee + ResourceFee.
	// Only the inclusion fee is bumped on retries; the resource fee is deterministic from simulation.
	BaseInclusionFee  *int64   `toml:"BaseInclusionFee"`
	MaxInclusionFee   *int64   `toml:"MaxInclusionFee"`
	FeeBumpMultiplier *float64 `toml:"FeeBumpMultiplier"`
	ResourceFeeBuffer *int64   `toml:"ResourceFeeBuffer"`
	RestoreFeeBuffer  *int64   `toml:"RestoreFeeBuffer"`
	// FeeStatsPollInterval controls how often GetFeeStats is called to refresh
	// Soroban inclusion fee P50/P90 in the feeTracker; back-to-back broadcasts reuse values.
	// Zero disables reuse (every inclusion-fee decision calls GetFeeStats).
	FeeStatsPollInterval *clconfig.Duration `toml:"FeeStatsPollInterval"`

	// Retry & timeout
	MaxSimulateAttempts       *uint              `toml:"MaxSimulateAttempts"`
	MaxSubmitRetryAttempts    *uint              `toml:"MaxSubmitRetryAttempts"`
	SubmitRetryDelay          *clconfig.Duration `toml:"SubmitRetryDelay"`
	TxTimeoutSecs             *int64             `toml:"TxTimeoutSecs"`
	LedgerBoundsOffset        *uint32            `toml:"LedgerBoundsOffset"`
	MaxTxRetryAttempts        *uint64            `toml:"MaxTxRetryAttempts"`
	MaxGetClientRetryAttempts *uint64            `toml:"MaxGetClientRetryAttempts"`
	MaxRestoreAttempts        *uint              `toml:"MaxRestoreAttempts"`

	// SimulationTerminalHints are matched case-insensitively as substrings
	// against failed SimulateTransaction errors; any match means the error is
	// treated as terminal (do not retry). Resolve merges these with built-in
	// defaults (additive); list only extra hints to add on top of defaults.
	SimulationTerminalHints []string `toml:"SimulationTerminalHints"`
	// SimulationRetryableHints: any substring match means retry simulation when
	// attempts remain. Resolve merges with built-in defaults (additive).
	SimulationRetryableHints []string `toml:"SimulationRetryableHints"`

	// Pruning
	// PruneInterval controls how often the background prune loop scans for
	// expired terminal txs. This is independent of PruneTxExpiration (retention).
	// Set to 0 to disable the loop (no goroutine is started); terminal txs are
	// then evicted synchronously when they reach a terminal state instead of
	// being retained until the next periodic prune.
	PruneInterval *clconfig.Duration `toml:"PruneInterval"`
	// PruneTxExpiration is the minimum time a terminal tx (Finalized or Failed)
	// is retained after reaching its terminal state before being eligible for pruning.
	// Measured from TerminalTime. Ignored when PruneInterval is 0 (immediate eviction).
	PruneTxExpiration *clconfig.Duration `toml:"PruneTxExpiration"`
}

TxManagerConfig defines the Stellar transaction manager configuration. Pointer fields are used for TOML deserialization — nil means "not set by user". After calling Resolve(), scalar pointer fields are non-nil; simulation hint slices are non-empty (built-in defaults when unset).

func (*TxManagerConfig) Resolve added in v0.0.3

func (c *TxManagerConfig) Resolve()

Resolve fills nil scalar fields with defaults from docs.toml (via Defaults), and always merges built-in simulation hints (additive with any user hints). After calling Resolve, scalar pointer fields are non-nil; simulation hint slices are non-empty.

func (*TxManagerConfig) SetFrom added in v0.0.3

func (c *TxManagerConfig) SetFrom(f *TxManagerConfig)

SetFrom copies non-nil fields from f onto c (deep-copied). Simulation hints are additive: user hints merge onto c's existing hints, deduped.

Jump to

Keyboard shortcuts

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