config

package
v1.3.0-rc5 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2022 License: MIT Imports: 34 Imported by: 0

Documentation

Overview

Package presenters allow for the specification and result of a Job, its associated TaskSpecs, and every JobRun and TaskRun to be returned in a user friendly human readable format.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrUnset   = errors.New("env var unset")
	ErrInvalid = errors.New("env var invalid")
)

nolint

Functions

func FriendlyBigInt

func FriendlyBigInt(n *big.Int) string

FriendlyBigInt returns a string printing the integer in both decimal and hexadecimal formats.

Types

type ConfigPrinter

type ConfigPrinter struct {
	EnvPrinter
}

ConfigPrinter are the non-secret values of the node

If you add an entry here, you should update NewConfigPrinter and ConfigPrinter#String accordingly.

func NewConfigPrinter

func NewConfigPrinter(cfg GeneralConfig) ConfigPrinter

NewConfigPrinter creates an instance of ConfigPrinter

func (ConfigPrinter) GetID

func (c ConfigPrinter) GetID() string

GetID generates a new ID for jsonapi serialization.

func (*ConfigPrinter) SetID

func (c *ConfigPrinter) SetID(value string) error

SetID is used to conform to the UnmarshallIdentifier interface for deserializing from jsonapi documents.

func (ConfigPrinter) String

func (c ConfigPrinter) String() string

String returns the values as a newline delimited string

type DatabaseBackupMode

type DatabaseBackupMode string
var (
	DatabaseBackupModeNone DatabaseBackupMode = "none"
	DatabaseBackupModeLite DatabaseBackupMode = "lite"
	DatabaseBackupModeFull DatabaseBackupMode = "full"
)

type EnvPrinter

