actions

package
v0.0.0-...-2e99468 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2024 License: MIT Imports: 58 Imported by: 7

Documentation

Overview

Package actions enables common chainlink interactions

Package actions enables common chainlink interactions

Index

Constants

This section is empty.

Variables

View Source
var ContractDeploymentInterval = 200

ContractDeploymentInterval After how many contract actions to wait before starting any more Example: When deploying 1000 contracts, stop every ContractDeploymentInterval have been deployed to wait before continuing

View Source
var ZeroAddress = common.Address{}

Functions

func AcceptAuthorizedReceiversOperator deprecated

func AcceptAuthorizedReceiversOperator(
	t *testing.T,
	operator common.Address,
	authorizedForwarder common.Address,
	nodeAddresses []common.Address,
	chainClient blockchain.EVMClient,
	contractLoader contracts.ContractLoader,
)

Deprecated: we are moving away from blockchain.EVMClient, use actions_seth.AcceptAuthorizedReceiversOperator

func BuildAutoOCR2ConfigVars

func BuildAutoOCR2ConfigVars(
	t *testing.T,
	chainlinkNodes []*client.ChainlinkK8sClient,
	registryConfig contracts.KeeperRegistrySettings,
	registrar string,
	deltaStage time.Duration,
	chainModuleAddress common.Address,
	reorgProtectionEnabled bool,
) (contracts.OCRv2Config, error)

func BuildAutoOCR2ConfigVarsLocal

func BuildAutoOCR2ConfigVarsLocal(
	l zerolog.Logger,
	chainlinkNodes []*client.ChainlinkClient,
	registryConfig contracts.KeeperRegistrySettings,
	registrar string,
	deltaStage time.Duration,
	registryOwnerAddress common.Address,
	chainModuleAddress common.Address,
	reorgProtectionEnabled bool,
) (contracts.OCRv2Config, error)

func BuildAutoOCR2ConfigVarsWithKeyIndex

func BuildAutoOCR2ConfigVarsWithKeyIndex(
	t *testing.T,
	chainlinkNodes []*client.ChainlinkK8sClient,
	registryConfig contracts.KeeperRegistrySettings,
	registrar string,
	deltaStage time.Duration,
	keyIndex int,
	registryOwnerAddress common.Address,
	chainModuleAddress common.Address,
	reorgProtectionEnabled bool,
) (contracts.OCRv2Config, error)

func BuildAutoOCR2ConfigVarsWithKeyIndexLocal

func BuildAutoOCR2ConfigVarsWithKeyIndexLocal(
	l zerolog.Logger,
	chainlinkNodes []*client.ChainlinkClient,
	registryConfig contracts.KeeperRegistrySettings,
	registrar string,
	deltaStage time.Duration,
	keyIndex int,
	registryOwnerAddress common.Address,
	chainModuleAddress common.Address,
	reorgProtectionEnabled bool,
) (contracts.OCRv2Config, error)

func BuildMedianOCR2Config

func BuildMedianOCR2Config(
	workerNodes []*client.ChainlinkK8sClient,
	ocrOffchainOptions contracts.OffchainOptions,
) (*contracts.OCRv2Config, error)

BuildMedianOCR2Config builds a default OCRv2 config for the given chainlink nodes for a standard median aggregation job

func BuildMedianOCR2ConfigLocal

func BuildMedianOCR2ConfigLocal(workerNodes []*client.ChainlinkClient, ocrOffchainOptions contracts.OffchainOptions) (*contracts.OCRv2Config, error)

func BuildNodeContractPairID

func BuildNodeContractPairID(node contracts.ChainlinkNodeWithKeysAndAddress, ocrInstance contracts.OffchainAggregator) (string, error)

BuildNodeContractPairID builds a UUID based on a related pair of a Chainlink node and OCR contract

func BuildOCR2NodeContractPairID

func BuildOCR2NodeContractPairID(node *client.ChainlinkK8sClient, ocrInstance contracts.OffchainAggregatorV2) (string, error)

BuildOCR2NodeContractPairID builds a UUID based on a related pair of a Chainlink node and OCRv2 contract

func ChainlinkNodeAddresses

func ChainlinkNodeAddresses(nodes []*client.ChainlinkK8sClient) ([]common.Address, error)

ChainlinkNodeAddresses will return all the on-chain wallet addresses for a set of Chainlink nodes

func ChainlinkNodeAddressesAtIndex

func ChainlinkNodeAddressesAtIndex(nodes []*client.ChainlinkK8sClient, keyIndex int) ([]common.Address, error)

