common

package
v0.0.0-...-692deea Latest Latest
Warning

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

Go to latest
Published: May 6, 2024 License: MIT Imports: 19 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	ErrGenericFormat             = "%s, err %w"
	ErrNodePrimaryKey            = "error getting node's primary ETH key"
	ErrNodeNewTxKey              = "error creating node's EVM transaction key"
	ErrCreatingProvingKeyHash    = "error creating a keyHash from the proving key"
	ErrRegisteringProvingKey     = "error registering a proving key on Coordinator contract"
	ErrRegisterProvingKey        = "error registering proving keys"
	ErrEncodingProvingKey        = "error encoding proving key"
	ErrDeployBlockHashStore      = "error deploying blockhash store"
	ErrDeployBatchBlockHashStore = "error deploying batch blockhash store"
	ErrDeployCoordinator         = "error deploying VRF CoordinatorV2"
	ErrABIEncodingFunding        = "error Abi encoding subscriptionID"
	ErrSendingLinkToken          = "error sending Link token"
	ErrCreatingBHSJob            = "error creating BHS job"
	ErrParseJob                  = "error parsing job definition"
	ErrSetVRFCoordinatorConfig   = "error setting config for VRF Coordinator contract"
	ErrCreateVRFSubscription     = "error creating VRF Subscription"
	ErrAddConsumerToSub          = "error adding consumer to VRF Subscription"
	ErrFundSubWithLinkToken      = "error funding subscription with Link tokens"
	ErrRestartCLNode             = "error restarting CL node"
	ErrWaitTXsComplete           = "error waiting for TXs to complete"
	ErrRequestRandomness         = "error requesting randomness"
	ErrLoadingCoordinator        = "error loading coordinator contract"
	ErrCreatingVRFKey            = "error creating VRF key"

	ErrWaitRandomWordsRequestedEvent = "error waiting for RandomWordsRequested event"
	ErrWaitRandomWordsFulfilledEvent = "error waiting for RandomWordsFulfilled event"
)

Variables

This section is empty.

Functions

func CreateAndFundSendingKeys

func CreateAndFundSendingKeys(
	client blockchain.EVMClient,
	node *VRFNode,
	chainlinkNodeFunding float64,
	numberOfNativeTokenAddressesToCreate int,
	chainID *big.Int,
) ([]string, error)

func CreateBHFJob

func CreateBHFJob(
	chainlinkNode *client.ChainlinkClient,
	bhfJobSpecConfig client.BlockHeaderFeederJobSpec,
) (*client.Job, error)

func CreateBHSJob

func CreateBHSJob(
	chainlinkNode *client.ChainlinkClient,
	bhsJobSpecConfig client.BlockhashStoreJobSpec,
) (*client.Job, error)

func CreateFundAndGetSendingKeys

func CreateFundAndGetSendingKeys(
	client blockchain.EVMClient,
	node *VRFNode,
	chainlinkNodeFunding float64,
	numberOfTxKeysToCreate int,
	chainID *big.Int,
) ([]string, []common.Address, error)

func CreateNodeTypeToNodeMap

func CreateNodeTypeToNodeMap(cluster *test_env.ClCluster, nodesToCreate []VRFNodeType) (map[VRFNodeType]*VRFNode, error)

func CreateVRFKeyOnVRFNode

func CreateVRFKeyOnVRFNode(vrfNode *VRFNode, l zerolog.Logger) (*client.VRFKey, string, error)

func FundNodesIfNeeded

func FundNodesIfNeeded(ctx context.Context, existingEnvConfig *vrf_common_config.ExistingEnvConfig, client blockchain.EVMClient, l zerolog.Logger) error

func LogFulfillmentDetailsLinkBilling

func LogFulfillmentDetailsLinkBilling(
	l zerolog.Logger,
	wrapperConsumerJuelsBalanceBeforeRequest *big.Int,
	wrapperConsumerJuelsBalanceAfterRequest *big.Int,
	consumerStatus vrfv2plus_wrapper_load_test_consumer.GetRequestStatus,
	randomWordsFulfilledEvent *contracts.CoordinatorRandomWordsFulfilled,
)

func LogFulfillmentDetailsNativeBilling

func LogFulfillmentDetailsNativeBilling(
	l zerolog.Logger,
	wrapperConsumerBalanceBeforeRequestWei *big.Int,
	wrapperConsumerBalanceAfterRequestWei *big.Int,
	consumerStatus vrfv2plus_wrapper_load_test_consumer.GetRequestStatus,
	randomWordsFulfilledEvent *contracts.CoordinatorRandomWordsFulfilled,
)

func LogRandomWordsForcedEvent