type EnvPrinter struct {
	AdvisoryLockCheckInterval                  time.Duration   `json:"ADVISORY_LOCK_CHECK_INTERVAL"`
	AdvisoryLockID                             int64           `json:"ADVISORY_LOCK_ID"`
	AllowOrigins                               string          `json:"ALLOW_ORIGINS"`
	BlockBackfillDepth                         uint64          `json:"BLOCK_BACKFILL_DEPTH"`
	BlockHistoryEstimatorBlockDelay            uint16          `json:"GAS_UPDATER_BLOCK_DELAY"`
	BlockHistoryEstimatorBlockHistorySize      uint16          `json:"GAS_UPDATER_BLOCK_HISTORY_SIZE"`
	BlockHistoryEstimatorTransactionPercentile uint16          `json:"GAS_UPDATER_TRANSACTION_PERCENTILE"`
	BridgeResponseURL                          string          `json:"BRIDGE_RESPONSE_URL,omitempty"`
	ChainType                                  string          `json:"CHAIN_TYPE"`
	ClientNodeURL                              string          `json:"CLIENT_NODE_URL"`
	DatabaseBackupFrequency                    time.Duration   `json:"DATABASE_BACKUP_FREQUENCY"`
	DatabaseBackupMode                         string          `json:"DATABASE_BACKUP_MODE"`
	DatabaseBackupOnVersionUpgrade             bool            `json:"DATABASE_BACKUP_ON_VERSION_UPGRADE"`
	DatabaseLockingMode                        string          `json:"DATABASE_LOCKING_MODE"`
	DefaultChainID                             string          `json:"ETH_CHAIN_ID"`
	DefaultHTTPLimit                           int64           `json:"DEFAULT_HTTP_LIMIT"`
	DefaultHTTPTimeout                         models.Duration `json:"DEFAULT_HTTP_TIMEOUT"`
	Dev                                        bool            `json:"CHAINLINK_DEV"`
	ShutdownGracePeriod                        time.Duration   `json:"SHUTDOWN_GRACE_PERIOD"`
	EVMRPCEnabled                              bool            `json:"EVM_RPC_ENABLED"`
	EthereumHTTPURL                            string          `json:"ETH_HTTP_URL"`
	EthereumSecondaryURLs                      []string        `json:"ETH_SECONDARY_URLS"`
	EthereumURL                                string          `json:"ETH_URL"`
	ExplorerURL                                string          `json:"EXPLORER_URL"`
	FMDefaultTransactionQueueDepth             uint32          `json:"FM_DEFAULT_TRANSACTION_QUEUE_DEPTH"`
	FeatureExternalInitiators                  bool            `json:"FEATURE_EXTERNAL_INITIATORS"`
	FeatureOffchainReporting                   bool            `json:"FEATURE_OFFCHAIN_REPORTING"`
	GasEstimatorMode                           string          `json:"GAS_ESTIMATOR_MODE"`
	InsecureFastScrypt                         bool            `json:"INSECURE_FAST_SCRYPT"`
	JSONConsole                                bool            `json:"JSON_CONSOLE"`
	JobPipelineReaperInterval                  time.Duration   `json:"JOB_PIPELINE_REAPER_INTERVAL"`
	JobPipelineReaperThreshold                 time.Duration   `json:"JOB_PIPELINE_REAPER_THRESHOLD"`
	KeeperDefaultTransactionQueueDepth         uint32          `json:"KEEPER_DEFAULT_TRANSACTION_QUEUE_DEPTH"`
	KeeperGasPriceBufferPercent                uint32          `json:"KEEPER_GAS_PRICE_BUFFER_PERCENT"`
	KeeperGasTipCapBufferPercent               uint32          `json:"KEEPER_GAS_TIP_CAP_BUFFER_PERCENT"`
	KeeperBaseFeeBufferPercent                 uint32          `json:"KEEPER_BASE_FEE_BUFFER_PERCENT"`
	KeeperMaximumGracePeriod                   int64           `json:"KEEPER_MAXIMUM_GRACE_PERIOD"`
	KeeperRegistryCheckGasOverhead             uint64          `json:"KEEPER_REGISTRY_CHECK_GAS_OVERHEAD"`
	KeeperRegistryPerformGasOverhead           uint64          `json:"KEEPER_REGISTRY_PERFORM_GAS_OVERHEAD"`
	KeeperRegistrySyncInterval                 time.Duration   `json:"KEEPER_REGISTRY_SYNC_INTERVAL"`
	KeeperRegistrySyncUpkeepQueueSize          uint32          `json:"KEEPER_REGISTRY_SYNC_UPKEEP_QUEUE_SIZE"`
	KeeperCheckUpkeepGasPriceFeatureEnabled    bool            `json:"KEEPER_CHECK_UPKEEP_GAS_PRICE_FEATURE_ENABLED"`
	LeaseLockDuration                          time.Duration   `json:"LEASE_LOCK_DURATION"`
	LeaseLockRefreshInterval                   time.Duration   `json:"LEASE_LOCK_REFRESH_INTERVAL"`
	FlagsContractAddress                       string          `json:"FLAGS_CONTRACT_ADDRESS"`
	LinkContractAddress                        string          `json:"LINK_CONTRACT_ADDRESS"`
	LogFileDir                                 string          `json:"LOG_FILE_DIR"`
	LogLevel                                   zapcore.Level   `json:"LOG_LEVEL"`
	LogSQL                                     bool            `json:"LOG_SQL"`
	LogFileMaxSize                             utils.FileSize  `json:"LOG_FILE_MAX_SIZE"`
	LogFileMaxAge                              int64           `json:"LOG_FILE_MAX_AGE"`
	LogFileMaxBackups                          int64           `json:"LOG_FILE_MAX_BACKUPS"`
	TriggerFallbackDBPollInterval              time.Duration   `json:"JOB_PIPELINE_DB_POLL_INTERVAL"`

	// OCR1
	OCRContractTransmitterTransmitTimeout time.Duration `json:"OCR_CONTRACT_TRANSMITTER_TRANSMIT_TIMEOUT"`
	OCRDatabaseTimeout                    time.Duration `json:"OCR_DATABASE_TIMEOUT"`
	OCRDefaultTransactionQueueDepth       uint32        `json:"OCR_DEFAULT_TRANSACTION_QUEUE_DEPTH"`
	OCRTraceLogging                       bool          `json:"OCR_TRACE_LOGGING"`

	// P2P General
	P2PNetworkingStack           string `json:"P2P_NETWORKING_STACK"`
	P2PPeerID                    string `json:"P2P_PEER_ID"`
	P2PIncomingMessageBufferSize int    `json:"P2P_INCOMING_MESSAGE_BUFFER_SIZE"`
	P2POutgoingMessageBufferSize int    `json:"P2P_OUTGOING_MESSAGE_BUFFER_SIZE"`

	// P2P V1
	P2PBootstrapPeers         []string      `json:"P2P_BOOTSTRAP_PEERS"`
	P2PListenIP               string        `json:"P2P_LISTEN_IP"`
	P2PListenPort             string        `json:"P2P_LISTEN_PORT"`
	P2PNewStreamTimeout       time.Duration `json:"P2P_NEW_STREAM_TIMEOUT"`
	P2PDHTLookupInterval      int           `json:"P2P_DHT_LOOKUP_INTERVAL"`
	P2PBootstrapCheckInterval time.Duration `json:"P2P_BOOTSTRAP_CHECK_INTERVAL"`

	// P2P V2
	P2PV2AnnounceAddresses []string        `json:"P2PV2_ANNOUNCE_ADDRESSES"`
	P2PV2Bootstrappers     []string        `json:"P2PV2_BOOTSTRAPPERS"`
	P2PV2DeltaDial         models.Duration `json:"P2PV2_DELTA_DIAL"`
	P2PV2DeltaReconcile    models.Duration `json:"P2PV2_DELTA_RECONCILE"`
	P2PV2ListenAddresses   []string        `json:"P2PV2_LISTEN_ADDRESSES"`

	Port                         uint16          `json:"CHAINLINK_PORT"`
	ReaperExpiration             models.Duration `json:"REAPER_EXPIRATION"`
	RootDir                      string          `json:"ROOT"`
	SecureCookies                bool            `json:"SECURE_COOKIES"`
	SessionTimeout               models.Duration `json:"SESSION_TIMEOUT"`
	TelemetryIngressLogging      bool            `json:"TELEMETRY_INGRESS_LOGGING"`
	TelemetryIngressServerPubKey string          `json:"TELEMETRY_INGRESS_SERVER_PUB_KEY"`
	TelemetryIngressURL          string          `json:"TELEMETRY_INGRESS_URL"`
	TLSHost                      string          `json:"CHAINLINK_TLS_HOST"`
	TLSPort                      uint16          `json:"CHAINLINK_TLS_PORT"`
	TLSRedirect                  bool            `json:"CHAINLINK_TLS_REDIRECT"`
}