ChainlinkNodeAddressesAtIndex will return all the on-chain wallet addresses for a set of Chainlink nodes

func ChainlinkNodeAddressesLocal

func ChainlinkNodeAddressesLocal(nodes []*client.ChainlinkClient) ([]common.Address, error)

func ConfigureOCRv2AggregatorContracts deprecated

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

Deprecated: we are moving away from blockchain.EVMClient, use actions_seth.ConfigureOCRv2AggregatorContracts

func CreateKeeperJobs

func CreateKeeperJobs(
	t *testing.T,
	chainlinkNodes []*client.ChainlinkK8sClient,
	keeperRegistry contracts.KeeperRegistry,
	ocrConfig contracts.OCRv2Config,
	evmChainID string,
)

func CreateKeeperJobsLocal

func CreateKeeperJobsLocal(
	l zerolog.Logger,
	chainlinkNodes []*client.ChainlinkClient,
	keeperRegistry contracts.KeeperRegistry,
	ocrConfig contracts.OCRv2Config,
	evmChainID string,
) ([]*client.Job, error)

func CreateKeeperJobsWithKeyIndex

func CreateKeeperJobsWithKeyIndex(
	t *testing.T,
	chainlinkNodes []*client.ChainlinkK8sClient,
	keeperRegistry contracts.KeeperRegistry,
	keyIndex int,
	ocrConfig contracts.OCRv2Config,
	evmChainID string,
)

func CreateOCRJobs

func CreateOCRJobs(
	ocrInstances []contracts.OffchainAggregator,
	bootstrapNode *client.ChainlinkK8sClient,
	workerNodes []*client.ChainlinkK8sClient,
	mockValue int,
	mockserver *ctfClient.MockserverClient,
	evmChainID string,
) error

CreateOCRJobs bootstraps the first node and to the other nodes sends ocr jobs that read from different adapters, to be used in combination with SetAdapterResponses

func CreateOCRJobsLocal

func CreateOCRJobsLocal(
	ocrInstances []contracts.OffchainAggregator,
	bootstrapNode *client.ChainlinkClient,
	workerNodes []*client.ChainlinkClient,
	mockValue int,
	mockAdapter *test_env.Killgrave,
	evmChainID *big.Int,
) error

func CreateOCRJobsWithForwarder

func CreateOCRJobsWithForwarder(
	t *testing.T,
	ocrInstances []contracts.OffchainAggregator,
	bootstrapNode *client.ChainlinkK8sClient,
	workerNodes []*client.ChainlinkK8sClient,
	mockValue int,
	mockserver *ctfClient.MockserverClient,
	evmChainID int64,
)

CreateOCRJobsWithForwarder bootstraps the first node and to the other nodes sends ocr jobs that read from different adapters, to be used in combination with SetAdapterResponses

func CreateOCRJobsWithForwarderLocal

func CreateOCRJobsWithForwarderLocal(
	ocrInstances []contracts.OffchainAggregator,
	bootstrapNode *client.ChainlinkClient,
	workerNodes []*client.ChainlinkClient,
	mockValue int,
	mockAdapter *test_env.Killgrave,
	evmChainID string,
) error

func CreateOCRKeeperJobs

func CreateOCRKeeperJobs(
	t *testing.T,
	chainlinkNodes []*client.ChainlinkK8sClient,
	registryAddr string,
	chainID int64,
	keyIndex int,
	registryVersion ethereum.KeeperRegistryVersion,
)

CreateOCRKeeperJobs bootstraps the first node and to the other nodes sends ocr jobs

func CreateOCRKeeperJobsLocal

func CreateOCRKeeperJobsLocal(
	l zerolog.Logger,
	chainlinkNodes []*client.ChainlinkClient,
	registryAddr string,
	chainID int64,
	keyIndex int,
	registryVersion ethereum.KeeperRegistryVersion,
) error

CreateOCRKeeperJobs bootstraps the first node and to the other nodes sends ocr jobs

func CreateOCRv2Jobs

func CreateOCRv2Jobs(
	ocrInstances []contracts.OffchainAggregatorV2,
	bootstrapNode *client.ChainlinkK8sClient,
	workerChainlinkNodes []*client.ChainlinkK8sClient,
	mockserver *ctfClient.MockserverClient,
	mockServerValue int,
	chainId int64,
	forwardingAllowed bool,
) error

CreateOCRv2Jobs bootstraps the first node and to the other nodes sends ocr jobs that read from different adapters, to be used in combination with SetAdapterResponses

