actions

package
v0.10.12 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2021 License: MIT Imports: 21 Imported by: 1

Documentation

Overview

Package actions enables common chainlink interactions

Index

Constants

View Source
const (
	KeepEnvironmentsNever  = "never"
	KeepEnvironmentsOnFail = "onfail"
	KeepEnvironmentsAlways = "always"
)

Keep Environments options

Variables

This section is empty.

Functions

func ChainlinkNodeAddresses

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

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

func CheckRound added in v0.0.17

func CheckRound(i *OCRSetupInputs) func()

CheckRound checks the ocr rounds for correctness

func CreateOCRJobs added in v0.0.17

func CreateOCRJobs(i *OCRSetupInputs) func()

CreateOCRJobs bootstraps the first node and to the other nodes sends ocr jobs that read from different adapters

func DeployOCRContracts added in v0.0.17

func DeployOCRContracts(i *OCRSetupInputs, nrOfOCRContracts int) func()

DeployOCRContracts deploys and funds a certain number of offchain aggregator contracts

func DeployOCRForEnv added in v0.0.17

func DeployOCRForEnv(i *OCRSetupInputs, envInit environment.K8sEnvSpecInit) func()

DeployOCRForEnv deploys the environment

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 ExtractRequestIDFromJobRun added in v0.0.7

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

ExtractRequestIDFromJobRun extracts RequestID from job runs response

func FundChainlinkNodes

func FundChainlinkNodes(
	nodes []client.Chainlink,
	blockchain client.BlockchainClient,
	fromWallet client.BlockchainWallet,
	nativeAmount,
	linkAmount *big.Float,
) error

FundChainlinkNodes will fund all of the Chainlink nodes with a given amount of ETH in wei

func FundNodes added in v0.0.17

func FundNodes(i *OCRSetupInputs) func()

FundNodes funds all chainlink nodes

func GetMockserverInitializerDataForOTPE added in v0.0.17

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

GetMockserverInitializerDataForOTPE creates mocked weiwatchers data needed for otpe

func NewOCRSetupInputForAtlas added in v0.0.17

func NewOCRSetupInputForAtlas(i *OCRSetupInputs, nodeCount int, contractCount int)

NewOCRSetupInputForAtlas deploys and setups env and clients for testing atlas

func NewOCRSetupInputForObservability added in v0.0.17

func NewOCRSetupInputForObservability(i *OCRSetupInputs, nodeCount int, contractCount int, rules map[string]*os.File)

NewOCRSetupInputForObservability deploys and setups env and clients for testing observability

func SetAdapterResults added in v0.0.17

func SetAdapterResults(i *OCRSetupInputs, results []int)

SetAdapterResults sets the mock responses in mockserver that are read by chainlink nodes to simulate different adapters

func SetChainlinkAPIPageSize

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

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

func SetupRunlogEnv added in v0.0.17

func SetupRunlogEnv(i *RunlogSetupInputs) func()

SetupRunlogEnv does all the environment setup for a run log type test

func StartNewRound added in v0.0.17

func StartNewRound(i *OCRSetupInputs, roundNr int64)

StartNewRound requests a new round from the ocr contract and waits for confirmation

Types

type NetworkInfo added in v0.0.7

type NetworkInfo struct {
	Client   client.BlockchainClient
	Wallets  client.BlockchainWallets
	Deployer contracts.ContractDeployer
	Link     contracts.LinkToken
	Network  client.BlockchainNetwork
}

NetworkInfo helps delineate network information in a multi-network setup

func NewNetworkInfo added in v0.0.13

func NewNetworkInfo(
	network client.BlockchainNetwork,
	clientFunc hooks.NewClientHook,
	extDepFunc hooks.NewDeployerHook,
	env environment.Environment,
) (NetworkInfo, error)

NewNetworkInfo initializes the network's blockchain client and gathers all test-relevant network information

type OCRSetupInputs added in v0.0.17

type OCRSetupInputs struct {
	SuiteSetup     SuiteSetup
	NetworkInfo    NetworkInfo
	ChainlinkNodes []client.Chainlink
	DefaultWallet  client.BlockchainWallet
	OCRInstances   []contracts.OffchainAggregator
	Mockserver     *client.MockserverClient
}

OCRSetupInputs inputs needed for OCR tests

type RunlogSetupInputs added in v0.0.17

type RunlogSetupInputs struct {
	SuiteSetup    SuiteSetup
	NetworkInfo   NetworkInfo
	Adapter       environment.ExternalAdapter
	Nodes         []client.Chainlink
	NodeAddresses []common.Address
	Oracle        contracts.Oracle
	Consumer      contracts.APIConsumer
	JobUUID       uuid.UUID
	Err           error
}

RunlogSetupInputs inputs needed for a runlog test

type SingleNetworkSuiteSetup added in v0.0.7

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

SingleNetworkSuiteSetup holds the data for a default setup

func (*SingleNetworkSuiteSetup) Config added in v0.0.7

func (s *SingleNetworkSuiteSetup) Config() *config.Config

Config retrieves the general config for the suite

func (*SingleNetworkSuiteSetup) DefaultNetwork added in v0.0.7

func (s *SingleNetworkSuiteSetup) DefaultNetwork() NetworkInfo

DefaultNetwork returns the only network in a single network environment

func (*SingleNetworkSuiteSetup) Environment added in v0.0.7

Environment retrieves the general environment for the suite

func (*SingleNetworkSuiteSetup) Network added in v0.0.7

func (s *SingleNetworkSuiteSetup) Network(index int) (NetworkInfo, error)

Network returns the only network in a single network environment

func (*SingleNetworkSuiteSetup) Networks added in v0.0.7

func (s *SingleNetworkSuiteSetup) Networks() []NetworkInfo

Networks returns the only network in a single network environment

func (*SingleNetworkSuiteSetup) TearDown added in v0.0.7

func (s *SingleNetworkSuiteSetup) TearDown() func()

TearDown checks for test failure, writes logs if there is one, then tears down the test environment, based on the keep_environments config value

type SuiteSetup added in v0.0.7

type SuiteSetup interface {
	Config() *config.Config
	Environment() environment.Environment

	DefaultNetwork() NetworkInfo
	Network(index int) (NetworkInfo, error)
	Networks() []NetworkInfo

	TearDown() func()
}

SuiteSetup enables common use cases, and safe handling of different blockchain networks for test scenarios

func MultiNetworkSetup added in v0.0.7

func MultiNetworkSetup(
	initialDeployInitFunc environment.K8sEnvSpecInit,
	multiNetworkInitialization hooks.NewMultinetworkHook,
	deployerFunc hooks.NewDeployerHook,
	clientFunc hooks.NewClientHook,
	configPath string,
) (SuiteSetup, error)

MultiNetworkSetup enables testing across multiple networks

func SingleNetworkSetup added in v0.0.7

func SingleNetworkSetup(
	initialDeployInitFunc environment.K8sEnvSpecInit,
	initFunc hooks.NewNetworkHook,
	deployerFunc hooks.NewDeployerHook,
	clientFunc hooks.NewClientHook,
	configPath string,
) (SuiteSetup, error)

SingleNetworkSetup setup minimum required components for test

Jump to

Keyboard shortcuts

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