EnvPrinter contains the supported environment variables

type FeatureFlags added in v1.2.0

type FeatureFlags interface {
	FeatureExternalInitiators() bool
	FeatureFeedsManager() bool
	FeatureOffchainReporting() bool
	FeatureOffchainReporting2() bool
	FeatureUICSAKeys() bool

	AutoPprofEnabled() bool
	EVMEnabled() bool
	EVMRPCEnabled() bool
	KeeperCheckUpkeepGasPriceFeatureEnabled() bool
	P2PEnabled() bool
	SolanaEnabled() bool
	TerraEnabled() bool
}

FeatureFlags contains bools that toggle various features or chains TODO: document the new ones

type FilePersistedSecretGenerator

type FilePersistedSecretGenerator struct{}

func (FilePersistedSecretGenerator) Generate

func (f FilePersistedSecretGenerator) Generate(rootDir string) ([]byte, error)

type GeneralConfig

type GeneralConfig interface {
	GeneralOnlyConfig
	GlobalConfig
}

func NewGeneralConfig

func NewGeneralConfig(lggr logger.Logger) GeneralConfig

NewGeneralConfig returns the config with the environment variables set to their respective fields, or their defaults if environment variables are not set.

type GeneralOnlyConfig

type GeneralOnlyConfig interface {
	Validate() error
	SetLogLevel(lvl zapcore.Level) error
	SetLogSQL(logSQL bool)

	FeatureFlags

	AdminCredentialsFile() string
	AdvisoryLockCheckInterval() time.Duration
	AdvisoryLockID() int64
	AllowOrigins() string
	AppID() uuid.UUID
	AuthenticatedRateLimit() int64
	AuthenticatedRateLimitPeriod() models.Duration
	AutoPprofBlockProfileRate() int
	AutoPprofCPUProfileRate() int
	AutoPprofGatherDuration() models.Duration
	AutoPprofGatherTraceDuration() models.Duration
	AutoPprofGoroutineThreshold() int
	AutoPprofMaxProfileSize() utils.FileSize
	AutoPprofMemProfileRate() int
	AutoPprofMemThreshold() utils.FileSize
	AutoPprofMutexProfileFraction() int
	AutoPprofPollInterval() models.Duration
	AutoPprofProfileRoot() string
	BlockBackfillDepth() uint64
	BlockBackfillSkip() bool
	BridgeResponseURL() *url.URL
	CertFile() string
	ClientNodeURL() string
	DatabaseBackupDir() string
	DatabaseBackupFrequency() time.Duration
	DatabaseBackupMode() DatabaseBackupMode
	DatabaseBackupOnVersionUpgrade() bool
	DatabaseBackupURL() *url.URL
	DatabaseListenerMaxReconnectDuration() time.Duration
	DatabaseListenerMinReconnectInterval() time.Duration
	DatabaseLockingMode() string
	DatabaseURL() url.URL
	DefaultChainID() *big.Int
	DefaultHTTPAllowUnrestrictedNetworkAccess() bool
	DefaultHTTPLimit() int64
	DefaultHTTPTimeout() models.Duration
	DefaultLogLevel() zapcore.Level
	Dev() bool
	ShutdownGracePeriod() time.Duration
	EthereumHTTPURL() *url.URL
	EthereumNodes() string
	EthereumSecondaryURLs() []url.URL
	EthereumURL() string
	ExplorerAccessKey() string
	ExplorerSecret() string
	ExplorerURL() *url.URL
	FMDefaultTransactionQueueDepth() uint32
	FMSimulateTransactions() bool
	GetAdvisoryLockIDConfiguredOrDefault() int64
	GetDatabaseDialectConfiguredOrDefault() dialects.DialectName
	HTTPServerWriteTimeout() time.Duration
	InsecureFastScrypt() bool
	InsecureSkipVerify() bool
	JSONConsole() bool
	JobPipelineMaxRunDuration() time.Duration
	JobPipelineReaperInterval() time.Duration
	JobPipelineReaperThreshold() time.Duration
	JobPipelineResultWriteQueueDepth() uint64
	KeeperDefaultTransactionQueueDepth() uint32
	KeeperGasPriceBufferPercent() uint32
	KeeperGasTipCapBufferPercent() uint32
	KeeperBaseFeeBufferPercent() uint32
	KeeperMaximumGracePeriod() int64
	KeeperRegistryCheckGasOverhead() uint64
	KeeperRegistryPerformGasOverhead() uint64
	KeeperRegistrySyncInterval() time.Duration
	KeeperRegistrySyncUpkeepQueueSize() uint32
	KeyFile() string
	LeaseLockDuration() time.Duration
	LeaseLockRefreshInterval() time.Duration
	LogFileDir() string
	LogLevel() zapcore.Level
	LogSQL() bool
	LogFileMaxSize() utils.FileSize
	LogFileMaxAge() int64
	LogFileMaxBackups() int64
	LogUnixTimestamps() bool
	MigrateDatabase() bool
	ORMMaxIdleConns() int
	ORMMaxOpenConns() int
	Port() uint16
	RPID() string
	RPOrigin() string
	ReaperExpiration() models.Duration
	RootDir() string
	SecureCookies() bool
	SessionOptions() sessions.Options
	SessionSecret() ([]byte, error)
	SessionTimeout() models.Duration
	TLSCertPath() string
	TLSDir() string
	TLSHost() string
	TLSKeyPath() string
	TLSPort() uint16
	TLSRedirect() bool
	TelemetryIngressLogging() bool
	TelemetryIngressUniConn() bool
	TelemetryIngressServerPubKey() string
	TelemetryIngressURL() *url.URL
	TelemetryIngressBufferSize() uint
	TelemetryIngressMaxBatchSize() uint
	TelemetryIngressSendInterval() time.Duration
	TelemetryIngressSendTimeout() time.Duration
	TelemetryIngressUseBatchSend() bool
	TriggerFallbackDBPollInterval() time.Duration
	UnAuthenticatedRateLimit() int64
	UnAuthenticatedRateLimitPeriod() models.Duration
}