func CreateOCRv2JobsLocal

func CreateOCRv2JobsLocal(
	ocrInstances []contracts.OffchainAggregatorV2,
	bootstrapNode *client.ChainlinkClient,
	workerChainlinkNodes []*client.ChainlinkClient,
	mockAdapter *test_env.Killgrave,
	mockAdapterPath string,
	mockAdapterValue int,
	chainId uint64,
	forwardingAllowed bool,
	enableChainReaderAndCodec bool,
) error

func DecodeTxInputData

func DecodeTxInputData(abiString string, data []byte) (map[string]interface{}, error)

todo - move to CTF

func DeleteAllJobs

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

func DeleteBridges

func DeleteBridges(nodes []*client.ChainlinkClient) error

DeleteBridges will delete ALL bridges from the nodes

func DeleteJobs

func DeleteJobs(nodes []*client.ChainlinkClient) error

DeleteJobs will delete ALL jobs from the nodes

func DeleteKeeperJobsWithId

func DeleteKeeperJobsWithId(t *testing.T, chainlinkNodes []*client.ChainlinkK8sClient, id int)

func DeployAutoOCRRegistryAndRegistrar

func DeployAutoOCRRegistryAndRegistrar(
	t *testing.T,
	registryVersion ethereum.KeeperRegistryVersion,
	registrySettings contracts.KeeperRegistrySettings,
	linkToken contracts.LinkToken,
	contractDeployer contracts.ContractDeployer,
	client blockchain.EVMClient,
) (contracts.KeeperRegistry, contracts.KeeperRegistrar)

DeployAutoOCRRegistryAndRegistrar registry and registrar

func DeployConsumers

func DeployConsumers(t *testing.T, registry contracts.KeeperRegistry, registrar contracts.KeeperRegistrar, linkToken contracts.LinkToken, contractDeployer contracts.ContractDeployer, client blockchain.EVMClient, numberOfUpkeeps int, linkFundsForEachUpkeep *big.Int, upkeepGasLimit uint32, isLogTrigger bool, isMercury bool) ([]contracts.KeeperConsumer, []*big.Int)

func DeployForwarderContracts deprecated

func DeployForwarderContracts(
	t *testing.T,
	contractDeployer contracts.ContractDeployer,
	linkToken contracts.LinkToken,
	chainClient blockchain.EVMClient,
	numberOfOperatorForwarderPairs int,
) (operators []common.Address, authorizedForwarders []common.Address, operatorFactoryInstance contracts.OperatorFactory)

Deprecated: we are moving away from blockchain.EVMClient, use actions_seth.DeployForwarderContracts

func DeployKeeperConsumers

func DeployKeeperConsumers(t *testing.T, contractDeployer contracts.ContractDeployer, client blockchain.EVMClient, numberOfContracts int, isLogTrigger bool, isMercury bool) []contracts.KeeperConsumer

func DeployKeeperConsumersPerformance

func DeployKeeperConsumersPerformance(
	t *testing.T,
	contractDeployer contracts.ContractDeployer,
	client blockchain.EVMClient,
	numberOfContracts int,
	blockRange,
	blockInterval,
	checkGasToBurn,
	performGasToBurn int64,
) []contracts.KeeperConsumerPerformance

func DeployKeeperContracts

func DeployKeeperContracts(
	t *testing.T,
	registryVersion ethereum.KeeperRegistryVersion,
	registrySettings contracts.KeeperRegistrySettings,
	numberOfUpkeeps int,
	upkeepGasLimit uint32,
	linkToken contracts.LinkToken,
	contractDeployer contracts.ContractDeployer,
	client blockchain.EVMClient,
	linkFundsForEachUpkeep *big.Int,
) (contracts.KeeperRegistry, contracts.KeeperRegistrar, []contracts.KeeperConsumer, []*big.Int)

DeployKeeperContracts deploys keeper registry and a number of basic upkeep contracts with an update interval of 5. It returns the freshly deployed registry, registrar, consumers and the IDs of the upkeeps.

func DeployKeeperRegistrar

func DeployKeeperRegistrar(
	t *testing.T,
	registryVersion ethereum.KeeperRegistryVersion,
	linkToken contracts.LinkToken,
	registrarSettings contracts.KeeperRegistrarSettings,
	contractDeployer contracts.ContractDeployer,
	client blockchain.EVMClient,
	registry contracts.KeeperRegistry,
) contracts.KeeperRegistrar

func DeployKeeperRegistry

