actions_seth

package
v0.0.0-...-4e62b15 Latest Latest
Warning

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

Go to latest
Published: May 2, 2024 License: MIT Imports: 26 Imported by: 2

Documentation

Index

Constants

View Source
const (
	InsufficientFundsErr = "insufficient funds"
	GasTooLowErr         = "gas too low"
	OvershotErr          = "overshot"
)

Variables

View Source
var (
	RetrySuccessfulMsg = "Retry successful"
	NotSupportedMsg    = "Error not supported. Passing to next retrier"
)
View Source
var ContractDeploymentInterval = 200

Functions

func AcceptAuthorizedReceiversOperator

func AcceptAuthorizedReceiversOperator(
	t *testing.T,
	logger zerolog.Logger,
	seth *seth.Client,
	operator common.Address,
	authorizedForwarder common.Address,
	nodeAddresses []common.Address,
)

AcceptAuthorizedReceiversOperator sets authorized receivers for each operator contract to authorizedForwarder and authorized EA to nodeAddresses. Once done, it confirms that authorizations were set correctly.

func ConfigureOCRv2AggregatorContracts

func ConfigureOCRv2AggregatorContracts(
	contractConfig *contracts.OCRv2Config,
	ocrv2Contracts []contracts.OffchainAggregatorV2,
) error

ConfigureOCRv2AggregatorContracts sets configuration for a number of OCRv2 contracts

func DeleteAllJobs

func DeleteAllJobs(chainlinkNodes []*client.ChainlinkK8sClient) error

DeleteAllJobs deletes all jobs from all chainlink nodes added here temporarily to avoid circular import

func DeployForwarderContracts

func DeployForwarderContracts(
	t *testing.T,
	seth *seth.Client,
	linkTokenAddress common.Address,
	numberOfOperatorForwarderPairs int,
) (operators []common.Address, authorizedForwarders []common.Address, operatorFactoryInstance contracts.OperatorFactory)

DeployForwarderContracts first deploys Operator Factory and then uses it to deploy given number of operator and forwarder pairs. It waits for each transaction to be mined and then extracts operator and forwarder addresses from emitted events.

func DeployOCRContractsForwarderFlow

func DeployOCRContractsForwarderFlow(
	logger zerolog.Logger,
	seth *seth.Client,
	numberOfContracts int,
	linkTokenContractAddress common.Address,
	workerNodes []contracts.ChainlinkNodeWithKeysAndAddress,
	forwarderAddresses []common.Address,
) ([]contracts.OffchainAggregator, error)

DeployOCRContractsForwarderFlow deploys and funds a certain number of offchain aggregator contracts with forwarders as effectiveTransmitters

func DeployOCRv1Contracts

func DeployOCRv1Contracts(
	logger zerolog.Logger,
	seth *seth.Client,
	numberOfContracts int,
	linkTokenContractAddress common.Address,
	workerNodes []contracts.ChainlinkNodeWithKeysAndAddress,
) ([]contracts.OffchainAggregator, error)

DeployOCRv1Contracts deploys and funds a certain number of offchain aggregator contracts

func DeployOCRv2Contracts

func DeployOCRv2Contracts(
	l zerolog.Logger,
	seth *seth.Client,
	numberOfContracts int,
	linkTokenAddress common.Address,
	transmitters []string,
	ocrOptions contracts.OffchainOptions,
) ([]contracts.OffchainAggregatorV2, error)

DeployOCRv2Contracts deploys a number of OCRv2 contracts and configures them with defaults

func FundChainlinkNodes

func FundChainlinkNodes(
	logger zerolog.Logger,
	client *seth.Client,
	nodes []contracts.ChainlinkNodeWithKeysAndAddress,
	privateKey *ecdsa.PrivateKey,
	amount *big.Float,
) error

FundChainlinkNodes sends native token amount (expressed in human-scale) to each Chainlink Node from private key's address. It returns an error if any of the transactions failed.

func FundChainlinkNodesFromRootAddress

func FundChainlinkNodesFromRootAddress(
	logger zerolog.Logger,
	client *seth.Client,
	nodes []contracts.ChainlinkNodeWithKeysAndAddress,
	amount *big.Float,
) error

FundChainlinkNodesFromRootAddress sends native token amount (expressed in human-scale) to each Chainlink Node from root private key. It returns an error if any of the transactions failed.

func ReturnFunds