type GlobalConfig

type GlobalConfig interface {
	GlobalBalanceMonitorEnabled() (bool, bool)
	GlobalBlockEmissionIdleWarningThreshold() (time.Duration, bool)
	GlobalBlockHistoryEstimatorBatchSize() (uint32, bool)
	GlobalBlockHistoryEstimatorBlockDelay() (uint16, bool)
	GlobalBlockHistoryEstimatorBlockHistorySize() (uint16, bool)
	GlobalBlockHistoryEstimatorEIP1559FeeCapBufferBlocks() (uint16, bool)
	GlobalBlockHistoryEstimatorTransactionPercentile() (uint16, bool)
	GlobalChainType() (string, bool)
	GlobalEthTxReaperInterval() (time.Duration, bool)
	GlobalEthTxReaperThreshold() (time.Duration, bool)
	GlobalEthTxResendAfterThreshold() (time.Duration, bool)
	GlobalEvmDefaultBatchSize() (uint32, bool)
	GlobalEvmEIP1559DynamicFees() (bool, bool)
	GlobalEvmFinalityDepth() (uint32, bool)
	GlobalEvmGasBumpPercent() (uint16, bool)
	GlobalEvmGasBumpThreshold() (uint64, bool)
	GlobalEvmGasBumpTxDepth() (uint16, bool)
	GlobalEvmGasBumpWei() (*big.Int, bool)
	GlobalEvmGasFeeCapDefault() (*big.Int, bool)
	GlobalEvmGasLimitDefault() (uint64, bool)
	GlobalEvmGasLimitMultiplier() (float32, bool)
	GlobalEvmGasLimitTransfer() (uint64, bool)
	GlobalEvmGasPriceDefault() (*big.Int, bool)
	GlobalEvmGasTipCapDefault() (*big.Int, bool)
	GlobalEvmGasTipCapMinimum() (*big.Int, bool)
	GlobalEvmHeadTrackerHistoryDepth() (uint32, bool)
	GlobalEvmHeadTrackerMaxBufferSize() (uint32, bool)
	GlobalEvmHeadTrackerSamplingInterval() (time.Duration, bool)
	GlobalEvmLogBackfillBatchSize() (uint32, bool)
	GlobalEvmMaxGasPriceWei() (*big.Int, bool)
	GlobalEvmMaxInFlightTransactions() (uint32, bool)
	GlobalEvmMaxQueuedTransactions() (uint64, bool)
	GlobalEvmMinGasPriceWei() (*big.Int, bool)
	GlobalEvmNonceAutoSync() (bool, bool)
	GlobalEvmRPCDefaultBatchSize() (uint32, bool)
	GlobalFlagsContractAddress() (string, bool)
	GlobalGasEstimatorMode() (string, bool)
	GlobalLinkContractAddress() (string, bool)
	GlobalMinIncomingConfirmations() (uint32, bool)
	GlobalMinRequiredOutgoingConfirmations() (uint64, bool)
	GlobalMinimumContractPayment() (*assets.Link, bool)
	GlobalNodeNoNewHeadsThreshold() (time.Duration, bool)
	GlobalNodePollFailureThreshold() (uint32, bool)
	GlobalNodePollInterval() (time.Duration, bool)

	OCR1Config
	OCR2Config
	P2PNetworking
	P2PV1Networking
	P2PV2Networking
}