func DeployKeeperRegistry(
	t *testing.T,
	contractDeployer contracts.ContractDeployer,
	client blockchain.EVMClient,
	registryOpts *contracts.KeeperRegistryOpts,
) contracts.KeeperRegistry

func DeployMockETHLinkFeed

func DeployMockETHLinkFeed(cd contracts.ContractDeployer, answer *big.Int) (contracts.MockETHLINKFeed, error)

func DeployOCRContracts deprecated

func DeployOCRContracts(
	numberOfContracts int,
	linkTokenContract contracts.LinkToken,
	contractDeployer contracts.ContractDeployer,
	workerNodes []*client.ChainlinkK8sClient,
	client blockchain.EVMClient,
) ([]contracts.OffchainAggregator, error)

Deprecated: we are moving away from blockchain.EVMClient, use actions_seth.DeployOCRContracts

func DeployOCRContractsForwarderFlow

func DeployOCRContractsForwarderFlow(
	t *testing.T,
	numberOfContracts int,
	linkTokenContract contracts.LinkToken,
	contractDeployer contracts.ContractDeployer,
	workerNodes []*client.ChainlinkK8sClient,
	forwarderAddresses []common.Address,
	client blockchain.EVMClient,
) []contracts.OffchainAggregator

DeployOCRContractsForwarderFlow deploys and funds a certain number of offchain aggregator contracts with forwarders as effectiveTransmitters Deprecated: we are moving away from blockchain.EVMClient, use actions_seth.DeployOCRContractsForwarderFlow

func DeployOCRContractsForwarderFlowLocal

func DeployOCRContractsForwarderFlowLocal(
	numberOfContracts int,
	linkTokenContract contracts.LinkToken,
	contractDeployer contracts.ContractDeployer,
	workerNodes []*client.ChainlinkClient,
	forwarderAddresses []common.Address,
	client blockchain.EVMClient,
) ([]contracts.OffchainAggregator, error)

func DeployOCRContractsLocal

func DeployOCRContractsLocal(
	numberOfContracts int,
	linkTokenContract contracts.LinkToken,
	contractDeployer contracts.ContractDeployer,
	workerNodes []*client.ChainlinkClient,
	client blockchain.EVMClient,
) ([]contracts.OffchainAggregator, error)

func DeployOCRv2Contracts

func DeployOCRv2Contracts(
	numberOfContracts int,
	linkTokenContract contracts.LinkToken,
	contractDeployer contracts.ContractDeployer,
	transmitters []string,
	client blockchain.EVMClient,
	ocrOptions contracts.OffchainOptions,
) ([]contracts.OffchainAggregatorV2, error)

DeployOCRv2Contracts deploys a number of OCRv2 contracts and configures them with defaults Deprecated: we are moving away from blockchain.EVMClient, use actions_seth.DeployOCRv2Contracts

func DeployPerformDataChecker

func DeployPerformDataChecker(
	t *testing.T,
	contractDeployer contracts.ContractDeployer,
	client blockchain.EVMClient,
	numberOfContracts int,
	expectedData []byte,
) []contracts.KeeperPerformDataChecker

func DeployPerformDataCheckerConsumers

func DeployPerformDataCheckerConsumers(
	t *testing.T,
	registry contracts.KeeperRegistry,
	registrar contracts.KeeperRegistrar,
	linkToken contracts.LinkToken,
	contractDeployer contracts.ContractDeployer,
	client blockchain.EVMClient,
	numberOfUpkeeps int,
	linkFundsForEachUpkeep *big.Int,
	upkeepGasLimit uint32,
	expectedData []byte,
) ([]contracts.KeeperPerformDataChecker, []*big.Int)

func DeployPerformDataCheckerContracts

func DeployPerformDataCheckerContracts(
	t *testing.T,
	registryVersion ethereum.KeeperRegistryVersion,
	numberOfContracts int,
	upkeepGasLimit uint32,
	linkToken contracts.LinkToken,
	contractDeployer contracts.ContractDeployer,
	client blockchain.EVMClient,
	registrySettings *contracts.KeeperRegistrySettings,
	linkFundsForEachUpkeep *big.Int,
	expectedData []byte,
) (contracts.KeeperRegistry, contracts.KeeperRegistrar, []contracts.KeeperPerformDataChecker, []*big.Int)

DeployPerformDataCheckerContracts deploys a set amount of keeper perform data checker contracts registered to a single registry

func DeployPerformanceConsumers