func LogRandomWordsForcedEvent(
	l zerolog.Logger,
	vrfOwner contracts.VRFOwner,
	randomWordsForcedEvent *vrf_owner.VRFOwnerRandomWordsForced,
)

func LogRandomWordsFulfilledEvent

func LogRandomWordsFulfilledEvent(
	l zerolog.Logger,
	coordinator contracts.Coordinator,
	randomWordsFulfilledEvent *contracts.CoordinatorRandomWordsFulfilled,
	isNativeBilling bool,
)

func LogRandomnessRequestedEvent

func LogRandomnessRequestedEvent(
	l zerolog.Logger,
	coordinator contracts.Coordinator,
	randomWordsRequestedEvent *contracts.CoordinatorRandomWordsRequested,
	isNativeBilling bool,
)

func LogSubDetails

func LogSubDetails(
	l zerolog.Logger,
	subscription contracts.Subscription,
	subID string,
	coordinator contracts.Coordinator,
)

func SetupBHFNode

func SetupBHFNode(
	env *test_env.CLClusterTestEnv,
	config *vrf_common_config.General,
	numberOfTxKeysToCreate int,
	chainID *big.Int,
	coordinatorAddress string,
	BHSAddress string,
	batchBHSAddress string,
	txKeyFunding float64,
	l zerolog.Logger,
	bhfNode *VRFNode,
) error

func SetupBHSNode

func SetupBHSNode(
	env *test_env.CLClusterTestEnv,
	config *vrf_common_config.General,
	numberOfTxKeysToCreate int,
	chainID *big.Int,
	coordinatorAddress string,
	BHSAddress string,
	txKeyFunding float64,
	l zerolog.Logger,
	bhsNode *VRFNode,
) error

func WaitForRequestCountEqualToFulfilmentCount

func WaitForRequestCountEqualToFulfilmentCount(
	ctx context.Context,
	consumer VRFLoadTestConsumer,
	timeout time.Duration,
	wg *sync.WaitGroup,
) (*big.Int, *big.Int, error)

Types

type NewEnvConfig

type NewEnvConfig struct {
	NodesToCreate          []VRFNodeType
	NumberOfTxKeysToCreate int
	UseVRFOwner            bool
	UseTestCoordinator     bool
}

type VRFContracts

type VRFContracts struct {
	CoordinatorV2     contracts.VRFCoordinatorV2
	CoordinatorV2Plus contracts.VRFCoordinatorV2_5
	VRFOwner          contracts.VRFOwner
	BHS               contracts.BlockHashStore
	BatchBHS          contracts.BatchBlockhashStore
	VRFV2Consumers    []contracts.VRFv2LoadTestConsumer
	VRFV2PlusConsumer []contracts.VRFv2PlusLoadTestConsumer
	LinkToken         contracts.LinkToken
	MockETHLINKFeed   contracts.VRFMockETHLINKFeed
}

type VRFEncodedProvingKey

type VRFEncodedProvingKey [2]*big.Int

type VRFJobSpecConfig

type VRFJobSpecConfig struct {
	ForwardingAllowed             bool
	CoordinatorAddress            string
	FromAddresses                 []string
	EVMChainID                    string
	MinIncomingConfirmations      int
	PublicKey                     string
	BatchFulfillmentEnabled       bool
	BatchFulfillmentGasMultiplier float64
	EstimateGasMultiplier         float64
	PollPeriod                    time.Duration
	RequestTimeout                time.Duration
	VRFOwnerConfig                *VRFOwnerConfig
	SimulationBlock               *string
}

type VRFKeyData

type VRFKeyData struct {
	VRFKey            *client.VRFKey
	EncodedProvingKey VRFEncodedProvingKey
	KeyHash           [32]byte
	PubKeyCompressed  string
}

VRFV2PlusKeyData defines a jobs into and proving key info

type VRFLoadTestConsumer

type VRFLoadTestConsumer interface {
	GetLoadTestMetrics(ctx context.Context) (*contracts.VRFLoadTestMetrics, error)
}

type VRFNode

type VRFNode struct {
	CLNode              *test_env.ClNode
	Job                 *client.Job
	TXKeyAddressStrings []string
}

type VRFNodeType

type VRFNodeType int
const (
	VRF VRFNodeType = iota + 1
	BHS
	BHF
)

func (VRFNodeType) Index

func (n VRFNodeType) Index() int

func (VRFNodeType) String

func (n VRFNodeType) String() string

type VRFOwnerConfig

type VRFOwnerConfig struct {
	OwnerAddress string
	UseVRFOwner  bool
}

Jump to

Keyboard shortcuts

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