GlobalConfig holds global ENV overrides for EVM chains If set the global ENV will override everything The second bool indicates if it is set or not

type OCR1Config added in v1.2.0

type OCR1Config interface {
	// OCR1 config, can override in jobs, only ethereum.
	GlobalOCRContractConfirmations() (uint16, bool)
	GlobalOCRContractTransmitterTransmitTimeout() (time.Duration, bool)
	GlobalOCRDatabaseTimeout() (time.Duration, bool)
	GlobalOCRObservationGracePeriod() (time.Duration, bool)
	OCRBlockchainTimeout() time.Duration
	OCRContractPollInterval() time.Duration
	OCRContractSubscribeInterval() time.Duration
	OCRMonitoringEndpoint() string
	OCRKeyBundleID() (string, error)
	OCRObservationTimeout() time.Duration
	OCRSimulateTransactions() bool
	OCRTransmitterAddress() (ethkey.EIP55Address, error) // OCR2 can support non-evm changes
	// OCR1 config, cannot override in jobs
	OCRTraceLogging() bool
	OCRDefaultTransactionQueueDepth() uint32
}

OCR1Config is a subset of global config relevant to OCR v1.

type OCR2Config added in v1.2.0

type OCR2Config interface {
	// OCR2 config, can override in jobs, all chains
	OCR2ContractConfirmations() uint16
	OCR2ContractTransmitterTransmitTimeout() time.Duration
	OCR2BlockchainTimeout() time.Duration
	OCR2DatabaseTimeout() time.Duration
	OCR2ContractPollInterval() time.Duration
	OCR2ContractSubscribeInterval() time.Duration
	OCR2MonitoringEndpoint() string
	OCR2KeyBundleID() (string, error)
	// OCR2 config, cannot override in jobs
	OCR2TraceLogging() bool
}