func DeployPerformanceConsumers(
	t *testing.T,
	registry contracts.KeeperRegistry,
	registrar contracts.KeeperRegistrar,
	linkToken contracts.LinkToken,
	contractDeployer contracts.ContractDeployer,
	client blockchain.EVMClient,
	numberOfUpkeeps int,
	linkFundsForEachUpkeep *big.Int,
	upkeepGasLimit uint32,
	blockRange,
	blockInterval,
	checkGasToBurn,
	performGasToBurn int64,
) ([]contracts.KeeperConsumerPerformance, []*big.Int)

func DeployPerformanceKeeperContracts

func DeployPerformanceKeeperContracts(
	t *testing.T,
	registryVersion ethereum.KeeperRegistryVersion,
	numberOfContracts int,
	upkeepGasLimit uint32,
	linkToken contracts.LinkToken,
	contractDeployer contracts.ContractDeployer,
	client blockchain.EVMClient,
	registrySettings *contracts.KeeperRegistrySettings,
	linkFundsForEachUpkeep *big.Int,
	blockRange,
	blockInterval,
	checkGasToBurn,
	performGasToBurn int64,
) (contracts.KeeperRegistry, contracts.KeeperRegistrar, []contracts.KeeperConsumerPerformance, []*big.Int)

DeployPerformanceKeeperContracts deploys a set amount of keeper performance contracts registered to a single registry

func DeployUpkeepCounters

func DeployUpkeepCounters(
	t *testing.T,
	contractDeployer contracts.ContractDeployer,
	client blockchain.EVMClient,
	numberOfContracts int,
	testRange *big.Int,
	interval *big.Int,
) []contracts.UpkeepCounter

func DeployUpkeepPerformCounterRestrictive

func DeployUpkeepPerformCounterRestrictive(
	t *testing.T,
	contractDeployer contracts.ContractDeployer,
	client blockchain.EVMClient,
	numberOfContracts int,
	testRange *big.Int,
	averageEligibilityCadence *big.Int,
) []contracts.UpkeepPerformCounterRestrictive

func DeployUpkeepTranscoder

func DeployUpkeepTranscoder(
	t *testing.T,
	contractDeployer contracts.ContractDeployer,
	client blockchain.EVMClient,
) contracts.UpkeepTranscoder

func EncodeOnChainExternalJobID

func EncodeOnChainExternalJobID(jobID uuid.UUID) [32]byte

EncodeOnChainExternalJobID encodes external job uuid to on-chain representation

func EncodeOnChainVRFProvingKey

func EncodeOnChainVRFProvingKey(vrfKey client.VRFKey) ([2]*big.Int, error)

EncodeOnChainVRFProvingKey encodes uncompressed public VRF key to on-chain representation

func EthereumNetworkConfigFromConfig

func EthereumNetworkConfigFromConfig(l zerolog.Logger, config tc.GlobalTestConfig) (network ctf_test_env.EthereumNetwork, err error)

func ExtractRequestIDFromJobRun

func ExtractRequestIDFromJobRun(jobDecodeData client.RunsResponseData) ([]byte, error)

ExtractRequestIDFromJobRun extracts RequestID from job runs response

func FundAddress

func FundAddress(client blockchain.EVMClient, sendingKey string, fundingToSendEth *big.Float) error

todo - move to CTF

func FundAddresses

func FundAddresses(blockchain blockchain.EVMClient, amount *big.Float, addresses ...string) error

FundAddresses will fund a list of addresses with an amount of native currency

func FundChainlinkNodes

func FundChainlinkNodes(
	nodes []*client.ChainlinkK8sClient,
	client blockchain.EVMClient,
	amount *big.Float,
) error

FundChainlinkNodes will fund all of the provided Chainlink nodes with a set amountCreateOCRv2Jobs of native currency Deprecated: we are moving away from blockchain.EVMClient, use actions_seth.FundChainlinkNodes

func FundChainlinkNodesAddress

func FundChainlinkNodesAddress(
	nodes []*client.ChainlinkK8sClient,
	client blockchain.EVMClient,
	amount *big.Float,
	keyIndex int,
) error

FundChainlinkNodesAddress will fund all of the provided Chainlink nodes address at given index with a set amount of native currency

func FundChainlinkNodesAddresses

func FundChainlinkNodesAddresses(
	nodes []*client.ChainlinkClient,
	client blockchain.EVMClient,
	amount *big.Float,
) error

FundChainlinkNodesAddress will fund all of the provided Chainlink nodes addresses with a set amount of native currency