func ReturnFunds(log zerolog.Logger, sethClient *seth.Client, chainlinkNodes []contracts.ChainlinkNodeWithKeysAndAddress) error

ReturnFunds returns funds from the given chainlink nodes to the default network wallet. It will use a variety of strategies to attempt to return funds, including retrying with less funds if the transaction fails due to insufficient funds, and retrying with a higher gas limit if the transaction fails due to gas too low.

func SendFunds

func SendFunds(logger zerolog.Logger, client *seth.Client, payload FundsToSendPayload) (*types.Receipt, error)

TODO: move to CTF? SendFunds sends native token amount (expressed in human-scale) from address controlled by private key to given address. You can override any or none of the following: gas limit, gas price, gas fee cap, gas tip cap. Values that are not set will be estimated or taken from config.

func StartNewRound

func StartNewRound(
	ocrInstances []contracts.OffChainAggregatorWithRounds,
) error

StartNewRound requests a new round from the ocr contracts and returns once transaction was mined

func TeardownRemoteSuite

func TeardownRemoteSuite(
	t *testing.T,
	client *seth.Client,
	namespace string,
	chainlinkNodes []*client.ChainlinkK8sClient,
	optionalTestReporter testreporters.TestReporter,
	grafnaUrlProvider testreporters.GrafanaURLProvider,
) error

TeardownRemoteSuite sends a report and returns funds from chainlink nodes to network's default wallet

func TrackForwarder

func TrackForwarder(
	t *testing.T,
	seth *seth.Client,
	authorizedForwarder common.Address,
	node contracts.ChainlinkNodeWithForwarder,
)

TrackForwarder creates forwarder track for a given Chainlink node

func WatchNewFluxRound

func WatchNewFluxRound(
	l zerolog.Logger,
	seth *seth.Client,
	roundNumber int64,
	fluxInstance contracts.FluxAggregator,
	timeout time.Duration,
) error

func WatchNewOCRRound

func WatchNewOCRRound(
	l zerolog.Logger,
	seth *seth.Client,
	roundNumber int64,
	ocrInstances []contracts.OffChainAggregatorWithRounds,
	timeout time.Duration,
) error

WatchNewOCRRound watches for a new OCR round, similarly to StartNewRound, but it does not explicitly request a new round from the contract, as this can cause some odd behavior in some cases. It announces success if latest round is >= roundNumber.

Types

type FundsToSendPayload

type FundsToSendPayload struct {
	ToAddress  common.Address
	Amount     *big.Int
	PrivateKey *ecdsa.PrivateKey
	GasLimit   *int64
	GasPrice   *big.Int
	GasFeeCap  *big.Int
	GasTipCap  *big.Int
	TxTimeout  *time.Duration
}

type GasTooLowTransferRetrier

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

GasTooLowTransferRetrier will retry a failed funds transfer transaction if the error is due to gas too low by doubling the gas limit and retrying until reaching maxGasLimit

func (*GasTooLowTransferRetrier) Retry

func (r *GasTooLowTransferRetrier) Retry(ctx context.Context, logger zerolog.Logger, client *seth.Client, txErr error, payload FundsToSendPayload, currentAttempt int) error

type InsufficientFundTransferRetrier

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

InsufficientFundTransferRetrier will retry a failed funds transfer transaction if the error is due to insufficient funds by subtracting 1 Gwei from amount to send and retrying it up to maxRetries times

func (*InsufficientFundTransferRetrier) Retry

func (r *InsufficientFundTransferRetrier) Retry(ctx context.Context, logger zerolog.Logger, client *seth.Client, txErr error, payload FundsToSendPayload, currentAttempt int) error

type OvershotTransferRetrier

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

OvershotTransferRetrier will retry a failed funds transfer transaction if the error is due to overshot by subtracting the overshot amount from the amount to send and retrying it up to maxRetries times

func (*OvershotTransferRetrier) Retry

func (r *OvershotTransferRetrier) Retry(ctx context.Context, logger zerolog.Logger, client *seth.Client, txErr error, payload FundsToSendPayload, currentAttempt int) error

type TransactionRetrier

type TransactionRetrier interface {
	Retry(ctx context.Context, logger zerolog.Logger, client *seth.Client, txErr error, payload FundsToSendPayload, currentAttempt int) error
}

TransactionRetrier is an interface that every retrier of failed funds transfer transaction needs to implement

Jump to

Keyboard shortcuts

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