OCR2Config is a subset of global config relevant to OCR v2.

type P2PDeprecated added in v1.2.0

type P2PDeprecated interface {
	// DEPRECATED - HERE FOR BACKWARDS COMPATIBILITY
	OCRNewStreamTimeout() time.Duration
	OCRBootstrapCheckInterval() time.Duration
	OCRDHTLookupInterval() int
	OCRIncomingMessageBufferSize() int
	OCROutgoingMessageBufferSize() int
}

type P2PNetworking added in v1.2.0

type P2PNetworking interface {
	P2PNetworkingStack() (n ocrnetworking.NetworkingStack)
	P2PNetworkingStackRaw() string
	P2PPeerID() p2pkey.PeerID
	P2PPeerIDRaw() string
	P2PIncomingMessageBufferSize() int
	P2POutgoingMessageBufferSize() int
	P2PDeprecated
}

P2PNetworking is a subset of global config relevant to p2p networking.

type P2PV1Networking added in v1.2.0

type P2PV1Networking interface {
	P2PAnnounceIP() net.IP
	P2PAnnouncePort() uint16
	P2PBootstrapPeers() ([]string, error)
	P2PDHTAnnouncementCounterUserPrefix() uint32
	P2PListenIP() net.IP
	P2PListenPort() uint16
	P2PListenPortRaw() string
	P2PNewStreamTimeout() time.Duration
	P2PBootstrapCheckInterval() time.Duration
	P2PDHTLookupInterval() int
	P2PPeerstoreWriteInterval() time.Duration
}

P2PV1Networking is a subset of global config relevant to p2p v1 networking.

type P2PV2Networking added in v1.2.0

type P2PV2Networking interface {
	P2PV2AnnounceAddresses() []string
	P2PV2Bootstrappers() (locators []ocrcommontypes.BootstrapperLocator)
	P2PV2BootstrappersRaw() []string
	P2PV2DeltaDial() models.Duration
	P2PV2DeltaReconcile() models.Duration
	P2PV2ListenAddresses() []string
}

P2PV2Networking is a subset of global config relevant to p2p v2 networking.

type SecretGenerator

type SecretGenerator interface {
	Generate(string) ([]byte, error)
}

SecretGenerator is the interface for objects that generate a secret used to sign or encrypt.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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