func FundChainlinkNodesLink(
	nodes []*client.ChainlinkK8sClient,
	blockchain blockchain.EVMClient,
	linkToken contracts.LinkToken,
	linkAmount *big.Int,
) error

FundChainlinkNodes will fund all of the provided Chainlink nodes with a set amount of native currency

func FundChainlinkNodesLocal

func FundChainlinkNodesLocal(
	nodes []*client.ChainlinkClient,
	client blockchain.EVMClient,
	amount *big.Float,
) error

FundChainlinkNodesLocal will fund all the provided Chainlink nodes with a set amount of native currency

func GenerateWallet

func GenerateWallet() (common.Address, error)

todo - move to CTF

func GetMockserverInitializerDataForOTPE

func GetMockserverInitializerDataForOTPE(
	OCRInstances []contracts.OffchainAggregator,
	chainlinkNodes []*client.ChainlinkK8sClient,
) (interface{}, error)

GetMockserverInitializerDataForOTPE creates mocked weiwatchers data needed for otpe

func GetOracleIdentities

func GetOracleIdentities(chainlinkNodes []*client.ChainlinkK8sClient) ([]int, []confighelper.OracleIdentityExtra, error)

GetOracleIdentities retrieves all chainlink nodes' OCR2 config identities with defaul key index

func GetOracleIdentitiesWithKeyIndex

func GetOracleIdentitiesWithKeyIndex(
	chainlinkNodes []*client.ChainlinkK8sClient,
	keyIndex int,
) ([]int, []confighelper.OracleIdentityExtra, error)

GetOracleIdentitiesWithKeyIndex retrieves all chainlink nodes' OCR2 config identities by key index

func GetOracleIdentitiesWithKeyIndexLocal

func GetOracleIdentitiesWithKeyIndexLocal(
	chainlinkNodes []*client.ChainlinkClient,
	keyIndex int,
) ([]int, []confighelper.OracleIdentityExtra, error)

func GetRPCUrl

func GetRPCUrl(env *test_env.CLClusterTestEnv, chainID int64) (string, error)

func GetTxByHash

func GetTxByHash(ctx context.Context, client blockchain.EVMClient, hash common.Hash) (*types.Transaction, bool, error)

todo - move to CTF

func GetTxFromAddress

func GetTxFromAddress(tx *types.Transaction) (string, error)

todo - move to CTF

func ProcessNewEvent

func ProcessNewEvent(
	t *testing.T,
	operatorCreated chan *operator_factory.OperatorFactoryOperatorCreated,
	authorizedForwarderCreated chan *operator_factory.OperatorFactoryAuthorizedForwarderCreated,
	event *types.Log,
	eventDetails *abi.Event,
	operatorFactoryInstance contracts.OperatorFactory,
	chainClient blockchain.EVMClient,
)

func RegisterNewUpkeeps

func RegisterNewUpkeeps(
	t *testing.T,
	contractDeployer contracts.ContractDeployer,
	client blockchain.EVMClient,
	linkToken contracts.LinkToken,
	registry contracts.KeeperRegistry,
	registrar contracts.KeeperRegistrar,
	upkeepGasLimit uint32,
	numberOfNewUpkeeps int,
) ([]contracts.KeeperConsumer, []*big.Int)

RegisterNewUpkeeps registers the given amount of new upkeeps, using the registry and registrar which are passed as parameters. It returns the newly deployed contracts (consumers), as well as their upkeep IDs.

func RegisterUpkeepContracts

func RegisterUpkeepContracts(t *testing.T, linkToken contracts.LinkToken, linkFunds *big.Int, client blockchain.EVMClient, upkeepGasLimit uint32, registry contracts.KeeperRegistry, registrar contracts.KeeperRegistrar, numberOfContracts int, upkeepAddresses []string, isLogTrigger bool, isMercury bool) []*big.Int

func RegisterUpkeepContractsWithCheckData

func RegisterUpkeepContractsWithCheckData(t *testing.T, linkToken contracts.LinkToken, linkFunds *big.Int, client blockchain.EVMClient, upkeepGasLimit uint32, registry contracts.KeeperRegistry, registrar contracts.KeeperRegistrar, numberOfContracts int, upkeepAddresses []string, checkData [][]byte, isLogTrigger bool, isMercury bool) []*big.Int

func ReturnFunds

func ReturnFunds(chainlinkNodes []*client.ChainlinkK8sClient, blockchainClient blockchain.EVMClient) error

ReturnFunds attempts to return all the funds from the chainlink nodes to the network's default address all from a remote, k8s style environment

func RewindSimulatedChainToBlockNumber

func RewindSimulatedChainToBlockNumber(
	ctx context.Context,
	evmClient blockchain.EVMClient,
	rpcURL string,
	rewindChainToBlockNumber uint64,
	l zerolog.Logger,
) (uint64, error)

todo - move to EVMClient

func SetAdapterResponse

func SetAdapterResponse(
	response int,
	ocrInstance contracts.OffchainAggregator,
	chainlinkNode *client.ChainlinkK8sClient,
	mockserver *ctfClient.MockserverClient,
) error

SetAdapterResponse sets a single adapter response that correlates with an ocr contract and a chainlink node

func SetAdapterResponseLocal

func SetAdapterResponseLocal(
	response int,
	ocrInstance contracts.OffchainAggregator,
	chainlinkNode *client.ChainlinkClient,
	mockAdapter *test_env.Killgrave,
) error

func SetAllAdapterResponsesToDifferentValues

func SetAllAdapterResponsesToDifferentValues(
	responses []int,
	ocrInstances []contracts.OffchainAggregator,
	chainlinkNodes []*client.ChainlinkK8sClient,
	mockserver *ctfClient.MockserverClient,
) error

SetAllAdapterResponsesToDifferentValues sets the mock responses in mockserver that are read by chainlink nodes to simulate different adapters. This sets all adapter responses for each node and contract to different responses

func SetAllAdapterResponsesToTheSameValue

func SetAllAdapterResponsesToTheSameValue(
	response int,
	ocrInstances []contracts.OffchainAggregator,
	chainlinkNodes []*client.ChainlinkK8sClient,
	mockserver *ctfClient.MockserverClient,
) error

SetAllAdapterResponsesToTheSameValue sets the mock responses in mockserver that are read by chainlink nodes to simulate different adapters. This sets all adapter responses for each node and contract to the same response

func SetAllAdapterResponsesToTheSameValueLocal

func SetAllAdapterResponsesToTheSameValueLocal(
	response int,
	ocrInstances []contracts.OffchainAggregator,
	chainlinkNodes []*client.ChainlinkClient,
	mockAdapter *test_env.Killgrave,
) error

func SetChainlinkAPIPageSize

func SetChainlinkAPIPageSize(nodes []*client.ChainlinkK8sClient, pageSize int)

SetChainlinkAPIPageSize specifies the page size from the Chainlink API, useful for high volume testing

func SetOCR2AdapterResponse

func SetOCR2AdapterResponse(
	response int,
	ocrInstance contracts.OffchainAggregatorV2,
	chainlinkNode *client.ChainlinkK8sClient,
	mockserver *ctfClient.MockserverClient,
) error

SetOCR2AdapterResponse sets a single adapter response that correlates with an ocr contract and a chainlink node used for OCR2 tests

func SetOCR2AllAdapterResponsesToDifferentValues

func SetOCR2AllAdapterResponsesToDifferentValues(
	responses []int,
	ocrInstances []contracts.OffchainAggregatorV2,
	chainlinkNodes []*client.ChainlinkK8sClient,
	mockserver *ctfClient.MockserverClient,
) error

SetOCR2AllAdapterResponsesToDifferentValues sets the mock responses in mockserver that are read by chainlink nodes to simulate different adapters. This sets all adapter responses for each node and contract to different responses used for OCR2 tests

func SetOCR2AllAdapterResponsesToTheSameValue

func SetOCR2AllAdapterResponsesToTheSameValue(
	response int,
	ocrInstances []contracts.OffchainAggregatorV2,
	chainlinkNodes []*client.ChainlinkK8sClient,
	mockserver *ctfClient.MockserverClient,
) error

SetOCR2AllAdapterResponsesToTheSameValue sets the mock responses in mockserver that are read by chainlink nodes to simulate different adapters. This sets all adapter responses for each node and contract to the same response used for OCR2 tests

func StartNewOCR2Round

func StartNewOCR2Round(
	roundNumber int64,
	ocrInstances []contracts.OffchainAggregatorV2,
	client blockchain.EVMClient,
	timeout time.Duration,
	logger zerolog.Logger,
) error

StartNewOCR2Round requests a new round from the ocr2 contracts and waits for confirmation

func StartNewRound

func StartNewRound(
	roundNumber int64,
	ocrInstances []contracts.OffchainAggregator,
	client blockchain.EVMClient,
	logger zerolog.Logger,
) error

StartNewRound requests a new round from the ocr contracts and waits for confirmation Deprecated: we are moving away from blockchain.EVMClient, use actions_seth.StartNewRound

func SubscribeOperatorFactoryEvents

func SubscribeOperatorFactoryEvents(
	t *testing.T,
	authorizedForwarderCreated chan *operator_factory.OperatorFactoryAuthorizedForwarderCreated,
	operatorCreated chan *operator_factory.OperatorFactoryOperatorCreated,
	chainClient blockchain.EVMClient,
	operatorFactoryInstance contracts.OperatorFactory,
)

SubscribeOperatorFactoryEvents subscribes to the event log for authorizedForwarderCreated and operatorCreated events from OperatorFactory contract

func TeardownRemoteSuite

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

TeardownRemoteSuite is used when running a test within a remote-test-runner, like for long-running performance and soak tests Deprecated: we are moving away from blockchain.EVMClient, use actions_seth.TeardownRemoteSuite

func TeardownSuite

func TeardownSuite(
	t *testing.T,
	env *environment.Environment,
	chainlinkNodes []*client.ChainlinkK8sClient,
	optionalTestReporter testreporters.TestReporter,
	failingLogLevel zapcore.Level,
	grafnaUrlProvider testreporters.GrafanaURLProvider,
	clients ...blockchain.EVMClient,
) error

TeardownSuite tears down networks/clients and environment and creates a logs folder for failed tests in the specified path. Can also accept a testreporter (if one was used) to log further results

func TrackForwarder deprecated

func TrackForwarder(
	t *testing.T,
	chainClient blockchain.EVMClient,
	authorizedForwarder common.Address,
	node *client.ChainlinkK8sClient,
)

Deprecated: we are moving away from blockchain.EVMClient, use actions_seth.TrackForwarder

func TrackForwarderLocal

func TrackForwarderLocal(
	chainClient blockchain.EVMClient,
	authorizedForwarder common.Address,
	node *client.ChainlinkClient,
	logger zerolog.Logger,
) error

func UpgradeChainlinkNodeVersions

func UpgradeChainlinkNodeVersions(
	testEnvironment *environment.Environment,
	newImage, newVersion string,
	nodes ...*client.ChainlinkK8sClient,
) error

UpgradeChainlinkNodeVersions upgrades all Chainlink nodes to a new version, and then runs the test environment to apply the upgrades

func UpgradeChainlinkNodeVersionsLocal

func UpgradeChainlinkNodeVersionsLocal(
	newImage, newVersion string,
	nodes ...*test_env.ClNode,
) error

UpgradeChainlinkNodeVersions upgrades all Chainlink nodes to a new version, and then runs the test environment to apply the upgrades

func WaitForBlockNumberToBe

func WaitForBlockNumberToBe(
	waitForBlockNumberToBe uint64,
	client blockchain.EVMClient,
	wg *sync.WaitGroup,
	timeout time.Duration,
	t testing.TB,
) (uint64, error)

todo - move to EVMClient

func WatchNewOCR2Round

func WatchNewOCR2Round(
	roundNumber int64,
	ocrInstances []contracts.OffchainAggregatorV2,
	client blockchain.EVMClient,
	timeout time.Duration,
	logger zerolog.Logger,
) error

WatchNewOCR2Round is the same as StartNewOCR2Round but does NOT explicitly request a new round as that can cause odd behavior in tandem with changing adapter values in OCR2

func WatchNewRound

func WatchNewRound(
	roundNumber int64,
	ocrInstances []contracts.OffchainAggregator,
	client blockchain.EVMClient,
	logger zerolog.Logger,
) error

WatchNewRound 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 Deprecated: we are moving away from blockchain.EVMClient, use actions_seth.WatchNewRound

Types

type JsonRPCResponse

type JsonRPCResponse struct {
	Version string `json:"jsonrpc"`
	Id      int    `json:"id"`
	Result  string `json:"result,omitempty"`
	Error   string `json:"error,omitempty"`
}

type RPCRawClient

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

RPCRawClient created separate client since method evmClient.RawJsonRPCCall fails on "invalid argument 0: json: cannot unmarshal non-string into Go value of type hexutil.Uint64"

func NewRPCRawClient

func NewRPCRawClient(url string) *RPCRawClient

func (*RPCRawClient) SetHeadForSimulatedChain

func (g *RPCRawClient) SetHeadForSimulatedChain(setHeadToBlockNumber uint64) (JsonRPCResponse, error)

Directories

Path Synopsis
vrf

Jump to

Keyboard shortcuts

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